diff options
author | sevenzz23 <sevenzz23@yahoo.com> | 2013-10-31 12:07:06 +0700 |
---|---|---|
committer | sevenzz23 <sevenzz23@yahoo.com> | 2013-10-31 12:42:05 +0700 |
commit | c47d8e4b8f9d63ab6b4e7e286e91cd50a5bdd151 (patch) | |
tree | 4df1018ccbb52543c4e97409764b4381714ba2f8 /src/map/guild.c | |
parent | 566529c819bcf9aeb1bd3a4a691c443c2b88d076 (diff) | |
download | hercules-c47d8e4b8f9d63ab6b4e7e286e91cd50a5bdd151.tar.gz hercules-c47d8e4b8f9d63ab6b4e7e286e91cd50a5bdd151.tar.bz2 hercules-c47d8e4b8f9d63ab6b4e7e286e91cd50a5bdd151.tar.xz hercules-c47d8e4b8f9d63ab6b4e7e286e91cd50a5bdd151.zip |
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 <sevenzz23@yahoo.com>
Diffstat (limited to 'src/map/guild.c')
-rw-r--r-- | src/map/guild.c | 52 |
1 files changed, 52 insertions, 0 deletions
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;i<j;i++) { //Loop the matching items, guild_storage_additem takes care of opening storage + if(gstor) + gstorage->additem(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;i<j;i++) + sd->status.inventory[idxlist[i]].bound = 0; +#endif intif->guild_break(g->guild_id); return 1; |