Go Back   EQEmulator Home > EQEmulator Forums > Development > Development::Server Code Submissions

Reply
 
Thread Tools Display Modes
  #1  
Old 11-08-2010, 11:37 AM
bad_captain
Developer
 
Join Date: Feb 2009
Location: Cincinnati, OH
Posts: 512
Default Bot SoD+ fixes - HP/Mana Calcs & inventory item link

I have made some fixed for bots for clients who use SoD+.
1- HP calcs will use the new SoD hp formulas
2- Mana calcs will use the new SoD mana formulas
3- #inventory list command will show correct link for SoD (SoF changed the item link code, but was not updated for newer clients). This now checks for >= SoFClient

These new formulas should only be used for bot owners who are using the SoD client. Older clients should continue to use the old formulas. Endurance is not calculated or used by bots, so the new endurance formula was not added.

My apologies for the strange bot.cpp diff. With the way I copied and pasted the code from the client functions, it splits up the adding and subtracting lines so it's not too obvious where the additions are. Because of this, I will post the full functions at the end for ease of copy and paste if that method is preferred.

bot.h
Code:
--- EQEmuServer\zone\bot.h	(revision 1713)
+++ C:\EqEmuSource\EQEmuServer\zone\bot.h	Mon Nov  1 23:43:23 2010
@@ -119,6 +119,7 @@
 	virtual sint32 CheckHealAggroAmount(int16 spellid, int32 heal_possible = 0);
 	virtual sint32 CalcMaxMana();
 	virtual void SetAttackTimer();
+	int32 GetClassHPFactor();
 	virtual sint32 CalcMaxHP();
 	bool DoFinishedSpellAETarget(int16 spell_id, Mob* spellTarget, int16 slot, bool &stopLogic);
 	bool DoFinishedSpellSingleTarget(int16 spell_id, Mob* spellTarget, int16 slot, bool &stopLogic);
bot.cpp
Code:
--- EQEmuServer\zone\bot.cpp	(revision 1713)
+++ C:\EqEmuSource\EQEmuServer\zone\bot.cpp	Wed Nov  3 20:57:46 2010
@@ -804,16 +804,46 @@
 				break;
 	}
 	int16 lm = multiplier;*/
+	int new_base_hp = 0;
 	int16 lm = GetClassLevelFactor();
 	int16 Post255;
 
-	if((this->GetSTA()-255)/2 > 0)
-		Post255 = (this->GetSTA()-255)/2;
-	else
-		Post255 = 0;
+	Client* c = this->GetOwner()->CastToClient();
+	if(c && c->GetClientVersion() >= EQClientSoD && RuleB(Character, SoDClientUseSoDHPManaEnd)) {
+		float SoDPost255;
+		int16 NormalSTA = GetSTA();
 
-	int new_base_hp = (5)+(GetLevel()*lm/10) + (((this->GetSTA()-Post255)*GetLevel()*lm/3000)) + ((Post255*1)*lm/6000);
+		if(((NormalSTA - 255) / 2) > 0)
+			SoDPost255 = ((NormalSTA - 255) / 2);
+		else
+			SoDPost255 = 0;
 
+		int hp_factor = GetClassHPFactor();
+		
+		if (level < 41) {
+			new_base_hp = (5 + (GetLevel() * hp_factor / 12) + 
+				((NormalSTA - SoDPost255) * GetLevel() * hp_factor / 3600));
+		}
+		else if (level < 81) {
+			new_base_hp = (5 + (40 * hp_factor / 12) + ((GetLevel() - 40) * hp_factor / 6) + 
+				((NormalSTA - SoDPost255) * hp_factor / 90) + 
+				((NormalSTA - SoDPost255) * (GetLevel() - 40) * hp_factor / 1800));
+		}
+		else { 
+			new_base_hp = (5 + (80 * hp_factor / 8) + ((GetLevel() - 80) * hp_factor / 10) + 
+				((NormalSTA - SoDPost255) * hp_factor / 90) + 
+				((NormalSTA - SoDPost255) * hp_factor / 45));
+		}
+	}
+	else{
+		if((this->GetSTA()-255)/2 > 0)
+			Post255 = (this->GetSTA()-255)/2;
+		else
+			Post255 = 0;
+
+		new_base_hp = (5)+(GetLevel()*lm/10) + (((this->GetSTA()-Post255)*GetLevel()*lm/3000)) + ((Post255*1)*lm/6000);
+	}
+
 	this->base_hp = new_base_hp;
 	this->cur_hp = this->base_hp;
 }
