[7039] Implement mangosd.conf options Death.Bones.* for disable bones creating from corpse in world zones or in arena/bg.

Note: in case apply insignia bones still created as required for looting.
This commit is contained in:
VladimirMangos 2009-01-06 14:46:30 +03:00
parent 1c5456324a
commit 7bae367084
8 changed files with 22 additions and 6 deletions

View file

@ -53,7 +53,7 @@ static void CorpsesEraseCallBack(QueryResult *result, bool bones)
{ {
if(!ObjectAccessor::Instance().ConvertCorpseForPlayer(player_guid)) if(!ObjectAccessor::Instance().ConvertCorpseForPlayer(player_guid))
{ {
sLog.outDebug("Corpse %u not found in world. Delete from DB.",guidlow); sLog.outDebug("Corpse %u not found in world or bones creating forbidden. Delete from DB.",guidlow);
CharacterDatabase.PExecute("DELETE FROM corpse WHERE guid = '%u'",guidlow); CharacterDatabase.PExecute("DELETE FROM corpse WHERE guid = '%u'",guidlow);
} }
} }

View file

@ -36,6 +36,7 @@
#include "Opcodes.h" #include "Opcodes.h"
#include "ObjectDefines.h" #include "ObjectDefines.h"
#include "MapInstanced.h" #include "MapInstanced.h"
#include "World.h"
#include <cmath> #include <cmath>
@ -430,7 +431,7 @@ ObjectAccessor::AddCorpsesToGrid(GridPair const& gridpair,GridType& grid,Map* ma
} }
Corpse* Corpse*
ObjectAccessor::ConvertCorpseForPlayer(uint64 player_guid) ObjectAccessor::ConvertCorpseForPlayer(uint64 player_guid, bool insignia)
{ {
Corpse *corpse = GetCorpseForPlayerGUID(player_guid); Corpse *corpse = GetCorpseForPlayerGUID(player_guid);
if(!corpse) if(!corpse)
@ -456,7 +457,10 @@ ObjectAccessor::ConvertCorpseForPlayer(uint64 player_guid)
Corpse *bones = NULL; Corpse *bones = NULL;
// create the bones only if the map and the grid is loaded at the corpse's location // create the bones only if the map and the grid is loaded at the corpse's location
if(map && !map->IsRemovalGrid(corpse->GetPositionX(), corpse->GetPositionY())) // ignore bones creating option in case insignia
if (map && (insignia ||
(map->IsBattleGroundOrArena() ? sWorld.getConfig(CONFIG_DEATH_BONES_BG_OR_ARENA) : sWorld.getConfig(CONFIG_DEATH_BONES_WORLD))) &&
!map->IsRemovalGrid(corpse->GetPositionX(), corpse->GetPositionY()))
{ {
// Create bones, don't change Corpse // Create bones, don't change Corpse
bones = new Corpse; bones = new Corpse;

View file

@ -192,7 +192,7 @@ class MANGOS_DLL_DECL ObjectAccessor : public MaNGOS::Singleton<ObjectAccessor,
void RemoveCorpse(Corpse *corpse); void RemoveCorpse(Corpse *corpse);
void AddCorpse(Corpse* corpse); void AddCorpse(Corpse* corpse);
void AddCorpsesToGrid(GridPair const& gridpair,GridType& grid,Map* map); void AddCorpsesToGrid(GridPair const& gridpair,GridType& grid,Map* map);
Corpse* ConvertCorpseForPlayer(uint64 player_guid); Corpse* ConvertCorpseForPlayer(uint64 player_guid, bool insignia = false);
static void UpdateObject(Object* obj, Player* exceptPlayer); static void UpdateObject(Object* obj, Player* exceptPlayer);
static void _buildUpdateObject(Object* obj, UpdateDataMapType &); static void _buildUpdateObject(Object* obj, UpdateDataMapType &);

View file

@ -7147,7 +7147,7 @@ void Player::RemovedInsignia(Player* looterPlr)
// We have to convert player corpse to bones, not to be able to resurrect there // We have to convert player corpse to bones, not to be able to resurrect there
// SpawnCorpseBones isn't handy, 'cos it saves player while he in BG // SpawnCorpseBones isn't handy, 'cos it saves player while he in BG
Corpse *bones = ObjectAccessor::Instance().ConvertCorpseForPlayer(GetGUID()); Corpse *bones = ObjectAccessor::Instance().ConvertCorpseForPlayer(GetGUID(),true);
if (!bones) if (!bones)
return; return;

View file

@ -914,6 +914,8 @@ void World::LoadConfigSettings(bool reload)
m_configs[CONFIG_DEATH_SICKNESS_LEVEL] = sConfig.GetIntDefault("Death.SicknessLevel", 11); m_configs[CONFIG_DEATH_SICKNESS_LEVEL] = sConfig.GetIntDefault("Death.SicknessLevel", 11);
m_configs[CONFIG_DEATH_CORPSE_RECLAIM_DELAY_PVP] = sConfig.GetBoolDefault("Death.CorpseReclaimDelay.PvP", true); m_configs[CONFIG_DEATH_CORPSE_RECLAIM_DELAY_PVP] = sConfig.GetBoolDefault("Death.CorpseReclaimDelay.PvP", true);
m_configs[CONFIG_DEATH_CORPSE_RECLAIM_DELAY_PVE] = sConfig.GetBoolDefault("Death.CorpseReclaimDelay.PvE", true); m_configs[CONFIG_DEATH_CORPSE_RECLAIM_DELAY_PVE] = sConfig.GetBoolDefault("Death.CorpseReclaimDelay.PvE", true);
m_configs[CONFIG_DEATH_BONES_WORLD] = sConfig.GetBoolDefault("Death.Bones.World", true);
m_configs[CONFIG_DEATH_BONES_BG_OR_ARENA] = sConfig.GetBoolDefault("Death.Bones.BattlegroundOrArena", true);
m_configs[CONFIG_THREAT_RADIUS] = sConfig.GetIntDefault("ThreatRadius", 100); m_configs[CONFIG_THREAT_RADIUS] = sConfig.GetIntDefault("ThreatRadius", 100);

View file

@ -172,6 +172,8 @@ enum WorldConfigs
CONFIG_DEATH_SICKNESS_LEVEL, CONFIG_DEATH_SICKNESS_LEVEL,
CONFIG_DEATH_CORPSE_RECLAIM_DELAY_PVP, CONFIG_DEATH_CORPSE_RECLAIM_DELAY_PVP,
CONFIG_DEATH_CORPSE_RECLAIM_DELAY_PVE, CONFIG_DEATH_CORPSE_RECLAIM_DELAY_PVE,
CONFIG_DEATH_BONES_WORLD,
CONFIG_DEATH_BONES_BG_OR_ARENA,
CONFIG_THREAT_RADIUS, CONFIG_THREAT_RADIUS,
CONFIG_INSTANT_LOGOUT, CONFIG_INSTANT_LOGOUT,
CONFIG_DISABLE_BREATHING, CONFIG_DISABLE_BREATHING,

View file

@ -1058,6 +1058,12 @@ Visibility.Distance.Grey.Object = 10
# Default: 1 (enabled) # Default: 1 (enabled)
# 0 (disabled) # 0 (disabled)
# #
# Death.Bones.World
# Death.Bones.BattlegroundOrArena
# Enabled/disabled creating bones instead corpse at resurrection (in normal zones/instacnes, or battleground/arenas)
# Default: 1 (enabled)
# 0 (disabled)
#
################################################################################################################### ###################################################################################################################
Rate.Health = 1 Rate.Health = 1
@ -1111,6 +1117,8 @@ DurabilityLossChance.Block = 0.05
Death.SicknessLevel = 11 Death.SicknessLevel = 11
Death.CorpseReclaimDelay.PvP = 1 Death.CorpseReclaimDelay.PvP = 1
Death.CorpseReclaimDelay.PvE = 1 Death.CorpseReclaimDelay.PvE = 1
Death.Bones.World = 1
Death.Bones.BattlegroundOrArena = 1
################################################################################################################### ###################################################################################################################
# #

View file

@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__ #ifndef __REVISION_NR_H__
#define __REVISION_NR_H__ #define __REVISION_NR_H__
#define REVISION_NR "7038" #define REVISION_NR "7039"
#endif // __REVISION_NR_H__ #endif // __REVISION_NR_H__