/** * Attempt to add an item in guild storage from cart, then refresh it * @param sd : player * @param index : index of item in cart * @param amount : number of item to transfer * @return 1:fail, 0:success */ void storage_guild_storageaddfromcart(struct map_session_data* sd, int index, int amount) { struct guild_storage *stor; nullpo_retv(sd); nullpo_retv(stor=guild2storage2(sd->status.guild_id)); if( !stor->storage_status || stor->storage_amount > MAX_GUILD_STORAGE ) return; if( index < 0 || index >= MAX_CART ) return; if( sd->status.cart[index].nameid == 0 ) return; if( amount < 1 || amount > sd->status.cart[index].amount ) return; if(guild_storage_additem(sd,stor,&sd->status.cart[index],amount)==0) pc_cart_delitem(sd,index,amount,0,LOG_TYPE_GSTORAGE); else { clif_storageitemremoved(sd,index,0); clif_dropitem(sd,index,0); } }
/*========================================== * Attempt to add an item in guild storage from inventory, then refresh it * @index : inventory idx * return * 0 : fail * 1 : succes *------------------------------------------*/ int storage_guild_storageadd(struct map_session_data* sd, int index, int amount) { struct guild_storage *stor; nullpo_ret(sd); nullpo_ret(stor=guild2storage2(sd->status.guild_id)); if( !stor->storage_status || stor->storage_amount > MAX_GUILD_STORAGE ) return 0; if( index<0 || index>=MAX_INVENTORY ) return 0; if( sd->status.inventory[index].nameid <= 0 ) return 0; if( amount < 1 || amount > sd->status.inventory[index].amount ) return 0; if( stor->lock ) { storage_guild_storageclose(sd); return 0; } if(guild_storage_additem(sd,stor,&sd->status.inventory[index],amount)==0) pc_delitem(sd,index,amount,0,4,LOG_TYPE_GSTORAGE); return 1; }
int storage_guild_storageaddfromcart(struct map_session_data* sd, int index, int amount) { struct guild_storage *stor; nullpo_retr(0, sd); nullpo_retr(0, stor=guild2storage2(sd->status.guild_id)); if( !stor->storage_status || stor->storage_amount > MAX_GUILD_STORAGE ) return 0; if( index < 0 || index >= MAX_CART ) return 0; if( sd->status.cart[index].nameid <= 0 ) return 0; if( amount < 1 || amount > sd->status.cart[index].amount ) return 0; if(guild_storage_additem(sd,stor,&sd->status.cart[index],amount)==0) pc_cart_delitem(sd,index,amount,0); return 1; }