Go Back   EQEmulator Home > EQEmulator Forums > Support > Support::Windows Servers

Support::Windows Servers Support forum for Windows EQEMu users.

Reply
 
Thread Tools Display Modes
  #1  
Old 02-23-2013, 07:29 PM
Zamthos
Discordant
 
Join Date: Jan 2013
Posts: 284
Default Stat Caps.

Okay, so, if you want your stats to go beyond 255 you will need the below fix or your custom stats will not work.

You'll want to have that StatCap within your database, ## is the value you wish to be the max.
Code:
INSERT INTO `rule_values` VALUES (1, 'Character:StatCap', '##', 'Stat Cap');
REPLACE client_mods.cpp:
Code:
int16 Client::GetMaxStat() const 
{

	if((RuleI(Character, StatCap)) > 0)
		return (RuleI(Character, StatCap));

	int level = GetLevel();
	
	int16 base = 0;
	
	if (level < 61) 
        {
		base = 255;
	}
	else if (GetClientVersion() >= EQClientSoF) 
        {
		base = 255 + 5 * (level - 60);
	}
	else if (level < 71) 
        {
		base = 255 + 5 * (level - 60);
	}
	else 
        {
		base = 330;
	}
	
	return(base);
}
WITH client_mods.cpp:
Code:
int16 Client::GetMaxStat() const 
{
	if((RuleI(Character, StatCap)) > 0)
	return (RuleI(Character, StatCap));
	
	int level = GetLevel();
	
	int16 base = 0;
	
	if (level < 1) 
	{
		base = 255;
	}
 
	return(base);
}
Reply With Quote
  #2  
Old 02-23-2013, 07:38 PM
Derision
Developer
 
Join Date: Feb 2004
Location: UK
Posts: 1,540
Default

If you set the rule Character:StatCap > 0, the existing function will return at this point:
Code:
if((RuleI(Character, StatCap)) > 0)
		return (RuleI(Character, StatCap));
So no source code changes are required, or am I missing something ?
Reply With Quote
  #3  
Old 02-23-2013, 07:44 PM
Zamthos
Discordant
 
Join Date: Jan 2013
Posts: 284
Default

No, not that, haha, in the first code if you're beyond level 71 your base is 330, as in your cap is 330. I'm trying to allow the StatCap to be recognized, with the current code it is overwritten and means nothing unless you make the change I have, I could take out the 'if (level < 1)' but I didn't, this is done so that any level can get the StatCap and so that the StatCap is only overwritten if you're below level 1.
Reply With Quote
  #4  
Old 02-23-2013, 07:50 PM
c0ncrete's Avatar
c0ncrete
Dragon
 
Join Date: Dec 2009
Posts: 719
Default

wat.......
__________________
I muck about @ The Forge.
say(rand 99>49?'try '.('0x'.join '',map{unpack 'H*',chr rand 256}1..2):'incoherent nonsense')while our $Noport=1;
Reply With Quote
  #5  
Old 02-23-2013, 07:50 PM
NatedogEZ's Avatar
NatedogEZ
Developer
 
Join Date: Dec 2012
Posts: 515
Default

If you are under level 61 your stats get CAPPED at 255... even with the rule
Reply With Quote
  #6  
Old 02-23-2013, 07:51 PM
c0ncrete's Avatar
c0ncrete
Dragon
 
Join Date: Dec 2009
Posts: 719
Default

not according to the code posted.
__________________
I muck about @ The Forge.
say(rand 99>49?'try '.('0x'.join '',map{unpack 'H*',chr rand 256}1..2):'incoherent nonsense')while our $Noport=1;
Reply With Quote
  #7  
Old 02-23-2013, 07:53 PM
NatedogEZ's Avatar
NatedogEZ
Developer
 
Join Date: Dec 2012
Posts: 515
Default

At level 60 I return 255 strength... at level 61 I return 3700 strength /shrug on the normal source code


I have a stat cap of 2000 and the character has 1700 heroic stats ( just a test character)
Reply With Quote
  #8  
Old 02-23-2013, 07:54 PM
Zamthos
Discordant
 
Join Date: Jan 2013
Posts: 284
Default

So, according to NatedogEZ, who has the fix, the cap is still being set to 255 even with the updated code, is there any reason for this? Does anyone have an ideas on how to fix that? I don't see an error within my code.

EDIT: So apparently when below level 61, with the update, you still get 255 as a cap.
Reply With Quote
  #9  
Old 02-23-2013, 07:57 PM
c0ncrete's Avatar
c0ncrete
Dragon
 
Join Date: Dec 2009
Posts: 719
Default

are we talking about viewed within the client or with #mystats or something else? need more input.
__________________
I muck about @ The Forge.
say(rand 99>49?'try '.('0x'.join '',map{unpack 'H*',chr rand 256}1..2):'incoherent nonsense')while our $Noport=1;
Reply With Quote
  #10  
Old 02-23-2013, 08:01 PM
NatedogEZ's Avatar
NatedogEZ
Developer
 
