Advertisement
Guest User

Untitled

a guest
Jan 25th, 2013
819
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.19 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 0c9413d..e5ee935 100755
  3. --- a/src/server/game/Entities/Player/Player.cpp
  4. +++ b/src/server/game/Entities/Player/Player.cpp
  5. @@ -8509,6 +8509,18 @@ void Player::CastItemCombatSpell(Unit* target, WeaponAttackType attType, uint32
  6. void Player::CastItemUseSpell(Item* item, SpellCastTargets const& targets, uint8 cast_count, uint32 glyphIndex)
  7. {
  8. ItemTemplate const* proto = item->GetTemplate();
  9. +
  10. + bool instant = false;
  11. + if ((proto->Class == ITEM_CLASS_GLYPH) ||
  12. + (proto->Class == ITEM_CLASS_CONSUMABLE && (
  13. + proto->SubClass == ITEM_SUBCLASS_ITEM_ENHANCEMENT ||
  14. + proto->SubClass == ITEM_SUBCLASS_CONSUMABLE_OTHER)) ||
  15. + (proto->Class == ITEM_CLASS_TRADE_GOODS && (
  16. + proto->SubClass == ITEM_SUBCLASS_ARMOR_ENCHANTMENT ||
  17. + proto->SubClass == ITEM_SUBCLASS_WEAPON_ENCHANTMENT ||
  18. + proto->SubClass == ITEM_SUBCLASS_ENCHANTING)))
  19. + instant = true;
  20. +
  21. // special learning case
  22. if (proto->Spells[0].SpellId == 483 || proto->Spells[0].SpellId == 55884)
  23. {
  24. @@ -8527,7 +8539,7 @@ void Player::CastItemUseSpell(Item* item, SpellCastTargets const& targets, uint8
  25. spell->m_CastItem = item;
  26. spell->m_cast_count = cast_count; //set count of casts
  27. spell->SetSpellValue(SPELLVALUE_BASE_POINT0, learning_spell_id);
  28. - spell->prepare(&targets);
  29. + spell->prepare(&targets, NULL, instant);
  30. return;
  31. }
  32.  
  33. @@ -8558,7 +8570,7 @@ void Player::CastItemUseSpell(Item* item, SpellCastTargets const& targets, uint8
  34. spell->m_CastItem = item;
  35. spell->m_cast_count = cast_count; // set count of casts
  36. spell->m_glyphIndex = glyphIndex; // glyph index
  37. - spell->prepare(&targets);
  38. + spell->prepare(&targets, NULL, instant);
  39.  
  40. ++count;
  41. }
  42. diff --git a/src/server/game/Spells/Spell.cpp b/src/server/game/Spells/Spell.cpp
  43. index 7f6af3e..b580113 100755
  44. --- a/src/server/game/Spells/Spell.cpp
  45. +++ b/src/server/game/Spells/Spell.cpp
  46. @@ -2903,7 +2903,7 @@ bool Spell::UpdateChanneledTargetList()
  47. return channelTargetEffectMask == 0;
  48. }
  49.  
  50. -void Spell::prepare(SpellCastTargets const* targets, AuraEffect const* triggeredByAura)
  51. +void Spell::prepare(SpellCastTargets const* targets, AuraEffect const* triggeredByAura, const bool instant)
  52. {
  53. if (m_CastItem)
  54. m_castItemGUID = m_CastItem->GetGUID();
  55. @@ -2998,6 +2998,8 @@ void Spell::prepare(SpellCastTargets const* targets, AuraEffect const* triggered
  56. if (m_caster->GetTypeId() == TYPEID_PLAYER)
  57. m_caster->ToPlayer()->SetSpellModTakingSpell(this, false);
  58.  
  59. + if (instant) m_casttime = 0;
  60. +
  61. // don't allow channeled spells / spells with cast time to be casted while moving
  62. // (even if they are interrupted on moving, spells with almost immediate effect get to have their effect processed before movement interrupter kicks in)
  63. if ((m_spellInfo->IsChanneled() || m_casttime) && m_caster->GetTypeId() == TYPEID_PLAYER && m_caster->isMoving() && m_spellInfo->InterruptFlags & SPELL_INTERRUPT_FLAG_MOVEMENT)
  64. diff --git a/src/server/game/Spells/Spell.h b/src/server/game/Spells/Spell.h
  65. index 0d9380d..baf75a7 100755
  66. --- a/src/server/game/Spells/Spell.h
  67. +++ b/src/server/game/Spells/Spell.h
  68. @@ -369,7 +369,7 @@ class Spell
  69. void SearchAreaTargets(std::list<WorldObject*>& targets, float range, Position const* position, Unit* referer, SpellTargetObjectTypes objectType, SpellTargetCheckTypes selectionType, ConditionList* condList);
  70. void SearchChainTargets(std::list<WorldObject*>& targets, uint32 chainTargets, WorldObject* target, SpellTargetObjectTypes objectType, SpellTargetCheckTypes selectType, ConditionList* condList, bool isChainHeal);
  71.  
  72. - void prepare(SpellCastTargets const* targets, AuraEffect const* triggeredByAura = NULL);
  73. + void prepare(SpellCastTargets const* targets, AuraEffect const* triggeredByAura = NULL, const bool instant = false);
  74. void cancel();
  75. void update(uint32 difftime);
  76. void cast(bool skipCheck = false);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement