AzerothCore 3.3.5a
OpenSource WoW Emulator
Loading...
Searching...
No Matches
misc_commandscript Class Reference
Inheritance diagram for misc_commandscript:
CommandScript ScriptObject

Public Member Functions

 misc_commandscript ()
 
ChatCommandTable GetCommands () const override
 
- Public Member Functions inherited from ScriptObject
virtual bool IsDatabaseBound () const
 
virtual bool isAfterLoadScript () const
 
virtual void checkValidity ()
 
const std::string & GetName () const
 
uint16 GetTotalAvailableHooks ()
 

Static Public Member Functions

static bool HandleSkirmishCommand (ChatHandler *handler, std::vector< std::string_view > args)
 
static bool HandleCommentatorCommand (ChatHandler *handler, Optional< bool > enableArg)
 
static bool HandleDevCommand (ChatHandler *handler, Optional< bool > enableArg)
 
static bool HandleGPSCommand (ChatHandler *handler, Optional< PlayerIdentifier > target)
 
static bool HandleAuraCommand (ChatHandler *handler, SpellInfo const *spell)
 
static bool HandleAuraStacksCommand (ChatHandler *handler, SpellInfo const *spell, int16 stacks)
 
static bool HandleUnAuraCommand (ChatHandler *handler, Variant< SpellInfo const *, std::string_view > spells)
 
static bool HandleAppearCommand (ChatHandler *handler, Optional< PlayerIdentifier > target)
 
static bool HandleSummonCommand (ChatHandler *handler, Optional< PlayerIdentifier > target)
 
static bool HandleGroupSummonCommand (ChatHandler *handler, Optional< PlayerIdentifier > target)
 
static bool HandleCommandsCommand (ChatHandler *handler)
 
static bool HandleDieCommand (ChatHandler *handler)
 
static bool HandleReviveCommand (ChatHandler *handler, Optional< PlayerIdentifier > target)
 
static bool HandleDismountCommand (ChatHandler *handler)
 
static bool HandleGUIDCommand (ChatHandler *handler)
 
static bool HandleHelpCommand (ChatHandler *handler, Tail cmd)
 
static bool HandleCooldownCommand (ChatHandler *handler, Optional< SpellInfo const * > spell)
 
static bool HandleGetDistanceCommand (ChatHandler *handler, Optional< PlayerIdentifier > target)
 
static bool HandleRecallCommand (ChatHandler *handler, Optional< PlayerIdentifier > target)
 
static bool HandleSaveCommand (ChatHandler *handler)
 
static bool HandleSaveAllCommand (ChatHandler *handler)
 
static bool HandleKickPlayerCommand (ChatHandler *handler, Optional< PlayerIdentifier > target, Optional< std::string_view > reason)
 
static bool HandleUnstuckCommand (ChatHandler *handler, Optional< PlayerIdentifier > target, Optional< std::string_view > location)
 
static bool HandleLinkGraveCommand (ChatHandler *handler, uint32 graveyardId, Optional< std::string_view > team)
 
static bool HandleNearGraveCommand (ChatHandler *handler, Optional< std::string_view > team)
 
static bool HandleShowAreaCommand (ChatHandler *handler, uint32 areaID)
 
static bool HandleHideAreaCommand (ChatHandler *handler, uint32 areaID)
 
static bool HandleAddItemCommand (ChatHandler *handler, Optional< PlayerIdentifier > player, ItemTemplate const *itemTemplate, Optional< int32 > _count)
 
static bool HandleAddItemSetCommand (ChatHandler *handler, Variant< Hyperlink< itemset >, uint32 > itemSetId)
 
static bool HandleChangeWeather (ChatHandler *handler, uint32 type, float grade)
 
static bool HandleMaxSkillCommand (ChatHandler *handler)
 
static bool HandleSetSkillCommand (ChatHandler *handler, Variant< Hyperlink< skill >, uint32 > skillId, int32 level, Optional< uint16 > maxPureSkill)
 
static bool HandlePInfoCommand (ChatHandler *handler, Optional< PlayerIdentifier > target)
 
static bool HandleRespawnCommand (ChatHandler *handler)
 
static bool HandleRespawnAllCommand (ChatHandler *handler)
 
static bool HandleMuteCommand (ChatHandler *handler, Optional< PlayerIdentifier > player, std::string notSpeakTime, Tail muteReason)
 
static bool HandleUnmuteCommand (ChatHandler *handler, Optional< PlayerIdentifier > target)
 
static bool HandleMuteInfoCommand (ChatHandler *handler, std::string accountName)
 
static bool HandleMuteInfoHelper (ChatHandler *handler, uint32 accountId, char const *accountName)
 
static bool HandleMovegensCommand (ChatHandler *handler)
 
static bool HandleComeToMeCommand (ChatHandler *handler)
 
static bool HandleDamageCommand (ChatHandler *handler, uint32 damage, Optional< std::string > percent)
 
static bool HandleCombatStopCommand (ChatHandler *handler, Optional< PlayerIdentifier > target)
 
static bool HandleFlushArenaPointsCommand (ChatHandler *)
 
static bool HandleFreezeCommand (ChatHandler *handler, Optional< PlayerIdentifier > target)
 
static bool HandleUnFreezeCommand (ChatHandler *handler, Optional< PlayerIdentifier > target)
 
static bool HandlePlayAllCommand (ChatHandler *handler, uint32 soundId)
 
static bool HandlePossessCommand (ChatHandler *handler)
 
static bool HandleUnPossessCommand (ChatHandler *handler)
 
static bool HandleBindSightCommand (ChatHandler *handler)
 
static bool HandleUnbindSightCommand (ChatHandler *handler)
 
static bool HandleMailBoxCommand (ChatHandler *handler)
 
static bool HandleStringCommand (ChatHandler *handler, uint32 id, Optional< uint8 > locale)
 
static bool HandleOpenDoorCommand (ChatHandler *handler, Optional< float > range)
 
static bool HandleBMCommand (ChatHandler *handler, Optional< bool > enableArg)
 
static bool HandlePacketLog (ChatHandler *handler, Optional< bool > enableArg)
 

Additional Inherited Members

- Protected Member Functions inherited from CommandScript
 CommandScript (const char *name)
 
- Protected Member Functions inherited from ScriptObject
 ScriptObject (const char *name, uint16 totalAvailableHooks=0)
 
virtual ~ScriptObject ()=default
 

Detailed Description

Constructor & Destructor Documentation

◆ misc_commandscript()

misc_commandscript::misc_commandscript ( )
inline
133: CommandScript("misc_commandscript") { }
Definition CommandScript.h:25

Member Function Documentation

◆ GetCommands()

ChatCommandTable misc_commandscript::GetCommands ( ) const
inlineoverridevirtual

Implements CommandScript.

136 {
137 static ChatCommandTable auraCommandTable =
138 {
139 { "stack", HandleAuraStacksCommand, SEC_GAMEMASTER, Console::No },
140 { "", HandleAuraCommand, SEC_GAMEMASTER, Console::No }
141 };
142
143 static ChatCommandTable commandTable =
144 {
145 { "commentator", HandleCommentatorCommand, SEC_MODERATOR, Console::No },
146 { "dev", HandleDevCommand, SEC_ADMINISTRATOR, Console::No },
147 { "gps", HandleGPSCommand, SEC_MODERATOR, Console::No },
148 { "aura", auraCommandTable },
149 { "unaura", HandleUnAuraCommand, SEC_GAMEMASTER, Console::No },
150 { "appear", HandleAppearCommand, SEC_MODERATOR, Console::No },
151 { "summon", HandleSummonCommand, SEC_GAMEMASTER, Console::No },
152 { "groupsummon", HandleGroupSummonCommand, SEC_GAMEMASTER, Console::No },
153 { "commands", HandleCommandsCommand, SEC_PLAYER, Console::Yes },
154 { "die", HandleDieCommand, SEC_GAMEMASTER, Console::No },
155 { "revive", HandleReviveCommand, SEC_GAMEMASTER, Console::Yes },
156 { "dismount", HandleDismountCommand, SEC_PLAYER, Console::No },
157 { "guid", HandleGUIDCommand, SEC_GAMEMASTER, Console::No },
158 { "help", HandleHelpCommand, SEC_PLAYER, Console::Yes },
159 { "cooldown", HandleCooldownCommand, SEC_GAMEMASTER, Console::No },
160 { "distance", HandleGetDistanceCommand, SEC_ADMINISTRATOR, Console::No },
161 { "recall", HandleRecallCommand, SEC_GAMEMASTER, Console::No },
162 { "save", HandleSaveCommand, SEC_PLAYER, Console::No },
163 { "saveall", HandleSaveAllCommand, SEC_GAMEMASTER, Console::Yes },
164 { "kick", HandleKickPlayerCommand, SEC_GAMEMASTER, Console::Yes },
165 { "unstuck", HandleUnstuckCommand, SEC_GAMEMASTER, Console::Yes },
166 { "linkgrave", HandleLinkGraveCommand, SEC_ADMINISTRATOR, Console::No },
167 { "neargrave", HandleNearGraveCommand, SEC_GAMEMASTER, Console::No },
168 { "showarea", HandleShowAreaCommand, SEC_GAMEMASTER, Console::No },
169 { "hidearea", HandleHideAreaCommand, SEC_ADMINISTRATOR, Console::No },
170 { "additem", HandleAddItemCommand, SEC_GAMEMASTER, Console::Yes },
171 { "additem set", HandleAddItemSetCommand, SEC_GAMEMASTER, Console::No },
172 { "wchange", HandleChangeWeather, SEC_ADMINISTRATOR, Console::No },
173 { "maxskill", HandleMaxSkillCommand, SEC_GAMEMASTER, Console::No },
174 { "setskill", HandleSetSkillCommand, SEC_GAMEMASTER, Console::No },
175 { "pinfo", HandlePInfoCommand, SEC_GAMEMASTER, Console::Yes },
176 { "respawn", HandleRespawnCommand, SEC_GAMEMASTER, Console::No },
177 { "respawn all", HandleRespawnAllCommand, SEC_GAMEMASTER, Console::No },
178 { "mute", HandleMuteCommand, SEC_GAMEMASTER, Console::Yes },
179 { "mutehistory", HandleMuteInfoCommand, SEC_GAMEMASTER, Console::Yes },
180 { "unmute", HandleUnmuteCommand, SEC_GAMEMASTER, Console::Yes },
181 { "movegens", HandleMovegensCommand, SEC_ADMINISTRATOR, Console::No },
182 { "cometome", HandleComeToMeCommand, SEC_ADMINISTRATOR, Console::No },
183 { "damage", HandleDamageCommand, SEC_GAMEMASTER, Console::No },
184 { "combatstop", HandleCombatStopCommand, SEC_GAMEMASTER, Console::Yes },
185 { "flusharenapoints", HandleFlushArenaPointsCommand, SEC_ADMINISTRATOR, Console::Yes },
186 { "freeze", HandleFreezeCommand, SEC_GAMEMASTER, Console::No },
187 { "unfreeze", HandleUnFreezeCommand, SEC_GAMEMASTER, Console::No },
188 { "possess", HandlePossessCommand, SEC_GAMEMASTER, Console::No },
189 { "unpossess", HandleUnPossessCommand, SEC_GAMEMASTER, Console::No },
190 { "bindsight", HandleBindSightCommand, SEC_ADMINISTRATOR, Console::No },
191 { "unbindsight", HandleUnbindSightCommand, SEC_ADMINISTRATOR, Console::No },
192 { "playall", HandlePlayAllCommand, SEC_GAMEMASTER, Console::No },
193 { "skirmish", HandleSkirmishCommand, SEC_ADMINISTRATOR, Console::No },
194 { "mailbox", HandleMailBoxCommand, SEC_MODERATOR, Console::No },
195 { "string", HandleStringCommand, SEC_GAMEMASTER, Console::No },
196 { "opendoor", HandleOpenDoorCommand, SEC_GAMEMASTER, Console::No },
197 { "bm", HandleBMCommand, SEC_GAMEMASTER, Console::No },
198 { "packetlog", HandlePacketLog, SEC_GAMEMASTER, Console::No }
199 };
200
201 return commandTable;
202 }
@ SEC_PLAYER
Definition Common.h:57
@ SEC_ADMINISTRATOR
Definition Common.h:60
@ SEC_GAMEMASTER
Definition Common.h:59
@ SEC_MODERATOR
Definition Common.h:58
static bool HandleCommentatorCommand(ChatHandler *handler, Optional< bool > enableArg)
Definition cs_misc.cpp:503
static bool HandleDevCommand(ChatHandler *handler, Optional< bool > enableArg)
Definition cs_misc.cpp:545
static bool HandleDamageCommand(ChatHandler *handler, uint32 damage, Optional< std::string > percent)
Definition cs_misc.cpp:2826
static bool HandleSaveCommand(ChatHandler *handler)
Definition cs_misc.cpp:1368
static bool HandleAuraStacksCommand(ChatHandler *handler, SpellInfo const *spell, int16 stacks)
Definition cs_misc.cpp:700
static bool HandleLinkGraveCommand(ChatHandler *handler, uint32 graveyardId, Optional< std::string_view > team)
Definition cs_misc.cpp:1531
static bool HandlePlayAllCommand(ChatHandler *handler, uint32 soundId)
Definition cs_misc.cpp:2975
static bool HandleAddItemCommand(ChatHandler *handler, Optional< PlayerIdentifier > player, ItemTemplate const *itemTemplate, Optional< int32 > _count)
Definition cs_misc.cpp:1721
static bool HandleAuraCommand(ChatHandler *handler, SpellInfo const *spell)
Definition cs_misc.cpp:674
static bool HandleUnstuckCommand(ChatHandler *handler, Optional< PlayerIdentifier > target, Optional< std::string_view > location)
Definition cs_misc.cpp:1453
static bool HandleRespawnAllCommand(ChatHandler *handler)
Definition cs_misc.cpp:2440
static bool HandleSkirmishCommand(ChatHandler *handler, std::vector< std::string_view > args)
Definition cs_misc.cpp:204
static bool HandleUnbindSightCommand(ChatHandler *handler)
Definition cs_misc.cpp:3025
static bool HandleShowAreaCommand(ChatHandler *handler, uint32 areaID)
Definition cs_misc.cpp:1659
static bool HandleStringCommand(ChatHandler *handler, uint32 id, Optional< uint8 > locale)
Definition cs_misc.cpp:3045
static bool HandleChangeWeather(ChatHandler *handler, uint32 type, float grade)
Definition cs_misc.cpp:1884
static bool HandlePInfoCommand(ChatHandler *handler, Optional< PlayerIdentifier > target)
Definition cs_misc.cpp:1966
static bool HandleBMCommand(ChatHandler *handler, Optional< bool > enableArg)
Definition cs_misc.cpp:3071
static bool HandleSummonCommand(ChatHandler *handler, Optional< PlayerIdentifier > target)
Definition cs_misc.cpp:928
static bool HandleCooldownCommand(ChatHandler *handler, Optional< SpellInfo const * > spell)
Definition cs_misc.cpp:1273
static bool HandleReviveCommand(ChatHandler *handler, Optional< PlayerIdentifier > target)
Definition cs_misc.cpp:1198
static bool HandleOpenDoorCommand(ChatHandler *handler, Optional< float > range)
Definition cs_misc.cpp:3058
static bool HandleCommandsCommand(ChatHandler *handler)
Definition cs_misc.cpp:1155
static bool HandleMailBoxCommand(ChatHandler *handler)
Definition cs_misc.cpp:3038
static bool HandleDieCommand(ChatHandler *handler)
Definition cs_misc.cpp:1161
static bool HandleAppearCommand(ChatHandler *handler, Optional< PlayerIdentifier > target)
Definition cs_misc.cpp:779
static bool HandleHelpCommand(ChatHandler *handler, Tail cmd)
Definition cs_misc.cpp:1261
static bool HandleRespawnCommand(ChatHandler *handler)
Definition cs_misc.cpp:2416
static bool HandleNearGraveCommand(ChatHandler *handler, Optional< std::string_view > team)
Definition cs_misc.cpp:1582
static bool HandleMovegensCommand(ChatHandler *handler)
Definition cs_misc.cpp:2676
static bool HandleGUIDCommand(ChatHandler *handler)
Definition cs_misc.cpp:1247
static bool HandleAddItemSetCommand(ChatHandler *handler, Variant< Hyperlink< itemset >, uint32 > itemSetId)
Definition cs_misc.cpp:1823
static bool HandleSaveAllCommand(ChatHandler *handler)
Definition cs_misc.cpp:1399
static bool HandleGPSCommand(ChatHandler *handler, Optional< PlayerIdentifier > target)
Definition cs_misc.cpp:588
static bool HandleKickPlayerCommand(ChatHandler *handler, Optional< PlayerIdentifier > target, Optional< std::string_view > reason)
Definition cs_misc.cpp:1407
static bool HandlePacketLog(ChatHandler *handler, Optional< bool > enableArg)
Definition cs_misc.cpp:3112
static bool HandleHideAreaCommand(ChatHandler *handler, uint32 areaID)
Definition cs_misc.cpp:1690
static bool HandleSetSkillCommand(ChatHandler *handler, Variant< Hyperlink< skill >, uint32 > skillId, int32 level, Optional< uint16 > maxPureSkill)
Definition cs_misc.cpp:1922
static bool HandleUnmuteCommand(ChatHandler *handler, Optional< PlayerIdentifier > target)
Definition cs_misc.cpp:2576
static bool HandleRecallCommand(ChatHandler *handler, Optional< PlayerIdentifier > target)
Definition cs_misc.cpp:1331
static bool HandleBindSightCommand(ChatHandler *handler)
Definition cs_misc.cpp:3013
static bool HandleComeToMeCommand(ChatHandler *handler)
Definition cs_misc.cpp:2810
static bool HandleUnPossessCommand(ChatHandler *handler)
Definition cs_misc.cpp:3001
static bool HandleDismountCommand(ChatHandler *handler)
Definition cs_misc.cpp:1223
static bool HandleGroupSummonCommand(ChatHandler *handler, Optional< PlayerIdentifier > target)
Definition cs_misc.cpp:1050
static bool HandleCombatStopCommand(ChatHandler *handler, Optional< PlayerIdentifier > target)
Definition cs_misc.cpp:2858
static bool HandleUnAuraCommand(ChatHandler *handler, Variant< SpellInfo const *, std::string_view > spells)
Definition cs_misc.cpp:745
static bool HandleGetDistanceCommand(ChatHandler *handler, Optional< PlayerIdentifier > target)
Definition cs_misc.cpp:1303
static bool HandleMaxSkillCommand(ChatHandler *handler)
Definition cs_misc.cpp:1908
static bool HandleFlushArenaPointsCommand(ChatHandler *)
Definition cs_misc.cpp:2884
static bool HandleFreezeCommand(ChatHandler *handler, Optional< PlayerIdentifier > target)
Definition cs_misc.cpp:2890
static bool HandleMuteInfoCommand(ChatHandler *handler, std::string accountName)
Definition cs_misc.cpp:2635
static bool HandleUnFreezeCommand(ChatHandler *handler, Optional< PlayerIdentifier > target)
Definition cs_misc.cpp:2933
static bool HandleMuteCommand(ChatHandler *handler, Optional< PlayerIdentifier > player, std::string notSpeakTime, Tail muteReason)
Definition cs_misc.cpp:2452
static bool HandlePossessCommand(ChatHandler *handler)
Definition cs_misc.cpp:2989
std::vector< ChatCommandBuilder > ChatCommandTable
Definition ChatCommand.h:46

References HandleAddItemCommand(), HandleAddItemSetCommand(), HandleAppearCommand(), HandleAuraCommand(), HandleAuraStacksCommand(), HandleBindSightCommand(), HandleBMCommand(), HandleChangeWeather(), HandleCombatStopCommand(), HandleComeToMeCommand(), HandleCommandsCommand(), HandleCommentatorCommand(), HandleCooldownCommand(), HandleDamageCommand(), HandleDevCommand(), HandleDieCommand(), HandleDismountCommand(), HandleFlushArenaPointsCommand(), HandleFreezeCommand(), HandleGetDistanceCommand(), HandleGPSCommand(), HandleGroupSummonCommand(), HandleGUIDCommand(), HandleHelpCommand(), HandleHideAreaCommand(), HandleKickPlayerCommand(), HandleLinkGraveCommand(), HandleMailBoxCommand(), HandleMaxSkillCommand(), HandleMovegensCommand(), HandleMuteCommand(), HandleMuteInfoCommand(), HandleNearGraveCommand(), HandleOpenDoorCommand(), HandlePacketLog(), HandlePInfoCommand(), HandlePlayAllCommand(), HandlePossessCommand(), HandleRecallCommand(), HandleRespawnAllCommand(), HandleRespawnCommand(), HandleReviveCommand(), HandleSaveAllCommand(), HandleSaveCommand(), HandleSetSkillCommand(), HandleShowAreaCommand(), HandleSkirmishCommand(), HandleStringCommand(), HandleSummonCommand(), HandleUnAuraCommand(), HandleUnbindSightCommand(), HandleUnFreezeCommand(), HandleUnmuteCommand(), HandleUnPossessCommand(), HandleUnstuckCommand(), SEC_ADMINISTRATOR, SEC_GAMEMASTER, SEC_MODERATOR, and SEC_PLAYER.

◆ HandleAddItemCommand()

static bool misc_commandscript::HandleAddItemCommand ( ChatHandler handler,
Optional< PlayerIdentifier player,
ItemTemplate const *  itemTemplate,
Optional< int32 _count 
)
inlinestatic
1722 {
1723 if (!sObjectMgr->GetItemTemplate(itemTemplate->ItemId))
1724 {
1725 handler->SendErrorMessage(LANG_COMMAND_ITEMIDINVALID, itemTemplate->ItemId);
1726 return false;
1727 }
1728
1729 uint32 itemId = itemTemplate->ItemId;
1730 int32 count = 1;
1731
1732 if (_count)
1733 count = *_count;
1734
1735 if (!count)
1736 count = 1;
1737
1738 if (!player)
1739 player = PlayerIdentifier::FromTargetOrSelf(handler);
1740
1741 if (!player)
1742 return false;
1743
1744 Player* playerTarget = player->GetConnectedPlayer();
1745
1746 if (!playerTarget)
1747 return false;
1748
1749 // Subtract
1750 if (count < 0)
1751 {
1752 // Only have scam check on player accounts
1753 if (playerTarget->GetSession()->GetSecurity() == SEC_PLAYER)
1754 {
1755 if (!playerTarget->HasItemCount(itemId, 0))
1756 {
1757 // output that player don't have any items to destroy
1758 handler->SendErrorMessage(LANG_REMOVEITEM_FAILURE, handler->GetNameLink(playerTarget), itemId);
1759 return false;
1760 }
1761
1762 if (!playerTarget->HasItemCount(itemId, -count))
1763 {
1764 // output that player don't have as many items that you want to destroy
1765 handler->SendErrorMessage(LANG_REMOVEITEM_ERROR, handler->GetNameLink(playerTarget), itemId);
1766 return false;
1767 }
1768 }
1769
1770 // output successful amount of destroyed items
1771 playerTarget->DestroyItemCount(itemId, -count, true, false);
1772 handler->PSendSysMessage(LANG_REMOVEITEM, itemId, -count, handler->GetNameLink(playerTarget));
1773 return true;
1774 }
1775
1776 // Adding items
1777 uint32 noSpaceForCount = 0;
1778
1779 // check space and find places
1780 ItemPosCountVec dest;
1781 InventoryResult msg = playerTarget->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, itemId, count, &noSpaceForCount);
1782
1783 if (msg != EQUIP_ERR_OK) // convert to possible store amount
1784 count -= noSpaceForCount;
1785
1786 if (!count || dest.empty()) // can't add any
1787 {
1788 handler->SendErrorMessage(LANG_ITEM_CANNOT_CREATE, itemId, noSpaceForCount);
1789 return false;
1790 }
1791
1792 Item* item = playerTarget->StoreNewItem(dest, itemId, true);
1793
1794 Player* p = handler->GetSession() ? handler->GetSession()->GetPlayer() : nullptr;
1795 // remove binding (let GM give it to another player later)
1796 if (p && p == playerTarget)
1797 {
1798 for (auto const& itemPos : dest)
1799 {
1800 if (Item* item1 = p->GetItemByPos(itemPos.pos))
1801 {
1802 item1->SetBinding(false);
1803 }
1804 }
1805 }
1806
1807 if (p && count && item)
1808 {
1809 p->SendNewItem(item, count, false, true);
1810
1811 if (p != playerTarget)
1812 {
1813 playerTarget->SendNewItem(item, count, true, false);
1814 }
1815 }
1816
1817 if (noSpaceForCount)
1818 handler->PSendSysMessage(LANG_ITEM_CANNOT_CREATE, itemId, noSpaceForCount);
1819
1820 return true;
1821 }
std::int32_t int32
Definition Define.h:103
std::uint32_t uint32
Definition Define.h:107
InventoryResult
Definition Item.h:46
@ EQUIP_ERR_OK
Definition Item.h:47
@ NULL_BAG
Definition Item.h:40
@ NULL_SLOT
Definition Item.h:41
@ LANG_ITEM_CANNOT_CREATE
Definition Language.h:543
@ LANG_REMOVEITEM_FAILURE
Definition Language.h:1333
@ LANG_REMOVEITEM_ERROR
Definition Language.h:1334
@ LANG_REMOVEITEM
Definition Language.h:542
@ LANG_COMMAND_ITEMIDINVALID
Definition Language.h:473
#define sObjectMgr
Definition ObjectMgr.h:1650
std::vector< ItemPosCount > ItemPosCountVec
Definition Player.h:766
virtual std::string GetNameLink() const
Definition Chat.h:198
void PSendSysMessage(std::string_view str, bool escapeCharacters=false)
Definition Chat.cpp:211
WorldSession * GetSession()
Definition Chat.h:242
void SendErrorMessage(uint32 entry)
Definition Chat.cpp:216
Definition Item.h:220
Definition Player.h:1071
bool HasItemCount(uint32 item, uint32 count=1, bool inBankAlso=false) const
Definition PlayerStorage.cpp:656
WorldSession * GetSession() const
Definition Player.h:1998
Item * GetItemByPos(uint16 pos) const
Definition PlayerStorage.cpp:442
void SendNewItem(Item *item, uint32 count, bool received, bool created, bool broadcast=false, bool sendChatMessage=true)
Definition PlayerStorage.cpp:4756
void DestroyItemCount(uint32 item, uint32 count, bool update, bool unequip_check=false)
Definition PlayerStorage.cpp:3120
Item * StoreNewItem(ItemPosCountVec const &pos, uint32 item, bool update, int32 randomPropertyId=0)
Definition PlayerStorage.cpp:2530
InventoryResult CanStoreNewItem(uint8 bag, uint8 slot, ItemPosCountVec &dest, uint32 item, uint32 count, uint32 *no_space_count=nullptr) const
Definition Player.h:1280
AccountTypes GetSecurity() const
Definition WorldSession.h:421
Player * GetPlayer() const
Definition WorldSession.h:424
static Optional< PlayerIdentifier > FromTargetOrSelf(ChatHandler *handler)
Definition ChatCommandTags.h:184

