Make logger automatically put a newline (#675)

at the end of the line
remove all the newlines in log calls
This commit is contained in:
Aaron Kimbrell
2022-07-24 21:26:51 -05:00
committed by GitHub
parent a7fb6eb3f3
commit e97ae92624
86 changed files with 1249 additions and 1252 deletions

View File

@@ -38,7 +38,7 @@ BaseCombatAIComponent::BaseCombatAIComponent(Entity* parent, const uint32_t id)
auto componentQuery = CDClientDatabase::CreatePreppedStmt(
"SELECT aggroRadius, tetherSpeed, pursuitSpeed, softTetherRadius, hardTetherRadius FROM BaseCombatAIComponent WHERE id = ?;");
componentQuery.bind(1, (int) id);
auto componentResult = componentQuery.execQuery();
if (!componentResult.eof())
@@ -76,7 +76,7 @@ BaseCombatAIComponent::BaseCombatAIComponent(Entity* parent, const uint32_t id)
auto skillQuery = CDClientDatabase::CreatePreppedStmt(
"SELECT skillID, cooldown, behaviorID FROM SkillBehavior WHERE skillID IN (SELECT skillID FROM ObjectSkills WHERE objectTemplate = ?);");
skillQuery.bind(1, (int) parent->GetLOT());
auto result = skillQuery.execQuery();
while (!result.eof()) {
@@ -254,7 +254,7 @@ void BaseCombatAIComponent::CalculateCombat(const float deltaTime) {
}
skillComponent->CalculateUpdate(deltaTime);
if (m_Disabled) return;
if (m_StunTime > 0.0f)
@@ -362,19 +362,19 @@ void BaseCombatAIComponent::CalculateCombat(const float deltaTime) {
if (m_Target == LWOOBJID_EMPTY)
{
m_State = AiState::idle;
return;
}
m_Downtime = 0.5f;
auto* target = GetTargetEntity();
if (target != nullptr)
{
LookAt(target->GetPosition());
}
for (auto i = 0; i < m_SkillEntries.size(); ++i)
{
auto entry = m_SkillEntries.at(i);
@@ -413,11 +413,11 @@ LWOOBJID BaseCombatAIComponent::FindTarget() {
if (m_MovementAI) reference = m_MovementAI->ApproximateLocation();
auto* target = GetTargetEntity();
if (target != nullptr && !m_DirtyThreat)
{
const auto targetPosition = target->GetPosition();
if (Vector3::DistanceSquared(targetPosition, m_StartPosition) < m_HardTetherRadius * m_HardTetherRadius)
{
return m_Target;
@@ -492,7 +492,7 @@ LWOOBJID BaseCombatAIComponent::FindTarget() {
}
std::vector<LWOOBJID> deadThreats {};
for (const auto& threatTarget : m_ThreatEntries)
{
auto* entity = EntityManager::Instance()->GetEntity(threatTarget.first);
@@ -526,7 +526,7 @@ LWOOBJID BaseCombatAIComponent::FindTarget() {
}
m_DirtyThreat = false;
if (optimalTarget == nullptr)
{
return LWOOBJID_EMPTY;
@@ -577,7 +577,7 @@ bool BaseCombatAIComponent::IsEnemy(LWOOBJID target) const {
auto* entity = EntityManager::Instance()->GetEntity(target);
if (entity == nullptr) {
Game::logger->Log("BaseCombatAIComponent", "Invalid entity for checking validity (%llu)!\n", target);
Game::logger->Log("BaseCombatAIComponent", "Invalid entity for checking validity (%llu)!", target);
return false;
}
@@ -591,7 +591,7 @@ bool BaseCombatAIComponent::IsEnemy(LWOOBJID target) const {
auto* referenceDestroyable = m_Parent->GetComponent<DestroyableComponent>();
if (referenceDestroyable == nullptr) {
Game::logger->Log("BaseCombatAIComponent", "Invalid reference destroyable component on (%llu)!\n", m_Parent->GetObjectID());
Game::logger->Log("BaseCombatAIComponent", "Invalid reference destroyable component on (%llu)!", m_Parent->GetObjectID());
return false;
}
@@ -601,7 +601,7 @@ bool BaseCombatAIComponent::IsEnemy(LWOOBJID target) const {
if (quickbuild != nullptr)
{
const auto state = quickbuild->GetState();
if (state != REBUILD_COMPLETED)
{
return false;
@@ -662,7 +662,7 @@ const NiPoint3& BaseCombatAIComponent::GetStartPosition() const
return m_StartPosition;
}
void BaseCombatAIComponent::ClearThreat()
void BaseCombatAIComponent::ClearThreat()
{
m_ThreatEntries.clear();
@@ -675,12 +675,12 @@ void BaseCombatAIComponent::Wander() {
}
m_MovementAI->SetHaltDistance(0);
const auto& info = m_MovementAI->GetInfo();
const auto div = static_cast<int>(info.wanderDelayMax);
m_Timer = (div == 0 ? 0 : GeneralUtils::GenerateRandomNumber<int>(0, div)) + info.wanderDelayMin; //set a random timer to stay put.
const float radius = info.wanderRadius * sqrt(static_cast<double>(GeneralUtils::GenerateRandomNumber<float>(0, 1))); //our wander radius + a bit of random range
const float theta = ((static_cast<double>(GeneralUtils::GenerateRandomNumber<float>(0, 1)) * 2 * PI));
@@ -720,7 +720,7 @@ void BaseCombatAIComponent::OnAggro() {
}
m_MovementAI->SetHaltDistance(m_AttackRadius);
NiPoint3 targetPos = target->GetPosition();
NiPoint3 currentPos = m_MovementAI->GetCurrentPosition();
@@ -731,7 +731,7 @@ void BaseCombatAIComponent::OnAggro() {
else if (Vector3::DistanceSquared(m_StartPosition, targetPos) > m_HardTetherRadius * m_HardTetherRadius) //Return to spawn if we're too far
{
m_MovementAI->SetSpeed(m_PursuitSpeed);
m_MovementAI->SetDestination(m_StartPosition);
}
else //Chase the player's new position
@@ -768,7 +768,7 @@ void BaseCombatAIComponent::OnTether() {
m_MovementAI->SetSpeed(m_PursuitSpeed);
m_MovementAI->SetDestination(m_StartPosition);
m_State = AiState::aggro;
}
else {
@@ -795,7 +795,7 @@ bool BaseCombatAIComponent::GetStunImmune() const
return m_StunImmune;
}
void BaseCombatAIComponent::SetStunImmune(bool value)
void BaseCombatAIComponent::SetStunImmune(bool value)
{
m_StunImmune = value;
}
@@ -805,7 +805,7 @@ float BaseCombatAIComponent::GetTetherSpeed() const
return m_TetherSpeed;
}
void BaseCombatAIComponent::SetTetherSpeed(float value)
void BaseCombatAIComponent::SetTetherSpeed(float value)
{
m_TetherSpeed = value;
}
@@ -816,7 +816,7 @@ void BaseCombatAIComponent::Stun(const float time) {
}
m_StunTime = time;
m_Stunned = true;
}
@@ -848,13 +848,13 @@ bool BaseCombatAIComponent::GetDistabled() const
return m_Disabled;
}
void BaseCombatAIComponent::Sleep()
void BaseCombatAIComponent::Sleep()
{
m_dpEntity->SetSleeping(true);
m_dpEntityEnemy->SetSleeping(true);
}
void BaseCombatAIComponent::Wake()
void BaseCombatAIComponent::Wake()
{
m_dpEntity->SetSleeping(false);
m_dpEntityEnemy->SetSleeping(false);

View File

@@ -12,7 +12,7 @@ BouncerComponent::BouncerComponent(Entity* parent) : Component(parent) {
m_PetEnabled = false;
m_PetBouncerEnabled = false;
m_PetSwitchLoaded = false;
if (parent->GetLOT() == 7625)
{
LookupPetSwitch();
@@ -34,14 +34,14 @@ Entity* BouncerComponent::GetParentEntity() const
return m_Parent;
}
void BouncerComponent::SetPetEnabled(bool value)
void BouncerComponent::SetPetEnabled(bool value)
{
m_PetEnabled = value;
EntityManager::Instance()->SerializeEntity(m_Parent);
}
void BouncerComponent::SetPetBouncerEnabled(bool value)
void BouncerComponent::SetPetBouncerEnabled(bool value)
{
m_PetBouncerEnabled = value;
@@ -57,7 +57,7 @@ void BouncerComponent::SetPetBouncerEnabled(bool value)
{
GameMessages::SendStopFXEffect(m_Parent, true, "PetOnSwitch");
}
}
bool BouncerComponent::GetPetEnabled() const
@@ -70,7 +70,7 @@ bool BouncerComponent::GetPetBouncerEnabled() const
return m_PetBouncerEnabled;
}
void BouncerComponent::LookupPetSwitch()
void BouncerComponent::LookupPetSwitch()
{
const auto& groups = m_Parent->GetGroups();
@@ -85,21 +85,21 @@ void BouncerComponent::LookupPetSwitch()
if (switchComponent != nullptr)
{
switchComponent->SetPetBouncer(this);
m_PetSwitchLoaded = true;
m_PetEnabled = true;
EntityManager::Instance()->SerializeEntity(m_Parent);
Game::logger->Log("BouncerComponent", "Loaded pet bouncer\n");
Game::logger->Log("BouncerComponent", "Loaded pet bouncer");
}
}
}
if (!m_PetSwitchLoaded)
{
Game::logger->Log("BouncerComponent", "Failed to load pet bouncer\n");
Game::logger->Log("BouncerComponent", "Failed to load pet bouncer");
m_Parent->AddCallbackTimer(0.5f, [this]() {
LookupPetSwitch();
});

View File

@@ -49,11 +49,11 @@ void BuffComponent::Serialize(RakNet::BitStream* outBitStream, bool bIsInitialUp
outBitStream->Write<uint32_t>(0);
}
}
outBitStream->Write0();
}
void BuffComponent::Update(float deltaTime)
void BuffComponent::Update(float deltaTime)
{
/**
* Loop through all buffs and apply deltaTime to ther time.
@@ -138,7 +138,7 @@ void BuffComponent::ApplyBuff(const int32_t id, const float duration, const LWOO
m_Buffs.emplace(id, buff);
}
void BuffComponent::RemoveBuff(int32_t id)
void BuffComponent::RemoveBuff(int32_t id)
{
const auto& iter = m_Buffs.find(id);
@@ -146,18 +146,18 @@ void BuffComponent::RemoveBuff(int32_t id)
{
return;
}
m_Buffs.erase(iter);
RemoveBuffEffect(id);
}
bool BuffComponent::HasBuff(int32_t id)
bool BuffComponent::HasBuff(int32_t id)
{
return m_Buffs.find(id) != m_Buffs.end();
}
void BuffComponent::ApplyBuffEffect(int32_t id)
void BuffComponent::ApplyBuffEffect(int32_t id)
{
const auto& parameters = GetBuffParameters(id);
for (const auto& parameter : parameters)
@@ -209,7 +209,7 @@ void BuffComponent::ApplyBuffEffect(int32_t id)
}
}
void BuffComponent::RemoveBuffEffect(int32_t id)
void BuffComponent::RemoveBuffEffect(int32_t id)
{
const auto& parameters = GetBuffParameters(id);
for (const auto& parameter : parameters)
@@ -261,7 +261,7 @@ void BuffComponent::RemoveBuffEffect(int32_t id)
}
}
void BuffComponent::RemoveAllBuffs()
void BuffComponent::RemoveAllBuffs()
{
for (const auto& buff : m_Buffs)
{
@@ -271,12 +271,12 @@ void BuffComponent::RemoveAllBuffs()
m_Buffs.clear();
}
void BuffComponent::Reset()
void BuffComponent::Reset()
{
RemoveAllBuffs();
}
void BuffComponent::ReApplyBuffs()
void BuffComponent::ReApplyBuffs()
{
for (const auto& buff : m_Buffs)
{
@@ -293,10 +293,10 @@ void BuffComponent::LoadFromXml(tinyxml2::XMLDocument* doc)
{
// Load buffs
auto* dest = doc->FirstChildElement("obj")->FirstChildElement("dest");
// Make sure we have a clean buff element.
auto* buffElement = dest->FirstChildElement("buff");
// Old character, no buffs to load
if (buffElement == nullptr)
{
@@ -328,14 +328,14 @@ 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");
// Make sure we have a clean buff element.
auto* buffElement = dest->FirstChildElement("buff");
if (buffElement == nullptr)
{
buffElement = doc->NewElement("buff");
@@ -357,12 +357,12 @@ void BuffComponent::UpdateXml(tinyxml2::XMLDocument* doc)
buffEntry->SetAttribute("s", buff.second.stacks);
buffEntry->SetAttribute("sr", buff.second.source);
buffEntry->SetAttribute("b", buff.second.behaviorID);
buffElement->LinkEndChild(buffEntry);
}
}
const std::vector<BuffParameter>& BuffComponent::GetBuffParameters(int32_t buffId)
const std::vector<BuffParameter>& BuffComponent::GetBuffParameters(int32_t buffId)
{
const auto& pair = m_Cache.find(buffId);
@@ -376,7 +376,7 @@ const std::vector<BuffParameter>& BuffComponent::GetBuffParameters(int32_t buffI
query.bind(1, (int) buffId);
auto result = query.execQuery();
std::vector<BuffParameter> parameters {};
while (!result.eof())
@@ -402,7 +402,7 @@ const std::vector<BuffParameter>& BuffComponent::GetBuffParameters(int32_t buffI
}
catch (std::invalid_argument& exception)
{
Game::logger->Log("BuffComponent", "Failed to parse value (%s): (%s)!\n", token.c_str(), exception.what());
Game::logger->Log("BuffComponent", "Failed to parse value (%s): (%s)!", token.c_str(), exception.what());
}
}
}
@@ -411,7 +411,7 @@ const std::vector<BuffParameter>& BuffComponent::GetBuffParameters(int32_t buffI
result.nextRow();
}
m_Cache.insert_or_assign(buffId, parameters);
return m_Cache.find(buffId)->second;

View File

@@ -26,8 +26,8 @@ void BuildBorderComponent::OnUse(Entity* originator) {
if (!entities.empty())
{
buildArea = entities[0]->GetObjectID();
Game::logger->Log("BuildBorderComponent", "Using PropertyPlaque\n");
Game::logger->Log("BuildBorderComponent", "Using PropertyPlaque");
}
auto* inventoryComponent = originator->GetComponent<InventoryComponent>();
@@ -44,7 +44,7 @@ void BuildBorderComponent::OnUse(Entity* originator) {
inventoryComponent->PushEquippedItems();
Game::logger->Log("BuildBorderComponent", "Starting with %llu\n", buildArea);
Game::logger->Log("BuildBorderComponent", "Starting with %llu", buildArea);
if (PropertyManagementComponent::Instance() != nullptr) {
GameMessages::SendStartArrangingWithItem(

View File

@@ -41,7 +41,7 @@ CharacterComponent::CharacterComponent(Entity* parent, Character* character) : C
if (character->GetZoneID() != Game::server->GetZoneID()) {
m_IsLanding = true;
}
if (LandingAnimDisabled(character->GetZoneID()) || LandingAnimDisabled(Game::server->GetZoneID()) || m_LastRocketConfig.empty()) {
m_IsLanding = false; //Don't make us land on VE/minigames lol
}
@@ -77,13 +77,13 @@ CharacterComponent::~CharacterComponent() {
}
void CharacterComponent::Serialize(RakNet::BitStream* outBitStream, bool bIsInitialUpdate, unsigned int& flags) {
if (bIsInitialUpdate) {
outBitStream->Write0();
outBitStream->Write0();
outBitStream->Write0();
outBitStream->Write0();
outBitStream->Write(m_Character->GetHairColor());
outBitStream->Write(m_Character->GetHairStyle());
outBitStream->Write<uint32_t>(0); //Default "head"
@@ -128,7 +128,7 @@ void CharacterComponent::Serialize(RakNet::BitStream* outBitStream, bool bIsInit
outBitStream->Write(m_RacingSmashablesSmashed);
outBitStream->Write(m_RacesFinished);
outBitStream->Write(m_FirstPlaceRaceFinishes);
outBitStream->Write0();
outBitStream->Write(m_IsLanding);
if (m_IsLanding) {
@@ -147,17 +147,17 @@ void CharacterComponent::Serialize(RakNet::BitStream* outBitStream, bool bIsInit
outBitStream->Write(m_EditorEnabled);
outBitStream->Write(m_EditorLevel);
}
outBitStream->Write(m_DirtyCurrentActivity);
if (m_DirtyCurrentActivity) outBitStream->Write(m_CurrentActivity);
outBitStream->Write(m_DirtySocialInfo);
if (m_DirtySocialInfo) {
outBitStream->Write(m_GuildID);
outBitStream->Write<unsigned char>(static_cast<unsigned char>(m_GuildName.size()));
if (!m_GuildName.empty())
outBitStream->WriteBits(reinterpret_cast<const unsigned char*>(m_GuildName.c_str()), static_cast<unsigned char>(m_GuildName.size()) * sizeof(wchar_t) * 8);
outBitStream->Write(m_IsLEGOClubMember);
outBitStream->Write(m_CountryCode);
}
@@ -171,7 +171,7 @@ bool CharacterComponent::GetPvpEnabled() const
void CharacterComponent::SetPvpEnabled(const bool value)
{
m_DirtyGMInfo = true;
m_PvpEnabled = value;
}
@@ -183,15 +183,16 @@ void CharacterComponent::SetGMLevel(int gmlevel) {
}
void CharacterComponent::LoadFromXml(tinyxml2::XMLDocument* doc) {
tinyxml2::XMLElement* character = doc->FirstChildElement("obj")->FirstChildElement("char");
if (!character) {
Game::logger->Log("CharacterComponent", "Failed to find char tag while loading XML!\n");
Game::logger->Log("CharacterComponent", "Failed to find char tag while loading XML!");
return;
}
if (character->QueryAttribute("rpt", &m_Reputation) == tinyxml2::XML_NO_ATTRIBUTE) {
SetReputation(0);
}
character->QueryInt64Attribute("ls", &m_Uscore);
// Load the statistics
@@ -280,11 +281,11 @@ void CharacterComponent::LoadFromXml(tinyxml2::XMLDocument* doc) {
void CharacterComponent::UpdateXml(tinyxml2::XMLDocument* doc) {
tinyxml2::XMLElement* minifig = doc->FirstChildElement("obj")->FirstChildElement("mf");
if (!minifig) {
Game::logger->Log("CharacterComponent", "Failed to find mf tag while updating XML!\n");
Game::logger->Log("CharacterComponent", "Failed to find mf tag while updating XML!");
return;
}
// write minifig information that might have been changed by commands
// write minifig information that might have been changed by commands
minifig->SetAttribute("es", m_Character->GetEyebrows());
minifig->SetAttribute("ess", m_Character->GetEyes());
@@ -300,7 +301,7 @@ void CharacterComponent::UpdateXml(tinyxml2::XMLDocument* doc) {
tinyxml2::XMLElement* character = doc->FirstChildElement("obj")->FirstChildElement("char");
if (!character) {
Game::logger->Log("CharacterComponent", "Failed to find char tag while updating XML!\n");
Game::logger->Log("CharacterComponent", "Failed to find char tag while updating XML!");
return;
}
@@ -350,7 +351,7 @@ void CharacterComponent::UpdateXml(tinyxml2::XMLDocument* doc) {
//
auto newUpdateTimestamp = std::time(nullptr);
Game::logger->Log("TotalTimePlayed", "Time since last save: %d\n", newUpdateTimestamp - m_LastUpdateTimestamp);
Game::logger->Log("TotalTimePlayed", "Time since last save: %d", newUpdateTimestamp - m_LastUpdateTimestamp);
m_TotalTimePlayed += newUpdateTimestamp - m_LastUpdateTimestamp;
character->SetAttribute("time", m_TotalTimePlayed);
@@ -380,7 +381,7 @@ Item* CharacterComponent::GetRocket(Entity* player) {
}
if (!rocket) {
Game::logger->Log("CharacterComponent", "Unable to find rocket to equip!\n");
Game::logger->Log("CharacterComponent", "Unable to find rocket to equip!");
return rocket;
}
return rocket;

View File

@@ -36,7 +36,7 @@ ControllablePhysicsComponent::ControllablePhysicsComponent(Entity* entity) : Com
return;
if (entity->GetLOT() == 1) {
Game::logger->Log("ControllablePhysicsComponent", "Using patch to load minifig physics\n");
Game::logger->Log("ControllablePhysicsComponent", "Using patch to load minifig physics");
float radius = 1.5f;
m_dpEntity = new dpEntity(m_Parent->GetObjectID(), radius, false);
@@ -133,10 +133,10 @@ void ControllablePhysicsComponent::Serialize(RakNet::BitStream* outBitStream, bo
void ControllablePhysicsComponent::LoadFromXml(tinyxml2::XMLDocument* doc) {
tinyxml2::XMLElement* character = doc->FirstChildElement("obj")->FirstChildElement("char");
if (!character) {
Game::logger->Log("ControllablePhysicsComponent", "Failed to find char tag!\n");
Game::logger->Log("ControllablePhysicsComponent", "Failed to find char tag!");
return;
}
m_Parent->GetCharacter()->LoadXmlRespawnCheckpoints();
character->QueryAttribute("lzx", &m_Position.x);
@@ -159,7 +159,7 @@ void ControllablePhysicsComponent::ResetFlags() {
void ControllablePhysicsComponent::UpdateXml(tinyxml2::XMLDocument* doc) {
tinyxml2::XMLElement* character = doc->FirstChildElement("obj")->FirstChildElement("char");
if (!character) {
Game::logger->Log("ControllablePhysicsComponent", "Failed to find char tag while updating XML!\n");
Game::logger->Log("ControllablePhysicsComponent", "Failed to find char tag while updating XML!");
return;
}
@@ -254,7 +254,7 @@ void ControllablePhysicsComponent::RemovePickupRadiusScale(float value) {
if (pos != m_ActivePickupRadiusScales.end()) {
m_ActivePickupRadiusScales.erase(pos);
} else {
Game::logger->Log("ControllablePhysicsComponent", "Warning: Could not find pickup radius %f in list of active radii. List has %i active radii.\n", value, m_ActivePickupRadiusScales.size());
Game::logger->Log("ControllablePhysicsComponent", "Warning: Could not find pickup radius %f in list of active radii. List has %i active radii.", value, m_ActivePickupRadiusScales.size());
return;
}

View File

@@ -162,7 +162,7 @@ void DestroyableComponent::Serialize(RakNet::BitStream* outBitStream, bool bIsIn
void DestroyableComponent::LoadFromXml(tinyxml2::XMLDocument* doc) {
tinyxml2::XMLElement* dest = doc->FirstChildElement("obj")->FirstChildElement("dest");
if (!dest) {
Game::logger->Log("DestroyableComponent", "Failed to find dest tag!\n");
Game::logger->Log("DestroyableComponent", "Failed to find dest tag!");
return;
}
@@ -184,7 +184,7 @@ void DestroyableComponent::LoadFromXml(tinyxml2::XMLDocument* doc) {
void DestroyableComponent::UpdateXml(tinyxml2::XMLDocument* doc) {
tinyxml2::XMLElement* dest = doc->FirstChildElement("obj")->FirstChildElement("dest");
if (!dest) {
Game::logger->Log("DestroyableComponent", "Failed to find dest tag!\n");
Game::logger->Log("DestroyableComponent", "Failed to find dest tag!");
return;
}
@@ -246,7 +246,7 @@ void DestroyableComponent::SetArmor(int32_t value) {
// If Destroyable Component already has zero armor do not trigger the passive ability again.
bool hadArmor = m_iArmor > 0;
auto* characterComponent = m_Parent->GetComponent<CharacterComponent>();
if (characterComponent != nullptr) {
characterComponent->TrackArmorDelta(value - m_iArmor);
@@ -499,7 +499,7 @@ bool DestroyableComponent::CheckValidity(const LWOOBJID target, const bool ignor
if (targetEntity == nullptr)
{
Game::logger->Log("DestroyableComponent", "Invalid entity for checking validity (%llu)!\n", target);
Game::logger->Log("DestroyableComponent", "Invalid entity for checking validity (%llu)!", target);
return false;
}
@@ -777,22 +777,22 @@ void DestroyableComponent::Smash(const LWOOBJID source, const eKillType killType
else
{
//Check if this zone allows coin drops
if (dZoneManager::Instance()->GetPlayerLoseCoinOnDeath())
if (dZoneManager::Instance()->GetPlayerLoseCoinOnDeath())
{
auto* character = m_Parent->GetCharacter();
uint64_t coinsTotal = character->GetCoins();
if (coinsTotal > 0)
if (coinsTotal > 0)
{
uint64_t coinsToLoose = 1;
if (coinsTotal >= 200)
if (coinsTotal >= 200)
{
float hundreth = (coinsTotal / 100.0f);
coinsToLoose = static_cast<int>(hundreth);
}
if (coinsToLoose > 10000)
if (coinsToLoose > 10000)
{
coinsToLoose = 10000;
}

View File

@@ -157,7 +157,7 @@ void InventoryComponent::AddItem(
{
if (count == 0)
{
Game::logger->Log("InventoryComponent", "Attempted to add 0 of item (%i) to the inventory!\n", lot);
Game::logger->Log("InventoryComponent", "Attempted to add 0 of item (%i) to the inventory!", lot);
return;
}
@@ -166,7 +166,7 @@ void InventoryComponent::AddItem(
{
if (lot > 0)
{
Game::logger->Log("InventoryComponent", "Attempted to add invalid item (%i) to the inventory!\n", lot);
Game::logger->Log("InventoryComponent", "Attempted to add invalid item (%i) to the inventory!", lot);
}
return;
@@ -187,7 +187,7 @@ void InventoryComponent::AddItem(
if (slot == -1)
{
Game::logger->Log("InventoryComponent", "Failed to find empty slot for inventory (%i)!\n", inventoryType);
Game::logger->Log("InventoryComponent", "Failed to find empty slot for inventory (%i)!", inventoryType);
return;
}
@@ -303,7 +303,7 @@ void InventoryComponent::RemoveItem(const LOT lot, const uint32_t count, eInvent
{
if (count == 0)
{
Game::logger->Log("InventoryComponent", "Attempted to remove 0 of item (%i) from the inventory!\n", lot);
Game::logger->Log("InventoryComponent", "Attempted to remove 0 of item (%i) from the inventory!", lot);
return;
}
@@ -532,7 +532,7 @@ void InventoryComponent::LoadXml(tinyxml2::XMLDocument* document)
if (inventoryElement == nullptr)
{
Game::logger->Log("InventoryComponent", "Failed to find 'inv' xml element!\n");
Game::logger->Log("InventoryComponent", "Failed to find 'inv' xml element!");
return;
}
@@ -541,7 +541,7 @@ void InventoryComponent::LoadXml(tinyxml2::XMLDocument* document)
if (bags == nullptr)
{
Game::logger->Log("InventoryComponent", "Failed to find 'bags' xml element!\n");
Game::logger->Log("InventoryComponent", "Failed to find 'bags' xml element!");
return;
}
@@ -569,7 +569,7 @@ void InventoryComponent::LoadXml(tinyxml2::XMLDocument* document)
if (items == nullptr)
{
Game::logger->Log("InventoryComponent", "Failed to find 'items' xml element!\n");
Game::logger->Log("InventoryComponent", "Failed to find 'items' xml element!");
return;
}
@@ -586,7 +586,7 @@ void InventoryComponent::LoadXml(tinyxml2::XMLDocument* document)
if (inventory == nullptr)
{
Game::logger->Log("InventoryComponent", "Failed to find inventory (%i)!\n", type);
Game::logger->Log("InventoryComponent", "Failed to find inventory (%i)!", type);
return;
}
@@ -666,7 +666,7 @@ void InventoryComponent::UpdateXml(tinyxml2::XMLDocument* document)
if (inventoryElement == nullptr)
{
Game::logger->Log("InventoryComponent", "Failed to find 'inv' xml element!\n");
Game::logger->Log("InventoryComponent", "Failed to find 'inv' xml element!");
return;
}
@@ -691,7 +691,7 @@ void InventoryComponent::UpdateXml(tinyxml2::XMLDocument* document)
if (bags == nullptr)
{
Game::logger->Log("InventoryComponent", "Failed to find 'bags' xml element!\n");
Game::logger->Log("InventoryComponent", "Failed to find 'bags' xml element!");
return;
}
@@ -712,7 +712,7 @@ void InventoryComponent::UpdateXml(tinyxml2::XMLDocument* document)
if (items == nullptr)
{
Game::logger->Log("InventoryComponent", "Failed to find 'items' xml element!\n");
Game::logger->Log("InventoryComponent", "Failed to find 'items' xml element!");
return;
}
@@ -819,7 +819,7 @@ void InventoryComponent::Serialize(RakNet::BitStream* outBitStream, const bool b
outBitStream->Write<uint8_t>(0); // Don't compress
outBitStream->Write(ldfStream);
}
outBitStream->Write1();
}
@@ -932,9 +932,9 @@ void InventoryComponent::EquipItem(Item* item, const bool skipChecks)
const auto building = character->GetBuildMode();
const auto type = static_cast<eItemType>(item->GetInfo().itemType);
if (item->GetLot() == 8092 && m_Parent->GetGMLevel() >= GAME_MASTER_LEVEL_OPERATOR && hasCarEquipped == false)
{
{
auto startPosition = m_Parent->GetPosition();
auto startRotation = NiQuaternion::LookAt(startPosition, startPosition + NiPoint3::UNIT_X);
@@ -1055,11 +1055,11 @@ void InventoryComponent::EquipItem(Item* item, const bool skipChecks)
}
GenerateProxies(item);
UpdateSlot(item->GetInfo().equipLocation, { item->GetId(), item->GetLot(), item->GetCount(), item->GetSlot(), item->GetConfig() });
ApplyBuff(item);
AddItemSkills(item->GetLot());
EntityManager::Instance()->SerializeEntity(m_Parent);
@@ -1087,7 +1087,7 @@ void InventoryComponent::UnEquipItem(Item* item)
}
RemoveBuff(item);
RemoveItemSkills(item->GetLot());
RemoveSlot(item->GetInfo().equipLocation);
@@ -1162,7 +1162,7 @@ void InventoryComponent::PopEquippedItems()
m_Pushed.clear();
auto destroyableComponent = m_Parent->GetComponent<DestroyableComponent>();
// Reset stats to full
if (destroyableComponent) {
destroyableComponent->SetHealth(static_cast<int32_t>(destroyableComponent->GetMaxHealth()));
@@ -1265,10 +1265,10 @@ void InventoryComponent::AddItemSkills(const LOT lot)
if (index != m_Skills.end())
{
const auto old = index->second;
GameMessages::SendRemoveSkill(m_Parent, old);
}
GameMessages::SendAddSkill(m_Parent, skill, static_cast<int>(slot));
m_Skills.insert_or_assign(slot, skill);
@@ -1474,7 +1474,7 @@ std::vector<uint32_t> InventoryComponent::FindBuffs(Item* item, bool castOnEquip
if (entry.skillID == 0)
{
Game::logger->Log("InventoryComponent", "Failed to find buff behavior for skill (%i)!\n", result.skillID);
Game::logger->Log("InventoryComponent", "Failed to find buff behavior for skill (%i)!", result.skillID);
continue;
}
@@ -1483,7 +1483,7 @@ std::vector<uint32_t> InventoryComponent::FindBuffs(Item* item, bool castOnEquip
{
missions->Progress(MissionTaskType::MISSION_TASK_TYPE_SKILL, result.skillID);
}
// If item is not a proxy, add its buff to the added buffs.
if (item->GetParent() == LWOOBJID_EMPTY) buffs.push_back(static_cast<uint32_t>(entry.behaviorID));
}
@@ -1553,7 +1553,7 @@ std::vector<Item*> InventoryComponent::GenerateProxies(Item* parent)
}
catch (std::invalid_argument& exception)
{
Game::logger->Log("InventoryComponent", "Failed to parse proxy (%s): (%s)!\n", segment.c_str(), exception.what());
Game::logger->Log("InventoryComponent", "Failed to parse proxy (%s): (%s)!", segment.c_str(), exception.what());
}
}

View File

@@ -12,7 +12,7 @@ LevelProgressionComponent::LevelProgressionComponent(Entity* parent) : Component
void LevelProgressionComponent::UpdateXml(tinyxml2::XMLDocument* doc) {
tinyxml2::XMLElement* level = doc->FirstChildElement("obj")->FirstChildElement("lvl");
if (!level) {
Game::logger->Log("LevelProgressionComponent", "Failed to find lvl tag while updating XML!\n");
Game::logger->Log("LevelProgressionComponent", "Failed to find lvl tag while updating XML!");
return;
}
level->SetAttribute("l", m_Level);
@@ -22,7 +22,7 @@ void LevelProgressionComponent::UpdateXml(tinyxml2::XMLDocument* doc) {
void LevelProgressionComponent::LoadFromXml(tinyxml2::XMLDocument* doc){
tinyxml2::XMLElement* level = doc->FirstChildElement("obj")->FirstChildElement("lvl");
if (!level) {
Game::logger->Log("LevelProgressionComponent", "Failed to find lvl tag while loading XML!\n");
Game::logger->Log("LevelProgressionComponent", "Failed to find lvl tag while loading XML!");
return;
}
level->QueryAttribute("l", &m_Level);

View File

@@ -220,7 +220,7 @@ void MissionComponent::ForceProgressTaskType(const uint32_t missionId, const uin
}
}
void MissionComponent::ForceProgressValue(uint32_t missionId, uint32_t taskType, int32_t value, bool acceptMission)
void MissionComponent::ForceProgressValue(uint32_t missionId, uint32_t taskType, int32_t value, bool acceptMission)
{
auto* mission = GetMission(missionId);
@@ -357,7 +357,7 @@ bool MissionComponent::LookForAchievements(MissionTaskType type, int32_t value,
}
}
catch (std::invalid_argument& exception) {
Game::logger->Log("MissionComponent", "Failed to parse target (%s): (%s)!\n", token.c_str(), exception.what());
Game::logger->Log("MissionComponent", "Failed to parse target (%s): (%s)!", token.c_str(), exception.what());
}
}
@@ -383,7 +383,7 @@ bool MissionComponent::LookForAchievements(MissionTaskType type, int32_t value,
#endif
}
const std::vector<uint32_t>& MissionComponent::QueryAchievements(MissionTaskType type, int32_t value, const std::string targets) {
const std::vector<uint32_t>& MissionComponent::QueryAchievements(MissionTaskType type, int32_t value, const std::string targets) {
// Create a hash which represent this query for achievements
size_t hash = 0;
GeneralUtils::hash_combine(hash, type);
@@ -471,7 +471,7 @@ bool MissionComponent::RequiresItem(const LOT lot) {
}
result.finalize();
for (const auto& pair : m_Missions) {
auto* mission = pair.second;
@@ -594,7 +594,7 @@ void MissionComponent::UpdateXml(tinyxml2::XMLDocument* doc) {
}
}
void MissionComponent::AddCollectible(int32_t collectibleID)
void MissionComponent::AddCollectible(int32_t collectibleID)
{
// Check if this collectible is already in the list
if (HasCollectible(collectibleID)) {
@@ -604,12 +604,12 @@ void MissionComponent::AddCollectible(int32_t collectibleID)
m_Collectibles.push_back(collectibleID);
}
bool MissionComponent::HasCollectible(int32_t collectibleID)
bool MissionComponent::HasCollectible(int32_t collectibleID)
{
return std::find(m_Collectibles.begin(), m_Collectibles.end(), collectibleID) != m_Collectibles.end();
}
bool MissionComponent::HasMission(uint32_t missionId)
bool MissionComponent::HasMission(uint32_t missionId)
{
return GetMission(missionId) != nullptr;
}

View File

@@ -50,7 +50,7 @@ MissionOfferComponent::MissionOfferComponent(Entity* parent, const LOT parentLot
// Now lookup the missions in the MissionNPCComponent table
auto* missionNpcComponentTable = CDClientManager::Instance()->GetTable<CDMissionNPCComponentTable>("MissionNPCComponent");
auto missions = missionNpcComponentTable->Query([=](const CDMissionNPCComponent& entry)
{
return entry.id == static_cast<unsigned>(componentId);
@@ -73,11 +73,11 @@ MissionOfferComponent::~MissionOfferComponent()
mission = nullptr;
}
}
offeredMissions.clear();
}
void MissionOfferComponent::OnUse(Entity* originator)
void MissionOfferComponent::OnUse(Entity* originator)
{
OfferMissions(originator);
}
@@ -86,9 +86,9 @@ void MissionOfferComponent::OfferMissions(Entity* entity, const uint32_t specifi
{
// First, get the entity's MissionComponent. If there is not one, then we cannot offer missions to this entity.
auto* missionComponent = static_cast<MissionComponent*>(entity->GetComponent(COMPONENT_TYPE_MISSION));
if (!missionComponent) {
Game::logger->Log("MissionOfferComponent", "Unable to get mission component for Entity %llu\n", entity->GetObjectID());
Game::logger->Log("MissionOfferComponent", "Unable to get mission component for Entity %llu", entity->GetObjectID());
return;
}
@@ -137,7 +137,7 @@ void MissionOfferComponent::OfferMissions(Entity* entity, const uint32_t specifi
continue;
}
}
const auto canAccept = MissionPrerequisites::CanAccept(missionId, missionComponent->GetMissions());
// Mission has not yet been accepted - check the prereqs
@@ -148,10 +148,10 @@ void MissionOfferComponent::OfferMissions(Entity* entity, const uint32_t specifi
{
continue;
}
const auto& randomPool = info.randomPool;
const auto isRandom = info.isRandom;
if (isRandom && randomPool.empty()) // This means the mission is part of a random pool of missions.
{
continue;
@@ -163,7 +163,7 @@ void MissionOfferComponent::OfferMissions(Entity* entity, const uint32_t specifi
std::string token;
std::vector<uint32_t> randomMissionPool;
while (std::getline(stream, token, ','))
{
try
@@ -174,7 +174,7 @@ void MissionOfferComponent::OfferMissions(Entity* entity, const uint32_t specifi
}
catch (std::invalid_argument& exception)
{
Game::logger->Log("MissionOfferComponent", "Failed to parse value (%s): (%s)!\n", token.c_str(), exception.what());
Game::logger->Log("MissionOfferComponent", "Failed to parse value (%s): (%s)!", token.c_str(), exception.what());
}
}
@@ -195,7 +195,7 @@ void MissionOfferComponent::OfferMissions(Entity* entity, const uint32_t specifi
for (const auto sample : randomMissionPool)
{
const auto state = missionComponent->GetMissionState(sample);
if (state == MissionState::MISSION_STATE_ACTIVE ||
state == MissionState::MISSION_STATE_COMPLETE_ACTIVE ||
state == MissionState::MISSION_STATE_READY_TO_COMPLETE ||
@@ -212,10 +212,10 @@ void MissionOfferComponent::OfferMissions(Entity* entity, const uint32_t specifi
GameMessages::SendOfferMission(entity->GetObjectID(), entity->GetSystemAddress(), sample, m_Parent->GetObjectID());
canAcceptPool.clear();
break;
}
if (std::find(offered.begin(), offered.end(), sample) == offered.end() && MissionPrerequisites::CanAccept(sample, missionComponent->GetMissions()))
{
canAcceptPool.push_back(sample);

View File

@@ -20,12 +20,12 @@ MoverSubComponent::MoverSubComponent(const NiPoint3& startPos) {
mDesiredWaypointIndex = 0; // -1;
mInReverse = false;
mShouldStopAtDesiredWaypoint = false;
mPercentBetweenPoints = 0.0f;
mCurrentWaypointIndex = 0;
mNextWaypointIndex = 0; //mCurrentWaypointIndex + 1;
mIdleTimeElapsed = 0.0f;
}
@@ -38,16 +38,16 @@ void MoverSubComponent::Serialize(RakNet::BitStream* outBitStream, bool bIsIniti
outBitStream->Write<int32_t>(mDesiredWaypointIndex);
outBitStream->Write(mShouldStopAtDesiredWaypoint);
outBitStream->Write(mInReverse);
outBitStream->Write<float_t>(mPercentBetweenPoints);
outBitStream->Write<float_t>(mPosition.x);
outBitStream->Write<float_t>(mPosition.y);
outBitStream->Write<float_t>(mPosition.z);
outBitStream->Write<uint32_t>(mCurrentWaypointIndex);
outBitStream->Write<uint32_t>(mNextWaypointIndex);
outBitStream->Write<float_t>(mIdleTimeElapsed);
outBitStream->Write<float_t>(0.0f); // Move time elapsed
}
@@ -62,7 +62,7 @@ MovingPlatformComponent::MovingPlatformComponent(Entity* parent, const std::stri
m_NoAutoStart = false;
if (m_Path == nullptr) {
Game::logger->Log("MovingPlatformComponent", "Path not found: %s\n", pathName.c_str());
Game::logger->Log("MovingPlatformComponent", "Path not found: %s", pathName.c_str());
}
}
@@ -72,7 +72,7 @@ MovingPlatformComponent::~MovingPlatformComponent() {
void MovingPlatformComponent::Serialize(RakNet::BitStream* outBitStream, bool bIsInitialUpdate, unsigned int& flags) {
// Here we don't serialize the moving platform to let the client simulate the movement
if (!m_Serialize)
{
outBitStream->Write<bool>(false);
@@ -89,7 +89,7 @@ void MovingPlatformComponent::Serialize(RakNet::BitStream* outBitStream, bool bI
if (hasPath) {
// Is on rail
outBitStream->Write1();
outBitStream->Write(static_cast<uint16_t>(m_PathName.size()));
for (const auto& c : m_PathName) {
outBitStream->Write(static_cast<uint16_t>(c));
@@ -128,7 +128,7 @@ void MovingPlatformComponent::OnCompleteRebuild() {
StartPathing();
}
void MovingPlatformComponent::SetMovementState(MovementPlatformState value)
void MovingPlatformComponent::SetMovementState(MovementPlatformState value)
{
auto* subComponent = static_cast<MoverSubComponent*>(m_MoverSubComponent);
@@ -137,10 +137,10 @@ void MovingPlatformComponent::SetMovementState(MovementPlatformState value)
EntityManager::Instance()->SerializeEntity(m_Parent);
}
void MovingPlatformComponent::GotoWaypoint(uint32_t index, bool stopAtWaypoint)
void MovingPlatformComponent::GotoWaypoint(uint32_t index, bool stopAtWaypoint)
{
auto* subComponent = static_cast<MoverSubComponent*>(m_MoverSubComponent);
subComponent->mDesiredWaypointIndex = index;
subComponent->mNextWaypointIndex = index;
subComponent->mShouldStopAtDesiredWaypoint = stopAtWaypoint;
@@ -148,13 +148,13 @@ void MovingPlatformComponent::GotoWaypoint(uint32_t index, bool stopAtWaypoint)
StartPathing();
}
void MovingPlatformComponent::StartPathing()
void MovingPlatformComponent::StartPathing()
{
//GameMessages::SendStartPathing(m_Parent);
m_PathingStopped = false;
auto* subComponent = static_cast<MoverSubComponent*>(m_MoverSubComponent);
subComponent->mShouldStopAtDesiredWaypoint = true;
subComponent->mState = MovementPlatformState::Stationary;
@@ -206,7 +206,7 @@ void MovingPlatformComponent::StartPathing()
void MovingPlatformComponent::ContinuePathing()
{
auto* subComponent = static_cast<MoverSubComponent*>(m_MoverSubComponent);
subComponent->mState = MovementPlatformState::Stationary;
subComponent->mCurrentWaypointIndex = subComponent->mNextWaypointIndex;
@@ -258,7 +258,7 @@ void MovingPlatformComponent::ContinuePathing()
case PathBehavior::Once:
EntityManager::Instance()->SerializeEntity(m_Parent);
return;
case PathBehavior::Bounce:
subComponent->mInReverse = true;
break;
@@ -266,7 +266,7 @@ void MovingPlatformComponent::ContinuePathing()
case PathBehavior::Loop:
subComponent->mNextWaypointIndex = 0;
break;
default:
break;
}
@@ -347,7 +347,7 @@ void MovingPlatformComponent::StopPathing()
//GameMessages::SendPlatformResync(m_Parent, UNASSIGNED_SYSTEM_ADDRESS);
}
void MovingPlatformComponent::SetSerialized(bool value)
void MovingPlatformComponent::SetSerialized(bool value)
{
m_Serialize = value;
}
@@ -357,7 +357,7 @@ bool MovingPlatformComponent::GetNoAutoStart() const
return m_NoAutoStart;
}
void MovingPlatformComponent::SetNoAutoStart(const bool value)
void MovingPlatformComponent::SetNoAutoStart(const bool value)
{
m_NoAutoStart = value;
}

View File

@@ -98,7 +98,7 @@ PetComponent::PetComponent(Entity* parent, uint32_t componentId) : Component(par
result.finalize();
}
void PetComponent::Serialize(RakNet::BitStream* outBitStream, bool bIsInitialUpdate, unsigned int& flags)
void PetComponent::Serialize(RakNet::BitStream* outBitStream, bool bIsInitialUpdate, unsigned int& flags)
{
const bool tamed = m_Owner != LWOOBJID_EMPTY;
@@ -114,7 +114,7 @@ void PetComponent::Serialize(RakNet::BitStream* outBitStream, bool bIsInitialUpd
{
outBitStream->Write(m_Interaction);
}
outBitStream->Write(tamed);
if (tamed)
{
@@ -143,7 +143,7 @@ void PetComponent::Serialize(RakNet::BitStream* outBitStream, bool bIsInitialUpd
}
}
void PetComponent::OnUse(Entity* originator)
void PetComponent::OnUse(Entity* originator)
{
if (m_Owner != LWOOBJID_EMPTY)
{
@@ -158,7 +158,7 @@ void PetComponent::OnUse(Entity* originator)
{
return;
}
m_Tamer = LWOOBJID_EMPTY;
}
@@ -179,7 +179,7 @@ void PetComponent::OnUse(Entity* originator)
{
movementAIComponent->Stop();
}
inventoryComponent->DespawnPet();
const auto& cached = buildCache.find(m_Parent->GetLOT());
@@ -245,7 +245,7 @@ void PetComponent::OnUse(Entity* originator)
}
auto* destroyableComponent = originator->GetComponent<DestroyableComponent>();
if (destroyableComponent == nullptr)
{
return;
@@ -263,7 +263,7 @@ void PetComponent::OnUse(Entity* originator)
if (bricks.empty())
{
ChatPackets::SendSystemMessage(originator->GetSystemAddress(), u"Failed to load the puzzle minigame for this pet.");
Game::logger->Log("PetComponent", "Couldn't find %s for minigame!\n", buildFile.c_str());
Game::logger->Log("PetComponent", "Couldn't find %s for minigame!", buildFile.c_str());
return;
}
@@ -282,7 +282,7 @@ void PetComponent::OnUse(Entity* originator)
}
auto position = originatorPosition;
NiPoint3 forward = NiQuaternion::LookAt(m_Parent->GetPosition(), originator->GetPosition()).GetForwardVector();
forward.y = 0;
@@ -297,7 +297,7 @@ void PetComponent::OnUse(Entity* originator)
const NiPoint3 forward = m_Parent->GetRotation().GetForwardVector();
attempt = originatorPosition + forward * interactionDistance;
y = dpWorld::Instance().GetHeightAtPoint(attempt);
interactionDistance -= 0.5f;
@@ -309,10 +309,10 @@ void PetComponent::OnUse(Entity* originator)
{
position = petPosition + forward * interactionDistance;
}
auto rotation = NiQuaternion::LookAt(position, petPosition);
GameMessages::SendNotifyPetTamingMinigame(
originator->GetObjectID(),
m_Parent->GetObjectID(),
@@ -350,7 +350,7 @@ void PetComponent::OnUse(Entity* originator)
}
}
void PetComponent::Update(float deltaTime)
void PetComponent::Update(float deltaTime)
{
if (m_StartPosition == NiPoint3::ZERO)
{
@@ -422,7 +422,7 @@ void PetComponent::Update(float deltaTime)
}
m_TresureTime -= deltaTime;
m_MovementAI->Stop();
if (m_TresureTime <= 0)
@@ -466,7 +466,7 @@ void PetComponent::Update(float deltaTime)
if (m_Timer > 0)
{
m_Timer -= deltaTime;
return;
}
@@ -509,7 +509,7 @@ void PetComponent::Update(float deltaTime)
if (distance < 3 * 3)
{
m_Interaction = closestTresure->GetObjectID();
Command(NiPoint3::ZERO, LWOOBJID_EMPTY, 1, 202, true);
m_TresureTime = 2;
@@ -525,7 +525,7 @@ void PetComponent::Update(float deltaTime)
skipTresure:
m_MovementAI->SetHaltDistance(haltDistance);
m_MovementAI->SetSpeed(2.5f);
m_MovementAI->SetDestination(destination);
@@ -573,7 +573,7 @@ void PetComponent::TryBuild(uint32_t numBricks, bool clientFailed) {
GameMessages::SendPetTamingTryBuildResult(m_Tamer, !clientFailed, numBricks, tamer->GetSystemAddress());
}
void PetComponent::NotifyTamingBuildSuccess(NiPoint3 position)
void PetComponent::NotifyTamingBuildSuccess(NiPoint3 position)
{
if (m_Tamer == LWOOBJID_EMPTY) return;
@@ -603,7 +603,7 @@ void PetComponent::NotifyTamingBuildSuccess(NiPoint3 position)
info.spawnerID = tamer->GetObjectID();
auto* modelEntity = EntityManager::Instance()->CreateEntity(info);
m_ModelId = modelEntity->GetObjectID();
EntityManager::Instance()->ConstructEntity(modelEntity);
@@ -625,26 +625,26 @@ void PetComponent::NotifyTamingBuildSuccess(NiPoint3 position)
petSubKey = GeneralUtils::SetBit(petSubKey, OBJECT_BIT_PERSISTENT);
m_DatabaseId = petSubKey;
std::string petName = tamer->GetCharacter()->GetName();
petName += "'s Pet";
GameMessages::SendAddPetToPlayer(m_Tamer, 0, GeneralUtils::ASCIIToUTF16(petName), petSubKey, m_Parent->GetLOT(), tamer->GetSystemAddress());
GameMessages::SendRegisterPetID(m_Tamer, m_Parent->GetObjectID(), tamer->GetSystemAddress());
GameMessages::SendRegisterPetDBID(m_Tamer, petSubKey, tamer->GetSystemAddress());
inventoryComponent->AddItem(m_Parent->GetLOT(), 1, eLootSourceType::LOOT_SOURCE_ACTIVITY, eInventoryType::MODELS, {}, LWOOBJID_EMPTY, true, false, petSubKey);
auto* item = inventoryComponent->FindItemBySubKey(petSubKey, MODELS);
if (item == nullptr)
{
return;
}
DatabasePet databasePet {};
databasePet.lot = m_Parent->GetLOT();
databasePet.moderationState = 1;
databasePet.name = petName;
@@ -687,7 +687,7 @@ void PetComponent::NotifyTamingBuildSuccess(NiPoint3 position)
}
}
void PetComponent::RequestSetPetName(std::u16string name)
void PetComponent::RequestSetPetName(std::u16string name)
{
if (m_Tamer == LWOOBJID_EMPTY)
{
@@ -717,7 +717,7 @@ void PetComponent::RequestSetPetName(std::u16string name)
return;
}
Game::logger->Log("PetComponent", "Got set pet name (%s)\n", GeneralUtils::UTF16ToWTF8(name).c_str());
Game::logger->Log("PetComponent", "Got set pet name (%s)", GeneralUtils::UTF16ToWTF8(name).c_str());
auto* inventoryComponent = tamer->GetComponent<InventoryComponent>();
@@ -770,7 +770,7 @@ void PetComponent::RequestSetPetName(std::u16string name)
}
}
void PetComponent::ClientExitTamingMinigame(bool voluntaryExit)
void PetComponent::ClientExitTamingMinigame(bool voluntaryExit)
{
if (m_Tamer == LWOOBJID_EMPTY) return;
@@ -804,7 +804,7 @@ void PetComponent::ClientExitTamingMinigame(bool voluntaryExit)
SetStatus(67108866);
m_Tamer = LWOOBJID_EMPTY;
m_Timer = 0;
EntityManager::Instance()->SerializeEntity(m_Parent);
// Notify the end of a pet taming minigame
@@ -813,7 +813,7 @@ void PetComponent::ClientExitTamingMinigame(bool voluntaryExit)
}
}
void PetComponent::StartTimer()
void PetComponent::StartTimer()
{
const auto& cached = buildCache.find(m_Parent->GetLOT());
@@ -825,8 +825,8 @@ void PetComponent::StartTimer()
m_Timer = cached->second.timeLimit;
}
void PetComponent::ClientFailTamingMinigame()
{
void PetComponent::ClientFailTamingMinigame()
{
if (m_Tamer == LWOOBJID_EMPTY) return;
auto* tamer = EntityManager::Instance()->GetEntity(m_Tamer);
@@ -859,7 +859,7 @@ void PetComponent::ClientFailTamingMinigame()
SetStatus(67108866);
m_Tamer = LWOOBJID_EMPTY;
m_Timer = 0;
EntityManager::Instance()->SerializeEntity(m_Parent);
// Notify the end of a pet taming minigame
@@ -868,7 +868,7 @@ void PetComponent::ClientFailTamingMinigame()
}
}
void PetComponent::Wander()
void PetComponent::Wander()
{
m_MovementAI = m_Parent->GetComponent<MovementAIComponent>();
@@ -877,12 +877,12 @@ void PetComponent::Wander()
}
m_MovementAI->SetHaltDistance(0);
const auto& info = m_MovementAI->GetInfo();
const auto div = static_cast<int>(info.wanderDelayMax);
m_Timer = (div == 0 ? 0 : GeneralUtils::GenerateRandomNumber<int>(0, div)) + info.wanderDelayMin; //set a random timer to stay put.
const float radius = info.wanderRadius * sqrt(static_cast<double>(GeneralUtils::GenerateRandomNumber<float>(0, 1))); //our wander radius + a bit of random range
const float theta = ((static_cast<double>(GeneralUtils::GenerateRandomNumber<float>(0, 1)) * 2 * PI));
@@ -912,13 +912,13 @@ void PetComponent::Wander()
m_Timer += (m_MovementAI->GetCurrentPosition().x - destination.x) / info.wanderSpeed;
}
void PetComponent::Activate(Item* item, bool registerPet, bool fromTaming)
void PetComponent::Activate(Item* item, bool registerPet, bool fromTaming)
{
AddDrainImaginationTimer(item, fromTaming);
m_ItemId = item->GetId();
m_DatabaseId = item->GetSubKey();
auto* inventoryComponent = item->GetInventory()->GetComponent();
if (inventoryComponent == nullptr) return;
@@ -1006,10 +1006,10 @@ void PetComponent::AddDrainImaginationTimer(Item* item, bool fromTaming) {
// Set this to a variable so when this is called back from the player the timer doesn't fire off.
m_Parent->AddCallbackTimer(imaginationDrainRate, [playerDestroyableComponent, this, item](){
if (!playerDestroyableComponent) {
Game::logger->Log("PetComponent", "No petComponent and/or no playerDestroyableComponent\n");
Game::logger->Log("PetComponent", "No petComponent and/or no playerDestroyableComponent");
return;
}
// If we are out of imagination despawn the pet.
if (playerDestroyableComponent->GetImagination() == 0) {
this->Deactivate();
@@ -1023,7 +1023,7 @@ void PetComponent::AddDrainImaginationTimer(Item* item, bool fromTaming) {
});
}
void PetComponent::Deactivate()
void PetComponent::Deactivate()
{
GameMessages::SendPlayFXEffect(m_Parent->GetObjectID(), -1, u"despawn", "", LWOOBJID_EMPTY, 1, 1, true);
@@ -1036,7 +1036,7 @@ void PetComponent::Deactivate()
auto* owner = GetOwner();
if (owner == nullptr) return;
GameMessages::SendAddPetToPlayer(m_Owner, 0, u"", LWOOBJID_EMPTY, LOT_NULL, owner->GetSystemAddress());
GameMessages::SendRegisterPetID(m_Owner, LWOOBJID_EMPTY, owner->GetSystemAddress());
@@ -1046,7 +1046,7 @@ void PetComponent::Deactivate()
GameMessages::SendShowPetActionButton(m_Owner, 0, false, owner->GetSystemAddress());
}
void PetComponent::Release()
void PetComponent::Release()
{
auto* inventoryComponent = GetOwner()->GetComponent<InventoryComponent>();
@@ -1054,7 +1054,7 @@ void PetComponent::Release()
{
return;
}
Deactivate();
inventoryComponent->RemoveDatabasePet(m_DatabaseId);
@@ -1064,7 +1064,7 @@ void PetComponent::Release()
item->SetCount(0, false, false);
}
void PetComponent::Command(NiPoint3 position, LWOOBJID source, int32_t commandType, int32_t typeId, bool overrideObey)
void PetComponent::Command(NiPoint3 position, LWOOBJID source, int32_t commandType, int32_t typeId, bool overrideObey)
{
auto* owner = GetOwner();
@@ -1133,12 +1133,12 @@ void PetComponent::SetStatus(uint32_t value)
m_Status = value;
}
void PetComponent::SetAbility(PetAbilityType value)
void PetComponent::SetAbility(PetAbilityType value)
{
m_Ability = value;
}
PetComponent* PetComponent::GetTamingPet(LWOOBJID tamer)
PetComponent* PetComponent::GetTamingPet(LWOOBJID tamer)
{
const auto& pair = currentActivities.find(tamer);
@@ -1159,7 +1159,7 @@ PetComponent* PetComponent::GetTamingPet(LWOOBJID tamer)
return entity->GetComponent<PetComponent>();
}
PetComponent* PetComponent::GetActivePet(LWOOBJID owner)
PetComponent* PetComponent::GetActivePet(LWOOBJID owner)
{
const auto& pair = activePets.find(owner);
@@ -1173,7 +1173,7 @@ PetComponent* PetComponent::GetActivePet(LWOOBJID owner)
if (entity == nullptr)
{
activePets.erase(owner);
return nullptr;
}

View File

@@ -30,18 +30,18 @@ PhantomPhysicsComponent::PhantomPhysicsComponent(Entity* parent) : Component(par
m_Rotation = m_Parent->GetDefaultRotation();
m_Scale = m_Parent->GetDefaultScale();
m_dpEntity = nullptr;
m_EffectInfoDirty = false;
m_PositionInfoDirty = false;
m_IsPhysicsEffectActive = false;
m_EffectType = 0;
m_DirectionalMultiplier = 0.0f;
m_MinMax = false;
m_Min = 0;
m_Max = 1;
m_IsDirectional = false;
m_Direction = NiPoint3(); // * m_DirectionalMultiplier
@@ -82,7 +82,7 @@ PhantomPhysicsComponent::PhantomPhysicsComponent(Entity* parent) : Component(par
}
// HF - RespawnPoints. Legacy respawn entity.
if (m_Parent->GetLOT() == 4945)
if (m_Parent->GetLOT() == 4945)
{
m_IsRespawnVolume = true;
m_RespawnPos = m_Position;
@@ -218,7 +218,7 @@ PhantomPhysicsComponent::PhantomPhysicsComponent(Entity* parent) : Component(par
dpWorld::Instance().AddEntity(m_dpEntity);
}
else {
//Game::logger->Log("PhantomPhysicsComponent", "This one is supposed to have %s\n", info->physicsAsset.c_str());
//Game::logger->Log("PhantomPhysicsComponent", "This one is supposed to have %s", info->physicsAsset.c_str());
//add fallback cube:
m_dpEntity = new dpEntity(m_Parent->GetObjectID(), 2.0f, 2.0f, 2.0f);
@@ -262,7 +262,7 @@ void PhantomPhysicsComponent::CreatePhysics() {
CDPhysicsComponentTable* physComp = CDClientManager::Instance()->GetTable<CDPhysicsComponentTable>("PhysicsComponent");
if (physComp == nullptr) return;
auto info = physComp->GetByID(componentID);
if (info == nullptr) return;
@@ -315,15 +315,15 @@ void PhantomPhysicsComponent::Serialize(RakNet::BitStream* outBitStream, bool bI
m_PositionInfoDirty = false;
}
outBitStream->Write(m_EffectInfoDirty || bIsInitialUpdate);
if (m_EffectInfoDirty || bIsInitialUpdate) {
outBitStream->Write(m_IsPhysicsEffectActive);
if (m_IsPhysicsEffectActive) {
outBitStream->Write(m_EffectType);
outBitStream->Write(m_DirectionalMultiplier);
// forgive me father for i have sinned
outBitStream->Write0();
//outBitStream->Write(m_MinMax);
@@ -331,7 +331,7 @@ void PhantomPhysicsComponent::Serialize(RakNet::BitStream* outBitStream, bool bI
//outBitStream->Write(m_Min);
//outBitStream->Write(m_Max);
//}
outBitStream->Write(m_IsDirectional);
if (m_IsDirectional) {
outBitStream->Write(m_Direction.x);
@@ -379,7 +379,7 @@ void PhantomPhysicsComponent::SetDirection(const NiPoint3& pos) {
m_Direction.x *= m_DirectionalMultiplier;
m_Direction.y *= m_DirectionalMultiplier;
m_Direction.z *= m_DirectionalMultiplier;
m_EffectInfoDirty = true;
m_IsDirectional = true;
}

View File

@@ -192,7 +192,7 @@ void PropertyEntranceComponent::OnPropertyEntranceSync(Entity* entity, bool incl
const auto query = BuildQuery(entity, sortMethod, character);
auto propertyLookup = Database::CreatePreppedStmt(query);
const auto searchString = "%" + filterText + "%";
propertyLookup->setUInt(1, this->m_MapID);
propertyLookup->setString(2, searchString.c_str());
@@ -230,7 +230,7 @@ void PropertyEntranceComponent::OnPropertyEntranceSync(Entity* entity, bool incl
delete nameLookup;
nameLookup = nullptr;
Game::logger->Log("PropertyEntranceComponent", "Failed to find property owner name for %llu!\n", cloneId);
Game::logger->Log("PropertyEntranceComponent", "Failed to find property owner name for %llu!", cloneId);
continue;
} else {
@@ -318,7 +318,7 @@ void PropertyEntranceComponent::OnPropertyEntranceSync(Entity* entity, bool incl
propertyLookup = nullptr;
propertyQueries[entity->GetObjectID()] = entries;
// Query here is to figure out whether or not to display the button to go to the next page or not.
int32_t numberOfProperties = 0;
@@ -337,7 +337,7 @@ void PropertyEntranceComponent::OnPropertyEntranceSync(Entity* entity, bool incl
delete result;
result = nullptr;
delete propertiesLeft;
propertiesLeft = nullptr;

View File

@@ -37,7 +37,7 @@ PropertyManagementComponent::PropertyManagementComponent(Entity* parent) : Compo
instance = this;
const auto& worldId = dZoneManager::Instance()->GetZone()->GetZoneID();
const auto zoneId = worldId.GetMapID();
const auto cloneId = worldId.GetCloneID();
@@ -51,7 +51,7 @@ PropertyManagementComponent::PropertyManagementComponent(Entity* parent) : Compo
{
return;
}
templateId = result.getIntField(0);
result.finalize();
@@ -80,7 +80,7 @@ PropertyManagementComponent::PropertyManagementComponent(Entity* parent) : Compo
this->reputation = propertyEntry->getUInt(14);
Load();
}
}
delete propertyLookup;
}
@@ -111,14 +111,14 @@ std::vector<NiPoint3> PropertyManagementComponent::GetPaths() const
auto result = query.execQuery();
std::vector<NiPoint3> paths {};
if (result.eof())
{
return paths;
}
std::vector<float> points;
std::istringstream stream(result.getStringField(0));
std::string token;
@@ -132,7 +132,7 @@ std::vector<NiPoint3> PropertyManagementComponent::GetPaths() const
}
catch (std::invalid_argument& exception)
{
Game::logger->Log("PropertyManagementComponent", "Failed to parse value (%s): (%s)!\n", token.c_str(), exception.what());
Game::logger->Log("PropertyManagementComponent", "Failed to parse value (%s): (%s)!", token.c_str(), exception.what());
}
}
@@ -149,7 +149,7 @@ PropertyPrivacyOption PropertyManagementComponent::GetPrivacyOption() const
return privacyOption;
}
void PropertyManagementComponent::SetPrivacyOption(PropertyPrivacyOption value)
void PropertyManagementComponent::SetPrivacyOption(PropertyPrivacyOption value)
{
if (owner == LWOOBJID_EMPTY) return;
@@ -241,7 +241,7 @@ bool PropertyManagementComponent::Claim(const LWOOBJID playerId)
}
catch (sql::SQLException& exception)
{
Game::logger->Log("PropertyManagementComponent", "Failed to execute query: (%s)!\n", exception.what());
Game::logger->Log("PropertyManagementComponent", "Failed to execute query: (%s)!", exception.what());
throw exception;
return false;
@@ -254,7 +254,7 @@ bool PropertyManagementComponent::Claim(const LWOOBJID playerId)
return true;
}
void PropertyManagementComponent::OnStartBuilding()
void PropertyManagementComponent::OnStartBuilding()
{
auto* ownerEntity = GetOwner();
@@ -307,7 +307,7 @@ void PropertyManagementComponent::OnFinishBuilding()
void PropertyManagementComponent::UpdateModelPosition(const LWOOBJID id, const NiPoint3 position, NiQuaternion rotation)
{
Game::logger->Log("PropertyManagementComponent", "Placing model <%f, %f, %f>\n", position.x, position.y, position.z);
Game::logger->Log("PropertyManagementComponent", "Placing model <%f, %f, %f>", position.x, position.y, position.z);
auto* entity = GetOwner();
@@ -327,7 +327,7 @@ void PropertyManagementComponent::UpdateModelPosition(const LWOOBJID id, const N
if (item == nullptr)
{
Game::logger->Log("PropertyManagementComponent", "Failed to find item with id %d\n", id);
Game::logger->Log("PropertyManagementComponent", "Failed to find item with id %d", id);
return;
}
@@ -369,7 +369,7 @@ void PropertyManagementComponent::UpdateModelPosition(const LWOOBJID id, const N
item->SetCount(item->GetCount() - 1);
return;
}
item->SetCount(item->GetCount() - 1);
auto* node = new SpawnerNode();
@@ -394,7 +394,7 @@ void PropertyManagementComponent::UpdateModelPosition(const LWOOBJID id, const N
LWOOBJID id = static_cast<LWOOBJID>(persistentId) | 1ull << OBJECT_BIT_CLIENT;
info.spawnerID = id;
const auto spawnerId = dZoneManager::Instance()->MakeSpawner(info);
auto* spawner = dZoneManager::Instance()->GetSpawner(spawnerId);
@@ -429,7 +429,7 @@ void PropertyManagementComponent::UpdateModelPosition(const LWOOBJID id, const N
void PropertyManagementComponent::DeleteModel(const LWOOBJID id, const int deleteReason)
{
Game::logger->Log("PropertyManagementComponent", "Delete model: (%llu) (%i)\n", id, deleteReason);
Game::logger->Log("PropertyManagementComponent", "Delete model: (%llu) (%i)", id, deleteReason);
auto* entity = GetOwner();
@@ -449,34 +449,34 @@ void PropertyManagementComponent::DeleteModel(const LWOOBJID id, const int delet
if (index == models.end())
{
Game::logger->Log("PropertyManagementComponent", "Failed to find model\n");
Game::logger->Log("PropertyManagementComponent", "Failed to find model");
return;
}
const auto spawnerId = index->second;
auto* spawner = dZoneManager::Instance()->GetSpawner(spawnerId);
models.erase(id);
if (spawner == nullptr)
{
Game::logger->Log("PropertyManagementComponent", "Failed to find spawner\n");
Game::logger->Log("PropertyManagementComponent", "Failed to find spawner");
}
auto* model = EntityManager::Instance()->GetEntity(id);
if (model == nullptr)
{
Game::logger->Log("PropertyManagementComponent", "Failed to find model entity\n");
Game::logger->Log("PropertyManagementComponent", "Failed to find model entity");
return;
}
EntityManager::Instance()->DestructEntity(model);
Game::logger->Log("PropertyManagementComponent", "Deleting model LOT %i\n", model->GetLOT());
Game::logger->Log("PropertyManagementComponent", "Deleting model LOT %i", model->GetLOT());
if (model->GetLOT() == 14)
{
@@ -536,7 +536,7 @@ void PropertyManagementComponent::DeleteModel(const LWOOBJID id, const int delet
return;
}
inventoryComponent->AddItem(model->GetLOT(), 1, eLootSourceType::LOOT_SOURCE_DELETION, INVALID, {}, LWOOBJID_EMPTY, false);
auto* item = inventoryComponent->FindItemByLot(model->GetLOT());
@@ -572,10 +572,10 @@ void PropertyManagementComponent::DeleteModel(const LWOOBJID id, const int delet
}
default:
{
Game::logger->Log("PropertyManagementComponent", "Invalid delete reason\n");
Game::logger->Log("PropertyManagementComponent", "Invalid delete reason");
}
}
GameMessages::SendGetModelsOnProperty(entity->GetObjectID(), GetModels(), UNASSIGNED_SYSTEM_ADDRESS);
GameMessages::SendPlaceModelResponse(entity->GetObjectID(), entity->GetSystemAddress(), NiPoint3::ZERO, LWOOBJID_EMPTY, 16, NiQuaternion::IDENTITY);
@@ -593,7 +593,7 @@ void PropertyManagementComponent::DeleteModel(const LWOOBJID id, const int delet
void PropertyManagementComponent::UpdateApprovedStatus(const bool value)
{
if (owner == LWOOBJID_EMPTY) return;
auto* update = Database::CreatePreppedStmt("UPDATE properties SET mod_approved = ? WHERE id = ?;");
update->setBoolean(1, value);
@@ -610,11 +610,11 @@ void PropertyManagementComponent::Load()
{
return;
}
auto* lookup = Database::CreatePreppedStmt("SELECT id, lot, x, y, z, rx, ry, rz, rw, ugc_id FROM properties_contents WHERE property_id = ?;");
lookup->setUInt64(1, propertyId);
auto* lookupResult = lookup->executeQuery();
while (lookupResult->next())
@@ -622,7 +622,7 @@ void PropertyManagementComponent::Load()
const LWOOBJID id = lookupResult->getUInt64(1);
const LOT lot = lookupResult->getInt(2);
const NiPoint3 position =
const NiPoint3 position =
{
static_cast<float>(lookupResult->getDouble(3)),
static_cast<float>(lookupResult->getDouble(4)),
@@ -641,7 +641,7 @@ void PropertyManagementComponent::Load()
node->position = position;
node->rotation = rotation;
SpawnerInfo info{};
info.templateID = lot;
@@ -720,7 +720,7 @@ void PropertyManagementComponent::Save()
try {
lookupResult = lookup->executeQuery();
} catch (sql::SQLException& ex) {
Game::logger->Log("PropertyManagementComponent", "lookup error %s\n", ex.what());
Game::logger->Log("PropertyManagementComponent", "lookup error %s", ex.what());
}
std::vector<LWOOBJID> present;
@@ -734,7 +734,7 @@ void PropertyManagementComponent::Save()
delete lookupResult;
std::vector<LWOOBJID> modelIds;
for (const auto& pair : models)
{
const auto id = pair.second;
@@ -767,7 +767,7 @@ void PropertyManagementComponent::Save()
try {
insertion->execute();
} catch (sql::SQLException& ex) {
Game::logger->Log("PropertyManagementComponent", "Error inserting into properties_contents. Error %s\n", ex.what());
Game::logger->Log("PropertyManagementComponent", "Error inserting into properties_contents. Error %s", ex.what());
}
}
else
@@ -784,7 +784,7 @@ void PropertyManagementComponent::Save()
try {
update->executeUpdate();
} catch (sql::SQLException& ex) {
Game::logger->Log("PropertyManagementComponent", "Error updating properties_contents. Error: %s\n", ex.what());
Game::logger->Log("PropertyManagementComponent", "Error updating properties_contents. Error: %s", ex.what());
}
}
}
@@ -800,7 +800,7 @@ void PropertyManagementComponent::Save()
try {
remove->execute();
} catch (sql::SQLException& ex) {
Game::logger->Log("PropertyManagementComponent", "Error removing from properties_contents. Error %s\n", ex.what());
Game::logger->Log("PropertyManagementComponent", "Error removing from properties_contents. Error %s", ex.what());
}
}
@@ -815,7 +815,7 @@ void PropertyManagementComponent::Save()
delete remove;
}
void PropertyManagementComponent::AddModel(LWOOBJID modelId, LWOOBJID spawnerId)
void PropertyManagementComponent::AddModel(LWOOBJID modelId, LWOOBJID spawnerId)
{
models[modelId] = spawnerId;
}
@@ -834,7 +834,7 @@ void PropertyManagementComponent::OnQueryPropertyData(Entity* originator, const
const auto& worldId = dZoneManager::Instance()->GetZone()->GetZoneID();
const auto zoneId = worldId.GetMapID();
Game::logger->Log("Properties", "Getting property info for %d\n", zoneId);
Game::logger->Log("Properties", "Getting property info for %d", zoneId);
GameMessages::PropertyDataMessage message = GameMessages::PropertyDataMessage(zoneId);
const auto isClaimed = GetOwnerId() != LWOOBJID_EMPTY;
@@ -845,7 +845,7 @@ void PropertyManagementComponent::OnQueryPropertyData(Entity* originator, const
std::string description = "";
uint64_t claimed = 0;
char privacy = 0;
if (isClaimed) {
const auto cloneId = worldId.GetCloneID();
@@ -904,7 +904,7 @@ void PropertyManagementComponent::OnQueryPropertyData(Entity* originator, const
// send rejection here?
}
void PropertyManagementComponent::OnUse(Entity* originator)
void PropertyManagementComponent::OnUse(Entity* originator)
{
OnQueryPropertyData(originator, UNASSIGNED_SYSTEM_ADDRESS);
GameMessages::SendOpenPropertyManagment(m_Parent->GetObjectID(), originator->GetSystemAddress());

View File

@@ -22,7 +22,7 @@ void PropertyVendorComponent::OnUse(Entity* originator)
if (PropertyManagementComponent::Instance()->GetOwnerId() == LWOOBJID_EMPTY)
{
Game::logger->Log("PropertyVendorComponent", "Property vendor opening!\n");
Game::logger->Log("PropertyVendorComponent", "Property vendor opening!");
GameMessages::SendOpenPropertyVendor(m_Parent->GetObjectID(), originator->GetSystemAddress());
@@ -42,7 +42,7 @@ void PropertyVendorComponent::OnBuyFromVendor(Entity* originator, const bool con
if (PropertyManagementComponent::Instance() == nullptr) return;
if (PropertyManagementComponent::Instance()->Claim(originator->GetObjectID()) == false) {
Game::logger->Log("PropertyVendorComponent", "FAILED TO CLAIM PROPERTY. PLAYER ID IS %llu\n", originator->GetObjectID());
Game::logger->Log("PropertyVendorComponent", "FAILED TO CLAIM PROPERTY. PLAYER ID IS %llu", originator->GetObjectID());
return;
}
@@ -51,11 +51,11 @@ void PropertyVendorComponent::OnBuyFromVendor(Entity* originator, const bool con
auto* controller = dZoneManager::Instance()->GetZoneControlObject();
controller->OnFireEventServerSide(m_Parent, "propertyRented");
PropertyManagementComponent::Instance()->SetOwner(originator);
PropertyManagementComponent::Instance()->OnQueryPropertyData(originator, originator->GetSystemAddress());
Game::logger->Log("PropertyVendorComponent", "Fired event; (%d) (%i) (%i)\n", confirmed, lot, count);
Game::logger->Log("PropertyVendorComponent", "Fired event; (%d) (%i) (%i)", confirmed, lot, count);
}

View File

@@ -91,7 +91,7 @@ void RacingControlComponent::OnPlayerLoaded(Entity *player) {
m_LoadedPlayers++;
Game::logger->Log("RacingControlComponent", "Loading player %i\n",
Game::logger->Log("RacingControlComponent", "Loading player %i",
m_LoadedPlayers);
m_LobbyPlayers.push_back(objectID);
@@ -116,7 +116,7 @@ void RacingControlComponent::LoadPlayerVehicle(Entity *player,
auto *item = inventoryComponent->FindItemByLot(8092);
if (item == nullptr) {
Game::logger->Log("RacingControlComponent", "Failed to find item\n");
Game::logger->Log("RacingControlComponent", "Failed to find item");
return;
}
@@ -149,7 +149,7 @@ void RacingControlComponent::LoadPlayerVehicle(Entity *player,
startRotation = NiQuaternion::FromEulerAngles(angles);
Game::logger->Log("RacingControlComponent",
"Start position <%f, %f, %f>, <%f, %f, %f>\n",
"Start position <%f, %f, %f>, <%f, %f, %f>",
startPosition.x, startPosition.y, startPosition.z,
angles.x * (180.0f / M_PI), angles.y * (180.0f / M_PI),
angles.z * (180.0f / M_PI));
@@ -565,11 +565,11 @@ void RacingControlComponent::Update(float deltaTime) {
// to load in, can raise this if it's too low
if (m_LoadTimer >= 15) {
Game::logger->Log("RacingControlComponent",
"Loading all players...\n");
"Loading all players...");
for (size_t i = 0; i < m_LobbyPlayers.size(); i++) {
Game::logger->Log("RacingControlComponent",
"Loading player now!\n");
"Loading player now!");
auto *player =
EntityManager::Instance()->GetEntity(m_LobbyPlayers[i]);
@@ -579,7 +579,7 @@ void RacingControlComponent::Update(float deltaTime) {
}
Game::logger->Log("RacingControlComponent",
"Loading player now NOW!\n");
"Loading player now NOW!");
LoadPlayerVehicle(player, true);
@@ -729,7 +729,7 @@ void RacingControlComponent::Update(float deltaTime) {
m_Started = true;
Game::logger->Log("RacingControlComponent", "Starting race\n");
Game::logger->Log("RacingControlComponent", "Starting race");
EntityManager::Instance()->SerializeEntity(m_Parent);
@@ -833,7 +833,7 @@ void RacingControlComponent::Update(float deltaTime) {
player.bestLapTime = lapTime;
Game::logger->Log("RacingControlComponent",
"Best lap time (%llu)\n", lapTime);
"Best lap time (%llu)", lapTime);
}
auto *missionComponent =
@@ -854,7 +854,7 @@ void RacingControlComponent::Update(float deltaTime) {
player.raceTime = raceTime;
Game::logger->Log("RacingControlComponent",
"Completed time %llu, %llu\n",
"Completed time %llu, %llu",
raceTime, raceTime * 1000);
// Entire race time
@@ -870,12 +870,12 @@ void RacingControlComponent::Update(float deltaTime) {
}
Game::logger->Log("RacingControlComponent",
"Lapped (%i) in (%llu)\n", player.lap,
"Lapped (%i) in (%llu)", player.lap,
lapTime);
}
Game::logger->Log("RacingControlComponent",
"Reached point (%i)/(%i)\n", player.respawnIndex,
"Reached point (%i)/(%i)", player.respawnIndex,
path->pathWaypoints.size());
break;

View File

@@ -28,12 +28,12 @@ RebuildComponent::RebuildComponent(Entity* entity) : Component(entity) {
// Should a setting that has the build activator position exist, fetch that setting here and parse it for position.
// It is assumed that the user who sets this setting uses the correct character delimiter (character 31 or in hex 0x1F)
auto positionAsVector = GeneralUtils::SplitString(m_Parent->GetVarAsString(u"rebuild_activators"), 0x1F);
if (positionAsVector.size() == 3 &&
if (positionAsVector.size() == 3 &&
GeneralUtils::TryParse(positionAsVector[0], m_ActivatorPosition.x) &&
GeneralUtils::TryParse(positionAsVector[1], m_ActivatorPosition.y) &&
GeneralUtils::TryParse(positionAsVector[1], m_ActivatorPosition.y) &&
GeneralUtils::TryParse(positionAsVector[2], m_ActivatorPosition.z)) {
} else {
Game::logger->Log("RebuildComponent", "Failed to find activator position for lot %i. Defaulting to parents position.\n", m_Parent->GetLOT());
Game::logger->Log("RebuildComponent", "Failed to find activator position for lot %i. Defaulting to parents position.", m_Parent->GetLOT());
m_ActivatorPosition = m_Parent->GetPosition();
}
@@ -47,7 +47,7 @@ RebuildComponent::~RebuildComponent() {
if (builder) {
CancelRebuild(builder, eFailReason::REASON_BUILD_ENDED, true);
}
DespawnActivator();
}
@@ -61,7 +61,7 @@ void RebuildComponent::Serialize(RakNet::BitStream* outBitStream, bool bIsInitia
outBitStream->Write(false);
}
// If build state is completed and we've already serialized once in the completed state,
// If build state is completed and we've already serialized once in the completed state,
// don't serializing this component anymore as this will cause the build to jump again.
// If state changes, serialization will begin again.
if (!m_StateDirty && m_State == REBUILD_COMPLETED) {
@@ -93,7 +93,7 @@ void RebuildComponent::Serialize(RakNet::BitStream* outBitStream, bool bIsInitia
outBitStream->Write(m_ShowResetEffect);
outBitStream->Write(m_Activator != nullptr);
outBitStream->Write(m_Timer);
outBitStream->Write(m_TimerIncomplete);
@@ -146,7 +146,7 @@ void RebuildComponent::Update(float deltaTime) {
}
}
}
break;
}
case REBUILD_COMPLETED: {
@@ -272,7 +272,7 @@ void RebuildComponent::SpawnActivator() {
void RebuildComponent::DespawnActivator() {
if (m_Activator) {
EntityManager::Instance()->DestructEntity(m_Activator);
m_Activator->ScheduleKillAfterUpdate();
m_Activator = nullptr;
@@ -281,7 +281,7 @@ void RebuildComponent::DespawnActivator() {
}
}
Entity* RebuildComponent::GetActivator()
Entity* RebuildComponent::GetActivator()
{
return EntityManager::Instance()->GetEntity(m_ActivatorId);
}
@@ -431,13 +431,13 @@ void RebuildComponent::CompleteRebuild(Entity* user) {
if (user == nullptr) {
return;
}
auto* characterComponent = user->GetComponent<CharacterComponent>();
if (characterComponent != nullptr) {
characterComponent->SetCurrentActivity(eGameActivities::ACTIVITY_NONE);
characterComponent->TrackRebuildComplete();
} else {
Game::logger->Log("RebuildComponent", "Some user tried to finish the rebuild but they didn't have a character somehow.\n");
Game::logger->Log("RebuildComponent", "Some user tried to finish the rebuild but they didn't have a character somehow.");
return;
}
@@ -447,7 +447,7 @@ void RebuildComponent::CompleteRebuild(Entity* user) {
GameMessages::SendPlayFXEffect(m_Parent, 507, u"create", "BrickFadeUpVisCompleteEffect", LWOOBJID_EMPTY, 0.4f, 1.0f, true);
GameMessages::SendEnableRebuild(m_Parent, false, false, true, eFailReason::REASON_NOT_GIVEN, m_ResetTime, user->GetObjectID());
GameMessages::SendTerminateInteraction(user->GetObjectID(), eTerminateType::FROM_INTERACTION, m_Parent->GetObjectID());
m_State = eRebuildState::REBUILD_COMPLETED;
m_StateDirty = true;
@@ -528,7 +528,7 @@ void RebuildComponent::ResetRebuild(bool failed) {
m_TimerIncomplete = 0.0f;
m_ShowResetEffect = false;
m_DrainedImagination = 0;
EntityManager::Instance()->SerializeEntity(m_Parent);
// Notify scripts and possible subscribers

View File

@@ -57,7 +57,7 @@ void RocketLaunchpadControlComponent::Launch(Entity* originator, LWOMAPID mapId,
auto* rocket = characterComponent->GetRocket(originator);
if (!rocket) {
Game::logger->Log("RocketLaunchpadControlComponent", "Unable to find rocket!\n");
Game::logger->Log("RocketLaunchpadControlComponent", "Unable to find rocket!");
return;
}
@@ -79,7 +79,7 @@ void RocketLaunchpadControlComponent::Launch(Entity* originator, LWOMAPID mapId,
SetSelectedMapId(originator->GetObjectID(), zone);
GameMessages::SendFireEventClientSide(m_Parent->GetObjectID(), originator->GetSystemAddress(), u"RocketEquipped", rocket->GetId(), cloneId, -1, originator->GetObjectID());
GameMessages::SendChangeObjectWorldState(rocket->GetId(), WORLDSTATE_ATTACHED, UNASSIGNED_SYSTEM_ADDRESS);
EntityManager::Instance()->SerializeEntity(originator);

View File

@@ -185,7 +185,7 @@ void ScriptedActivityComponent::PlayerLeave(LWOOBJID playerID) {
delete lobby->players[i];
lobby->players[i] = nullptr;
lobby->players.erase(lobby->players.begin() + i);
return;
}
}
@@ -246,7 +246,7 @@ void ScriptedActivityComponent::Update(float deltaTime) {
// The timer has elapsed, start the instance
if (lobby->timer <= 0.0f) {
Game::logger->Log("ScriptedActivityComponent", "Setting up instance.\n");
Game::logger->Log("ScriptedActivityComponent", "Setting up instance.");
ActivityInstance* instance = NewInstance();
LoadPlayersIntoInstance(instance, lobby->players);
@@ -397,7 +397,7 @@ void ScriptedActivityComponent::ClearInstances() {
m_Instances.clear();
}
ActivityPlayer* ScriptedActivityComponent::GetActivityPlayerData(LWOOBJID playerID)
ActivityPlayer* ScriptedActivityComponent::GetActivityPlayerData(LWOOBJID playerID)
{
for (auto* activityData : m_ActivityPlayers)
{
@@ -410,7 +410,7 @@ ActivityPlayer* ScriptedActivityComponent::GetActivityPlayerData(LWOOBJID player
return nullptr;
}
void ScriptedActivityComponent::RemoveActivityPlayerData(LWOOBJID playerID)
void ScriptedActivityComponent::RemoveActivityPlayerData(LWOOBJID playerID)
{
for (size_t i = 0; i < m_ActivityPlayers.size(); i++)
{
@@ -427,7 +427,7 @@ void ScriptedActivityComponent::RemoveActivityPlayerData(LWOOBJID playerID)
}
}
ActivityPlayer* ScriptedActivityComponent::AddActivityPlayerData(LWOOBJID playerID)
ActivityPlayer* ScriptedActivityComponent::AddActivityPlayerData(LWOOBJID playerID)
{
auto* data = GetActivityPlayerData(playerID);
if (data != nullptr)
@@ -515,7 +515,7 @@ void ActivityInstance::StartZone() {
if (player == nullptr)
return;
Game::logger->Log("UserManager", "Transferring %s to Zone %i (Instance %i | Clone %i | Mythran Shift: %s) with IP %s and Port %i\n", player->GetCharacter()->GetName().c_str(), zoneID, zoneInstance, zoneClone, mythranShift == true ? "true" : "false", serverIP.c_str(), serverPort);
Game::logger->Log("UserManager", "Transferring %s to Zone %i (Instance %i | Clone %i | Mythran Shift: %s) with IP %s and Port %i", player->GetCharacter()->GetName().c_str(), zoneID, zoneInstance, zoneClone, mythranShift == true ? "true" : "false", serverIP.c_str(), serverPort);
if (player->GetCharacter()) {
player->GetCharacter()->SetZoneID(zoneID);
player->GetCharacter()->SetZoneInstance(zoneInstance);
@@ -526,7 +526,7 @@ void ActivityInstance::StartZone() {
return;
});
}
m_NextZoneCloneID++;
}
@@ -565,7 +565,7 @@ std::vector<Entity*> ActivityInstance::GetParticipants() const {
if (entity != nullptr)
entities.push_back(entity);
}
return entities;
}

View File

@@ -52,7 +52,7 @@ void SkillComponent::SyncPlayerSkill(const uint32_t skillUid, const uint32_t syn
if (index == this->m_managedBehaviors.end())
{
Game::logger->Log("SkillComponent", "Failed to find skill with uid (%i)!\n", skillUid, syncId);
Game::logger->Log("SkillComponent", "Failed to find skill with uid (%i)!", skillUid, syncId);
return;
}
@@ -81,7 +81,7 @@ void SkillComponent::SyncPlayerProjectile(const LWOOBJID projectileId, RakNet::B
if (index == -1)
{
Game::logger->Log("SkillComponent", "Failed to find projectile id (%llu)!\n", projectileId);
Game::logger->Log("SkillComponent", "Failed to find projectile id (%llu)!", projectileId);
return;
}
@@ -95,7 +95,7 @@ void SkillComponent::SyncPlayerProjectile(const LWOOBJID projectileId, RakNet::B
auto result = query.execQuery();
if (result.eof()) {
Game::logger->Log("SkillComponent", "Failed to find skill id for (%i)!\n", sync_entry.lot);
Game::logger->Log("SkillComponent", "Failed to find skill id for (%i)!", sync_entry.lot);
return;
}
@@ -432,7 +432,7 @@ void SkillComponent::SyncProjectileCalculation(const ProjectileSyncEntry& entry)
if (other == nullptr) {
if (entry.branchContext.target != LWOOBJID_EMPTY)
{
Game::logger->Log("SkillComponent", "Invalid projectile target (%llu)!\n", entry.branchContext.target);
Game::logger->Log("SkillComponent", "Invalid projectile target (%llu)!", entry.branchContext.target);
}
return;
@@ -444,7 +444,7 @@ void SkillComponent::SyncProjectileCalculation(const ProjectileSyncEntry& entry)
auto result = query.execQuery();
if (result.eof()) {
Game::logger->Log("SkillComponent", "Failed to find skill id for (%i)!\n", entry.lot);
Game::logger->Log("SkillComponent", "Failed to find skill id for (%i)!", entry.lot);
return;
}