Feat: Add new UnitEvent for Creature and Player (#341)

This commit is contained in:
iThorgrim
2025-11-08 14:02:00 +01:00
committed by GitHub
parent 5d59a43d49
commit 1ac94f18a3
7 changed files with 866 additions and 221 deletions

View File

@@ -1216,7 +1216,24 @@ public:
sALE->OnPlayerAuraApply(unit->ToPlayer(), aura); sALE->OnPlayerAuraApply(unit->ToPlayer(), aura);
if (unit->IsCreature()) if (unit->IsCreature())
{
sALE->OnCreatureAuraApply(unit->ToCreature(), aura); sALE->OnCreatureAuraApply(unit->ToCreature(), aura);
sALE->OnAllCreatureAuraApply(unit->ToCreature(), aura);
}
}
void OnAuraRemove(Unit* unit, AuraApplication* aurApp, AuraRemoveMode mode) override
{
if (!unit || !aurApp->GetBase()) return;
if (unit->IsPlayer())
sALE->OnPlayerAuraRemove(unit->ToPlayer(), aurApp->GetBase(), mode);
if (unit->IsCreature())
{
sALE->OnCreatureAuraRemove(unit->ToCreature(), aurApp->GetBase(), mode);
sALE->OnAllCreatureAuraRemove(unit->ToCreature(), aurApp->GetBase(), mode);
}
} }
void OnHeal(Unit* healer, Unit* receiver, uint32& gain) override void OnHeal(Unit* healer, Unit* receiver, uint32& gain) override
@@ -1227,7 +1244,10 @@ public:
sALE->OnPlayerHeal(healer->ToPlayer(), receiver, gain); sALE->OnPlayerHeal(healer->ToPlayer(), receiver, gain);
if (healer->IsCreature()) if (healer->IsCreature())
{
sALE->OnCreatureHeal(healer->ToCreature(), receiver, gain); sALE->OnCreatureHeal(healer->ToCreature(), receiver, gain);
sALE->OnAllCreatureHeal(healer->ToCreature(), receiver, gain);
}
} }
void OnDamage(Unit* attacker, Unit* receiver, uint32& damage) override void OnDamage(Unit* attacker, Unit* receiver, uint32& damage) override
@@ -1238,7 +1258,79 @@ public:
sALE->OnPlayerDamage(attacker->ToPlayer(), receiver, damage); sALE->OnPlayerDamage(attacker->ToPlayer(), receiver, damage);
if (attacker->IsCreature()) if (attacker->IsCreature())
{
sALE->OnCreatureDamage(attacker->ToCreature(), receiver, damage); sALE->OnCreatureDamage(attacker->ToCreature(), receiver, damage);
sALE->OnAllCreatureDamage(attacker->ToCreature(), receiver, damage);
}
}
void ModifyPeriodicDamageAurasTick(Unit* target, Unit* attacker, uint32& damage, SpellInfo const* spellInfo) override
{
if (!target || !attacker) return;
if (attacker->IsPlayer())
sALE->OnPlayerModifyPeriodicDamageAurasTick(attacker->ToPlayer(), target, damage, spellInfo);
if (attacker->IsCreature())
{
sALE->OnCreatureModifyPeriodicDamageAurasTick(attacker->ToCreature(), target, damage, spellInfo);
sALE->OnAllCreatureModifyPeriodicDamageAurasTick(attacker->ToCreature(), target, damage, spellInfo);
}
}
void ModifyMeleeDamage(Unit* target, Unit* attacker, uint32& damage) override
{
if (!target || !attacker) return;
if (attacker->IsPlayer())
sALE->OnPlayerModifyMeleeDamage(attacker->ToPlayer(), target, damage);
if (attacker->IsCreature())
{
sALE->OnCreatureModifyMeleeDamage(attacker->ToCreature(), target, damage);
sALE->OnAllCreatureModifyMeleeDamage(attacker->ToCreature(), target, damage);
}
}
void ModifySpellDamageTaken(Unit* target, Unit* attacker, int32& damage, SpellInfo const* spellInfo) override
{
if (!target || !attacker) return;
if (attacker->IsPlayer())
sALE->OnPlayerModifySpellDamageTaken(attacker->ToPlayer(), target, damage, spellInfo);
if (attacker->IsCreature())
{
sALE->OnCreatureModifySpellDamageTaken(attacker->ToCreature(), target, damage, spellInfo);
sALE->OnAllCreatureModifySpellDamageTaken(attacker->ToCreature(), target, damage, spellInfo);
}
}
void ModifyHealReceived(Unit* target, Unit* healer, uint32& heal, SpellInfo const* spellInfo) override
{
if (!target || !healer) return;
if (healer->IsPlayer())
sALE->OnPlayerModifyHealReceived(healer->ToPlayer(), target, heal, spellInfo);
if (healer->IsCreature())
{
sALE->OnCreatureModifyHealReceived(healer->ToCreature(), target, heal, spellInfo);
sALE->OnAllCreatureModifyHealReceived(healer->ToCreature(), target, heal, spellInfo);
}
}
uint32 DealDamage(Unit* AttackerUnit, Unit* pVictim, uint32 damage, DamageEffectType damagetype) override
{
if (!AttackerUnit || !pVictim) return damage;
if (AttackerUnit->IsPlayer())
return sALE->OnPlayerDealDamage(AttackerUnit->ToPlayer(), pVictim, damage, damagetype);
if (AttackerUnit->IsCreature())
return sALE->OnCreatureDealDamage(AttackerUnit->ToCreature(), pVictim, damage, damagetype);
return damage;
} }
}; };

View File