References Player::CanStoreNewItem(), Player::DestroyItemCount(), EQUIP_ERR_OK, Acore::ChatCommands::PlayerIdentifier::FromTargetOrSelf(), Player::GetItemByPos(), ChatHandler::GetNameLink(), WorldSession::GetPlayer(), WorldSession::GetSecurity(), ChatHandler::GetSession(), Player::GetSession(), Player::HasItemCount(), ItemTemplate::ItemId, LANG_COMMAND_ITEMIDINVALID, LANG_ITEM_CANNOT_CREATE, LANG_REMOVEITEM, LANG_REMOVEITEM_ERROR, LANG_REMOVEITEM_FAILURE, NULL_BAG, NULL_SLOT, ChatHandler::PSendSysMessage(), SEC_PLAYER, ChatHandler::SendErrorMessage(), Player::SendNewItem(), sObjectMgr, and Player::StoreNewItem().

Referenced by GetCommands().

◆ HandleAddItemSetCommand()

static bool misc_commandscript::HandleAddItemSetCommand ( ChatHandler handler,
Variant< Hyperlink< itemset >, uint32 itemSetId 
)
inlinestatic
1824 {
1825 // prevent generation all items with itemset field value '0'
1826 if (!*itemSetId)
1827 {
1829 return false;
1830 }
1831
1832 Player* player = handler->GetSession()->GetPlayer();
1833 Player* playerTarget = handler->getSelectedPlayer();
1834
1835 if (!playerTarget)
1836 {
1837 playerTarget = player;
1838 }
1839
1840 bool found = false;
1841
1842 for (auto const& [itemid, itemTemplate] : *sObjectMgr->GetItemTemplateStore())
1843 {
1844 if (itemTemplate.ItemSet == uint32(itemSetId))
1845 {
1846 found = true;
1847 ItemPosCountVec dest;
1848 InventoryResult msg = playerTarget->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, itemTemplate.ItemId, 1);
1849
1850 if (msg == EQUIP_ERR_OK)
1851 {
1852 Item* item = playerTarget->StoreNewItem(dest, itemTemplate.ItemId, true);
1853
1854 // remove binding (let GM give it to another player later)
1855 if (player == playerTarget)
1856 {
1857 item->SetBinding(false);
1858 }
1859
1860 player->SendNewItem(item, 1, false, true);
1861
1862 if (player != playerTarget)
1863 {
1864 playerTarget->SendNewItem(item, 1, true, false);
1865 }
1866 }
1867 else
1868 {
1869 player->SendEquipError(msg, nullptr, nullptr, itemTemplate.ItemId);
1870 handler->PSendSysMessage(LANG_ITEM_CANNOT_CREATE, itemTemplate.ItemId, 1);
1871 }
1872 }
1873 }
1874
1875 if (!found)
1876 {
1878 return false;
1879 }
1880
1881 return true;
1882 }
@ LANG_NO_ITEMS_FROM_ITEMSET_FOUND
Definition Language.h:548
Player * getSelectedPlayer() const
Definition Chat.cpp:374
void SetBinding(bool val)
Definition Item.h:235
void SendEquipError(InventoryResult msg, Item *pItem, Item *pItem2=nullptr, uint32 itemid=0)
Definition PlayerStorage.cpp:4020

References Player::CanStoreNewItem(), EQUIP_ERR_OK, WorldSession::GetPlayer(), ChatHandler::getSelectedPlayer(), ChatHandler::GetSession(), LANG_ITEM_CANNOT_CREATE, LANG_NO_ITEMS_FROM_ITEMSET_FOUND, NULL_BAG, NULL_SLOT, ChatHandler::PSendSysMessage(), Player::SendEquipError(), ChatHandler::SendErrorMessage(), Player::SendNewItem(), Item::SetBinding(), sObjectMgr, and Player::StoreNewItem().

Referenced by GetCommands().

◆ HandleAppearCommand()

static bool misc_commandscript::HandleAppearCommand ( ChatHandler handler,
Optional< PlayerIdentifier target 
)
inlinestatic
780 {
781 if (!target)
782 {
783 target = PlayerIdentifier::FromTarget(handler);
784 }
785
786 if (!target)
787 {
788 return false;
789 }
790
791 Player* _player = handler->GetSession()->GetPlayer();
792 if (target->GetGUID() == _player->GetGUID())
793 {
795 return false;
796 }
797
798 std::string nameLink = handler->playerLink(target->GetName());
799
800 if (target->IsConnected())
801 {
802 auto targetPlayer = target->GetConnectedPlayer();
803
804 // check online security
805 if (handler->HasLowerSecurity(targetPlayer))
806 {
807 return false;
808 }
809
810 Map* map = targetPlayer->GetMap();
811 if (map->IsBattlegroundOrArena())
812 {
813 // only allow if gm mode is on
814 if (!_player->IsGameMaster())
815 {
816 handler->SendErrorMessage(LANG_CANNOT_GO_TO_BG_GM, nameLink);
817 return false;
818 }
819
820 if (!_player->GetMap()->IsBattlegroundOrArena())
821 {
822 _player->SetEntryPoint();
823 }
824
825 _player->SetBattlegroundId(targetPlayer->GetBattlegroundId(), targetPlayer->GetBattlegroundTypeId(), PLAYER_MAX_BATTLEGROUND_QUEUES, false, false, TEAM_NEUTRAL);
826 }
827 else if (map->IsDungeon())
828 {
829 // we have to go to instance, and can go to player only if:
830 // 1) we are in his group (either as leader or as member)
831 // 2) we are not bound to any group and have GM mode on
832 if (_player->GetGroup())
833 {
834 // we are in group, we can go only if we are in the player group
835 if (_player->GetGroup() != targetPlayer->GetGroup())
836 {
838 return false;
839 }
840 }
841 else
842 {
843 // we are not in group, let's verify our GM mode
844 if (!_player->IsGameMaster())
845 {
847 return false;
848 }
849 }
850
851 // if the GM is bound to another instance, he will not be bound to another one
852 InstancePlayerBind* bind = sInstanceSaveMgr->PlayerGetBoundInstance(_player->GetGUID(), targetPlayer->GetMapId(), targetPlayer->GetDifficulty(map->IsRaid()));
853 if (!bind)
854 {
855 if (InstanceSave* save = sInstanceSaveMgr->GetInstanceSave(target->GetConnectedPlayer()->GetInstanceId()))
856 {
857 sInstanceSaveMgr->PlayerBindToInstance(_player->GetGUID(), save, !save->CanReset(), _player);
858 }
859 }
860
861 if (map->IsRaid())
862 {
863 _player->SetRaidDifficulty(targetPlayer->GetRaidDifficulty());
864 }
865 else
866 {
867 _player->SetDungeonDifficulty(targetPlayer->GetDungeonDifficulty());
868 }
869 }
870
871 handler->PSendSysMessage(LANG_APPEARING_AT, nameLink);
872
873 // stop flight if need
874 if (_player->IsInFlight())
875 {
876 _player->GetMotionMaster()->MovementExpired();
877 _player->CleanupAfterTaxiFlight();
878 }
879 else // save only in non-flight case
880 {
881 _player->SaveRecallPosition();
882 }
883
884 if (_player->TeleportTo(targetPlayer->GetMapId(), targetPlayer->GetPositionX(), targetPlayer->GetPositionY(), targetPlayer->GetPositionZ() + 0.25f, _player->GetOrientation(), TELE_TO_GM_MODE, targetPlayer))
885 {
886 _player->SetPhaseMask(targetPlayer->GetPhaseMask() | 1, false);
887 }
888 }
889 else
890 {
891 // check offline security
892 if (handler->HasLowerSecurity(nullptr, target->GetGUID()))
893 {
894 return false;
895 }
896
897 handler->PSendSysMessage(LANG_APPEARING_AT, nameLink);
898
899 // to point where player stay (if loaded)
900 float x, y, z, o;
901 uint32 map;
902 bool in_flight;
903
904 if (!Player::LoadPositionFromDB(map, x, y, z, o, in_flight, target->GetGUID().GetCounter()))
905 {
906 return false;
907 }
908
909 // stop flight if need
910 if (_player->IsInFlight())
911 {
912 _player->GetMotionMaster()->MovementExpired();
913 _player->CleanupAfterTaxiFlight();
914 }
915 // save only in non-flight case
916 else
917 {
918 _player->SaveRecallPosition();
919 }
920
921 _player->TeleportTo(map, x, y, z, _player->GetOrientation());
922 }
923
924 return true;
925 }
#define sInstanceSaveMgr
Definition InstanceSaveMgr.h:202
@ LANG_CANNOT_GO_TO_INST_PARTY
Definition Language.h:137
@ LANG_CANT_TELEPORT_SELF
Definition Language.h:212
@ LANG_APPEARING_AT
Definition Language.h:146
@ LANG_CANNOT_GO_TO_INST_GM
Definition Language.h:138
@ LANG_CANNOT_GO_TO_BG_GM
Definition Language.h:712
@ TELE_TO_GM_MODE
Definition Player.h:816
@ TEAM_NEUTRAL
Definition SharedDefines.h:773
#define PLAYER_MAX_BATTLEGROUND_QUEUES
Definition SharedDefines.h:176
std::string playerLink(std::string const &name) const
Definition Chat.h:231
bool HasLowerSecurity(Player *target, ObjectGuid guid=ObjectGuid::Empty, bool strong=false)
Definition Chat.cpp:57
Definition InstanceSaveMgr.h:56
Definition Map.h:163
bool IsDungeon() const
Definition Map.h:295
bool IsBattlegroundOrArena() const
Definition Map.h:303
bool IsRaid() const
Definition Map.h:297
void MovementExpired(bool reset=true)
Definition MotionMaster.h:195
static ObjectGuid GetGUID(Object const *o)
Definition Object.h:113
void SetDungeonDifficulty(Difficulty dungeon_difficulty)
Definition Player.h:1919
void SetEntryPoint()
Definition Player.cpp:11263
void SetRaidDifficulty(Difficulty raid_difficulty)
Definition Player.h:1920
void SetBattlegroundId(uint32 id, BattlegroundTypeId bgTypeId, uint32 queueSlot, bool invited, bool isRandom, TeamId teamId)
Definition Player.cpp:12304
void SaveRecallPosition()
Definition Player.cpp:5655
Group * GetGroup()
Definition Player.h:2470
bool IsGameMaster() const
Definition Player.h:1161
bool TeleportTo(uint32 mapid, float x, float y, float z, float orientation, uint32 options=0, Unit *target=nullptr, bool newInstance=false)
Definition Player.cpp:1350
static bool LoadPositionFromDB(uint32 &mapid, float &x, float &y, float &z, float &o, bool &in_flight, ObjectGuid::LowType guid)
Definition PlayerStorage.cpp:4881
void CleanupAfterTaxiFlight()
Definition Player.cpp:10420
MotionMaster * GetMotionMaster()
Definition Unit.h:1713
bool IsInFlight() const
Definition Unit.h:1660
void SetPhaseMask(uint32 newPhaseMask, bool update) override
Definition Unit.cpp:19081
Map * GetMap() const
Definition Object.h:621
static Optional< PlayerIdentifier > FromTarget(ChatHandler *handler)
Definition ChatCommandTags.cpp:138
Definition InstanceSaveMgr.h:39
float GetOrientation() const
Definition Position.h:124

References Player::CleanupAfterTaxiFlight(), Acore::ChatCommands::PlayerIdentifier::FromTarget(), Player::GetGroup(), Object::GetGUID(), WorldObject::GetMap(), Unit::GetMotionMaster(), Position::GetOrientation(), WorldSession::GetPlayer(), ChatHandler::GetSession(), ChatHandler::HasLowerSecurity(), Map::IsBattlegroundOrArena(), Map::IsDungeon(), Player::IsGameMaster(), Unit::IsInFlight(), Map::IsRaid(), LANG_APPEARING_AT, LANG_CANNOT_GO_TO_BG_GM, LANG_CANNOT_GO_TO_INST_GM, LANG_CANNOT_GO_TO_INST_PARTY, LANG_CANT_TELEPORT_SELF, Player::LoadPositionFromDB(), MotionMaster::MovementExpired(), PLAYER_MAX_BATTLEGROUND_QUEUES, ChatHandler::playerLink(), ChatHandler::PSendSysMessage(), Player::SaveRecallPosition(), ChatHandler::SendErrorMessage(), Player::SetBattlegroundId(), Player::SetDungeonDifficulty(), Player::SetEntryPoint(), Unit::SetPhaseMask(), Player::SetRaidDifficulty(), sInstanceSaveMgr, TEAM_NEUTRAL, TELE_TO_GM_MODE, and Player::TeleportTo().

Referenced by GetCommands().

◆ HandleAuraCommand()

static bool misc_commandscript::HandleAuraCommand ( ChatHandler handler,
SpellInfo const *  spell 
)
inlinestatic
675 {
676 if (!spell)
677 {
679 return false;
680 }
681
682 if (!SpellMgr::IsSpellValid(spell))
683 {
684 handler->SendErrorMessage(LANG_COMMAND_SPELL_BROKEN, spell->Id);
685 return false;
686 }
687
688 Unit* target = handler->getSelectedUnit();
689 if (!target)
690 {
692 return false;
693 }
694
695 Aura::TryRefreshStackOrCreate(spell, MAX_EFFECT_MASK, target, target);
696
697 return true;
698 }
#define MAX_EFFECT_MASK
Definition DBCStructure.h:1639
@ LANG_COMMAND_NOSPELLFOUND
Definition Language.h:483
@ LANG_SELECT_CHAR_OR_CREATURE
Definition Language.h:31
@ LANG_COMMAND_SPELL_BROKEN
Definition Language.h:526
static Aura * TryRefreshStackOrCreate(SpellInfo const *spellproto, uint8 tryEffMask, WorldObject *owner, Unit *caster, int32 *baseAmount=nullptr, Item *castItem=nullptr, ObjectGuid casterGUID=ObjectGuid::Empty, bool *refresh=nullptr, bool periodicReset=false)
Definition SpellAuras.cpp:326
Unit * getSelectedUnit() const
Definition Chat.cpp:386
static bool IsSpellValid(SpellInfo const *spellInfo)
Definition SpellMgr.cpp:441
Definition Unit.h:650

References ChatHandler::getSelectedUnit(), SpellInfo::Id, SpellMgr::IsSpellValid(), LANG_COMMAND_NOSPELLFOUND, LANG_COMMAND_SPELL_BROKEN, LANG_SELECT_CHAR_OR_CREATURE, MAX_EFFECT_MASK, ChatHandler::SendErrorMessage(), and Aura::TryRefreshStackOrCreate().

Referenced by GetCommands().

◆ HandleAuraStacksCommand()

static bool misc_commandscript::HandleAuraStacksCommand ( ChatHandler handler,
SpellInfo const *  spell,
int16  stacks 
)
inlinestatic
701 {
702 if (!spell)
703 {
705 return false;
706 }
707
708 if (!SpellMgr::IsSpellValid(spell))
709 {
710 handler->SendErrorMessage(LANG_COMMAND_SPELL_BROKEN, spell->Id);
711 return false;
712 }
713
714 if (!stacks)
715 {
717 return false;
718 }
719
720 Unit* target = handler->getSelectedUnit();
721 if (!target)
722 {
724 return false;
725 }
726
727 Aura* aur = target->GetAura(spell->Id);
728 if (!aur)
729 {
731 return false;
732 }
733
734 if (!spell->StackAmount)
735 {
737 return false;
738 }
739
740 aur->ModStackAmount(stacks);
741
742 return true;
743 }
@ LANG_COMMAND_AURASTACK_CANT_STACK
Definition Language.h:427
@ LANG_COMMAND_AURASTACK_NO_STACK
Definition Language.h:426
@ LANG_COMMAND_AURASTACK_NO_AURA
Definition Language.h:425
Definition SpellAuras.h:87
bool ModStackAmount(int32 num, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT, bool periodicReset=false)
Definition SpellAuras.cpp:1021
Aura * GetAura(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, ObjectGuid itemCasterGUID=ObjectGuid::Empty, uint8 reqEffMask=0) const
Definition Unit.cpp:5650

References Unit::GetAura(), ChatHandler::getSelectedUnit(), SpellInfo::Id, SpellMgr::IsSpellValid(), LANG_COMMAND_AURASTACK_CANT_STACK, LANG_COMMAND_AURASTACK_NO_AURA, LANG_COMMAND_AURASTACK_NO_STACK, LANG_COMMAND_NOSPELLFOUND, LANG_COMMAND_SPELL_BROKEN, LANG_SELECT_CHAR_OR_CREATURE, Aura::ModStackAmount(), ChatHandler::SendErrorMessage(), and SpellInfo::StackAmount.

Referenced by GetCommands().

◆ HandleBindSightCommand()

static bool misc_commandscript::HandleBindSightCommand ( ChatHandler handler)
inlinestatic
3014 {
3015 Unit* unit = handler->getSelectedUnit();
3016 if (!unit)
3017 {
3018 return false;
3019 }
3020
3021 handler->GetSession()->GetPlayer()->CastSpell(unit, 6277, true);
3022 return true;
3023 }
SpellCastResult CastSpell(SpellCastTargets const &targets, SpellInfo const *spellInfo, CustomSpellValues const *value, TriggerCastFlags triggerFlags=TRIGGERED_NONE, Item *castItem=nullptr, AuraEffect const *triggeredByAura=nullptr, ObjectGuid originalCaster=ObjectGuid::Empty)
Definition Unit.cpp:1194

References Unit::CastSpell(), WorldSession::GetPlayer(), ChatHandler::getSelectedUnit(), and ChatHandler::GetSession().

Referenced by GetCommands().

◆ HandleBMCommand()

static bool misc_commandscript::HandleBMCommand ( ChatHandler handler,
Optional< bool >  enableArg 
)
inlinestatic
3072 {
3073 WorldSession* session = handler->GetSession();
3074
3075 if (!session)
3076 return false;
3077
3078 auto SetBMMod = [&](bool enable)
3079 {
3080 char const* enabled = "ON";
3081 char const* disabled = "OFF";
3082 handler->SendNotification(LANG_COMMAND_BEASTMASTER_MODE, enable ? enabled : disabled);
3083
3084 session->GetPlayer()->SetBeastMaster(enable);
3085 };
3086
3087 if (!enableArg)
3088 {
3089 if (!AccountMgr::IsPlayerAccount(session->GetSecurity()) && session->GetPlayer()->IsDeveloper())
3090 SetBMMod(true);
3091 else
3092 SetBMMod(false);
3093
3094 return true;
3095 }
3096
3097 if (*enableArg)
3098 {
3099 SetBMMod(true);
3100 return true;
3101 }
3102 else
3103 {
3104 SetBMMod(false);
3105 return true;
3106 }
3107
3109 return false;
3110 }
@ LANG_USE_BOL
Definition Language.h:308
@ LANG_COMMAND_BEASTMASTER_MODE
Definition Language.h:981
void SendNotification(std::string_view str)
Definition Chat.cpp:105
void SetBeastMaster(bool on)
Definition Player.h:1158
bool IsDeveloper() const
Definition Player.h:1156
Player session in the World.
Definition WorldSession.h:369
bool IsPlayerAccount(uint32 gmlevel)
Definition AccountMgr.cpp:312

References WorldSession::GetPlayer(), WorldSession::GetSecurity(), ChatHandler::GetSession(), Player::IsDeveloper(), AccountMgr::IsPlayerAccount(), LANG_COMMAND_BEASTMASTER_MODE, LANG_USE_BOL, ChatHandler::SendErrorMessage(), ChatHandler::SendNotification(), and Player::SetBeastMaster().

Referenced by GetCommands().

◆ HandleChangeWeather()

static bool misc_commandscript::HandleChangeWeather ( ChatHandler handler,
uint32  type,
float  grade 
)
inlinestatic
1885 {
1886 // Weather is OFF
1887 if (!sWorld->getBoolConfig(CONFIG_WEATHER))
1888 {
1890 return false;
1891 }
1892
1893 Player* player = handler->GetSession()->GetPlayer();
1894 uint32 zoneid = player->GetZoneId();
1895
1896 Weather* weather = player->GetMap()->GetOrGenerateZoneDefaultWeather(zoneid);
1897 if (!weather)
1898 {
1900 return false;
1901 }
1902
1903 weather->SetWeather(WeatherType(type), grade);
1904
1905 return true;
1906 }
@ LANG_NO_WEATHER
Definition Language.h:438
@ LANG_WEATHER_DISABLED
Definition Language.h:439
WeatherType
Definition SharedDefines.h:3387
@ CONFIG_WEATHER
Definition WorldConfig.h:53
Weather * GetOrGenerateZoneDefaultWeather(uint32 zoneId)
Definition Map.cpp:2871
Weather for one zone.
Definition Weather.h:65
uint32 GetZoneId() const
Definition Object.cpp:3063
#define sWorld
Definition World.h:316
void SetWeather(WeatherType type, float grade)
Set the weather.
Definition Weather.cpp:268

References CONFIG_WEATHER, WorldObject::GetMap(), Map::GetOrGenerateZoneDefaultWeather(), WorldSession::GetPlayer(), ChatHandler::GetSession(), WorldObject::GetZoneId(), LANG_NO_WEATHER, LANG_WEATHER_DISABLED, ChatHandler::SendErrorMessage(), Weather::SetWeather(), and sWorld.

Referenced by GetCommands().

◆ HandleCombatStopCommand()

static bool misc_commandscript::HandleCombatStopCommand ( ChatHandler handler,
Optional< PlayerIdentifier target 
)
inlinestatic
2859 {
2860 if (!target)
2861 {
2862 target = PlayerIdentifier::FromTargetOrSelf(handler);
2863 }
2864
2865 if (!target || !target->IsConnected())
2866 {
2868 return false;
2869 }
2870
2871 Player* playerTarget = target->GetConnectedPlayer();
2872
2873 // check online security
2874 if (handler->HasLowerSecurity(playerTarget))
2875 {
2876 return false;
2877 }
2878
2879 playerTarget->CombatStop();
2880 playerTarget->getHostileRefMgr().deleteReferences();
2881 return true;
2882 }
@ LANG_PLAYER_NOT_FOUND
Definition Language.h:545
void deleteReferences(bool removeFromMap=false)
Definition HostileRefMgr.cpp:125
void CombatStop(bool includingCast=false)
Definition Unit.cpp:10513
HostileRefMgr & getHostileRefMgr()
Definition Unit.h:940

