From c47d8e4b8f9d63ab6b4e7e286e91cd50a5bdd151 Mon Sep 17 00:00:00 2001 From: sevenzz23 Date: Thu, 31 Oct 2013 12:07:06 +0700 Subject: No error after compilation, but when logging in at map server it will crash. Im pretty sure its on the clif.c Signed-off-by: sevenzz23 --- src/map/guild.c | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) (limited to 'src/map/guild.c') diff --git a/src/map/guild.c b/src/map/guild.c index 0ae45bede..517a49cc4 100644 --- a/src/map/guild.c +++ b/src/map/guild.c @@ -865,6 +865,11 @@ int guild_member_withdraw(int guild_id, int account_id, int char_id, int flag, c online_member_sd = guild->getavailablesd(g); if(online_member_sd == NULL) return 0; // noone online to inform + +#ifdef BOUND_ITEMS + //Guild bound item check + guild->retrieveitembound(char_id,account_id,guild_id); +#endif if(!flag) clif->guild_leave(online_member_sd, name, mes); @@ -899,6 +904,41 @@ int guild_member_withdraw(int guild_id, int account_id, int char_id, int flag, c return 0; } +#ifdef BOUND_ITEMS +void guild_retrieveitembound(int char_id,int aid,int guild_id) +{ + TBL_PC *sd = map->id2sd(aid); + if(sd){ //Character is online + int idxlist[MAX_INVENTORY]; + int j,i; + j = pc->bound_chk(sd,2,idxlist); + if(j) { + struct guild_storage *gstor = gstorage->id2storage(guild_id); + for(i=0;iadditem(sd,gstor,&sd->status.inventory[idxlist[i]],sd->status.inventory[idxlist[i]].amount); + pc->delitem(sd,idxlist[i],sd->status.inventory[idxlist[i]].amount,0,4,LOG_TYPE_GSTORAGE); + } + gstorage->close(sd); //Close and save the storage + } + } + else { //Character is offline, ask char server to do the job + struct guild_storage *gstor = gstorage->id2storage2(guild_id); + if(gstor && gstor->storage_status == 1) { //Someone is in guild storage, close them + struct s_mapiterator* iter = mapit_getallusers(); + for( sd = (TBL_PC*)mapit->first(iter); mapit->exists(iter); sd = (TBL_PC*)mapit->next(iter) ) { + if(sd->status.guild_id == guild_id && sd->state.storage_flag == 2) { + gstorage->close(sd); + break; + } + } + mapit->free(iter); + } + intif->itembound_req(char_id,aid,guild_id); + } +} +#endif + int guild_send_memberinfoshort(struct map_session_data *sd,int online) { // cleaned up [LuzZza] struct guild *g; @@ -1813,6 +1853,11 @@ int guild_break(struct map_session_data *sd,char *name) { struct guild *g; struct unit_data *ud; int i; + +#ifdef BOUND_ITEMS + int j; + int idxlist[MAX_INVENTORY]; +#endif nullpo_ret(sd); @@ -1855,6 +1900,13 @@ int guild_break(struct map_session_data *sd,char *name) { skill->del_unitgroup(groups[i],ALC_MARK); } } + +#ifdef BOUND_ITEMS + //Guild bound item check - Removes the bound flag + j = pc->bound_chk(sd,2,idxlist); + for(i=0;istatus.inventory[idxlist[i]].bound = 0; +#endif intif->guild_break(g->guild_id); return 1; -- cgit v1.2.3-60-g2f50