mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2025-12-20 03:36:43 -06:00
Compare commits
7 Commits
revert-lxf
...
buffs
| Author | SHA1 | Date | |
|---|---|---|---|
| 6bf45cad39 | |||
| 3f3c5d9215 | |||
| b7ec08a8e2 | |||
| 4fee6d1bba | |||
| 8f9df9178a | |||
| 9e530b91d6 | |||
| 9b3c2f094f |
@@ -6,7 +6,9 @@
|
|||||||
|
|
||||||
|
|
||||||
void ApplyBuffBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bitStream, BehaviorBranchContext branch) {
|
void ApplyBuffBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bitStream, BehaviorBranchContext branch) {
|
||||||
auto* entity = EntityManager::Instance()->GetEntity(branch.target == LWOOBJID_EMPTY ? context->originator : branch.target);
|
branch.target == LWOOBJID_EMPTY ? context->originator : branch.target;
|
||||||
|
if (m_TargetCaster) branch.target = context->originator;
|
||||||
|
auto* entity = EntityManager::Instance()->GetEntity(branch.target);
|
||||||
|
|
||||||
if (entity == nullptr) return;
|
if (entity == nullptr) return;
|
||||||
|
|
||||||
@@ -14,11 +16,27 @@ void ApplyBuffBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bitS
|
|||||||
|
|
||||||
if (buffComponent == nullptr) return;
|
if (buffComponent == nullptr) return;
|
||||||
|
|
||||||
buffComponent->ApplyBuff(m_BuffId, m_Duration, context->originator, addImmunity, cancelOnDamaged, cancelOnDeath,
|
Buff buff;
|
||||||
cancelOnLogout, cancelonRemoveBuff, cancelOnUi, cancelOnUnequip, cancelOnZone);
|
buff.id = m_BuffId;
|
||||||
|
buff.duration = m_Duration;
|
||||||
|
buff.source = context->originator;
|
||||||
|
buff.addImmunity = m_AddImmunity;
|
||||||
|
buff.applyOnTeammates = m_ApplyOnTeammates;
|
||||||
|
buff.cancelOnDamaged = m_CancelOnDamaged;
|
||||||
|
buff.cancelOnDeath = m_CancelOnDeath;
|
||||||
|
buff.cancelOnLogout = m_CancelOnLogout;
|
||||||
|
buff.cancelOnRemoveBuff = m_CancelOnRemoveBuff;
|
||||||
|
buff.cancelOnUi = m_CancelOnUi;
|
||||||
|
buff.cancelOnUnequip = m_CancelOnUnequip;
|
||||||
|
buff.cancelOnZone = m_CancelOnZone;
|
||||||
|
buff.useRefCount = m_UseRefCount;
|
||||||
|
buff.cancelOnDamageAbsDone = m_CancelOnDamageAbsDone;
|
||||||
|
|
||||||
|
buffComponent->ApplyBuff(buff);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ApplyBuffBehavior::UnCast(BehaviorContext* context, BehaviorBranchContext branch) {
|
void ApplyBuffBehavior::UnCast(BehaviorContext* context, BehaviorBranchContext branch) {
|
||||||
|
if (m_IgnoreUncast) return;
|
||||||
auto* entity = EntityManager::Instance()->GetEntity(branch.target);
|
auto* entity = EntityManager::Instance()->GetEntity(branch.target);
|
||||||
|
|
||||||
if (entity == nullptr) return;
|
if (entity == nullptr) return;
|
||||||
@@ -37,12 +55,17 @@ void ApplyBuffBehavior::Calculate(BehaviorContext* context, RakNet::BitStream* b
|
|||||||
void ApplyBuffBehavior::Load() {
|
void ApplyBuffBehavior::Load() {
|
||||||
m_BuffId = GetInt("buff_id");
|
m_BuffId = GetInt("buff_id");
|
||||||
m_Duration = GetFloat("duration_secs");
|
m_Duration = GetFloat("duration_secs");
|
||||||
addImmunity = GetBoolean("add_immunity");
|
m_IgnoreUncast = GetBoolean("ignore_uncast", false);
|
||||||
cancelOnDamaged = GetBoolean("cancel_on_damaged");
|
m_TargetCaster = GetBoolean("target_caster", false);
|
||||||
cancelOnDeath = GetBoolean("cancel_on_death");
|
m_AddImmunity = GetBoolean("add_immunity", false);
|
||||||
cancelOnLogout = GetBoolean("cancel_on_logout");
|
m_ApplyOnTeammates = GetBoolean("apply_on_teammates", false);
|
||||||
cancelonRemoveBuff = GetBoolean("cancel_on_remove_buff");
|
m_CancelOnDamaged = GetBoolean("cancel_on_damaged", false);
|
||||||
cancelOnUi = GetBoolean("cancel_on_ui");
|
m_CancelOnDeath = GetBoolean("cancel_on_death", false);
|
||||||
cancelOnUnequip = GetBoolean("cancel_on_unequip");
|
m_CancelOnLogout = GetBoolean("cancel_on_logout", false);
|
||||||
cancelOnZone = GetBoolean("cancel_on_zone");
|
m_CancelOnRemoveBuff = GetBoolean("cancel_on_remove_buff", false);
|
||||||
|
m_CancelOnUi = GetBoolean("cancel_on_ui", false);
|
||||||
|
m_CancelOnUnequip = GetBoolean("cancel_on_unequip", false);
|
||||||
|
m_CancelOnZone = GetBoolean("cancel_on_zone", false);
|
||||||
|
m_CancelOnDamageAbsDone = GetBoolean("cancel_on_damage_abs_done", false);
|
||||||
|
m_UseRefCount = GetBoolean("use_ref_count", false);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,18 +7,7 @@
|
|||||||
class ApplyBuffBehavior final : public Behavior
|
class ApplyBuffBehavior final : public Behavior
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
int32_t m_BuffId;
|
/*
|
||||||
float m_Duration;
|
|
||||||
bool addImmunity;
|
|
||||||
bool cancelOnDamaged;
|
|
||||||
bool cancelOnDeath;
|
|
||||||
bool cancelOnLogout;
|
|
||||||
bool cancelonRemoveBuff;
|
|
||||||
bool cancelOnUi;
|
|
||||||
bool cancelOnUnequip;
|
|
||||||
bool cancelOnZone;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Inherited
|
* Inherited
|
||||||
*/
|
*/
|
||||||
explicit ApplyBuffBehavior(const uint32_t behaviorId) : Behavior(behaviorId) {
|
explicit ApplyBuffBehavior(const uint32_t behaviorId) : Behavior(behaviorId) {
|
||||||
@@ -31,4 +20,21 @@ public:
|
|||||||
void Calculate(BehaviorContext* context, RakNet::BitStream* bitStream, BehaviorBranchContext branch) override;
|
void Calculate(BehaviorContext* context, RakNet::BitStream* bitStream, BehaviorBranchContext branch) override;
|
||||||
|
|
||||||
void Load() override;
|
void Load() override;
|
||||||
|
|
||||||
|
private:
|
||||||
|
int32_t m_BuffId;
|
||||||
|
float m_Duration;
|
||||||
|
bool m_IgnoreUncast;
|
||||||
|
bool m_TargetCaster;
|
||||||
|
bool m_AddImmunity;
|
||||||
|
bool m_ApplyOnTeammates;
|
||||||
|
bool m_CancelOnDamaged;
|
||||||
|
bool m_CancelOnDeath;
|
||||||
|
bool m_CancelOnLogout;
|
||||||
|
bool m_CancelOnRemoveBuff;
|
||||||
|
bool m_CancelOnUi;
|
||||||
|
bool m_CancelOnUnequip;
|
||||||
|
bool m_CancelOnZone;
|
||||||
|
bool m_CancelOnDamageAbsDone;
|
||||||
|
bool m_UseRefCount;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -20,33 +20,58 @@ 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;
|
// apply buffs from previous sessions that are stored in the charxml
|
||||||
if (m_Buffs.empty()) {
|
if (bIsInitialUpdate) {
|
||||||
outBitStream->Write0();
|
// buffs
|
||||||
} else {
|
if (m_Buffs.empty()) {
|
||||||
outBitStream->Write1();
|
outBitStream->Write0(); // no buffs
|
||||||
outBitStream->Write<uint32_t>(m_Buffs.size());
|
} else {
|
||||||
|
outBitStream->Write1(); // we have some
|
||||||
|
outBitStream->Write<uint32_t>(m_Buffs.size());
|
||||||
|
|
||||||
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->Write0();
|
outBitStream->Write(buff.second.time);
|
||||||
outBitStream->Write0();
|
outBitStream->Write(buff.second.cancelOnDeath);
|
||||||
outBitStream->Write0();
|
outBitStream->Write(buff.second.cancelOnZone);
|
||||||
outBitStream->Write0();
|
outBitStream->Write(buff.second.cancelOnDamaged);
|
||||||
outBitStream->Write0();
|
outBitStream->Write(buff.second.cancelOnRemoveBuff);
|
||||||
outBitStream->Write0();
|
outBitStream->Write(buff.second.cancelOnUi);
|
||||||
outBitStream->Write0();
|
outBitStream->Write(buff.second.cancelOnLogout);
|
||||||
outBitStream->Write0();
|
outBitStream->Write(buff.second.cancelOnUnequip);
|
||||||
outBitStream->Write0();
|
outBitStream->Write(buff.second.cancelOnDamageAbsDone);
|
||||||
|
outBitStream->Write(buff.second.source != m_Parent->GetObjectID());
|
||||||
outBitStream->Write0();
|
outBitStream->Write(buff.second.applyOnTeammates);
|
||||||
outBitStream->Write0();
|
if (buff.second.source != m_Parent->GetObjectID()) outBitStream->Write(buff.second.source);
|
||||||
|
outBitStream->Write(buff.second.refcount);
|
||||||
outBitStream->Write<uint32_t>(0);
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
outBitStream->Write0();
|
// buff imunities
|
||||||
|
if (m_BuffImmunities.empty()) {
|
||||||
|
outBitStream->Write0(); // no buff immunities
|
||||||
|
} else {
|
||||||
|
outBitStream->Write1(); // we have some
|
||||||
|
outBitStream->Write<uint32_t>(m_BuffImmunities.size());
|
||||||
|
|
||||||
|
for (const auto& buffImmunity : m_BuffImmunities) {
|
||||||
|
outBitStream->Write<uint32_t>(buffImmunity.first);
|
||||||
|
outBitStream->Write(buffImmunity.second.time);
|
||||||
|
outBitStream->Write(buffImmunity.second.cancelOnDeath);
|
||||||
|
outBitStream->Write(buffImmunity.second.cancelOnZone);
|
||||||
|
outBitStream->Write(buffImmunity.second.cancelOnDamaged);
|
||||||
|
outBitStream->Write(buffImmunity.second.cancelOnRemoveBuff);
|
||||||
|
outBitStream->Write(buffImmunity.second.cancelOnUi);
|
||||||
|
outBitStream->Write(buffImmunity.second.cancelOnLogout);
|
||||||
|
outBitStream->Write(buffImmunity.second.cancelOnUnequip);
|
||||||
|
outBitStream->Write(buffImmunity.second.cancelOnDamageAbsDone);
|
||||||
|
outBitStream->Write(buffImmunity.second.source != m_Parent->GetObjectID());
|
||||||
|
outBitStream->Write(buffImmunity.second.applyOnTeammates);
|
||||||
|
if (buffImmunity.second.source != m_Parent->GetObjectID()) outBitStream->Write(buffImmunity.second.source);
|
||||||
|
outBitStream->Write(buffImmunity.second.refcount);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} // there is no update serilization, only on initialization
|
||||||
}
|
}
|
||||||
|
|
||||||
void BuffComponent::Update(float deltaTime) {
|
void BuffComponent::Update(float deltaTime) {
|
||||||
@@ -82,23 +107,17 @@ void BuffComponent::Update(float deltaTime) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void BuffComponent::ApplyBuff(const int32_t id, const float duration, const LWOOBJID source, bool addImmunity,
|
void BuffComponent::ApplyBuff(Buff buff) {
|
||||||
bool cancelOnDamaged, bool cancelOnDeath, bool cancelOnLogout, bool cancelOnRemoveBuff,
|
|
||||||
bool cancelOnUi, bool cancelOnUnequip, bool cancelOnZone) {
|
|
||||||
// Prevent buffs from stacking.
|
|
||||||
if (HasBuff(id)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
GameMessages::SendAddBuff(const_cast<LWOOBJID&>(m_Parent->GetObjectID()), source, (uint32_t)id,
|
if (HasBuff(buff.id) && HasBuffImmunity(buff.id)) return;
|
||||||
(uint32_t)duration * 1000, addImmunity, cancelOnDamaged, cancelOnDeath,
|
|
||||||
cancelOnLogout, cancelOnRemoveBuff, cancelOnUi, cancelOnUnequip, cancelOnZone);
|
GameMessages::SendAddBuff(const_cast<LWOOBJID&>(m_Parent->GetObjectID()), buff);
|
||||||
|
|
||||||
float tick = 0;
|
float tick = 0;
|
||||||
float stacks = 0;
|
float stacks = 0;
|
||||||
int32_t behaviorID = 0;
|
int32_t behaviorID = 0;
|
||||||
|
|
||||||
const auto& parameters = GetBuffParameters(id);
|
const auto& parameters = GetBuffParameters(buff.id);
|
||||||
for (const auto& parameter : parameters) {
|
for (const auto& parameter : parameters) {
|
||||||
if (parameter.name == "overtime") {
|
if (parameter.name == "overtime") {
|
||||||
auto* behaviorTemplateTable = CDClientManager::Instance()->GetTable<CDSkillBehaviorTable>("SkillBehavior");
|
auto* behaviorTemplateTable = CDClientManager::Instance()->GetTable<CDSkillBehaviorTable>("SkillBehavior");
|
||||||
@@ -106,22 +125,20 @@ void BuffComponent::ApplyBuff(const int32_t id, const float duration, const LWOO
|
|||||||
behaviorID = behaviorTemplateTable->GetSkillByID(parameter.values[0]).behaviorID;
|
behaviorID = behaviorTemplateTable->GetSkillByID(parameter.values[0]).behaviorID;
|
||||||
stacks = static_cast<int32_t>(parameter.values[1]);
|
stacks = static_cast<int32_t>(parameter.values[1]);
|
||||||
tick = parameter.values[2];
|
tick = parameter.values[2];
|
||||||
const auto unknown2 = parameter.values[3]; // Always 0
|
const auto unknown2 = parameter.values[3]; // TODO: figure this out it changed to all 1 in FT
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ApplyBuffEffect(id);
|
ApplyBuffEffect(buff.id);
|
||||||
|
|
||||||
Buff buff;
|
|
||||||
buff.id = id;
|
|
||||||
buff.time = duration;
|
|
||||||
buff.tick = tick;
|
buff.tick = tick;
|
||||||
buff.tickTime = tick;
|
buff.tickTime = tick;
|
||||||
buff.stacks = stacks;
|
buff.stacks = stacks;
|
||||||
buff.source = source;
|
|
||||||
buff.behaviorID = behaviorID;
|
buff.behaviorID = behaviorID;
|
||||||
|
|
||||||
m_Buffs.emplace(id, buff);
|
buff.refcount = 0;
|
||||||
|
if (buff.addImmunity) {
|
||||||
|
m_BuffImmunities.emplace(buff.id, buff);
|
||||||
|
} else m_Buffs.emplace(buff.id, buff);
|
||||||
}
|
}
|
||||||
|
|
||||||
void BuffComponent::RemoveBuff(int32_t id, bool fromUnEquip, bool removeImmunity) {
|
void BuffComponent::RemoveBuff(int32_t id, bool fromUnEquip, bool removeImmunity) {
|
||||||
@@ -142,6 +159,10 @@ bool BuffComponent::HasBuff(int32_t id) {
|
|||||||
return m_Buffs.find(id) != m_Buffs.end();
|
return m_Buffs.find(id) != m_Buffs.end();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool BuffComponent::HasBuffImmunity(int32_t id) {
|
||||||
|
return m_BuffImmunities.find(id) != m_BuffImmunities.end();
|
||||||
|
}
|
||||||
|
|
||||||
void BuffComponent::ApplyBuffEffect(int32_t id) {
|
void BuffComponent::ApplyBuffEffect(int32_t id) {
|
||||||
const auto& parameters = GetBuffParameters(id);
|
const auto& parameters = GetBuffParameters(id);
|
||||||
for (const auto& parameter : parameters) {
|
for (const auto& parameter : parameters) {
|
||||||
@@ -288,6 +309,7 @@ void BuffComponent::UpdateXml(tinyxml2::XMLDocument* doc) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (const auto& buff : m_Buffs) {
|
for (const auto& buff : m_Buffs) {
|
||||||
|
if (buff.second.cancelOnLogout || buff.second.cancelOnZone) continue;
|
||||||
auto* buffEntry = doc->NewElement("b");
|
auto* buffEntry = doc->NewElement("b");
|
||||||
|
|
||||||
buffEntry->SetAttribute("id", buff.first);
|
buffEntry->SetAttribute("id", buff.first);
|
||||||
|
|||||||
@@ -28,12 +28,27 @@ struct BuffParameter
|
|||||||
struct Buff
|
struct Buff
|
||||||
{
|
{
|
||||||
int32_t id = 0;
|
int32_t id = 0;
|
||||||
|
float duration = 0;
|
||||||
float time = 0;
|
float time = 0;
|
||||||
float tick = 0;
|
float tick = 0;
|
||||||
float tickTime = 0;
|
float tickTime = 0;
|
||||||
int32_t stacks = 0;
|
int32_t stacks = 0;
|
||||||
LWOOBJID source = 0;
|
LWOOBJID source = 0;
|
||||||
int32_t behaviorID = 0;
|
int32_t behaviorID = 0;
|
||||||
|
bool addImmunity = false;
|
||||||
|
bool applyOnTeammates = false;
|
||||||
|
bool cancelOnDamaged = false;
|
||||||
|
bool cancelOnDeath = false;
|
||||||
|
bool cancelOnLogout = false;
|
||||||
|
bool cancelOnRemoveBuff = false;
|
||||||
|
bool cancelOnDamageAbsDone = false;
|
||||||
|
bool cancelOnUi = false;
|
||||||
|
bool cancelOnUnequip = false;
|
||||||
|
bool cancelOnZone = false;
|
||||||
|
bool useRefCount = false;
|
||||||
|
|
||||||
|
uint32_t refcount = 0;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -59,21 +74,9 @@ public:
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Applies a buff to the parent entity
|
* Applies a buff to the parent entity
|
||||||
* @param id the id of the buff to apply
|
* @param buff the Buff to apply
|
||||||
* @param duration the duration of the buff in seconds
|
|
||||||
* @param source an optional source entity that cast the buff
|
|
||||||
* @param addImmunity client flag
|
|
||||||
* @param cancelOnDamaged client flag to indicate that the buff should disappear when damaged
|
|
||||||
* @param cancelOnDeath client flag to indicate that the buff should disappear when dying
|
|
||||||
* @param cancelOnLogout client flag to indicate that the buff should disappear when logging out
|
|
||||||
* @param cancelOnRemoveBuff client flag to indicate that the buff should disappear when a concrete GM to do so comes around
|
|
||||||
* @param cancelOnUi client flag to indicate that the buff should disappear when interacting with UI
|
|
||||||
* @param cancelOnUnequip client flag to indicate that the buff should disappear when the triggering item is unequipped
|
|
||||||
* @param cancelOnZone client flag to indicate that the buff should disappear when changing zones
|
|
||||||
*/
|
*/
|
||||||
void ApplyBuff(int32_t id, float duration, LWOOBJID source, bool addImmunity = false, bool cancelOnDamaged = false,
|
void ApplyBuff(Buff buff);
|
||||||
bool cancelOnDeath = true, bool cancelOnLogout = false, bool cancelOnRemoveBuff = true,
|
|
||||||
bool cancelOnUi = false, bool cancelOnUnequip = false, bool cancelOnZone = false);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Removes a buff from the parent entity, reversing its effects
|
* Removes a buff from the parent entity, reversing its effects
|
||||||
@@ -89,6 +92,14 @@ public:
|
|||||||
*/
|
*/
|
||||||
bool HasBuff(int32_t id);
|
bool HasBuff(int32_t id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns whether or not the entity has a buff immunity identified by `id`
|
||||||
|
* @param id the id of the buff immunity to find
|
||||||
|
* @return whether or not the entity has a buff with the specified id active
|
||||||
|
*/
|
||||||
|
bool HasBuffImmunity(int32_t id);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Applies the effects of the buffs on the entity, e.g.: changing armor, health, imag, etc.
|
* Applies the effects of the buffs on the entity, e.g.: changing armor, health, imag, etc.
|
||||||
* @param id the id of the buff effects to apply
|
* @param id the id of the buff effects to apply
|
||||||
@@ -129,6 +140,11 @@ private:
|
|||||||
*/
|
*/
|
||||||
std::map<int32_t, Buff> m_Buffs;
|
std::map<int32_t, Buff> m_Buffs;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The currently active buff immunities
|
||||||
|
*/
|
||||||
|
std::map<int32_t, Buff> m_BuffImmunities;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Parameters (=effects) for each buff
|
* Parameters (=effects) for each buff
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -61,6 +61,7 @@
|
|||||||
#include "RacingControlComponent.h"
|
#include "RacingControlComponent.h"
|
||||||
#include "RailActivatorComponent.h"
|
#include "RailActivatorComponent.h"
|
||||||
#include "LevelProgressionComponent.h"
|
#include "LevelProgressionComponent.h"
|
||||||
|
#include "BuffComponent.h"
|
||||||
|
|
||||||
// Message includes:
|
// Message includes:
|
||||||
#include "dZoneManager.h"
|
#include "dZoneManager.h"
|
||||||
@@ -4437,37 +4438,34 @@ void GameMessages::SendVehicleNotifyFinishedRace(LWOOBJID objectId, const System
|
|||||||
SEND_PACKET;
|
SEND_PACKET;
|
||||||
}
|
}
|
||||||
|
|
||||||
void GameMessages::SendAddBuff(LWOOBJID& objectID, const LWOOBJID& casterID, uint32_t buffID, uint32_t msDuration,
|
void GameMessages::SendAddBuff(LWOOBJID& target, Buff buff, const SystemAddress& sysAddr) {
|
||||||
bool addImmunity, bool cancelOnDamaged, bool cancelOnDeath, bool cancelOnLogout,
|
|
||||||
bool cancelOnRemoveBuff, bool cancelOnUi, bool cancelOnUnequip, bool cancelOnZone,
|
|
||||||
const SystemAddress& sysAddr) {
|
|
||||||
CBITSTREAM;
|
CBITSTREAM;
|
||||||
CMSGHEADER;
|
CMSGHEADER;
|
||||||
|
|
||||||
bitStream.Write(objectID);
|
bitStream.Write(target);
|
||||||
bitStream.Write(GAME_MSG::GAME_MSG_ADD_BUFF);
|
bitStream.Write(GAME_MSG::GAME_MSG_ADD_BUFF);
|
||||||
|
|
||||||
bitStream.Write(false); // Added by teammate
|
bitStream.Write(buff.source != target); // If we were added by a teammate/someone else
|
||||||
bitStream.Write(false); // Apply on teammates
|
bitStream.Write(buff.applyOnTeammates);
|
||||||
bitStream.Write(false); // Cancel on damage absorb ran out
|
bitStream.Write(buff.cancelOnDamageAbsDone);
|
||||||
bitStream.Write(cancelOnDamaged);
|
bitStream.Write(buff.cancelOnDamaged);
|
||||||
bitStream.Write(cancelOnDeath);
|
bitStream.Write(buff.cancelOnDeath);
|
||||||
bitStream.Write(cancelOnLogout);
|
bitStream.Write(buff.cancelOnLogout);
|
||||||
bitStream.Write(false); // Cancel on move
|
bitStream.Write(false); // Cancel on move
|
||||||
bitStream.Write(cancelOnRemoveBuff);
|
bitStream.Write(buff.cancelOnRemoveBuff);
|
||||||
|
|
||||||
bitStream.Write(cancelOnUi);
|
bitStream.Write(buff.cancelOnUi);
|
||||||
bitStream.Write(cancelOnUnequip);
|
bitStream.Write(buff.cancelOnUnequip);
|
||||||
bitStream.Write(cancelOnZone);
|
bitStream.Write(buff.cancelOnZone);
|
||||||
bitStream.Write(false); // Ignore immunities
|
bitStream.Write(false); // Ignore immunities
|
||||||
bitStream.Write(addImmunity);
|
bitStream.Write(buff.addImmunity);
|
||||||
bitStream.Write(false); // Use ref count
|
bitStream.Write(buff.useRefCount);
|
||||||
|
|
||||||
bitStream.Write(buffID);
|
bitStream.Write(buff.id);
|
||||||
bitStream.Write(msDuration);
|
bitStream.Write(buff.duration * 1000); // needs to be in MS
|
||||||
|
|
||||||
bitStream.Write(casterID);
|
bitStream.Write(buff.source);
|
||||||
bitStream.Write(casterID);
|
bitStream.Write(buff.source);
|
||||||
|
|
||||||
if (sysAddr == UNASSIGNED_SYSTEM_ADDRESS) SEND_PACKET_BROADCAST;
|
if (sysAddr == UNASSIGNED_SYSTEM_ADDRESS) SEND_PACKET_BROADCAST;
|
||||||
SEND_PACKET;
|
SEND_PACKET;
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ class NiPoint3;
|
|||||||
enum class eUnequippableActiveType;
|
enum class eUnequippableActiveType;
|
||||||
enum eInventoryType : uint32_t;
|
enum eInventoryType : uint32_t;
|
||||||
class Item;
|
class Item;
|
||||||
|
struct Buff;
|
||||||
|
|
||||||
namespace GameMessages {
|
namespace GameMessages {
|
||||||
class PropertyDataMessage;
|
class PropertyDataMessage;
|
||||||
@@ -183,10 +184,7 @@ namespace GameMessages {
|
|||||||
// The success or failure response sent back to the client will preserve the same value for localID.
|
// 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 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,
|
void SendAddBuff(LWOOBJID& target, Buff buff, const SystemAddress& sysAddr = UNASSIGNED_SYSTEM_ADDRESS);
|
||||||
bool addImmunity = false, bool cancelOnDamaged = false, bool cancelOnDeath = true,
|
|
||||||
bool cancelOnLogout = false, bool cancelOnRemoveBuff = true, bool cancelOnUi = false,
|
|
||||||
bool cancelOnUnequip = false, bool cancelOnZone = false, const SystemAddress& sysAddr = UNASSIGNED_SYSTEM_ADDRESS);
|
|
||||||
|
|
||||||
void SendToggleGMInvis(LWOOBJID objectId, bool enabled, const SystemAddress& sysAddr);
|
void SendToggleGMInvis(LWOOBJID objectId, bool enabled, const SystemAddress& sysAddr);
|
||||||
|
|
||||||
|
|||||||
@@ -1463,6 +1463,10 @@ void SlashCommandHandler::HandleChatCommand(const std::u16string& command, Entit
|
|||||||
|
|
||||||
if (chatCommand == "buff" && args.size() >= 2 && entity->GetGMLevel() >= GAME_MASTER_LEVEL_DEVELOPER) {
|
if (chatCommand == "buff" && args.size() >= 2 && entity->GetGMLevel() >= GAME_MASTER_LEVEL_DEVELOPER) {
|
||||||
auto* buffComponent = entity->GetComponent<BuffComponent>();
|
auto* buffComponent = entity->GetComponent<BuffComponent>();
|
||||||
|
if (!buffComponent) {
|
||||||
|
ChatPackets::SendSystemMessage(sysAddr, u"Error, no buff component.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
int32_t id = 0;
|
int32_t id = 0;
|
||||||
int32_t duration = 0;
|
int32_t duration = 0;
|
||||||
@@ -1477,9 +1481,10 @@ void SlashCommandHandler::HandleChatCommand(const std::u16string& command, Entit
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (buffComponent != nullptr) {
|
Buff buff;
|
||||||
buffComponent->ApplyBuff(id, duration, entity->GetObjectID());
|
buff.id = id;
|
||||||
}
|
buff.duration = duration;
|
||||||
|
buffComponent->ApplyBuff(buff);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -193,8 +193,8 @@ 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("", 33, &packet);
|
PacketUtils::WritePacketString("ninjago2", 33, &packet);
|
||||||
PacketUtils::WritePacketString("", 33, &packet);
|
PacketUtils::WritePacketString("", 33, &packet);
|
||||||
PacketUtils::WritePacketString("", 33, &packet);
|
PacketUtils::WritePacketString("", 33, &packet);
|
||||||
PacketUtils::WritePacketString("", 33, &packet);
|
PacketUtils::WritePacketString("", 33, &packet);
|
||||||
|
|||||||
Reference in New Issue
Block a user