Go Back   EQEmulator Home > EQEmulator Forums > Development > Development::Feature Requests

Development::Feature Requests Post suggestions/feature requests here.

Reply
 
Thread Tools Display Modes
  #1  
Old 11-12-2004, 11:27 PM
Magoth78
Discordant
 
Join Date: Jun 2003
Posts: 345
Default PvP stats

Hello,

I'm sorry to bother you with the PvP but is it possible to add some stats when a Player kills an other Player?

How I would see that:
- New table in the DB called: PvPstats
- Fields: Pwinner (the killer's name) Pwinguild (the killer's guild) Pwinlevel (level of the winner) Plooser (the looser) Ploosguild (the looser's guild) Plooslvl(level of the looser) Nkills (number of kills).

-> When player1(guild: Goodies) kills player2(guild: Shorties), it adds an entrie in the PvPstats table:
- players1|goodies|51|players2|shorties|51|1

This way, it would become possible to make some pvp stats

Thx,
Mag
__________________
User's projects:
-- Original EMPIRE I/II and Factions! servers
-- Web GM Portal
-- EQoffline/bots
Reply With Quote
  #2  
Old 11-14-2004, 10:04 PM
Muuss
Dragon
 
Join Date: May 2003
Posts: 539
Default

This kind of implements would be nice to add for any PvP server. I m not sure of how much work it requires, but it seems than adding a simple query adding a row in a table when a player dies from another one might not be that hard. Exploiting that table from an external website, to make PvP rosters will be really valuable !
Tho, i would suggest a different table from Mag's one, instead of cumulating kills on the same record, i would just add 1 row per kill, with the date, so it could allow to make periodic stats instead of global ones!
__________________
Muuss - [PEQGC] Dobl, the ogre that counts for 2 !
http://www.vilvert.fr/page.php?id=10
Reply With Quote
  #3  
Old 08-19-2005, 12:02 AM
Magoth78
Discordant
 
Join Date: Jun 2003
Posts: 345
Default

Hello there,

I'm sorry to bump my old post but I would like to know if it would be possible to add this feature?

Thx by advance,
Mag
__________________
User's projects:
-- Original EMPIRE I/II and Factions! servers
-- Web GM Portal
-- EQoffline/bots
Reply With Quote
  #4  
Old 08-19-2005, 02:18 AM
fathernitwit
Developer
 
Join Date: Jul 2004
Posts: 773
Default

anything is possible, but its not gunna get written by the core developers right now, we have a lot of higher priorities.
Reply With Quote
  #5  
Old 08-19-2005, 05:59 PM
Magoth78
Discordant
 
Join Date: Jun 2003
Posts: 345
Default

Ok fnw, no probs.
I'll just wait then.

Mag
__________________
User's projects:
-- Original EMPIRE I/II and Factions! servers
-- Web GM Portal
-- EQoffline/bots
Reply With Quote
  #6  
Old 09-15-2005, 12:15 PM
Magoth78
Discordant
 
Join Date: Jun 2003
Posts: 345
Default

I've learned c++ and coded it, so I don't need it anymore.

It's working well even if the code might be crappy

If anyone is interested by the code changes, I can give them np.

Mag
__________________
User's projects:
-- Original EMPIRE I/II and Factions! servers
-- Web GM Portal
-- EQoffline/bots
Reply With Quote
  #7  
Old 09-15-2005, 12:27 PM
Dr Zauis's Avatar
Dr Zauis
I know how to fix that!
 
Join Date: May 2005
Posts: 447
Default

"I've learned c++ and coded it, so I don't need it anymore."

Well Hello Albert Einstein! That was quick learning!
__________________
Server_Op: ForbiddenZone
Reply With Quote
  #8  
Old 09-15-2005, 12:28 PM
vRandom
Sarnak
 
Join Date: Jun 2005
Posts: 91
Default

I would be interested in seeing the code. I'm curious if maybe it could be modified to count all kills a player does that way we could make a site similar to eq2's player profiling... number kills each player did, and what not...

just an idea...

vRandom
Reply With Quote
  #9  
Old 09-15-2005, 08:29 PM
Magoth78
Discordant
 
Join Date: Jun 2003
Posts: 345
Default

Quote:
Originally Posted by Dr Zauis
"I've learned c++ and coded it, so I don't need it anymore."

Well Hello Albert Einstein! That was quick learning!

Quick yeah, but i dunno about how good is the code

Vrandom, once a player kills an other player , it add an entrie in the pvpstats table, in that way:
killID|Killername|killerlevel|killerguild|Looserna me|Looserlevel|Looserguild|PvPpoints|Timestamp

So you can see (using php by example):
- Daily, Weekly, Monthly: who is the best killer, which's the best guild, how many kills does have a player, who is the best target of a player, etc...
Also pvppoints are calculated depending of the levels and it also works for group kills.


Once I'll get to home, I'll show the code i've made.

Mag
__________________
User's projects:
-- Original EMPIRE I/II and Factions! servers
-- Web GM Portal
-- EQoffline/bots

Last edited by Magoth78; 09-16-2005 at 04:50 AM..
Reply With Quote
  #10  
Old 09-15-2005, 11:06 PM
Magoth78
Discordant
 
Join Date: Jun 2003
Posts: 345
Default

Last line of database.cpp
Code:
bool Database::UpdatePVPPoints(const char* killername, int klevel, int kguildid, const char* loosername, int llevel, int lguildid, int pvppoints)
{
	// debug
	printf("Starting the update...\n");
	// end debug
	char errbuf[MYSQL_ERRMSG_SIZE];
    char *query = 0;
	int32	affected_rows = 0;
	//printf("Variables ok...\n");
	if (!RunQuery(query, MakeAnyLenString(&query, 
		"INSERT INTO pvpstats (killername,klevel,kguildid,loosername,llevel,lguildid,pvppoints) VALUES ('%s','%i','%i','%s','%i','%i','%i')",killername,klevel,kguildid,loosername,llevel,lguildid,pvppoints),
		errbuf, 0, &affected_rows)); {
			//printf("Error Updating the points......\n");
		safe_delete_array(query);
		return false;
		}
	//printf("UpdatePVPPoints: %s,%i,%i,%s,%i,%i,%i\n",killername,klevel,kguildid,loosername,llevel,lguildid,pvppoints);
	safe_delete_array(query);
	return true;
}

add this in database.h:
Code:
bool UpdatePVPPoints(const char* killername, int klevel, int kguildid, const char* loosername, int llevel, int lguildid, int pvppoints);
and in attack.cpp just after the lines:
Code:
//		if(!IsLD())//Todo: make it so an LDed client leaves corpse if its enabled
//			MakeCorpse(exploss);
add this:
Code:
if(GetGM() || !IsBecomeNPC() && other != NULL && other->IsClient())
 // added GetGM() for debug purposes
	{
			const char* killername = other->GetName();
			int klevel = other->GetLevel();
			int kguildid = other->CastToClient()->GuildDBID();
			const char* loosername = this->GetName();
			int llevel = this->GetLevel();
			int lguildid = this->CastToClient()->GuildDBID();
			int pvppoints;
			int diflevel = klevel - llevel;
			
			if(diflevel >= 10)
				pvppoints = 10;

			if(diflevel < 10 && diflevel >= 7)
				pvppoints = 25;

			if(diflevel < 7 && diflevel >= 4)
				pvppoints = 40;

			if(diflevel < 4 && diflevel >= 1)
				pvppoints = 50;
				
			if(diflevel == 0)
				pvppoints = 60;

			if(diflevel <= -1 && diflevel > -4 )
				pvppoints = 80;

			if(diflevel <= -4 && diflevel > -7)
				pvppoints = 100;

			if(diflevel < -7)
				pvppoints = 120;

			if(kguildid == NULL){
				kguildid = 0;
			}
			if(lguildid == NULL){
				lguildid = 0;
			}
			//// let's calcul points of the group

				if(other->CastToClient()->IsGrouped()) {
					Group* group = entity_list.GetGroupByClient(other->CastToClient());
						for(int i=0;i<MAX_GROUP_MEMBERS;i++) {
								if(group->members[i] != NULL) {
									Client* c = group->members[i]->CastToClient();
									pvppoints = llevel / 4;
									c->Message(0,"You have gained %i points in this fight!",pvppoints);
									database.UpdatePVPPoints(c->GetName(),c->GetLevel(),c->GuildDBID(),loosername,llevel,lguildid,pvppoints);
								}
							}
						}
		
				else{
						printf("Variables: killername = %s, klevel = %i, kguildid = %i, loosername = %s, llevel = %i, lguildid = %i, pvppoints = %i\n",
						killername,klevel,kguildid,loosername,llevel,lguildid,pvppoints);

						database.UpdatePVPPoints(killername,klevel,kguildid,loosername,llevel,lguildid,pvppoints);
						//LogFile->write(EQEMuLog::Error, "%i,%i,%i,%s,%i,%i,%i"), killerid,klevel,kguildid,looserid,llevel,lguildid,pvppoints;
						other->CastToClient()->Message(0,"You have gained %i points in this fight!",pvppoints);
						printf("PVP: %s has been killed by %s\n",loosername,killername);
						//this->CastToClient()->Message(0,"You have been killed by an enemy. Xp lost!");
				    }
			

			
	}
yes I know that the code is ugly, but my skills in c++ are still low


You will can notice that all pvppoints are previously declared. (it's what i wanted to do on empire). You can change them, or add a formula for the points check.

You will have to create a new table in your db called "pvpstats" with the columns: id(int(11)auto_increment), killername(varchar(64)),klevel(int(11)),kguilid(in t(11)),loosername(varchar(64)),llevel(int(11)),lgu ildid(int(11)),pvppoints(int(11)),date(timestamp(C URRENT_TIMESTAMP on update CURRENT_TIMESTAMP)).


Mag
__________________
User's projects:
-- Original EMPIRE I/II and Factions! servers
-- Web GM Portal
-- EQoffline/bots

Last edited by Magoth78; 09-16-2005 at 07:09 AM..
Reply With Quote
  #11  
Old 09-16-2005, 04:00 AM
vRandom
Sarnak
 
Join Date: Jun 2005
Posts: 91
Default

Quote:
Originally Posted by Magoth78
Last line of database.cpp

yes I know that the code is ugly, but my skills in c++ are still low

Mag
np, my c++ skills are, humm, below that low you used, i just have a nack in figuring things out

Thanks for sharing, I'll see what I come up with later, got called to the office :( I hate the office....

Good job on the code Mag.
vRandom
Reply With Quote
  #12  
Old 09-16-2005, 05:31 AM
cavedude's Avatar
cavedude
The PEQ Dude
 
Join Date: Apr 2003
Location: -
Posts: 1,988
Default

OT but I bet my office is worse than yours :P One of my users somehow removed the root user from their Linux server. I told them not use root. I told them they would break it.... LOL
Reply With Quote
  #13  
Old 09-16-2005, 05:43 AM
vRandom
Sarnak
 
Join Date: Jun 2005
Posts: 91
Default

Quote:
Originally Posted by cavedude
OT but I bet my office is worse than yours :P One of my users somehow removed the root user from their Linux server. I told them not use root. I told them they would break it.... LOL
LMAO, I totaly understand that one... my user did rm -fr in the root dir because it had to much stuff in it..... /sigh

vRandom
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

   

All times are GMT -4. The time now is 04:36 PM.


 

Everquest is a registered trademark of Daybreak Game Company LLC.
EQEmulator is not associated or affiliated in any way with Daybreak Game Company LLC.
Except where otherwise noted, this site is licensed under a Creative Commons License.
       
Powered by vBulletin®, Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Template by Bluepearl Design and vBulletin Templates - Ver3.3