--- Base (BASE) +++ Locally Modified (Based On LOCAL) @@ -792,9 +792,29 @@ /*========================================== * Player request leaving a given guild_id *----------------------------------------*/ + +int itemdb_guildbound_chk(TBL_PC *sd,int type,int *idxlist){ + int i=0, j=0; + switch(type){ + case 1: //cehck in inventory + for(i=0;istatus.inventory[i].nameid > 0 && sd->status.inventory[i].amount > 0 && sd->status.inventory[i].bound == 2) { + idxlist[j] = i; + j++; + } + } + break; + case 2: //check in cart + case 3: //check in storage + break; + } + return j; +} + int guild_leave(struct map_session_data* sd, int guild_id, int account_id, int char_id, const char* mes) { struct guild *g; + int idxlist[MAX_INVENTORY]; //or malloc to reduce consumtion nullpo_ret(sd); @@ -808,10 +828,23 @@ ((agit_flag || agit2_flag) && map[sd->bl.m].flag.gvg_castle)) return 0; + //Guild bound item check + j = itemdb_guildbound_chk(sd,1,idxlist); + if(j) { + struct guild_storage* stor = guild2storage(sd->status.guild_id); + for(i=0;istatus.inventory[list[i]],sd->status.inventory[list[i]].amount); + pc_delitem(sd,list[i],sd->status.inventory[list[i]].amount,0,4,LOG_TYPE_GSTORAGE); + } + storage_guild_storageclose(sd); + } + intif_guild_leave(sd->status.guild_id, sd->status.account_id, sd->status.char_id,0,mes); return 0; }