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

Classes

struct  DeletedInfo
 

Public Types

typedef std::list< DeletedInfoDeletedInfoList
 

Public Member Functions

 character_commandscript ()
 
ChatCommandTable GetCommands () const override
 
virtual std::vector< Acore::ChatCommands::ChatCommandBuilderGetCommands () const =0
 
- Public Member Functions inherited from ScriptObject
virtual bool IsDatabaseBound () const
 
virtual bool isAfterLoadScript () const
 
virtual void checkValidity ()
 
const std::string & GetName () const
 

Static Public Member Functions

static bool GetDeletedCharacterInfoList (DeletedInfoList &foundList, std::string searchString)
 
static void HandleCharacterDeletedListHelper (DeletedInfoList const &foundList, ChatHandler *handler)
 
static void HandleCharacterDeletedRestoreHelper (DeletedInfo const &delInfo, ChatHandler *handler)
 
static void HandleCharacterLevel (Player *player, ObjectGuid playerGuid, uint32 oldLevel, uint32 newLevel, ChatHandler *handler)
 
static bool HandleCharacterTitlesCommand (ChatHandler *handler, Optional< PlayerIdentifier > player)
 
static bool HandleCharacterRenameCommand (ChatHandler *handler, Optional< PlayerIdentifier > player, Optional< bool > reserveName, Optional< std::string_view > newNameV)
 
static bool HandleCharacterLevelCommand (ChatHandler *handler, Optional< PlayerIdentifier > player, int16 newlevel)
 
static bool HandleCharacterCustomizeCommand (ChatHandler *handler, Optional< PlayerIdentifier > player)
 
static bool HandleCharacterChangeFactionCommand (ChatHandler *handler, Optional< PlayerIdentifier > player)
 
static bool HandleCharacterChangeRaceCommand (ChatHandler *handler, Optional< PlayerIdentifier > player)
 
static bool HandleCharacterReputationCommand (ChatHandler *handler, Optional< PlayerIdentifier > player)
 
static bool HandleCharacterDeletedListCommand (ChatHandler *handler, Optional< std::string_view > needleStr)
 
static bool HandleCharacterDeletedRestoreCommand (ChatHandler *handler, std::string needle, Optional< std::string_view > newCharName, Optional< AccountIdentifier > newAccount)
 
static bool HandleCharacterDeletedDeleteCommand (ChatHandler *handler, std::string needle)
 
static bool HandleCharacterDeletedPurgeCommand (ChatHandler *, Optional< uint16 > days)
 
static bool HandleCharacterEraseCommand (ChatHandler *handler, PlayerIdentifier player)
 
static bool HandleLevelUpCommand (ChatHandler *handler, Optional< PlayerIdentifier > player, int16 level)
 
static bool ValidatePDumpTarget (ChatHandler *handler, std::string &name, Optional< std::string_view > characterName, Optional< ObjectGuid::LowType > characterGUID)
 
static bool HandlePDumpLoadCommand (ChatHandler *handler, std::string fileName, AccountIdentifier account, Optional< std::string_view > characterName, Optional< ObjectGuid::LowType > characterGUID)
 
static bool HandlePDumpCopyCommand (ChatHandler *handler, PlayerIdentifier player, AccountIdentifier account, Optional< std::string_view > characterName, Optional< ObjectGuid::LowType > characterGUID)
 
static bool HandlePDumpWriteCommand (ChatHandler *handler, std::string fileName, PlayerIdentifier player)
 
static bool HandleCharacterCheckBankCommand (ChatHandler *handler)
 
static bool HandleCharacterCheckBagCommand (ChatHandler *handler, uint8 BagSlot)
 
static bool HandleCharacterCheckProfessionCommand (ChatHandler *handler)
 
static bool HandleCharacterChangeAccountCommand (ChatHandler *handler, std::string accountName, Optional< PlayerIdentifier > player)
 

Additional Inherited Members

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

Detailed Description

Member Typedef Documentation

◆ DeletedInfoList

Constructor & Destructor Documentation

◆ character_commandscript()

character_commandscript::character_commandscript ( )
inline
45: CommandScript("character_commandscript") { }
Definition: CommandScript.h:25

Member Function Documentation

◆ GetCommands()

ChatCommandTable character_commandscript::GetCommands ( ) const
inlineoverridevirtual

Implements CommandScript.

48 {
49 static ChatCommandTable pdumpCommandTable =
50 {
51 { "load", HandlePDumpLoadCommand, SEC_ADMINISTRATOR, Console::Yes },
52 { "write", HandlePDumpWriteCommand, SEC_ADMINISTRATOR, Console::Yes }
53 };
54
55 static ChatCommandTable characterDeletedCommandTable =
56 {
57 { "delete", HandleCharacterDeletedDeleteCommand, SEC_CONSOLE, Console::Yes },
59 { "restore", HandleCharacterDeletedRestoreCommand, SEC_ADMINISTRATOR, Console::Yes },
60 { "purge", HandleCharacterDeletedPurgeCommand, SEC_CONSOLE, Console::Yes }
61 };
62
63 static ChatCommandTable characterCheckCommandTable =
64 {
65 { "bank", HandleCharacterCheckBankCommand, SEC_GAMEMASTER, Console::Yes },
66 { "bag", HandleCharacterCheckBagCommand, SEC_GAMEMASTER, Console::Yes },
67 { "profession", HandleCharacterCheckProfessionCommand, SEC_GAMEMASTER, Console::Yes }
68 };
69
70 static ChatCommandTable characterCommandTable =
71 {
72 { "customize", HandleCharacterCustomizeCommand, SEC_GAMEMASTER, Console::Yes },
73 { "changefaction", HandleCharacterChangeFactionCommand, SEC_GAMEMASTER, Console::Yes },
74 { "changerace", HandleCharacterChangeRaceCommand, SEC_GAMEMASTER, Console::Yes },
75 { "changeaccount", HandleCharacterChangeAccountCommand, SEC_ADMINISTRATOR, Console::Yes },
76 { "check", characterCheckCommandTable },
77 { "erase", HandleCharacterEraseCommand, SEC_CONSOLE, Console::Yes },
78 { "deleted", characterDeletedCommandTable },
79 { "level", HandleCharacterLevelCommand, SEC_GAMEMASTER, Console::Yes },
80 { "rename", HandleCharacterRenameCommand, SEC_GAMEMASTER, Console::Yes },
81 { "reputation", HandleCharacterReputationCommand, SEC_GAMEMASTER, Console::Yes },
82 { "titles", HandleCharacterTitlesCommand, SEC_GAMEMASTER, Console::Yes }
83 };
84
85 static ChatCommandTable commandTable =
86 {
87 { "character", characterCommandTable },
88 { "levelup", HandleLevelUpCommand, SEC_GAMEMASTER, Console::No },
89 { "pdump", pdumpCommandTable }
90 };
91
92 return commandTable;
93 }
@ SEC_ADMINISTRATOR
Definition: Common.h:62
@ SEC_GAMEMASTER
Definition: Common.h:61
@ SEC_CONSOLE
Definition: Common.h:63
std::vector< ChatCommandBuilder > ChatCommandTable
Definition: ChatCommand.h:49
static bool HandleCharacterChangeAccountCommand(ChatHandler *handler, std::string accountName, Optional< PlayerIdentifier > player)
Definition: cs_character.cpp:1048
static bool HandleCharacterDeletedListCommand(ChatHandler *handler, Optional< std::string_view > needleStr)
Definition: cs_character.cpp:589
static bool HandleCharacterCheckBankCommand(ChatHandler *handler)
Definition: cs_character.cpp:899
static bool HandlePDumpLoadCommand(ChatHandler *handler, std::string fileName, AccountIdentifier account, Optional< std::string_view > characterName, Optional< ObjectGuid::LowType > characterGUID)
Definition: cs_character.cpp:809
static bool HandleCharacterDeletedPurgeCommand(ChatHandler *, Optional< uint16 > days)
Definition: cs_character.cpp:710
static bool HandleLevelUpCommand(ChatHandler *handler, Optional< PlayerIdentifier > player, int16 level)
Definition: cs_character.cpp:753
static bool HandleCharacterRenameCommand(ChatHandler *handler, Optional< PlayerIdentifier > player, Optional< bool > reserveName, Optional< std::string_view > newNameV)
Definition: cs_character.cpp:327
static bool HandleCharacterLevelCommand(ChatHandler *handler, Optional< PlayerIdentifier > player, int16 newlevel)
Definition: cs_character.cpp:433
static bool HandleCharacterCustomizeCommand(ChatHandler *handler, Optional< PlayerIdentifier > player)
Definition: cs_character.cpp:458
static bool HandleCharacterCheckProfessionCommand(ChatHandler *handler)
Definition: cs_character.cpp:970
static bool HandleCharacterDeletedDeleteCommand(ChatHandler *handler, std::string needle)
Definition: cs_character.cpp:677
static bool HandleCharacterChangeRaceCommand(ChatHandler *handler, Optional< PlayerIdentifier > player)
Definition: cs_character.cpp:506
static bool HandleCharacterTitlesCommand(ChatHandler *handler, Optional< PlayerIdentifier > player)
Definition: cs_character.cpp:279
static bool HandlePDumpWriteCommand(ChatHandler *handler, std::string fileName, PlayerIdentifier player)
Definition: cs_character.cpp:878
static bool HandleCharacterReputationCommand(ChatHandler *handler, Optional< PlayerIdentifier > player)
Definition: cs_character.cpp:530
static bool HandleCharacterEraseCommand(ChatHandler *handler, PlayerIdentifier player)
Definition: cs_character.cpp:731
static bool HandleCharacterCheckBagCommand(ChatHandler *handler, uint8 BagSlot)
Definition: cs_character.cpp:905
static bool HandleCharacterChangeFactionCommand(ChatHandler *handler, Optional< PlayerIdentifier > player)
Definition: cs_character.cpp:482
static bool HandleCharacterDeletedRestoreCommand(ChatHandler *handler, std::string needle, Optional< std::string_view > newCharName, Optional< AccountIdentifier > newAccount)
Definition: cs_character.cpp:621

