Add files via upload

This commit is contained in:
Dinkledork
2023-03-18 03:05:01 -06:00
committed by GitHub
parent 4ba87552c3
commit 3d8464205f
7 changed files with 82 additions and 97 deletions

31
DeathStalker.lua Normal file
View File

@@ -0,0 +1,31 @@
local DeathStalker = {}
function DeathStalker.OnEnterCombat(event, creature, target)
creature:RegisterEvent(DeathStalker.Cripple, 1000, 1)
creature:RegisterEvent(DeathStalker.Cripple, 8000, 0)
end
function DeathStalker.Cripple(eventId, delay, calls, creature)
local targetList = creature:GetAITargets(5)
local targetCount = #targetList
if targetCount > 0 then
local randomIndex = math.random(1, targetCount)
local randomTarget = targetList[randomIndex]
creature:CastSpell(randomTarget, 6217, true)
else
creature:CastSpell(creature:GetVictim(), 6217, true)
end
end
function DeathStalker.OnLeaveCombat(event, creature)
creature:RemoveEvents()
end
function DeathStalker.OnDied(event, creature, killer)
creature:RemoveEvents()
end
RegisterCreatureEvent(400102, 1, DeathStalker.OnEnterCombat)
RegisterCreatureEvent(400102, 2, DeathStalker.OnLeaveCombat)
RegisterCreatureEvent(400102, 4, DeathStalker.OnDied)

View File

@@ -56,7 +56,9 @@ local npcIds3 = {
400032,
400029,
400073,
400072
400072,
400102,
400103
}
-- Function to be executed when an NPC from group 1 is spawned

View File

@@ -595,70 +595,3 @@ RegisterCreatureGossipEvent(NPC_ENTRY11, 2, OnGossipSelect)
------------------
local NPC_ENTRY11 = 381
local REQUIRED_QUEST_ID = 30011
local GAME_EVENT_ID = 17
local function ShowGossipMenu(player, creature)
player:GossipMenuAddItem(0, "The scourge are coming! Please head to the inn!", 0, 1)
player:GossipSendMenu(1, creature)
end
local function OnGossipHello(event, player, creature)
if IsGameEventActive(GAME_EVENT_ID) then
if not player:HasQuest(REQUIRED_QUEST_ID) then
local questStatus = player:GetQuestStatus(REQUIRED_QUEST_ID)
if questStatus == 4 then
player:SendBroadcastMessage("Your time ran out, and you have failed this quest...")
else
player:SendBroadcastMessage("You must be on a certain quest to interact with this person.")
end
return
end
ShowGossipMenu(player, creature)
end
end
local function OnGossipSelect(event, player, creature, sender, intid, code)
if (intid == 1) then
player:GossipComplete()
player:KilledMonsterCredit(NPC_ENTRY1)
local random = math.random(0, 4)
if random == 0 then
creature:SendUnitSay("Mommmmy!!!!", 0)
elseif random == 1 then
creature:SendUnitSay("But I wanted to go play with Sally...", 0)
elseif random == 2 then
creature:SendUnitSay("Really? Stay indoors? How boring...", 0)
elseif random == 3 then
creature:SendUnitSay("Darn those yucky Scourge...", 0)
else
creature:SendUnitSay("Awww, no fun!", 0)
end
creature:DespawnOrUnsummon(1000) -- Despawn after 1 second (1000 milliseconds)
end
end
local function OnGameEventStart(event, gameEventId)
if gameEventId == GAME_EVENT_ID then
local creatures = GetWorld():GetCreaturesByEntry(NPC_ENTRY11)
for _, creature in ipairs(creatures) do
creature:SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP)
end
end
end
local function OnGameEventStop(event, gameEventId)
if gameEventId == GAME_EVENT_ID then
local creatures = GetWorld():GetCreaturesByEntry(NPC_ENTRY11)
for _, creature in ipairs(creatures) do
creature:RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP)
end
end
end
RegisterCreatureGossipEvent(NPC_ENTRY11, 1, OnGossipHello)
RegisterCreatureGossipEvent(NPC_ENTRY11, 2, OnGossipSelect)
RegisterServerEvent(34, OnGameEventStart)
RegisterServerEvent(35, OnGameEventStop)

View File

@@ -5,14 +5,16 @@ local CREATURE_ID = 400096
local QUEST_ACCEPT = {
[30015] = 20439,
[30016] = 20441,
[30017] = 20443
[30017] = 20443,
[30018] = 20449
}
local QUEST_COMPLETE = {
[30014] = 20438,
[30015] = 20440,
[30016] = 20442,
[30017] = 20444
[30017] = 20444,
[30018] = 20450
}
-- Register the event for quest accept

View File

