aboutsummaryrefslogtreecommitdiff
path: root/src/server/scripts/Commands
diff options
context:
space:
mode:
authorPeter Keresztes Schmidt <carbenium@outlook.com>2020-09-10 01:05:44 +0200
committerGitHub <noreply@github.com>2020-09-10 01:05:44 +0200
commit062c55f1ab9c84396ce5b054945f5a908e3a354f (patch)
treea24c56c23d56b0a538904296d51923268d387cd2 /src/server/scripts/Commands
parentf3b7f9ed5cb8fdc8142b95bfd16bdfb4a7b10e26 (diff)
Scripts/Commands: Convert remaining debug commands (PR #25429)
Diffstat (limited to 'src/server/scripts/Commands')
-rw-r--r--src/server/scripts/Commands/cs_debug.cpp251
1 files changed, 86 insertions, 165 deletions
diff --git a/src/server/scripts/Commands/cs_debug.cpp b/src/server/scripts/Commands/cs_debug.cpp
index 8f6a80b2201..f979f01a718 100644
--- a/src/server/scripts/Commands/cs_debug.cpp
+++ b/src/server/scripts/Commands/cs_debug.cpp
@@ -27,6 +27,7 @@ EndScriptData */
#include "BattlefieldMgr.h"
#include "BattlegroundMgr.h"
#include "CellImpl.h"
+#include "Channel.h"
#include "Chat.h"
#include "GameTime.h"
#include "GossipDef.h"
@@ -108,7 +109,6 @@ public:
{ "setitemvalue", rbac::RBAC_PERM_COMMAND_DEBUG_SETITEMVALUE, false, &HandleDebugSetItemValueCommand, "" },
{ "setvalue", rbac::RBAC_PERM_COMMAND_DEBUG_SETVALUE, false, &HandleDebugSetValueCommand, "" },
{ "spawnvehicle", rbac::RBAC_PERM_COMMAND_DEBUG_SPAWNVEHICLE, false, &HandleDebugSpawnVehicleCommand, "" },
- { "setvid", rbac::RBAC_PERM_COMMAND_DEBUG_SETVID, false, &HandleDebugSetVehicleIdCommand, "" },
{ "entervehicle", rbac::RBAC_PERM_COMMAND_DEBUG_ENTERVEHICLE, false, &HandleDebugEnterVehicleCommand, "" },
{ "worldstate", rbac::RBAC_PERM_COMMAND_DEBUG_WORLDSTATE, false, &HandleDebugUpdateWorldStateCommand, "" },
{ "update", rbac::RBAC_PERM_COMMAND_DEBUG_UPDATE, false, &HandleDebugUpdateCommand, "" },
@@ -161,7 +161,7 @@ public:
handler->PSendSysMessage("%u waypoints dumped", flyByCameras->size());
}
- handler->GetSession()->GetPlayer()->SendCinematicStart(cinematicId);
+ handler->GetPlayer()->SendCinematicStart(cinematicId);
return true;
}
@@ -175,7 +175,7 @@ public:
return false;
}
- handler->GetSession()->GetPlayer()->SendMovieStart(movieId);
+ handler->GetPlayer()->SendMovieStart(movieId);
return true;
}
@@ -189,7 +189,7 @@ public:
return false;
}
- Player* player = handler->GetSession()->GetPlayer();
+ Player* player = handler->GetPlayer();
Unit* unit = handler->getSelectedUnit();
if (!unit)
@@ -218,7 +218,7 @@ public:
return false;
}
- Player* player = handler->GetSession()->GetPlayer();
+ Player* player = handler->GetPlayer();
player->PlayDirectMusic(musicId, player);
@@ -226,65 +226,36 @@ public:
return true;
}
- static bool HandleDebugSendSpellFailCommand(ChatHandler* handler, char const* args)
+ static bool HandleDebugSendSpellFailCommand(ChatHandler* handler, SpellCastResult result, Optional<uint32> failArg1, Optional<uint32> failArg2)
{
- if (!*args)
- return false;
-
- char* result = strtok((char*)args, " ");
- if (!result)
- return false;
-
- uint8 failNum = (uint8)atoi(result);
- if (failNum == 0 && *result != '0')
- return false;
-
- char* fail1 = strtok(nullptr, " ");
- uint8 failArg1 = fail1 ? (uint8)atoi(fail1) : 0;
-
- char* fail2 = strtok(nullptr, " ");
- uint8 failArg2 = fail2 ? (uint8)atoi(fail2) : 0;
-
WorldPacket data(SMSG_CAST_FAILED, 5);
data << uint8(0);
- data << uint32(133);
- data << uint8(failNum);
- if (fail1 || fail2)
- data << uint32(failArg1);
- if (fail2)
- data << uint32(failArg2);
+ data << uint32(133); // Spell "Fireball"
+ data << uint8(result);
+ if (failArg1 || failArg2)
+ data << uint32(failArg1.value_or(0));
+ if (failArg2)
+ data << uint32(*failArg2);
handler->GetSession()->SendPacket(&data);
return true;
}
- static bool HandleDebugSendEquipErrorCommand(ChatHandler* handler, char const* args)
+ static bool HandleDebugSendEquipErrorCommand(ChatHandler* handler, InventoryResult error)
{
- if (!*args)
- return false;
-
- InventoryResult msg = InventoryResult(atoi(args));
- handler->GetSession()->GetPlayer()->SendEquipError(msg, nullptr, nullptr);
+ handler->GetPlayer()->SendEquipError(error, nullptr, nullptr);
return true;
}
- static bool HandleDebugSendSellErrorCommand(ChatHandler* handler, char const* args)
+ static bool HandleDebugSendSellErrorCommand(ChatHandler* handler, SellResult error)
{
- if (!*args)
- return false;
-
- SellResult msg = SellResult(atoi(args));
- handler->GetSession()->GetPlayer()->SendSellError(msg, nullptr, ObjectGuid::Empty, 0);
+ handler->GetPlayer()->SendSellError(error, nullptr, ObjectGuid::Empty, 0);
return true;
}
- static bool HandleDebugSendBuyErrorCommand(ChatHandler* handler, char const* args)
+ static bool HandleDebugSendBuyErrorCommand(ChatHandler* handler, BuyResult error)
{
- if (!*args)
- return false;
-
- BuyResult msg = BuyResult(atoi(args));
- handler->GetSession()->GetPlayer()->SendBuyError(msg, nullptr, 0, 0);
+ handler->GetPlayer()->SendBuyError(error, nullptr, 0, 0);
return true;
}
@@ -293,7 +264,7 @@ public:
Unit* unit = handler->getSelectedUnit();
Player* player = nullptr;
if (!unit || (unit->GetTypeId() != TYPEID_PLAYER))
- player = handler->GetSession()->GetPlayer();
+ player = handler->GetPlayer();
else
player = unit->ToPlayer();
@@ -461,13 +432,13 @@ public:
static bool HandleDebugUpdateWorldStateCommand(ChatHandler* handler, uint32 variable, uint32 value)
{
- handler->GetSession()->GetPlayer()->SendUpdateWorldState(variable, value);
+ handler->GetPlayer()->SendUpdateWorldState(variable, value);
return true;
}
static bool HandleDebugAreaTriggersCommand(ChatHandler* handler)
{
- Player* player = handler->GetSession()->GetPlayer();
+ Player* player = handler->GetPlayer();
if (!player->isDebugAreaTriggers)
{
handler->PSendSysMessage(LANG_DEBUG_AREATRIGGER_ON);
@@ -481,40 +452,28 @@ public:
return true;
}
- static bool HandleDebugSendChannelNotifyCommand(ChatHandler* handler, char const* args)
+ static bool HandleDebugSendChannelNotifyCommand(ChatHandler* handler, ChatNotify type)
{
- if (!*args)
- return false;
-
- char const* name = "test";
- uint8 code = atoi(args);
-
WorldPacket data(SMSG_CHANNEL_NOTIFY, (1+10));
- data << code; // notify type
- data << name; // channel name
+ data << uint8(type);
+ data << "test";
data << uint32(0);
data << uint32(0);
handler->GetSession()->SendPacket(&data);
return true;
}
- static bool HandleDebugSendChatMsgCommand(ChatHandler* handler, char const* args)
+ static bool HandleDebugSendChatMsgCommand(ChatHandler* handler, ChatMsg type)
{
- if (!*args)
- return false;
-
- char const* msg = "testtest";
- uint8 type = atoi(args);
WorldPacket data;
- ChatHandler::BuildChatPacket(data, ChatMsg(type), LANG_UNIVERSAL, handler->GetSession()->GetPlayer(), handler->GetSession()->GetPlayer(), msg, 0, "chan");
+ ChatHandler::BuildChatPacket(data, type, LANG_UNIVERSAL, handler->GetPlayer(), handler->GetPlayer(), "testtest", 0, "chan");
handler->GetSession()->SendPacket(&data);
return true;
}
- static bool HandleDebugSendQuestPartyMsgCommand(ChatHandler* handler, char const* args)
+ static bool HandleDebugSendQuestPartyMsgCommand(ChatHandler* handler, QuestShareMessages msg)
{
- uint32 msg = atoul(args);
- handler->GetSession()->GetPlayer()->SendPushToPartyResponse(handler->GetSession()->GetPlayer(), msg);
+ handler->GetPlayer()->SendPushToPartyResponse(handler->GetPlayer(), msg);
return true;
}
@@ -530,10 +489,9 @@ public:
return true;
}
- static bool HandleDebugSendQuestInvalidMsgCommand(ChatHandler* handler, char const* args)
+ static bool HandleDebugSendQuestInvalidMsgCommand(ChatHandler* handler, QuestFailedReason msg)
{
- QuestFailedReason msg = static_cast<QuestFailedReason>(atoul(args));
- handler->GetSession()->GetPlayer()->SendCanTakeQuestResponse(msg);
+ handler->GetPlayer()->SendCanTakeQuestResponse(msg);
return true;
}
@@ -560,7 +518,7 @@ public:
Player* player = handler->getSelectedPlayer();
if (!player)
- player = handler->GetSession()->GetPlayer();
+ player = handler->GetPlayer();
if (!listQueue && !checkAll)
{
@@ -819,7 +777,7 @@ public:
{
Unit* target = handler->getSelectedUnit();
if (!target)
- target = handler->GetSession()->GetPlayer();
+ target = handler->GetPlayer();
ThreatManager& mgr = target->GetThreatManager();
if (!target->IsAlive())
@@ -979,7 +937,7 @@ public:
{
Unit* target = handler->getSelectedUnit();
if (!target)
- target = handler->GetSession()->GetPlayer();
+ target = handler->GetPlayer();
handler->PSendSysMessage("Combat refs: (Combat state: %d | Manager state: %d)", target->IsInCombat(), target->GetCombatManager().HasCombat());
for (auto const& ref : target->GetCombatManager().GetPvPCombatRefs())
@@ -995,25 +953,6 @@ public:
return true;
}
- static bool HandleDebugSetVehicleIdCommand(ChatHandler* handler, char const* args)
- {
- Unit* target = handler->getSelectedUnit();
- if (!target || target->IsVehicle())
- return false;
-
- if (!args)
- return false;
-
- char* i = strtok((char*)args, " ");
- if (!i)
- return false;
-
- uint32 id = (uint32)atoi(i);
- //target->SetVehicleId(id);
- handler->PSendSysMessage("Vehicle id set to %u", id);
- return true;
- }
-
static bool HandleDebugEnterVehicleCommand(ChatHandler* handler, uint32 entry, Optional<int8> seatId)
{
Unit* target = handler->getSelectedUnit();
@@ -1024,13 +963,13 @@ public:
seatId = -1;
if (!entry)
- handler->GetSession()->GetPlayer()->EnterVehicle(target, *seatId);
+ handler->GetPlayer()->EnterVehicle(target, *seatId);
else
{
Creature* passenger = nullptr;
- Trinity::AllCreaturesOfEntryInRange check(handler->GetSession()->GetPlayer(), entry, 20.0f);
- Trinity::CreatureSearcher<Trinity::AllCreaturesOfEntryInRange> searcher(handler->GetSession()->GetPlayer(), passenger, check);
- Cell::VisitAllObjects(handler->GetSession()->GetPlayer(), searcher, 30.0f);
+ Trinity::AllCreaturesOfEntryInRange check(handler->GetPlayer(), entry, 20.0f);
+ Trinity::CreatureSearcher<Trinity::AllCreaturesOfEntryInRange> searcher(handler->GetPlayer(), passenger, check);
+ Cell::VisitAllObjects(handler->GetPlayer(), searcher, 30.0f);
if (!passenger || passenger == target)
return false;
passenger->EnterVehicle(target, *seatId);
@@ -1042,11 +981,11 @@ public:
static bool HandleDebugSpawnVehicleCommand(ChatHandler* handler, uint32 entry, Optional<uint32> id)
{
- float x, y, z, o = handler->GetSession()->GetPlayer()->GetOrientation();
- handler->GetSession()->GetPlayer()->GetClosePoint(x, y, z, handler->GetSession()->GetPlayer()->GetCombatReach());
+ float x, y, z, o = handler->GetPlayer()->GetOrientation();
+ handler->GetPlayer()->GetClosePoint(x, y, z, handler->GetPlayer()->GetCombatReach());
if (!id)
- return handler->GetSession()->GetPlayer()->SummonCreature(entry, x, y, z, o) != nullptr;
+ return handler->GetPlayer()->SummonCreature(entry, x, y, z, o) != nullptr;
CreatureTemplate const* ci = sObjectMgr->GetCreatureTemplate(entry);
@@ -1060,9 +999,9 @@ public:
Creature* v = new Creature();
- Map* map = handler->GetSession()->GetPlayer()->GetMap();
+ Map* map = handler->GetPlayer()->GetMap();
- if (!v->Create(map->GenerateLowGuid<HighGuid::Vehicle>(), map, handler->GetSession()->GetPlayer()->GetPhaseMask(), entry, { x, y, z, o }, nullptr, *id))
+ if (!v->Create(map->GenerateLowGuid<HighGuid::Vehicle>(), map, handler->GetPlayer()->GetPhaseMask(), entry, { x, y, z, o }, nullptr, *id))
{
delete v;
return false;
@@ -1075,10 +1014,9 @@ public:
static bool HandleDebugSendLargePacketCommand(ChatHandler* handler)
{
- char const* stuffingString = "This is a dummy string to push the packet's size beyond 128000 bytes. ";
std::ostringstream ss;
while (ss.str().size() < 128000)
- ss << stuffingString;
+ ss << "This is a dummy string to push the packet's size beyond 128000 bytes. ";
handler->SendSysMessage(ss.str().c_str());
return true;
}
@@ -1091,7 +1029,7 @@ public:
static bool HandleDebugGetItemValueCommand(ChatHandler* handler, ObjectGuid::LowType guid, uint32 index)
{
- Item* i = handler->GetSession()->GetPlayer()->GetItemByGuid(ObjectGuid(HighGuid::Item, 0, guid));
+ Item* i = handler->GetPlayer()->GetItemByGuid(ObjectGuid(HighGuid::Item, 0, guid));
if (!i)
return false;
@@ -1108,7 +1046,7 @@ public:
static bool HandleDebugSetItemValueCommand(ChatHandler* handler, ObjectGuid::LowType guid, uint32 index, uint32 value)
{
- Item* i = handler->GetSession()->GetPlayer()->GetItemByGuid(ObjectGuid(HighGuid::Item, 0, guid));
+ Item* i = handler->GetPlayer()->GetItemByGuid(ObjectGuid(HighGuid::Item, 0, guid));
if (!i)
return false;
@@ -1123,13 +1061,13 @@ public:
static bool HandleDebugItemExpireCommand(ChatHandler* handler, ObjectGuid::LowType guid)
{
- Item* i = handler->GetSession()->GetPlayer()->GetItemByGuid(ObjectGuid(HighGuid::Item, guid));
+ Item* i = handler->GetPlayer()->GetItemByGuid(ObjectGuid(HighGuid::Item, guid));
if (!i)
return false;
- handler->GetSession()->GetPlayer()->DestroyItem(i->GetBagSlot(), i->GetSlot(), true);
- sScriptMgr->OnItemExpire(handler->GetSession()->GetPlayer(), i->GetTemplate());
+ handler->GetPlayer()->DestroyItem(i->GetBagSlot(), i->GetSlot(), true);
+ sScriptMgr->OnItemExpire(handler->GetPlayer(), i->GetTemplate());
return true;
}
@@ -1149,7 +1087,7 @@ public:
{
if (Unit* unit = handler->getSelectedUnit())
{
- Player* player = handler->GetSession()->GetPlayer();
+ Player* player = handler->GetPlayer();
handler->PSendSysMessage("Checking LoS %s -> %s:", player->GetName().c_str(), unit->GetName().c_str());
handler->PSendSysMessage(" VMAP LoS: %s", player->IsWithinLOSInMap(unit, LINEOFSIGHT_CHECK_VMAP) ? "clear" : "obstructed");
handler->PSendSysMessage(" GObj LoS: %s", player->IsWithinLOSInMap(unit, LINEOFSIGHT_CHECK_GOBJECT) ? "clear" : "obstructed");
@@ -1159,15 +1097,8 @@ public:
return false;
}
- static bool HandleDebugSetAuraStateCommand(ChatHandler* handler, char const* args)
+ static bool HandleDebugSetAuraStateCommand(ChatHandler* handler, Optional<AuraStateType> state, bool apply)
{
- if (!*args)
- {
- handler->SendSysMessage(LANG_BAD_VALUE);
- handler->SetSentErrorMessage(true);
- return false;
- }
-
Unit* unit = handler->getSelectedUnit();
if (!unit)
{
@@ -1176,16 +1107,15 @@ public:
return false;
}
- int32 state = atoi((char*)args);
if (!state)
{
// reset all states
- for (int i = 1; i <= 32; ++i)
- unit->ModifyAuraState(AuraStateType(i), false);
+ for (AuraStateType s : EnumUtils::Iterate<AuraStateType>())
+ unit->ModifyAuraState(s, false);
return true;
}
- unit->ModifyAuraState(AuraStateType(abs(state)), state > 0);
+ unit->ModifyAuraState(*state, apply);
return true;
}
@@ -1253,16 +1183,16 @@ public:
static bool HandleDebugMod32ValueCommand(ChatHandler* handler, uint32 index, uint32 value)
{
- if (index >= handler->GetSession()->GetPlayer()->GetValuesCount())
+ if (index >= handler->GetPlayer()->GetValuesCount())
{
- handler->PSendSysMessage(LANG_TOO_BIG_INDEX, index, handler->GetSession()->GetPlayer()->GetGUID().GetCounter(), handler->GetSession()->GetPlayer()->GetValuesCount());
+ handler->PSendSysMessage(LANG_TOO_BIG_INDEX, index, handler->GetPlayer()->GetGUID().GetCounter(), handler->GetPlayer()->GetValuesCount());
return false;
}
- uint32 currentValue = handler->GetSession()->GetPlayer()->GetUInt32Value(index);
+ uint32 currentValue = handler->GetPlayer()->GetUInt32Value(index);
currentValue += value;
- handler->GetSession()->GetPlayer()->SetUInt32Value(index, currentValue);
+ handler->GetPlayer()->SetUInt32Value(index, currentValue);
handler->PSendSysMessage(LANG_CHANGE_32BIT_FIELD, index, currentValue);
@@ -1325,63 +1255,54 @@ public:
return true;
}
- static bool HandleDebugMoveflagsCommand(ChatHandler* handler, char const* args)
+ static bool HandleDebugMoveflagsCommand(ChatHandler* handler, Optional<uint32> moveFlags, Optional<uint32> moveFlagsExtra)
{
Unit* target = handler->getSelectedUnit();
if (!target)
- target = handler->GetSession()->GetPlayer();
+ target = handler->GetPlayer();
- if (!*args)
+ if (!moveFlags)
{
//! Display case
handler->PSendSysMessage(LANG_MOVEFLAGS_GET, target->GetUnitMovementFlags(), target->GetExtraUnitMovementFlags());
}
else
{
- char* mask1 = strtok((char*)args, " ");
- if (!mask1)
- return false;
-
- char* mask2 = strtok(nullptr, " \n");
-
- uint32 moveFlags = (uint32)atoi(mask1);
-
static uint32 const FlagsWithHandlers = MOVEMENTFLAG_MASK_HAS_PLAYER_STATUS_OPCODE |
MOVEMENTFLAG_WALKING | MOVEMENTFLAG_SWIMMING |
MOVEMENTFLAG_SPLINE_ENABLED;
- bool unhandledFlag = ((moveFlags ^ target->GetUnitMovementFlags()) & ~FlagsWithHandlers) != 0;
+ bool unhandledFlag = ((*moveFlags ^ target->GetUnitMovementFlags()) & ~FlagsWithHandlers) != 0;
- target->SetWalk((moveFlags & MOVEMENTFLAG_WALKING) != 0);
- target->SetDisableGravity((moveFlags & MOVEMENTFLAG_DISABLE_GRAVITY) != 0);
- target->SetSwim((moveFlags & MOVEMENTFLAG_SWIMMING) != 0);
- target->SetCanFly((moveFlags & MOVEMENTFLAG_CAN_FLY) != 0);
- target->SetWaterWalking((moveFlags & MOVEMENTFLAG_WATERWALKING) != 0);
- target->SetFeatherFall((moveFlags & MOVEMENTFLAG_FALLING_SLOW) != 0);
- target->SetHover((moveFlags & MOVEMENTFLAG_HOVER) != 0);
+ target->SetWalk((*moveFlags & MOVEMENTFLAG_WALKING) != 0);
+ target->SetDisableGravity((*moveFlags & MOVEMENTFLAG_DISABLE_GRAVITY) != 0);
+ target->SetSwim((*moveFlags & MOVEMENTFLAG_SWIMMING) != 0);
+ target->SetCanFly((*moveFlags & MOVEMENTFLAG_CAN_FLY) != 0);
+ target->SetWaterWalking((*moveFlags & MOVEMENTFLAG_WATERWALKING) != 0);
+ target->SetFeatherFall((*moveFlags & MOVEMENTFLAG_FALLING_SLOW) != 0);
+ target->SetHover((*moveFlags & MOVEMENTFLAG_HOVER) != 0);
- if (moveFlags & (MOVEMENTFLAG_DISABLE_GRAVITY | MOVEMENTFLAG_CAN_FLY))
- moveFlags &= ~MOVEMENTFLAG_FALLING;
+ if (*moveFlags & (MOVEMENTFLAG_DISABLE_GRAVITY | MOVEMENTFLAG_CAN_FLY))
+ *moveFlags &= ~MOVEMENTFLAG_FALLING;
- if (moveFlags & MOVEMENTFLAG_ROOT)
+ if (*moveFlags & MOVEMENTFLAG_ROOT)
{
target->SetControlled(true, UNIT_STATE_ROOT);
- moveFlags &= ~MOVEMENTFLAG_MASK_MOVING;
+ *moveFlags &= ~MOVEMENTFLAG_MASK_MOVING;
}
- if (target->HasUnitMovementFlag(MOVEMENTFLAG_SPLINE_ENABLED) && !(moveFlags & MOVEMENTFLAG_SPLINE_ENABLED))
+ if (target->HasUnitMovementFlag(MOVEMENTFLAG_SPLINE_ENABLED) && !(*moveFlags & MOVEMENTFLAG_SPLINE_ENABLED))
target->StopMoving();
if (unhandledFlag)
- target->SetUnitMovementFlags(moveFlags);
+ target->SetUnitMovementFlags(*moveFlags);
- if (mask2)
+ if (moveFlagsExtra)
{
- uint32 moveFlagsExtra = uint32(atoi(mask2));
- target->SetExtraUnitMovementFlags(moveFlagsExtra);
+ target->SetExtraUnitMovementFlags(*moveFlagsExtra);
}
- if (mask2 || unhandledFlag)
+ if (moveFlagsExtra || unhandledFlag)
target->SendMovementFlagUpdate();
handler->PSendSysMessage(LANG_MOVEFLAGS_SET, target->GetUnitMovementFlags(), target->GetExtraUnitMovementFlags());
@@ -1392,7 +1313,7 @@ public:
static bool HandleWPGPSCommand(ChatHandler* handler)
{
- Player* player = handler->GetSession()->GetPlayer();
+ Player* player = handler->GetPlayer();
TC_LOG_INFO("sql.dev", "(@PATH, XX, %.3f, %.3f, %.5f, %.5f, 0, 0, 0, 100, 0),", player->GetPositionX(), player->GetPositionY(), player->GetPositionZ(), player->GetOrientation());
@@ -1402,7 +1323,7 @@ public:
static bool HandleDebugTransportCommand(ChatHandler* handler, std::string operation)
{
- Transport* transport = handler->GetSession()->GetPlayer()->GetTransport();
+ Transport* transport = handler->GetPlayer()->GetTransport();
if (!transport)
return false;
@@ -1428,7 +1349,7 @@ public:
static bool HandleDebugLoadCellsCommand(ChatHandler* handler, Optional<uint32> mapId)
{
- Player* player = handler->GetSession()->GetPlayer();
+ Player* player = handler->GetPlayer();
if (!player)
return false;
@@ -1447,7 +1368,7 @@ public:
static bool HandleDebugBoundaryCommand(ChatHandler* handler, Optional<ExactSequence<'f', 'i', 'l','l'>> fill, Optional<uint32> durationArg)
{
- Player* player = handler->GetSession()->GetPlayer();
+ Player* player = handler->GetPlayer();
if (!player)
return false;
Creature* target = handler->getSelectedCreature();
@@ -1552,7 +1473,7 @@ public:
static bool HandleDebugNearGraveyard(ChatHandler* handler, Optional<ExactSequence<'l', 'i', 'n', 'k', 'e', 'd'>> linked)
{
- Player* player = handler->GetSession()->GetPlayer();
+ Player* player = handler->GetPlayer();
WorldSafeLocsEntry const* nearestLoc = nullptr;
if (linked)
@@ -1597,18 +1518,18 @@ public:
return true;
}
- static bool HandleDebugInstanceSpawns(ChatHandler* handler, char const* args)
+ static bool HandleDebugInstanceSpawns(ChatHandler* handler, Variant<uint32, ExactSequence<'e', 'x', 'p', 'l', 'a', 'i', 'n'>> optArg)
{
- Player const* const player = handler->GetSession()->GetPlayer();
+ Player const* const player = handler->GetPlayer();
if (!player)
return false;
bool explain = false;
uint32 groupID = 0;
- if (!stricmp(args, "explain"))
+ if (optArg.holds_alternative<ExactSequence<'e', 'x', 'p', 'l', 'a', 'i', 'n'>>())
explain = true;
else
- groupID = atoi(args);
+ groupID = optArg.get<uint32>();
if (groupID && !sObjectMgr->GetSpawnGroupData(groupID))
{