References HandleCharacterChangeAccountCommand(), HandleCharacterChangeFactionCommand(), HandleCharacterChangeRaceCommand(), HandleCharacterCheckBagCommand(), HandleCharacterCheckBankCommand(), HandleCharacterCheckProfessionCommand(), HandleCharacterCustomizeCommand(), HandleCharacterDeletedDeleteCommand(), HandleCharacterDeletedListCommand(), HandleCharacterDeletedPurgeCommand(), HandleCharacterDeletedRestoreCommand(), HandleCharacterEraseCommand(), HandleCharacterLevelCommand(), HandleCharacterRenameCommand(), HandleCharacterReputationCommand(), HandleCharacterTitlesCommand(), HandleLevelUpCommand(), HandlePDumpLoadCommand(), HandlePDumpWriteCommand(), SEC_ADMINISTRATOR, SEC_CONSOLE, and SEC_GAMEMASTER.

◆ GetDeletedCharacterInfoList()

static bool character_commandscript::GetDeletedCharacterInfoList ( DeletedInfoList foundList,
std::string  searchString 
)
inlinestatic

Collects all GUIDs (and related info) from deleted characters which are still in the database.

Parameters
foundLista reference to an std::list which will be filled with info data
searchStringthe search string which either contains a player GUID or a part fo the character-name
Returns
returns false if there was a problem while selecting the characters (e.g. player name not normalizeable)
115 {
116 PreparedQueryResult result;
118 if (!searchString.empty())
119 {
120 // search by GUID
121 if (isNumeric(searchString.c_str()))
122 {
123 stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHAR_DEL_INFO_BY_GUID);
124 stmt->SetData(0, *Acore::StringTo<uint32>(searchString));
125 result = CharacterDatabase.Query(stmt);
126 }
127 // search by name
128 else
129 {
130 if (!normalizePlayerName(searchString))
131 return false;
132
133 stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHAR_DEL_INFO_BY_NAME);
134 stmt->SetData(0, searchString);
135 result = CharacterDatabase.Query(stmt);
136 }
137 }
138 else
139 {
140 stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHAR_DEL_INFO);
141 result = CharacterDatabase.Query(stmt);
142 }
143
144 if (result)
145 {
146 do
147 {
148 Field* fields = result->Fetch();
149
150 DeletedInfo info;
151
152 info.lowGuid = fields[0].Get<uint32>();
153 info.name = fields[1].Get<std::string>();
154 info.accountId = fields[2].Get<uint32>();
155
156 // account name will be empty for nonexisting account
157 AccountMgr::GetName(info.accountId, info.accountName);
158 info.deleteDate = time_t(fields[3].Get<uint32>());
159 foundList.push_back(info);
160 } while (result->NextRow());
161 }
162
163 return true;
164 }
std::uint32_t uint32
Definition: Define.h:108
bool isNumeric(wchar_t wchar)
Definition: Util.h:204
DatabaseWorkerPool< CharacterDatabaseConnection > CharacterDatabase
Accessor to the character database.
Definition: DatabaseEnv.cpp:21
std::shared_ptr< PreparedResultSet > PreparedQueryResult
Definition: DatabaseEnvFwd.h:46
@ CHAR_SEL_CHAR_DEL_INFO_BY_NAME
Definition: CharacterDatabase.h:331
@ CHAR_SEL_CHAR_DEL_INFO
Definition: CharacterDatabase.h:332
@ CHAR_SEL_CHAR_DEL_INFO_BY_GUID
Definition: CharacterDatabase.h:330
bool normalizePlayerName(std::string &name)
Definition: ObjectMgr.cpp:262
bool GetName(uint32 accountId, std::string &name)
Definition: AccountMgr.cpp:228
Definition: PreparedStatement.h:158
Class used to access individual fields of database query result.
Definition: Field.h:99
std::enable_if_t< std::is_arithmetic_v< T >, T > Get() const
Definition: Field.h:113
Acore::Types::is_default< T > SetData(const uint8 index, T value)
Definition: PreparedStatement.h:78

References character_commandscript::DeletedInfo::accountId, character_commandscript::DeletedInfo::accountName, CHAR_SEL_CHAR_DEL_INFO, CHAR_SEL_CHAR_DEL_INFO_BY_GUID, CHAR_SEL_CHAR_DEL_INFO_BY_NAME, CharacterDatabase, character_commandscript::DeletedInfo::deleteDate, Field::Get(), AccountMgr::GetName(), isNumeric(), character_commandscript::DeletedInfo::lowGuid, character_commandscript::DeletedInfo::name, normalizePlayerName(), and PreparedStatementBase::SetData().

Referenced by HandleCharacterDeletedDeleteCommand(), HandleCharacterDeletedListCommand(), and HandleCharacterDeletedRestoreCommand().

◆ HandleCharacterChangeAccountCommand()

static bool character_commandscript::HandleCharacterChangeAccountCommand ( ChatHandler handler,
std::string  accountName,
Optional< PlayerIdentifier player 
)
inlinestatic
1049 {
1050 if (!player)
1051 {
1052 player = PlayerIdentifier::FromTargetOrSelf(handler);
1053 }
1054
1055 if (!player)
1056 {
1058 return false;
1059 }
1060
1061 if (uint32 accountId = AccountMgr::GetId(accountName))
1062 {
1063 if (AccountMgr::GetCharactersCount(accountId) >= 10)
1064 {
1065 handler->SendErrorMessage(LANG_ACCOUNT_CHARACTER_LIST_FULL, accountName, accountId);
1066 return true;
1067 }
1068
1069 if (CharacterCacheEntry const* cache = sCharacterCache->GetCharacterCacheByName(player->GetName()))
1070 {
1071 std::string accName;
1072 AccountMgr::GetName(cache->AccountId, accName);
1073 handler->PSendSysMessage(LANG_CMD_CHAR_CHANGE_ACC_SUCCESS, player->GetName(), player->GetGUID().GetCounter(), accName, cache->AccountId, accountName, accountId);
1074 }
1075
1076 if (player->IsConnected())
1077 {
1078 player->GetConnectedPlayer()->GetSession()->KickPlayer("CMD char changeaccount");
1079 }
1080
1081 CharacterDatabase.Query("UPDATE characters SET account = {} WHERE guid = {}", accountId, player->GetGUID().GetCounter());
1082 sCharacterCache->UpdateCharacterAccountId(player->GetGUID(), accountId);
1083
1084 }
1085 else
1086 {
1087 handler->SendErrorMessage(LANG_ACCOUNT_NOT_EXIST, accountName);
1088 return true;
1089 }
1090
1091 return true;
1092 }
#define sCharacterCache
Definition: CharacterCache.h:83
@ LANG_ACCOUNT_CHARACTER_LIST_FULL
Definition: Language.h:884
@ LANG_PLAYER_NOT_FOUND
Definition: Language.h:522
@ LANG_ACCOUNT_NOT_EXIST
Definition: Language.h:425
@ LANG_CMD_CHAR_CHANGE_ACC_SUCCESS
Definition: Language.h:1158
uint32 GetCharactersCount(uint32 accountId)
Definition: AccountMgr.cpp:266
uint32 GetId(std::string const &username)
Definition: AccountMgr.cpp:200
Definition: CharacterCache.h:28
void SendErrorMessage(uint32 entry)
Definition: Chat.cpp:152
void PSendSysMessage(char const *fmt, Args &&... args)
Definition: Chat.h:60
static Optional< PlayerIdentifier > FromTargetOrSelf(ChatHandler *handler)
Definition: ChatCommandTags.h:188

References CharacterDatabase, Acore::ChatCommands::PlayerIdentifier::FromTargetOrSelf(), AccountMgr::GetCharactersCount(), AccountMgr::GetId(), AccountMgr::GetName(), LANG_ACCOUNT_CHARACTER_LIST_FULL, LANG_ACCOUNT_NOT_EXIST, LANG_CMD_CHAR_CHANGE_ACC_SUCCESS, LANG_PLAYER_NOT_FOUND, ChatHandler::PSendSysMessage(), sCharacterCache, and ChatHandler::SendErrorMessage().

Referenced by GetCommands().

◆ HandleCharacterChangeFactionCommand()

static bool character_commandscript::HandleCharacterChangeFactionCommand ( ChatHandler handler,
Optional< PlayerIdentifier player 
)
inlinestatic
483 {
484 if (!player)
485 player = PlayerIdentifier::FromTarget(handler);
486 if (!player)
487 return false;
488
489 if (Player* target = player->GetConnectedPlayer())
490 {
491 handler->PSendSysMessage(LANG_CUSTOMIZE_PLAYER, handler->GetNameLink(target).c_str());
492 target->SetAtLoginFlag(AT_LOGIN_CHANGE_FACTION);
493 }
494 else
495 {
496 handler->PSendSysMessage(LANG_CUSTOMIZE_PLAYER_GUID, handler->playerLink(*player).c_str(), player->GetGUID().GetCounter());
499 stmt->SetData(1, player->GetGUID().GetCounter());
500 CharacterDatabase.Execute(stmt);
501 }
502
503 return true;
504 }
std::uint16_t uint16
Definition: Define.h:109
@ CHAR_UPD_ADD_AT_LOGIN_FLAG
Definition: CharacterDatabase.h:274
@ AT_LOGIN_CHANGE_FACTION
Definition: Player.h:607
@ LANG_CUSTOMIZE_PLAYER_GUID
Definition: Language.h:387
@ LANG_CUSTOMIZE_PLAYER
Definition: Language.h:386
virtual std::string GetNameLink() const
Definition: Chat.h:101
std::string playerLink(std::string const &name) const
Definition: Chat.h:128
static Optional< PlayerIdentifier > FromTarget(ChatHandler *handler)
Definition: ChatCommandTags.cpp:138
Definition: Player.h:1056

