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
 
- 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
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:60
@ SEC_GAMEMASTER
Definition Common.h:59
@ SEC_CONSOLE
Definition Common.h:61
static bool HandleCharacterChangeAccountCommand(ChatHandler *handler, std::string accountName, Optional< PlayerIdentifier > player)
Definition cs_character.cpp:1051
static bool HandleCharacterDeletedListCommand(ChatHandler *handler, Optional< std::string_view > needleStr)
Definition cs_character.cpp:592
static bool HandleCharacterCheckBankCommand(ChatHandler *handler)
Definition cs_character.cpp:902
static bool HandlePDumpLoadCommand(ChatHandler *handler, std::string fileName, AccountIdentifier account, Optional< std::string_view > characterName, Optional< ObjectGuid::LowType > characterGUID)
Definition cs_character.cpp:812
static bool HandleCharacterDeletedPurgeCommand(ChatHandler *, Optional< uint16 > days)
Definition cs_character.cpp:713
static bool HandleLevelUpCommand(ChatHandler *handler, Optional< PlayerIdentifier > player, int16 level)
Definition cs_character.cpp:756
static bool HandleCharacterRenameCommand(ChatHandler *handler, Optional< PlayerIdentifier > player, Optional< bool > reserveName, Optional< std::string_view > newNameV)
Definition cs_character.cpp:329
static bool HandleCharacterLevelCommand(ChatHandler *handler, Optional< PlayerIdentifier > player, int16 newlevel)
Definition cs_character.cpp:436
static bool HandleCharacterCustomizeCommand(ChatHandler *handler, Optional< PlayerIdentifier > player)
Definition cs_character.cpp:461
static bool HandleCharacterCheckProfessionCommand(ChatHandler *handler)
Definition cs_character.cpp:973
static bool HandleCharacterDeletedDeleteCommand(ChatHandler *handler, std::string needle)
Definition cs_character.cpp:680
static bool HandleCharacterChangeRaceCommand(ChatHandler *handler, Optional< PlayerIdentifier > player)
Definition cs_character.cpp:509
static bool HandleCharacterTitlesCommand(ChatHandler *handler, Optional< PlayerIdentifier > player)
Definition cs_character.cpp:281
static bool HandlePDumpWriteCommand(ChatHandler *handler, std::string fileName, PlayerIdentifier player)
Definition cs_character.cpp:881
static bool HandleCharacterReputationCommand(ChatHandler *handler, Optional< PlayerIdentifier > player)
Definition cs_character.cpp:533
static bool HandleCharacterEraseCommand(ChatHandler *handler, PlayerIdentifier player)
Definition cs_character.cpp:734
static bool HandleCharacterCheckBagCommand(ChatHandler *handler, uint8 BagSlot)
Definition cs_character.cpp:908
static bool HandleCharacterChangeFactionCommand(ChatHandler *handler, Optional< PlayerIdentifier > player)
Definition cs_character.cpp:485
static bool HandleCharacterDeletedRestoreCommand(ChatHandler *handler, std::string needle, Optional< std::string_view > newCharName, Optional< AccountIdentifier > newAccount)
Definition cs_character.cpp:624
std::vector< ChatCommandBuilder > ChatCommandTable
Definition ChatCommand.h:46

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 }
@ CHAR_SEL_CHAR_DEL_INFO_BY_NAME
Definition CharacterDatabase.h:333
@ CHAR_SEL_CHAR_DEL_INFO
Definition CharacterDatabase.h:334
@ CHAR_SEL_CHAR_DEL_INFO_BY_GUID
Definition CharacterDatabase.h:332
std::shared_ptr< PreparedResultSet > PreparedQueryResult
Definition DatabaseEnvFwd.h:45
DatabaseWorkerPool< CharacterDatabaseConnection > CharacterDatabase
Accessor to the character database.
Definition DatabaseEnv.cpp:21
std::uint32_t uint32
Definition Define.h:107
bool normalizePlayerName(std::string &name)
Definition ObjectMgr.cpp:208
bool isNumeric(wchar_t wchar)
Definition Util.h:204
Class used to access individual fields of database query result.
Definition Field.h:98
std::enable_if_t< std::is_arithmetic_v< T >, T > Get() const
Definition Field.h:112
Acore::Types::is_default< T > SetData(const uint8 index, T value)
Definition PreparedStatement.h:77
Definition PreparedStatement.h:157
bool GetName(uint32 accountId, std::string &name)
Definition AccountMgr.cpp:257

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
1052 {
1053 if (!player)
1054 {
1055 player = PlayerIdentifier::FromTargetOrSelf(handler);
1056 }
1057
1058 if (!player)
1059 {
1061 return false;
1062 }
1063
1064 if (uint32 accountId = AccountMgr::GetId(accountName))
1065 {
1066 if (AccountMgr::GetCharactersCount(accountId) >= 10)
1067 {
1068 handler->SendErrorMessage(LANG_ACCOUNT_CHARACTER_LIST_FULL, accountName, accountId);
1069 return true;
1070 }
1071
1072 if (CharacterCacheEntry const* cache = sCharacterCache->GetCharacterCacheByName(player->GetName()))
1073 {
1074 std::string accName;
1075 AccountMgr::GetName(cache->AccountId, accName);
1076 handler->PSendSysMessage(LANG_CMD_CHAR_CHANGE_ACC_SUCCESS, player->GetName(), player->GetGUID().ToString(), accName, cache->AccountId, accountName, accountId);
1077 }
1078
1079 if (player->IsConnected())
1080 {
1081 player->GetConnectedPlayer()->GetSession()->KickPlayer("CMD char changeaccount");
1082 }
1083
1084 CharacterDatabase.Query("UPDATE characters SET account = {} WHERE guid = {}", accountId, player->GetGUID().GetCounter());
1085 sCharacterCache->UpdateCharacterAccountId(player->GetGUID(), accountId);
1086
1087 }
1088 else
1089 {
1090 handler->SendErrorMessage(LANG_ACCOUNT_NOT_EXIST, accountName);
1091 return true;
1092 }
1093
1094 return true;
1095 }
#define sCharacterCache
Definition CharacterCache.h:83
@ LANG_ACCOUNT_CHARACTER_LIST_FULL
Definition Language.h:903
@ LANG_PLAYER_NOT_FOUND
Definition Language.h:540
@ LANG_ACCOUNT_NOT_EXIST
Definition Language.h:443
@ LANG_CMD_CHAR_CHANGE_ACC_SUCCESS
Definition Language.h:1143
void PSendSysMessage(std::string_view str, bool escapeCharacters=false)
Definition Chat.cpp:211
void SendErrorMessage(uint32 entry)
Definition Chat.cpp:216
uint32 GetCharactersCount(uint32 accountId)
Definition AccountMgr.cpp:295
uint32 GetId(std::string const &username)
Definition AccountMgr.cpp:229
static Optional< PlayerIdentifier > FromTargetOrSelf(ChatHandler *handler)
Definition ChatCommandTags.h:184
Definition CharacterCache.h:28

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
486 {
487 if (!player)
488 player = PlayerIdentifier::FromTarget(handler);
489 if (!player)
490 return false;
491
492 if (Player* target = player->GetConnectedPlayer())
493 {
494 handler->PSendSysMessage(LANG_CUSTOMIZE_PLAYER, handler->GetNameLink(target));
495 target->SetAtLoginFlag(AT_LOGIN_CHANGE_FACTION);
496 }
497 else
498 {
499 handler->PSendSysMessage(LANG_CUSTOMIZE_PLAYER_GUID, handler->playerLink(*player), player->GetGUID().ToString());
502 stmt->SetData(1, player->GetGUID().GetCounter());
503 CharacterDatabase.Execute(stmt);
504 }
505
506 return true;
507 }
@ CHAR_UPD_ADD_AT_LOGIN_FLAG
Definition CharacterDatabase.h:276
std::uint16_t uint16
Definition Define.h:108
@ LANG_CUSTOMIZE_PLAYER_GUID
Definition Language.h:388
@ LANG_CUSTOMIZE_PLAYER
Definition Language.h:387
@ AT_LOGIN_CHANGE_FACTION
Definition Player.h:611
virtual std::string GetNameLink() const
Definition Chat.h:198
std::string playerLink(std::string const &name) const
Definition Chat.h:231
Definition Player.h:1081
static Optional< PlayerIdentifier > FromTarget(ChatHandler *handler)
Definition ChatCommandTags.cpp:138

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

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

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
903 {
904 handler->GetSession()->SendShowBank(handler->GetSession()->GetPlayer()->GetGUID());
905 return true;
906 }
WorldSession * GetSession()
Definition Chat.h:242
static ObjectGuid GetGUID(Object const *o)
Definition Object.h:112
Player * GetPlayer() const
Definition WorldSession.h:376
void SendShowBank(ObjectGuid guid)
Definition BankHandler.cpp:188

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

