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

@@ -51,7 +51,7 @@ float_t ActivityManager::GetActivityValue(Entity *self, const LWOOBJID playerID,
void ActivityManager::StopActivity(Entity *self, const LWOOBJID playerID, const uint32_t score,
const uint32_t value1, const uint32_t value2, bool quit) {
int32_t gameID = 0;
auto* sac = self->GetComponent<ScriptedActivityComponent>();
if (sac == nullptr) {
gameID = self->GetLOT();
@@ -125,7 +125,7 @@ void ActivityManager::ActivityTimerStart(Entity *self, const std::string& timerN
auto* timer = new ActivityTimer { timerName, updateInterval, stopTime };
activeTimers.push_back(timer);
Game::logger->Log("ActivityManager", "Starting timer '%s', %f, %f\n", timerName.c_str(), updateInterval, stopTime);
Game::logger->Log("ActivityManager", "Starting timer '%s', %f, %f", timerName.c_str(), updateInterval, stopTime);
self->AddTimer(GetPrefixedName(timer->name), timer->updateInterval);
}
@@ -147,7 +147,7 @@ float_t ActivityManager::ActivityTimerGetCurrentTime(Entity *self, const std::st
int32_t ActivityManager::GetGameID(Entity *self) const
{
int32_t gameID = 0;
auto* sac = self->GetComponent<ScriptedActivityComponent>();
if (sac == nullptr) {
gameID = self->GetLOT();
@@ -208,10 +208,10 @@ void ActivityManager::OnTimerDone(Entity *self, std::string timerName) {
activeTimers.erase(std::remove(activeTimers.begin(), activeTimers.end(), timer),
activeTimers.end());
delete timer;
Game::logger->Log("ActivityManager", "Executing timer '%s'\n", activityTimerName.c_str());
Game::logger->Log("ActivityManager", "Executing timer '%s'", activityTimerName.c_str());
OnActivityTimerDone(self, activityTimerName);
} else {
Game::logger->Log("ActivityManager", "Updating timer '%s'\n", activityTimerName.c_str());
Game::logger->Log("ActivityManager", "Updating timer '%s'", activityTimerName.c_str());
OnActivityTimerUpdate(self, timer->name, timer->stopTime - timer->runTime, timer->runTime);
self->AddTimer(GetPrefixedName(timer->name), timer->updateInterval);
}

View File

@@ -49,20 +49,20 @@ void AgJetEffectServer::OnRebuildComplete(Entity* self, Entity* target)
auto* effect = entities[0];
auto groups = self->GetGroups();
if (groups.empty())
{
return;
}
builder = target->GetObjectID();
const auto group = groups[0];
GameMessages::SendPlayAnimation(effect, u"jetFX");
self->AddTimer("PlayEffect", 2.5f);
if (group == "Base_Radar")
{
self->AddTimer("CineDone", 5);
@@ -88,7 +88,7 @@ void AgJetEffectServer::OnTimerDone(Entity* self, std::string timerName)
}
const auto size = entities.size();
if (size == 0)
{
return;
@@ -98,7 +98,7 @@ void AgJetEffectServer::OnTimerDone(Entity* self, std::string timerName)
auto* mortar = entities[selected];
Game::logger->Log("AgJetEffectServer", "Mortar (%i) (&d)\n", mortar->GetLOT(), mortar->HasComponent(COMPONENT_TYPE_SKILL));
Game::logger->Log("AgJetEffectServer", "Mortar (%i) (&d)", mortar->GetLOT(), mortar->HasComponent(COMPONENT_TYPE_SKILL));
mortar->SetOwnerOverride(builder);

View File

@@ -4,7 +4,7 @@
#include "dLogger.h"
#include "Entity.h"
void BaseRandomServer::BaseStartup(Entity* self)
void BaseRandomServer::BaseStartup(Entity* self)
{
self->SetVar<std::string>(u"SpawnState", "min");
self->SetVar<bool>(u"JustChanged", false);
@@ -13,12 +13,12 @@ void BaseRandomServer::BaseStartup(Entity* self)
SpawnMapZones(self);
}
void BaseRandomServer::CheckEvents(Entity* self)
void BaseRandomServer::CheckEvents(Entity* self)
{
// TODO: Add events?
}
void BaseRandomServer::SpawnMapZones(Entity* self)
void BaseRandomServer::SpawnMapZones(Entity* self)
{
for (const auto& pair : sectionMultipliers)
{
@@ -35,13 +35,13 @@ void BaseRandomServer::SpawnMapZones(Entity* self)
self->SetVar(u"bInit", true);
}
void BaseRandomServer::SpawnSection(Entity* self, const std::string& sectionName, float iMultiplier)
void BaseRandomServer::SpawnSection(Entity* self, const std::string& sectionName, float iMultiplier)
{
Zone* spawnLoad = GetRandomLoad(self, sectionName);
if (spawnLoad == nullptr)
{
Game::logger->Log("BaseRandomServer", "Failed to find section: %s\n", sectionName.c_str());
Game::logger->Log("BaseRandomServer", "Failed to find section: %s", sectionName.c_str());
return;
}
@@ -60,7 +60,7 @@ void BaseRandomServer::SpawnSection(Entity* self, const std::string& sectionName
}
}
void BaseRandomServer::SetSpawnerNetwork(Entity* self, const std::string& spawnerName, int32_t spawnNum, LOT spawnLOT)
void BaseRandomServer::SetSpawnerNetwork(Entity* self, const std::string& spawnerName, int32_t spawnNum, LOT spawnLOT)
{
const auto& spawners = dZoneManager::Instance()->GetSpawnersByName(spawnerName);
@@ -71,7 +71,7 @@ void BaseRandomServer::SetSpawnerNetwork(Entity* self, const std::string& spawne
if (spawners.empty())
{
Game::logger->Log("BaseRandomServer", "Failed to find spawner: %s\n", spawnerName.c_str());
Game::logger->Log("BaseRandomServer", "Failed to find spawner: %s", spawnerName.c_str());
return;
}
@@ -108,7 +108,7 @@ void BaseRandomServer::SetSpawnerNetwork(Entity* self, const std::string& spawne
spawnersWatched.push_back(spawner);
}
BaseRandomServer::Zone* BaseRandomServer::GetRandomLoad(Entity* self, const std::string& sectionName)
BaseRandomServer::Zone* BaseRandomServer::GetRandomLoad(Entity* self, const std::string& sectionName)
{
const auto zoneInfo = GeneralUtils::SplitString(sectionName, '_');
@@ -135,7 +135,7 @@ BaseRandomServer::Zone* BaseRandomServer::GetRandomLoad(Entity* self, const std:
return nullptr;
}
void BaseRandomServer::NotifySpawnerOfDeath(Entity* self, Spawner* spawner)
void BaseRandomServer::NotifySpawnerOfDeath(Entity* self, Spawner* spawner)
{
const auto& spawnerName = spawner->GetName();
@@ -164,29 +164,29 @@ void BaseRandomServer::NotifySpawnerOfDeath(Entity* self, Spawner* spawner)
self->SetVar(variableName, mobDeathCount);
}
void BaseRandomServer::NamedEnemyDeath(Entity* self, Spawner* spawner)
void BaseRandomServer::NamedEnemyDeath(Entity* self, Spawner* spawner)
{
const auto spawnDelay = GeneralUtils::GenerateRandomNumber<float>(1, 2) * 450;
self->AddTimer("SpawnNewEnemy", spawnDelay);
}
void BaseRandomServer::SpawnersUp(Entity* self)
void BaseRandomServer::SpawnersUp(Entity* self)
{
}
void BaseRandomServer::SpawnersDown(Entity* self)
void BaseRandomServer::SpawnersDown(Entity* self)
{
}
void BaseRandomServer::BaseOnTimerDone(Entity* self, const std::string& timerName)
void BaseRandomServer::BaseOnTimerDone(Entity* self, const std::string& timerName)
{
NamedTimerDone(self, timerName);
}
void BaseRandomServer::SpawnNamedEnemy(Entity* self)
void BaseRandomServer::SpawnNamedEnemy(Entity* self)
{
const auto enemy = namedMobs[GeneralUtils::GenerateRandomNumber<int32_t>(0, namedMobs.size() - 1)];

View File

@@ -22,7 +22,7 @@
void BossSpiderQueenEnemyServer::OnStartup(Entity* self) {
// Make immune to stuns
//self:SetStunImmunity{ StateChangeType = "PUSH", bImmuneToStunAttack = true, bImmuneToStunMove = true, bImmuneToStunTurn = true, bImmuneToStunUseItem = true, bImmuneToStunEquip = true, bImmuneToStunInteract = true, bImmuneToStunJump = true }
// Make immune to knockbacks and pulls
//self:SetStatusImmunity{ StateChangeType = "PUSH", bImmuneToPullToPoint = true, bImmuneToKnockback = true, bImmuneToInterrupt = true }
@@ -60,7 +60,7 @@ void BossSpiderQueenEnemyServer::OnDie(Entity* self, Entity* killer) {
missionComponent->CompleteMission(instanceMissionID);
}
Game::logger->Log("BossSpiderQueenEnemyServer", "Starting timer...\n");
Game::logger->Log("BossSpiderQueenEnemyServer", "Starting timer...");
// There is suppose to be a 0.1 second delay here but that may be admitted?
auto* controller = EntityManager::Instance()->GetZoneControlEntity();
@@ -88,15 +88,15 @@ void BossSpiderQueenEnemyServer::WithdrawSpider(Entity* self, const bool withdra
//First rotate for anim
NiQuaternion rot = NiQuaternion::IDENTITY;
controllable->SetStatic(false);
controllable->SetRotation(rot);
controllable->SetStatic(true);
controllable->SetDirtyPosition(true);
rot = controllable->GetRotation();
EntityManager::Instance()->SerializeEntity(self);
@@ -122,10 +122,10 @@ void BossSpiderQueenEnemyServer::WithdrawSpider(Entity* self, const bool withdra
}
else {
controllable->SetStatic(false);
//Cancel all remaining timers for say idle anims:
self->CancelAllTimers();
auto* baseCombatAi = self->GetComponent<BaseCombatAIComponent>();
baseCombatAi->SetDisabled(false);
@@ -133,7 +133,7 @@ void BossSpiderQueenEnemyServer::WithdrawSpider(Entity* self, const bool withdra
// Move the Spider to its ground location
// preparing its stage attacks, and removing invulnerability
//destroyable->SetIsImmune(false);
// Run the advance animation and prepare a timer for resuming AI
float animTime = PlayAnimAndReturnTime(self, spiderAdvanceAnim);
animTime += 1.f;
@@ -142,19 +142,19 @@ void BossSpiderQueenEnemyServer::WithdrawSpider(Entity* self, const bool withdra
destroyable->SetFaction(4);
destroyable->SetIsImmune(false);
//Advance stage
m_CurrentBossStage++;
//Reset the current wave death counter
m_DeathCounter = 0;
EntityManager::Instance()->SerializeEntity(self);
// Prepare a timer for post leap attack
self->AddTimer("AdvanceAttack", attackPause);
// Prepare a timer for post leap
// Prepare a timer for post leap
self->AddTimer("AdvanceComplete", animTime);
}
@@ -162,7 +162,7 @@ void BossSpiderQueenEnemyServer::WithdrawSpider(Entity* self, const bool withdra
}
void BossSpiderQueenEnemyServer::SpawnSpiderWave(Entity* self, int spiderCount) {
// The Spider Queen Boss is withdrawing and requesting the spawn
// The Spider Queen Boss is withdrawing and requesting the spawn
// of a hatchling wave
/*auto SpiderEggNetworkID = self->GetI64(u"SpiderEggNetworkID");
@@ -176,7 +176,7 @@ void BossSpiderQueenEnemyServer::SpawnSpiderWave(Entity* self, int spiderCount)
hatchCounter = spiderCount;
hatchList = {};
Game::logger->Log("SpiderQueen", "Trying to spawn %i spiders\n", hatchCounter);
Game::logger->Log("SpiderQueen", "Trying to spawn %i spiders", hatchCounter);
// Run the wave manager
@@ -189,19 +189,19 @@ void BossSpiderQueenEnemyServer::SpiderWaveManager(Entity* self) {
// Reset the spider egg spawner network to ensure a maximum number of eggs
//SpiderEggNetworkID:SpawnerReset()
// Obtain a list of all the eggs on the egg spawner network
//auto spiderEggList = SpiderEggNetworkID:SpawnerGetAllObjectIDsSpawned().objects;
//if (table.maxn(spiderEggList) <= 0) {
//if (table.maxn(spiderEggList) <= 0) {
// self->AddTimer("PollSpiderWaveManager", 1.0f);
// return;
//}
//
//// A check for (wave mangement across multiple spawn iterations
//if(hatchCounter < spiderWaveCnt) {
// // We have already prepped some objects for (hatching,
// // We have already prepped some objects for (hatching,
// // remove them from our list for (random egg pulls
// for (i, sVal in ipairs(spiderEggList) {
// if(hatchList[sVal:GetID()]) {
@@ -220,8 +220,8 @@ void BossSpiderQueenEnemyServer::SpiderWaveManager(Entity* self) {
for (auto spodder : spooders) {
spiderEggs.push_back(spodder->GetObjectID());
}
// Select a number of random spider eggs from the list equal to the
// Select a number of random spider eggs from the list equal to the
// current number needed to complete the current wave
for (int i = 0; i < hatchCounter; i++) {
// Select a random spider egg
@@ -235,7 +235,7 @@ void BossSpiderQueenEnemyServer::SpiderWaveManager(Entity* self) {
randomEgg = spiderEggs[randomEggLoc];
}
}
if (randomEgg) {
auto* eggEntity = EntityManager::Instance()->GetEntity(randomEgg);
@@ -246,24 +246,24 @@ void BossSpiderQueenEnemyServer::SpiderWaveManager(Entity* self) {
// Prep the selected spider egg
//randomEgg:FireEvent{s}erID=self, args="prepEgg"}
eggEntity->OnFireEventServerSide(self, "prepEgg");
Game::logger->Log("SpiderQueen", "Prepping egg %llu\n", eggEntity->GetObjectID());
Game::logger->Log("SpiderQueen", "Prepping egg %llu", eggEntity->GetObjectID());
// Add the prepped egg to our hatchList
hatchList.push_back(eggEntity->GetObjectID());
// Decrement the hatchCounter
hatchCounter = hatchCounter - 1;
}
// Remove it from our spider egg list
//table.remove(spiderEggList, randomEggLoc);
spiderEggs[randomEggLoc] = LWOOBJID_EMPTY;
if (spiderEggs.size() <= 0 || (hatchCounter <= 0)) {
if (spiderEggs.size() <= 0 || (hatchCounter <= 0)) {
break;
}
}
if (hatchCounter > 0) {
// We still have more eggs to hatch, poll the SpiderWaveManager again
self->AddTimer("PollSpiderWaveManager", 1.0f);
@@ -280,20 +280,20 @@ void BossSpiderQueenEnemyServer::SpiderWaveManager(Entity* self) {
}
eggEntity->OnFireEventServerSide(self, "hatchEgg");
Game::logger->Log("SpiderQueen", "hatching egg %llu\n", eggEntity->GetObjectID());
Game::logger->Log("SpiderQueen", "hatching egg %llu", eggEntity->GetObjectID());
auto time = PlayAnimAndReturnTime(self, spiderWithdrawIdle);
combat->SetStunImmune(false);
combat->Stun(time += 6.0f);
combat->SetStunImmune(true);
//self->AddTimer("disableWaitForIdle", defaultAnimPause);
self->AddTimer("checkForSpiders", 6.0f);
}
hatchList.clear();
}
}
@@ -322,7 +322,7 @@ void BossSpiderQueenEnemyServer::RunRainOfFire(Entity* self)
for (const auto& rofGroup : ROFTargetGroupIDTable)
{
const auto spawners = dZoneManager::Instance()->GetSpawnersInGroup(rofGroup);
std::vector<LWOOBJID> spawned;
for (auto* spawner : spawners)
@@ -352,7 +352,7 @@ void BossSpiderQueenEnemyServer::RunRainOfFire(Entity* self)
self->AddTimer("StartROF", animTime);
}
void BossSpiderQueenEnemyServer::RainOfFireManager(Entity* self)
void BossSpiderQueenEnemyServer::RainOfFireManager(Entity* self)
{
if (!impactList.empty())
{
@@ -362,7 +362,7 @@ void BossSpiderQueenEnemyServer::RainOfFireManager(Entity* self)
if (entity == nullptr)
{
Game::logger->Log("BossSpiderQueenEnemyServer", "Failed to find impact!\n");
Game::logger->Log("BossSpiderQueenEnemyServer", "Failed to find impact!");
return;
}
@@ -371,8 +371,8 @@ void BossSpiderQueenEnemyServer::RainOfFireManager(Entity* self)
if (skillComponent == nullptr)
{
Game::logger->Log("BossSpiderQueenEnemyServer", "Failed to find impact skill component!\n");
Game::logger->Log("BossSpiderQueenEnemyServer", "Failed to find impact skill component!");
return;
}
@@ -384,7 +384,7 @@ void BossSpiderQueenEnemyServer::RainOfFireManager(Entity* self)
}
ToggleForSpecial(self, false);
self->AddTimer("ROF", GeneralUtils::GenerateRandomNumber<float>(20, 40));
}
@@ -402,7 +402,7 @@ void BossSpiderQueenEnemyServer::RapidFireShooterManager(Entity* self)
}
const auto target = attackTargetTable[0];
auto* skillComponent = self->GetComponent<SkillComponent>();
skillComponent->CalculateBehavior(1394, 32612, target, true);
@@ -412,7 +412,7 @@ void BossSpiderQueenEnemyServer::RapidFireShooterManager(Entity* self)
self->AddTimer("PollRFSManager", 0.3f);
}
void BossSpiderQueenEnemyServer::RunRapidFireShooter(Entity* self)
void BossSpiderQueenEnemyServer::RunRapidFireShooter(Entity* self)
{
/*
const auto targets = EntityManager::Instance()->GetEntitiesByComponent(COMPONENT_TYPE_CHARACTER);
@@ -429,7 +429,7 @@ void BossSpiderQueenEnemyServer::RunRapidFireShooter(Entity* self)
if (targets.empty())
{
Game::logger->Log("BossSpiderQueenEnemyServer", "Failed to find RFS targets\n");
Game::logger->Log("BossSpiderQueenEnemyServer", "Failed to find RFS targets");
self->AddTimer("RFS", GeneralUtils::GenerateRandomNumber<float>(5, 10));
@@ -452,7 +452,7 @@ void BossSpiderQueenEnemyServer::RunRapidFireShooter(Entity* self)
PlayAnimAndReturnTime(self, spiderSingleShot);
Game::logger->Log("BossSpiderQueenEnemyServer", "Ran RFS\n");
Game::logger->Log("BossSpiderQueenEnemyServer", "Ran RFS");
self->AddTimer("RFS", GeneralUtils::GenerateRandomNumber<float>(10, 15));
}
@@ -487,7 +487,7 @@ void BossSpiderQueenEnemyServer::OnTimerDone(Entity* self, const std::string tim
//If there are still baby spiders, don't do anyhting either
const auto spiders = EntityManager::Instance()->GetEntitiesInGroup("BabySpider");
if (spiders.size() > 0)
if (spiders.size() > 0)
self->AddTimer("checkForSpiders", time);
else
WithdrawSpider(self, false);
@@ -496,30 +496,30 @@ void BossSpiderQueenEnemyServer::OnTimerDone(Entity* self, const std::string tim
//Call the manager again to attempt to initiate an impact on another random location
//Run the ROF Manager
RainOfFireManager(self);
} else if ( timerName == "PollRFSManager") {
//Call the manager again to attempt to initiate a rapid fire shot at the next sequential target
//Run the ROF Manager
RapidFireShooterManager(self);
} else if ( timerName == "StartROF") {
//Re-enable Spider Boss
//ToggleForSpecial(self, false);
RainOfFireManager(self);
} else if ( timerName == "PollSpiderSkillManager") {
//Call the skill manager again to attempt to run the current Spider Boss
//stage's special attack again
//SpiderSkillManager(self, true);
PlayAnimAndReturnTime(self, spiderJeerAnim);
} else if ( timerName == "RFS") {
RunRapidFireShooter(self);
} else if ( timerName == "ROF") {
RunRainOfFire(self);
} else if ( timerName == "RFSTauntComplete") {
//Determine an appropriate random time to check our manager again
} else if ( timerName == "RFSTauntComplete") {
//Determine an appropriate random time to check our manager again
// local spiderCooldownDelay = math.random(s1DelayMin, s1DelayMax)
//Set a timer based on our random cooldown determination
@@ -529,7 +529,7 @@ void BossSpiderQueenEnemyServer::OnTimerDone(Entity* self, const std::string tim
//Re-enable Spider Boss
//ToggleForSpecial(self, false);
} else if ( timerName == "WithdrawComplete") {
//Play the Spider Boss' mountain idle anim
PlayAnimAndReturnTime(self, spiderWithdrawIdle);
@@ -545,19 +545,19 @@ void BossSpiderQueenEnemyServer::OnTimerDone(Entity* self, const std::string tim
if (currentStage > 1) hatchCounter++;
SpawnSpiderWave(self, spiderWaveCntTable[currentStage - 1]);
} else if ( timerName == "AdvanceAttack") {
} else if ( timerName == "AdvanceAttack") {
//TODO: Can we even do knockbacks yet? @Wincent01
// Yes ^
//Fire the melee smash skill to throw players back
/*local landingTarget = self:GetVar("LandingTarget") or false
if((landingTarget) and (landingTarget:Exists())) {
local advSmashFlag = landingTarget:CastSkill{skillID = bossLandingSkill}
landingTarget:PlayEmbeddedEffectOnAllClientsNearObject{radius = 100, fromObjectID = landingTarget, effectName = "camshake-bridge"}
}*/
auto landingTarget = self->GetI64(u"LandingTarget");
auto landingEntity = EntityManager::Instance()->GetEntity(landingTarget);
@@ -567,7 +567,7 @@ void BossSpiderQueenEnemyServer::OnTimerDone(Entity* self, const std::string tim
{
skillComponent->CalculateBehavior(bossLandingSkill, 37739, LWOOBJID_EMPTY);
}
if (landingEntity) {
auto* landingSkill = landingEntity->GetComponent<SkillComponent>();
@@ -578,12 +578,12 @@ void BossSpiderQueenEnemyServer::OnTimerDone(Entity* self, const std::string tim
}
GameMessages::SendPlayEmbeddedEffectOnAllClientsNearObject(self, u"camshake-bridge", self->GetObjectID(), 100.0f);
} else if ( timerName == "AdvanceComplete") {
} else if ( timerName == "AdvanceComplete") {
//Reset faction and collision
/*local SBFactionList = self:GetVar("SBFactionList")
local SBCollisionGroup = self:GetVar("SBCollisionGroup")
for i, fVal in ipairs(SBFactionList) {
if(i == 1) {
//Our first faction - flush and add
@@ -596,18 +596,18 @@ void BossSpiderQueenEnemyServer::OnTimerDone(Entity* self, const std::string tim
/*
auto SBCollisionGroup = self->GetI32(u"SBCollisionGroup");
GameMessages::SendNotifyClientObject(self->GetObjectID(), u"SetColGroup", SBCollisionGroup, 0, LWOOBJID_EMPTY, "", UNASSIGNED_SYSTEM_ADDRESS);
*/
GameMessages::SendNotifyClientObject(self->GetObjectID(), u"SetColGroup", 11, 0, 0, "", UNASSIGNED_SYSTEM_ADDRESS);
//Wind up, telegraphing next round
float animTime = PlayAnimAndReturnTime(self, spiderJeerAnim);
self->AddTimer("AdvanceTauntComplete", animTime);
} else if ( timerName == "AdvanceTauntComplete") {
//Declare a default special Spider Boss skill cooldown
int spiderCooldownDelay = 10;
@@ -620,11 +620,11 @@ void BossSpiderQueenEnemyServer::OnTimerDone(Entity* self, const std::string tim
//Set a timer based on our random cooldown determination
//to pulse the SpiderSkillManager
self->AddTimer("PollSpiderSkillManager", spiderCooldownDelay);
//Remove current status immunity
/*self:SetStatusImmunity{ StateChangeType = "POP", bImmuneToSpeed = true, bImmuneToBasicAttack = true, bImmuneToDOT = true}
self:SetStunned{StateChangeType = "POP",
self:SetStunned{StateChangeType = "POP",
bCantMove = true,
bCantJump = true,
bCantTurn = true,
@@ -638,14 +638,14 @@ void BossSpiderQueenEnemyServer::OnTimerDone(Entity* self, const std::string tim
destroyable->SetFaction(4);
EntityManager::Instance()->SerializeEntity(self);
} else if ( timerName == "Clear") {
EntityManager::Instance()->FireEventServerSide(self, "ClearProperty");
self->CancelAllTimers();
} else if ( timerName == "UnlockSpecials") {
//We no longer need to lock specials
self->SetBoolean(u"bSpecialLock", false);
//Did we queue a spcial attack?
if(self->GetBoolean(u"bSpecialQueued")) {
self->SetBoolean(u"bSpecialQueued", false);
@@ -723,17 +723,17 @@ float BossSpiderQueenEnemyServer::PlayAnimAndReturnTime(Entity* self, const std:
//TODO: Get the actual animation time
// Get the anim time
float animTimer = defaultAnimPause; //self:GetAnimationTime{animationID = animID}.time
float animTimer = defaultAnimPause; //self:GetAnimationTime{animationID = animID}.time
// If we have an animation play it
if (animTimer > 0) {
GameMessages::SendPlayAnimation(self, animID);
}
// If the anim time is less than the the default time use default
if (animTimer < defaultAnimPause) {
animTimer = defaultAnimPause;
}
return animTimer;
}

View File

@@ -818,7 +818,7 @@ CppScripts::Script* CppScripts::GetScript(Entity* parent, const std::string& scr
script = invalidToReturn;
else if (script == invalidToReturn) {
if (scriptName.length() > 0)
Game::logger->LogDebug("CppScripts", "Attempted to load CppScript for '" + scriptName + "', but returned InvalidScript.\n");
Game::logger->LogDebug("CppScripts", "Attempted to load CppScript for '" + scriptName + "', but returned InvalidScript.");
// information not really needed for sys admins but is for developers
script = invalidToReturn;

View File

@@ -2,7 +2,7 @@
#include "SkillComponent.h"
#include "GameMessages.h"
void FlameJetServer::OnStartup(Entity* self)
void FlameJetServer::OnStartup(Entity* self)
{
if (self->GetVar<bool>(u"NotActive"))
{
@@ -12,7 +12,7 @@ void FlameJetServer::OnStartup(Entity* self)
self->SetNetworkVar<bool>(u"FlameOn", true);
}
void FlameJetServer::OnCollisionPhantom(Entity* self, Entity* target)
void FlameJetServer::OnCollisionPhantom(Entity* self, Entity* target)
{
if (!target->IsPlayer())
{
@@ -42,9 +42,9 @@ void FlameJetServer::OnCollisionPhantom(Entity* self, Entity* target)
GameMessages::SendKnockback(target->GetObjectID(), self->GetObjectID(), self->GetObjectID(), 1000, dir);
}
void FlameJetServer::OnFireEventServerSide(Entity *self, Entity *sender, std::string args, int32_t param1, int32_t param2, int32_t param3)
void FlameJetServer::OnFireEventServerSide(Entity *self, Entity *sender, std::string args, int32_t param1, int32_t param2, int32_t param3)
{
Game::logger->Log("FlameJetServer::OnFireEventServerSide", "Event: %s\n", args.c_str());
Game::logger->Log("FlameJetServer::OnFireEventServerSide", "Event: %s", args.c_str());
if (args == "OnActivated")
{

View File

@@ -4,7 +4,7 @@
#include "BaseCombatAIComponent.h"
#include "DestroyableComponent.h"
void FvMaelstromDragon::OnStartup(Entity* self)
void FvMaelstromDragon::OnStartup(Entity* self)
{
self->SetVar<int32_t>(u"weakspot", 0);
@@ -16,7 +16,7 @@ void FvMaelstromDragon::OnStartup(Entity* self)
}
}
void FvMaelstromDragon::OnDie(Entity* self, Entity* killer)
void FvMaelstromDragon::OnDie(Entity* self, Entity* killer)
{
if (self->GetVar<bool>(u"bDied"))
{
@@ -68,7 +68,7 @@ void FvMaelstromDragon::OnHitOrHealResult(Entity* self, Entity* attacker, int32_
if (destroyableComponent != nullptr)
{
Game::logger->Log("FvMaelstromDragon", "Hit %i\n", destroyableComponent->GetArmor());
Game::logger->Log("FvMaelstromDragon", "Hit %i", destroyableComponent->GetArmor());
if (destroyableComponent->GetArmor() > 0) return;
@@ -76,7 +76,7 @@ void FvMaelstromDragon::OnHitOrHealResult(Entity* self, Entity* attacker, int32_
if (weakpoint == 0)
{
Game::logger->Log("FvMaelstromDragon", "Activating weakpoint\n");
Game::logger->Log("FvMaelstromDragon", "Activating weakpoint");
self->AddTimer("ReviveTimer", 12);
@@ -141,7 +141,7 @@ void FvMaelstromDragon::OnHitOrHealResult(Entity* self, Entity* attacker, int32_
}
}
void FvMaelstromDragon::OnTimerDone(Entity* self, std::string timerName)
void FvMaelstromDragon::OnTimerDone(Entity* self, std::string timerName)
{
if (timerName == "ReviveHeldTimer")
{
@@ -187,7 +187,7 @@ FvMaelstromDragon::OnFireEventServerSide(Entity *self, Entity *sender, std::stri
int32_t param3)
{
if (args != "rebuildDone") return;
self->AddTimer("ExposeWeakSpotTimer", 3.8f);
self->CancelTimer("ReviveTimer");

View File

@@ -92,7 +92,7 @@ void NjMonastryBossInstance::OnPlayerExit(Entity *self, Entity *player) {
UpdatePlayer(self, player->GetObjectID(), true);
// Fetch the total players loaded from the vars
auto totalPlayersLoaded = self->GetVar<std::vector<LWOOBJID> >(TotalPlayersLoadedVariable);
// Find the player to remove
auto playerToRemove = std::find(totalPlayersLoaded.begin(), totalPlayersLoaded.end(), player->GetObjectID());
@@ -100,7 +100,7 @@ void NjMonastryBossInstance::OnPlayerExit(Entity *self, Entity *player) {
if (playerToRemove != totalPlayersLoaded.end()) {
totalPlayersLoaded.erase(playerToRemove);
} else {
Game::logger->Log("NjMonastryBossInstance", "Failed to remove player at exit.\n");
Game::logger->Log("NjMonastryBossInstance", "Failed to remove player at exit.");
}
// Set the players loaded var back

View File

@@ -13,7 +13,7 @@
#include "MissionComponent.h"
void SGCannon::OnStartup(Entity *self) {
Game::logger->Log("SGCannon", "OnStartup\n");
Game::logger->Log("SGCannon", "OnStartup");
m_Waves = GetWaves();
constants = GetConstants();
@@ -59,7 +59,7 @@ void SGCannon::OnStartup(Entity *self) {
}
void SGCannon::OnPlayerLoaded(Entity *self, Entity *player) {
Game::logger->Log("SGCannon", "Player loaded\n");
Game::logger->Log("SGCannon", "Player loaded");
self->SetVar<LWOOBJID>(PlayerIDVariable, player->GetObjectID());
}
@@ -70,15 +70,15 @@ void SGCannon::OnFireEventServerSide(Entity *self, Entity *sender, std::string a
void SGCannon::OnActivityStateChangeRequest(Entity *self, LWOOBJID senderID, int32_t value1, int32_t value2,
const std::u16string &stringValue) {
Game::logger->Log("SGCannon", "Got activity state change request: %s\n", GeneralUtils::UTF16ToWTF8(stringValue).c_str());
Game::logger->Log("SGCannon", "Got activity state change request: %s", GeneralUtils::UTF16ToWTF8(stringValue).c_str());
if (stringValue == u"clientready") {
auto* player = EntityManager::Instance()->GetEntity(self->GetVar<LWOOBJID>(PlayerIDVariable));
if (player != nullptr) {
Game::logger->Log("SGCannon", "Player is ready\n");
Game::logger->Log("SGCannon", "Player is ready");
/*GameMessages::SendSetStunned(player->GetObjectID(), PUSH, player->GetSystemAddress(), LWOOBJID_EMPTY,
true, true, true, true, true, true, true);*/
Game::logger->Log("SGCannon", "Sending ActivityEnter\n");
Game::logger->Log("SGCannon", "Sending ActivityEnter");
GameMessages::SendActivityEnter(self->GetObjectID(), player->GetSystemAddress());
@@ -87,14 +87,14 @@ void SGCannon::OnActivityStateChangeRequest(Entity *self, LWOOBJID senderID, int
if (shootingGalleryComponent != nullptr) {
shootingGalleryComponent->SetCurrentPlayerID(player->GetObjectID());
Game::logger->Log("SGCannon", "Setting player ID\n");
Game::logger->Log("SGCannon", "Setting player ID");
EntityManager::Instance()->SerializeEntity(self);
}
else {
Game::logger->Log("SGCannon", "Shooting gallery component is null\n");
Game::logger->Log("SGCannon", "Shooting gallery component is null");
}
auto* characterComponent = player->GetComponent<CharacterComponent>();
if (characterComponent != nullptr) {
@@ -112,11 +112,11 @@ void SGCannon::OnActivityStateChangeRequest(Entity *self, LWOOBJID senderID, int
self->SetNetworkVar<bool>(HideScoreBoardVariable, true);
self->SetNetworkVar<bool>(ReSetSuperChargeVariable, true);
self->SetNetworkVar<bool>(ShowLoadingUI, true);
/*
GameMessages::SendTeleport(
player->GetObjectID(),
{-292.6415710449219, 230.20237731933594, -3.9090466499328613},
player->GetObjectID(),
{-292.6415710449219, 230.20237731933594, -3.9090466499328613},
{0.7067984342575073, -6.527870573336259e-05, 0.707414984703064, 0.00021762956748716533},
player->GetSystemAddress(), true
);
@@ -125,7 +125,7 @@ void SGCannon::OnActivityStateChangeRequest(Entity *self, LWOOBJID senderID, int
//GameMessages::SendRequestActivityEnter(self->GetObjectID(), player->GetSystemAddress(), false, player->GetObjectID());
}
else {
Game::logger->Log("SGCannon", "Player not found\n");
Game::logger->Log("SGCannon", "Player not found");
}
}
else if (value1 == 1200) {
@@ -193,7 +193,7 @@ void SGCannon::OnActivityTimerDone(Entity *self, const std::string &name) {
SpawnObject(self, enemyToSpawn, true);
}
Game::logger->Log("SGCannon", "Current wave spawn: %i/%i\n", wave, m_Waves.size());
Game::logger->Log("SGCannon", "Current wave spawn: %i/%i", wave, m_Waves.size());
// All waves completed
const auto timeLimit = (float_t) self->GetVar<uint32_t>(TimeLimitVariable);
@@ -208,7 +208,7 @@ void SGCannon::OnActivityTimerDone(Entity *self, const std::string &name) {
GameMessages::SendPlayFXEffect(player->GetObjectID(), -1, u"SG-start", "");
GameMessages::SendStartActivityTime(self->GetObjectID(), timeLimit, player->GetSystemAddress());
Game::logger->Log("SGCannon", "Sending ActivityPause false\n");
Game::logger->Log("SGCannon", "Sending ActivityPause false");
GameMessages::SendActivityPause(self->GetObjectID(), false, player->GetSystemAddress());
}
@@ -229,7 +229,7 @@ void SGCannon::OnActivityTimerDone(Entity *self, const std::string &name) {
self->SetNetworkVar<uint32_t>(WaveNumVariable, self->GetVar<uint32_t>(ThisWaveVariable) + 1);
self->SetNetworkVar<uint32_t>(WaveStrVariable, self->GetVar<uint32_t>(TimeLimitVariable));
Game::logger->Log("SGCannon", "Current wave: %i/%i\n", self->GetVar<uint32_t>(ThisWaveVariable), m_Waves.size());
Game::logger->Log("SGCannon", "Current wave: %i/%i", self->GetVar<uint32_t>(ThisWaveVariable), m_Waves.size());
if (self->GetVar<uint32_t>(ThisWaveVariable) >= m_Waves.size()) {
ActivityTimerStart(self, GameOverTimer, 0.1, 0.1);
@@ -237,7 +237,7 @@ void SGCannon::OnActivityTimerDone(Entity *self, const std::string &name) {
ActivityTimerStart(self, SpawnWaveTimer, constants.inBetweenWavePause, constants.inBetweenWavePause);
}
Game::logger->Log("SGCannon", "Sending ActivityPause true\n");
Game::logger->Log("SGCannon", "Sending ActivityPause true");
GameMessages::SendActivityPause(self->GetObjectID(), true);
if (self->GetVar<bool>(SuperChargeActiveVariable) && !self->GetVar<bool>(SuperChargePausedVariable)) {
@@ -246,7 +246,7 @@ void SGCannon::OnActivityTimerDone(Entity *self, const std::string &name) {
} else if (name == GameOverTimer) {
auto* player = EntityManager::Instance()->GetEntity(self->GetVar<LWOOBJID>(PlayerIDVariable));
if (player != nullptr) {
Game::logger->Log("SGCannon", "Sending ActivityPause true\n");
Game::logger->Log("SGCannon", "Sending ActivityPause true");
GameMessages::SendActivityPause(self->GetObjectID(), true, player->GetSystemAddress());
@@ -288,7 +288,7 @@ void SGCannon::OnActivityTimerDone(Entity *self, const std::string &name) {
new LDFData<std::u16string>(u"groupID", u"SGEnemy")
};
Game::logger->Log("SGCannon", "Spawning enemy %i on path %s\n", toSpawn.lot, path->pathName.c_str());
Game::logger->Log("SGCannon", "Spawning enemy %i on path %s", toSpawn.lot, path->pathName.c_str());
auto* enemy = EntityManager::Instance()->CreateEntity(info, nullptr, self);
EntityManager::Instance()->ConstructEntity(enemy);
@@ -297,7 +297,7 @@ void SGCannon::OnActivityTimerDone(Entity *self, const std::string &name) {
auto* movementAI = new MovementAIComponent(enemy, {});
enemy->AddComponent(COMPONENT_TYPE_MOVEMENT_AI, movementAI);
movementAI->SetSpeed(toSpawn.initialSpeed);
movementAI->SetCurrentSpeed(toSpawn.initialSpeed);
movementAI->SetHaltDistance(0.0f);
@@ -349,7 +349,7 @@ void SGCannon::StartGame(Entity *self) {
auto* player = EntityManager::Instance()->GetEntity(self->GetVar<LWOOBJID>(PlayerIDVariable));
if (player != nullptr) {
GetLeaderboardData(self, player->GetObjectID(), GetActivityID(self));
Game::logger->Log("SGCannon", "Sending ActivityStart\n");
Game::logger->Log("SGCannon", "Sending ActivityStart");
GameMessages::SendActivityStart(self->GetObjectID(), player->GetSystemAddress());
GameMessages::SendPlayFXEffect(self->GetObjectID(), -1, u"start", "");
@@ -554,7 +554,7 @@ void SGCannon::StopGame(Entity *self, bool cancel) {
}
auto* missionComponent = player->GetComponent<MissionComponent>();
if (missionComponent != nullptr) {
missionComponent->Progress(MissionTaskType::MISSION_TASK_TYPE_MINIGAME, self->GetVar<uint32_t>(TotalScoreVariable), self->GetObjectID(), "performact_score");
missionComponent->Progress(MissionTaskType::MISSION_TASK_TYPE_MINIGAME, self->GetVar<uint32_t>(MaxStreakVariable), self->GetObjectID(), "performact_streak");
@@ -602,7 +602,7 @@ void SGCannon::StopGame(Entity *self, bool cancel) {
ResetVars(self);
}
void SGCannon::RegisterHit(Entity* self, Entity* target, const std::string& timerName)
void SGCannon::RegisterHit(Entity* self, Entity* target, const std::string& timerName)
{
const auto& spawnInfo = target->GetVar<SGEnemy>(u"SpawnData");
@@ -634,7 +634,7 @@ void SGCannon::RegisterHit(Entity* self, Entity* target, const std::string& time
auto scScore = self->GetVar<uint32_t>(TotalScoreVariable) - lastSuperTotal;
Game::logger->Log("SGCannon", "LastSuperTotal: %i, scScore: %i, constants.chargedPoints: %i\n",
Game::logger->Log("SGCannon", "LastSuperTotal: %i, scScore: %i, constants.chargedPoints: %i",
lastSuperTotal, scScore, constants.chargedPoints
);
@@ -674,7 +674,7 @@ void SGCannon::RegisterHit(Entity* self, Entity* target, const std::string& time
missionComponent->Progress(MissionTaskType::MISSION_TASK_TYPE_SMASH, spawnInfo.lot, self->GetObjectID());
}
void SGCannon::UpdateStreak(Entity* self)
void SGCannon::UpdateStreak(Entity* self)
{
const auto streakBonus = GetCurrentBonus(self);
@@ -705,7 +705,7 @@ void SGCannon::UpdateStreak(Entity* self)
if (maxStreak < curStreak) self->SetVar<uint32_t>(MaxStreakVariable, curStreak);
}
float_t SGCannon::GetCurrentBonus(Entity* self)
float_t SGCannon::GetCurrentBonus(Entity* self)
{
auto streak = self->GetVar<uint32_t>(u"m_curStreak");
@@ -723,7 +723,7 @@ void SGCannon::ToggleSuperCharge(Entity *self, bool enable) {
auto* player = EntityManager::Instance()->GetEntity(self->GetVar<LWOOBJID>(PlayerIDVariable));
if (player == nullptr) {
Game::logger->Log("SGCannon", "Player not found in toggle super charge\n");
Game::logger->Log("SGCannon", "Player not found in toggle super charge");
return;
}
@@ -731,7 +731,7 @@ void SGCannon::ToggleSuperCharge(Entity *self, bool enable) {
auto equippedItems = inventoryComponent->GetEquippedItems();
Game::logger->Log("SGCannon", "Player has %d equipped items\n", equippedItems.size());
Game::logger->Log("SGCannon", "Player has %d equipped items", equippedItems.size());
auto skillID = constants.cannonSkill;
auto coolDown = constants.cannonRefireRate;
@@ -739,12 +739,12 @@ void SGCannon::ToggleSuperCharge(Entity *self, bool enable) {
auto* selfInventoryComponent = self->GetComponent<InventoryComponent>();
if (inventoryComponent == nullptr) {
Game::logger->Log("SGCannon", "Inventory component not found\n");
Game::logger->Log("SGCannon", "Inventory component not found");
return;
}
if (enable) {
Game::logger->Log("SGCannon", "Player is activating super charge\n");
Game::logger->Log("SGCannon", "Player is activating super charge");
selfInventoryComponent->UpdateSlot("greeble_r", { ObjectIDManager::GenerateRandomObjectID(), 6505, 1, 0 });
selfInventoryComponent->UpdateSlot("greeble_l", { ObjectIDManager::GenerateRandomObjectID(), 6506, 1, 0 });
@@ -754,15 +754,15 @@ void SGCannon::ToggleSuperCharge(Entity *self, bool enable) {
} else {
selfInventoryComponent->UpdateSlot("greeble_r", { ObjectIDManager::GenerateRandomObjectID(), 0, 0, 0 });
selfInventoryComponent->UpdateSlot("greeble_l", { ObjectIDManager::GenerateRandomObjectID(), 0, 0, 0 });
self->SetNetworkVar<float>(u"SuperChargeBar", 0);
Game::logger->Log("SGCannon", "Player disables super charge\n");
Game::logger->Log("SGCannon", "Player disables super charge");
// TODO: Unequip items
for (const auto& equipped : equippedItems) {
if (equipped.first == "special_r" || equipped.first == "special_l") {
Game::logger->Log("SGCannon", "Trying to unequip a weapon, %i\n", equipped.second.lot);
Game::logger->Log("SGCannon", "Trying to unequip a weapon, %i", equipped.second.lot);
auto* item = inventoryComponent->FindItemById(equipped.second.id);
@@ -770,7 +770,7 @@ void SGCannon::ToggleSuperCharge(Entity *self, bool enable) {
inventoryComponent->UnEquipItem(item);
}
else {
Game::logger->Log("SGCannon", "Item not found, %i\n", equipped.second.lot);
Game::logger->Log("SGCannon", "Item not found, %i", equipped.second.lot);
}
}
}
@@ -787,7 +787,7 @@ void SGCannon::ToggleSuperCharge(Entity *self, bool enable) {
}
DynamicShootingGalleryParams properties = shootingGalleryComponent->GetDynamicParams();
properties.cannonFOV = 58.6f;
properties.cannonVelocity = 129.0;
properties.cannonRefireRate = 800;