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

10-18-2006, 04:42 AM
|
|
Administrator
|
|
Join Date: Sep 2006
Posts: 1,348
|
|
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);
}
}
}
|
 |
|
 |
 |
|
 |

10-19-2006, 07:37 AM
|
|
Administrator
|
|
Join Date: Sep 2006
Posts: 1,348
|
|
Now some actual changes:
-Fixed the atk mlog bug, again.
-Changed how recourse works
-Made glow messages only go off for instant spells
-Changed how haste is calculated to account for caps and stacking correctly and to make sure we account for overhaste spells(ex warsong of the vahshir). Should fix one of the current dev issues with wonderous rapidity and nature's melody etc etc.
-The way hundredhands is calculated isn't correct, but I wasn't sure how to address it so I kept it the way it was implemented for now but replacing the true/false with actual effect values.
-Changed the end calculations slightly (but in a big way) GetLevel()*0.075 is added in every line to address some pretty massive rounding errors if you try to simplify it, we're talking a loss of 8-900 endurance when you get up in pop gear kinda rounding errors.
-Special Messages should be able to show a type other than 0x0A.
And svn created me a nifty little patch file
http://hmproject.org/files/haste.patch
|
 |
|
 |
 |
|
 |

10-21-2006, 03:50 PM
|
|
Administrator
|
|
Join Date: Sep 2006
Posts: 1,348
|
|
Another quick change. Did this pretty quickly so tell me if I messed any part of it up.
Dunno if it bothers anyone else as much as it bothers me but the small quickly used timers for the hard coded client skills keep bugging out on me, my sneak is down for the next 11 days according to my database for instance =(
Not sure at all what causes these short timers to bug out so I added a rule here on whether or not to enforce them, I mean do we really need to enforce them? They're hard coded into the client and it's going to be pretty rare that someone hacks into the client to change the timers, most are only a few seconds anyway.
Also threw in another rule that helps server admins modify the endurance regen since there really isn't any way to raise your regen outside of +endurance regen items, and def seems like something admins might want to change, just like an exp modifier.
new rules:
RULE_BOOL( Character, EnforceSkillTimers, false )
RULE_REAL( Character, EnduranceRegenBonus, 1.0 )
http://hmproject.org/files/timers.patch
Also would like to add that I love this rule system, it's a brilliant concept.
Last edited by KLS; 10-21-2006 at 11:53 PM..
|
 |
|
 |

10-21-2006, 04:01 PM
|
|
|
People will hack the client for the timers, trust me. Instant Back Stab for instance.
This was added in because of the amount of people that were hacking the client.
|

10-21-2006, 04:02 PM
|
|
Discordant
|
|
Join Date: May 2006
Posts: 458
|
|
I love you man!
These are some seriously bad-ass fixes. I'm gonna patch up the server and see the changes. Will report back if I see something out of the ordinary.
Keep up the awesome work!
|

10-21-2006, 05:18 PM
|
|
Administrator
|
|
Join Date: Sep 2006
Posts: 1,348
|
|
I'll look for what's happening to the shorter timers, I don't notice it happening with any of the longer ones, my disc timers for instance but it's certainly happening with some of the shorter ones kick sneak hide Feign. That's just there till I figure it out.
Edit: Alright, here's something I found with persistant timers, first I misread the timer in my database last time that led me to the rule conclusion it was really set to 0, 0. If a timer is set to duration 0, enable 0 in the database it wont count as expired, and apparently sometimes when removing timers instead of them being removed from the DB they get set to 0, 0 thus that skill is now bugged for that character(gg). Not sure of a fix yet but yeah thanks for not letting me take the lazy way out with my rule I guess.
Last edited by KLS; 10-22-2006 at 01:50 AM..
Reason: Timer stuff
|
 |
|
 |

10-21-2006, 05:55 PM
|
|
Developer
|
|
Join Date: Jul 2004
Posts: 773
|
|
overall the changes look good.
make sure you default any new rules to how they were before you added the rule... aka EnforceSkillTimers to true.
interesting about the item bonuses being counted twice... have you checked #showbuffs to see how it compares?
also in the endurance calculation, what I put in should have matched your original version here:
http://www.eqemulator.net/forums/showthread.php?t=21661
I am assuming that the int() operators in your original code were being used in place of floor()... but in any light, the 0.075 * GetLevel() in your oringinal code was outside the int(), so it should have had the same rounding effects as my code. If you are really not intending to floor() those numbers, than instead of multiplying out each time like you did, just change the variables in that function to be floats and then use max_end += bonus_sum * GetLevel()*0.075; at the end. (converting an int to a float or vise versa is generally a rather computationally expensive operation, and should be minimized)
|
 |
|
 |
 |
|
 |

10-21-2006, 06:49 PM
|
|
Administrator
|
|
Join Date: Sep 2006
Posts: 1,348
|
|
I think I've found the issues that affect timers. A timer that is not enabled and as a 0 duration will return false on get expired and never be cleared from the database, sometimes they do(I dunno why? but can we put a work around in the expired code?).
Also some of the hard coded combat skills are affected by haste clientside but not taking that into account server side. Ex just timed my backstab clientside with a stopwatch, about 8 seconds without haste 5.5 with.
The issues with get stats is it uses the Mob:: version of stats instead of Client:: we need to be very careful as a result when things can be both for clients and npcs. Get stats for instance uses the mob version and the mob version counts the item and spell bonuses twice for clients because they aren't counted at all for non clients outside of that.
I'm not sure what's with my head and the endurance sorry, I really had documented a major loss in it the other day but just went to go make sure I wasn't crazy and apparently I am, oh no =( I work too late, sorry mate, if I actually find the problem again I'll bring it back to you in excrutiating detail.
I'm editing this post way too much but yeah also I'm gonna go through and see about getting close to the actual times on the client side skills since some seem off, some by a lot(track/forage!).
Last edited by KLS; 10-22-2006 at 03:02 AM..
|
 |
|
 |
| Thread Tools |
|
|
| Display Modes |
Hybrid Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -4. The time now is 08:37 PM.
|
|
 |
|
 |
|
|
|
 |
|
 |
|
 |