viewing paste topic/4495- koe_1.2.c | C

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
//===== Hercules Plugin ======================================
//= King of Emperium Hill
//===== By: ==================================================
//= AnnieRuru
//===== Current Version: =====================================
//= 1.2
//===== Compatible With: =====================================
//= Hercules 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 plugin for this popular script
//============================================================
 
#include "common/hercules.h"
#include "map/pc.h"
#include "map/mob.h"
#include "map/mapreg.h"
#include "map/battle.h"
#include "plugins/HPMHooking.h"
#include "common/HPMDataCheck.h"
 
HPExport struct hplugin_info pinfo = {
        "koe",
        SERVER_TYPE_MAP,
        "1.2",
        HPM_VERSION,
};
 
int battle_check_target_post( int retVal, struct block_list *src, struct block_list *target, int flag ) {
        if ( retVal == 1 ) {
                struct block_list *s_bl = src;
                if( (s_bl = battle->get_master(src)) == NULL )
                        s_bl = src;
                if ( s_bl->type == BL_PC && target->type == BL_MOB ) {
                        TBL_PC *sd = BL_CAST( BL_PC, s_bl );
                        TBL_MOB *md = BL_CAST( BL_MOB, target );
                        if ( ( md->class_ == MOBID_EMPELIUM && !strcmp( mapindex_id2name(sd->mapindex), "guild_vs1" ) ) &&
                                ( sd->status.guild_id == mapreg->readreg( script->add_str("$koegid") ) || battle->get_current_skill(src) > 0 ) )
                                return 0;
                }
        }
        return retVal;
}
 
HPExport void plugin_init (void) {
        addHookPost( battle, check_target, battle_check_target_post );
}
Viewed 313 times, submitted by AnnieRuru.