References Unit::CombatStop(), HostileRefMgr::deleteReferences(), Acore::ChatCommands::PlayerIdentifier::FromTargetOrSelf(), Unit::getHostileRefMgr(), ChatHandler::HasLowerSecurity(), LANG_PLAYER_NOT_FOUND, and ChatHandler::SendErrorMessage().

Referenced by GetCommands().

◆ HandleComeToMeCommand()

static bool misc_commandscript::HandleComeToMeCommand ( ChatHandler handler)
inlinestatic
2811 {
2812 Creature* caster = handler->getSelectedCreature();
2813 if (!caster)
2814 {
2816 return false;
2817 }
2818
2819 Player* player = handler->GetSession()->GetPlayer();
2820
2821 caster->GetMotionMaster()->MovePoint(0, player->GetPositionX(), player->GetPositionY(), player->GetPositionZ());
2822
2823 return true;
2824 }
@ LANG_SELECT_CREATURE
Definition Language.h:32
Creature * getSelectedCreature() const
Definition Chat.cpp:410
Definition Creature.h:47
void MovePoint(uint32 id, const Position &pos, ForcedMovement forcedMovement=FORCED_MOVEMENT_NONE, float speed=0.f, bool generatePath=true, bool forceDestination=true)
Definition MotionMaster.h:228
float GetPositionZ() const
Definition Position.h:123
float GetPositionX() const
Definition Position.h:121
float GetPositionY() const
Definition Position.h:122

References Unit::GetMotionMaster(), WorldSession::GetPlayer(), Position::GetPositionX(), Position::GetPositionY(), Position::GetPositionZ(), ChatHandler::getSelectedCreature(), ChatHandler::GetSession(), LANG_SELECT_CREATURE, MotionMaster::MovePoint(), and ChatHandler::SendErrorMessage().

Referenced by GetCommands().

◆ HandleCommandsCommand()

static bool misc_commandscript::HandleCommandsCommand ( ChatHandler handler)
inlinestatic
1156 {
1157 SendCommandHelpFor(*handler, "");
1158 return true;
1159 }
AC_GAME_API void SendCommandHelpFor(ChatHandler &handler, std::string_view cmd)
Definition ChatCommand.cpp:533

References Acore::ChatCommands::SendCommandHelpFor().

Referenced by GetCommands().

◆ HandleCommentatorCommand()

static bool misc_commandscript::HandleCommentatorCommand ( ChatHandler handler,
Optional< bool >  enableArg 
)
inlinestatic
504 {
505 WorldSession* session = handler->GetSession();
506
507 if (!session)
508 {
510 return false;
511 }
512
513 auto SetCommentatorMod = [&](bool enable)
514 {
515 handler->SendNotification(enable ? "Commentator mode on" : "Commentator mode off");
516 session->GetPlayer()->SetCommentator(enable);
517 };
518
519 if (!enableArg)
520 {
521 if (!AccountMgr::IsPlayerAccount(session->GetSecurity()) && session->GetPlayer()->IsCommentator())
522 {
523 SetCommentatorMod(true);
524 }
525 else
526 {
527 SetCommentatorMod(false);
528 }
529
530 return true;
531 }
532
533 if (*enableArg)
534 {
535 SetCommentatorMod(true);
536 return true;
537 }
538 else
539 {
540 SetCommentatorMod(false);
541 return true;
542 }
543 }
bool IsCommentator() const
Definition Player.h:1154
void SetCommentator(bool on)
Definition Player.h:1155

References WorldSession::GetPlayer(), WorldSession::GetSecurity(), ChatHandler::GetSession(), Player::IsCommentator(), AccountMgr::IsPlayerAccount(), LANG_USE_BOL, ChatHandler::SendErrorMessage(), ChatHandler::SendNotification(), and Player::SetCommentator().

Referenced by GetCommands().

◆ HandleCooldownCommand()

static bool misc_commandscript::HandleCooldownCommand ( ChatHandler handler,
Optional< SpellInfo const * >  spell 
)
inlinestatic
1274 {
1275 Player* target = handler->getSelectedPlayer();
1276 if (!target)
1277 {
1279 return false;
1280 }
1281
1282 std::string nameLink = handler->GetNameLink(target);
1283
1284 if (!spell)
1285 {
1286 target->RemoveAllSpellCooldown();
1287 handler->PSendSysMessage(LANG_REMOVEALL_COOLDOWN, nameLink);
1288 }
1289 else
1290 {
1291 if (!SpellMgr::IsSpellValid(*spell))
1292 {
1293 handler->SendErrorMessage(LANG_COMMAND_SPELL_BROKEN, spell.value()->Id);
1294 return false;
1295 }
1296
1297 target->RemoveSpellCooldown(spell.value()->Id, true);
1298 handler->PSendSysMessage(LANG_REMOVE_COOLDOWN, spell.value()->Id, target == handler->GetSession()->GetPlayer() ? handler->GetAcoreString(LANG_YOU) : nameLink);
1299 }
1300 return true;
1301 }
@ LANG_YOU
Definition Language.h:76
@ LANG_REMOVE_COOLDOWN
Definition Language.h:538
@ LANG_REMOVEALL_COOLDOWN
Definition Language.h:537
virtual std::string GetAcoreString(uint32 entry) const
Definition Chat.cpp:41
void RemoveAllSpellCooldown()
Definition Player.cpp:3586
void RemoveSpellCooldown(uint32 spell_id, bool update=false)
Definition Player.cpp:3535

References ChatHandler::GetAcoreString(), ChatHandler::GetNameLink(), WorldSession::GetPlayer(), ChatHandler::getSelectedPlayer(), ChatHandler::GetSession(), SpellMgr::IsSpellValid(), LANG_COMMAND_SPELL_BROKEN, LANG_PLAYER_NOT_FOUND, LANG_REMOVE_COOLDOWN, LANG_REMOVEALL_COOLDOWN, LANG_YOU, ChatHandler::PSendSysMessage(), Player::RemoveAllSpellCooldown(), Player::RemoveSpellCooldown(), and ChatHandler::SendErrorMessage().

Referenced by GetCommands().

◆ HandleDamageCommand()

static bool misc_commandscript::HandleDamageCommand ( ChatHandler handler,
uint32  damage,
Optional< std::string >  percent 
)
inlinestatic
2827 {
2828 Unit* target = handler->getSelectedUnit();
2829 if (!target || !handler->GetSession()->GetPlayer()->GetTarget())
2830 {
2832 return false;
2833 }
2834
2835 if (target->IsPlayer())
2836 if (handler->HasLowerSecurity(target->ToPlayer()))
2837 return false;
2838
2839 if (!target->IsAlive() || !damage)
2840 return true;
2841
2842 if (target->IsCreature() && handler->GetSession()->GetSecurity() == SEC_CONSOLE) // pussywizard
2843 target->ToCreature()->LowerPlayerDamageReq(target->GetMaxHealth());
2844
2845 if (percent)
2846 if (StringStartsWith("pct", *percent))
2847 if (damage <= 100)
2848 damage = target->CountPctFromMaxHealth(damage);
2849
2850 Unit::DealDamage(handler->GetSession()->GetPlayer(), target, damage, nullptr, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, nullptr, false, true);
2851
2852 if (target != handler->GetSession()->GetPlayer())
2854
2855 return true;
2856 }
@ SEC_CONSOLE
Definition Common.h:61
@ SPELL_SCHOOL_MASK_NORMAL
Definition SharedDefines.h:308
@ VICTIMSTATE_HIT
Definition Unit.h:86
@ HITINFO_AFFECTS_VICTIM
Definition Unit.h:100
@ DIRECT_DAMAGE
Definition Unit.h:250
bool StringStartsWith(std::string_view haystack, std::string_view needle)
Definition Util.h:401
void LowerPlayerDamageReq(uint32 unDamage, bool damagedByPlayer=true)
Definition Creature.cpp:3737
bool IsPlayer() const
Definition Object.h:201
Player * ToPlayer()
Definition Object.h:202
bool IsCreature() const
Definition Object.h:205
Creature * ToCreature()
Definition Object.h:206
void SendAttackStateUpdate(CalcDamageInfo *damageInfo)
Definition Unit.cpp:6579
uint32 GetMaxHealth() const
Definition Unit.h:1071
bool IsAlive() const
Definition Unit.h:1748
uint32 CountPctFromMaxHealth(int32 pct) const
Definition Unit.h:1083
ObjectGuid GetTarget() const
Definition Unit.h:844
static uint32 DealDamage(Unit *attacker, Unit *victim, uint32 damage, CleanDamage const *cleanDamage=nullptr, DamageEffectType damagetype=DIRECT_DAMAGE, SpellSchoolMask damageSchoolMask=SPELL_SCHOOL_MASK_NORMAL, SpellInfo const *spellProto=nullptr, bool durabilityLoss=true, bool allowGM=false, Spell const *spell=nullptr)
Definition Unit.cpp:824

References Unit::CountPctFromMaxHealth(), Unit::DealDamage(), DIRECT_DAMAGE, Unit::GetMaxHealth(), WorldSession::GetPlayer(), WorldSession::GetSecurity(), ChatHandler::getSelectedUnit(), ChatHandler::GetSession(), Unit::GetTarget(), ChatHandler::HasLowerSecurity(), HITINFO_AFFECTS_VICTIM, Unit::IsAlive(), Object::IsCreature(), Object::IsPlayer(), LANG_SELECT_CHAR_OR_CREATURE, Creature::LowerPlayerDamageReq(), SEC_CONSOLE, Unit::SendAttackStateUpdate(), ChatHandler::SendErrorMessage(), SPELL_SCHOOL_MASK_NORMAL, StringStartsWith(), Object::ToCreature(), Object::ToPlayer(), and VICTIMSTATE_HIT.

Referenced by GetCommands().

◆ HandleDevCommand()

static bool misc_commandscript::HandleDevCommand ( ChatHandler handler,
Optional< bool >  enableArg 
)
inlinestatic
546 {
547 WorldSession* session = handler->GetSession();
548
549 if (!session)
550 {
552 return false;
553 }
554
555 auto SetDevMod = [&](bool enable)
556 {
557 handler->SendNotification(enable ? LANG_DEV_ON : LANG_DEV_OFF);
558 session->GetPlayer()->SetDeveloper(enable);
559 sScriptMgr->OnHandleDevCommand(handler->GetSession()->GetPlayer(), enable);
560 };
561
562 if (!enableArg)
563 {
564 if (!AccountMgr::IsPlayerAccount(session->GetSecurity()) && session->GetPlayer()->IsDeveloper())
565 {
566 SetDevMod(true);
567 }
568 else
569 {
570 SetDevMod(false);
571 }
572
573 return true;
574 }
575
576 if (*enableArg)
577 {
578 SetDevMod(true);
579 return true;
580 }
581 else
582 {
583 SetDevMod(false);
584 return true;
585 }
586 }
@ LANG_DEV_ON
Definition Language.h:932
@ LANG_DEV_OFF
Definition Language.h:933
#define sScriptMgr
Definition ScriptMgr.h:723
void SetDeveloper(bool on)
Definition Player.h:1157

References WorldSession::GetPlayer(), WorldSession::GetSecurity(), ChatHandler::GetSession(), Player::IsDeveloper(), AccountMgr::IsPlayerAccount(), LANG_DEV_OFF, LANG_DEV_ON, LANG_USE_BOL, ChatHandler::SendErrorMessage(), ChatHandler::SendNotification(), Player::SetDeveloper(), and sScriptMgr.

Referenced by GetCommands().

◆ HandleDieCommand()

static bool misc_commandscript::HandleDieCommand ( ChatHandler handler)
inlinestatic
1162 {
1163 Unit* target = handler->getSelectedUnit();
1164
1165 if (!target || !handler->GetSession()->GetPlayer()->GetTarget())
1166 {
1168 return false;
1169 }
1170
1171 if (target->IsPlayer())
1172 {
1173 if (handler->HasLowerSecurity(target->ToPlayer()))
1174 {
1175 return false;
1176 }
1177 }
1178
1179 if (target->IsAlive())
1180 {
1181 if (sWorld->getBoolConfig(CONFIG_DIE_COMMAND_MODE))
1182 {
1183 if (target->IsCreature() && handler->GetSession()->GetSecurity() == SEC_CONSOLE) // pussywizard
1184 {
1185 target->ToCreature()->LowerPlayerDamageReq(target->GetMaxHealth());
1186 }
1187 Unit::Kill(handler->GetSession()->GetPlayer(), target);
1188 }
1189 else
1190 {
1191 Unit::DealDamage(handler->GetSession()->GetPlayer(), target, target->GetHealth(), nullptr, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, nullptr, false, true);
1192 }
1193 }
1194
1195 return true;
1196 }
@ CONFIG_DIE_COMMAND_MODE
Definition WorldConfig.h:66
static void Kill(Unit *killer, Unit *victim, bool durabilityLoss=true, WeaponAttackType attackType=BASE_ATTACK, SpellInfo const *spellProto=nullptr, Spell const *spell=nullptr)
Definition Unit.cpp:17743
uint32 GetHealth() const
Definition Unit.h:1070

References CONFIG_DIE_COMMAND_MODE, Unit::DealDamage(), DIRECT_DAMAGE, Unit::GetHealth(), Unit::GetMaxHealth(), WorldSession::GetPlayer(), WorldSession::GetSecurity(), ChatHandler::getSelectedUnit(), ChatHandler::GetSession(), Unit::GetTarget(), ChatHandler::HasLowerSecurity(), Unit::IsAlive(), Object::IsCreature(), Object::IsPlayer(), Unit::Kill(), LANG_SELECT_CHAR_OR_CREATURE, Creature::LowerPlayerDamageReq(), SEC_CONSOLE, ChatHandler::SendErrorMessage(), SPELL_SCHOOL_MASK_NORMAL, sWorld, Object::ToCreature(), and Object::ToPlayer().

Referenced by GetCommands().

◆ HandleDismountCommand()

static bool misc_commandscript::HandleDismountCommand ( ChatHandler handler)
inlinestatic
1224 {
1225 Player* player = handler->GetSession()->GetPlayer();
1226
1227 // If player is not mounted, so go out :)
1228 if (!player->IsMounted())
1229 {
1231 return false;
1232 }
1233
1234 if (player->IsInFlight())
1235 {
1237 return false;
1238 }
1239
1240 player->Dismount();
1242 player->SetSpeed(MOVE_RUN, 1, true);
1243 player->SetSpeed(MOVE_FLIGHT, 1, true);
1244 return true;
1245 }
@ LANG_CHAR_NON_MOUNTED
Definition Language.h:54
@ LANG_YOU_IN_FLIGHT
Definition Language.h:50
@ SPELL_AURA_MOUNTED
Definition SpellAuraDefines.h:141
@ MOVE_FLIGHT
Definition UnitDefines.h:359
@ MOVE_RUN
Definition UnitDefines.h:354
void Dismount()
Definition Unit.cpp:13605
bool IsMounted() const
Definition Unit.h:1841
void SetSpeed(UnitMoveType mtype, float rate, bool forced=false)
Definition Unit.cpp:14518
void RemoveAurasByType(AuraType auraType, ObjectGuid casterGUID=ObjectGuid::Empty, Aura *except=nullptr, bool negative=true, bool positive=true)
Definition Unit.cpp:5179

References Unit::Dismount(), WorldSession::GetPlayer(), ChatHandler::GetSession(), Unit::IsInFlight(), Unit::IsMounted(), LANG_CHAR_NON_MOUNTED, LANG_YOU_IN_FLIGHT, MOVE_FLIGHT, MOVE_RUN, Unit::RemoveAurasByType(), ChatHandler::SendErrorMessage(), Unit::SetSpeed(), and SPELL_AURA_MOUNTED.

Referenced by GetCommands().

◆ HandleFlushArenaPointsCommand()

static bool misc_commandscript::HandleFlushArenaPointsCommand ( ChatHandler )
inlinestatic
2885 {
2886 sArenaTeamMgr->DistributeArenaPoints();
2887 return true;
2888 }
#define sArenaTeamMgr
Definition ArenaTeamMgr.h:69

References sArenaTeamMgr.

Referenced by GetCommands().

◆ HandleFreezeCommand()

static bool misc_commandscript::HandleFreezeCommand ( ChatHandler handler,
Optional< PlayerIdentifier target 
)
inlinestatic
2891 {
2892 Creature* creatureTarget = handler->getSelectedCreature();
2893
2894 if (!target && !creatureTarget)
2895 {
2896 target = PlayerIdentifier::FromTargetOrSelf(handler);
2897 }
2898
2899 if (!target && !creatureTarget)
2900 {
2902 return false;
2903 }
2904
2905 Player* playerTarget = target->GetConnectedPlayer();
2906 if (playerTarget && !creatureTarget)
2907 {
2908 handler->PSendSysMessage(LANG_COMMAND_FREEZE, target->GetName());
2909
2910 if (SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(SPELL_FREEZE))
2911 {
2912 Aura::TryRefreshStackOrCreate(spellInfo, MAX_EFFECT_MASK, playerTarget, playerTarget);
2913 }
2914
2915 return true;
2916 }
2917 else if (creatureTarget && creatureTarget->IsAlive())
2918 {
2920
2921 if (SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(SPELL_FREEZE))
2922 {
2923 Aura::TryRefreshStackOrCreate(spellInfo, MAX_EFFECT_MASK, creatureTarget, creatureTarget);
2924 }
2925
2926 return true;
2927 }
2928
2930 return false;
2931 }
@ LANG_COMMAND_FREEZE
Definition Language.h:1055
#define sSpellMgr
Definition SpellMgr.h:825
virtual LocaleConstant GetSessionDbcLocale() const
Definition Chat.cpp:870
Definition SpellInfo.h:316
constexpr auto SPELL_FREEZE
Definition cs_misc.cpp:59
std::string const GetLocalizeCreatureName(Creature *creature, LocaleConstant locale)
Definition cs_misc.cpp:104

References Acore::ChatCommands::PlayerIdentifier::FromTargetOrSelf(), GetLocalizeCreatureName(), ChatHandler::getSelectedCreature(), ChatHandler::GetSessionDbcLocale(), Unit::IsAlive(), LANG_COMMAND_FREEZE, LANG_SELECT_CHAR_OR_CREATURE, MAX_EFFECT_MASK, ChatHandler::PSendSysMessage(), ChatHandler::SendErrorMessage(), SPELL_FREEZE, sSpellMgr, and Aura::TryRefreshStackOrCreate().

Referenced by GetCommands().

◆ HandleGetDistanceCommand()

static bool misc_commandscript::HandleGetDistanceCommand ( ChatHandler handler,
Optional< PlayerIdentifier target 
)
inlinestatic
1304 {
1305 if (!target)
1306 {
1307 target = PlayerIdentifier::FromTargetOrSelf(handler);
1308 }
1309
1310 WorldObject* object = handler->getSelectedUnit();
1311
1312 if (!object && !target)
1313 {
1314 return false;
1315 }
1316
1317 if (!object && target && target->IsConnected())
1318 {
1319 object = target->GetConnectedPlayer();
1320 }
1321
1322 if (!object)
1323 {
1324 return false;
1325 }
1326
1327 handler->PSendSysMessage(LANG_DISTANCE, handler->GetSession()->GetPlayer()->GetDistance(object), handler->GetSession()->GetPlayer()->GetDistance2d(object), handler->GetSession()->GetPlayer()->GetExactDist(object), handler->GetSession()->GetPlayer()->GetExactDist2d(object));
1328 return true;
1329 }
@ LANG_DISTANCE
Definition Language.h:550
Definition Object.h:472
float GetDistance2d(WorldObject const *obj) const
Definition Object.cpp:1296
float GetDistance(WorldObject const *obj) const
Definition Object.cpp:1278
float GetExactDist2d(const float x, const float y) const
Definition Position.h:170
float GetExactDist(float x, float y, float z) const
Definition Position.h:182

References Acore::ChatCommands::PlayerIdentifier::FromTargetOrSelf(), WorldObject::GetDistance(), WorldObject::GetDistance2d(), Position::GetExactDist(), Position::GetExactDist2d(), WorldSession::GetPlayer(), ChatHandler::getSelectedUnit(), ChatHandler::GetSession(), LANG_DISTANCE, and ChatHandler::PSendSysMessage().

Referenced by GetCommands().

◆ HandleGPSCommand()

static bool misc_commandscript::HandleGPSCommand ( ChatHandler handler,
Optional< PlayerIdentifier target 
)
inlinestatic
589 {
590 if (!target)
591 {
592 target = PlayerIdentifier::FromTargetOrSelf(handler);
593 }
594
595 WorldObject* object = handler->getSelectedUnit();
596
597 if (!object && !target)
598 {
599 return false;
600 }
601
602 if (!object && target && target->IsConnected())
603 {
604 object = target->GetConnectedPlayer();
605 }
606
607 if (!object)
608 {
609 return false;
610 }
611
612 CellCoord const cellCoord = Acore::ComputeCellCoord(object->GetPositionX(), object->GetPositionY());
613 Cell cell(cellCoord);
614
615 uint32 zoneId, areaId;
616 object->GetZoneAndAreaId(zoneId, areaId);
617
618 MapEntry const* mapEntry = sMapStore.LookupEntry(object->GetMapId());
619 AreaTableEntry const* zoneEntry = sAreaTableStore.LookupEntry(zoneId);
620 AreaTableEntry const* areaEntry = sAreaTableStore.LookupEntry(areaId);
621
622 float zoneX = object->GetPositionX();
623 float zoneY = object->GetPositionY();
624
625 Map2ZoneCoordinates(zoneX, zoneY, zoneId);
626
627 float groundZ = object->GetMapHeight(object->GetPositionX(), object->GetPositionY(), MAX_HEIGHT);
628 float floorZ = object->GetMapHeight(object->GetPositionX(), object->GetPositionY(), object->GetPositionZ());
629
630 uint32 haveMap = GridTerrainLoader::ExistMap(object->GetMapId(), cell.GridX(), cell.GridY()) ? 1 : 0;
631 uint32 haveVMap = GridTerrainLoader::ExistVMap(object->GetMapId(), cell.GridX(), cell.GridY()) ? 1 : 0;
633
634 if (haveVMap)
635 {
636 if (object->IsOutdoors())
637 {
638 handler->PSendSysMessage("You are outdoors");
639 }
640 else
641 {
642 handler->PSendSysMessage("You are indoors");
643 }
644 }
645 else
646 {
647 handler->PSendSysMessage("no VMAP available for area info");
648 }
649
651 object->GetMapId(), (mapEntry ? mapEntry->name[handler->GetSessionDbcLocale()] : "<unknown>"),
652 zoneId, (zoneEntry ? zoneEntry->area_name[handler->GetSessionDbcLocale()] : "<unknown>"),
653 areaId, (areaEntry ? areaEntry->area_name[handler->GetSessionDbcLocale()] : "<unknown>"),
654 object->GetPhaseMask(),
655 object->GetPositionX(), object->GetPositionY(), object->GetPositionZ(), object->GetOrientation(),
656 cell.GridX(), cell.GridY(), cell.CellX(), cell.CellY(), object->GetInstanceId(),
657 zoneX, zoneY, groundZ, floorZ, haveMap, haveVMap, haveMMAP);
658
659 LiquidData const& liquidData = object->GetLiquidData();
660
661 if (liquidData.Status)
662 {
663 handler->PSendSysMessage(LANG_LIQUID_STATUS, liquidData.Level, liquidData.DepthLevel, liquidData.Entry, liquidData.Flags, liquidData.Status);
664 }
665
666 if (object->GetTransport())
667 {
668 handler->PSendSysMessage("Transport offset: {:0.2f}, {:0.2f}, {:0.2f}, {:0.2f}", object->m_movementInfo.transport.pos.GetPositionX(), object->m_movementInfo.transport.pos.GetPositionY(), object->m_movementInfo.transport.pos.GetPositionZ(), object->m_movementInfo.transport.pos.GetOrientation());
669 }
670
671 return true;
672 }
void Map2ZoneCoordinates(float &x, float &y, uint32 zone)
Definition DBCStores.cpp:748
DBCStorage< MapEntry > sMapStore(MapEntryfmt)
DBCStorage< AreaTableEntry > sAreaTableStore(AreaTableEntryfmt)
#define MAX_HEIGHT
Definition GridTerrainData.h:26
@ LANG_LIQUID_STATUS
Definition Language.h:216
@ LANG_MAP_POSITION
Definition Language.h:134
static bool ExistVMap(uint32 mapid, int gx, int gy)
Definition GridTerrainLoader.cpp:122
static bool ExistMap(uint32 mapid, int gx, int gy)
Definition GridTerrainLoader.cpp:95
static MMapMgr * createOrGetMMapMgr()
Definition MMapFactory.cpp:27
dtNavMesh const * GetNavMesh(uint32 mapId)
Definition MMapMgr.cpp:303
uint32 GetMapId() const
Definition Position.h:281
bool IsOutdoors() const
Definition Object.cpp:3088
Transport * GetTransport() const
Definition Object.h:683
MovementInfo m_movementInfo
Definition Object.h:693
CellCoord ComputeCellCoord(float x, float y)
Definition GridDefines.h:197
Definition DBCStructure.h:519
Definition Cell.h:45
Definition GridTerrainData.h:199
float Level
Definition GridTerrainData.h:204
uint32 Flags
Definition GridTerrainData.h:203
uint32 Entry
Definition GridTerrainData.h:202
LiquidStatus Status
Definition GridTerrainData.h:206
float DepthLevel
Definition GridTerrainData.h:205
Definition DBCStructure.h:1326
char const * name[16]
Definition DBCStructure.h:1332
Position pos
Definition Object.h:309
struct MovementInfo::TransportInfo transport

