Exemplo n.º 1
0
/**
 * 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 transfert
 * @return 1:fail, 0:success
 */
void storage_guild_storagegettocart(struct map_session_data* sd, int index, int amount)
{
	short flag;
	struct guild_storage *stor;

	nullpo_retv(sd);
	nullpo_retv(stor=guild2storage2(sd->status.guild_id));

	if(!stor->storage_status)
	  	return;

	if(index < 0 || index >= MAX_GUILD_STORAGE)
	  	return;

	if(stor->items[index].nameid == 0)
		return;

	if(amount < 1 || amount > stor->items[index].amount)
		return;

	if((flag = pc_cart_additem(sd,&stor->items[index],amount,LOG_TYPE_GSTORAGE)) == 0)
		guild_storage_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);
	}
}
Exemplo n.º 2
0
/*==========================================
 * Get from Storage to the Cart inventory
 * @index : storage index
 * return
 *	0 : fail
 *	1 : success
 *------------------------------------------*/
int storage_storagegettocart(struct map_session_data* sd, int index, int amount)
{
	nullpo_ret(sd);

	if( index < 0 || index >= MAX_STORAGE )
		return 0;

	if( sd->status.storage.items[index].nameid <= 0 )
		return 0; //Nothing there.

	if( amount < 1 || amount > sd->status.storage.items[index].amount )
		return 0;

	if( pc_cart_additem(sd,&sd->status.storage.items[index],amount,LOG_TYPE_STORAGE) == 0 )
		storage_delitem(sd,index,amount);

	return 1;
}
Exemplo n.º 3
0
/**
 * Get from Storage to the Cart inventory
 * @param sd : player
 * @param stor : Storage data
 * @param index : storage index to take the item from
 * @param amount : number of item to take
 * @return 0:fail, 1:success
 */
void storage_storagegettocart(struct map_session_data* sd, struct s_storage *stor, int index, int amount)
{
	unsigned char flag = 0;
	enum e_storage_add result;

	nullpo_retv(sd);

	result = storage_canGetItem(stor, index, amount);
	if (result != STORAGE_ADD_OK)
		return;

	if ((flag = pc_cart_additem(sd,&stor->u.items_storage[index],amount,LOG_TYPE_STORAGE)) == 0)
		storage_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);
	}
}
Exemplo n.º 4
0
/**
 * Get from Storage to the Cart inventory
 * @param sd : player
 * @param index : storage index to take the item from
 * @param amount : number of item to take
 * @return 0:fail, 1:success
 */
void storage_storagegettocart(struct map_session_data* sd, int index, int amount)
{
	unsigned char flag;
	nullpo_retv(sd);

	if( index < 0 || index >= sd->storage_size )
		return;

	if( sd->status.storage.items[index].nameid <= 0 )
		return; //Nothing there.

	if( amount < 1 || amount > sd->status.storage.items[index].amount )
		return;

	if( (flag = pc_cart_additem(sd,&sd->status.storage.items[index],amount,LOG_TYPE_STORAGE)) == 0 )
		storage_delitem(sd,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);
	}
}
Exemplo n.º 5
0
/*==========================================
 * カプラ倉庫からカートへ出す
 *------------------------------------------
 */
void storage_storagegettocart(struct map_session_data *sd, int idx, int amount)
{
	struct storage *stor;

	nullpo_retv(sd);
	nullpo_retv(stor = (struct storage *)numdb_search(storage_db,sd->status.account_id));

	if(!stor->storage_status)
		return;
	if(idx < 0 || idx >= MAX_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_delitem(sd, stor, idx, amount);

	return;
}
Exemplo n.º 6
0
/*==========================================
* Attempt to retrieve an item from guild storage to cart, then refresh it
* @index : storage idx
* return
* 	0 : fail
* 	1 : succes
 *------------------------------------------*/
int storage_guild_storagegettocart(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)
	  	return 0;

	if(index<0 || index>=MAX_GUILD_STORAGE)
	  	return 0;

	if(stor->items[index].nameid<=0)
		return 0;

	if(amount < 1 || amount > stor->items[index].amount)
		return 0;

	if(pc_cart_additem(sd,&stor->items[index],amount,LOG_TYPE_GSTORAGE)==0)
		guild_storage_delitem(sd,stor,index,amount);

	return 1;
}
Exemplo n.º 7
0
/*==========================================
 * Get from Storage to the Cart
 *------------------------------------------
 */
int storage_storagegettocart(struct map_session_data *sd,int index,int amount)
{
	struct storage *stor;

	nullpo_retr(0, sd);
	nullpo_retr(0, stor=account2storage2(sd->status.account_id));

	if(!stor->storage_status)
		return 0;
 
	if(index< 0 || index>=MAX_STORAGE)
		return 0;
	
	if(stor->storage_[index].nameid <= 0)
		return 0; //Nothing there.
	
	if(amount < 1 || amount > stor->storage_[index].amount)
		return 0;
	
	if(pc_cart_additem(sd,&stor->storage_[index],amount)==0)
		storage_delitem(sd,stor,index,amount);

	return 1;
}