viewing paste topic/4495- koe_1.2.diff | Diff

Posted on the | Last edited on
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63
// ===== rAthena Patch ========================================
// = King of Emperium Hill
// ===== By: ==================================================
// = AnnieRuru
// ===== Current Version: =====================================
// = 1.2
// ===== Compatible With: ===================================== 
// = rAthena 2018-04-08
// ===== Description: =========================================
// = stop guild owner from hitting the emperium over and over
// ===== Topic ================================================
// = http://herc.ws/board/topic/4495-king-of-emperium-hill/
// ===== Additional Comments: =================================  
// = finally a patch for this popular script
// ============================================================
 
 db/castle_db.txt   | 2 ++
 src/map/battle.cpp | 7 +++++++
 src/map/battle.hpp | 1 +
 3 files changed, 10 insertions(+)
 
diff --git a/db/castle_db.txt b/db/castle_db.txt
index ceb74dd..0fc8231 100644
--- a/db/castle_db.txt
+++ b/db/castle_db.txt
@@ -60,3 +60,5 @@
 41,te_prtcas03,Gloria 3,Manager_TE#Wigner
 42,te_prtcas04,Gloria 4,Manager_TE#Heine
 43,te_prtcas05,Gloria 5,Manager_TE#Nerious
+
+100,guild_vs1,King of Emperium Hill,koe
\ No newline at end of file
diff --git a/src/map/battle.cpp b/src/map/battle.cpp
index e845c5e..4234ba7 100644
--- a/src/map/battle.cpp
+++ b/src/map/battle.cpp
@@ -7643,6 +7643,13 @@ int battle_check_target( struct block_list *src, struct block_list *target,int f
    if( (s_bl = battle_get_master(src)) == NULL )
        s_bl = src;
 
+   if ( s_bl->type == BL_PC && t_bl->type == BL_MOB ) {
+       struct map_session_data *sd = BL_CAST( BL_PC, s_bl );
+       if ( ( ( (TBL_MOB*)target )->mob_id == 1288 && !strcmp( mapindex_id2name(sd->mapindex), "guild_vs1" ) ) &&
+           ( sd->status.guild_id == mapreg_readreg( add_str("$koegid") ) || battle_getcurrentskill(src) > 0 ) )
+       return 0;
+   }
+
    if ( s_bl->type == BL_PC ) {
        switch( t_bl->type ) {
            case BL_MOB: // Source => PC, Target => MOB
diff --git a/src/map/battle.hpp b/src/map/battle.hpp
index b5fe7d4..f8e8908 100644
--- a/src/map/battle.hpp
+++ b/src/map/battle.hpp
@@ -10,6 +10,7 @@
 #include "../config/core.h"
 
 #include "map.hpp" //ELE_MAX
+#include "mapreg.hpp"
 
 //fwd declaration
 struct map_session_data;
 
Viewed 1846 times, submitted by AnnieRuru.