I've installed a Haste Mod, although

耗尽温柔 提交于 2021-01-29 04:15:24

问题


So I'm using AzerothCore, and I recently just installed a Haste Mod, it's working, but not functioning properly, the Haste Mod I had to install manually due to times changing and codes changing, although now.

My issue is that even though I get 0.00 after I reached a certain amount of haste, it is too fast & proccs don't work, example: Shadowmourne weapon effect...

Sometimes I'm hitting up to 80 times pr game tick, and it varies for 50-80, I want to ask you guys, is it possible to make it locked to a certain amount of attack counts? Both Melee and Ranged, due to sound glitching out also, sometimes sound disappears until I stop attacking, This is unlike any haste mod I ever tested, whether it be a live server or a test server...

The Hastemod is the following:

PLAYER.CPP
hasteMod = 2.9;

/* hastemod
if (haveOffhandWeapon())
if (getAttackTimer(OFF_ATTACK) < ATTACK_DISPLAY_DELAY)
setAttackTimer(OFF_ATTACK, ATTACK_DISPLAY_DELAY);
*/

/* hastemod
if (getAttackTimer(BASE_ATTACK) < ATTACK_DISPLAY_DELAY)
setAttackTimer(BASE_ATTACK, ATTACK_DISPLAY_DELAY);
*/

// hastemod begins
void Player::SetAttackTime(WeaponAttackType att, uint32 val) {
    switch(att) {
        case BASE_ATTACK:
        ApplyHasteMod(m_baseRatingValue[CR_HASTE_MELEE],BASE_ATTACK,CR_HASTE_MELEE, val);
        break;

        case OFF_ATTACK:
        ApplyHasteMod(m_baseRatingValue[CR_HASTE_MELEE],OFF_ATTACK,CR_HASTE_MELEE, val);
        break;
        case RANGED_ATTACK:
        ApplyHasteMod(m_baseRatingValue[CR_HASTE_RANGED],RANGED_ATTACK,CR_HASTE_RANGED, val);
        break;

        default:
        SetFloatValue(UNIT_FIELD_BASEATTACKTIME+att,val*m_modAttackSpeedPct[att]);
    }
}

void Player::ApplyHasteMod(int16 val, uint32 att, CombatRating cr, float speed) {
    float atkSpd = speed * (( 100.0f - ((val / 32.789989f) * hasteMod)  ) / 100.0f );
    if (atkSpd < 0) atkSpd = 0;
SetFloatValue(UNIT_FIELD_BASEATTACKTIME+att, atkSpd);
}