References AT_LOGIN_CHANGE_FACTION, CHAR_UPD_ADD_AT_LOGIN_FLAG, CharacterDatabase, Acore::ChatCommands::PlayerIdentifier::FromTarget(), ChatHandler::GetNameLink(), LANG_CUSTOMIZE_PLAYER, LANG_CUSTOMIZE_PLAYER_GUID, ChatHandler::playerLink(), ChatHandler::PSendSysMessage(), and PreparedStatementBase::SetData().

Referenced by GetCommands().

◆ HandleCharacterChangeRaceCommand()

static bool character_commandscript::HandleCharacterChangeRaceCommand ( ChatHandler handler,
Optional< PlayerIdentifier player 
)
inlinestatic
507 {
508 if (!player)
509 player = PlayerIdentifier::FromTarget(handler);
510 if (!player)
511 return false;
512
513 if (Player* target = player->GetConnectedPlayer())
514 {
515 handler->PSendSysMessage(LANG_CUSTOMIZE_PLAYER, handler->GetNameLink(target).c_str());
516 target->SetAtLoginFlag(AT_LOGIN_CHANGE_RACE);
517 }
518 else
519 {
520 handler->PSendSysMessage(LANG_CUSTOMIZE_PLAYER_GUID, handler->playerLink(*player).c_str(), player->GetGUID().GetCounter());
523 stmt->SetData(1, player->GetGUID().GetCounter());
524 CharacterDatabase.Execute(stmt);
525 }
526
527 return true;
528 }
@ AT_LOGIN_CHANGE_RACE
Definition: Player.h:608

References AT_LOGIN_CHANGE_RACE, CHAR_UPD_ADD_AT_LOGIN_FLAG, CharacterDatabase, Acore::ChatCommands::PlayerIdentifier::FromTarget(), ChatHandler::GetNameLink(), LANG_CUSTOMIZE_PLAYER, LANG_CUSTOMIZE_PLAYER_GUID, ChatHandler::playerLink(), ChatHandler::PSendSysMessage(), and PreparedStatementBase::SetData().

Referenced by GetCommands().

◆ HandleCharacterCheckBagCommand()

static bool character_commandscript::HandleCharacterCheckBagCommand ( ChatHandler handler,
uint8  BagSlot 
)
inlinestatic
906 {
907 Player* target = handler->getSelectedPlayerOrSelf();
908
909 if (!target)
910 return false;
911
912 uint8 Counter = 0;
913 switch (BagSlot)
914 {
915 case 2:
916 BagSlot = 19;
917 break;
918 case 3:
919 BagSlot = 20;
920 break;
921 case 4:
922 BagSlot = 21;
923 break;
924 case 5:
925 BagSlot = 22;
926 break;
927 default:
928 BagSlot = 1;
929 break;
930 }
931
932 handler->PSendSysMessage("--------------------------------------");
933
934 if (BagSlot == 1)
935 {
936 for (uint32 i = 23; i < 39; i++)
937 {
938 if (Item* item = target->GetItemByPos(INVENTORY_SLOT_BAG_0, i))
939 {
940 Counter++;
941 std::ostringstream ItemString;
942 ItemString << std::hex << ItemQualityColors[item->GetTemplate()->Quality];
943
944 handler->PSendSysMessage("%u - |c%s|Hitem:%u:0:0:0:0:0:0:0:0:0|h[%s]|h|r - %u", Counter, ItemString.str().c_str(), item->GetEntry(), item->GetTemplate()->Name1.c_str(), item->GetCount());
945 }
946 }
947 }
948 else
949 {
950 if (Bag* bag = target->GetBagByPos(BagSlot))
951 {
952 for (uint32 i = 0; i < bag->GetBagSize(); i++)
953 {
954 if (Item* item = target->GetItemByPos(BagSlot, i))
955 {
956 Counter++;
957 std::ostringstream ItemString;
958 ItemString << std::hex << ItemQualityColors[item->GetTemplate()->Quality];
959
960 handler->PSendSysMessage("%u - |c%s|Hitem:%u:0:0:0:0:0:0:0:0:0|h[%s]|h|r - %u", Counter, ItemString.str().c_str(), item->GetEntry(), item->GetTemplate()->Name1.c_str(), item->GetCount());
961 }
962 }
963 }
964 }
965
966 handler->PSendSysMessage("--------------------------------------");
967 return true;
968 }
std::uint8_t uint8
Definition: Define.h:110
#define INVENTORY_SLOT_BAG_0
Definition: Player.h:671
const uint32 ItemQualityColors[MAX_ITEM_QUALITY]
Definition: SharedDefines.h:353
Player * getSelectedPlayerOrSelf() const
Definition: Chat.cpp:354
Definition: Bag.h:28
Definition: Item.h:214
Bag * GetBagByPos(uint8 slot) const
Definition: PlayerStorage.cpp:485
Item * GetItemByPos(uint16 pos) const
Definition: PlayerStorage.cpp:469

References Player::GetBagByPos(), Player::GetItemByPos(), ChatHandler::getSelectedPlayerOrSelf(), INVENTORY_SLOT_BAG_0, ItemQualityColors, and ChatHandler::PSendSysMessage().

Referenced by GetCommands().

◆ HandleCharacterCheckBankCommand()

static bool character_commandscript::HandleCharacterCheckBankCommand ( ChatHandler handler)
inlinestatic
900 {
901 handler->GetSession()->SendShowBank(handler->GetSession()->GetPlayer()->GetGUID());
902 return true;
903 }
WorldSession * GetSession()
Definition: Chat.h:139
static ObjectGuid GetGUID(Object const *o)
Definition: Object.h:106
Player * GetPlayer() const
Definition: WorldSession.h:364
void SendShowBank(ObjectGuid guid)
Definition: BankHandler.cpp:189

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

Referenced by GetCommands().

◆ HandleCharacterCheckProfessionCommand()

static bool character_commandscript::HandleCharacterCheckProfessionCommand ( ChatHandler handler)
inlinestatic
971 {
972 Player* player = handler->getSelectedPlayerOrSelf();
973
974 if (!player)
975 return false;
976
977 uint8 Counter = 0;
978
979 handler->PSendSysMessage("--------------------------------------");
980
981 for (uint32 i = 1; i < sSkillLineStore.GetNumRows(); ++i)
982 {
983 SkillLineEntry const* SkillInfo = sSkillLineStore.LookupEntry(i);
984
985 if (!SkillInfo)
986 continue;
987
988 if ((SkillInfo->categoryId != SKILL_CATEGORY_PROFESSION) && !SkillInfo->canLink)
989 continue;
990
991 uint32 SkillID = SkillInfo->id;
992
993 if (player->HasSkill(SkillID))
994 {
995 Counter++;
996
997 switch (SkillID)
998 {
999 case SKILL_ALCHEMY:
1000 handler->PSendSysMessage("%u - Alchemy - %u", Counter, player->GetSkillValue(SkillID));
1001 break;
1003 handler->PSendSysMessage("%u - Blacksmithing - %u", Counter, player->GetSkillValue(SkillID));
1004 break;
1005 case SKILL_ENCHANTING:
1006 handler->PSendSysMessage("%u - Enchanting - %u", Counter, player->GetSkillValue(SkillID));
1007 break;
1008 case SKILL_ENGINEERING:
1009 handler->PSendSysMessage("%u - Engineering - %u", Counter, player->GetSkillValue(SkillID));
1010 break;
1011 case SKILL_INSCRIPTION:
1012 handler->PSendSysMessage("%u - Inscription - %u", Counter, player->GetSkillValue(SkillID));
1013 break;
1015 handler->PSendSysMessage("%u - Jewelcrafting - %u", Counter, player->GetSkillValue(SkillID));
1016 break;
1018 handler->PSendSysMessage("%u - Leatherworking - %u", Counter, player->GetSkillValue(SkillID));
1019 break;
1020 case SKILL_TAILORING:
1021 handler->PSendSysMessage("%u - Tailoring - %u", Counter, player->GetSkillValue(SkillID));
1022 break;
1023 case SKILL_SKINNING:
1024 handler->PSendSysMessage("%u - Skinning - %u", Counter, player->GetSkillValue(SkillID));
1025 break;
1026 case SKILL_HERBALISM:
1027 handler->PSendSysMessage("%u - Herbalism - %u", Counter, player->GetSkillValue(SkillID));
1028 break;
1029 case SKILL_MINING:
1030 handler->PSendSysMessage("%u - Mining - %u", Counter, player->GetSkillValue(SkillID));
1031 break;
1032 case SKILL_COOKING:
1033 handler->PSendSysMessage("%u - Cooking - %u", Counter, player->GetSkillValue(SkillID));
1034 break;
1035 case SKILL_FIRST_AID:
1036 handler->PSendSysMessage("%u - First Aid - %u", Counter, player->GetSkillValue(SkillID));
1037 break;
1038 default:
1039 break;
1040 }
1041 }
1042 }
1043
1044 handler->PSendSysMessage("--------------------------------------");
1045 return true;
1046 }
DBCStorage< SkillLineEntry > sSkillLineStore(SkillLinefmt)
@ SKILL_CATEGORY_PROFESSION
Definition: SharedDefines.h:3078
@ SKILL_INSCRIPTION
Definition: SharedDefines.h:3002
@ SKILL_COOKING
Definition: SharedDefines.h:2918
@ SKILL_BLACKSMITHING
Definition: SharedDefines.h:2909
@ SKILL_LEATHERWORKING
Definition: SharedDefines.h:2910
@ SKILL_TAILORING
Definition: SharedDefines.h:2922
@ SKILL_MINING
Definition: SharedDefines.h:2919
@ SKILL_ENGINEERING
Definition: SharedDefines.h:2923
@ SKILL_FIRST_AID
Definition: SharedDefines.h:2892
@ SKILL_SKINNING
Definition: SharedDefines.h:2961
@ SKILL_ALCHEMY
Definition: SharedDefines.h:2911
@ SKILL_ENCHANTING
Definition: SharedDefines.h:2954
@ SKILL_JEWELCRAFTING
Definition: SharedDefines.h:2985
@ SKILL_HERBALISM
Definition: SharedDefines.h:2915
uint16 GetSkillValue(uint32 skill) const
Definition: Player.cpp:5367
bool HasSkill(uint32 skill) const
Definition: Player.cpp:5346
Definition: DBCStructure.h:1581
uint32 id
Definition: DBCStructure.h:1582
int32 categoryId
Definition: DBCStructure.h:1583
uint32 canLink
Definition: DBCStructure.h:1592