Join Date: Dec 2012
Posts: 515
Default

i was using perl code to check my stats
Reply With Quote
  #11  
Old 02-23-2013, 08:06 PM
Zamthos
Discordant
 
Join Date: Jan 2013
Posts: 284
Default

#Mystats with the normal code displays a 255 cap if you're level 60 or below.
Reply With Quote
  #12  
Old 02-23-2013, 08:23 PM
Maze_EQ
Demi-God
 
Join Date: Mar 2012
Posts: 1,106
Default

Publishing other people's code without crediting the writer is rude...
__________________
"No, thanks, man. I don't want you fucking up my life, too."

Skype:
Comerian1
Reply With Quote
  #13  
Old 02-23-2013, 08:24 PM
Zamthos
Discordant
 
Join Date: Jan 2013
Posts: 284
Default

The writer of what? It's an open source code, I didn't realize I had to give credit, I don't even know who the writer is. We're trying to fix a problem, not make it the way it already is.

P.S. The change is written by me if that's what you're trying to say.
Reply With Quote
  #14  
Old 02-23-2013, 08:31 PM
Zamthos
Discordant
 
Join Date: Jan 2013
Posts: 284
Default

I just stumbled upon this in the same code.

EDIT: With this new find, the first change is not necessary.

REPLACE client_mods.cpp
Code:
int16 Client::CalcSTR() {
	int16 val = m_pp.STR + itembonuses.STR + spellbonuses.STR + CalcAlcoholPhysicalEffect();
	
	int16 mod = aabonuses.STR;
	
	if(val>255 && GetLevel() <= 60)
		val = 255;
	STR = val + mod;
	
	if(STR < 1)
		STR = 1;

	int m = GetMaxSTR();
	if(STR > m)
		STR = m;
	
	return(STR);
}

int16 Client::CalcSTA() {
	int16 val = m_pp.STA + itembonuses.STA + spellbonuses.STA + CalcAlcoholPhysicalEffect();;
	
	int16 mod = aabonuses.STA;
	
	if(val>255 && GetLevel() <= 60)
		val = 255;
	STA = val + mod;
	
	if(STA < 1)
		STA = 1;

	int m = GetMaxSTA();
	if(STA > m)
		STA = m;
	
	return(STA);
}

int16 Client::CalcAGI() {
	int16 val = m_pp.AGI + itembonuses.AGI + spellbonuses.AGI - CalcAlcoholPhysicalEffect();;
	int16 mod = aabonuses.AGI;

	if(val>255 && GetLevel() <= 60)
		val = 255;

	int16 str = GetSTR();
	
	//Encumbered penalty
	if(weight > (str * 10)) {
		//AGI is halved when we double our weight, zeroed (defaults to 1) when we triple it. this includes AGI from AAs
		float total_agi = float(val + mod);
		float str_float = float(str);
		AGI = (int16)(((-total_agi) / (str_float * 2)) * (((float)weight / 10) - str_float) + total_agi);	//casting to an int assumes this will be floor'd. without using floats & casting to int16, the calculation doesn't work right
	} else
		AGI = val + mod;

	if(AGI < 1)
		AGI = 1;

	int m = GetMaxAGI();
	if(AGI > m)
		AGI = m;
	
	return(AGI);
}

int16 Client::CalcDEX() {
	int16 val = m_pp.DEX + itembonuses.DEX + spellbonuses.DEX - CalcAlcoholPhysicalEffect();;
	
	int16 mod = aabonuses.DEX;
	
	if(val>255 && GetLevel() <= 60)
		val = 255;
	DEX = val + mod;
	
	if(DEX < 1)
		DEX = 1;

	int m = GetMaxDEX();
	if(DEX > m)
		DEX = m;
	
	return(DEX);
}

int16 Client::CalcINT() {
	int16 val = m_pp.INT + itembonuses.INT + spellbonuses.INT;

	int16 mod = aabonuses.INT;
	
	if(val>255 && GetLevel() <= 60)
		val = 255;
	INT = val + mod;
	
	if(m_pp.intoxication)
	{
		int16 AlcINT  = INT - (int16)((float)m_pp.intoxication / 200.0f * (float)INT) - 1;

		if((AlcINT < (int)(0.2 * INT)))
			INT = (int)(0.2f * (float)INT);
		else
			INT = AlcINT;
	}

	if(INT < 1)
		INT = 1;

	int m = GetMaxINT();
	if(INT > m)
		INT = m;
	
	return(INT);
}

int16 Client::CalcWIS() {
	int16 val = m_pp.WIS + itembonuses.WIS + spellbonuses.WIS;
	
	int16 mod = aabonuses.WIS;
	
	if(val>255 && GetLevel() <= 60)
		val = 255;
	WIS = val + mod;

	if(m_pp.intoxication)
	{
		int16 AlcWIS  = WIS - (int16)((float)m_pp.intoxication / 200.0f * (float)WIS) - 1;

		if((AlcWIS < (int)(0.2 * WIS)))
			WIS = (int)(0.2f * (float)WIS);
		else
			WIS = AlcWIS;
	}

	if(WIS < 1)
		WIS = 1;

	int m = GetMaxWIS();
	if(WIS > m)
		WIS = m;
	
	return(WIS);
}

