EQEmulator Forums

EQEmulator Forums (https://www.eqemulator.org/forums/index.php)
-   Development::Development (https://www.eqemulator.org/forums/forumdisplay.php?f=590)
-   -   OOC Regen Enable/Disable (https://www.eqemulator.org/forums/showthread.php?t=26447)

trevius 10-14-2008 05:48 PM

I think we can set IsEngaged() back to the way it was before and simply add in the whipehatelist code that AndMetal posted to fix the FD issue. The IsEngaged() check being available for clients is just too useful to remove it to fix FD. I am pretty sure that the fix AndMetal posted above will correct it. I will try it out tonight along with my OOC Regen code using the old IsEngaged() check by removing the check that Congdar posted. I think that will resolve some of the issues we are having right now with other code.

trevius 10-15-2008 05:05 AM

Finally, by reverting IsEngaged() back to allowing it to work on clients, I was able to get OOC Regen working almost perfectly. The only thing that isn't currently working 100% as intended is the wait timer. And by adding the WhipeHateList() to the FD forget timer, it should fix the issues with FD as well even with IsEngaged() being reverted back. Much thanks for AndMetal, So_1337 and Congdar for figuring that stuff out :D

zone/attack.cpp in Mob::AddToHateList remove:
Code:

        if(IsClient() && !IsAIControlled())
                return;

zone/client_process.cpp, around line 626, add the RED line
Code:

        // EverHood Feign Death 2 minutes and zone forgets you
        if (forget_timer.Check()) {
                forget_timer.Disable();
                entity_list.ClearZoneFeignAggro(this);
                WhipeHateList(); //wipe the client's hate list
                Message(0,"Your enemies have forgotten you!");
        }

zone/client_process.cpp remove:
Code:

void Client::DoHPRegen() {
        sint32 normal_regen = LevelRegen();
        sint32 item_regen = itembonuses.HPRegen;
        sint32 spell_regen = spellbonuses.HPRegen;
        sint32 total_regen = normal_regen + item_regen + spell_regen;
        total_regen = (total_regen * RuleI(Character, HPRegenMultiplier)) / 100;
        SetHP(GetHP() + total_regen);
        SendHPUpdate();
}

void Client::DoManaRegen() {
        if (GetMana() >= max_mana)
                return;
        int32 level=GetLevel();
        int32 regen = 0;
        if (IsSitting() ||(GetHorseId() != 0)) {                //this should be changed so we dont med while camping, etc...
                if(HasSkill(MEDITATE)) {
                        medding = true;
                        regen = (((GetSkill(MEDITATE)/10)+(level-(level/4)))/4)+4;
                        regen += spellbonuses.ManaRegen + itembonuses.ManaRegen;
                        CheckIncreaseSkill(MEDITATE, -10);
                }
                else
                        regen = 2+spellbonuses.ManaRegen+itembonuses.ManaRegen+(level/5);
        }
        else {
                medding = false;
                regen = 2+spellbonuses.ManaRegen+itembonuses.ManaRegen+(level/5);
        }
        regen += GetAA(aaMentalClarity);
        regen += GetAA(aaBodyAndMindRejuvenation);
        regen = (regen * RuleI(Character, ManaRegenMultiplier)) / 100;
       
        SetMana(GetMana() + regen);
        SendManaUpdatePacket();
}

And replace it with this:
Code:

void Client::DoHPRegen() {
        if(GetHP() < GetMaxHP()) {  //Don't do HP regen if HPs are full
                int32 level=GetLevel();
                int32 oochpregen = 0;
                int8 oocwaittime = oocwaittime++;
                sint32 normal_regen = LevelRegen();
                sint32 item_regen = itembonuses.HPRegen;
                sint32 spell_regen = spellbonuses.HPRegen;
                sint32 total_regen = normal_regen + item_regen + spell_regen;
                if(IsEngaged()) {
                        oochpregen = 0;
                        oocwaittime = 0;
                } else {
                        if(IsCasting() && RuleB(Character, OOCRegenCastCheck)) {
                                oochpregen = 0;
                                oocwaittime = 0;
                        } else {
                                if(oocwaittime >= RuleI(Character, OOCRegenWaitTicks)) {
                                        oochpregen += GetMaxHP() * RuleI(Character, OOCHPRegen) / 100;
                                        oochpregen -= level / RuleI(Character, MaxLevel) * oochpregen * RuleI(Character, OOCRegenLevelScale) / 100;
                                        oocwaittime = RuleI(Character, OOCRegenWaitTicks);
                                }       
                        }
                }
                total_regen = ((total_regen * RuleI(Character, HPRegenMultiplier)) / 100) + oochpregen;
                SetHP(GetHP() + total_regen);
                SendHPUpdate();
        }
}

void Client::DoManaRegen() {
        if(GetMana() < GetMaxMana()) { //Don't do mana regen if mana is full
                int32 level=GetLevel();
                int32 regen = 0;
                int8 oocwaittime = oocwaittime++;
                int32 oocmanaregen = 0;
                if(IsEngaged()) {
                        oocmanaregen = 0;
                        oocwaittime = 0;
                } else {
                        if(IsCasting() && RuleB(Character, OOCRegenCastCheck)) {
                                oocmanaregen = 0;
                                oocwaittime = 0;
                        } else {
                                if(oocwaittime >= RuleI(Character, OOCRegenWaitTicks)) {
                                        oocmanaregen += GetMaxMana() * RuleI(Character, OOCManaRegen) / 100;
                                        oocmanaregen -= level / RuleI(Character, MaxLevel) * oocmanaregen * RuleI(Character, OOCRegenLevelScale) / 100;
                                        oocwaittime = RuleI(Character, OOCRegenWaitTicks);
                                }
                        }
                }
                if (IsSitting() ||(GetHorseId() != 0)) {                //this should be changed so we dont med while camping, etc...
                        if(HasSkill(MEDITATE)) {
                                medding = true;
                                regen = (((GetSkill(MEDITATE)/10)+(level-(level/4)))/4)+4;
                                regen += spellbonuses.ManaRegen + itembonuses.ManaRegen;
                                CheckIncreaseSkill(MEDITATE, -10);
                        }
                        else
                                regen = 2+spellbonuses.ManaRegen+itembonuses.ManaRegen+(level/5);
                }
                else {
                        medding = false;
                        regen = 2+spellbonuses.ManaRegen+itembonuses.ManaRegen+(level/5);
                }

                //AAs
                regen += GetAA(aaMentalClarity)
                        + GetAA(aaBodyAndMindRejuvenation)
                        + GetAA(aaExpansiveMind);

                regen = ((regen * RuleI(Character, ManaRegenMultiplier)) / 100) + oocmanaregen;
               
                SetMana(GetMana() + regen);
                SendManaUpdatePacket();
        }
}

I have tested this and once I get the wait timer working, I will add it to the SVN so anyone can enable it with the new rules or just leave it disabled as it is by default. It could actually get added as-is, but I don't think the wait timer will be that hard to fix. I am just not sure why the code I have set for it isn't working. It seems that no matter what I set the wait timer rule to, it always starts regen on the first tick after a fight is over.

If anyone knows of a reason why this shouldn't be added, please let me know!

Moved this thread to Development::Development since it is nearly final and not really a request anymore.

Derision 10-15-2008 06:09 AM

I looked at reverting the change in Mob::AddToHateList when I was looking at fixing the Flee code. I added code to Feign Death, Rogue Escape and Bard Fading Memories to wipe the clients hate list, but I found a problem, so I backed that out.

Depending on timing, you can have a situation where a mob starts to cast an offensive spell on the player, a Rogue hits 'Escape', clears it's hatelist and then the spell still lands on the player and the mob is added back to the player's hate list, even though the mob no longer hates the player.

As I say, it purely depends on the timing of a mob casting and the player hitting Escape, or Fading Memories and probably won't happen often, but it is something to be aware of.

trevius 10-15-2008 06:28 AM

It worked that way on Live too though :)

I played a rogue on live and using escape while something was casting on you would break hide/sneak and also add you back to their hate list. So unless something has changed since I played, I think that would be perfectly acceptable and intended. I am not sure even with changing how IsEngaged works that a spell being cast on you won't cause aggro after you escape or fade. It should at the very least break your hide/sneak.

Maybe you can put those changes back in unless someone else thinks it should work any differently.

Congdar 10-15-2008 08:53 AM

on Live it is like that, but is it like that here? if the spell lands after fd or fm it should break fd and fm and add to both mob and client hate lists... i think here it may only add to the clients hate list and not actually break fd and fm.

So_1337 10-15-2008 09:00 AM

That's right, Congdar. This wouldn't be an issue except for the fact that melee overflow was only occurring and pulling full zone trains based upon what was on the client's hatelist. I'd advocate putting the client hatelists back in if the issue were solved somehow, but it seems to be causing more trouble than it's worth for the time.

And yes, currently if you FD while a spell is being cast, it will hit you and nothing will happen. On Live, your FD would be broken and mobs would continue to attack you. AEs hitting you would have the same effect, they didn't have to be targeted spells.

trevius 10-15-2008 05:31 PM

If WhipeHateList() is added for escape, fading memories and FD, I think it will work exactly the way it does on live. FD won't pull full zone trains if the client hate list is wiped after they get the forgotten about you message.

The only case where I think it could still be an issue is if someone FDs and a mob walks back to it's spawn point. That is supposed to clear FD if it worked like live. But, if the issue is that the client hate list still exists when that happens, we can just add another WhipeHateList() there so it catches both player and NPC hate lists. I know I have seen the code for NPCs returning to their spawn point after they leave combat somewhere, but I can't find it atm. I will put the code here if/when I find it.

Congdar 10-15-2008 06:39 PM

I just wanted throw out a couple of thoughts I was having about this.

Do memblur spell effects have this problem? How do those spells handle the hate lists?
What other memblur, fd, fade, etc. type effects should we consider before implementing this code?

trevius 10-15-2008 06:52 PM

Actually yes, I am pretty sure Memblur spells do have this problem lol. I just happened to be looking into something else last night and noticed the effect for memblur only wiping the hate list for NPCs. Which should mean that Memblur works for the first time currently in SVN since the hate lists were removed from players. But I posted a fix for it to work (I think it should anyway) even with hate lists being added to players as well as NPCs. So, that should resolve that issue and one other Memblur issue too I hope.

http://www.eqemulator.net/forums/showthread.php?t=26528

Funny that you posted this shortly after I posted that Memblur fix lol.

Congdar 10-15-2008 07:05 PM

heh, that is funny. i don't remember reading that post, but I must have since it was making my brain itch about the same thing.

KLS 10-16-2008 06:08 AM

I have no problem bringing back hate lists for clients but:

1) If a npc loses all hate on a client the client should clear that npc from their table as well.
2) 1 can't apply if the client is computer controlled.

