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
 
uint16 GetTotalAvailableHooks ()
 

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, uint16 totalAvailableHooks=0)
 
virtual ~ScriptObject ()=default
 

Detailed Description

Member Typedef Documentation

◆ DeletedInfoList

Constructor & Destructor Documentation

◆ character_commandscript()

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

Member Function Documentation

◆ GetCommands()

ChatCommandTable character_commandscript::GetCommands ( ) const
inlineoverridevirtual

Implements CommandScript.

49 {
50 static ChatCommandTable pdumpCommandTable =
51 {
52 { "load", HandlePDumpLoadCommand, SEC_ADMINISTRATOR, Console::Yes },
53 { "write", HandlePDumpWriteCommand, SEC_ADMINISTRATOR, Console::Yes }
54 };
55
56 static ChatCommandTable characterDeletedCommandTable =
57 {
58 { "delete", HandleCharacterDeletedDeleteCommand, SEC_CONSOLE, Console::Yes },
60 { "restore", HandleCharacterDeletedRestoreCommand, SEC_ADMINISTRATOR, Console::Yes },
61 { "purge", HandleCharacterDeletedPurgeCommand, SEC_CONSOLE, Console::Yes }
62 };
63
64 static ChatCommandTable characterCheckCommandTable =
65 {
66 { "bank", HandleCharacterCheckBankCommand, SEC_GAMEMASTER, Console::Yes },
67 { "bag", HandleCharacterCheckBagCommand, SEC_GAMEMASTER, Console::Yes },
68 { "profession", HandleCharacterCheckProfessionCommand, SEC_GAMEMASTER, Console::Yes }
69 };
70
71 static ChatCommandTable characterCommandTable =
72 {
73 { "customize", HandleCharacterCustomizeCommand, SEC_GAMEMASTER, Console::Yes },
74 { "changefaction", HandleCharacterChangeFactionCommand, SEC_GAMEMASTER, Console::Yes },
75 { "changerace", HandleCharacterChangeRaceCommand, SEC_GAMEMASTER, Console::Yes },
76 { "changeaccount", HandleCharacterChangeAccountCommand, SEC_ADMINISTRATOR, Console::Yes },
77 { "check", characterCheckCommandTable },
78 { "erase", HandleCharacterEraseCommand, SEC_CONSOLE, Console::Yes },
79 { "deleted", characterDeletedCommandTable },
80 { "level", HandleCharacterLevelCommand, SEC_GAMEMASTER, Console::Yes },
81 { "rename", HandleCharacterRenameCommand, SEC_GAMEMASTER, Console::Yes },
82 { "reputation", HandleCharacterReputationCommand, SEC_GAMEMASTER, Console::Yes },
83 { "titles", HandleCharacterTitlesCommand, SEC_GAMEMASTER, Console::Yes }
84 };
85
86 static ChatCommandTable commandTable =
87 {
88 { "character", characterCommandTable },
89 { "levelup", HandleLevelUpCommand, SEC_GAMEMASTER, Console::No },
90 { "pdump", pdumpCommandTable }
91 };
92
93 return commandTable;
94 }
@ SEC_ADMINISTRATOR
Definition: Common.h:60
@ SEC_GAMEMASTER
Definition: Common.h:59
@ SEC_CONSOLE
Definition: Common.h:61
std::vector< ChatCommandBuilder > ChatCommandTable
Definition: ChatCommand.h:49
static bool HandleCharacterChangeAccountCommand(ChatHandler *handler, std::string accountName, Optional< PlayerIdentifier > player)
Definition: cs_character.cpp:1052
static bool HandleCharacterDeletedListCommand(ChatHandler *handler, Optional< std::string_view > needleStr)
Definition: cs_character.cpp:593
static bool HandleCharacterCheckBankCommand(ChatHandler *handler)
Definition: cs_character.cpp:903
static bool HandlePDumpLoadCommand(ChatHandler *handler, std::string fileName, AccountIdentifier account, Optional< std::string_view > characterName, Optional< ObjectGuid::LowType > characterGUID)
Definition: cs_character.cpp:813
static bool HandleCharacterDeletedPurgeCommand(ChatHandler *, Optional< uint16 > days)
Definition: cs_character.cpp:714
static bool HandleLevelUpCommand(ChatHandler *handler, Optional< PlayerIdentifier > player, int16 level)
Definition: cs_character.cpp:757
static bool HandleCharacterRenameCommand(ChatHandler *handler, Optional< PlayerIdentifier > player, Optional< bool > reserveName, Optional< std::string_view > newNameV)
Definition: cs_character.cpp:330
static bool HandleCharacterLevelCommand(ChatHandler *handler, Optional< PlayerIdentifier > player, int16 newlevel)
Definition: cs_character.cpp:437
static bool HandleCharacterCustomizeCommand(ChatHandler *handler, Optional< PlayerIdentifier > player)
Definition: cs_character.cpp:462
static bool HandleCharacterCheckProfessionCommand(ChatHandler *handler)
Definition: cs_character.cpp:974
static bool HandleCharacterDeletedDeleteCommand(ChatHandler *handler, std::string needle)
Definition: cs_character.cpp:681
static bool HandleCharacterChangeRaceCommand(ChatHandler *handler, Optional< PlayerIdentifier > player)
Definition: cs_character.cpp:510
static bool HandleCharacterTitlesCommand(ChatHandler *handler, Optional< PlayerIdentifier > player)
Definition: cs_character.cpp:282
static bool HandlePDumpWriteCommand(ChatHandler *handler, std::string fileName, PlayerIdentifier player)
Definition: cs_character.cpp:882
static bool HandleCharacterReputationCommand(ChatHandler *handler, Optional< PlayerIdentifier > player)
Definition: cs_character.cpp:534
static bool HandleCharacterEraseCommand(ChatHandler *handler, PlayerIdentifier player)
Definition: cs_character.cpp:735
static bool HandleCharacterCheckBagCommand(ChatHandler *handler, uint8 BagSlot)
Definition: cs_character.cpp:909
static bool HandleCharacterChangeFactionCommand(ChatHandler *handler, Optional< PlayerIdentifier > player)
Definition: cs_character.cpp:486
static bool HandleCharacterDeletedRestoreCommand(ChatHandler *handler, std::string needle, Optional< std::string_view > newCharName, Optional< AccountIdentifier > newAccount)
Definition: cs_character.cpp:625

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)
116 {
117 PreparedQueryResult result;
119 if (!searchString.empty())
120 {
121 // search by GUID
122 if (isNumeric(searchString.c_str()))
123 {
124 stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHAR_DEL_INFO_BY_GUID);
125 stmt->SetData(0, *Acore::StringTo<uint32>(searchString));
126 result = CharacterDatabase.Query(stmt);
127 }
128 // search by name
129 else
130 {
131 if (!normalizePlayerName(searchString))
132 return false;
133
134 stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHAR_DEL_INFO_BY_NAME);
135 stmt->SetData(0, searchString);
136 result = CharacterDatabase.Query(stmt);
137 }
138 }
139 else
140 {
141 stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHAR_DEL_INFO);
142 result = CharacterDatabase.Query(stmt);
143 }
144
145 if (result)
146 {
147 do
148 {
149 Field* fields = result->Fetch();
150
151 DeletedInfo info;
152
153 info.lowGuid = fields[0].Get<uint32>();
154 info.name = fields[1].Get<std::string>();
155 info.accountId = fields[2].Get<uint32>();
156
157 // account name will be empty for nonexisting account
158 AccountMgr::GetName(info.accountId, info.accountName);
159 info.deleteDate = time_t(fields[3].Get<uint32>());
160 foundList.push_back(info);
161 } while (result->NextRow());
162 }
163
164 return true;
165 }
bool isNumeric(wchar_t wchar)
Definition: Util.h:204
std::uint32_t uint32
Definition: Define.h:107
bool normalizePlayerName(std::string &name)
Definition: ObjectMgr.cpp:206
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
DatabaseWorkerPool< CharacterDatabaseConnection > CharacterDatabase
Accessor to the character database.
Definition: DatabaseEnv.cpp:21
bool GetName(uint32 accountId, std::string &name)
Definition: AccountMgr.cpp:257
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
1053 {
1054 if (!player)
1055 {
1056 player = PlayerIdentifier::FromTargetOrSelf(handler);
1057 }
1058
1059 if (!player)
1060 {
1062 return false;
1063 }
1064
1065 if (uint32 accountId = AccountMgr::GetId(accountName))
1066 {
1067 if (AccountMgr::GetCharactersCount(accountId) >= 10)
1068 {
1069 handler->SendErrorMessage(LANG_ACCOUNT_CHARACTER_LIST_FULL, accountName, accountId);
1070 return true;
1071 }
1072
1073 if (CharacterCacheEntry const* cache = sCharacterCache->GetCharacterCacheByName(player->GetName()))
1074 {
1075 std::string accName;
1076 AccountMgr::GetName(cache->AccountId, accName);
1077 handler->PSendSysMessage(LANG_CMD_CHAR_CHANGE_ACC_SUCCESS, player->GetName(), player->GetGUID().ToString(), accName, cache->AccountId, accountName, accountId);
1078 }
1079
1080 if (player->IsConnected())
1081 {
1082 player->GetConnectedPlayer()->GetSession()->KickPlayer("CMD char changeaccount");
1083 }
1084
1085 CharacterDatabase.Query("UPDATE characters SET account = {} WHERE guid = {}", accountId, player->GetGUID().GetCounter());
1086 sCharacterCache->UpdateCharacterAccountId(player->GetGUID(), accountId);
1087
1088 }
1089 else
1090 {
1091 handler->SendErrorMessage(LANG_ACCOUNT_NOT_EXIST, accountName);
1092 return true;
1093 }
1094
1095 return true;
1096 }
#define sCharacterCache
Definition: CharacterCache.h:83
@ LANG_ACCOUNT_CHARACTER_LIST_FULL
Definition: Language.h:902
@ LANG_PLAYER_NOT_FOUND
Definition: Language.h:539
@ LANG_ACCOUNT_NOT_EXIST
Definition: Language.h:442
@ LANG_CMD_CHAR_CHANGE_ACC_SUCCESS
Definition: Language.h:1142
uint32 GetCharactersCount(uint32 accountId)
Definition: AccountMgr.cpp:295
uint32 GetId(std::string const &username)
Definition: AccountMgr.cpp:229
Definition: CharacterCache.h:28
void PSendSysMessage(std::string_view str, bool escapeCharacters=false)
Definition: Chat.cpp:213
void SendErrorMessage(uint32 entry)
Definition: Chat.cpp:218
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
487 {
488 if (!player)
489 player = PlayerIdentifier::FromTarget(handler);
490 if (!player)
491 return false;
492
493 if (Player* target = player->GetConnectedPlayer())
494 {
495 handler->PSendSysMessage(LANG_CUSTOMIZE_PLAYER, handler->GetNameLink(target));
496 target->SetAtLoginFlag(AT_LOGIN_CHANGE_FACTION);
497 }
498 else
499 {
500 handler->PSendSysMessage(LANG_CUSTOMIZE_PLAYER_GUID, handler->playerLink(*player), player->GetGUID().ToString());
503 stmt->SetData(1, player->GetGUID().GetCounter());
504 CharacterDatabase.Execute(stmt);
505 }
506
507 return true;
508 }
std::uint16_t uint16
Definition: Define.h:108
@ LANG_CUSTOMIZE_PLAYER_GUID
Definition: Language.h:387
@ LANG_CUSTOMIZE_PLAYER
Definition: Language.h:386
@ AT_LOGIN_CHANGE_FACTION
Definition: Player.h:606
@ CHAR_UPD_ADD_AT_LOGIN_FLAG
Definition: CharacterDatabase.h:274
virtual std::string GetNameLink() const
Definition: Chat.h:200
std::string playerLink(std::string const &name) const
Definition: Chat.h:233
static Optional< PlayerIdentifier > FromTarget(ChatHandler *handler)
Definition: ChatCommandTags.cpp:138
Definition: Player.h:1064

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
511 {
512 if (!player)
513 player = PlayerIdentifier::FromTarget(handler);
514 if (!player)
515 return false;
516
517 if (Player* target = player->GetConnectedPlayer())
518 {
519 handler->PSendSysMessage(LANG_CUSTOMIZE_PLAYER, handler->GetNameLink(target));
520 target->SetAtLoginFlag(AT_LOGIN_CHANGE_RACE);
521 }
522 else
523 {
524 handler->PSendSysMessage(LANG_CUSTOMIZE_PLAYER_GUID, handler->playerLink(*player), player->GetGUID().ToString());
527 stmt->SetData(1, player->GetGUID().GetCounter());
528 CharacterDatabase.Execute(stmt);
529 }
530
531 return true;
532 }
@ AT_LOGIN_CHANGE_RACE
Definition: Player.h:607

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

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
904 {
905 handler->GetSession()->SendShowBank(handler->GetSession()->GetPlayer()->GetGUID());
906 return true;
907 }
WorldSession * GetSession()
Definition: Chat.h:244
static ObjectGuid GetGUID(Object const *o)
Definition: Object.h:109
Player * GetPlayer() const
Definition: WorldSession.h:362
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
975 {
976 Player* player = handler->getSelectedPlayerOrSelf();
977
978 if (!player)
979 return false;
980
981 uint8 Counter = 0;
982
983 handler->PSendSysMessage("--------------------------------------");
984
985 for (uint32 i = 1; i < sSkillLineStore.GetNumRows(); ++i)
986 {
987 SkillLineEntry const* SkillInfo = sSkillLineStore.LookupEntry(i);
988
989 if (!SkillInfo)
990 continue;
991
992 if ((SkillInfo->categoryId != SKILL_CATEGORY_PROFESSION) && !SkillInfo->canLink)
993 continue;
994
995 uint32 SkillID = SkillInfo->id;
996
997 if (player->HasSkill(SkillID))
998 {
999 Counter++;
1000
1001 switch (SkillID)
1002 {
1003 case SKILL_ALCHEMY:
1004 handler->PSendSysMessage("{} - Alchemy - {}", Counter, player->GetSkillValue(SkillID));
1005 break;
1007 handler->PSendSysMessage("{} - Blacksmithing - {}", Counter, player->GetSkillValue(SkillID));
1008 break;
1009 case SKILL_ENCHANTING:
1010 handler->PSendSysMessage("{} - Enchanting - {}", Counter, player->GetSkillValue(SkillID));
1011 break;
1012 case SKILL_ENGINEERING:
1013 handler->PSendSysMessage("{} - Engineering - {}", Counter, player->GetSkillValue(SkillID));
1014 break;
1015 case SKILL_INSCRIPTION:
1016 handler->PSendSysMessage("{} - Inscription - {}", Counter, player->GetSkillValue(SkillID));
1017 break;
1019 handler->PSendSysMessage("{} - Jewelcrafting - {}", Counter, player->GetSkillValue(SkillID));
1020 break;
1022 handler->PSendSysMessage("{} - Leatherworking - {}", Counter, player->GetSkillValue(SkillID));
1023 break;
1024 case SKILL_TAILORING:
1025 handler->PSendSysMessage("{} - Tailoring - {}", Counter, player->GetSkillValue(SkillID));
1026 break;
1027 case SKILL_SKINNING:
1028 handler->PSendSysMessage("{} - Skinning - {}", Counter, player->GetSkillValue(SkillID));
1029 break;
1030 case SKILL_HERBALISM:
1031 handler->PSendSysMessage("{} - Herbalism - {}", Counter, player->GetSkillValue(SkillID));
1032 break;
1033 case SKILL_MINING:
1034 handler->PSendSysMessage("{} - Mining - {}", Counter, player->GetSkillValue(SkillID));
1035 break;
1036 case SKILL_COOKING:
1037 handler->PSendSysMessage("{} - Cooking - {}", Counter, player->GetSkillValue(SkillID));
1038 break;
1039 case SKILL_FIRST_AID:
1040 handler->PSendSysMessage("{} - First Aid - {}", Counter, player->GetSkillValue(SkillID));
1041 break;
1042 default:
1043 break;
1044 }
1045 }
1046 }
1047
1048 handler->PSendSysMessage("--------------------------------------");
1049 return true;
1050 }
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:5437
bool HasSkill(uint32 skill) const
Definition: Player.cpp:5416
Definition: DBCStructure.h:1583
uint32 id
Definition: DBCStructure.h:1584
int32 categoryId
Definition: DBCStructure.h:1585
uint32 canLink
Definition: DBCStructure.h:1594

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
463 {
464 if (!player)
465 player = PlayerIdentifier::FromTarget(handler);
466 if (!player)
467 return false;
468
469 if (Player* target = player->GetConnectedPlayer())
470 {
471 handler->PSendSysMessage(LANG_CUSTOMIZE_PLAYER, handler->GetNameLink(target));
472 target->SetAtLoginFlag(AT_LOGIN_CUSTOMIZE);
473 }
474 else
475 {
476 handler->PSendSysMessage(LANG_CUSTOMIZE_PLAYER_GUID, handler->playerLink(*player), player->GetGUID().ToString());
478 stmt->SetData(0, static_cast<uint16>(AT_LOGIN_CUSTOMIZE));
479 stmt->SetData(1, player->GetGUID().GetCounter());
480 CharacterDatabase.Execute(stmt);
481 }
482
483 return true;
484 }
@ AT_LOGIN_CUSTOMIZE
Definition: Player.h:603

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
682 {
683 DeletedInfoList foundList;
684 if (!GetDeletedCharacterInfoList(foundList, needle))
685 return false;
686
687 if (foundList.empty())
688 {
690 return false;
691 }
692
694 HandleCharacterDeletedListHelper(foundList, handler);
695
696 // Call the appropriate function to delete them (current account for deleted characters is 0)
697 for (DeletedInfoList::const_iterator itr = foundList.begin(); itr != foundList.end(); ++itr)
698 Player::DeleteFromDB(itr->lowGuid, 0, false, true);
699
700 return true;
701 }
@ LANG_CHARACTER_DELETED_LIST_EMPTY
Definition: Language.h:874
@ LANG_CHARACTER_DELETED_DELETE
Definition: Language.h:876
virtual void SendSysMessage(std::string_view str, bool escapeCharacters=false)
Definition: Chat.cpp:162
static void DeleteFromDB(ObjectGuid::LowType lowGuid, uint32 accountId, bool updateRealmChars, bool deleteFinally)
Definition: Player.cpp:3955
static bool GetDeletedCharacterInfoList(DeletedInfoList &foundList, std::string searchString)
Definition: cs_character.cpp:115
static void HandleCharacterDeletedListHelper(DeletedInfoList const &foundList, ChatHandler *handler)
Definition: cs_character.cpp:177
std::list< DeletedInfo > DeletedInfoList
Definition: cs_character.cpp:106

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
594 {
595 std::string needle;
596 if (needleStr)
597 needle.assign(*needleStr);
598 DeletedInfoList foundList;
599 if (!GetDeletedCharacterInfoList(foundList, needle))
600 return false;
601
602 // if no characters have been found, output a warning
603 if (foundList.empty())
604 {
606 return false;
607 }
608
609 HandleCharacterDeletedListHelper(foundList, handler);
610
611 return true;
612 }

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
178 {
179 if (!handler->GetSession())
180 {
184 }
185
186 for (DeletedInfoList::const_iterator itr = foundList.begin(); itr != foundList.end(); ++itr)
187 {
188 std::string dateStr = Acore::Time::TimeToTimestampStr(Seconds(itr->deleteDate));
189
190 if (!handler->GetSession())
192 itr->lowGuid, itr->name, itr->accountName.empty() ? "<Not existing>" : itr->accountName,
193 itr->accountId, dateStr);
194 else
196 itr->lowGuid, itr->name, itr->accountName.empty() ? "<Not existing>" : itr->accountName,
197 itr->accountId, dateStr);
198 }
199
200 if (!handler->GetSession())
202 }
std::chrono::seconds Seconds
Seconds shorthand typedef.
Definition: Duration.h:30
@ LANG_CHARACTER_DELETED_LIST_LINE_CHAT
Definition: Language.h:881
@ LANG_CHARACTER_DELETED_LIST_HEADER
Definition: Language.h:871
@ LANG_CHARACTER_DELETED_LIST_LINE_CONSOLE
Definition: Language.h:872
@ LANG_CHARACTER_DELETED_LIST_BAR
Definition: Language.h:873
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
715 {
716 int32 keepDays = static_cast<int32>(sWorld->getIntConfig(CONFIG_CHARDELETE_KEEP_DAYS));
717
718 if (days)
719 keepDays = static_cast<int32>(*days);
720 else if (keepDays <= 0) // config option value 0 -> disabled and can't be used
721 return false;
722
723 Player::DeleteOldCharacters(static_cast<uint32>(keepDays));
724
725 return true;
726 }
std::int32_t int32
Definition: Define.h:103
@ CONFIG_CHARDELETE_KEEP_DAYS
Definition: IWorld.h:356
#define sWorld
Definition: World.h:444
static void DeleteOldCharacters()
Definition: Player.cpp:4305

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
626 {
627 DeletedInfoList foundList;
628 if (!GetDeletedCharacterInfoList(foundList, needle))
629 return false;
630
631 if (foundList.empty())
632 {
634 return false;
635 }
636
638 HandleCharacterDeletedListHelper(foundList, handler);
639
640 if (!newCharName)
641 {
642 // Drop nonexisting account cases
643 for (DeletedInfoList::iterator itr = foundList.begin(); itr != foundList.end(); ++itr)
645 return true;
646 }
647
648 if (foundList.size() == 1)
649 {
650 std::string newName{ *newCharName };
651 DeletedInfo delInfo = foundList.front();
652
653 // update name
654 delInfo.name = newName;
655
656 // if new account provided update deleted info
657 if (newAccount)
658 {
659 delInfo.accountId = newAccount->GetID();
660 delInfo.accountName = newAccount->GetName();
661 }
662
663 HandleCharacterDeletedRestoreHelper(delInfo, handler);
664 return true;
665 }
666
668 return false;
669 }
@ LANG_CHARACTER_DELETED_ERR_RENAME
Definition: Language.h:877
@ LANG_CHARACTER_DELETED_RESTORE
Definition: Language.h:875
static void HandleCharacterDeletedRestoreHelper(DeletedInfo const &delInfo, ChatHandler *handler)
Definition: cs_character.cpp:214

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
215 {
216 if (delInfo.accountName.empty()) // account does not exist
217 {
218 handler->PSendSysMessage(LANG_CHARACTER_DELETED_SKIP_ACCOUNT, delInfo.name, delInfo.lowGuid, delInfo.accountId);
219 return;
220 }
221
222 // check character count
223 uint32 charcount = AccountMgr::GetCharactersCount(delInfo.accountId);
224 if (charcount >= 10)
225 {
226 handler->PSendSysMessage(LANG_CHARACTER_DELETED_SKIP_FULL, delInfo.name, delInfo.lowGuid, delInfo.accountId);
227 return;
228 }
229
230 if (sCharacterCache->GetCharacterGuidByName(delInfo.name))
231 {
232 handler->PSendSysMessage(LANG_CHARACTER_DELETED_SKIP_NAME, delInfo.name, delInfo.lowGuid, delInfo.accountId);
233 return;
234 }
235
236 auto* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UDP_RESTORE_DELETE_INFO);
237 stmt->SetData(0, delInfo.name);
238 stmt->SetData(1, delInfo.accountId);
239 stmt->SetData(2, delInfo.lowGuid);
240 CharacterDatabase.Execute(stmt);
241
242 stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHARACTER_NAME_DATA);
243 stmt->SetData(0, delInfo.lowGuid);
244 if (PreparedQueryResult result = CharacterDatabase.Query(stmt))
245 {
246 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>());
247 }
248 }
@ LANG_CHARACTER_DELETED_SKIP_NAME
Definition: Language.h:880
@ LANG_CHARACTER_DELETED_SKIP_FULL
Definition: Language.h:879
@ LANG_CHARACTER_DELETED_SKIP_ACCOUNT
Definition: Language.h:878
@ CHAR_UDP_RESTORE_DELETE_INFO
Definition: CharacterDatabase.h:293
@ CHAR_SEL_CHARACTER_NAME_DATA
Definition: CharacterDatabase.h:52
Definition: ObjectGuid.h:118

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
736 {
737 uint32 accountId;
738 if (Player* target = player.GetConnectedPlayer())
739 {
740 accountId = target->GetSession()->GetAccountId();
741 target->GetSession()->KickPlayer("HandleCharacterEraseCommand GM Command deleting character");
742 }
743 else
744 {
745 accountId = sCharacterCache->GetCharacterAccountIdByGuid(player.GetGUID());
746 }
747
748 std::string accountName;
749 AccountMgr::GetName(accountId, accountName);
750
751 Player::DeleteFromDB(player.GetGUID().GetCounter(), accountId, true, true);
752 handler->PSendSysMessage(LANG_CHARACTER_DELETED, player.GetName(), player.GetGUID().ToString(), accountName, accountId);
753
754 return true;
755 }
@ LANG_CHARACTER_DELETED
Definition: Language.h:864
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:145
std::string ToString() const
Definition: ObjectGuid.cpp:47

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