References SkillLineEntry::canLink, SkillLineEntry::categoryId, ChatHandler::getSelectedPlayerOrSelf(), Player::GetSkillValue(), Player::HasSkill(), SkillLineEntry::id, ChatHandler::PSendSysMessage(), SKILL_ALCHEMY, SKILL_BLACKSMITHING, SKILL_CATEGORY_PROFESSION, SKILL_COOKING, SKILL_ENCHANTING, SKILL_ENGINEERING, SKILL_FIRST_AID, SKILL_HERBALISM, SKILL_INSCRIPTION, SKILL_JEWELCRAFTING, SKILL_LEATHERWORKING, SKILL_MINING, SKILL_SKINNING, SKILL_TAILORING, and sSkillLineStore.

Referenced by GetCommands().

◆ HandleCharacterCustomizeCommand()

static bool character_commandscript::HandleCharacterCustomizeCommand ( ChatHandler handler,
Optional< PlayerIdentifier player 
)
inlinestatic
459 {
460 if (!player)
461 player = PlayerIdentifier::FromTarget(handler);
462 if (!player)
463 return false;
464
465 if (Player* target = player->GetConnectedPlayer())
466 {
467 handler->PSendSysMessage(LANG_CUSTOMIZE_PLAYER, handler->GetNameLink(target).c_str());
468 target->SetAtLoginFlag(AT_LOGIN_CUSTOMIZE);
469 }
470 else
471 {
472 handler->PSendSysMessage(LANG_CUSTOMIZE_PLAYER_GUID, handler->playerLink(*player).c_str(), player->GetGUID().GetCounter());
474 stmt->SetData(0, static_cast<uint16>(AT_LOGIN_CUSTOMIZE));
475 stmt->SetData(1, player->GetGUID().GetCounter());
476 CharacterDatabase.Execute(stmt);
477 }
478
479 return true;
480 }
@ AT_LOGIN_CUSTOMIZE
Definition: Player.h:604

References AT_LOGIN_CUSTOMIZE, CHAR_UPD_ADD_AT_LOGIN_FLAG, CharacterDatabase, Acore::ChatCommands::PlayerIdentifier::FromTarget(), ChatHandler::GetNameLink(), LANG_CUSTOMIZE_PLAYER, LANG_CUSTOMIZE_PLAYER_GUID, ChatHandler::playerLink(), ChatHandler::PSendSysMessage(), and PreparedStatementBase::SetData().

Referenced by GetCommands().

◆ HandleCharacterDeletedDeleteCommand()

static bool character_commandscript::HandleCharacterDeletedDeleteCommand ( ChatHandler handler,
std::string  needle 
)
inlinestatic

Handles the '.character deleted delete' command, which completely deletes all deleted characters which matches the given search string

See also
Player::GetDeletedCharacterGUIDs
Player::DeleteFromDB
HandleCharacterDeletedListCommand
HandleCharacterDeletedRestoreCommand
Parameters
argsthe search string which either contains a player GUID or a part fo the character-name
678 {
679 DeletedInfoList foundList;
680 if (!GetDeletedCharacterInfoList(foundList, needle))
681 return false;
682
683 if (foundList.empty())
684 {
686 return false;
687 }
688
690 HandleCharacterDeletedListHelper(foundList, handler);
691
692 // Call the appropriate function to delete them (current account for deleted characters is 0)
693 for (DeletedInfoList::const_iterator itr = foundList.begin(); itr != foundList.end(); ++itr)
694 Player::DeleteFromDB(itr->lowGuid, 0, false, true);
695
696 return true;
697 }
@ LANG_CHARACTER_DELETED_LIST_EMPTY
Definition: Language.h:856
@ LANG_CHARACTER_DELETED_DELETE
Definition: Language.h:858
virtual void SendSysMessage(std::string_view str, bool escapeCharacters=false)
Definition: Chat.cpp:101
static void DeleteFromDB(ObjectGuid::LowType lowGuid, uint32 accountId, bool updateRealmChars, bool deleteFinally)
Definition: Player.cpp:3927
static bool GetDeletedCharacterInfoList(DeletedInfoList &foundList, std::string searchString)
Definition: cs_character.cpp:114
static void HandleCharacterDeletedListHelper(DeletedInfoList const &foundList, ChatHandler *handler)
Definition: cs_character.cpp:176
std::list< DeletedInfo > DeletedInfoList
Definition: cs_character.cpp:105

References Player::DeleteFromDB(), GetDeletedCharacterInfoList(), HandleCharacterDeletedListHelper(), LANG_CHARACTER_DELETED_DELETE, LANG_CHARACTER_DELETED_LIST_EMPTY, ChatHandler::SendErrorMessage(), and ChatHandler::SendSysMessage().

Referenced by GetCommands().

◆ HandleCharacterDeletedListCommand()

static bool character_commandscript::HandleCharacterDeletedListCommand ( ChatHandler handler,
Optional< std::string_view >  needleStr 
)
inlinestatic

Handles the '.character deleted list' command, which shows all deleted characters which matches the given search string

See also
HandleCharacterDeletedListHelper
HandleCharacterDeletedRestoreCommand
HandleCharacterDeletedDeleteCommand
DeletedInfoList
Parameters
argsthe search string which either contains a player GUID or a part fo the character-name
590 {
591 std::string needle;
592 if (needleStr)
593 needle.assign(*needleStr);
594 DeletedInfoList foundList;
595 if (!GetDeletedCharacterInfoList(foundList, needle))
596 return false;
597
598 // if no characters have been found, output a warning
599 if (foundList.empty())
600 {
602 return false;
603 }
604
605 HandleCharacterDeletedListHelper(foundList, handler);
606
607 return true;
608 }

References GetDeletedCharacterInfoList(), HandleCharacterDeletedListHelper(), LANG_CHARACTER_DELETED_LIST_EMPTY, and ChatHandler::SendErrorMessage().

Referenced by GetCommands().

◆ HandleCharacterDeletedListHelper()

static void character_commandscript::HandleCharacterDeletedListHelper ( DeletedInfoList const &  foundList,
ChatHandler handler 
)
inlinestatic

Shows all deleted characters which matches the given search string, expected non empty list

See also
HandleCharacterDeletedListCommand
HandleCharacterDeletedRestoreCommand
HandleCharacterDeletedDeleteCommand
DeletedInfoList
Parameters
foundListcontains a list with all found deleted characters
177 {
178 if (!handler->GetSession())
179 {
183 }
184
185 for (DeletedInfoList::const_iterator itr = foundList.begin(); itr != foundList.end(); ++itr)
186 {
187 std::string dateStr = Acore::Time::TimeToTimestampStr(Seconds(itr->deleteDate));
188
189 if (!handler->GetSession())
191 itr->lowGuid, itr->name.c_str(), itr->accountName.empty() ? "<Not existing>" : itr->accountName.c_str(),
192 itr->accountId, dateStr.c_str());
193 else
195 itr->lowGuid, itr->name.c_str(), itr->accountName.empty() ? "<Not existing>" : itr->accountName.c_str(),
196 itr->accountId, dateStr.c_str());
197 }
198
199 if (!handler->GetSession())
201 }
std::chrono::seconds Seconds
Seconds shorthand typedef.
Definition: Duration.h:30
@ LANG_CHARACTER_DELETED_LIST_LINE_CHAT
Definition: Language.h:863
@ LANG_CHARACTER_DELETED_LIST_HEADER
Definition: Language.h:853
@ LANG_CHARACTER_DELETED_LIST_LINE_CONSOLE
Definition: Language.h:854
@ LANG_CHARACTER_DELETED_LIST_BAR
Definition: Language.h:855
AC_COMMON_API std::string TimeToTimestampStr(Seconds time=0s, std::string_view fmt={})
Definition: Timer.cpp:272

References ChatHandler::GetSession(), LANG_CHARACTER_DELETED_LIST_BAR, LANG_CHARACTER_DELETED_LIST_HEADER, LANG_CHARACTER_DELETED_LIST_LINE_CHAT, LANG_CHARACTER_DELETED_LIST_LINE_CONSOLE, ChatHandler::PSendSysMessage(), ChatHandler::SendSysMessage(), and Acore::Time::TimeToTimestampStr().

Referenced by HandleCharacterDeletedDeleteCommand(), HandleCharacterDeletedListCommand(), and HandleCharacterDeletedRestoreCommand().

◆ HandleCharacterDeletedPurgeCommand()

static bool character_commandscript::HandleCharacterDeletedPurgeCommand ( ChatHandler ,
Optional< uint16 days 
)
inlinestatic

Handles the '.character deleted old' command, which completely deletes all deleted characters deleted with some days ago

