mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2024-11-09 01:38:20 +00:00
Fix whitespace
Convert to tabs and remove trailing whitespace
This commit is contained in:
parent
4ff84e0730
commit
9dfa401b27
@ -185,8 +185,8 @@ Behavior* Behavior::CreateBehavior(const uint32_t behaviorId)
|
||||
break;
|
||||
case BehaviorTemplates::BEHAVIOR_JETPACK: break;
|
||||
case BehaviorTemplates::BEHAVIOR_SKILL_EVENT:
|
||||
behavior = new SkillEventBehavior(behaviorId);
|
||||
break;
|
||||
behavior = new SkillEventBehavior(behaviorId);
|
||||
break;
|
||||
case BehaviorTemplates::BEHAVIOR_CONSUME_ITEM: break;
|
||||
case BehaviorTemplates::BEHAVIOR_SKILL_CAST_FAILED:
|
||||
behavior = new SkillCastFailedBehavior(behaviorId);
|
||||
@ -414,11 +414,11 @@ Behavior::Behavior(const uint32_t behaviorId)
|
||||
this->m_templateId = BehaviorTemplates::BEHAVIOR_EMPTY;
|
||||
}
|
||||
|
||||
auto query = CDClientDatabase::CreatePreppedStmt(
|
||||
auto query = CDClientDatabase::CreatePreppedStmt(
|
||||
"SELECT templateID, effectID, effectHandle FROM BehaviorTemplate WHERE 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
|
||||
if (result.eof())
|
||||
@ -493,7 +493,7 @@ std::map<std::string, float> Behavior::GetParameterNames() const
|
||||
|
||||
auto query = CDClientDatabase::CreatePreppedStmt(
|
||||
"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();
|
||||
|
||||
|
@ -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->Write(m_DirtyHealth || bIsInitialUpdate);
|
||||
outBitStream->Write(m_DirtyHealth || bIsInitialUpdate);
|
||||
if (m_DirtyHealth || bIsInitialUpdate) {
|
||||
outBitStream->Write(m_iHealth);
|
||||
outBitStream->Write(m_fMaxHealth);
|
||||
@ -113,12 +113,12 @@ void DestroyableComponent::Serialize(RakNet::BitStream* outBitStream, bool bIsIn
|
||||
outBitStream->Write(m_fMaxArmor);
|
||||
outBitStream->Write(m_iImagination);
|
||||
outBitStream->Write(m_fMaxImagination);
|
||||
|
||||
|
||||
outBitStream->Write(m_DamageToAbsorb);
|
||||
outBitStream->Write(IsImmune());
|
||||
outBitStream->Write(m_IsGMImmune);
|
||||
outBitStream->Write(m_IsShielded);
|
||||
|
||||
|
||||
outBitStream->Write(m_fMaxHealth);
|
||||
outBitStream->Write(m_fMaxArmor);
|
||||
outBitStream->Write(m_fMaxImagination);
|
||||
@ -129,14 +129,14 @@ void DestroyableComponent::Serialize(RakNet::BitStream* outBitStream, bool bIsIn
|
||||
}
|
||||
|
||||
outBitStream->Write(m_IsSmashable);
|
||||
|
||||
|
||||
if (bIsInitialUpdate) {
|
||||
outBitStream->Write(m_IsDead);
|
||||
outBitStream->Write(m_IsSmashed);
|
||||
|
||||
|
||||
if (m_IsSmashable) {
|
||||
outBitStream->Write(m_HasBricks);
|
||||
|
||||
|
||||
if (m_ExplodeFactor != 1.0f) {
|
||||
outBitStream->Write1();
|
||||
outBitStream->Write(m_ExplodeFactor);
|
||||
@ -145,10 +145,10 @@ void DestroyableComponent::Serialize(RakNet::BitStream* outBitStream, bool bIsIn
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
m_DirtyHealth = false;
|
||||
}
|
||||
|
||||
|
||||
if (m_DirtyThreatList || bIsInitialUpdate) {
|
||||
outBitStream->Write1();
|
||||
outBitStream->Write(m_HasThreats);
|
||||
@ -166,7 +166,7 @@ void DestroyableComponent::LoadFromXML(tinyxml2::XMLDocument* doc) {
|
||||
}
|
||||
|
||||
auto* buffComponent = m_Parent->GetComponent<BuffComponent>();
|
||||
|
||||
|
||||
if (buffComponent != nullptr) {
|
||||
buffComponent->LoadFromXML(doc);
|
||||
}
|
||||
@ -186,9 +186,9 @@ void DestroyableComponent::UpdateXml(tinyxml2::XMLDocument* doc) {
|
||||
Game::logger->Log("DestroyableComponent", "Failed to find dest tag!\n");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
auto* buffComponent = m_Parent->GetComponent<BuffComponent>();
|
||||
|
||||
|
||||
if (buffComponent != nullptr) {
|
||||
buffComponent->UpdateXml(doc);
|
||||
}
|
||||
@ -233,7 +233,7 @@ void DestroyableComponent::SetMaxHealth(float value, bool playAnim) {
|
||||
args.InsertValue("type", type);
|
||||
|
||||
GameMessages::SendUIMessageServerToSingleClient(m_Parent, m_Parent->GetParentUser()->GetSystemAddress(), "MaxPlayerBarUpdate", &args);
|
||||
|
||||
|
||||
delete amount;
|
||||
delete type;
|
||||
}
|
||||
@ -279,7 +279,7 @@ void DestroyableComponent::SetMaxArmor(float value, bool playAnim) {
|
||||
args.InsertValue("type", type);
|
||||
|
||||
GameMessages::SendUIMessageServerToSingleClient(m_Parent, m_Parent->GetParentUser()->GetSystemAddress(), "MaxPlayerBarUpdate", &args);
|
||||
|
||||
|
||||
delete amount;
|
||||
delete type;
|
||||
}
|
||||
@ -325,7 +325,7 @@ void DestroyableComponent::SetMaxImagination(float value, bool playAnim) {
|
||||
args.InsertValue("type", type);
|
||||
|
||||
GameMessages::SendUIMessageServerToSingleClient(m_Parent, m_Parent->GetParentUser()->GetSystemAddress(), "MaxPlayerBarUpdate", &args);
|
||||
|
||||
|
||||
delete amount;
|
||||
delete type;
|
||||
}
|
||||
@ -340,7 +340,7 @@ void DestroyableComponent::SetDamageToAbsorb(int32_t value)
|
||||
m_DamageToAbsorb = value;
|
||||
}
|
||||
|
||||
void DestroyableComponent::SetDamageReduction(int32_t value)
|
||||
void DestroyableComponent::SetDamageReduction(int32_t value)
|
||||
{
|
||||
m_DirtyHealth = true;
|
||||
m_DamageReduction = value;
|
||||
@ -352,7 +352,7 @@ void DestroyableComponent::SetIsImmune(bool value)
|
||||
m_ImmuneStacks = value ? 1 : 0;
|
||||
}
|
||||
|
||||
void DestroyableComponent::SetIsGMImmune(bool value)
|
||||
void DestroyableComponent::SetIsGMImmune(bool value)
|
||||
{
|
||||
m_DirtyHealth = true;
|
||||
m_IsGMImmune = value;
|
||||
@ -375,7 +375,7 @@ void DestroyableComponent::AddFaction(const int32_t factionID, const bool ignore
|
||||
|
||||
auto query = CDClientDatabase::CreatePreppedStmt(
|
||||
"SELECT enemyList FROM Factions WHERE faction = ?;");
|
||||
query.bind(1, (int) factionID);
|
||||
query.bind(1, (int) factionID);
|
||||
|
||||
auto result = query.execQuery();
|
||||
|
||||
@ -387,10 +387,10 @@ void DestroyableComponent::AddFaction(const int32_t factionID, const bool ignore
|
||||
|
||||
std::stringstream ss(list_string);
|
||||
std::string token;
|
||||
|
||||
|
||||
while (std::getline(ss, token, ',')) {
|
||||
if (token.empty()) continue;
|
||||
|
||||
|
||||
auto id = std::stoi(token);
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
AddEnemyFaction(id);
|
||||
}
|
||||
|
||||
@ -521,7 +521,7 @@ bool DestroyableComponent::CheckValidity(const LWOOBJID target, const bool ignor
|
||||
if (quickbuild != nullptr)
|
||||
{
|
||||
const auto state = quickbuild->GetState();
|
||||
|
||||
|
||||
if (state != REBUILD_COMPLETED)
|
||||
{
|
||||
return false;
|
||||
@ -568,7 +568,7 @@ void DestroyableComponent::Imagine(const int32_t deltaImagination)
|
||||
{
|
||||
auto current = static_cast<int32_t>(GetImagination());
|
||||
const auto max = static_cast<int32_t>(GetMaxImagination());
|
||||
|
||||
|
||||
current += deltaImagination;
|
||||
|
||||
current = std::min(current, max);
|
||||
@ -641,7 +641,7 @@ void DestroyableComponent::Damage(uint32_t damage, const LWOOBJID source, bool e
|
||||
|
||||
damage -= absorbDamage;
|
||||
absorb -= absorbDamage;
|
||||
|
||||
|
||||
const auto armorDamage = std::min(damage, armor);
|
||||
|
||||
damage -= armorDamage;
|
||||
@ -663,7 +663,7 @@ void DestroyableComponent::Damage(uint32_t damage, const LWOOBJID source, bool e
|
||||
{
|
||||
EntityManager::Instance()->SerializeEntity(m_Parent);
|
||||
}
|
||||
|
||||
|
||||
auto* attacker = EntityManager::Instance()->GetEntity(source);
|
||||
m_Parent->OnHit(attacker);
|
||||
m_Parent->OnHitOrHealResult(attacker, sourceDamage);
|
||||
@ -741,7 +741,7 @@ void DestroyableComponent::Smash(const LWOOBJID source, const eKillType killType
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
const auto isPlayer = m_Parent->IsPlayer();
|
||||
|
||||
GameMessages::SendDie(
|
||||
@ -783,14 +783,14 @@ void DestroyableComponent::Smash(const LWOOBJID source, const eKillType killType
|
||||
auto* member = EntityManager::Instance()->GetEntity(specificOwner);
|
||||
|
||||
if (member) LootGenerator::Instance().DropLoot(member, m_Parent, lootMatrixId, GetMinCoins(), GetMaxCoins());
|
||||
}
|
||||
}
|
||||
else {
|
||||
for (const auto memberId : team->members) { // Free for all
|
||||
auto* member = EntityManager::Instance()->GetEntity(memberId);
|
||||
|
||||
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;
|
||||
|
||||
|
||||
LootGenerator::Instance().DropLoot(m_Parent, m_Parent, -1, coinsToLoose, coinsToLoose);
|
||||
}
|
||||
|
||||
@ -862,7 +862,7 @@ void DestroyableComponent::PopImmunity(int32_t stacks)
|
||||
m_ImmuneStacks -= stacks;
|
||||
}
|
||||
|
||||
void DestroyableComponent::FixStats()
|
||||
void DestroyableComponent::FixStats()
|
||||
{
|
||||
auto* entity = GetParent();
|
||||
|
||||
@ -920,7 +920,7 @@ void DestroyableComponent::FixStats()
|
||||
|
||||
// Add the stats
|
||||
const auto& info = mission->GetClientInfo();
|
||||
|
||||
|
||||
maxHealth += info.reward_maxhealth;
|
||||
maxImagination += info.reward_maximagination;
|
||||
}
|
||||
|
@ -19,11 +19,11 @@
|
||||
|
||||
RocketLaunchpadControlComponent::RocketLaunchpadControlComponent(Entity* parent, int rocketId) : Component(parent) {
|
||||
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);
|
||||
|
||||
auto result = query.execQuery();
|
||||
|
||||
|
||||
if (!result.eof() && !result.fieldIsNull(0))
|
||||
{
|
||||
m_TargetZone = result.getIntField(0);
|
||||
@ -59,7 +59,7 @@ void RocketLaunchpadControlComponent::Launch(Entity* originator, LWOOBJID option
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
TellMasterToPrepZone(zone);
|
||||
|
||||
// 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);
|
||||
}
|
||||
|
||||
|
||||
if (rocket == nullptr)
|
||||
{
|
||||
rocket = inventoryComponent->FindItemById(characterComponent->GetLastRocketItemID());
|
||||
@ -131,7 +131,7 @@ void RocketLaunchpadControlComponent::Launch(Entity* originator, LWOOBJID option
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Store the last used rocket item's ID
|
||||
characterComponent->SetLastRocketItemID(rocket->GetId());
|
||||
|
||||
@ -140,13 +140,13 @@ void RocketLaunchpadControlComponent::Launch(Entity* originator, LWOOBJID option
|
||||
character->SaveXMLToDatabase();
|
||||
|
||||
SetSelectedMapId(originator->GetObjectID(), zone);
|
||||
|
||||
|
||||
GameMessages::SendFireEventClientSide(m_Parent->GetObjectID(), originator->GetSystemAddress(), u"RocketEquipped", rocket->GetId(), cloneId, -1, originator->GetObjectID());
|
||||
|
||||
rocket->Equip(true);
|
||||
|
||||
|
||||
GameMessages::SendChangeObjectWorldState(rocket->GetId(), WORLDSTATE_ATTACHED, UNASSIGNED_SYSTEM_ADDRESS);
|
||||
|
||||
|
||||
EntityManager::Instance()->SerializeEntity(originator);
|
||||
}
|
||||
|
||||
@ -167,7 +167,7 @@ void RocketLaunchpadControlComponent::OnProximityUpdate(Entity* entering, std::s
|
||||
// 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;
|
||||
}
|
||||
@ -181,7 +181,7 @@ LWOMAPID RocketLaunchpadControlComponent::GetSelectedMapId(LWOOBJID player) cons
|
||||
return index->second;
|
||||
}
|
||||
|
||||
void RocketLaunchpadControlComponent::SetSelectedCloneId(LWOOBJID player, LWOCLONEID cloneId)
|
||||
void RocketLaunchpadControlComponent::SetSelectedCloneId(LWOOBJID player, LWOCLONEID cloneId)
|
||||
{
|
||||
m_SelectedCloneIds[player] = cloneId;
|
||||
}
|
||||
|
@ -36,11 +36,11 @@ bool SkillComponent::CastPlayerSkill(const uint32_t behaviorId, const uint32_t s
|
||||
auto* behavior = Behavior::CreateBehavior(behaviorId);
|
||||
|
||||
const auto branch = BehaviorBranchContext(target, 0);
|
||||
|
||||
|
||||
behavior->Handle(context, bitStream, branch);
|
||||
|
||||
context->ExecuteUpdates();
|
||||
|
||||
|
||||
return !context->failed;
|
||||
}
|
||||
|
||||
@ -76,11 +76,11 @@ void SkillComponent::SyncPlayerProjectile(const LWOOBJID projectileId, RakNet::B
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (index == -1)
|
||||
{
|
||||
Game::logger->Log("SkillComponent", "Failed to find projectile id (%llu)!\n", projectileId);
|
||||
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
@ -88,7 +88,7 @@ void SkillComponent::SyncPlayerProjectile(const LWOOBJID projectileId, RakNet::B
|
||||
|
||||
auto query = CDClientDatabase::CreatePreppedStmt(
|
||||
"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();
|
||||
|
||||
@ -112,7 +112,7 @@ void SkillComponent::SyncPlayerProjectile(const LWOOBJID projectileId, RakNet::B
|
||||
{
|
||||
branch.target = target;
|
||||
}
|
||||
|
||||
|
||||
behavior->Handle(sync_entry.context, bitStream, branch);
|
||||
|
||||
this->m_managedProjectiles.erase(this->m_managedProjectiles.begin() + index);
|
||||
@ -126,7 +126,7 @@ void SkillComponent::RegisterPlayerProjectile(const LWOOBJID projectileId, Behav
|
||||
entry.branchContext = branch;
|
||||
entry.lot = lot;
|
||||
entry.id = projectileId;
|
||||
|
||||
|
||||
this->m_managedProjectiles.push_back(entry);
|
||||
}
|
||||
|
||||
@ -138,7 +138,7 @@ void SkillComponent::Update(const float deltaTime)
|
||||
}
|
||||
|
||||
std::map<uint32_t, BehaviorContext*> keep {};
|
||||
|
||||
|
||||
for (const auto& pair : this->m_managedBehaviors)
|
||||
{
|
||||
auto* context = pair.second;
|
||||
@ -147,7 +147,7 @@ void SkillComponent::Update(const float deltaTime)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
if (context->clientInitalized)
|
||||
{
|
||||
context->CalculateUpdate(deltaTime);
|
||||
@ -161,7 +161,7 @@ void SkillComponent::Update(const float deltaTime)
|
||||
if (context->syncEntries.empty() && context->timerEntries.empty())
|
||||
{
|
||||
auto any = false;
|
||||
|
||||
|
||||
for (const auto& projectile : this->m_managedProjectiles)
|
||||
{
|
||||
if (projectile.context == context)
|
||||
@ -177,13 +177,13 @@ void SkillComponent::Update(const float deltaTime)
|
||||
context->Reset();
|
||||
|
||||
delete context;
|
||||
|
||||
|
||||
context = nullptr;
|
||||
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
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->clientInitalized = clientInitalized;
|
||||
|
||||
|
||||
context->foundTarget = target != LWOOBJID_EMPTY || ignoreTarget || clientInitalized;
|
||||
|
||||
|
||||
behavior->Calculate(context, bitStream, { target, 0});
|
||||
|
||||
for (auto* script : CppScripts::GetEntityScripts(m_Parent)) {
|
||||
@ -275,7 +275,7 @@ SkillExecutionResult SkillComponent::CalculateBehavior(const uint32_t skillId, c
|
||||
{
|
||||
// Echo start skill
|
||||
GameMessages::EchoStartSkill start;
|
||||
|
||||
|
||||
start.iCastType = 0;
|
||||
start.skillID = skillId;
|
||||
start.uiSkillHandle = context->skillUId;
|
||||
@ -350,7 +350,7 @@ void SkillComponent::CalculateUpdate(const float deltaTime)
|
||||
const auto targetPosition = target->GetPosition();
|
||||
|
||||
const auto closestPoint = Vector3::ClosestPointOnLine(entry.lastPosition, position, targetPosition);
|
||||
|
||||
|
||||
const auto distance = Vector3::DistanceSquared(targetPosition, closestPoint);
|
||||
|
||||
if (distance > 3 * 3)
|
||||
@ -396,12 +396,12 @@ void SkillComponent::CalculateUpdate(const float deltaTime)
|
||||
}
|
||||
|
||||
entry.lastPosition = position;
|
||||
|
||||
|
||||
managedProjectile = entry;
|
||||
}
|
||||
|
||||
|
||||
std::vector<ProjectileSyncEntry> valid;
|
||||
|
||||
|
||||
for (auto& entry : this->m_managedProjectiles)
|
||||
{
|
||||
if (entry.calculation)
|
||||
@ -409,7 +409,7 @@ void SkillComponent::CalculateUpdate(const float deltaTime)
|
||||
if (entry.time >= entry.maxTime)
|
||||
{
|
||||
entry.branchContext.target = LWOOBJID_EMPTY;
|
||||
|
||||
|
||||
SyncProjectileCalculation(entry);
|
||||
|
||||
continue;
|
||||
@ -450,13 +450,13 @@ void SkillComponent::SyncProjectileCalculation(const ProjectileSyncEntry& entry)
|
||||
const auto behaviorId = static_cast<uint32_t>(result.getIntField(0));
|
||||
|
||||
result.finalize();
|
||||
|
||||
|
||||
auto* behavior = Behavior::CreateBehavior(behaviorId);
|
||||
|
||||
auto* bitStream = new RakNet::BitStream();
|
||||
|
||||
behavior->Calculate(entry.context, bitStream, entry.branchContext);
|
||||
|
||||
|
||||
GameMessages::DoClientProjectileImpact projectileImpact;
|
||||
|
||||
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 context;
|
||||
delete context;
|
||||
}
|
||||
|
||||
void SkillComponent::HandleUnCast(const uint32_t behaviorId, const LWOOBJID target)
|
||||
{
|
||||
auto* context = new BehaviorContext(target);
|
||||
|
||||
|
||||
context->caster = target;
|
||||
|
||||
auto* behavior = Behavior::CreateBehavior(behaviorId);
|
||||
|
||||
behavior->UnCast(context, { target });
|
||||
|
||||
|
||||
delete context;
|
||||
}
|
||||
|
||||
|
@ -25,7 +25,7 @@ ItemSet::ItemSet(const uint32_t id, InventoryComponent* inventoryComponent)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
for (auto i = 0; i < 5; ++i)
|
||||
{
|
||||
if (result.fieldIsNull(i))
|
||||
@ -35,7 +35,7 @@ ItemSet::ItemSet(const uint32_t id, InventoryComponent* inventoryComponent)
|
||||
|
||||
auto skillQuery = CDClientDatabase::CreatePreppedStmt(
|
||||
"SELECT SkillID FROM ItemSetSkills WHERE SkillSetID = ?;");
|
||||
skillQuery.bind(1, result.getIntField(i));
|
||||
skillQuery.bind(1, result.getIntField(i));
|
||||
|
||||
auto skillResult = skillQuery.execQuery();
|
||||
|
||||
@ -49,10 +49,10 @@ ItemSet::ItemSet(const uint32_t id, InventoryComponent* inventoryComponent)
|
||||
if (skillResult.fieldIsNull(0))
|
||||
{
|
||||
skillResult.nextRow();
|
||||
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
const auto skillId = skillResult.getIntField(0);
|
||||
|
||||
switch (i)
|
||||
@ -75,7 +75,7 @@ ItemSet::ItemSet(const uint32_t id, InventoryComponent* inventoryComponent)
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
skillResult.nextRow();
|
||||
}
|
||||
}
|
||||
@ -83,7 +83,7 @@ ItemSet::ItemSet(const uint32_t id, InventoryComponent* inventoryComponent)
|
||||
std::string ids = result.getStringField(5);
|
||||
|
||||
ids.erase(std::remove_if(ids.begin(), ids.end(), ::isspace), ids.end());
|
||||
|
||||
|
||||
std::istringstream stream(ids);
|
||||
std::string token;
|
||||
|
||||
@ -99,9 +99,9 @@ ItemSet::ItemSet(const uint32_t id, InventoryComponent* inventoryComponent)
|
||||
m_Items.push_back(value);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
m_Equipped = {};
|
||||
|
||||
|
||||
for (const auto item : m_Items)
|
||||
{
|
||||
if (inventoryComponent->IsEquipped(item))
|
||||
@ -141,11 +141,11 @@ void ItemSet::OnEquip(const LOT lot)
|
||||
|
||||
auto* skillComponent = m_InventoryComponent->GetParent()->GetComponent<SkillComponent>();
|
||||
auto* missionComponent = m_InventoryComponent->GetParent()->GetComponent<MissionComponent>();
|
||||
|
||||
|
||||
for (const auto skill : skillSet)
|
||||
{
|
||||
auto* skillTable = CDClientManager::Instance()->GetTable<CDSkillBehaviorTable>("SkillBehavior");
|
||||
|
||||
|
||||
const auto behaviorId = skillTable->GetSkillByID(skill).behaviorID;
|
||||
|
||||
missionComponent->Progress(MissionTaskType::MISSION_TASK_TYPE_SKILL, skill);
|
||||
@ -167,11 +167,11 @@ void ItemSet::OnUnEquip(const LOT lot)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
const auto& skillSet = GetSkillSet(m_Equipped.size());
|
||||
|
||||
m_Equipped.erase(index);
|
||||
|
||||
|
||||
if (skillSet.empty())
|
||||
{
|
||||
return;
|
||||
@ -199,7 +199,7 @@ uint32_t ItemSet::GetID() const
|
||||
return m_ID;
|
||||
}
|
||||
|
||||
void ItemSet::Update(float deltaTime)
|
||||
void ItemSet::Update(float deltaTime)
|
||||
{
|
||||
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)
|
||||
{
|
||||
|
@ -16,18 +16,18 @@
|
||||
std::map<uint32_t, Precondition*> Preconditions::cache = {};
|
||||
|
||||
Precondition::Precondition(const uint32_t condition) {
|
||||
auto query = CDClientDatabase::CreatePreppedStmt(
|
||||
"SELECT type, targetLOT, targetCount FROM Preconditions WHERE id = ?;");
|
||||
auto query = CDClientDatabase::CreatePreppedStmt(
|
||||
"SELECT type, targetLOT, targetCount FROM Preconditions WHERE id = ?;");
|
||||
query.bind(1, (int) condition);
|
||||
|
||||
auto result = query.execQuery();
|
||||
auto result = query.execQuery();
|
||||
|
||||
if (result.eof())
|
||||
{
|
||||
this->type = PreconditionType::ItemEquipped;
|
||||
this->count = 1;
|
||||
this->values = { 0 };
|
||||
|
||||
|
||||
Game::logger->Log("Precondition", "Failed to find precondition of id (%i)!\n", condition);
|
||||
|
||||
return;
|
||||
@ -98,11 +98,11 @@ bool Precondition::Check(Entity* player, bool evaluateCosts) const
|
||||
}
|
||||
|
||||
auto passedAny = false;
|
||||
|
||||
|
||||
for (const auto value : values)
|
||||
{
|
||||
const auto passed = CheckValue(player, value, evaluateCosts);
|
||||
|
||||
|
||||
if (passed && any)
|
||||
{
|
||||
return true;
|
||||
@ -221,7 +221,7 @@ PreconditionExpression::PreconditionExpression(const std::string& conditions)
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
std::stringstream a;
|
||||
std::stringstream b;
|
||||
|
||||
@ -309,16 +309,16 @@ bool PreconditionExpression::Check(Entity* player, bool evaluateCosts) const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
const auto a = Preconditions::Check(player, condition, evaluateCosts);
|
||||
|
||||
if (!a)
|
||||
{
|
||||
GameMessages::SendNotifyClientFailedPrecondition(player->GetObjectID(), player->GetSystemAddress(), u"", condition);
|
||||
}
|
||||
|
||||
|
||||
const auto b = next == nullptr ? true : next->Check(player);
|
||||
|
||||
|
||||
return m_or ? a || b : a && b;
|
||||
}
|
||||
|
||||
|
@ -1242,12 +1242,12 @@ void SlashCommandHandler::HandleChatCommand(const std::u16string& command, Entit
|
||||
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(
|
||||
"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] + "%";
|
||||
query.bind(1, query_text.c_str());
|
||||
query.bind(1, query_text.c_str());
|
||||
|
||||
auto tables = query.execQuery();
|
||||
|
||||
|
@ -16,7 +16,7 @@ dZoneManager* dZoneManager::m_Address = nullptr;
|
||||
|
||||
void dZoneManager::Initialize(const LWOZONEID& zoneID) {
|
||||
Game::logger->Log("dZoneManager", "Preparing zone: %i/%i/%i\n", zoneID.GetMapID(), zoneID.GetInstanceID(), zoneID.GetCloneID());
|
||||
|
||||
|
||||
int64_t startTime = 0;
|
||||
int64_t endTime = 0;
|
||||
|
||||
@ -27,7 +27,7 @@ void dZoneManager::Initialize(const LWOZONEID& zoneID) {
|
||||
LOT zoneControlTemplate = 2365;
|
||||
|
||||
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());
|
||||
|
||||
auto result = query.execQuery();
|
||||
@ -54,7 +54,7 @@ void dZoneManager::Initialize(const LWOZONEID& zoneID) {
|
||||
m_pZone->Initalize();
|
||||
|
||||
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));
|
||||
|
||||
VanityUtilities::SpawnVanity();
|
||||
@ -62,13 +62,13 @@ void dZoneManager::Initialize(const LWOZONEID& zoneID) {
|
||||
|
||||
dZoneManager::~dZoneManager() {
|
||||
if (m_pZone) delete m_pZone;
|
||||
|
||||
|
||||
for (std::pair<LWOOBJID, Spawner*> p : m_Spawners) {
|
||||
if (p.second) {
|
||||
delete p.second;
|
||||
p.second = nullptr;
|
||||
}
|
||||
|
||||
|
||||
m_Spawners.erase(p.first);
|
||||
}
|
||||
}
|
||||
@ -130,7 +130,7 @@ void dZoneManager::Update(float deltaTime) {
|
||||
LWOOBJID dZoneManager::MakeSpawner(SpawnerInfo info)
|
||||
{
|
||||
auto objectId = info.spawnerID;
|
||||
|
||||
|
||||
if (objectId == LWOOBJID_EMPTY)
|
||||
{
|
||||
objectId = ObjectIDManager::Instance()->GenerateObjectID();
|
||||
@ -139,18 +139,18 @@ LWOOBJID dZoneManager::MakeSpawner(SpawnerInfo info)
|
||||
|
||||
info.spawnerID = objectId;
|
||||
}
|
||||
|
||||
|
||||
auto* spawner = new Spawner(info);
|
||||
|
||||
EntityInfo entityInfo{};
|
||||
|
||||
entityInfo.id = objectId;
|
||||
entityInfo.lot = 176;
|
||||
|
||||
|
||||
auto* entity = EntityManager::Instance()->CreateEntity(entityInfo, nullptr, nullptr, false, objectId);
|
||||
|
||||
EntityManager::Instance()->ConstructEntity(entity);
|
||||
|
||||
|
||||
AddSpawner(objectId, spawner);
|
||||
|
||||
return objectId;
|
||||
@ -203,9 +203,9 @@ void dZoneManager::RemoveSpawner(const LWOOBJID id)
|
||||
spawner->Deactivate();
|
||||
|
||||
Game::logger->Log("dZoneManager", "Destroying spawner (%llu)\n", id);
|
||||
|
||||
|
||||
m_Spawners.erase(id);
|
||||
|
||||
|
||||
delete spawner;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user