#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 );
}