See also
Player::DeleteOldCharacters
Player::DeleteFromDB
HandleCharacterDeletedDeleteCommand
HandleCharacterDeletedListCommand
HandleCharacterDeletedRestoreCommand
Parameters
argsthe search string which either contains a player GUID or a part of the character-name
711 {
712 int32 keepDays = static_cast<int32>(sWorld->getIntConfig(CONFIG_CHARDELETE_KEEP_DAYS));
713
714 if (days)
715 keepDays = static_cast<int32>(*days);
716 else if (keepDays <= 0) // config option value 0 -> disabled and can't be used
717 return false;
718
719 Player::DeleteOldCharacters(static_cast<uint32>(keepDays));
720
721 return true;
722 }
std::int32_t int32
Definition: Define.h:104
@ CONFIG_CHARDELETE_KEEP_DAYS
Definition: IWorld.h:352
#define sWorld
Definition: World.h:447
static void DeleteOldCharacters()
Definition: Player.cpp:4277

References CONFIG_CHARDELETE_KEEP_DAYS, Player::DeleteOldCharacters(), and sWorld.

Referenced by GetCommands().

◆ HandleCharacterDeletedRestoreCommand()

static bool character_commandscript::HandleCharacterDeletedRestoreCommand ( ChatHandler handler,
std::string  needle,
Optional< std::string_view >  newCharName,
Optional< AccountIdentifier newAccount 
)
inlinestatic

Handles the '.character deleted restore' command, which restores all deleted characters which matches the given search string

The command automatically calls '.character deleted list' command with the search string to show all restored characters.

See also
HandleCharacterDeletedRestoreHelper
HandleCharacterDeletedListCommand
HandleCharacterDeletedDeleteCommand
Parameters
argsthe search string which either contains a player GUID or a part of the character-name
622 {
623 DeletedInfoList foundList;
624 if (!GetDeletedCharacterInfoList(foundList, needle))
625 return false;
626
627 if (foundList.empty())
628 {
630 return false;
631 }
632
634 HandleCharacterDeletedListHelper(foundList, handler);
635
636 if (!newCharName)
637 {
638 // Drop nonexisting account cases
639 for (DeletedInfoList::iterator itr = foundList.begin(); itr != foundList.end(); ++itr)
641 return true;
642 }
643
644 if (foundList.size() == 1)
645 {
646 std::string newName{ *newCharName };
647 DeletedInfo delInfo = foundList.front();
648
649 // update name
650 delInfo.name = newName;
651
652 // if new account provided update deleted info
653 if (newAccount)
654 {
655 delInfo.accountId = newAccount->GetID();
656 delInfo.accountName = newAccount->GetName();
657 }
658
659 HandleCharacterDeletedRestoreHelper(delInfo, handler);
660 return true;
661 }
662
664 return false;
665 }
@ LANG_CHARACTER_DELETED_ERR_RENAME
Definition: Language.h:859
@ LANG_CHARACTER_DELETED_RESTORE
Definition: Language.h:857
static void HandleCharacterDeletedRestoreHelper(DeletedInfo const &delInfo, ChatHandler *handler)
Definition: cs_character.cpp:213

References character_commandscript::DeletedInfo::accountId, character_commandscript::DeletedInfo::accountName, GetDeletedCharacterInfoList(), HandleCharacterDeletedListHelper(), HandleCharacterDeletedRestoreHelper(), LANG_CHARACTER_DELETED_ERR_RENAME, LANG_CHARACTER_DELETED_LIST_EMPTY, LANG_CHARACTER_DELETED_RESTORE, character_commandscript::DeletedInfo::name, ChatHandler::SendErrorMessage(), and ChatHandler::SendSysMessage().

Referenced by GetCommands().

◆ HandleCharacterDeletedRestoreHelper()

static void character_commandscript::HandleCharacterDeletedRestoreHelper ( DeletedInfo const &  delInfo,
ChatHandler handler 
)
inlinestatic

Restore a previously deleted character

See also
HandleCharacterDeletedListHelper
HandleCharacterDeletedRestoreCommand
HandleCharacterDeletedDeleteCommand
DeletedInfoList
Parameters
delInfothe informations about the character which will be restored
214 {
215 if (delInfo.accountName.empty()) // account does not exist
216 {
217 handler->PSendSysMessage(LANG_CHARACTER_DELETED_SKIP_ACCOUNT, delInfo.name.c_str(), delInfo.lowGuid, delInfo.accountId);
218 return;
219 }
220
221 // check character count
222 uint32 charcount = AccountMgr::GetCharactersCount(delInfo.accountId);
223 if (charcount >= 10)
224 {
225 handler->PSendSysMessage(LANG_CHARACTER_DELETED_SKIP_FULL, delInfo.name.c_str(), delInfo.lowGuid, delInfo.accountId);
226 return;
227 }
228
229 if (sCharacterCache->GetCharacterGuidByName(delInfo.name))
230 {
231 handler->PSendSysMessage(LANG_CHARACTER_DELETED_SKIP_NAME, delInfo.name.c_str(), delInfo.lowGuid, delInfo.accountId);
232 return;
233 }
234
235 auto* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UDP_RESTORE_DELETE_INFO);
236 stmt->SetData(0, delInfo.name);
237 stmt->SetData(1, delInfo.accountId);
238 stmt->SetData(2, delInfo.lowGuid);
239 CharacterDatabase.Execute(stmt);
240
241 stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHARACTER_NAME_DATA);
242 stmt->SetData(0, delInfo.lowGuid);
243 if (PreparedQueryResult result = CharacterDatabase.Query(stmt))
244 {
245 sCharacterCache->AddCharacterCacheEntry(ObjectGuid(HighGuid::Player, delInfo.lowGuid), delInfo.accountId, delInfo.name, (*result)[2].Get<uint8>(), (*result)[0].Get<uint8>(), (*result)[1].Get<uint8>(), (*result)[3].Get<uint8>());
246 }
247 }
@ CHAR_UDP_RESTORE_DELETE_INFO
Definition: CharacterDatabase.h:293
@ CHAR_SEL_CHARACTER_NAME_DATA
Definition: CharacterDatabase.h:52
@ LANG_CHARACTER_DELETED_SKIP_NAME
Definition: Language.h:862
@ LANG_CHARACTER_DELETED_SKIP_FULL
Definition: Language.h:861
@ LANG_CHARACTER_DELETED_SKIP_ACCOUNT
Definition: Language.h:860
Definition: ObjectGuid.h:120

References character_commandscript::DeletedInfo::accountId, character_commandscript::DeletedInfo::accountName, CHAR_SEL_CHARACTER_NAME_DATA, CHAR_UDP_RESTORE_DELETE_INFO, CharacterDatabase, AccountMgr::GetCharactersCount(), LANG_CHARACTER_DELETED_SKIP_ACCOUNT, LANG_CHARACTER_DELETED_SKIP_FULL, LANG_CHARACTER_DELETED_SKIP_NAME, character_commandscript::DeletedInfo::lowGuid, character_commandscript::DeletedInfo::name, ChatHandler::PSendSysMessage(), and sCharacterCache.

Referenced by HandleCharacterDeletedRestoreCommand().

◆ HandleCharacterEraseCommand()

static bool character_commandscript::HandleCharacterEraseCommand ( ChatHandler handler,
PlayerIdentifier  player 
)
inlinestatic

Handles the '.character erase' command which completly delete a character from the DB

See also
Player::DeleteFromDB
Parameters
argsthe search string which either contains a player GUID or a part of the character-name
732 {
733 uint32 accountId;
734 if (Player* target = player.GetConnectedPlayer())
735 {
736 accountId = target->GetSession()->GetAccountId();
737 target->GetSession()->KickPlayer("HandleCharacterEraseCommand GM Command deleting character");
738 }
739 else
740 {
741 accountId = sCharacterCache->GetCharacterAccountIdByGuid(player.GetGUID());
742 }
743
744 std::string accountName;
745 AccountMgr::GetName(accountId, accountName);
746
747 Player::DeleteFromDB(player.GetGUID().GetCounter(), accountId, true, true);
748 handler->PSendSysMessage(LANG_CHARACTER_DELETED, player.GetName().c_str(), player.GetGUID().GetCounter(), accountName.c_str(), accountId);
749
750 return true;
751 }
@ LANG_CHARACTER_DELETED
Definition: Language.h:846
ObjectGuid GetGUID() const
Definition: ChatCommandTags.h:180
std::string const & GetName() const
Definition: ChatCommandTags.h:179
Player * GetConnectedPlayer() const
Definition: ChatCommandTags.h:182
LowType GetCounter() const
Definition: ObjectGuid.h:147

References Player::DeleteFromDB(), Acore::ChatCommands::PlayerIdentifier::GetConnectedPlayer(), ObjectGuid::GetCounter(), Acore::ChatCommands::PlayerIdentifier::GetGUID(), Acore::ChatCommands::PlayerIdentifier::GetName(), AccountMgr::GetName(), LANG_CHARACTER_DELETED, ChatHandler::PSendSysMessage(), and sCharacterCache.

Referenced by GetCommands().

◆ HandleCharacterLevel()

