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

Development::Development Forum for development topics and for those interested in EQEMu development. (Not a support forum)

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #3  
Old 10-18-2006, 04:42 AM
KLS
Administrator
 
Join Date: Sep 2006
Posts: 1,348
Default

Code:
//Info taken from magelo, it's a *little* off but accurate enough.
void Client::CalcMaxEndurance()
{
	//"Stats" the total of (Str + Dex + Sta + Agi)
	int Stats = GetSTR()+GetSTA()+GetDEX()+GetAGI();

	//"Levelbonus" your Level * .075
	//Endurance = level * 15 plus

	//Levelbonus times the sum of the next 4 lines (this is calculated on each line, not at the end because of rounding errors otherwise)
	max_end = GetLevel() * 15;
	//plus lesser of Stats and 800, divide that by 4.
	max_end += int((Stats>800?800:Stats)/4)*0.075*GetLevel();
	//plus bigger of (lesser of Stats and 800)-400, and 0. all of that /4
	max_end += int((((Stats>800?800:Stats)-400)>0?((Stats>800?800:Stats)-400):0)/4)*(0.075*GetLevel());
	//plus bigger of (lesser of Stats and 800)-400, and 0. all of that /8
	max_end += int((((Stats>800?800:Stats)-400)>0?((Stats>800?800:Stats)-400):0)/8)*(0.075*GetLevel());
	//plus bigger of (Stats - 800 and zero) / 8
	max_end += int(((Stats-800)>0?(Stats-800):0)/8)*(0.075*GetLevel())*2;
	//plus bigger of (Stats - 800 and zero) / 16 
	max_end += int(((Stats-800)?(Stats-800):0)/16)*(0.075*GetLevel());
	//plus our endurance from items and spells.
	max_end += spellbonuses.Endurance + itembonuses.Endurance;
	//Maurice of Magelo fame explained that we can't simplify the statements 
	//because we have to round every step of the way.
}
Was two typos in the calcmaxend I made, what I get for working while tired.

The double stats comes from functions that use the Mob::Get<somestat>() that instead of return <somestat>; return <somestat> + itembonuses.<somestat> + spellbonuses.<somestat>. Not what solution there would be other than making sure code that involves clients uses client::getstat instead of mob::getstat in the code, which will probably be a little tedious given the amount of times they're referenced.

The aug thing, I'm not sure how they're serialized in the code yet so take that with a grain of salt but I confirmed when I set in the database:

augslottype1 = 0;
augslot1unk = 7;
That I created an item with an aug slot of 7 clientside, trying to apply it to an item was a little troublesome. I successfully inserted the augment into the item, however after you finish the insert the items in the pool are not deleted immediatly and attempting to remove them causes the client to crash, so obviously some work to be done there.

The glow message thing appears to work, and tested recourse; took out old recourse code and replaced it with this in spellontarget rightbelow where resists are calculated.

Code:
	if(spell_effectiveness == 100)
	{
			// Recourse means there is a spell linked to that spell in that the recourse spell will
		// be automatically casted on the casters group or the caster only depending on Targettype
		// solar: this is for things like dark empathy, shadow vortex
		int recourse_spell=0;
		recourse_spell = spells[spell_id].RecourseLink;
		if(recourse_spell)
		{
			if(spells[recourse_spell].targettype == ST_Group || spells[recourse_spell].targettype == ST_GroupTeleport)
			{
				if(IsGrouped())
				{
					Group *g = entity_list.GetGroupByMob(this);
					g->CastGroupSpell(this, recourse_spell);
				}
				else if(HasOwner())
				{
					if(GetOwner()->IsGrouped())
					{
						Group *g = entity_list.GetGroupByMob(GetOwner());
						g->CastGroupSpell(this, recourse_spell);
					}

				}
				else
				{
					SpellOnTarget(recourse_spell, this);
#ifdef GROUP_BUFF_PETS
					if (HasPet())
						SpellOnTarget(recourse_spell, GetPet());
#endif
				}	

			}
			else
			{
				SpellOnTarget(recourse_spell, this);
			}
		}
	}
Reply With Quote
 


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 11:29 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 - 2025, Jelsoft Enterprises Ltd.
Template by Bluepearl Design and vBulletin Templates - Ver3.3