References AreaTableEntry::area_name, Cell::CellX(), Cell::CellY(), Acore::ComputeCellCoord(), MMAP::MMapFactory::createOrGetMMapMgr(), LiquidData::DepthLevel, LiquidData::Entry, GridTerrainLoader::ExistMap(), GridTerrainLoader::ExistVMap(), LiquidData::Flags, Acore::ChatCommands::PlayerIdentifier::FromTargetOrSelf(), WorldLocation::GetMapId(), MMAP::MMapMgr::GetNavMesh(), WorldObject::GetPhaseMask(), WorldSession::GetPlayer(), Position::GetPositionX(), Position::GetPositionY(), Position::GetPositionZ(), ChatHandler::getSelectedUnit(), ChatHandler::GetSession(), ChatHandler::GetSessionDbcLocale(), WorldObject::GetTransport(), Cell::GridX(), Cell::GridY(), WorldObject::IsOutdoors(), LANG_LIQUID_STATUS, LANG_MAP_POSITION, LiquidData::Level, WorldObject::m_movementInfo, Map2ZoneCoordinates(), MAX_HEIGHT, MapEntry::name, MovementInfo::TransportInfo::pos, ChatHandler::PSendSysMessage(), sAreaTableStore, sMapStore, LiquidData::Status, and MovementInfo::transport.

Referenced by GetCommands().

◆ HandleGroupSummonCommand()

static bool misc_commandscript::HandleGroupSummonCommand ( ChatHandler handler,
Optional< PlayerIdentifier target 
)
inlinestatic
1051 {
1052 if (!target)
1053 {
1054 target = PlayerIdentifier::FromTargetOrSelf(handler);
1055 }
1056
1057 if (!target || !target->IsConnected())
1058 {
1059 return false;
1060 }
1061
1062 // check online security
1063 if (handler->HasLowerSecurity(target->GetConnectedPlayer()))
1064 {
1065 return false;
1066 }
1067
1068 auto targetPlayer = target->GetConnectedPlayer();
1069
1070 Group* group = targetPlayer->GetGroup();
1071
1072 std::string nameLink = handler->playerLink(target->GetName());
1073
1074 if (!group)
1075 {
1076 handler->SendErrorMessage(LANG_NOT_IN_GROUP, nameLink);
1077 return false;
1078 }
1079
1080 Map* gmMap = handler->GetSession()->GetPlayer()->GetMap();
1081 bool toInstance = gmMap->Instanceable();
1082
1083 // we are in instance, and can summon only player in our group with us as lead
1084 if (toInstance && (
1085 !handler->GetSession()->GetPlayer()->GetGroup() || (group->GetLeaderGUID() != handler->GetSession()->GetPlayer()->GetGUID()) ||
1086 (handler->GetSession()->GetPlayer()->GetGroup()->GetLeaderGUID() != handler->GetSession()->GetPlayer()->GetGUID())))
1087 // the last check is a bit excessive, but let it be, just in case
1088 {
1090 return false;
1091 }
1092
1093 for (GroupReference* itr = group->GetFirstMember(); itr != nullptr; itr = itr->next())
1094 {
1095 Player* player = itr->GetSource();
1096
1097 if (!player || player == handler->GetSession()->GetPlayer() || !player->GetSession())
1098 {
1099 continue;
1100 }
1101
1102 // check online security
1103 if (handler->HasLowerSecurity(player))
1104 {
1105 return false;
1106 }
1107
1108 std::string plNameLink = handler->GetNameLink(player);
1109
1110 if (player->IsBeingTeleported())
1111 {
1112 handler->SendErrorMessage(LANG_IS_TELEPORTED, plNameLink);
1113 return false;
1114 }
1115
1116 if (toInstance)
1117 {
1118 Map* playerMap = player->GetMap();
1119
1120 if (playerMap->Instanceable() && playerMap->GetInstanceId() != gmMap->GetInstanceId())
1121 {
1122 // cannot summon from instance to instance
1123 handler->SendErrorMessage(LANG_CANNOT_SUMMON_TO_INST, plNameLink);
1124 return false;
1125 }
1126 }
1127
1128 handler->PSendSysMessage(LANG_SUMMONING, plNameLink, "");
1129 if (handler->needReportToTarget(player))
1130 {
1132 }
1133
1134 // stop flight if need
1135 if (player->IsInFlight())
1136 {
1137 player->GetMotionMaster()->MovementExpired();
1138 player->CleanupAfterTaxiFlight();
1139 }
1140 // save only in non-flight case
1141 else
1142 {
1143 player->SaveRecallPosition();
1144 }
1145
1146 // before GM
1147 float x, y, z;
1148 handler->GetSession()->GetPlayer()->GetClosePoint(x, y, z, player->GetObjectSize());
1149 player->TeleportTo(handler->GetSession()->GetPlayer()->GetMapId(), x, y, z, player->GetOrientation(), 0, handler->GetSession()->GetPlayer());
1150 }
1151
1152 return true;
1153 }
@ LANG_SUMMONING
Definition Language.h:141
@ LANG_NOT_IN_GROUP
Definition Language.h:150
@ LANG_IS_TELEPORTED
Definition Language.h:135
@ LANG_CANNOT_SUMMON_TO_INST
Definition Language.h:136
@ LANG_SUMMONED_BY
Definition Language.h:142
Definition Chat.h:37
virtual bool needReportToTarget(Player *chr) const
Definition Chat.cpp:864
Definition GroupReference.h:27
Definition Group.h:169
GroupReference * GetFirstMember()
Definition Group.h:243
ObjectGuid GetLeaderGUID() const
Definition Group.cpp:2306
bool Instanceable() const
Definition Map.h:294
uint32 GetInstanceId() const
Definition Map.h:266
bool IsBeingTeleported() const
Definition Player.h:2088
bool GetClosePoint(float &x, float &y, float &z, float size, float distance2d=0, float angle=0, WorldObject const *forWho=nullptr, bool force=false) const
Definition Object.cpp:2717
float GetObjectSize() const
Definition Object.cpp:2789

References Player::CleanupAfterTaxiFlight(), Acore::ChatCommands::PlayerIdentifier::FromTargetOrSelf(), WorldObject::GetClosePoint(), Group::GetFirstMember(), Player::GetGroup(), Object::GetGUID(), Map::GetInstanceId(), Group::GetLeaderGUID(), WorldObject::GetMap(), WorldLocation::GetMapId(), Unit::GetMotionMaster(), ChatHandler::GetNameLink(), WorldObject::GetObjectSize(), Position::GetOrientation(), WorldSession::GetPlayer(), ChatHandler::GetSession(), Player::GetSession(), ChatHandler::HasLowerSecurity(), Map::Instanceable(), Player::IsBeingTeleported(), Unit::IsInFlight(), LANG_CANNOT_SUMMON_TO_INST, LANG_IS_TELEPORTED, LANG_NOT_IN_GROUP, LANG_SUMMONED_BY, LANG_SUMMONING, MotionMaster::MovementExpired(), ChatHandler::needReportToTarget(), ChatHandler::playerLink(), ChatHandler::PSendSysMessage(), Player::SaveRecallPosition(), ChatHandler::SendErrorMessage(), and Player::TeleportTo().

Referenced by GetCommands().

◆ HandleGUIDCommand()

static bool misc_commandscript::HandleGUIDCommand ( ChatHandler handler)
inlinestatic
1248 {
1249 ObjectGuid guid = handler->GetSession()->GetPlayer()->GetTarget();
1250
1251 if (!guid)
1252 {
1254 return false;
1255 }
1256
1257 handler->PSendSysMessage(LANG_OBJECT_GUID, guid.ToString());
1258 return true;
1259 }
@ LANG_OBJECT_GUID
Definition Language.h:243
@ LANG_NO_SELECTION
Definition Language.h:242
Definition ObjectGuid.h:118
std::string ToString() const
Definition ObjectGuid.cpp:47

References WorldSession::GetPlayer(), ChatHandler::GetSession(), Unit::GetTarget(), LANG_NO_SELECTION, LANG_OBJECT_GUID, ChatHandler::PSendSysMessage(), ChatHandler::SendErrorMessage(), and ObjectGuid::ToString().

Referenced by GetCommands().

◆ HandleHelpCommand()

static bool misc_commandscript::HandleHelpCommand ( ChatHandler handler,
Tail  cmd 
)
inlinestatic
1262 {
1264
1265 if (cmd.empty())
1266 {
1268 }
1269
1270 return true;
1271 }

References Acore::ChatCommands::SendCommandHelpFor().

Referenced by GetCommands().

◆ HandleHideAreaCommand()

static bool misc_commandscript::HandleHideAreaCommand ( ChatHandler handler,
uint32  areaID 
)
inlinestatic
1691 {
1692 Player* playerTarget = handler->getSelectedPlayer();
1693 if (!playerTarget)
1694 {
1696 return false;
1697 }
1698
1699 AreaTableEntry const* area = sAreaTableStore.LookupEntry(areaID);
1700 if (!area)
1701 {
1703 return false;
1704 }
1705
1706 int32 offset = area->exploreFlag / 32;
1707 if (offset >= PLAYER_EXPLORED_ZONES_SIZE)
1708 {
1710 return false;
1711 }
1712
1713 uint32 val = uint32((1 << (area->exploreFlag % 32)));
1714 uint32 currFields = playerTarget->GetUInt32Value(PLAYER_EXPLORED_ZONES_1 + offset);
1715 playerTarget->SetUInt32Value(PLAYER_EXPLORED_ZONES_1 + offset, uint32((currFields ^ val)));
1716
1718 return true;
1719 }
@ LANG_UNEXPLORE_AREA
Definition Language.h:623
@ LANG_NO_CHAR_SELECTED
Definition Language.h:149
@ LANG_BAD_VALUE
Definition Language.h:148
#define PLAYER_EXPLORED_ZONES_SIZE
Definition Player.h:73
@ PLAYER_EXPLORED_ZONES_1
Definition UpdateFields.h:357
virtual void SendSysMessage(std::string_view str, bool escapeCharacters=false)
Definition Chat.cpp:160
uint32 GetUInt32Value(uint16 index) const
Definition Object.cpp:294
void SetUInt32Value(uint16 index, uint32 value)
Definition Unit.cpp:21199
uint32 exploreFlag
Definition DBCStructure.h:523

References AreaTableEntry::exploreFlag, ChatHandler::getSelectedPlayer(), Object::GetUInt32Value(), LANG_BAD_VALUE, LANG_NO_CHAR_SELECTED, LANG_UNEXPLORE_AREA, PLAYER_EXPLORED_ZONES_1, PLAYER_EXPLORED_ZONES_SIZE, sAreaTableStore, ChatHandler::SendErrorMessage(), ChatHandler::SendSysMessage(), and Unit::SetUInt32Value().

Referenced by GetCommands().

◆ HandleKickPlayerCommand()

static bool misc_commandscript::HandleKickPlayerCommand ( ChatHandler handler,
Optional< PlayerIdentifier target,
Optional< std::string_view >  reason 
)
inlinestatic
1408 {
1409 if (!target)
1410 {
1411 target = PlayerIdentifier::FromTargetOrSelf(handler);
1412 }
1413
1414 if (!target || !target->IsConnected())
1415 {
1416 return false;
1417 }
1418
1419 auto targetPlayer = target->GetConnectedPlayer();
1420
1421 if (handler->GetSession() && target->GetGUID() == handler->GetSession()->GetPlayer()->GetGUID())
1422 {
1424 return false;
1425 }
1426
1427 // check online security
1428 if (handler->HasLowerSecurity(targetPlayer))
1429 {
1430 return false;
1431 }
1432
1433 std::string kickReasonStr = handler->GetAcoreString(LANG_NO_REASON);
1434 if (reason && !reason->empty())
1435 {
1436 kickReasonStr = std::string{ *reason };
1437 }
1438
1439 if (sWorld->getBoolConfig(CONFIG_SHOW_KICK_IN_WORLD))
1440 {
1441 handler->SendWorldText(LANG_COMMAND_KICKMESSAGE_WORLD, (handler->GetSession() ? handler->GetSession()->GetPlayerName() : "Server"), target->GetName(), kickReasonStr);
1442 }
1443 else
1444 {
1445 handler->PSendSysMessage(LANG_COMMAND_KICKMESSAGE, target->GetName());
1446 }
1447
1448 targetPlayer->GetSession()->KickPlayer("HandleKickPlayerCommand");
1449
1450 return true;
1451 }
@ LANG_COMMAND_KICKSELF
Definition Language.h:331
@ LANG_COMMAND_KICKMESSAGE_WORLD
Definition Language.h:1298
@ LANG_NO_REASON
Definition Language.h:813
@ LANG_COMMAND_KICKMESSAGE
Definition Language.h:332
@ CONFIG_SHOW_KICK_IN_WORLD
Definition WorldConfig.h:90
void SendWorldText(std::string_view str)
Definition Chat.cpp:131
const std::string & GetName() const
Definition ScriptObject.h:53
std::string const & GetPlayerName() const
Definition WorldSession.cpp:211

References CONFIG_SHOW_KICK_IN_WORLD, Acore::ChatCommands::PlayerIdentifier::FromTargetOrSelf(), ChatHandler::GetAcoreString(), Object::GetGUID(), WorldSession::GetPlayer(), WorldSession::GetPlayerName(), ChatHandler::GetSession(), ChatHandler::HasLowerSecurity(), LANG_COMMAND_KICKMESSAGE, LANG_COMMAND_KICKMESSAGE_WORLD, LANG_COMMAND_KICKSELF, LANG_NO_REASON, ChatHandler::PSendSysMessage(), ChatHandler::SendErrorMessage(), ChatHandler::SendWorldText(), and sWorld.

Referenced by GetCommands().

◆ HandleLinkGraveCommand()

static bool misc_commandscript::HandleLinkGraveCommand ( ChatHandler handler,
uint32  graveyardId,
Optional< std::string_view >  team 
)
inlinestatic
1532 {
1533 TeamId teamId;
1534
1535 if (!team)
1536 {
1537 teamId = TEAM_NEUTRAL;
1538 }
1539 else if (StringEqualI(team->substr(0, 6), "horde"))
1540 {
1541 teamId = TEAM_HORDE;
1542 }
1543 else if (StringEqualI(team->substr(0, 9), "alliance"))
1544 {
1545 teamId = TEAM_ALLIANCE;
1546 }
1547 else
1548 {
1549 return false;
1550 }
1551
1552 GraveyardStruct const* graveyard = sGraveyard->GetGraveyard(graveyardId);
1553
1554 if (!graveyard)
1555 {
1556 handler->SendErrorMessage(LANG_COMMAND_GRAVEYARDNOEXIST, graveyardId);
1557 return false;
1558 }
1559
1560 Player* player = handler->GetSession()->GetPlayer();
1561 uint32 zoneId = player->GetZoneId();
1562
1563 AreaTableEntry const* areaEntry = sAreaTableStore.LookupEntry(zoneId);
1564 if (!areaEntry || areaEntry->zone != 0)
1565 {
1566 handler->SendErrorMessage(LANG_COMMAND_GRAVEYARDWRONGZONE, graveyardId, zoneId);
1567 return false;
1568 }
1569
1570 if (sGraveyard->AddGraveyardLink(graveyardId, zoneId, teamId))
1571 {
1572 handler->PSendSysMessage(LANG_COMMAND_GRAVEYARDLINKED, graveyardId, zoneId);
1573 }
1574 else
1575 {
1576 handler->PSendSysMessage(LANG_COMMAND_GRAVEYARDALRLINKED, graveyardId, zoneId);
1577 }
1578
1579 return true;
1580 }
#define sGraveyard
Definition GameGraveyard.h:74
@ LANG_COMMAND_GRAVEYARDALRLINKED
Definition Language.h:488
@ LANG_COMMAND_GRAVEYARDNOEXIST
Definition Language.h:487
@ LANG_COMMAND_GRAVEYARDWRONGZONE
Definition Language.h:490
@ LANG_COMMAND_GRAVEYARDLINKED
Definition Language.h:489
TeamId
Definition SharedDefines.h:770
@ TEAM_ALLIANCE
Definition SharedDefines.h:771
@ TEAM_HORDE
Definition SharedDefines.h:772
bool StringEqualI(std::string_view a, std::string_view b)
Definition Util.cpp:592
uint32 zone
Definition DBCStructure.h:522
Definition GameGraveyard.h:27

References WorldSession::GetPlayer(), ChatHandler::GetSession(), WorldObject::GetZoneId(), LANG_COMMAND_GRAVEYARDALRLINKED, LANG_COMMAND_GRAVEYARDLINKED, LANG_COMMAND_GRAVEYARDNOEXIST, LANG_COMMAND_GRAVEYARDWRONGZONE, ChatHandler::PSendSysMessage(), sAreaTableStore, ChatHandler::SendErrorMessage(), sGraveyard, StringEqualI(), TEAM_ALLIANCE, TEAM_HORDE, TEAM_NEUTRAL, and AreaTableEntry::zone.

Referenced by GetCommands().

◆ HandleMailBoxCommand()

static bool misc_commandscript::HandleMailBoxCommand ( ChatHandler handler)
inlinestatic
3039 {
3040 Player* player = handler->GetSession()->GetPlayer();
3041 handler->GetSession()->SendShowMailBox(player->GetGUID());
3042 return true;
3043 }
void SendShowMailBox(ObjectGuid guid)
Definition NPCHandler.cpp:72

References Object::GetGUID(), WorldSession::GetPlayer(), ChatHandler::GetSession(), and WorldSession::SendShowMailBox().

Referenced by GetCommands().

◆ HandleMaxSkillCommand()

static bool misc_commandscript::HandleMaxSkillCommand ( ChatHandler handler)
inlinestatic
1909 {
1910 Player* SelectedPlayer = handler->getSelectedPlayer();
1911 if (!SelectedPlayer)
1912 {
1914 return false;
1915 }
1916
1917 // each skills that have max skill value dependent from level seted to current level max skill value
1918 SelectedPlayer->UpdateSkillsToMaxSkillsForLevel();
1919 return true;
1920 }
void UpdateSkillsToMaxSkillsForLevel()
Definition PlayerUpdates.cpp:1130

References ChatHandler::getSelectedPlayer(), LANG_NO_CHAR_SELECTED, ChatHandler::SendErrorMessage(), and Player::UpdateSkillsToMaxSkillsForLevel().

Referenced by GetCommands().

◆ HandleMovegensCommand()

static bool misc_commandscript::HandleMovegensCommand ( ChatHandler handler)
inlinestatic
2677 {
2678 Unit* unit = handler->getSelectedUnit();
2679 if (!unit)
2680 {
2682 return false;
2683 }
2684
2685 handler->PSendSysMessage(LANG_MOVEGENS_LIST, (unit->IsPlayer() ? "Player" : "Creature"), unit->GetGUID().ToString());
2686
2687 MotionMaster* motionMaster = unit->GetMotionMaster();
2688 float x, y, z;
2689 motionMaster->GetDestination(x, y, z);
2690
2691 for (uint8 i = 0; i < MAX_MOTION_SLOT; ++i)
2692 {
2693 MovementGenerator* movementGenerator = motionMaster->GetMotionSlot(i);
2694 if (!movementGenerator)
2695 {
2696 handler->SendSysMessage("Empty");
2697 continue;
2698 }
2699
2700 switch (movementGenerator->GetMovementGeneratorType())
2701 {
2702 case IDLE_MOTION_TYPE:
2704 break;
2705 case RANDOM_MOTION_TYPE:
2707 break;
2710 break;
2713 break;
2716 break;
2717 case CHASE_MOTION_TYPE:
2718 {
2719 Unit* target = nullptr;
2720 if (unit->IsPlayer())
2721 {
2722 target = static_cast<ChaseMovementGenerator<Player> const*>(movementGenerator)->GetTarget();
2723 }
2724 else
2725 {
2726 target = static_cast<ChaseMovementGenerator<Creature> const*>(movementGenerator)->GetTarget();
2727 }
2728
2729 if (!target)
2730 {
2732 }
2733 else if (target->IsPlayer())
2734 {
2735 handler->PSendSysMessage(LANG_MOVEGENS_CHASE_PLAYER, target->GetName(), target->GetGUID().ToString());
2736 }
2737 else
2738 {
2739 handler->PSendSysMessage(LANG_MOVEGENS_CHASE_CREATURE, target->GetName(), target->GetGUID().ToString());
2740 }
2741 break;
2742 }
2743 case FOLLOW_MOTION_TYPE:
2744 {
2745 Unit* target = nullptr;
2746 if (unit->IsPlayer())
2747 {
2748 target = static_cast<FollowMovementGenerator<Player> const*>(movementGenerator)->GetTarget();
2749 }
2750 else
2751 {
2752 target = static_cast<FollowMovementGenerator<Creature> const*>(movementGenerator)->GetTarget();
2753 }
2754
2755 if (!target)
2756 {
2758 }
2759 else if (target->IsPlayer())
2760 {
2761 handler->PSendSysMessage(LANG_MOVEGENS_FOLLOW_PLAYER, target->GetName(), target->GetGUID().ToString());
2762 }
2763 else
2764 {
2765 handler->PSendSysMessage(LANG_MOVEGENS_FOLLOW_CREATURE, target->GetName(), target->GetGUID().ToString());
2766 }
2767 break;
2768 }
2769 case HOME_MOTION_TYPE:
2770 {
2771 if (unit->IsCreature())
2772 {
2774 }
2775 else
2776 {
2778 }
2779 break;
2780 }
2781 case FLIGHT_MOTION_TYPE:
2783 break;
2784 case POINT_MOTION_TYPE:
2785 {
2786 handler->PSendSysMessage(LANG_MOVEGENS_POINT, x, y, z);
2787 break;
2788 }
2791 break;
2794 break;
2795 case EFFECT_MOTION_TYPE:
2797 break;
2798 default:
2799 handler->PSendSysMessage(LANG_MOVEGENS_UNKNOWN, movementGenerator->GetMovementGeneratorType());
2800 break;
2801 }
2802 }
2803 return true;
2804 }
std::uint8_t uint8
Definition Define.h:109
@ LANG_MOVEGENS_FOLLOW_PLAYER
Definition Language.h:934
@ LANG_MOVEGENS_EFFECT
Definition Language.h:937
@ LANG_MOVEGENS_UNKNOWN
Definition Language.h:590
@ LANG_MOVEGENS_CHASE_PLAYER
Definition Language.h:584
@ LANG_MOVEGENS_IDLE
Definition Language.h:579
@ LANG_MOVEGENS_CONFUSED
Definition Language.h:583
@ LANG_MOVEGENS_FOLLOW_CREATURE
Definition Language.h:935
@ LANG_MOVEGENS_FOLLOW_NULL
Definition Language.h:936
@ LANG_MOVEGENS_DISTRACT
Definition Language.h:658
@ LANG_MOVEGENS_CHASE_CREATURE
Definition Language.h:585
@ LANG_MOVEGENS_RANDOM
Definition Language.h:580
@ LANG_MOVEGENS_WAYPOINT
Definition Language.h:581
@ LANG_MOVEGENS_POINT
Definition Language.h:656
@ LANG_MOVEGENS_ANIMAL_RANDOM
Definition Language.h:582
@ LANG_MOVEGENS_CHASE_NULL
Definition Language.h:586
@ LANG_MOVEGENS_FLIGHT
Definition Language.h:589
@ LANG_MOVEGENS_HOME_CREATURE
Definition Language.h:587
@ LANG_MOVEGENS_HOME_PLAYER
Definition Language.h:588
@ LANG_MOVEGENS_LIST
Definition Language.h:578
@ LANG_MOVEGENS_FEAR
Definition Language.h:657
@ MAX_MOTION_SLOT
Definition MotionMaster.h:66
@ DISTRACT_MOTION_TYPE
Definition MotionMaster.h:50
@ IDLE_MOTION_TYPE
Definition MotionMaster.h:39
@ CHASE_MOTION_TYPE
Definition MotionMaster.h:45
@ WAYPOINT_MOTION_TYPE
Definition MotionMaster.h:41
@ FLEEING_MOTION_TYPE
Definition MotionMaster.h:49
@ CONFUSED_MOTION_TYPE
Definition MotionMaster.h:44
@ HOME_MOTION_TYPE
Definition MotionMaster.h:46
@ POINT_MOTION_TYPE
Definition MotionMaster.h:48
@ FLIGHT_MOTION_TYPE
Definition MotionMaster.h:47
@ FOLLOW_MOTION_TYPE
Definition MotionMaster.h:54
@ ANIMAL_RANDOM_MOTION_TYPE
Definition MotionMaster.h:43
@ RANDOM_MOTION_TYPE
Definition MotionMaster.h:40
@ EFFECT_MOTION_TYPE
Definition MotionMaster.h:56
Definition TargetedMovementGenerator.h:47
Definition TargetedMovementGenerator.h:91
Definition MotionMaster.h:127
_Ty GetMotionSlot(int slot) const
Definition MotionMaster.h:170
bool GetDestination(float &x, float &y, float &z)
Definition MotionMaster.cpp:1012
Definition MovementGenerator.h:28
virtual MovementGeneratorType GetMovementGeneratorType()=0
std::string const & GetName() const
Definition Object.h:525
std::string ToString(Type &&val, Params &&... params)
Definition StringConvert.h:250

