|  |  | 
 
  |  |  |  |  
  |  |  |  |  
  |  |  |  |  
  |  |  |  |  
  |  | 
	
		
   
   
      | Support::Windows Servers Support forum for Windows EQEMu users. |  
	
	
		
	
	
	| 
			
			 
			
				02-23-2013, 07:29 PM
			
			
			
		 |  
	| 
		
			
			| Discordant |  | 
					Join Date: Jan 2013 
						Posts: 284
					      |  |  
	| 
				 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);
} |  
	
		
	
	
	| 
			
			 
			
				02-23-2013, 07:38 PM
			
			
			
		 |  
	| 
		
			
			| Developer |  | 
					Join Date: Feb 2004 Location: UK 
						Posts: 1,540
					      |  |  
	| 
 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 ? |  
	
		
	
	
	| 
			
			 
			
				02-23-2013, 07:44 PM
			
			
			
		 |  
	| 
		
			
			| Discordant |  | 
					Join Date: Jan 2013 
						Posts: 284
					      |  |  
	| 
 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. |  
	
		
	
	
	| 
			
			 
			
				02-23-2013, 07:50 PM
			
			
			
		 |  
	| 
		
			|  | Dragon |  | 
					Join Date: Dec 2009 
						Posts: 719
					      |  |  
	| 
 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; |  
	
		
	
	
	| 
			
			 
			
				02-23-2013, 07:50 PM
			
			
			
		 |  
	| 
		
			|  | Developer |  | 
					Join Date: Dec 2012 
						Posts: 515
					      |  |  
	| 
 If you are under level 61 your stats get CAPPED at 255... even with the rule |  
	
		
	
	
	| 
			
			 
			
				02-23-2013, 07:51 PM
			
			
			
		 |  
	| 
		
			|  | Dragon |  | 
					Join Date: Dec 2009 
						Posts: 719
					      |  |  
	| 
 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; |  
	
		
	
	
	| 
			
			 
			
				02-23-2013, 07:53 PM
			
			
			
		 |  
	| 
		
			|  | Developer |  | 
					Join Date: Dec 2012 
						Posts: 515
					      |  |  
	| 
 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)
 |  
	
		
	
	
	| 
			
			 
			
				02-23-2013, 07:54 PM
			
			
			
		 |  
	| 
		
			
			| Discordant |  | 
					Join Date: Jan 2013 
						Posts: 284
					      |  |  
	| 
 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.
 |  
	
		
	
	
	| 
			
			 
			
				02-23-2013, 07:57 PM
			
			
			
		 |  
	| 
		
			|  | Dragon |  | 
					Join Date: Dec 2009 
						Posts: 719
					      |  |  
	| 
 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; |  
	
		
	
	
	| 
			
			 
			
				02-23-2013, 08:01 PM
			
			
			
		 |  
	| 
		
			|  | Developer |  | 
					Join Date: Dec 2012 
						Posts: 515
					      |  |  
	| 
 i was using perl code to check my stats |  
	
		
	
	
	| 
			
			 
			
				02-23-2013, 08:06 PM
			
			
			
		 |  
	| 
		
			
			| Discordant |  | 
					Join Date: Jan 2013 
						Posts: 284
					      |  |  
	| 
 #Mystats with the normal code displays a 255 cap if you're level 60 or below. |  
	
		
	
	
	| 
			
			 
			
				02-23-2013, 08:23 PM
			
			
			
		 |  
	| 
		
			
			| Demi-God |  | 
					Join Date: Mar 2012 
						Posts: 1,103
					      |  |  
	| 
 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
 |  
	
		
	
	
	| 
			
			 
			
				02-23-2013, 08:24 PM
			
			
			
		 |  
	| 
		
			
			| Discordant |  | 
					Join Date: Jan 2013 
						Posts: 284
					      |  |  
	| 
 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.
 |  
	
		
	
	
 
  |  |  |  |  
	| 
			
			 
			
				02-23-2013, 08:31 PM
			
			
			
		 |  
	| 
		
			
			| Discordant |  | 
					Join Date: Jan 2013 
						Posts: 284
					      |  |  
	| 
				  
 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);
}
			
			
			
			
				  |  
 
  |  |  |  |  
	
		
	
	
	| 
			
			 
			
				02-23-2013, 08:52 PM
			
			
			
		 |  
	| 
		
			
			| Discordant |  | 
					Join Date: Jan 2013 
						Posts: 284
					      |  |  
	| 
 BUMP: Last fix in post before this is confirmed to work by NatedogEZ. |  
	
		
	
	
	
	
	| 
	|  Posting Rules |  
	| 
		
		You may not post new threads You may not post replies You may not post attachments You may not edit your posts 
 HTML code is Off 
 |  |  |  All times are GMT -4. The time now is 03:47 AM.
 
 |  |  
    |  |  |  |  
    |  |  |  |  
     |  |  |  |  
 |  |