Example #1
0
 void HandleDummy(SpellEffIndex /*effIndex*/)
 {
     Player* caster = GetCaster()->ToPlayer();
     if (GetCastItem())
         if (Creature* creatureTarget = GetHitCreature())
         {
             uint32 uiNewEntry = 0;
             switch (caster->GetTeam())
             {
                 case HORDE:
                     if (creatureTarget->GetEntry() == NPC_SICKLY_GAZELLE)
                         uiNewEntry = NPC_CURED_GAZELLE;
                     break;
                 case ALLIANCE:
                     if (creatureTarget->GetEntry() == NPC_SICKLY_DEER)
                         uiNewEntry = NPC_CURED_DEER;
                     break;
             }
             if (uiNewEntry)
             {
                 creatureTarget->UpdateEntry(uiNewEntry);
                 creatureTarget->DespawnOrUnsummon(DESPAWN_TIME);
             }
         }
 }
Example #2
0
        void HandleDummy(SpellEffIndex /*effIndex*/)
        {
            if (Unit* pTarget = GetHitUnit())
            {
                Unit* pCaster = GetCaster();

                uint32 spellId = 0;
                uint32 rand = urand(0, 99);
                if (rand < 25)                      // Fireball (25% chance)
                    spellId = SPELL_FIREBALL;
                else if (rand < 50)                 // Frostball (25% chance)
                    spellId = SPELL_FROSTBOLT;
                else if (rand < 70)                 // Chain Lighting (20% chance)
                    spellId = SPELL_CHAIN_LIGHTNING;
                else if (rand < 80)                 // Polymorph (10% chance)
                {
                    spellId = SPELL_POLYMORPH;
                    if (urand(0, 100) <= 30)        // 30% chance to self-cast
                        pTarget = pCaster;
                }
                else if (rand < 95)                 // Enveloping Winds (15% chance)
                    spellId = SPELL_ENVELOPING_WINDS;
                else                                // Summon Felhund minion (5% chance)
                {
                    spellId = SPELL_SUMMON_FELHOUND_MINION;
                    pTarget = pCaster;
                }

                pCaster->CastSpell(pTarget, spellId, true, GetCastItem());
            }
        }
Example #3
0
            void HandleAfterHit()
            {
                if (_stackAmount < 5)
                    return;

                Player* player = GetCaster()->ToPlayer();

                if (Unit* target = GetHitUnit())
                {

                    Item* item = player->GetItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_MAINHAND);

                    if (item == GetCastItem())
                        item = player->GetItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_OFFHAND);

                    if (!item)
                        return;

                    // item combat enchantments
                    for (uint8 slot = 0; slot < MAX_ENCHANTMENT_SLOT; ++slot)
                    {
                        if (slot > PRISMATIC_ENCHANTMENT_SLOT || slot < PROP_ENCHANTMENT_SLOT_0)    // not holding enchantment id
                            continue;

                        SpellItemEnchantmentEntry const* enchant = sSpellItemEnchantmentStore.LookupEntry(item->GetEnchantmentId(EnchantmentSlot(slot)));
                        if (!enchant)
                            continue;

                        for (uint8 s = 0; s < 3; ++s)
                        {
                            if (enchant->type[s] != ITEM_ENCHANTMENT_TYPE_COMBAT_SPELL)
                                continue;

                            SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(enchant->spellid[s]);
                            if (!spellInfo)
                            {
                                sLog->outError(LOG_FILTER_SPELLS_AURAS, "Player::CastItemCombatSpell Enchant %i, player (Name: %s, GUID: %u) cast unknown spell %i", enchant->ID, player->GetName().c_str(), player->GetGUIDLow(), enchant->spellid[s]);
                                continue;
                            }

                            // Proc only rogue poisons
                            if (spellInfo->SpellFamilyName != SPELLFAMILY_ROGUE || spellInfo->Dispel != DISPEL_POISON)
                                continue;

                            // Do not reproc deadly
                            if (spellInfo->SpellFamilyFlags.IsEqual(0x10000, 0x80000, 0))
                                continue;

                            if (spellInfo->IsPositive())
                                player->CastSpell(player, enchant->spellid[s], true, item);
                            else
                                player->CastSpell(target, enchant->spellid[s], true, item);
                        }
                    }
                }
            }
