当前位置: 首页>>代码示例>>C++>>正文


C++ clif_additem函数代码示例

本文整理汇总了C++中clif_additem函数的典型用法代码示例。如果您正苦于以下问题:C++ clif_additem函数的具体用法?C++ clif_additem怎么用?C++ clif_additem使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了clif_additem函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: trade_tradecancel

/**
 * 'Cancel' is pressed. (or trade was force-cancelled by the code)
 * @param sd : Player that pressed the button
 */
void trade_tradecancel(struct map_session_data *sd)
{
	struct map_session_data *target_sd;
	int trade_i;

	nullpo_retv(sd);

	target_sd = map_id2sd(sd->trade_partner);
	sd->state.isBoundTrading = 0;

	if(!sd->state.trading) { // Not trade accepted
		if( target_sd ) {
			target_sd->trade_partner = 0;
			clif_tradecancelled(target_sd);
		}
		sd->trade_partner = 0;
		clif_tradecancelled(sd);
		return;
	}

	for(trade_i = 0; trade_i < 10; trade_i++) { // give items back (only virtual)
		if (!sd->deal.item[trade_i].amount)
			continue;

		clif_additem(sd, sd->deal.item[trade_i].index, sd->deal.item[trade_i].amount, 0);
		sd->deal.item[trade_i].index = 0;
		sd->deal.item[trade_i].amount = 0;
	}

	if (sd->deal.zeny) {
		clif_updatestatus(sd, SP_ZENY);
		sd->deal.zeny = 0;
	}

	sd->state.deal_locked = 0;
	sd->state.trading = 0;
	sd->trade_partner = 0;
	clif_tradecancelled(sd);

	if (!target_sd)
		return;

	for(trade_i = 0; trade_i < 10; trade_i++) { // give items back (only virtual)
		if (!target_sd->deal.item[trade_i].amount)
			continue;
		clif_additem(target_sd, target_sd->deal.item[trade_i].index, target_sd->deal.item[trade_i].amount, 0);
		target_sd->deal.item[trade_i].index = 0;
		target_sd->deal.item[trade_i].amount = 0;
	}

	if (target_sd->deal.zeny) {
		clif_updatestatus(target_sd, SP_ZENY);
		target_sd->deal.zeny = 0;
	}

	target_sd->state.deal_locked = 0;
	target_sd->trade_partner = 0;
	target_sd->state.trading = 0;
	clif_tradecancelled(target_sd);
}
开发者ID:snapdown,项目名称:meraserver,代码行数:64,代码来源:trade.c

示例2: trade_tradecancel

/*==========================================
 * 取引キャンセル
 *------------------------------------------
 */
void trade_tradecancel(dumb_ptr<map_session_data> sd)
{
    dumb_ptr<map_session_data> target_sd;
    int trade_i;

    nullpo_retv(sd);

    if ((target_sd = map_id2sd(account_to_block(sd->trade_partner))) != nullptr)
    {
        for (trade_i = 0; trade_i < TRADE_MAX; trade_i++)
        {                       //give items back (only virtual)
            if (sd->deal_item_amount[trade_i] != 0)
            {
                assert (sd->deal_item_index[trade_i].ok());
                clif_additem(sd,
                        sd->deal_item_index[trade_i].unshift(),
                        sd->deal_item_amount[trade_i],
                        PickupFail::OKAY);
                sd->deal_item_index[trade_i] = IOff2::from(0);
                sd->deal_item_amount[trade_i] = 0;
            }
            if (target_sd->deal_item_amount[trade_i] != 0)
            {
                assert (target_sd->deal_item_index[trade_i].ok());
                clif_additem(target_sd,
                        target_sd->deal_item_index[trade_i].unshift(),
                        target_sd->deal_item_amount[trade_i],
                        PickupFail::OKAY);
                target_sd->deal_item_index[trade_i] = IOff2::from(0);
                target_sd->deal_item_amount[trade_i] = 0;
            }
        }
        if (sd->deal_zeny)
        {
            sd->deal_zeny = 0;
            clif_updatestatus(sd, SP::ZENY);
        }
        if (target_sd->deal_zeny)
        {
            clif_updatestatus(target_sd, SP::ZENY);
            target_sd->deal_zeny = 0;
        }
        sd->deal_locked = 0;
        sd->trade_partner = AccountId();
        target_sd->deal_locked = 0;
        target_sd->trade_partner = AccountId();
        clif_tradecancelled(sd);
        clif_tradecancelled(target_sd);
    }
}
开发者ID:mrktj,项目名称:tmwa,代码行数:54,代码来源:trade.cpp

