View Single Post
  #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