Jump to content

[10649][Fix] Rockbiter Weapon should not apply to both weapon


eggxp

Recommended Posts

* What bug does the patch fix? What features does the patch add?

1. fix ticet 637: Rockbiter Weapon should not apply to both weapon

2. Totem.h, Totem::m_duration change from uint32 to int32.

* For which repository revision was the patch created?

Rev. 10636

* Is there a thread in the bug report section or at lighthouse? If yes, please add a link to the thread.

https://mangos.lighthouseapp.com/projects/18208/tickets/637-rockbiter-weapon-should-not-apply-to-both-weapon

* Who has been writing this patch? Please include either forum user names or email addresses.

me. [email protected]

From 37bfd00aa6c85732070c4a90d4fb83ce20a9510c Mon Sep 17 00:00:00 2001
From: eggxp <[email protected]>
Date: Fri, 22 Oct 2010 09:16:39 +0800
Subject: [PATCH] 1. fix ticet 637: Rockbiter Weapon should not apply to both weapon
2. Totem.h, Totem::m_duration change from uint32 to int32.

---
src/game/Spell.cpp        |    6 +++++-
src/game/Spell.h          |    4 ++++
src/game/SpellEffects.cpp |   23 +++++++++--------------
src/game/Totem.cpp        |    2 +-
src/game/Totem.h          |    2 +-
5 files changed, 20 insertions(+), 17 deletions(-)

diff --git a/src/game/Spell.cpp b/src/game/Spell.cpp
index c59658e..6e816b9 100644
--- a/src/game/Spell.cpp
+++ b/src/game/Spell.cpp
@@ -339,6 +339,7 @@ Spell::Spell( Unit* caster, SpellEntry const *info, bool triggered, ObjectGuid o
    m_selfContainer = NULL;
    m_referencedFromCurrentSpell = false;
    m_executedCurrently = false;
+    m_notSendCastResult = false;
    m_delayStart = 0;
    m_delayAtDamageCount = 0;

@@ -2643,7 +2644,10 @@ void Spell::prepare(SpellCastTargets const* targets, Aura* triggeredByAura)
            SendChannelUpdate(0);
            triggeredByAura->SetAuraDuration(0);
        }
-        SendCastResult(result);
+        if(!m_notSendCastResult)
+        {
+            SendCastResult(result);
+        }
        finish(false);
        return;
    }
diff --git a/src/game/Spell.h b/src/game/Spell.h
index 2bb7e40..ad1b317 100644
--- a/src/game/Spell.h
+++ b/src/game/Spell.h
@@ -459,6 +459,9 @@ class Spell

        CurrentSpellTypes GetCurrentContainer();

+        void SetNotSendCastResult(bool not_send) {m_notSendCastResult = not_send;}
+        bool GetNotSendCastResult() const {return m_notSendCastResult;}
+
        // caster types:
        // formal spell caster, in game source of spell affects cast
        Unit* GetCaster() const { return m_caster; }
@@ -625,6 +628,7 @@ class Spell
        float m_castPositionZ;
        float m_castOrientation;
        bool m_IsTriggeredSpell;
+        bool m_notSendCastResult;

        // if need this can be replaced by Aura copy
        // we can't store original aura link to prevent access to deleted auras
diff --git a/src/game/SpellEffects.cpp b/src/game/SpellEffects.cpp
index 56c494e..a2d13cb 100644
--- a/src/game/SpellEffects.cpp
+++ b/src/game/SpellEffects.cpp
@@ -4767,7 +4767,7 @@ void Spell::EffectEnchantItemTmp(SpellEffectIndex eff_idx)

    Player* p_caster = (Player*)m_caster;

-    // Rockbiter Weapon apply to both weapon
+    // Rockbiter Weapon
    if (m_spellInfo->SpellFamilyName == SPELLFAMILY_SHAMAN && m_spellInfo->SpellFamilyFlags & UI64LIT(0x0000000000400000))
    {
        uint32 spell_id = 0;
@@ -4794,7 +4794,6 @@ void Spell::EffectEnchantItemTmp(SpellEffectIndex eff_idx)
                return;
        }

-
        SpellEntry const *spellInfo = sSpellStore.LookupEntry(spell_id);
        if (!spellInfo)
        {
@@ -4802,19 +4801,15 @@ void Spell::EffectEnchantItemTmp(SpellEffectIndex eff_idx)
            return;
        }

-        for(int j = BASE_ATTACK; j <= OFF_ATTACK; ++j)
+        if (!itemTarget->IsFitToSpellRequirements(m_spellInfo))
        {
-            if (Item* item = p_caster->GetWeaponForAttack(WeaponAttackType(j)))
-            {
-                if (item->IsFitToSpellRequirements(m_spellInfo))
-                {
-                    Spell *spell = new Spell(m_caster, spellInfo, true);
-                    SpellCastTargets targets;
-                    targets.setItemTarget( item );
-                    spell->prepare(&targets);
-                }
-            }
-        }
+            return;
+        }
+        Spell *spell = new Spell(m_caster, spellInfo, true);
+        SpellCastTargets targets;
+        targets.setItemTarget( itemTarget );
+        spell->SetNotSendCastResult(true);
+        spell->prepare(&targets);
        return;
    }

diff --git a/src/game/Totem.cpp b/src/game/Totem.cpp
index 87cb0d5..2b1c968 100644
--- a/src/game/Totem.cpp
+++ b/src/game/Totem.cpp
@@ -40,7 +40,7 @@ void Totem::Update( uint32 time )
        return;
    }

-    if (m_duration <= time)
+    if (m_duration <= int32(time))
    {
        UnSummon();                                         // remove self
        return;
diff --git a/src/game/Totem.h b/src/game/Totem.h
index 57c1686..c489a55 100644
--- a/src/game/Totem.h
+++ b/src/game/Totem.h
@@ -57,6 +57,6 @@ class Totem : public Creature

    protected:
        TotemType m_type;
-        uint32 m_duration;
+        int32 m_duration;
};
#endif
-- 
1.7.3.1.msysgit.0


why add m_notSendCastResult?

1. shaman equip a weapon and a shield.

2. use Rockbiter Weapon. target in CMSG_CAST_SPELL is the weapon.

3. use Rockbiter Weapon again. target in CMSG_CAST_SPELL is the shield.

problem:

out mangos will return SMSG_CAST_FAIL message to client. so client say "no, you can't cast the spell".

in pub wow server, blizz will not return SMSG_CAST_FAIL message.

so:

add m_notSendCastResult. set to true in EffectEnchantItemTmp.

why change m_duration from uint32 to int32?

because m_duration may be negative in Totem::Update m_duration -= time

first post. Sorry for my poor english -:)

Link to comment
Share on other sites

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. Privacy Policy Terms of Use