fix(Core/Commands): Achievement checkall (#12649)
This commit is contained in:
parent
5734630e7e
commit
031dfc4c5b
1 changed files with 22 additions and 6 deletions
|
|
@ -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;
|
||||
}
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue