aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/server/game/Entities/Player/Player.cpp25
-rw-r--r--src/server/game/World/World.cpp24
-rw-r--r--src/server/game/World/World.h1
-rw-r--r--src/server/worldserver/worldserver.conf.dist10
4 files changed, 52 insertions, 8 deletions
diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp
index 4114dd6109f..60dbb7651d0 100644
--- a/src/server/game/Entities/Player/Player.cpp
+++ b/src/server/game/Entities/Player/Player.cpp
@@ -4688,20 +4688,33 @@ TrainerSpellState Player::GetTrainerSpellState(TrainerSpell const* trainer_spell
*/
void Player::DeleteFromDB(uint64 playerguid, uint32 accountId, bool updateRealmChars, bool deleteFinally)
{
- // for not existed account avoid update realm
+ // Avoid realm-update for non-existing account
if (accountId == 0)
updateRealmChars = false;
+ // Convert guid to low GUID for CharacterNameData, but also other methods on success
+ uint32 guid = GUID_LOPART(playerguid);
+
+ // To avoid a query, we select loaded data. If it doesn't exist, return.
+ CharacterNameData const* nameData = sWorld->GetCharacterNameData(guid);
+ if (!nameData)
+ {
+ sLog->outError(LOG_FILTER_PLAYER, "Invalid call on information for guid (%u) from account (%u). Could not delete character.", guid, accountId);
+ return;
+ }
+
+ // Selecting the required pieces of information
+ uint8 playerClass = nameData->m_class;
+ uint8 playerLevel = nameData->m_level;
+ // Define the required variables
uint32 charDelete_method = sWorld->getIntConfig(CONFIG_CHARDELETE_METHOD);
- uint32 charDelete_minLvl = sWorld->getIntConfig(CONFIG_CHARDELETE_MIN_LEVEL);
+ uint32 charDelete_minLvl = sWorld->getIntConfig(playerClass != CLASS_DEATH_KNIGHT ? CONFIG_CHARDELETE_MIN_LEVEL : CONFIG_CHARDELETE_HEROIC_MIN_LEVEL);
- // if we want to finally delete the character or the character does not meet the level requirement,
+ // if we want to finalize the character removal or the character does not meet the level requirement of either heroic or non-heroic settings,
// we set it to mode CHAR_DELETE_REMOVE
- if (deleteFinally || Player::GetLevelFromDB(playerguid) < charDelete_minLvl)
+ if (deleteFinally || playerLevel < charDelete_minLvl)
charDelete_method = CHAR_DELETE_REMOVE;
- uint32 guid = GUID_LOPART(playerguid);
-
// convert corpse to bones if exist (to prevent exiting Corpse in World without DB entry)
// bones will be deleted by corpse/bones deleting thread shortly
sObjectAccessor->ConvertCorpseForPlayer(playerguid);
diff --git a/src/server/game/World/World.cpp b/src/server/game/World/World.cpp
index 144d91485b5..834f02d7692 100644
--- a/src/server/game/World/World.cpp
+++ b/src/server/game/World/World.cpp
@@ -1100,6 +1100,7 @@ void World::LoadConfigSettings(bool reload)
///- Load the CharDelete related config options
m_int_configs[CONFIG_CHARDELETE_METHOD] = ConfigMgr::GetIntDefault("CharDelete.Method", 0);
m_int_configs[CONFIG_CHARDELETE_MIN_LEVEL] = ConfigMgr::GetIntDefault("CharDelete.MinLevel", 0);
+ m_int_configs[CONFIG_CHARDELETE_HEROIC_MIN_LEVEL] = ConfigMgr::GetIntDefault("CharDelete.Heroic.MinLevel", 0);
m_int_configs[CONFIG_CHARDELETE_KEEP_DAYS] = ConfigMgr::GetIntDefault("CharDelete.KeepDays", 30);
///- Read the "Data" directory from the config file
@@ -3076,6 +3077,27 @@ void World::ProcessQueryCallbacks()
}
}
+/**
+* @brief Loads several pieces of information on server startup with the low GUID
+* There is no further database query necessary.
+* These are a number of methods that work into the calling function.
+*
+* @param guid Requires a lowGUID to call
+* @return Name, Gender, Race, Class and Level of player character
+* Example Usage:
+* @code
+* CharacterNameData const* nameData = sWorld->GetCharacterNameData(lowGUID);
+* if (!nameData)
+* return;
+*
+* std::string playerName = nameData->m_name;
+* uint8 playerGender = nameData->m_gender;
+* uint8 playerRace = nameData->m_race;
+* uint8 playerClass = nameData->m_class;
+* uint8 playerLevel = nameData->m_level;
+* @endcode
+**/
+
void World::LoadCharacterNameData()
{
sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading character name data");
@@ -3145,7 +3167,7 @@ CharacterNameData const* World::GetCharacterNameData(uint32 guid) const
void World::ReloadRBAC()
{
- // Pasive reload, we mark the data as invalidated and next time a permission is checked it will be reloaded
+ // Passive reload, we mark the data as invalidated and next time a permission is checked it will be reloaded
sLog->outInfo(LOG_FILTER_RBAC, "World::ReloadRBAC()");
for (SessionMap::const_iterator itr = m_sessions.begin(); itr != m_sessions.end(); ++itr)
if (WorldSession* session = itr->second)
diff --git a/src/server/game/World/World.h b/src/server/game/World/World.h
index b303ca4bd4b..984a1709ac8 100644
--- a/src/server/game/World/World.h
+++ b/src/server/game/World/World.h
@@ -300,6 +300,7 @@ enum WorldIntConfigs
CONFIG_CHARDELETE_KEEP_DAYS,
CONFIG_CHARDELETE_METHOD,
CONFIG_CHARDELETE_MIN_LEVEL,
+ CONFIG_CHARDELETE_HEROIC_MIN_LEVEL,
CONFIG_AUTOBROADCAST_CENTER,
CONFIG_AUTOBROADCAST_INTERVAL,
CONFIG_MAX_RESULTS_LOOKUP_COMMANDS,
diff --git a/src/server/worldserver/worldserver.conf.dist b/src/server/worldserver/worldserver.conf.dist
index bf19240407f..a9b09e5d94f 100644
--- a/src/server/worldserver/worldserver.conf.dist
+++ b/src/server/worldserver/worldserver.conf.dist
@@ -2372,13 +2372,21 @@ CharDelete.Method = 0
#
# CharDelete.MinLevel
-# Description: Required level to use the unlinking method if enabled.
+# Description: Required level to use the unlinking method if enabled for non-heroic classes.
# Default: 0 - (Same method for every level)
# 1+ - (Only characters with the specified level will use the unlinking method)
CharDelete.MinLevel = 0
#
+# CharDelete.Heroic.MinLevel
+# Description: Required level to use the unlinking method if enabled for heroic classes.
+# Default: 0 - (Same method for every level)
+# 1+ - (Only characters with the specified level will use the unlinking method)
+
+CharDelete.Heroic.MinLevel = 0
+
+#
# CharDelete.KeepDays
# Description: Time (in days) before unlinked characters will be removed from the database.
# Default: 30 - (Enabled)