Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

option_invisible break users_pvp count on login #4230

Open
Stingor opened this issue Jun 29, 2019 · 0 comments

Comments

Projects
None yet
1 participant
@Stingor
Copy link

commented Jun 29, 2019

  • rAthena Hash: last
  • Client Date: irrelevant
  • Server Mode: pre-re/re
  • Description of Issue: count of pvp users in map goes wrong when login into map with invisible option.

    • How to Reproduce: go to a pvp map, make sure to remove nosave mapflag then @hide, disconnect, reconnect and voilà, remove your hide, rank pvp is no longer 1/1, but nothing, if another player join it will be 2/1 and 1/1 rank .
      Then redo @hide, disconnect, reconnect and rank will go 1/999999 :D
  • Modifications that may affect results:

in pc.cpp at pc_reg_received function changing :

	if (sd->state.connect_new == 0 && sd->fd) { //Character already loaded map! Gotta trigger LoadEndAck manually.
		sd->state.connect_new = 1;
		clif_parse_LoadEndAck(sd->fd, sd);
	}

	if( pc_isinvisible(sd) ){
		sd->vd.class_ = JT_INVISIBLE;
		clif_displaymessage( sd->fd, msg_txt( sd, 11 ) ); // Invisible: On
		// decrement the number of pvp players on the map
		map_getmapdata(sd->bl.m)->users_pvp--;

		if( map_getmapflag(sd->bl.m, MF_PVP) && !map_getmapflag(sd->bl.m, MF_PVP_NOCALCRANK) && sd->pvp_timer != INVALID_TIMER ){
			// unregister the player for ranking
			delete_timer( sd->pvp_timer, pc_calc_pvprank_timer );
			sd->pvp_timer = INVALID_TIMER;
		}

		clif_changeoption( &sd->bl );
	}

TO :

	if (sd->state.connect_new == 0 && sd->fd) { //Character already loaded map! Gotta trigger LoadEndAck manually.
		sd->state.connect_new = 1;
		clif_parse_LoadEndAck(sd->fd, sd);
		if( pc_isinvisible(sd) ) {
			sd->vd.class_ = JT_INVISIBLE;
			clif_displaymessage( sd->fd, msg_txt( sd, 11 ) ); // Invisible: On
			// decrement the number of pvp players on the map
			map_getmapdata(sd->bl.m)->users_pvp--;

			if( map_getmapflag(sd->bl.m, MF_PVP) && !map_getmapflag(sd->bl.m, MF_PVP_NOCALCRANK) && sd->pvp_timer != INVALID_TIMER ){
				// unregister the player for ranking
				delete_timer( sd->pvp_timer, pc_calc_pvprank_timer );
				sd->pvp_timer = INVALID_TIMER;
			}

			clif_changeoption( &sd->bl );
		}
	}

seems to resolve the issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.