示例3: trade_tradecancel

/*==========================================
 * 取引キャンセル
 *------------------------------------------
 */
void trade_tradecancel(dumb_ptr<map_session_data> sd)
{
    dumb_ptr<map_session_data> target_sd;
    int trade_i;

    nullpo_retv(sd);

    if ((target_sd = map_id2sd(sd->trade_partner)) != NULL)
    {
        for (trade_i = 0; trade_i < 10; trade_i++)
        {                       //give items back (only virtual)
            if (sd->deal_item_amount[trade_i] != 0)
            {
                clif_additem(sd,
                        sd->deal_item_index[trade_i] - 2,
                        sd->deal_item_amount[trade_i],
                        PickupFail::OKAY);
                sd->deal_item_index[trade_i] = 0;
                sd->deal_item_amount[trade_i] = 0;
            }
            if (target_sd->deal_item_amount[trade_i] != 0)
            {
                clif_additem(target_sd,
                        target_sd->deal_item_index[trade_i] - 2,
                        target_sd->deal_item_amount[trade_i],
                        PickupFail::OKAY);
                target_sd->deal_item_index[trade_i] = 0;
                target_sd->deal_item_amount[trade_i] = 0;
            }
        }
        if (sd->deal_zeny)
        {
            sd->deal_zeny = 0;
            clif_updatestatus(sd, SP::ZENY);
        }
        if (target_sd->deal_zeny)
        {
            clif_updatestatus(target_sd, SP::ZENY);
            target_sd->deal_zeny = 0;
        }
        sd->deal_locked = 0;
        sd->trade_partner = 0;
        target_sd->deal_locked = 0;
        target_sd->trade_partner = 0;
        clif_tradecancelled(sd);
        clif_tradecancelled(target_sd);
    }
}
开发者ID:cinderweb,项目名称:tmwa,代码行数:52,代码来源:trade.cpp

示例4: storage_storageget

/*==========================================
 * カプラ倉庫から出す
 *------------------------------------------
 */
void storage_storageget(struct map_session_data *sd, int idx, int amount)
{
	struct storage *stor;
	int flag;

	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(amount < 1 || amount > stor->store_item[idx].amount)
		return;

	if((flag = pc_additem(sd, &stor->store_item[idx], amount)) == 0) {
		storage_delitem(sd, stor, idx, amount);
		return;
	}
	clif_storageitemremoved(sd,idx,amount);
	clif_additem(sd,0,0,flag);
	clif_storageitemadded(sd,stor,idx,amount);

	return;
}
开发者ID:Lilystar,项目名称:Auriga,代码行数:29,代码来源:storage.c

示例5: storage_guild_storageget

