Ejemplo n.º 1
0
/*==========================================
 * Opens a storage. Returns:
 * 0 - success
 * 1 - fail
 * 2 - Storage requested from char-server (will open automatically later)
 *------------------------------------------
 */
int storage_storageopen(struct map_session_data *sd)
{
	struct storage *stor;
	nullpo_retr(0, sd);

	if(sd->state.finalsave) //Refuse to open storage when you had your last save done.
		return 1;

	if(sd->state.storage_flag)
		return 1; //Already open?
	
	if(pc_can_give_items(pc_isGM(sd)))
  	{ //check is this GM level is allowed to put items to storage
		clif_displaymessage(sd->fd, msg_txt(246));
		return 1;
	}
	
	if((stor = idb_get(storage_db,sd->status.account_id)) == NULL)
  	{	//Request storage.
		intif_request_storage(sd->status.account_id);
		return 2;
	}
  
	if (stor->storage_status)
  		return 1; //Already open/player already has it open...

	stor->storage_status = 1;
	sd->state.storage_flag = 1;
	clif_storagelist(sd,stor);
	clif_updatestorageamount(sd,stor);
	return 0;
}
Ejemplo n.º 2
0
/*==========================================
* Attempt to open guild storage for sd
* return
* 	0 : success (open or req to create a new one)
* 	1 : fail
*	2 : no guild for sd
 *------------------------------------------*/
int storage_guild_storageopen(struct map_session_data* sd)
{
	struct guild_storage *gstor;

	nullpo_ret(sd);

	if(sd->status.guild_id <= 0)
		return 2;

	if(sd->state.storage_flag)
		return 1; //Can't open both storages at a time.

	if( !pc_can_give_items(sd) ) { //check is this GM level can open guild storage and store items [Lupus]
		clif_displaymessage(sd->fd, msg_txt(sd,246));
		return 1;
	}

	if((gstor = guild2storage2(sd->status.guild_id)) == NULL) {
		intif_request_guild_storage(sd->status.account_id,sd->status.guild_id);
		return 0;
	}
	if(gstor->storage_status)
		return 1;

	if( gstor->lock )
		return 1;

	gstor->storage_status = 1;
	sd->state.storage_flag = 2;
	storage_sortitem(gstor->items, ARRAYLENGTH(gstor->items));
	clif_storagelist(sd, gstor->items, ARRAYLENGTH(gstor->items));
	clif_updatestorageamount(sd, gstor->storage_amount, MAX_GUILD_STORAGE);
	return 0;
}
Ejemplo n.º 3
0
/**
 * Open premium storage
 * @param sd Player
 **/
void storage_premiumStorage_open(struct map_session_data *sd) {
	nullpo_retv(sd);

	if (!&sd->premiumStorage)
		return;

	sd->state.storage_flag = 3;
	storage_sortitem(sd->premiumStorage.u.items_storage, sd->premiumStorage.max_amount);
	clif_storagelist(sd, sd->premiumStorage.u.items_storage, sd->premiumStorage.max_amount, storage_getName(sd->premiumStorage.stor_id));
	clif_updatestorageamount(sd, sd->premiumStorage.amount, sd->premiumStorage.max_amount);
}
Ejemplo n.º 4
0
/*==========================================
 * Opens a storage. Returns:
 * 0 - success
 * 1 - fail
 *------------------------------------------*/
int storage_storageopen(struct map_session_data *sd)
{
	nullpo_retr(0, sd);

	if(sd->state.storage_flag)
		return 1; //Already open?
	
	if( !pc_can_give_items(pc_isGM(sd)) )
  	{ //check is this GM level is allowed to put items to storage
		clif_displaymessage(sd->fd, msg_txt(246));
		return 1;
	}
	
	sd->state.storage_flag = 1;
	clif_storagelist(sd,&sd->status.storage);
	clif_updatestorageamount(sd,sd->status.storage.storage_amount);
	return 0;
}
Ejemplo n.º 5
0
/**
 * Player attempt tp open his storage.
 * @param sd : player
 * @return 0 : success, 1 : fail
 */
int storage_storageopen(struct map_session_data *sd)
{
	nullpo_ret(sd);

	if (sd->state.storage_flag)
		return 1; //Already open?

	if (!pc_can_give_items(sd)) { //Check is this GM level is allowed to put items to storage
		clif_displaymessage(sd->fd, msg_txt(246));
		return 1;
	}

	sd->state.storage_flag = 1;
	storage_sortitem(sd->status.storage.items, ARRAYLENGTH(sd->status.storage.items));
	clif_storagelist(sd, sd->status.storage.items, ARRAYLENGTH(sd->status.storage.items));
	clif_updatestorageamount(sd, sd->status.storage.storage_amount, sd->storage_size);
	return 0;
}
Ejemplo n.º 6
0
int ext_storage_open(struct map_session_data *sd)
{
	nullpo_ret(sd);

	if(sd->state.storage_flag)
		return 1;

	if( !pc_can_give_items(pc_isGM(sd)) )
  	{ //check is this GM level is allowed to put items to storage
		clif_displaymessage(sd->fd, msg_txt(246));
		return 1;
	}

	sd->state.storage_flag = 3;
	storage_sortitem(sd->status.ext_storage.items, ARRAYLENGTH(sd->status.ext_storage.items));
	clif_storagelist(sd, sd->status.ext_storage.items, ARRAYLENGTH(sd->status.ext_storage.items));
	clif_updateextrastorageamount(sd,sd->status.ext_storage.storage_amount);
	return 0;
}
Ejemplo n.º 7
0
/**
 * Player attempt tp open his storage.
 * @param sd : player
 * @return  0:success, 1:fail
 */
int storage_storageopen(struct map_session_data *sd)
{
	nullpo_ret(sd);

	if(sd->state.storage_flag)
		return 1; //Already open?

	if( !pc_can_give_items(sd) ) { // check is this GM level is allowed to put items to storage
		clif_displaymessage(sd->fd, msg_txt(sd,246));
		return 1;
	}

	sd->state.storage_flag = 1;
	storage_sortitem(sd->storage.u.items_storage, sd->storage.max_amount);
	clif_storagelist(sd, sd->storage.u.items_storage, sd->storage.max_amount, storage_getName(0));
	clif_updatestorageamount(sd, sd->storage.amount, sd->storage.max_amount);

	return 0;
}