// hastemod ends

 void Player::ApplyRatingMod(CombatRating cr, int32 value, bool apply)
 {
     m_baseRatingValue[cr]+=(apply ? value : -value);
   // explicit affected values
   switch (cr)
   {
       case CR_HASTE_MELEE:
       {
            Item * mainhand = m_items[EQUIPMENT_SLOT_MAINHAND];
            Item * offhand = m_items[EQUIPMENT_SLOT_OFFHAND];
            float speed1 = mainhand ? (float)mainhand->GetTemplate()->Delay : 2000.0f;
            float speed2 = offhand ? (float)offhand->GetTemplate()->Delay : 2000.0f;

            ApplyHasteMod(m_baseRatingValue[cr], BASE_ATTACK, cr, speed1);
            ApplyHasteMod(m_baseRatingValue[cr], OFF_ATTACK, cr, speed2);

            float RatingChange = value / value;
            (RatingChange = 0) ? ApplyPercentModFloatVar(m_modAttackSpeedPct[BASE_ATTACK], RatingChange, !apply) : ApplyPercentModFloatVar(m_modAttackSpeedPct[BASE_ATTACK], -RatingChange, apply);
            (RatingChange = 0) ? ApplyPercentModFloatVar(m_modAttackSpeedPct[OFF_ATTACK], RatingChange, !apply) : ApplyPercentModFloatVar(m_modAttackSpeedPct[OFF_ATTACK], -RatingChange, apply);
             break;
         }
         case CR_HASTE_RANGED:
         {
            Item * ranged = m_items[EQUIPMENT_SLOT_RANGED];
            float speed = ranged ? (float)ranged->GetTemplate()->Delay : 2000.0f;
            ApplyHasteMod(m_baseRatingValue[cr], RANGED_ATTACK, cr, speed);
            float RatingChange = value / value;
            (RatingChange = 0) ? ApplyPercentModFloatVar(m_modAttackSpeedPct[RANGED_ATTACK], RatingChange, !apply) : ApplyPercentModFloatVar(m_modAttackSpeedPct[RANGED_ATTACK], -RatingChange, apply);
             break;
         }
         case CR_HASTE_SPELL:
         {
            ApplyHasteMod(m_baseRatingValue[cr], CR_HASTE_SPELL-1, cr, 1.0f);
             break;
         }
         default:

PLAYER.H


        float hasteMod;
        public:

        float GetHasteMod() const { return hasteMod; }
        void SetHasteMod(float val) { hasteMod = val; }
        void ApplyHasteMod(int16 val, uint32 att, CombatRating cr, float speed);
        void SetAttackTime(WeaponAttackType att, uint32 val);

STATSYSTEM.CPP

 void Player::CalculateMinMaxDamage(WeaponAttackType attType, bool normalized, bool addTotalPct, float& min_damage, float& max_damage)
 {
     UnitMods unitMod;
    Item *Weapon = NULL;

     switch (attType)
     {
         case BASE_ATTACK:
         default:
            Weapon = m_items[EQUIPMENT_SLOT_MAINHAND];
             unitMod = UNIT_MOD_DAMAGE_MAINHAND;
             break;
         case OFF_ATTACK:
            Weapon = m_items[EQUIPMENT_SLOT_OFFHAND];
             unitMod = UNIT_MOD_DAMAGE_OFFHAND;
             break;
         case RANGED_ATTACK:
            Weapon = m_items[EQUIPMENT_SLOT_RANGED];
             unitMod = UNIT_MOD_DAMAGE_RANGED;
             break;
     }


    float wep_speed   =(!Weapon) ? 2200.00f : Weapon->GetTemplate()->Delay;
    float base_value  = GetModifierValue(unitMod, BASE_VALUE) + GetTotalAttackPowerValue(attType)/ 14.0f  (wep_speed/1000.00f);
    float att_speed   = GetAPMultiplier(attType,normalized);
    float base_pct    = GetModifierValue(unitMod, BASE_PCT);    
    float total_value = GetModifierValue(unitMod, TOTAL_VALUE);
    float total_pct   = addTotalPct ? GetModifierValue(unitMod, TOTAL_PCT) : 1.0f;

     float weapon_mindamage = GetWeaponDamageRange(attType, MINDAMAGE);
     float weapon_maxdamage = GetWeaponDamageRange(attType, MAXDAMAGE);


         if (lvl > 60)
             lvl = 60;

        weapon_mindamage = lvl*3.0f*wep_speed/1000;
        weapon_maxdamage = lvl*5.0f*wep_speed/1000;
     }
     else if (!CanUseAttackType(attType))      //check if player not in form but still can't use (disarm case)
     {

I would love if you guys have heard or seen anything like this before, and know what to do, I've spent the last 3 days, trying to figure it out... I know it's possible, just don't know how, or if it's even possible with this hastemod.


回答1:


You should avoid modifying the main core's files (e.g. Player.cpp, Player.h, etc..) but create a real (separate) module for your custom changes:

http://www.azerothcore.org/wiki/Create-a-Module

If you need to implement new hooks, then you should send a PR to the main repo. So your core codebase will always be clean (without custom changes).



来源:https://stackoverflow.com/questions/59604357/ive-installed-a-haste-mod-although

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!