Add files via upload

This commit is contained in:
Dinkledork
2023-03-09 03:36:13 -07:00
committed by GitHub
parent 853f202792
commit eae97d262b
23 changed files with 403 additions and 23 deletions

View File

@@ -30,12 +30,24 @@ local function CastAntiMagicZone(eventId, delay, calls, creature)
creature:CastSpell(creature, 51052, true)
end
local function CastSpecialSpell(eventId, delay, calls, creature)
local victim = creature:GetVictim()
if not victim then
return
end
if victim:GetEntry() == 32666 or victim:GetEntry() == 32667 or victim:GetEntry() == 31144 or victim:GetEntry() == 31146 then
creature:CastSpell(victim, 5, true)
end
end
local function OnEnterCombat(event, creature, target)
creature:RegisterEvent(CastIcyTouch, 5000, 0)
creature:RegisterEvent(CastPlagueStrike, 6000, 0)
creature:RegisterEvent(CastDeathstrike, 25000, 0)
creature:RegisterEvent(CastBloodBoil, math.random(12000, 18000), 0)
creature:RegisterEvent(CastDnD, 100, 1)
creature:RegisterEvent(CastSpecialSpell, 1000, 0)
end
local function OnLeaveCombat(event, creature)

View File

@@ -23,7 +23,7 @@ creature:RemoveEvents()
end
function BlightedZombie.OnDeath(event, creature, killer)
creature:RemoveCorpse()
creature:DespawnOrUnsummon(5000)
creature:RemoveEvents()
end

View File

@@ -8,9 +8,21 @@ local function CastSpit(eventId, delay, calls, creature)
creature:CastSpell(creature:GetVictim(), 25262, true)
end
local function CastSpecialSpell(eventId, delay, calls, creature)
local victim = creature:GetVictim()
if not victim then
return
end
if victim:GetEntry() == 32666 or victim:GetEntry() == 32667 or victim:GetEntry() == 31144 or victim:GetEntry() == 31146 then
creature:CastSpell(victim, 5, true)
end
end
local function OnEnterCombat(event, creature, target)
creature:RegisterEvent(CastArmyOfTheDead, 25000, 0)
creature:RegisterEvent(CastSpit, 5000, 0)
creature:RegisterEvent(CastSpecialSpell, 1000, 0)
end
local function OnLeaveCombat(event, creature)
@@ -22,6 +34,7 @@ creature:RegisterEvent(CastArmyOfTheDead, 1000, 1)
end
local function OnDied(event, creature, killer)
creature:DespawnOrUnsummon(5000)
creature:RemoveEvents()
end

View File

@@ -8,9 +8,20 @@ local function CastEarthquake(eventId, delay, calls, creature)
creature:CastSpell(creature:GetVictim(), 33919, true)
end
local function CastSpecialSpell(eventId, delay, calls, creature)
local victim = creature:GetVictim()
if not victim then
return
end
if victim:GetEntry() == 32666 or victim:GetEntry() == 32667 or victim:GetEntry() == 31144 or victim:GetEntry() == 31146 then
creature:CastSpell(victim, 5, true)
end
end
local function OnEnterCombat(event, creature, target)
creature:RegisterEvent(CastShadowCleave, 5000, 0)
creature:RegisterEvent(CastEarthquake, 12000, 0)
creature:RegisterEvent(CastSpecialSpell, 1000, 0)
end
local function OnLeaveCombat(event, creature)

View File

@@ -18,7 +18,7 @@ local function OnLeaveCombat(event, creature)
end
local function OnDied(event, creature, killer)
creature:RemoveCorpse()
creature:DespawnOrUnsummon(5000)
creature:RemoveEvents()
end

View File

