Core/Commands: Implement .debug moveflags command. With params you can set MoveFlags and MoveFlagsExtra for targeted unit. Without params it will display the current MoveFlags and MoveFlagsExtra. Useful for debugging upcoming changes.
This commit is contained in:
@@ -89,6 +89,7 @@ public:
|
||||
{ "itemexpire", SEC_ADMINISTRATOR, false, &HandleDebugItemExpireCommand, "", NULL },
|
||||
{ "areatriggers", SEC_ADMINISTRATOR, false, &HandleDebugAreaTriggersCommand, "", NULL },
|
||||
{ "los", SEC_MODERATOR, false, &HandleDebugLoSCommand, "", NULL },
|
||||
{ "moveflags", SEC_ADMINISTRATOR, false, &HandleDebugMoveflagsCommand, "", NULL },
|
||||
{ NULL, 0, false, NULL, "", NULL }
|
||||
};
|
||||
static ChatCommand commandTable[] =
|
||||
@@ -1283,6 +1284,39 @@ public:
|
||||
handler->PSendSysMessage(LANG_SET_32BIT_FIELD, opcode, value);
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool HandleDebugMoveflagsCommand(ChatHandler* handler, char const* args)
|
||||
{
|
||||
Unit* target = handler->getSelectedUnit();
|
||||
if (!target)
|
||||
target = handler->GetSession()->GetPlayer();
|
||||
|
||||
if (!*args)
|
||||
{
|
||||
//! Display case
|
||||
handler->PSendSysMessage(LANG_MOVEFLAGS_GET, target->GetUnitMovementFlags(), target->GetExtraUnitMovementFlags());
|
||||
}
|
||||
else
|
||||
{
|
||||
char* mask1 = strtok((char*)args, " ");
|
||||
if (!mask1)
|
||||
return false;
|
||||
|
||||
char* mask2 = strtok(NULL, " \n");
|
||||
|
||||
uint32 moveFlags = (uint32)atoi(mask1);
|
||||
target->SetUnitMovementFlags(moveFlags);
|
||||
|
||||
if (mask2)
|
||||
{
|
||||
uint32 moveFlagsExtra = uint32(atoi(mask2));
|
||||
target->SetExtraUnitMovementFlags(moveFlagsExtra);
|
||||
}
|
||||
|
||||
target->SendMovementFlagUpdate();
|
||||
handler->PSendSysMessage(LANG_MOVEFLAGS_SET, target->GetUnitMovementFlags(), target->GetExtraUnitMovementFlags());
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
void AddSC_debug_commandscript()
|
||||
|
||||
Reference in New Issue
Block a user