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

Reply
 
Thread Tools Display Modes
  #1  
Old 01-24-2011, 02:08 PM
bad_captain
Developer
 
Join Date: Feb 2009
Location: Cincinnati, OH
Posts: 512
Default

Thanks and you're welcome.

Here some fixes. All are against Rev1834, which shouldn't matter except for mob.cpp.
1- I fixed the stat caps issue noted, and now should display the correct stats at all times.
2- Removed doubling up of mana from items and spells. (Missed this before somehow)
3- Fixed a mess up in how the last patch was applied to bot spells ai (the change for getting a nuke was applied to get fast heal).
4- Changed ShowStats to display the correct amount for ATK for bots. All other stats should be correct.


bot.h
Code:
Index: bot.h
===================================================================
--- bot.h		(revision 1834)
+++ bot.h		(working copy)

@@ -155,6 +155,19 @@
 	inline virtual sint16  GetMaxCR();
 	inline virtual sint16  GetMaxFR();
 	inline virtual sint16  GetMaxCorrup();
+	sint16  CalcSTR();
+	sint16  CalcSTA();
+	sint16  CalcDEX();
+	sint16  CalcAGI();
+	sint16  CalcINT();
+	sint16  CalcWIS();
+	sint16  CalcCHA();
+    sint16	CalcMR();
+	sint16	CalcFR();
+	sint16	CalcDR();
+	sint16	CalcPR();
+	sint16	CalcCR();
+	sint16	CalcCorrup();
 	sint32  CalcHPRegenCap();
 	sint32 	CalcManaRegenCap();
 	sint32	LevelRegen();
@@ -290,20 +303,20 @@
 	bool IsBotCaster() { return (GetClass() == CLERIC || GetClass() == DRUID || GetClass() == SHAMAN || GetClass() == NECROMANCER || GetClass() == WIZARD || GetClass() == MAGICIAN || GetClass() == ENCHANTER); }
 	bool IsBotINTCaster() { return (GetClass() == NECROMANCER || GetClass() == WIZARD || GetClass() == MAGICIAN || GetClass() == ENCHANTER); }
 	bool IsBotWISCaster() { return (GetClass() == CLERIC || GetClass() == DRUID || GetClass() == SHAMAN); }
-	inline virtual sint16 GetAC()	{ return AC; }
-	inline virtual sint16 GetSTR(); 
-	inline virtual sint16 GetSTA(); 
-	inline virtual sint16 GetDEX(); 
-	inline virtual sint16 GetAGI(); 
-	inline virtual sint16 GetINT(); 
-	inline virtual sint16 GetWIS(); 
-	inline virtual sint16 GetCHA(); 
-	inline virtual sint16 GetMR(); 
-	inline virtual sint16 GetFR(); 
-	inline virtual sint16 GetDR(); 
-	inline virtual sint16 GetPR(); 
-	inline virtual sint16 GetCR(); 
-	inline virtual sint16 GetCorrup();
+	inline virtual sint16	GetAC()	{ return AC; }
+	inline virtual sint16	GetSTR()	const { return STR; }
+	inline virtual sint16	GetSTA()	const { return STA; }
+	inline virtual sint16	GetDEX()	const { return DEX; }
+	inline virtual sint16	GetAGI()	const { return AGI; }
+	inline virtual sint16	GetINT()	const { return INT; }
+	inline virtual sint16	GetWIS()	const { return WIS; }
+	inline virtual sint16	GetCHA()	const { return CHA; }
+	inline virtual sint16	GetMR()	const { return MR; }
+	inline virtual sint16	GetFR()	const { return FR; }
+	inline virtual sint16	GetDR()	const { return DR; }
+	inline virtual sint16	GetPR()	const { return PR; }
+	inline virtual sint16	GetCR()	const { return CR; }
+	inline virtual sint16	GetCorrup()	const { return Corrup; }
 	//Heroic
 	inline virtual sint16	GetHeroicSTR()	const { return itembonuses.HeroicSTR; }
 	inline virtual sint16	GetHeroicSTA()	const { return itembonuses.HeroicSTA; }