static void character_commandscript::HandleCharacterLevel ( Player player,
ObjectGuid  playerGuid,
uint32  oldLevel,
uint32  newLevel,
ChatHandler handler 
)
inlinestatic
250 {
251 if (player)
252 {
253 player->GiveLevel(newLevel);
254 player->InitTalentForLevel();
255 player->SetUInt32Value(PLAYER_XP, 0);
256
257 if (handler->needReportToTarget(player))
258 {
259 if (oldLevel == newLevel)
261 else if (oldLevel < newLevel)
262 ChatHandler(player->GetSession()).PSendSysMessage(LANG_YOURS_LEVEL_UP, handler->GetNameLink().c_str(), newLevel);
263 else // if (oldlevel > newlevel)
264 ChatHandler(player->GetSession()).PSendSysMessage(LANG_YOURS_LEVEL_DOWN, handler->GetNameLink().c_str(), newLevel);
265 }
266 }
267 else
268 {
269 // Update level and reset XP, everything else will be updated at login
270 auto* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_LEVEL);
271 stmt->SetData(0, uint8(newLevel));
272 stmt->SetData(1, playerGuid.GetCounter());
273 CharacterDatabase.Execute(stmt);
274
275 sCharacterCache->UpdateCharacterLevel(playerGuid, newLevel);
276 }
277 }
@ CHAR_UPD_LEVEL
Definition: CharacterDatabase.h:295
@ PLAYER_XP
Definition: UpdateFields.h:339
@ LANG_YOURS_LEVEL_UP
Definition: Language.h:596
@ LANG_YOURS_LEVEL_PROGRESS_RESET
Definition: Language.h:598
@ LANG_YOURS_LEVEL_DOWN
Definition: Language.h:597
Definition: Chat.h:38
virtual bool needReportToTarget(Player *chr) const
Definition: Chat.cpp:783
void SetUInt32Value(uint16 index, uint32 value)
Definition: Object.cpp:650
void InitTalentForLevel()
Definition: Player.cpp:2533
void GiveLevel(uint8 level)
Definition: Player.cpp:2431
WorldSession * GetSession() const
Definition: Player.h:1961

References CHAR_UPD_LEVEL, CharacterDatabase, ObjectGuid::GetCounter(), ChatHandler::GetNameLink(), Player::GetSession(), Player::GiveLevel(), Player::InitTalentForLevel(), LANG_YOURS_LEVEL_DOWN, LANG_YOURS_LEVEL_PROGRESS_RESET, LANG_YOURS_LEVEL_UP, ChatHandler::needReportToTarget(), PLAYER_XP, ChatHandler::PSendSysMessage(), sCharacterCache, and Object::SetUInt32Value().

Referenced by HandleCharacterLevelCommand(), and HandleLevelUpCommand().

◆ HandleCharacterLevelCommand()

static bool character_commandscript::HandleCharacterLevelCommand ( ChatHandler handler,
Optional< PlayerIdentifier player,
int16  newlevel 
)
inlinestatic
434 {
435 if (!player)
436 player = PlayerIdentifier::FromTargetOrSelf(handler);
437
438 if (!player)
439 return false;
440
441 uint8 oldlevel = player->IsConnected() ? player->GetConnectedPlayer()->GetLevel() : sCharacterCache->GetCharacterLevelByGuid(player->GetGUID());
442
443 if (newlevel < 1)
444 return false; // invalid level
445
446 if (newlevel > DEFAULT_MAX_LEVEL) // hardcoded maximum level
447 newlevel = DEFAULT_MAX_LEVEL;
448
449 HandleCharacterLevel(player->GetConnectedPlayer(), player->GetGUID(), oldlevel, newlevel, handler);
450
451 if (!handler->GetSession() || (handler->GetSession()->GetPlayer() != player->GetConnectedPlayer())) // including chr == NULL
452 handler->PSendSysMessage(LANG_YOU_CHANGE_LVL, handler->playerLink(*player).c_str(), newlevel);
453
454 return true;
455 }
@ LANG_YOU_CHANGE_LVL
Definition: Language.h:161
#define DEFAULT_MAX_LEVEL
Definition: DBCEnums.h:43
static void HandleCharacterLevel(Player *player, ObjectGuid playerGuid, uint32 oldLevel, uint32 newLevel, ChatHandler *handler)
Definition: cs_character.cpp:249

References DEFAULT_MAX_LEVEL, Acore::ChatCommands::PlayerIdentifier::FromTargetOrSelf(), WorldSession::GetPlayer(), ChatHandler::GetSession(), HandleCharacterLevel(), LANG_YOU_CHANGE_LVL, ChatHandler::playerLink(), ChatHandler::PSendSysMessage(), and sCharacterCache.

Referenced by GetCommands().

◆ HandleCharacterRenameCommand()

static bool character_commandscript::HandleCharacterRenameCommand ( ChatHandler handler,
Optional< PlayerIdentifier player,
Optional< bool >  reserveName,
Optional< std::string_view >  newNameV 
)
inlinestatic
328 {
329 if (!player && newNameV)
330 return false;
331
332 if (!player)
333 player = PlayerIdentifier::FromTarget(handler);
334
335 if (!player)
336 return false;
337
338 if (handler->HasLowerSecurity(nullptr, player->GetGUID()))
339 return false;
340
341 if (newNameV)
342 {
343 std::string newName{ *newNameV };
344 if (!normalizePlayerName(newName))
345 {
347 return false;
348 }
349
350 if (ObjectMgr::CheckPlayerName(newName, true) != CHAR_NAME_SUCCESS)
351 {
353 return false;
354 }
355
356 if (sObjectMgr->IsReservedName(newName))
357 {
359 return false;
360 }
361
362 if (sObjectMgr->IsProfanityName(newName))
363 {
365 return false;
366 }
367
369 stmt->SetData(0, newName);
370 PreparedQueryResult result = CharacterDatabase.Query(stmt);
371 if (result)
372 {
373 handler->SendErrorMessage(LANG_RENAME_PLAYER_ALREADY_EXISTS, newName.c_str());
374 return false;
375 }
376
377 // Remove declined name from db
378 stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_DECLINED_NAME);
379 stmt->SetData(0, player->GetGUID().GetCounter());
380 CharacterDatabase.Execute(stmt);
381
382 if (Player* target = player->GetConnectedPlayer())
383 {
384 target->SetName(newName);
385
386 ObjectAccessor::UpdatePlayerNameMapReference(player->GetName(), target);
387
388 if (WorldSession* session = target->GetSession())
389 session->KickPlayer("HandleCharacterRenameCommand GM Command renaming character");
390 }
391 else
392 {
393 stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_NAME_BY_GUID);
394 stmt->SetData(0, newName);
395 stmt->SetData(1, player->GetGUID().GetCounter());
396 CharacterDatabase.Execute(stmt);
397 }
398
399 sCharacterCache->UpdateCharacterData(player->GetGUID(), newName);
400
401 handler->PSendSysMessage(LANG_RENAME_PLAYER_WITH_NEW_NAME, player->GetName().c_str(), newName.c_str());
402 }
403 else
404 {
405 if (Player* target = player->GetConnectedPlayer())
406 {
407 handler->PSendSysMessage(LANG_RENAME_PLAYER, handler->GetNameLink(target).c_str());
408 target->SetAtLoginFlag(AT_LOGIN_RENAME);
409 }
410 else
411 {
412 // check offline security
413 if (handler->HasLowerSecurity(nullptr, player->GetGUID()))
414 return false;
415
416 handler->PSendSysMessage(LANG_RENAME_PLAYER_GUID, handler->playerLink(*player).c_str(), player->GetGUID().GetCounter());
417
419 stmt->SetData(0, uint16(AT_LOGIN_RENAME));
420 stmt->SetData(1, player->GetGUID().GetCounter());
421 CharacterDatabase.Execute(stmt);
422 }
423 }
424
425 if (reserveName)
426 {
427 sObjectMgr->AddReservedPlayerName(player->GetName());
428 }
429
430 return true;
431 }
@ CHAR_SEL_CHECK_NAME
Definition: CharacterDatabase.h:37
@ CHAR_DEL_DECLINED_NAME
Definition: CharacterDatabase.h:138
@ CHAR_UPD_NAME_BY_GUID
Definition: CharacterDatabase.h:137
@ AT_LOGIN_RENAME
Definition: Player.h:601
#define sObjectMgr
Definition: ObjectMgr.h:1640
@ LANG_RENAME_PLAYER
Definition: Language.h:295
@ LANG_RENAME_PLAYER_WITH_NEW_NAME
Definition: Language.h:129
@ LANG_PROFANITY_NAME
Definition: Language.h:221
@ LANG_BAD_VALUE
Definition: Language.h:147
@ LANG_RESERVED_NAME
Definition: Language.h:206
@ LANG_RENAME_PLAYER_ALREADY_EXISTS
Definition: Language.h:128
@ LANG_RENAME_PLAYER_GUID
Definition: Language.h:296
@ CHAR_NAME_SUCCESS
Definition: SharedDefines.h:3419
void UpdatePlayerNameMapReference(std::string oldname, Player *player)
Definition: ObjectAccessor.cpp:349
bool HasLowerSecurity(Player *target, ObjectGuid guid=ObjectGuid::Empty, bool strong=false)
Definition: Chat.cpp:53
static uint8 CheckPlayerName(std::string_view name, bool create=false)
Definition: ObjectMgr.cpp:8362
Player session in the World.
Definition: WorldSession.h:330

References AT_LOGIN_RENAME, CHAR_DEL_DECLINED_NAME, CHAR_NAME_SUCCESS, CHAR_SEL_CHECK_NAME, CHAR_UPD_ADD_AT_LOGIN_FLAG, CHAR_UPD_NAME_BY_GUID, CharacterDatabase, ObjectMgr::CheckPlayerName(), Acore::ChatCommands::PlayerIdentifier::FromTarget(), ChatHandler::GetNameLink(), ChatHandler::HasLowerSecurity(), LANG_BAD_VALUE, LANG_PROFANITY_NAME, LANG_RENAME_PLAYER, LANG_RENAME_PLAYER_ALREADY_EXISTS, LANG_RENAME_PLAYER_GUID, LANG_RENAME_PLAYER_WITH_NEW_NAME, LANG_RESERVED_NAME, normalizePlayerName(), ChatHandler::playerLink(), ChatHandler::PSendSysMessage(), sCharacterCache, ChatHandler::SendErrorMessage(), PreparedStatementBase::SetData(), sObjectMgr, and ObjectAccessor::UpdatePlayerNameMapReference().

Referenced by GetCommands().

