From 3693868acf0cfd9577ee69825667c501af7ae9df Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 12 Jan 2015 22:52:46 -0600 Subject: [PATCH] Convert 'SPAWNS' debugging _log to logger.LogDebugType --- zone/spawn2.cpp | 130 ++++++++++++++++++++++++------------------------ 1 file changed, 65 insertions(+), 65 deletions(-) diff --git a/zone/spawn2.cpp b/zone/spawn2.cpp index 5a4f9b998..367427527 100644 --- a/zone/spawn2.cpp +++ b/zone/spawn2.cpp @@ -153,13 +153,13 @@ bool Spawn2::Process() { if (timer.Check()) { timer.Disable(); - _log(SPAWNS__MAIN, "Spawn2 %d: Timer has triggered", spawn2_id); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn2 %d: Timer has triggered", spawn2_id); //first check our spawn condition, if this isnt active //then we reset the timer and try again next time. if(condition_id != SC_AlwaysEnabled && !zone->spawn_conditions.Check(condition_id, condition_min_value)) { - _log(SPAWNS__CONDITIONS, "Spawn2 %d: spawning prevented by spawn condition %d", spawn2_id, condition_id); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn2 %d: spawning prevented by spawn condition %d", spawn2_id, condition_id); Reset(); return(true); } @@ -170,14 +170,14 @@ bool Spawn2::Process() { } if (sg == nullptr) { - _log(SPAWNS__MAIN, "Spawn2 %d: Unable to locate spawn group %d. Disabling.", spawn2_id, spawngroup_id_); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn2 %d: Unable to locate spawn group %d. Disabling.", spawn2_id, spawngroup_id_); return false; } //have the spawn group pick an NPC for us uint32 npcid = sg->GetNPCType(); if (npcid == 0) { - _log(SPAWNS__MAIN, "Spawn2 %d: Spawn group %d did not yeild an NPC! not spawning.", spawn2_id, spawngroup_id_); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn2 %d: Spawn group %d did not yeild an NPC! not spawning.", spawn2_id, spawngroup_id_); Reset(); //try again later (why?) return(true); } @@ -185,7 +185,7 @@ bool Spawn2::Process() { //try to find our NPC type. const NPCType* tmp = database.GetNPCType(npcid); if (tmp == nullptr) { - _log(SPAWNS__MAIN, "Spawn2 %d: Spawn group %d yeilded an invalid NPC type %d", spawn2_id, spawngroup_id_, npcid); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn2 %d: Spawn group %d yeilded an invalid NPC type %d", spawn2_id, spawngroup_id_, npcid); Reset(); //try again later return(true); } @@ -194,7 +194,7 @@ bool Spawn2::Process() { { if(!entity_list.LimitCheckName(tmp->name)) { - _log(SPAWNS__MAIN, "Spawn2 %d: Spawn group %d yeilded NPC type %d, which is unique and one already exists.", spawn2_id, spawngroup_id_, npcid); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn2 %d: Spawn group %d yeilded NPC type %d, which is unique and one already exists.", spawn2_id, spawngroup_id_, npcid); timer.Start(5000); //try again in five seconds. return(true); } @@ -202,7 +202,7 @@ bool Spawn2::Process() { if(tmp->spawn_limit > 0) { if(!entity_list.LimitCheckType(npcid, tmp->spawn_limit)) { - _log(SPAWNS__MAIN, "Spawn2 %d: Spawn group %d yeilded NPC type %d, which is over its spawn limit (%d)", spawn2_id, spawngroup_id_, npcid, tmp->spawn_limit); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn2 %d: Spawn group %d yeilded NPC type %d, which is over its spawn limit (%d)", spawn2_id, spawngroup_id_, npcid, tmp->spawn_limit); timer.Start(5000); //try again in five seconds. return(true); } @@ -233,10 +233,10 @@ bool Spawn2::Process() { if(sg->roamdist && sg->roambox[0] && sg->roambox[1] && sg->roambox[2] && sg->roambox[3] && sg->delay && sg->min_delay) npc->AI_SetRoambox(sg->roamdist,sg->roambox[0],sg->roambox[1],sg->roambox[2],sg->roambox[3],sg->delay,sg->min_delay); if(zone->InstantGrids()) { - _log(SPAWNS__MAIN, "Spawn2 %d: Group %d spawned %s (%d) at (%.3f, %.3f, %.3f).", spawn2_id, spawngroup_id_, npc->GetName(), npcid, x, y, z); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn2 %d: Group %d spawned %s (%d) at (%.3f, %.3f, %.3f).", spawn2_id, spawngroup_id_, npc->GetName(), npcid, x, y, z); LoadGrid(); } else { - _log(SPAWNS__MAIN, "Spawn2 %d: Group %d spawned %s (%d) at (%.3f, %.3f, %.3f). Grid loading delayed.", spawn2_id, spawngroup_id_, tmp->name, npcid, x, y, z); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn2 %d: Group %d spawned %s (%d) at (%.3f, %.3f, %.3f). Grid loading delayed.", spawn2_id, spawngroup_id_, tmp->name, npcid, x, y, z); } } return true; @@ -261,7 +261,7 @@ void Spawn2::LoadGrid() { //dont set an NPC's grid until its loaded for them. npcthis->SetGrid(grid_); npcthis->AssignWaypoints(grid_); - _log(SPAWNS__MAIN, "Spawn2 %d: Loading grid %d for %s", spawn2_id, grid_, npcthis->GetName()); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn2 %d: Loading grid %d for %s", spawn2_id, grid_, npcthis->GetName()); } @@ -272,21 +272,21 @@ void Spawn2::LoadGrid() { void Spawn2::Reset() { timer.Start(resetTimer()); npcthis = nullptr; - _log(SPAWNS__MAIN, "Spawn2 %d: Spawn reset, repop in %d ms", spawn2_id, timer.GetRemainingTime()); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn2 %d: Spawn reset, repop in %d ms", spawn2_id, timer.GetRemainingTime()); } void Spawn2::Depop() { timer.Disable(); - _log(SPAWNS__MAIN, "Spawn2 %d: Spawn reset, repop disabled", spawn2_id); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn2 %d: Spawn reset, repop disabled", spawn2_id); npcthis = nullptr; } void Spawn2::Repop(uint32 delay) { if (delay == 0) { timer.Trigger(); - _log(SPAWNS__MAIN, "Spawn2 %d: Spawn reset, repop immediately.", spawn2_id); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn2 %d: Spawn reset, repop immediately.", spawn2_id); } else { - _log(SPAWNS__MAIN, "Spawn2 %d: Spawn reset for repop, repop in %d ms", spawn2_id, delay); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn2 %d: Spawn reset for repop, repop in %d ms", spawn2_id, delay); timer.Start(delay); } npcthis = nullptr; @@ -328,7 +328,7 @@ void Spawn2::ForceDespawn() cur = despawnTimer(dtimer); } - _log(SPAWNS__MAIN, "Spawn2 %d: Spawn group %d set despawn timer to %d ms.", spawn2_id, spawngroup_id_, cur); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn2 %d: Spawn group %d set despawn timer to %d ms.", spawn2_id, spawngroup_id_, cur); timer.Start(cur); } @@ -349,7 +349,7 @@ void Spawn2::DeathReset(bool realdeath) if(spawn2_id) { database.UpdateSpawn2Timeleft(spawn2_id, zone->GetInstanceID(), (cur/1000)); - _log(SPAWNS__MAIN, "Spawn2 %d: Spawn reset by death, repop in %d ms", spawn2_id, timer.GetRemainingTime()); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn2 %d: Spawn reset by death, repop in %d ms", spawn2_id, timer.GetRemainingTime()); //store it to database too } } @@ -466,12 +466,12 @@ void Spawn2::SpawnConditionChanged(const SpawnCondition &c, int16 old_value) { if(GetSpawnCondition() != c.condition_id) return; - _log(SPAWNS__CONDITIONS, "Spawn2 %d: Notified that our spawn condition %d has changed from %d to %d. Our min value is %d.", spawn2_id, c.condition_id, old_value, c.value, condition_min_value); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn2 %d: Notified that our spawn condition %d has changed from %d to %d. Our min value is %d.", spawn2_id, c.condition_id, old_value, c.value, condition_min_value); bool old_state = (old_value >= condition_min_value); bool new_state = (c.value >= condition_min_value); if(old_state == new_state) { - _log(SPAWNS__CONDITIONS, "Spawn2 %d: Our threshold for this condition was not crossed. Doing nothing.", spawn2_id); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn2 %d: Our threshold for this condition was not crossed. Doing nothing.", spawn2_id); return; //no change } @@ -479,50 +479,50 @@ void Spawn2::SpawnConditionChanged(const SpawnCondition &c, int16 old_value) { switch(c.on_change) { case SpawnCondition::DoNothing: //that was easy. - _log(SPAWNS__CONDITIONS, "Spawn2 %d: Our condition is now %s. Taking no action on existing spawn.", spawn2_id, new_state?"enabled":"disabled"); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn2 %d: Our condition is now %s. Taking no action on existing spawn.", spawn2_id, new_state?"enabled":"disabled"); break; case SpawnCondition::DoDepop: - _log(SPAWNS__CONDITIONS, "Spawn2 %d: Our condition is now %s. Depoping our mob.", spawn2_id, new_state?"enabled":"disabled"); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn2 %d: Our condition is now %s. Depoping our mob.", spawn2_id, new_state?"enabled":"disabled"); if(npcthis != nullptr) npcthis->Depop(false); //remove the current mob Reset(); //reset our spawn timer break; case SpawnCondition::DoRepop: - _log(SPAWNS__CONDITIONS, "Spawn2 %d: Our condition is now %s. Forcing a repop.", spawn2_id, new_state?"enabled":"disabled"); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn2 %d: Our condition is now %s. Forcing a repop.", spawn2_id, new_state?"enabled":"disabled"); if(npcthis != nullptr) npcthis->Depop(false); //remove the current mob Repop(); //repop break; case SpawnCondition::DoRepopIfReady: - _log(SPAWNS__CONDITIONS, "Spawn2 %d: Our condition is now %s. Forcing a repop if repsawn timer is expired.", spawn2_id, new_state?"enabled":"disabled"); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn2 %d: Our condition is now %s. Forcing a repop if repsawn timer is expired.", spawn2_id, new_state?"enabled":"disabled"); if(npcthis != nullptr) { - _log(SPAWNS__CONDITIONS, "Spawn2 %d: Our npcthis is currently not null. The zone thinks it is %s. Forcing a depop.", spawn2_id, npcthis->GetName()); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn2 %d: Our npcthis is currently not null. The zone thinks it is %s. Forcing a depop.", spawn2_id, npcthis->GetName()); npcthis->Depop(false); //remove the current mob npcthis = nullptr; } if(new_state) { // only get repawn timer remaining when the SpawnCondition is enabled. timer_remaining = database.GetSpawnTimeLeft(spawn2_id,zone->GetInstanceID()); - _log(SPAWNS__CONDITIONS,"Spawn2 %d: Our condition is now %s. The respawn timer_remaining is %d. Forcing a repop if it is <= 0.", spawn2_id, new_state?"enabled":"disabled", timer_remaining); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Spawns,"Spawn2 %d: Our condition is now %s. The respawn timer_remaining is %d. Forcing a repop if it is <= 0.", spawn2_id, new_state?"enabled":"disabled", timer_remaining); if(timer_remaining <= 0) Repop(); } else { - _log(SPAWNS__CONDITIONS,"Spawn2 %d: Our condition is now %s. Not checking respawn timer.", spawn2_id, new_state?"enabled":"disabled"); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Spawns,"Spawn2 %d: Our condition is now %s. Not checking respawn timer.", spawn2_id, new_state?"enabled":"disabled"); } break; default: if(c.on_change < SpawnCondition::DoSignalMin) { - _log(SPAWNS__CONDITIONS, "Spawn2 %d: Our condition is now %s. Invalid on-change action %d.", spawn2_id, new_state?"enabled":"disabled", c.on_change); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn2 %d: Our condition is now %s. Invalid on-change action %d.", spawn2_id, new_state?"enabled":"disabled", c.on_change); return; //unknown onchange action } int signal_id = c.on_change - SpawnCondition::DoSignalMin; - _log(SPAWNS__CONDITIONS, "Spawn2 %d: Our condition is now %s. Signaling our mob with %d.", spawn2_id, new_state?"enabled":"disabled", signal_id); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn2 %d: Our condition is now %s. Signaling our mob with %d.", spawn2_id, new_state?"enabled":"disabled", signal_id); if(npcthis != nullptr) npcthis->SignalNPC(signal_id); } } void Zone::SpawnConditionChanged(const SpawnCondition &c, int16 old_value) { - _log(SPAWNS__CONDITIONS, "Zone notified that spawn condition %d has changed from %d to %d. Notifying all spawn points.", c.condition_id, old_value, c.value); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Zone notified that spawn condition %d has changed from %d to %d. Notifying all spawn points.", c.condition_id, old_value, c.value); LinkedListIterator iterator(spawn2_list); @@ -592,7 +592,7 @@ void SpawnConditionManager::Process() { EQTime::AddMinutes(cevent.period, &cevent.next); std::string t; EQTime::ToString(&cevent.next, t); - _log(SPAWNS__CONDITIONS, "Event %d: Will trigger again in %d EQ minutes at %s.", cevent.id, cevent.period, t.c_str()); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Event %d: Will trigger again in %d EQ minutes at %s.", cevent.id, cevent.period, t.c_str()); //save the next event time in the DB UpdateDBEvent(cevent); //find the next closest event timer. @@ -611,7 +611,7 @@ void SpawnConditionManager::ExecEvent(SpawnEvent &event, bool send_update) { std::map::iterator condi; condi = spawn_conditions.find(event.condition_id); if(condi == spawn_conditions.end()) { - _log(SPAWNS__CONDITIONS, "Event %d: Unable to find condition %d to execute on.", event.id, event.condition_id); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Event %d: Unable to find condition %d to execute on.", event.id, event.condition_id); return; //unable to find the spawn condition to operate on } @@ -619,7 +619,7 @@ void SpawnConditionManager::ExecEvent(SpawnEvent &event, bool send_update) { zone->zone_time.getEQTimeOfDay(&tod); if(event.strict && (event.next.hour != tod.hour || event.next.day != tod.day || event.next.month != tod.month || event.next.year != tod.year)) { - _log(SPAWNS__CONDITIONS, "Event %d: Unable to execute. Condition is strict, and event time has already passed.", event.id); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Event %d: Unable to execute. Condition is strict, and event time has already passed.", event.id); return; } @@ -631,26 +631,26 @@ void SpawnConditionManager::ExecEvent(SpawnEvent &event, bool send_update) { switch(event.action) { case SpawnEvent::ActionSet: new_value = event.argument; - _log(SPAWNS__CONDITIONS, "Event %d: Executing. Setting condition %d to %d.", event.id, event.condition_id, event.argument); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Event %d: Executing. Setting condition %d to %d.", event.id, event.condition_id, event.argument); break; case SpawnEvent::ActionAdd: new_value += event.argument; - _log(SPAWNS__CONDITIONS, "Event %d: Executing. Adding %d to condition %d, yeilding %d.", event.id, event.argument, event.condition_id, new_value); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Event %d: Executing. Adding %d to condition %d, yeilding %d.", event.id, event.argument, event.condition_id, new_value); break; case SpawnEvent::ActionSubtract: new_value -= event.argument; - _log(SPAWNS__CONDITIONS, "Event %d: Executing. Subtracting %d from condition %d, yeilding %d.", event.id, event.argument, event.condition_id, new_value); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Event %d: Executing. Subtracting %d from condition %d, yeilding %d.", event.id, event.argument, event.condition_id, new_value); break; case SpawnEvent::ActionMultiply: new_value *= event.argument; - _log(SPAWNS__CONDITIONS, "Event %d: Executing. Multiplying condition %d by %d, yeilding %d.", event.id, event.condition_id, event.argument, new_value); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Event %d: Executing. Multiplying condition %d by %d, yeilding %d.", event.id, event.condition_id, event.argument, new_value); break; case SpawnEvent::ActionDivide: new_value /= event.argument; - _log(SPAWNS__CONDITIONS, "Event %d: Executing. Dividing condition %d by %d, yeilding %d.", event.id, event.condition_id, event.argument, new_value); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Event %d: Executing. Dividing condition %d by %d, yeilding %d.", event.id, event.condition_id, event.argument, new_value); break; default: - _log(SPAWNS__CONDITIONS, "Event %d: Invalid event action type %d", event.id, event.action); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Event %d: Invalid event action type %d", event.id, event.action); return; } @@ -727,7 +727,7 @@ bool SpawnConditionManager::LoadDBEvent(uint32 event_id, SpawnEvent &event, std: std::string timeAsString; EQTime::ToString(&event.next, timeAsString); - _log(SPAWNS__CONDITIONS, "(LoadDBEvent) Loaded %s spawn event %d on condition %d with period %d, action %d, argument %d, strict %d. Will trigger at %s", event.enabled? "enabled": "disabled", event.id, event.condition_id, event.period, event.action, event.argument, event.strict, timeAsString.c_str()); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "(LoadDBEvent) Loaded %s spawn event %d on condition %d with period %d, action %d, argument %d, strict %d. Will trigger at %s", event.enabled? "enabled": "disabled", event.id, event.condition_id, event.period, event.action, event.argument, event.strict, timeAsString.c_str()); return true; } @@ -755,7 +755,7 @@ bool SpawnConditionManager::LoadSpawnConditions(const char* zone_name, uint32 in cond.on_change = (SpawnCondition::OnChange) atoi(row[1]); spawn_conditions[cond.condition_id] = cond; - _log(SPAWNS__CONDITIONS, "Loaded spawn condition %d with value %d and on_change %d", cond.condition_id, cond.value, cond.on_change); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Loaded spawn condition %d with value %d and on_change %d", cond.condition_id, cond.value, cond.on_change); } //load values @@ -811,7 +811,7 @@ bool SpawnConditionManager::LoadSpawnConditions(const char* zone_name, uint32 in spawn_events.push_back(event); - _log(SPAWNS__CONDITIONS, "(LoadSpawnConditions) Loaded %s spawn event %d on condition %d with period %d, action %d, argument %d, strict %d", event.enabled? "enabled": "disabled", event.id, event.condition_id, event.period, event.action, event.argument, event.strict); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "(LoadSpawnConditions) Loaded %s spawn event %d on condition %d with period %d, action %d, argument %d, strict %d", event.enabled? "enabled": "disabled", event.id, event.condition_id, event.period, event.action, event.argument, event.strict); } //now we need to catch up on events that happened while we were away @@ -846,7 +846,7 @@ bool SpawnConditionManager::LoadSpawnConditions(const char* zone_name, uint32 in //watch for special case of all 0s, which means to reset next to now if(cevent.next.year == 0 && cevent.next.month == 0 && cevent.next.day == 0 && cevent.next.hour == 0 && cevent.next.minute == 0) { - _log(SPAWNS__CONDITIONS, "Initial next trigger time set for spawn event %d", cevent.id); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Initial next trigger time set for spawn event %d", cevent.id); memcpy(&cevent.next, &tod, sizeof(cevent.next)); //add one period EQTime::AddMinutes(cevent.period, &cevent.next); @@ -857,7 +857,7 @@ bool SpawnConditionManager::LoadSpawnConditions(const char* zone_name, uint32 in bool ran = false; while(EQTime::IsTimeBefore(&tod, &cevent.next)) { - _log(SPAWNS__CONDITIONS, "Catch up triggering on event %d", cevent.id); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Catch up triggering on event %d", cevent.id); //this event has been triggered. //execute the event if(!cevent.strict || StrictCheck) @@ -900,9 +900,9 @@ void SpawnConditionManager::FindNearestEvent() { } } if(next_id == -1) - _log(SPAWNS__CONDITIONS, "No spawn events enabled. Disabling next event."); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "No spawn events enabled. Disabling next event."); else - _log(SPAWNS__CONDITIONS, "Next event determined to be event %d", next_id); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Next event determined to be event %d", next_id); } void SpawnConditionManager::SetCondition(const char *zone_short, uint32 instance_id, uint16 condition_id, int16 new_value, bool world_update) @@ -914,14 +914,14 @@ void SpawnConditionManager::SetCondition(const char *zone_short, uint32 instance std::map::iterator condi; condi = spawn_conditions.find(condition_id); if(condi == spawn_conditions.end()) { - _log(SPAWNS__CONDITIONS, "Condition update received from world for %d, but we do not have that conditon.", condition_id); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Condition update received from world for %d, but we do not have that conditon.", condition_id); return; //unable to find the spawn condition } SpawnCondition &cond = condi->second; if(cond.value == new_value) { - _log(SPAWNS__CONDITIONS, "Condition update received from world for %d with value %d, which is what we already have.", condition_id, new_value); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Condition update received from world for %d with value %d, which is what we already have.", condition_id, new_value); return; } @@ -930,7 +930,7 @@ void SpawnConditionManager::SetCondition(const char *zone_short, uint32 instance //set our local value cond.value = new_value; - _log(SPAWNS__CONDITIONS, "Condition update received from world for %d with value %d", condition_id, new_value); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Condition update received from world for %d with value %d", condition_id, new_value); //now we have to test each spawn point to see if it changed. zone->SpawnConditionChanged(cond, old_value); @@ -941,14 +941,14 @@ void SpawnConditionManager::SetCondition(const char *zone_short, uint32 instance std::map::iterator condi; condi = spawn_conditions.find(condition_id); if(condi == spawn_conditions.end()) { - _log(SPAWNS__CONDITIONS, "Local Condition update requested for %d, but we do not have that conditon.", condition_id); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Local Condition update requested for %d, but we do not have that conditon.", condition_id); return; //unable to find the spawn condition } SpawnCondition &cond = condi->second; if(cond.value == new_value) { - _log(SPAWNS__CONDITIONS, "Local Condition update requested for %d with value %d, which is what we already have.", condition_id, new_value); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Local Condition update requested for %d with value %d, which is what we already have.", condition_id, new_value); return; } @@ -959,7 +959,7 @@ void SpawnConditionManager::SetCondition(const char *zone_short, uint32 instance //save it in the DB too UpdateDBCondition(zone_short, instance_id, condition_id, new_value); - _log(SPAWNS__CONDITIONS, "Local Condition update requested for %d with value %d", condition_id, new_value); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Local Condition update requested for %d with value %d", condition_id, new_value); //now we have to test each spawn point to see if it changed. zone->SpawnConditionChanged(cond, old_value); @@ -969,7 +969,7 @@ void SpawnConditionManager::SetCondition(const char *zone_short, uint32 instance //this is a remote spawn condition, update the DB and send //an update packet to the zone if its up - _log(SPAWNS__CONDITIONS, "Remote spawn condition %d set to %d. Updating DB and notifying world.", condition_id, new_value); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Remote spawn condition %d set to %d. Updating DB and notifying world.", condition_id, new_value); UpdateDBCondition(zone_short, instance_id, condition_id, new_value); @@ -989,7 +989,7 @@ void SpawnConditionManager::SetCondition(const char *zone_short, uint32 instance void SpawnConditionManager::ReloadEvent(uint32 event_id) { std::string zone_short_name; - _log(SPAWNS__CONDITIONS, "Requested to reload event %d from the database.", event_id); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Requested to reload event %d from the database.", event_id); //first look for the event in our local event list std::vector::iterator cur,end; @@ -1002,7 +1002,7 @@ void SpawnConditionManager::ReloadEvent(uint32 event_id) { //load the event into the old event slot if(!LoadDBEvent(event_id, cevent, zone_short_name)) { //unable to find the event in the database... - _log(SPAWNS__CONDITIONS, "Failed to reload event %d from the database.", event_id); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Failed to reload event %d from the database.", event_id); return; } //sync up our nearest event @@ -1015,7 +1015,7 @@ void SpawnConditionManager::ReloadEvent(uint32 event_id) { SpawnEvent e; if(!LoadDBEvent(event_id, e, zone_short_name)) { //unable to find the event in the database... - _log(SPAWNS__CONDITIONS, "Failed to reload event %d from the database.", event_id); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Failed to reload event %d from the database.", event_id); return; } @@ -1032,7 +1032,7 @@ void SpawnConditionManager::ReloadEvent(uint32 event_id) { void SpawnConditionManager::ToggleEvent(uint32 event_id, bool enabled, bool strict, bool reset_base) { - _log(SPAWNS__CONDITIONS, "Request to %s spawn event %d %sresetting trigger time", enabled?"enable":"disable", event_id, reset_base?"":"without "); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Request to %s spawn event %d %sresetting trigger time", enabled?"enable":"disable", event_id, reset_base?"":"without "); //first look for the event in our local event list std::vector::iterator cur,end; @@ -1047,13 +1047,13 @@ void SpawnConditionManager::ToggleEvent(uint32 event_id, bool enabled, bool stri cevent.enabled = enabled; cevent.strict = strict; if(reset_base) { - _log(SPAWNS__CONDITIONS, "Spawn event %d located in this zone. State set. Trigger time reset (period %d).", event_id, cevent.period); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn event %d located in this zone. State set. Trigger time reset (period %d).", event_id, cevent.period); //start with the time now zone->zone_time.getEQTimeOfDay(&cevent.next); //advance the next time by our period EQTime::AddMinutes(cevent.period, &cevent.next); } else { - _log(SPAWNS__CONDITIONS, "Spawn event %d located in this zone. State changed.", event_id); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn event %d located in this zone. State changed.", event_id); } //save the event in the DB @@ -1062,7 +1062,7 @@ void SpawnConditionManager::ToggleEvent(uint32 event_id, bool enabled, bool stri //sync up our nearest event FindNearestEvent(); } else { - _log(SPAWNS__CONDITIONS, "Spawn event %d located in this zone but no change was needed.", event_id); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn event %d located in this zone but no change was needed.", event_id); } //even if we dont change anything, we still found it return; @@ -1081,24 +1081,24 @@ void SpawnConditionManager::ToggleEvent(uint32 event_id, bool enabled, bool stri SpawnEvent e; std::string zone_short_name; if(!LoadDBEvent(event_id, e, zone_short_name)) { - _log(SPAWNS__CONDITIONS, "Unable to find spawn event %d in the database.", event_id); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Unable to find spawn event %d in the database.", event_id); //unable to find the event in the database... return; } if(e.enabled == enabled && !reset_base) { - _log(SPAWNS__CONDITIONS, "Spawn event %d is not located in this zone but no change was needed.", event_id); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn event %d is not located in this zone but no change was needed.", event_id); return; //no changes. } e.enabled = enabled; if(reset_base) { - _log(SPAWNS__CONDITIONS, "Spawn event %d is in zone %s. State set. Trigger time reset (period %d). Notifying world.", event_id, zone_short_name.c_str(), e.period); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn event %d is in zone %s. State set. Trigger time reset (period %d). Notifying world.", event_id, zone_short_name.c_str(), e.period); //start with the time now zone->zone_time.getEQTimeOfDay(&e.next); //advance the next time by our period EQTime::AddMinutes(e.period, &e.next); } else { - _log(SPAWNS__CONDITIONS, "Spawn event %d is in zone %s. State changed. Notifying world.", event_id, zone_short_name.c_str(), e.period); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Spawn event %d is in zone %s. State changed. Notifying world.", event_id, zone_short_name.c_str(), e.period); } //save the event in the DB UpdateDBEvent(e); @@ -1123,7 +1123,7 @@ int16 SpawnConditionManager::GetCondition(const char *zone_short, uint32 instanc condi = spawn_conditions.find(condition_id); if(condi == spawn_conditions.end()) { - _log(SPAWNS__CONDITIONS, "Unable to find local condition %d in Get request.", condition_id); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Unable to find local condition %d in Get request.", condition_id); return(0); //unable to find the spawn condition } @@ -1138,12 +1138,12 @@ int16 SpawnConditionManager::GetCondition(const char *zone_short, uint32 instanc zone_short, instance_id, condition_id); auto results = database.QueryDatabase(query); if (!results.Success()) { - _log(SPAWNS__CONDITIONS, "Unable to query remote condition %d from zone %s in Get request.", condition_id, zone_short); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Unable to query remote condition %d from zone %s in Get request.", condition_id, zone_short); return 0; //dunno a better thing to do... } if (results.RowCount() == 0) { - _log(SPAWNS__CONDITIONS, "Unable to load remote condition %d from zone %s in Get request.", condition_id, zone_short); + logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::Spawns, "Unable to load remote condition %d from zone %s in Get request.", condition_id, zone_short); return 0; //dunno a better thing to do... }