viewing paste Unknown #6069 | Plain text

Posted on the
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
/*==========================================
 * Player request leaving a given guild_id
 *----------------------------------------*/
int guild_leave(struct map_session_data* sd, int guild_id, int account_id, int char_id, const char* mes)
{
        struct guild *g;
        int i, j=0;
        int list[MAX_INVENTORY];
 
        nullpo_ret(sd);
 
        g = sd->guild;
 
        if(g==NULL)
                return 0;
 
        if(sd->status.account_id!=account_id ||
                sd->status.char_id!=char_id || sd->status.guild_id!=guild_id ||
                ((agit_flag || agit2_flag) && map[sd->bl.m].flag.gvg_castle))
                return 0;
 
        //Guild bound item check
        for(i=0;i<MAX_INVENTORY;i++){
                if(sd->status.inventory[i].nameid > 0 && sd->status.inventory[i].amount > 0 && sd->status.inventory[i].bound == 2) {
                        list[j] = i;
                        j++;
                }
        }
        if(j) {
                struct guild_storage* stor = guild2storage(sd->status.guild_id);
                for(i=0;i<j;i++) {
                        guild_storage_additem(sd,stor,&sd->status.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;
}
Viewed 283 times, submitted by unknown.