mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-22 18:15:31 +01:00
Revive all command (#26127)
* First version of command handler * Done HandleReviveAllCommand * Moved command to group subcommonads * removed empty row * nullptr check for player target
This commit is contained in:
@@ -57,6 +57,7 @@ public:
|
||||
{ "join", rbac::RBAC_PERM_COMMAND_GROUP_JOIN, false, &HandleGroupJoinCommand, "" },
|
||||
{ "list", rbac::RBAC_PERM_COMMAND_GROUP_LIST, false, &HandleGroupListCommand, "" },
|
||||
{ "summon", rbac::RBAC_PERM_COMMAND_GROUP_SUMMON, false, &HandleGroupSummonCommand, "" },
|
||||
{ "revive", rbac::RBAC_PERM_COMMAND_REVIVE, true, &HandleGroupReviveCommand, "" }
|
||||
};
|
||||
|
||||
static std::vector<ChatCommand> commandTable =
|
||||
@@ -66,6 +67,31 @@ public:
|
||||
return commandTable;
|
||||
}
|
||||
|
||||
static bool HandleGroupReviveCommand(ChatHandler* handler, char const* args)
|
||||
{
|
||||
Player* playerTarget;
|
||||
ObjectGuid playerTargetGuid;
|
||||
if (!handler->extractPlayerTarget((char*)args, &playerTarget, &playerTargetGuid))
|
||||
return false;
|
||||
|
||||
Group* groupTarget = playerTarget->GetGroup();
|
||||
if (!groupTarget)
|
||||
return false;
|
||||
|
||||
for (GroupReference* it = groupTarget->GetFirstMember(); it != nullptr; it = it->next())
|
||||
{
|
||||
Player* target = it->GetSource();
|
||||
if (target)
|
||||
{
|
||||
target->ResurrectPlayer(target->GetSession()->HasPermission(rbac::RBAC_PERM_RESURRECT_WITH_FULL_HPS) ? 1.0f : 0.5f);
|
||||
target->SpawnCorpseBones();
|
||||
target->SaveToDB();
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// Summon group of player
|
||||
static bool HandleGroupSummonCommand(ChatHandler* handler, char const* args)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user