◆ HandleCharacterReputationCommand()

static bool character_commandscript::HandleCharacterReputationCommand ( ChatHandler handler,
Optional< PlayerIdentifier player 
)
inlinestatic
531 {
532 if (!player)
533 player = PlayerIdentifier::FromTargetOrSelf(handler);
534 if (!player || !player->IsConnected())
535 {
537 return false;
538 }
539
540 Player const* target = player->GetConnectedPlayer();
541 LocaleConstant loc = handler->GetSessionDbcLocale();
542
543 FactionStateList const& targetFSL = target->GetReputationMgr().GetStateList();
544 for (FactionStateList::const_iterator itr = targetFSL.begin(); itr != targetFSL.end(); ++itr)
545 {
546 FactionState const& faction = itr->second;
547 FactionEntry const* factionEntry = sFactionStore.LookupEntry(faction.ID);
548 char const* factionName = factionEntry ? factionEntry->name[loc] : "#Not found#";
549 ReputationRank rank = target->GetReputationMgr().GetRank(factionEntry);
550 std::string rankName = handler->GetAcoreString(ReputationRankStrIndex[rank]);
551 std::ostringstream ss;
552 if (handler->GetSession())
553 ss << faction.ID << " - |cffffffff|Hfaction:" << faction.ID << "|h[" << factionName << ' ' << localeNames[loc] << "]|h|r";
554 else
555 ss << faction.ID << " - " << factionName << ' ' << localeNames[loc];
556
557 ss << ' ' << rankName << " (" << target->GetReputationMgr().GetReputation(factionEntry) << ')';
558
559 if (faction.Flags & FACTION_FLAG_VISIBLE)
560 ss << handler->GetAcoreString(LANG_FACTION_VISIBLE);
561 if (faction.Flags & FACTION_FLAG_AT_WAR)
562 ss << handler->GetAcoreString(LANG_FACTION_ATWAR);
563 if (faction.Flags & FACTION_FLAG_PEACE_FORCED)
565 if (faction.Flags & FACTION_FLAG_HIDDEN)
566 ss << handler->GetAcoreString(LANG_FACTION_HIDDEN);
569 if (faction.Flags & FACTION_FLAG_INACTIVE)
571
572 handler->SendSysMessage(ss.str().c_str());
573 }
574
575 return true;
576 }
char const * localeNames[TOTAL_LOCALES]
Definition: Common.cpp:20
LocaleConstant
Definition: Common.h:67
DBCStorage< FactionEntry > sFactionStore(FactionEntryfmt)
@ LANG_FACTION_PEACE_FORCED
Definition: Language.h:355
@ LANG_FACTION_ATWAR
Definition: Language.h:354
@ LANG_FACTION_INVISIBLE_FORCED
Definition: Language.h:357
@ LANG_FACTION_HIDDEN
Definition: Language.h:356
@ LANG_FACTION_INACTIVE
Definition: Language.h:358
@ LANG_FACTION_VISIBLE
Definition: Language.h:353
constexpr std::array< uint32, MAX_REPUTATION_RANK > ReputationRankStrIndex
Definition: ReputationMgr.h:28
std::map< RepListID, FactionState > FactionStateList
Definition: ReputationMgr.h:52
@ FACTION_FLAG_INACTIVE
Definition: DBCEnums.h:320
@ FACTION_FLAG_PEACE_FORCED
Definition: DBCEnums.h:319
@ FACTION_FLAG_INVISIBLE_FORCED
Definition: DBCEnums.h:318
@ FACTION_FLAG_HIDDEN
Definition: DBCEnums.h:317
@ FACTION_FLAG_VISIBLE
Definition: DBCEnums.h:315
@ FACTION_FLAG_AT_WAR
Definition: DBCEnums.h:316
ReputationRank
Definition: SharedDefines.h:179
virtual LocaleConstant GetSessionDbcLocale() const
Definition: Chat.cpp:789
virtual char const * GetAcoreString(uint32 entry) const
Definition: Chat.cpp:42
ReputationMgr & GetReputationMgr()
Definition: Player.h:2089
Definition: ReputationMgr.h:42
uint32 ID
Definition: ReputationMgr.h:43
uint8 Flags
Definition: ReputationMgr.h:46
FactionStateList const & GetStateList() const
Definition: ReputationMgr.h:80
int32 GetReputation(uint32 faction_id) const
Definition: ReputationMgr.cpp:78
ReputationRank GetRank(FactionEntry const *factionEntry) const
Definition: ReputationMgr.cpp:125
Definition: DBCStructure.h:898
char const * name[16]
Definition: DBCStructure.h:910

References FACTION_FLAG_AT_WAR, FACTION_FLAG_HIDDEN, FACTION_FLAG_INACTIVE, FACTION_FLAG_INVISIBLE_FORCED, FACTION_FLAG_PEACE_FORCED, FACTION_FLAG_VISIBLE, FactionState::Flags, Acore::ChatCommands::PlayerIdentifier::FromTargetOrSelf(), ChatHandler::GetAcoreString(), ReputationMgr::GetRank(), ReputationMgr::GetReputation(), Player::GetReputationMgr(), ChatHandler::GetSession(), ChatHandler::GetSessionDbcLocale(), ReputationMgr::GetStateList(), FactionState::ID, LANG_FACTION_ATWAR, LANG_FACTION_HIDDEN, LANG_FACTION_INACTIVE, LANG_FACTION_INVISIBLE_FORCED, LANG_FACTION_PEACE_FORCED, LANG_FACTION_VISIBLE, LANG_PLAYER_NOT_FOUND, localeNames, FactionEntry::name, ReputationRankStrIndex, ChatHandler::SendErrorMessage(), ChatHandler::SendSysMessage(), and sFactionStore.

Referenced by GetCommands().

◆ HandleCharacterTitlesCommand()

static bool character_commandscript::HandleCharacterTitlesCommand ( ChatHandler handler,
Optional< PlayerIdentifier player 
)
inlinestatic
280 {
281 if (!player)
282 player = PlayerIdentifier::FromTargetOrSelf(handler);
283
284 if (!player || !player->IsConnected())
285 {
287 return false;
288 }
289
290 Player const* target = player->GetConnectedPlayer();
291
292 LocaleConstant loc = handler->GetSessionDbcLocale();
293 char const* knownStr = handler->GetAcoreString(LANG_KNOWN);
294
295 // Search in CharTitles.dbc
296 for (uint32 id = 0; id < sCharTitlesStore.GetNumRows(); id++)
297 {
298 CharTitlesEntry const* titleInfo = sCharTitlesStore.LookupEntry(id);
299
300 if (titleInfo && target->HasTitle(titleInfo))
301 {
302 char const* name = target->getGender() == GENDER_MALE ? titleInfo->nameMale[loc] : titleInfo->nameFemale[loc];
303 if (!*name)
304 name = (target->getGender() == GENDER_MALE ? titleInfo->nameMale[sWorld->GetDefaultDbcLocale()] : titleInfo->nameFemale[sWorld->GetDefaultDbcLocale()]);
305
306 if (!*name)
307 continue;
308
309 char const* activeStr = "";
310 if (target->GetUInt32Value(PLAYER_CHOSEN_TITLE) == titleInfo->bit_index)
311 activeStr = handler->GetAcoreString(LANG_ACTIVE);
312
313 std::string titleName = Acore::StringFormat(name, player->GetName().c_str());
314
315 // send title in "id (idx:idx) - [namedlink locale]" format
316 if (handler->GetSession())
317 handler->PSendSysMessage(LANG_TITLE_LIST_CHAT, id, titleInfo->bit_index, id, titleName.c_str(), localeNames[loc], knownStr, activeStr);
318 else
319 handler->PSendSysMessage(LANG_TITLE_LIST_CONSOLE, id, titleInfo->bit_index, name, localeNames[loc], knownStr, activeStr);
320 }
321 }
322
323 return true;
324 }
DBCStorage< CharTitlesEntry > sCharTitlesStore(CharTitlesEntryfmt)
@ PLAYER_CHOSEN_TITLE
Definition: UpdateFields.h:324
@ LANG_KNOWN
Definition: Language.h:63
@ LANG_TITLE_LIST_CHAT
Definition: Language.h:390
@ LANG_ACTIVE
Definition: Language.h:67
@ LANG_TITLE_LIST_CONSOLE
Definition: Language.h:391
@ GENDER_MALE
Definition: SharedDefines.h:61
std::string StringFormat(Format &&fmt, Args &&... args)
Default AC string format function.
Definition: StringFormat.h:30
uint32 GetUInt32Value(uint16 index) const
Definition: Object.cpp:305
bool HasTitle(uint32 bitIndex) const
Definition: Player.cpp:13241
uint8 getGender() const
Definition: Unit.h:1440
Definition: DBCStructure.h:632
uint32 bit_index
Definition: DBCStructure.h:639
char const * nameMale[16]
Definition: DBCStructure.h:635
char const * nameFemale[16]
Definition: DBCStructure.h:637

References CharTitlesEntry::bit_index, Acore::ChatCommands::PlayerIdentifier::FromTargetOrSelf(), GENDER_MALE, ChatHandler::GetAcoreString(), Unit::getGender(), ChatHandler::GetSession(), ChatHandler::GetSessionDbcLocale(), Object::GetUInt32Value(), Player::HasTitle(), LANG_ACTIVE, LANG_KNOWN, LANG_PLAYER_NOT_FOUND, LANG_TITLE_LIST_CHAT, LANG_TITLE_LIST_CONSOLE, localeNames, CharTitlesEntry::nameFemale, CharTitlesEntry::nameMale, PLAYER_CHOSEN_TITLE, ChatHandler::PSendSysMessage(), sCharTitlesStore, ChatHandler::SendErrorMessage(), Acore::StringFormat(), and sWorld.

Referenced by GetCommands().

