• This is a read only backup of the old Emudevs forum. If you want to have anything removed, please message me on Discord: KittyKaev

[SOLVED] Get crit rating

Status
Not open for further replies.

Kaev

Super Moderator
Hiho EmuDev's. :3

I search a function to get the critrating (not the critchance!) from a player.
I've tried player->GetRatingBonusValue(CR_CRIT_MELEE) but this will return the critchance.
Google'd for a hour now but couldn't find anything. :(

~Kaev
 

pgmforever

Enthusiast
According to WoWWiki, it takes 45.91 critical strike rating to increase the chance by one percent. Therefore you can do the math and get the rating but keep in mind that critical chance is also affected by agility so the best you can get is an approximation... I'm not aware of any method returning the total critical rating of the player (not saying there isnt one)
 

Kaev

Super Moderator
According to WoWWiki, it takes 45.91 critical strike rating to increase the chance by one percent. Therefore you can do the math and get the rating but keep in mind that critical chance is also affected by agility so the best you can get is an approximation... I'm not aware of any method returning the total critical rating of the player (not saying there isnt one)

I want to modify the critchance-system, already removed the chance from the agility. :p
Just need to get the critrating to finish it completely. :/
 

pgmforever

Enthusiast
I see... well then you can get the chance and calculate the rating using the 45.91 (at level 80) convert rate but keep in mind that chance is also affected by talents, potions, whatever. It really depends on what you really need there
 

Kaev

Super Moderator
I see... well then you can get the chance and calculate the rating using the 45.91 (at level 80) convert rate but keep in mind that chance is also affected by talents, potions, whatever. It really depends on what you really need there

I want to mod it like this:
Level 1-9:
1 Critrating = 1% Critchance
Level 10-19:
1 Critrating = 0.5% Critchance
Level20-XX:
1 Critrating = 0.1% Critchance
(Just example values, but we'll stay this lowlevel at least a long time, so i can't just calculate it with the lvl 80 value :/ )
 

Kaev

Super Moderator
I understand, what's your code so far? I mean the modifications that you have already done

I'm not at home atm, but it looks like this (Pseudocode, made by hand + copied the unmodified code from TC git):
Code:
void Player::UpdateCritPercentage(WeaponAttackType attType)
{

BaseModGroup modGroup;
    uint16 index;
    CombatRating cr;

    switch (attType)
    {
        case OFF_ATTACK:
            modGroup = OFFHAND_CRIT_PERCENTAGE;
            index = PLAYER_OFFHAND_CRIT_PERCENTAGE;
            cr = CR_CRIT_MELEE;
            break;
        case RANGED_ATTACK:
            modGroup = RANGED_CRIT_PERCENTAGE;
            index = PLAYER_RANGED_CRIT_PERCENTAGE;
            cr = CR_CRIT_RANGED;
            break;
        case BASE_ATTACK:
        default:
            modGroup = CRIT_PERCENTAGE;
            index = PLAYER_CRIT_PERCENTAGE;
            cr = CR_CRIT_MELEE;
            break;
    }

float value = 0;

if(this->GetLevel() >= 20)
   // value = this->GetCritRating() * 0.1;
else if(this->GetLevel() >= 10)
   // value = this-<GetCritRating() * 0.5;
else if (this->GetLevel() < 10)
  // value = this->GetCritRating();

if (sWorld->getBoolConfig(CONFIG_STATS_LIMITS_ENABLE))
     value = value > sWorld->getFloatConfig(CONFIG_STATS_LIMITS_CRIT) ? sWorld->getFloatConfig(CONFIG_STATS_LIMITS_CRIT) : value;

value = value < 0.0f ? 0.0f : value;
SetStatFloatValue(index, value);

But obviously this->GetCritRating() doesn't exist. :p That's why i need a function like that.
 

Rochet2

Moderator / Eluna Dev
See
ApplyRatingMod
UpdateRating
UpdateCritPercentage

In them you can see how the rating is got and how its calculated and set as the chance.

Some quotes:
// Applies rating mod change, so there you see where you can get base rating
float oldRating = m_baseRatingValue[cr];
m_baseRatingValue[cr]+=(apply ? value : -value);
// Sets the rating field for player (so just get it?)
SetUInt32Value(PLAYER_FIELD_COMBAT_RATING_1 + cr, uint32(amount));

I assume the problem was that you got the % value of the chance and not the actual critical hit rating value (IE 1000)
Not sure if this was at all what you were looking for. Somewhat at loss with stats since I havent played wow.
 
Last edited:

Kaev

Super Moderator
See
ApplyRatingMod
UpdateRating
UpdateCritPercentage

In them you can see how the rating is got and how its calculated and set as the chance.

Some quotes:



I assume the problem was that you got the % value of the chance and not the actual critical hit rating value (IE 1000)
Not sure if this was at all what you were looking for. Somewhat at loss with stats since I havent played wow.

Will test this when i'm at home again.
But m_baseRatingValue sounds ready good to me, how couldn't i see this? I bet i was searching way too hard, so i just ignored this.
I owe you something, if this will work as exptected.

EDIT: I owe you something. It was m_baseRatingValue[cr] and it works like a charm.
Thank you!
 
Last edited:
Status
Not open for further replies.
Top