simplify passing data around

This commit is contained in:
Aaron Kimbre
2022-12-24 14:25:31 -06:00
parent 3f3c5d9215
commit 6bf45cad39
6 changed files with 81 additions and 92 deletions

View File

@@ -61,6 +61,7 @@
#include "RacingControlComponent.h"
#include "RailActivatorComponent.h"
#include "LevelProgressionComponent.h"
#include "BuffComponent.h"
// Message includes:
#include "dZoneManager.h"
@@ -4437,39 +4438,34 @@ void GameMessages::SendVehicleNotifyFinishedRace(LWOOBJID objectId, const System
SEND_PACKET;
}
void GameMessages::SendAddBuff(LWOOBJID& objectID, const LWOOBJID& casterID, uint32_t buffID, uint32_t msDuration,
bool addImmunity, bool applyOnTeammates,
bool cancelOnDamaged, bool cancelOnDeath, bool cancelOnLogout, bool cancelOnRemoveBuff,
bool cancelOnUi, bool cancelOnUnequip, bool cancelOnZone, bool cancelOnDamageAbsDone,
bool useRefCount,
const SystemAddress& sysAddr) {
void GameMessages::SendAddBuff(LWOOBJID& target, Buff buff, const SystemAddress& sysAddr) {
CBITSTREAM;
CMSGHEADER;
bitStream.Write(objectID);
bitStream.Write(target);
bitStream.Write(GAME_MSG::GAME_MSG_ADD_BUFF);
bitStream.Write(false); // Added by teammate
bitStream.Write(applyOnTeammates);
bitStream.Write(cancelOnDamageAbsDone);
bitStream.Write(cancelOnDamaged);
bitStream.Write(cancelOnDeath);
bitStream.Write(cancelOnLogout);
bitStream.Write(buff.source != target); // If we were added by a teammate/someone else
bitStream.Write(buff.applyOnTeammates);
bitStream.Write(buff.cancelOnDamageAbsDone);
bitStream.Write(buff.cancelOnDamaged);
bitStream.Write(buff.cancelOnDeath);
bitStream.Write(buff.cancelOnLogout);
bitStream.Write(false); // Cancel on move
bitStream.Write(cancelOnRemoveBuff);
bitStream.Write(buff.cancelOnRemoveBuff);
bitStream.Write(cancelOnUi);
bitStream.Write(cancelOnUnequip);
bitStream.Write(cancelOnZone);
bitStream.Write(buff.cancelOnUi);
bitStream.Write(buff.cancelOnUnequip);
bitStream.Write(buff.cancelOnZone);
bitStream.Write(false); // Ignore immunities
bitStream.Write(addImmunity);
bitStream.Write(useRefCount);
bitStream.Write(buff.addImmunity);
bitStream.Write(buff.useRefCount);
bitStream.Write(buffID);
bitStream.Write(msDuration);
bitStream.Write(buff.id);
bitStream.Write(buff.duration * 1000); // needs to be in MS
bitStream.Write(casterID);
bitStream.Write(casterID);
bitStream.Write(buff.source);
bitStream.Write(buff.source);
if (sysAddr == UNASSIGNED_SYSTEM_ADDRESS) SEND_PACKET_BROADCAST;
SEND_PACKET;

View File

@@ -22,6 +22,7 @@ class NiPoint3;
enum class eUnequippableActiveType;
enum eInventoryType : uint32_t;
class Item;
struct Buff;
namespace GameMessages {
class PropertyDataMessage;
@@ -183,12 +184,7 @@ namespace GameMessages {
// The success or failure response sent back to the client will preserve the same value for localID.
void SendBBBSaveResponse(const LWOOBJID& objectId, const LWOOBJID& localID, unsigned char* buffer, uint32_t bufferSize, const SystemAddress& sysAddr);
void SendAddBuff(LWOOBJID& objectID, const LWOOBJID& casterID, uint32_t buffID, uint32_t msDuration,
bool addImmunity = false, bool applyOnTeammates = false,
bool cancelOnDamaged = false, bool cancelOnDeath = true,bool cancelOnLogout = false, bool cancelOnRemoveBuff = true,
bool cancelOnUi = false, bool cancelOnUnequip = false, bool cancelOnZone = false, bool cancelOnDamageAbsDone = false,
bool useRefCount = false,
const SystemAddress& sysAddr = UNASSIGNED_SYSTEM_ADDRESS);
void SendAddBuff(LWOOBJID& target, Buff buff, const SystemAddress& sysAddr = UNASSIGNED_SYSTEM_ADDRESS);
void SendToggleGMInvis(LWOOBJID objectId, bool enabled, const SystemAddress& sysAddr);