trevius 10-16-2008 05:30 PM

I am still trying to figure out why the wait timer setting isn't working.

So far, I have only seen 1 other issue with this that needs to be resolved before it could be submitted. For some reason heals and buffs are not causing OOC Regen to stop, so healers basically have unlimited mana in fights. I figure I can find out why in the heal aggro code.

Andrew80k 10-16-2008 05:48 PM

In live buffs don't cause you to gain agro IIRC. I'll have to verify that. Heals definitely should though.

trevius 10-16-2008 06:53 PM

I know for sure that buffs used to cause aggro when I played Live. Rune procs were one of the better aggro generators. Also, if you cast a buff on a noobie while they were killing something, you would take faction hits when it died.

It isn't really buffs that I am so worried about, it is mostly heals. But HP buffs could be used as heals, so buffs should really cause hate too.

ChaosSlayer 10-16-2008 08:03 PM

Quote:

Originally Posted by trevius (Post 158472)
I know for sure that buffs used to cause aggro when I played Live. Rune procs were one of the better aggro generators. Also, if you cast a buff on a noobie while they were killing something, you would take faction hits when it died.

It isn't really buffs that I am so worried about, it is mostly heals. But HP buffs could be used as heals, so buffs should really cause hate too.


when someone killing dervishes in comons asked my druid for SoW I always waited till they stop fighting to cast it - i valued my faction. yeah buffs should defently put you on hate list

