Jump to content

[10248][patch][dev]Titan's grip


Auntie Mangos
 Share

Recommended Posts

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

- It fixes the 10% dmg penalty for Titan's grip while wielding a 2h weapon.

- It fixes unequiping of offhand 2h weapon at talent reset.

For which repository revision was the patch created?

Rev. 8578

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

Yes: http://getmangos.eu/community/viewtopic.php?id=9928

And here is stated that the problem with unequiping at reseting talents has been fixed, however in rev. 8578 it is bugged as for me :): http://getmangos.eu/community/viewtopic.php?id=6638

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

Me, reeshack

Paste2.org: http://paste2.org/p/465228

Well I'm afraid that maybe this is not the right way how to fix it, but I haven't found another one (the reason is probably because I'm not very MaNGOS-experienced :)) - so I'm looking forward to some new ideas how to do it :).

Link to comment
Share on other sites

  • 39 years later...

If you were talking about the problem that at talent reset you still have shield and 2h equipped then this bug exists even without this patch...but anyway thank you for reporting, I'll have a look at it :).

EDIT: I probably know what is causing it, just give some time for testing :)

EDIT2:OK, it is fixed :)

Link to comment
Share on other sites

  • 1 month later...
  • 4 weeks later...

updated patch for 9034 with some minor modifications by me:

diff --git a/src/game/Player.cpp b/src/game/Player.cpp
index 2d09f4f..ae8ba39 100644
--- a/src/game/Player.cpp
+++ b/src/game/Player.cpp
@@ -3639,11 +3639,12 @@ bool Player::resetTalents(bool no_cost)
    */


-    if(m_canTitanGrip)
+    if(CanTitanGrip())
    {
-        m_canTitanGrip = false;
+        SetCanTitanGrip(false);
        if(sWorld.getConfig(CONFIG_OFFHAND_CHECK_AT_TALENTS_RESET))
            AutoUnequipOffhandIfNeed();
+        RemoveAurasDueToSpellByCancel(49152);
    }

    return true;
@@ -6400,6 +6401,8 @@ void Player::UpdateZone(uint32 newZone, uint32 newArea)

    // check some item equip limitations (in result lost CanTitanGrip at talent reset, for example)
    AutoUnequipOffhandIfNeed();
+    if (CanTitanGrip() && IsTwoHandUsedInDualWield() && !HasAura(49152))
+        CastSpell(this, 49152, true);

    // recent client version not send leave/join channel packets for built-in local channels
    UpdateLocalChannels( newZone );
@@ -10606,6 +10609,14 @@ Item* Player::EquipItem( uint16 pos, Item *pItem, bool update )
    // only for full equip instead adding to stack
    GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_EQUIP_ITEM, pItem->GetEntry());

+    // titans grip dmg penalty for 2h weapons
+    if (CanTitanGrip())
+    {
+        ItemPrototype const *pProto = pItem->GetProto();
+        if (pProto && pProto->InventoryType == INVTYPE_2HWEAPON && !HasAura(49152))
+            CastSpell(this, 49152, true);
+    }
+
    return pItem;
}

@@ -10745,6 +10756,14 @@ void Player::RemoveItem( uint8 bag, uint8 slot, bool update )
        pItem->SetSlot( NULL_SLOT );
        if( IsInWorld() && update )
            pItem->SendCreateUpdateToPlayer( this );
+
+        // titans grip dmg penalty for 2h weapons removed if player does not have any
+        if (HasAura(49152))
+        {
+            ItemPrototype const *pProto = pItem->GetProto();
+            if (pProto && pProto->InventoryType == INVTYPE_2HWEAPON && !IsTwoHandUsedInDualWield())
+                RemoveAurasDueToSpellByCancel(49152);
+        }
    }
}

@@ -19325,7 +19344,7 @@ void Player::AutoUnequipOffhandIfNeed()
        return;

    // need unequip offhand for 2h-weapon without TitanGrip (in any from hands)
-    if (CanTitanGrip() || (offItem->GetProto()->InventoryType != INVTYPE_2HWEAPON && !IsTwoHandUsed()))
+    if (CanTitanGrip() || !((IsTwoHandUsedInDualWield() && offItem->GetProto()->InventoryType != INVTYPE_NON_EQUIP) || offItem->GetProto()->InventoryType == INVTYPE_2HWEAPON))
        return;

    ItemPosCountVec off_dest;
diff --git a/src/game/Player.h b/src/game/Player.h
index 75e8e31..a57b086 100644
--- a/src/game/Player.h
+++ b/src/game/Player.h
@@ -1269,6 +1269,12 @@ class MANGOS_DLL_SPEC Player : public Unit
            Item* mainItem = GetItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_MAINHAND);
            return mainItem && mainItem->GetProto()->InventoryType == INVTYPE_2HWEAPON && !CanTitanGrip();
        }
