70 {
"deleted", characterDeletedCommandTable },
80 {
"character", characterCommandTable },
82 {
"pdump", pdumpCommandTable },
110 if (!searchString.empty())
140 Field* fields = result->Fetch();
144 info.
guid = ObjectGuid::Create<HighGuid::Player>(fields[0].GetUInt64());
151 foundList.push_back(info);
153 while (result->NextRow());
178 for (DeletedInfoList::const_iterator itr = foundList.begin(); itr != foundList.end(); ++itr)
184 itr->guid.ToString().c_str(), itr->name.c_str(), itr->accountName.empty() ?
"<Not existing>" : itr->accountName.c_str(),
185 itr->accountId, dateStr.c_str());
188 itr->guid.ToString().c_str(), itr->name.c_str(), itr->accountName.empty() ?
"<Not existing>" : itr->accountName.c_str(),
189 itr->accountId, dateStr.c_str());
240 player = PlayerIdentifier::FromTargetOrSelf(handler);
241 if (!player || !player->IsConnected())
248 Player const* target = player->GetConnectedPlayer();
258 if (titleInfo && target->
HasTitle(titleInfo))
266 char const* activeStr =
"";
270 std::string titleName = fmt::sprintf(name, player->GetName());
286 if (!player && newNameV)
290 player = PlayerIdentifier::FromTarget(handler);
299 std::string newName{ *newNameV };
336 stmt->
setUInt64(0, player->GetGUID().GetCounter());
339 if (
Player* target = player->GetConnectedPlayer())
341 target->SetName(newName);
344 session->KickPlayer(
"HandleCharacterRenameCommand GM Command renaming character");
350 stmt->
setUInt64(1, player->GetGUID().GetCounter());
360 if (
Player* player = session->GetPlayer())
361 sLog->OutCommand(session->GetAccountId(),
"GM {} (Account: {}) forced rename {} to player {} (Account: {})", player->GetName(), session->GetAccountId(), newName, player->GetName(),
sCharacterCache->GetCharacterAccountIdByGuid(player->GetGUID()));
364 sLog->OutCommand(0,
"CONSOLE forced rename '{}' to '{}' ({})", player->GetName(), newName, player->GetGUID().ToString());
368 if (
Player* target = player->GetConnectedPlayer())
383 stmt->
setUInt64(1, player->GetGUID().GetCounter());
395 player = PlayerIdentifier::FromTarget(handler);
399 if (
Player* target = player->GetConnectedPlayer())
409 stmt->
setUInt64(1, player->GetGUID().GetCounter());
419 player = PlayerIdentifier::FromTarget(handler);
423 if (
Player* target = player->GetConnectedPlayer())
433 stmt->
setUInt64(1, player->GetGUID().GetCounter());
443 player = PlayerIdentifier::FromTarget(handler);
447 if (
Player* target = player->GetConnectedPlayer())
457 stmt->
setUInt64(1, player->GetGUID().GetCounter());
467 player = PlayerIdentifier::FromTarget(handler);
481 if (newAccount.
GetID() == oldAccountId)
494 if (
Player* onlinePlayer = player->GetConnectedPlayer())
495 onlinePlayer->GetSession()->KickPlayer(
"HandleCharacterChangeAccountCommand GM Command transferring character to another account");
499 charStmt->
setUInt64(1, player->GetGUID().GetCounter());
502 sWorld->UpdateRealmCharCount(oldAccountId);
509 std::string logString =
Trinity::StringFormat(
"changed ownership of player {} ({}) from account {} to account {}", player->GetName(), player->GetGUID().ToString(), oldAccountId, newAccount.
GetID());
512 if (
Player* player = session->GetPlayer())
513 sLog->OutCommand(session->GetAccountId(),
"GM {} (Account: {}) {}", player->GetName(), session->GetAccountId(), logString);
523 player = PlayerIdentifier::FromTargetOrSelf(handler);
524 if (!player || !player->IsConnected())
531 Player const* target = player->GetConnectedPlayer();
535 for (FactionStateList::const_iterator itr = targetFSL.begin(); itr != targetFSL.end(); ++itr)
539 char const* factionName = factionEntry ? factionEntry->
Name[loc] :
"#Not found#";
541 std::ostringstream ss;
543 ss << faction.
ID <<
" - |cffffffff|Hfaction:" << faction.
ID <<
"|h[" << factionName <<
' ' <<
localeNames[loc] <<
"]|h|r";
545 ss << faction.
ID <<
" - " << factionName <<
' ' <<
localeNames[loc];
582 needle.assign(*needleStr);
588 if (foundList.empty())
617 if (foundList.empty())
630 for (DeletedInfoList::iterator itr = foundList.begin(); itr != foundList.end(); ++itr)
635 if (foundList.size() == 1)
637 std::string newName{ *newCharName };
641 delInfo.
name = newName;
675 if (foundList.empty())
686 for (DeletedInfoList::const_iterator itr = foundList.begin(); itr != foundList.end(); ++itr)
708 keepDays =
static_cast<int32>(*days);
709 else if (keepDays <= 0)
722 accountId = target->GetSession()->GetAccountId();
723 target->GetSession()->KickPlayer(
"HandleCharacterEraseCommand GM Command deleting character");
728 std::string accountName;
740 player = PlayerIdentifier::FromTargetOrSelf(handler);
744 uint8 oldlevel =
static_cast<uint8>(player->IsConnected() ? player->GetConnectedPlayer()->GetLevel() :
sCharacterCache->GetCharacterLevelByGuid(*player));
752 if (
Player* target = player->GetConnectedPlayer())
754 target->GiveLevel(
static_cast<uint8>(newlevel));
755 target->InitTalentForLevel();
760 if (oldlevel == newlevel)
762 else if (oldlevel <
static_cast<uint8>(newlevel))
773 stmt->
setUInt64(1, player->GetGUID().GetCounter());
786 player = PlayerIdentifier::FromTargetOrSelf(handler);
790 uint8 oldlevel =
static_cast<uint8>(player->IsConnected() ? player->GetConnectedPlayer()->GetLevel() :
sCharacterCache->GetCharacterLevelByGuid(*player));
791 int16 newlevel =
static_cast<int16>(oldlevel) + level;
799 if (
Player* target = player->GetConnectedPlayer())
801 target->GiveLevel(
static_cast<uint8>(newlevel));
802 target->InitTalentForLevel();
807 if (oldlevel == newlevel)
809 else if (oldlevel <
static_cast<uint8>(newlevel))
820 stmt->
setUInt64(1, player->GetGUID().GetCounter());
852 switch (
PlayerDumpReader().LoadDumpFromString(dump, account, name, characterGUID.value_or(0)))
880 switch (
PlayerDumpReader().LoadDumpFromFile(fileName, account, name, characterGUID.value_or(0)))
910 name.assign(*characterName);
929 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_UPD_ACCOUNT_BY_GUID
@ CHAR_UPD_ADD_AT_LOGIN_FLAG
@ CHAR_UPD_RESTORE_DELETE_INFO
char const * localeNames[TOTAL_LOCALES]
DB2Storage< CharTitlesEntry > sCharTitlesStore("CharTitles.db2", &CharTitlesLoadInfo::Instance)
DB2Storage< FactionEntry > sFactionStore("Faction.db2", &FactionLoadInfo::Instance)
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_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_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
WorldSession * GetSession()
virtual LocaleConstant GetSessionDbcLocale() const
virtual std::string GetNameLink() const
void PSendSysMessage(const char *fmt, Args &&... args)
bool HasLowerSecurity(Player *target, ObjectGuid guid, bool strong=false)
void SetSentErrorMessage(bool val)
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)
static void DeleteOldCharacters()
UF::UpdateField< UF::PlayerData, 0, TYPEID_PLAYER > m_playerData
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 setUInt8(const uint8 index, const uint8 value)
void setUInt32(const uint8 index, const uint32 value)
void setUInt16(const uint8 index, const uint16 value)
void setString(const uint8 index, const std::string &value)
void setUInt64(const uint8 index, const uint64 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
std::string const & GetName() const
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