bot.cpp
Code:
Index: bot.cpp
===================================================================
--- bot.cpp		(revision 1834)
+++ bot.cpp		(working copy)

@@ -447,7 +447,7 @@
 				PoisonResist += 4;
 				DiseaseResist += 4;
 				break;
-			case 6: // DiseaseResistuid
+			case 6: // Druid
 				BotSpellID = 707;
 				Stamina += 15;
 				Wisdom += 35;
@@ -483,7 +483,7 @@
 				Charisma += 10;
 				Attack += 28;
 				break;
-			case 11: // NeColdResistomancer
+			case 11: // Necromancer
 				BotSpellID = 703;
 				Dexterity += 10;
 				Agility += 10;
@@ -8534,7 +8534,6 @@
 					bot_mana = (((5 * (MindFactor + 200)) / 2) * 3 * GetLevel() / 100);
 				}
 			}
-			bot_mana += (itembonuses.Mana + spellbonuses.Mana);
 			break;
 
 		case 'W':
@@ -8578,7 +8577,6 @@
 					bot_mana = (((5 * (MindFactor + 200)) / 2) * 3 * GetLevel() / 100);
 				}
 			}
-			bot_mana += (itembonuses.Mana + spellbonuses.Mana);
 			break;
 
 		default:
@@ -8714,7 +8712,28 @@
 }
 
 void Bot::CalcBonuses() {
+	GenerateBaseStats();
+	CalcItemBonuses();
 	CalcSpellBonuses(&spellbonuses);
+	GenerateAABonuses();
+
+	CalcSTR();
+	CalcSTA();
+	CalcDEX();
+	CalcAGI();
+	CalcINT();
+	CalcWIS();
+	CalcCHA();
+	
+	CalcMR();
+	CalcFR();
+	CalcDR();
+	CalcPR();
+	CalcCR();
+	CalcCorrup();
+
+	GenerateArmorClass();
+
 	CalcMaxHP();
 	CalcMaxMana();
 	hp_regen = CalcHPRegen();
@@ -8907,122 +8926,228 @@
 		+ spellbonuses.CorrupCapMod;
 }
 
