Go Back   EQEmulator Home > EQEmulator Forums > Development > Development::Server Code Submissions

Reply
 
Thread Tools Display Modes
  #1  
Old 05-10-2011, 04:00 AM
rdurbin
Fire Beetle
 
Join Date: Jan 2006
Posts: 16
Default Show XP and Group XP values

instead of it saying "You have gained experience" how about making it so it shows the exact xp you gain. Its an easy fix. I already tested it, and it works perfect. Have not made the change for raid xp yet tho. It may be better to make it a choice, like a rule in the database to show it with the actual xp or not, in case some rather it not show. I also commented out the old messages rather than remove them incase of it not working correctly.

(the text in red is the changes I have made, its only about 3 or 4 lines, minor changes)

line 187-216 of exp.cpp
Code:
SetEXP(add_exp, aaexp, resexp);
}

void Client::SetEXP(int32 add_exp, int32 set_aaxp, bool isrezzexp) {
	int32 set_exp = GetEXP() + add_exp;
	_log(CLIENT__EXP, "Attempting to Set Exp for %s (XP: %u, AAXP: %u, Rez: %s)", this->GetCleanName(), set_exp, set_aaxp, isrezzexp ? "true" : "false");
	//max_AAXP = GetEXPForLevel(52) - GetEXPForLevel(51);	//GetEXPForLevel() doesn't depend on class/race, just level, so it shouldn't change between Clients
	max_AAXP = RuleI(AA, ExpPerPoint);	//this may be redundant since we're doing this in Client::FinishConnState2()
	if (max_AAXP == 0 || GetEXPForLevel(GetLevel()) == 0xFFFFFFFF) {
		Message(13, "Error in Client::SetEXP. EXP not set.");
		return; // Must be invalid class/race
	}
	
	
	if ((set_exp + set_aaxp) > (m_pp.exp+m_pp.expAA)) {
		if (isrezzexp)
			this->Message_StringID(MT_Experience, REZ_REGAIN);
		else{
			if(this->IsGrouped())
				//this->Message_StringID(MT_Experience, GAIN_GROUPXP);
				int a=1;
			else if(IsRaidGrouped())
				Message_StringID(MT_Experience, GAIN_RAIDEXP);
			else
				//this->Message_StringID(MT_Experience, GAIN_XP);
				this->Message(15,"You have gained %u XP.", add_exp);
		}
	}
	else if((set_exp + set_aaxp) < (m_pp.exp+m_pp.expAA)){ //only loss message if you lose exp, no message if you gained/lost nothing.
		Message(15, "You have lost experience.");
line 525-541 of exp.cpp
Code:
for (i = 0; i < MAX_GROUP_MEMBERS; i++)  {
		if (members[i] != NULL && members[i]->IsClient()) // If Group Member is Client
		{
			Client *cmember = members[i]->CastToClient();
			// add exp + exp cap 
			sint16 diff = cmember->GetLevel() - maxlevel;
			sint16 maxdiff = -(cmember->GetLevel()*15/10 - cmember->GetLevel());
				if(maxdiff > -5)
					maxdiff = -5;
			if (diff >= (maxdiff)) { /*Instead of person who killed the mob, the person who has the highest level in the group*/ 				
				uint32 tmp = (cmember->GetLevel()+3) * (cmember->GetLevel()+3) * 75 * 35 / 10;
				uint32 tmp2 = groupexp / membercount;
				cmember->Message(15,"Your share of the Group XP is %u", tmp2); //Shows the amount of group XP gained (RDurbin)
				cmember->AddEXP( tmp < tmp2 ? tmp : tmp2, conlevel ); 
			} 
		} 
	}
Reply With Quote
  #2  
Old 05-10-2011, 04:44 AM
Zothen
Hill Giant
 
Join Date: Apr 2011
Location: Germany
Posts: 163
Default

Nice improvement, thanks for sharing.

But I think the change in exp.cpp isnt correct. Like in the AddExp() line, you need to refer either to tmp oder tmp2, so...

Code:
cmember->Message(15,"Your share of the Group XP is %u", (tmp < tmp2 ? tmp : tmp2) ); //Shows the amount of group XP gained (RDurbin)
EDIT: Maybe it would make more sense to show the group xp share in percent, cause you wont get the amount that is displayed. AddEXP() will change it depending on the mobs conlevel.
Reply With Quote
  #3  
Old 05-10-2011, 05:45 AM
rdurbin
Fire Beetle
 
Join Date: Jan 2006
Posts: 16
Default

thanks, it always annoyed me how it never said the real xp, even eq2 did the same until just recently. Plus its nice when your using bots to know how much xp your losing out if you go overboard.

I think its tmp 2 it sounds about right in my testing and looking at the code tmp2 is the result of bonus grp xp after being split down the line. I could very well be wrong, but comparing #s with single and with one bot seem about right. my server is doing the default bonus of .60 group xp. I dont remember the exact #s but fight an equal mob at level 1 was around 250ish (with server at 1.0 xp rate) and with a group of two you get around 205ish (grp xp bonus is 60% after all the other bonuses before you divide by 2)

Im also thinking of showing the gain in % towards level.

For example it may say "you have gained 3250 xp (25% of a level)"

would be nice to know so you know how much each kill is moving you, I dont know tho, maybe too much info...
Reply With Quote
  #4  
Old 05-10-2011, 06:01 AM
Zothen
Hill Giant
 
Join Date: Apr 2011
Location: Germany
Posts: 163
Default

tmp2 cant be right cause its just the max group xp you can get. If you display tmp2 in the message and AddEXP() uses either tmp1 or tmp2, the text wont display the correct value in most situations. Only the highest level char in group may see the right amount of xp he/she gets. The others xp is scaled depending on the level range in group.

Btw, you need to change ALL calls to SetEXP() with your altered parameter add_exp, not just the one in line 187.
Reply With Quote
  #5  
Old 05-10-2011, 06:15 AM
rdurbin
Fire Beetle
 
Join Date: Jan 2006
Posts: 16
Default

that last line was just a workaround I know its sloppy but was a quick fix originally the file passes set_exp not add_exp. what I did is made it pass add_exp instead and than put that data into set_exp. the reasoning for this is so I can display the add_exp data which is the actualy xp you get, set_exp is just the new xp total, which would not work. for example if you have 0 xp at start and kill a enemy worth 250, both set_exp and add_exp would be the same. but on the next kill it will screw up. basically it would say the next kill would be 500 xp, because its using the total xp instead of xp for last kill. So yeah it was my way to get the add_exp variable into that functions that contains the function to display the xp for that kill.

Im sure it could of been done better, like probably displaying the xp earned before you even go in the set_exp function.

Im sure the group xp thing is wrong, really I have no way to test it with people in different levels, I only tested it with chars of same level, but im 100% sure the solo xp is correct. Ill try changing group xp to what its passing, should work...

------------------------------------
EDIT:

Ok fixed the problem with the group xp, I just moved it to same place near the solo xp displaying, since they are displayed after it calculates the xp for group xp it passes through all the other modifers, including mobcolor, if your server uses that rule. to be safe i just commented the old spot group xp was in. here is the new change

(can prob show raid xp using the exact same line as well)

Code:
SetEXP(add_exp, aaexp, resexp);
}

void Client::SetEXP(int32 add_exp, int32 set_aaxp, bool isrezzexp) {
	int32 set_exp = GetEXP() + add_exp;
	_log(CLIENT__EXP, "Attempting to Set Exp for %s (XP: %u, AAXP: %u, Rez: %s)", this->GetCleanName(), set_exp, set_aaxp, isrezzexp ? "true" : "false");
	//max_AAXP = GetEXPForLevel(52) - GetEXPForLevel(51);	//GetEXPForLevel() doesn't depend on class/race, just level, so it shouldn't change between Clients
	max_AAXP = RuleI(AA, ExpPerPoint);	//this may be redundant since we're doing this in Client::FinishConnState2()
	if (max_AAXP == 0 || GetEXPForLevel(GetLevel()) == 0xFFFFFFFF) {
		Message(13, "Error in Client::SetEXP. EXP not set.");
		return; // Must be invalid class/race
	}
	
	
	if ((set_exp + set_aaxp) > (m_pp.exp+m_pp.expAA)) {
		if (isrezzexp)
			this->Message_StringID(MT_Experience, REZ_REGAIN);
		else{
			if(this->IsGrouped())
				//this->Message_StringID(MT_Experience, GAIN_GROUPXP);
				//int a=1;
				this->Message(15,"Your share of the Group XP is %u",  add_exp);
			else if(IsRaidGrouped())
				Message_StringID(MT_Experience, GAIN_RAIDEXP);
			else
				//this->Message_StringID(MT_Experience, GAIN_XP);
				this->Message(15,"You have gained %u XP.", add_exp);
		}
	}

Last edited by rdurbin; 05-10-2011 at 06:41 AM.. Reason: fixed the group xp code
Reply With Quote
  #6  
Old 05-10-2011, 09:58 AM
sorvani
Dragon
 
Join Date: May 2010
Posts: 966
Default

This would be a nice rule to add in. As a player I always liked seeing the numbers. Maybe I just play to much D&D :P
My GM toon on my test server already sees the XP when he kills something so maybe some rule could be dropped in to show that?
Reply With Quote
  #7  
Old 05-18-2011, 02:29 AM
rdurbin
Fire Beetle
 
Join Date: Jan 2006
Posts: 16
Default fixed the mistake I made, works perfect now

Guys ignore the code I posted before, it has a critical error in it, I fixed it with the code below, it also displays the amount of xp you lose and raid xp, i commented out the normal xp messages, these lines are from 207-214, apply these changes to the original exp.cpp, the xp loss message is in yellow and should probably be in red, but im not sure what message # you use for red text

LINES 207-214 of exp.cpp

Code:
if(this->IsGrouped())
				//this->Message_StringID(MT_Experience, GAIN_GROUPXP); //hides normal xp message
				this->Message(15,"You have gained %u Group XP",((set_exp+set_aaxp)-(m_pp.exp+m_pp.expAA)));//Displays grp xp
			else if(IsRaidGrouped())
				//Message_StringID(MT_Experience, GAIN_RAIDEXP); //hides normal xp message
				this->Message(15,"You have gained %u Raid XP",((set_exp+set_aaxp)-(m_pp.exp+m_pp.expAA)));//Displays raid xp
			else
				//this->Message_StringID(MT_Experience, GAIN_XP); //hides normal xp message
				this->Message(15,"You have gained %u XP",((set_exp+set_aaxp)-(m_pp.exp+m_pp.expAA)));//displays solo xp
		}
	}
	else if((set_exp + set_aaxp) < (m_pp.exp+m_pp.expAA)){ //only loss message if you lose exp, no message if you gained/lost nothing.
		//Message(15, "You have lost experience."); //hides normal loss xp message
		this->Message(15,"You have LOST %u XP",((m_pp.exp+m_pp.expAA)-(set_exp+set_aaxp))); //displays amount of xp lost
Reply With Quote
  #8  
Old 05-18-2011, 10:57 AM
Fridgecritter
Hill Giant
 
Join Date: Feb 2008
Posts: 189
Default great idea

I love this idea. I hope this is refined and implemented.
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 02:17 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