mirror of
https://github.com/EQEmu/Server.git
synced 2026-09-02 08:26:36 +00:00
Faction update
This commit is contained in:
+11
-19
@@ -3212,16 +3212,7 @@ bool ZoneDatabase::GetNPCFactionList(uint32 npcfaction_id, int32* faction_id, in
|
||||
bool ZoneDatabase::SetCharacterFactionLevel(uint32 char_id, int32 faction_id, int32 value, uint8 temp, faction_map &val_list)
|
||||
{
|
||||
|
||||
std::string query = StringFormat("DELETE FROM faction_values "
|
||||
"WHERE char_id=%i AND faction_id = %i",
|
||||
char_id, faction_id);
|
||||
auto results = QueryDatabase(query);
|
||||
if (!results.Success()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if(value == 0)
|
||||
return true;
|
||||
std::string query;
|
||||
|
||||
if(temp == 2)
|
||||
temp = 0;
|
||||
@@ -3229,17 +3220,18 @@ bool ZoneDatabase::SetCharacterFactionLevel(uint32 char_id, int32 faction_id, in
|
||||
if(temp == 3)
|
||||
temp = 1;
|
||||
|
||||
query = StringFormat("INSERT INTO faction_values (char_id, faction_id, current_value, temp) "
|
||||
"VALUES (%i, %i, %i, %i)", char_id, faction_id, value, temp);
|
||||
results = QueryDatabase(query);
|
||||
if (!results.Success()) {
|
||||
query = StringFormat("INSERT INTO `faction_values` "
|
||||
"(`char_id`, `faction_id`, `current_value`, `temp`) "
|
||||
"VALUES (%i, %i, %i, %i) "
|
||||
"ON DUPLICATE KEY UPDATE `current_value`=%i,`temp`=%i",
|
||||
char_id, faction_id, value, temp, value, temp);
|
||||
auto results = QueryDatabase(query);
|
||||
|
||||
if (!results.Success())
|
||||
return false;
|
||||
}
|
||||
else
|
||||
val_list[faction_id] = value;
|
||||
|
||||
if (results.RowsAffected() == 0)
|
||||
return false;
|
||||
|
||||
val_list[faction_id] = value;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user