viewing paste topic/11141- koe_char | C

Posted on the
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
#include "common/hercules.h"
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include "map/pc.h"
#include "map/mob.h"
#include "map/battle.h"
#include "map/mapreg.h"
#include "common/memmgr.h"
#include "common/HPMDataCheck.h"
 
HPExport struct hplugin_info pinfo = {
    "koe_char", // Plugin name
    SERVER_TYPE_MAP,// Which server types this plugin works with?
    "0.1",          // Plugin version
    HPM_VERSION,    // HPM Version (don't change, macro is automatically updated)
};
 
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_EMPERIUM || md->class_ == MOBID_BARRICADE2 ) && !strcmp( mapindex_id2name(sd->mapindex), "ordeal_1-1" ) ) &&
                ( sd->status.account_id == mapreg->readreg( script->add_str("$koeaid") ) || battle->get_current_skill(src) > 0 ) )
                return 0;
        }
    }
    return retVal;
}
 
HPExport void plugin_init (void) {
    addHookPost( "battle->check_target", battle_check_target_post );
}
Viewed 1344 times, submitted by AnnieRuru.