feat(Scripts/Commands): Implement opendoor command (#21136)

This commit is contained in:
Andrew
2025-01-10 20:48:58 -03:00
committed by GitHub
parent 8b21b6150f
commit 07937d34da
3 changed files with 28 additions and 2 deletions

View File

@@ -146,7 +146,8 @@ public:
{ "playall", HandlePlayAllCommand, SEC_GAMEMASTER, Console::No },
{ "skirmish", HandleSkirmishCommand, SEC_ADMINISTRATOR, Console::No },
{ "mailbox", HandleMailBoxCommand, SEC_MODERATOR, Console::No },
{ "string", HandleStringCommand, SEC_GAMEMASTER, Console::No }
{ "string", HandleStringCommand, SEC_GAMEMASTER, Console::No },
{ "opendoor", HandleOpenDoorCommand, SEC_GAMEMASTER, Console::No }
};
return commandTable;
@@ -3034,6 +3035,19 @@ public:
return true;
}
}
static bool HandleOpenDoorCommand(ChatHandler* handler, Optional<float> range)
{
if (GameObject* go = handler->GetPlayer()->FindNearestGameObjectOfType(GAMEOBJECT_TYPE_DOOR, range ? *range : 5.0f))
{
go->SetGoState(GO_STATE_ACTIVE);
handler->PSendSysMessage(LANG_CMD_DOOR_OPENED, go->GetName(), go->GetEntry());
return true;
}
handler->SendErrorMessage(LANG_CMD_NO_DOOR_FOUND, range ? *range : 5.0f);
return false;
}
};
void AddSC_misc_commandscript()