@@ -163,74 +163,80 @@ namespace Hooks
enum PlayerEvents enum PlayerEvents
{ {
PLAYER_EVENT_ON_CHARACTER_CREATE = 1, // (event, player) PLAYER_EVENT_ON_CHARACTER_CREATE = 1, // (event, player)
PLAYER_EVENT_ON_CHARACTER_DELETE = 2, // (event, guid) PLAYER_EVENT_ON_CHARACTER_DELETE = 2, // (event, guid)
PLAYER_EVENT_ON_LOGIN = 3, // (event, player) PLAYER_EVENT_ON_LOGIN = 3, // (event, player)
PLAYER_EVENT_ON_LOGOUT = 4, // (event, player) PLAYER_EVENT_ON_LOGOUT = 4, // (event, player)
PLAYER_EVENT_ON_SPELL_CAST = 5, // (event, player, spell, skipCheck) PLAYER_EVENT_ON_SPELL_CAST = 5, // (event, player, spell, skipCheck)
PLAYER_EVENT_ON_KILL_PLAYER = 6, // (event, killer, killed) PLAYER_EVENT_ON_KILL_PLAYER = 6, // (event, killer, killed)
PLAYER_EVENT_ON_KILL_CREATURE = 7, // (event, killer, killed) PLAYER_EVENT_ON_KILL_CREATURE = 7, // (event, killer, killed)
PLAYER_EVENT_ON_KILLED_BY_CREATURE = 8, // (event, killer, killed) PLAYER_EVENT_ON_KILLED_BY_CREATURE = 8, // (event, killer, killed)
PLAYER_EVENT_ON_DUEL_REQUEST = 9, // (event, target, challenger) PLAYER_EVENT_ON_DUEL_REQUEST = 9, // (event, target, challenger)
PLAYER_EVENT_ON_DUEL_START = 10, // (event, player1, player2) PLAYER_EVENT_ON_DUEL_START = 10, // (event, player1, player2)
PLAYER_EVENT_ON_DUEL_END = 11, // (event, winner, loser, type) PLAYER_EVENT_ON_DUEL_END = 11, // (event, winner, loser, type)
PLAYER_EVENT_ON_GIVE_XP = 12, // (event, player, amount, victim, source) - Can return new XP amount PLAYER_EVENT_ON_GIVE_XP = 12, // (event, player, amount, victim, source) - Can return new XP amount
PLAYER_EVENT_ON_LEVEL_CHANGE = 13, // (event, player, oldLevel) PLAYER_EVENT_ON_LEVEL_CHANGE = 13, // (event, player, oldLevel)
PLAYER_EVENT_ON_MONEY_CHANGE = 14, // (event, player, amount) - Can return new money amount PLAYER_EVENT_ON_MONEY_CHANGE = 14, // (event, player, amount) - Can return new money amount
PLAYER_EVENT_ON_REPUTATION_CHANGE = 15, // (event, player, factionId, standing, incremental) - Can return new standing -> if standing == -1, it will prevent default action (rep gain) PLAYER_EVENT_ON_REPUTATION_CHANGE = 15, // (event, player, factionId, standing, incremental) - Can return new standing -> if standing == -1, it will prevent default action (rep gain)
PLAYER_EVENT_ON_TALENTS_CHANGE = 16, // (event, player, points) PLAYER_EVENT_ON_TALENTS_CHANGE = 16, // (event, player, points)
PLAYER_EVENT_ON_TALENTS_RESET = 17, // (event, player, noCost) PLAYER_EVENT_ON_TALENTS_RESET = 17, // (event, player, noCost)
PLAYER_EVENT_ON_CHAT = 18, // (event, player, msg, Type, lang) - Can return false, newMessage PLAYER_EVENT_ON_CHAT = 18, // (event, player, msg, Type, lang) - Can return false, newMessage
PLAYER_EVENT_ON_WHISPER = 19, // (event, player, msg, Type, lang, receiver) - Can return false, newMessage PLAYER_EVENT_ON_WHISPER = 19, // (event, player, msg, Type, lang, receiver) - Can return false, newMessage
PLAYER_EVENT_ON_GROUP_CHAT = 20, // (event, player, msg, Type, lang, group) - Can return false, newMessage PLAYER_EVENT_ON_GROUP_CHAT = 20, // (event, player, msg, Type, lang, group) - Can return false, newMessage
PLAYER_EVENT_ON_GUILD_CHAT = 21, // (event, player, msg, Type, lang, guild) - Can return false, newMessage PLAYER_EVENT_ON_GUILD_CHAT = 21, // (event, player, msg, Type, lang, guild) - Can return false, newMessage
PLAYER_EVENT_ON_CHANNEL_CHAT = 22, // (event, player, msg, Type, lang, channel) - channel is negative for custom channels. Can return false, newMessage PLAYER_EVENT_ON_CHANNEL_CHAT = 22, // (event, player, msg, Type, lang, channel) - channel is negative for custom channels. Can return false, newMessage
PLAYER_EVENT_ON_EMOTE = 23, // (event, player, emote) - Not triggered on any known emote PLAYER_EVENT_ON_EMOTE = 23, // (event, player, emote) - Not triggered on any known emote
PLAYER_EVENT_ON_TEXT_EMOTE = 24, // (event, player, textEmote, emoteNum, guid) PLAYER_EVENT_ON_TEXT_EMOTE = 24, // (event, player, textEmote, emoteNum, guid)
PLAYER_EVENT_ON_SAVE = 25, // (event, player) PLAYER_EVENT_ON_SAVE = 25, // (event, player)
PLAYER_EVENT_ON_BIND_TO_INSTANCE = 26, // (event, player, difficulty, mapid, permanent) PLAYER_EVENT_ON_BIND_TO_INSTANCE = 26, // (event, player, difficulty, mapid, permanent)
PLAYER_EVENT_ON_UPDATE_ZONE = 27, // (event, player, newZone, newArea) PLAYER_EVENT_ON_UPDATE_ZONE = 27, // (event, player, newZone, newArea)
PLAYER_EVENT_ON_MAP_CHANGE = 28, // (event, player) PLAYER_EVENT_ON_MAP_CHANGE = 28, // (event, player)
// Custom // Custom
PLAYER_EVENT_ON_EQUIP = 29, // (event, player, item, bag, slot) PLAYER_EVENT_ON_EQUIP = 29, // (event, player, item, bag, slot)
PLAYER_EVENT_ON_FIRST_LOGIN = 30, // (event, player) PLAYER_EVENT_ON_FIRST_LOGIN = 30, // (event, player)
PLAYER_EVENT_ON_CAN_USE_ITEM = 31, // (event, player, itemEntry) - Can return InventoryResult enum value PLAYER_EVENT_ON_CAN_USE_ITEM = 31, // (event, player, itemEntry) - Can return InventoryResult enum value
PLAYER_EVENT_ON_LOOT_ITEM = 32, // (event, player, item, count) PLAYER_EVENT_ON_LOOT_ITEM = 32, // (event, player, item, count)
PLAYER_EVENT_ON_ENTER_COMBAT = 33, // (event, player, enemy) PLAYER_EVENT_ON_ENTER_COMBAT = 33, // (event, player, enemy)
PLAYER_EVENT_ON_LEAVE_COMBAT = 34, // (event, player) PLAYER_EVENT_ON_LEAVE_COMBAT = 34, // (event, player)
PLAYER_EVENT_ON_REPOP = 35, // (event, player) PLAYER_EVENT_ON_REPOP = 35, // (event, player)
PLAYER_EVENT_ON_RESURRECT = 36, // (event, player) PLAYER_EVENT_ON_RESURRECT = 36, // (event, player)
PLAYER_EVENT_ON_LOOT_MONEY = 37, // (event, player, amount) PLAYER_EVENT_ON_LOOT_MONEY = 37, // (event, player, amount)
PLAYER_EVENT_ON_QUEST_ABANDON = 38, // (event, player, questId) PLAYER_EVENT_ON_QUEST_ABANDON = 38, // (event, player, questId)
PLAYER_EVENT_ON_LEARN_TALENTS = 39, // (event, player, talentId, talentRank, spellid) PLAYER_EVENT_ON_LEARN_TALENTS = 39, // (event, player, talentId, talentRank, spellid)
// UNUSED = 40, // (event, player) // UNUSED = 40, // (event, player)
// UNUSED = 41, // (event, player) // UNUSED = 41, // (event, player)
PLAYER_EVENT_ON_COMMAND = 42, // (event, player, command, chatHandler) - player is nil if command used from console. Can return false PLAYER_EVENT_ON_COMMAND = 42, // (event, player, command, chatHandler) - player is nil if command used from console. Can return false
PLAYER_EVENT_ON_PET_ADDED_TO_WORLD = 43, // (event, player, pet) PLAYER_EVENT_ON_PET_ADDED_TO_WORLD = 43, // (event, player, pet)
PLAYER_EVENT_ON_LEARN_SPELL = 44, // (event, player, spellId) PLAYER_EVENT_ON_LEARN_SPELL = 44, // (event, player, spellId)
PLAYER_EVENT_ON_ACHIEVEMENT_COMPLETE = 45, // (event, player, achievement) PLAYER_EVENT_ON_ACHIEVEMENT_COMPLETE = 45, // (event, player, achievement)
PLAYER_EVENT_ON_FFAPVP_CHANGE = 46, // (event, player, hasFfaPvp) PLAYER_EVENT_ON_FFAPVP_CHANGE = 46, // (event, player, hasFfaPvp)
PLAYER_EVENT_ON_UPDATE_AREA = 47, // (event, player, oldArea, newArea) PLAYER_EVENT_ON_UPDATE_AREA = 47, // (event, player, oldArea, newArea)
PLAYER_EVENT_ON_CAN_INIT_TRADE = 48, // (event, player, target) - Can return false to prevent the trade PLAYER_EVENT_ON_CAN_INIT_TRADE = 48, // (event, player, target) - Can return false to prevent the trade
PLAYER_EVENT_ON_CAN_SEND_MAIL = 49, // (event, player, receiverGuid, mailbox, subject, body, money, cod, item) - Can return false to prevent sending the mail PLAYER_EVENT_ON_CAN_SEND_MAIL = 49, // (event, player, receiverGuid, mailbox, subject, body, money, cod, item) - Can return false to prevent sending the mail
PLAYER_EVENT_ON_CAN_JOIN_LFG = 50, // (event, player, roles, dungeons, comment) - Can return false to prevent queueing PLAYER_EVENT_ON_CAN_JOIN_LFG = 50, // (event, player, roles, dungeons, comment) - Can return false to prevent queueing
PLAYER_EVENT_ON_QUEST_REWARD_ITEM = 51, // (event, player, item, count) PLAYER_EVENT_ON_QUEST_REWARD_ITEM = 51, // (event, player, item, count)
PLAYER_EVENT_ON_CREATE_ITEM = 52, // (event, player, item, count) PLAYER_EVENT_ON_CREATE_ITEM = 52, // (event, player, item, count)
PLAYER_EVENT_ON_STORE_NEW_ITEM = 53, // (event, player, item, count) PLAYER_EVENT_ON_STORE_NEW_ITEM = 53, // (event, player, item, count)
PLAYER_EVENT_ON_COMPLETE_QUEST = 54, // (event, player, quest) PLAYER_EVENT_ON_COMPLETE_QUEST = 54, // (event, player, quest)
PLAYER_EVENT_ON_CAN_GROUP_INVITE = 55, // (event, player, memberName) - Can return false to prevent inviting PLAYER_EVENT_ON_CAN_GROUP_INVITE = 55, // (event, player, memberName) - Can return false to prevent inviting
PLAYER_EVENT_ON_GROUP_ROLL_REWARD_ITEM = 56, // (event, player, item, count, voteType, roll) PLAYER_EVENT_ON_GROUP_ROLL_REWARD_ITEM = 56, // (event, player, item, count, voteType, roll)
PLAYER_EVENT_ON_BG_DESERTION = 57, // (event, player, type) PLAYER_EVENT_ON_BG_DESERTION = 57, // (event, player, type)
PLAYER_EVENT_ON_PET_KILL = 58, // (event, player, killer) PLAYER_EVENT_ON_PET_KILL = 58, // (event, player, killer)
PLAYER_EVENT_ON_CAN_RESURRECT = 59, // (event, player) PLAYER_EVENT_ON_CAN_RESURRECT = 59, // (event, player)
PLAYER_EVENT_ON_CAN_UPDATE_SKILL = 60, // (event, player, skill_id) - Can return true or false PLAYER_EVENT_ON_CAN_UPDATE_SKILL = 60, // (event, player, skill_id) - Can return true or false
PLAYER_EVENT_ON_BEFORE_UPDATE_SKILL = 61, // (event, player, skill_id, value, max, step) -- Can return new amount PLAYER_EVENT_ON_BEFORE_UPDATE_SKILL = 61, // (event, player, skill_id, value, max, step) -- Can return new amount
PLAYER_EVENT_ON_UPDATE_SKILL = 62, // (event, player, skill_id, value, max, step, new_value) PLAYER_EVENT_ON_UPDATE_SKILL = 62, // (event, player, skill_id, value, max, step, new_value)
PLAYER_EVENT_ON_QUEST_ACCEPT = 63, // (event, player, quest) PLAYER_EVENT_ON_QUEST_ACCEPT = 63, // (event, player, quest)
PLAYER_EVENT_ON_AURA_APPLY = 64, // (event, player, aura) PLAYER_EVENT_ON_AURA_APPLY = 64, // (event, player, aura)
PLAYER_EVENT_ON_HEAL = 65, // (event, player, target, gain) - Can return new heal amount PLAYER_EVENT_ON_HEAL = 65, // (event, player, target, gain) - Can return new heal amount
PLAYER_EVENT_ON_DAMAGE = 66, // (event, player, target, damage) - Can return new damage amount PLAYER_EVENT_ON_DAMAGE = 66, // (event, player, target, damage) - Can return new damage amount
PLAYER_EVENT_ON_AURA_REMOVE = 67, // (event, player, aura, remove_mode)
PLAYER_EVENT_ON_MODIFY_PERIODIC_DAMAGE_AURAS_TICK = 68, // (event, player, target, damage, spellInfo) - Can return new damage amount
PLAYER_EVENT_ON_MODIFY_MELEE_DAMAGE = 69, // (event, player, target, damage) - Can return new damage amount
PLAYER_EVENT_ON_MODIFY_SPELL_DAMAGE_TAKEN = 70, // (event, player, target, damage, spellInfo) - Can return new damage amount
PLAYER_EVENT_ON_MODIFY_HEAL_RECEIVED = 71, // (event, player, target, heal, spellInfo) - Can return new heal amount
PLAYER_EVENT_ON_DEAL_DAMAGE = 72, // (event, player, target, damage, damagetype) - Can return new damage amount
PLAYER_EVENT_COUNT PLAYER_EVENT_COUNT
}; };
@@ -280,46 +286,52 @@ namespace Hooks
enum CreatureEvents enum CreatureEvents
{ {
CREATURE_EVENT_ON_ENTER_COMBAT = 1, // (event, creature, target) - Can return true to stop normal action CREATURE_EVENT_ON_ENTER_COMBAT = 1, // (event, creature, target) - Can return true to stop normal action
CREATURE_EVENT_ON_LEAVE_COMBAT = 2, // (event, creature) - Can return true to stop normal action CREATURE_EVENT_ON_LEAVE_COMBAT = 2, // (event, creature) - Can return true to stop normal action
CREATURE_EVENT_ON_TARGET_DIED = 3, // (event, creature, victim) - Can return true to stop normal action CREATURE_EVENT_ON_TARGET_DIED = 3, // (event, creature, victim) - Can return true to stop normal action
CREATURE_EVENT_ON_DIED = 4, // (event, creature, killer) - Can return true to stop normal action CREATURE_EVENT_ON_DIED = 4, // (event, creature, killer) - Can return true to stop normal action
CREATURE_EVENT_ON_SPAWN = 5, // (event, creature) - Can return true to stop normal action CREATURE_EVENT_ON_SPAWN = 5, // (event, creature) - Can return true to stop normal action
CREATURE_EVENT_ON_REACH_WP = 6, // (event, creature, type, id) - Can return true to stop normal action CREATURE_EVENT_ON_REACH_WP = 6, // (event, creature, type, id) - Can return true to stop normal action
CREATURE_EVENT_ON_AIUPDATE = 7, // (event, creature, diff) - Can return true to stop normal action CREATURE_EVENT_ON_AIUPDATE = 7, // (event, creature, diff) - Can return true to stop normal action
CREATURE_EVENT_ON_RECEIVE_EMOTE = 8, // (event, creature, player, emoteid) - Can return true to stop normal action CREATURE_EVENT_ON_RECEIVE_EMOTE = 8, // (event, creature, player, emoteid) - Can return true to stop normal action
CREATURE_EVENT_ON_DAMAGE_TAKEN = 9, // (event, creature, attacker, damage) - Can return true to stop normal action, can return new damage as second return value. CREATURE_EVENT_ON_DAMAGE_TAKEN = 9, // (event, creature, attacker, damage) - Can return true to stop normal action, can return new damage as second return value.
CREATURE_EVENT_ON_PRE_COMBAT = 10, // (event, creature, target) - Can return true to stop normal action CREATURE_EVENT_ON_PRE_COMBAT = 10, // (event, creature, target) - Can return true to stop normal action
// UNUSED // UNUSED
CREATURE_EVENT_ON_OWNER_ATTACKED = 12, // (event, creature, target) - Can return true to stop normal action // Not on mangos CREATURE_EVENT_ON_OWNER_ATTACKED = 12, // (event, creature, target) - Can return true to stop normal action // Not on mangos
CREATURE_EVENT_ON_OWNER_ATTACKED_AT = 13, // (event, creature, attacker) - Can return true to stop normal action // Not on mangos CREATURE_EVENT_ON_OWNER_ATTACKED_AT = 13, // (event, creature, attacker) - Can return true to stop normal action // Not on mangos
CREATURE_EVENT_ON_HIT_BY_SPELL = 14, // (event, creature, caster, spellid) - Can return true to stop normal action CREATURE_EVENT_ON_HIT_BY_SPELL = 14, // (event, creature, caster, spellid) - Can return true to stop normal action
CREATURE_EVENT_ON_SPELL_HIT_TARGET = 15, // (event, creature, target, spellid) - Can return true to stop normal action CREATURE_EVENT_ON_SPELL_HIT_TARGET = 15, // (event, creature, target, spellid) - Can return true to stop normal action
// UNUSED = 16, // (event, creature) // UNUSED = 16, // (event, creature)
// UNUSED = 17, // (event, creature) // UNUSED = 17, // (event, creature)
// UNUSED = 18, // (event, creature) // UNUSED = 18, // (event, creature)
CREATURE_EVENT_ON_JUST_SUMMONED_CREATURE = 19, // (event, creature, summon) - Can return true to stop normal action CREATURE_EVENT_ON_JUST_SUMMONED_CREATURE = 19, // (event, creature, summon) - Can return true to stop normal action
CREATURE_EVENT_ON_SUMMONED_CREATURE_DESPAWN = 20, // (event, creature, summon) - Can return true to stop normal action CREATURE_EVENT_ON_SUMMONED_CREATURE_DESPAWN = 20, // (event, creature, summon) - Can return true to stop normal action
CREATURE_EVENT_ON_SUMMONED_CREATURE_DIED = 21, // (event, creature, summon, killer) - Can return true to stop normal action // Not on mangos CREATURE_EVENT_ON_SUMMONED_CREATURE_DIED = 21, // (event, creature, summon, killer) - Can return true to stop normal action // Not on mangos
CREATURE_EVENT_ON_SUMMONED = 22, // (event, creature, summoner) - Can return true to stop normal action CREATURE_EVENT_ON_SUMMONED = 22, // (event, creature, summoner) - Can return true to stop normal action
CREATURE_EVENT_ON_RESET = 23, // (event, creature) CREATURE_EVENT_ON_RESET = 23, // (event, creature)
CREATURE_EVENT_ON_REACH_HOME = 24, // (event, creature) - Can return true to stop normal action CREATURE_EVENT_ON_REACH_HOME = 24, // (event, creature) - Can return true to stop normal action
// UNUSED = 25, // (event, creature) // UNUSED = 25, // (event, creature)
CREATURE_EVENT_ON_CORPSE_REMOVED = 26, // (event, creature, respawndelay) - Can return true to stop normal action, can return new respawndelay as second return value CREATURE_EVENT_ON_CORPSE_REMOVED = 26, // (event, creature, respawndelay) - Can return true to stop normal action, can return new respawndelay as second return value
CREATURE_EVENT_ON_MOVE_IN_LOS = 27, // (event, creature, unit) - Can return true to stop normal action. Does not actually check LOS, just uses the sight range CREATURE_EVENT_ON_MOVE_IN_LOS = 27, // (event, creature, unit) - Can return true to stop normal action. Does not actually check LOS, just uses the sight range
// UNUSED = 28, // (event, creature) // UNUSED = 28, // (event, creature)
// UNUSED = 29, // (event, creature) // UNUSED = 29, // (event, creature)
CREATURE_EVENT_ON_DUMMY_EFFECT = 30, // (event, caster, spellid, effindex, creature) CREATURE_EVENT_ON_DUMMY_EFFECT = 30, // (event, caster, spellid, effindex, creature)
CREATURE_EVENT_ON_QUEST_ACCEPT = 31, // (event, player, creature, quest) - Can return true CREATURE_EVENT_ON_QUEST_ACCEPT = 31, // (event, player, creature, quest) - Can return true
// UNUSED = 32, // (event, creature) // UNUSED = 32, // (event, creature)
// UNUSED = 33, // (event, creature) // UNUSED = 33, // (event, creature)
CREATURE_EVENT_ON_QUEST_REWARD = 34, // (event, player, creature, quest, opt) - Can return true CREATURE_EVENT_ON_QUEST_REWARD = 34, // (event, player, creature, quest, opt) - Can return true
CREATURE_EVENT_ON_DIALOG_STATUS = 35, // (event, player, creature) CREATURE_EVENT_ON_DIALOG_STATUS = 35, // (event, player, creature)
CREATURE_EVENT_ON_ADD = 36, // (event, creature) CREATURE_EVENT_ON_ADD = 36, // (event, creature)
CREATURE_EVENT_ON_REMOVE = 37, // (event, creature) CREATURE_EVENT_ON_REMOVE = 37, // (event, creature)
CREATURE_EVENT_ON_AURA_APPLY = 38, // (event, creature, aura) CREATURE_EVENT_ON_AURA_APPLY = 38, // (event, creature, aura)
CREATURE_EVENT_ON_HEAL = 39, // (event, creature, target, gain) - Can return new heal amount CREATURE_EVENT_ON_HEAL = 39, // (event, creature, target, gain) - Can return new heal amount
CREATURE_EVENT_ON_DAMAGE = 40, // (event, creature, target, damage) - Can return new damage amount CREATURE_EVENT_ON_DAMAGE = 40, // (event, creature, target, damage) - Can return new damage amount
CREATURE_EVENT_ON_AURA_REMOVE = 41, // (event, creature, aura, remove_mode)
CREATURE_EVENT_ON_MODIFY_PERIODIC_DAMAGE_AURAS_TICK = 42, // (event, creature, target, damage, spellInfo) - Can return new damage amount
CREATURE_EVENT_ON_MODIFY_MELEE_DAMAGE = 43, // (event, creature, target, damage) - Can return new damage amount
CREATURE_EVENT_ON_MODIFY_SPELL_DAMAGE_TAKEN = 44, // (event, creature, target, damage, spellInfo) - Can return new damage amount
CREATURE_EVENT_ON_MODIFY_HEAL_RECEIVED = 45, // (event, creature, target, heal, spellInfo) - Can return new heal amount
CREATURE_EVENT_ON_DEAL_DAMAGE = 46, // (event, creature, target, damage, damagetype) - Can return new damage amount
CREATURE_EVENT_COUNT CREATURE_EVENT_COUNT
}; };
@@ -399,10 +411,19 @@ namespace Hooks
enum AllCreatureEvents enum AllCreatureEvents
{ {
ALL_CREATURE_EVENT_ON_ADD = 1, // (event, creature) ALL_CREATURE_EVENT_ON_ADD = 1, // (event, creature)
ALL_CREATURE_EVENT_ON_REMOVE = 2, // (event, creature) ALL_CREATURE_EVENT_ON_REMOVE = 2, // (event, creature)
ALL_CREATURE_EVENT_ON_SELECT_LEVEL = 3, // (event, creature_template, creature) ALL_CREATURE_EVENT_ON_SELECT_LEVEL = 3, // (event, creature_template, creature)
ALL_CREATURE_EVENT_ON_BEFORE_SELECT_LEVEL = 4, // (event, creature_template, creature, level) - Can return the new level ALL_CREATURE_EVENT_ON_BEFORE_SELECT_LEVEL = 4, // (event, creature_template, creature, level) - Can return the new level
ALL_CREATURE_EVENT_ON_AURA_APPLY = 5, // (event, creature, aura)
ALL_CREATURE_EVENT_ON_HEAL = 6, // (event, creature, target, gain) - Can return new heal amount
ALL_CREATURE_EVENT_ON_DAMAGE = 7, // (event, creature, target, damage) - Can return new damage amount
ALL_CREATURE_EVENT_ON_AURA_REMOVE = 8, // (event, creature, aura, remove_mode)
ALL_CREATURE_EVENT_ON_MODIFY_PERIODIC_DAMAGE_AURAS_TICK = 9, // (event, creature, target, damage, spellInfo) - Can return new damage amount
ALL_CREATURE_EVENT_ON_MODIFY_MELEE_DAMAGE = 10, // (event, creature, target, damage) - Can return new damage amount
ALL_CREATURE_EVENT_ON_MODIFY_SPELL_DAMAGE_TAKEN = 11, // (event, creature, target, damage, spellInfo) - Can return new damage amount
ALL_CREATURE_EVENT_ON_MODIFY_HEAL_RECEIVED = 12, // (event, creature, target, heal, spellInfo) - Can return new heal amount
ALL_CREATURE_EVENT_ON_DEAL_DAMAGE = 13, // (event, creature, target, damage, damagetype) - Can return new damage amount
ALL_CREATURE_EVENT_COUNT ALL_CREATURE_EVENT_COUNT
}; };
}; };