@@ -5,15 +5,28 @@ local function CastShadowBolt(eventId, delay, calls, creature)
creature:CastSpell(creature:GetVictim(), 21077, true)
end
local function CastSpecialSpell(eventId, delay, calls, creature)
local victim = creature:GetVictim()
if not victim then
return
end
if victim:GetEntry() == 32666 or victim:GetEntry() == 32667 or victim:GetEntry() == 31144 or victim:GetEntry() == 31146 then
creature:CastSpell(victim, 5, true)
end
end
local function CastShadowBoltVolley(eventId, delay, calls, creature)
creature:CastSpell(creature:GetVictim(), 33841, true)
end
local function CastRainOfFire(eventId, delay, calls, creature)
local targets = creature:GetAITargets(10)
if #targets > 0 then
local target = targets[math.random(#targets)]
creature:CastSpell(target, 24669, true)
end
end
local function CastCurseOfPain(eventId, delay, calls, creature)
creature:CastSpell(creature:GetVictim(), 38048, true)
@@ -34,6 +47,7 @@ creature:RegisterEvent(CastRainOfFire, math.random(12000, 31000), 0)
creature:RegisterEvent(CastCurseOfPain, math.random(13000, 18000), 0)
creature:RegisterEvent(CastShadowMend, math.random(11000, 20000), 0)
creature:RegisterEvent(CastShadowStrike, math.random(2000, 5000), 0)
creature:RegisterEvent(CastSpecialSpell, 1000, 0)
end
local function OnLeaveCombat(event, creature)

8
DinkleDoom.lua Normal file
View File

@@ -0,0 +1,8 @@
local Dinkledork = {}
function Dinkledork.OnSpawn(event, creature)
creature:CastSpell(creature, 100138, true)
creature:CastSpell(creature, 100035, true)
end
RegisterCreatureEvent(400066, 5, Dinkledork.OnSpawn)

102
DinkleStone1.lua Normal file
View File

@@ -0,0 +1,102 @@
local ItemEntry = 65000 -- Hearthstone. You can change this item ID to whatever.
local T = {
[1] = { "|TInterface\\icons\\achievement_pvp_h_h:37:37:-23|t|cff610B0BHorde Cities|r", 1,
{"|TInterface\\icons\\achievement_zone_durotar:37:37:-23|t|cff610B0BOrgrimmar|r", 1, 1503, -4415.5, 22, 0},
{"|TInterface\\icons\\achievement_zone_tirisfalglades_01:37:37:-23|t|cff610B0BUndercity|r", 0, 1831, 238.5, 61.6, 0},
{"|TInterface\\icons\\achievement_zone_mulgore_01:37:37:-23|t|cff610B0BThunderbluff|r", 1, -1278, 122, 132, 0},
{"|TInterface\\icons\\achievement_zone_bloodmystisle_01:37:37:-23|t|cff610B0BSilvermoon|r", 530, 9487.69, -7279.2, 14.2866, 0},
{"|TInterface\\icons\\achievement_reputation_wyrmresttemple:37:37:-23|t|cff642EFEShattrath|r", 530, -1838.16, 5301.79, -12.428, 0},
{"|TInterface\\icons\\achievement_reputation_kirintor:37:37:-23|t|cff642EFEDalaran|r", 571, 5804.15, 624.771, 647.767, 0},
},
[2] = {"|TInterface\\icons\\achievement_pvp_a_a:37:37:-23|t|cff0101DFAlliance Cities|r", 0,
{"|TInterface\\icons\\achievement_zone_elwynnforest:37:37:-23|t|cff0101DFStormwind|r", 0, -8905, 560, 94, 0.62},
{"|TInterface\\icons\\achievement_zone_dunmorogh:37:37:-23|t|cff0101DFIronforge|r", 0, -4795, -1117, 499, 0},
{"|TInterface\\icons\\achievement_zone_ashenvale_01:37:37:-23|t|cff0101DFDarnassus|r", 1, 9952, 2280.5, 1342, 1.6},
{"|TInterface\\icons\\achievement_zone_zangarmarsh:37:37:-23|t|cff0101DFThe Exodar|r", 530, -3965.7, -11653.6, -138.844, 0},
{"|TInterface\\icons\\achievement_reputation_wyrmresttemple:37:37:-23|t|cff642EFEShattrath|r", 530, -1838.16, 5301.79, -12.428, 0},
{"|TInterface\\icons\\achievement_reputation_kirintor:37:37:-23|t|cff642EFEDalaran|r", 571, 5804.15, 624.771, 647.767, 0},
},
[3] = { "|TInterface\\icons\\achievement_bg_winwsg:37:37:-23|t|cffC41F3BPvP Locations|r", 2,
{"Gurubashi Arena", 0, -13229, 226, 33, 1},
{"Dire Maul Arena", 1, -3669, 1094, 160, 3},
{"Nagrand Arena", 530, -1983, 6562, 12, 2},
{"Blade's Edge Arena", 530, 2910, 5976, 2, 4},
},
[4] = {"|TInterface\\icons\\achievement_zone_elwynnforest:37:37:-23|t|cff0101DFAlliance Starter Areas|r", 0,
{"Northshire Valley", 0, -8921.09, -119.13, 82.2, 6},
{"Coldridge", 0, -6231.77, 333, 383.17, 0},
{"Shadowglen", 1, 10322.26, 831.4, 1326.37, 0},
{"Ammen Vale", 530, -3961.64, -13931.2, 100.615, 0},
},
[5] = { "|TInterface\\icons\\achievement_zone_durotar:37:37:-23|t|cff610B0BHorde Starter Areas|r", 1,
{"Valley of Trials", 1, -618.518, -4251.67, 38.718, 0},
{"Camp Narache", 1, -2917.58, -257.98, 52.9968, 0},
{"Death Knell", 0, 1676.71, 1678.31, 121.67, 0},
{"Sunstrider Isle", 530, 10349.6, -6357.29, 33.4026, 0},
},
[6] = {"|TInterface\\icons\\achievement_boss_ragnaros:37:37:-23|t|cff0101DFRaids|r", 2,
{"Molten Core", 230, 1126.64, -459.94, -102.535, 3.46095},
{"Onyxia's Lair", 1, -4708.27, -3727.64, 54.5589, 3.72786},
{"Blackwing Lair", 469, -7664.76, -1100.87,399.679, 0},
{"Zul'Gurub", 309, -11916.9, -1248.36, 92.5334, 4.72417},
{"Ahn'Qiraj", 1, -8253.067, 1538.91, -4.797, 3.065894},
{"Naxx 40", 0, 3082.924316, -3746.725830, 133.52, 0},
{"Karazhan", 0, -11118.9, -2010.33,47.0819, 0.649895},
{"Magtheridon's Lair", 530, -312.7, 3087.26, -116.52, 5.19026},
{"Gruul's Lair", 530, 3530.06, 5104.08, 3.50861, 5.51117},
{"Zul'Aman", 530, 6851.78, -7972.57, 179.242, 4.64691},
{"Serpentshrine Caverns", 530, 748.984436, 6870.443359, -68, 6.246},
{"Tempest Keep", 530, 3088.49, 1381.57, 184.863, 4.61973},
{"Hyjal Summit", 1, -8177.5, -4183, -168, 1},
{"Black Temple", 530, -3649.92, 317.469, 35.2827, 2.94285},
{"Sunwell Plateau", 530, 12574.1, -6774.81, 15.0904, 3.13788},
{"Naxx Wotlk", 571, 3670.268066, -1263.276367, 243.52, 4.61},
{"Obsidian Sanctum", 571, 3457.11, 262.394, -113.819, 3.28258},
{"Eye of Eternity", 571, 3859.44, 6989.85, 152.041, 5.79635},
{"Vault of Archavon", 571, 5453.72, 2840.79, 421.28, 0},
{"Ulduar", 571, 9251.101562, -1112.424072, 1216.115479, 6.26},
{"Trial of the Crusader", 571, 8515.68, 716.982, 558.248, 1.57315},
{"Icecrown Citadel", 571, 5873.82, 2110.98, 636.011, 3.5523},
{"Ruby Sanctum", 571, 3600.5, 197.34, -113.76, 5.29905},
},
}
local function OnGossipHello(event, player, item)
-- Show main menu
for i, v in ipairs(T) do
if (v[2] == 2 or v[2] == player:GetTeam()) then
player:GossipMenuAddItem(0, v[1], i, 0)
end
end
player:GossipSendMenu(1, item)
end
local function OnGossipSelect(event, player, item, sender, intid, code)
if (sender == 0) then
-- return to main menu
OnGossipHello(event, player, item)
return
end
if (intid == 0) then
-- Show teleport menu
for i, v in ipairs(T[sender]) do
if (i > 2) then
player:GossipMenuAddItem(0, v[1], sender, i)
end
end
player:GossipMenuAddItem(0, "Back", 0, 0)
player:GossipSendMenu(1, item)
return
else
-- teleport
local name, map, x, y, z, o = table.unpack(T[sender][intid])
player:Teleport(map, x, y, z, o)
end
player:GossipComplete()
end
RegisterItemGossipEvent(ItemEntry, 1, OnGossipHello)
RegisterItemGossipEvent(ItemEntry, 2, OnGossipSelect)

47
Dinklestone2.lua Normal file
View File

@@ -0,0 +1,47 @@
function OnGossipHello(event, player, item)
if player:GetLevel() < 15 then
player:SendBroadcastMessage("You need to be level 15 or higher to use this item.")
return
end
player:GossipMenuAddItem(0, "|TInterface\\icons\\achievement_boss_lichking:37:37:-23|t|cff007d45Scourge Event|r", 150, 0)
player:GossipSendMenu(1, item)
end
local function OnGossipSelect(event, player, item, sender, intid, code)
if (sender == 150) then
-- Show Scourge Event menu
player:GossipMenuAddItem(0, "|TInterface\\icons\\spell_misc_emotionhappy:37:37:-23|t|cff007d45Start Event for Bonus Lich Runes|r", 100, 0)
player:GossipMenuAddItem(0, "|TInterface\\icons\\spell_misc_emotionsad:37:37:-23|t|cffC41F3BStop Event but Die and Suffer|r", 101, 0)
player:GossipMenuAddItem(0, "Back", 0, 0)
player:GossipSendMenu(1, item)
return
elseif (sender == 100) then
-- Start the event
if not IsGameEventActive(17) then
player:AddItem(43949, 2)
StartGameEvent(17, true)
player:PlayDirectSound(14797)
end
player:GossipComplete()
elseif (sender == 101) then
-- Stop the event
if IsGameEventActive(17) then
StopGameEvent(17, true)
player:CastSpell(player, 15007, true)
player:RemoveItem(43949, 2)
player:SetLevel(player:GetLevel())
player:SendBroadcastMessage("2 Lich Runes have been removed, you've been given Resurrection Sickness and have lost your current level's experience progress. So sad :(")
player:PlayDirectSound(14776)
end
player:GossipComplete()
elseif (sender == 0) then
-- return to main menu
OnGossipHello(event, player, item)
return
end
player:GossipComplete()
end
RegisterItemGossipEvent(65001, 1, OnGossipHello)
RegisterItemGossipEvent(65001, 2, OnGossipSelect)

View File

@@ -24,7 +24,7 @@ local function OnLeaveCombat(event, creature)
end
local function OnDied(event, creature, killer)
creature:RemoveCorpse()
creature:DespawnOrUnsummon(5000)
creature:RemoveEvents()
end

View File

@@ -1,4 +1,4 @@
local BRAVE_IDS = {5412, 5511, 5512, 957, 7798, 11026, 5518, 5510, 5509, 1416, 5514, 29016, 29019, 3518, 1472, 31423, 3314, 3312, 3323}
local BRAVE_IDS = {5412, 5511, 5512, 957, 7798, 11026, 5518, 5510, 5509, 1416, 5514, 29016, 29019, 3518, 1472, 31423, 3314, 3312, 3323, 5188, 3370, 3368, 3371, 3316, 3405, 11046, 3347, 3348, 6986}
local BRAVERY_DIALOGUE = {
"I fear no enemy!",
"I will fight to the bitter end!",

View File

@@ -1,4 +1,4 @@
local FREAKOUT_NPC = { 30217, 4981, 483, 5193, 1402, 70021, 1257, 1286, 1285, 3520, 3513, 1432, 1402, 1444, 7917, 1212, 6173, 5489, 4982, 5484, 14500, 14450, 14496, 14497, 6579, 5519, 6007, 29152, 9977, 1395, 2795 }
local FREAKOUT_NPC = { 30217, 4981, 483, 5193, 1402, 70021, 1257, 1286, 1285, 3520, 3513, 1432, 1402, 1444, 7917, 1212, 6173, 5489, 4982, 5484, 14500, 14450, 14496, 14497, 6579, 5519, 6007, 29152, 9977, 1395, 2795, 1320, 1318, 1310, 3399, 7010, 5811, 3351, 400062, 400067 }
function OnEnterCombat(event, creature, target)
creature:CastSpell(creature, 31358, true) -- fear spell

View File

@@ -1,29 +1,45 @@
local Necrofiend = {}
function Necrofiend.OnEnterCombat(event, creature, target)
creature:RegisterEvent(Necrofiend.WebSpray, 15000, 0)
creature:RegisterEvent(Necrofiend.CastBanefulPoison, 7000, 0)
creature:RegisterEvent(Necrofiend.WebSpray, 15000, 0, creature)
creature:RegisterEvent(Necrofiend.CastBanefulPoison, 7000, 0, creature)
creature:RegisterEvent(Necrofiend.SpecialSpell, 1000, 0, creature)
end
function Necrofiend.SpecialSpell(eventId, delay, calls, creature)
local victim = creature:GetVictim()
if not victim then
return
end
if victim:GetEntry() == 32666 or victim:GetEntry() == 32667 or victim:GetEntry() == 31144 or victim:GetEntry() == 31146 then
creature:CastSpell(victim, 5, true)
end
end
function Necrofiend.WebSpray(event, delay, calls, creature)
creature:CastSpell(creature:GetVictim(), 55508, true)
creature:CastSpell(creature:GetVictim(), 55508, true)
end
function Necrofiend.CastBanefulPoison(event, delay, calls, creature)
local targets = creature:GetAITargets(10)
local target = targets[math.random(#targets)]
creature:CastSpell(target, 15475, true)
local targets = creature:GetAITargets(10)
if #targets == 0 then
return
end
local target = targets[math.random(#targets)]
creature:CastSpell(target, 15475, true)
end
function Necrofiend.OnLeaveCombat(event, creature)
creature:RemoveEvents()
creature:RemoveEvents()
end
function Necrofiend.OnDied(event, creature, killer)
creature:RemoveCorpse()
creature:RemoveEvents()
creature:DespawnOrUnsummon(5000)
creature:RemoveEvents()
end
RegisterCreatureEvent(400055, 1, Necrofiend.OnEnterCombat)
RegisterCreatureEvent(400055, 2, Necrofiend.OnLeaveCombat)
RegisterCreatureEvent(400055, 4, Necrofiend.OnDied)
RegisterCreatureEvent(400055, 4, Necrofiend.OnDied)

View File

@@ -21,10 +21,16 @@ local function OnDied(event, creature, killer)
creature:RemoveEvents()
end
local function OnSpawn(event, creature)
creature:CastSpell(creature, 17683, true)
end
RegisterCreatureEvent(400013, 1, OnEnterCombat)
RegisterCreatureEvent(400013, 2, OnLeaveCombat)
RegisterCreatureEvent(400013, 4, OnDied)
RegisterCreatureEvent(400013, 5, OnSpawn)
RegisterCreatureEvent(400039, 1, OnEnterCombat)
RegisterCreatureEvent(400039, 2, OnLeaveCombat)
RegisterCreatureEvent(400039, 4, OnDied)
RegisterCreatureEvent(400039, 4, OnDied)
RegisterCreatureEvent(400039, 5, OnSpawn)

View File

@@ -12,7 +12,7 @@ function OnSpellCast(event, caster, spell)
end
end
if not isValidTarget then
caster:SendBroadcastMessage("Invalid target for this spell.")
caster:SendBroadcastMessage("")
spell:Cancel()
else
-- give kill credit to NPC ID 68

43
SWTrapCredit.lua Normal file
View File

@@ -0,0 +1,43 @@
local NPC_ID = 400034 -- The ID of the NPC you want players to get kill credit for
-- List of allowed zones (use zone ID)
local ALLOWED_ZONES = {
1519, -- SW City
12,
}
-- List of allowed spell IDs
local ALLOWED_SPELLS = {
100144, -- Spell 1
100142,
100143,
100145,
-- Add more spells here as needed
}
-- Define the indexOf function for tables
function table.indexOf(t, value)
for k, v in ipairs(t) do
if v == value then
return k
end
end
return -1
end
function OnPlayerCastSpell(event, player, spell)
local spellId = spell:GetEntry()
local zoneId = player:GetZoneId()
if table.indexOf(ALLOWED_SPELLS, spellId) ~= -1 then
if table.indexOf(ALLOWED_ZONES, zoneId) == -1 then
spell:Cancel()
player:SendBroadcastMessage("You cannot cast this spell in this area.")
else
player:KilledMonsterCredit(NPC_ID)
player:SendBroadcastMessage("You have successfuly placed a trap!")
end
end
end
RegisterPlayerEvent(5, OnPlayerCastSpell)

19
SWTrapQuestR.lua Normal file
View File

@@ -0,0 +1,19 @@
-- Quest ID for the quest that should trigger the sound
local QUEST_ID = 30004
-- Creature ID for the creature that gives the quest
local CREATURE_ID = 12480
-- Sound ID for the sound that should play when the quest is rewarded
local SOUND_ID = 20427
-- Emote ID for the emote that should play when the quest is rewarded
local EMOTE_ID = 113
-- Register the event for quest reward
RegisterCreatureEvent(CREATURE_ID, 34, function(event, player, creature, quest)
if quest:GetId() == QUEST_ID then
creature:PlayDistanceSound(SOUND_ID)
creature:PerformEmote(EMOTE_ID)
end
end)

View File

@@ -25,16 +25,20 @@ creature:RemoveEvents()
end
function SkeletalWarlord.OnDied(event, creature, killer)
creature:RemoveCorpse()
creature:DespawnOrUnsummon(5000)
creature:RemoveEvents()
end
function SkeletalWarlord.Charge(eventId, delay, calls, creature)
local targets = creature:GetAITargets(SkeletalWarlord.minChargeRange)
local target = targets[math.random(#targets)]
creature:CastSpell(target, 19471, true)
local targets = creature:GetAITargets(SkeletalWarlord.minChargeRange)
if #targets == 0 then
return
end
local target = targets[math.random(#targets)]
creature:CastSpell(target, 19471, true)
end
RegisterCreatureEvent(400056, 5, SkeletalWarlord.OnSpawn)
RegisterCreatureEvent(400056, 1, SkeletalWarlord.OnEnterCombat)
RegisterCreatureEvent(400056, 2, SkeletalWarlord.OnLeaveCombat)

View File

@@ -21,7 +21,7 @@ local mapId = player:GetMapId()
if table.indexOf(ALLOWED_SPELLS, spellId) ~= -1 then
if table.indexOf(ALLOWED_MAPS, mapId) == -1 then
spell:Cancel()
player:SendBroadcastMessage("You cannot use that mount here.")
player:SendBroadcastMessage("You cannot use that here.")
else
if spellId == 100150 then
player:PlayDirectSound(20428)

View File

@@ -9,9 +9,21 @@ function SpectralAttendant.OnEnterCombat(event, creature, target)
creature:RegisterEvent(SpectralAttendant.Immolate, 6000, 0)
creature:RegisterEvent(SpectralAttendant.Incinerate, 12000, 0)
creature:RegisterEvent(SpectralAttendant.AOEFear, 30000, 0)
creature:RegisterEvent(SpectralAttendant.CastSpecialSpell, 1000, 0)
creature:RegisterEvent(SpectralAttendant.Teleport, math.random(12000,16000), 0)
end
function SpectralAttendant.CastSpecialSpell(eventId, delay, calls, creature)
local victim = creature:GetVictim()
if not victim then
return
end
if victim:GetEntry() == 32666 or victim:GetEntry() == 32667 or victim:GetEntry() == 31144 or victim:GetEntry() == 31146 then
creature:CastSpell(victim, 5, true)
end
end
function SpectralAttendant.Immolate(eventId, delay, calls, creature)
creature:CastSpell(creature:GetVictim(), 11668, true)
end
@@ -29,17 +41,21 @@ creature:RemoveEvents()
end
function SpectralAttendant.OnDied(event, creature, killer)
creature:RemoveCorpse()
creature:DespawnOrUnsummon(5000)
creature:RemoveEvents()
end
function SpectralAttendant.Teleport(eventId, delay, calls, creature)
local targets = creature:GetAITargets(10)
if #targets == 0 then
return
end
local target = targets[math.random(#targets)]
creature:CastSpell(target, 69904)
creature:ClearThreatList()
end
RegisterCreatureEvent(400052, 5, SpectralAttendant.OnSpawn)
RegisterCreatureEvent(400052, 1, SpectralAttendant.OnEnterCombat)
RegisterCreatureEvent(400052, 2, SpectralAttendant.OnLeaveCombat)

36
StealthPot.lua Normal file
View File

@@ -0,0 +1,36 @@
Draven = {}
-- Create the item you want to give to the player
Draven.ITEM_ID = 60114 -- replace with the ID of the item you want to give
-- Register the gossip event for the NPC
function Draven.OnGossipHello(event, player, creature)
player:GossipMenuAddItem(0, "|TInterface\\Icons\\ability_stealth:50:50:-23:0|tPurchase 3 Stealth Potions.|r", 0, 1)
player:GossipSendMenu(1, creature)
end
-- Handle the player's selection in the gossip menu
function Draven.OnGossipSelect(event, player, creature, sender, action)
if action == 1 then
if player:GetCoinage() < 7500 then
player:SendBroadcastMessage("You do not have enough coins.")
player:GossipComplete()
else
player:SetCoinage(player:GetCoinage() - 7500)
player:AddItem(Draven.ITEM_ID, 3)
player:SendBroadcastMessage("You have received 3 Stealth Potions.")
player:GossipComplete()
end
end
end
-- Send a unit yell when the NPC spawns
function Draven.OnSpawn(event, creature)
creature:SendUnitYell("", 0)
creature:CastSpell(creature, 20374)
end
-- Register the gossip events with the NPC
RegisterCreatureGossipEvent(nil, 1, Draven.OnGossipHello)
RegisterCreatureGossipEvent(nil, 2, Draven.OnGossipSelect)
RegisterCreatureEvent(nil, 5, Draven.OnSpawn)

View File

@@ -23,6 +23,7 @@ creature:RemoveEvents()
end
local function OnDied(event, creature, killer)
creature:DespawnOrUnsummon(5000)
creature:RemoveEvents()
end

32
TurretKillCred.lua Normal file
View File

@@ -0,0 +1,32 @@
local TUR_ID = {400038, 400037}
local SPELL_ID = 100181
function OnSpellCast(event, caster, spell)
local target = spell:GetTarget()
if target and spell:GetEntry() == SPELL_ID then
local isValidTarget = false
for _, TURID in ipairs(TUR_ID) do
if target:GetEntry() == TURID then
isValidTarget = true
break
end
end
if not isValidTarget then
caster:SendBroadcastMessage("Invalid target.")
spell:Cancel()
else
-- 33% chance for the respawn to fizzle
local chance = math.random(1, 3)
if chance == 1 then
caster:SendBroadcastMessage("Attempt to recharge the turret has fizzled.")
else
-- give kill credit
caster:KilledMonsterCredit(400037)
-- respawn the creature
target:Respawn()
end
end
end
end
RegisterPlayerEvent(5, OnSpellCast)