Skip to content

Commit

Permalink
Script item 12300 for UBRS key
Browse files Browse the repository at this point in the history
Prevent spell cast from item 12300 if script target is above 10% HP

(based on cmangos/mangos-classic@bd1e0da)

Signed-off-by: Cala <calaftp@free.fr>
  • Loading branch information
cala committed Jan 14, 2017
1 parent cf68b47 commit 9e594c1
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 1 deletion.
3 changes: 2 additions & 1 deletion sql/scriptdev2/scriptdev2.sql
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,7 @@ UPDATE item_template SET ScriptName='item_arcane_charges' WHERE entry=34475;
UPDATE item_template SET ScriptName='item_flying_machine' WHERE entry IN (34060,34061);
UPDATE item_template SET ScriptName='item_gor_dreks_ointment' WHERE entry=30175;
UPDATE item_template SET ScriptName='item_petrov_cluster_bombs' WHERE entry=33098;
UPDATE item_template SET ScriptName='item_orb_of_draconic_energy' WHERE entry=12300;

/* NPC (usually creatures to be found in more than one specific zone) */
UPDATE creature_template SET ScriptName='npc_air_force_bots' WHERE entry IN (2614, 2615, 21974, 21993, 21996, 21997, 21999, 22001, 22002, 22003, 22063, 22065, 22066, 22068, 22069, 22070, 22071, 22078, 22079, 22080, 22086, 22087, 22088, 22090, 22124, 22125, 22126);
Expand Down Expand Up @@ -10758,4 +10759,4 @@ INSERT INTO script_waypoint VALUES
(25504, 24, 2807.49, 6748.29, 8.25933, 3000, 'MOOTOO_Y_SAY_9'),
(25504, 25, 2807.49, 6748.29, 8.25933, 5000, 'SAY_2_ELDER_MOOTOO');

-- EOF
-- EOF
33 changes: 33 additions & 0 deletions src/scriptdev2/scripts/world/item_scripts.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,34 @@ EndContentData */
#include "precompiled.h"
#include "Spell.h"


/*#####
# item_orb_of_draconic_energy
#####*/

enum
{
SPELL_DOMINION_SOUL = 16053,
NPC_EMBERSTRIFE = 10321
};

bool ItemUse_item_orb_of_draconic_energy(Player* pPlayer, Item* pItem, const SpellCastTargets& pTargets)
{
Creature* pEmberstrife = GetClosestCreatureWithEntry(pPlayer, NPC_EMBERSTRIFE, 20.0f);
// If Emberstrife is already mind controled or above 10% HP: force spell cast failure
if (pEmberstrife && pEmberstrife->HasAura(SPELL_DOMINION_SOUL) || pEmberstrife->GetHealth() / pEmberstrife->GetMaxHealth() > 0.1f)
{
pPlayer->SendEquipError(EQUIP_ERR_NONE, pItem, NULL);

if (const SpellEntry* pSpellInfo = GetSpellStore()->LookupEntry<SpellEntry>(SPELL_DOMINION_SOUL))
Spell::SendCastResult(pPlayer, pSpellInfo, 1, SPELL_FAILED_TARGET_AURASTATE);

return true;
}

return false;
}

/*#####
# item_arcane_charges
#####*/
Expand Down Expand Up @@ -131,6 +159,11 @@ void AddSC_item_scripts()
{
Script* pNewScript;

pNewScript = new Script;
pNewScript->Name = "item_orb_of_draconic_energy";
pNewScript->pItemUse = &ItemUse_item_orb_of_draconic_energy;
pNewScript->RegisterSelf();

pNewScript = new Script;
pNewScript->Name = "item_arcane_charges";
pNewScript->pItemUse = &ItemUse_item_arcane_charges;
Expand Down

0 comments on commit 9e594c1

Please sign in to comment.