mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-13 18:51:29 +00:00
Changes to accomodate the new raw faction data.
This commit is contained in:
parent
cfbd8e727a
commit
688e37f108
@ -59,31 +59,31 @@ FACTION_VALUE CalculateFaction(FactionMods* fm, int32 tmpCharacter_value)
|
|||||||
if (fm) {
|
if (fm) {
|
||||||
character_value += fm->base + fm->class_mod + fm->race_mod + fm->deity_mod;
|
character_value += fm->base + fm->class_mod + fm->race_mod + fm->deity_mod;
|
||||||
}
|
}
|
||||||
if (character_value >= 1101) {
|
if (character_value >= 1100) {
|
||||||
return FACTION_ALLY;
|
return FACTION_ALLY;
|
||||||
}
|
}
|
||||||
if (character_value >= 701 && character_value <= 1100) {
|
if (character_value >= 750 && character_value <= 1099) {
|
||||||
return FACTION_WARMLY;
|
return FACTION_WARMLY;
|
||||||
}
|
}
|
||||||
if (character_value >= 401 && character_value <= 700) {
|
if (character_value >= 500 && character_value <= 749) {
|
||||||
return FACTION_KINDLY;
|
return FACTION_KINDLY;
|
||||||
}
|
}
|
||||||
if (character_value >= 101 && character_value <= 400) {
|
if (character_value >= 100 && character_value <= 499) {
|
||||||
return FACTION_AMIABLE;
|
return FACTION_AMIABLE;
|
||||||
}
|
}
|
||||||
if (character_value >= 0 && character_value <= 100) {
|
if (character_value >= 0 && character_value <= 99) {
|
||||||
return FACTION_INDIFFERENT;
|
return FACTION_INDIFFERENT;
|
||||||
}
|
}
|
||||||
if (character_value >= -100 && character_value <= -1) {
|
if (character_value >= -100 && character_value <= -1) {
|
||||||
return FACTION_APPREHENSIVE;
|
return FACTION_APPREHENSIVE;
|
||||||
}
|
}
|
||||||
if (character_value >= -700 && character_value <= -101) {
|
if (character_value >= -500 && character_value <= -101) {
|
||||||
return FACTION_DUBIOUS;
|
return FACTION_DUBIOUS;
|
||||||
}
|
}
|
||||||
if (character_value >= -999 && character_value <= -701) {
|
if (character_value >= -750 && character_value <= -501) {
|
||||||
return FACTION_THREATENLY;
|
return FACTION_THREATENLY;
|
||||||
}
|
}
|
||||||
if (character_value <= -1000) {
|
if (character_value <= -751) {
|
||||||
return FACTION_SCOWLS;
|
return FACTION_SCOWLS;
|
||||||
}
|
}
|
||||||
return FACTION_INDIFFERENT;
|
return FACTION_INDIFFERENT;
|
||||||
|
|||||||
4
common/faction.h
Normal file → Executable file
4
common/faction.h
Normal file → Executable file
@ -50,6 +50,8 @@ struct NPCFactionList {
|
|||||||
struct FactionMods
|
struct FactionMods
|
||||||
{
|
{
|
||||||
int32 base;
|
int32 base;
|
||||||
|
int16 min; // The lowest your personal earned faction can go - before race/class/diety adjustments.
|
||||||
|
int16 max; // The highest your personal earned faction can go - before race/class/diety adjustments.
|
||||||
int32 class_mod;
|
int32 class_mod;
|
||||||
int32 race_mod;
|
int32 race_mod;
|
||||||
int32 deity_mod;
|
int32 deity_mod;
|
||||||
@ -59,6 +61,8 @@ struct Faction {
|
|||||||
int32 id;
|
int32 id;
|
||||||
std::map<std::string, int16> mods;
|
std::map<std::string, int16> mods;
|
||||||
int16 base;
|
int16 base;
|
||||||
|
int16 min; // The lowest your personal earned faction can go - before race/class/diety adjustments.
|
||||||
|
int16 max; // The highest your personal earned faction can go - before race/class/diety adjustments.
|
||||||
char name[50];
|
char name[50];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@ -384,6 +384,8 @@
|
|||||||
9128|2018_08_13_inventory_version_update.sql|SHOW TABLES LIKE 'inventory_version'|not_empty|
|
9128|2018_08_13_inventory_version_update.sql|SHOW TABLES LIKE 'inventory_version'|not_empty|
|
||||||
9129|2018_08_13_inventory_update.sql|SHOW TABLES LIKE 'inventory_versions'|empty|
|
9129|2018_08_13_inventory_update.sql|SHOW TABLES LIKE 'inventory_versions'|empty|
|
||||||
9130|2018_11_25_name_filter_update.sql|SHOW COLUMNS FROM `name_filter` LIKE 'id'|empty|
|
9130|2018_11_25_name_filter_update.sql|SHOW COLUMNS FROM `name_filter` LIKE 'id'|empty|
|
||||||
|
9131|2018_12_12_client_faction_tables.sql|SHOW TABLES LIKE 'faction_base_data'|empty|
|
||||||
|
9132|2018_12_12_convert_to_client_functions.sql|SELECT `id` FROM `faction_list` WHERE `id` > 4999 |empty|
|
||||||
|
|
||||||
# Upgrade conditions:
|
# Upgrade conditions:
|
||||||
# This won't be needed after this system is implemented, but it is used database that are not
|
# This won't be needed after this system is implemented, but it is used database that are not
|
||||||
|
|||||||
22
zone/zonedb.cpp
Normal file → Executable file
22
zone/zonedb.cpp
Normal file → Executable file
@ -3901,6 +3901,8 @@ bool ZoneDatabase::GetFactionData(FactionMods* fm, uint32 class_mod, uint32 race
|
|||||||
}
|
}
|
||||||
|
|
||||||
fm->base = faction_array[faction_id]->base;
|
fm->base = faction_array[faction_id]->base;
|
||||||
|
fm->min = faction_array[faction_id]->min; // The lowest your personal earned faction can go - before race/class/diety adjustments.
|
||||||
|
fm->max = faction_array[faction_id]->max; // The highest your personal earned faction can go - before race/class/diety adjustments.
|
||||||
|
|
||||||
if(class_mod > 0) {
|
if(class_mod > 0) {
|
||||||
char str[32];
|
char str[32];
|
||||||
@ -4047,15 +4049,33 @@ bool ZoneDatabase::LoadFactionData()
|
|||||||
faction_array[index] = new Faction;
|
faction_array[index] = new Faction;
|
||||||
strn0cpy(faction_array[index]->name, row[1], 50);
|
strn0cpy(faction_array[index]->name, row[1], 50);
|
||||||
faction_array[index]->base = atoi(row[2]);
|
faction_array[index]->base = atoi(row[2]);
|
||||||
|
faction_array[index]->min = MIN_PERSONAL_FACTION;
|
||||||
|
faction_array[index]->max = MAX_PERSONAL_FACTION;
|
||||||
|
|
||||||
|
// Load in the mimimum and maximum faction that can be earned for this faction
|
||||||
|
query = StringFormat("SELECT `min` , `max` FROM `faction_base_data` WHERE client_faction_id = %u", index);
|
||||||
|
auto baseResults = QueryDatabase(query);
|
||||||
|
if (!baseResults.Success() || baseResults.RowCount() == 0) {
|
||||||
|
Log(Logs::General, Logs::General, "Faction %d has no base data", (int)index);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
for (auto modRow = baseResults.begin(); modRow != baseResults.end(); ++modRow) {
|
||||||
|
faction_array[index]->min = atoi(modRow[0]);
|
||||||
|
faction_array[index]->max = atoi(modRow[1]);
|
||||||
|
Log(Logs::General, Logs::None, "Min(%d), Max(%d) for faction (%u)",faction_array[index]->min, faction_array[index]->max, index);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Load in modifiers to the faction based on characters race, class and diety.
|
||||||
query = StringFormat("SELECT `mod`, `mod_name` FROM `faction_list_mod` WHERE faction_id = %u", index);
|
query = StringFormat("SELECT `mod`, `mod_name` FROM `faction_list_mod` WHERE faction_id = %u", index);
|
||||||
auto modResults = QueryDatabase(query);
|
auto modResults = QueryDatabase(query);
|
||||||
if (!modResults.Success())
|
if (!modResults.Success())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
for (auto modRow = modResults.begin(); modRow != modResults.end(); ++modRow)
|
for (auto modRow = modResults.begin(); modRow != modResults.end(); ++modRow) {
|
||||||
faction_array[index]->mods[modRow[1]] = atoi(modRow[0]);
|
faction_array[index]->mods[modRow[1]] = atoi(modRow[0]);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user