References ANIMAL_RANDOM_MOTION_TYPE, CHASE_MOTION_TYPE, CONFUSED_MOTION_TYPE, DISTRACT_MOTION_TYPE, EFFECT_MOTION_TYPE, FLEEING_MOTION_TYPE, FLIGHT_MOTION_TYPE, FOLLOW_MOTION_TYPE, MotionMaster::GetDestination(), Object::GetGUID(), Unit::GetMotionMaster(), MotionMaster::GetMotionSlot(), MovementGenerator::GetMovementGeneratorType(), WorldObject::GetName(), ChatHandler::getSelectedUnit(), HOME_MOTION_TYPE, IDLE_MOTION_TYPE, Object::IsCreature(), Object::IsPlayer(), LANG_MOVEGENS_ANIMAL_RANDOM, LANG_MOVEGENS_CHASE_CREATURE, LANG_MOVEGENS_CHASE_NULL, LANG_MOVEGENS_CHASE_PLAYER, LANG_MOVEGENS_CONFUSED, LANG_MOVEGENS_DISTRACT, LANG_MOVEGENS_EFFECT, LANG_MOVEGENS_FEAR, LANG_MOVEGENS_FLIGHT, LANG_MOVEGENS_FOLLOW_CREATURE, LANG_MOVEGENS_FOLLOW_NULL, LANG_MOVEGENS_FOLLOW_PLAYER, LANG_MOVEGENS_HOME_CREATURE, LANG_MOVEGENS_HOME_PLAYER, LANG_MOVEGENS_IDLE, LANG_MOVEGENS_LIST, LANG_MOVEGENS_POINT, LANG_MOVEGENS_RANDOM, LANG_MOVEGENS_UNKNOWN, LANG_MOVEGENS_WAYPOINT, LANG_SELECT_CHAR_OR_CREATURE, MAX_MOTION_SLOT, POINT_MOTION_TYPE, ChatHandler::PSendSysMessage(), RANDOM_MOTION_TYPE, ChatHandler::SendErrorMessage(), ChatHandler::SendSysMessage(), ObjectGuid::ToString(), and WAYPOINT_MOTION_TYPE.

Referenced by GetCommands().

◆ HandleMuteCommand()

static bool misc_commandscript::HandleMuteCommand ( ChatHandler handler,
Optional< PlayerIdentifier player,
std::string  notSpeakTime,
Tail  muteReason 
)
inlinestatic
2453 {
2454 std::string muteReasonStr{ muteReason };
2455
2456 if (notSpeakTime.empty())
2457 {
2458 return false;
2459 }
2460
2461 if (Acore::StringTo<int32>(notSpeakTime).value_or(0) < 0)
2462 {
2464 return false;
2465 }
2466
2467 if (muteReason.empty())
2468 {
2469 muteReasonStr = handler->GetAcoreString(LANG_NO_REASON);
2470 }
2471
2472 if (!player)
2473 {
2474 player = PlayerIdentifier::FromTarget(handler);
2475 }
2476
2477 if (!player)
2478 {
2480 return false;
2481 }
2482
2483 Player* target = player->GetConnectedPlayer();
2484 uint32 accountId = target ? target->GetSession()->GetAccountId() : sCharacterCache->GetCharacterAccountIdByGuid(player->GetGUID());
2485
2486 // find only player from same account if any
2487 if (!target)
2488 if (WorldSession* session = sWorldSessionMgr->FindSession(accountId))
2489 {
2490 target = session->GetPlayer();
2491 }
2492
2493 // must have strong lesser security level
2494 if (handler->HasLowerSecurity(target, player->GetGUID(), true))
2495 {
2496 return false;
2497 }
2498
2500 int32 muteDuration = TimeStringToSecs(notSpeakTime);
2501 if (muteDuration <= 0)
2502 {
2503 muteDuration = Acore::StringTo<int32>(notSpeakTime).value_or(0);
2504 }
2505
2506 if (muteDuration <= 0)
2507 {
2509 return false;
2510 }
2511
2512 std::string muteBy = "";
2513 if (handler->GetSession())
2514 {
2515 muteBy = handler->GetSession()->GetPlayerName();
2516 }
2517 else
2518 {
2519 muteBy = handler->GetAcoreString(LANG_CONSOLE);
2520 }
2521
2522 if (target)
2523 {
2524 // Target is online, mute will be in effect right away.
2525 int64 muteTime = GameTime::GetGameTime().count() + muteDuration;
2526 target->GetSession()->m_muteTime = muteTime;
2527 stmt->SetData(0, muteTime);
2528 std::string nameLink = handler->playerLink(player->GetName());
2529
2530 if (sWorld->getBoolConfig(CONFIG_SHOW_MUTE_IN_WORLD))
2531 {
2532 handler->SendWorldText(LANG_COMMAND_MUTEMESSAGE_WORLD, muteBy, nameLink, secsToTimeString(muteDuration, true), muteReasonStr);
2533 }
2534
2535 ChatHandler(target->GetSession()).PSendSysMessage(LANG_YOUR_CHAT_DISABLED, secsToTimeString(muteDuration, true), muteBy, muteReasonStr);
2536 }
2537 else
2538 {
2539 // Target is offline, mute will be in effect starting from the next login.
2540 stmt->SetData(0, -int32(muteDuration));
2541 }
2542
2543 stmt->SetData(1, muteReasonStr);
2544 stmt->SetData(2, muteBy);
2545 stmt->SetData(3, accountId);
2546 LoginDatabase.Execute(stmt);
2547
2548 stmt = LoginDatabase.GetPreparedStatement(LOGIN_INS_ACCOUNT_MUTE);
2549 stmt->SetData(0, accountId);
2550 stmt->SetData(1, muteDuration / MINUTE);
2551 stmt->SetData(2, muteBy);
2552 stmt->SetData(3, muteReasonStr);
2553 LoginDatabase.Execute(stmt);
2554
2555 std::string nameLink = handler->playerLink(player->GetName());
2556
2557 if (sWorld->getBoolConfig(CONFIG_SHOW_MUTE_IN_WORLD) && !target)
2558 {
2559 handler->SendWorldText(LANG_COMMAND_MUTEMESSAGE_WORLD, muteBy, nameLink, secsToTimeString(muteDuration, true), muteReasonStr);
2560 }
2561 else
2562 {
2563 // pussywizard: notify all online GMs
2564 std::shared_lock<std::shared_mutex> lock(*HashMapHolder<Player>::GetLock());
2566 for (HashMapHolder<Player>::MapType::const_iterator itr = m.begin(); itr != m.end(); ++itr)
2567 if (itr->second->GetSession()->GetSecurity())
2568 ChatHandler(itr->second->GetSession()).PSendSysMessage(target ? LANG_YOU_DISABLE_CHAT : LANG_COMMAND_DISABLE_CHAT_DELAYED,
2569 (handler->GetSession() ? handler->GetSession()->GetPlayerName() : handler->GetAcoreString(LANG_CONSOLE)), nameLink, secsToTimeString(muteDuration, true), muteReasonStr);
2570 }
2571
2572 return true;
2573 }
#define sCharacterCache
Definition CharacterCache.h:83
constexpr auto MINUTE
Definition Common.h:47
DatabaseWorkerPool< LoginDatabaseConnection > LoginDatabase
Accessor to the realm/login database.
Definition DatabaseEnv.cpp:22
std::int64_t int64
Definition Define.h:102
@ LANG_COMMAND_DISABLE_CHAT_DELAYED
Definition Language.h:333
@ LANG_YOUR_CHAT_DISABLED
Definition Language.h:346
@ LANG_COMMAND_MUTEMESSAGE_WORLD
Definition Language.h:1301
@ LANG_YOU_DISABLE_CHAT
Definition Language.h:347
@ LANG_CONSOLE
Definition Language.h:1095
@ LOGIN_UPD_MUTE_TIME
Definition LoginDatabase.h:72
@ LOGIN_INS_ACCOUNT_MUTE
Definition LoginDatabase.h:114
std::string secsToTimeString(uint64 timeInSecs, bool shortText)
Definition Util.cpp:73
uint32 TimeStringToSecs(const std::string &timestring)
Definition Util.cpp:163
@ CONFIG_SHOW_MUTE_IN_WORLD
Definition WorldConfig.h:91
#define sWorldSessionMgr
Definition WorldSessionMgr.h:108
Definition ObjectAccessor.h:41
std::unordered_map< ObjectGuid, T * > MapType
Definition ObjectAccessor.h:47
Acore::Types::is_default< T > SetData(const uint8 index, T value)
Definition PreparedStatement.h:77
Definition PreparedStatement.h:157
uint32 GetAccountId() const
Definition WorldSession.h:423
time_t m_muteTime
Definition WorldSession.h:556
AC_GAME_API std::string GetAcoreString(ChatHandler const *handler, AcoreStrings which)
Definition ChatCommandHelpers.cpp:27
Seconds GetGameTime()
Definition GameTime.cpp:38
HashMapHolder< Player >::MapType const & GetPlayers()
Definition ObjectAccessor.cpp:75

References CONFIG_SHOW_MUTE_IN_WORLD, Acore::ChatCommands::PlayerIdentifier::FromTarget(), WorldSession::GetAccountId(), ChatHandler::GetAcoreString(), GameTime::GetGameTime(), Object::GetGUID(), WorldSession::GetPlayerName(), ObjectAccessor::GetPlayers(), ChatHandler::GetSession(), Player::GetSession(), ChatHandler::HasLowerSecurity(), LANG_BAD_VALUE, LANG_COMMAND_DISABLE_CHAT_DELAYED, LANG_COMMAND_MUTEMESSAGE_WORLD, LANG_CONSOLE, LANG_NO_REASON, LANG_PLAYER_NOT_FOUND, LANG_YOU_DISABLE_CHAT, LANG_YOUR_CHAT_DISABLED, LOGIN_INS_ACCOUNT_MUTE, LOGIN_UPD_MUTE_TIME, LoginDatabase, WorldSession::m_muteTime, MINUTE, ChatHandler::playerLink(), ChatHandler::PSendSysMessage(), sCharacterCache, secsToTimeString(), ChatHandler::SendErrorMessage(), ChatHandler::SendWorldText(), PreparedStatementBase::SetData(), sWorld, sWorldSessionMgr, and TimeStringToSecs().

Referenced by GetCommands().

◆ HandleMuteInfoCommand()

static bool misc_commandscript::HandleMuteInfoCommand ( ChatHandler handler,
std::string  accountName 
)
inlinestatic
2636 {
2637 if (!Utf8ToUpperOnlyLatin(accountName))
2638 {
2639 handler->SendErrorMessage(LANG_ACCOUNT_NOT_EXIST, accountName);
2640 return false;
2641 }
2642
2643 uint32 accountId = AccountMgr::GetId(accountName);
2644 if (!accountId)
2645 {
2646 handler->PSendSysMessage(LANG_ACCOUNT_NOT_EXIST, accountName);
2647 return false;
2648 }
2649
2650 return HandleMuteInfoHelper(handler, accountId, accountName.c_str());
2651 }
@ LANG_ACCOUNT_NOT_EXIST
Definition Language.h:448
bool Utf8ToUpperOnlyLatin(std::string &utf8String)
Definition Util.cpp:532
static bool HandleMuteInfoHelper(ChatHandler *handler, uint32 accountId, char const *accountName)
Definition cs_misc.cpp:2654
uint32 GetId(std::string const &username)
Definition AccountMgr.cpp:236

References AccountMgr::GetId(), HandleMuteInfoHelper(), LANG_ACCOUNT_NOT_EXIST, ChatHandler::PSendSysMessage(), ChatHandler::SendErrorMessage(), and Utf8ToUpperOnlyLatin().

Referenced by GetCommands().

◆ HandleMuteInfoHelper()

static bool misc_commandscript::HandleMuteInfoHelper ( ChatHandler handler,
uint32  accountId,
char const *  accountName 
)
inlinestatic
2655 {
2657 stmt->SetData(0, accountId);
2658 PreparedQueryResult result = LoginDatabase.Query(stmt);
2659
2660 if (!result)
2661 {
2662 handler->PSendSysMessage(LANG_COMMAND_MUTEHISTORY_EMPTY, accountName);
2663 return true;
2664 }
2665
2666 handler->PSendSysMessage(LANG_COMMAND_MUTEHISTORY, accountName);
2667 do
2668 {
2669 Field* fields = result->Fetch();
2670 handler->PSendSysMessage(LANG_COMMAND_MUTEHISTORY_OUTPUT, Acore::Time::TimeToHumanReadable(Seconds(fields[0].Get<uint32>())), fields[1].Get<uint32>(), fields[2].Get<std::string>(), fields[3].Get<std::string>());
2671 } while (result->NextRow());
2672
2673 return true;
2674 }
std::shared_ptr< PreparedResultSet > PreparedQueryResult
Definition DatabaseEnvFwd.h:45
std::chrono::seconds Seconds
Seconds shorthand typedef.
Definition Duration.h:30
@ LANG_COMMAND_MUTEHISTORY_OUTPUT
Definition Language.h:1121
@ LANG_COMMAND_MUTEHISTORY_EMPTY
Definition Language.h:1120
@ LANG_COMMAND_MUTEHISTORY
Definition Language.h:1119
@ LOGIN_SEL_ACCOUNT_MUTE_INFO
Definition LoginDatabase.h:115
Class used to access individual fields of database query result.
Definition Field.h:98
AC_COMMON_API std::string TimeToHumanReadable(Seconds time=0s, std::string_view fmt={})
Definition Timer.cpp:287

References LANG_COMMAND_MUTEHISTORY, LANG_COMMAND_MUTEHISTORY_EMPTY, LANG_COMMAND_MUTEHISTORY_OUTPUT, LOGIN_SEL_ACCOUNT_MUTE_INFO, LoginDatabase, ChatHandler::PSendSysMessage(), PreparedStatementBase::SetData(), and Acore::Time::TimeToHumanReadable().

Referenced by HandleMuteInfoCommand().

◆ HandleNearGraveCommand()

static bool misc_commandscript::HandleNearGraveCommand ( ChatHandler handler,
Optional< std::string_view >  team 
)
inlinestatic
1583 {
1584 TeamId teamId;
1585
1586 if (!team)
1587 {
1588 teamId = TEAM_NEUTRAL;
1589 }
1590 else if (StringEqualI(team->substr(0, 6), "horde"))
1591 {
1592 teamId = TEAM_HORDE;
1593 }
1594 else if (StringEqualI(team->substr(0, 9), "alliance"))
1595 {
1596 teamId = TEAM_ALLIANCE;
1597 }
1598 else
1599 {
1600 return false;
1601 }
1602
1603 Player* player = handler->GetSession()->GetPlayer();
1604 uint32 zone_id = player->GetZoneId();
1605
1606 GraveyardStruct const* graveyard = sGraveyard->GetClosestGraveyard(player, teamId);
1607
1608 if (graveyard)
1609 {
1610 uint32 graveyardId = graveyard->ID;
1611
1612 GraveyardData const* data = sGraveyard->FindGraveyardData(graveyardId, zone_id);
1613 if (!data)
1614 {
1615 handler->SendErrorMessage(LANG_COMMAND_GRAVEYARDERROR, graveyardId);
1616 return false;
1617 }
1618
1619 std::string team_name = handler->GetAcoreString(LANG_COMMAND_GRAVEYARD_NOTEAM);
1620
1621 if (data->teamId == TEAM_NEUTRAL)
1622 {
1623 team_name = handler->GetAcoreString(LANG_COMMAND_GRAVEYARD_ANY);
1624 }
1625 else if (data->teamId == TEAM_HORDE)
1626 {
1627 team_name = handler->GetAcoreString(LANG_COMMAND_GRAVEYARD_HORDE);
1628 }
1629 else if (data->teamId == TEAM_ALLIANCE)
1630 {
1631 team_name = handler->GetAcoreString(LANG_COMMAND_GRAVEYARD_ALLIANCE);
1632 }
1633
1634 handler->PSendSysMessage(LANG_COMMAND_GRAVEYARDNEAREST, graveyardId, team_name, zone_id);
1635 }
1636 else
1637 {
1638 std::string team_name;
1639
1640 if (teamId == TEAM_NEUTRAL)
1641 {
1642 team_name = handler->GetAcoreString(LANG_COMMAND_GRAVEYARD_ANY);
1643 }
1644 else if (teamId == TEAM_HORDE)
1645 {
1646 team_name = handler->GetAcoreString(LANG_COMMAND_GRAVEYARD_HORDE);
1647 }
1648 else if (teamId == TEAM_ALLIANCE)
1649 {
1650 team_name = handler->GetAcoreString(LANG_COMMAND_GRAVEYARD_ALLIANCE);
1651 }
1652
1653 handler->PSendSysMessage(LANG_COMMAND_ZONENOGRAFACTION, zone_id, team_name);
1654 }
1655
1656 return true;
1657 }
@ LANG_COMMAND_GRAVEYARD_ALLIANCE
Definition Language.h:495
@ LANG_COMMAND_ZONENOGRAFACTION
Definition Language.h:499
@ LANG_COMMAND_GRAVEYARDNEAREST
Definition Language.h:497
@ LANG_COMMAND_GRAVEYARD_NOTEAM
Definition Language.h:493
@ LANG_COMMAND_GRAVEYARDERROR
Definition Language.h:492
@ LANG_COMMAND_GRAVEYARD_HORDE
Definition Language.h:496
@ LANG_COMMAND_GRAVEYARD_ANY
Definition Language.h:494
Definition GameGraveyard.h:38
TeamId teamId
Definition GameGraveyard.h:40
uint32 ID
Definition GameGraveyard.h:28

References ChatHandler::GetAcoreString(), WorldSession::GetPlayer(), ChatHandler::GetSession(), WorldObject::GetZoneId(), GraveyardStruct::ID, LANG_COMMAND_GRAVEYARD_ALLIANCE, LANG_COMMAND_GRAVEYARD_ANY, LANG_COMMAND_GRAVEYARD_HORDE, LANG_COMMAND_GRAVEYARD_NOTEAM, LANG_COMMAND_GRAVEYARDERROR, LANG_COMMAND_GRAVEYARDNEAREST, LANG_COMMAND_ZONENOGRAFACTION, ChatHandler::PSendSysMessage(), ChatHandler::SendErrorMessage(), sGraveyard, StringEqualI(), TEAM_ALLIANCE, TEAM_HORDE, TEAM_NEUTRAL, and GraveyardData::teamId.

Referenced by GetCommands().

◆ HandleOpenDoorCommand()

static bool misc_commandscript::HandleOpenDoorCommand ( ChatHandler handler,
Optional< float >  range 
)
inlinestatic
3059 {
3060 if (GameObject* go = handler->GetPlayer()->FindNearestGameObjectOfType(GAMEOBJECT_TYPE_DOOR, range ? *range : 5.0f))
3061 {
3062 go->SetGoState(GO_STATE_ACTIVE);
3063 handler->PSendSysMessage(LANG_CMD_DOOR_OPENED, go->GetName(), go->GetEntry());
3064 return true;
3065 }
3066
3067 handler->SendErrorMessage(LANG_CMD_NO_DOOR_FOUND, range ? *range : 5.0f);
3068 return false;
3069 }
@ GO_STATE_ACTIVE
Definition GameObjectData.h:691
@ LANG_CMD_NO_DOOR_FOUND
Definition Language.h:1157
@ LANG_CMD_DOOR_OPENED
Definition Language.h:1158
@ GAMEOBJECT_TYPE_DOOR
Definition SharedDefines.h:1571
Player * GetPlayer() const
Definition Chat.cpp:36
Definition GameObject.h:120
GameObject * FindNearestGameObjectOfType(GameobjectTypes type, float range) const
Definition Object.cpp:2468

References WorldObject::FindNearestGameObjectOfType(), GAMEOBJECT_TYPE_DOOR, ChatHandler::GetPlayer(), GO_STATE_ACTIVE, LANG_CMD_DOOR_OPENED, LANG_CMD_NO_DOOR_FOUND, ChatHandler::PSendSysMessage(), and ChatHandler::SendErrorMessage().

Referenced by GetCommands().

◆ HandlePacketLog()

static bool misc_commandscript::HandlePacketLog ( ChatHandler handler,
Optional< bool >  enableArg 
)
inlinestatic
3113 {
3114 WorldSession* session = handler->GetSession();
3115
3116 if (!session)
3117 return false;
3118
3119 if (enableArg)
3120 {
3121 if (*enableArg)
3122 {
3123 session->SetPacketLogging(true);
3124 handler->SendNotification(LANG_ON);
3125 return true;
3126 }
3127 else
3128 {
3129 session->SetPacketLogging(false);
3130 handler->SendNotification(LANG_OFF);
3131 return true;
3132 }
3133 }
3134
3136 return false;
3137 }
@ LANG_OFF
Definition Language.h:71
@ LANG_ON
Definition Language.h:70
void SetPacketLogging(bool state)
Definition WorldSession.cpp:1514

References ChatHandler::GetSession(), LANG_OFF, LANG_ON, LANG_USE_BOL, ChatHandler::SendErrorMessage(), ChatHandler::SendNotification(), and WorldSession::SetPacketLogging().

Referenced by GetCommands().

◆ HandlePInfoCommand()