Referenced by GetCommands().

◆ HandleCharacterLevel()

static void character_commandscript::HandleCharacterLevel ( Player player,
ObjectGuid  playerGuid,
uint32  oldLevel,
uint32  newLevel,
ChatHandler handler 
)
inlinestatic
251 {
252 if (player)
253 {
254 player->GiveLevel(newLevel);
255 player->InitTalentForLevel();
256 player->SetUInt32Value(PLAYER_XP, 0);
257
258 if (handler->needReportToTarget(player))
259 {
260 if (oldLevel == newLevel)
262 else if (oldLevel < newLevel)
263 ChatHandler(player->GetSession()).PSendSysMessage(LANG_YOURS_LEVEL_UP, handler->GetNameLink(), newLevel);
264 else // if (oldlevel > newlevel)
266 }
267 }
268 else
269 {
270 // Update level and reset XP, everything else will be updated at login
271 auto* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_LEVEL);
272 stmt->SetData(0, uint8(newLevel));
273 stmt->SetData(1, playerGuid.GetCounter());
274 CharacterDatabase.Execute(stmt);
275
276 sAchievementMgr->UpdateAchievementCriteriaForOfflinePlayer(playerGuid.GetCounter(), ACHIEVEMENT_CRITERIA_TYPE_REACH_LEVEL);
277
278 sCharacterCache->UpdateCharacterLevel(playerGuid, newLevel);
279 }
280 }
#define sAchievementMgr
Definition: AchievementMgr.h:452
@ LANG_YOURS_LEVEL_UP
Definition: Language.h:613
@ LANG_YOURS_LEVEL_PROGRESS_RESET
Definition: Language.h:615
@ LANG_YOURS_LEVEL_DOWN
Definition: Language.h:614
@ PLAYER_XP
Definition: UpdateFields.h:339
@ CHAR_UPD_LEVEL
Definition: CharacterDatabase.h:295
@ ACHIEVEMENT_CRITERIA_TYPE_REACH_LEVEL
Definition: DBCEnums.h:124
Definition: Chat.h:39
virtual bool needReportToTarget(Player *chr) const
Definition: Chat.cpp:866
void InitTalentForLevel()
Definition: Player.cpp:2553
void GiveLevel(uint8 level)
Definition: Player.cpp:2446
WorldSession * GetSession() const
Definition: Player.h:1978
void SetUInt32Value(uint16 index, uint32 value)
Definition: Unit.cpp:21256

