Exemple #1
0
/** [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;
	}
}
Exemple #2
0
void duel_invite (const unsigned int did, struct map_session_data *sd, struct map_session_data *target_sd)
{
	char output[256];
	// " -- Player %s invites %s to duel --"
	sprintf (output, msg_txt (373), sd->status.name, target_sd->status.name);
	clif_disp_message (&sd->bl, output, strlen (output), DUEL_WOS);
	target_sd->duel_invite = did;
	duel_list[did].invites_count++;
	// "Blue -- Player %s invites you to PVP duel (@accept/@reject) --"
	sprintf (output, msg_txt (374), sd->status.name);
	clif_broadcast ( (struct block_list *) target_sd, output, strlen (output) + 1, 0x10, SELF);
}