/**
 * 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 guild_storage *stor;
	unsigned char flag = 0;

	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( stor->lock ) {
		storage_guild_storageclose(sd);
		return;
	}

	if((flag = pc_additem(sd,&stor->items[index],amount,LOG_TYPE_GSTORAGE)) == 0)
		guild_storage_delitem(sd,stor,index,amount);
	else {//inform fail
		clif_storageitemremoved(sd,index,0);
		clif_additem(sd,0,0,flag);
	}
}
开发者ID:Escada28,项目名称:rathena,代码行数:39,代码来源:storage.c

示例6: pet_get_egg

int pet_get_egg(int account_id,int pet_id,int flag)
{	//This function is invoked when a new pet has been created, and at no other time!
	struct map_session_data *sd;
	struct item tmp_item;
	int i=0,ret=0;

	if(flag)
		return 0;

	sd = map_id2sd(account_id);
	if(sd == NULL)
		return 0;

	i = search_petDB_index(sd->catch_target_class,PET_CLASS);
	sd->catch_target_class = -1;

	if(i < 0) {
		intif_delete_petdata(pet_id);
		return 0;
	}

	memset(&tmp_item,0,sizeof(tmp_item));
	tmp_item.nameid = pet_db[i].EggID;
	tmp_item.identify = 1;
	tmp_item.card[0] = CARD0_PET;
	tmp_item.card[1] = GetWord(pet_id,0);
	tmp_item.card[2] = GetWord(pet_id,1);
	tmp_item.card[3] = 0; //New pets are not named.
	if((ret = pc_additem(sd,&tmp_item,1,LOG_TYPE_PICKDROP_PLAYER))) {
		clif_additem(sd,0,0,ret);
		map_addflooritem(&tmp_item,1,sd->bl.m,sd->bl.x,sd->bl.y,0,0,0,0);
	}

	return 1;
}
开发者ID:BlazingSpear,项目名称:rathena,代码行数:35,代码来源:pet.c

示例7: itemdb_pc_get_itemgroup_sub

/** [Cydh]
 * Gives item(s) to the player based on item group
 * @param sd: Player that obtains item from item group
 * @param group_id: The group ID of item that obtained by player
 * @param *group: struct s_item_group from itemgroup_db[group_id].random[idx] or itemgroup_db[group_id].must[sub_group][idx]
*/
static void itemdb_pc_get_itemgroup_sub(struct map_session_data *sd, uint16 group_id, struct s_item_group *group) {
	uint16 i;
	struct item tmp;

	nullpo_retv(group);

	memset(&tmp, 0, sizeof(tmp));

	tmp.nameid = group->nameid;
	tmp.amount = (itemdb_isstackable(group->nameid)) ? group->amount : 1;
	tmp.bound = group->bound;
	tmp.identify = 1;
	tmp.expire_time = (group->duration) ? (unsigned int)(time(NULL) + group->duration * 60) : 0;
	if (group->isNamed) {
		tmp.card[0] = itemdb_isequip(group->nameid) ? CARD0_FORGE : CARD0_CREATE;
		tmp.card[1] = 0;
		tmp.card[2] = GetWord(sd->status.char_id, 0);
		tmp.card[3] = GetWord(sd->status.char_id, 1);
	}
	//Do loop for non-stackable item
	for (i = 0; i < group->amount; i++) {
		int flag;

		if ((flag = pc_additem(sd,&tmp,tmp.amount,LOG_TYPE_SCRIPT)))
			clif_additem(sd,0,0,flag);
		else if (!flag && group->isAnnounced) {
			char output[CHAT_SIZE_MAX];

			sprintf(output, msg_txt(717), sd->status.name, itemdb_jname(group->nameid), itemdb_jname(sd->itemid));
			clif_broadcast(&sd->bl, output,strlen(output), 0, ALL_CLIENT);
		}
		if (itemdb_isstackable(group->nameid))
			break;
	}
}
开发者ID:icxbb-xx,项目名称:trunk,代码行数:41,代码来源:itemdb.c

示例8: storage_storageget

/*==========================================
 * Retrieve an item from the storage.
 *------------------------------------------
 */
int storage_storageget(struct map_session_data *sd,int index,int amount)
{
	struct storage *stor;
	int flag;

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

	
	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((flag = pc_additem(sd,&stor->storage_[index],amount)) == 0)
		storage_delitem(sd,stor,index,amount);
	else
		clif_additem(sd,0,0,flag);
//	log_fromstorage(sd, index, 0);
	return 1;
}
开发者ID:AxlSckay,项目名称:Ragnarok-OldTimes,代码行数:29,代码来源:storage.c

示例9: storage_guild_storageget

/*==========================================
* Attempt to retrieve an item from guild storage to inventory, then refresh it
* @index : storage idx
* return
* 	0 : fail
* 	1 : succes
 *------------------------------------------*/
int storage_guild_storageget(struct map_session_data* sd, int index, int amount)
{
	struct guild_storage *stor;
	int flag;

	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( stor->lock ) {
		storage_guild_storageclose(sd);
		return 0;
	}

	if((flag = pc_additem(sd,&stor->items[index],amount,LOG_TYPE_GSTORAGE)) == 0)
		guild_storage_delitem(sd,stor,index,amount);
	else //inform fail
		clif_additem(sd,0,0,flag);
//	log_fromstorage(sd, index, 1);

	return 0;
}
开发者ID:gigaguzel,项目名称:rAthena-1,代码行数:40,代码来源:storage.c

示例10: pet_return_egg

