Created
April 2, 2013 17:38
-
-
Save Raydor/5294351 to your computer and use it in GitHub Desktop.
Comprueba una máxima cantidad de daño que hace el jugador, y si la sobrepasa, banea a ese jugador las horas que se hayan asignado en el config.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/src/server/game/World/World.h b/src/server/game/World/World.h | |
--- 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_CHECKEO_MAXIMO_DMG, | |
+ CONFIG_MINIMO_NIVEL_DE_MJ_PARA_INMUNIDAD_A_CHECKEO, | |
+ CONFIG_CHECKEO_DMG_VALOR_DE_BANEO, | |
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 | |
--- 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_CHECKEO_MAXIMO_DMG] = ConfigMgr::GetIntDefault("CheckeoDmg.MaximoDmg", 50000); | |
+ m_int_configs[CONFIG_MINIMO_NIVEL_DE_MJ_PARA_INMUNIDAD_A_CHECKEO] = ConfigMgr::GetIntDefault("CheckeoDmg.MinMJLevelInmune", 1); | |
+ m_int_configs[CONFIG_CHECKEO_DMG_VALOR_DE_BANEO] = ConfigMgr::GetIntDefault("CheckeoDmg.ValorBaneo", 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 | |
--- 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"); | |
+ // Checkeo de daño | |
+ if(GetTypeId() == TYPEID_PLAYER | |
+ && sWorld->getIntConfig(CONFIG_CHECKEO_MAXIMO_DMG) > 0 | |
+ && damage >= sWorld->getIntConfig(CONFIG_CHECKEO_MAXIMO_DMG) | |
+ && (uint8)ToPlayer()->GetSession()->GetSecurity() < sWorld->getIntConfig(CONFIG_MINIMO_NIVEL_DE_MJ_PARA_INMUNIDAD_A_CHECKEO)) | |
+ { | |
+ // Castigo | |
+ uint32 banTime = sWorld->getIntConfig(CONFIG_CHECKEO_DMG_VALOR_DE_BANEO); | |
+ if(banTime > 0) | |
+ sWorld->BanCharacter(ToPlayer()->GetName(), secsToTimeString(banTime, true).c_str(), "Superar el damage", "Checkeo de Dmg"); | |
+ | |
+ sLog->outString("Checkeo de damage: Nombre del jugador '%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 | |
--- 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 | |
+# OPCIONES DE CHECKEO DE DMG | |
# | |
################################################################################################### | |
@@ -2880,3 +2881,29 @@ PlayerDump.DisallowOverwrite = 1 | |
# | |
################################################################################################### | |
+ | |
+################################################################################################### | |
+# OPCIONES DE CHECKEO DE DMG | |
+# | |
+# CheckeoDmg.MaximoDmg | |
+# Daño máximo del jugador. Si el valor es distinto de 0, contará ese daño máximo. | |
+# Por defecto: 0 - Deshabilitado | |
+# | |
+ | |
+CheckeoDmg.MaximoDmg = 50000 | |
+ | |
+# | |
+# CheckeoDmg.MinMJLevelInmune | |
+# El nivel mínimo requerido de MJ para obtener inmunidad al detector. | |
+# Por defecto: 1 | |
+ | |
+CheckeoDmg.MinMJLevelInmune = 1 | |
+ | |
+# | |
+# CheckeoDmg.ValorBaneo | |
+# Tiempo de baneo al jugador (en segundos). Si el valor es 0 o menor, solamente se guardará en el log. | |
+# Por defecto: 3600 (1 hora) | |
+ | |
+CheckeoDmg.ValorBaneo = 3600 | |
+ | |
+# | |
+################################################################################################### |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment