*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
This commit is contained in:
QAston
2009-08-04 01:44:14 +02:00
parent 29c9d709b9
commit 2e34af64cf
15 changed files with 91 additions and 7 deletions
+1 -1
View File
@@ -168,7 +168,7 @@ ChatCommand * ChatHandler::getCommandTable()
{ "entervehicle", SEC_ADMINISTRATOR, false, &ChatHandler::HandleDebugEnterVehicle, "", NULL },
{ "uws", SEC_ADMINISTRATOR, false, &ChatHandler::HandleDebugUpdateWorldStateCommand, "", NULL },
{ "update", SEC_ADMINISTRATOR, false, &ChatHandler::HandleDebugUpdateCommand, "", NULL },
{ "itemexpire", SEC_ADMINISTRATOR, false, &ChatHandler::HandleDebugUpdateCommand, "", NULL },
{ "itemexpire", SEC_ADMINISTRATOR, false, &ChatHandler::HandleDebugItemExpireCommand, "", NULL },
{ NULL, 0, false, NULL, "", NULL }
};
+1
View File
@@ -144,6 +144,7 @@ class ChatHandler
bool HandleDebugMod32ValueCommand(const char* args);
bool HandleDebugSetAuraStateCommand(const char * args);
bool HandleDebugSetItemFlagCommand(const char * args);
bool HandleDebugItemExpireCommand(const char * args);
bool HandleDebugSetVehicleId(const char * args);
bool HandleDebugEnterVehicle(const char * args);
bool HandleDebugSetValueCommand(const char* args);
+23
View File
@@ -37,6 +37,7 @@
#include "GridNotifiers.h"
#include "GridNotifiersImpl.h"
#include "SpellMgr.h"
#include "ScriptCalls.h"
bool ChatHandler::HandleDebugSendSpellFailCommand(const char* args)
{
@@ -845,6 +846,28 @@ bool ChatHandler::HandleDebugSetItemFlagCommand(const char* args)
return true;
}
bool ChatHandler::HandleDebugItemExpireCommand(const char* args)
{
if (!*args)
return false;
char* e = strtok((char*)args, " ");
if (!e)
return false;
uint32 guid = (uint32)atoi(e);
Item *i = m_session->GetPlayer()->GetItemByGuid(MAKE_NEW_GUID(guid, 0, HIGHGUID_ITEM));
if (!i)
return false;
m_session->GetPlayer()->DestroyItem( i->GetBagSlot(),i->GetSlot(), true);
Script->ItemExpire(m_session->GetPlayer(),i->GetProto());
return true;
}
//show animation
bool ChatHandler::HandleDebugAnimCommand(const char* args)
{
+2
View File
@@ -25,6 +25,7 @@
#include "Database/DatabaseEnv.h"
#include "ItemEnchantmentMgr.h"
#include "SpellMgr.h"
#include "ScriptCalls.h"
void AddItemsSetItem(Player*player,Item *item)
{
@@ -285,6 +286,7 @@ void Item::UpdateDuration(Player* owner, uint32 diff)
if (GetUInt32Value(ITEM_FIELD_DURATION)<=diff)
{
owner->DestroyItem(GetBagSlot(), GetSlot(), true);
Script->ItemExpire(owner, GetProto());
return;
}
+1 -1
View File
@@ -10603,7 +10603,7 @@ Item* Player::_StoreItem( uint16 pos, Item *pItem, uint32 count, bool clone, boo
uint8 bag = pos >> 8;
uint8 slot = pos & 255;
sLog.outDebug( "STORAGE: StoreItem bag = %u, slot = %u, item = %u, count = %u", bag, slot, pItem->GetEntry(), count);
sLog.outDebug( "STORAGE: StoreItem bag = %u, slot = %u, item = %u, count = %u, guid = %u", bag, slot, pItem->GetEntry(), count, pItem->GetGUIDLow());
Item *pItem2 = GetItemByPos( bag, slot );
+1
View File
@@ -79,6 +79,7 @@ bool LoadScriptingModule(char const* libName)
||!(testScript->ItemQuestAccept =(scriptCallItemQuestAccept )TRINITY_GET_PROC_ADDR(testScript->hScriptsLib,"ItemQuestAccept" ))
||!(testScript->GOQuestAccept =(scriptCallGOQuestAccept )TRINITY_GET_PROC_ADDR(testScript->hScriptsLib,"GOQuestAccept" ))
||!(testScript->ItemUse =(scriptCallItemUse )TRINITY_GET_PROC_ADDR(testScript->hScriptsLib,"ItemUse" ))
||!(testScript->ItemExpire =(scriptCallItemExpire )TRINITY_GET_PROC_ADDR(testScript->hScriptsLib,"ItemExpire" ))
||!(testScript->EffectDummyGameObj =(scriptCallEffectDummyGameObj )TRINITY_GET_PROC_ADDR(testScript->hScriptsLib,"EffectDummyGameObj" ))
||!(testScript->EffectDummyCreature =(scriptCallEffectDummyCreature )TRINITY_GET_PROC_ADDR(testScript->hScriptsLib,"EffectDummyCreature" ))
||!(testScript->EffectDummyItem =(scriptCallEffectDummyItem )TRINITY_GET_PROC_ADDR(testScript->hScriptsLib,"EffectDummyItem" ))
+2
View File
@@ -59,6 +59,7 @@ typedef bool(TRINITY_IMPORT * scriptCallItemQuestAccept)(Player *player, Item *,
typedef bool(TRINITY_IMPORT * scriptCallGOQuestAccept)(Player *player, GameObject *, Quest const*);
typedef bool(TRINITY_IMPORT * scriptCallGOChooseReward)(Player *player, GameObject *, Quest const*, uint32 opt );
typedef bool(TRINITY_IMPORT * scriptCallItemUse) (Player *player, Item *_Item, SpellCastTargets const& targets);
typedef bool(TRINITY_IMPORT * scriptCallItemExpire) (Player *player, ItemPrototype const *_ItemProto);
typedef bool(TRINITY_IMPORT * scriptCallEffectDummyGameObj) (Unit *caster, uint32 spellId, uint32 effIndex, GameObject *gameObjTarget);
typedef bool(TRINITY_IMPORT * scriptCallEffectDummyCreature) (Unit *caster, uint32 spellId, uint32 effIndex, Creature *crTarget);
typedef bool(TRINITY_IMPORT * scriptCallEffectDummyItem) (Unit *caster, uint32 spellId, uint32 effIndex, Item *itemTarget);
@@ -89,6 +90,7 @@ typedef struct
scriptCallItemQuestAccept ItemQuestAccept;
scriptCallGOQuestAccept GOQuestAccept;
scriptCallItemUse ItemUse;
scriptCallItemExpire ItemExpire;
scriptCallEffectDummyGameObj EffectDummyGameObj;
scriptCallEffectDummyCreature EffectDummyCreature;
scriptCallEffectDummyItem EffectDummyItem;
+1 -1
View File
@@ -4463,7 +4463,7 @@ void AuraEffect::HandleModStateImmunityMask(bool apply, bool Real, bool /*change
if (GetMiscValue() & (1<<7))
immunity_list.push_back(SPELL_AURA_MOD_DISARM);
if (GetMiscValue() & (1<<1))
immunity_list.push_back(SPELL_AURA_MOD_TAUNT);
immunity_list.push_back(SPELL_AURA_TRANSFORM);
// These flag can be recognized wrong:
if (GetMiscValue() & (1<<6))
+3 -2
View File
@@ -6442,7 +6442,8 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, AuraEffect* trigger
case SPELLFAMILY_SHAMAN:
{
switch(dummySpell->Id)
{ // Shaman T8 Elemental 4P Bonus
{
// Shaman T8 Elemental 4P Bonus
case 64928:
{
basepoints0 = int32( triggerAmount * damage / 100 );
@@ -12653,6 +12654,7 @@ bool InitTriggerAuraData()
isTriggerAura[SPELL_AURA_MOD_STEALTH] = true;
isTriggerAura[SPELL_AURA_MOD_FEAR] = true; // Aura not have charges but need remove him on trigger
isTriggerAura[SPELL_AURA_MOD_ROOT] = true;
isTriggerAura[SPELL_AURA_TRANSFORM] = true;
isTriggerAura[SPELL_AURA_REFLECT_SPELLS] = true;
isTriggerAura[SPELL_AURA_DAMAGE_IMMUNITY] = true;
isTriggerAura[SPELL_AURA_PROC_TRIGGER_SPELL] = true;
@@ -13876,7 +13878,6 @@ void Unit::SetToNotify()
void Unit::Kill(Unit *pVictim, bool durabilityLoss)
{
assert(pVictim->IsInWorld() && pVictim->FindMap());
// Prevent killing unit twice (and giving reward from kill twice)
if (!pVictim->GetHealth())
return;