static int pet_return_egg(struct map_session_data *sd, struct pet_data *pd)
{
	struct item tmp_item;
	int flag;

	pet_lootitem_drop(pd,sd);
	memset(&tmp_item,0,sizeof(tmp_item));
	tmp_item.nameid = pd->petDB->EggID;
	tmp_item.identify = 1;
	tmp_item.card[0] = CARD0_PET;
	tmp_item.card[1] = GetWord(pd->pet.pet_id,0);
	tmp_item.card[2] = GetWord(pd->pet.pet_id,1);
	tmp_item.card[3] = pd->pet.rename_flag;
	if((flag = pc_additem(sd,&tmp_item,1))) {
		clif_additem(sd,0,0,flag);
		map_addflooritem(&tmp_item,1,sd->bl.m,sd->bl.x,sd->bl.y,0,0,0,0);
	}
	pd->pet.incuvate = 1;
	//No need, pet is saved on unit_free below.
	//intif_save_petdata(sd->status.account_id,&pd->pet);
	if(pd->state.skillbonus) {
		pd->state.skillbonus = 0;
		status_calc_pc(sd,0);
	}
	unit_free(&pd->bl,0);
	sd->status.pet_id = 0;

	return 1;
}
开发者ID:monimonih,项目名称:eathena,代码行数:29,代码来源:pet.c

示例11: pet_return_egg

static int pet_return_egg(struct map_session_data *sd, struct pet_data *pd)
{
	struct item tmp_item;
	unsigned char flag = 0;

	pet_lootitem_drop(pd,sd);
	memset(&tmp_item,0,sizeof(tmp_item));
	tmp_item.nameid = pd->petDB->EggID;
	tmp_item.identify = 1;
	tmp_item.card[0] = CARD0_PET;
	tmp_item.card[1] = GetWord(pd->pet.pet_id,0);
	tmp_item.card[2] = GetWord(pd->pet.pet_id,1);
	tmp_item.card[3] = pd->pet.rename_flag;
	if((flag = pc_additem(sd,&tmp_item,1,LOG_TYPE_OTHER))) {
		clif_additem(sd,0,0,flag);
		map_addflooritem(&tmp_item,1,sd->bl.m,sd->bl.x,sd->bl.y,0,0,0,0,0);
	}
	pd->pet.incubate = 1;
	unit_free(&pd->bl,CLR_OUTSIGHT);

	status_calc_pc(sd,SCO_NONE);
	sd->status.pet_id = 0;

	return 1;
}
开发者ID:SamuelHercules,项目名称:idathena,代码行数:25,代码来源:pet.c

示例12: mail_removeitem

int mail_removeitem(struct map_session_data *sd, short flag, int idx, int amount)
{
	int i;

	nullpo_ret(sd);

	idx -= 2;

	if( idx < 0 || idx >= MAX_INVENTORY )
			return false;
	if( amount <= 0 || amount > sd->inventory.u.items_inventory[idx].amount )
			return false;

	ARR_FIND(0, MAIL_MAX_ITEM, i, sd->mail.item[i].index == idx && sd->mail.item[i].nameid > 0);

	if( i == MAIL_MAX_ITEM ){
		return false;
	}

	if( flag ){
		if( battle_config.mail_attachment_price > 0 ){
			if( pc_payzeny( sd, battle_config.mail_attachment_price, LOG_TYPE_MAIL, NULL ) ){
				return false;
			}
		}

#if PACKETVER < 20150513
		// With client update packet
		pc_delitem(sd, idx, amount, 1, 0, LOG_TYPE_MAIL);
#else
		// RODEX refreshes the client inventory from the ACK packet
		pc_delitem(sd, idx, amount, 0, 0, LOG_TYPE_MAIL);
#endif
	}else{
		for( ; i < MAIL_MAX_ITEM-1; i++ ){
			if (sd->mail.item[i + 1].nameid == 0)
				break;
			sd->mail.item[i].index = sd->mail.item[i+1].index;
			sd->mail.item[i].nameid = sd->mail.item[i+1].nameid;
			sd->mail.item[i].amount = sd->mail.item[i+1].amount;
		}

		for( ; i < MAIL_MAX_ITEM; i++ ){
			sd->mail.item[i].index = 0;
			sd->mail.item[i].nameid = 0;
			sd->mail.item[i].amount = 0;
		}

#if PACKETVER < 20150513
		clif_additem(sd, idx, amount, 0);
#else
		clif_mail_removeitem(sd, true, idx + 2, amount);
#endif
	}

	return 1;
}
开发者ID:Vincentore,项目名称:rathena,代码行数:57,代码来源:mail.c

示例13: trade_tradecancel

/*==========================================
 * 取引キャンセル
 *------------------------------------------
 */
