chore(Script/Misc): cleanup (#19619)

* chore(Script/Misc): cleanup

* more cleanup

* cleanup
This commit is contained in:
Kitzunu
2024-08-14 21:29:50 +02:00
committed by GitHub
parent 030716421f
commit 7ff8f72397
21 changed files with 145 additions and 122 deletions

View File

@@ -37,7 +37,7 @@ bool Acore::PlayerCommand::HandleLearnSpellCommand(ChatHandler* handler, Player*
}
else
{
handler->SendErrorMessage(LANG_TARGET_KNOWN_SPELL, handler->GetNameLink(targetPlayer).c_str());
handler->SendErrorMessage(LANG_TARGET_KNOWN_SPELL, handler->GetNameLink(targetPlayer));
}
return false;

View File

@@ -164,7 +164,7 @@ public:
}
// new suggestion, or no token specified, output TOTP parameters
handler->SendErrorMessage(LANG_2FA_SECRET_SUGGESTION, Acore::Encoding::Base32::Encode(pair.first->second).c_str());
handler->SendErrorMessage(LANG_2FA_SECRET_SUGGESTION, Acore::Encoding::Base32::Encode(pair.first->second));
return false;
}
@@ -328,14 +328,14 @@ public:
std::string accountName = account;
if (!Utf8ToUpperOnlyLatin(accountName))
{
handler->SendErrorMessage(LANG_ACCOUNT_NOT_EXIST, accountName.c_str());
handler->SendErrorMessage(LANG_ACCOUNT_NOT_EXIST, accountName);
return false;
}
uint32 accountId = AccountMgr::GetId(accountName);
if (!accountId)
{
handler->SendErrorMessage(LANG_ACCOUNT_NOT_EXIST, accountName.c_str());
handler->SendErrorMessage(LANG_ACCOUNT_NOT_EXIST, accountName);
return false;
}
@@ -352,13 +352,13 @@ public:
handler->PSendSysMessage(LANG_ACCOUNT_DELETED, accountName);
break;
case AOR_NAME_NOT_EXIST:
handler->SendErrorMessage(LANG_ACCOUNT_NOT_EXIST, accountName.c_str());
handler->SendErrorMessage(LANG_ACCOUNT_NOT_EXIST, accountName);
return false;
case AOR_DB_INTERNAL_ERROR:
handler->SendErrorMessage(LANG_ACCOUNT_NOT_DELETED_SQL_ERROR, accountName.c_str());
handler->SendErrorMessage(LANG_ACCOUNT_NOT_DELETED_SQL_ERROR, accountName);
return false;
default:
handler->SendErrorMessage(LANG_ACCOUNT_NOT_DELETED, accountName.c_str());
handler->SendErrorMessage(LANG_ACCOUNT_NOT_DELETED, accountName);
return false;
}

View File

@@ -148,7 +148,7 @@ public:
str << " items from your bags.";
handler->SendSysMessage(str.str().c_str());
handler->SendSysMessage(str.str());
return true;
};

View File

