/** * Attempt to retrieve an item from guild storage to cart, then refresh it * @param sd : player * @param index : index of item in storage * @param amount : number of item to transfer * @return 1:fail, 0:success */ void storage_guild_storagegettocart(struct map_session_data* sd, int index, int amount) { short flag; struct s_storage *stor; nullpo_retv(sd); nullpo_retv(stor = guild2storage2(sd->status.guild_id)); if(!stor->status) return; if(index < 0 || index >= MAX_GUILD_STORAGE) return; if(stor->u.items_guild[index].nameid == 0) return; if(amount < 1 || amount > stor->u.items_guild[index].amount) return; if((flag = pc_cart_additem(sd,&stor->u.items_guild[index],amount,LOG_TYPE_GSTORAGE)) == 0) storage_guild_delitem(sd,stor,index,amount); else { clif_storageitemremoved(sd,index,0); clif_cart_additem_ack(sd,(flag == 1) ? ADDITEM_TO_CART_FAIL_WEIGHT:ADDITEM_TO_CART_FAIL_COUNT); } }
/** * Attempt to retrieve an item from guild storage to inventory, then refresh it * @param sd : player * @param index : index of item in storage * @param amount : number of item to get * @return 1:success, 0:fail */ void storage_guild_storageget(struct map_session_data* sd, int index, int amount) { struct s_storage *stor; unsigned char flag = 0; nullpo_retv(sd); nullpo_retv(stor = guild2storage2(sd->status.guild_id)); if(!stor->status) return; if(index < 0 || index >= MAX_GUILD_STORAGE) return; if(stor->u.items_guild[index].nameid == 0) return; if(amount < 1 || amount > stor->u.items_guild[index].amount) return; if( stor->lock ) { storage_guild_storageclose(sd); return; } if((flag = pc_additem(sd,&stor->u.items_guild[index],amount,LOG_TYPE_GSTORAGE)) == 0) storage_guild_delitem(sd,stor,index,amount); else { // inform fail clif_storageitemremoved(sd,index,0); clif_additem(sd,0,0,flag); } }
/*========================================== * ギルド倉庫からカートへ出す *------------------------------------------ */ void storage_guild_storagegettocart(struct map_session_data *sd, int idx, int amount) { struct guild_storage *stor; nullpo_retv(sd); if((stor = (struct guild_storage *)numdb_search(guild_storage_db,sd->status.guild_id)) == NULL) return; if(!stor->storage_status) return; if(idx < 0 || idx >= MAX_GUILD_STORAGE) return; if(itemdb_iscartable(stor->store_item[idx].nameid) == 0) // カートへ出せるかチェック return; if(amount < 1 || amount > stor->store_item[idx].amount) return; if(pc_cart_additem(sd, &stor->store_item[idx], amount) == 0) storage_guild_delitem(sd, stor, idx, amount); return; }
/*========================================== * ギルド倉庫から出す *------------------------------------------ */ void storage_guild_storageget(struct map_session_data *sd, int idx, int amount) { struct guild_storage *stor; int flag; nullpo_retv(sd); if((stor = (struct guild_storage *)numdb_search(guild_storage_db,sd->status.guild_id)) == NULL) return; if(!stor->storage_status) return; if(idx < 0 || idx >= MAX_GUILD_STORAGE) return; if(amount < 1 || amount > stor->store_item[idx].amount) return; if((flag = pc_additem(sd,&stor->store_item[idx],amount)) == 0) storage_guild_delitem(sd, stor, idx, amount); else clif_additem(sd,0,0,flag); return; }