|
@@ -4293,6 +4293,17 @@ void ZoneServer::ProcessFaction(Spawn* spawn, Client* client)
|
|
|
|
|
|
if(player->GetFactions()->ShouldDecrease(spawn->GetFactionID()))
|
|
|
{
|
|
|
+ //make sure the player has discovered the faction before we do anything with it, otherwise add it.
|
|
|
+ bool hasfaction = database.VerifyFactionID(player->GetCharacterID(),spawn->GetFactionID());
|
|
|
+ if(hasfaction == 0) {
|
|
|
+ //they do not have the faction. Lets get the default value and feed it in.
|
|
|
+ sint32 defaultfaction = master_faction_list.GetDefaultFactionValue(spawn->GetFactionID());
|
|
|
+ //add the default faction for the player.
|
|
|
+ database.AddDefaultFaction(player->GetCharacterID(), spawn->GetFactionID(), defaultfaction);
|
|
|
+ //load the clients factions. without this it gets reset to -100 on character save.
|
|
|
+ database.LoadPlayerFactions(client);
|
|
|
+ }
|
|
|
+
|
|
|
update_result = player->GetFactions()->DecreaseFaction(spawn->GetFactionID());
|
|
|
faction = master_faction_list.GetFaction(spawn->GetFactionID());
|
|
|
|
|
@@ -4333,6 +4344,16 @@ void ZoneServer::ProcessFaction(Spawn* spawn, Client* client)
|
|
|
{
|
|
|
if(player->GetFactions()->ShouldDecrease(*itr))
|
|
|
{
|
|
|
+ bool hasfaction = database.VerifyFactionID(player->GetCharacterID(),spawn->GetFactionID());
|
|
|
+ if(hasfaction == 0) {
|
|
|
+ //they do not have the faction. Lets get the default value and feed it in.
|
|
|
+ sint32 defaultfaction = master_faction_list.GetDefaultFactionValue(spawn->GetFactionID());
|
|
|
+ //add the default faction for the player.
|
|
|
+ database.AddDefaultFaction(player->GetCharacterID(), spawn->GetFactionID(), defaultfaction);
|
|
|
+ //load the clients factions. without this it gets reset to -100 on character save.
|
|
|
+ database.LoadPlayerFactions(client);
|
|
|
+ }
|
|
|
+
|
|
|
update_result = player->GetFactions()->DecreaseFaction(*itr);
|
|
|
faction = master_faction_list.GetFaction(*itr);
|
|
|
|