Fix whitespace

Convert to tabs and remove trailing whitespace
This commit is contained in:
TheMatt2 2022-01-15 14:02:14 -05:00
parent 4ff84e0730
commit 9dfa401b27
8 changed files with 108 additions and 108 deletions

View File

@ -185,8 +185,8 @@ Behavior* Behavior::CreateBehavior(const uint32_t behaviorId)
break; break;
case BehaviorTemplates::BEHAVIOR_JETPACK: break; case BehaviorTemplates::BEHAVIOR_JETPACK: break;
case BehaviorTemplates::BEHAVIOR_SKILL_EVENT: case BehaviorTemplates::BEHAVIOR_SKILL_EVENT:
behavior = new SkillEventBehavior(behaviorId); behavior = new SkillEventBehavior(behaviorId);
break; break;
case BehaviorTemplates::BEHAVIOR_CONSUME_ITEM: break; case BehaviorTemplates::BEHAVIOR_CONSUME_ITEM: break;
case BehaviorTemplates::BEHAVIOR_SKILL_CAST_FAILED: case BehaviorTemplates::BEHAVIOR_SKILL_CAST_FAILED:
behavior = new SkillCastFailedBehavior(behaviorId); behavior = new SkillCastFailedBehavior(behaviorId);
@ -414,11 +414,11 @@ Behavior::Behavior(const uint32_t behaviorId)
this->m_templateId = BehaviorTemplates::BEHAVIOR_EMPTY; this->m_templateId = BehaviorTemplates::BEHAVIOR_EMPTY;
} }
auto query = CDClientDatabase::CreatePreppedStmt( auto query = CDClientDatabase::CreatePreppedStmt(
"SELECT templateID, effectID, effectHandle FROM BehaviorTemplate WHERE behaviorID = ?;"); "SELECT templateID, effectID, effectHandle FROM BehaviorTemplate WHERE behaviorID = ?;");
query.bind(1, (int) behaviorId); query.bind(1, (int) behaviorId);
auto result = query.execQuery(); auto result = query.execQuery();
// Make sure we do not proceed if we are trying to load an invalid behavior // Make sure we do not proceed if we are trying to load an invalid behavior
if (result.eof()) if (result.eof())
@ -493,7 +493,7 @@ std::map<std::string, float> Behavior::GetParameterNames() const
auto query = CDClientDatabase::CreatePreppedStmt( auto query = CDClientDatabase::CreatePreppedStmt(
"SELECT parameterID, value FROM BehaviorParameter WHERE behaviorID = ?;"); "SELECT parameterID, value FROM BehaviorParameter WHERE behaviorID = ?;");
query.bind(1, (int) this->m_behaviorId); query.bind(1, (int) this->m_behaviorId);
auto tableData = query.execQuery(); auto tableData = query.execQuery();

View File

