Jump to content
  • 0

What ways to track these sorts of data?


Judas

Question


  • Group:  Members
  • Topic Count:  26
  • Topics Per Day:  0.01
  • Content Count:  2244
  • Reputation:   182
  • Joined:  11/19/11
  • Last Seen:  

1. total number of players killed.
2. Highest Phy.Damage
3. Highest Mag.Damage
4. "TOTAL" amount of HP Healed from players

I don't believe these are being stored currently. What would be the proper way to store these statistics so it could be reported on via a website as an example or through ingame.
Can these be achieved through script, or would logging statements in the src code have to be done strictly. Or a mix of both?

 

Thanks!

Link to comment
Share on other sites

3 answers to this question

Recommended Posts

  • 0

  • Group:  Members
  • Topic Count:  5
  • Topics Per Day:  0.00
  • Content Count:  249
  • Reputation:   72
  • Joined:  10/20/12
  • Last Seen:  

Hey Judas,

I had the same idea (for WoE statistics) some time ago. And I solved it by just incrementing character variables at the specific src positions:

  src git:(master)  grep -nr "WoE Statistik"
map/intif.c:286:	if( agit_flag || agit2_flag ) pc_setglobalreg(sd,add_str("woestat_chat"), pc_readglobalreg(sd,add_str("woestat_chat"))+1);// [Jey] WoE Statistik
map/unit.c:400:	if( bl->type == BL_PC && (agit_flag || agit2_flag) ) pc_setglobalreg(sd,add_str("woestat_walked"), pc_readglobalreg(sd,add_str("woestat_walked"))+1);// [Jey] WoE Statistik
map/unit.c:1911:		if( map_flag_woe(sd->bl.m) ) pc_setglobalreg(sd,add_str("woestat_skilluse"), pc_readglobalreg(sd,add_str("woestat_skilluse"))+1);// [Jey] WoE Statistik
map/clif.c:10760:	if( agit_flag || agit2_flag ) pc_setglobalreg(sd,add_str("woestat_chat"), pc_readglobalreg(sd,add_str("woestat_chat"))+1); // [Jey] WoE Statistik
map/clif.c:11047:	if(agit_flag || agit2_flag ) pc_setglobalreg(sd,add_str("woestat_chat"), pc_readglobalreg(sd,add_str("woestat_chat"))+1); // [Jey] WoE Statistik
map/pc.c:5060:	if( map_flag_woe(sd->bl.m) ) pc_setglobalreg(sd,add_str("woestat_potuse"), pc_readglobalreg(sd,add_str("woestat_potuse"))+1); // [Jey] WoE Statistik
map/pc.c:5449:		if( sd->vars_ok && (agit_flag || agit2_flag) ) pc_setglobalreg(sd,add_str("woestat_warpcount"), pc_readglobalreg(sd,add_str("woestat_warpcount"))+1);// [Jey] WoE Statistik
map/pc.c:7586:	// [Jey] WoE Statistik
map/pc.c:8418:	if( map_flag_woe(sd->bl.m) ) pc_setglobalreg(sd,add_str("woestat_itemheal"), pc_readglobalreg(sd,add_str("woestat_itemheal"))+hp);// [Jey] WoE Statistik
map/party.c:938:	if(agit_flag || agit2_flag ) pc_setglobalreg(sd,add_str("woestat_chat"), pc_readglobalreg(sd,add_str("woestat_chat"))+1);// [Jey] WoE Statistik
map/skill.c:564:	if( sd != NULL && map_flag_woe(sd->bl.m) ) pc_setglobalreg(sd,add_str("woestat_heal"), pc_readglobalreg(sd,add_str("woestat_heal"))+heal);// [Jey] WoE Statistik
map/skill.c:2584:				if( map_flag_woe(sd->bl.m) ) pc_setglobalreg(sd,add_str("woestat_broken"), pc_readglobalreg(sd,add_str("woestat_broken"))+1);// [Jey] WoE Statistik
map/skill.c:8564:			if( sd != NULL && map_flag_woe(sd->bl.m) ) pc_setglobalreg(sd,add_str("woestat_heal"), pc_readglobalreg(sd,add_str("woestat_heal"))+hp);// [Jey] WoE Statistik
map/skill.c:8754:				if ((dstsd = g->member[i].sd) != NULL && sd != dstsd && !dstsd->state.autotrade && !pc_isdead(dstsd) && pc_readglobalreg(dstsd,add_str("nowoe")) == 0) {// [Jey] WoE Statistik
map/guild.c:1049:	if( agit_flag || agit2_flag ) pc_setglobalreg(sd,add_str("woestat_chat"), pc_readglobalreg(sd,add_str("woestat_chat"))+1);// [Jey] WoE Statistik

And a NPC which showed the player stats and resets them on ever woe start:

prontera,218,87,5	script	WoE Statistik	833,{
OnWhisperGlobal:
	callfunc "CheckWoEStatReset";
	mes "Deine letzte WoE Statistik:";
	mes "Kills: "+woestat_kills;
	mes "Tode: "+woestat_deaths;
	if( woestat_deaths > 0 )
		mes "KDA: "+callfunc("GetPercentage",(woestat_kills*100)/woestat_deaths);
	else
		mes "KDA: Perfekt";
	mes "Maximale Killcombo: "+woestat_killcombo;
	mes "Heilung gewirkt: "+callfunc("ThousandPoints",woestat_heal);
	mes "Itemheilung gewirkt: "+callfunc("ThousandPoints",woestat_itemheal);
	mes "Schaden: "+callfunc("ThousandPoints",woestat_dmgdealt);
	mes "Schaden erlitten: "+callfunc("ThousandPoints",woestat_tanked);
	mes "Skills genutzt: "+callfunc("ThousandPoints",woestat_skilluse);
	mes "Potions genutzt: "+callfunc("ThousandPoints",woestat_potuse);
	mes "Zerbrochene Rüstung: "+woestat_broken;
	mes "Chat Kommunikation: "+callfunc("ThousandPoints",woestat_chat);
	mes "Strecke zurückgelegt: "+callfunc("ThousandPoints",woestat_walked);
	mes "Höchste AFK-Zeit in Sek.: "+callfunc("ThousandPoints",woestat_idle);
	mes "Emps gebrochen: "+woestat_empbreak;
	mes "Gewarpt: "+callfunc("ThousandPoints",woestat_warpcount);
	close;
}
//if( map_flag_woe(sd->bl.m) ) pc_setglobalreg(sd,"woestat_heal", pc_readglobalreg(sd,"woestat_heal")+heal);

//if( map_flag_woe(sd->bl.m) ) pc_setglobalreg(sd,"woestat_chat", pc_readglobalreg(sd,"woestat_chat")+1);
//if( agit_flag || agit2_flag ) pc_setglobalreg(sd,"woestat_chat", pc_readglobalreg(sd,"woestat_chat")+1);
// return pc_setpos((TBL_PC*)bl, map_id2index(m), x, y, type);
function	script	CheckWoEStatReset	{
	if( playerattached() &&  woestat_id != $LastWoEID )
	{
		set woestat_id,$LastWoEID; //Day of the Year
		woestat_kills = 0;
		woestat_deaths = 0;
		woestat_killcombo = 0;
		woestat_killcombo_tmp = 0;
		woestat_heal = 0;
		woestat_itemheal = 0;
		woestat_dmgdealt = 0;
		woestat_tanked = 0;
		woestat_skilluse = 0;
		woestat_potuse = 0;
		woestat_broken = 0;
		woestat_chat = 0;
		woestat_walked = 0;
		woestat_idle = 0;
		woestat_empbreak = 0;
		woestat_warpcount = 0;
	}
	return;
}

-	script	WoEStats	-1,{
	end;
OnAgitStart:
OnAgitStart2:
OnAgitNStartBE:
OnAgitNStartTE:
	initnpctimer;
	$LastWoEID++;
	addrid(0);
OnPCLoginEvent:
	callfunc "CheckWoEStatReset";
	end;

OnPCKillEvent:
	if( callfunc("onActiveGuildCastle") )
	{
		woestat_kills++;
		woestat_killcombo_tmp++;
		if( woestat_killcombo_tmp > woestat_killcombo ) set woestat_killcombo,woestat_killcombo_tmp;
	}
	end;

OnPCDieEvent:
	if( callfunc("onActiveGuildCastle") )
	{
		woestat_deaths++;
		woestat_killcombo_tmp = 0;
	}
	end;

OnAgitEnd:
OnAgitEnd2:
OnAgitNEndBE:
OnAgitNEndTE:
	stopnpctimer;

OnTimer30000: //Alle 30 Sekunden Idletimecheck (Relativ ungenau, aber egal.)
	addrid(0);
	set .@idle,checkidle();
	if( .@idle > woestat_idle ) set woestat_idle,.@idle;
	end;
}

It likely isn't the best approach, but at least it worked fine

 

To answer your question properly:

1. Simple OnPCKillEvent script.
2. SRC edit by comparing the character variable
3. same as 2.
4. SRC edit incrementing the character variable

Edited by Jey
  • Upvote 1
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  41
  • Topics Per Day:  0.01
  • Content Count:  164
  • Reputation:   16
  • Joined:  03/15/12
  • Last Seen:  

2 hours ago, Jey said:

Hey Judas,

I had the same idea (for WoE statistics) some time ago. And I solved it by just incrementing character variables at the specific src positions:


  src git:(master)  grep -nr "WoE Statistik"
map/intif.c:286:	if( agit_flag || agit2_flag ) pc_setglobalreg(sd,add_str("woestat_chat"), pc_readglobalreg(sd,add_str("woestat_chat"))+1);// [Jey] WoE Statistik
map/unit.c:400:	if( bl->type == BL_PC && (agit_flag || agit2_flag) ) pc_setglobalreg(sd,add_str("woestat_walked"), pc_readglobalreg(sd,add_str("woestat_walked"))+1);// [Jey] WoE Statistik
map/unit.c:1911:		if( map_flag_woe(sd->bl.m) ) pc_setglobalreg(sd,add_str("woestat_skilluse"), pc_readglobalreg(sd,add_str("woestat_skilluse"))+1);// [Jey] WoE Statistik
map/clif.c:10760:	if( agit_flag || agit2_flag ) pc_setglobalreg(sd,add_str("woestat_chat"), pc_readglobalreg(sd,add_str("woestat_chat"))+1); // [Jey] WoE Statistik
map/clif.c:11047:	if(agit_flag || agit2_flag ) pc_setglobalreg(sd,add_str("woestat_chat"), pc_readglobalreg(sd,add_str("woestat_chat"))+1); // [Jey] WoE Statistik
map/pc.c:5060:	if( map_flag_woe(sd->bl.m) ) pc_setglobalreg(sd,add_str("woestat_potuse"), pc_readglobalreg(sd,add_str("woestat_potuse"))+1); // [Jey] WoE Statistik
map/pc.c:5449:		if( sd->vars_ok && (agit_flag || agit2_flag) ) pc_setglobalreg(sd,add_str("woestat_warpcount"), pc_readglobalreg(sd,add_str("woestat_warpcount"))+1);// [Jey] WoE Statistik
map/pc.c:7586:	// [Jey] WoE Statistik
map/pc.c:8418:	if( map_flag_woe(sd->bl.m) ) pc_setglobalreg(sd,add_str("woestat_itemheal"), pc_readglobalreg(sd,add_str("woestat_itemheal"))+hp);// [Jey] WoE Statistik
map/party.c:938:	if(agit_flag || agit2_flag ) pc_setglobalreg(sd,add_str("woestat_chat"), pc_readglobalreg(sd,add_str("woestat_chat"))+1);// [Jey] WoE Statistik
map/skill.c:564:	if( sd != NULL && map_flag_woe(sd->bl.m) ) pc_setglobalreg(sd,add_str("woestat_heal"), pc_readglobalreg(sd,add_str("woestat_heal"))+heal);// [Jey] WoE Statistik
map/skill.c:2584:				if( map_flag_woe(sd->bl.m) ) pc_setglobalreg(sd,add_str("woestat_broken"), pc_readglobalreg(sd,add_str("woestat_broken"))+1);// [Jey] WoE Statistik
map/skill.c:8564:			if( sd != NULL && map_flag_woe(sd->bl.m) ) pc_setglobalreg(sd,add_str("woestat_heal"), pc_readglobalreg(sd,add_str("woestat_heal"))+hp);// [Jey] WoE Statistik
map/skill.c:8754:				if ((dstsd = g->member[i].sd) != NULL && sd != dstsd && !dstsd->state.autotrade && !pc_isdead(dstsd) && pc_readglobalreg(dstsd,add_str("nowoe")) == 0) {// [Jey] WoE Statistik
map/guild.c:1049:	if( agit_flag || agit2_flag ) pc_setglobalreg(sd,add_str("woestat_chat"), pc_readglobalreg(sd,add_str("woestat_chat"))+1);// [Jey] WoE Statistik

And a NPC which showed the player stats and resets them on ever woe start:


prontera,218,87,5	script	WoE Statistik	833,{
OnWhisperGlobal:
	callfunc "CheckWoEStatReset";
	mes "Deine letzte WoE Statistik:";
	mes "Kills: "+woestat_kills;
	mes "Tode: "+woestat_deaths;
	if( woestat_deaths > 0 )
		mes "KDA: "+callfunc("GetPercentage",(woestat_kills*100)/woestat_deaths);
	else
		mes "KDA: Perfekt";
	mes "Maximale Killcombo: "+woestat_killcombo;
	mes "Heilung gewirkt: "+callfunc("ThousandPoints",woestat_heal);
	mes "Itemheilung gewirkt: "+callfunc("ThousandPoints",woestat_itemheal);
	mes "Schaden: "+callfunc("ThousandPoints",woestat_dmgdealt);
	mes "Schaden erlitten: "+callfunc("ThousandPoints",woestat_tanked);
	mes "Skills genutzt: "+callfunc("ThousandPoints",woestat_skilluse);
	mes "Potions genutzt: "+callfunc("ThousandPoints",woestat_potuse);
	mes "Zerbrochene Rüstung: "+woestat_broken;
	mes "Chat Kommunikation: "+callfunc("ThousandPoints",woestat_chat);
	mes "Strecke zurückgelegt: "+callfunc("ThousandPoints",woestat_walked);
	mes "Höchste AFK-Zeit in Sek.: "+callfunc("ThousandPoints",woestat_idle);
	mes "Emps gebrochen: "+woestat_empbreak;
	mes "Gewarpt: "+callfunc("ThousandPoints",woestat_warpcount);
	close;
}
//if( map_flag_woe(sd->bl.m) ) pc_setglobalreg(sd,"woestat_heal", pc_readglobalreg(sd,"woestat_heal")+heal);

//if( map_flag_woe(sd->bl.m) ) pc_setglobalreg(sd,"woestat_chat", pc_readglobalreg(sd,"woestat_chat")+1);
//if( agit_flag || agit2_flag ) pc_setglobalreg(sd,"woestat_chat", pc_readglobalreg(sd,"woestat_chat")+1);
// return pc_setpos((TBL_PC*)bl, map_id2index(m), x, y, type);
function	script	CheckWoEStatReset	{
	if( playerattached() &&  woestat_id != $LastWoEID )
	{
		set woestat_id,$LastWoEID; //Day of the Year
		woestat_kills = 0;
		woestat_deaths = 0;
		woestat_killcombo = 0;
		woestat_killcombo_tmp = 0;
		woestat_heal = 0;
		woestat_itemheal = 0;
		woestat_dmgdealt = 0;
		woestat_tanked = 0;
		woestat_skilluse = 0;
		woestat_potuse = 0;
		woestat_broken = 0;
		woestat_chat = 0;
		woestat_walked = 0;
		woestat_idle = 0;
		woestat_empbreak = 0;
		woestat_warpcount = 0;
	}
	return;
}

-	script	WoEStats	-1,{
	end;
OnAgitStart:
OnAgitStart2:
OnAgitNStartBE:
OnAgitNStartTE:
	initnpctimer;
	$LastWoEID++;
	addrid(0);
OnPCLoginEvent:
	callfunc "CheckWoEStatReset";
	end;

OnPCKillEvent:
	if( callfunc("onActiveGuildCastle") )
	{
		woestat_kills++;
		woestat_killcombo_tmp++;
		if( woestat_killcombo_tmp > woestat_killcombo ) set woestat_killcombo,woestat_killcombo_tmp;
	}
	end;

OnPCDieEvent:
	if( callfunc("onActiveGuildCastle") )
	{
		woestat_deaths++;
		woestat_killcombo_tmp = 0;
	}
	end;

OnAgitEnd:
OnAgitEnd2:
OnAgitNEndBE:
OnAgitNEndTE:
	stopnpctimer;

OnTimer30000: //Alle 30 Sekunden Idletimecheck (Relativ ungenau, aber egal.)
	addrid(0);
	set .@idle,checkidle();
	if( .@idle > woestat_idle ) set woestat_idle,.@idle;
	end;
}

It likely isn't the best approach, but at least it worked fine

 

To answer your question properly:

1. Simple OnPCKillEvent script.
2. SRC edit by comparing the character variable
3. same as 2.
4. SRC edit incrementing the character variable

Jey can you share the full script of this? that would be appreciated.

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  5
  • Topics Per Day:  0.00
  • Content Count:  249
  • Reputation:   72
  • Joined:  10/20/12
  • Last Seen:  

It should be the full script, not sure if I missed anything.

But it's non applicable on the current rathena version. Unfortunately I'm pretty lazy in terms of updating diffs, therefore I'd like delay that work until we got a proper plugin system. Everyone who wants to use it before that  should be able to get it done with the "instructions" above.

Edited by Jey
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...