chore(core): Cleanup code p2 (#16041)

* Update AchievementMgr.cpp

* Update M2Stores.cpp

* Update LFGHandler.cpp

* Update PetHandler.cpp

* Update WaypointMovementGenerator.cpp

* Update ScriptMgr.cpp

* Update SpellAuras.cpp

* Update Spell.cpp

* Update SecretMgr.cpp

* Update SpellScript.cpp

* Update SecretMgr.cpp

* Update Spell.cpp

* Update SpellAuras.cpp

* Add files via upload

* Update PetHandler.cpp

* Update PetHandler.cpp

* Update CalendarMgr.cpp

* Update LFG.h

* Update WaypointMovementGenerator.cpp

* Update MapScripts.cpp

* Update Unit.cpp

* Update SmartScript.cpp
This commit is contained in:
天鹿
2023-05-14 02:00:29 +08:00
committed by GitHub
parent 5c5c28c715
commit ab7c12fe41
11 changed files with 27 additions and 27 deletions

View File

@@ -640,12 +640,12 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
me->CastSpell(target->ToUnit(), e.action.cast.spell, triggerFlags);
LOG_DEBUG("scripts.ai", "SmartScript::ProcessAction:: SMART_ACTION_CAST: Unit {} casts spell {} on target {} with castflags {}",
me->GetGUID().ToString().c_str(), e.action.cast.spell, target->GetGUID().ToString().c_str(), e.action.cast.castFlags);
me->GetGUID().ToString(), e.action.cast.spell, target->GetGUID().ToString(), e.action.cast.castFlags);
}
else
{
LOG_DEBUG("scripts.ai", "Spell {} not cast because it has flag SMARTCAST_AURA_NOT_PRESENT and the target {} already has the aura",
e.action.cast.spell, target->GetGUID().ToString().c_str());
e.action.cast.spell, target->GetGUID().ToString());
}
}
break;
@@ -729,12 +729,12 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
tempLastInvoker->CastSpell(target->ToUnit(), e.action.cast.spell, triggerFlags);
LOG_DEBUG("scripts.ai", "SmartScript::ProcessAction:: SMART_ACTION_INVOKER_CAST: Invoker {} casts spell {} on target {} with castflags {}",
tempLastInvoker->GetGUID().ToString().c_str(), e.action.cast.spell, target->GetGUID().ToString().c_str(), e.action.cast.castFlags);
tempLastInvoker->GetGUID().ToString(), e.action.cast.spell, target->GetGUID().ToString(), e.action.cast.castFlags);
}
else
{
LOG_DEBUG("scripts.ai", "Spell {} not cast because it has flag SMARTCAST_AURA_NOT_PRESENT and the target {} already has the aura",
e.action.cast.spell, target->GetGUID().ToString().c_str());
e.action.cast.spell, target->GetGUID().ToString());
}
}
break;

View File

@@ -2683,7 +2683,7 @@ void AchievementGlobalMgr::LoadAchievementCriteriaData()
if (dataType != ACHIEVEMENT_CRITERIA_DATA_TYPE_SCRIPT)
LOG_ERROR("sql.sql", "Table `achievement_criteria_data` has ScriptName set for non-scripted data type (Entry: {}, type {}), useless data.", criteria_id, dataType);
else
scriptId = sObjectMgr->GetScriptId(scriptName.c_str());
scriptId = sObjectMgr->GetScriptId(scriptName);
}
AchievementCriteriaData data(dataType, fields[2].Get<uint32>(), fields[3].Get<uint32>(), scriptId);

View File

@@ -459,7 +459,7 @@ uint32 CalendarMgr::GetPlayerNumPending(ObjectGuid guid)
std::string CalendarEvent::BuildCalendarMailSubject(ObjectGuid remover) const
{
std::ostringstream strm;
strm << remover.ToString().c_str() << ':' << _title;
strm << remover.ToString() << ':' << _title;
return strm.str();
}

View File