-sint16	Bot::GetSTR() { 
-	sint16 max = GetMaxSTR();
+sint16 Bot::CalcSTR() {
 	sint16 val = STR + itembonuses.STR + spellbonuses.STR;
+	
+	//sint16 mod = aabonuses.STR;
+	
+	if(val>255 && GetLevel() <= 60)
+		val = 255;
+	//STR = val + mod;
+	STR = val;
+	
+	if(STR < 1)
+		STR = 1;
 
-	if(val > max)
-		val = max;
+	int m = GetMaxSTR();
+	if(STR > m)
+		STR = m;
+	
+	return(STR);
+}
 
-	return val; 
-}
-sint16	Bot::GetSTA() { 
-	sint16 max = GetMaxSTA();
+sint16 Bot::CalcSTA() {
 	sint16 val = STA + itembonuses.STA + spellbonuses.STA;
- 
-	if(val > max)
-		val = max;
+	
+	//sint16 mod = aabonuses.STA;
+	
+	if(val>255 && GetLevel() <= 60)
+		val = 255;
+	//STA = val + mod;
+	STA = val;
+	
+	if(STA < 1)
+		STA = 1;
 
-	return val; 
+	int m = GetMaxSTA();
+	if(STA > m)
+		STA = m;
+	
+	return(STA);
 }
-sint16	Bot::GetDEX() { 
-	sint16 max = GetMaxDEX();
-	sint16 val = DEX + itembonuses.DEX + spellbonuses.DEX;
 
-	if(val > max)
-		val = max;
+sint16 Bot::CalcAGI() {
+	sint16 val = AGI + itembonuses.AGI + spellbonuses.AGI;
+	//sint16 mod = aabonuses.AGI;
 
-	return val; 
+	if(val>255 && GetLevel() <= 60)
+		val = 255;
+
+	//AGI = val + mod;
+	AGI = val;
+
+	if(AGI < 1)
+		AGI = 1;
+
+	int m = GetMaxAGI();
+	if(AGI > m)
+		AGI = m;
+	
+	return(AGI);
 }
-sint16	Bot::GetAGI() { 
-	sint16 max = GetMaxAGI();
-	sint16 val = AGI + itembonuses.AGI + spellbonuses.AGI;
- 
-	if(val > max)
-		val = max;
 
-	return val; 
+sint16 Bot::CalcDEX() {
+	sint16 val = DEX + itembonuses.DEX + spellbonuses.DEX;
+	
+	//sint16 mod = aabonuses.DEX;
+	
+	if(val>255 && GetLevel() <= 60)
+		val = 255;
+	//DEX = val + mod;
+	DEX = val;
+	
+	if(DEX < 1)
+		DEX = 1;
+
+	int m = GetMaxDEX();
+	if(DEX > m)
+		DEX = m;
+	
+	return(DEX);
 }
-sint16	Bot::GetINT() { 
-	sint16 max = GetMaxINT();
+
+sint16 Bot::CalcINT() {
 	sint16 val = INT + itembonuses.INT + spellbonuses.INT;
- 
-	if(val > max)
-		val = max;
+	
+	//sint16 mod = aabonuses.INT;
+	
+	if(val>255 && GetLevel() <= 60)
+		val = 255;
+	//INT = val + mod;
+	INT = val;
+	
+	if(INT < 1)
+		INT = 1;
 
-	return val; 
+	int m = GetMaxINT();
+	if(INT > m)
+		INT = m;
+	
+	return(INT);
 }
-sint16	Bot::GetWIS() { 
-	sint16 max = GetMaxWIS();
+
+sint16 Bot::CalcWIS() {
 	sint16 val = WIS + itembonuses.WIS + spellbonuses.WIS;
+	
+	//sint16 mod = aabonuses.WIS;
+	
+	if(val>255 && GetLevel() <= 60)
+		val = 255;
+	//WIS = val + mod;
+	WIS = val;
+	
+	if(WIS < 1)
+		WIS = 1;
 
-	if(val > max)
-		val = max;
+	int m = GetMaxWIS();
+	if(WIS > m)
+		WIS = m;
+	
+	return(WIS);
+}
 
-	return val; 
-}
-sint16	Bot::GetCHA() { 
-	sint16 max = GetMaxCHA();
+sint16 Bot::CalcCHA() {
 	sint16 val = CHA + itembonuses.CHA + spellbonuses.CHA;
- 
-	if(val > max)
-		val = max;
+	
+	//sint16 mod = aabonuses.CHA;
+	
+	if(val>255 && GetLevel() <= 60)
+		val = 255;
+	//CHA = val + mod;
+	CHA = val;
+	
+	if(CHA < 1)
+		CHA = 1;
 
-	return val; 
+	int m = GetMaxCHA();
+	if(CHA > m)
+		CHA = m;
+	
+	return(CHA);
 }
-sint16	Bot::GetMR() { 
-	sint16 max = GetMaxMR();
-	sint16 val = MR + itembonuses.MR + spellbonuses.MR;
- 
-	if(val > max)
-		val = max;
 
-	return val; 
+//The AA multipliers are set to be 5, but were 2 on WR
+//The resistant discipline which I think should be here is implemented
+//in Mob::ResistSpell
+sint16	Bot::CalcMR()
+{
+	MR += itembonuses.MR + spellbonuses.MR;
+	//MR += (GetAA(aaInnateMagicProtection) + GetAA(aaMarrsProtection))*2;
+	
+	if(MR < 1)
+		MR = 1;
+
+	if(MR > GetMaxMR())
+		MR = GetMaxMR();
+
+	return(MR);
 }
-sint16	Bot::GetFR()	{ 
-	sint16 max = GetMaxFR();
-	sint16 val = FR + itembonuses.FR + spellbonuses.FR;
 
-	if(val > max)
-		val = max;
+sint16	Bot::CalcFR()
+{
+	FR += itembonuses.FR + spellbonuses.FR;
+	//FR += (GetAA(aaInnateFireProtection) + GetAA(aaWardingofSolusek))*2;
+	
+	if(FR < 1)
+		FR = 1;
+	
+	if(FR > GetMaxFR())
+		FR = GetMaxFR();
 
-	return val; 
+	return(FR);
 }
-sint16	Bot::GetDR() { 
-	sint16 max = GetMaxDR();
-	sint16 val = DR + itembonuses.DR + spellbonuses.DR;
- 
-	if(val > max)
-		val = max;
 
-	return val; 
+sint16	Bot::CalcDR()
+{
+	DR += itembonuses.DR + spellbonuses.DR;
+	//DR += (GetAA(aaInnateDiseaseProtection) + GetAA(aaBertoxxulousGift))*2;
+	
+	if(DR < 1)
+		DR = 1;
+
+	if(DR > GetMaxDR())
+		DR = GetMaxDR();
+
+	return(DR);
 }
-sint16	Bot::GetPR() { 
-	sint16 max = GetMaxPR();
-	sint16 val = PR + itembonuses.PR + spellbonuses.PR;
 
-	if(val > max)
-		val = max;
+sint16	Bot::CalcPR()
+{
+	PR += itembonuses.PR + spellbonuses.PR;
+	//PR += (GetAA(aaInnatePoisonProtection) + GetAA(aaShroudofTheFaceless))*2;
+	
+	if(PR < 1)
+		PR = 1;
 
-	return val; 
+	if(PR > GetMaxPR())
+		PR = GetMaxPR();
+
+	return(PR);
 }
-sint16	Bot::GetCR() { 
-	sint16 max = GetMaxCR();
-	sint16 val = CR + itembonuses.CR + spellbonuses.CR;
 
-	if(val > max)
-		val = max;
+sint16	Bot::CalcCR()
+{
+	CR += itembonuses.CR + spellbonuses.CR;
+	//CR += (GetAA(aaInnateColdProtection) + GetAA(aaBlessingofEci))*2;
+	
+	if(CR < 1)
+		CR = 1;
 
-	return val; 
+	if(CR > GetMaxCR())
+		CR = GetMaxCR();
+
+	return(CR);
 }
-sint16	Bot::GetCorrup() { 
-	sint16 max = GetMaxCorrup();
-	sint16 val = Corrup + itembonuses.Corrup + spellbonuses.Corrup;
 
-	if(val > max)
-		val = max;
+sint16	Bot::CalcCorrup()
+{
+	//Corrup = Corrup + itembonuses.Corrup + spellbonuses.Corrup + aabonuses.Corrup;
+	Corrup = Corrup + itembonuses.Corrup + spellbonuses.Corrup;
+	
+	if(Corrup > GetMaxCorrup())
+		Corrup = GetMaxCorrup();
 
-	return val; 
+	return(Corrup);
 }
 
 void Bot::CalcRestState() {
@@ -9823,10 +9948,6 @@
 	if(GetBotOwner()->GetLevel() != GetLevel())
 		SetLevel(GetBotOwner()->GetLevel());
 
-	GenerateBaseStats();
-
-	GenerateAABonuses();
-
 	GenerateSpecialAttacks();
 
 	if(showtext) {
@@ -9835,22 +9956,12 @@
 		GetBotOwner()->Message(15, "Resists-- Magic: %i, Poison: %i, Fire: %i, Cold: %i, Disease: %i, Corruption: %i.",MR,PR,FR,CR,DR,Corrup);
 	}
 
-	// Let's find the items in the bot inventory
-
 	/*if(this->Save())
 		this->GetBotOwner()->CastToClient()->Message(0, "%s saved.", this->GetCleanName());
 	else
 		this->GetBotOwner()->CastToClient()->Message(13, "%s save failed!", this->GetCleanName());*/
 
-	CalcItemBonuses();
-	CalcSpellBonuses(&spellbonuses);
-	GenerateArmorClass();
-
-	CalcMaxHP();
-	CalcMaxMana();
-
-	hp_regen = CalcHPRegen();
-	mana_regen = CalcManaRegen();
+	CalcBonuses();
 	
 	AI_AddNPCSpells(this->GetBotSpellID());


botspellsai.cpp
Code:
Index: botspellsai.cpp
===================================================================
--- botspellsai.cpp		(revision 1834)
+++ botspellsai.cpp		(working copy)

@@ -889,7 +889,7 @@
 
 		for(std::list<BotSpell>::iterator botSpellListItr = botSpellList.begin(); botSpellListItr != botSpellList.end(); botSpellListItr++) {
 			// Assuming all the spells have been loaded into this list by level and in descending order
-			if(IsPureNukeSpell(botSpellListItr->SpellId) && IsDamageSpell(botSpellListItr->SpellId)) {
+			if(IsFastHealSpell(botSpellListItr->SpellId)) {
 				result.SpellId = botSpellListItr->SpellId;
 				result.SpellIndex = botSpellListItr->SpellIndex;
 				result.ManaCost = botSpellListItr->ManaCost;
@@ -1216,7 +1216,7 @@
 
 		for(std::list<BotSpell>::iterator botSpellListItr = botSpellList.begin(); botSpellListItr != botSpellList.end(); botSpellListItr++) {
 			// Assuming all the spells have been loaded into this list by level and in descending order
-			if(IsPureNukeSpell(botSpellListItr->SpellId)) {
+			if(IsPureNukeSpell(botSpellListItr->SpellId) && IsDamageSpell(botSpellListItr->SpellId)) {
 				result.SpellId = botSpellListItr->SpellId;
 				result.SpellIndex = botSpellListItr->SpellIndex;
 				result.ManaCost = botSpellListItr->ManaCost;


mob.cpp
Code:
Index: mob.cpp
===================================================================
--- mob.cpp		(revision 1834)
+++ mob.cpp		(working copy)

@@ -1040,8 +1040,12 @@
 			client->Message(0, "  HP: %i  Max HP: %i",GetHP(), GetMaxHP());
 			client->Message(0, "  Mana: %i  Max Mana: %i", GetMana(), GetMaxMana());
 		}
-	
-		client->Message(0, "  Total ATK: %i  Worn/Spell ATK (Cap %i): %i  Server Used ATK: %i", this->CastToClient()->GetTotalATK(), RuleI(Character, ItemATKCap), GetATKBonus(), attackRating);
+		if(IsBot()){
+			client->Message(0, "  Total ATK: %i  Worn/Spell ATK (Cap %i): %i", this->CastToBot()->GetATK(), RuleI(Character, ItemATKCap), GetATKBonus());
+		}
+		else{
+			client->Message(0, "  Total ATK: %i  Worn/Spell ATK (Cap %i): %i  Server Used ATK: %i", this->CastToClient()->GetTotalATK(), RuleI(Character, ItemATKCap), GetATKBonus(), attackRating);
+		}
 		client->Message(0, "  STR: %i  STA: %i  DEX: %i  AGI: %i  INT: %i  WIS: %i  CHA: %i", GetSTR(), GetSTA(), GetDEX(), GetAGI(), GetINT(), GetWIS(), GetCHA());
 		if (c)
 			client->Message(0, "  hSTR: %i  hSTA: %i  hDEX: %i  hAGI: %i  hINT: %i  hWIS: %i  hCHA: %i", c->GetHeroicSTR(), c->GetHeroicSTA(), c->GetHeroicDEX(), c->GetHeroicAGI(), c->GetHeroicINT(), c->GetHeroicWIS(), c->GetHeroicCHA());
Reply With Quote
Reply

Thread Tools
Display Modes

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:54 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