summaryrefslogtreecommitdiff
path: root/src/map
diff options
context:
space:
mode:
Diffstat (limited to 'src/map')
-rw-r--r--src/map/itemdb.c3
-rw-r--r--src/map/mob.c59
-rw-r--r--src/map/pc.c8
-rw-r--r--src/map/pc.h1
4 files changed, 39 insertions, 32 deletions
diff --git a/src/map/itemdb.c b/src/map/itemdb.c
index 9c3ff4138..dc4559483 100644
--- a/src/map/itemdb.c
+++ b/src/map/itemdb.c
@@ -2208,6 +2208,9 @@ void itemdb_reload(void) {
iter = mapit_geteachpc();
for( sd = (struct map_session_data*)mapit->first(iter); mapit->exists(iter); sd = (struct map_session_data*)mapit->next(iter) ) {
memset(sd->item_delay, 0, sizeof(sd->item_delay)); // reset item delays
+ if( battle_config.item_check )
+ sd->state.itemcheck = 1;
+ pc->checkitem(sd);
pc->setinventorydata(sd);
/* clear combo bonuses */
if( sd->combos.count ) {
diff --git a/src/map/mob.c b/src/map/mob.c
index 777518d87..02c263bd3 100644
--- a/src/map/mob.c
+++ b/src/map/mob.c
@@ -1046,7 +1046,7 @@ int mob_ai_sub_hard_activesearch(struct block_list *bl,va_list ap)
mode= va_arg(ap,int);
//If can't seek yet, not an enemy, or you can't attack it, skip.
- if ((*target) == bl || !status->check_skilluse(&md->bl, bl, 0, 0))
+ if (md->bl.id == bl->id || (*target) == bl || !status->check_skilluse(&md->bl, bl, 0, 0))
return 0;
if ((mode&MD_TARGETWEAK) && status->get_lv(bl) >= md->level-5)
@@ -1055,39 +1055,38 @@ int mob_ai_sub_hard_activesearch(struct block_list *bl,va_list ap)
if(battle->check_target(&md->bl,bl,BCT_ENEMY)<=0)
return 0;
- switch (bl->type)
- {
- case BL_PC:
- if (((TBL_PC*)bl)->state.gangsterparadise &&
- !(status_get_mode(&md->bl)&MD_BOSS))
- return 0; //Gangster paradise protection.
- default:
- if (battle_config.hom_setting&0x4 &&
- (*target) && (*target)->type == BL_HOM && bl->type != BL_HOM)
- return 0; //For some reason Homun targets are never overriden.
+ switch (bl->type) {
+ case BL_PC:
+ if (((TBL_PC*)bl)->state.gangsterparadise &&
+ !(status_get_mode(&md->bl)&MD_BOSS))
+ return 0; //Gangster paradise protection.
+ default:
+ if (battle_config.hom_setting&0x4 &&
+ (*target) && (*target)->type == BL_HOM && bl->type != BL_HOM)
+ return 0; //For some reason Homun targets are never overriden.
- dist = distance_bl(&md->bl, bl);
- if(
- ((*target) == NULL || !check_distance_bl(&md->bl, *target, dist)) &&
- battle->check_range(&md->bl,bl,md->db->range2)
- ) { //Pick closest target?
+ dist = distance_bl(&md->bl, bl);
+ if(
+ ((*target) == NULL || !check_distance_bl(&md->bl, *target, dist)) &&
+ battle->check_range(&md->bl,bl,md->db->range2)
+ ) { //Pick closest target?
- if( map->list[bl->m].icewall_num &&
- !path->search_long(NULL,bl->m,md->bl.x,md->bl.y,bl->x,bl->y,CELL_CHKICEWALL) ) {
+ if( map->list[bl->m].icewall_num &&
+ !path->search_long(NULL,bl->m,md->bl.x,md->bl.y,bl->x,bl->y,CELL_CHKICEWALL) ) {
- if( !check_distance_bl(&md->bl, bl, status_get_range(&md->bl) ) )
- return 0;
+ if( !check_distance_bl(&md->bl, bl, status_get_range(&md->bl) ) )
+ return 0;
- }
+ }
- (*target) = bl;
- md->target_id=bl->id;
- md->min_chase= dist + md->db->range3;
- if(md->min_chase>MAX_MINCHASE)
- md->min_chase=MAX_MINCHASE;
- return 1;
- }
- break;
+ (*target) = bl;
+ md->target_id=bl->id;
+ md->min_chase= dist + md->db->range3;
+ if(md->min_chase>MAX_MINCHASE)
+ md->min_chase=MAX_MINCHASE;
+ return 1;
+ }
+ break;
}
return 0;
}
@@ -1104,7 +1103,7 @@ int mob_ai_sub_hard_changechase(struct block_list *bl,va_list ap) {
target= va_arg(ap,struct block_list**);
//If can't seek yet, not an enemy, or you can't attack it, skip.
- if( *target == bl
+ if( md->bl.id == bl->id || *target == bl
|| battle->check_target(&md->bl,bl,BCT_ENEMY) <= 0
|| !status->check_skilluse(&md->bl, bl, 0, 0)
)
diff --git a/src/map/pc.c b/src/map/pc.c
index b5fa9268e..84880c24d 100644
--- a/src/map/pc.c
+++ b/src/map/pc.c
@@ -1124,6 +1124,9 @@ bool pc_authok(struct map_session_data *sd, int login_id2, time_t expiration_tim
sd->delayed_damage = 0;
+ if( battle_config.item_check )
+ sd->state.itemcheck = 1;
+
// Event Timers
for( i = 0; i < MAX_EVENTTIMER; i++ )
sd->eventtimer[i] = INVALID_TIMER;
@@ -9060,7 +9063,7 @@ int pc_checkitem(struct map_session_data *sd)
if( sd->state.vending ) //Avoid reorganizing items when we are vending, as that leads to exploits (pointed out by End of Exam)
return 0;
- if( battle_config.item_check ) { // check for invalid(ated) items
+ if( sd->state.itemcheck ) { // check for invalid(ated) items
for( i = 0; i < MAX_INVENTORY; i++ ) {
id = sd->status.inventory[i].nameid;
@@ -9088,7 +9091,7 @@ int pc_checkitem(struct map_session_data *sd)
}
}
- if (sd->state.gmaster_flag) {
+ if (sd->guild) {
struct guild_storage *guild_storage = gstorage->id2storage2(sd->guild->guild_id);
if (guild_storage) {
for( i = 0; i < MAX_GUILD_STORAGE; i++ ) {
@@ -9101,6 +9104,7 @@ int pc_checkitem(struct map_session_data *sd)
}
}
}
+ sd->state.itemcheck = 0;
}
for( i = 0; i < MAX_INVENTORY; i++) {
diff --git a/src/map/pc.h b/src/map/pc.h
index f10bd0f59..2c802a896 100644
--- a/src/map/pc.h
+++ b/src/map/pc.h
@@ -179,6 +179,7 @@ struct map_session_data {
unsigned int hold_recalc : 1;
unsigned int snovice_call_flag : 3; //Summon Angel (stage 1~3)
unsigned int hpmeter_visible : 1;
+ unsigned int itemcheck : 1;
} state;
struct {
unsigned char no_weapon_damage, no_magic_damage, no_misc_damage;