static bool misc_commandscript::HandlePInfoCommand ( ChatHandler handler,
Optional< PlayerIdentifier target 
)
inlinestatic
1967 {
1968 if (!target)
1969 {
1970 target = PlayerIdentifier::FromTargetOrSelf(handler);
1971 }
1972
1973 if (!target)
1974 {
1975 return false;
1976 }
1977
1978 Player* playerTarget = target->GetConnectedPlayer();
1979
1980 CharacterDatabasePreparedStatement* stmt = nullptr;
1981 LoginDatabasePreparedStatement* loginStmt = nullptr;
1982
1983 // Account data print variables
1984 std::string userName = handler->GetAcoreString(LANG_ERROR);
1985 ObjectGuid::LowType lowguid = target->GetGUID().GetCounter();
1986 uint32 accId = 0;
1987 std::string eMail = handler->GetAcoreString(LANG_ERROR);
1988 std::string regMail = handler->GetAcoreString(LANG_ERROR);
1989 uint32 security = 0;
1990 std::string lastIp = handler->GetAcoreString(LANG_ERROR);
1991 uint8 locked = 0;
1992 std::string lastLogin = handler->GetAcoreString(LANG_ERROR);
1993 uint32 failedLogins = 0;
1994 uint32 latency = 0;
1995 std::string OS = handler->GetAcoreString(LANG_UNKNOWN);
1996
1997 // Mute data print variables
1998 int64 muteTime = -1;
1999 std::string muteReason = handler->GetAcoreString(LANG_NO_REASON);
2000 std::string muteBy = handler->GetAcoreString(LANG_UNKNOWN);
2001
2002 // Ban data print variables
2003 int64 banTime = -1;
2004 std::string banType = handler->GetAcoreString(LANG_UNKNOWN);
2005 std::string banReason = handler->GetAcoreString(LANG_NO_REASON);
2006 std::string bannedBy = handler->GetAcoreString(LANG_UNKNOWN);
2007
2008 // Character data print variables
2009 uint8 raceid, classid = 0; //RACE_NONE, CLASS_NONE
2010 std::string raceStr, classStr = handler->GetAcoreString(LANG_UNKNOWN);
2011 uint8 gender = 0;
2012 int8 locale = handler->GetSessionDbcLocale();
2013 uint32 totalPlayerTime = 0;
2014 uint8 level = 0;
2015 std::string alive = handler->GetAcoreString(LANG_ERROR);
2016 uint32 money = 0;
2017 uint32 xp = 0;
2018 uint32 xptotal = 0;
2019
2020 // Position data print
2021 uint32 mapId;
2022 uint32 areaId;
2023 uint32 phase = 0;
2024 std::string areaName = "";
2025 std::string zoneName = "";
2026
2027 // Guild data print variables defined so that they exist, but are not necessarily used
2028 uint32 guildId = 0;
2029 uint8 guildRankId = 0;
2030 std::string guildName;
2031 std::string guildRank;
2032 std::string note;
2033 std::string officeNote;
2034
2035 // get additional information from Player object
2036 if (playerTarget)
2037 {
2038 // check online security
2039 if (handler->HasLowerSecurity(playerTarget))
2040 {
2041 return false;
2042 }
2043
2044 accId = playerTarget->GetSession()->GetAccountId();
2045 money = playerTarget->GetMoney();
2046 totalPlayerTime = playerTarget->GetTotalPlayedTime();
2047 level = playerTarget->GetLevel();
2048 latency = playerTarget->GetSession()->GetLatency();
2049 raceid = playerTarget->getRace();
2050 classid = playerTarget->getClass();
2051 muteTime = playerTarget->GetSession()->m_muteTime;
2052 mapId = playerTarget->GetMapId();
2053 areaId = playerTarget->GetAreaId();
2054 alive = playerTarget->IsAlive() ? handler->GetAcoreString(LANG_YES) : handler->GetAcoreString(LANG_NO);
2055 gender = playerTarget->getGender();
2056 phase = playerTarget->GetPhaseMask();
2057 }
2058 // get additional information from DB
2059 else
2060 {
2061 // check offline security
2062 if (handler->HasLowerSecurity(nullptr, target->GetGUID()))
2063 {
2064 return false;
2065 }
2066
2067 // Query informations from the DB
2068 stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHAR_PINFO);
2069 stmt->SetData(0, lowguid);
2070 PreparedQueryResult charInfoResult = CharacterDatabase.Query(stmt);
2071
2072 if (!charInfoResult)
2073 {
2074 return false;
2075 }
2076
2077 Field* fields = charInfoResult->Fetch();
2078 totalPlayerTime = fields[0].Get<uint32>();
2079 level = fields[1].Get<uint8>();
2080 money = fields[2].Get<uint32>();
2081 accId = fields[3].Get<uint32>();
2082 raceid = fields[4].Get<uint8>();
2083 classid = fields[5].Get<uint8>();
2084 mapId = fields[6].Get<uint16>();
2085 areaId = fields[7].Get<uint16>();
2086 gender = fields[8].Get<uint8>();
2087 uint32 health = fields[9].Get<uint32>();
2088 uint32 playerFlags = fields[10].Get<uint32>();
2089
2090 if (!health || playerFlags & PLAYER_FLAGS_GHOST)
2091 {
2092 alive = handler->GetAcoreString(LANG_NO);
2093 }
2094 else
2095 {
2096 alive = handler->GetAcoreString(LANG_YES);
2097 }
2098 }
2099
2100 // Query the prepared statement for login data
2101 loginStmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_PINFO);
2102 loginStmt->SetData(0, int32(realm.Id.Realm));
2103 loginStmt->SetData(1, accId);
2104
2105 PreparedQueryResult accInfoResult = LoginDatabase.Query(loginStmt);
2106 if (accInfoResult)
2107 {
2108 Field* fields = accInfoResult->Fetch();
2109 userName = fields[0].Get<std::string>();
2110 security = fields[1].Get<uint8>();
2111
2112 // Only fetch these fields if commander has sufficient rights)
2113 if (!handler->GetSession() || handler->GetSession()->GetSecurity() >= AccountTypes(security))
2114 {
2115 eMail = fields[2].Get<std::string>();
2116 regMail = fields[3].Get<std::string>();
2117 lastIp = fields[4].Get<std::string>();
2118 lastLogin = fields[5].Get<std::string>();
2119
2120 if (IpLocationRecord const* location = sIPLocation->GetLocationRecord(lastIp))
2121 {
2122 lastIp.append(" (");
2123 lastIp.append(location->CountryName);
2124 lastIp.append(")");
2125 }
2126 }
2127 else
2128 {
2129 eMail = handler->GetAcoreString(LANG_UNAUTHORIZED);
2130 regMail = handler->GetAcoreString(LANG_UNAUTHORIZED);
2131 lastIp = handler->GetAcoreString(LANG_UNAUTHORIZED);
2132 lastLogin = handler->GetAcoreString(LANG_UNAUTHORIZED);
2133 }
2134
2135 muteTime = fields[6].Get<uint64>();
2136 muteReason = fields[7].Get<std::string>();
2137 muteBy = fields[8].Get<std::string>();
2138 failedLogins = fields[9].Get<uint32>();
2139 locked = fields[10].Get<uint8>();
2140 OS = fields[11].Get<std::string>();
2141 }
2142
2143 // Creates a chat link to the character. Returns nameLink
2144 std::string nameLink = handler->playerLink(target->GetName());
2145
2146 // Returns banType, banTime, bannedBy, banreason
2147 LoginDatabasePreparedStatement* banQuery = LoginDatabase.GetPreparedStatement(LOGIN_SEL_PINFO_BANS);
2148 banQuery->SetData(0, accId);
2149
2150 PreparedQueryResult accBannedResult = LoginDatabase.Query(banQuery);
2151 if (!accBannedResult)
2152 {
2153 banType = handler->GetAcoreString(LANG_CHARACTER);
2154 stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_PINFO_BANS);
2155 stmt->SetData(0, lowguid);
2156 accBannedResult = CharacterDatabase.Query(stmt);
2157 }
2158
2159 if (accBannedResult)
2160 {
2161 Field* fields = accBannedResult->Fetch();
2162 banTime = int64(fields[1].Get<uint64>() ? 0 : fields[0].Get<uint32>());
2163 bannedBy = fields[2].Get<std::string>();
2164 banReason = fields[3].Get<std::string>();
2165 }
2166
2167 // Can be used to query data from World database
2168 WorldDatabasePreparedStatement* xpQuery = WorldDatabase.GetPreparedStatement(WORLD_SEL_REQ_XP);
2169 xpQuery->SetData(0, level);
2170
2171 PreparedQueryResult xpResult = WorldDatabase.Query(xpQuery);
2172 if (xpResult)
2173 {
2174 Field* fields = xpResult->Fetch();
2175 xptotal = fields[0].Get<uint32>();
2176 }
2177
2178 // Can be used to query data from Characters database
2179 CharacterDatabasePreparedStatement* charXpQuery = CharacterDatabase.GetPreparedStatement(CHAR_SEL_PINFO_XP);
2180 charXpQuery->SetData(0, lowguid);
2181
2182 PreparedQueryResult charXpResult = CharacterDatabase.Query(charXpQuery);
2183 if (charXpResult)
2184 {
2185 Field* fields = charXpResult->Fetch();
2186 xp = fields[0].Get<uint32>();
2187 ObjectGuid::LowType gguid = fields[1].Get<uint32>();
2188
2189 if (gguid != 0)
2190 {
2192 guildQuery->SetData(0, lowguid);
2193
2194 PreparedQueryResult guildInfoResult = CharacterDatabase.Query(guildQuery);
2195 if (guildInfoResult)
2196 {
2197 Field* guildInfoFields = guildInfoResult->Fetch();
2198 guildId = guildInfoFields[0].Get<uint32>();
2199 guildName = guildInfoFields[1].Get<std::string>();
2200 guildRank = guildInfoFields[2].Get<std::string>();
2201 note = guildInfoFields[3].Get<std::string>();
2202 officeNote = guildInfoFields[4].Get<std::string>();
2203 }
2204 }
2205 }
2206
2207 // Initiate output
2208 // Output I. LANG_PINFO_PLAYER
2209 handler->PSendSysMessage(LANG_PINFO_PLAYER, playerTarget ? "" : handler->GetAcoreString(LANG_OFFLINE), nameLink, target->GetGUID().ToString());
2210
2211 // Output II. LANG_PINFO_GM_ACTIVE if character is gamemaster
2212 if (playerTarget && playerTarget->IsGameMaster())
2213 {
2215 }
2216
2217 // Output III. LANG_PINFO_BANNED if ban exists and is applied
2218 if (banTime >= 0)
2219 {
2220 handler->PSendSysMessage(LANG_PINFO_BANNED, banType, banReason, banTime > 0 ? secsToTimeString(banTime - GameTime::GetGameTime().count(), true) : handler->GetAcoreString(LANG_PERMANENTLY), bannedBy);
2221 }
2222
2223 // Output IV. LANG_PINFO_MUTED if mute is applied
2224 if (muteTime > 0)
2225 {
2226 handler->PSendSysMessage(LANG_PINFO_MUTED, muteReason, secsToTimeString(muteTime - GameTime::GetGameTime().count(), true), muteBy);
2227 }
2228
2229 // Output V. LANG_PINFO_ACC_ACCOUNT
2230 handler->PSendSysMessage(LANG_PINFO_ACC_ACCOUNT, userName, accId, security);
2231
2232 if (playerTarget)
2233 {
2234 uint32 accountFlags = playerTarget->GetSession()->GetAccountFlags();
2236 for (uint8 i = 0; i < MAX_ACCOUNT_FLAG; i++)
2237 if (accountFlags & static_cast<uint32>(accountFlagText[i].flag))
2239 }
2240
2241 // Output VI. LANG_PINFO_ACC_LASTLOGIN
2242 handler->PSendSysMessage(LANG_PINFO_ACC_LASTLOGIN, lastLogin, failedLogins);
2243
2244 // Output VII. LANG_PINFO_ACC_OS
2245 handler->PSendSysMessage(LANG_PINFO_ACC_OS, OS, latency);
2246
2247 // Output VIII. LANG_PINFO_ACC_REGMAILS
2248 handler->PSendSysMessage(LANG_PINFO_ACC_REGMAILS, regMail, eMail);
2249
2250 // Output IX. LANG_PINFO_ACC_IP
2251 handler->PSendSysMessage(LANG_PINFO_ACC_IP, lastIp, locked ? handler->GetAcoreString(LANG_YES) : handler->GetAcoreString(LANG_NO));
2252
2253 // Output X. LANG_PINFO_CHR_LEVEL
2254 if (level != sWorld->getIntConfig(CONFIG_MAX_PLAYER_LEVEL))
2255 {
2256 handler->PSendSysMessage(LANG_PINFO_CHR_LEVEL_LOW, level, xp, xptotal, (xptotal - xp));
2257 }
2258 else
2259 {
2261 }
2262
2263 // Output XI. LANG_PINFO_CHR_RACE
2264 switch (raceid)
2265 {
2266 case RACE_HUMAN:
2267 raceStr = "Human";
2268 break;
2269 case RACE_ORC:
2270 raceStr = "Orc";
2271 break;
2272 case RACE_DWARF:
2273 raceStr = "Dwarf";
2274 break;
2275 case RACE_NIGHTELF:
2276 raceStr = "Night Elf";
2277 break;
2278 case RACE_UNDEAD_PLAYER:
2279 raceStr = "Undead";
2280 break;
2281 case RACE_TAUREN:
2282 raceStr = "Tauren";
2283 break;
2284 case RACE_GNOME:
2285 raceStr = "Gnome";
2286 break;
2287 case RACE_TROLL:
2288 raceStr = "Troll";
2289 break;
2290 case RACE_BLOODELF:
2291 raceStr = "Blood Elf";
2292 break;
2293 case RACE_DRAENEI:
2294 raceStr = "Draenei";
2295 break;
2296 }
2297
2298 switch (classid)
2299 {
2300 case CLASS_WARRIOR:
2301 classStr = "Warrior";
2302 break;
2303 case CLASS_PALADIN:
2304 classStr = "Paladin";
2305 break;
2306 case CLASS_HUNTER:
2307 classStr = "Hunter";
2308 break;
2309 case CLASS_ROGUE:
2310 classStr = "Rogue";
2311 break;
2312 case CLASS_PRIEST:
2313 classStr = "Priest";
2314 break;
2315 case CLASS_DEATH_KNIGHT:
2316 classStr = "Death Knight";
2317 break;
2318 case CLASS_SHAMAN:
2319 classStr = "Shaman";
2320 break;
2321 case CLASS_MAGE:
2322 classStr = "Mage";
2323 break;
2324 case CLASS_WARLOCK:
2325 classStr = "Warlock";
2326 break;
2327 case CLASS_DRUID:
2328 classStr = "Druid";
2329 break;
2330 }
2331
2332 handler->PSendSysMessage(LANG_PINFO_CHR_RACE, (gender == 0 ? handler->GetAcoreString(LANG_CHARACTER_GENDER_MALE) : handler->GetAcoreString(LANG_CHARACTER_GENDER_FEMALE)), raceStr, classStr);
2333
2334 // Output XII. LANG_PINFO_CHR_ALIVE
2335 handler->PSendSysMessage(LANG_PINFO_CHR_ALIVE, alive);
2336
2337 // Output XIII. LANG_PINFO_CHR_PHASE if player is not in GM mode (GM is in every phase)
2338 if (playerTarget && !playerTarget->IsGameMaster()) // IsInWorld() returns false on loadingscreen, so it's more
2339 {
2340 handler->PSendSysMessage(LANG_PINFO_CHR_PHASE, phase); // precise than just target (safer ?).
2341 }
2342
2343 // However, as we usually just require a target here, we use target instead.
2344 // Output XIV. LANG_PINFO_CHR_MONEY
2345 uint32 gold = money / GOLD;
2346 uint32 silv = (money % GOLD) / SILVER;
2347 uint32 copp = (money % GOLD) % SILVER;
2348 handler->PSendSysMessage(LANG_PINFO_CHR_MONEY, gold, silv, copp);
2349
2350 // Position data
2351 MapEntry const* map = sMapStore.LookupEntry(mapId);
2352 AreaTableEntry const* area = sAreaTableStore.LookupEntry(areaId);
2353
2354 if (area)
2355 {
2356 zoneName = area->area_name[locale];
2357
2358 AreaTableEntry const* zone = sAreaTableStore.LookupEntry(area->zone);
2359 if (zone)
2360 {
2361 areaName = zoneName;
2362 zoneName = zone->area_name[locale];
2363 }
2364 }
2365
2366 if (zoneName.empty())
2367 zoneName = handler->GetAcoreString(LANG_UNKNOWN);
2368
2369 if (!areaName.empty())
2370 handler->PSendSysMessage(LANG_PINFO_CHR_MAP_WITH_AREA, map->name[locale], zoneName, areaName);
2371 else
2372 handler->PSendSysMessage(LANG_PINFO_CHR_MAP, map->name[locale], zoneName);
2373
2374 // Output XVII. - XVIX. if they are not empty
2375 if (!guildName.empty())
2376 {
2377 handler->PSendSysMessage(LANG_PINFO_CHR_GUILD, guildName, guildId);
2378 handler->PSendSysMessage(LANG_PINFO_CHR_GUILD_RANK, guildRank, uint32(guildRankId));
2379
2380 if (!note.empty())
2381 {
2383 }
2384
2385 if (!officeNote.empty())
2386 {
2387 handler->PSendSysMessage(LANG_PINFO_CHR_GUILD_ONOTE, officeNote);
2388 }
2389 }
2390
2391 // Output XX. LANG_PINFO_CHR_PLAYEDTIME
2392 handler->PSendSysMessage(LANG_PINFO_CHR_PLAYEDTIME, (secsToTimeString(totalPlayerTime, true)));
2393
2394 // Mail Data - an own query, because it may or may not be useful.
2395 // SQL: "SELECT SUM(CASE WHEN (checked & 1) THEN 1 ELSE 0 END) AS 'readmail', COUNT(*) AS 'totalmail' FROM mail WHERE `receiver` = ?"
2397 mailQuery->SetData(0, lowguid);
2398
2399 PreparedQueryResult mailInfoResult = CharacterDatabase.Query(mailQuery);
2400 if (mailInfoResult)
2401 {
2402 Field* fields = mailInfoResult->Fetch();
2403 uint32 readmail = uint32(fields[0].Get<double>());
2404 uint32 totalmail = uint32(fields[1].Get<uint64>());
2405
2406 // Output XXI. LANG_INFO_CHR_MAILS if at least one mail is given
2407 if (totalmail >= 1)
2408 {
2409 handler->PSendSysMessage(LANG_PINFO_CHR_MAILS, readmail, totalmail);
2410 }
2411 }
2412
2413 return true;
2414 }
@ CHAR_SEL_PINFO_XP
Definition CharacterDatabase.h:338
@ CHAR_SEL_GUILD_MEMBER_EXTENDED
Definition CharacterDatabase.h:146
@ CHAR_SEL_CHAR_PINFO
Definition CharacterDatabase.h:337
@ CHAR_SEL_PINFO_MAILS
Definition CharacterDatabase.h:339
@ CHAR_SEL_PINFO_BANS
Definition CharacterDatabase.h:340
#define MAX_ACCOUNT_FLAG
Definition Common.h:64
AccountTypes
Definition Common.h:56
DatabaseWorkerPool< CharacterDatabaseConnection > CharacterDatabase
Accessor to the character database.
Definition DatabaseEnv.cpp:21
DatabaseWorkerPool< WorldDatabaseConnection > WorldDatabase
Accessor to the world database.
Definition DatabaseEnv.cpp:20
std::int8_t int8
Definition Define.h:105
std::uint64_t uint64
Definition Define.h:106
std::uint16_t uint16
Definition Define.h:108
#define sIPLocation
Definition IPLocation.h:49
@ LANG_YES
Definition Language.h:457
@ LANG_CHARACTER_GENDER_FEMALE
Definition Language.h:818
@ LANG_PINFO_CHR_GUILD_NOTE
Definition Language.h:808
@ LANG_PINFO_CHR_ALIVE
Definition Language.h:802
@ LANG_PINFO_ACC_LASTLOGIN
Definition Language.h:796
@ LANG_CHARACTER
Definition Language.h:1096
@ LANG_UNKNOWN
Definition Language.h:77
@ LANG_PINFO_CHR_PHASE
Definition Language.h:803
@ LANG_ERROR
Definition Language.h:78
@ LANG_PERMANENTLY
Definition Language.h:1097
@ LANG_OFFLINE
Definition Language.h:69
@ LANG_PINFO_CHR_LEVEL_LOW
Definition Language.h:800
@ LANG_PINFO_CHR_PLAYEDTIME
Definition Language.h:810
@ LANG_UNAUTHORIZED
Definition Language.h:814
@ LANG_SUBCMDS_LIST_ENTRY
Definition Language.h:230
@ LANG_PINFO_CHR_RACE
Definition Language.h:801
@ LANG_PINFO_CHR_MAP_WITH_AREA
Definition Language.h:815
@ LANG_PINFO_PLAYER
Definition Language.h:791
@ LANG_PINFO_ACC_OS
Definition Language.h:797
@ LANG_CHARACTER_GENDER_MALE
Definition Language.h:817
@ LANG_PINFO_CHR_MONEY
Definition Language.h:804
@ LANG_PINFO_CHR_LEVEL_HIGH
Definition Language.h:812
@ LANG_NO
Definition Language.h:458
@ LANG_PINFO_CHR_MAP
Definition Language.h:805
@ LANG_PINFO_ACC_IP
Definition Language.h:799
@ LANG_PINFO_BANNED
Definition Language.h:793
@ LANG_PINFO_CHR_GUILD_RANK
Definition Language.h:807
@ LANG_PINFO_ACC_ACCOUNT
Definition Language.h:795
@ LANG_PINFO_ACC_REGMAILS
Definition Language.h:798
@ LANG_PINFO_GM_ACTIVE
Definition Language.h:792
@ LANG_PINFO_CHR_MAILS
Definition Language.h:811
@ LANG_PINFO_CHR_GUILD
Definition Language.h:806
@ LANG_ACCOUNT_FLAGS_PINFO
Definition Language.h:221
@ LANG_PINFO_CHR_GUILD_ONOTE
Definition Language.h:809
@ LANG_PINFO_MUTED
Definition Language.h:794
@ LOGIN_SEL_PINFO
Definition LoginDatabase.h:90
@ LOGIN_SEL_PINFO_BANS
Definition LoginDatabase.h:91
@ PLAYER_FLAGS_GHOST
Definition Player.h:472
@ CLASS_HUNTER
Definition SharedDefines.h:143
@ CLASS_DRUID
Definition SharedDefines.h:151
@ CLASS_SHAMAN
Definition SharedDefines.h:147
@ CLASS_PRIEST
Definition SharedDefines.h:145
@ CLASS_WARRIOR
Definition SharedDefines.h:141
@ CLASS_WARLOCK
Definition SharedDefines.h:149
@ CLASS_MAGE
Definition SharedDefines.h:148
@ CLASS_DEATH_KNIGHT
Definition SharedDefines.h:146
@ CLASS_PALADIN
Definition SharedDefines.h:142
@ CLASS_ROGUE
Definition SharedDefines.h:144
@ SILVER
Definition SharedDefines.h:263
@ GOLD
Definition SharedDefines.h:264
@ RACE_TROLL
Definition SharedDefines.h:78
@ RACE_UNDEAD_PLAYER
Definition SharedDefines.h:75
@ RACE_ORC
Definition SharedDefines.h:72
@ RACE_DRAENEI
Definition SharedDefines.h:81
@ RACE_NIGHTELF
Definition SharedDefines.h:74
@ RACE_BLOODELF
Definition SharedDefines.h:80
@ RACE_DWARF
Definition SharedDefines.h:73
@ RACE_GNOME
Definition SharedDefines.h:77
@ RACE_HUMAN
Definition SharedDefines.h:71
@ RACE_TAUREN
Definition SharedDefines.h:76
@ CONFIG_MAX_PLAYER_LEVEL
Definition WorldConfig.h:189
@ WORLD_SEL_REQ_XP
Definition WorldDatabase.h:117
phase
Definition boss_skadi.cpp:99
std::enable_if_t< std::is_arithmetic_v< T >, T > Get() const
Definition Field.h:112
uint32 LowType
Definition ObjectGuid.h:122
uint32 GetTotalPlayedTime()
Definition Player.h:1192
uint32 GetMoney() const
Definition Player.h:1603
uint8 getGender() const
Definition Unit.h:831
uint8 getClass() const
Definition Unit.h:826
uint8 getRace(bool original=false) const
Definition Unit.cpp:20883
uint8 GetLevel() const
Definition Unit.h:1065
uint32 GetPhaseMask() const
Definition Object.h:513
uint32 GetAreaId() const
Definition Object.cpp:3071
uint32 GetAccountFlags() const
Definition WorldSession.h:374
uint32 GetLatency() const
Definition WorldSession.h:564
AccountFlagText const accountFlagText[MAX_ACCOUNT_FLAG]
Definition cs_misc.cpp:67
Realm realm
Definition World.cpp:111
char const * area_name[16]
Definition DBCStructure.h:527
Definition IPLocation.h:23
uint32 Realm
Definition Realm.h:43
RealmHandle Id
Definition Realm.h:69