References ACHIEVEMENT_CRITERIA_TYPE_REACH_LEVEL, 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(), sAchievementMgr, sCharacterCache, and Unit::SetUInt32Value().

Referenced by HandleCharacterLevelCommand(), and HandleLevelUpCommand().

◆ HandleCharacterLevelCommand()

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

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
331 {
332 if (!player && newNameV)
333 return false;
334
335 if (!player)
336 player = PlayerIdentifier::FromTarget(handler);
337
338 if (!player)
339 return false;
340
341 if (handler->HasLowerSecurity(nullptr, player->GetGUID()))
342 return false;
343
344 if (newNameV)
345 {
346 std::string newName{ *newNameV };
347 if (!normalizePlayerName(newName))
348 {
350 return false;
351 }
352
354 if (res != CHAR_NAME_SUCCESS)
355 {
356 switch (res)
357 {
360 break;
363 break;
364 default:
366 break;
367 }
368
369 return false;
370 }
371
373 stmt->SetData(0, newName);
374 PreparedQueryResult result = CharacterDatabase.Query(stmt);
375 if (result)
376 {
378 return false;
379 }
380
381 // Remove declined name from db
382 stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_DECLINED_NAME);
383 stmt->SetData(0, player->GetGUID().GetCounter());
384 CharacterDatabase.Execute(stmt);
385
386 if (Player* target = player->GetConnectedPlayer())
387 {
388 target->SetName(newName);
389
390 ObjectAccessor::UpdatePlayerNameMapReference(player->GetName(), target);
391
392 if (WorldSession* session = target->GetSession())
393 session->KickPlayer("HandleCharacterRenameCommand GM Command renaming character");
394 }
395 else
396 {
397 stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_NAME_BY_GUID);
398 stmt->SetData(0, newName);
399 stmt->SetData(1, player->GetGUID().GetCounter());
400 CharacterDatabase.Execute(stmt);
401 }
402
403 sCharacterCache->UpdateCharacterData(player->GetGUID(), newName);
404
405 handler->PSendSysMessage(LANG_RENAME_PLAYER_WITH_NEW_NAME, player->GetName(), newName);
406 }
407 else
408 {
409 if (Player* target = player->GetConnectedPlayer())
410 {
411 handler->PSendSysMessage(LANG_RENAME_PLAYER, handler->GetNameLink(target));
412 target->SetAtLoginFlag(AT_LOGIN_RENAME);
413 }
414 else
415 {
416 // check offline security
417 if (handler->HasLowerSecurity(nullptr, player->GetGUID()))
418 return false;
419
420 handler->PSendSysMessage(LANG_RENAME_PLAYER_GUID, handler->playerLink(*player), player->GetGUID().ToString());
421
423 stmt->SetData(0, uint16(AT_LOGIN_RENAME));
424 stmt->SetData(1, player->GetGUID().GetCounter());
425 CharacterDatabase.Execute(stmt);
426 }
427 }
428
429 if (reserveName)
430 {
431 sObjectMgr->AddReservedPlayerName(player->GetName());
432 }
433
434 return true;
435 }
#define sObjectMgr
Definition: ObjectMgr.h:1623
@ 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
@ AT_LOGIN_RENAME
Definition: Player.h:600
@ 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
ResponseCodes
Definition: SharedDefines.h:3320
@ CHAR_NAME_RESERVED
Definition: SharedDefines.h:3427
@ CHAR_NAME_PROFANE
Definition: SharedDefines.h:3426
@ 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:59
static uint8 CheckPlayerName(std::string_view name, bool create=false)
Definition: ObjectMgr.cpp:8374
Player session in the World.
Definition: WorldSession.h:330

