summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/common/conf.c3
-rw-r--r--src/map/atcommand.c18
-rw-r--r--src/map/clif.c6
-rw-r--r--src/map/guild.c2
-rw-r--r--src/map/itemdb.c3
-rw-r--r--src/map/mob.c59
-rw-r--r--src/map/party.c3
-rw-r--r--src/map/pc.c8
-rw-r--r--src/map/pc.h1
9 files changed, 66 insertions, 37 deletions
diff --git a/src/common/conf.c b/src/common/conf.c
index a6329d70e..813069ac4 100644
--- a/src/common/conf.c
+++ b/src/common/conf.c
@@ -83,6 +83,9 @@ void config_setting_copy_aggregate(config_setting_t *parent, const config_settin
config_setting_t *newAgg;
int i, n;
+ if( config_setting_get_member(parent, config_setting_name(src)) != NULL )
+ return;
+
newAgg = config_setting_add(parent, config_setting_name(src), config_setting_type(src));
if (newAgg == NULL)
diff --git a/src/map/atcommand.c b/src/map/atcommand.c
index c355f6bbd..3976c8427 100644
--- a/src/map/atcommand.c
+++ b/src/map/atcommand.c
@@ -6812,8 +6812,10 @@ ACMD(makehomun) {
homunid = atoi(message);
- if( homunid == -1 && sd->status.hom_id && !homun_alive(sd->hd) ) {
- if( sd->hd->homunculus.vaporize )
+ if( homunid == -1 && sd->status.hom_id && !(sd->hd && homun_alive(sd->hd)) ) {
+ if( !sd->hd )
+ homun->call(sd);
+ else if( sd->hd->homunculus.vaporize )
homun->ressurect(sd, 100, sd->bl.x, sd->bl.y);
else
homun->call(sd);
@@ -8615,7 +8617,7 @@ ACMD(cart) {
}
/* [Ind/Hercules] */
ACMD(join) {
- struct hChSysCh *channel;
+ struct hChSysCh *channel = NULL;
char name[HCHSYS_NAME_LENGTH], pass[HCHSYS_NAME_LENGTH];
if( !message || !*message || sscanf(message, "%s %s", name, pass) < 1 ) {
@@ -8626,7 +8628,8 @@ ACMD(join) {
if( hChSys.local && strcmpi(name + 1, hChSys.local_name) == 0 ) {
if( !map->list[sd->bl.m].channel ) {
clif->chsys_mjoin(sd);
- return true;
+ if( map->list[sd->bl.m].channel ) /* mjoin might have refused, map has chatting capabilities disabled */
+ return true;
} else
channel = map->list[sd->bl.m].channel;
} else if( hChSys.ally && sd->status.guild_id && strcmpi(name + 1, hChSys.ally_name) == 0 ) {
@@ -8639,6 +8642,13 @@ ACMD(join) {
return false;
}
+ if( !channel ) {
+ sprintf(atcmd_output, msg_txt(1400),name,command); // Unknown Channel '%s' (usage: %s <#channel_name>)
+ clif->message(fd, atcmd_output);
+ return false;
+ }
+
+
if( idb_exists(channel->users, sd->status.char_id) ) {
sprintf(atcmd_output, msg_txt(1475),name); // You're already in the '%s' channel
clif->message(fd, atcmd_output);
diff --git a/src/map/clif.c b/src/map/clif.c
index a383617b5..2257df0aa 100644
--- a/src/map/clif.c
+++ b/src/map/clif.c
@@ -9164,6 +9164,10 @@ void clif_parse_WantToConnection(int fd, struct map_session_data* sd) {
}
void clif_hercules_chsys_mjoin(struct map_session_data *sd) {
if( !map->list[sd->bl.m].channel ) {
+
+ if (map->list[sd->bl.m].flag.chsysnolocalaj || (map->list[sd->bl.m].instance_id >= 0 && instance->list[map->list[sd->bl.m].instance_id].owner_type != IOT_NONE) )
+ return;
+
CREATE(map->list[sd->bl.m].channel, struct hChSysCh , 1);
safestrncpy(map->list[sd->bl.m].channel->name, hChSys.local_name, HCHSYS_NAME_LENGTH);
map->list[sd->bl.m].channel->type = hChSys_MAP;
@@ -9453,7 +9457,7 @@ void clif_parse_LoadEndAck(int fd,struct map_session_data *sd) {
status_calc_pc(sd, SCO_NONE);/* some conditions are map-dependent so we must recalculate */
sd->state.changemap = false;
- if( hChSys.local && hChSys.local_autojoin && !map->list[sd->bl.m].flag.chsysnolocalaj ) {
+ if( hChSys.local && hChSys.local_autojoin ) {
clif->chsys_mjoin(sd);
}
}
diff --git a/src/map/guild.c b/src/map/guild.c
index cba568bd8..cca4da6cf 100644
--- a/src/map/guild.c
+++ b/src/map/guild.c
@@ -1756,6 +1756,8 @@ int guild_broken(int guild_id,int flag)
clif->chsys_delete(( struct hChSysCh * )g->channel);
}
}
+ if( g->instance )
+ aFree(g->instance);
idb_remove(guild->db,guild_id);
return 0;
}
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 1e197756e..16c33b552 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/party.c b/src/map/party.c
index 0a7467162..8e3ac3dcf 100644
--- a/src/map/party.c
+++ b/src/map/party.c
@@ -589,6 +589,9 @@ int party_broken(int party_id)
}
}
+ if( p->instance )
+ aFree(p->instance);
+
idb_remove(party->db,party_id);
return 0;
}
diff --git a/src/map/pc.c b/src/map/pc.c
index 57433ea0d..feca11758 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;
@@ -9063,7 +9066,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;
@@ -9091,7 +9094,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++ ) {
@@ -9104,6 +9107,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;