View Single Post
  #42  
Old 10-15-2008, 05:05 AM
trevius's Avatar
trevius
Developer
 
Join Date: Aug 2006
Location: USA
Posts: 5,946
Default

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

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:evelopment since it is nearly final and not really a request anymore.
__________________
Trevazar/Trevius Owner of: Storm Haven
Everquest Emulator FAQ (Frequently Asked Questions) - Read It!

Last edited by trevius; 10-15-2008 at 01:08 PM..
Reply With Quote