PDA

View Full Version : [C++] Adding a haste/parry/dodge/block cap to your core [Trinity/3.3.5a]



Wise
26-01-13, 08:41 AM
Good mornin',

So yes, I counted them.. about 13819053715 ( not sure if I missed one ) people are searching for a cap on one of the above stats, so I thought let's make a guide how to add it.

note #1 : This involves core modifications, so if you're either too stupid or use a Repack, please leave immediately.

note #2 : This is just a flat cap, I know it's better to edit the formula's for the stat percentages if you want to scale, but I figured this out in ~10 minutes so formula editing is not for now.

Okay, after the bunch of notes, let's start.

How to make a cap on the haste percentage ( spell haste ofc ) :
1. Open up Object.h
2. go to line 212.
3. You'll see :


void ApplyPercentModFloatValue(uint16 index, float val, bool apply)
{
float value = GetFloatValue(index);
ApplyPercentModFloatVar(value, val, apply);
SetFloatValue(index, value);
}

Edit it like I did :


void ApplyPercentModFloatValue(uint16 index, float val, bool apply)
{
float value = GetFloatValue(index);
ApplyPercentModFloatVar(value, val, apply);
if(apply && index == CR_HASTE_SPELL && value > /*the haste cap, 50 for example*/ 50)
value = 50;
SetFloatValue(index, value);
}

So, that little if makes the difference, let me explain how it works:


if(apply && index == CR_HASTE_SPELL && value > /*the haste cap, 50 for example*/ 50)
value = 50;

Change the numbers in red to your desired haste cap, in percentages.
4. Recompile ( skip this if you want to add more caps).
5. Celebrate ( I guess? ).

How to make a cap on the parry percentage :
1. Open up Statsystem.cpp
2. Go to line 702.
3. You'll see :


SetStatFloatValue(PLAYER_PARRY_PERCENTAGE, value);
}

Replace it with :


if(value > 50)
value = 50;
SetStatFloatValue(PLAYER_PARRY_PERCENTAGE, value);
}

Again, change the red numbers to your desired parry cap.
4. Recompile ( skip this if you want to add more caps).
5. Celebrate ( again ) .

How to make a cap on the dodge percentage :
1. Open up Statsytem.cpp
2. Go to line : 738
3. You'll see:


SetStatFloatValue(PLAYER_DODGE_PERCENTAGE, value);
}

Replace with :


if(value > 50)
value = 50;
SetStatFloatValue(PLAYER_DODGE_PERCENTAGE, value);
}

Again, change the red numbers to your desired dodge cap.
4. Recompile ( skip this if you want to add more caps).
5. Celebrate ( aaand again ) .

How to make a cap on the block percentage :
1. Open up Statsystem.cpp
2. go to line : 577
3. You'll see:


SetStatFloatValue(PLAYER_BLOCK_PERCENTAGE, value);
}

Replace it with :


if(value > 50)
value = 50;
SetStatFloatValue(PLAYER_BLOCK_PERCENTAGE, value);
}

Again, change the red numbers to your desired block ( percentage ) cap.
4. Recompile ( Now you will NEED to since this is the last cap).
5. Celebrate ( I should get a cake now ) .


The haste cap has not been tested yet.
The parry/dodge/block caps work as intended.

Credits for making this guide goes to Jameyboor