View Single Post
  #1  
Old 05-09-2004, 09:57 PM
bUsh
Sarnak
 
Join Date: Apr 2004
Location: Waukesha, WI
Posts: 93
Default FIX UPDATE: Group Experience & Greens

Greetings!

This fix addresses the issue of players receiving experience when killing green-conned mobs.

Please Re-Evaluate the code, couple things I had to fix

This fix emulates EQLive in three aspects:
1. Players will no longer receive experience when killing green-conned mobs if grouped.
2. Players will not receive experience if another member of the group is too high level.
3. Mobs which still con higher than green to members of the group will give experience to those members only.

in zone\groups.h - around line 46, change:
Code:
void	SplitExp(uint32 exp, int16);
to
Code:
void	SplitExp(uint32 exp, Mob* other);
in zone\groups.cpp - around line 347, replace SplitExp function with this:
Code:
void Group::SplitExp(uint32 exp, Mob* other)
{
	if( other->CastToNPC()->MerchantType == 0 )
	{
		int i;
		uint32 groupexp = exp;
		int8 membercount = 0;
		int8 maxlevel = 1;
		for (i = 0; i < MAX_GROUP_MEMBERS; i++)
		{
			if (members[i] != NULL)
			{
				if(members[i]->GetLevel() > maxlevel)
					maxlevel = members[i]->GetLevel();
				//groupexp += exp/10;
				groupexp += (uint32)(exp * zone->GetGroupEXPBonus());

				membercount++;
			}
		}

		if (membercount == 0)
			return;

		for (i = 0; i < MAX_GROUP_MEMBERS; i++)
		{
			if (members[i] != NULL && members[i]->IsClient())
    		{
				if( members[i]->GetLevelCon( other->GetLevel() ) != CON_GREEN )
				{
					// add exp + exp cap
					sint16 diff = members[i]->GetLevel() - maxlevel;
					if (diff >= -8) /*Instead of person who killed the mob, the person who has the highest level in the group*/
					{
						members[i]->CastToClient()->AddEXP(((members[i]->GetLevel()+3) * (members[i]->GetLevel()+3) * 75*3.5f < groupexp/membercount ) ? (int32)(members[i]->GetLevel() * members[i]->GetLevel() * 75*3.5f):(int32)(groupexp/membercount) );
					}
				}
			}
		}
	}
}
Finally,

in zone\attack.cpp - around line 1804, change line:
Code:
entity_list.GetGroupByClient(killer->CastToClient())->SplitExp((uint32)(level*level*75*3.5f), GetLevel() );
to this:
Code:
entity_list.GetGroupByClient(killer->CastToClient())->SplitExp((uint32)(level*level*75*3.5f), this );
You're done!
__________________
~ b [ u ] s h

* ServerOP * The Green Leaf Server
Reply With Quote