Example #4
0
            void HandleAfterHit()
            {
                if (_stackAmount < 5)
                    return;

                Player* player = GetCaster()->ToPlayer();

                if (Unit* target = GetHitUnit())
                {

                    Item* item = player->GetItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_MAINHAND);

                    if (item == GetCastItem())
                        item = player->GetItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_OFFHAND);

                    if (!item)
                        return;

                    // item combat enchantments
                    for (uint8 slot = 0; slot < MAX_ENCHANTMENT_SLOT; ++slot)
                    {
                        SpellItemEnchantmentEntry const* enchant = sSpellItemEnchantmentStore.LookupEntry(item->GetEnchantmentId(EnchantmentSlot(slot)));
                        if (!enchant)
                            continue;

                        for (uint8 s = 0; s < 3; ++s)
                        {
                            if (enchant->Effect[s] != ITEM_ENCHANTMENT_TYPE_COMBAT_SPELL)
                                continue;

                            SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(enchant->EffectArg[s]);
                            if (!spellInfo)
                            {
                                TC_LOG_ERROR("spells", "Player::CastItemCombatSpell Enchant %i, player (Name: %s, %s) cast unknown spell %i", enchant->ID, player->GetName().c_str(), player->GetGUID().ToString().c_str(), enchant->EffectArg[s]);
                                continue;
                            }

                            // Proc only rogue poisons
                            if (spellInfo->SpellFamilyName != SPELLFAMILY_ROGUE || spellInfo->Dispel != DISPEL_POISON)
                                continue;

                            // Do not reproc deadly
                            if (spellInfo->SpellFamilyFlags == flag128(0x10000, 0x80000, 0, 0))
                                continue;

                            if (spellInfo->IsPositive())
                                player->CastSpell(player, enchant->EffectArg[s], true, item);
                            else
                                player->CastSpell(target, enchant->EffectArg[s], true, item);
                        }
                    }
                }
            }
Example #5
0
 void HandleActivateGameobject(SpellEffIndex effIndex)
 {
     if(Unit* caster = GetCaster())
     {
         caster->MonsterSay("test",0,0);
     }
     if(Unit* caster = GetCastItem()->GetOwner())
     {
         caster->MonsterSay("test",0,0);
     }
     if(GameObject* gob = GetTargetGObj())
     {
         gob->Delete();
         
     }
 }
Example #6
0
 void HandleDummy(SpellEffIndex /*effIndex*/)
 {
     Item* castItem = GetCastItem();
     Unit* caster = GetCaster();
     if (Creature* target = GetHitCreature())
     {
         uint32 spellId = 0;
         switch (target->GetEntry())
         {
             case NPC_SCAVENGEBOT_004A8: spellId = SPELL_SUMMON_SCAVENGEBOT_004A8;    break;
             case NPC_SENTRYBOT_57K:     spellId = SPELL_SUMMON_SENTRYBOT_57K;        break;
             case NPC_DEFENDOTANK_66D:   spellId = SPELL_SUMMON_DEFENDOTANK_66D;      break;
             case NPC_SCAVENGEBOT_005B6: spellId = SPELL_SUMMON_SCAVENGEBOT_005B6;    break;
             case NPC_55D_COLLECTATRON:  spellId = SPELL_SUMMON_55D_COLLECTATRON;     break;
             default:
                 return;
         }
         caster->CastSpell(caster, spellId, true, castItem);
         caster->CastSpell(caster, SPELL_ROBOT_KILL_CREDIT, true);
         target->DespawnOrUnsummon();
     }
 }
 bool Load()
 {
     _stackAmount = 0;
     // at this point CastItem must already be initialized
     return GetCaster()->GetTypeId() == TYPEID_PLAYER && GetCastItem();
 }
Example #8
0
 bool Load() override
 {
     // at this point CastItem must already be initialized
     return GetCaster()->GetTypeId() == TYPEID_PLAYER && GetCastItem();
 }
Example #9
0
 bool Load()
 {
     return GetCaster()->GetTypeId() == TYPEID_PLAYER && GetCastItem();
 }
Example #10
0
 void HandleDummy(SpellEffIndex /*effIndex*/)
 {
     if (Unit* target = GetExplTargetUnit())
         if (target->GetTypeId() == TYPEID_UNIT && target->HasAura(SPELL_FORCE_SHIELD_ARCANE_PURPLE_X3))
             // Make sure nobody else is channeling the same target
             if (!target->HasAura(SPELL_SCOURGING_CRYSTAL_CONTROLLER))
                 GetCaster()->CastSpell(target, SPELL_SCOURGING_CRYSTAL_CONTROLLER, true, GetCastItem());
 }
Example #11
0
 void HandleDummy(SpellEffIndex /*effIndex*/)
 {
     if (Item* pItem = GetCastItem())
         GetCaster()->CastSpell(GetCaster(), _triggeredSpellId, true, pItem);
 }