fix the serilization

This commit is contained in:
Aaron Kimbre 2022-12-24 11:02:02 -06:00
parent 4fee6d1bba
commit b7ec08a8e2
3 changed files with 30 additions and 29 deletions

View File

@ -20,9 +20,7 @@ BuffComponent::~BuffComponent() {
} }
void BuffComponent::Serialize(RakNet::BitStream* outBitStream, bool bIsInitialUpdate, unsigned int& flags) { void BuffComponent::Serialize(RakNet::BitStream* outBitStream, bool bIsInitialUpdate, unsigned int& flags) {
if (!bIsInitialUpdate) return; if (bIsInitialUpdate) {
// if we have buffs
if (m_Buffs.empty()) { if (m_Buffs.empty()) {
outBitStream->Write0(); outBitStream->Write0();
} else { } else {
@ -31,25 +29,24 @@ void BuffComponent::Serialize(RakNet::BitStream* outBitStream, bool bIsInitialUp
for (const auto& buff : m_Buffs) { for (const auto& buff : m_Buffs) {
outBitStream->Write<uint32_t>(buff.first); outBitStream->Write<uint32_t>(buff.first);
outBitStream->Write(buff.second.time); // time left outBitStream->Write(buff.second.time);
outBitStream->Write(buff.second.cancelOnDeath); // cancel on death outBitStream->Write(buff.second.cancelOnDeath);
outBitStream->Write(buff.second.cancelOnZone); // cancel on zone outBitStream->Write(buff.second.cancelOnZone);
outBitStream->Write(buff.second.cancelOnDamaged); // cancel on damage outBitStream->Write(buff.second.cancelOnDamaged);
outBitStream->Write(buff.second.cancelOnRemoveBuff); // cancel on remove buff outBitStream->Write(buff.second.cancelOnRemoveBuff);
outBitStream->Write(buff.second.cancelOnUi); // cancel on UI outBitStream->Write(buff.second.cancelOnUi);
outBitStream->Write(buff.second.cancelOnLogout); // cancel on logout outBitStream->Write(buff.second.cancelOnLogout);
outBitStream->Write(buff.second.cancelOnUnequip); // cancel on unequip outBitStream->Write(buff.second.cancelOnUnequip);
outBitStream->Write0(); // cancel on damage asorb ran out outBitStream->Write(buff.second.cancelOnDamageAbsDone);
outBitStream->Write0(); // outBitStream->Write(addedByTeammate)
outBitStream->Write0(); // if added by team mate outBitStream->Write(buff.second.applyOnTeammates);
// teammate lwoobjid // if (addedByTeammate) outBitStream->Write(team mate lwoobjid);
outBitStream->Write0(); //apply on team mate outBitStream->Write(buff.second.refcount);
outBitStream->Write(buff.second.refcount); // ref_count
} }
} }
outBitStream->Write0(); // buff immunities outBitStream->Write0(); // buff immunities
}
} }
void BuffComponent::Update(float deltaTime) { void BuffComponent::Update(float deltaTime) {
@ -123,6 +120,7 @@ void BuffComponent::ApplyBuff(const int32_t id, const float duration, const LWOO
buff.source = source; buff.source = source;
buff.behaviorID = behaviorID; buff.behaviorID = behaviorID;
buff.addImmunity = addImmunity; buff.addImmunity = addImmunity;
buff.applyOnTeammates = applyOnTeammates;
buff.cancelOnDamaged = cancelOnDamaged; buff.cancelOnDamaged = cancelOnDamaged;
buff.cancelOnDeath = cancelOnDeath; buff.cancelOnDeath = cancelOnDeath;
buff.cancelOnLogout = cancelOnLogout; buff.cancelOnLogout = cancelOnLogout;
@ -131,7 +129,9 @@ void BuffComponent::ApplyBuff(const int32_t id, const float duration, const LWOO
buff.cancelOnUnequip = cancelOnUnequip; buff.cancelOnUnequip = cancelOnUnequip;
buff.cancelOnZone = cancelOnZone; buff.cancelOnZone = cancelOnZone;
buff.useRefCount = useRefCount; buff.useRefCount = useRefCount;
buff.refcount = 1; buff.cancelOnDamageAbsDone = cancelOnDamageAbsDone;
buff.refcount = 0;
m_Buffs.emplace(id, buff); m_Buffs.emplace(id, buff);
} }

View File

@ -35,6 +35,7 @@ struct Buff
LWOOBJID source = 0; LWOOBJID source = 0;
int32_t behaviorID = 0; int32_t behaviorID = 0;
bool addImmunity = false; bool addImmunity = false;
bool applyOnTeammates = false;
bool cancelOnDamaged = false; bool cancelOnDamaged = false;
bool cancelOnDeath = false; bool cancelOnDeath = false;
bool cancelOnLogout = false; bool cancelOnLogout = false;

View File

@ -193,7 +193,7 @@ void AuthPackets::SendLoginResponse(dServer* server, const SystemAddress& sysAdd
PacketUtils::WritePacketString("Talk_Like_A_Pirate", 33, &packet); PacketUtils::WritePacketString("Talk_Like_A_Pirate", 33, &packet);
// 7 unknown strings - perhaps other IP addresses? // gating strings
PacketUtils::WritePacketString("ninjago2", 33, &packet); PacketUtils::WritePacketString("ninjago2", 33, &packet);
PacketUtils::WritePacketString("", 33, &packet); PacketUtils::WritePacketString("", 33, &packet);
PacketUtils::WritePacketString("", 33, &packet); PacketUtils::WritePacketString("", 33, &packet);