Пример #1
0
/// Invoked (from char-server) when a new member is added to the party.
/// flag: 0-success, 1-failure
int party_member_added(int party_id,uint32 account_id,uint32 char_id, int flag)
{
	struct map_session_data *sd = map_id2sd(account_id),*sd2;
	struct party_data *p = party_search(party_id);
	int i;

	if(sd == NULL || sd->status.char_id != char_id || !sd->party_joining ) {
		if (!flag) //Char logged off before being accepted into party.
			intif_party_leave(party_id,account_id,char_id);
		return 0;
	}

	sd2 = map_id2sd(sd->party_invite_account);

	sd->party_joining = false;
	sd->party_invite = 0;
	sd->party_invite_account = 0;

	if (!p) {
		ShowError("party_member_added: party %d not found.\n",party_id);
		intif_party_leave(party_id,account_id,char_id);
		return 0;
	}

	if( flag ) { // failed
		if( sd2 != NULL )
			clif_party_invite_reply(sd2,sd->status.name,PARTY_REPLY_FULL);
		return 0;
	}

	sd->status.party_id = party_id;

	clif_party_member_info(p,sd);
	clif_party_option(p,sd,0x100);
	clif_party_info(p,sd);

	if( sd2 != NULL )
		clif_party_invite_reply(sd2,sd->status.name,PARTY_REPLY_ACCEPTED);

	for( i = 0; i < ARRAYLENGTH(p->data); ++i ) { // hp of the other party members
		sd2 = p->data[i].sd;

		if( sd2 && sd2->status.account_id != account_id && sd2->status.char_id != char_id )
			clif_hpmeter_single(sd->fd, sd2->bl.id, sd2->battle_status.hp, sd2->battle_status.max_hp);
	}

	clif_party_hp(sd);
	clif_party_xy(sd);
	clif_charnameupdate(sd); //Update char name's display [Skotlex]

	if( p->instance_id )
		instance_reqinfo(sd,p->instance_id);

	return 0;
}
Пример #2
0
int party_reply_invite(struct map_session_data *sd,int party_id,int flag)
{
	struct map_session_data* tsd;
	struct party_member member;

	if( sd->party_invite != party_id ) { // forged
		sd->party_invite = 0;
		sd->party_invite_account = 0;
		return 0;
	}

	tsd = map_id2sd(sd->party_invite_account);

	if( flag == 1 && !sd->party_creating && !sd->party_joining ) { // accepted and allowed
		sd->party_joining = true;
		party_fill_member(&member, sd, 0);
		intif_party_addmember(sd->party_invite, &member);
		return 1;
	} else { // rejected or failure
		sd->party_invite = 0;
		sd->party_invite_account = 0;

		if( tsd != NULL )
			clif_party_invite_reply(tsd,sd->status.name,PARTY_REPLY_REJECTED);
	}

	return 0;
}
Пример #3
0
int party_reply_invite(struct map_session_data *sd,int party_id,int flag)
{
	struct map_session_data* tsd;
	struct party_member member;

	if( sd->party_invite != party_id ) { // forged
		sd->party_invite = 0;
		sd->party_invite_account = 0;
		return 0;
	}

	// The character is already in a party, possibly left a party invite open and created his own party
	if( sd->status.party_id != 0 ){
		// On Aegis no rejection packet is sent to the inviting player
		sd->party_invite = 0;
		sd->party_invite_account = 0;
		return 0;
	}

	tsd = map_id2sd(sd->party_invite_account);

	if( flag == 1 && !sd->party_creating && !sd->party_joining ) { // accepted and allowed
		sd->party_joining = true;
		party_fill_member(&member, sd, 0);
		intif_party_addmember(sd->party_invite, &member);
		return 1;
	} else { // rejected or failure
		sd->party_invite = 0;
		sd->party_invite_account = 0;

		if( tsd != NULL )
			clif_party_invite_reply(tsd,sd->status.name,PARTY_REPLY_REJECTED);
	}

	return 0;
}
Пример #4
0
///! TODO: Party invitation cross map-server through inter-server, so does with the reply.
int party_invite(struct map_session_data *sd,struct map_session_data *tsd)
{
	struct party_data *p;
	int i;

	nullpo_ret(sd);

	if( ( p = party_search(sd->status.party_id) ) == NULL )
		return 0;

	// confirm if this player is a party leader
	ARR_FIND(0, MAX_PARTY, i, p->data[i].sd == sd);

	if( i == MAX_PARTY || !p->party.member[i].leader ) {
		clif_displaymessage(sd->fd, msg_txt(sd,282));
		return 0;
	}

	if (tsd && battle_config.block_account_in_same_party) {
		ARR_FIND(0, MAX_PARTY, i, p->party.member[i].account_id == tsd->status.account_id);
		if (i < MAX_PARTY) {
			clif_party_invite_reply(sd, tsd->status.name, PARTY_REPLY_DUAL);
			return 0;
		}
	}

	// confirm if there is an open slot in the party
	ARR_FIND(0, MAX_PARTY, i, p->party.member[i].account_id == 0);

	if( i == MAX_PARTY ) {
		clif_party_invite_reply(sd, (tsd?tsd->status.name:""), PARTY_REPLY_FULL);
		return 0;
	}

	// confirm whether the account has the ability to invite before checking the player
	if( !pc_has_permission(sd, PC_PERM_PARTY) || (tsd && !pc_has_permission(tsd, PC_PERM_PARTY)) ) {
		clif_displaymessage(sd->fd, msg_txt(sd,81)); // "Your GM level doesn't authorize you to preform this action on the specified player."
		return 0;
	}

	if( tsd == NULL) {
		clif_party_invite_reply(sd, "", PARTY_REPLY_OFFLINE);
		return 0;
	}

	if(!battle_config.invite_request_check) {
		if (tsd->guild_invite>0 || tsd->trade_partner || tsd->adopt_invite) {
			clif_party_invite_reply(sd,tsd->status.name,PARTY_REPLY_JOIN_OTHER_PARTY);
			return 0;
		}
	}

	if (!tsd->fd) { //You can't invite someone who has already disconnected.
		clif_party_invite_reply(sd,tsd->status.name,PARTY_REPLY_REJECTED);
		return 0;
	}

	if( tsd->status.party_id > 0 || tsd->party_invite > 0 )
	{// already associated with a party
		clif_party_invite_reply(sd,tsd->status.name,PARTY_REPLY_JOIN_OTHER_PARTY);
		return 0;
	}

	tsd->party_invite=sd->status.party_id;
	tsd->party_invite_account=sd->status.account_id;

	clif_party_invite(sd,tsd);
	return 1;
}