View File

@@ -424,6 +424,12 @@ public:
void OnCreatureAuraApply(Creature* me, Aura* aura); void OnCreatureAuraApply(Creature* me, Aura* aura);
void OnCreatureHeal(Creature* me, Unit* target, uint32& gain); void OnCreatureHeal(Creature* me, Unit* target, uint32& gain);
void OnCreatureDamage(Creature* me, Unit* target, uint32& gain); void OnCreatureDamage(Creature* me, Unit* target, uint32& gain);
void OnCreatureAuraRemove(Creature* me, Aura* aura, AuraRemoveMode mode);
void OnCreatureModifyPeriodicDamageAurasTick(Creature* me, Unit* target, uint32& damage, SpellInfo const* spellInfo);
void OnCreatureModifyMeleeDamage(Creature* me, Unit* target, uint32& damage);
void OnCreatureModifySpellDamageTaken(Creature* me, Unit* target, int32& damage, SpellInfo const* spellInfo);
void OnCreatureModifyHealReceived(Creature* me, Unit* target, uint32& heal, SpellInfo const* spellInfo);
uint32 OnCreatureDealDamage(Creature* me, Unit* pVictim, uint32 damage, DamageEffectType damagetype);
/* GameObject */ /* GameObject */
void OnDummyEffect(WorldObject* pCaster, uint32 spellId, SpellEffIndex effIndex, GameObject* pTarget); void OnDummyEffect(WorldObject* pCaster, uint32 spellId, SpellEffIndex effIndex, GameObject* pTarget);
@@ -498,8 +504,14 @@ public:
bool CanPlayerResurrect(Player* player); bool CanPlayerResurrect(Player* player);
void OnPlayerQuestAccept(Player* player, Quest const* quest); void OnPlayerQuestAccept(Player* player, Quest const* quest);
void OnPlayerAuraApply(Player* player, Aura* aura); void OnPlayerAuraApply(Player* player, Aura* aura);
void OnPlayerAuraRemove(Player* player, Aura* aura, AuraRemoveMode mode);
void OnPlayerHeal(Player* player, Unit* target, uint32& gain); void OnPlayerHeal(Player* player, Unit* target, uint32& gain);
void OnPlayerDamage(Player* player, Unit* target, uint32& gain); void OnPlayerDamage(Player* player, Unit* target, uint32& damage);
void OnPlayerModifyPeriodicDamageAurasTick(Player* player, Unit* target, uint32& damage, SpellInfo const* spellInfo);
void OnPlayerModifyMeleeDamage(Player* player, Unit* target, uint32& damage);
void OnPlayerModifySpellDamageTaken(Player* player, Unit* target, int32& damage, SpellInfo const* spellInfo);
void OnPlayerModifyHealReceived(Player* player, Unit* target, uint32& heal, SpellInfo const* spellInfo);
uint32 OnPlayerDealDamage(Player* player, Unit* pVictim, uint32 damage, DamageEffectType damagetype);
/* Vehicle */ /* Vehicle */
void OnInstall(Vehicle* vehicle); void OnInstall(Vehicle* vehicle);
@@ -595,6 +607,15 @@ public:
void OnAllCreatureRemoveFromWorld(Creature* creature); void OnAllCreatureRemoveFromWorld(Creature* creature);
void OnAllCreatureSelectLevel(const CreatureTemplate* cinfo, Creature* creature); void OnAllCreatureSelectLevel(const CreatureTemplate* cinfo, Creature* creature);
void OnAllCreatureBeforeSelectLevel(const CreatureTemplate* cinfo, Creature* creature, uint8& level); void OnAllCreatureBeforeSelectLevel(const CreatureTemplate* cinfo, Creature* creature, uint8& level);
void OnAllCreatureAuraApply(Creature* me, Aura* aura);
void OnAllCreatureHeal(Creature* me, Unit* target, uint32& gain);
void OnAllCreatureDamage(Creature* me, Unit* target, uint32& gain);
void OnAllCreatureAuraRemove(Creature* me, Aura* aura, AuraRemoveMode mode);
void OnAllCreatureModifyPeriodicDamageAurasTick(Creature* me, Unit* target, uint32& damage, SpellInfo const* spellInfo);
void OnAllCreatureModifyMeleeDamage(Creature* me, Unit* target, uint32& damage);
void OnAllCreatureModifySpellDamageTaken(Creature* me, Unit* target, int32& damage, SpellInfo const* spellInfo);
void OnAllCreatureModifyHealReceived(Creature* me, Unit* target, uint32& heal, SpellInfo const* spellInfo);
uint32 OnAllCreatureDealDamage(Creature* me, Unit* pVictim, uint32 damage, DamageEffectType damagetype);
}; };
template<> Unit* ALE::CHECKOBJ<Unit>(lua_State* L, int narg, bool error); template<> Unit* ALE::CHECKOBJ<Unit>(lua_State* L, int narg, bool error);
template<> Object* ALE::CHECKOBJ<Object>(lua_State* L, int narg, bool error); template<> Object* ALE::CHECKOBJ<Object>(lua_State* L, int narg, bool error);

