예제 #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,int account_id,int 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_inviteack(sd2,sd->status.name,3);
		return 0;
	}

	sd->status.party_id = party_id;

	ARR_FIND( 0, MAX_PARTY, i, p->party.member[i].account_id == 0 );
	if (i < MAX_PARTY) {
		//TODO: This is a hack to allow the following clif calls to send the data to the new player.
		//The correct player data is set when party_recv_info arrives soon afterwards.
		party_fill_member(&p->party.member[i], sd);
		p->data[i].sd = sd;
	}

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

	if( sd2 != NULL )
		clif_party_inviteack(sd2,sd->status.name,2);

	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]

	return 0;
}
예제 #2
0
// パーティへの勧誘
int party_invite(struct map_session_data *sd,int account_id)
{
	struct map_session_data *tsd= map_id2sd(account_id);
	struct party *p=party_search(sd->status.party_id);
	int i;
	
	nullpo_retr(0, sd);

	if(tsd==NULL || p==NULL)
		return 0;
	if(!battle_config.invite_request_check) {
		if (tsd->guild_invite>0 || tsd->trade_partner) {	// 相手が取引中かどうか
			clif_party_inviteack(sd,tsd->status.name,0);
			return 0;
		}
	}
	if( tsd->status.party_id>0 || tsd->party_invite>0 ){	// 相手の所属確認
		clif_party_inviteack(sd,tsd->status.name,0);
		return 0;
	}
	for(i=0;i<MAX_PARTY;i++){	// 同アカウント確認
		if(p->member[i].account_id==account_id){
			clif_party_inviteack(sd,tsd->status.name,0);
			return 0;
		}
	}
	
	tsd->party_invite=sd->status.party_id;
	tsd->party_invite_account=sd->status.account_id;

	clif_party_invite(sd,tsd);
	return 0;
}
예제 #3
0
파일: party.c 프로젝트: Celso1415/Fusion
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 (282));
		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_inviteack (sd, (tsd ? tsd->status.name : ""), 3);
		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 (81)); // "Your GM level doesn't authorize you to preform this action on the specified player."
		return 0;
	}

	if (tsd == NULL) {
		clif_party_inviteack (sd, "", 7);
		return 0;
	}

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

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

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

	tsd->party_invite = sd->status.party_id;
	tsd->party_invite_account = sd->status.account_id;
	clif_party_invite (sd, tsd);
	return 1;
}
예제 #4
0
파일: party.c 프로젝트: Celso1415/Fusion
/// 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, int account_id, int 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_inviteack (sd2, sd->status.name, 3);

		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_inviteack (sd2, sd->status.name, 2);

	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)
		clif_instance_join (sd->fd, p->instance_id);

	return 0;
}
예제 #5
0
파일: party.cpp 프로젝트: JaduJagat/tmwa
// パーティが追加された
int party_member_added(int party_id, int account_id, int flag)
{
    dumb_ptr<map_session_data> sd = map_id2sd(account_id), sd2;
    struct party *p = party_search(party_id);

    if (sd == NULL)
    {
        if (flag == 0)
        {
            if (battle_config.error_log)
                PRINTF("party: member added error %d is not online\n",
                        account_id);
            intif_party_leave(party_id, account_id);   // キャラ側に登録できなかったため脱退要求を出す
        }
        return 0;
    }
    sd2 = map_id2sd(sd->party_invite_account);
    sd->party_invite = 0;
    sd->party_invite_account = 0;

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

    if (flag == 1)
    {                           // 失敗
        if (sd2 != NULL)
            clif_party_inviteack(sd2, sd->status.name, 0);
        return 0;
    }

    // 成功
    sd->party_sended = 0;
    sd->status.party_id = party_id;

    if (sd2 != NULL)
        clif_party_inviteack(sd2, sd->status.name, 2);

    // いちおう競合確認
    party_check_conflict(sd);

    party_send_xy_clear(p);

    return 0;
}
예제 #6
0
파일: party.cpp 프로젝트: mrktj/tmwa
// パーティが追加された
int party_member_added(PartyId party_id, AccountId account_id, int flag)
{
    dumb_ptr<map_session_data> sd = map_id2sd(account_to_block(account_id)), sd2;
    PartyPair p = party_search(party_id);

    if (sd == nullptr)
    {
        if (flag == 0)
        {
            if (battle_config.error_log)
                PRINTF("party: member added error %d is not online\n"_fmt,
                        account_id);
            intif_party_leave(party_id, account_id);   // キャラ側に登録できなかったため脱退要求を出す
        }
        return 0;
    }
    sd2 = map_id2sd(account_to_block(sd->party_invite_account));
    sd->party_invite = PartyId();
    sd->party_invite_account = AccountId();

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

    if (flag == 1)
    {                           // 失敗
        if (sd2 != nullptr)
            clif_party_inviteack(sd2, sd->status_key.name, 0);
        return 0;
    }

    // 成功
    sd->party_sended = 0;
    sd->status.party_id = party_id;

    if (sd2 != nullptr)
        clif_party_inviteack(sd2, sd->status_key.name, 2);

    // いちおう競合確認
    party_check_conflict(sd);

    party_send_xy_clear(p);

    return 0;
}
예제 #7
0
파일: party.cpp 프로젝트: JaduJagat/tmwa
/* Process response to party invitation. */
int party_reply_invite(dumb_ptr<map_session_data> sd, int account_id, int flag)
{
    nullpo_ret(sd);

    /* There is no pending invitation. */
    if (!sd->party_invite || !sd->party_invite_account)
        return 0;

    /*
     * Only one invitation can be pending, so these have to be the same. Since
     * the client continues to send the wrong ID, and it's already managed on
     * this side of things, the sent ID is being ignored.
     */
    account_id = sd->party_invite_account;

    /* The invitation was accepted. */
    if (flag == 1)
        intif_party_addmember(sd->party_invite, sd->status.account_id);
    /* The invitation was rejected. */
    else
    {
        /* This is the player who sent the invitation. */
        dumb_ptr<map_session_data> tsd = NULL;

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

        if ((tsd = map_id2sd(account_id)))
            clif_party_inviteack(tsd, sd->status.name, 1);
    }
    return 0;
}
예제 #8
0
파일: party.c 프로젝트: Tonetete/eathena
void 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;
	}
	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);
	}
	else
	{// rejected or failure
		sd->party_invite = 0;
		sd->party_invite_account = 0;
		if( tsd != NULL )
			clif_party_inviteack(tsd,sd->status.name,1);
	}
}
예제 #9
0
// パーティが追加された
int party_member_added(int party_id,int account_id,int char_id, int flag)
{
	struct map_session_data *sd = map_id2sd(account_id),*sd2;
	
	if(sd == NULL || sd->status.char_id != char_id){
		if (flag == 0) {
			if(battle_config.error_log)
				ShowError("party: member added error %d is not online\n",account_id);
			intif_party_leave(party_id,account_id,char_id); // キャラ側i登録eきhかaたたぁ脱憎要求も出す
		}
		return 0;
	}
	
	sd->party_invite=0;
	sd->party_invite_account=0;
	
	sd2=map_id2sd(sd->party_invite_account);
	if (sd2)
		clif_party_inviteack(sd2,sd->status.name,flag?2:0);
	if(flag)
		return 0;
	
	sd->state.party_sent=0;
	sd->status.party_id=party_id;

	party_check_conflict(sd);
	clif_charnameupdate(sd); //Update char name's display [Skotlex]
	clif_party_hp(sd);
	clif_party_xy(sd);
	return 0;
}
예제 #10
0
int party_invite(struct map_session_data *sd,struct map_session_data *tsd)
{
	struct party_data *p=party_search(sd->status.party_id);
	int i,flag=0;
	
	nullpo_retr(0, sd);

	if(tsd==NULL || p==NULL)
		return 0;
	if(!battle_config.invite_request_check) {
		if (tsd->guild_invite>0 || tsd->trade_partner) {
			clif_party_inviteack(sd,tsd->status.name,0);
			return 0;
		}
	}
	if( tsd->status.party_id>0 || tsd->party_invite>0 ){
		clif_party_inviteack(sd,tsd->status.name,0);
		return 0;
	}
	for(i=0;i<MAX_PARTY;i++){
		if(p->party.member[i].account_id == 0) //Room for a new member.
			flag = 1;
	/* By default Aegis BLOCKS more than one char from the same account on a party.
	 * But eA does support it... so this check is left commented.
		if(p->party.member[i].account_id==tsd->status.account_id)
		{
			clif_party_inviteack(sd,tsd->status.name,4);
			return 0;
		}
	*/
	}
	if (!flag) { //Full party.
		clif_party_inviteack(sd,tsd->status.name,3);
		return 0;
	}
		
	tsd->party_invite=sd->status.party_id;
	tsd->party_invite_account=sd->status.account_id;

	clif_party_invite(sd,tsd);
	return 1;
}
예제 #11
0
int party_reply_invite(struct map_session_data *sd,int account_id,int flag)
{
	struct map_session_data *tsd= map_id2sd(account_id);
	struct party_member member;
	nullpo_retr(0, sd);

	if(flag==1){
		party_fill_member(&member, sd);
		intif_party_addmember(sd->party_invite, &member);
		return 0;
	}
	sd->party_invite=0;
	sd->party_invite_account=0;
	if(tsd==NULL)
		return 0;
	clif_party_inviteack(tsd,sd->status.name,1);
	return 1;
}
예제 #12
0
// パーティ勧誘への返答
int party_reply_invite(struct map_session_data *sd,int account_id,int flag)
{
	struct map_session_data *tsd= map_id2sd(account_id);

	nullpo_retr(0, sd);

	if(flag==1){	// 承諾
		//inter鯖へ追加要求
		intif_party_addmember( sd->party_invite, sd->status.account_id );
		return 0;
	}
	else {		// 拒否
		sd->party_invite=0;
		sd->party_invite_account=0;
		if(tsd==NULL)
			return 0;
		clif_party_inviteack(tsd,sd->status.name,1);
	}
	return 0;
}
예제 #13
0
int party_member_added(int party_id,int account_id,int char_id, int flag)
{
	struct map_session_data *sd = map_id2sd(account_id),*sd2;
	struct party_data *p = party_search(party_id);
	if(sd == NULL || sd->status.char_id != char_id){
		if (flag == 0) {
			if(battle_config.error_log)
				ShowError("party: member added error %d is not online\n",account_id);
			intif_party_leave(party_id,account_id,char_id);
		}
		return 0;
	}
	sd->party_invite=0;
	sd->party_invite_account=0;

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

	if(!flag) {
		sd->state.party_sent=0;
		sd->status.party_id=party_id;
		party_check_conflict(sd);
		clif_party_member_info(p,sd);
		clif_party_hp(sd);
		clif_party_xy(sd);
		clif_charnameupdate(sd); //Update char name's display [Skotlex]
	}

	sd2=map_id2sd(sd->party_invite_account);
	if (sd2)
		clif_party_inviteack(sd2,sd->status.name,flag?2:1);
	return 0;
}
예제 #14
0
int party_invite(struct map_session_data *sd,struct map_session_data *tsd)
{
	struct party_data *p=party_search(sd->status.party_id);
	int i,flag=0;
	
	nullpo_retr(0, sd);
	if (p==NULL)
		return 0;

	if(tsd==NULL) {	//TODO: Find the correct reply packet.
		clif_displaymessage(sd->fd, msg_txt(3));
		return 0;
	}
	//Only leader can invite.
	ARR_FIND(0, MAX_PARTY, i, p->data[i].sd == sd);
	if (i == MAX_PARTY || !p->party.member[i].leader)
	{	//TODO: Find the correct reply packet.
		clif_displaymessage(sd->fd, msg_txt(282));
		return 0;
	}

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

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

	if( tsd->status.party_id > 0 || tsd->party_invite > 0 )
	{// already associated with a party
		clif_party_inviteack(sd,tsd->status.name,0);
		return 0;
	}
	for(i=0;i<MAX_PARTY;i++){
		if(p->party.member[i].account_id == 0) //Room for a new member.
			flag = 1;
	/* By default Aegis BLOCKS more than one char from the same account on a party.
	 * But eA does support it... so this check is left commented.
		if(p->party.member[i].account_id==tsd->status.account_id)
		{
			clif_party_inviteack(sd,tsd->status.name,4);
			return 0;
		}
	*/
	}
	if (!flag) { //Full party.
		clif_party_inviteack(sd,tsd->status.name,3);
		return 0;
	}
		
	tsd->party_invite=sd->status.party_id;
	tsd->party_invite_account=sd->status.account_id;

	clif_party_invite(sd,tsd);
	return 1;
}
예제 #15
0
파일: party.cpp 프로젝트: JaduJagat/tmwa
/* Process party invitation from sd to account_id. */
int party_invite(dumb_ptr<map_session_data> sd, int account_id)
{
    dumb_ptr<map_session_data> tsd = map_id2sd(account_id);
    struct party *p = party_search(sd->status.party_id);
    int i;
    int full = 1; /* Indicates whether or not there's room for one more. */

    nullpo_ret(sd);

    if (!tsd || !p || !tsd->fd)
        return 0;

    if (!battle_config.invite_request_check)
    {
        /* Disallow the invitation under these conditions. */
        if (tsd->trade_partner || tsd->npc_id
            || tsd->npc_shopid || pc_checkskill(tsd, SkillID::NV_PARTY) < 1)
        {
            clif_party_inviteack(sd, tsd->status.name, 1);
            return 0;
        }
    }

    /* The target player is already in a party, or has a pending invitation. */
    if (tsd->status.party_id > 0 || tsd->party_invite > 0)
    {
        clif_party_inviteack(sd, tsd->status.name, 0);
        return 0;
    }

    for (i = 0; i < MAX_PARTY; i++)
    {
        /*
         * A character from the target account is already in the same party.
         * The response isn't strictly accurate, as they're separate
         * characters, but we're making do with what was already in place and
         * leaving this (mostly) alone for now.
         */
        if (p->member[i].account_id == account_id)
        {
            clif_party_inviteack(sd, tsd->status.name, 1);
            return 0;
        }

        if (!p->member[i].account_id)
            full = 0;
    }

    /* There isn't enough room for a new member. */
    if (full)
    {
        clif_party_inviteack(sd, tsd->status.name, 3);
        return 0;
    }

    /* Otherwise, relay the invitation to the target player. */
    tsd->party_invite = sd->status.party_id;
    tsd->party_invite_account = sd->status.account_id;

    clif_party_invite(sd, tsd);
    return 0;
}
예제 #16
0
파일: party.c 프로젝트: Tonetete/eathena
int party_invite(struct map_session_data *sd,struct map_session_data *tsd)
{
	struct party_data *p;
	int i,flag=0;
	
	nullpo_ret(sd);
	if( ( p = party_search(sd->status.party_id) ) == NULL )
		return 0;
	if( tsd == NULL) {
		clif_party_inviteack(sd, "", 7);
		return 0;
	}
	
	if ( (pc_isGM(sd) >= battle_config.lowest_gm_level && pc_isGM(tsd) < battle_config.lowest_gm_level && !battle_config.gm_can_party && pc_isGM(sd) < battle_config.gm_cant_party_min_lv)
		|| ( pc_isGM(sd) < battle_config.lowest_gm_level && pc_isGM(tsd) >= battle_config.lowest_gm_level && !battle_config.gm_can_party && pc_isGM(tsd) < battle_config.gm_cant_party_min_lv) )
	{
		//GMs can't invite non GMs to the party if not above the invite trust level
		//Likewise, as long as gm_can_party is off, players can't invite GMs.
		clif_displaymessage(sd->fd, msg_txt(81));
		return 0;
	}
	
	//Only leader can invite.
	ARR_FIND(0, MAX_PARTY, i, p->data[i].sd == sd);
	if (i == MAX_PARTY || !p->party.member[i].leader)
	{	//TODO: Find the correct reply packet.
		clif_displaymessage(sd->fd, msg_txt(282));
		return 0;
	}

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

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

	if( tsd->status.party_id > 0 || tsd->party_invite > 0 )
	{// already associated with a party
		clif_party_inviteack(sd,tsd->status.name,0);
		return 0;
	}
	for(i=0;i<MAX_PARTY;i++){
		if(p->party.member[i].account_id == 0) //Room for a new member.
			flag = 1;
	/* By default Aegis BLOCKS more than one char from the same account on a party.
	 * But eA does support it... so this check is left commented.
		if(p->party.member[i].account_id==tsd->status.account_id)
		{
			clif_party_inviteack(sd,tsd->status.name,4);
			return 0;
		}
	*/
	}
	if (!flag) { //Full party.
		clif_party_inviteack(sd,tsd->status.name,3);
		return 0;
	}
		
	tsd->party_invite=sd->status.party_id;
	tsd->party_invite_account=sd->status.account_id;

	clif_party_invite(sd,tsd);
	return 1;
}