Dispeller
|
Дата: Воскресенье, 26.08.2012, 21:33 | Сообщение # 1 |
Сержант
Сообщений: 59
| Code Checking the damage the player. By Rescr1pt <img src="../http://s54.ucoz.net/sm/23/wink.gif" border="0" align="absmiddle" alt="wink" /> src/server/game/World/World.h | 3 +++ 1 files changed, 3 insertions(+), 0 deletions(-) diff --git a/src/server/game/World/World.h b/src/server/game/World/World.h index 95e9fbd..c35b46d 100755 --- a/src/server/game/World/World.h +++ b/src/server/game/World/World.h @@ -317,6 +317,9 @@ enum WorldIntConfigs CONFIG_WARDEN_CLIENT_BAN_DURATION, CONFIG_WARDEN_NUM_MEM_CHECKS, CONFIG_WARDEN_NUM_OTHER_CHECKS, + CONFIG_DAMAGE_CHECKER_MAX_DAMAGE, + CONFIG_DAMAGE_CHECKER_IMMUNE_MIN_GM_LEVEL, + CONFIG_DAMAGE_CHECKER_BAN_VALUE, INT_CONFIG_VALUE_COUNT }; src/server/game/World/World.cpp | 5 +++++ 1 files changed, 5 insertions(+), 0 deletions(-) diff --git a/src/server/game/World/World.cpp b/src/server/game/World/World.cpp index ccc8bb2..5b4e912 100755 --- a/src/server/game/World/World.cpp +++ b/src/server/game/World/World.cpp @@ -1200,6 +1200,11 @@ void World::LoadConfigSettings(bool reload) m_bool_configs[CONFIG_PDUMP_NO_PATHS] = ConfigMgr::GetBoolDefault("PlayerDump.DisallowPaths", true); m_bool_configs[CONFIG_PDUMP_NO_OVERWRITE] = ConfigMgr::GetBoolDefault("PlayerDump.DisallowOverwrite", true); + // damage checker + m_int_configs[CONFIG_DAMAGE_CHECKER_MAX_DAMAGE] = ConfigMgr::GetIntDefault("DamageChecker.MaxDamage", 50000); + m_int_configs[CONFIG_DAMAGE_CHECKER_IMMUNE_MIN_GM_LEVEL] = ConfigMgr::GetIntDefault("DamageChecker.ImmuneMinGMLevel", 1); + m_int_configs[CONFIG_DAMAGE_CHECKER_BAN_VALUE] = ConfigMgr::GetIntDefault("DamageChecker.BanValue", 3600); + // call ScriptMgr if we're reloading the configuration if (reload) sScriptMgr->OnConfigLoad(reload); src/server/game/Entities/Unit/Unit.cpp | 14 ++++++++++++++ 1 files changed, 14 insertions(+), 0 deletions(-) diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index d71f8e8..5ea95cf 100755 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -655,6 +655,20 @@ uint32 Unit::DealDamage(Unit* victim, uint32 damage, CleanDamage const* cleanDam sLog->outStaticDebug("DealDamageStart"); + // damage checker + if(GetTypeId() == TYPEID_PLAYER + && sWorld->getIntConfig(CONFIG_DAMAGE_CHECKER_MAX_DAMAGE) > 0 + && damage >= sWorld->getIntConfig(CONFIG_DAMAGE_CHECKER_MAX_DAMAGE) + && (uint8)ToPlayer()->GetSession()->GetSecurity() < sWorld->getIntConfig(CONFIG_DAMAGE_CHECKER_IMMUNE_MIN_GM_LEVEL)) + { + // punishment + uint32 banTime = sWorld->getIntConfig(CONFIG_DAMAGE_CHECKER_BAN_VALUE); + if(banTime > 0) + sWorld->BanCharacter(ToPlayer()->GetName(), secsToTimeString(banTime, true).c_str(), "Maximal damage", "Damage Checker"); + + sLog->outString("Damage Checker: Player name '%s', damage %u", ToPlayer()->GetName(), damage); + } + uint32 health = victim->GetHealth(); sLog->outDetail("deal dmg:%d to health:%d ", damage, health); src/server/worldserver/worldserver.conf.dist | 27 ++++++++++++++++++++++++++ 1 files changed, 27 insertions(+), 0 deletions(-) diff --git a/src/server/worldserver/worldserver.conf.dist b/src/server/worldserver/worldserver.conf.dist index 5d83710..9dae019 100644 --- a/src/server/worldserver/worldserver.conf.dist +++ b/src/server/worldserver/worldserver.conf.dist @@ -25,6 +25,7 @@ # CONSOLE AND REMOTE ACCESS # CHARACTER DELETE OPTIONS # CUSTOM SERVER OPTIONS +# DAMAGE CHECKER OPTIONS # ################################################################################################### @@ -2880,3 +2881,29 @@ PlayerDump.DisallowOverwrite = 1 # ################################################################################################### + +################################################################################################### +# DAMAGE CHECKER OPTIONS +# +# DamageChecker.MaxDamage +# Maximum damage on the player. +# Default: 0 - disable + +DamageChecker.MaxDamage = 50000 + +# +# DamageChecker.ImmuneMinGMLevel +# The min level of GM, to obtain immunity from the detector. +# Default: 1 + +DamageChecker.ImmuneMinGMLevel = 1 + +# +# DamageChecker.BanValue +# Ban-time for the character (in seconds). If the BanValue is 0 or less, then only get a log. +# Default: 3600 + +DamageChecker.BanValue = 3600 + +# +###################################################################################################
|
|
| |