◆ HandleLevelUpCommand()

static bool character_commandscript::HandleLevelUpCommand ( ChatHandler handler,
Optional< PlayerIdentifier player,
int16  level 
)
inlinestatic
754 {
755 if (!player)
756 player = PlayerIdentifier::FromTargetOrSelf(handler);
757
758 if (!player)
759 return false;
760
761 uint8 oldlevel = player->IsConnected() ? player->GetConnectedPlayer()->GetLevel() : sCharacterCache->GetCharacterLevelByGuid(player->GetGUID());
762 int16 newlevel = static_cast<int16>(oldlevel) + level;
763
764 if (newlevel < 1)
765 newlevel = 1;
766
767 if (newlevel > STRONG_MAX_LEVEL) // hardcoded maximum level
768 newlevel = STRONG_MAX_LEVEL;
769
770 HandleCharacterLevel(player->GetConnectedPlayer(), player->GetGUID(), oldlevel, newlevel, handler);
771
772 if (!handler->GetSession() || (handler->GetSession()->GetPlayer() != player->GetConnectedPlayer())) // including chr == NULL
773 handler->PSendSysMessage(LANG_YOU_CHANGE_LVL, handler->playerLink(*player).c_str(), newlevel);
774
775 return true;
776 }
std::int16_t int16
Definition: Define.h:105
#define STRONG_MAX_LEVEL
Definition: DBCEnums.h:51

References Acore::ChatCommands::PlayerIdentifier::FromTargetOrSelf(), WorldSession::GetPlayer(), ChatHandler::GetSession(), HandleCharacterLevel(), LANG_YOU_CHANGE_LVL, ChatHandler::playerLink(), ChatHandler::PSendSysMessage(), sCharacterCache, and STRONG_MAX_LEVEL.

Referenced by GetCommands().

◆ HandlePDumpCopyCommand()

static bool character_commandscript::HandlePDumpCopyCommand ( ChatHandler handler,
PlayerIdentifier  player,
AccountIdentifier  account,
Optional< std::string_view >  characterName,
Optional< ObjectGuid::LowType characterGUID 
)
inlinestatic
838 {
839 std::string name;
840 if (!ValidatePDumpTarget(handler, name, characterName, characterGUID))
841 return false;
842
843 std::string dump;
844 switch (PlayerDumpWriter().WriteDumpToString(dump, player.GetGUID().GetCounter()))
845 {
846 case DUMP_SUCCESS:
847 break;
850 return false;
851 case DUMP_FILE_OPEN_ERROR: // this error code should not happen
852 default:
854 return false;
855 }
856
857 switch (PlayerDumpReader().LoadDumpFromString(dump, account, name, characterGUID.value_or(0)))
858 {
859 case DUMP_SUCCESS:
860 break;
862 handler->SendErrorMessage(LANG_ACCOUNT_CHARACTER_LIST_FULL, account.GetName().c_str(), account.GetID());
863 return false;
864 case DUMP_FILE_OPEN_ERROR: // this error code should not happen
865 case DUMP_FILE_BROKEN: // this error code should not happen
866 default:
868 return false;
869 }
870
871 // Original TC Notes from Refactor vvv
872 //ToDo: use a new acore_string for this commands
874
875 return true;
876 }
@ LANG_COMMAND_EXPORT_DELETED_CHAR
Definition: Language.h:901
@ LANG_COMMAND_IMPORT_FAILED
Definition: Language.h:499
@ LANG_COMMAND_EXPORT_FAILED
Definition: Language.h:501
@ LANG_COMMAND_IMPORT_SUCCESS
Definition: Language.h:498
@ DUMP_FILE_OPEN_ERROR
Definition: PlayerDump.h:58
@ DUMP_CHARACTER_DELETED
Definition: PlayerDump.h:61
@ DUMP_SUCCESS
Definition: PlayerDump.h:57
@ DUMP_TOO_MANY_CHARS
Definition: PlayerDump.h:59
@ DUMP_FILE_BROKEN
Definition: PlayerDump.h:60
uint32 GetID() const
Definition: ChatCommandTags.h:158
std::string const & GetName() const
Definition: ChatCommandTags.h:159
Definition: PlayerDump.h:78
Definition: PlayerDump.h:98
static bool ValidatePDumpTarget(ChatHandler *handler, std::string &name, Optional< std::string_view > characterName, Optional< ObjectGuid::LowType > characterGUID)
Definition: cs_character.cpp:778

References DUMP_CHARACTER_DELETED, DUMP_FILE_BROKEN, DUMP_FILE_OPEN_ERROR, DUMP_SUCCESS, DUMP_TOO_MANY_CHARS, ObjectGuid::GetCounter(), Acore::ChatCommands::PlayerIdentifier::GetGUID(), Acore::ChatCommands::AccountIdentifier::GetID(), Acore::ChatCommands::AccountIdentifier::GetName(), LANG_ACCOUNT_CHARACTER_LIST_FULL, LANG_COMMAND_EXPORT_DELETED_CHAR, LANG_COMMAND_EXPORT_FAILED, LANG_COMMAND_IMPORT_FAILED, LANG_COMMAND_IMPORT_SUCCESS, ChatHandler::PSendSysMessage(), ChatHandler::SendErrorMessage(), and ValidatePDumpTarget().

◆ HandlePDumpLoadCommand()

static bool character_commandscript::HandlePDumpLoadCommand ( ChatHandler handler,
std::string  fileName,
AccountIdentifier  account,
Optional< std::string_view >  characterName,
Optional< ObjectGuid::LowType characterGUID 
)
inlinestatic
810 {
811 std::string name;
812 if (!ValidatePDumpTarget(handler, name, characterName, characterGUID))
813 return false;
814
815 switch (PlayerDumpReader().LoadDumpFromFile(fileName, account, name, characterGUID.value_or(0)))
816 {
817 case DUMP_SUCCESS:
819 break;
821 handler->SendErrorMessage(LANG_FILE_OPEN_FAIL, fileName.c_str());
822 return false;
823 case DUMP_FILE_BROKEN:
824 handler->SendErrorMessage(LANG_DUMP_BROKEN, fileName.c_str());
825 return false;
827 handler->SendErrorMessage(LANG_ACCOUNT_CHARACTER_LIST_FULL, account.GetName().c_str(), account.GetID());
828 return false;
829 default:
831 return false;
832 }
833
834 return true;
835 }
@ LANG_DUMP_BROKEN
Definition: Language.h:885
@ LANG_FILE_OPEN_FAIL
Definition: Language.h:883

References DUMP_FILE_BROKEN, DUMP_FILE_OPEN_ERROR, DUMP_SUCCESS, DUMP_TOO_MANY_CHARS, Acore::ChatCommands::AccountIdentifier::GetID(), Acore::ChatCommands::AccountIdentifier::GetName(), LANG_ACCOUNT_CHARACTER_LIST_FULL, LANG_COMMAND_IMPORT_FAILED, LANG_COMMAND_IMPORT_SUCCESS, LANG_DUMP_BROKEN, LANG_FILE_OPEN_FAIL, ChatHandler::PSendSysMessage(), ChatHandler::SendErrorMessage(), and ValidatePDumpTarget().

Referenced by GetCommands().

◆ HandlePDumpWriteCommand()

static bool character_commandscript::HandlePDumpWriteCommand ( ChatHandler handler,
std::string  fileName,
PlayerIdentifier  player 
)
inlinestatic
879 {
880 switch (PlayerDumpWriter().WriteDumpToFile(fileName, player.GetGUID().GetCounter()))
881 {
882 case DUMP_SUCCESS:
884 break;
886 handler->SendErrorMessage(LANG_FILE_OPEN_FAIL, fileName.c_str());
887 return false;
890 return false;
891 default:
893 return false;
894 }
895
896 return true;
897 }
@ LANG_COMMAND_EXPORT_SUCCESS
Definition: Language.h:500

References DUMP_CHARACTER_DELETED, DUMP_FILE_OPEN_ERROR, DUMP_SUCCESS, ObjectGuid::GetCounter(), Acore::ChatCommands::PlayerIdentifier::GetGUID(), LANG_COMMAND_EXPORT_DELETED_CHAR, LANG_COMMAND_EXPORT_FAILED, LANG_COMMAND_EXPORT_SUCCESS, LANG_FILE_OPEN_FAIL, ChatHandler::PSendSysMessage(), and ChatHandler::SendErrorMessage().

Referenced by GetCommands().

◆ ValidatePDumpTarget()

static bool character_commandscript::ValidatePDumpTarget ( ChatHandler handler,
std::string &  name,
Optional< std::string_view >  characterName,
Optional< ObjectGuid::LowType characterGUID 
)
inlinestatic
779 {
780 if (characterName)
781 {
782 name.assign(*characterName);
783 // normalize the name if specified and check if it exists
784 if (!normalizePlayerName(name))
785 {
787 return false;
788 }
789
791 {
793 return false;
794 }
795 }
796
797 if (characterGUID)
798 {
799 if (sCharacterCache->GetCharacterAccountIdByGuid(ObjectGuid(HighGuid::Player, *characterGUID)))
800 {
801 handler->SendErrorMessage(LANG_CHARACTER_GUID_IN_USE, *characterGUID);
802 return false;
803 }
804 }
805
806 return true;
807 }
@ LANG_CHARACTER_GUID_IN_USE
Definition: Language.h:888
@ LANG_INVALID_CHARACTER_NAME
Definition: Language.h:886

References CHAR_NAME_SUCCESS, ObjectMgr::CheckPlayerName(), LANG_CHARACTER_GUID_IN_USE, LANG_INVALID_CHARACTER_NAME, normalizePlayerName(), sCharacterCache, and ChatHandler::SendErrorMessage().

Referenced by HandlePDumpCopyCommand(), and HandlePDumpLoadCommand().