Jump to content

[fix] Lightwell


Recommended Posts

Posted

MaNGOS 9527

SD2 1607

UDB 387

Bug:

Lightwell http://www.wowhead.com/?spell=724 and ranks is not working at all

Comments:

* lightwell is respawning if ForcedDespawn() used to despawn so I had to use AddObjectToRemoveList()

Proposed fix:

diff --git a/src/game/SpellAuras.cpp b/src/game/SpellAuras.cpp
index c02a49f..168d34a 100644
--- a/src/game/SpellAuras.cpp
+++ b/src/game/SpellAuras.cpp
@@ -2461,6 +2461,10 @@ void Aura::HandleAuraDummy(bool apply, bool Real)
                    case 58591:                                 // Stoneclaw Totem X
                        m_target->CastSpell(m_target, 58585, true);
                        return;
+                    case 59907:                             // Lightwell charges
+                        if (m_target->GetTypeId() == TYPEID_UNIT)
+                            ((Creature*)m_target)->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_SPELLCLICK);
+                        return;
                    case 62061:                             // Festive Holiday Mount
                        if (m_target->HasAuraType(SPELL_AURA_MOUNTED))
                            // Reindeer Transformation
@@ -2711,6 +2715,12 @@ void Aura::HandleAuraDummy(bool apply, bool Real)
                    caster->RemoveAurasDueToSpell(34027);
                return;
            }
+            case 59907:                                     // Lightwell charges - despawn creature if no charges remain
+            {
+                if (m_target->GetTypeId() == TYPEID_UNIT)
+                    ((Creature*)m_target)->AddObjectToRemoveList();
+                return;
+            }
        }
        // Living Bomb
        if (m_spellProto->SpellFamilyName == SPELLFAMILY_MAGE && (m_spellProto->SpellFamilyFlags & UI64LIT(0x2000000000000)))
diff --git a/src/game/SpellEffects.cpp b/src/game/SpellEffects.cpp
index 7ded7bf..0860f25 100644
--- a/src/game/SpellEffects.cpp
+++ b/src/game/SpellEffects.cpp
@@ -6150,6 +6150,37 @@ void Spell::EffectScriptEffect(SpellEffectIndex eff_idx)
                    unitTarget->CastSpell(unitTarget, 59943, true);
                    return;
                }
+                case 60123:                                 // Lightwell Renew
+                {
+                    Unit* creator = Unit::GetUnit(*m_caster, m_caster->GetCreatorGUID());
+
+                    if (!unitTarget || unitTarget->GetTypeId() != TYPEID_PLAYER || 
+                        !creator || creator->GetTypeId() != TYPEID_PLAYER || 
+                        ((Player*)unitTarget)->GetTeam() != ((Player*)creator)->GetTeam())
+                        return;
+                    
+                    uint32 renewSpell = 0;
+                    switch(m_caster->GetEntry())
+                    {
+                        case 31897: renewSpell = 7001; break;
+                        case 31896: renewSpell = 27873; break;
+                        case 31895: renewSpell = 27874; break;
+                        case 31894: renewSpell = 28276; break;
+                        case 31893: renewSpell = 48084; break;
+                        case 31883: renewSpell = 48085; break;
+                        default: break;
+                    }
+
+                    m_caster->CastSpell(unitTarget, renewSpell, true);
+
+                    if (Aura* aur = m_caster->GetAura(59907, EFFECT_INDEX_0))
+                    {
+                        if (aur->GetAuraCharges() > 1)
+                            aur->DropAuraCharge();
+                        else m_caster->RemoveAura(aur);
+                    }
+                    return;
+                }
                                                            // random spell learn instead placeholder
                case 60893:                                 // Northrend Alchemy Research
                case 61177:                                 // Northrend Inscription Research

SQL

DELETE FROM npc_spellclick_spells WHERE npc_entry IN (31883,31893,31894,31895,31896,31897);
INSERT INTO npc_spellclick_spells VALUES
(31897,60123,0,0,0,2), -- rank 1
(31896,60123,0,0,0,2), -- rank 2
(31895,60123,0,0,0,2), -- rank 3
(31894,60123,0,0,0,2), -- rank 4
(31893,60123,0,0,0,2), -- rank 5
(31883,60123,0,0,0,2); -- rank 6

