Pelf

Pelf dk pack 1

Apr 25th, 2012
252
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 6.46 KB | None | 0 0
  1. diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp
  2. index 3a16536..1b148e4 100644
  3. --- a/src/server/game/Entities/Player/Player.cpp
  4. +++ b/src/server/game/Entities/Player/Player.cpp
  5. @@ -2271,8 +2271,52 @@ void Player::RegenerateAll()
  6.      // Runes act as cooldowns, and they don't need to send any data
  7.      if (getClass() == CLASS_DEATH_KNIGHT)
  8.          for (uint32 i = 0; i < MAX_RUNES; ++i)
  9. -            if (uint32 cd = GetRuneCooldown(i))
  10. -                SetRuneCooldown(i, (cd > m_regenTimer) ? cd - m_regenTimer : 0);
  11. +       {
  12. +           switch (GetBaseRune(i))
  13. +           {
  14. +           case RUNE_BLOOD:
  15. +               {
  16. +               uint8 nextslot = (i > 0)? 0: 1;
  17. +               if (GetRuneCooldown(nextslot) && GetRuneCooldown(nextslot) < GetRuneCooldown(i))
  18. +                   break;
  19. +               if (uint32 cd = GetRuneCooldown(i))
  20. +               {
  21. +                   uint32 _cd = (cd > m_regenTimer) ? cd - m_regenTimer : 0;
  22. +                   SetRuneCooldown(i, _cd);
  23. +               }
  24. +               break;
  25. +               }
  26. +           case RUNE_UNHOLY:
  27. +               {
  28. +               uint8 nextslot = (i > 2)? 2: 3;
  29. +               if (GetRuneCooldown(nextslot) && GetRuneCooldown(nextslot) < GetRuneCooldown(i))
  30. +                   break;
  31. +               if (uint32 cd = GetRuneCooldown(i))
  32. +               {
  33. +                   uint32 _cd = (cd > m_regenTimer) ? cd - m_regenTimer : 0;
  34. +                   SetRuneCooldown(i, _cd);
  35. +               }
  36. +               break;
  37. +               }
  38. +           case RUNE_FROST:
  39. +               {
  40. +               uint8 nextslot = (i > 4)? 4: 5;
  41. +               if (GetRuneCooldown(nextslot) && GetRuneCooldown(nextslot) < GetRuneCooldown(i))
  42. +                   break;
  43. +               if (uint32 cd = GetRuneCooldown(i))
  44. +               {
  45. +                   uint32 _cd = (cd > m_regenTimer) ? cd - m_regenTimer : 0;
  46. +                   SetRuneCooldown(i, _cd);
  47. +               }
  48. +               break;
  49. +               }
  50. +           }
  51. +            /*if (uint32 cd = GetRuneCooldown(i))
  52. +           {
  53. +               uint32 _cd = (cd > m_regenTimer) ? cd - m_regenTimer : 0;
  54. +               SetRuneCooldown(i, _cd);
  55. +           }*/
  56. +       }
  57.  
  58.      if (m_regenTimerCount >= 2000)
  59.      {
  60. @@ -23328,6 +23373,10 @@ uint32 Player::GetRuneBaseCooldown(uint8 index)
  61.              cooldown = cooldown*(100-(*i)->GetAmount())/100;
  62.      }
  63.  
  64. +   float haste = GetFloatValue(UNIT_MOD_CAST_SPEED);
  65. +
  66. +   cooldown -= cooldown * (1 - haste);
  67. +
  68.      return cooldown;
  69.  }
  70.  
  71. @@ -23375,10 +23424,11 @@ void Player::ResyncRunes(uint8 count)
  72.      data << uint32(count);
  73.      for (uint32 i = 0; i < count; ++i)
  74.      {
  75. -        data << uint8(GetCurrentRune(i));                   // rune type
  76. -        data << uint8(255 - (GetRuneCooldown(i) * 51));     // passed cooldown time (0-255)
  77. -    }
  78. -    GetSession()->SendPacket(&data);
  79. +       data << uint8(GetCurrentRune(i));                   // rune type
  80. +       float baseCd = float(GetRuneBaseCooldown(i));
  81. +       data << uint8((baseCd - float(GetRuneCooldown(i))) / baseCd * 255);
  82. +   }
  83. +   GetSession()->SendPacket(&data);
  84.  }
  85.  
  86.  void Player::AddRunePower(uint8 index)
  87. diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp
  88. index e6f7d3d..c38e025 100644
  89. --- a/src/server/game/Entities/Unit/Unit.cpp
  90. +++ b/src/server/game/Entities/Unit/Unit.cpp
  91. @@ -643,8 +643,6 @@ uint32 Unit::DealDamage(Unit *pVictim, uint32 damage, CleanDamage const* cleanDa
  92.              case BASE_ATTACK:
  93.              {
  94.                  weaponSpeedHitFactor = uint32(GetAttackTime(cleanDamage->attackType) / 1000.0f * 3.5f);
  95. -                if (cleanDamage->hitOutCome == MELEE_HIT_CRIT)
  96. -                    weaponSpeedHitFactor *= 2;
  97.  
  98.                  RewardRage(rage_damage, weaponSpeedHitFactor, true);
  99.  
  100. @@ -653,8 +651,6 @@ uint32 Unit::DealDamage(Unit *pVictim, uint32 damage, CleanDamage const* cleanDa
  101.              case OFF_ATTACK:
  102.              {
  103.                  weaponSpeedHitFactor = uint32(GetAttackTime(cleanDamage->attackType) / 1000.0f * 1.75f);
  104. -                if (cleanDamage->hitOutCome == MELEE_HIT_CRIT)
  105. -                    weaponSpeedHitFactor *= 2;
  106.  
  107.                  RewardRage(rage_damage, weaponSpeedHitFactor, true);
  108.  
  109. @@ -7978,6 +7974,34 @@ bool Unit::HandleAuraProc(Unit * pVictim, uint32 damage, Aura * triggeredByAura,
  110.          }
  111.          case SPELLFAMILY_DEATHKNIGHT:
  112.          {
  113. +           //Runic Empowerment
  114. +           if (dummySpell->Id == 81229)
  115. +           {
  116. +               if (GetTypeId() != TYPEID_PLAYER)
  117. +                   return false;
  118. +
  119. +               if (HasAura(51459) || HasAura(51462)) //Runic Corruption (Rank 1&2)
  120. +                   CastSpell(this, 51460, true);
  121. +               else
  122. +                {
  123. +                   uint32 cooldownrunes[MAX_RUNES];
  124. +                   uint8 runescount = 0;
  125. +                   for (uint32 j = 0; j < MAX_RUNES; ++j)
  126. +                   {
  127. +                       if (ToPlayer()->GetRuneCooldown(j))
  128. +                       {
  129. +                            cooldownrunes[runescount] = j;
  130. +                            runescount++;
  131. +                        }
  132. +                    }
  133. +                    if (runescount > 0)
  134. +                    {
  135. +                        uint8 rndrune = urand(0,runescount-1);
  136. +                        ToPlayer()->SetRuneCooldown(cooldownrunes[rndrune], 0);
  137. +                       ToPlayer()->ResyncRunes(MAX_RUNES);
  138. +                    }
  139. +                 }
  140. +           }
  141.              // Blood of the North
  142.              // Reaping
  143.              // Death Rune Mastery
  144. diff --git a/src/server/game/Spells/Spell.cpp b/src/server/game/Spells/Spell.cpp
  145. index adc6401..e3b8d31 100644
  146. --- a/src/server/game/Spells/Spell.cpp
  147. +++ b/src/server/game/Spells/Spell.cpp
  148. @@ -4152,13 +4153,9 @@ void Spell::SendSpellGo()
  149.          data << uint8(runeMaskAfterCast);                   // runes state after
  150.          for (uint8 i = 0; i < MAX_RUNES; ++i)
  151.          {
  152. -            uint8 mask = (1 << i);
  153. -            if (mask & runeMaskInitial && !(mask & runeMaskAfterCast))  // usable before andon cooldown now...
  154. -            {
  155. -                // float casts ensure the division is performed on floats as we need float result
  156. -                float baseCd = float(player->GetRuneBaseCooldown(i));
  157. -                data << uint8((baseCd - float(player->GetRuneCooldown(i))) / baseCd * 255); // rune cooldown passed
  158. -            }
  159. +           uint8 mask = (1 << i);
  160. +           float baseCd = float(player->GetRuneBaseCooldown(i));
  161. +            data << uint8((baseCd - float(player->GetRuneCooldown(i))) / baseCd * 255);
  162.          }
  163.      }
  164.  
  165. diff --git a/src/server/game/Spells/SpellEffects.cpp b/src/server/game/Spells/SpellEffects.cpp
  166. index c924e21..7eb8580 100644
  167. --- a/src/server/game/Spells/SpellEffects.cpp
  168. +++ b/src/server/game/Spells/SpellEffects.cpp
  169. @@ -7565,6 +7566,7 @@ void Spell::EffectActivateRune(SpellEffIndex effIndex)
  170.                  plr->SetRuneCooldown(i, 0);
  171.          }
  172.      }
  173. +   plr->ResyncRunes(MAX_RUNES);
  174.  }
  175.  
  176.  void Spell::EffectCreateTamedPet(SpellEffIndex effIndex)
Advertisement
Add Comment
Please, Sign In to add comment