diff options
| author | QAston <none@none> | 2009-08-04 01:44:14 +0200 |
|---|---|---|
| committer | QAston <none@none> | 2009-08-04 01:44:14 +0200 |
| commit | 2e34af64cf83d79b7352636da71b60132b512106 (patch) | |
| tree | cea5dcc663fed54b74f728c3af730b47da0e9096 /src/bindings/scripts | |
| parent | 29c9d709b908bae35b03dc24e5ba64481c1d547e (diff) | |
*Allow ItemExpire events to be scripted.
*Add .debug itemexpire command
*Add script for Disgusting Jar and Mysterious Egg - original patch by Elron.
--HG--
branch : trunk
Diffstat (limited to 'src/bindings/scripts')
| -rw-r--r-- | src/bindings/scripts/ScriptMgr.cpp | 9 | ||||
| -rw-r--r-- | src/bindings/scripts/ScriptMgr.h | 4 | ||||
| -rw-r--r-- | src/bindings/scripts/scripts/item/item_scripts.cpp | 40 |
3 files changed, 52 insertions, 1 deletions
diff --git a/src/bindings/scripts/ScriptMgr.cpp b/src/bindings/scripts/ScriptMgr.cpp index 27835f8e23e..478c2b904f3 100644 --- a/src/bindings/scripts/ScriptMgr.cpp +++ b/src/bindings/scripts/ScriptMgr.cpp @@ -1877,6 +1877,15 @@ bool ItemUse( Player *player, Item* _Item, SpellCastTargets const& targets) } TRINITY_DLL_EXPORT +bool ItemExpire( Player *player, ItemPrototype const * _ItemProto) +{ + Script *tmpscript = m_scripts[_ItemProto->ScriptId]; + if (!tmpscript || !tmpscript->pItemExpire) return true; + + return tmpscript->pItemExpire(player,_ItemProto); +} + +TRINITY_DLL_EXPORT bool EffectDummyCreature(Unit *caster, uint32 spellId, uint32 effIndex, Creature *crTarget ) { Script *tmpscript = m_scripts[crTarget->GetScriptId()]; diff --git a/src/bindings/scripts/ScriptMgr.h b/src/bindings/scripts/ScriptMgr.h index 719cf7932e9..06830532c9b 100644 --- a/src/bindings/scripts/ScriptMgr.h +++ b/src/bindings/scripts/ScriptMgr.h @@ -23,6 +23,7 @@ class SpellCastTargets; class Map; class Unit; class WorldObject; +struct ItemPrototype; #define MAX_SCRIPTS 5000 //72 bytes each (approx 351kb) #define VISIBLE_RANGE (166.0f) //MAX visible range (size of grid) @@ -34,7 +35,7 @@ struct Script pGossipHello(NULL), pQuestAccept(NULL), pGossipSelect(NULL), pGossipSelectWithCode(NULL), pQuestSelect(NULL), pQuestComplete(NULL), pNPCDialogStatus(NULL), pGODialogStatus(NULL), pChooseReward(NULL), pItemHello(NULL), pGOHello(NULL), pAreaTrigger(NULL), pItemQuestAccept(NULL), - pGOQuestAccept(NULL), pGOChooseReward(NULL),pItemUse(NULL), + pGOQuestAccept(NULL), pGOChooseReward(NULL),pItemUse(NULL), pItemExpire(NULL), pEffectDummyCreature(NULL), pEffectDummyGameObj(NULL), pEffectDummyItem(NULL), GetAI(NULL), GetInstanceData(NULL) {} @@ -60,6 +61,7 @@ struct Script bool (*pGOQuestAccept )(Player*, GameObject*, Quest const* ); bool (*pGOChooseReward )(Player*, GameObject*, Quest const*, uint32 ); bool (*pItemUse )(Player*, Item*, SpellCastTargets const& ); + bool (*pItemExpire )(Player*, ItemPrototype const *); bool (*pEffectDummyCreature )(Unit*, uint32, uint32, Creature* ); bool (*pEffectDummyGameObj )(Unit*, uint32, uint32, GameObject* ); bool (*pEffectDummyItem )(Unit*, uint32, uint32, Item* ); diff --git a/src/bindings/scripts/scripts/item/item_scripts.cpp b/src/bindings/scripts/scripts/item/item_scripts.cpp index a58edb58fa2..3b72aab6529 100644 --- a/src/bindings/scripts/scripts/item/item_scripts.cpp +++ b/src/bindings/scripts/scripts/item/item_scripts.cpp @@ -526,6 +526,36 @@ bool ItemUse_item_incendiary_explosives(Player *player, Item* _Item, SpellCastTa } } +/*##### +# item_mysterious_egg +#####*/ + +bool ItemExpire_item_mysterious_egg(Player *player, ItemPrototype const * _ItemProto) +{ + ItemPosCountVec dest; + uint8 msg = player->CanStoreNewItem( NULL_BAG, NULL_SLOT, dest, 39883, 1); // Cracked Egg + if( msg == EQUIP_ERR_OK ) + { + player->StoreNewItem( dest, 39883, true, Item::GenerateItemRandomPropertyId(39883)); + } + return true; +} + +/*##### +# item_disgusting_jar +#####*/ + +bool ItemExpire_item_disgusting_jar(Player *player, ItemPrototype const * _ItemProto) +{ + ItemPosCountVec dest; + uint8 msg = player->CanStoreNewItem( NULL_BAG, NULL_SLOT, dest, 44718, 1); // Ripe Disgusting Jar + if( msg == EQUIP_ERR_OK ) + { + player->StoreNewItem( dest, 44718, true, Item::GenerateItemRandomPropertyId(44718)); + } + return true; +} + void AddSC_item_scripts() { Script *newscript; @@ -639,5 +669,15 @@ void AddSC_item_scripts() newscript->Name="item_incendiary_explosives"; newscript->pItemUse = &ItemUse_item_incendiary_explosives; newscript->RegisterSelf(); + + newscript = new Script; + newscript->Name="item_mysterious_egg"; + newscript->pItemExpire = &ItemExpire_item_mysterious_egg; + newscript->RegisterSelf(); + + newscript = new Script; + newscript->Name="item_disgusting_jar"; + newscript->pItemExpire = &ItemExpire_item_disgusting_jar; + newscript->RegisterSelf(); } |