Referenced by GetCommands().

◆ HandleCharacterCheckProfessionCommand()

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

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

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
681 {
682 DeletedInfoList foundList;
683 if (!GetDeletedCharacterInfoList(foundList, needle))
684 return false;
685
686 if (foundList.empty())
687 {
689 return false;
690 }
691
693 HandleCharacterDeletedListHelper(foundList, handler);
694
695 // Call the appropriate function to delete them (current account for deleted characters is 0)
696 for (DeletedInfoList::const_iterator itr = foundList.begin(); itr != foundList.end(); ++itr)
697 Player::DeleteFromDB(itr->lowGuid, 0, false, true);
698
699 return true;
700 }
@ LANG_CHARACTER_DELETED_LIST_EMPTY
Definition Language.h:875
@ LANG_CHARACTER_DELETED_DELETE
Definition Language.h:877
virtual void SendSysMessage(std::string_view str, bool escapeCharacters=false)
Definition Chat.cpp:160
static void DeleteFromDB(ObjectGuid::LowType lowGuid, uint32 accountId, bool updateRealmChars, bool deleteFinally)
Definition Player.cpp:3995
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
593 {
594 std::string needle;
595 if (needleStr)
596 needle.assign(*needleStr);
597 DeletedInfoList foundList;
598 if (!GetDeletedCharacterInfoList(foundList, needle))
599 return false;
600
601 // if no characters have been found, output a warning
602 if (foundList.empty())
603 {
605 return false;
606 }
607
608 HandleCharacterDeletedListHelper(foundList, handler);
609
610 return true;
611 }

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, itr->accountName.empty() ? "<Not existing>" : itr->accountName,
192 itr->accountId, dateStr);
193 else
195 itr->lowGuid, itr->name, itr->accountName.empty() ? "<Not existing>" : itr->accountName,
196 itr->accountId, dateStr);
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:882
@ LANG_CHARACTER_DELETED_LIST_HEADER
Definition Language.h:872
@ LANG_CHARACTER_DELETED_LIST_LINE_CONSOLE
Definition Language.h:873
@ LANG_CHARACTER_DELETED_LIST_BAR
Definition Language.h:874
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
714 {
715 int32 keepDays = static_cast<int32>(sWorld->getIntConfig(CONFIG_CHARDELETE_KEEP_DAYS));
716
717 if (days)
718 keepDays = static_cast<int32>(*days);
719 else if (keepDays <= 0) // config option value 0 -> disabled and can't be used
720 return false;
721
722 Player::DeleteOldCharacters(static_cast<uint32>(keepDays));
723
724 return true;
725 }
std::int32_t int32
Definition Define.h:103
@ CONFIG_CHARDELETE_KEEP_DAYS
Definition IWorld.h:356
static void DeleteOldCharacters()
Definition Player.cpp:4345
#define sWorld
Definition World.h:363

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
625 {
626 DeletedInfoList foundList;
627 if (!GetDeletedCharacterInfoList(foundList, needle))
628 return false;
629
630 if (foundList.empty())
631 {
633 return false;
634 }
635
637 HandleCharacterDeletedListHelper(foundList, handler);
638
639 if (!newCharName)
640 {
641 // Drop nonexisting account cases
642 for (DeletedInfoList::iterator itr = foundList.begin(); itr != foundList.end(); ++itr)
644 return true;
645 }
646
647 if (foundList.size() == 1)
648 {
649 std::string newName{ *newCharName };
650 DeletedInfo delInfo = foundList.front();
651
652 // update name
653 delInfo.name = newName;
654
655 // if new account provided update deleted info
656 if (newAccount)
657 {
658 delInfo.accountId = newAccount->GetID();
659 delInfo.accountName = newAccount->GetName();
660 }
661
662 HandleCharacterDeletedRestoreHelper(delInfo, handler);
663 return true;
664 }
665
667 return false;
668 }
@ LANG_CHARACTER_DELETED_ERR_RENAME
Definition Language.h:878
@ LANG_CHARACTER_DELETED_RESTORE
Definition Language.h:876
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, 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, 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, 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:295
@ CHAR_SEL_CHARACTER_NAME_DATA
Definition CharacterDatabase.h:52
@ LANG_CHARACTER_DELETED_SKIP_NAME
Definition Language.h:881
@ LANG_CHARACTER_DELETED_SKIP_FULL
Definition Language.h:880
@ LANG_CHARACTER_DELETED_SKIP_ACCOUNT
Definition Language.h:879
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, Player, 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
735 {
736 uint32 accountId;
737 if (Player* target = player.GetConnectedPlayer())
738 {
739 accountId = target->GetSession()->GetAccountId();
740 target->GetSession()->KickPlayer("HandleCharacterEraseCommand GM Command deleting character");
741 }
742 else
743 {
744 accountId = sCharacterCache->GetCharacterAccountIdByGuid(player.GetGUID());
745 }
746
747 std::string accountName;
748 AccountMgr::GetName(accountId, accountName);
749
750 Player::DeleteFromDB(player.GetGUID().GetCounter(), accountId, true, true);
751 handler->PSendSysMessage(LANG_CHARACTER_DELETED, player.GetName(), player.GetGUID().ToString(), accountName, accountId);
752
753 return true;
754 }
@ LANG_CHARACTER_DELETED
Definition Language.h:865
LowType GetCounter() const
Definition ObjectGuid.h:145
std::string ToString() const
Definition ObjectGuid.cpp:47
ObjectGuid GetGUID() const
Definition ChatCommandTags.h:176
std::string const & GetName() const
Definition ChatCommandTags.h:175
Player * GetConnectedPlayer() const
Definition ChatCommandTags.h:178

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
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(), newLevel);
263 else // if (oldlevel > 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 sAchievementMgr->UpdateAchievementCriteriaForOfflinePlayer(playerGuid.GetCounter(), ACHIEVEMENT_CRITERIA_TYPE_REACH_LEVEL);
276
277 sCharacterCache->UpdateCharacterLevel(playerGuid, newLevel);
278 }
279 }
#define sAchievementMgr
Definition AchievementMgr.h:451
@ CHAR_UPD_LEVEL
Definition CharacterDatabase.h:297
@ ACHIEVEMENT_CRITERIA_TYPE_REACH_LEVEL
Definition DBCEnums.h:124
@ LANG_YOURS_LEVEL_UP
Definition Language.h:614
@ LANG_YOURS_LEVEL_PROGRESS_RESET
Definition Language.h:616
@ LANG_YOURS_LEVEL_DOWN
Definition Language.h:615
@ PLAYER_XP
Definition UpdateFields.h:339
Definition Chat.h:37
virtual bool needReportToTarget(Player *chr) const
Definition Chat.cpp:864
void InitTalentForLevel()
Definition Player.cpp:2587
void GiveLevel(uint8 level)
Definition Player.cpp:2474
WorldSession * GetSession() const
Definition Player.h:2005
void SetUInt32Value(uint16 index, uint32 value)
Definition Unit.cpp:21372

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
437 {
438 if (!player)
439 player = PlayerIdentifier::FromTargetOrSelf(handler);
440
441 if (!player)
442 return false;
443
444 uint8 oldlevel = player->IsConnected() ? player->GetConnectedPlayer()->GetLevel() : sCharacterCache->GetCharacterLevelByGuid(player->GetGUID());
445
446 if (newlevel < 1)
447 return false; // invalid level
448
449 if (newlevel > DEFAULT_MAX_LEVEL) // hardcoded maximum level
450 newlevel = DEFAULT_MAX_LEVEL;
451
452 HandleCharacterLevel(player->GetConnectedPlayer(), player->GetGUID(), oldlevel, newlevel, handler);
453
454 if (!handler->GetSession() || (handler->GetSession()->GetPlayer() != player->GetConnectedPlayer())) // including chr == NULL
455 handler->PSendSysMessage(LANG_YOU_CHANGE_LVL, handler->playerLink(*player), newlevel);
456
457 return true;
458 }
#define DEFAULT_MAX_LEVEL
Definition DBCEnums.h:35
@ LANG_YOU_CHANGE_LVL
Definition Language.h:162
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
330 {
331 if (!player && newNameV)
332 return false;
333
334 if (!player)
335 player = PlayerIdentifier::FromTarget(handler);
336
337 if (!player)
338 return false;
339
340 if (handler->HasLowerSecurity(nullptr, player->GetGUID()))
341 return false;
342
343 if (newNameV)
344 {
345 std::string newName{ *newNameV };
346 if (!normalizePlayerName(newName))
347 {
349 return false;
350 }
351
353 if (res != CHAR_NAME_SUCCESS)
354 {
355 switch (res)
356 {
359 break;
362 break;
363 default:
365 break;
366 }
367
368 return false;
369 }
370
372 stmt->SetData(0, newName);
373 PreparedQueryResult result = CharacterDatabase.Query(stmt);
374 if (result)
375 {
377 return false;
378 }
379
380 // Remove declined name from db
381 stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_DECLINED_NAME);
382 stmt->SetData(0, player->GetGUID().GetCounter());
383 CharacterDatabase.Execute(stmt);
384
385 if (Player* target = player->GetConnectedPlayer())
386 {
387 target->SetName(newName);
388
389 ObjectAccessor::UpdatePlayerNameMapReference(player->GetName(), target);
390
391 if (WorldSession* session = target->GetSession())
392 session->KickPlayer("HandleCharacterRenameCommand GM Command renaming character");
393 }
394 else
395 {
396 stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_NAME_BY_GUID);
397 stmt->SetData(0, newName);
398 stmt->SetData(1, player->GetGUID().GetCounter());
399 CharacterDatabase.Execute(stmt);
400 }
401
402 sCharacterCache->UpdateCharacterData(player->GetGUID(), newName);
403
404 handler->PSendSysMessage(LANG_RENAME_PLAYER_WITH_NEW_NAME, player->GetName(), newName);
405 }
406 else
407 {
408 if (Player* target = player->GetConnectedPlayer())
409 {
410 handler->PSendSysMessage(LANG_RENAME_PLAYER, handler->GetNameLink(target));
411 target->SetAtLoginFlag(AT_LOGIN_RENAME);
412 }
413 else
414 {
415 // check offline security
416 if (handler->HasLowerSecurity(nullptr, player->GetGUID()))
417 return false;
418
419 handler->PSendSysMessage(LANG_RENAME_PLAYER_GUID, handler->playerLink(*player), player->GetGUID().ToString());
420
422 stmt->SetData(0, uint16(AT_LOGIN_RENAME));
423 stmt->SetData(1, player->GetGUID().GetCounter());
424 CharacterDatabase.Execute(stmt);
425 }
426 }
427
428 if (reserveName)
429 {
430 sObjectMgr->AddReservedPlayerName(player->GetName());
431 }
432
433 return true;
434 }
@ 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
@ LANG_RENAME_PLAYER
Definition Language.h:296
@ LANG_RENAME_PLAYER_WITH_NEW_NAME
Definition Language.h:130
@ LANG_PROFANITY_NAME
Definition Language.h:222
@ LANG_BAD_VALUE
Definition Language.h:148
@ LANG_RESERVED_NAME
Definition Language.h:207
@ LANG_RENAME_PLAYER_ALREADY_EXISTS
Definition Language.h:129
@ LANG_RENAME_PLAYER_GUID
Definition Language.h:297
#define sObjectMgr
Definition ObjectMgr.h:1636
@ AT_LOGIN_RENAME
Definition Player.h:605
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
bool HasLowerSecurity(Player *target, ObjectGuid guid=ObjectGuid::Empty, bool strong=false)
Definition Chat.cpp:57
static uint8 CheckPlayerName(std::string_view name, bool create=false)
Definition ObjectMgr.cpp:8472
Player session in the World.
Definition WorldSession.h:330
void UpdatePlayerNameMapReference(std::string oldname, Player *player)
Definition ObjectAccessor.cpp:346

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
534 {
535 if (!player)
536 player = PlayerIdentifier::FromTargetOrSelf(handler);
537 if (!player || !player->IsConnected())
538 {
540 return false;
541 }
542
543 Player const* target = player->GetConnectedPlayer();
544 LocaleConstant loc = handler->GetSessionDbcLocale();
545
546 FactionStateList const& targetFSL = target->GetReputationMgr().GetStateList();
547 for (FactionStateList::const_iterator itr = targetFSL.begin(); itr != targetFSL.end(); ++itr)
548 {
549 FactionState const& faction = itr->second;
550 FactionEntry const* factionEntry = sFactionStore.LookupEntry(faction.ID);
551 char const* factionName = factionEntry ? factionEntry->name[loc] : "#Not found#";
552 ReputationRank rank = target->GetReputationMgr().GetRank(factionEntry);
553 std::string rankName = handler->GetAcoreString(ReputationRankStrIndex[rank]);
554 std::ostringstream ss;
555 if (handler->GetSession())
556 ss << faction.ID << " - |cffffffff|Hfaction:" << faction.ID << "|h[" << factionName << ' ' << localeNames[loc] << "]|h|r";
557 else
558 ss << faction.ID << " - " << factionName << ' ' << localeNames[loc];
559
560 ss << ' ' << rankName << " (" << target->GetReputationMgr().GetReputation(factionEntry) << ')';
561
562 if (faction.Flags & FACTION_FLAG_VISIBLE)
563 ss << handler->GetAcoreString(LANG_FACTION_VISIBLE);
564 if (faction.Flags & FACTION_FLAG_AT_WAR)
565 ss << handler->GetAcoreString(LANG_FACTION_ATWAR);
566 if (faction.Flags & FACTION_FLAG_PEACE_FORCED)
568 if (faction.Flags & FACTION_FLAG_HIDDEN)
569 ss << handler->GetAcoreString(LANG_FACTION_HIDDEN);
572 if (faction.Flags & FACTION_FLAG_INACTIVE)
574
575 handler->SendSysMessage(ss.str().c_str());
576 }
577
578 return true;
579 }
char const * localeNames[TOTAL_LOCALES]
Definition Common.cpp:20
LocaleConstant
Definition Common.h:65
@ 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
DBCStorage< FactionEntry > sFactionStore(FactionEntryfmt)
@ LANG_FACTION_PEACE_FORCED
Definition Language.h:356
@ LANG_FACTION_ATWAR
Definition Language.h:355
@ LANG_FACTION_INVISIBLE_FORCED
Definition Language.h:358
@ LANG_FACTION_HIDDEN
Definition Language.h:357
@ LANG_FACTION_INACTIVE
Definition Language.h:359
@ LANG_FACTION_VISIBLE
Definition Language.h:354
constexpr std::array< uint32, MAX_REPUTATION_RANK > ReputationRankStrIndex
Definition ReputationMgr.h:27
std::map< RepListID, FactionState > FactionStateList
Definition ReputationMgr.h:51
ReputationRank
Definition SharedDefines.h:179
virtual LocaleConstant GetSessionDbcLocale() const
Definition Chat.cpp:870
virtual std::string GetAcoreString(uint32 entry) const
Definition Chat.cpp:41
ReputationMgr & GetReputationMgr()
Definition Player.h:2133
FactionStateList const & GetStateList() const
Definition ReputationMgr.h:79
int32 GetReputation(uint32 faction_id) const
Definition ReputationMgr.cpp:78
ReputationRank GetRank(FactionEntry const *factionEntry) const
Definition ReputationMgr.cpp:125
Definition DBCStructure.h:906
char const * name[16]
Definition DBCStructure.h:918
Definition ReputationMgr.h:41
uint32 ID
Definition ReputationMgr.h:42
uint8 Flags
Definition ReputationMgr.h:45

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

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
757 {
758 if (!player)
759 player = PlayerIdentifier::FromTargetOrSelf(handler);
760
761 if (!player)
762 return false;
763
764 uint8 oldlevel = player->IsConnected() ? player->GetConnectedPlayer()->GetLevel() : sCharacterCache->GetCharacterLevelByGuid(player->GetGUID());
765 int16 newlevel = static_cast<int16>(oldlevel) + level;
766
767 if (newlevel < 1)
768 newlevel = 1;
769
770 if (newlevel > STRONG_MAX_LEVEL) // hardcoded maximum level
771 newlevel = STRONG_MAX_LEVEL;
772
773 HandleCharacterLevel(player->GetConnectedPlayer(), player->GetGUID(), oldlevel, newlevel, handler);
774
775 if (!handler->GetSession() || (handler->GetSession()->GetPlayer() != player->GetConnectedPlayer())) // including chr == NULL
776 handler->PSendSysMessage(LANG_YOU_CHANGE_LVL, handler->playerLink(*player), newlevel);
777
778 return true;
779 }
#define STRONG_MAX_LEVEL
Definition DBCEnums.h:43
std::int16_t int16
Definition Define.h:104

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
841 {
842 std::string name;
843 if (!ValidatePDumpTarget(handler, name, characterName, characterGUID))
844 return false;
845
846 std::string dump;
847 switch (PlayerDumpWriter().WriteDumpToString(dump, player.GetGUID().GetCounter()))
848 {
849 case DUMP_SUCCESS:
850 break;
853 return false;
854 case DUMP_FILE_OPEN_ERROR: // this error code should not happen
855 default:
857 return false;
858 }
859
860 switch (PlayerDumpReader().LoadDumpFromString(dump, account, name, characterGUID.value_or(0)))
861 {
862 case DUMP_SUCCESS:
863 break;
865 handler->SendErrorMessage(LANG_ACCOUNT_CHARACTER_LIST_FULL, account.GetName(), account.GetID());
866 return false;
867 case DUMP_FILE_OPEN_ERROR: // this error code should not happen
868 case DUMP_FILE_BROKEN: // this error code should not happen
869 default:
871 return false;
872 }
873
874 // Original TC Notes from Refactor vvv
875 //ToDo: use a new acore_string for this commands
877
878 return true;
879 }
@ LANG_COMMAND_EXPORT_DELETED_CHAR
Definition Language.h:920
@ LANG_COMMAND_IMPORT_FAILED
Definition Language.h:517
@ LANG_COMMAND_EXPORT_FAILED
Definition Language.h:519
@ LANG_COMMAND_IMPORT_SUCCESS
Definition Language.h:516
@ DUMP_FILE_OPEN_ERROR
Definition PlayerDump.h:55
@ DUMP_CHARACTER_DELETED
Definition PlayerDump.h:58
@ DUMP_SUCCESS
Definition PlayerDump.h:54
@ DUMP_TOO_MANY_CHARS
Definition PlayerDump.h:56
@ DUMP_FILE_BROKEN
Definition PlayerDump.h:57
Definition PlayerDump.h:95
Definition PlayerDump.h:75
static bool ValidatePDumpTarget(ChatHandler *handler, std::string &name, Optional< std::string_view > characterName, Optional< ObjectGuid::LowType > characterGUID)
Definition cs_character.cpp:781
uint32 GetID() const
Definition ChatCommandTags.h:154
std::string const & GetName() const
Definition ChatCommandTags.h:155

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

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
882 {
883 switch (PlayerDumpWriter().WriteDumpToFile(fileName, player.GetGUID().GetCounter()))
884 {
885 case DUMP_SUCCESS:
887 break;
889 handler->SendErrorMessage(LANG_FILE_OPEN_FAIL, fileName);
890 return false;
893 return false;
894 default:
896 return false;
897 }
898
899 return true;
900 }
@ LANG_COMMAND_EXPORT_SUCCESS
Definition Language.h:518

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

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

Referenced by HandlePDumpCopyCommand(), and HandlePDumpLoadCommand().


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