DELETE FROM creature_template_addon WHERE entry IN (31897,31896,31895,31894,31893,31883);
INSERT INTO creature_template_addon VALUES
(31883,0,0,0,0,0,'59907 0'),
(31893,0,0,0,0,0,'59907 0'),
(31894,0,0,0,0,0,'59907 0'),
(31895,0,0,0,0,0,'59907 0'),
(31896,0,0,0,0,0,'59907 0'),
(31897,0,0,0,0,0,'59907 0');

Posted

All well, exept some things, Glyph of Lightwell and possibility to click on lightwell in combat.

My attempt to implement glyph was:

+                    if (Unit *owner = m_caster->GetOwner())
+                    {
+
+                       if (const SpellEntry *pSpell = sSpellStore.LookupEntry(spellID))
+                      {
+
+                        //damage = owner->CalculateSpellDamage(pSpell, EFFECT_INDEX_0, pSpell->EffectBasePoints[EFFECT_INDEX_0], unitTarget);
+                        damage = owner->SpellDamageBonus(unitTarget, pSpell, pSpell->EffectBasePoints[EFFECT_INDEX_0], HEAL);
+
+                        if (Aura *dummy = owner->GetDummyAura(55673))
+                           damage += damage * dummy->GetModifier()->m_amount /100.0f;
+                      }
+
+
+                    }
+                    Aura* chargesaura = m_caster->GetAura(59907,EFFECT_INDEX_0);
+                    if(chargesaura && chargesaura->GetAuraCharges() >= 1)
+                     {
+                       chargesaura->SetAuraCharges(chargesaura->GetAuraCharges() - 1);
+                       m_caster->CastCustomSpell(unitTarget, spellID, &damage, NULL, NULL, true, NULL, NULL, m_originalCasterGUID);
+                     } 

also don't know about with or not healing bonus =/

Posted

Thank you for patch :)

* lightwell is respawning if ForcedDespawn() used to despawn so I had to use AddObjectToRemoveList()

I think TemporarySummon::UnSummon() should be a better sollution, bu in the end it does the same ;)

  • 1 month later...
  • 2 months later...
Posted

Update for Revision 10091

Code with Glyph of Lightwell

BUG: not useable in combat. have anyone ideas?

btw bumb

diff --git a/src/game/SpellAuras.cpp b/src/game/SpellAuras.cpp
index c02a49f..168d34a 100644
--- a/src/game/SpellAuras.cpp
+++ b/src/game/SpellAuras.cpp
@@ -2461,6 +2461,10 @@ void Aura::HandleAuraDummy(bool apply, bool Real)
                    case 58591:                                 // Stoneclaw Totem X
                        m_target->CastSpell(m_target, 58585, true);
                        return;
+                    case 59907:                             // Lightwell charges
+                        if (m_target->GetTypeId() == TYPEID_UNIT)
+                            ((Creature*)m_target)->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_SPELLCLICK);
+                        return;
                    case 62061:                             // Festive Holiday Mount
                        if (m_target->HasAuraType(SPELL_AURA_MOUNTED))
                            // Reindeer Transformation
@@ -2711,6 +2715,12 @@ void Aura::HandleAuraDummy(bool apply, bool Real)
                    caster->RemoveAurasDueToSpell(34027);
                return;
            }
+            case 59907:                                     // Lightwell charges - despawn creature if no charges remain
+            {
+                if (m_target->GetTypeId() == TYPEID_UNIT)
+                    ((Creature*)m_target)->AddObjectToRemoveList();
+                return;
+            }
        }
        // Living Bomb
        if (m_spellProto->SpellFamilyName == SPELLFAMILY_MAGE && (m_spellProto->SpellFamilyFlags & UI64LIT(0x2000000000000)))
diff --git a/src/game/SpellEffects.cpp b/src/game/SpellEffects.cpp
index 7ded7bf..0860f25 100644
--- a/src/game/SpellEffects.cpp
+++ b/src/game/SpellEffects.cpp
@@ -6150,6 +6150,37 @@ void Spell::EffectScriptEffect(SpellEffectIndex eff_idx)
                    unitTarget->CastSpell(unitTarget, 59943, true);
                    return;
                }
