mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-15 18:10:26 +00:00
fix(Core/Commands): Achievement checkall (#12649)
This commit is contained in:
@@ -40,7 +40,7 @@ public:
|
||||
static ChatCommandTable achievementCommandTable =
|
||||
{
|
||||
{ "add", HandleAchievementAddCommand, SEC_GAMEMASTER, Console::No },
|
||||
{ "checkall", HandleAchievementCheckAllCommand, SEC_ADMINISTRATOR, Console::No }
|
||||
{ "checkall", HandleAchievementCheckAllCommand, SEC_ADMINISTRATOR, Console::Yes }
|
||||
};
|
||||
static ChatCommandTable commandTable =
|
||||
{
|
||||
@@ -63,17 +63,33 @@ public:
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool HandleAchievementCheckAllCommand(ChatHandler* handler)
|
||||
static bool HandleAchievementCheckAllCommand(ChatHandler* handler, Optional<PlayerIdentifier> player)
|
||||
{
|
||||
Player* target = handler->getSelectedPlayer();
|
||||
if (!target)
|
||||
if (!player)
|
||||
{
|
||||
handler->SendSysMessage(LANG_NO_CHAR_SELECTED);
|
||||
player = PlayerIdentifier::FromTarget(handler);
|
||||
}
|
||||
|
||||
if (!player)
|
||||
{
|
||||
handler->SendSysMessage(LANG_PLAYER_NOT_FOUND);
|
||||
handler->SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
|
||||
target->CheckAllAchievementCriteria();
|
||||
if (player->IsConnected())
|
||||
{
|
||||
if (Player* target = player->GetConnectedPlayer())
|
||||
target->CheckAllAchievementCriteria();
|
||||
}
|
||||
else
|
||||
{
|
||||
auto* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_ADD_AT_LOGIN_FLAG);
|
||||
stmt->SetData(0, uint16(AT_LOGIN_CHECK_ACHIEVS));
|
||||
stmt->SetData(1, player->GetGUID().GetCounter());
|
||||
CharacterDatabase.Execute(stmt);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user