@@ -206,7 +206,7 @@ void LoadM2Cameras(std::string const& dataPath)
// Reject if not at least the size of the header
if (static_cast<uint32>(fileSize) < sizeof(M2Header))
{
LOG_ERROR("server.loading", "Camera file {} is damaged. File is smaller than header size", filename.string().c_str());
LOG_ERROR("server.loading", "Camera file {} is damaged. File is smaller than header size", filename.string());
m2file.close();
continue;
}
@@ -220,7 +220,7 @@ void LoadM2Cameras(std::string const& dataPath)
// Check file has correct magic (MD20)
if (strcmp(fileCheck, "MD20"))
{
LOG_ERROR("server.loading", "Camera file {} is damaged. File identifier not found", filename.string().c_str());
LOG_ERROR("server.loading", "Camera file {} is damaged. File identifier not found", filename.string());
m2file.close();
continue;
}
@@ -240,14 +240,14 @@ void LoadM2Cameras(std::string const& dataPath)
if (header->ofsCameras + sizeof(M2Camera) > static_cast<uint32>(fileSize))
{
LOG_ERROR("server.loading", "Camera file {} is damaged. Camera references position beyond file end", filename.string().c_str());
LOG_ERROR("server.loading", "Camera file {} is damaged. Camera references position beyond file end", filename.string());
continue;
}
// Get camera(s) - Main header, then dump them.
M2Camera const* cam = reinterpret_cast<M2Camera const*>(buffer.data() + header->ofsCameras);
if (!readCamera(cam, fileSize, header, dbcentry))
LOG_ERROR("server.loading", "Camera file {} is damaged. Camera references position beyond file end", filename.string().c_str());
LOG_ERROR("server.loading", "Camera file {} is damaged. Camera references position beyond file end", filename.string());
}
LOG_INFO("server.loading", ">> Loaded {} Cinematic Waypoint Sets in {} ms", (uint32)sFlyByCameraStore.size(), GetMSTimeDiffToNow(oldMSTime));

View File

@@ -484,7 +484,7 @@ namespace lfg
[[nodiscard]] std::string toString() const // for debugging
{
std::ostringstream o;
o << guids[0].ToString().c_str() << "," << guids[1].ToString().c_str() << "," << guids[2].ToString().c_str() << "," << guids[3].ToString().c_str() << "," << guids[4].ToString().c_str() << ":" << (roles ? 1 : 0);
o << guids[0].ToString() << "," << guids[1].ToString() << "," << guids[2].ToString() << "," << guids[3].ToString() << "," << guids[4].ToString() << ":" << (roles ? 1 : 0);
return o.str();
}
};

View File

@@ -10369,7 +10369,7 @@ bool Unit::Attack(Unit* victim, bool meleeAttack)
creature->SendAIReaction(AI_REACTION_HOSTILE);
/// @todo: Implement aggro range, detection range and assistance range templates
if (!(creature->ToCreature()->GetCreatureTemplate()->flags_extra & CREATURE_FLAG_EXTRA_DONT_CALL_ASSISTANCE))
if (!(creature->GetCreatureTemplate()->flags_extra & CREATURE_FLAG_EXTRA_DONT_CALL_ASSISTANCE))
{
creature->CallAssistance();
}

View File

@@ -55,7 +55,7 @@ void WorldSession::HandleLfgJoinOpcode(WorldPackets::LFG::LFGJoin& packet)
if (packet.Slots.empty())
{
LOG_DEBUG("lfg", "CMSG_LFG_JOIN {} no dungeons selected", GetPlayerInfo().c_str());
LOG_DEBUG("lfg", "CMSG_LFG_JOIN {} no dungeons selected", GetPlayerInfo());
return;
}

View File

@@ -953,21 +953,21 @@ void WorldSession::HandlePetSpellAutocastOpcode(WorldPackets::Pet::PetSpellAutoc
Creature* checkPet = ObjectAccessor::GetCreatureOrPetOrVehicle(*_player, packet.PetGUID);
if (!checkPet)
{
LOG_ERROR("entities.pet", "WorldSession::HandlePetSpellAutocastOpcode: Pet {} not found.", packet.PetGUID.ToString().c_str());
LOG_ERROR("entities.pet", "WorldSession::HandlePetSpellAutocastOpcode: Pet {} not found.", packet.PetGUID.ToString());
return;
}
SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(packet.SpellID);
if (!spellInfo)
{
LOG_ERROR("spells.pet", "WorldSession::HandlePetSpellAutocastOpcode: Unknown spell id {} used by {}.", packet.SpellID, packet.PetGUID.ToString().c_str());
LOG_ERROR("spells.pet", "WorldSession::HandlePetSpellAutocastOpcode: Unknown spell id {} used by {}.", packet.SpellID, packet.PetGUID.ToString());
return;
}
if (checkPet != _player->GetGuardianPet() && checkPet != _player->GetCharm())
{
LOG_ERROR("entities.pet", "WorldSession::HandlePetSpellAutocastOpcode: {} isn't pet of player {} ({}).",
packet.PetGUID.ToString().c_str(), GetPlayer()->GetName().c_str(), GetPlayer()->GetGUID().ToString().c_str());
packet.PetGUID.ToString(), GetPlayer()->GetName(), GetPlayer()->GetGUID().ToString());
return;
}

View File