void trade_tradecancel(struct map_session_data *sd)
{
	struct map_session_data *target_sd;
	int trade_i;

	nullpo_retv(sd);

	target_sd = map_id2sd(sd->trade.partner);
	if(target_sd && target_sd->bl.prev) {
		for(trade_i = 0; trade_i < MAX_DEAL_ITEMS; trade_i++) { //give items back (only virtual)
			if(target_sd->trade.item_amount[trade_i] != 0) {
				clif_additem(target_sd,target_sd->trade.item_index[trade_i]-2,target_sd->trade.item_amount[trade_i],0);
				target_sd->trade.item_index[trade_i]  = 0;
				target_sd->trade.item_amount[trade_i] = 0;
			}
		}
		if(target_sd->trade.zeny) {
			clif_updatestatus(target_sd,SP_ZENY);
			target_sd->trade.zeny = 0;
		}
		target_sd->state.deal_locked = 0;
		target_sd->state.deal_mode   = 0;
		target_sd->trade.partner     = 0;
		clif_tradecancelled(target_sd);
	}

	for(trade_i = 0; trade_i < MAX_DEAL_ITEMS; trade_i++) { //give items back (only virtual)
		if (sd->trade.item_amount[trade_i] != 0) {
			clif_additem(sd, sd->trade.item_index[trade_i]-2, sd->trade.item_amount[trade_i], 0);
			sd->trade.item_index[trade_i]  = 0;
			sd->trade.item_amount[trade_i] = 0;
		}
	}
	if (sd->trade.zeny) {
		clif_updatestatus(sd, SP_ZENY);
		sd->trade.zeny = 0;
	}
	sd->state.deal_locked = 0;
	sd->state.deal_mode   = 0;
	sd->trade.partner     = 0;
	clif_tradecancelled(sd);

	return;
}
开发者ID:AurigaProject,项目名称:root,代码行数:48,代码来源:trade.c

示例14: trade_tradecancel

/*==========================================
 * 取引キャンセル
 *------------------------------------------
 */
void trade_tradecancel(struct map_session_data *sd) {
	struct map_session_data *target_sd;
	int trade_i;

	nullpo_retv(sd);

	if ((target_sd = map_id2sd(sd->trade_partner)) != NULL) {
		for(trade_i = 0; trade_i < 10; trade_i++) { // give items back (only virtual)
			if (sd->deal.item[trade_i].amount != 0) {
				clif_additem(sd, sd->deal.item[trade_i].index, sd->deal.item[trade_i].amount, 0);
				sd->deal.item[trade_i].index = 0;
				sd->deal.item[trade_i].amount = 0;
			}
			if (target_sd->deal.item[trade_i].amount != 0) {
				clif_additem(target_sd, target_sd->deal.item[trade_i].index, target_sd->deal.item[trade_i].amount, 0);
				target_sd->deal.item[trade_i].index = 0;
				target_sd->deal.item[trade_i].amount = 0;
			}
		}
		if (sd->deal.zeny) {
			clif_updatestatus(sd, SP_ZENY);
			sd->deal.zeny = 0;
		}
		if (target_sd->deal.zeny) {
			clif_updatestatus(target_sd, SP_ZENY);
			target_sd->deal.zeny = 0;
		}
		sd->state.deal_locked = 0;
		sd->trade_partner = 0;
		sd->state.trading = 0;
		target_sd->state.deal_locked = 0;
		target_sd->trade_partner = 0;
		target_sd->state.trading = 0;
		clif_tradecancelled(sd);
		clif_tradecancelled(target_sd);
	}
}
开发者ID:AxlSckay,项目名称:Ragnarok-OldTimes,代码行数:41,代码来源:trade.c

示例15: mail_removeitem

int mail_removeitem(struct map_session_data *sd, short flag)
{
	nullpo_ret(sd);

	if( sd->mail.amount )
	{
		if (flag) // Item send
			pc_delitem(sd, sd->mail.index, sd->mail.amount, 1, 0, LOG_TYPE_MAIL);
		else
			clif_additem(sd, sd->mail.index, sd->mail.amount, 0);
	}

	sd->mail.nameid = 0;
	sd->mail.index = 0;
	sd->mail.amount = 0;
	return 1;
}
开发者ID:Chocolate31,项目名称:eamod,代码行数:17,代码来源:mail.c


注:本文中的clif_additem函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。