+        bool IsTwoHandUsedInDualWield() const
+        {
+            Item* offItem = GetItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_OFFHAND);
+            Item* mainItem = GetItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_MAINHAND);
+            return mainItem && mainItem->GetProto()->InventoryType == INVTYPE_2HWEAPON || offItem && offItem->GetProto()->InventoryType == INVTYPE_2HWEAPON;
+        }
        void SendNewItem( Item *item, uint32 count, bool received, bool created, bool broadcast = false );
        bool BuyItemFromVendor(uint64 vendorguid, uint32 item, uint8 count, uint8 bag, uint8 slot);

diff --git a/src/game/SpellEffects.cpp b/src/game/SpellEffects.cpp
index d11576e..3fbe545 100644
--- a/src/game/SpellEffects.cpp
+++ b/src/game/SpellEffects.cpp
@@ -6954,8 +6954,15 @@ void Spell::EffectActivateRune(uint32  eff_idx)

void Spell::EffectTitanGrip(uint32 /*eff_idx*/)
{
-    if (unitTarget && unitTarget->GetTypeId() == TYPEID_PLAYER)
-        ((Player*)unitTarget)->SetCanTitanGrip(true);
+    if (!unitTarget || unitTarget->GetTypeId() != TYPEID_PLAYER)
+        return;
+
+    Player *p_target = (Player*)unitTarget;
+    p_target->SetCanTitanGrip(true);
+
+    // titans grip dmg penalty for 2h weapons
+    if (!unitTarget->HasAura(49152) && p_target->IsTwoHandUsedInDualWield())
+        unitTarget->CastSpell(unitTarget, 49152, true);
}

void Spell::EffectRenamePet(uint32 /*eff_idx*/)

Link to comment
Share on other sites

updated patch for 9034 with some minor modifications by me:

diff --git a/src/game/Player.cpp b/src/game/Player.cpp
index 2d09f4f..ae8ba39 100644
--- a/src/game/Player.cpp
+++ b/src/game/Player.cpp
@@ -3639,11 +3639,12 @@ bool Player::resetTalents(bool no_cost)
    */


-    if(m_canTitanGrip)
+    if(CanTitanGrip())
    {
-        m_canTitanGrip = false;
+        SetCanTitanGrip(false);
        if(sWorld.getConfig(CONFIG_OFFHAND_CHECK_AT_TALENTS_RESET))
            AutoUnequipOffhandIfNeed();
+        RemoveAurasDueToSpellByCancel(49152);
    }

    return true;
@@ -6400,6 +6401,8 @@ void Player::UpdateZone(uint32 newZone, uint32 newArea)

    // check some item equip limitations (in result lost CanTitanGrip at talent reset, for example)
    AutoUnequipOffhandIfNeed();
+    if (CanTitanGrip() && IsTwoHandUsedInDualWield() && !HasAura(49152))
+        CastSpell(this, 49152, true);

    // recent client version not send leave/join channel packets for built-in local channels
    UpdateLocalChannels( newZone );
@@ -10606,6 +10609,14 @@ Item* Player::EquipItem( uint16 pos, Item *pItem, bool update )
    // only for full equip instead adding to stack
    GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_EQUIP_ITEM, pItem->GetEntry());

+    // titans grip dmg penalty for 2h weapons
+    if (CanTitanGrip())
+    {
+        ItemPrototype const *pProto = pItem->GetProto();
+        if (pProto && pProto->InventoryType == INVTYPE_2HWEAPON && !HasAura(49152))
+            CastSpell(this, 49152, true);
+    }
+
    return pItem;
}

@@ -10745,6 +10756,14 @@ void Player::RemoveItem( uint8 bag, uint8 slot, bool update )
        pItem->SetSlot( NULL_SLOT );
        if( IsInWorld() && update )
            pItem->SendCreateUpdateToPlayer( this );
+
+        // titans grip dmg penalty for 2h weapons removed if player does not have any
+        if (HasAura(49152))
+        {
+            ItemPrototype const *pProto = pItem->GetProto();
+            if (pProto && pProto->InventoryType == INVTYPE_2HWEAPON && !IsTwoHandUsedInDualWield())
+                RemoveAurasDueToSpellByCancel(49152);
+        }
    }
}

@@ -19325,7 +19344,7 @@ void Player::AutoUnequipOffhandIfNeed()
        return;

    // need unequip offhand for 2h-weapon without TitanGrip (in any from hands)
-    if (CanTitanGrip() || (offItem->GetProto()->InventoryType != INVTYPE_2HWEAPON && !IsTwoHandUsed()))
+    if (CanTitanGrip() || !((IsTwoHandUsedInDualWield() && offItem->GetProto()->InventoryType != INVTYPE_NON_EQUIP) || offItem->GetProto()->InventoryType == INVTYPE_2HWEAPON))
        return;

    ItemPosCountVec off_dest;