@ -105,7 +105,7 @@ void DestroyableComponent::Serialize(RakNet::BitStream* outBitStream, bool bIsIn
outBitStream->Write0(); //Contains info about immunities this object has, but it's left out for now. outBitStream->Write0(); //Contains info about immunities this object has, but it's left out for now.
} }
outBitStream->Write(m_DirtyHealth || bIsInitialUpdate); outBitStream->Write(m_DirtyHealth || bIsInitialUpdate);
if (m_DirtyHealth || bIsInitialUpdate) { if (m_DirtyHealth || bIsInitialUpdate) {
outBitStream->Write(m_iHealth); outBitStream->Write(m_iHealth);
outBitStream->Write(m_fMaxHealth); outBitStream->Write(m_fMaxHealth);
@ -113,12 +113,12 @@ void DestroyableComponent::Serialize(RakNet::BitStream* outBitStream, bool bIsIn
outBitStream->Write(m_fMaxArmor); outBitStream->Write(m_fMaxArmor);
outBitStream->Write(m_iImagination); outBitStream->Write(m_iImagination);
outBitStream->Write(m_fMaxImagination); outBitStream->Write(m_fMaxImagination);
outBitStream->Write(m_DamageToAbsorb); outBitStream->Write(m_DamageToAbsorb);
outBitStream->Write(IsImmune()); outBitStream->Write(IsImmune());
outBitStream->Write(m_IsGMImmune); outBitStream->Write(m_IsGMImmune);
outBitStream->Write(m_IsShielded); outBitStream->Write(m_IsShielded);
outBitStream->Write(m_fMaxHealth); outBitStream->Write(m_fMaxHealth);
outBitStream->Write(m_fMaxArmor); outBitStream->Write(m_fMaxArmor);
outBitStream->Write(m_fMaxImagination); outBitStream->Write(m_fMaxImagination);
@ -129,14 +129,14 @@ void DestroyableComponent::Serialize(RakNet::BitStream* outBitStream, bool bIsIn
} }
outBitStream->Write(m_IsSmashable); outBitStream->Write(m_IsSmashable);
if (bIsInitialUpdate) { if (bIsInitialUpdate) {
outBitStream->Write(m_IsDead); outBitStream->Write(m_IsDead);
outBitStream->Write(m_IsSmashed); outBitStream->Write(m_IsSmashed);
if (m_IsSmashable) { if (m_IsSmashable) {
outBitStream->Write(m_HasBricks); outBitStream->Write(m_HasBricks);
if (m_ExplodeFactor != 1.0f) { if (m_ExplodeFactor != 1.0f) {
outBitStream->Write1(); outBitStream->Write1();
outBitStream->Write(m_ExplodeFactor); outBitStream->Write(m_ExplodeFactor);
@ -145,10 +145,10 @@ void DestroyableComponent::Serialize(RakNet::BitStream* outBitStream, bool bIsIn
} }
} }
} }
m_DirtyHealth = false; m_DirtyHealth = false;
} }
if (m_DirtyThreatList || bIsInitialUpdate) { if (m_DirtyThreatList || bIsInitialUpdate) {
outBitStream->Write1(); outBitStream->Write1();
outBitStream->Write(m_HasThreats); outBitStream->Write(m_HasThreats);
@ -166,7 +166,7 @@ void DestroyableComponent::LoadFromXML(tinyxml2::XMLDocument* doc) {
} }
auto* buffComponent = m_Parent->GetComponent<BuffComponent>(); auto* buffComponent = m_Parent->GetComponent<BuffComponent>();
if (buffComponent != nullptr) { if (buffComponent != nullptr) {
buffComponent->LoadFromXML(doc); buffComponent->LoadFromXML(doc);
} }
@ -186,9 +186,9 @@ void DestroyableComponent::UpdateXml(tinyxml2::XMLDocument* doc) {
Game::logger->Log("DestroyableComponent", "Failed to find dest tag!\n"); Game::logger->Log("DestroyableComponent", "Failed to find dest tag!\n");
return; return;
} }
auto* buffComponent = m_Parent->GetComponent<BuffComponent>(); auto* buffComponent = m_Parent->GetComponent<BuffComponent>();
if (buffComponent != nullptr) { if (buffComponent != nullptr) {
buffComponent->UpdateXml(doc); buffComponent->UpdateXml(doc);
} }
@ -233,7 +233,7 @@ void DestroyableComponent::SetMaxHealth(float value, bool playAnim) {
args.InsertValue("type", type); args.InsertValue("type", type);
GameMessages::SendUIMessageServerToSingleClient(m_Parent, m_Parent->GetParentUser()->GetSystemAddress(), "MaxPlayerBarUpdate", &args); GameMessages::SendUIMessageServerToSingleClient(m_Parent, m_Parent->GetParentUser()->GetSystemAddress(), "MaxPlayerBarUpdate", &args);
delete amount; delete amount;
delete type; delete type;
} }
@ -279,7 +279,7 @@ void DestroyableComponent::SetMaxArmor(float value, bool playAnim) {
args.InsertValue("type", type); args.InsertValue("type", type);
GameMessages::SendUIMessageServerToSingleClient(m_Parent, m_Parent->GetParentUser()->GetSystemAddress(), "MaxPlayerBarUpdate", &args); GameMessages::SendUIMessageServerToSingleClient(m_Parent, m_Parent->GetParentUser()->GetSystemAddress(), "MaxPlayerBarUpdate", &args);
delete amount; delete amount;
delete type; delete type;
} }
@ -325,7 +325,7 @@ void DestroyableComponent::SetMaxImagination(float value, bool playAnim) {
args.InsertValue("type", type); args.InsertValue("type", type);
GameMessages::SendUIMessageServerToSingleClient(m_Parent, m_Parent->GetParentUser()->GetSystemAddress(), "MaxPlayerBarUpdate", &args); GameMessages::SendUIMessageServerToSingleClient(m_Parent, m_Parent->GetParentUser()->GetSystemAddress(), "MaxPlayerBarUpdate", &args);
delete amount; delete amount;
delete type; delete type;
} }
@ -340,7 +340,7 @@ void DestroyableComponent::SetDamageToAbsorb(int32_t value)
m_DamageToAbsorb = value; m_DamageToAbsorb = value;
} }
void DestroyableComponent::SetDamageReduction(int32_t value) void DestroyableComponent::SetDamageReduction(int32_t value)
{ {
m_DirtyHealth = true; m_DirtyHealth = true;
m_DamageReduction = value; m_DamageReduction = value;
@ -352,7 +352,7 @@ void DestroyableComponent::SetIsImmune(bool value)
m_ImmuneStacks = value ? 1 : 0; m_ImmuneStacks = value ? 1 : 0;
} }
void DestroyableComponent::SetIsGMImmune(bool value) void DestroyableComponent::SetIsGMImmune(bool value)
{ {
m_DirtyHealth = true; m_DirtyHealth = true;
m_IsGMImmune = value; m_IsGMImmune = value;
@ -375,7 +375,7 @@ void DestroyableComponent::AddFaction(const int32_t factionID, const bool ignore
auto query = CDClientDatabase::CreatePreppedStmt( auto query = CDClientDatabase::CreatePreppedStmt(
"SELECT enemyList FROM Factions WHERE faction = ?;"); "SELECT enemyList FROM Factions WHERE faction = ?;");
query.bind(1, (int) factionID); query.bind(1, (int) factionID);
auto result = query.execQuery(); auto result = query.execQuery();
@ -387,10 +387,10 @@ void DestroyableComponent::AddFaction(const int32_t factionID, const bool ignore
std::stringstream ss(list_string); std::stringstream ss(list_string);
std::string token; std::string token;
while (std::getline(ss, token, ',')) { while (std::getline(ss, token, ',')) {
if (token.empty()) continue; if (token.empty()) continue;
auto id = std::stoi(token); auto id = std::stoi(token);
auto exclude = std::find(m_FactionIDs.begin(), m_FactionIDs.end(), id) != m_FactionIDs.end(); auto exclude = std::find(m_FactionIDs.begin(), m_FactionIDs.end(), id) != m_FactionIDs.end();
@ -404,7 +404,7 @@ void DestroyableComponent::AddFaction(const int32_t factionID, const bool ignore
{ {
continue; continue;
} }
AddEnemyFaction(id); AddEnemyFaction(id);
} }
@ -521,7 +521,7 @@ bool DestroyableComponent::CheckValidity(const LWOOBJID target, const bool ignor
if (quickbuild != nullptr) if (quickbuild != nullptr)
{ {
const auto state = quickbuild->GetState(); const auto state = quickbuild->GetState();
if (state != REBUILD_COMPLETED) if (state != REBUILD_COMPLETED)
{ {
return false; return false;
@ -568,7 +568,7 @@ void DestroyableComponent::Imagine(const int32_t deltaImagination)
{ {
auto current = static_cast<int32_t>(GetImagination()); auto current = static_cast<int32_t>(GetImagination());
const auto max = static_cast<int32_t>(GetMaxImagination()); const auto max = static_cast<int32_t>(GetMaxImagination());
current += deltaImagination; current += deltaImagination;
current = std::min(current, max); current = std::min(current, max);
@ -641,7 +641,7 @@ void DestroyableComponent::Damage(uint32_t damage, const LWOOBJID source, bool e
damage -= absorbDamage; damage -= absorbDamage;
absorb -= absorbDamage; absorb -= absorbDamage;
const auto armorDamage = std::min(damage, armor); const auto armorDamage = std::min(damage, armor);
damage -= armorDamage; damage -= armorDamage;
@ -663,7 +663,7 @@ void DestroyableComponent::Damage(uint32_t damage, const LWOOBJID source, bool e
{ {
EntityManager::Instance()->SerializeEntity(m_Parent); EntityManager::Instance()->SerializeEntity(m_Parent);
} }
auto* attacker = EntityManager::Instance()->GetEntity(source); auto* attacker = EntityManager::Instance()->GetEntity(source);
m_Parent->OnHit(attacker); m_Parent->OnHit(attacker);
m_Parent->OnHitOrHealResult(attacker, sourceDamage); m_Parent->OnHitOrHealResult(attacker, sourceDamage);
@ -741,7 +741,7 @@ void DestroyableComponent::Smash(const LWOOBJID source, const eKillType killType
} }
} }
} }
const auto isPlayer = m_Parent->IsPlayer(); const auto isPlayer = m_Parent->IsPlayer();
GameMessages::SendDie( GameMessages::SendDie(
@ -783,14 +783,14 @@ void DestroyableComponent::Smash(const LWOOBJID source, const eKillType killType
auto* member = EntityManager::Instance()->GetEntity(specificOwner); auto* member = EntityManager::Instance()->GetEntity(specificOwner);
if (member) LootGenerator::Instance().DropLoot(member, m_Parent, lootMatrixId, GetMinCoins(), GetMaxCoins()); if (member) LootGenerator::Instance().DropLoot(member, m_Parent, lootMatrixId, GetMinCoins(), GetMaxCoins());
} }
else { else {
for (const auto memberId : team->members) { // Free for all for (const auto memberId : team->members) { // Free for all
auto* member = EntityManager::Instance()->GetEntity(memberId); auto* member = EntityManager::Instance()->GetEntity(memberId);
if (member == nullptr) continue; if (member == nullptr) continue;
LootGenerator::Instance().DropLoot(member, m_Parent, lootMatrixId, GetMinCoins(), GetMaxCoins()); LootGenerator::Instance().DropLoot(member, m_Parent, lootMatrixId, GetMinCoins(), GetMaxCoins());
} }
} }
} }
@ -821,7 +821,7 @@ void DestroyableComponent::Smash(const LWOOBJID source, const eKillType killType
} }
coinsTotal -= coinsToLoose; coinsTotal -= coinsToLoose;
LootGenerator::Instance().DropLoot(m_Parent, m_Parent, -1, coinsToLoose, coinsToLoose); LootGenerator::Instance().DropLoot(m_Parent, m_Parent, -1, coinsToLoose, coinsToLoose);
} }
@ -862,7 +862,7 @@ void DestroyableComponent::PopImmunity(int32_t stacks)
m_ImmuneStacks -= stacks; m_ImmuneStacks -= stacks;
} }
void DestroyableComponent::FixStats() void DestroyableComponent::FixStats()
{ {
auto* entity = GetParent(); auto* entity = GetParent();
@ -920,7 +920,7 @@ void DestroyableComponent::FixStats()
// Add the stats // Add the stats
const auto& info = mission->GetClientInfo(); const auto& info = mission->GetClientInfo();
maxHealth += info.reward_maxhealth; maxHealth += info.reward_maxhealth;
maxImagination += info.reward_maximagination; maxImagination += info.reward_maximagination;
} }

View File

@ -19,11 +19,11 @@
RocketLaunchpadControlComponent::RocketLaunchpadControlComponent(Entity* parent, int rocketId) : Component(parent) { RocketLaunchpadControlComponent::RocketLaunchpadControlComponent(Entity* parent, int rocketId) : Component(parent) {
auto query = CDClientDatabase::CreatePreppedStmt( auto query = CDClientDatabase::CreatePreppedStmt(
"SELECT targetZone, defaultZoneID, targetScene, altLandingPrecondition, altLandingSpawnPointName FROM RocketLaunchpadControlComponent WHERE id = ?;"); "SELECT targetZone, defaultZoneID, targetScene, altLandingPrecondition, altLandingSpawnPointName FROM RocketLaunchpadControlComponent WHERE id = ?;");
query.bind(1, rocketId); query.bind(1, rocketId);
auto result = query.execQuery(); auto result = query.execQuery();
if (!result.eof() && !result.fieldIsNull(0)) if (!result.eof() && !result.fieldIsNull(0))
{ {
m_TargetZone = result.getIntField(0); m_TargetZone = result.getIntField(0);
@ -59,7 +59,7 @@ void RocketLaunchpadControlComponent::Launch(Entity* originator, LWOOBJID option
{ {
return; return;
} }
TellMasterToPrepZone(zone); TellMasterToPrepZone(zone);
// This also gets triggered by a proximity monitor + item equip, I will set that up when havok is ready // This also gets triggered by a proximity monitor + item equip, I will set that up when havok is ready
@ -80,7 +80,7 @@ void RocketLaunchpadControlComponent::Launch(Entity* originator, LWOOBJID option
{ {
rocket = inventoryComponent->FindItemById(optionalRocketID); rocket = inventoryComponent->FindItemById(optionalRocketID);
} }
if (rocket == nullptr) if (rocket == nullptr)
{ {
rocket = inventoryComponent->FindItemById(characterComponent->GetLastRocketItemID()); rocket = inventoryComponent->FindItemById(characterComponent->GetLastRocketItemID());
@ -131,7 +131,7 @@ void RocketLaunchpadControlComponent::Launch(Entity* originator, LWOOBJID option
} }
} }
} }
// Store the last used rocket item's ID // Store the last used rocket item's ID
characterComponent->SetLastRocketItemID(rocket->GetId()); characterComponent->SetLastRocketItemID(rocket->GetId());
@ -140,13 +140,13 @@ void RocketLaunchpadControlComponent::Launch(Entity* originator, LWOOBJID option
character->SaveXMLToDatabase(); character->SaveXMLToDatabase();
SetSelectedMapId(originator->GetObjectID(), zone); SetSelectedMapId(originator->GetObjectID(), zone);
GameMessages::SendFireEventClientSide(m_Parent->GetObjectID(), originator->GetSystemAddress(), u"RocketEquipped", rocket->GetId(), cloneId, -1, originator->GetObjectID()); GameMessages::SendFireEventClientSide(m_Parent->GetObjectID(), originator->GetSystemAddress(), u"RocketEquipped", rocket->GetId(), cloneId, -1, originator->GetObjectID());
rocket->Equip(true); rocket->Equip(true);
GameMessages::SendChangeObjectWorldState(rocket->GetId(), WORLDSTATE_ATTACHED, UNASSIGNED_SYSTEM_ADDRESS); GameMessages::SendChangeObjectWorldState(rocket->GetId(), WORLDSTATE_ATTACHED, UNASSIGNED_SYSTEM_ADDRESS);
EntityManager::Instance()->SerializeEntity(originator); EntityManager::Instance()->SerializeEntity(originator);
} }
@ -167,7 +167,7 @@ void RocketLaunchpadControlComponent::OnProximityUpdate(Entity* entering, std::s
// Proximity rockets are handled by item equipment // Proximity rockets are handled by item equipment
} }
void RocketLaunchpadControlComponent::SetSelectedMapId(LWOOBJID player, LWOMAPID mapID) void RocketLaunchpadControlComponent::SetSelectedMapId(LWOOBJID player, LWOMAPID mapID)
{ {
m_SelectedMapIds[player] = mapID; m_SelectedMapIds[player] = mapID;
} }
@ -181,7 +181,7 @@ LWOMAPID RocketLaunchpadControlComponent::GetSelectedMapId(LWOOBJID player) cons
return index->second; return index->second;
} }
void RocketLaunchpadControlComponent::SetSelectedCloneId(LWOOBJID player, LWOCLONEID cloneId) void RocketLaunchpadControlComponent::SetSelectedCloneId(LWOOBJID player, LWOCLONEID cloneId)
{ {
m_SelectedCloneIds[player] = cloneId; m_SelectedCloneIds[player] = cloneId;
} }

View File

@ -36,11 +36,11 @@ bool SkillComponent::CastPlayerSkill(const uint32_t behaviorId, const uint32_t s
auto* behavior = Behavior::CreateBehavior(behaviorId); auto* behavior = Behavior::CreateBehavior(behaviorId);
const auto branch = BehaviorBranchContext(target, 0); const auto branch = BehaviorBranchContext(target, 0);
behavior->Handle(context, bitStream, branch); behavior->Handle(context, bitStream, branch);
context->ExecuteUpdates(); context->ExecuteUpdates();
return !context->failed; return !context->failed;
} }
@ -76,11 +76,11 @@ void SkillComponent::SyncPlayerProjectile(const LWOOBJID projectileId, RakNet::B
break; break;
} }
} }
if (index == -1) 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)!\n", projectileId);
return; return;
} }
@ -88,7 +88,7 @@ void SkillComponent::SyncPlayerProjectile(const LWOOBJID projectileId, RakNet::B
auto query = CDClientDatabase::CreatePreppedStmt( auto query = CDClientDatabase::CreatePreppedStmt(
"SELECT behaviorID FROM SkillBehavior WHERE skillID = (SELECT skillID FROM ObjectSkills WHERE objectTemplate = ?);"); "SELECT behaviorID FROM SkillBehavior WHERE skillID = (SELECT skillID FROM ObjectSkills WHERE objectTemplate = ?);");
query.bind(1, (int) sync_entry.lot); query.bind(1, (int) sync_entry.lot);
auto result = query.execQuery(); auto result = query.execQuery();
@ -112,7 +112,7 @@ void SkillComponent::SyncPlayerProjectile(const LWOOBJID projectileId, RakNet::B
{ {
branch.target = target; branch.target = target;
} }
behavior->Handle(sync_entry.context, bitStream, branch); behavior->Handle(sync_entry.context, bitStream, branch);
this->m_managedProjectiles.erase(this->m_managedProjectiles.begin() + index); this->m_managedProjectiles.erase(this->m_managedProjectiles.begin() + index);
@ -126,7 +126,7 @@ void SkillComponent::RegisterPlayerProjectile(const LWOOBJID projectileId, Behav
entry.branchContext = branch; entry.branchContext = branch;
entry.lot = lot; entry.lot = lot;
entry.id = projectileId; entry.id = projectileId;
this->m_managedProjectiles.push_back(entry); this->m_managedProjectiles.push_back(entry);
} }
@ -138,7 +138,7 @@ void SkillComponent::Update(const float deltaTime)
} }
std::map<uint32_t, BehaviorContext*> keep {}; std::map<uint32_t, BehaviorContext*> keep {};
for (const auto& pair : this->m_managedBehaviors) for (const auto& pair : this->m_managedBehaviors)
{ {
auto* context = pair.second; auto* context = pair.second;
@ -147,7 +147,7 @@ void SkillComponent::Update(const float deltaTime)
{ {
continue; continue;
} }
if (context->clientInitalized) if (context->clientInitalized)
{ {
context->CalculateUpdate(deltaTime); context->CalculateUpdate(deltaTime);
@ -161,7 +161,7 @@ void SkillComponent::Update(const float deltaTime)
if (context->syncEntries.empty() && context->timerEntries.empty()) if (context->syncEntries.empty() && context->timerEntries.empty())
{ {
auto any = false; auto any = false;
for (const auto& projectile : this->m_managedProjectiles) for (const auto& projectile : this->m_managedProjectiles)
{ {
if (projectile.context == context) if (projectile.context == context)
@ -177,13 +177,13 @@ void SkillComponent::Update(const float deltaTime)
context->Reset(); context->Reset();
delete context; delete context;
context = nullptr; context = nullptr;
continue; continue;
} }
} }
keep.insert_or_assign(pair.first, context); keep.insert_or_assign(pair.first, context);
} }
@ -251,9 +251,9 @@ SkillExecutionResult SkillComponent::CalculateBehavior(const uint32_t skillId, c
context->caster = m_Parent->GetObjectID(); context->caster = m_Parent->GetObjectID();
context->clientInitalized = clientInitalized; context->clientInitalized = clientInitalized;
context->foundTarget = target != LWOOBJID_EMPTY || ignoreTarget || clientInitalized; context->foundTarget = target != LWOOBJID_EMPTY || ignoreTarget || clientInitalized;
behavior->Calculate(context, bitStream, { target, 0}); behavior->Calculate(context, bitStream, { target, 0});
for (auto* script : CppScripts::GetEntityScripts(m_Parent)) { for (auto* script : CppScripts::GetEntityScripts(m_Parent)) {
@ -275,7 +275,7 @@ SkillExecutionResult SkillComponent::CalculateBehavior(const uint32_t skillId, c
{ {
// Echo start skill // Echo start skill
GameMessages::EchoStartSkill start; GameMessages::EchoStartSkill start;
start.iCastType = 0; start.iCastType = 0;
start.skillID = skillId; start.skillID = skillId;
start.uiSkillHandle = context->skillUId; start.uiSkillHandle = context->skillUId;
@ -350,7 +350,7 @@ void SkillComponent::CalculateUpdate(const float deltaTime)
const auto targetPosition = target->GetPosition(); const auto targetPosition = target->GetPosition();
const auto closestPoint = Vector3::ClosestPointOnLine(entry.lastPosition, position, targetPosition); const auto closestPoint = Vector3::ClosestPointOnLine(entry.lastPosition, position, targetPosition);
const auto distance = Vector3::DistanceSquared(targetPosition, closestPoint); const auto distance = Vector3::DistanceSquared(targetPosition, closestPoint);
if (distance > 3 * 3) if (distance > 3 * 3)
@ -396,12 +396,12 @@ void SkillComponent::CalculateUpdate(const float deltaTime)
} }
entry.lastPosition = position; entry.lastPosition = position;
managedProjectile = entry; managedProjectile = entry;
} }
std::vector<ProjectileSyncEntry> valid; std::vector<ProjectileSyncEntry> valid;
for (auto& entry : this->m_managedProjectiles) for (auto& entry : this->m_managedProjectiles)
{ {
if (entry.calculation) if (entry.calculation)
@ -409,7 +409,7 @@ void SkillComponent::CalculateUpdate(const float deltaTime)
if (entry.time >= entry.maxTime) if (entry.time >= entry.maxTime)
{ {
entry.branchContext.target = LWOOBJID_EMPTY; entry.branchContext.target = LWOOBJID_EMPTY;
SyncProjectileCalculation(entry); SyncProjectileCalculation(entry);
continue; continue;
@ -450,13 +450,13 @@ void SkillComponent::SyncProjectileCalculation(const ProjectileSyncEntry& entry)
const auto behaviorId = static_cast<uint32_t>(result.getIntField(0)); const auto behaviorId = static_cast<uint32_t>(result.getIntField(0));
result.finalize(); result.finalize();
auto* behavior = Behavior::CreateBehavior(behaviorId); auto* behavior = Behavior::CreateBehavior(behaviorId);
auto* bitStream = new RakNet::BitStream(); auto* bitStream = new RakNet::BitStream();
behavior->Calculate(entry.context, bitStream, entry.branchContext); behavior->Calculate(entry.context, bitStream, entry.branchContext);
GameMessages::DoClientProjectileImpact projectileImpact; GameMessages::DoClientProjectileImpact projectileImpact;
projectileImpact.sBitStream.assign((char*) bitStream->GetData(), bitStream->GetNumberOfBytesUsed()); projectileImpact.sBitStream.assign((char*) bitStream->GetData(), bitStream->GetNumberOfBytesUsed());
@ -492,19 +492,19 @@ void SkillComponent::HandleUnmanaged(const uint32_t behaviorId, const LWOOBJID t
delete bitStream; delete bitStream;
delete context; delete context;
} }
void SkillComponent::HandleUnCast(const uint32_t behaviorId, const LWOOBJID target) void SkillComponent::HandleUnCast(const uint32_t behaviorId, const LWOOBJID target)
{ {
auto* context = new BehaviorContext(target); auto* context = new BehaviorContext(target);
context->caster = target; context->caster = target;
auto* behavior = Behavior::CreateBehavior(behaviorId); auto* behavior = Behavior::CreateBehavior(behaviorId);
behavior->UnCast(context, { target }); behavior->UnCast(context, { target });
delete context; delete context;
} }

View File

@ -25,7 +25,7 @@ ItemSet::ItemSet(const uint32_t id, InventoryComponent* inventoryComponent)
{ {
return; return;
} }
for (auto i = 0; i < 5; ++i) for (auto i = 0; i < 5; ++i)
{ {
if (result.fieldIsNull(i)) if (result.fieldIsNull(i))
@ -35,7 +35,7 @@ ItemSet::ItemSet(const uint32_t id, InventoryComponent* inventoryComponent)
auto skillQuery = CDClientDatabase::CreatePreppedStmt( auto skillQuery = CDClientDatabase::CreatePreppedStmt(
"SELECT SkillID FROM ItemSetSkills WHERE SkillSetID = ?;"); "SELECT SkillID FROM ItemSetSkills WHERE SkillSetID = ?;");
skillQuery.bind(1, result.getIntField(i)); skillQuery.bind(1, result.getIntField(i));
auto skillResult = skillQuery.execQuery(); auto skillResult = skillQuery.execQuery();
@ -49,10 +49,10 @@ ItemSet::ItemSet(const uint32_t id, InventoryComponent* inventoryComponent)
if (skillResult.fieldIsNull(0)) if (skillResult.fieldIsNull(0))
{ {
skillResult.nextRow(); skillResult.nextRow();
continue; continue;
} }
const auto skillId = skillResult.getIntField(0); const auto skillId = skillResult.getIntField(0);
switch (i) switch (i)
@ -75,7 +75,7 @@ ItemSet::ItemSet(const uint32_t id, InventoryComponent* inventoryComponent)
default: default:
break; break;
} }
skillResult.nextRow(); skillResult.nextRow();
} }
} }
@ -83,7 +83,7 @@ ItemSet::ItemSet(const uint32_t id, InventoryComponent* inventoryComponent)
std::string ids = result.getStringField(5); std::string ids = result.getStringField(5);
ids.erase(std::remove_if(ids.begin(), ids.end(), ::isspace), ids.end()); ids.erase(std::remove_if(ids.begin(), ids.end(), ::isspace), ids.end());
std::istringstream stream(ids); std::istringstream stream(ids);
std::string token; std::string token;
@ -99,9 +99,9 @@ ItemSet::ItemSet(const uint32_t id, InventoryComponent* inventoryComponent)
m_Items.push_back(value); m_Items.push_back(value);
} }
} }
m_Equipped = {}; m_Equipped = {};
for (const auto item : m_Items) for (const auto item : m_Items)
{ {
if (inventoryComponent->IsEquipped(item)) if (inventoryComponent->IsEquipped(item))
@ -141,11 +141,11 @@ void ItemSet::OnEquip(const LOT lot)
auto* skillComponent = m_InventoryComponent->GetParent()->GetComponent<SkillComponent>(); auto* skillComponent = m_InventoryComponent->GetParent()->GetComponent<SkillComponent>();
auto* missionComponent = m_InventoryComponent->GetParent()->GetComponent<MissionComponent>(); auto* missionComponent = m_InventoryComponent->GetParent()->GetComponent<MissionComponent>();
for (const auto skill : skillSet) for (const auto skill : skillSet)
{ {
auto* skillTable = CDClientManager::Instance()->GetTable<CDSkillBehaviorTable>("SkillBehavior"); auto* skillTable = CDClientManager::Instance()->GetTable<CDSkillBehaviorTable>("SkillBehavior");
const auto behaviorId = skillTable->GetSkillByID(skill).behaviorID; const auto behaviorId = skillTable->GetSkillByID(skill).behaviorID;
missionComponent->Progress(MissionTaskType::MISSION_TASK_TYPE_SKILL, skill); missionComponent->Progress(MissionTaskType::MISSION_TASK_TYPE_SKILL, skill);
@ -167,11 +167,11 @@ void ItemSet::OnUnEquip(const LOT lot)
{ {
return; return;
} }
const auto& skillSet = GetSkillSet(m_Equipped.size()); const auto& skillSet = GetSkillSet(m_Equipped.size());
m_Equipped.erase(index); m_Equipped.erase(index);
if (skillSet.empty()) if (skillSet.empty())
{ {
return; return;
@ -199,7 +199,7 @@ uint32_t ItemSet::GetID() const
return m_ID; return m_ID;
} }
void ItemSet::Update(float deltaTime) void ItemSet::Update(float deltaTime)
{ {
for (auto& passiveAbility : m_PassiveAbilities) for (auto& passiveAbility : m_PassiveAbilities)
{ {
@ -207,7 +207,7 @@ void ItemSet::Update(float deltaTime)
} }
} }
void ItemSet::TriggerPassiveAbility(PassiveAbilityTrigger trigger) void ItemSet::TriggerPassiveAbility(PassiveAbilityTrigger trigger)
{ {
for (auto& passiveAbility : m_PassiveAbilities) for (auto& passiveAbility : m_PassiveAbilities)
{ {

View File

@ -16,18 +16,18 @@
std::map<uint32_t, Precondition*> Preconditions::cache = {}; std::map<uint32_t, Precondition*> Preconditions::cache = {};
Precondition::Precondition(const uint32_t condition) { Precondition::Precondition(const uint32_t condition) {
auto query = CDClientDatabase::CreatePreppedStmt( auto query = CDClientDatabase::CreatePreppedStmt(
"SELECT type, targetLOT, targetCount FROM Preconditions WHERE id = ?;"); "SELECT type, targetLOT, targetCount FROM Preconditions WHERE id = ?;");
query.bind(1, (int) condition); query.bind(1, (int) condition);
auto result = query.execQuery(); auto result = query.execQuery();
if (result.eof()) if (result.eof())
{ {
this->type = PreconditionType::ItemEquipped; this->type = PreconditionType::ItemEquipped;
this->count = 1; this->count = 1;
this->values = { 0 }; this->values = { 0 };
Game::logger->Log("Precondition", "Failed to find precondition of id (%i)!\n", condition); Game::logger->Log("Precondition", "Failed to find precondition of id (%i)!\n", condition);
return; return;
@ -98,11 +98,11 @@ bool Precondition::Check(Entity* player, bool evaluateCosts) const
} }
auto passedAny = false; auto passedAny = false;
for (const auto value : values) for (const auto value : values)
{ {
const auto passed = CheckValue(player, value, evaluateCosts); const auto passed = CheckValue(player, value, evaluateCosts);
if (passed && any) if (passed && any)
{ {
return true; return true;
@ -221,7 +221,7 @@ PreconditionExpression::PreconditionExpression(const std::string& conditions)
return; return;
} }
std::stringstream a; std::stringstream a;
std::stringstream b; std::stringstream b;
@ -309,16 +309,16 @@ bool PreconditionExpression::Check(Entity* player, bool evaluateCosts) const
{ {
return true; return true;
} }
const auto a = Preconditions::Check(player, condition, evaluateCosts); const auto a = Preconditions::Check(player, condition, evaluateCosts);
if (!a) if (!a)
{ {
GameMessages::SendNotifyClientFailedPrecondition(player->GetObjectID(), player->GetSystemAddress(), u"", condition); GameMessages::SendNotifyClientFailedPrecondition(player->GetObjectID(), player->GetSystemAddress(), u"", condition);
} }
const auto b = next == nullptr ? true : next->Check(player); const auto b = next == nullptr ? true : next->Check(player);
return m_or ? a || b : a && b; return m_or ? a || b : a && b;
} }

View File

@ -1242,12 +1242,12 @@ void SlashCommandHandler::HandleChatCommand(const std::u16string& command, Entit
EntityManager::Instance()->SerializeEntity(entity); EntityManager::Instance()->SerializeEntity(entity);
} }
if (chatCommand == "lookup" && entity->GetGMLevel() >= GAME_MASTER_LEVEL_DEVELOPER && args.size() == 1) { if (chatCommand == "lookup" && entity->GetGMLevel() >= GAME_MASTER_LEVEL_DEVELOPER && args.size() == 1) {
auto query = CDClientDatabase::CreatePreppedStmt( auto query = CDClientDatabase::CreatePreppedStmt(
"SELECT `id`, `name` FROM `Objects` WHERE `displayName` LIKE ?1 OR `name` LIKE ?1 OR `description` LIKE ?1 LIMIT 50"); "SELECT `id`, `name` FROM `Objects` WHERE `displayName` LIKE ?1 OR `name` LIKE ?1 OR `description` LIKE ?1 LIMIT 50");
const std::string query_text = "%" + args[0] + "%"; const std::string query_text = "%" + args[0] + "%";
query.bind(1, query_text.c_str()); query.bind(1, query_text.c_str());
auto tables = query.execQuery(); auto tables = query.execQuery();

View File

@ -16,7 +16,7 @@ dZoneManager* dZoneManager::m_Address = nullptr;
void dZoneManager::Initialize(const LWOZONEID& zoneID) { void dZoneManager::Initialize(const LWOZONEID& zoneID) {
Game::logger->Log("dZoneManager", "Preparing zone: %i/%i/%i\n", zoneID.GetMapID(), zoneID.GetInstanceID(), zoneID.GetCloneID()); Game::logger->Log("dZoneManager", "Preparing zone: %i/%i/%i\n", zoneID.GetMapID(), zoneID.GetInstanceID(), zoneID.GetCloneID());
int64_t startTime = 0; int64_t startTime = 0;
int64_t endTime = 0; int64_t endTime = 0;
@ -27,7 +27,7 @@ void dZoneManager::Initialize(const LWOZONEID& zoneID) {
LOT zoneControlTemplate = 2365; LOT zoneControlTemplate = 2365;
auto query = CDClientDatabase::CreatePreppedStmt( auto query = CDClientDatabase::CreatePreppedStmt(
"SELECT zoneControlTemplate, ghostdistance_min, ghostdistance FROM ZoneTable WHERE zoneID = ?;"); "SELECT zoneControlTemplate, ghostdistance_min, ghostdistance FROM ZoneTable WHERE zoneID = ?;");
query.bind(1, (int) zoneID.GetMapID()); query.bind(1, (int) zoneID.GetMapID());
auto result = query.execQuery(); auto result = query.execQuery();
@ -54,7 +54,7 @@ void dZoneManager::Initialize(const LWOZONEID& zoneID) {
m_pZone->Initalize(); m_pZone->Initalize();
endTime = std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::steady_clock::now().time_since_epoch()).count(); endTime = std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::steady_clock::now().time_since_epoch()).count();
Game::logger->Log("dZoneManager", "Zone prepared in: %llu ms\n", (endTime - startTime)); Game::logger->Log("dZoneManager", "Zone prepared in: %llu ms\n", (endTime - startTime));
VanityUtilities::SpawnVanity(); VanityUtilities::SpawnVanity();
@ -62,13 +62,13 @@ void dZoneManager::Initialize(const LWOZONEID& zoneID) {
dZoneManager::~dZoneManager() { dZoneManager::~dZoneManager() {
if (m_pZone) delete m_pZone; if (m_pZone) delete m_pZone;
for (std::pair<LWOOBJID, Spawner*> p : m_Spawners) { for (std::pair<LWOOBJID, Spawner*> p : m_Spawners) {
if (p.second) { if (p.second) {
delete p.second; delete p.second;
p.second = nullptr; p.second = nullptr;
} }
m_Spawners.erase(p.first); m_Spawners.erase(p.first);
} }
} }
@ -130,7 +130,7 @@ void dZoneManager::Update(float deltaTime) {
LWOOBJID dZoneManager::MakeSpawner(SpawnerInfo info) LWOOBJID dZoneManager::MakeSpawner(SpawnerInfo info)
{ {
auto objectId = info.spawnerID; auto objectId = info.spawnerID;
if (objectId == LWOOBJID_EMPTY) if (objectId == LWOOBJID_EMPTY)
{ {
objectId = ObjectIDManager::Instance()->GenerateObjectID(); objectId = ObjectIDManager::Instance()->GenerateObjectID();
@ -139,18 +139,18 @@ LWOOBJID dZoneManager::MakeSpawner(SpawnerInfo info)
info.spawnerID = objectId; info.spawnerID = objectId;
} }
auto* spawner = new Spawner(info); auto* spawner = new Spawner(info);
EntityInfo entityInfo{}; EntityInfo entityInfo{};
entityInfo.id = objectId; entityInfo.id = objectId;
entityInfo.lot = 176; entityInfo.lot = 176;
auto* entity = EntityManager::Instance()->CreateEntity(entityInfo, nullptr, nullptr, false, objectId); auto* entity = EntityManager::Instance()->CreateEntity(entityInfo, nullptr, nullptr, false, objectId);
EntityManager::Instance()->ConstructEntity(entity); EntityManager::Instance()->ConstructEntity(entity);
AddSpawner(objectId, spawner); AddSpawner(objectId, spawner);
return objectId; return objectId;
@ -203,9 +203,9 @@ void dZoneManager::RemoveSpawner(const LWOOBJID id)
spawner->Deactivate(); spawner->Deactivate();
Game::logger->Log("dZoneManager", "Destroying spawner (%llu)\n", id); Game::logger->Log("dZoneManager", "Destroying spawner (%llu)\n", id);
m_Spawners.erase(id); m_Spawners.erase(id);
delete spawner; delete spawner;
} }