aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/bindings/scripts/ScriptMgr.cpp32
-rw-r--r--src/bindings/scripts/ScriptMgr.h11
-rw-r--r--src/bindings/scripts/scripts/creature/mob_event_ai.cpp13
3 files changed, 35 insertions, 21 deletions
diff --git a/src/bindings/scripts/ScriptMgr.cpp b/src/bindings/scripts/ScriptMgr.cpp
index 7987d5f1788..811a4a4080b 100644
--- a/src/bindings/scripts/ScriptMgr.cpp
+++ b/src/bindings/scripts/ScriptMgr.cpp
@@ -40,6 +40,7 @@ enum ChatType
CHAT_TYPE_BOSS_EMOTE = 3,
CHAT_TYPE_WHISPER = 4,
CHAT_TYPE_BOSS_WHISPER = 5,
+ CHAT_TYPE_ZONE_YELL = 6
};
#define TEXT_SOURCE_RANGE -1000000 //the amount of entries each text source has available
@@ -2239,6 +2240,9 @@ void DoScriptText(int32 textEntry, WorldObject* pSource, Unit* target)
pSource->MonsterWhisper(textEntry, target->GetGUID(), true);
else error_log("TSCR: DoScriptText entry %i cannot whisper without target unit (TYPEID_PLAYER).", textEntry);
}break;
+ case CHAT_TYPE_ZONE_YELL:
+ pSource->MonsterYellToZone(textEntry, (*i).second.Language, target ? target->GetGUID() : 0);
+ break;
}
}
@@ -2473,14 +2477,13 @@ bool ReceiveEmote( Player *player, Creature *_Creature, uint32 emote )
}
TRINITY_DLL_EXPORT
-InstanceData* CreateInstanceData(Map *map)
+bool EffectDummyCreature(Unit *caster, uint32 spellId, uint32 effIndex, Creature *crTarget )
{
- if (!map->IsDungeon()) return NULL;
+ Script *tmpscript = m_scripts[crTarget->GetScriptId()];
- Script *tmpscript = m_scripts[((InstanceMap*)map)->GetScriptId()];
- if (!tmpscript || !tmpscript->GetInstanceData) return NULL;
+ if (!tmpscript || !tmpscript->pEffectDummyCreature) return false;
- return tmpscript->GetInstanceData(map);
+ return tmpscript->pEffectDummyCreature(caster, spellId,effIndex,crTarget);
}
TRINITY_DLL_EXPORT
@@ -2493,22 +2496,25 @@ bool EffectDummyGameObj(Unit *caster, uint32 spellId, uint32 effIndex, GameObjec
return tmpscript->pEffectDummyGameObj(caster, spellId,effIndex,gameObjTarget);
}
+
TRINITY_DLL_EXPORT
-bool EffectDummyCreature(Unit *caster, uint32 spellId, uint32 effIndex, Creature *crTarget )
+bool EffectDummyItem(Unit *caster, uint32 spellId, uint32 effIndex, Item *itemTarget )
{
- Script *tmpscript = m_scripts[crTarget->GetScriptId()];
+ Script *tmpscript = m_scripts[itemTarget->GetProto()->ScriptId];
- if (!tmpscript || !tmpscript->pEffectDummyCreature) return false;
+ if (!tmpscript || !tmpscript->pEffectDummyItem) return false;
- return tmpscript->pEffectDummyCreature(caster, spellId,effIndex,crTarget);
+ return tmpscript->pEffectDummyItem(caster, spellId,effIndex,itemTarget);
}
TRINITY_DLL_EXPORT
-bool EffectDummyItem(Unit *caster, uint32 spellId, uint32 effIndex, Item *itemTarget )
+InstanceData* CreateInstanceData(Map *map)
{
- Script *tmpscript = m_scripts[itemTarget->GetProto()->ScriptId];
+ if (!map->IsDungeon()) return NULL;
- if (!tmpscript || !tmpscript->pEffectDummyItem) return false;
+ Script *tmpscript = m_scripts[((InstanceMap*)map)->GetScriptId()];
+ if (!tmpscript || !tmpscript->GetInstanceData) return NULL;
- return tmpscript->pEffectDummyItem(caster, spellId,effIndex,itemTarget);
+ return tmpscript->GetInstanceData(map);
}
+
diff --git a/src/bindings/scripts/ScriptMgr.h b/src/bindings/scripts/ScriptMgr.h
index 69ade0e4a45..92e8728abf0 100644
--- a/src/bindings/scripts/ScriptMgr.h
+++ b/src/bindings/scripts/ScriptMgr.h
@@ -32,10 +32,11 @@ struct Script
{
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), pReceiveEmote(NULL), pItemUse(NULL), pEffectDummyGameObj(NULL), pEffectDummyCreature(NULL),
- pEffectDummyItem(NULL), GetAI(NULL)
+ pQuestSelect(NULL), pQuestComplete(NULL), pNPCDialogStatus(NULL), pGODialogStatus(NULL),
+ pChooseReward(NULL), pItemHello(NULL), pGOHello(NULL), pAreaTrigger(NULL), pItemQuestAccept(NULL),
+ pGOQuestAccept(NULL), pGOChooseReward(NULL),pReceiveEmote(NULL),pItemUse(NULL),
+ pEffectDummyCreature(NULL), pEffectDummyGameObj(NULL), pEffectDummyItem(NULL),
+ GetAI(NULL), GetInstanceData(NULL)
{}
std::string Name;
@@ -60,8 +61,8 @@ struct Script
bool (*pGOChooseReward )(Player*, GameObject*, Quest const*, uint32 );
bool (*pReceiveEmote )(Player*, Creature*, uint32 );
bool (*pItemUse )(Player*, Item*, SpellCastTargets const& );
- bool (*pEffectDummyGameObj )(Unit*, uint32, uint32, GameObject* );
bool (*pEffectDummyCreature )(Unit*, uint32, uint32, Creature* );
+ bool (*pEffectDummyGameObj )(Unit*, uint32, uint32, GameObject* );
bool (*pEffectDummyItem )(Unit*, uint32, uint32, Item* );
CreatureAI* (*GetAI)(Creature*);
diff --git a/src/bindings/scripts/scripts/creature/mob_event_ai.cpp b/src/bindings/scripts/scripts/creature/mob_event_ai.cpp
index 637c0754bd1..095632c653b 100644
--- a/src/bindings/scripts/scripts/creature/mob_event_ai.cpp
+++ b/src/bindings/scripts/scripts/creature/mob_event_ai.cpp
@@ -933,10 +933,17 @@ struct TRINITY_DLL_DECL Mob_EventAI : public ScriptedAI
break;
case ACTION_T_KILLED_MONSTER:
{
- Unit* target = GetTargetByType(param2, pActionInvoker);
+ //first attempt player who tapped creature
+ if (Player* pPlayer = m_creature->GetLootRecipient())
+ pPlayer->RewardPlayerAndGroupAtEvent(param1,m_creature);
+ else
+ {
+ //if not available, use pActionInvoker
+ Unit* pTarget = GetTargetByType(param2, pActionInvoker);
- if (target && target->GetTypeId() == TYPEID_PLAYER)
- ((Player*)target)->KilledMonster(param1, m_creature->GetGUID());
+ if (Player* pPlayer = pTarget->GetCharmerOrOwnerPlayerOrPlayerItself())
+ pPlayer->RewardPlayerAndGroupAtEvent(param1,m_creature);
+ }
}
break;
case ACTION_T_SET_INST_DATA: