mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2025-10-14 19:38:08 +00:00
Merge remote-tracking branch 'upstream/main' into PetFixes
This commit is contained in:
@@ -21,7 +21,7 @@
|
||||
#include "eMissionTaskType.h"
|
||||
#include "eMatchUpdate.h"
|
||||
#include "eConnectionType.h"
|
||||
#include "eChatInternalMessageType.h"
|
||||
#include "eChatMessageType.h"
|
||||
|
||||
#include "CDCurrencyTableTable.h"
|
||||
#include "CDActivityRewardsTable.h"
|
||||
@@ -501,7 +501,7 @@ void ActivityInstance::StartZone() {
|
||||
// only make a team if we have more than one participant
|
||||
if (participants.size() > 1) {
|
||||
CBITSTREAM;
|
||||
BitStreamUtils::WriteHeader(bitStream, eConnectionType::CHAT_INTERNAL, eChatInternalMessageType::CREATE_TEAM);
|
||||
BitStreamUtils::WriteHeader(bitStream, eConnectionType::CHAT, eChatMessageType::CREATE_TEAM);
|
||||
|
||||
bitStream.Write(leader->GetObjectID());
|
||||
bitStream.Write(m_Participants.size());
|
||||
|
@@ -45,20 +45,20 @@ BaseCombatAIComponent::BaseCombatAIComponent(Entity* parent, const uint32_t id):
|
||||
auto componentResult = componentQuery.execQuery();
|
||||
|
||||
if (!componentResult.eof()) {
|
||||
if (!componentResult.fieldIsNull(0))
|
||||
m_AggroRadius = componentResult.getFloatField(0);
|
||||
if (!componentResult.fieldIsNull("aggroRadius"))
|
||||
m_AggroRadius = componentResult.getFloatField("aggroRadius");
|
||||
|
||||
if (!componentResult.fieldIsNull(1))
|
||||
m_TetherSpeed = componentResult.getFloatField(1);
|
||||
if (!componentResult.fieldIsNull("tetherSpeed"))
|
||||
m_TetherSpeed = componentResult.getFloatField("tetherSpeed");
|
||||
|
||||
if (!componentResult.fieldIsNull(2))
|
||||
m_PursuitSpeed = componentResult.getFloatField(2);
|
||||
if (!componentResult.fieldIsNull("pursuitSpeed"))
|
||||
m_PursuitSpeed = componentResult.getFloatField("pursuitSpeed");
|
||||
|
||||
if (!componentResult.fieldIsNull(3))
|
||||
m_SoftTetherRadius = componentResult.getFloatField(3);
|
||||
if (!componentResult.fieldIsNull("softTetherRadius"))
|
||||
m_SoftTetherRadius = componentResult.getFloatField("softTetherRadius");
|
||||
|
||||
if (!componentResult.fieldIsNull(4))
|
||||
m_HardTetherRadius = componentResult.getFloatField(4);
|
||||
if (!componentResult.fieldIsNull("hardTetherRadius"))
|
||||
m_HardTetherRadius = componentResult.getFloatField("hardTetherRadius");
|
||||
}
|
||||
|
||||
componentResult.finalize();
|
||||
@@ -82,11 +82,11 @@ BaseCombatAIComponent::BaseCombatAIComponent(Entity* parent, const uint32_t id):
|
||||
auto result = skillQuery.execQuery();
|
||||
|
||||
while (!result.eof()) {
|
||||
const auto skillId = static_cast<uint32_t>(result.getIntField(0));
|
||||
const auto skillId = static_cast<uint32_t>(result.getIntField("skillID"));
|
||||
|
||||
const auto abilityCooldown = static_cast<float>(result.getFloatField(1));
|
||||
const auto abilityCooldown = static_cast<float>(result.getFloatField("cooldown"));
|
||||
|
||||
const auto behaviorId = static_cast<uint32_t>(result.getIntField(2));
|
||||
const auto behaviorId = static_cast<uint32_t>(result.getIntField("behaviorID"));
|
||||
|
||||
auto* behavior = Behavior::CreateBehavior(behaviorId);
|
||||
|
||||
@@ -150,13 +150,13 @@ void BaseCombatAIComponent::Update(const float deltaTime) {
|
||||
m_dpEntityEnemy->SetPosition(m_Parent->GetPosition());
|
||||
|
||||
//Process enter events
|
||||
for (auto en : m_dpEntity->GetNewObjects()) {
|
||||
m_Parent->OnCollisionPhantom(en->GetObjectID());
|
||||
for (const auto id : m_dpEntity->GetNewObjects()) {
|
||||
m_Parent->OnCollisionPhantom(id);
|
||||
}
|
||||
|
||||
//Process exit events
|
||||
for (auto en : m_dpEntity->GetRemovedObjects()) {
|
||||
m_Parent->OnCollisionLeavePhantom(en->GetObjectID());
|
||||
for (const auto id : m_dpEntity->GetRemovedObjects()) {
|
||||
m_Parent->OnCollisionLeavePhantom(id);
|
||||
}
|
||||
|
||||
// Check if we should stop the tether effect
|
||||
|
@@ -326,9 +326,9 @@ Entity* BuffComponent::GetParent() const {
|
||||
return m_Parent;
|
||||
}
|
||||
|
||||
void BuffComponent::LoadFromXml(tinyxml2::XMLDocument* doc) {
|
||||
void BuffComponent::LoadFromXml(const tinyxml2::XMLDocument& doc) {
|
||||
// Load buffs
|
||||
auto* dest = doc->FirstChildElement("obj")->FirstChildElement("dest");
|
||||
auto* dest = doc.FirstChildElement("obj")->FirstChildElement("dest");
|
||||
|
||||
// Make sure we have a clean buff element.
|
||||
auto* buffElement = dest->FirstChildElement("buff");
|
||||
@@ -386,15 +386,15 @@ void BuffComponent::LoadFromXml(tinyxml2::XMLDocument* doc) {
|
||||
}
|
||||
}
|
||||
|
||||
void BuffComponent::UpdateXml(tinyxml2::XMLDocument* doc) {
|
||||
void BuffComponent::UpdateXml(tinyxml2::XMLDocument& doc) {
|
||||
// Save buffs
|
||||
auto* dest = doc->FirstChildElement("obj")->FirstChildElement("dest");
|
||||
auto* dest = doc.FirstChildElement("obj")->FirstChildElement("dest");
|
||||
|
||||
// Make sure we have a clean buff element.
|
||||
auto* buffElement = dest->FirstChildElement("buff");
|
||||
|
||||
if (buffElement == nullptr) {
|
||||
buffElement = doc->NewElement("buff");
|
||||
buffElement = doc.NewElement("buff");
|
||||
|
||||
dest->LinkEndChild(buffElement);
|
||||
} else {
|
||||
@@ -402,7 +402,7 @@ void BuffComponent::UpdateXml(tinyxml2::XMLDocument* doc) {
|
||||
}
|
||||
|
||||
for (const auto& [id, buff] : m_Buffs) {
|
||||
auto* buffEntry = doc->NewElement("b");
|
||||
auto* buffEntry = doc.NewElement("b");
|
||||
// TODO: change this if to if (buff.cancelOnZone || buff.cancelOnLogout) handling at some point. No current way to differentiate between zone transfer and logout.
|
||||
if (buff.cancelOnZone) continue;
|
||||
|
||||
@@ -450,7 +450,7 @@ const std::vector<BuffParameter>& BuffComponent::GetBuffParameters(int32_t buffI
|
||||
param.value = result.getFloatField("NumberValue");
|
||||
param.effectId = result.getIntField("EffectID");
|
||||
|
||||
if (!result.fieldIsNull(3)) {
|
||||
if (!result.fieldIsNull("StringValue")) {
|
||||
std::istringstream stream(result.getStringField("StringValue"));
|
||||
std::string token;
|
||||
|
||||
|
@@ -57,9 +57,9 @@ public:
|
||||
|
||||
Entity* GetParent() const;
|
||||
|
||||
void LoadFromXml(tinyxml2::XMLDocument* doc) override;
|
||||
void LoadFromXml(const tinyxml2::XMLDocument& doc) override;
|
||||
|
||||
void UpdateXml(tinyxml2::XMLDocument* doc) override;
|
||||
void UpdateXml(tinyxml2::XMLDocument& doc) override;
|
||||
|
||||
void Serialize(RakNet::BitStream& outBitStream, bool bIsInitialUpdate) override;
|
||||
|
||||
|
@@ -186,9 +186,9 @@ void CharacterComponent::SetGMLevel(eGameMasterLevel gmlevel) {
|
||||
m_GMLevel = gmlevel;
|
||||
}
|
||||
|
||||
void CharacterComponent::LoadFromXml(tinyxml2::XMLDocument* doc) {
|
||||
void CharacterComponent::LoadFromXml(const tinyxml2::XMLDocument& doc) {
|
||||
|
||||
tinyxml2::XMLElement* character = doc->FirstChildElement("obj")->FirstChildElement("char");
|
||||
auto* character = doc.FirstChildElement("obj")->FirstChildElement("char");
|
||||
if (!character) {
|
||||
LOG("Failed to find char tag while loading XML!");
|
||||
return;
|
||||
@@ -299,8 +299,8 @@ void CharacterComponent::LoadFromXml(tinyxml2::XMLDocument* doc) {
|
||||
}
|
||||
}
|
||||
|
||||
void CharacterComponent::UpdateXml(tinyxml2::XMLDocument* doc) {
|
||||
tinyxml2::XMLElement* minifig = doc->FirstChildElement("obj")->FirstChildElement("mf");
|
||||
void CharacterComponent::UpdateXml(tinyxml2::XMLDocument& doc) {
|
||||
tinyxml2::XMLElement* minifig = doc.FirstChildElement("obj")->FirstChildElement("mf");
|
||||
if (!minifig) {
|
||||
LOG("Failed to find mf tag while updating XML!");
|
||||
return;
|
||||
@@ -320,7 +320,7 @@ void CharacterComponent::UpdateXml(tinyxml2::XMLDocument* doc) {
|
||||
|
||||
// done with minifig
|
||||
|
||||
tinyxml2::XMLElement* character = doc->FirstChildElement("obj")->FirstChildElement("char");
|
||||
tinyxml2::XMLElement* character = doc.FirstChildElement("obj")->FirstChildElement("char");
|
||||
if (!character) {
|
||||
LOG("Failed to find char tag while updating XML!");
|
||||
return;
|
||||
@@ -338,11 +338,11 @@ void CharacterComponent::UpdateXml(tinyxml2::XMLDocument* doc) {
|
||||
|
||||
// Set the zone statistics of the form <zs><s/> ... <s/></zs>
|
||||
auto zoneStatistics = character->FirstChildElement("zs");
|
||||
if (!zoneStatistics) zoneStatistics = doc->NewElement("zs");
|
||||
if (!zoneStatistics) zoneStatistics = doc.NewElement("zs");
|
||||
zoneStatistics->DeleteChildren();
|
||||
|
||||
for (auto pair : m_ZoneStatistics) {
|
||||
auto zoneStatistic = doc->NewElement("s");
|
||||
auto zoneStatistic = doc.NewElement("s");
|
||||
|
||||
zoneStatistic->SetAttribute("map", pair.first);
|
||||
zoneStatistic->SetAttribute("ac", pair.second.m_AchievementsCollected);
|
||||
|
@@ -70,8 +70,8 @@ public:
|
||||
CharacterComponent(Entity* parent, Character* character, const SystemAddress& systemAddress);
|
||||
~CharacterComponent() override;
|
||||
|
||||
void LoadFromXml(tinyxml2::XMLDocument* doc) override;
|
||||
void UpdateXml(tinyxml2::XMLDocument* doc) override;
|
||||
void LoadFromXml(const tinyxml2::XMLDocument& doc) override;
|
||||
void UpdateXml(tinyxml2::XMLDocument& doc) override;
|
||||
|
||||
void Serialize(RakNet::BitStream& outBitStream, bool bIsInitialUpdate) override;
|
||||
|
||||
|
@@ -21,11 +21,11 @@ void Component::OnUse(Entity* originator) {
|
||||
|
||||
}
|
||||
|
||||
void Component::UpdateXml(tinyxml2::XMLDocument* doc) {
|
||||
void Component::UpdateXml(tinyxml2::XMLDocument& doc) {
|
||||
|
||||
}
|
||||
|
||||
void Component::LoadFromXml(tinyxml2::XMLDocument* doc) {
|
||||
void Component::LoadFromXml(const tinyxml2::XMLDocument& doc) {
|
||||
|
||||
}
|
||||
|
||||
|
@@ -34,13 +34,13 @@ public:
|
||||
* Save data from this componennt to character XML
|
||||
* @param doc the document to write data to
|
||||
*/
|
||||
virtual void UpdateXml(tinyxml2::XMLDocument* doc);
|
||||
virtual void UpdateXml(tinyxml2::XMLDocument& doc);
|
||||
|
||||
/**
|
||||
* Load base data for this component from character XML
|
||||
* @param doc the document to read data from
|
||||
*/
|
||||
virtual void LoadFromXml(tinyxml2::XMLDocument* doc);
|
||||
virtual void LoadFromXml(const tinyxml2::XMLDocument& doc);
|
||||
|
||||
virtual void Serialize(RakNet::BitStream& outBitStream, bool isConstruction);
|
||||
|
||||
|
@@ -158,8 +158,8 @@ void ControllablePhysicsComponent::Serialize(RakNet::BitStream& outBitStream, bo
|
||||
}
|
||||
}
|
||||
|
||||
void ControllablePhysicsComponent::LoadFromXml(tinyxml2::XMLDocument* doc) {
|
||||
tinyxml2::XMLElement* character = doc->FirstChildElement("obj")->FirstChildElement("char");
|
||||
void ControllablePhysicsComponent::LoadFromXml(const tinyxml2::XMLDocument& doc) {
|
||||
auto* character = doc.FirstChildElement("obj")->FirstChildElement("char");
|
||||
if (!character) {
|
||||
LOG("Failed to find char tag!");
|
||||
return;
|
||||
@@ -178,8 +178,8 @@ void ControllablePhysicsComponent::LoadFromXml(tinyxml2::XMLDocument* doc) {
|
||||
m_DirtyPosition = true;
|
||||
}
|
||||
|
||||
void ControllablePhysicsComponent::UpdateXml(tinyxml2::XMLDocument* doc) {
|
||||
tinyxml2::XMLElement* character = doc->FirstChildElement("obj")->FirstChildElement("char");
|
||||
void ControllablePhysicsComponent::UpdateXml(tinyxml2::XMLDocument& doc) {
|
||||
tinyxml2::XMLElement* character = doc.FirstChildElement("obj")->FirstChildElement("char");
|
||||
if (!character) {
|
||||
LOG("Failed to find char tag while updating XML!");
|
||||
return;
|
||||
|
@@ -28,8 +28,8 @@ public:
|
||||
|
||||
void Update(float deltaTime) override;
|
||||
void Serialize(RakNet::BitStream& outBitStream, bool bIsInitialUpdate) override;
|
||||
void LoadFromXml(tinyxml2::XMLDocument* doc) override;
|
||||
void UpdateXml(tinyxml2::XMLDocument* doc) override;
|
||||
void LoadFromXml(const tinyxml2::XMLDocument& doc) override;
|
||||
void UpdateXml(tinyxml2::XMLDocument& doc) override;
|
||||
|
||||
/**
|
||||
* Sets the position of this entity, also ensures this update is serialized next tick.
|
||||
|
@@ -185,8 +185,8 @@ void DestroyableComponent::Update(float deltaTime) {
|
||||
m_DamageCooldownTimer -= deltaTime;
|
||||
}
|
||||
|
||||
void DestroyableComponent::LoadFromXml(tinyxml2::XMLDocument* doc) {
|
||||
tinyxml2::XMLElement* dest = doc->FirstChildElement("obj")->FirstChildElement("dest");
|
||||
void DestroyableComponent::LoadFromXml(const tinyxml2::XMLDocument& doc) {
|
||||
auto* dest = doc.FirstChildElement("obj")->FirstChildElement("dest");
|
||||
if (!dest) {
|
||||
LOG("Failed to find dest tag!");
|
||||
return;
|
||||
@@ -207,8 +207,8 @@ void DestroyableComponent::LoadFromXml(tinyxml2::XMLDocument* doc) {
|
||||
m_DirtyHealth = true;
|
||||
}
|
||||
|
||||
void DestroyableComponent::UpdateXml(tinyxml2::XMLDocument* doc) {
|
||||
tinyxml2::XMLElement* dest = doc->FirstChildElement("obj")->FirstChildElement("dest");
|
||||
void DestroyableComponent::UpdateXml(tinyxml2::XMLDocument& doc) {
|
||||
tinyxml2::XMLElement* dest = doc.FirstChildElement("obj")->FirstChildElement("dest");
|
||||
if (!dest) {
|
||||
LOG("Failed to find dest tag!");
|
||||
return;
|
||||
@@ -389,9 +389,9 @@ void DestroyableComponent::AddFaction(const int32_t factionID, const bool ignore
|
||||
|
||||
if (result.eof()) return;
|
||||
|
||||
if (result.fieldIsNull(0)) return;
|
||||
if (result.fieldIsNull("enemyList")) return;
|
||||
|
||||
const auto* list_string = result.getStringField(0);
|
||||
const auto* list_string = result.getStringField("enemyList");
|
||||
|
||||
std::stringstream ss(list_string);
|
||||
std::string token;
|
||||
|
@@ -26,8 +26,8 @@ public:
|
||||
|
||||
void Update(float deltaTime) override;
|
||||
void Serialize(RakNet::BitStream& outBitStream, bool bIsInitialUpdate) override;
|
||||
void LoadFromXml(tinyxml2::XMLDocument* doc) override;
|
||||
void UpdateXml(tinyxml2::XMLDocument* doc) override;
|
||||
void LoadFromXml(const tinyxml2::XMLDocument& doc) override;
|
||||
void UpdateXml(tinyxml2::XMLDocument& doc) override;
|
||||
|
||||
/**
|
||||
* Initializes the component using a different LOT
|
||||
|
@@ -38,7 +38,7 @@
|
||||
#include "CDObjectSkillsTable.h"
|
||||
#include "CDSkillBehaviorTable.h"
|
||||
|
||||
InventoryComponent::InventoryComponent(Entity* parent, tinyxml2::XMLDocument* document) : Component(parent) {
|
||||
InventoryComponent::InventoryComponent(Entity* parent) : Component(parent) {
|
||||
this->m_Dirty = true;
|
||||
this->m_Equipped = {};
|
||||
this->m_Pushed = {};
|
||||
@@ -48,7 +48,8 @@ InventoryComponent::InventoryComponent(Entity* parent, tinyxml2::XMLDocument* do
|
||||
const auto lot = parent->GetLOT();
|
||||
|
||||
if (lot == 1) {
|
||||
LoadXml(document);
|
||||
auto* character = m_Parent->GetCharacter();
|
||||
if (character) LoadXml(character->GetXMLDoc());
|
||||
|
||||
CheckProxyIntegrity();
|
||||
|
||||
@@ -472,10 +473,10 @@ bool InventoryComponent::HasSpaceForLoot(const std::unordered_map<LOT, int32_t>&
|
||||
return true;
|
||||
}
|
||||
|
||||
void InventoryComponent::LoadXml(tinyxml2::XMLDocument* document) {
|
||||
void InventoryComponent::LoadXml(const tinyxml2::XMLDocument& document) {
|
||||
LoadPetXml(document);
|
||||
|
||||
auto* inventoryElement = document->FirstChildElement("obj")->FirstChildElement("inv");
|
||||
auto* inventoryElement = document.FirstChildElement("obj")->FirstChildElement("inv");
|
||||
|
||||
if (inventoryElement == nullptr) {
|
||||
LOG("Failed to find 'inv' xml element!");
|
||||
@@ -594,10 +595,10 @@ void InventoryComponent::LoadXml(tinyxml2::XMLDocument* document) {
|
||||
}
|
||||
}
|
||||
|
||||
void InventoryComponent::UpdateXml(tinyxml2::XMLDocument* document) {
|
||||
void InventoryComponent::UpdateXml(tinyxml2::XMLDocument& document) {
|
||||
UpdatePetXml(document);
|
||||
|
||||
auto* inventoryElement = document->FirstChildElement("obj")->FirstChildElement("inv");
|
||||
auto* inventoryElement = document.FirstChildElement("obj")->FirstChildElement("inv");
|
||||
|
||||
if (inventoryElement == nullptr) {
|
||||
LOG("Failed to find 'inv' xml element!");
|
||||
@@ -631,7 +632,7 @@ void InventoryComponent::UpdateXml(tinyxml2::XMLDocument* document) {
|
||||
bags->DeleteChildren();
|
||||
|
||||
for (const auto* inventory : inventoriesToSave) {
|
||||
auto* bag = document->NewElement("b");
|
||||
auto* bag = document.NewElement("b");
|
||||
|
||||
bag->SetAttribute("t", inventory->GetType());
|
||||
bag->SetAttribute("m", static_cast<unsigned int>(inventory->GetSize()));
|
||||
@@ -654,14 +655,14 @@ void InventoryComponent::UpdateXml(tinyxml2::XMLDocument* document) {
|
||||
continue;
|
||||
}
|
||||
|
||||
auto* bagElement = document->NewElement("in");
|
||||
auto* bagElement = document.NewElement("in");
|
||||
|
||||
bagElement->SetAttribute("t", inventory->GetType());
|
||||
|
||||
for (const auto& pair : inventory->GetItems()) {
|
||||
auto* item = pair.second;
|
||||
|
||||
auto* itemElement = document->NewElement("i");
|
||||
auto* itemElement = document.NewElement("i");
|
||||
|
||||
itemElement->SetAttribute("l", item->GetLot());
|
||||
itemElement->SetAttribute("id", item->GetId());
|
||||
@@ -680,7 +681,7 @@ void InventoryComponent::UpdateXml(tinyxml2::XMLDocument* document) {
|
||||
continue;
|
||||
}
|
||||
|
||||
auto* extraInfo = document->NewElement("x");
|
||||
auto* extraInfo = document.NewElement("x");
|
||||
|
||||
extraInfo->SetAttribute("ma", data->GetString(false).c_str());
|
||||
|
||||
@@ -1093,7 +1094,7 @@ void InventoryComponent::CheckItemSet(const LOT lot) {
|
||||
auto result = query.execQuery();
|
||||
|
||||
while (!result.eof()) {
|
||||
const auto id = result.getIntField(0);
|
||||
const auto id = result.getIntField("setID");
|
||||
|
||||
bool found = false;
|
||||
|
||||
@@ -1542,8 +1543,8 @@ void InventoryComponent::PurgeProxies(Item* item) {
|
||||
}
|
||||
}
|
||||
|
||||
void InventoryComponent::LoadPetXml(tinyxml2::XMLDocument* document) {
|
||||
auto* petInventoryElement = document->FirstChildElement("obj")->FirstChildElement("pet");
|
||||
void InventoryComponent::LoadPetXml(const tinyxml2::XMLDocument& document) {
|
||||
auto* petInventoryElement = document.FirstChildElement("obj")->FirstChildElement("pet");
|
||||
|
||||
if (petInventoryElement == nullptr) {
|
||||
m_Pets.clear();
|
||||
@@ -1574,19 +1575,19 @@ void InventoryComponent::LoadPetXml(tinyxml2::XMLDocument* document) {
|
||||
}
|
||||
}
|
||||
|
||||
void InventoryComponent::UpdatePetXml(tinyxml2::XMLDocument* document) {
|
||||
auto* petInventoryElement = document->FirstChildElement("obj")->FirstChildElement("pet");
|
||||
void InventoryComponent::UpdatePetXml(tinyxml2::XMLDocument& document) {
|
||||
auto* petInventoryElement = document.FirstChildElement("obj")->FirstChildElement("pet");
|
||||
|
||||
if (petInventoryElement == nullptr) {
|
||||
petInventoryElement = document->NewElement("pet");
|
||||
petInventoryElement = document.NewElement("pet");
|
||||
|
||||
document->FirstChildElement("obj")->LinkEndChild(petInventoryElement);
|
||||
document.FirstChildElement("obj")->LinkEndChild(petInventoryElement);
|
||||
}
|
||||
|
||||
petInventoryElement->DeleteChildren();
|
||||
|
||||
for (const auto& pet : m_Pets) {
|
||||
auto* petElement = document->NewElement("p");
|
||||
auto* petElement = document.NewElement("p");
|
||||
|
||||
petElement->SetAttribute("id", pet.first);
|
||||
petElement->SetAttribute("l", pet.second.lot);
|
||||
|
@@ -38,12 +38,12 @@ enum class eItemType : int32_t;
|
||||
class InventoryComponent final : public Component {
|
||||
public:
|
||||
static constexpr eReplicaComponentType ComponentType = eReplicaComponentType::INVENTORY;
|
||||
explicit InventoryComponent(Entity* parent, tinyxml2::XMLDocument* document = nullptr);
|
||||
InventoryComponent(Entity* parent);
|
||||
|
||||
void Update(float deltaTime) override;
|
||||
void Serialize(RakNet::BitStream& outBitStream, bool bIsInitialUpdate) override;
|
||||
void LoadXml(tinyxml2::XMLDocument* document);
|
||||
void UpdateXml(tinyxml2::XMLDocument* document) override;
|
||||
void LoadXml(const tinyxml2::XMLDocument& document);
|
||||
void UpdateXml(tinyxml2::XMLDocument& document) override;
|
||||
|
||||
/**
|
||||
* Returns an inventory of the specified type, if it exists
|
||||
@@ -470,13 +470,13 @@ private:
|
||||
* Saves all the pet information stored in inventory items to the database
|
||||
* @param document the xml doc to save to
|
||||
*/
|
||||
void LoadPetXml(tinyxml2::XMLDocument* document);
|
||||
void LoadPetXml(const tinyxml2::XMLDocument& document);
|
||||
|
||||
/**
|
||||
* Loads all the pet information from an xml doc into items
|
||||
* @param document the xml doc to load from
|
||||
*/
|
||||
void UpdatePetXml(tinyxml2::XMLDocument* document);
|
||||
void UpdatePetXml(tinyxml2::XMLDocument& document);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@@ -13,8 +13,8 @@ LevelProgressionComponent::LevelProgressionComponent(Entity* parent) : Component
|
||||
m_CharacterVersion = eCharacterVersion::LIVE;
|
||||
}
|
||||
|
||||
void LevelProgressionComponent::UpdateXml(tinyxml2::XMLDocument* doc) {
|
||||
tinyxml2::XMLElement* level = doc->FirstChildElement("obj")->FirstChildElement("lvl");
|
||||
void LevelProgressionComponent::UpdateXml(tinyxml2::XMLDocument& doc) {
|
||||
tinyxml2::XMLElement* level = doc.FirstChildElement("obj")->FirstChildElement("lvl");
|
||||
if (!level) {
|
||||
LOG("Failed to find lvl tag while updating XML!");
|
||||
return;
|
||||
@@ -24,8 +24,8 @@ void LevelProgressionComponent::UpdateXml(tinyxml2::XMLDocument* doc) {
|
||||
level->SetAttribute("cv", static_cast<uint32_t>(m_CharacterVersion));
|
||||
}
|
||||
|
||||
void LevelProgressionComponent::LoadFromXml(tinyxml2::XMLDocument* doc) {
|
||||
tinyxml2::XMLElement* level = doc->FirstChildElement("obj")->FirstChildElement("lvl");
|
||||
void LevelProgressionComponent::LoadFromXml(const tinyxml2::XMLDocument& doc) {
|
||||
auto* level = doc.FirstChildElement("obj")->FirstChildElement("lvl");
|
||||
if (!level) {
|
||||
LOG("Failed to find lvl tag while loading XML!");
|
||||
return;
|
||||
|
@@ -27,13 +27,13 @@ public:
|
||||
* Save data from this componennt to character XML
|
||||
* @param doc the document to write data to
|
||||
*/
|
||||
void UpdateXml(tinyxml2::XMLDocument* doc) override;
|
||||
void UpdateXml(tinyxml2::XMLDocument& doc) override;
|
||||
|
||||
/**
|
||||
* Load base data for this component from character XML
|
||||
* @param doc the document to read data from
|
||||
*/
|
||||
void LoadFromXml(tinyxml2::XMLDocument* doc) override;
|
||||
void LoadFromXml(const tinyxml2::XMLDocument& doc) override;
|
||||
|
||||
/**
|
||||
* Gets the current level of the entity
|
||||
|
@@ -466,8 +466,8 @@ bool MissionComponent::RequiresItem(const LOT lot) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!result.fieldIsNull(0)) {
|
||||
const auto type = std::string(result.getStringField(0));
|
||||
if (!result.fieldIsNull("type")) {
|
||||
const auto type = std::string(result.getStringField("type"));
|
||||
|
||||
result.finalize();
|
||||
|
||||
@@ -504,10 +504,8 @@ bool MissionComponent::RequiresItem(const LOT lot) {
|
||||
}
|
||||
|
||||
|
||||
void MissionComponent::LoadFromXml(tinyxml2::XMLDocument* doc) {
|
||||
if (doc == nullptr) return;
|
||||
|
||||
auto* mis = doc->FirstChildElement("obj")->FirstChildElement("mis");
|
||||
void MissionComponent::LoadFromXml(const tinyxml2::XMLDocument& doc) {
|
||||
auto* mis = doc.FirstChildElement("obj")->FirstChildElement("mis");
|
||||
|
||||
if (mis == nullptr) return;
|
||||
|
||||
@@ -523,7 +521,7 @@ void MissionComponent::LoadFromXml(tinyxml2::XMLDocument* doc) {
|
||||
|
||||
auto* mission = new Mission(this, missionId);
|
||||
|
||||
mission->LoadFromXml(doneM);
|
||||
mission->LoadFromXml(*doneM);
|
||||
|
||||
doneM = doneM->NextSiblingElement();
|
||||
|
||||
@@ -540,7 +538,7 @@ void MissionComponent::LoadFromXml(tinyxml2::XMLDocument* doc) {
|
||||
|
||||
auto* mission = new Mission(this, missionId);
|
||||
|
||||
mission->LoadFromXml(currentM);
|
||||
mission->LoadFromXml(*currentM);
|
||||
|
||||
if (currentM->QueryAttribute("o", &missionOrder) == tinyxml2::XML_SUCCESS && mission->IsMission()) {
|
||||
mission->SetUniqueMissionOrderID(missionOrder);
|
||||
@@ -554,25 +552,23 @@ void MissionComponent::LoadFromXml(tinyxml2::XMLDocument* doc) {
|
||||
}
|
||||
|
||||
|
||||
void MissionComponent::UpdateXml(tinyxml2::XMLDocument* doc) {
|
||||
if (doc == nullptr) return;
|
||||
|
||||
void MissionComponent::UpdateXml(tinyxml2::XMLDocument& doc) {
|
||||
auto shouldInsertMis = false;
|
||||
|
||||
auto* obj = doc->FirstChildElement("obj");
|
||||
auto* obj = doc.FirstChildElement("obj");
|
||||
|
||||
auto* mis = obj->FirstChildElement("mis");
|
||||
|
||||
if (mis == nullptr) {
|
||||
mis = doc->NewElement("mis");
|
||||
mis = doc.NewElement("mis");
|
||||
|
||||
shouldInsertMis = true;
|
||||
}
|
||||
|
||||
mis->DeleteChildren();
|
||||
|
||||
auto* done = doc->NewElement("done");
|
||||
auto* cur = doc->NewElement("cur");
|
||||
auto* done = doc.NewElement("done");
|
||||
auto* cur = doc.NewElement("cur");
|
||||
|
||||
for (const auto& pair : m_Missions) {
|
||||
auto* mission = pair.second;
|
||||
@@ -580,10 +576,10 @@ void MissionComponent::UpdateXml(tinyxml2::XMLDocument* doc) {
|
||||
if (mission) {
|
||||
const auto complete = mission->IsComplete();
|
||||
|
||||
auto* m = doc->NewElement("m");
|
||||
auto* m = doc.NewElement("m");
|
||||
|
||||
if (complete) {
|
||||
mission->UpdateXml(m);
|
||||
mission->UpdateXml(*m);
|
||||
|
||||
done->LinkEndChild(m);
|
||||
|
||||
@@ -591,7 +587,7 @@ void MissionComponent::UpdateXml(tinyxml2::XMLDocument* doc) {
|
||||
}
|
||||
if (mission->IsMission()) m->SetAttribute("o", mission->GetUniqueMissionOrderID());
|
||||
|
||||
mission->UpdateXml(m);
|
||||
mission->UpdateXml(*m);
|
||||
|
||||
cur->LinkEndChild(m);
|
||||
}
|
||||
|
@@ -31,8 +31,8 @@ public:
|
||||
explicit MissionComponent(Entity* parent);
|
||||
~MissionComponent() override;
|
||||
void Serialize(RakNet::BitStream& outBitStream, bool bIsInitialUpdate, unsigned int& flags);
|
||||
void LoadFromXml(tinyxml2::XMLDocument* doc) override;
|
||||
void UpdateXml(tinyxml2::XMLDocument* doc) override;
|
||||
void LoadFromXml(const tinyxml2::XMLDocument& doc) override;
|
||||
void UpdateXml(tinyxml2::XMLDocument& doc) override;
|
||||
|
||||
/**
|
||||
* Returns all the missions for this entity, mapped by mission ID
|
||||
|
@@ -215,20 +215,20 @@ void PetComponent::OnUse(Entity* originator) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (result.fieldIsNull(0)) {
|
||||
if (result.fieldIsNull("ValidPiecesLXF")) {
|
||||
result.finalize();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
buildFile = std::string(result.getStringField(0));
|
||||
buildFile = std::string(result.getStringField("ValidPiecesLXF"));
|
||||
|
||||
PetPuzzleData data;
|
||||
data.buildFile = buildFile;
|
||||
data.puzzleModelLot = result.getIntField(1);
|
||||
data.timeLimit = result.getFloatField(2);
|
||||
data.numValidPieces = result.getIntField(3);
|
||||
data.imaginationCost = result.getIntField(4);
|
||||
data.puzzleModelLot = result.getIntField("PuzzleModelLot");
|
||||
data.timeLimit = result.getFloatField("Timelimit");
|
||||
data.numValidPieces = result.getIntField("NumValidPieces");
|
||||
data.imaginationCost = result.getIntField("imagCostPerBuild");
|
||||
if (data.timeLimit <= 0) data.timeLimit = 60;
|
||||
imaginationCost = data.imaginationCost;
|
||||
|
||||
|
@@ -187,7 +187,7 @@ PhantomPhysicsComponent::PhantomPhysicsComponent(Entity* parent) : PhysicsCompon
|
||||
//add fallback cube:
|
||||
m_dpEntity = new dpEntity(m_Parent->GetObjectID(), 2.0f, 2.0f, 2.0f);
|
||||
}
|
||||
|
||||
|
||||
m_dpEntity->SetScale(m_Scale);
|
||||
m_dpEntity->SetRotation(m_Rotation);
|
||||
m_dpEntity->SetPosition(m_Position);
|
||||
@@ -323,14 +323,13 @@ void PhantomPhysicsComponent::Update(float deltaTime) {
|
||||
if (!m_dpEntity) return;
|
||||
|
||||
//Process enter events
|
||||
for (auto en : m_dpEntity->GetNewObjects()) {
|
||||
if (!en) continue;
|
||||
ApplyCollisionEffect(en->GetObjectID(), m_EffectType, m_DirectionalMultiplier);
|
||||
m_Parent->OnCollisionPhantom(en->GetObjectID());
|
||||
for (const auto id : m_dpEntity->GetNewObjects()) {
|
||||
ApplyCollisionEffect(id, m_EffectType, m_DirectionalMultiplier);
|
||||
m_Parent->OnCollisionPhantom(id);
|
||||
|
||||
//If we are a respawn volume, inform the client:
|
||||
if (m_IsRespawnVolume) {
|
||||
auto entity = Game::entityManager->GetEntity(en->GetObjectID());
|
||||
auto* const entity = Game::entityManager->GetEntity(id);
|
||||
|
||||
if (entity) {
|
||||
GameMessages::SendPlayerReachedRespawnCheckpoint(entity, m_RespawnPos, m_RespawnRot);
|
||||
@@ -341,10 +340,9 @@ void PhantomPhysicsComponent::Update(float deltaTime) {
|
||||
}
|
||||
|
||||
//Process exit events
|
||||
for (auto en : m_dpEntity->GetRemovedObjects()) {
|
||||
if (!en) continue;
|
||||
ApplyCollisionEffect(en->GetObjectID(), m_EffectType, 1.0f);
|
||||
m_Parent->OnCollisionLeavePhantom(en->GetObjectID());
|
||||
for (const auto id : m_dpEntity->GetRemovedObjects()) {
|
||||
ApplyCollisionEffect(id, m_EffectType, 1.0f);
|
||||
m_Parent->OnCollisionLeavePhantom(id);
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -18,8 +18,8 @@ PossessableComponent::PossessableComponent(Entity* parent, uint32_t componentId)
|
||||
|
||||
// Should a result not exist for this default to attached visible
|
||||
if (!result.eof()) {
|
||||
m_PossessionType = static_cast<ePossessionType>(result.getIntField(0, 1)); // Default to Attached Visible
|
||||
m_DepossessOnHit = static_cast<bool>(result.getIntField(1, 0));
|
||||
m_PossessionType = static_cast<ePossessionType>(result.getIntField("possessionType", 1)); // Default to Attached Visible
|
||||
m_DepossessOnHit = static_cast<bool>(result.getIntField("depossessOnHit", 0));
|
||||
} else {
|
||||
m_PossessionType = ePossessionType::ATTACHED_VISIBLE;
|
||||
m_DepossessOnHit = false;
|
||||
|
@@ -49,11 +49,11 @@ PropertyManagementComponent::PropertyManagementComponent(Entity* parent) : Compo
|
||||
|
||||
auto result = query.execQuery();
|
||||
|
||||
if (result.eof() || result.fieldIsNull(0)) {
|
||||
if (result.eof() || result.fieldIsNull("id")) {
|
||||
return;
|
||||
}
|
||||
|
||||
templateId = result.getIntField(0);
|
||||
templateId = result.getIntField("id");
|
||||
|
||||
auto propertyInfo = Database::Get()->GetPropertyInfo(zoneId, cloneId);
|
||||
|
||||
@@ -105,7 +105,7 @@ std::vector<NiPoint3> PropertyManagementComponent::GetPaths() const {
|
||||
|
||||
std::vector<float> points;
|
||||
|
||||
std::istringstream stream(result.getStringField(0));
|
||||
std::istringstream stream(result.getStringField("path"));
|
||||
std::string token;
|
||||
|
||||
while (std::getline(stream, token, ' ')) {
|
||||
@@ -352,16 +352,11 @@ void PropertyManagementComponent::UpdateModelPosition(const LWOOBJID id, const N
|
||||
|
||||
auto* spawner = Game::zoneManager->GetSpawner(spawnerId);
|
||||
|
||||
auto ldfModelBehavior = new LDFData<LWOOBJID>(u"modelBehaviors", 0);
|
||||
auto userModelID = new LDFData<LWOOBJID>(u"userModelID", info.spawnerID);
|
||||
auto modelType = new LDFData<int>(u"modelType", 2);
|
||||
auto propertyObjectID = new LDFData<bool>(u"propertyObjectID", true);
|
||||
auto componentWhitelist = new LDFData<int>(u"componentWhitelist", 1);
|
||||
info.nodes[0]->config.push_back(componentWhitelist);
|
||||
info.nodes[0]->config.push_back(ldfModelBehavior);
|
||||
info.nodes[0]->config.push_back(modelType);
|
||||
info.nodes[0]->config.push_back(propertyObjectID);
|
||||
info.nodes[0]->config.push_back(userModelID);
|
||||
info.nodes[0]->config.push_back(new LDFData<LWOOBJID>(u"modelBehaviors", 0));
|
||||
info.nodes[0]->config.push_back(new LDFData<LWOOBJID>(u"userModelID", info.spawnerID));
|
||||
info.nodes[0]->config.push_back(new LDFData<int>(u"modelType", 2));
|
||||
info.nodes[0]->config.push_back(new LDFData<bool>(u"propertyObjectID", true));
|
||||
info.nodes[0]->config.push_back(new LDFData<int>(u"componentWhitelist", 1));
|
||||
|
||||
auto* model = spawner->Spawn();
|
||||
|
||||
@@ -585,29 +580,17 @@ void PropertyManagementComponent::Load() {
|
||||
GeneralUtils::SetBit(blueprintID, eObjectBits::CHARACTER);
|
||||
GeneralUtils::SetBit(blueprintID, eObjectBits::PERSISTENT);
|
||||
|
||||
LDFBaseData* ldfBlueprintID = new LDFData<LWOOBJID>(u"blueprintid", blueprintID);
|
||||
LDFBaseData* componentWhitelist = new LDFData<int>(u"componentWhitelist", 1);
|
||||
LDFBaseData* modelType = new LDFData<int>(u"modelType", 2);
|
||||
LDFBaseData* propertyObjectID = new LDFData<bool>(u"propertyObjectID", true);
|
||||
LDFBaseData* userModelID = new LDFData<LWOOBJID>(u"userModelID", databaseModel.id);
|
||||
|
||||
settings.push_back(ldfBlueprintID);
|
||||
settings.push_back(componentWhitelist);
|
||||
settings.push_back(modelType);
|
||||
settings.push_back(propertyObjectID);
|
||||
settings.push_back(userModelID);
|
||||
settings.push_back(new LDFData<LWOOBJID>(u"blueprintid", blueprintID));
|
||||
settings.push_back(new LDFData<int>(u"componentWhitelist", 1));
|
||||
settings.push_back(new LDFData<int>(u"modelType", 2));
|
||||
settings.push_back(new LDFData<bool>(u"propertyObjectID", true));
|
||||
settings.push_back(new LDFData<LWOOBJID>(u"userModelID", databaseModel.id));
|
||||
} else {
|
||||
auto modelType = new LDFData<int>(u"modelType", 2);
|
||||
auto userModelID = new LDFData<LWOOBJID>(u"userModelID", databaseModel.id);
|
||||
auto ldfModelBehavior = new LDFData<LWOOBJID>(u"modelBehaviors", 0);
|
||||
auto propertyObjectID = new LDFData<bool>(u"propertyObjectID", true);
|
||||
auto componentWhitelist = new LDFData<int>(u"componentWhitelist", 1);
|
||||
|
||||
settings.push_back(componentWhitelist);
|
||||
settings.push_back(ldfModelBehavior);
|
||||
settings.push_back(modelType);
|
||||
settings.push_back(propertyObjectID);
|
||||
settings.push_back(userModelID);
|
||||
settings.push_back(new LDFData<int>(u"modelType", 2));
|
||||
settings.push_back(new LDFData<LWOOBJID>(u"userModelID", databaseModel.id));
|
||||
settings.push_back(new LDFData<LWOOBJID>(u"modelBehaviors", 0));
|
||||
settings.push_back(new LDFData<bool>(u"propertyObjectID", true));
|
||||
settings.push_back(new LDFData<int>(u"componentWhitelist", 1));
|
||||
}
|
||||
|
||||
node->config = settings;
|
||||
|
@@ -5,7 +5,7 @@
|
||||
#include "EntityManager.h"
|
||||
#include "SimplePhysicsComponent.h"
|
||||
|
||||
const std::map<LWOOBJID, dpEntity*> ProximityMonitorComponent::m_EmptyObjectMap = {};
|
||||
const std::unordered_set<LWOOBJID> ProximityMonitorComponent::m_EmptyObjectSet = {};
|
||||
|
||||
ProximityMonitorComponent::ProximityMonitorComponent(Entity* parent, int radiusSmall, int radiusLarge) : Component(parent) {
|
||||
if (radiusSmall != -1 && radiusLarge != -1) {
|
||||
@@ -38,26 +38,26 @@ void ProximityMonitorComponent::SetProximityRadius(dpEntity* entity, const std::
|
||||
m_ProximitiesData.insert(std::make_pair(name, entity));
|
||||
}
|
||||
|
||||
const std::map<LWOOBJID, dpEntity*>& ProximityMonitorComponent::GetProximityObjects(const std::string& name) {
|
||||
const auto& iter = m_ProximitiesData.find(name);
|
||||
const std::unordered_set<LWOOBJID>& ProximityMonitorComponent::GetProximityObjects(const std::string& name) {
|
||||
const auto iter = m_ProximitiesData.find(name);
|
||||
|
||||
if (iter == m_ProximitiesData.end()) {
|
||||
return m_EmptyObjectMap;
|
||||
if (iter == m_ProximitiesData.cend()) {
|
||||
return m_EmptyObjectSet;
|
||||
}
|
||||
|
||||
return iter->second->GetCurrentlyCollidingObjects();
|
||||
}
|
||||
|
||||
bool ProximityMonitorComponent::IsInProximity(const std::string& name, LWOOBJID objectID) {
|
||||
const auto& iter = m_ProximitiesData.find(name);
|
||||
const auto iter = m_ProximitiesData.find(name);
|
||||
|
||||
if (iter == m_ProximitiesData.end()) {
|
||||
if (iter == m_ProximitiesData.cend()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
const auto& collitions = iter->second->GetCurrentlyCollidingObjects();
|
||||
const auto& collisions = iter->second->GetCurrentlyCollidingObjects();
|
||||
|
||||
return collitions.find(objectID) != collitions.end();
|
||||
return collisions.contains(objectID);
|
||||
}
|
||||
|
||||
void ProximityMonitorComponent::Update(float deltaTime) {
|
||||
@@ -66,13 +66,13 @@ void ProximityMonitorComponent::Update(float deltaTime) {
|
||||
|
||||
prox.second->SetPosition(m_Parent->GetPosition());
|
||||
//Process enter events
|
||||
for (auto* en : prox.second->GetNewObjects()) {
|
||||
m_Parent->OnCollisionProximity(en->GetObjectID(), prox.first, "ENTER");
|
||||
for (const auto id : prox.second->GetNewObjects()) {
|
||||
m_Parent->OnCollisionProximity(id, prox.first, "ENTER");
|
||||
}
|
||||
|
||||
//Process exit events
|
||||
for (auto* en : prox.second->GetRemovedObjects()) {
|
||||
m_Parent->OnCollisionProximity(en->GetObjectID(), prox.first, "LEAVE");
|
||||
for (const auto id : prox.second->GetRemovedObjects()) {
|
||||
m_Parent->OnCollisionProximity(id, prox.first, "LEAVE");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -6,6 +6,8 @@
|
||||
#ifndef PROXIMITYMONITORCOMPONENT_H
|
||||
#define PROXIMITYMONITORCOMPONENT_H
|
||||
|
||||
#include <unordered_set>
|
||||
|
||||
#include "BitStream.h"
|
||||
#include "Entity.h"
|
||||
#include "dpWorld.h"
|
||||
@@ -42,9 +44,9 @@ public:
|
||||
/**
|
||||
* Returns the last of entities that are used to check proximity, given a name
|
||||
* @param name the proximity name to retrieve physics objects for
|
||||
* @return a map of physics entities for this name, indexed by object ID
|
||||
* @return a set of physics entity object IDs for this name
|
||||
*/
|
||||
const std::map<LWOOBJID, dpEntity*>& GetProximityObjects(const std::string& name);
|
||||
const std::unordered_set<LWOOBJID>& GetProximityObjects(const std::string& name);
|
||||
|
||||
/**
|
||||
* Checks if the passed object is in proximity of the named proximity sensor
|
||||
@@ -70,7 +72,7 @@ private:
|
||||
/**
|
||||
* Default value for the proximity data
|
||||
*/
|
||||
static const std::map<LWOOBJID, dpEntity*> m_EmptyObjectMap;
|
||||
static const std::unordered_set<LWOOBJID> m_EmptyObjectSet;
|
||||
};
|
||||
|
||||
#endif // PROXIMITYMONITORCOMPONENT_H
|
||||
|
@@ -117,7 +117,7 @@ void RenderComponent::PlayEffect(const int32_t effectId, const std::u16string& e
|
||||
|
||||
auto result = query.execQuery();
|
||||
|
||||
if (result.eof() || result.fieldIsNull(0)) {
|
||||
if (result.eof() || result.fieldIsNull("animation_length")) {
|
||||
result.finalize();
|
||||
|
||||
m_DurationCache[effectId] = 0;
|
||||
@@ -127,7 +127,7 @@ void RenderComponent::PlayEffect(const int32_t effectId, const std::u16string& e
|
||||
return;
|
||||
}
|
||||
|
||||
effect.time = static_cast<float>(result.getFloatField(0));
|
||||
effect.time = static_cast<float>(result.getFloatField("animation_length"));
|
||||
|
||||
result.finalize();
|
||||
|
||||
|
@@ -27,12 +27,12 @@ RocketLaunchpadControlComponent::RocketLaunchpadControlComponent(Entity* parent,
|
||||
|
||||
auto result = query.execQuery();
|
||||
|
||||
if (!result.eof() && !result.fieldIsNull(0)) {
|
||||
m_TargetZone = result.getIntField(0);
|
||||
m_DefaultZone = result.getIntField(1);
|
||||
m_TargetScene = result.getStringField(2);
|
||||
m_AltPrecondition = new PreconditionExpression(result.getStringField(3));
|
||||
m_AltLandingScene = result.getStringField(4);
|
||||
if (!result.eof() && !result.fieldIsNull("targetZone")) {
|
||||
m_TargetZone = result.getIntField("targetZone");
|
||||
m_DefaultZone = result.getIntField("defaultZoneID");
|
||||
m_TargetScene = result.getStringField("targetScene");
|
||||
m_AltPrecondition = new PreconditionExpression(result.getStringField("altLandingPrecondition"));
|
||||
m_AltLandingScene = result.getStringField("altLandingSpawnPointName");
|
||||
}
|
||||
|
||||
result.finalize();
|
||||
|
@@ -99,7 +99,7 @@ void SkillComponent::SyncPlayerProjectile(const LWOOBJID projectileId, RakNet::B
|
||||
return;
|
||||
}
|
||||
|
||||
const auto behavior_id = static_cast<uint32_t>(result.getIntField(0));
|
||||
const auto behavior_id = static_cast<uint32_t>(result.getIntField("behaviorID"));
|
||||
|
||||
result.finalize();
|
||||
|
||||
@@ -227,7 +227,7 @@ void SkillComponent::RegisterCalculatedProjectile(const LWOOBJID projectileId, B
|
||||
this->m_managedProjectiles.push_back(entry);
|
||||
}
|
||||
|
||||
bool SkillComponent::CastSkill(const uint32_t skillId, LWOOBJID target, const LWOOBJID optionalOriginatorID) {
|
||||
bool SkillComponent::CastSkill(const uint32_t skillId, LWOOBJID target, const LWOOBJID optionalOriginatorID, const int32_t castType, const NiQuaternion rotationOverride) {
|
||||
uint32_t behaviorId = -1;
|
||||
// try to find it via the cache
|
||||
const auto& pair = m_skillBehaviorCache.find(skillId);
|
||||
@@ -247,11 +247,19 @@ bool SkillComponent::CastSkill(const uint32_t skillId, LWOOBJID target, const LW
|
||||
return false;
|
||||
}
|
||||
|
||||
return CalculateBehavior(skillId, behaviorId, target, false, false, optionalOriginatorID).success;
|
||||
return CalculateBehavior(skillId, behaviorId, target, false, false, optionalOriginatorID, castType, rotationOverride).success;
|
||||
}
|
||||
|
||||
|
||||
SkillExecutionResult SkillComponent::CalculateBehavior(const uint32_t skillId, const uint32_t behaviorId, const LWOOBJID target, const bool ignoreTarget, const bool clientInitalized, const LWOOBJID originatorOverride) {
|
||||
SkillExecutionResult SkillComponent::CalculateBehavior(
|
||||
const uint32_t skillId,
|
||||
const uint32_t behaviorId,
|
||||
const LWOOBJID target,
|
||||
const bool ignoreTarget,
|
||||
const bool clientInitalized,
|
||||
const LWOOBJID originatorOverride,
|
||||
const int32_t castType,
|
||||
const NiQuaternion rotationOverride) {
|
||||
RakNet::BitStream bitStream{};
|
||||
|
||||
auto* behavior = Behavior::CreateBehavior(behaviorId);
|
||||
@@ -283,7 +291,7 @@ SkillExecutionResult SkillComponent::CalculateBehavior(const uint32_t skillId, c
|
||||
// Echo start skill
|
||||
EchoStartSkill start;
|
||||
|
||||
start.iCastType = 0;
|
||||
start.iCastType = castType;
|
||||
start.skillID = skillId;
|
||||
start.uiSkillHandle = context->skillUId;
|
||||
start.optionalOriginatorID = context->originator;
|
||||
@@ -294,6 +302,10 @@ SkillExecutionResult SkillComponent::CalculateBehavior(const uint32_t skillId, c
|
||||
if (originator != nullptr) {
|
||||
start.originatorRot = originator->GetRotation();
|
||||
}
|
||||
|
||||
if (rotationOverride != NiQuaternionConstant::IDENTITY) {
|
||||
start.originatorRot = rotationOverride;
|
||||
}
|
||||
//start.optionalTargetID = target;
|
||||
|
||||
start.sBitStream.assign(reinterpret_cast<char*>(bitStream.GetData()), bitStream.GetNumberOfBytesUsed());
|
||||
@@ -413,7 +425,7 @@ void SkillComponent::SyncProjectileCalculation(const ProjectileSyncEntry& entry)
|
||||
return;
|
||||
}
|
||||
|
||||
const auto behaviorId = static_cast<uint32_t>(result.getIntField(0));
|
||||
const auto behaviorId = static_cast<uint32_t>(result.getIntField("behaviorID"));
|
||||
|
||||
result.finalize();
|
||||
|
||||
@@ -464,7 +476,7 @@ void SkillComponent::HandleUnCast(const uint32_t behaviorId, const LWOOBJID targ
|
||||
behavior->UnCast(&context, { target });
|
||||
}
|
||||
|
||||
SkillComponent::SkillComponent(Entity* parent): Component(parent) {
|
||||
SkillComponent::SkillComponent(Entity* parent) : Component(parent) {
|
||||
this->m_skillUid = 0;
|
||||
}
|
||||
|
||||
|
@@ -127,7 +127,7 @@ public:
|
||||
* @param optionalOriginatorID change the originator of the skill
|
||||
* @return if the case succeeded
|
||||
*/
|
||||
bool CastSkill(const uint32_t skillId, LWOOBJID target = LWOOBJID_EMPTY, const LWOOBJID optionalOriginatorID = LWOOBJID_EMPTY);
|
||||
bool CastSkill(const uint32_t skillId, LWOOBJID target = LWOOBJID_EMPTY, const LWOOBJID optionalOriginatorID = LWOOBJID_EMPTY, const int32_t castType = 0, const NiQuaternion rotationOverride = NiQuaternionConstant::IDENTITY);
|
||||
|
||||
/**
|
||||
* Initializes a server-side skill calculation.
|
||||
@@ -139,7 +139,7 @@ public:
|
||||
* @param originatorOverride an override for the originator of the skill calculation
|
||||
* @return the result of the skill calculation
|
||||
*/
|
||||
SkillExecutionResult CalculateBehavior(uint32_t skillId, uint32_t behaviorId, LWOOBJID target, bool ignoreTarget = false, bool clientInitalized = false, LWOOBJID originatorOverride = LWOOBJID_EMPTY);
|
||||
SkillExecutionResult CalculateBehavior(uint32_t skillId, uint32_t behaviorId, LWOOBJID target, bool ignoreTarget = false, bool clientInitalized = false, LWOOBJID originatorOverride = LWOOBJID_EMPTY, const int32_t castType = 0, const NiQuaternion rotationOverride = NiQuaternionConstant::IDENTITY);
|
||||
|
||||
/**
|
||||
* Register a server-side projectile.
|
||||
|
Reference in New Issue
Block a user