+                case 60123:                                 // Lightwell Renew
+                {
+                    Unit* creator = Unit::GetUnit(*m_caster, m_caster->GetCreatorGUID());
+                    if (!unitTarget || unitTarget->GetTypeId() != TYPEID_PLAYER || 
+                        !creator || creator->GetTypeId() != TYPEID_PLAYER || 
+                        ((Player*)unitTarget)->GetTeam() != ((Player*)creator)->GetTeam())
+                        return; 
+
+                    uint32 renewSpell = 0;
+                    switch(m_caster->GetEntry())
+                    {
+                        case 31897: renewSpell = 7001; break;
+                        case 31896: renewSpell = 27873; break;
+                        case 31895: renewSpell = 27874; break;
+                        case 31894: renewSpell = 28276; break;
+                        case 31893: renewSpell = 48084; break;
+                        case 31883: renewSpell = 48085; break;
+                        default: break;
+                    }
+            if (const SpellEntry *pSpell = sSpellStore.LookupEntry(renewSpell))
+                    {
+                        damage = pSpell->EffectBasePoints[EFFECT_INDEX_0];
+                        if (Aura *dummy = creator->GetDummyAura(55673))
+                        {
+                            damage += damage * dummy->GetModifier()->m_amount /100.0f;
+                        }
+                    }
+                    m_caster->CastCustomSpell(unitTarget, renewSpell, &damage, NULL, NULL, true, NULL, NULL, m_originalCasterGUID);
+                    if (Aura* aur = m_caster->GetAura(59907, EFFECT_INDEX_0))
+                    {
+                        if (aur->GetAuraCharges() > 1)
+                            aur->DropAuraCharge();
+                        else m_caster->RemoveAura(aur);
+                    }
+                    return;
+                }
                                                            // random spell learn instead placeholder
                case 60893:                                 // Northrend Alchemy Research
                case 61177:                                 // Northrend Inscription Research

Also need sql data

DELETE FROM npc_spellclick_spells WHERE npc_entry IN (31883,31893,31894,31895,31896,31897);
INSERT INTO npc_spellclick_spells VALUES
(31897,60123,0,0,0,2), -- rank 1
(31896,60123,0,0,0,2), -- rank 2
(31895,60123,0,0,0,2), -- rank 3
(31894,60123,0,0,0,2), -- rank 4
(31893,60123,0,0,0,2), -- rank 5
(31883,60123,0,0,0,2); -- rank 6

DELETE FROM creature_template_addon WHERE entry IN (31897,31896,31895,31894,31893,31883);
INSERT INTO creature_template_addon VALUES
(31883,0,0,0,0,0,'59907 0'),
(31893,0,0,0,0,0,'59907 0'),
(31894,0,0,0,0,0,'59907 0'),
(31895,0,0,0,0,0,'59907 0'),
(31896,0,0,0,0,0,'59907 0'),
(31897,0,0,0,0,0,'59907 0');

Posted

I think the solution lies in this part

void WorldSession::HandleSpellClick( WorldPacket & recv_data )
{
   uint64 guid;
   recv_data >> guid;

   if (_player->isInCombat())                              // client prevent click and set different icon at combat state
       return; 

   Creature *unit = _player->GetMap()->GetCreatureOrPetOrVehicle(guid);
   if (!unit || unit->isInCombat())                        // client prevent click and set different icon at combat state
       return;

   SpellClickInfoMapBounds clickPair = sObjectMgr.GetSpellClickInfoMapBounds(unit->GetEntry());
   for(SpellClickInfoMap::const_iterator itr = clickPair.first; itr != clickPair.second; ++itr)
   {
       if (itr->second.IsFitToRequirements(_player))
       {
           Unit *caster = (itr->second.castFlags & 0x1) ? (Unit*)_player : (Unit*)unit;
           Unit *target = (itr->second.castFlags & 0x2) ? (Unit*)_player : (Unit*)unit;

           caster->CastSpell(target, itr->second.spellId, true);
       }
   }
}

Anyone Ideas?

Posted

This looks like the one who implemented it this way gave this some thought, so I would expect there are many mobs, which shouldn't be SpellClicked if one is in combat, and you now have a few examples where they should, so this will need some research what the common pattern is ..

(just took a look at unit_flags and dynamicflags and flags_extra, they are 0 for these npc here (udb 391)

Posted

Shouldn't buff casting be added via scripts? The Lightwell has "charges" also, so 10 times and despawn (i think), so we can handle this easily in script library. It will also solve the problem with combat clicking.

Something like "spellcast in GossipHello function, with 'switch' with spell ranks" ?

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