69 {
"deleted", characterDeletedCommandTable },
79 {
"character", characterCommandTable },
81 {
"pdump", pdumpCommandTable },
109 if (!searchString.empty())
139 Field* fields = result->Fetch();
143 info.
guid = ObjectGuid::Create<HighGuid::Player>(fields[0].GetUInt32());
149 info.
deleteDate = time_t(fields[3].GetUInt32());
150 foundList.push_back(info);
152 while (result->NextRow());
177 for (DeletedInfoList::const_iterator itr = foundList.begin(); itr != foundList.end(); ++itr)
183 itr->guid.ToString().c_str(), itr->name.c_str(), itr->accountName.empty() ?
"<Not existing>" : itr->accountName.c_str(),
184 itr->accountId, dateStr.c_str());
187 itr->guid.ToString().c_str(), itr->name.c_str(), itr->accountName.empty() ?
"<Not existing>" : itr->accountName.c_str(),
188 itr->accountId, dateStr.c_str());
236 sCharacterCache->AddCharacterCacheEntry(delInfo.
guid, delInfo.
accountId, delInfo.
name, (*result)[2].GetUInt8(), (*result)[0].GetUInt8(), (*result)[1].GetUInt8(), (*result)[3].GetUInt8());
243 if (!player || !player->IsConnected())
250 Player const* target = player->GetConnectedPlayer();
260 if (titleInfo && target->
HasTitle(titleInfo))
268 char const* activeStr =
"";
288 if (!player && newNameV)
301 std::string newName{ *newNameV };
338 stmt->
setUInt32(0, player->GetGUID().GetCounter());
341 if (
Player* target = player->GetConnectedPlayer())
343 target->SetName(newName);
346 session->KickPlayer(
"HandleCharacterRenameCommand GM Command renaming character");
352 stmt->
setUInt32(1, player->GetGUID().GetCounter());
362 if (
Player* player = session->GetPlayer())
363 sLog->OutCommand(session->GetAccountId(),
"GM {} (Account: {}) forced rename {} to player {} (Account: {})", player->GetName(), session->GetAccountId(), newName, player->GetName(),
sCharacterCache->GetCharacterAccountIdByGuid(player->GetGUID()));
366 sLog->OutCommand(0,
"CONSOLE forced rename '{}' to '{}' ({})", player->GetName(), newName, player->GetGUID().ToString());
370 if (
Player* target = player->GetConnectedPlayer())
385 stmt->
setUInt32(1, player->GetGUID().GetCounter());
401 if (
Player* target = player->GetConnectedPlayer())
411 stmt->
setUInt32(1, player->GetGUID().GetCounter());
429 if (characterInfo->
Level < 10)
443 if (
Player* target = player->GetConnectedPlayer())
453 stmt->
setUInt32(1, player->GetGUID().GetCounter());
467 if (
Player* target = player->GetConnectedPlayer())
477 stmt->
setUInt32(1, player->GetGUID().GetCounter());
501 if (newAccount.
GetID() == oldAccountId)
514 if (
Player* onlinePlayer = player->GetConnectedPlayer())
515 onlinePlayer->GetSession()->KickPlayer(
"HandleCharacterChangeAccountCommand GM Command transferring character to another account");
519 charStmt->
setUInt32(1, player->GetGUID().GetCounter());
522 sWorld->UpdateRealmCharCount(oldAccountId);
529 std::string logString =
Trinity::StringFormat(
"changed ownership of player {} ({}) from account {} to account {}", player->GetName(), player->GetGUID().ToString(), oldAccountId, newAccount.
GetID());
532 if (
Player* player = session->GetPlayer())
533 sLog->OutCommand(session->GetAccountId(),
"GM {} (Account: {}) {}", player->GetName(), session->GetAccountId(), logString);
544 if (!player || !player->IsConnected())
551 Player const* target = player->GetConnectedPlayer();
555 for (FactionStateList::const_iterator itr = targetFSL.begin(); itr != targetFSL.end(); ++itr)
559 char const* factionName = factionEntry ? factionEntry->
Name[loc] :
"#Not found#";
561 std::ostringstream ss;
563 ss << faction.
ID <<
" - |cffffffff|Hfaction:" << faction.
ID <<
"|h[" << factionName <<
' ' <<
localeNames[loc] <<
"]|h|r";
565 ss << faction.
ID <<
" - " << factionName <<
' ' <<
localeNames[loc];
602 needle.assign(*needleStr);
608 if (foundList.empty())
637 if (foundList.empty())
650 for (DeletedInfoList::iterator itr = foundList.begin(); itr != foundList.end(); ++itr)
655 if (foundList.size() == 1)
657 std::string newName{ *newCharName };
661 delInfo.
name = newName;
695 if (foundList.empty())
706 for (DeletedInfoList::const_iterator itr = foundList.begin(); itr != foundList.end(); ++itr)
728 keepDays =
static_cast<int32>(*days);
729 else if (keepDays <= 0)
742 accountId = target->GetSession()->GetAccountId();
743 target->GetSession()->KickPlayer(
"HandleCharacterEraseCommand GM Command deleting character");
748 std::string accountName;
764 uint8 oldlevel =
static_cast<uint8>(player->IsConnected() ? player->GetConnectedPlayer()->GetLevel() :
sCharacterCache->GetCharacterLevelByGuid(*player));
772 if (
Player* target = player->GetConnectedPlayer())
774 target->GiveLevel(
static_cast<uint8>(newlevel));
775 target->InitTalentForLevel();
780 if (oldlevel == newlevel)
782 else if (oldlevel <
static_cast<uint8>(newlevel))
793 stmt->
setUInt32(1, player->GetGUID().GetCounter());
810 uint8 oldlevel =
static_cast<uint8>(player->IsConnected() ? player->GetConnectedPlayer()->GetLevel() :
sCharacterCache->GetCharacterLevelByGuid(*player));
811 int16 newlevel =
static_cast<int16>(oldlevel) + level;
819 if (
Player* target = player->GetConnectedPlayer())
821 target->GiveLevel(
static_cast<uint8>(newlevel));
822 target->InitTalentForLevel();
827 if (oldlevel == newlevel)
829 else if (oldlevel <
static_cast<uint8>(newlevel))
840 stmt->
setUInt32(1, player->GetGUID().GetCounter());
872 switch (
PlayerDumpReader().LoadDumpFromString(dump, account, name, characterGUID.value_or(0)))
900 switch (
PlayerDumpReader().LoadDumpFromFile(fileName, account, name, characterGUID.value_or(0)))
930 name.assign(*characterName);
949 if (
sCharacterCache->GetCharacterCacheByGuid(ObjectGuid::Create<HighGuid::Player>(*characterGUID)))
@ CHAR_SEL_CHAR_DEL_INFO_BY_NAME
@ CHAR_DEL_CHAR_DECLINED_NAME
@ CHAR_SEL_CHAR_DEL_INFO_BY_GUID
@ CHAR_SEL_CHARACTER_NAME_DATA
@ CHAR_UPD_ACCOUNT_BY_GUID
@ CHAR_UPD_ADD_AT_LOGIN_FLAG
@ CHAR_UPD_RESTORE_DELETE_INFO
char const * localeNames[TOTAL_LOCALES]
DBCStorage< CharTitlesEntry > sCharTitlesStore(CharTitlesEntryfmt)
DBCStorage< FactionEntry > sFactionStore(FactionEntryfmt)
std::shared_ptr< PreparedResultSet > PreparedQueryResult
DatabaseWorkerPool< CharacterDatabaseConnection > CharacterDatabase
Accessor to the character database.
@ LANG_FACTION_PEACE_FORCED
@ LANG_CHARACTER_DELETED_SKIP_NAME
@ LANG_CHARACTER_DELETED_LIST_LINE_CHAT
@ LANG_CHARACTER_DELETED_ERR_RENAME
@ LANG_CHARACTER_DELETED_LIST_HEADER
@ LANG_CHARACTER_DELETED_LIST_LINE_CONSOLE
@ LANG_FACTION_INVISIBLE_FORCED
@ LANG_COMMAND_EXPORT_DELETED_CHAR
@ LANG_CHANGEFACTION_NOT_ELIGIBLE_60
@ LANG_CHARACTER_GUID_IN_USE
@ LANG_CUSTOMIZE_PLAYER_GUID
@ LANG_ACCOUNT_CHARACTER_LIST_FULL
@ LANG_RENAME_PLAYER_WITH_NEW_NAME
@ LANG_CHARACTER_DELETED_RESTORE
@ LANG_COMMAND_EXPORT_SUCCESS
@ LANG_CHARACTER_DELETED_SKIP_FULL
@ LANG_CHARACTER_DELETED_LIST_EMPTY
@ LANG_CHARACTER_DELETED_LIST_BAR
@ LANG_TITLE_LIST_CONSOLE
@ LANG_COMMAND_IMPORT_FAILED
@ LANG_YOURS_LEVEL_PROGRESS_RESET
@ LANG_COMMAND_EXPORT_FAILED
@ LANG_CHANGEFACTION_NOT_ELIGIBLE_10
@ LANG_RENAME_PLAYER_ALREADY_EXISTS
@ LANG_CHARACTER_DELETED_SKIP_ACCOUNT
@ LANG_RENAME_PLAYER_GUID
@ LANG_CHANGEACCOUNT_SUCCESS
@ LANG_INVALID_CHARACTER_NAME
@ LANG_COMMAND_IMPORT_SUCCESS
@ LANG_CHARACTER_DELETED_DELETE
bool normalizePlayerName(std::string &name)
std::optional< T > Optional
Optional helper class to wrap optional values within.
@ AT_LOGIN_CHANGE_FACTION
std::map< RepListID, FactionState > FactionStateList
std::string TimeToTimestampStr(time_t t)
static uint32 GetCharactersCount(uint32 accountId)
static bool GetName(uint32 accountId, std::string &name)
std::string playerLink(std::string const &name) const
static std::string PGetParseString(std::string_view fmt, Args &&... args)
WorldSession * GetSession()
virtual LocaleConstant GetSessionDbcLocale() const
virtual std::string GetNameLink() const
bool HasLowerSecurity(Player *target, ObjectGuid guid, bool strong=false)
void SetSentErrorMessage(bool val)
void PSendSysMessage(char const *fmt, Args &&... args)
virtual void SendSysMessage(std::string_view str, bool escapeCharacters=false)
virtual bool needReportToTarget(Player *chr) const
virtual char const * GetTrinityString(uint32 entry) const
constexpr bool HasFlag(T flag) const
Class used to access individual fields of database query result.
std::string GetString() const
LowType GetCounter() const
std::string ToString() const
static ResponseCodes CheckPlayerName(std::string_view name, LocaleConstant locale, bool create=false)
uint32 GetUInt32Value(uint16 index) const
static void DeleteOldCharacters()
Gender GetNativeGender() const override
bool HasTitle(uint32 bitIndex) const
static void DeleteFromDB(ObjectGuid playerguid, uint32 accountId, bool updateRealmChars=true, bool deleteFinally=false)
ReputationMgr & GetReputationMgr()
void setUInt16(uint8 index, uint16 value)
void setUInt32(uint8 index, uint32 value)
void setUInt8(uint8 index, uint8 value)
void setString(uint8 index, std::string const &value)
std::string GetReputationRankName(FactionEntry const *factionEntry) const
FactionStateList const & GetStateList() const
int32 GetReputation(uint32 faction_id) const
Player session in the World.
Player * GetPlayer() const
static bool HandleCharacterDeletedListCommand(ChatHandler *handler, Optional< std::string_view > needleStr)
static bool HandlePDumpLoadCommand(ChatHandler *handler, std::string fileName, AccountIdentifier account, Optional< std::string_view > characterName, Optional< ObjectGuid::LowType > characterGUID)
static bool HandleLevelUpCommand(ChatHandler *handler, Optional< PlayerIdentifier > player, int16 level)
static bool GetDeletedCharacterInfoList(DeletedInfoList &foundList, std::string &searchString)
static bool HandleCharacterLevelCommand(ChatHandler *handler, Optional< PlayerIdentifier > player, int16 newlevel)
ChatCommandTable GetCommands() const override
static void HandleCharacterDeletedRestoreHelper(DeletedInfo const &delInfo, ChatHandler *handler)
static bool HandlePDumpCopyCommand(ChatHandler *handler, PlayerIdentifier player, AccountIdentifier account, Optional< std::string_view > characterName, Optional< ObjectGuid::LowType > characterGUID)
static bool HandleCharacterCustomizeCommand(ChatHandler *handler, Optional< PlayerIdentifier > player)
static bool HandleCharacterRenameCommand(ChatHandler *handler, Optional< PlayerIdentifier > player, Optional< std::string_view > newNameV)
static bool HandleCharacterDeletedDeleteCommand(ChatHandler *handler, std::string needle)
static bool HandleCharacterChangeRaceCommand(ChatHandler *handler, Optional< PlayerIdentifier > player)
static bool HandleCharacterDeletedOldCommand(ChatHandler *, Optional< uint16 > days)
static bool HandleCharacterChangeAccountCommand(ChatHandler *handler, Optional< PlayerIdentifier > player, AccountIdentifier newAccount)
static bool ValidatePDumpTarget(ChatHandler *handler, std::string &name, Optional< std::string_view > characterName, Optional< ObjectGuid::LowType > characterGUID)
static bool HandleCharacterTitlesCommand(ChatHandler *handler, Optional< PlayerIdentifier > player)
character_commandscript()
static void HandleCharacterDeletedListHelper(DeletedInfoList const &foundList, ChatHandler *handler)
static bool HandlePDumpWriteCommand(ChatHandler *handler, std::string fileName, PlayerIdentifier player)
static bool HandleCharacterReputationCommand(ChatHandler *handler, Optional< PlayerIdentifier > player)
static bool HandleCharacterEraseCommand(ChatHandler *handler, PlayerIdentifier player)
static bool HandleCharacterChangeFactionCommand(ChatHandler *handler, Optional< PlayerIdentifier > player)
static bool HandleCharacterDeletedRestoreCommand(ChatHandler *handler, std::string needle, Optional< std::string_view > newCharName, Optional< AccountIdentifier > newAccount)
std::list< DeletedInfo > DeletedInfoList
void AddSC_character_commandscript()
@ CONFIG_CHARDELETE_KEEP_DAYS
@ CONFIG_CHARACTERS_PER_REALM
std::vector< ChatCommandBuilder > ChatCommandTable
std::string StringFormat(FormatString< Args... > fmt, Args &&... args)
Default TC string format function.
@ RBAC_PERM_COMMAND_CHARACTER_CHANGERACE
@ RBAC_PERM_COMMAND_PDUMP_COPY
@ RBAC_PERM_COMMAND_CHARACTER_DELETED_OLD
@ RBAC_PERM_COMMAND_LEVELUP
@ RBAC_PERM_COMMAND_CHARACTER_LEVEL
@ RBAC_PERM_COMMAND_CHARACTER_DELETED_DELETE
@ RBAC_PERM_SKIP_CHECK_CHARACTER_CREATION_RESERVEDNAME
@ RBAC_PERM_COMMAND_CHARACTER_CHANGEFACTION
@ RBAC_PERM_COMMAND_CHARACTER_TITLES
@ RBAC_PERM_COMMAND_CHARACTER_CUSTOMIZE
@ RBAC_PERM_COMMAND_CHARACTER_CHANGEACCOUNT
@ RBAC_PERM_COMMAND_CHARACTER_RENAME
@ RBAC_PERM_COMMAND_CHARACTER_ERASE
@ RBAC_PERM_COMMAND_PDUMP_LOAD
@ RBAC_PERM_COMMAND_CHARACTER_REPUTATION
@ RBAC_PERM_COMMAND_CHARACTER_DELETED_LIST
@ RBAC_PERM_COMMAND_CHARACTER_DELETED_RESTORE
@ RBAC_PERM_COMMAND_PDUMP_WRITE
EnumFlag< ReputationFlags > Flags
std::string const & GetName() const
Player * GetConnectedPlayer() const
ObjectGuid GetGUID() const
static Optional< PlayerIdentifier > FromTarget(ChatHandler *handler)
std::string const & GetName() const
static Optional< PlayerIdentifier > FromTargetOrSelf(ChatHandler *handler)
std::string name
the character name
std::string accountName
the account name
time_t deleteDate
the date at which the character has been deleted
ObjectGuid guid
the GUID from the character
uint32 accountId
the account id