View File

@@ -75,4 +75,203 @@ void ALE::OnAllCreatureBeforeSelectLevel(const CreatureTemplate* cinfo, Creature
} }
CleanUpStack(3); CleanUpStack(3);
} }
void ALE::OnAllCreatureAuraApply(Creature* me, Aura* aura)
{
START_HOOK(ALL_CREATURE_EVENT_ON_AURA_APPLY);
Push(me);
Push(aura);
CallAllFunctions(AllCreatureEventBindings, key);
}
void ALE::OnAllCreatureAuraRemove(Creature* me, Aura* aura, AuraRemoveMode mode)
{
START_HOOK(ALL_CREATURE_EVENT_ON_AURA_REMOVE);
Push(me);
Push(aura);
Push(mode);
CallAllFunctions(AllCreatureEventBindings, key);
}
void ALE::OnAllCreatureHeal(Creature* me, Unit* target, uint32& gain)
{
START_HOOK(ALL_CREATURE_EVENT_ON_HEAL);
Push(me);
Push(target);
Push(gain);
int gainIndex = lua_gettop(L);
int n = SetupStack(AllCreatureEventBindings, key, 3);
while (n > 0)
{
int r = CallOneFunction(n--, 3, 1);
if (lua_isnumber(L, r))
{
gain = CHECKVAL<uint32>(L, r);
// Update the stack for subsequent calls.
ReplaceArgument(gain, gainIndex);
}
lua_pop(L, 1);
}
CleanUpStack(3);
}
void ALE::OnAllCreatureDamage(Creature* me, Unit* target, uint32& damage)
{
START_HOOK(ALL_CREATURE_EVENT_ON_DAMAGE);
Push(me);
Push(target);
Push(damage);
int damageIndex = lua_gettop(L);
int n = SetupStack(AllCreatureEventBindings, key, 3);
while (n > 0)
{
int r = CallOneFunction(n--, 3, 1);
if (lua_isnumber(L, r))
{
damage = CHECKVAL<uint32>(L, r);
// Update the stack for subsequent calls.
ReplaceArgument(damage, damageIndex);
}
lua_pop(L, 1);
}
CleanUpStack(3);
}
void ALE::OnAllCreatureModifyPeriodicDamageAurasTick(Creature* me, Unit* target, uint32& damage, SpellInfo const* spellInfo)
{
START_HOOK(ALL_CREATURE_EVENT_ON_MODIFY_PERIODIC_DAMAGE_AURAS_TICK);
Push(me);
Push(target);
Push(damage);
Push(spellInfo);
int damageIndex = lua_gettop(L) - 1;
int n = SetupStack(AllCreatureEventBindings, key, 4);
while (n > 0)
{
int r = CallOneFunction(n--, 4, 1);
if (lua_isnumber(L, r))
{
damage = CHECKVAL<uint32>(L, r);
// Update the stack for subsequent calls.
ReplaceArgument(damage, damageIndex);
}
lua_pop(L, 1);
}
CleanUpStack(4);
}
void ALE::OnAllCreatureModifyMeleeDamage(Creature* me, Unit* target, uint32& damage)
{
START_HOOK(ALL_CREATURE_EVENT_ON_MODIFY_MELEE_DAMAGE);
Push(me);
Push(target);
Push(damage);
int damageIndex = lua_gettop(L);
int n = SetupStack(AllCreatureEventBindings, key, 3);
while (n > 0)
{
int r = CallOneFunction(n--, 3, 1);
if (lua_isnumber(L, r))
{
damage = CHECKVAL<uint32>(L, r);
// Update the stack for subsequent calls.
ReplaceArgument(damage, damageIndex);
}
lua_pop(L, 1);
}
CleanUpStack(3);
}
void ALE::OnAllCreatureModifySpellDamageTaken(Creature* me, Unit* target, int32& damage, SpellInfo const* spellInfo)
{
START_HOOK(ALL_CREATURE_EVENT_ON_MODIFY_SPELL_DAMAGE_TAKEN);
Push(me);
Push(target);
Push(damage);
Push(spellInfo);
int damageIndex = lua_gettop(L) - 1;
int n = SetupStack(AllCreatureEventBindings, key, 4);
while (n > 0)
{
int r = CallOneFunction(n--, 4, 1);
if (lua_isnumber(L, r))
{
damage = CHECKVAL<int32>(L, r);
// Update the stack for subsequent calls.
ReplaceArgument(damage, damageIndex);
}
lua_pop(L, 1);
}
CleanUpStack(4);
}
void ALE::OnAllCreatureModifyHealReceived(Creature* me, Unit* target, uint32& heal, SpellInfo const* spellInfo)
{
START_HOOK(ALL_CREATURE_EVENT_ON_MODIFY_HEAL_RECEIVED);
Push(me);
Push(target);
Push(heal);
Push(spellInfo);
int healIndex = lua_gettop(L) - 1;
int n = SetupStack(AllCreatureEventBindings, key, 4);
while (n > 0)
{
int r = CallOneFunction(n--, 4, 1);
if (lua_isnumber(L, r))
{
heal = CHECKVAL<uint32>(L, r);
// Update the stack for subsequent calls.
ReplaceArgument(heal, healIndex);
}
lua_pop(L, 1);
}
CleanUpStack(4);
}
uint32 ALE::OnAllCreatureDealDamage(Creature* me, Unit* target, uint32 damage, DamageEffectType damagetype)
{
START_HOOK_WITH_RETVAL(ALL_CREATURE_EVENT_ON_DEAL_DAMAGE, damage);
uint32 result = damage;
Push(me);
Push(target);
Push(damage);
Push(damagetype);
int damageIndex = lua_gettop(L) - 1;
int n = SetupStack(AllCreatureEventBindings, key, 4);
while (n > 0)
{
int r = CallOneFunction(n--, 4, 1);
if (lua_isnumber(L, r))
{
result = CHECKVAL<uint32>(L, r);
// Update the stack for subsequent calls.
ReplaceArgument(result, damageIndex);
}
lua_pop(L, 1);
}
CleanUpStack(4);
return result;
}

