|
@@ -860,6 +860,9 @@ int guild_member_withdraw(int guild_id, int account_id, int char_id, int flag, c
|
|
|
if(online_member_sd == NULL)
|
|
|
return 0; // noone online to inform
|
|
|
|
|
|
+ //Guild bound item check
|
|
|
+ guild_retrieveitembound(char_id,account_id,guild_id);
|
|
|
+
|
|
|
if(!flag)
|
|
|
clif_guild_leave(online_member_sd, name, mes);
|
|
|
else
|
|
@@ -887,6 +890,39 @@ int guild_member_withdraw(int guild_id, int account_id, int char_id, int flag, c
|
|
|
return 0;
|
|
|
}
|
|
|
|
|
|
+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* stor = guild2storage(sd->status.guild_id);
|
|
|
+ for(i=0;i<j;i++) { //Loop the matching items, guild_storage_additem takes care of opening storage
|
|
|
+ if(stor)
|
|
|
+ guild_storage_additem(sd,stor,&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);
|
|
|
+ }
|
|
|
+ storage_guild_storageclose(sd); //Close and save the storage
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else { //Character is offline, ask char server to do the job
|
|
|
+ struct guild_storage* stor = guild2storage2(guild_id);
|
|
|
+ if(stor && stor->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) {
|
|
|
+ storage_guild_storageclose(sd);
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ mapit_free(iter);
|
|
|
+ }
|
|
|
+ intif_itembound_req(char_id,aid,guild_id);
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
int guild_send_memberinfoshort(struct map_session_data *sd,int online)
|
|
|
{ // cleaned up [LuzZza]
|
|
|
struct guild *g;
|
|
@@ -1696,7 +1732,8 @@ int guild_broken(int guild_id,int flag)
|
|
|
{
|
|
|
struct guild *g = guild_search(guild_id);
|
|
|
struct map_session_data *sd = NULL;
|
|
|
- int i;
|
|
|
+ int i, j;
|
|
|
+ int idxlist[MAX_INVENTORY];
|
|
|
|
|
|
if(flag!=0 || g==NULL)
|
|
|
return 0;
|
|
@@ -1712,6 +1749,11 @@ int guild_broken(int guild_id,int flag)
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ //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;
|
|
|
+
|
|
|
guild_db->foreach(guild_db,guild_broken_sub,guild_id);
|
|
|
castle_db->foreach(castle_db,castle_guild_broken_sub,guild_id);
|
|
|
guild_storage_delete(guild_id);
|