int16 Client::CalcCHA() {
	int16 val = m_pp.CHA + itembonuses.CHA + spellbonuses.CHA;
	
	int16 mod = aabonuses.CHA;
	
	if(val>255 && GetLevel() <= 60)
		val = 255;
	CHA = val + mod;
	
	if(CHA < 1)
		CHA = 1;

	int m = GetMaxCHA();
	if(CHA > m)
		CHA = m;
	
	return(CHA);
}
WITH client_mods.cpp:
Code:
int16 Client::CalcSTR() {
	int16 val = m_pp.STR + itembonuses.STR + spellbonuses.STR + CalcAlcoholPhysicalEffect();
	
	int16 mod = aabonuses.STR;
	
	STR = val + mod;
	
	if(STR < 1)
		STR = 1;

	int m = GetMaxSTR();
	if(STR > m)
		STR = m;
	
	return(STR);
}

int16 Client::CalcSTA() {
	int16 val = m_pp.STA + itembonuses.STA + spellbonuses.STA + CalcAlcoholPhysicalEffect();;
	
	int16 mod = aabonuses.STA;
	
	STA = val + mod;
	
	if(STA < 1)
		STA = 1;

	int m = GetMaxSTA();
	if(STA > m)
		STA = m;
	
	return(STA);
}

int16 Client::CalcAGI() {
	int16 val = m_pp.AGI + itembonuses.AGI + spellbonuses.AGI - CalcAlcoholPhysicalEffect();;
	int16 mod = aabonuses.AGI;

	int16 str = GetSTR();
	
	//Encumbered penalty
	if(weight > (str * 10)) {
		//AGI is halved when we double our weight, zeroed (defaults to 1) when we triple it. this includes AGI from AAs
		float total_agi = float(val + mod);
		float str_float = float(str);
		AGI = (int16)(((-total_agi) / (str_float * 2)) * (((float)weight / 10) - str_float) + total_agi);	//casting to an int assumes this will be floor'd. without using floats & casting to int16, the calculation doesn't work right
	} else
		AGI = val + mod;

	if(AGI < 1)
		AGI = 1;

	int m = GetMaxAGI();
	if(AGI > m)
		AGI = m;
	
	return(AGI);
}

int16 Client::CalcDEX() {
	int16 val = m_pp.DEX + itembonuses.DEX + spellbonuses.DEX - CalcAlcoholPhysicalEffect();;
	
	int16 mod = aabonuses.DEX;
	
	DEX = val + mod;
	
	if(DEX < 1)
		DEX = 1;

	int m = GetMaxDEX();
	if(DEX > m)
		DEX = m;
	
	return(DEX);
}

int16 Client::CalcINT() {
	int16 val = m_pp.INT + itembonuses.INT + spellbonuses.INT;

	int16 mod = aabonuses.INT;
	
	INT = val + mod;
	
	if(m_pp.intoxication)
	{
		int16 AlcINT  = INT - (int16)((float)m_pp.intoxication / 200.0f * (float)INT) - 1;

		if((AlcINT < (int)(0.2 * INT)))
			INT = (int)(0.2f * (float)INT);
		else
			INT = AlcINT;
	}

	if(INT < 1)
		INT = 1;

	int m = GetMaxINT();
	if(INT > m)
		INT = m;
	
	return(INT);
}

int16 Client::CalcWIS() {
	int16 val = m_pp.WIS + itembonuses.WIS + spellbonuses.WIS;
	
	int16 mod = aabonuses.WIS;
	
	WIS = val + mod;

	if(m_pp.intoxication)
	{
		int16 AlcWIS  = WIS - (int16)((float)m_pp.intoxication / 200.0f * (float)WIS) - 1;

		if((AlcWIS < (int)(0.2 * WIS)))
			WIS = (int)(0.2f * (float)WIS);
		else
			WIS = AlcWIS;
	}

	if(WIS < 1)
		WIS = 1;

	int m = GetMaxWIS();
	if(WIS > m)
		WIS = m;
	
	return(WIS);
}

int16 Client::CalcCHA() {
	int16 val = m_pp.CHA + itembonuses.CHA + spellbonuses.CHA;
	
	int16 mod = aabonuses.CHA;
	
	CHA = val + mod;
	
	if(CHA < 1)
		CHA = 1;

	int m = GetMaxCHA();
	if(CHA > m)
		CHA = m;
	
	return(CHA);
}
Reply With Quote
  #15  
Old 02-23-2013, 08:52 PM
Zamthos
Discordant
 
Join Date: Jan 2013
Posts: 284
Default

BUMP: Last fix in post before this is confirmed to work by NatedogEZ.
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 08:48 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