View File

@@ -336,6 +336,15 @@ void ALE::OnCreatureAuraApply(Creature* me, Aura* aura)
CallAllFunctions(CreatureEventBindings, CreatureUniqueBindings, entry_key, unique_key); CallAllFunctions(CreatureEventBindings, CreatureUniqueBindings, entry_key, unique_key);
} }
void ALE::OnCreatureAuraRemove(Creature* me, Aura* aura, AuraRemoveMode mode)
{
START_HOOK(CREATURE_EVENT_ON_AURA_REMOVE, me);
Push(me);
Push(aura);
Push(mode);
CallAllFunctions(CreatureEventBindings, CreatureUniqueBindings, entry_key, unique_key);
}
void ALE::OnCreatureHeal(Creature* me, Unit* target, uint32& gain) void ALE::OnCreatureHeal(Creature* me, Unit* target, uint32& gain)
{ {
START_HOOK(CREATURE_EVENT_ON_HEAL, me); START_HOOK(CREATURE_EVENT_ON_HEAL, me);
@@ -384,4 +393,136 @@ void ALE::OnCreatureDamage(Creature* me, Unit* target, uint32& damage)
} }
CleanUpStack(3); CleanUpStack(3);
} }
void ALE::OnCreatureModifyPeriodicDamageAurasTick(Creature* me, Unit* target, uint32& damage, SpellInfo const* spellInfo)
{
START_HOOK(CREATURE_EVENT_ON_MODIFY_PERIODIC_DAMAGE_AURAS_TICK, me);
Push(me);
Push(target);
Push(damage);
Push(spellInfo);
int damageIndex = lua_gettop(L) - 1;
int n = SetupStack(CreatureEventBindings, CreatureUniqueBindings, entry_key, unique_key, 4);
while (n > 0)
{
int r = CallOneFunction(n--, 4, 1);
if (lua_isnumber(L, r))
{
damage = CHECKVAL<uint32>(L, r);
// Update the stack for subsequent calls.
ReplaceArgument(damage, damageIndex);
}
lua_pop(L, 1);
}
CleanUpStack(4);
}
void ALE::OnCreatureModifyMeleeDamage(Creature* me, Unit* target, uint32& damage)
{
START_HOOK(CREATURE_EVENT_ON_MODIFY_MELEE_DAMAGE, me);
Push(me);
Push(target);
Push(damage);
int damageIndex = lua_gettop(L);
int n = SetupStack(CreatureEventBindings, CreatureUniqueBindings, entry_key, unique_key, 3);
while (n > 0)
{
int r = CallOneFunction(n--, 3, 1);
if (lua_isnumber(L, r))
{
damage = CHECKVAL<uint32>(L, r);
// Update the stack for subsequent calls.
ReplaceArgument(damage, damageIndex);
}
lua_pop(L, 1);
}
CleanUpStack(3);
}
void ALE::OnCreatureModifySpellDamageTaken(Creature* me, Unit* target, int32& damage, SpellInfo const* spellInfo)
{
START_HOOK(CREATURE_EVENT_ON_MODIFY_SPELL_DAMAGE_TAKEN, me);
Push(me);
Push(target);
Push(damage);
Push(spellInfo);
int damageIndex = lua_gettop(L) - 1;
int n = SetupStack(CreatureEventBindings, CreatureUniqueBindings, entry_key, unique_key, 4);
while (n > 0)
{
int r = CallOneFunction(n--, 4, 1);
if (lua_isnumber(L, r))
{
damage = CHECKVAL<int32>(L, r);
// Update the stack for subsequent calls.
ReplaceArgument(damage, damageIndex);
}
lua_pop(L, 1);
}
CleanUpStack(4);
}
void ALE::OnCreatureModifyHealReceived(Creature* me, Unit* target, uint32& heal, SpellInfo const* spellInfo)
{
START_HOOK(CREATURE_EVENT_ON_MODIFY_HEAL_RECEIVED, me);
Push(me);
Push(target);
Push(heal);
Push(spellInfo);
int healIndex = lua_gettop(L) - 1;
int n = SetupStack(CreatureEventBindings, CreatureUniqueBindings, entry_key, unique_key, 4);
while (n > 0)
{
int r = CallOneFunction(n--, 4, 1);
if (lua_isnumber(L, r))
{
heal = CHECKVAL<uint32>(L, r);
// Update the stack for subsequent calls.
ReplaceArgument(heal, healIndex);
}
lua_pop(L, 1);
}
CleanUpStack(4);
}
uint32 ALE::OnCreatureDealDamage(Creature* me, Unit* target, uint32 damage, DamageEffectType damagetype)
{
START_HOOK_WITH_RETVAL(CREATURE_EVENT_ON_DEAL_DAMAGE, me, damage);
uint32 result = damage;
Push(me);
Push(target);
Push(damage);
Push(damagetype);
int damageIndex = lua_gettop(L) - 1;
int n = SetupStack(CreatureEventBindings, CreatureUniqueBindings, entry_key, unique_key, 4);
while (n > 0)
{
int r = CallOneFunction(n--, 4, 1);
if (lua_isnumber(L, r))
{
result = CHECKVAL<uint32>(L, r);
// Update the stack for subsequent calls.
ReplaceArgument(result, damageIndex);
}
lua_pop(L, 1);
}
CleanUpStack(4);
return result;
}

View File

@@ -826,3 +826,144 @@ void ALE::OnPlayerDamage(Player* player, Unit* target, uint32& damage)
CleanUpStack(3); CleanUpStack(3);
} }
void ALE::OnPlayerAuraRemove(Player* player, Aura* aura, AuraRemoveMode mode)
{
START_HOOK(PLAYER_EVENT_ON_AURA_REMOVE);
Push(player);
Push(aura);
Push(mode);
CallAllFunctions(PlayerEventBindings, key);
}
void ALE::OnPlayerModifyPeriodicDamageAurasTick(Player* player, Unit* target, uint32& damage, SpellInfo const* spellInfo)
{
START_HOOK(PLAYER_EVENT_ON_MODIFY_PERIODIC_DAMAGE_AURAS_TICK);
Push(player);
Push(target);
Push(damage);
Push(spellInfo);
int damageIndex = lua_gettop(L) - 1;
int n = SetupStack(PlayerEventBindings, key, 4);
while (n > 0)
{
int r = CallOneFunction(n--, 4, 1);
if (lua_isnumber(L, r))
{
damage = CHECKVAL<uint32>(L, r);
// Update the stack for subsequent calls.
ReplaceArgument(damage, damageIndex);
}
lua_pop(L, 1);
}
CleanUpStack(4);
}
void ALE::OnPlayerModifyMeleeDamage(Player* player, Unit* target, uint32& damage)
{
START_HOOK(PLAYER_EVENT_ON_MODIFY_MELEE_DAMAGE);
Push(player);
Push(target);
Push(damage);
int damageIndex = lua_gettop(L);
int n = SetupStack(PlayerEventBindings, key, 3);
while (n > 0)
{
int r = CallOneFunction(n--, 3, 1);
if (lua_isnumber(L, r))
{
damage = CHECKVAL<uint32>(L, r);
// Update the stack for subsequent calls.
ReplaceArgument(damage, damageIndex);
}
lua_pop(L, 1);
}
CleanUpStack(3);
}
void ALE::OnPlayerModifySpellDamageTaken(Player* player, Unit* target, int32& damage, SpellInfo const* spellInfo)
{
START_HOOK(PLAYER_EVENT_ON_MODIFY_SPELL_DAMAGE_TAKEN);
Push(player);
Push(target);
Push(damage);
Push(spellInfo);
int damageIndex = lua_gettop(L) - 1;
int n = SetupStack(PlayerEventBindings, key, 4);
while (n > 0)
{
int r = CallOneFunction(n--, 4, 1);
if (lua_isnumber(L, r))
{
damage = CHECKVAL<int32>(L, r);
// Update the stack for subsequent calls.
ReplaceArgument(damage, damageIndex);
}
lua_pop(L, 1);
}
CleanUpStack(4);
}
void ALE::OnPlayerModifyHealReceived(Player* player, Unit* target, uint32& heal, SpellInfo const* spellInfo)
{
START_HOOK(PLAYER_EVENT_ON_MODIFY_HEAL_RECEIVED);
Push(player);
Push(target);
Push(heal);
Push(spellInfo);
int healIndex = lua_gettop(L) - 1;
int n = SetupStack(PlayerEventBindings, key, 4);
while (n > 0)
{
int r = CallOneFunction(n--, 4, 1);
if (lua_isnumber(L, r))
{
heal = CHECKVAL<uint32>(L, r);
// Update the stack for subsequent calls.
ReplaceArgument(heal, healIndex);
}
lua_pop(L, 1);
}
CleanUpStack(4);
}
uint32 ALE::OnPlayerDealDamage(Player* player, Unit* target, uint32 damage, DamageEffectType damagetype)
{
START_HOOK_WITH_RETVAL(PLAYER_EVENT_ON_DEAL_DAMAGE, damage);
Push(player);
Push(target);
Push(damage);
Push(damagetype);
int damageIndex = lua_gettop(L) - 1;
int n = SetupStack(PlayerEventBindings, key, 4);
uint32 result = damage;
while (n > 0)
{
int r = CallOneFunction(n--, 4, 1);
if (lua_isnumber(L, r))
{
result = CHECKVAL<uint32>(L, r);
// Update the stack for subsequent calls.
ReplaceArgument(result, damageIndex);
}
lua_pop(L, 1);
}
CleanUpStack(4);
return result;
}