@@ -1,46 +1,63 @@
local CREATURE_EVENT_ON_QUEST_ACCEPT = 31
local CREATURE_EVENT_ON_DIE = 4
local QUEST_ID = 30018
local CREATURE_SPAWNER = 400096
local BUNNY_ENTRY = 400099
local UNDEAD_BUNNY_ENTRY = 400100
local UNDEAD_WARLORD = 400101
local UNDEAD_WARLORD = 400103
local SPAWN_TYPE = 3
local DESPAWN_TIMER = 600000 -- 10 minutes in milliseconds
local CAST_SPELL_ID = 37679
local DESPAWN_TIMER = 200000 -- 3 minutes and 20 seconds in milliseconds
local CAST_SPELL_ID = 67040
local CAST_SPELL_ID2 = 32826
local function DespawnCreatures(spawner)
local spawnedCreatures = spawner:GetCreaturesInRange(100, {BUNNY_ENTRY, UNDEAD_BUNNY_ENTRY})
for _, spawnedCreature in ipairs(spawnedCreatures) do
spawnedCreature:DespawnOrUnsummon(100) -- Despawn with a 100 ms delay
end
local function CastSpellWithDelay(event, delay, calls, creature)
creature:CastSpell(creature, CAST_SPELL_ID, false)
end
local function CastSpellPolyVis(event, delay, calls, creature)
creature:CastSpell(creature, CAST_SPELL_ID2, false)
end
local function OnQuestAccept(event, player, creature, quest)
if quest:GetId() == QUEST_ID then
creature:SetReactState(0) -- Set react state to passive
creature:CastSpell(creature, CAST_SPELL_ID, true) -- Cast the specified spell on self
local x, y, z = creature:GetLocation()
creature:PerformEmote(1)
creature:SetReactState(0)
creature:RegisterEvent(CastSpellPolyVis, 17000, 1)
creature:RegisterEvent(CastSpellWithDelay, 18200, 1) -- 10-second delay before casting the spell
local x, y, z, o = creature:GetLocation()
for i = 1, 5 do
local randomX = x + math.random(-5, 5)
local randomY = y + math.random(-5, 5)
creature:SpawnCreature(BUNNY_ENTRY, randomX, randomY, z, SPAWN_TYPE, DESPAWN_TIMER)
local randomX = x + math.random(-4, 4)
local randomY = y + math.random(-4, 4)
creature:SpawnCreature(BUNNY_ENTRY, randomX, randomY, z, o, SPAWN_TYPE, DESPAWN_TIMER)
end
local undeadX = x + math.random(-5, 5)
local undeadY = y + math.random(-5, 5)
creature:SpawnCreature(UNDEAD_BUNNY_ENTRY, undeadX, undeadY, z, SPAWN_TYPE, DESPAWN_TIMER)
local undeadX = x + math.random(-4, 4)
local undeadY = y + math.random(-4, 4)
creature:SpawnCreature(UNDEAD_BUNNY_ENTRY, undeadX, undeadY, z, o, SPAWN_TYPE, DESPAWN_TIMER)
end
end
local function OnCreatureDeath(event, creature, killer)
if creature:GetEntry() == UNDEAD_WARLORD then
local spawner = creature:GetNearestCreature(100, CREATURE_SPAWNER)
local spawner = creature:GetNearestCreature(CREATURE_SPAWNER, 100)
if spawner then
DespawnCreatures(spawner)
spawner:SetReactState(1) -- Set react state back to aggressive
spawner:StopSpellCast(CAST_SPELL_ID)
end
end
end
local function OnSpawnerDeath(event, creature, killer)
if creature:GetEntry() == CREATURE_SPAWNER then
local players = creature:GetPlayersInRange(100)
for _, player in ipairs(players) do
if player:HasQuest(QUEST_ID) then
player:FailQuest(QUEST_ID)
end
end
end
end
RegisterCreatureEvent(CREATURE_SPAWNER, CREATURE_EVENT_ON_QUEST_ACCEPT, OnQuestAccept)
RegisterCreatureEvent(UNDEAD_WARLORD, 4, OnCreatureDeath) -- 4 is the event for creature death
RegisterCreatureEvent(UNDEAD_WARLORD, CREATURE_EVENT_ON_DIE, OnCreatureDeath)
RegisterCreatureEvent(CREATURE_SPAWNER, CREATURE_EVENT_ON_DIE, OnSpawnerDeath)

View File

@@ -1,15 +1,15 @@
local INVISIBLE_BUNNY_ENTRY = 400099
local SPELL_TO_CAST = 10001
local SPELL_TO_CAST = 364735
local InvisibleBunny = {}
function InvisibleBunny.OnSpawn(event, creature)
creature:RegisterEvent(InvisibleBunny.CastSpellRandomly, math.random(5000, 12000), 0)
creature:RegisterEvent(InvisibleBunny.CastSpellRandomly, math.random(18000, 34000), 4)
end
function InvisibleBunny.CastSpellRandomly(event, delay, calls, creature)
creature:CastSpell(creature, SPELL_TO_CAST, true)
creature:RegisterEvent(InvisibleBunny.CastSpellRandomly, math.random(5000, 12000), 0)
end
RegisterCreatureEvent(INVISIBLE_BUNNY_ENTRY, 5, InvisibleBunny.OnSpawn)

View File

@@ -1,6 +1,6 @@
local UNDEAD_BUNNY_ENTRY = 400100
local SPELL_TO_CAST = 10000
local CAST_DELAY = 90000 -- 90 seconds in milliseconds
local SPELL_TO_CAST = 364736
local CAST_DELAY = 120000
local UndeadBunny = {}
@@ -12,4 +12,4 @@ function UndeadBunny.CastSpellAfterDelay(event, delay, calls, creature)
creature:CastSpell(creature, SPELL_TO_CAST, true)
end
RegisterCreatureEvent(UNDEAD_BUNNY_ENTRY, 5, UndeadBunny.OnSpawn)
RegisterCreatureEvent(UNDEAD_BUNNY_ENTRY, 5, UndeadBunny.OnSpawn) -- 5 is the event for creature spawn