diff --git a/src/game/Player.h b/src/game/Player.h
index 75e8e31..a57b086 100644
--- a/src/game/Player.h
+++ b/src/game/Player.h
@@ -1269,6 +1269,12 @@ class MANGOS_DLL_SPEC Player : public Unit
            Item* mainItem = GetItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_MAINHAND);
            return mainItem && mainItem->GetProto()->InventoryType == INVTYPE_2HWEAPON && !CanTitanGrip();
        }
+        bool IsTwoHandUsedInDualWield() const
+        {
+            Item* offItem = GetItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_OFFHAND);
+            Item* mainItem = GetItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_MAINHAND);
+            return mainItem && mainItem->GetProto()->InventoryType == INVTYPE_2HWEAPON || offItem && offItem->GetProto()->InventoryType == INVTYPE_2HWEAPON;
+        }
        void SendNewItem( Item *item, uint32 count, bool received, bool created, bool broadcast = false );
        bool BuyItemFromVendor(uint64 vendorguid, uint32 item, uint8 count, uint8 bag, uint8 slot);

diff --git a/src/game/SpellEffects.cpp b/src/game/SpellEffects.cpp
index d11576e..3fbe545 100644
--- a/src/game/SpellEffects.cpp
+++ b/src/game/SpellEffects.cpp
@@ -6954,8 +6954,15 @@ void Spell::EffectActivateRune(uint32  eff_idx)

void Spell::EffectTitanGrip(uint32 /*eff_idx*/)
{
-    if (unitTarget && unitTarget->GetTypeId() == TYPEID_PLAYER)
-        ((Player*)unitTarget)->SetCanTitanGrip(true);
+    if (!unitTarget || unitTarget->GetTypeId() != TYPEID_PLAYER)
+        return;
+
+    Player *p_target = (Player*)unitTarget;
+    p_target->SetCanTitanGrip(true);
+
+    // titans grip dmg penalty for 2h weapons
+    if (!unitTarget->HasAura(49152) && p_target->IsTwoHandUsedInDualWield())
+        unitTarget->CastSpell(unitTarget, 49152, true);
}

void Spell::EffectRenamePet(uint32 /*eff_idx*/)

confirmed works for me^_^

Link to comment
Share on other sites

  • 3 weeks later...
  • 3 weeks later...
  • 4 weeks later...

Hy Guys!

I have pulled down 9582 core!

I have not added scriptdev or any patch so this is a clean mangos!

When i put talent on Titan's Grip a message appears: "This Item can't be equipped!" I tryed with swords and maces. The item is not unique! I tryed with this for ex.: Cataclysm's Edge - http://www.wowhead.com/?item=30902 .

If I try with Polearm the message not appear!

If I don't talent the Titan's Grip it is the same but with no message.

Any idea what is wrong with it?

Link to comment
Share on other sites

  • 1 month later...
  • 3 months later...

More or less accepted in [10248], at least the idea survived :)

Required some adaptions (no surprise after this time...) but some things just didn't seem correct to me.

Don't understand why you modified Player::UpdateZone().

About:

- It fixes unequiping of offhand 2h weapon at talent reset.

There is a config option "OffhandCheckAtTalentsReset" that should take care of it, better enable it instead of removing the code for it.

Also Player::QuickEquipItem() required a check too, otherwise you did not have the damage penalty right after login, allowing for some abuse. Maybe the Player::UpdateZone() was a workaround for that?

But i totally forgot to mention you as author in commit, sorry about that :(

-edit-

argh, the first posts are so old that they don't have a thanks button...so,

thanks everyone for their effort!

Link to comment
Share on other sites

As for many talents weapon masks in its can be just for client show. Specially for this talent is applied always.

Debuf spell itself not have item requirements data :/ so gas been discussed as alter native adding manually check in to Item::IsFit* function with allways applied state.

Added way or second way possible, but unclear what form its less hack, dependent how spell applied at official servers (at equip or always). And this unknown data part.

If will proved that second way more expected feature can be reimplemented in second way...

Link to comment
Share on other sites

Ah yes weapon type implementation was never implemented either :/

Unfortunately, Titan's Grip is the only talent which enables special equipment abilities, which makes some "generic" implementation little more than a guessing game.

And it seems unlikely there will be more of those until the next expansion turns every single class upside down...

I had thought about something like keeping a seperate list of Effect #155 spells and check them for equipment requirements and apply the referenced spell if the item could only be equipped using this special ability, but who knows if that is reasonably close to how blizz designed it, and all for just 2 spells in the whole game (well, plus one "Dual Wield 2H Test" definitely not available to players)...

Also the fact that it is not just a new aura type also made us wonder if blizzard really has anything more than a mostly hard-coded solution...

Link to comment
Share on other sites

  • 1 month later...

Hi! One player of my realmd reporte that Titan's Grip decreases damage by 60% instead of 10%, but I've had a look to the code and I'm not able to find any reference to the damage modifier of aura 49152, it is just casted and nothing more hehe. Where do I have to look to change that?

Thanks!

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
 Share

×
×
  • 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