[General] Disable automatic sync for PlayerJournal and PlayerFaction

Simplify PlayerFaction packets by removing BOTH action
This commit is contained in:
David Cernat 2017-07-08 12:27:48 +03:00
parent 6dde0ca9c9
commit 4e74910fdb
5 changed files with 5 additions and 11 deletions

View file

@ -17,8 +17,6 @@ namespace mwmp
{ {
DEBUG_PRINTF(strPacketID.c_str()); DEBUG_PRINTF(strPacketID.c_str());
packet.Send(true);
Script::Call<Script::CallbackIdentity("OnPlayerFaction")>(player.getId()); Script::Call<Script::CallbackIdentity("OnPlayerFaction")>(player.getId());
} }
}; };

View file

@ -17,8 +17,6 @@ namespace mwmp
{ {
DEBUG_PRINTF(strPacketID.c_str()); DEBUG_PRINTF(strPacketID.c_str());
packet.Send(true);
Script::Call<Script::CallbackIdentity("OnPlayerJournal")>(player.getId()); Script::Call<Script::CallbackIdentity("OnPlayerJournal")>(player.getId());
} }
}; };

View file

@ -955,7 +955,7 @@ void LocalPlayer::setFactions()
if (!ptrNpcStats.isInFaction(faction.factionId)) if (!ptrNpcStats.isInFaction(faction.factionId))
ptrNpcStats.joinFaction(faction.factionId); ptrNpcStats.joinFaction(faction.factionId);
if (factionChanges.action == mwmp::FactionChanges::RANK || factionChanges.action == mwmp::FactionChanges::BOTH) if (factionChanges.action == mwmp::FactionChanges::RANK)
{ {
// While the faction rank is different in the packet than in the NpcStats, // While the faction rank is different in the packet than in the NpcStats,
// adjust the NpcStats accordingly // adjust the NpcStats accordingly
@ -967,8 +967,7 @@ void LocalPlayer::setFactions()
ptrNpcStats.lowerRank(faction.factionId); ptrNpcStats.lowerRank(faction.factionId);
} }
} }
else if (factionChanges.action == mwmp::FactionChanges::EXPULSION)
if (factionChanges.action == mwmp::FactionChanges::EXPULSION || factionChanges.action == mwmp::FactionChanges::BOTH)
{ {
// If the expelled state is different in the packet than in the NpcStats, // If the expelled state is different in the packet than in the NpcStats,
// adjust the NpcStats accordingly // adjust the NpcStats accordingly

View file

@ -91,8 +91,7 @@ namespace mwmp
enum FACTION_ACTION enum FACTION_ACTION
{ {
RANK = 0, RANK = 0,
EXPULSION = 1, EXPULSION = 1
BOTH = 2
}; };
int action; // 0 - Rank, 1 - Expulsion state, 2 - Both int action; // 0 - Rank, 1 - Expulsion state, 2 - Both

View file

@ -31,10 +31,10 @@ void PacketPlayerFaction::Packet(RakNet::BitStream *bs, bool send)
RW(faction.factionId, send, 1); RW(faction.factionId, send, 1);
if (player->factionChanges.action == FactionChanges::BOTH || player->factionChanges.action == FactionChanges::RANK) if (player->factionChanges.action == FactionChanges::RANK)
RW(faction.rank, send); RW(faction.rank, send);
if (player->factionChanges.action == FactionChanges::BOTH || player->factionChanges.action == FactionChanges::EXPULSION) if (player->factionChanges.action == FactionChanges::EXPULSION)
RW(faction.isExpelled, send); RW(faction.isExpelled, send);
if (!send) if (!send)