@@ -375,7 +375,7 @@ void FlightPathMovementGenerator::DoReset(Player* player)
if (currentNodeId == end)
{
LOG_DEBUG("movement.flightpath", "FlightPathMovementGenerator::DoReset: trying to start a flypath from the end point. {}", player->GetGUID().ToString().c_str());
LOG_DEBUG("movement.flightpath", "FlightPathMovementGenerator::DoReset: trying to start a flypath from the end point. {}", player->GetGUID().ToString());
return;
}
@@ -406,7 +406,7 @@ bool FlightPathMovementGenerator::DoUpdate(Player* player, uint32 /*diff*/)
bool departureEvent = true;
do
{
ASSERT(i_currentNode < i_path.size(), "Point Id: {}\n{}", pointId, player->GetGUID().ToString().c_str());
ASSERT(i_currentNode < i_path.size(), "Point Id: {}\n{}", pointId, player->GetGUID().ToString());
DoEventIfAny(player, i_path[i_currentNode], departureEvent);
while (!_pointsForPathSwitch.empty() && _pointsForPathSwitch.front().PathIndex <= i_currentNode)
@@ -460,7 +460,7 @@ void FlightPathMovementGenerator::DoEventIfAny(Player* player, TaxiPathNodeEntry
{
if (uint32 eventid = departure ? node->departureEventID : node->arrivalEventID)
{
LOG_DEBUG("maps.script", "Taxi {} event {} of node {} of path {} for player {}", departure ? "departure" : "arrival", eventid, node->index, node->path, player->GetName().c_str());
LOG_DEBUG("maps.script", "Taxi {} event {} of node {} of path {} for player {}", departure ? "departure" : "arrival", eventid, node->index, node->path, player->GetName());
player->GetMap()->ScriptsStart(sEventScripts, eventid, player, player);
}
}

View File

@@ -113,9 +113,9 @@ inline Player* Map::_GetScriptPlayerSourceOrTarget(Object* source, Object* targe
if (!player)
LOG_ERROR("maps.script", "{} neither source nor target object is player (source: TypeId: {}, Entry: {}, GUID: {}; target: TypeId: {}, Entry: {}, GUID: {}), skipping.",
scriptInfo->GetDebugInfo().c_str(),
source ? source->GetTypeId() : 0, source ? source->GetEntry() : 0, source ? source->GetGUID().ToString().c_str() : "",
target ? target->GetTypeId() : 0, target ? target->GetEntry() : 0, target ? target->GetGUID().ToString().c_str() : "");
scriptInfo->GetDebugInfo(),
source ? source->GetTypeId() : 0, source ? source->GetEntry() : 0, source ? source->GetGUID().ToString() : "",
target ? target->GetTypeId() : 0, target ? target->GetEntry() : 0, target ? target->GetGUID().ToString() : "");
}
return player;
}
@@ -146,9 +146,9 @@ inline Creature* Map::_GetScriptCreatureSourceOrTarget(Object* source, Object* t
if (!creature)
LOG_ERROR("maps.script", "{} neither source nor target are creatures (source: TypeId: {}, Entry: {}, GUID: {}; target: TypeId: {}, Entry: {}, GUID: {}), skipping.",
scriptInfo->GetDebugInfo().c_str(),
source ? source->GetTypeId() : 0, source ? source->GetEntry() : 0, source ? source->GetGUID().ToString().c_str() : "",
target ? target->GetTypeId() : 0, target ? target->GetEntry() : 0, target ? target->GetGUID().ToString().c_str() : "");
scriptInfo->GetDebugInfo(),
source ? source->GetTypeId() : 0, source ? source->GetEntry() : 0, source ? source->GetGUID().ToString() : "",
target ? target->GetTypeId() : 0, target ? target->GetEntry() : 0, target ? target->GetGUID().ToString() : "");
}
return creature;
}
@@ -533,7 +533,7 @@ void Map::ScriptsProcess()
else
{
LOG_ERROR("maps.script", "{} neither source nor target is player (source: {}; target: {}), skipping.",
step.script->GetDebugInfo().c_str(), source->GetGUID().ToString().c_str(), target->GetGUID().ToString().c_str());
step.script->GetDebugInfo(), source->GetGUID().ToString(), target->GetGUID().ToString());
break;
}
}

View File

@@ -159,7 +159,7 @@ void ScriptMgr::CheckIfScriptsInDatabaseExist()
{
for (auto const& scriptName : sObjectMgr->GetScriptNames())
{
if (uint32 sid = sObjectMgr->GetScriptId(scriptName.c_str()))
if (uint32 sid = sObjectMgr->GetScriptId(scriptName))
{
if (!ScriptRegistry<SpellScriptLoader>::GetScriptById(sid) &&
!ScriptRegistry<ServerScript>::GetScriptById(sid) &&