View File

@@ -719,74 +719,80 @@ namespace LuaGlobalFunctions
* <pre> * <pre>
* enum PlayerEvents * enum PlayerEvents
* { * {
* PLAYER_EVENT_ON_CHARACTER_CREATE = 1, // (event, player) * PLAYER_EVENT_ON_CHARACTER_CREATE = 1, // (event, player)
* PLAYER_EVENT_ON_CHARACTER_DELETE = 2, // (event, guid) * PLAYER_EVENT_ON_CHARACTER_DELETE = 2, // (event, guid)
* PLAYER_EVENT_ON_LOGIN = 3, // (event, player) * PLAYER_EVENT_ON_LOGIN = 3, // (event, player)
* PLAYER_EVENT_ON_LOGOUT = 4, // (event, player) * PLAYER_EVENT_ON_LOGOUT = 4, // (event, player)
* PLAYER_EVENT_ON_SPELL_CAST = 5, // (event, player, spell, skipCheck) * PLAYER_EVENT_ON_SPELL_CAST = 5, // (event, player, spell, skipCheck)
* PLAYER_EVENT_ON_KILL_PLAYER = 6, // (event, killer, killed) * PLAYER_EVENT_ON_KILL_PLAYER = 6, // (event, killer, killed)
* PLAYER_EVENT_ON_KILL_CREATURE = 7, // (event, killer, killed) * PLAYER_EVENT_ON_KILL_CREATURE = 7, // (event, killer, killed)
* PLAYER_EVENT_ON_KILLED_BY_CREATURE = 8, // (event, killer, killed) * PLAYER_EVENT_ON_KILLED_BY_CREATURE = 8, // (event, killer, killed)
* PLAYER_EVENT_ON_DUEL_REQUEST = 9, // (event, target, challenger) * PLAYER_EVENT_ON_DUEL_REQUEST = 9, // (event, target, challenger)
* PLAYER_EVENT_ON_DUEL_START = 10, // (event, player1, player2) * PLAYER_EVENT_ON_DUEL_START = 10, // (event, player1, player2)
* PLAYER_EVENT_ON_DUEL_END = 11, // (event, winner, loser, type) * PLAYER_EVENT_ON_DUEL_END = 11, // (event, winner, loser, type)
* PLAYER_EVENT_ON_GIVE_XP = 12, // (event, player, amount, victim, source) - Can return new XP amount * PLAYER_EVENT_ON_GIVE_XP = 12, // (event, player, amount, victim, source) - Can return new XP amount
* PLAYER_EVENT_ON_LEVEL_CHANGE = 13, // (event, player, oldLevel) * PLAYER_EVENT_ON_LEVEL_CHANGE = 13, // (event, player, oldLevel)
* PLAYER_EVENT_ON_MONEY_CHANGE = 14, // (event, player, amount) - Can return new money amount * PLAYER_EVENT_ON_MONEY_CHANGE = 14, // (event, player, amount) - Can return new money amount
* PLAYER_EVENT_ON_REPUTATION_CHANGE = 15, // (event, player, factionId, standing, incremental) - Can return new standing -> if standing == -1, it will prevent default action (rep gain) * PLAYER_EVENT_ON_REPUTATION_CHANGE = 15, // (event, player, factionId, standing, incremental) - Can return new standing -> if standing == -1, it will prevent default action (rep gain)
* PLAYER_EVENT_ON_TALENTS_CHANGE = 16, // (event, player, points) * PLAYER_EVENT_ON_TALENTS_CHANGE = 16, // (event, player, points)
* PLAYER_EVENT_ON_TALENTS_RESET = 17, // (event, player, noCost) * PLAYER_EVENT_ON_TALENTS_RESET = 17, // (event, player, noCost)
* PLAYER_EVENT_ON_CHAT = 18, // (event, player, msg, Type, lang) - Can return false, newMessage * PLAYER_EVENT_ON_CHAT = 18, // (event, player, msg, Type, lang) - Can return false, newMessage
* PLAYER_EVENT_ON_WHISPER = 19, // (event, player, msg, Type, lang, receiver) - Can return false, newMessage * PLAYER_EVENT_ON_WHISPER = 19, // (event, player, msg, Type, lang, receiver) - Can return false, newMessage
* PLAYER_EVENT_ON_GROUP_CHAT = 20, // (event, player, msg, Type, lang, group) - Can return false, newMessage * PLAYER_EVENT_ON_GROUP_CHAT = 20, // (event, player, msg, Type, lang, group) - Can return false, newMessage
* PLAYER_EVENT_ON_GUILD_CHAT = 21, // (event, player, msg, Type, lang, guild) - Can return false, newMessage * PLAYER_EVENT_ON_GUILD_CHAT = 21, // (event, player, msg, Type, lang, guild) - Can return false, newMessage
* PLAYER_EVENT_ON_CHANNEL_CHAT = 22, // (event, player, msg, Type, lang, channel) - channel is negative for custom channels. Can return false, newMessage * PLAYER_EVENT_ON_CHANNEL_CHAT = 22, // (event, player, msg, Type, lang, channel) - channel is negative for custom channels. Can return false, newMessage
* PLAYER_EVENT_ON_EMOTE = 23, // (event, player, emote) - Not triggered on any known emote * PLAYER_EVENT_ON_EMOTE = 23, // (event, player, emote) - Not triggered on any known emote
* PLAYER_EVENT_ON_TEXT_EMOTE = 24, // (event, player, textEmote, emoteNum, guid) * PLAYER_EVENT_ON_TEXT_EMOTE = 24, // (event, player, textEmote, emoteNum, guid)
* PLAYER_EVENT_ON_SAVE = 25, // (event, player) * PLAYER_EVENT_ON_SAVE = 25, // (event, player)
* PLAYER_EVENT_ON_BIND_TO_INSTANCE = 26, // (event, player, difficulty, mapid, permanent) * PLAYER_EVENT_ON_BIND_TO_INSTANCE = 26, // (event, player, difficulty, mapid, permanent)
* PLAYER_EVENT_ON_UPDATE_ZONE = 27, // (event, player, newZone, newArea) * PLAYER_EVENT_ON_UPDATE_ZONE = 27, // (event, player, newZone, newArea)
* PLAYER_EVENT_ON_MAP_CHANGE = 28, // (event, player) * PLAYER_EVENT_ON_MAP_CHANGE = 28, // (event, player)
* *
* // Custom * // Custom
* PLAYER_EVENT_ON_EQUIP = 29, // (event, player, item, bag, slot) * PLAYER_EVENT_ON_EQUIP = 29, // (event, player, item, bag, slot)
* PLAYER_EVENT_ON_FIRST_LOGIN = 30, // (event, player) * PLAYER_EVENT_ON_FIRST_LOGIN = 30, // (event, player)
* PLAYER_EVENT_ON_CAN_USE_ITEM = 31, // (event, player, itemEntry) - Can return InventoryResult enum value * PLAYER_EVENT_ON_CAN_USE_ITEM = 31, // (event, player, itemEntry) - Can return InventoryResult enum value
* PLAYER_EVENT_ON_LOOT_ITEM = 32, // (event, player, item, count) * PLAYER_EVENT_ON_LOOT_ITEM = 32, // (event, player, item, count)
* PLAYER_EVENT_ON_ENTER_COMBAT = 33, // (event, player, enemy) * PLAYER_EVENT_ON_ENTER_COMBAT = 33, // (event, player, enemy)
* PLAYER_EVENT_ON_LEAVE_COMBAT = 34, // (event, player) * PLAYER_EVENT_ON_LEAVE_COMBAT = 34, // (event, player)
* PLAYER_EVENT_ON_REPOP = 35, // (event, player) * PLAYER_EVENT_ON_REPOP = 35, // (event, player)
* PLAYER_EVENT_ON_RESURRECT = 36, // (event, player) * PLAYER_EVENT_ON_RESURRECT = 36, // (event, player)
* PLAYER_EVENT_ON_LOOT_MONEY = 37, // (event, player, amount) * PLAYER_EVENT_ON_LOOT_MONEY = 37, // (event, player, amount)
* PLAYER_EVENT_ON_QUEST_ABANDON = 38, // (event, player, questId) * PLAYER_EVENT_ON_QUEST_ABANDON = 38, // (event, player, questId)
* PLAYER_EVENT_ON_LEARN_TALENTS = 39, // (event, player, talentId, talentRank, spellid) * PLAYER_EVENT_ON_LEARN_TALENTS = 39, // (event, player, talentId, talentRank, spellid)
* // UNUSED = 40, // (event, player) * // UNUSED = 40, // (event, player)
* // UNUSED = 41, // (event, player) * // UNUSED = 41, // (event, player)
* PLAYER_EVENT_ON_COMMAND = 42, // (event, player, command, chatHandler) - player is nil if command used from console. Can return false * PLAYER_EVENT_ON_COMMAND = 42, // (event, player, command, chatHandler) - player is nil if command used from console. Can return false
* PLAYER_EVENT_ON_PET_ADDED_TO_WORLD = 43, // (event, player, pet) * PLAYER_EVENT_ON_PET_ADDED_TO_WORLD = 43, // (event, player, pet)
* PLAYER_EVENT_ON_LEARN_SPELL = 44, // (event, player, spellId) * PLAYER_EVENT_ON_LEARN_SPELL = 44, // (event, player, spellId)
* PLAYER_EVENT_ON_ACHIEVEMENT_COMPLETE = 45, // (event, player, achievement) * PLAYER_EVENT_ON_ACHIEVEMENT_COMPLETE = 45, // (event, player, achievement)
* PLAYER_EVENT_ON_FFAPVP_CHANGE = 46, // (event, player, hasFfaPvp) * PLAYER_EVENT_ON_FFAPVP_CHANGE = 46, // (event, player, hasFfaPvp)
* PLAYER_EVENT_ON_UPDATE_AREA = 47, // (event, player, oldArea, newArea) * PLAYER_EVENT_ON_UPDATE_AREA = 47, // (event, player, oldArea, newArea)
* PLAYER_EVENT_ON_CAN_INIT_TRADE = 48, // (event, player, target) - Can return false to prevent the trade * PLAYER_EVENT_ON_CAN_INIT_TRADE = 48, // (event, player, target) - Can return false to prevent the trade
* PLAYER_EVENT_ON_CAN_SEND_MAIL = 49, // (event, player, receiverGuid, mailbox, subject, body, money, cod, item) - Can return false to prevent sending the mail * PLAYER_EVENT_ON_CAN_SEND_MAIL = 49, // (event, player, receiverGuid, mailbox, subject, body, money, cod, item) - Can return false to prevent sending the mail
* PLAYER_EVENT_ON_CAN_JOIN_LFG = 50, // (event, player, roles, dungeons, comment) - Can return false to prevent queueing * PLAYER_EVENT_ON_CAN_JOIN_LFG = 50, // (event, player, roles, dungeons, comment) - Can return false to prevent queueing
* PLAYER_EVENT_ON_QUEST_REWARD_ITEM = 51, // (event, player, item, count) * PLAYER_EVENT_ON_QUEST_REWARD_ITEM = 51, // (event, player, item, count)
* PLAYER_EVENT_ON_CREATE_ITEM = 52, // (event, player, item, count) * PLAYER_EVENT_ON_CREATE_ITEM = 52, // (event, player, item, count)
* PLAYER_EVENT_ON_STORE_NEW_ITEM = 53, // (event, player, item, count) * PLAYER_EVENT_ON_STORE_NEW_ITEM = 53, // (event, player, item, count)
* PLAYER_EVENT_ON_COMPLETE_QUEST = 54, // (event, player, quest) * PLAYER_EVENT_ON_COMPLETE_QUEST = 54, // (event, player, quest)
* PLAYER_EVENT_ON_CAN_GROUP_INVITE = 55, // (event, player, memberName) - Can return false to prevent inviting * PLAYER_EVENT_ON_CAN_GROUP_INVITE = 55, // (event, player, memberName) - Can return false to prevent inviting
* PLAYER_EVENT_ON_GROUP_ROLL_REWARD_ITEM = 56, // (event, player, item, count, voteType, roll) * PLAYER_EVENT_ON_GROUP_ROLL_REWARD_ITEM = 56, // (event, player, item, count, voteType, roll)
* PLAYER_EVENT_ON_BG_DESERTION = 57, // (event, player, type) * PLAYER_EVENT_ON_BG_DESERTION = 57, // (event, player, type)
* PLAYER_EVENT_ON_PET_KILL = 58, // (event, player, killer) * PLAYER_EVENT_ON_PET_KILL = 58, // (event, player, killer)
* PLAYER_EVENT_ON_CAN_RESURRECT = 59, // (event, player) * PLAYER_EVENT_ON_CAN_RESURRECT = 59, // (event, player)
* PLAYER_EVENT_ON_CAN_UPDATE_SKILL = 60, // (event, player, skill_id) -- Can return true or false * PLAYER_EVENT_ON_CAN_UPDATE_SKILL = 60, // (event, player, skill_id) -- Can return true or false
* PLAYER_EVENT_ON_BEFORE_UPDATE_SKILL = 61, // (event, player, skill_id, value, max, step) -- Can return new amount * PLAYER_EVENT_ON_BEFORE_UPDATE_SKILL = 61, // (event, player, skill_id, value, max, step) -- Can return new amount
* PLAYER_EVENT_ON_UPDATE_SKILL = 62, // (event, player, skill_id, value, max, step, new_value) * PLAYER_EVENT_ON_UPDATE_SKILL = 62, // (event, player, skill_id, value, max, step, new_value)
* PLAYER_EVENT_ON_QUEST_ACCEPT = 63, // (event, player, quest) * PLAYER_EVENT_ON_QUEST_ACCEPT = 63, // (event, player, quest)
* PLAYER_EVENT_ON_AURA_APPLY = 64, // (event, player, aura) * PLAYER_EVENT_ON_AURA_APPLY = 64, // (event, player, aura)
* PLAYER_EVENT_ON_HEAL = 65, // (event, player, target, heal) - Can return new heal amount * PLAYER_EVENT_ON_HEAL = 65, // (event, player, target, heal) - Can return new heal amount
* PLAYER_EVENT_ON_DAMAGE = 66, // (event, player, target, damage) - Can return new damage amount * PLAYER_EVENT_ON_DAMAGE = 66, // (event, player, target, damage) - Can return new damage amount
* PLAYER_EVENT_ON_AURA_REMOVE = 67, // (event, player, aura, remove_mode)
* PLAYER_EVENT_ON_MODIFY_PERIODIC_DAMAGE_AURAS_TICK = 68, // (event, player, target, damage, spellInfo) - Can return new damage amount
* PLAYER_EVENT_ON_MODIFY_MELEE_DAMAGE = 69, // (event, player, target, damage) - Can return new damage amount
* PLAYER_EVENT_ON_MODIFY_SPELL_DAMAGE_TAKEN = 70, // (event, player, target, damage, spellInfo) - Can return new damage amount
* PLAYER_EVENT_ON_MODIFY_HEAL_RECEIVED = 71, // (event, player, target, heal, spellInfo) - Can return new heal amount
* PLAYER_EVENT_ON_DEAL_DAMAGE = 72, // (event, player, target, damage, damagetype) - Can return new damage amount
* }; * };
* </pre> * </pre>
* *
@@ -1130,46 +1136,52 @@ namespace LuaGlobalFunctions
* <pre> * <pre>
* enum CreatureEvents * enum CreatureEvents
* { * {
* CREATURE_EVENT_ON_ENTER_COMBAT = 1, // (event, creature, target) - Can return true to stop normal action * CREATURE_EVENT_ON_ENTER_COMBAT = 1, // (event, creature, target) - Can return true to stop normal action
* CREATURE_EVENT_ON_LEAVE_COMBAT = 2, // (event, creature) - Can return true to stop normal action * CREATURE_EVENT_ON_LEAVE_COMBAT = 2, // (event, creature) - Can return true to stop normal action
* CREATURE_EVENT_ON_TARGET_DIED = 3, // (event, creature, victim) - Can return true to stop normal action * CREATURE_EVENT_ON_TARGET_DIED = 3, // (event, creature, victim) - Can return true to stop normal action
* CREATURE_EVENT_ON_DIED = 4, // (event, creature, killer) - Can return true to stop normal action * CREATURE_EVENT_ON_DIED = 4, // (event, creature, killer) - Can return true to stop normal action
* CREATURE_EVENT_ON_SPAWN = 5, // (event, creature) - Can return true to stop normal action * CREATURE_EVENT_ON_SPAWN = 5, // (event, creature) - Can return true to stop normal action
* CREATURE_EVENT_ON_REACH_WP = 6, // (event, creature, type, id) - Can return true to stop normal action * CREATURE_EVENT_ON_REACH_WP = 6, // (event, creature, type, id) - Can return true to stop normal action
* CREATURE_EVENT_ON_AIUPDATE = 7, // (event, creature, diff) - Can return true to stop normal action * CREATURE_EVENT_ON_AIUPDATE = 7, // (event, creature, diff) - Can return true to stop normal action
* CREATURE_EVENT_ON_RECEIVE_EMOTE = 8, // (event, creature, player, emoteid) - Can return true to stop normal action * CREATURE_EVENT_ON_RECEIVE_EMOTE = 8, // (event, creature, player, emoteid) - Can return true to stop normal action
* CREATURE_EVENT_ON_DAMAGE_TAKEN = 9, // (event, creature, attacker, damage) - Can return true to stop normal action, can return new damage as second return value. * CREATURE_EVENT_ON_DAMAGE_TAKEN = 9, // (event, creature, attacker, damage) - Can return true to stop normal action, can return new damage as second return value.
* CREATURE_EVENT_ON_PRE_COMBAT = 10, // (event, creature, target) - Can return true to stop normal action * CREATURE_EVENT_ON_PRE_COMBAT = 10, // (event, creature, target) - Can return true to stop normal action
* // UNUSED * // UNUSED
* CREATURE_EVENT_ON_OWNER_ATTACKED = 12, // (event, creature, target) - Can return true to stop normal action // Not on mangos * CREATURE_EVENT_ON_OWNER_ATTACKED = 12, // (event, creature, target) - Can return true to stop normal action // Not on mangos
* CREATURE_EVENT_ON_OWNER_ATTACKED_AT = 13, // (event, creature, attacker) - Can return true to stop normal action // Not on mangos * CREATURE_EVENT_ON_OWNER_ATTACKED_AT = 13, // (event, creature, attacker) - Can return true to stop normal action // Not on mangos
* CREATURE_EVENT_ON_HIT_BY_SPELL = 14, // (event, creature, caster, spellid) - Can return true to stop normal action * CREATURE_EVENT_ON_HIT_BY_SPELL = 14, // (event, creature, caster, spellid) - Can return true to stop normal action
* CREATURE_EVENT_ON_SPELL_HIT_TARGET = 15, // (event, creature, target, spellid) - Can return true to stop normal action * CREATURE_EVENT_ON_SPELL_HIT_TARGET = 15, // (event, creature, target, spellid) - Can return true to stop normal action
* // UNUSED = 16, // (event, creature) * // UNUSED = 16, // (event, creature)
* // UNUSED = 17, // (event, creature) * // UNUSED = 17, // (event, creature)
* // UNUSED = 18, // (event, creature) * // UNUSED = 18, // (event, creature)
* CREATURE_EVENT_ON_JUST_SUMMONED_CREATURE = 19, // (event, creature, summon) - Can return true to stop normal action * CREATURE_EVENT_ON_JUST_SUMMONED_CREATURE = 19, // (event, creature, summon) - Can return true to stop normal action
* CREATURE_EVENT_ON_SUMMONED_CREATURE_DESPAWN = 20, // (event, creature, summon) - Can return true to stop normal action * CREATURE_EVENT_ON_SUMMONED_CREATURE_DESPAWN = 20, // (event, creature, summon) - Can return true to stop normal action
* CREATURE_EVENT_ON_SUMMONED_CREATURE_DIED = 21, // (event, creature, summon, killer) - Can return true to stop normal action // Not on mangos * CREATURE_EVENT_ON_SUMMONED_CREATURE_DIED = 21, // (event, creature, summon, killer) - Can return true to stop normal action // Not on mangos
* CREATURE_EVENT_ON_SUMMONED = 22, // (event, creature, summoner) - Can return true to stop normal action * CREATURE_EVENT_ON_SUMMONED = 22, // (event, creature, summoner) - Can return true to stop normal action
* CREATURE_EVENT_ON_RESET = 23, // (event, creature) * CREATURE_EVENT_ON_RESET = 23, // (event, creature)
* CREATURE_EVENT_ON_REACH_HOME = 24, // (event, creature) - Can return true to stop normal action * CREATURE_EVENT_ON_REACH_HOME = 24, // (event, creature) - Can return true to stop normal action
* // UNUSED = 25, // (event, creature) * // UNUSED = 25, // (event, creature)
* CREATURE_EVENT_ON_CORPSE_REMOVED = 26, // (event, creature, respawndelay) - Can return true to stop normal action, can return new respawndelay as second return value * CREATURE_EVENT_ON_CORPSE_REMOVED = 26, // (event, creature, respawndelay) - Can return true to stop normal action, can return new respawndelay as second return value
* CREATURE_EVENT_ON_MOVE_IN_LOS = 27, // (event, creature, unit) - Can return true to stop normal action. Does not actually check LOS, just uses the sight range * CREATURE_EVENT_ON_MOVE_IN_LOS = 27, // (event, creature, unit) - Can return true to stop normal action. Does not actually check LOS, just uses the sight range
* // UNUSED = 28, // (event, creature) * // UNUSED = 28, // (event, creature)
* // UNUSED = 29, // (event, creature) * // UNUSED = 29, // (event, creature)
* CREATURE_EVENT_ON_DUMMY_EFFECT = 30, // (event, caster, spellid, effindex, creature) * CREATURE_EVENT_ON_DUMMY_EFFECT = 30, // (event, caster, spellid, effindex, creature)
* CREATURE_EVENT_ON_QUEST_ACCEPT = 31, // (event, player, creature, quest) - Can return true * CREATURE_EVENT_ON_QUEST_ACCEPT = 31, // (event, player, creature, quest) - Can return true
* // UNUSED = 32, // (event, creature) * // UNUSED = 32, // (event, creature)
* // UNUSED = 33, // (event, creature) * // UNUSED = 33, // (event, creature)
* CREATURE_EVENT_ON_QUEST_REWARD = 34, // (event, player, creature, quest, opt) - Can return true * CREATURE_EVENT_ON_QUEST_REWARD = 34, // (event, player, creature, quest, opt) - Can return true
* CREATURE_EVENT_ON_DIALOG_STATUS = 35, // (event, player, creature) * CREATURE_EVENT_ON_DIALOG_STATUS = 35, // (event, player, creature)
* CREATURE_EVENT_ON_ADD = 36, // (event, creature) * CREATURE_EVENT_ON_ADD = 36, // (event, creature)
* CREATURE_EVENT_ON_REMOVE = 37, // (event, creature) * CREATURE_EVENT_ON_REMOVE = 37, // (event, creature)
* CREATURE_EVENT_ON_AURA_APPLY = 38, // (event, creature, aura) * CREATURE_EVENT_ON_AURA_APPLY = 38, // (event, creature, aura)
* CREATURE_EVENT_ON_HEAL = 39, // (event, creature, target, heal) - Can return new heal amount * CREATURE_EVENT_ON_HEAL = 39, // (event, creature, target, heal) - Can return new heal amount
* CREATURE_EVENT_ON_DAMAGE = 40, // (event, creature, target, damage) - Can return new damage amount * CREATURE_EVENT_ON_DAMAGE = 40, // (event, creature, target, damage) - Can return new damage amount
* CREATURE_EVENT_ON_AURA_REMOVE = 41, // (event, creature, aura, remove_mode)
* CREATURE_EVENT_ON_MODIFY_PERIODIC_DAMAGE_AURAS_TICK = 42, // (event, creature, target, damage, spellInfo) - Can return new damage amount
* CREATURE_EVENT_ON_MODIFY_MELEE_DAMAGE = 43, // (event, creature, target, damage) - Can return new damage amount
* CREATURE_EVENT_ON_MODIFY_SPELL_DAMAGE_TAKEN = 44, // (event, creature, target, damage, spellInfo) - Can return new damage amount
* CREATURE_EVENT_ON_MODIFY_HEAL_RECEIVED = 45, // (event, creature, target, heal, spellInfo) - Can return new heal amount
* CREATURE_EVENT_ON_DEAL_DAMAGE = 46, // (event, creature, target, damage, damagetype) - Can return new damage amount
* CREATURE_EVENT_COUNT * CREATURE_EVENT_COUNT
* }; * };
* </pre> * </pre>
@@ -1232,6 +1244,15 @@ namespace LuaGlobalFunctions
* CREATURE_EVENT_ON_DIALOG_STATUS = 35, // (event, player, creature) * CREATURE_EVENT_ON_DIALOG_STATUS = 35, // (event, player, creature)
* CREATURE_EVENT_ON_ADD = 36, // (event, creature) * CREATURE_EVENT_ON_ADD = 36, // (event, creature)
* CREATURE_EVENT_ON_REMOVE = 37, // (event, creature) * CREATURE_EVENT_ON_REMOVE = 37, // (event, creature)
* CREATURE_EVENT_ON_AURA_APPLY = 38, // (event, creature, aura)
* CREATURE_EVENT_ON_HEAL = 39, // (event, creature, target, gain) - Can return new heal amount
* CREATURE_EVENT_ON_DAMAGE = 40, // (event, creature, target, damage) - Can return new damage amount
* CREATURE_EVENT_ON_AURA_REMOVE = 41, // (event, creature, aura, remove_mode)
* CREATURE_EVENT_ON_MODIFY_PERIODIC_DAMAGE_AURAS_TICK = 42, // (event, creature, target, damage, spellInfo) - Can return new damage amount
* CREATURE_EVENT_ON_MODIFY_MELEE_DAMAGE = 43, // (event, creature, target, damage) - Can return new damage amount
* CREATURE_EVENT_ON_MODIFY_SPELL_DAMAGE_TAKEN = 44, // (event, creature, target, damage, spellInfo) - Can return new damage amount
* CREATURE_EVENT_ON_MODIFY_HEAL_RECEIVED = 45, // (event, creature, target, heal, spellInfo) - Can return new heal amount
* CREATURE_EVENT_ON_DEAL_DAMAGE = 46, // (event, creature, target, damage, damagetype) - Can return new damage amount
* CREATURE_EVENT_COUNT * CREATURE_EVENT_COUNT
* }; * };
* </pre> * </pre>
@@ -1344,10 +1365,19 @@ namespace LuaGlobalFunctions
* <pre> * <pre>
* enum AllCreatureEvents * enum AllCreatureEvents
* { * {
* ALL_CREATURE_EVENT_ON_ADD = 1, // (event, creature) * ALL_CREATURE_EVENT_ON_ADD = 1, // (event, creature)
* ALL_CREATURE_EVENT_ON_REMOVE = 2, // (event, creature) * ALL_CREATURE_EVENT_ON_REMOVE = 2, // (event, creature)
* ALL_CREATURE_EVENT_ON_SELECT_LEVEL = 3, // (event, creature_template, creature) * ALL_CREATURE_EVENT_ON_SELECT_LEVEL = 3, // (event, creature_template, creature)
* ALL_CREATURE_EVENT_ON_BEFORE_SELECT_LEVEL = 4, // (event, creature_template, creature, level) - Can return the new level * ALL_CREATURE_EVENT_ON_BEFORE_SELECT_LEVEL = 4, // (event, creature_template, creature, level) - Can return the new level
* ALL_CREATURE_EVENT_ON_AURA_APPLY = 5, // (event, creature, aura)
* ALL_CREATURE_EVENT_ON_HEAL = 6, // (event, creature, target, gain) - Can return new heal amount
* ALL_CREATURE_EVENT_ON_DAMAGE = 7, // (event, creature, target, damage) - Can return new damage amount
* ALL_CREATURE_EVENT_ON_AURA_REMOVE = 8, // (event, creature, aura, remove_mode)
* ALL_CREATURE_EVENT_ON_MODIFY_PERIODIC_DAMAGE_AURAS_TICK = 9, // (event, creature, target, damage, spellInfo) - Can return new damage amount
* ALL_CREATURE_EVENT_ON_MODIFY_MELEE_DAMAGE = 10, // (event, creature, target, damage) - Can return new damage amount
* ALL_CREATURE_EVENT_ON_MODIFY_SPELL_DAMAGE_TAKEN = 11, // (event, creature, target, damage, spellInfo) - Can return new damage amount
* ALL_CREATURE_EVENT_ON_MODIFY_HEAL_RECEIVED = 12, // (event, creature, target, heal, spellInfo) - Can return new heal amount
* ALL_CREATURE_EVENT_ON_DEAL_DAMAGE = 13, // (event, creature, target, damage, damagetype) - Can return new damage amount
* ALL_CREATURE_EVENT_COUNT * ALL_CREATURE_EVENT_COUNT
* }; * };
* </pre> * </pre>