feat(Scripts/Commands): Item restoration command (#9538)

* Implement item restore command & move itemmove to new item cmd

* Implement LANG_COMMAND_DISABLED

* Prevent command usage if no config is set

* WIP: `.item restore list`

* Fix restore list & create base for restore item

* Send item to player via mail

* Put player as last argument

* Use Postmaster & fix restore list

* Show item name in restore list

* Update HandleItemMoveCommand to be using the api

Co-authored-by: Skjalf <47818697+Nyeriah@users.noreply.github.com>

* Send item instantly if online
This commit is contained in:
Noxies
2021-12-09 03:57:15 +01:00
committed by GitHub
parent 8ae8db5283
commit c95c29838b
7 changed files with 226 additions and 35 deletions

View File

@@ -156,7 +156,6 @@ public:
{ "dismount", SEC_PLAYER, false, &HandleDismountCommand, "" },
{ "guid", SEC_GAMEMASTER, false, &HandleGUIDCommand, "" },
{ "help", SEC_PLAYER, true, &HandleHelpCommand, "" },
{ "itemmove", SEC_GAMEMASTER, false, &HandleItemMoveCommand, "" },
{ "cooldown", SEC_GAMEMASTER, false, &HandleCooldownCommand, "" },
{ "distance", SEC_ADMINISTRATOR, false, &HandleGetDistanceCommand, "" },
{ "recall", SEC_GAMEMASTER, false, &HandleRecallCommand, "" },
@@ -1072,39 +1071,6 @@ public:
return true;
}
// move item to other slot
static bool HandleItemMoveCommand(ChatHandler* handler, char const* args)
{
if (!*args)
return false;
char const* param1 = strtok((char*)args, " ");
if (!param1)
return false;
char const* param2 = strtok(nullptr, " ");
if (!param2)
return false;
uint8 srcSlot = uint8(atoi(param1));
uint8 dstSlot = uint8(atoi(param2));
if (srcSlot == dstSlot)
return true;
if (!handler->GetSession()->GetPlayer()->IsValidPos(INVENTORY_SLOT_BAG_0, srcSlot, true))
return false;
if (!handler->GetSession()->GetPlayer()->IsValidPos(INVENTORY_SLOT_BAG_0, dstSlot, false))
return false;
uint16 src = ((INVENTORY_SLOT_BAG_0 << 8) | srcSlot);
uint16 dst = ((INVENTORY_SLOT_BAG_0 << 8) | dstSlot);
handler->GetSession()->GetPlayer()->SwapItem(src, dst);
return true;
}
static bool HandleCooldownCommand(ChatHandler* handler, char const* args)
{