2023-03-12 08:55:05 -06:00
|
|
|
local SWG_ID = {68, 400013, 400033, 400014, 1976}
|
2023-02-15 15:04:02 -07:00
|
|
|
local SPELL_ID = 100141
|
|
|
|
|
|
|
|
|
|
function OnSpellCast(event, caster, spell)
|
2023-03-12 08:55:05 -06:00
|
|
|
local target = spell:GetTarget()
|
|
|
|
|
if target and spell:GetEntry() == SPELL_ID then
|
|
|
|
|
local isValidTarget = false
|
|
|
|
|
for _, swgID in ipairs(SWG_ID) do
|
|
|
|
|
if target:GetEntry() == swgID then
|
|
|
|
|
isValidTarget = true
|
|
|
|
|
break
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
if not isValidTarget then
|
|
|
|
|
caster:SendBroadcastMessage("That target is not valid.")
|
|
|
|
|
spell:Cancel()
|
|
|
|
|
elseif target:HasAura(SPELL_ID) then
|
|
|
|
|
caster:SendBroadcastMessage("Target has already been empowered.")
|
|
|
|
|
spell:Cancel()
|
|
|
|
|
else
|
|
|
|
|
-- give kill credit to NPC ID 68
|
|
|
|
|
caster:KilledMonsterCredit(68)
|
|
|
|
|
end
|
|
|
|
|
end
|
2023-02-15 15:04:02 -07:00
|
|
|
end
|
|
|
|
|
|
2023-03-12 08:55:05 -06:00
|
|
|
RegisterPlayerEvent(5, OnSpellCast)
|