Merge pull request #9727 from Ascathor/master

Core/Player: CharDelete.Heroic.MinLevel as seperated unlink requirement for Heroic classes
This commit is contained in:
Subv
2013-04-27 22:45:08 -07:00
4 changed files with 55 additions and 11 deletions
+22 -9
View File
@@ -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;
uint32 charDelete_method = sWorld->getIntConfig(CONFIG_CHARDELETE_METHOD);
uint32 charDelete_minLvl = sWorld->getIntConfig(CONFIG_CHARDELETE_MIN_LEVEL);
// if we want to finally delete the character or the character does not meet the level requirement,
// we set it to mode CHAR_DELETE_REMOVE
if (deleteFinally || Player::GetLevelFromDB(playerguid) < charDelete_minLvl)
charDelete_method = CHAR_DELETE_REMOVE;
// 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(playerClass != CLASS_DEATH_KNIGHT ? CONFIG_CHARDELETE_MIN_LEVEL : CONFIG_CHARDELETE_HEROIC_MIN_LEVEL);
// 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 || playerLevel < charDelete_minLvl)
charDelete_method = CHAR_DELETE_REMOVE;
// 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);
+23 -1
View File
@@ -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)
+1
View File
@@ -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,
+9 -1
View File
@@ -2372,12 +2372,20 @@ 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.