View Full Version : Stat Caps.
Zamthos
02-23-2013, 07:29 PM
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.
INSERT INTO `rule_values` VALUES (1, 'Character:StatCap', '##', 'Stat Cap');
REPLACE client_mods.cpp:
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:
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);
}
Derision
02-23-2013, 07:38 PM
If you set the rule Character:StatCap > 0, the existing function will return at this point:
if((RuleI(Character, StatCap)) > 0)
return (RuleI(Character, StatCap));
So no source code changes are required, or am I missing something ?
Zamthos
02-23-2013, 07:44 PM
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.
c0ncrete
02-23-2013, 07:50 PM
wat.......
NatedogEZ
02-23-2013, 07:50 PM
If you are under level 61 your stats get CAPPED at 255... even with the rule
c0ncrete
02-23-2013, 07:51 PM
not according to the code posted.
NatedogEZ
02-23-2013, 07:53 PM
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)
Zamthos
02-23-2013, 07:54 PM
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.
c0ncrete
02-23-2013, 07:57 PM
are we talking about viewed within the client or with #mystats or something else? need more input.
NatedogEZ
02-23-2013, 08:01 PM
i was using perl code to check my stats
Zamthos
02-23-2013, 08:06 PM
#Mystats with the normal code displays a 255 cap if you're level 60 or below.
Maze_EQ
02-23-2013, 08:23 PM
Publishing other people's code without crediting the writer is rude...
Zamthos
02-23-2013, 08:24 PM
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.
Zamthos
02-23-2013, 08:31 PM
I just stumbled upon this in the same code.
EDIT: With this new find, the first change is not necessary.
REPLACE client_mods.cpp
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:
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);
}
Zamthos
02-23-2013, 08:52 PM
BUMP: Last fix in post before this is confirmed to work by NatedogEZ.
NatedogEZ
02-23-2013, 08:59 PM
inside client_mods.cpp
if(val>255 && GetLevel() <= 60)
val = 255;
This Code OVERWRITES the Rule confirmed
Had to remove all instances of this code to get the hardcap on stats to go away for players level 60 and lower.
Drajor
02-23-2013, 10:17 PM
To increase the stat cap for characters of any level you will need to modify GetMaxStat and CalcSTR/AGI etc. Simple as that.
I don't use any of the rules etc.
Zamthos
02-23-2013, 10:21 PM
I already did that in the post 2 posts before yours. :)
Furniture
06-21-2013, 03:00 PM
It looks like the CalcSTR/calcSTA changes are in the source already now, but the getmaxstat did not make it in.
However, even with the getmaxstat change, Caps are STILL 255 for any level, whats going on?
Furniture
06-21-2013, 04:51 PM
Nevermind - I figured it out, please ignore
Scalefiend
12-22-2013, 04:09 PM
So, what is the current way of removing stat caps. I've imputed the changes mentioned in this thread to no avail. Still capped at 255 in-game.
Any detailed instructions on how to do this would be much appreciated. Thx
NatedogEZ
12-22-2013, 08:59 PM
Inside the rule values table to change the StatCap.. and if it is not there add it :)
|| *ruleset_id* || *rule_name* || *rule_value* || *notes* ||
|| 1 || Character:StatCap || 2500 || Sets the Max Statistics Cap for PCs. 0 = feature disabled ||
vBulletin® v3.8.11, Copyright ©2000-2025, vBulletin Solutions Inc.