References AT_LOGIN_RENAME, CHAR_DEL_DECLINED_NAME, CHAR_NAME_PROFANE, CHAR_NAME_RESERVED, 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
535 {
536 if (!player)
537 player = PlayerIdentifier::FromTargetOrSelf(handler);
538 if (!player || !player->IsConnected())
539 {
541 return false;
542 }
543
544 Player const* target = player->GetConnectedPlayer();
545 LocaleConstant loc = handler->GetSessionDbcLocale();
546
547 FactionStateList const& targetFSL = target->GetReputationMgr().GetStateList();
548 for (FactionStateList::const_iterator itr = targetFSL.begin(); itr != targetFSL.end(); ++itr)
549 {
550 FactionState const& faction = itr->second;
551 FactionEntry const* factionEntry = sFactionStore.LookupEntry(faction.ID);
552 char const* factionName = factionEntry ? factionEntry->name[loc] : "#Not found#";
553 ReputationRank rank = target->GetReputationMgr().GetRank(factionEntry);
554 std::string rankName = handler->GetAcoreString(ReputationRankStrIndex[rank]);
555 std::ostringstream ss;
556 if (handler->GetSession())
557 ss << faction.ID << " - |cffffffff|Hfaction:" << faction.ID << "|h[" << factionName << ' ' << localeNames[loc] << "]|h|r";
558 else
559 ss << faction.ID << " - " << factionName << ' ' << localeNames[loc];
560
561 ss << ' ' << rankName << " (" << target->GetReputationMgr().GetReputation(factionEntry) << ')';
562
563 if (faction.Flags & FACTION_FLAG_VISIBLE)
564 ss << handler->GetAcoreString(LANG_FACTION_VISIBLE);
565 if (faction.Flags & FACTION_FLAG_AT_WAR)
566 ss << handler->GetAcoreString(LANG_FACTION_ATWAR);
567 if (faction.Flags & FACTION_FLAG_PEACE_FORCED)
569 if (faction.Flags & FACTION_FLAG_HIDDEN)
570 ss << handler->GetAcoreString(LANG_FACTION_HIDDEN);
573 if (faction.Flags & FACTION_FLAG_INACTIVE)
575
576 handler->SendSysMessage(ss.str().c_str());
577 }
578
579 return true;
580 }
LocaleConstant
Definition: Common.h:65
char const * localeNames[TOTAL_LOCALES]
Definition: Common.cpp:20
constexpr std::array< uint32, MAX_REPUTATION_RANK > ReputationRankStrIndex
Definition: ReputationMgr.h:28
std::map< RepListID, FactionState > FactionStateList
Definition: ReputationMgr.h:52
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
ReputationRank
Definition: SharedDefines.h:179
@ FACTION_FLAG_INACTIVE
Definition: DBCEnums.h:312
@ FACTION_FLAG_PEACE_FORCED
Definition: DBCEnums.h:311
@ FACTION_FLAG_INVISIBLE_FORCED
Definition: DBCEnums.h:310
@ FACTION_FLAG_HIDDEN
Definition: DBCEnums.h:309
@ FACTION_FLAG_VISIBLE
Definition: DBCEnums.h:307
@ FACTION_FLAG_AT_WAR
Definition: DBCEnums.h:308
virtual LocaleConstant GetSessionDbcLocale() const
Definition: Chat.cpp:872
virtual char const * GetAcoreString(uint32 entry) const
Definition: Chat.cpp:43
ReputationMgr & GetReputationMgr()
Definition: Player.h:2105
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:907
char const * name[16]
Definition: DBCStructure.h:919

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
283 {
284 if (!player)
285 player = PlayerIdentifier::FromTargetOrSelf(handler);
286
287 if (!player || !player->IsConnected())
288 {
290 return false;
291 }
292
293 Player const* target = player->GetConnectedPlayer();
294
295 LocaleConstant loc = handler->GetSessionDbcLocale();
296 char const* knownStr = handler->GetAcoreString(LANG_KNOWN);
297
298 // Search in CharTitles.dbc
299 for (uint32 id = 0; id < sCharTitlesStore.GetNumRows(); id++)
300 {
301 CharTitlesEntry const* titleInfo = sCharTitlesStore.LookupEntry(id);
302
303 if (titleInfo && target->HasTitle(titleInfo))
304 {
305 char const* name = target->getGender() == GENDER_MALE ? titleInfo->nameMale[loc] : titleInfo->nameFemale[loc];
306 if (!*name)
307 name = (target->getGender() == GENDER_MALE ? titleInfo->nameMale[sWorld->GetDefaultDbcLocale()] : titleInfo->nameFemale[sWorld->GetDefaultDbcLocale()]);
308
309 if (!*name)
310 continue;
311
312 char const* activeStr = "";
313 if (target->GetUInt32Value(PLAYER_CHOSEN_TITLE) == titleInfo->bit_index)
314 activeStr = handler->GetAcoreString(LANG_ACTIVE);
315
316 std::string titleName = Acore::StringFormat(name, player->GetName());
317
318 // send title in "id (idx:idx) - [namedlink locale]" format
319 if (handler->GetSession())
320 handler->PSendSysMessage(LANG_TITLE_LIST_CHAT, id, titleInfo->bit_index, id, titleName, localeNames[loc], knownStr, activeStr);
321 else
322 handler->PSendSysMessage(LANG_TITLE_LIST_CONSOLE, id, titleInfo->bit_index, name, localeNames[loc], knownStr, activeStr);
323 }
324 }
325
326 return true;
327 }
DBCStorage< CharTitlesEntry > sCharTitlesStore(CharTitlesEntryfmt)
@ 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
@ PLAYER_CHOSEN_TITLE
Definition: UpdateFields.h:324
@ GENDER_MALE
Definition: SharedDefines.h:61
std::string StringFormat(FormatString< Args... > fmt, Args &&... args)
Default AC string format function.
Definition: StringFormat.h:34
uint32 GetUInt32Value(uint16 index) const
Definition: Object.cpp:305
bool HasTitle(uint32 bitIndex) const
Definition: Player.cpp:13324
uint8 getGender() const
Definition: Unit.h:752
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
758 {
759 if (!player)
760 player = PlayerIdentifier::FromTargetOrSelf(handler);
761
762 if (!player)
763 return false;
764
765 uint8 oldlevel = player->IsConnected() ? player->GetConnectedPlayer()->GetLevel() : sCharacterCache->GetCharacterLevelByGuid(player->GetGUID());
766 int16 newlevel = static_cast<int16>(oldlevel) + level;
767
768 if (newlevel < 1)
769 newlevel = 1;
770
771 if (newlevel > STRONG_MAX_LEVEL) // hardcoded maximum level
772 newlevel = STRONG_MAX_LEVEL;
773
774 HandleCharacterLevel(player->GetConnectedPlayer(), player->GetGUID(), oldlevel, newlevel, handler);
775
776 if (!handler->GetSession() || (handler->GetSession()->GetPlayer() != player->GetConnectedPlayer())) // including chr == NULL
777 handler->PSendSysMessage(LANG_YOU_CHANGE_LVL, handler->playerLink(*player), newlevel);
778
779 return true;
780 }
std::int16_t int16
Definition: Define.h:104
#define STRONG_MAX_LEVEL
Definition: DBCEnums.h:43

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
842 {
843 std::string name;
844 if (!ValidatePDumpTarget(handler, name, characterName, characterGUID))
845 return false;
846
847 std::string dump;
848 switch (PlayerDumpWriter().WriteDumpToString(dump, player.GetGUID().GetCounter()))
849 {
850 case DUMP_SUCCESS:
851 break;
854 return false;
855 case DUMP_FILE_OPEN_ERROR: // this error code should not happen
856 default:
858 return false;
859 }
860
861 switch (PlayerDumpReader().LoadDumpFromString(dump, account, name, characterGUID.value_or(0)))
862 {
863 case DUMP_SUCCESS:
864 break;
866 handler->SendErrorMessage(LANG_ACCOUNT_CHARACTER_LIST_FULL, account.GetName(), account.GetID());
867 return false;
868 case DUMP_FILE_OPEN_ERROR: // this error code should not happen
869 case DUMP_FILE_BROKEN: // this error code should not happen
870 default:
872 return false;
873 }
874
875 // Original TC Notes from Refactor vvv
876 //ToDo: use a new acore_string for this commands
878
879 return true;
880 }
@ 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
@ LANG_COMMAND_EXPORT_DELETED_CHAR
Definition: Language.h:919
@ LANG_COMMAND_IMPORT_FAILED
Definition: Language.h:516
@ LANG_COMMAND_EXPORT_FAILED
Definition: Language.h:518
@ LANG_COMMAND_IMPORT_SUCCESS
Definition: Language.h:515
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:782

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
814 {
815 std::string name;
816 if (!ValidatePDumpTarget(handler, name, characterName, characterGUID))
817 return false;
818
819 switch (PlayerDumpReader().LoadDumpFromFile(fileName, account, name, characterGUID.value_or(0)))
820 {
821 case DUMP_SUCCESS:
823 break;
825 handler->SendErrorMessage(LANG_FILE_OPEN_FAIL, fileName);
826 return false;
827 case DUMP_FILE_BROKEN:
828 handler->SendErrorMessage(LANG_DUMP_BROKEN, fileName);
829 return false;
831 handler->SendErrorMessage(LANG_ACCOUNT_CHARACTER_LIST_FULL, account.GetName(), account.GetID());
832 return false;
833 default:
835 return false;
836 }
837
838 return true;
839 }
@ LANG_DUMP_BROKEN
Definition: Language.h:903
@ LANG_FILE_OPEN_FAIL
Definition: Language.h:901

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
883 {
884 switch (PlayerDumpWriter().WriteDumpToFile(fileName, player.GetGUID().GetCounter()))
885 {
886 case DUMP_SUCCESS:
888 break;
890 handler->SendErrorMessage(LANG_FILE_OPEN_FAIL, fileName);
891 return false;
894 return false;
895 default:
897 return false;
898 }
899
900 return true;
901 }
@ LANG_COMMAND_EXPORT_SUCCESS
Definition: Language.h:517

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
783 {
784 if (characterName)
785 {
786 name.assign(*characterName);
787 // normalize the name if specified and check if it exists
788 if (!normalizePlayerName(name))
789 {
791 return false;
792 }
793
795 {
797 return false;
798 }
799 }
800
801 if (characterGUID)
802 {
803 if (sCharacterCache->GetCharacterAccountIdByGuid(ObjectGuid(HighGuid::Player, *characterGUID)))
804 {
805 handler->SendErrorMessage(LANG_CHARACTER_GUID_IN_USE, *characterGUID);
806 return false;
807 }
808 }
809
810 return true;
811 }
@ LANG_CHARACTER_GUID_IN_USE
Definition: Language.h:906
@ LANG_INVALID_CHARACTER_NAME
Definition: Language.h:904

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().