steve 10-17-2008 03:47 AM

On Live, when my druid heals my pet, he does not get any faction hits when the mob dies. I'm not sure if this is unique to healing pets though. Always bugged me because then I need to remember to cast something on the mob to get the faction hit.

Congdar 10-17-2008 09:00 AM

Quote:

Originally Posted by steve (Post 158487)
On Live, when my druid heals my pet, he does not get any faction hits when the mob dies. I'm not sure if this is unique to healing pets though. Always bugged me because then I need to remember to cast something on the mob to get the faction hit.

Yes, my necro had to do at least one point of damage to get the faction hits while my pet defended me. I think that meant I also had to do at least one point of damage to get the exp as well.

trevius 10-18-2008 05:10 PM

Probably a big reason for pets not getting faction hits is because I remember people going AFK with a pet up at the orcs in west commons so they could get FP faction so they could trade in NFP. Free AFK faction gains was probably a large reason to remove it from pets. Though, if you are healing the pet, you aren't AFK so you should really be able to get faction IMO.

Yathozemli 01-02-2009 04:41 PM

Quote:

Originally Posted by trevius (Post 157890)
Ya, that too does sound like a fun idea! Though, I would think it would need to be a bit more complex and scale up per level, but shouldn't be too hard to figure out a simple equation. I will see if I can write a rule or 2 for Player OOC regen. Maybe having 1 for the regen amount and another for level scaling. So, you could have it regen a level 1 character to full HPs in 15 seconds, but a level 70 character might take 1 minute or something if you wanted it to scale. Of course with an option to turn both off and use normal regen rates. That should be pretty easy code to write.

I didn't read all the way through the thread, but I think if a person would like to do out of combat regens without messing with the code, they could simply create new spells to be used as a clicky that uses the make fragile effect. This way they get nice OOC regens but lose them when aggresive action is taken. Kinda like the level 10 discipline Focused Will.

Just an idea, but I think I'm going to implement this on my server.

trevius 01-03-2009 06:12 PM

Ya, that would work ok on individual servers to setup custom stuff for regen. But, that isn't exactly the point of this thread. The point is for a rule so admins can setup out of combat regen for characters. It is actually almost all complete, but I need to add IsEngaged() back to the emu for it to work properly. I would also need to work out a few minor things with aggro from healing and maybe some other stuff. Other than that, it is pretty much all ready to go. I got side-tracked working on some other stuff, so I never finished this. Hopefully I will get some time soon to get OOC regen finished.


All times are GMT -4. The time now is 12:02 AM.

Powered by vBulletin®, Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.