References accountFlagText, AreaTableEntry::area_name, CHAR_SEL_CHAR_PINFO, CHAR_SEL_GUILD_MEMBER_EXTENDED, CHAR_SEL_PINFO_BANS, CHAR_SEL_PINFO_MAILS, CHAR_SEL_PINFO_XP, CharacterDatabase, CLASS_DEATH_KNIGHT, CLASS_DRUID, CLASS_HUNTER, CLASS_MAGE, CLASS_PALADIN, CLASS_PRIEST, CLASS_ROGUE, CLASS_SHAMAN, CLASS_WARLOCK, CLASS_WARRIOR, CONFIG_MAX_PLAYER_LEVEL, Acore::ChatCommands::PlayerIdentifier::FromTargetOrSelf(), Field::Get(), WorldSession::GetAccountFlags(), WorldSession::GetAccountId(), ChatHandler::GetAcoreString(), WorldObject::GetAreaId(), Unit::getClass(), GameTime::GetGameTime(), Unit::getGender(), WorldSession::GetLatency(), Unit::GetLevel(), WorldLocation::GetMapId(), Player::GetMoney(), WorldObject::GetPhaseMask(), Unit::getRace(), WorldSession::GetSecurity(), ChatHandler::GetSession(), Player::GetSession(), ChatHandler::GetSessionDbcLocale(), Player::GetTotalPlayedTime(), GOLD, ChatHandler::HasLowerSecurity(), Realm::Id, Unit::IsAlive(), Player::IsGameMaster(), LANG_ACCOUNT_FLAGS_PINFO, LANG_CHARACTER, LANG_CHARACTER_GENDER_FEMALE, LANG_CHARACTER_GENDER_MALE, LANG_ERROR, LANG_NO, LANG_NO_REASON, LANG_OFFLINE, LANG_PERMANENTLY, LANG_PINFO_ACC_ACCOUNT, LANG_PINFO_ACC_IP, LANG_PINFO_ACC_LASTLOGIN, LANG_PINFO_ACC_OS, LANG_PINFO_ACC_REGMAILS, LANG_PINFO_BANNED, LANG_PINFO_CHR_ALIVE, LANG_PINFO_CHR_GUILD, LANG_PINFO_CHR_GUILD_NOTE, LANG_PINFO_CHR_GUILD_ONOTE, LANG_PINFO_CHR_GUILD_RANK, LANG_PINFO_CHR_LEVEL_HIGH, LANG_PINFO_CHR_LEVEL_LOW, LANG_PINFO_CHR_MAILS, LANG_PINFO_CHR_MAP, LANG_PINFO_CHR_MAP_WITH_AREA, LANG_PINFO_CHR_MONEY, LANG_PINFO_CHR_PHASE, LANG_PINFO_CHR_PLAYEDTIME, LANG_PINFO_CHR_RACE, LANG_PINFO_GM_ACTIVE, LANG_PINFO_MUTED, LANG_PINFO_PLAYER, LANG_SUBCMDS_LIST_ENTRY, LANG_UNAUTHORIZED, LANG_UNKNOWN, LANG_YES, LOGIN_SEL_PINFO, LOGIN_SEL_PINFO_BANS, LoginDatabase, WorldSession::m_muteTime, MAX_ACCOUNT_FLAG, MapEntry::name, PLAYER_FLAGS_GHOST, ChatHandler::playerLink(), ChatHandler::PSendSysMessage(), RACE_BLOODELF, RACE_DRAENEI, RACE_DWARF, RACE_GNOME, RACE_HUMAN, RACE_NIGHTELF, RACE_ORC, RACE_TAUREN, RACE_TROLL, RACE_UNDEAD_PLAYER, realm, RealmHandle::Realm, sAreaTableStore, secsToTimeString(), PreparedStatementBase::SetData(), SILVER, sIPLocation, sMapStore, sWorld, AccountFlagText::text, WORLD_SEL_REQ_XP, WorldDatabase, and AreaTableEntry::zone.

Referenced by GetCommands().

◆ HandlePlayAllCommand()

static bool misc_commandscript::HandlePlayAllCommand ( ChatHandler handler,
uint32  soundId 
)
inlinestatic
2976 {
2977 if (!sSoundEntriesStore.LookupEntry(soundId))
2978 {
2979 handler->SendErrorMessage(LANG_SOUND_NOT_EXIST, soundId);
2980 return false;
2981 }
2982
2983 sWorldSessionMgr->SendGlobalMessage(WorldPackets::Misc::Playsound(soundId).Write());
2984
2986 return true;
2987 }
DBCStorage< SoundEntriesEntry > sSoundEntriesStore(SoundEntriesfmt)
@ LANG_COMMAND_PLAYED_TO_ALL
Definition Language.h:1064
@ LANG_SOUND_NOT_EXIST
Definition Language.h:211
Definition MiscPackets.h:85

References LANG_COMMAND_PLAYED_TO_ALL, LANG_SOUND_NOT_EXIST, ChatHandler::PSendSysMessage(), ChatHandler::SendErrorMessage(), sSoundEntriesStore, and sWorldSessionMgr.

Referenced by GetCommands().

◆ HandlePossessCommand()

static bool misc_commandscript::HandlePossessCommand ( ChatHandler handler)
inlinestatic
2990 {
2991 Unit* unit = handler->getSelectedUnit();
2992 if (!unit)
2993 {
2994 return false;
2995 }
2996
2997 handler->GetSession()->GetPlayer()->CastSpell(unit, MAP_OUTLAND, true);
2998 return true;
2999 }
@ MAP_OUTLAND
Definition AreaDefines.h:216

References Unit::CastSpell(), WorldSession::GetPlayer(), ChatHandler::getSelectedUnit(), ChatHandler::GetSession(), and MAP_OUTLAND.

Referenced by GetCommands().

◆ HandleRecallCommand()

static bool misc_commandscript::HandleRecallCommand ( ChatHandler handler,
Optional< PlayerIdentifier target 
)
inlinestatic
1332 {
1333 if (!target)
1334 {
1335 target = PlayerIdentifier::FromTargetOrSelf(handler);
1336 }
1337
1338 if (!target || !target->IsConnected())
1339 {
1340 return false;
1341 }
1342
1343 auto targetPlayer = target->GetConnectedPlayer();
1344
1345 // check online security
1346 if (handler->HasLowerSecurity(targetPlayer))
1347 {
1348 return false;
1349 }
1350
1351 if (targetPlayer->IsBeingTeleported())
1352 {
1353 handler->SendErrorMessage(LANG_IS_TELEPORTED, handler->playerLink(target->GetName()));
1354 return false;
1355 }
1356
1357 // stop flight if need
1358 if (targetPlayer->IsInFlight())
1359 {
1360 targetPlayer->GetMotionMaster()->MovementExpired();
1361 targetPlayer->CleanupAfterTaxiFlight();
1362 }
1363
1364 targetPlayer->TeleportTo(targetPlayer->m_recallMap, targetPlayer->m_recallX, targetPlayer->m_recallY, targetPlayer->m_recallZ, targetPlayer->m_recallO);
1365 return true;
1366 }

References Acore::ChatCommands::PlayerIdentifier::FromTargetOrSelf(), ChatHandler::HasLowerSecurity(), LANG_IS_TELEPORTED, ChatHandler::playerLink(), and ChatHandler::SendErrorMessage().

Referenced by GetCommands().

◆ HandleRespawnAllCommand()

static bool misc_commandscript::HandleRespawnAllCommand ( ChatHandler handler)
inlinestatic
2441 {
2442 Player* player = handler->GetSession()->GetPlayer();
2443
2444 Acore::RespawnDo u_do;
2445 Acore::WorldObjectWorker<Acore::RespawnDo> worker(player, u_do);
2446 Cell::VisitObjects(player, worker, player->GetGridActivationRange());
2447
2448 return true;
2449 }
Definition GridNotifiers.h:636
float GetGridActivationRange() const
Definition Object.cpp:1656
Definition GridNotifiers.h:251
static void VisitObjects(WorldObject const *obj, T &visitor, float radius)
Definition CellImpl.h:165

References WorldObject::GetGridActivationRange(), WorldSession::GetPlayer(), ChatHandler::GetSession(), and Cell::VisitObjects().

Referenced by GetCommands().

◆ HandleRespawnCommand()

static bool misc_commandscript::HandleRespawnCommand ( ChatHandler handler)
inlinestatic
2417 {
2418 Player* player = handler->GetSession()->GetPlayer();
2419
2420 Unit* target = handler->getSelectedUnit();
2421 if (player->GetTarget() && target)
2422 {
2423 if (!target->IsCreature() || target->IsPet())
2424 {
2426 return false;
2427 }
2428
2429 if (target->isDead())
2430 {
2431 target->ToCreature()->Respawn(true);
2432 }
2433 return true;
2434 }
2435
2437 return false;
2438 }
void Respawn(bool force=false)
Definition Creature.cpp:2043
bool IsPet() const
Definition Unit.h:780
bool isDead() const
Definition Unit.h:1750

References WorldSession::GetPlayer(), ChatHandler::getSelectedUnit(), ChatHandler::GetSession(), Unit::GetTarget(), Object::IsCreature(), Unit::isDead(), Unit::IsPet(), LANG_SELECT_CREATURE, Creature::Respawn(), ChatHandler::SendErrorMessage(), and Object::ToCreature().

Referenced by GetCommands().

◆ HandleReviveCommand()

static bool misc_commandscript::HandleReviveCommand ( ChatHandler handler,
Optional< PlayerIdentifier target 
)
inlinestatic
1199 {
1200 if (!target)
1201 target = PlayerIdentifier::FromTargetOrSelf(handler);
1202
1203 if (!target)
1204 return false;
1205
1206 if (target->IsConnected())
1207 {
1208 auto targetPlayer = target->GetConnectedPlayer();
1209 targetPlayer->RemoveAurasDueToSpell(27827); // Spirit of Redemption
1210 targetPlayer->ResurrectPlayer(!AccountMgr::IsPlayerAccount(targetPlayer->GetSession()->GetSecurity()) ? 1.0f : 0.5f);
1211 targetPlayer->SpawnCorpseBones();
1212 targetPlayer->SaveToDB(false, false);
1213 }
1214 else
1215 {
1216 CharacterDatabaseTransaction trans(nullptr);
1217 Player::OfflineResurrect(target->GetGUID(), trans);
1218 }
1219
1220 return true;
1221 }
SQLTransaction< CharacterDatabaseConnection > CharacterDatabaseTransaction
Definition DatabaseEnvFwd.h:69
static void OfflineResurrect(ObjectGuid const &guid, CharacterDatabaseTransaction trans)
Definition Player.cpp:4578

References Acore::ChatCommands::PlayerIdentifier::FromTargetOrSelf(), AccountMgr::IsPlayerAccount(), and Player::OfflineResurrect().

Referenced by GetCommands().

◆ HandleSaveAllCommand()

static bool misc_commandscript::HandleSaveAllCommand ( ChatHandler handler)
inlinestatic
1400 {
1403 return true;
1404 }
@ LANG_PLAYERS_SAVED
Definition Language.h:47
void SaveAllPlayers()
Definition ObjectAccessor.cpp:262

References LANG_PLAYERS_SAVED, ObjectAccessor::SaveAllPlayers(), and ChatHandler::SendSysMessage().

Referenced by GetCommands().

◆ HandleSaveCommand()

static bool misc_commandscript::HandleSaveCommand ( ChatHandler handler)
inlinestatic
1369 {
1370 Player* player = handler->GetSession()->GetPlayer();
1371
1372 // save GM account without delay and output message
1373 if (handler->GetSession()->GetSecurity() >= SEC_GAMEMASTER)
1374 {
1375 if (Player* target = handler->getSelectedPlayer())
1376 {
1377 target->SaveToDB(false, false);
1378 }
1379 else
1380 {
1381 player->SaveToDB(false, false);
1382 }
1383
1385 return true;
1386 }
1387
1388 // save if the player has last been saved over 20 seconds ago
1389 uint32 saveInterval = sWorld->getIntConfig(CONFIG_INTERVAL_SAVE);
1390 if (saveInterval == 0 || (saveInterval > 20 * IN_MILLISECONDS && player->GetSaveTimer() <= saveInterval - 20 * IN_MILLISECONDS))
1391 {
1392 player->SaveToDB(false, false);
1393 }
1394
1395 return true;
1396 }
constexpr auto IN_MILLISECONDS
Definition Common.h:53
@ LANG_PLAYER_SAVED
Definition Language.h:46
@ CONFIG_INTERVAL_SAVE
Definition WorldConfig.h:167
void SaveToDB(bool create, bool logout)
Definition PlayerStorage.cpp:7063
uint32 GetSaveTimer() const
Definition Player.h:2358

References CONFIG_INTERVAL_SAVE, WorldSession::GetPlayer(), Player::GetSaveTimer(), WorldSession::GetSecurity(), ChatHandler::getSelectedPlayer(), ChatHandler::GetSession(), IN_MILLISECONDS, LANG_PLAYER_SAVED, Player::SaveToDB(), SEC_GAMEMASTER, ChatHandler::SendSysMessage(), and sWorld.

Referenced by GetCommands().

◆ HandleSetSkillCommand()

static bool misc_commandscript::HandleSetSkillCommand ( ChatHandler handler,
Variant< Hyperlink< skill >, uint32 skillId,
int32  level,
Optional< uint16 maxPureSkill 
)
inlinestatic
1923 {
1924 uint32 skillID = uint32(skillId);
1925
1926 if (skillID <= 0)
1927 {
1928 handler->SendErrorMessage(LANG_INVALID_SKILL_ID, skillID);
1929 return false;
1930 }
1931
1932 Player* target = handler->getSelectedPlayer();
1933 if (!target)
1934 {
1936 return false;
1937 }
1938
1939 SkillLineEntry const* skillLine = sSkillLineStore.LookupEntry(skillID);
1940 if (!skillLine)
1941 {
1942 handler->SendErrorMessage(LANG_INVALID_SKILL_ID, uint32(skillID));
1943 return false;
1944 }
1945
1946 bool targetHasSkill = target->GetSkillValue(skillID);
1947
1948 // If our target does not yet have the skill they are trying to add to them, the chosen level also becomes
1949 // the max level of the new profession.
1950 uint16 max = maxPureSkill ? *maxPureSkill : targetHasSkill ? target->GetPureMaxSkillValue(skillID) : uint16(level);
1951
1952 if (level <= 0 || level > max || max <= 0)
1953 {
1954 return false;
1955 }
1956
1957 // If the player has the skill, we get the current skill step. If they don't have the skill, we
1958 // add the skill to the player's book with step 1 (which is the first rank, in most cases something
1959 // like 'Apprentice <skill>'.
1960 target->SetSkill(skillID, targetHasSkill ? target->GetSkillStep(skillID) : 1, level, max);
1961 handler->PSendSysMessage(LANG_SET_SKILL, skillID, skillLine->name[handler->GetSessionDbcLocale()], handler->GetNameLink(target), level, max);
1962 return true;
1963 }
DBCStorage< SkillLineEntry > sSkillLineStore(SkillLinefmt)
@ LANG_INVALID_SKILL_ID
Definition Language.h:531
@ LANG_SET_SKILL
Definition Language.h:528
uint16 GetSkillValue(uint32 skill) const
Definition Player.cpp:5445
uint16 GetSkillStep(uint16 skill) const
Definition Player.cpp:5433
uint16 GetPureMaxSkillValue(uint32 skill) const
Definition Player.cpp:5480
void SetSkill(uint16 id, uint16 step, uint16 currVal, uint16 maxVal)
Definition Player.cpp:5324
Definition DBCStructure.h:1584
char const * name[16]
Definition DBCStructure.h:1588

References ChatHandler::GetNameLink(), Player::GetPureMaxSkillValue(), ChatHandler::getSelectedPlayer(), ChatHandler::GetSessionDbcLocale(), Player::GetSkillStep(), Player::GetSkillValue(), LANG_INVALID_SKILL_ID, LANG_NO_CHAR_SELECTED, LANG_SET_SKILL, SkillLineEntry::name, ChatHandler::PSendSysMessage(), ChatHandler::SendErrorMessage(), Player::SetSkill(), and sSkillLineStore.

Referenced by GetCommands().

◆ HandleShowAreaCommand()

static bool misc_commandscript::HandleShowAreaCommand ( ChatHandler handler,
uint32  areaID 
)
inlinestatic
1660 {
1661 Player* playerTarget = handler->getSelectedPlayer();
1662 if (!playerTarget)
1663 {
1665 return false;
1666 }
1667
1668 AreaTableEntry const* area = sAreaTableStore.LookupEntry(areaID);
1669 if (!area)
1670 {
1672 return false;
1673 }
1674
1675 int32 offset = area->exploreFlag / 32;
1676 if (offset >= PLAYER_EXPLORED_ZONES_SIZE)
1677 {
1679 return false;
1680 }
1681
1682 uint32 val = uint32((1 << (area->exploreFlag % 32)));
1683 uint32 currFields = playerTarget->GetUInt32Value(PLAYER_EXPLORED_ZONES_1 + offset);
1684 playerTarget->SetUInt32Value(PLAYER_EXPLORED_ZONES_1 + offset, uint32((currFields | val)));
1685
1687 return true;
1688 }
@ LANG_EXPLORE_AREA
Definition Language.h:622

References AreaTableEntry::exploreFlag, ChatHandler::getSelectedPlayer(), Object::GetUInt32Value(), LANG_BAD_VALUE, LANG_EXPLORE_AREA, LANG_NO_CHAR_SELECTED, PLAYER_EXPLORED_ZONES_1, PLAYER_EXPLORED_ZONES_SIZE, sAreaTableStore, ChatHandler::SendErrorMessage(), ChatHandler::SendSysMessage(), and Unit::SetUInt32Value().

Referenced by GetCommands().

◆ HandleSkirmishCommand()

static bool misc_commandscript::HandleSkirmishCommand ( ChatHandler handler,
std::vector< std::string_view >  args 
)
inlinestatic
205 {
206 auto tokens = args;
207
208 if (args.empty() || !tokens.size())
209 {
210 handler->SetSentErrorMessage(true);
211 return false;
212 }
213
214 auto tokensItr = tokens.begin();
215
216 std::vector<BattlegroundTypeId> allowedArenas;
217 std::string_view arenasStr = *(tokensItr++);
218
219 auto arenaTokens = Acore::Tokenize(arenasStr, ',', false);
220 for (auto const& arenaName : arenaTokens)
221 {
222 if (arenaName == "all")
223 {
224 if (arenaTokens.size() > 1)
225 {
226 handler->SendErrorMessage("Invalid [arena] specified.");
227 return false;
228 }
229
230 allowedArenas.emplace_back(BATTLEGROUND_NA);
231 allowedArenas.emplace_back(BATTLEGROUND_BE);
232 allowedArenas.emplace_back(BATTLEGROUND_RL);
233 allowedArenas.emplace_back(BATTLEGROUND_DS);
234 allowedArenas.emplace_back(BATTLEGROUND_RV);
235 }
236 else if (arenaName == "NA")
237 {
238 allowedArenas.emplace_back(BATTLEGROUND_NA);
239 }
240 else if (arenaName == "BE")
241 {
242 allowedArenas.emplace_back(BATTLEGROUND_BE);
243 }
244 else if (arenaName == "RL")
245 {
246 allowedArenas.emplace_back(BATTLEGROUND_RL);
247 }
248 else if (arenaName == "DS")
249 {
250 allowedArenas.emplace_back(BATTLEGROUND_DS);
251 }
252 else if (arenaName == "RV")
253 {
254 allowedArenas.emplace_back(BATTLEGROUND_RV);
255 }
256 else
257 {
258 handler->SendErrorMessage("Invalid [arena] specified.");
259 return false;
260 }
261 }
262
263 ASSERT(!allowedArenas.empty());
264 BattlegroundTypeId randomizedArenaBgTypeId = Acore::Containers::SelectRandomContainerElement(allowedArenas);
265
266 uint8 count = 0;
267 if (tokensItr != tokens.end())
268 {
269 std::string_view mode = *(tokensItr++);
270
271 if (mode == "1v1")
272 {
273 count = 2;
274 }
275 else if (mode == "2v2")
276 {
277 count = 4;
278 }
279 else if (mode == "3v3")
280 {
281 count = 6;
282 }
283 else if (mode == "5v5")
284 {
285 count = 10;
286 }
287 }
288
289 if (!count)
290 {
291 handler->SendErrorMessage("Invalid bracket. Can be 1v1, 2v2, 3v3, 5v5");
292 return false;
293 }
294
295 if (tokens.size() != uint16(count + 2))
296 {
297 handler->SendErrorMessage("Invalid number of nicknames for this bracket.");
298 return false;
299 }
300
301 uint8 hcnt = count / 2;
302 uint8 error = 0;
303 std::string last_name;
304 Player* plr = nullptr;
305 std::array<Player*, 10> players = {};
306 uint8 cnt = 0;
307
308 for (; tokensItr != tokens.end(); ++tokensItr)
309 {
310 last_name = std::string(*tokensItr);
311 plr = ObjectAccessor::FindPlayerByName(last_name, false);
312
313 if (!plr)
314 {
315 error = 1;
316 break;
317 }
318
319 if (!plr->IsInWorld() || !plr->FindMap() || plr->IsBeingTeleported())
320 {
321 error = 2;
322 break;
323 }
324
325 if (plr->GetMap()->GetEntry()->Instanceable())
326 {
327 error = 3;
328 break;
329 }
330
331 if (plr->IsUsingLfg())
332 {
333 error = 4;
334 break;
335 }
336
337 if (plr->InBattlegroundQueue())
338 {
339 error = 5;
340 break;
341 }
342
343 if (plr->IsInFlight())
344 {
345 error = 10;
346 break;
347 }
348
349 if (!plr->IsAlive())
350 {
351 error = 11;
352 break;
353 }
354
355 const Group* g = plr->GetGroup();
356
357 if (hcnt > 1)
358 {
359 if (!g)
360 {
361 error = 6;
362 break;
363 }
364
365 if (g->isRaidGroup() || g->isBGGroup() || g->isBFGroup() || g->isLFGGroup())
366 {
367 error = 7;
368 break;
369 }
370
371 if (g->GetMembersCount() != hcnt)
372 {
373 error = 8;
374 break;
375 }
376
377 uint8 sti = (cnt < hcnt ? 0 : hcnt);
378 if (sti != cnt && players[sti]->GetGroup() != plr->GetGroup())
379 {
380 error = 9;
381 last_name += " and " + players[sti]->GetName();
382 break;
383 }
384 }
385 else // 1v1
386 {
387 if (g)
388 {
389 error = 12;
390 break;
391 }
392 }
393
394 players[cnt++] = plr;
395 }
396
397 for (uint8 i = 0; i < cnt && !error; ++i)
398 {
399 for (uint8 j = i + 1; j < cnt; ++j)
400 {
401 if (players[i]->GetGUID() == players[j]->GetGUID())
402 {
403 last_name = players[i]->GetName();
404 error = 13;
405 break;
406 }
407 }
408 }
409
410 switch (error)
411 {
412 case 1:
413 handler->PSendSysMessage("Player {} not found.", last_name);
414 break;
415 case 2:
416 handler->PSendSysMessage("Player {} is being teleported.", last_name);
417 break;
418 case 3:
419 handler->PSendSysMessage("Player {} is in instance/battleground/arena.", last_name);
420 break;
421 case 4:
422 handler->PSendSysMessage("Player {} is in LFG system.", last_name);
423 break;
424 case 5:
425 handler->PSendSysMessage("Player {} is queued for battleground/arena.", last_name);
426 break;
427 case 6:
428 handler->PSendSysMessage("Player {} is not in group.", last_name);
429 break;
430 case 7:
431 handler->PSendSysMessage("Player {} is not in normal group.", last_name);
432 break;
433 case 8:
434 handler->PSendSysMessage("Group of player {} has invalid member count.", last_name);
435 break;
436 case 9:
437 handler->PSendSysMessage("Players {} are not in the same group.", last_name);
438 break;
439 case 10:
440 handler->PSendSysMessage("Player {} is in flight.", last_name);
441 break;
442 case 11:
443 handler->PSendSysMessage("Player {} is dead.", last_name);
444 break;
445 case 12:
446 handler->PSendSysMessage("Player {} is in a group.", last_name);
447 break;
448 case 13:
449 handler->PSendSysMessage("Player {} occurs more than once.", last_name);
450 break;
451 }
452
453 if (error)
454 {
455 handler->SetSentErrorMessage(true);
456 return false;
457 }
458
459 Battleground* bgt = sBattlegroundMgr->GetBattlegroundTemplate(BATTLEGROUND_AA);
460 if (!bgt)
461 {
462 handler->SendErrorMessage("Couldn't create arena map!");
463 return false;
464 }
465
466 Battleground* bg = sBattlegroundMgr->CreateNewBattleground(randomizedArenaBgTypeId, GetBattlegroundBracketById(bgt->GetMapId(), bgt->GetBracketId()), ArenaType(hcnt >= 2 ? hcnt : 2), false);
467 if (!bg)
468 {
469 handler->SendErrorMessage("Couldn't create arena map!");
470 return false;
471 }
472
473 bg->StartBattleground();
474
475 BattlegroundTypeId bgTypeId = bg->GetBgTypeID();
476
477 TeamId teamId1 = Player::TeamIdForRace(players[0]->getRace());
478 TeamId teamId2 = (teamId1 == TEAM_ALLIANCE ? TEAM_HORDE : TEAM_ALLIANCE);
479
480 for (uint8 i = 0; i < cnt; ++i)
481 {
482 Player* player = players[i];
483
484 TeamId teamId = (i < hcnt ? teamId1 : teamId2);
485 player->SetEntryPoint();
486
487 uint32 queueSlot = 0;
488 WorldPacket data;
489 sBattlegroundMgr->BuildBattlegroundStatusPacket(&data, bg, queueSlot, STATUS_IN_PROGRESS, 0, bg->GetStartTime(), bg->GetArenaType(), teamId);
490 player->SendDirectMessage(&data);
491
492 // Remove from LFG queues
493 sLFGMgr->LeaveAllLfgQueues(player->GetGUID(), false);
494
495 player->SetBattlegroundId(bg->GetInstanceID(), bgTypeId, queueSlot, true, false, teamId);
496 sBattlegroundMgr->SendToBattleground(player, bg->GetInstanceID(), bgTypeId);
497 }
498
499 handler->PSendSysMessage("Success! Players are now being teleported to the arena.");
500 return true;
501 }
#define sBattlegroundMgr
Definition BattlegroundMgr.h:187
@ STATUS_IN_PROGRESS
Definition Battleground.h:193
ArenaType
Definition Battleground.h:207
PvPDifficultyEntry const * GetBattlegroundBracketById(uint32 mapid, BattlegroundBracketId id)
Definition DBCStores.cpp:815
#define ASSERT
Definition Errors.h:68
#define sLFGMgr
Definition LFGMgr.h:641
BattlegroundTypeId
Definition SharedDefines.h:3745
@ BATTLEGROUND_AA
Definition SharedDefines.h:3752
@ BATTLEGROUND_BE
Definition SharedDefines.h:3751
@ BATTLEGROUND_RV
Definition SharedDefines.h:3757
@ BATTLEGROUND_NA
Definition SharedDefines.h:3750
@ BATTLEGROUND_DS
Definition SharedDefines.h:3756
@ BATTLEGROUND_RL
Definition SharedDefines.h:3754
Definition Battleground.h:294
uint32 GetMapId() const
Definition Battleground.h:436
uint8 GetArenaType() const
Definition Battleground.h:348
void StartBattleground()
Definition Battleground.cpp:1143
uint32 GetInstanceID() const
Definition Battleground.h:322
uint32 GetStartTime() const
Definition Battleground.h:325
BattlegroundBracketId GetBracketId() const
Definition Battleground.h:321
BattlegroundTypeId GetBgTypeID(bool GetRandom=false) const
Definition Battleground.h:320
void SetSentErrorMessage(bool val)
Definition Chat.h:238
bool isLFGGroup(bool restricted=false) const
Definition Group.cpp:2275
bool isBGGroup() const
Definition Group.cpp:2286
uint32 GetMembersCount() const
Definition Group.h:245
bool isBFGroup() const
Definition Group.cpp:2291
bool isRaidGroup() const
Definition Group.cpp:2281
MapEntry const * GetEntry() const
Definition Map.h:170
bool IsInWorld() const
Definition Object.h:108
static TeamId TeamIdForRace(uint8 race)
Definition Player.cpp:5825
void SendDirectMessage(WorldPacket const *data) const
Definition Player.cpp:5687
bool InBattlegroundQueue(bool ignoreArena=false) const
Definition Player.cpp:12203
bool IsUsingLfg()
Definition Player.cpp:13063
Map * FindMap() const
Definition Object.h:622
Definition WorldPacket.h:26
auto SelectRandomContainerElement(C const &container) -> typename std::add_const< decltype(*std::begin(container))>::type &
Definition Containers.h:133
std::vector< std::string_view > Tokenize(std::string_view str, char sep, bool keepEmpty)
Definition Tokenize.cpp:20
Player * FindPlayerByName(std::string const &name, bool checkInWorld=true)
Definition ObjectAccessor.cpp:271
bool Instanceable() const
Definition DBCStructure.h:1354