@@ -444,7 +444,7 @@ public:
if (banResult)
{
Field* fields2 = banResult->Fetch();
handler->PSendSysMessage("%s", fields2[0].Get<std::string>());
handler->PSendSysMessage("{}", fields2[0].Get<std::string>());
}
} while (result->NextRow());
}
@@ -480,14 +480,14 @@ public:
if (fields2[0].Get<uint32>() == fields2[1].Get<uint32>())
{
handler->PSendSysMessage("|%-15.15s|%02d-%02d-%02d %02d:%02d| permanent |%-15.15s|%-15.15s|",
handler->PSendSysMessage("|%-15.15s|{:02}-{:02}-{:02} {:02}:{:02}| permanent |%-15.15s|%-15.15s|",
accountName, tmBan.tm_year % 100, tmBan.tm_mon + 1, tmBan.tm_mday, tmBan.tm_hour, tmBan.tm_min,
fields2[2].Get<std::string>(), fields2[3].Get<std::string>());
}
else
{
tm tmUnban = Acore::Time::TimeBreakdown(fields2[1].Get<uint32>());
handler->PSendSysMessage("|%-15.15s|%02d-%02d-%02d %02d:%02d|%02d-%02d-%02d %02d:%02d|%-15.15s|%-15.15s|",
handler->PSendSysMessage("|%-15.15s|{:02}-{:02}-{:02} {:02}:{:02}|{:02}-{:02}-{:02} {:02}:{:02}|%-15.15s|%-15.15s|",
accountName, tmBan.tm_year % 100, tmBan.tm_mon + 1, tmBan.tm_mday, tmBan.tm_hour, tmBan.tm_min,
tmUnban.tm_year % 100, tmUnban.tm_mon + 1, tmUnban.tm_mday, tmUnban.tm_hour, tmUnban.tm_min,
fields2[2].Get<std::string>(), fields2[3].Get<std::string>());
@@ -534,7 +534,7 @@ public:
PreparedQueryResult banResult = CharacterDatabase.Query(stmt2);
if (banResult)
handler->PSendSysMessage("%s", (*banResult)[0].Get<std::string>());
handler->PSendSysMessage("{}", (*banResult)[0].Get<std::string>());
} while (result->NextRow());
}
// Console wide output
@@ -564,14 +564,14 @@ public:
if (banFields[0].Get<uint32>() == banFields[1].Get<uint32>())
{
handler->PSendSysMessage("|%-15.15s|%02d-%02d-%02d %02d:%02d| permanent |%-15.15s|%-15.15s|",
handler->PSendSysMessage("|%-15.15s|{:02}-{:02}-{:02} {:02}:{:02}| permanent |%-15.15s|%-15.15s|",
char_name, tmBan.tm_year % 100, tmBan.tm_mon + 1, tmBan.tm_mday, tmBan.tm_hour, tmBan.tm_min,
banFields[2].Get<std::string>(), banFields[3].Get<std::string>());
}
else
{
tm tmUnban = Acore::Time::TimeBreakdown(banFields[1].Get<uint32>());
handler->PSendSysMessage("|%-15.15s|%02d-%02d-%02d %02d:%02d|%02d-%02d-%02d %02d:%02d|%-15.15s|%-15.15s|",
handler->PSendSysMessage("|%-15.15s|{:02}-{:02}-{:02} {:02}:{:02}|{:02}-{:02}-{:02} {:02}:{:02}|%-15.15s|%-15.15s|",
char_name, tmBan.tm_year % 100, tmBan.tm_mon + 1, tmBan.tm_mday, tmBan.tm_hour, tmBan.tm_min,
tmUnban.tm_year % 100, tmUnban.tm_mon + 1, tmUnban.tm_mday, tmUnban.tm_hour, tmUnban.tm_min,
banFields[2].Get<std::string>(), banFields[3].Get<std::string>());
@@ -621,7 +621,7 @@ public:
do
{
Field* fields = result->Fetch();
handler->PSendSysMessage("%s", fields[0].Get<std::string>());
handler->PSendSysMessage("{}", fields[0].Get<std::string>());
} while (result->NextRow());
}
// Console wide output
@@ -637,14 +637,14 @@ public:
tm tmBan = Acore::Time::TimeBreakdown(fields[1].Get<uint32>());
if (fields[1].Get<uint32>() == fields[2].Get<uint32>())
{
handler->PSendSysMessage("|%-15.15s|%02d-%02d-%02d %02d:%02d| permanent |%-15.15s|%-15.15s|",
handler->PSendSysMessage("|%-15.15s|{:02}-{:02}-{:02} {:02}:{:02}| permanent |%-15.15s|%-15.15s|",
fields[0].Get<std::string>(), tmBan.tm_year % 100, tmBan.tm_mon + 1, tmBan.tm_mday, tmBan.tm_hour, tmBan.tm_min,
fields[3].Get<std::string>(), fields[4].Get<std::string>());
}
else
{
tm tmUnban = Acore::Time::TimeBreakdown(fields[2].Get<uint32>());
handler->PSendSysMessage("|%-15.15s|%02d-%02d-%02d %02d:%02d|%02d-%02d-%02d %02d:%02d|%-15.15s|%-15.15s|",
handler->PSendSysMessage("|%-15.15s|{:02}-{:02}-{:02} {:02}:{:02}|{:02}-{:02}-{:02} {:02}:{:02}|%-15.15s|%-15.15s|",
fields[0].Get<std::string>(), tmBan.tm_year % 100, tmBan.tm_mon + 1, tmBan.tm_mday, tmBan.tm_hour, tmBan.tm_min,
tmUnban.tm_year % 100, tmUnban.tm_mon + 1, tmUnban.tm_mday, tmUnban.tm_hour, tmUnban.tm_min,
fields[3].Get<std::string>(), fields[4].Get<std::string>());

View File

@@ -570,7 +570,7 @@ public:
if (faction.Flags & FACTION_FLAG_INACTIVE)
ss << handler->GetAcoreString(LANG_FACTION_INACTIVE);
handler->SendSysMessage(ss.str().c_str());
handler->SendSysMessage(ss.str());
}
return true;

View File

@@ -535,7 +535,7 @@ public:
if (!listQueue && !checkAll)
{
itemState = "The player has the following " + itemState + " items: ";
handler->SendSysMessage(itemState.c_str());
handler->SendSysMessage(itemState);
for (uint8 i = PLAYER_SLOT_START; i < PLAYER_SLOT_END; ++i)
{
if (i >= BUYBACK_SLOT_START && i < BUYBACK_SLOT_END)
@@ -941,7 +941,7 @@ public:
while (ss.str().size() < 128000)
ss << "This is a dummy string to push the packet's size beyond 128000 bytes. ";
handler->SendSysMessage(ss.str().c_str());
handler->SendSysMessage(ss.str());
return true;
}

View File

@@ -173,7 +173,7 @@ public:
str << ".";
handler->SendSysMessage(str.str().c_str());
handler->SendSysMessage(str.str());
return true;
}

View File

@@ -153,7 +153,7 @@ public:
ss << areaEntry->ID << " - " << name << ' ' << localeNames[locale];
}
handler->SendSysMessage(ss.str().c_str());
handler->SendSysMessage(ss.str());
if (!found)
{
@@ -455,7 +455,7 @@ public:
ss << handler->GetAcoreString(LANG_FACTION_NOREPUTATION);
}
handler->SendSysMessage(ss.str().c_str());
handler->SendSysMessage(ss.str());
if (!found)
{
@@ -1147,7 +1147,7 @@ public:
ss << handler->GetAcoreString(LANG_ACTIVE);
}
handler->SendSysMessage(ss.str().c_str());
handler->SendSysMessage(ss.str());
if (!found)
{
@@ -1262,7 +1262,7 @@ public:
ss << handler->GetAcoreString(LANG_ACTIVE);
}
handler->SendSysMessage(ss.str().c_str());
handler->SendSysMessage(ss.str());
if (!found)
{
@@ -1587,7 +1587,7 @@ public:
break;
}
handler->SendSysMessage(ss.str().c_str());
handler->SendSysMessage(ss.str());
++counter;
}

View File

@@ -170,12 +170,12 @@ public:
if (Player* player = ObjectAccessor::FindPlayerByName(*playerNameArg))
{
handler->GetSession()->GetPlayer()->RemoveFromWhisperWhiteList(player->GetGUID());
handler->PSendSysMessage(LANG_COMMAND_WHISPEROFFPLAYER, playerNameArg->c_str());
handler->PSendSysMessage(LANG_COMMAND_WHISPEROFFPLAYER, playerNameArg);
return true;
}
else
{
handler->SendErrorMessage(LANG_PLAYER_NOT_FOUND, playerNameArg->c_str());
handler->SendErrorMessage(LANG_PLAYER_NOT_FOUND, playerNameArg);
return false;
}
}

View File

@@ -627,7 +627,7 @@ public:
if (object->GetTransport())
{
handler->PSendSysMessage("Transport offset: %.2f, %.2f, %.2f, %.2f", object->m_movementInfo.transport.pos.GetPositionX(), object->m_movementInfo.transport.pos.GetPositionY(), object->m_movementInfo.transport.pos.GetPositionZ(), object->m_movementInfo.transport.pos.GetOrientation());
handler->PSendSysMessage("Transport offset: {0:.2f}, {0:.2f}, {0:.2f}, {0:.2f}", object->m_movementInfo.transport.pos.GetPositionX(), object->m_movementInfo.transport.pos.GetPositionY(), object->m_movementInfo.transport.pos.GetPositionZ(), object->m_movementInfo.transport.pos.GetOrientation());
}
return true;

View File

@@ -217,7 +217,7 @@ public:
static bool HandleMmapStatsCommand(ChatHandler* handler)
{
handler->PSendSysMessage("mmap stats:");
//handler->PSendSysMessage(" global mmap pathfinding is %sabled", DisableMgr::IsPathfindingEnabled(mapId) ? "en" : "dis");
//handler->PSendSysMessage(" global mmap pathfinding is {}abled", DisableMgr::IsPathfindingEnabled(mapId) ? "en" : "dis");
MMAP::MMapMgr* manager = MMAP::MMapFactory::createOrGetMMapMgr();
handler->PSendSysMessage(" {} maps loaded with {} tiles overall", manager->getLoadedMapsCount(), manager->getLoadedTilesCount());

View File

@@ -409,7 +409,7 @@ public:
if (player->IsInFlight() && checkInFlight)
{
handler->SendErrorMessage(LANG_CHAR_IN_FLIGHT, handler->GetNameLink(player).c_str());
handler->SendErrorMessage(LANG_CHAR_IN_FLIGHT, handler->GetNameLink(player));
return false;
}
}
@@ -799,7 +799,7 @@ public:
if (r >= MAX_REPUTATION_RANK)
{
handler->SendErrorMessage(LANG_COMMAND_FACTION_INVPARAM, rankStr.c_str());
handler->SendErrorMessage(LANG_COMMAND_FACTION_INVPARAM, rankStr);
return false;
}
}

View File

@@ -796,7 +796,7 @@ public:
if (!sCreatureDisplayInfoStore.LookupEntry(displayId))
{
handler->SendErrorMessage(LANG_COMMAND_FACTION_INVPARAM, Acore::ToString(displayId).c_str());
handler->SendErrorMessage(LANG_COMMAND_FACTION_INVPARAM, Acore::ToString(displayId));
return false;
}
@@ -1086,7 +1086,7 @@ public:
if (/*creature->GetMotionMaster()->empty() ||*/
creature->GetMotionMaster()->GetCurrentMovementGeneratorType() != FOLLOW_MOTION_TYPE)
{
handler->SendErrorMessage(LANG_CREATURE_NOT_FOLLOW_YOU, creature->GetName().c_str());
handler->SendErrorMessage(LANG_CREATURE_NOT_FOLLOW_YOU, creature->GetName());
return false;
}
@@ -1094,7 +1094,7 @@ public:
if (mgen->GetTarget() != player)
{
handler->SendErrorMessage(LANG_CREATURE_NOT_FOLLOW_YOU, creature->GetName().c_str());
handler->SendErrorMessage(LANG_CREATURE_NOT_FOLLOW_YOU, creature->GetName());
return false;
}
@@ -1259,7 +1259,7 @@ public:
if (!sObjectMgr->SetCreatureLinkedRespawn(creature->GetSpawnId(), linkguid))
{
handler->SendErrorMessage("Selected creature can't link with guid '%u'", linkguid);
handler->SendErrorMessage("Selected creature can't link with guid '{}'", linkguid);
return false;
}

View File

@@ -81,7 +81,7 @@ public:
{
if (player->IsActiveQuest(entry))
{
handler->SendErrorMessage(LANG_COMMAND_QUEST_ACTIVE, quest->GetTitle().c_str(), entry);
handler->SendErrorMessage(LANG_COMMAND_QUEST_ACTIVE, quest->GetTitle(), entry);
return false;
}
@@ -98,7 +98,7 @@ public:
if (result)
{
handler->SendErrorMessage(LANG_COMMAND_QUEST_ACTIVE, quest->GetTitle().c_str(), entry);
handler->SendErrorMessage(LANG_COMMAND_QUEST_ACTIVE, quest->GetTitle(), entry);
return false;
}

View File

@@ -130,7 +130,7 @@ public:
if (target->IsBeingTeleported())
{
handler->SendErrorMessage(LANG_IS_TELEPORTED, chrNameLink.c_str());
handler->SendErrorMessage(LANG_IS_TELEPORTED, chrNameLink);
return false;
}
@@ -233,7 +233,7 @@ public:
Group* grp = target->GetGroup();
if (!grp)
{
handler->SendErrorMessage(LANG_NOT_IN_GROUP, nameLink.c_str());
handler->SendErrorMessage(LANG_NOT_IN_GROUP, nameLink);
return false;
}
@@ -256,7 +256,7 @@ public:
continue;
}
handler->PSendSysMessage(LANG_TELEPORTING_TO, plNameLink.c_str(), "", tele->name);
handler->PSendSysMessage(LANG_TELEPORTING_TO, plNameLink, "", tele->name);
if (handler->needReportToTarget(player))
ChatHandler(player->GetSession()).PSendSysMessage(LANG_TELEPORTED_TO_BY, nameLink);