@@ -7113,41 +7143,100 @@
 sint32 Bot::CalcMaxMana() {
 	sint32 WisInt = 0;
 	sint32 MindLesserFactor, MindFactor;
+	int wisint_mana = 0;
+	int base_mana = 0;
+	int ConvertedWisInt = 0;
+	Client* c = this->GetOwner()->CastToClient();
 	switch (GetCasterClass()) {
 		case 'I':
 			WisInt = GetINT();
-			if((( WisInt - 199 ) / 2) > 0) {
-				MindLesserFactor = ( WisInt - 199 ) / 2;
+			if (c && c->GetClientVersion() >= EQClientSoD && RuleB(Character, SoDClientUseSoDHPManaEnd)) {
+				if (WisInt > 100) {
+					ConvertedWisInt = (((WisInt - 100) * 5 / 2) + 100);
+					if (WisInt > 201) {
+						ConvertedWisInt -= ((WisInt - 201) * 5 / 4);
+					}
+				}
+				else {
+					ConvertedWisInt = WisInt;
+				}
+				if (GetLevel() < 41) { 
+					wisint_mana = (GetLevel() * 75 * ConvertedWisInt / 1000);
+					base_mana = (GetLevel() * 15);
+				}
+				else if (GetLevel() < 81) {
+					wisint_mana = ((3 * ConvertedWisInt) + ((GetLevel() - 40) * 15 * ConvertedWisInt / 100));
+					base_mana = (600 + ((GetLevel() - 40) * 30));
+				}
+				else {
+					wisint_mana = (9 * ConvertedWisInt);
+					base_mana = (1800 + ((GetLevel() - 80) * 18));
+				}
+				max_mana = base_mana + wisint_mana;
+				max_mana += (itembonuses.Mana + spellbonuses.Mana);
 			}
-			else {
-				MindLesserFactor = 0;
+			else{
+				if((( WisInt - 199 ) / 2) > 0) {
+					MindLesserFactor = ( WisInt - 199 ) / 2;
+				}
+				else {
+					MindLesserFactor = 0;
+				}
+				MindFactor = WisInt - MindLesserFactor;
+				if(WisInt > 100) {
+					max_mana = (((5 * (MindFactor + 20)) / 2) * 3 * GetLevel() / 40);
+				}
+				else {
+					max_mana = (((5 * (MindFactor + 200)) / 2) * 3 * GetLevel() / 100);
+				}
+				max_mana += (itembonuses.Mana + spellbonuses.Mana);
 			}
-			MindFactor = WisInt - MindLesserFactor;
-			if(WisInt > 100) {
-				max_mana = (((5 * (MindFactor + 20)) / 2) * 3 * GetLevel() / 40);
-			}
-			else {
-				max_mana = (((5 * (MindFactor + 200)) / 2) * 3 * GetLevel() / 100);
-			}
-			max_mana += (itembonuses.Mana + spellbonuses.Mana);
 			break;
 
 		case 'W':
 			WisInt = GetWIS();
-			if((( WisInt - 199 ) / 2) > 0) {
-				MindLesserFactor = ( WisInt - 199 ) / 2;
+			if (c && c->GetClientVersion() >= EQClientSoD && RuleB(Character, SoDClientUseSoDHPManaEnd)) {
+				if (WisInt > 100) {
+					ConvertedWisInt = (((WisInt - 100) * 5 / 2) + 100);
+					if (WisInt > 201) {
+						ConvertedWisInt -= ((WisInt - 201) * 5 / 4);
+					}
+				}
+				else {
+					ConvertedWisInt = WisInt;
+				}
+
+				if (GetLevel() < 41) { 
+					wisint_mana = (GetLevel() * 75 * ConvertedWisInt / 1000);
+					base_mana = (GetLevel() * 15);
+				}
+				else if (GetLevel() < 81) {
+					wisint_mana = ((3 * ConvertedWisInt) + ((GetLevel() - 40) * 15 * ConvertedWisInt / 100));
+					base_mana = (600 + ((GetLevel() - 40) * 30));
+				}
+				else {
+					wisint_mana = (9 * ConvertedWisInt);
+					base_mana = (1800 + ((GetLevel() - 80) * 18));
+				}
+				max_mana = base_mana + wisint_mana;
+				max_mana += (itembonuses.Mana + spellbonuses.Mana);
 			}
-			else {
-				MindLesserFactor = 0;
+			else{
+				if((( WisInt - 199 ) / 2) > 0) {
+					MindLesserFactor = ( WisInt - 199 ) / 2;
+				}
+				else {
+					MindLesserFactor = 0;
+				}
+				MindFactor = WisInt - MindLesserFactor;
+				if(WisInt > 100) {
+					max_mana = (((5 * (MindFactor + 20)) / 2) * 3 * GetLevel() / 40);
+				}
+				else {
+					max_mana = (((5 * (MindFactor + 200)) / 2) * 3 * GetLevel() / 100);
+				}
+				max_mana += (itembonuses.Mana + spellbonuses.Mana);
 			}
-			MindFactor = WisInt - MindLesserFactor;
-			if(WisInt > 100) {
-				max_mana = (((5 * (MindFactor + 20)) / 2) * 3 * GetLevel() / 40);
-			}
-			else {
-				max_mana = (((5 * (MindFactor + 200)) / 2) * 3 * GetLevel() / 100);
-			}
-			max_mana += (itembonuses.Mana + spellbonuses.Mana);
 			break;
 
 		default:
@@ -8015,40 +8104,98 @@
 	sint32 bot_mana = 0;
 	sint32 WisInt = 0;
 	sint32 MindLesserFactor, MindFactor;
+	int wisint_mana = 0;
+	int base_mana = 0;
+	int ConvertedWisInt = 0;
+	Client* c = this->GetOwner()->CastToClient();
+
 	switch (GetCasterClass()) {
 		case 'I':
 			WisInt = INT;
-			if((( WisInt - 199 ) / 2) > 0) {
-				MindLesserFactor = ( WisInt - 199 ) / 2;
+			if (c && c->GetClientVersion() >= EQClientSoD && RuleB(Character, SoDClientUseSoDHPManaEnd)) {
+				if (WisInt > 100) {
+					ConvertedWisInt = (((WisInt - 100) * 5 / 2) + 100);
+					if (WisInt > 201) {
+						ConvertedWisInt -= ((WisInt - 201) * 5 / 4);
+					}
+				}
+				else {
+					ConvertedWisInt = WisInt;
+				}
+				if (GetLevel() < 41) { 
+					wisint_mana = (GetLevel() * 75 * ConvertedWisInt / 1000);
+					base_mana = (GetLevel() * 15);
+				}
+				else if (GetLevel() < 81) {
+					wisint_mana = ((3 * ConvertedWisInt) + ((GetLevel() - 40) * 15 * ConvertedWisInt / 100));
+					base_mana = (600 + ((GetLevel() - 40) * 30));
+				}
+				else {
+					wisint_mana = (9 * ConvertedWisInt);
+					base_mana = (1800 + ((GetLevel() - 80) * 18));
+				}
+				bot_mana = base_mana + wisint_mana;
 			}
-			else {
-				MindLesserFactor = 0;
+			else{
+				if((( WisInt - 199 ) / 2) > 0) {
+					MindLesserFactor = ( WisInt - 199 ) / 2;
+				}
+				else {
+					MindLesserFactor = 0;
+				}
+				MindFactor = WisInt - MindLesserFactor;
+				if(WisInt > 100) {
+					bot_mana = (((5 * (MindFactor + 20)) / 2) * 3 * GetLevel() / 40);
+				}
+				else {
+					bot_mana = (((5 * (MindFactor + 200)) / 2) * 3 * GetLevel() / 100);
+				}
 			}
-			MindFactor = WisInt - MindLesserFactor;
-			if(WisInt > 100) {
-				bot_mana = (((5 * (MindFactor + 20)) / 2) * 3 * GetLevel() / 40);
-			}
-			else {
-				bot_mana = (((5 * (MindFactor + 200)) / 2) * 3 * GetLevel() / 100);
-			}
+				
 			bot_mana += (itembonuses.Mana + spellbonuses.Mana);
 			break;
 
 		case 'W':
 			WisInt = WIS;
-			if((( WisInt - 199 ) / 2) > 0) {
-				MindLesserFactor = ( WisInt - 199 ) / 2;
+			if (c && c->GetClientVersion() >= EQClientSoD && RuleB(Character, SoDClientUseSoDHPManaEnd)) {
+				if (WisInt > 100) {
+					ConvertedWisInt = (((WisInt - 100) * 5 / 2) + 100);
+					if (WisInt > 201) {
+						ConvertedWisInt -= ((WisInt - 201) * 5 / 4);
+					}
+				}
+				else {
+					ConvertedWisInt = WisInt;
+				}
+				if (GetLevel() < 41) { 
+					wisint_mana = (GetLevel() * 75 * ConvertedWisInt / 1000);
+					base_mana = (GetLevel() * 15);
+				}
+				else if (GetLevel() < 81) {
+					wisint_mana = ((3 * ConvertedWisInt) + ((GetLevel() - 40) * 15 * ConvertedWisInt / 100));
+					base_mana = (600 + ((GetLevel() - 40) * 30));
+				}
+				else {
+					wisint_mana = (9 * ConvertedWisInt);
+					base_mana = (1800 + ((GetLevel() - 80) * 18));
+				}
+				bot_mana = base_mana + wisint_mana;
 			}
-			else {
-				MindLesserFactor = 0;
+			else{
+				if((( WisInt - 199 ) / 2) > 0) {
+					MindLesserFactor = ( WisInt - 199 ) / 2;
+				}
+				else {
+					MindLesserFactor = 0;
+				}
+				MindFactor = WisInt - MindLesserFactor;
+				if(WisInt > 100) {
+					bot_mana = (((5 * (MindFactor + 20)) / 2) * 3 * GetLevel() / 40);
+				}
+				else {
+					bot_mana = (((5 * (MindFactor + 200)) / 2) * 3 * GetLevel() / 100);
+				}
 			}
-			MindFactor = WisInt - MindLesserFactor;
-			if(WisInt > 100) {
-				bot_mana = (((5 * (MindFactor + 20)) / 2) * 3 * GetLevel() / 40);
-			}
-			else {
-				bot_mana = (((5 * (MindFactor + 200)) / 2) * 3 * GetLevel() / 100);
-			}
 			bot_mana += (itembonuses.Mana + spellbonuses.Mana);
 			break;
 
@@ -8187,17 +8334,93 @@
 	CalcMaxMana();
 }
 
+// This is for calculating Base HPs + STA bonus for SoD or later clients.
+int32 Bot::GetClassHPFactor() {
+
+	int factor;
+
+	// Note: Base HP factor under level 41 is equal to factor / 12, and from level 41 to 80 is factor / 6.
+	// Base HP over level 80 is factor / 10
+	// HP per STA point per level is factor / 30 for level 80+
+	// HP per STA under level 40 is the level 80 HP Per STA / 120, and for over 40 it is / 60.
+	
+	switch(GetClass())
+	{
+		case DRUID:
+		case ENCHANTER:
+		case NECROMANCER:
+		case MAGICIAN:
+		case WIZARD:
+			factor = 240;
+			break;
+		case BEASTLORD:
+		case BERSERKER:
+		case MONK:
+		case ROGUE:
+		case SHAMAN:
+			factor = 255;
+			break;
+		case BARD:
+		case CLERIC:
+			factor = 264;
+			break;
+		case SHADOWKNIGHT:
+		case PALADIN:
+			factor = 288;
+			break;
+		case RANGER:
+			factor = 276;
+			break;
+		case WARRIOR:
+			factor = 300;
+			break;
+		default:
+			factor = 240;
+			break;
+	}
+	return factor;
+}
+
 sint32 Bot::CalcMaxHP() {
-	int16 Post255 = 0;
 	sint32 bot_hp = 0;
-	int16 lm = GetClassLevelFactor();
+	Client* c = this->GetOwner()->CastToClient();
+	if(c && c->GetClientVersion() >= EQClientSoD && RuleB(Character, SoDClientUseSoDHPManaEnd)) {
+		float SoDPost255;
+		int16 NormalSTA = GetSTA();
 
-	if((STA-255)/2 > 0)
-		Post255 = (STA-255)/2;
-	else
-		Post255 = 0;
+		if(((NormalSTA - 255) / 2) > 0)
+			SoDPost255 = ((NormalSTA - 255) / 2);
+		else
+			SoDPost255 = 0;
 
-	bot_hp = (5)+(GetLevel()*lm/10) + (((STA-Post255)*GetLevel()*lm/3000));
+		int hp_factor = GetClassHPFactor();
+		
+		if (level < 41) {
+			bot_hp = (5 + (GetLevel() * hp_factor / 12) + 
+				((NormalSTA - SoDPost255) * GetLevel() * hp_factor / 3600));
+		}
+		else if (level < 81) {
+			bot_hp = (5 + (40 * hp_factor / 12) + ((GetLevel() - 40) * hp_factor / 6) + 
+				((NormalSTA - SoDPost255) * hp_factor / 90) + 
+				((NormalSTA - SoDPost255) * (GetLevel() - 40) * hp_factor / 1800));
+		}
+		else { 
+			bot_hp = (5 + (80 * hp_factor / 8) + ((GetLevel() - 80) * hp_factor / 10) + 
+				((NormalSTA - SoDPost255) * hp_factor / 90) + 
+				((NormalSTA - SoDPost255) * hp_factor / 45));
+		}
+	}
+	else{
+		int16 Post255 = 0;
+		int16 lm = GetClassLevelFactor();
+
+		if((STA-255)/2 > 0)
+			Post255 = (STA-255)/2;
+		else
+			Post255 = 0;
+
+		bot_hp = (5)+(GetLevel()*lm/10) + (((STA-Post255)*GetLevel()*lm/3000))  + ((Post255*GetLevel())*lm/6000);
+	}
 	bot_hp += itembonuses.HP;
 	
 	// Hitpoint AA's
@@ -9358,7 +9581,7 @@
 
 					char* itemLink = 0;
 					if((i == 0) || (i == 11) || (i == 13) || (i == 14) || (i == 21)) {
-						if (c->GetClientVersion() == EQClientSoF)
+						if (c->GetClientVersion() >= EQClientSoF)
 						{
 							MakeAnyLenString(&itemLink, "%1X" "%05X" "%05X" "%05X" "%05X" "%05X" "%05X" "%1X" "%04X" "%1X" "%05X" "%08X", 
 								0,
@@ -9394,7 +9617,7 @@
 						}
 					}
 					else {
-						if (c->GetClientVersion() == EQClientSoF)
+						if (c->GetClientVersion() >= EQClientSoF)
 						{
 							MakeAnyLenString(&itemLink, "%1X" "%05X" "%05X" "%05X" "%05X" "%05X" "%05X" "%1X" "%04X" "%1X" "%05X" "%08X", 
 								0,

Now for the functions ..

NEW GetClassHPFactor (copied from client)
Code:
// This is for calculating Base HPs + STA bonus for SoD or later clients.
int32 Bot::GetClassHPFactor() {

	int factor;

	// Note: Base HP factor under level 41 is equal to factor / 12, and from level 41 to 80 is factor / 6.
	// Base HP over level 80 is factor / 10
	// HP per STA point per level is factor / 30 for level 80+
	// HP per STA under level 40 is the level 80 HP Per STA / 120, and for over 40 it is / 60.
	
	switch(GetClass())
	{
		case DRUID:
		case ENCHANTER:
		case NECROMANCER:
		case MAGICIAN:
		case WIZARD:
			factor = 240;
			break;
		case BEASTLORD:
		case BERSERKER:
		case MONK:
		case ROGUE:
		case SHAMAN:
			factor = 255;
			break;
		case BARD:
		case CLERIC:
			factor = 264;
			break;
		case SHADOWKNIGHT:
		case PALADIN:
			factor = 288;
			break;
		case RANGER:
			factor = 276;
			break;
		case WARRIOR:
			factor = 300;
			break;
		default:
			factor = 240;
			break;
	}
	return factor;
}
EDIT GenerateBaseManaPoints
Code:
void Bot::GenerateBaseManaPoints() {
	// Now, we need to calc the base mana.
	sint32 bot_mana = 0;
	sint32 WisInt = 0;
	sint32 MindLesserFactor, MindFactor;
	int wisint_mana = 0;
	int base_mana = 0;
	int ConvertedWisInt = 0;
	Client* c = this->GetOwner()->CastToClient();

	switch (GetCasterClass()) {
		case 'I':
			WisInt = INT;
			if (c && c->GetClientVersion() >= EQClientSoD && RuleB(Character, SoDClientUseSoDHPManaEnd)) {
				if (WisInt > 100) {
					ConvertedWisInt = (((WisInt - 100) * 5 / 2) + 100);
					if (WisInt > 201) {
						ConvertedWisInt -= ((WisInt - 201) * 5 / 4);
					}
				}
				else {
					ConvertedWisInt = WisInt;
				}
				if (GetLevel() < 41) { 
					wisint_mana = (GetLevel() * 75 * ConvertedWisInt / 1000);
					base_mana = (GetLevel() * 15);
				}
				else if (GetLevel() < 81) {
					wisint_mana = ((3 * ConvertedWisInt) + ((GetLevel() - 40) * 15 * ConvertedWisInt / 100));
					base_mana = (600 + ((GetLevel() - 40) * 30));
				}
				else {
					wisint_mana = (9 * ConvertedWisInt);
					base_mana = (1800 + ((GetLevel() - 80) * 18));
				}
				bot_mana = base_mana + wisint_mana;
			}
			else{
				if((( WisInt - 199 ) / 2) > 0) {
					MindLesserFactor = ( WisInt - 199 ) / 2;
				}
				else {
					MindLesserFactor = 0;
				}
				MindFactor = WisInt - MindLesserFactor;
				if(WisInt > 100) {
					bot_mana = (((5 * (MindFactor + 20)) / 2) * 3 * GetLevel() / 40);
				}
				else {
					bot_mana = (((5 * (MindFactor + 200)) / 2) * 3 * GetLevel() / 100);
				}
			}
				
			bot_mana += (itembonuses.Mana + spellbonuses.Mana);
			break;

		case 'W':
			WisInt = WIS;
			if (c && c->GetClientVersion() >= EQClientSoD && RuleB(Character, SoDClientUseSoDHPManaEnd)) {
				if (WisInt > 100) {
					ConvertedWisInt = (((WisInt - 100) * 5 / 2) + 100);
					if (WisInt > 201) {
						ConvertedWisInt -= ((WisInt - 201) * 5 / 4);
					}
				}
				else {
					ConvertedWisInt = WisInt;
				}
				if (GetLevel() < 41) { 
					wisint_mana = (GetLevel() * 75 * ConvertedWisInt / 1000);
					base_mana = (GetLevel() * 15);
				}
				else if (GetLevel() < 81) {
					wisint_mana = ((3 * ConvertedWisInt) + ((GetLevel() - 40) * 15 * ConvertedWisInt / 100));
					base_mana = (600 + ((GetLevel() - 40) * 30));
				}
				else {
					wisint_mana = (9 * ConvertedWisInt);
					base_mana = (1800 + ((GetLevel() - 80) * 18));
				}
				bot_mana = base_mana + wisint_mana;
			}
			else{
				if((( WisInt - 199 ) / 2) > 0) {
					MindLesserFactor = ( WisInt - 199 ) / 2;
				}
				else {
					MindLesserFactor = 0;
				}
				MindFactor = WisInt - MindLesserFactor;
				if(WisInt > 100) {
					bot_mana = (((5 * (MindFactor + 20)) / 2) * 3 * GetLevel() / 40);
				}
				else {
					bot_mana = (((5 * (MindFactor + 200)) / 2) * 3 * GetLevel() / 100);
				}
			}
			bot_mana += (itembonuses.Mana + spellbonuses.Mana);
			break;

		default:
			bot_mana = 0;
			break;
	}

	max_mana = cur_mana = bot_mana;
}
EDIT GenerateBaseHitPoints
Code:
void Bot::GenerateBaseHitPoints() {
	// Calc Base Hit Points
	/*int16 multiplier = 1;
	switch(this->GetClass()) {
			case WARRIOR:
				multiplier = 220;
				break;
			case DRUID:
			case CLERIC:
			case SHAMAN:
				multiplier = 150;
				break;
			case BERSERKER:
			case PALADIN:
			case SHADOWKNIGHT:
				multiplier = 210;
				break;
			case MONK:
			case BARD:
			case ROGUE:
			case BEASTLORD:
				multiplier = 180;
				break;
			case RANGER:
				multiplier = 200;
				break;
			case MAGICIAN:
			case WIZARD:
			case NECROMANCER:
			case ENCHANTER:
				multiplier = 120;
				break;
	}
	int16 lm = multiplier;*/
	int new_base_hp = 0;
	int16 lm = GetClassLevelFactor();
	int16 Post255;

	Client* c = this->GetOwner()->CastToClient();
	if(c && c->GetClientVersion() >= EQClientSoD && RuleB(Character, SoDClientUseSoDHPManaEnd)) {
		float SoDPost255;
		int16 NormalSTA = GetSTA();

		if(((NormalSTA - 255) / 2) > 0)
			SoDPost255 = ((NormalSTA - 255) / 2);
		else
			SoDPost255 = 0;

		int hp_factor = GetClassHPFactor();
		
		if (level < 41) {
			new_base_hp = (5 + (GetLevel() * hp_factor / 12) + 
				((NormalSTA - SoDPost255) * GetLevel() * hp_factor / 3600));
		}
		else if (level < 81) {
			new_base_hp = (5 + (40 * hp_factor / 12) + ((GetLevel() - 40) * hp_factor / 6) + 
				((NormalSTA - SoDPost255) * hp_factor / 90) + 
				((NormalSTA - SoDPost255) * (GetLevel() - 40) * hp_factor / 1800));
		}
		else { 
			new_base_hp = (5 + (80 * hp_factor / 8) + ((GetLevel() - 80) * hp_factor / 10) + 
				((NormalSTA - SoDPost255) * hp_factor / 90) + 
				((NormalSTA - SoDPost255) * hp_factor / 45));
		}
	}
	else{
		if((this->GetSTA()-255)/2 > 0)
			Post255 = (this->GetSTA()-255)/2;
		else
			Post255 = 0;

		new_base_hp = (5)+(GetLevel()*lm/10) + (((this->GetSTA()-Post255)*GetLevel()*lm/3000)) + ((Post255*1)*lm/6000);
	}

	this->base_hp = new_base_hp;
	this->cur_hp = this->base_hp;
}
EDIT CalcMaxMana
Code:
sint32 Bot::CalcMaxMana() {
	sint32 WisInt = 0;
	sint32 MindLesserFactor, MindFactor;
	int wisint_mana = 0;
	int base_mana = 0;
	int ConvertedWisInt = 0;
	Client* c = this->GetOwner()->CastToClient();
	switch (GetCasterClass()) {
		case 'I':
			WisInt = GetINT();
			if (c && c->GetClientVersion() >= EQClientSoD && RuleB(Character, SoDClientUseSoDHPManaEnd)) {
				if (WisInt > 100) {
					ConvertedWisInt = (((WisInt - 100) * 5 / 2) + 100);
					if (WisInt > 201) {
						ConvertedWisInt -= ((WisInt - 201) * 5 / 4);
					}
				}
				else {
					ConvertedWisInt = WisInt;
				}
				if (GetLevel() < 41) { 
					wisint_mana = (GetLevel() * 75 * ConvertedWisInt / 1000);
					base_mana = (GetLevel() * 15);
				}
				else if (GetLevel() < 81) {
					wisint_mana = ((3 * ConvertedWisInt) + ((GetLevel() - 40) * 15 * ConvertedWisInt / 100));
					base_mana = (600 + ((GetLevel() - 40) * 30));
				}
				else {
					wisint_mana = (9 * ConvertedWisInt);
					base_mana = (1800 + ((GetLevel() - 80) * 18));
				}
				max_mana = base_mana + wisint_mana;
				max_mana += (itembonuses.Mana + spellbonuses.Mana);
			}
			else{
				if((( WisInt - 199 ) / 2) > 0) {
					MindLesserFactor = ( WisInt - 199 ) / 2;
				}
				else {
					MindLesserFactor = 0;
				}
				MindFactor = WisInt - MindLesserFactor;
				if(WisInt > 100) {
					max_mana = (((5 * (MindFactor + 20)) / 2) * 3 * GetLevel() / 40);
				}
				else {
					max_mana = (((5 * (MindFactor + 200)) / 2) * 3 * GetLevel() / 100);
				}
				max_mana += (itembonuses.Mana + spellbonuses.Mana);
			}
			break;

		case 'W':
			WisInt = GetWIS();
			if (c && c->GetClientVersion() >= EQClientSoD && RuleB(Character, SoDClientUseSoDHPManaEnd)) {
				if (WisInt > 100) {
					ConvertedWisInt = (((WisInt - 100) * 5 / 2) + 100);
					if (WisInt > 201) {
						ConvertedWisInt -= ((WisInt - 201) * 5 / 4);
					}
				}
				else {
					ConvertedWisInt = WisInt;
				}

				if (GetLevel() < 41) { 
					wisint_mana = (GetLevel() * 75 * ConvertedWisInt / 1000);
					base_mana = (GetLevel() * 15);
				}
				else if (GetLevel() < 81) {
					wisint_mana = ((3 * ConvertedWisInt) + ((GetLevel() - 40) * 15 * ConvertedWisInt / 100));
					base_mana = (600 + ((GetLevel() - 40) * 30));
				}
				else {
					wisint_mana = (9 * ConvertedWisInt);
					base_mana = (1800 + ((GetLevel() - 80) * 18));
				}
				max_mana = base_mana + wisint_mana;
				max_mana += (itembonuses.Mana + spellbonuses.Mana);
			}
			else{
				if((( WisInt - 199 ) / 2) > 0) {
					MindLesserFactor = ( WisInt - 199 ) / 2;
				}
				else {
					MindLesserFactor = 0;
				}
				MindFactor = WisInt - MindLesserFactor;
				if(WisInt > 100) {
					max_mana = (((5 * (MindFactor + 20)) / 2) * 3 * GetLevel() / 40);
				}
				else {
					max_mana = (((5 * (MindFactor + 200)) / 2) * 3 * GetLevel() / 100);
				}
				max_mana += (itembonuses.Mana + spellbonuses.Mana);
			}
			break;

		default:
			max_mana = 0;
			break;
	}
	return max_mana;
}
EDIT CalcMaxHP
Code:
sint32 Bot::CalcMaxHP() {
	sint32 bot_hp = 0;
	Client* c = this->GetOwner()->CastToClient();
	if(c && c->GetClientVersion() >= EQClientSoD && RuleB(Character, SoDClientUseSoDHPManaEnd)) {
		float SoDPost255;
		int16 NormalSTA = GetSTA();

		if(((NormalSTA - 255) / 2) > 0)
			SoDPost255 = ((NormalSTA - 255) / 2);
		else
			SoDPost255 = 0;

		int hp_factor = GetClassHPFactor();
		
		if (level < 41) {
			bot_hp = (5 + (GetLevel() * hp_factor / 12) + 
				((NormalSTA - SoDPost255) * GetLevel() * hp_factor / 3600));
		}
		else if (level < 81) {
			bot_hp = (5 + (40 * hp_factor / 12) + ((GetLevel() - 40) * hp_factor / 6) + 
				((NormalSTA - SoDPost255) * hp_factor / 90) + 
				((NormalSTA - SoDPost255) * (GetLevel() - 40) * hp_factor / 1800));
		}
		else { 
			bot_hp = (5 + (80 * hp_factor / 8) + ((GetLevel() - 80) * hp_factor / 10) + 
				((NormalSTA - SoDPost255) * hp_factor / 90) + 
				((NormalSTA - SoDPost255) * hp_factor / 45));
		}
	}
	else{
		int16 Post255 = 0;
		int16 lm = GetClassLevelFactor();

		if((STA-255)/2 > 0)
			Post255 = (STA-255)/2;
		else
			Post255 = 0;

		bot_hp = (5)+(GetLevel()*lm/10) + (((STA-Post255)*GetLevel()*lm/3000))  + ((Post255*GetLevel())*lm/6000);
	}
	bot_hp += itembonuses.HP;
	
	// Hitpoint AA's
	int32 nd = 10000;
	if(GetLevel() >= 69) {
		nd += 1650;	// Planar Durablility AA 3
		if(GetClass() == WARRIOR) { // Sturdiness AA 5
			nd += 500;
		}
	}
	else if(GetLevel() >= 68) {
		nd += 1650;	// Planar Durablility AA 3
		if(GetClass() == WARRIOR) { // Sturdiness AA 4
			nd += 400;
		}
	}
	else if(GetLevel() >= 67) {
		nd += 1650;	// Planar Durablility AA 3
		if(GetClass() == WARRIOR) { // Sturdiness AA 3
			nd += 300;
		}
	}
	else if(GetLevel() >= 66) {
		nd += 1650;	// Planar Durablility AA 3
		if(GetClass() == WARRIOR) { // Sturdiness AA 2
			nd += 200;
		}
	}
	else if(GetLevel() >= 65) {
		nd += 1650;	// Planar Durablility AA 3
		if(GetClass() == WARRIOR) { // Sturdiness AA 1
			nd += 100;
		}
	}
	else if(GetLevel() >= 63) {
		nd += 1500;	// Planar Durablility AA 2
	}
	else if(GetLevel() >= 61) {
		nd += 1350;	// Planar Durablility AA 1
	}
	else if(GetLevel() >= 59) {
		nd += 1200;	// Physical Enhancememt AA 1
	}
	else if(GetLevel() >= 57) {
		nd += 1000;	// Natural Durablility AA 3
	}
	else if(GetLevel() >= 56) {
		nd += 500;	// Natural Durablility AA 2
	}
	else if(GetLevel() >= 55) {
		nd += 200;	// Natural Durablility AA 1
	}

	bot_hp = bot_hp * nd / 10000;

	bot_hp += spellbonuses.HP;

	max_hp = bot_hp;

	return max_hp;
}

Then, in ProcessBotCommands, the Inventory List command code, replace the two lines of
Code:
if (c->GetClientVersion() == EQClientSoF)
with
Code:
if (c->GetClientVersion() >= EQClientSoF)
Reply With Quote
  #2  
Old 11-15-2010, 10:32 AM
bad_captain
Developer
 
Join Date: Feb 2009
Location: Cincinnati, OH
Posts: 512
Default

Later this week, I will be posting a consolidated post with multiple fixes including this one.
Reply With Quote
Reply


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 09:43 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 - 2024, Jelsoft Enterprises Ltd.
Template by Bluepearl Design and vBulletin Templates - Ver3.3