References ASSERT, BATTLEGROUND_AA, BATTLEGROUND_BE, BATTLEGROUND_DS, BATTLEGROUND_NA, BATTLEGROUND_RL, BATTLEGROUND_RV, WorldObject::FindMap(), ObjectAccessor::FindPlayerByName(), Battleground::GetArenaType(), GetBattlegroundBracketById(), Battleground::GetBgTypeID(), Battleground::GetBracketId(), Map::GetEntry(), Player::GetGroup(), Object::GetGUID(), Battleground::GetInstanceID(), WorldObject::GetMap(), Battleground::GetMapId(), Group::GetMembersCount(), WorldObject::GetName(), Battleground::GetStartTime(), Player::InBattlegroundQueue(), MapEntry::Instanceable(), Unit::IsAlive(), Player::IsBeingTeleported(), Group::isBFGroup(), Group::isBGGroup(), Unit::IsInFlight(), Object::IsInWorld(), Group::isLFGGroup(), Group::isRaidGroup(), Player::IsUsingLfg(), ChatHandler::PSendSysMessage(), sBattlegroundMgr, Acore::Containers::SelectRandomContainerElement(), Player::SendDirectMessage(), ChatHandler::SendErrorMessage(), Player::SetBattlegroundId(), Player::SetEntryPoint(), ChatHandler::SetSentErrorMessage(), sLFGMgr, Battleground::StartBattleground(), STATUS_IN_PROGRESS, TEAM_ALLIANCE, TEAM_HORDE, Player::TeamIdForRace(), and Acore::Tokenize().

Referenced by GetCommands().

◆ HandleStringCommand()

static bool misc_commandscript::HandleStringCommand ( ChatHandler handler,
uint32  id,
Optional< uint8 locale 
)
inlinestatic
3046 {
3047 if (!id)
3048 {
3050 return false;
3051 }
3052
3053 std::string str = sObjectMgr->GetAcoreString(id, locale ? static_cast<LocaleConstant>(*locale) : DEFAULT_LOCALE);
3054 handler->SendSysMessage(str);
3055 return true;
3056 }
LocaleConstant
Definition Common.h:117
#define DEFAULT_LOCALE
Definition Common.h:131
@ LANG_CMD_SYNTAX
Definition Language.h:42

References DEFAULT_LOCALE, LANG_CMD_SYNTAX, ChatHandler::SendSysMessage(), and sObjectMgr.

Referenced by GetCommands().

◆ HandleSummonCommand()

static bool misc_commandscript::HandleSummonCommand ( ChatHandler handler,
Optional< PlayerIdentifier target 
)
inlinestatic
929 {
930 if (!target)
931 {
932 target = PlayerIdentifier::FromTarget(handler);
933 }
934
935 if (!target)
936 {
937 return false;
938 }
939
940 Player* _player = handler->GetSession()->GetPlayer();
941 if (target->GetGUID() == _player->GetGUID())
942 {
944 return false;
945 }
946
947 std::string nameLink = handler->playerLink(target->GetName());
948
949 if (target->IsConnected())
950 {
951 auto targetPlayer = target->GetConnectedPlayer();
952
953 // check online security
954 if (handler->HasLowerSecurity(targetPlayer))
955 {
956 return false;
957 }
958
959 if (targetPlayer->IsBeingTeleported())
960 {
961 handler->SendErrorMessage(LANG_IS_TELEPORTED, nameLink);
962 return false;
963 }
964
965 Map* map = handler->GetSession()->GetPlayer()->GetMap();
966
967 if (map->IsBattlegroundOrArena())
968 {
969 handler->SendErrorMessage("Can't summon to a battleground!");
970 return false;
971 }
972 else if (map->IsDungeon())
973 {
974 // Allow GM to summon players or only other GM accounts inside instances.
975 if (!sWorld->getBoolConfig(CONFIG_INSTANCE_GMSUMMON_PLAYER))
976 {
977 // pussywizard: prevent unbinding normal player's perm bind by just summoning him >_>
978 if (!targetPlayer->GetSession()->GetSecurity())
979 {
980 handler->SendErrorMessage("Only GMs can be summoned to an instance!");
981 return false;
982 }
983 }
984
985 Map* destMap = targetPlayer->GetMap();
986
987 if (destMap->Instanceable() && destMap->GetInstanceId() != map->GetInstanceId())
988 {
989 sInstanceSaveMgr->PlayerUnbindInstance(target->GetGUID(), map->GetInstanceId(), targetPlayer->GetDungeonDifficulty(), true, targetPlayer);
990 }
991
992 // we are in an instance, and can only summon players in our group with us as leader
993 if (!handler->GetSession()->GetPlayer()->GetGroup() || !targetPlayer->GetGroup() ||
994 (targetPlayer->GetGroup()->GetLeaderGUID() != handler->GetSession()->GetPlayer()->GetGUID()) ||
995 (handler->GetSession()->GetPlayer()->GetGroup()->GetLeaderGUID() != handler->GetSession()->GetPlayer()->GetGUID()))
996 // the last check is a bit excessive, but let it be, just in case
997 {
999 return false;
1000 }
1001 }
1002
1003 handler->PSendSysMessage(LANG_SUMMONING, nameLink, "");
1004 if (handler->needReportToTarget(targetPlayer))
1005 {
1006 ChatHandler(targetPlayer->GetSession()).PSendSysMessage(LANG_SUMMONED_BY, handler->playerLink(_player->GetName()));
1007 }
1008
1009 // stop flight if need
1010 if (targetPlayer->IsInFlight())
1011 {
1012 targetPlayer->GetMotionMaster()->MovementExpired();
1013 targetPlayer->CleanupAfterTaxiFlight();
1014 }
1015 // save only in non-flight case
1016 else
1017 {
1018 targetPlayer->SaveRecallPosition();
1019 }
1020
1021 // before GM
1022 float x, y, z;
1023 handler->GetSession()->GetPlayer()->GetClosePoint(x, y, z, targetPlayer->GetObjectSize());
1024 targetPlayer->TeleportTo(handler->GetSession()->GetPlayer()->GetMapId(), x, y, z, targetPlayer->GetOrientation(), 0, handler->GetSession()->GetPlayer());
1025 }
1026 else
1027 {
1028 // check offline security
1029 if (handler->HasLowerSecurity(nullptr, target->GetGUID()))
1030 {
1031 return false;
1032 }
1033
1034 handler->PSendSysMessage(LANG_SUMMONING, nameLink, handler->GetAcoreString(LANG_OFFLINE));
1035
1036 // in point where GM stay
1038 handler->GetSession()->GetPlayer()->GetPositionX(),
1039 handler->GetSession()->GetPlayer()->GetPositionY(),
1040 handler->GetSession()->GetPlayer()->GetPositionZ(),
1041 handler->GetSession()->GetPlayer()->GetOrientation(),
1042 handler->GetSession()->GetPlayer()->GetZoneId(),
1043 target->GetGUID());
1044 }
1045
1046 return true;
1047 }
@ CONFIG_INSTANCE_GMSUMMON_PLAYER
Definition WorldConfig.h:45
static void SavePositionInDB(uint32 mapid, float x, float y, float z, float o, uint32 zone, ObjectGuid guid)
Definition PlayerMisc.cpp:84

References CONFIG_INSTANCE_GMSUMMON_PLAYER, Acore::ChatCommands::PlayerIdentifier::FromTarget(), ChatHandler::GetAcoreString(), WorldObject::GetClosePoint(), Player::GetGroup(), Object::GetGUID(), Map::GetInstanceId(), Group::GetLeaderGUID(), WorldObject::GetMap(), WorldLocation::GetMapId(), WorldObject::GetName(), Position::GetOrientation(), WorldSession::GetPlayer(), Position::GetPositionX(), Position::GetPositionY(), Position::GetPositionZ(), ChatHandler::GetSession(), WorldObject::GetZoneId(), ChatHandler::HasLowerSecurity(), Map::Instanceable(), Map::IsBattlegroundOrArena(), Map::IsDungeon(), LANG_CANNOT_SUMMON_TO_INST, LANG_CANT_TELEPORT_SELF, LANG_IS_TELEPORTED, LANG_OFFLINE, LANG_SUMMONED_BY, LANG_SUMMONING, ChatHandler::needReportToTarget(), ChatHandler::playerLink(), ChatHandler::PSendSysMessage(), Player::SavePositionInDB(), ChatHandler::SendErrorMessage(), sInstanceSaveMgr, and sWorld.

Referenced by GetCommands().

◆ HandleUnAuraCommand()

static bool misc_commandscript::HandleUnAuraCommand ( ChatHandler handler,
Variant< SpellInfo const *, std::string_view >  spells 
)
inlinestatic
746 {
747 Unit* target = handler->getSelectedUnit();
748 if (!target)
749 {
751 return false;
752 }
753
754 if (spells.holds_alternative<std::string_view>() && spells.get<std::string_view>() == "all")
755 {
756 target->RemoveAllAuras();
757 return true;
758 }
759
760 if (!spells.holds_alternative<SpellInfo const*>())
761 {
763 return false;
764 }
765
766 auto spell = spells.get<SpellInfo const*>();
767
768 if (!SpellMgr::IsSpellValid(spell))
769 {
770 handler->SendErrorMessage(LANG_COMMAND_SPELL_BROKEN, spell->Id);
771 return false;
772 }
773
774 target->RemoveAurasDueToSpell(spell->Id);
775
776 return true;
777 }
spells
Definition boss_krystallus.cpp:26
void RemoveAurasDueToSpell(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, uint8 reqEffMask=0, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
Definition Unit.cpp:4978
void RemoveAllAuras()
Definition Unit.cpp:5388

References ChatHandler::getSelectedUnit(), SpellMgr::IsSpellValid(), LANG_COMMAND_NOSPELLFOUND, LANG_COMMAND_SPELL_BROKEN, LANG_SELECT_CHAR_OR_CREATURE, Unit::RemoveAllAuras(), Unit::RemoveAurasDueToSpell(), and ChatHandler::SendErrorMessage().

Referenced by GetCommands().

◆ HandleUnbindSightCommand()

static bool misc_commandscript::HandleUnbindSightCommand ( ChatHandler handler)
inlinestatic
3026 {
3027 Player* player = handler->GetSession()->GetPlayer();
3028
3029 if (player->isPossessing())
3030 {
3031 return false;
3032 }
3033
3034 player->StopCastingBindSight();
3035 return true;
3036 }
void StopCastingBindSight(Aura *except=nullptr)
Definition Player.cpp:13151
bool isPossessing() const
Definition Unit.h:1280

References WorldSession::GetPlayer(), ChatHandler::GetSession(), Unit::isPossessing(), and Player::StopCastingBindSight().

Referenced by GetCommands().

◆ HandleUnFreezeCommand()

static bool misc_commandscript::HandleUnFreezeCommand ( ChatHandler handler,
Optional< PlayerIdentifier target 
)
inlinestatic
2934 {
2935 Creature* creatureTarget = handler->getSelectedCreature();
2936
2937 if (!target && !creatureTarget)
2938 {
2939 target = PlayerIdentifier::FromTargetOrSelf(handler);
2940 }
2941
2942 if (!target && !creatureTarget)
2943 {
2945 return false;
2946 }
2947
2948 Player* playerTarget = target->GetConnectedPlayer();
2949
2950 if (!creatureTarget && playerTarget && playerTarget->HasAura(SPELL_FREEZE))
2951 {
2952 handler->PSendSysMessage(LANG_COMMAND_UNFREEZE, target->GetName());
2953 playerTarget->RemoveAurasDueToSpell(SPELL_FREEZE);
2954 return true;
2955 }
2956 else if (creatureTarget && creatureTarget->HasAura(SPELL_FREEZE))
2957 {
2959 creatureTarget->RemoveAurasDueToSpell(SPELL_FREEZE);
2960 return true;
2961 }
2962 else if (!creatureTarget && target && !target->IsConnected())
2963 {
2965 stmt->SetData(0, target->GetGUID().GetCounter());
2966 CharacterDatabase.Execute(stmt);
2967 handler->PSendSysMessage(LANG_COMMAND_UNFREEZE, target->GetName());
2968 return true;
2969 }
2970
2972 return true;
2973 }
@ CHAR_DEL_CHAR_AURA_FROZEN
Definition CharacterDatabase.h:355
@ LANG_COMMAND_UNFREEZE
Definition Language.h:1058
@ LANG_COMMAND_FREEZE_WRONG
Definition Language.h:1057
bool HasAura(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, ObjectGuid itemCasterGUID=ObjectGuid::Empty, uint8 reqEffMask=0) const
Definition Unit.cpp:5790

References CHAR_DEL_CHAR_AURA_FROZEN, CharacterDatabase, Acore::ChatCommands::PlayerIdentifier::FromTargetOrSelf(), GetLocalizeCreatureName(), ChatHandler::getSelectedCreature(), ChatHandler::GetSessionDbcLocale(), Unit::HasAura(), LANG_COMMAND_FREEZE_WRONG, LANG_COMMAND_UNFREEZE, LANG_SELECT_CHAR_OR_CREATURE, ChatHandler::PSendSysMessage(), Unit::RemoveAurasDueToSpell(), ChatHandler::SendErrorMessage(), ChatHandler::SendSysMessage(), PreparedStatementBase::SetData(), and SPELL_FREEZE.

Referenced by GetCommands().

◆ HandleUnmuteCommand()

static bool misc_commandscript::HandleUnmuteCommand ( ChatHandler handler,
Optional< PlayerIdentifier target 
)
inlinestatic
2577 {
2578 if (!target)
2579 {
2580 target = PlayerIdentifier::FromTargetOrSelf(handler);
2581 }
2582
2583 if (!target)
2584 {
2585 return false;
2586 }
2587
2588 Player* playerTarget = target->GetConnectedPlayer();
2589 uint32 accountId = playerTarget ? playerTarget->GetSession()->GetAccountId() : sCharacterCache->GetCharacterAccountIdByGuid(target->GetGUID());
2590
2591 // find only player from same account if any
2592 if (!playerTarget)
2593 {
2594 if (WorldSession* session = sWorldSessionMgr->FindSession(accountId))
2595 {
2596 playerTarget = session->GetPlayer();
2597 }
2598 }
2599
2600 // must have strong lesser security level
2601 if (handler->HasLowerSecurity(playerTarget, target->GetGUID(), true))
2602 {
2603 return false;
2604 }
2605
2606 if (playerTarget)
2607 {
2608 if (playerTarget->CanSpeak())
2609 {
2611 return false;
2612 }
2613
2614 playerTarget->GetSession()->m_muteTime = 0;
2615 }
2616
2618 stmt->SetData(0, 0);
2619 stmt->SetData(1, "");
2620 stmt->SetData(2, "");
2621 stmt->SetData(3, accountId);
2622 LoginDatabase.Execute(stmt);
2623
2624 if (playerTarget)
2625 {
2627 }
2628
2629 handler->PSendSysMessage(LANG_YOU_ENABLE_CHAT, handler->playerLink(target->GetName()));
2630
2631 return true;
2632 }
@ LANG_CHAT_ALREADY_ENABLED
Definition Language.h:348
@ LANG_YOU_ENABLE_CHAT
Definition Language.h:350
@ LANG_YOUR_CHAT_ENABLED
Definition Language.h:349
bool CanSpeak() const
Definition PlayerMisc.cpp:69

References Player::CanSpeak(), Acore::ChatCommands::PlayerIdentifier::FromTargetOrSelf(), WorldSession::GetAccountId(), Object::GetGUID(), Player::GetSession(), ChatHandler::HasLowerSecurity(), LANG_CHAT_ALREADY_ENABLED, LANG_YOU_ENABLE_CHAT, LANG_YOUR_CHAT_ENABLED, LOGIN_UPD_MUTE_TIME, LoginDatabase, WorldSession::m_muteTime, ChatHandler::playerLink(), ChatHandler::PSendSysMessage(), sCharacterCache, ChatHandler::SendErrorMessage(), PreparedStatementBase::SetData(), and sWorldSessionMgr.

Referenced by GetCommands().

◆ HandleUnPossessCommand()

static bool misc_commandscript::HandleUnPossessCommand ( ChatHandler handler)
inlinestatic
3002 {
3003 Unit* unit = handler->getSelectedUnit();
3004 if (!unit)
3005 {
3006 unit = handler->GetSession()->GetPlayer();
3007 }
3008
3009 unit->RemoveCharmAuras();
3010 return true;
3011 }
void RemoveCharmAuras()
Definition Unit.cpp:11275

References WorldSession::GetPlayer(), ChatHandler::getSelectedUnit(), ChatHandler::GetSession(), and Unit::RemoveCharmAuras().

Referenced by GetCommands().

◆ HandleUnstuckCommand()

static bool misc_commandscript::HandleUnstuckCommand ( ChatHandler handler,
Optional< PlayerIdentifier target,
Optional< std::string_view >  location 
)
inlinestatic
1454 {
1455 // No args required for players
1456 if (handler->GetSession() && AccountMgr::IsPlayerAccount(handler->GetSession()->GetSecurity()))
1457 {
1458 if (Player* player = handler->GetSession()->GetPlayer())
1459 {
1460 player->CastSpell(player, SPELL_STUCK, false);
1461 }
1462
1463 return true;
1464 }
1465
1466 if (!target)
1467 {
1468 target = PlayerIdentifier::FromTargetOrSelf(handler);
1469 }
1470
1471 if (!target || !target->IsConnected())
1472 {
1473 if (handler->HasLowerSecurity(nullptr, target->GetGUID()))
1474 return false;
1475
1477 stmt->SetData(0, target->GetGUID().GetCounter());
1478
1479 PreparedQueryResult result = CharacterDatabase.Query(stmt);
1480
1481 if (result)
1482 {
1483 Field* fieldsDB = result->Fetch();
1484 WorldLocation loc(fieldsDB[0].Get<uint16>(), fieldsDB[2].Get<float>(), fieldsDB[3].Get<float>(), fieldsDB[4].Get<float>(), 0.0f);
1485 uint32 zoneId = fieldsDB[1].Get<uint16>();
1486
1487 Player::SavePositionInDB(loc, zoneId, target->GetGUID(), nullptr);
1488
1489 handler->PSendSysMessage(LANG_SUMMONING, target->GetName(), handler->GetAcoreString(LANG_OFFLINE));
1490 }
1491
1492 return true;
1493 }
1494
1495 Player* player = target->GetConnectedPlayer();
1496
1497 if (player->IsInFlight() || player->IsInCombat())
1498 {
1499 SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(7355);
1500 if (!spellInfo)
1501 return false;
1502
1503 if (player)
1505
1506 return false;
1507 }
1508
1509 if (location->empty() || *location == "inn")
1510 {
1511 player->TeleportTo(player->m_homebindMapId, player->m_homebindX, player->m_homebindY, player->m_homebindZ, player->GetOrientation());
1512 return true;
1513 }
1514
1515 if (*location == "graveyard")
1516 {
1517 player->RepopAtGraveyard();
1518 return true;
1519 }
1520
1521 if (*location == "startzone")
1522 {
1523 player->TeleportTo(player->GetStartPosition());
1524 return true;
1525 }
1526
1527 //Not a supported argument
1528 return false;
1529 }
@ CHAR_SEL_CHARACTER_HOMEBIND
Definition CharacterDatabase.h:87
@ SPELL_FAILED_CANT_DO_THAT_RIGHT_NOW
Definition SharedDefines.h:1133
float m_homebindZ
Definition Player.h:2376
uint32 m_homebindMapId
Definition Player.h:2372
void RepopAtGraveyard()
Definition Player.cpp:4914
float m_homebindY
Definition Player.h:2375
WorldLocation GetStartPosition() const
Definition Player.cpp:11382
float m_homebindX
Definition Player.h:2374
static void SendCastResult(Player *caster, SpellInfo const *spellInfo, uint8 castCount, SpellCastResult result, SpellCustomErrors customError=SPELL_CUSTOM_ERROR_NONE)
Definition Spell.cpp:4607
bool IsInCombat() const
Definition Unit.h:917
Definition Position.h:256
constexpr auto SPELL_STUCK
Definition cs_misc.cpp:58

References CHAR_SEL_CHARACTER_HOMEBIND, CharacterDatabase, Acore::ChatCommands::PlayerIdentifier::FromTargetOrSelf(), Field::Get(), ChatHandler::GetAcoreString(), Position::GetOrientation(), WorldSession::GetPlayer(), WorldSession::GetSecurity(), ChatHandler::GetSession(), Player::GetStartPosition(), ChatHandler::HasLowerSecurity(), Unit::IsInCombat(), Unit::IsInFlight(), AccountMgr::IsPlayerAccount(), LANG_OFFLINE, LANG_SUMMONING, Player::m_homebindMapId, Player::m_homebindX, Player::m_homebindY, Player::m_homebindZ, ChatHandler::PSendSysMessage(), Player::RepopAtGraveyard(), Player::SavePositionInDB(), Spell::SendCastResult(), PreparedStatementBase::SetData(), SPELL_FAILED_CANT_DO_THAT_RIGHT_NOW, SPELL_STUCK, sSpellMgr, and Player::TeleportTo().

Referenced by GetCommands().


The documentation for this class was generated from the following file: