Add files via upload

This commit is contained in:
Dinkledork
2023-03-21 02:26:13 -06:00
committed by GitHub
parent 700c67a93f
commit 2b50ae9df0
57 changed files with 2884 additions and 0 deletions

View File

@@ -0,0 +1,49 @@
local NPC_UNDEAD_ROGUE = 400114
local NPC_TARGET = 3338
local SPELL_SINISTER_STRIKE = 1752
local SPELL_EVASION = 5277
local SPELL_GOUGE = 12540
local SPELL_CAST_DEATH = 5
local function CastSinisterStrike(creature)
creature:CastSpell(creature:GetVictim(), SPELL_SINISTER_STRIKE, false)
end
local function CastGouge(creature)
creature:CastSpell(creature:GetVictim(), SPELL_GOUGE, false)
end
local function CastSpellOnTarget(creature, targetNPC)
creature:CastSpell(targetNPC, SPELL_CAST_DEATH, true)
end
local function UndeadRogue_OnEnterCombat(event, creature, target)
creature:RegisterEvent(CastSinisterStrike, math.random(4000, 6000), 0)
creature:RegisterEvent(CastGouge, math.random(14000, 18000), 0)
local targetNPC = creature:GetNearestCreature(50, NPC_TARGET)
if targetNPC then
CastSpellOnTarget(creature, targetNPC)
end
end
local function UndeadRogue_OnLeaveCombat(event, creature)
creature:RemoveEvents()
end
local function UndeadRogue_OnDamageTaken(event, creature, attacker, damage)
local healthPct = creature:GetHealthPct()
if healthPct <= 30 and not creature:HasAura(SPELL_EVASION) then
creature:CastSpell(creature, SPELL_EVASION, true)
end
end
local function UndeadRogue_OnDied(event, creature, killer)
creature:RemoveEvents()
end
RegisterCreatureEvent(NPC_UNDEAD_ROGUE, 1, UndeadRogue_OnEnterCombat)
RegisterCreatureEvent(NPC_UNDEAD_ROGUE, 2, UndeadRogue_OnLeaveCombat)
RegisterCreatureEvent(NPC_UNDEAD_ROGUE, 4, UndeadRogue_OnDied)
RegisterCreatureEvent(NPC_UNDEAD_ROGUE, 9, UndeadRogue_OnDamageTaken)

View File

@@ -0,0 +1,40 @@
local NPC_BANSHEE = 400112
local NPC_TARGET = 3338
local SPELL_BANSHEE_SCREAM = 41150
local SPELL_SHADOW_BOLT = 9613
local SPELL_CAST_DEATH = 5
local function CastShadowBolt(creature)
creature:CastSpell(creature:GetVictim(), SPELL_SHADOW_BOLT, true)
end
local function CastBansheeScream(creature)
creature:CastSpell(creature:GetVictim(), SPELL_BANSHEE_SCREAM, true)
end
local function CastSpellOnTarget(creature, targetNPC)
creature:CastSpell(targetNPC, SPELL_CAST_DEATH, true)
end
local function Banshee_OnEnterCombat(event, creature, target)
creature:RegisterEvent(CastShadowBolt, math.random(4000, 8000), 0)
creature:RegisterEvent(CastBansheeScream, math.random(9000, 18000), 1)
local targetNPC = creature:GetNearestCreature(50, NPC_TARGET)
if targetNPC then
CastSpellOnTarget(creature, targetNPC)
end
end
local function Banshee_OnLeaveCombat(event, creature)
creature:RemoveEvents()
end
local function Banshee_OnDied(event, creature, killer)
creature:RemoveEvents()
end
RegisterCreatureEvent(NPC_BANSHEE, 1, Banshee_OnEnterCombat)
RegisterCreatureEvent(NPC_BANSHEE, 2, Banshee_OnLeaveCombat)
RegisterCreatureEvent(NPC_BANSHEE, 4, Banshee_OnDied)

View File

@@ -0,0 +1,26 @@
local NPC_HORDE_GUARD = 400105
local SPELL_REND = 6547
local function CastRend(creature)
creature:CastSpell(creature:GetVictim(), SPELL_REND, true)
end
local function HordeGuard_OnEnterCombat(event, creature, target)
creature:RegisterEvent(CastRend, 100, 1)
creature:RegisterEvent(CastRend, math.random(8000, 15000), 0)
end
local function HordeGuard_OnLeaveCombat(event, creature)
creature:RemoveEvents() -- Remove events when leaving combat
creature:EmoteState(375)
end
local function HordeGuard_OnSpawn(event, creature)
creature:EmoteState(375)
creature:SetEquipmentSlots(6905, 0, 0)
end
RegisterCreatureEvent(NPC_HORDE_GUARD, 1, HordeGuard_OnEnterCombat)
RegisterCreatureEvent(NPC_HORDE_GUARD, 2, HordeGuard_OnLeaveCombat)
RegisterCreatureEvent(NPC_HORDE_GUARD, 5, HordeGuard_OnSpawn)

View File

@@ -0,0 +1,47 @@
local NPC_SUTURES = 400113
local SPELL_CLEAVE = 15496
local SPELL_DISEASE_CLOUD = 30122
local SPELL_ABOMINATION_SLAM = 40546
local YELL_COMBAT_DIALOGUE = {
"Sutures smash!",
"Me make you hurt!",
"You not escape Sutures!",
"Why you bother Sutures?",
"Sutures crush you!"
}
local function CastCleave(creature)
creature:CastSpell(creature:GetVictim(), SPELL_CLEAVE, false)
end
local function CastDiseaseCloud(creature)
creature:CastSpell(creature:GetVictim(), SPELL_DISEASE_CLOUD, false)
end
local function CastAbominationSlam(creature)
creature:CastSpell(creature:GetVictim(), SPELL_ABOMINATION_SLAM, false)
end
local function Sutures_OnEnterCombat(event, creature, target)
if math.random(1, 100) <= 50 then -- 50% chance to yell upon entering combat
creature:SendUnitYell(YELL_COMBAT_DIALOGUE[math.random(1, #YELL_COMBAT_DIALOGUE)], 0)
end
creature:RegisterEvent(CastCleave, math.random(4000, 8000), 0)
creature:RegisterEvent(CastDiseaseCloud, math.random(10000, 15000), 0)
creature:RegisterEvent(CastAbominationSlam, math.random(8000, 12000), 0)
end
local function Sutures_OnLeaveCombat(event, creature)
creature:RemoveEvents() -- Remove events when leaving combat
end
local function Sutures_OnDied(event, creature, killer)
creature:RemoveEvents() -- Remove events when died
creature:SendUnitSay("Sutures...fall...", 0)
end
RegisterCreatureEvent(NPC_SUTURES, 1, Sutures_OnEnterCombat)
RegisterCreatureEvent(NPC_SUTURES, 2, Sutures_OnLeaveCombat)
RegisterCreatureEvent(NPC_SUTURES, 4, Sutures_OnDied)

View File

@@ -0,0 +1,186 @@
local NPC_IDS = {400104}
local ITEM_ID = 60124
local mainHandItems = {6905, 10756, 11087}
local destinations = {
{x = -482, y = -2710, z = 94.303, o = 4.2},
{x = -353, y = -2681, z = 95.88, o = 0.0929},
{x = -579, y = -2650, z = 95.633, o = 3.12},
{x = -348, y = -2507, z = 95.563, o = 1.49},
}
local messages = {
"For the Horde!",
"No mercy for our enemies!",
"Let's show these Scourge dogs what it means to mess with the Horde!",
"Victory or death, we fight for the Horde!",
"The blood of our enemies will water the fields of our glory!",
"This land is ours, and we will defend it with our lives!",
"We are the Horde, and we know no fear!",
}
local function OnGossipHello(event, player, creature)
if player:HasItem(ITEM_ID) then
player:GossipClearMenu()
player:GossipMenuAddItem(8, "|TInterface\\icons\\inv_sword_39:40:40:-35|t|cff610B0BGive Weapon|r", 1, 0)
player:GossipMenuAddItem(9, "2-Handed Axe", 1, 1001)
player:GossipMenuAddItem(9, "2-Handed Mace", 1, 1002)
player:GossipMenuAddItem(9, "2-Handed Sword", 1, 1003)
if creature:GetData("equipmentSet") then
player:GossipMenuAddItem(8, "|TInterface\\icons\\ability_hunter_markedfordeath:40:40:-35|t|cffC41F3BSend to Location|r", 2, 0)
player:GossipMenuAddItem(0, "Reinforce the East Entrance!", 2, 2001)
player:GossipMenuAddItem(0, "Reinforce the North Entrance!", 2, 2002)
player:GossipMenuAddItem(0, "Reinforce the South Entrance!", 2, 2003)
player:GossipMenuAddItem(0, "Reinforce the West Entrance!", 2, 2004)
player:GossipMenuAddItem(2, "|t|cff0101DFFollow me into battle!|r", 2, 2005)
end
player:GossipSendMenu(1, creature)
else
player:SendBroadcastMessage("You need Horde Armaments!")
end
end
--Define your abilities here
local function CastCleave(eventId, delay, calls, creature)
if creature:IsInCombat() then
creature:CastSpell(creature:GetVictim(), 845, true)
end
end
local function CastHeroicStrike(eventId, delay, calls, creature)
if creature:IsInCombat() then
creature:CastSpell(creature:GetVictim(), 78, true)
end
end
local function CastThunderClap(eventId, delay, calls, creature)
if creature:IsInCombat() then
creature:CastSpell(creature:GetVictim(), 8078, true)
end
end
local function CastEnrage(eventId, delay, calls, creature)
if creature:IsInCombat() then
creature:CastSpell(creature:GetVictim(), 3547, true)
end
end
local function CastRend(eventId, delay, calls, creature)
if creature:IsInCombat() then
creature:CastSpell(creature:GetVictim(), 8548, true)
end
end
local function CastCharge(eventId, delay, calls, creature)
if creature:IsInCombat() then
creature:CastSpell(creature:GetVictim(), 24193, true)
end
end
local function RegisterAbilities(creature, weaponType)
if creature:GetData("abilitiesRegistered") then
return
end
creature:SetData("abilitiesRegistered", true)
if weaponType == 1 then -- 2-Handed Axe Abilities
creature:RegisterEvent(CastCleave, math.random(8000, 12000), 0)
creature:RegisterEvent(CastHeroicStrike, math.random(5000, 9000), 0)
elseif weaponType == 2 then -- 2-Handed Mace Abilities
creature:RegisterEvent(CastThunderClap, math.random(9000, 14000), 0)
creature:RegisterEvent(CastEnrage, math.random(15000, 19000), 0)
elseif weaponType == 3 then -- 2-Handed Sword Abilities
creature:RegisterEvent(CastRend, math.random(11000, 15000), 0)
creature:RegisterEvent(CastCharge, 100, 1)
end
end
local function OnEnterCombat(event, creature, target)
local weaponType = creature:GetData("weaponType")
if weaponType and not creature:GetData("abilitiesRegistered") then
RegisterAbilities(creature, weaponType)
end
end
local function OnLeaveCombat(event, creature)
creature:RemoveEvents()
-- creature:EmoteState(375)
creature:SetData("abilitiesRegistered", false)
end
local function DespawnCreature(eventId, delay, calls, creature)
creature:SetEquipmentSlots(0, 0, 0)
creature:DespawnOrUnsummon()
end
local function OnGossipSelect(event, player, creature, sender, intid, code)
if intid == 0 then
OnGossipHello(event, player, creature)
elseif intid >= 1001 and intid <= 1003 then
local index = intid - 1000
local selectedMainHand = mainHandItems[index]
creature:SetEquipmentSlots(selectedMainHand, 0, 0)
creature:SetData("weaponType", index)
creature:SetData("equipmentSet", true)
creature:PerformEmote(66)
RegisterAbilities(creature, index) -- Add this line to register abilities
OnGossipHello(event, player, creature)
end
if intid >= 2001 and intid <= 2004 then
local index = intid - 2000
local destination = destinations[index]
local finalX = destination.x + math.random(-10, 10)
local finalY = destination.y + math.random(-10, 10)
local finalZ = destination.z
local finalO = destination.o
creature:MoveTo(0, finalX, finalY, finalZ, true)
local battlecryIndex = math.random(1, #messages)
creature:SendUnitYell(messages[battlecryIndex], 0)
creature:EmoteState(375)
creature:SetHomePosition(finalX, finalY, finalZ, finalO)
creature:SetNPCFlags(0)
player:RemoveItem(ITEM_ID, 1)
player:KilledMonsterCredit(creature:GetEntry())
player:GossipComplete()
creature:RegisterEvent(DespawnCreature, 180000)
end
if intid == 2005 then
local randomAngle = math.random() * 2 * math.pi
creature:MoveFollow(player, 5, randomAngle)
local battlecryIndex = math.random(1, #messages)
creature:SendUnitYell(messages[battlecryIndex], 0)
player:KilledMonsterCredit(400104)
creature:SetNPCFlags(0)
player:RemoveItem(ITEM_ID, 1)
player:GossipComplete()
creature:RegisterEvent(DespawnCreature, 180000)
end
end
local function OnCreatureDied(event, creature, killer)
creature:SetEquipmentSlots(0, 0, 0)
creature:SetData("equipmentSet", false)
creature:RemoveEvents()
creature:SetEquipmentSlots(0, 0, 0)
end
for _, npcId in ipairs(NPC_IDS) do
RegisterCreatureGossipEvent(npcId, 1, OnGossipHello)
RegisterCreatureGossipEvent(npcId, 2, OnGossipSelect)
RegisterCreatureEvent(npcId, 1, OnEnterCombat)
RegisterCreatureEvent(npcId, 2, OnLeaveCombat)
RegisterCreatureEvent(npcId, 4, OnCreatureDied)
end

10
Faction_Shared/Auto91.lua Normal file
View File

@@ -0,0 +1,10 @@
--Custom Content Auto-loader. If you don't see custom content in Azeroth or unscripted creatures, it's because it's December 31st. Just .event stop 91 and .event start 91 again.
--DO NOT TOUCH! THIS IS TO FIX AN EXTREMELY ANNOYING BUG!
local eventId = 91
function OnStartup()
StartGameEvent(eventId, true)
end
RegisterServerEvent(14, OnStartup)

View File

@@ -0,0 +1,22 @@
local npcId = 400092
local spellId1 = 100199
local spellId2 = 100206
local range = 8
local killCreditNpcId = 400095
function OnSpellCast(event, player, spell)
local spellEntry = spell:GetEntry()
if spellEntry == spellId1 or spellEntry == spellId2 then
nearestCreature = player:GetNearestCreature(range, npcId)
if nearestCreature == nil then
player:SendBroadcastMessage("You need to place the barrier in a more strategic location.")
spell:Cancel()
else
player:KilledMonsterCredit(killCreditNpcId)
player:SendBroadcastMessage("You have successfully built a barrier!")
end
end
end
RegisterPlayerEvent(5, OnSpellCast)

View File

@@ -0,0 +1,35 @@
local BlightedZombie = {}
function BlightedZombie.OnSpawn(event, creature)
creature:SetMaxHealth(17720)
creature:CastSpell(creature:GetVictim(), 17683, true)
end
function BlightedZombie.OnCombat(event, creature, target)
creature:RegisterEvent(BlightedZombie.Ability1, 7000, 0)
creature:RegisterEvent(BlightedZombie.Ability2, 14000, 0)
end
function BlightedZombie.Ability1(event, delay, calls, creature)
creature:CastSpell(creature:GetVictim(), 52476, true)
end
function BlightedZombie.Ability2(event, delay, calls, creature)
creature:CastSpell(creature:GetVictim(), 37597, true)
end
function BlightedZombie.OnLeaveCombat(event, creature)
creature:RemoveEvents()
end
function BlightedZombie.OnDeath(event, creature, killer)
creature:DespawnOrUnsummon(5000)
creature:RemoveEvents()
end
RegisterCreatureEvent(400051, 1, BlightedZombie.OnCombat)
RegisterCreatureEvent(400051, 2, BlightedZombie.OnLeaveCombat)
RegisterCreatureEvent(400051, 4, BlightedZombie.OnDeath)
RegisterCreatureEvent(400051, 5, BlightedZombie.OnSpawn)

View File

@@ -0,0 +1,26 @@
local BlightedZombie = {}
function BlightedZombie.OnCombat(event, creature, target)
creature:RegisterEvent(BlightedZombie.Ability1, 7000, 0)
creature:RegisterEvent(BlightedZombie.Ability2, 12000, 0)
end
function BlightedZombie.Ability1(event, delay, calls, creature)
creature:CastSpell(creature:GetVictim(), 52476, true)
end
function BlightedZombie.Ability2(event, delay, calls, creature)
creature:CastSpell(creature:GetVictim(), 37597, true)
end
function BlightedZombie.OnLeaveCombat(event, creature)
creature:RemoveEvents()
end
function BlightedZombie.OnDeath(event, creature, killer)
creature:RemoveEvents()
end
RegisterCreatureEvent(4475, 1, BlightedZombie.OnCombat)
RegisterCreatureEvent(4475, 2, BlightedZombie.OnLeaveCombat)
RegisterCreatureEvent(4475, 4, BlightedZombie.OnDeath)

View File

@@ -0,0 +1,44 @@
local BlisteringZombie = {};
local function CastArmyOfTheDead(eventId, delay, calls, creature)
creature:CastSpell(creature, 42650, true)
end
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)
creature:RemoveEvents()
end
local function OnSpawn(event, creature)
creature:RegisterEvent(CastArmyOfTheDead, 1000, 1)
end
local function OnDied(event, creature, killer)
creature:DespawnOrUnsummon(5000)
creature:RemoveEvents()
end
RegisterCreatureEvent(400029, 1, OnEnterCombat)
RegisterCreatureEvent(400029, 2, OnLeaveCombat)
RegisterCreatureEvent(400029, 4, OnDied)
RegisterCreatureEvent(400029, 5, OnSpawn)

View File

@@ -0,0 +1,28 @@
local BlisteringZombie = {};
function BlisteringZombie.OnSpawn(event, creature)
creature:SetMaxHealth(8224)
creature:CastSpell(creature:GetVictim(), 17683, true)
end
function BlisteringZombie.OnCombat(event, creature, target)
creature:RegisterEvent(BlisteringZombie.Ability1, 8000, 0)
end
function BlisteringZombie.Ability1(event, delay, calls, creature)
creature:CastSpell(creature:GetVictim(), 55604, true)
end
function BlisteringZombie.OnLeaveCombat(event, creature)
creature:RemoveEvents()
end
function BlisteringZombie.OnDeath(event, creature, killer)
creature:DespawnOrUnsummon(10000)
creature:RemoveEvents()
end
RegisterCreatureEvent(400077, 1, BlisteringZombie.OnCombat)
RegisterCreatureEvent(400077, 2, BlisteringZombie.OnLeaveCombat)
RegisterCreatureEvent(400077, 4, BlisteringZombie.OnDeath)
RegisterCreatureEvent(400077, 5, BlisteringZombie.OnSpawn)

View File

@@ -0,0 +1,19 @@
local BoneWitch = {};
local function CastBoneShards(eventId, delay, calls, creature)
creature:CastSpell(creature, 17014, true)
end
local function OnSpawn(event, creature, target)
creature:RegisterEvent(CastBoneShards, 100, 1)
creature:RegisterEvent(CastBoneShards, 14000, 0)
end
local function OnDied(event, creature, killer)
creature:DespawnOrUnsummon(25000)
creature:RemoveEvents()
end
RegisterCreatureEvent(16380, 5, OnSpawn)
RegisterCreatureEvent(16380, 4, OnDied)

View File

@@ -0,0 +1,27 @@
local CreepStalker = {};
local function CastRake(eventId, delay, calls, creature)
creature:CastSpell(creature:GetVictim(), 9904, true)
end
local function CastStun(eventId, delay, calls, creature)
creature:CastSpell(creature:GetVictim(), 34510, true)
end
local function OnEnterCombat(event, creature, target)
creature:RegisterEvent(CastRake, 5000, 0)
creature:RegisterEvent(CastStun, 12000, 0)
end
local function OnLeaveCombat(event, creature)
creature:RemoveEvents()
end
local function OnDied(event, creature, killer)
creature:DespawnOrUnsummon(5000)
creature:RemoveEvents()
end
RegisterCreatureEvent(400032, 1, OnEnterCombat)
RegisterCreatureEvent(400032, 2, OnLeaveCombat)
RegisterCreatureEvent(400032, 4, OnDied)

View File

@@ -0,0 +1,61 @@
local GAME_EVENT_ID = 17 -- Set the game event ID
local npcIds = {344, 12480, 1284, 400064, 234, 3429} -- Add your NPC entries here
local BROADCAST_MESSAGE = "The Scourge are attacking the people of Azeroth. Quickly adventurers, prepare yourselves for battle!"
local SOUND_ID = 13363
local excludedZones = {44} -- Replace these with the zone IDs where you don't want the sound to play
local YELL_MESSAGES = {
"The Scourge have come!",
"Beware, the Scourge approaches!",
"Defend our home, the Scourge is upon us!",
"To arms, the Scourge is here!",
"All fighters ready the assault against the Scourge.",
"The Scourge invasion has begun!",
"The Lich Kings minions have come! Rally against the Scourge!",
"The Scourge dares to attack us!",
"Show the Scourge the might of the people of Azeroth!"
}
local function YellRandomMessage(npc)
local messageIndex = math.random(1, #YELL_MESSAGES)
npc:SendUnitYell(YELL_MESSAGES[messageIndex], 0)
end
local function valueExists(tbl, value)
for _, v in ipairs(tbl) do
if v == value then
return true
end
end
return false
end
local function DespawnAndRespawnNpcs(event, gameEventId)
if gameEventId == GAME_EVENT_ID then
local players = GetPlayersInWorld() -- Get all players in the world
if event == 34 then -- Game Event Start
SendWorldMessage(BROADCAST_MESSAGE, 2) -- Broadcast the message with chat type 2 (SYSTEM)
for _, player in ipairs(players) do
local playerZoneId = player:GetZoneId()
if not valueExists(excludedZones, playerZoneId) then
player:PlayDirectSound(SOUND_ID) -- Play the sound for each player
end
end
end
for _, player in ipairs(players) do
for _, npcId in ipairs(npcIds) do
local npcs = player:GetCreaturesInRange(1000, npcId) -- Get creatures within a radius of 1000 units from the player
for _, npc in ipairs(npcs) do
if event == 34 then -- Game Event Start
YellRandomMessage(npc)
end
npc:DespawnOrUnsummon()
npc:Respawn()
end
end
end
end
end
RegisterServerEvent(34, DespawnAndRespawnNpcs) -- Game Event Start
RegisterServerEvent(35, DespawnAndRespawnNpcs) -- Game Event End

110
Faction_Shared/DingMask.lua Normal file
View File

@@ -0,0 +1,110 @@
--lightning
local npcIds1 = {
8541,
10417,
4475,
11873,
8531,
11551,
10488,
10487,
1788,
10414,
10407,
400010,
400011,
400015,
400016,
300018,
16383,
16394,
16423,
16422,
400036,
400049,
400048,
16437,
16438
}
-- Rez Visual
local npcIds2 = {
400013,
400014,
68,
1976,
466,
400018,
400019,
400026,
400027,
400033,
400070,
400065,
400042,
400043
}
-- Shadowstep
local npcIds3 = {
400053,
400069,
400055,
400052,
400047,
400056,
400032,
400029,
400073,
400072,
400102,
400103
}
-- Function to be executed when an NPC from group 1 is spawned
local function CastSpellOnSpawnGroup1(event, creature)
if not creature then
print("Error: creature was not set!")
return
end
local spellId = 28234
creature:CastSpell(creature, spellId, true) -- minion visual
end
-- Function to be executed when an NPC from group 2 is spawned
local function CastSpellOnSpawnGroup2(event, creature)
if not creature then
print("Error: creature was not set!")
return
end
local spellId = 100133
creature:CastSpell(creature, spellId, true) -- rez visual
end
-- Function to be executed when an NPC from group 3 is spawned
local function CastSpellOnSpawnGroup3(event, creature)
if not creature then
print("Error: creature was not set!")
return
end
local spellId = 51908
creature:CastSpell(creature, spellId, true) -- shadowstep cosmetic
end
-- Register the event for NPCs in group 1
for _, npcId in ipairs(npcIds1) do
RegisterCreatureEvent(npcId, 5, CastSpellOnSpawnGroup1)
end
-- Register the event for NPCs in group 2
for _, npcId in ipairs(npcIds2) do
RegisterCreatureEvent(npcId, 5, CastSpellOnSpawnGroup2)
end
-- Register the event for NPCs in group 3
for _, npcId in ipairs(npcIds3) do
RegisterCreatureEvent(npcId, 5, CastSpellOnSpawnGroup3)
end

View File

@@ -0,0 +1,13 @@
local SPELL_ID = 100191
local AURA_1 = 100003
local AURA_2 = 100168
function OnKilledByCreature(event, killer, killed)
if (killed:HasAura(AURA_1) or killed:HasAura(AURA_2)) then
if not killed:HasSpellCooldown(SPELL_ID) then
killed:CastSpell(killed, SPELL_ID, false)
end
end
end
RegisterPlayerEvent(8, OnKilledByCreature)

60
Faction_Shared/Emote.lua Normal file
View File

@@ -0,0 +1,60 @@
local GAME_EVENT_ID = 17
local npcIds = {777, 790, 415, 956, 3356, 341, 793, 343, 342, 812, 1671, 10037, 859, 382, 1070, 931, 932, 903, 935, 68, 12480, 12481, 3479, 3483, 3477, 3486, 3478, 3431, 3481, 3482, 3464, 3489, 3432, 3480}
local secondNpcIds = {3088}
local thirdNpcIds = {3501, 3615}
local EMOTE_ID = 333 -- 1h ready
local SECOND_EMOTE_ID = 214 -- rifle ready
local THIRD_EMOTE_ID = 375 -- 2h ready
local function IsGameEventActive(eventId)
local activeEvents = GetActiveGameEvents()
for _, event in ipairs(activeEvents) do
if event == eventId then
return true
end
end
return false
end
local function ApplyEmoteToNpcs(players, npcIds, emoteId)
for _, player in ipairs(players) do
for _, npcId in ipairs(npcIds) do
local npcs = player:GetCreaturesInRange(1000, npcId)
for _, npc in ipairs(npcs) do
npc:EmoteState(emoteId)
end
end
end
end
local function SetNpcsEmoteState(event, gameEventId)
if gameEventId == GAME_EVENT_ID then
local players = GetPlayersInWorld()
ApplyEmoteToNpcs(players, npcIds, EMOTE_ID)
ApplyEmoteToNpcs(players, secondNpcIds, SECOND_EMOTE_ID)
ApplyEmoteToNpcs(players, thirdNpcIds, THIRD_EMOTE_ID)
end
end
local function ResetNpcsEmoteState(event, gameEventId)
if gameEventId == GAME_EVENT_ID then
local players = GetPlayersInWorld()
ApplyEmoteToNpcs(players, npcIds, 0)
ApplyEmoteToNpcs(players, secondNpcIds, 0)
ApplyEmoteToNpcs(players, thirdNpcIds, 0)
end
end
local function OnPlayerMapChange(event, player, newMap, newZone)
if IsGameEventActive(GAME_EVENT_ID) then
ApplyEmoteToNpcs({player}, npcIds, EMOTE_ID)
ApplyEmoteToNpcs({player}, secondNpcIds, SECOND_EMOTE_ID)
end
end
RegisterPlayerEvent(27, OnPlayerMapChange)
RegisterServerEvent(34, SetNpcsEmoteState)
RegisterServerEvent(35, ResetNpcsEmoteState)

View File

@@ -0,0 +1,25 @@
local FlameShocker = {};
local function CastFlameShock(eventId, delay, calls, creature)
creature:CastSpell(creature:GetVictim(), 10448, true)
end
local function OnEnterCombat(event, creature, target)
creature:RegisterEvent(CastFlameShock, 100, 1)
creature:RegisterEvent(CastFlameShock, 8000, 0)
end
local function OnLeaveCombat(event, creature)
creature:RemoveEvents()
end
local function OnDied(event, creature, killer)
creature:CastSpell(killer, 28323, true)
creature:DespawnOrUnsummon(25000)
creature:RemoveEvents()
end
RegisterCreatureEvent(16383, 1, OnEnterCombat)
RegisterCreatureEvent(16383, 2, OnLeaveCombat)
RegisterCreatureEvent(16383, 4, OnDied)

View File

@@ -0,0 +1,37 @@
local FleshFlayer = {};
local function CastLeap(eventId, delay, calls, creature)
creature:CastSpell(creature:GetVictim(), 47482, true)
end
local function CastPlague(eventId, delay, calls, creature)
creature:CastSpell(creature:GetVictim(), 52230, true)
end
local function CastExplode(eventId, delay, calls, creature)
creature:CastSpell(creature, 47496, true)
end
local function CastRend(eventId, delay, calls, creature)
creature:CastSpell(creature:GetVictim(), 18106, true)
end
local function OnEnterCombat(event, creature, target)
creature:RegisterEvent(CastLeap, 100, 1)
creature:RegisterEvent(CastPlague, 500, 1)
creature:RegisterEvent(CastRend, 2000, 1)
creature:RegisterEvent(CastPlague, 20000, 0)
creature:RegisterEvent(CastExplode, 30000, 0)
end
local function OnLeaveCombat(event, creature)
creature:RemoveEvents()
end
local function OnDied(event, creature, killer)
creature:RemoveEvents()
end
RegisterCreatureEvent(10407, 1, OnEnterCombat)
RegisterCreatureEvent(10407, 2, OnLeaveCombat)
RegisterCreatureEvent(10407, 4, OnDied)

33
Faction_Shared/Ghoul.lua Normal file
View File

@@ -0,0 +1,33 @@
local Ghoul = {};
local function CastLeap(eventId, delay, calls, creature)
creature:CastSpell(creature:GetVictim(), 47482, true)
end
local function CastPlague(eventId, delay, calls, creature)
creature:CastSpell(creature:GetVictim(), 52230, true)
end
local function CastExplode(eventId, delay, calls, creature)
creature:CastSpell(creature, 47496, true)
end
local function OnEnterCombat(event, creature, target)
creature:RegisterEvent(CastLeap, 100, 1)
creature:RegisterEvent(CastPlague, 100, 1)
creature:RegisterEvent(CastPlague, 20000, 0)
creature:RegisterEvent(CastExplode, 23000, 0)
end
local function OnLeaveCombat(event, creature)
creature:RemoveEvents()
end
local function OnDied(event, creature, killer)
creature:DespawnOrUnsummon(5000)
creature:RemoveEvents()
end
RegisterCreatureEvent(400047, 1, OnEnterCombat)
RegisterCreatureEvent(400047, 2, OnLeaveCombat)
RegisterCreatureEvent(400047, 4, OnDied)

View File

@@ -0,0 +1,27 @@
local GibberingGhoul = {}
function GibberingGhoul.OnCombat(event, creature, target)
creature:RegisterEvent(GibberingGhoul.Ability2, 100, 1)
creature:RegisterEvent(GibberingGhoul.Ability1, 7000, 0)
creature:RegisterEvent(GibberingGhoul.Ability2, 12000, 0)
end
function GibberingGhoul.Ability1(event, delay, calls, creature)
creature:CastSpell(creature:GetVictim(), 34113, true)
end
function GibberingGhoul.Ability2(event, delay, calls, creature)
creature:CastSpell(creature:GetVictim(), 12889, true)
end
function GibberingGhoul.OnLeaveCombat(event, creature)
creature:RemoveEvents()
end
function GibberingGhoul.OnDeath(event, creature, killer)
creature:RemoveEvents()
end
RegisterCreatureEvent(8531, 1, GibberingGhoul.OnCombat)
RegisterCreatureEvent(8531, 2, GibberingGhoul.OnLeaveCombat)
RegisterCreatureEvent(8531, 4, GibberingGhoul.OnDeath)

View File

@@ -0,0 +1,35 @@
local HateShrieker = {}
function HateShrieker.OnEnterCombat(event, creature, target)
creature:RegisterEvent(HateShrieker.Screech, 7000, 0)
creature:RegisterEvent(HateShrieker.ShadowWordPain, math.random(11000,16000), 0)
end
function HateShrieker.Screech(eventId, delay, calls, creature)
creature:CastSpell(creature, 3589)
end
function HateShrieker.OnLeaveCombat(event, creature)
creature:RemoveEvents()
end
function HateShrieker.OnDied(event, creature, killer)
creature:RemoveEvents()
end
function HateShrieker.ShadowWordPain(eventId, delay, calls, creature)
local targets = creature:GetAITargets(10)
if #targets == 0 then
return
end
local target = targets[math.random(#targets)]
creature:CastSpell(target, 10893)
creature:ClearThreatList()
end
RegisterCreatureEvent(8541, 1, HateShrieker.OnEnterCombat)
RegisterCreatureEvent(8541, 2, HateShrieker.OnLeaveCombat)
RegisterCreatureEvent(8541, 4, HateShrieker.OnDied)

View File

@@ -0,0 +1,23 @@
local BRAVE_IDS = {5412, 5614, 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, 31433}
local BRAVERY_DIALOGUE = {
"I fear no enemy!",
"I will fight to the bitter end!",
"This battle is mine!",
"This is MY city!",
"My courage will never falter!",
"I'll show you what true bravery is!",
"I am unbreakable!",
"This fight is mine to win!",
"I'll fight until my last breath!",
"Pfft, you think you can scare the likes of me!?"
}
local function OnCombat(event, creature, target)
if math.random() < 0.5 then -- 50% chance to trigger dialogue
creature:SendUnitSay(BRAVERY_DIALOGUE[math.random(#BRAVERY_DIALOGUE)], 0)
end
end
for i, id in ipairs(BRAVE_IDS) do
RegisterCreatureEvent(id, 1, OnCombat)
end

View File

@@ -0,0 +1,29 @@
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
local yellOptions = {
"Aaahhh! Somebody help!",
"I can't believe this is happening, why is this happening?!",
"I don't know what to do, I don't know what to do!",
"No! Stay away from me!",
"Please, please let this be a nightmare!",
"I can't handle this, I can't handle this!",
"No, no, no!",
"This can't be happening!",
"I'm not ready for this!",
"This is insane, how did we get here?!",
"Why is this happening to me?!",
"I don't want to die!",
"I'm not prepared for this, I'm not prepared for this at all!",
"Please, someone help me!",
"There's no way this is happening!"
}
local randomIndex = math.random(1, 15)
local selectedYell = yellOptions[randomIndex]
creature:SendUnitYell(selectedYell, 0)
end
for i, id in ipairs(FREAKOUT_NPC) do
RegisterCreatureEvent(id, 1, OnEnterCombat)
end

View File

@@ -0,0 +1,45 @@
local Necrofiend = {}
function Necrofiend.OnEnterCombat(event, creature, target)
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)
end
function Necrofiend.CastBanefulPoison(event, delay, calls, creature)
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()
end
function Necrofiend.OnDied(event, creature, killer)
creature:DespawnOrUnsummon(5000)
creature:RemoveEvents()
end
RegisterCreatureEvent(400055, 1, Necrofiend.OnEnterCombat)
RegisterCreatureEvent(400055, 2, Necrofiend.OnLeaveCombat)
RegisterCreatureEvent(400055, 4, Necrofiend.OnDied)

View File

@@ -0,0 +1,36 @@
local Necrofiend = {}
function Necrofiend.OnEnterCombat(event, creature, target)
creature:RegisterEvent(Necrofiend.WebSpray, 12000, 0, creature)
creature:RegisterEvent(Necrofiend.CastBanefulPoison, 7000, 0, creature)
creature:RegisterEvent(Necrofiend.DeadlyPoison, 10000, 0, creature)
end
function Necrofiend.WebSpray(event, delay, calls, creature)
creature:CastSpell(creature:GetVictim(), 55508, true)
end
function Necrofiend.DeadlyPoison(event, delay, calls, creature)
creature:CastSpell(creature:GetVictim(), 34616, true)
end
function Necrofiend.CastBanefulPoison(event, delay, calls, creature)
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()
end
function Necrofiend.OnDied(event, creature, killer)
creature:RemoveEvents()
end
RegisterCreatureEvent(11551, 1, Necrofiend.OnEnterCombat)
RegisterCreatureEvent(11551, 2, Necrofiend.OnLeaveCombat)
RegisterCreatureEvent(11551, 4, Necrofiend.OnDied)

View File

@@ -0,0 +1,7 @@
local PallidHorror = {}
function PallidHorror.OnDied(event, creature, killer)
creature:CastSpell(creature, 28699, true)
end
RegisterCreatureEvent(16394, 4, PallidHorror.OnDied)

View File

@@ -0,0 +1,65 @@
local GAME_EVENT_ID = 17 -- Set the game event ID
local MAX_NPC_SPAWN = 3 -- Set the maximum number of NPCs to spawn simultaneously. Extremely high numbers will hurt performance
local ATTACK_CHANCE = 15 -- Set the likelihood of an attack here, in percent
local DAZE_SPELL_ID = 100201 -- Set the spell ID for daze
local creatureEntries = {
16423,
16422,
400011
} -- Add NPC entries above (CHANGE THESE OR IT WON'T WORK! I'M USING CUSTOM IDs)
local npcdialogue = {
"Grrrr...",
"Rrrrr...",
"Grraaargh...",
"Raaargh...",
"Hssss..."
} -- Add dialogue above
local function IsGameEventActive(eventId)
local activeEvents = GetActiveGameEvents()
for _, event in ipairs(activeEvents) do
if event == eventId then
return true
end
end
return false
end
local function SpawnAttacker(event, player)
if IsGameEventActive(GAME_EVENT_ID) then
local chance = math.random(100)
if chance <= ATTACK_CHANCE then
local mapId = player:GetMapId()
local x, y, z, o = player:GetLocation()
local level = player:GetLevel()
local health = player:GetHealth() * 1.65
local npcCount = math.random(1, MAX_NPC_SPAWN)
-- Check if the player is mounted and not flying
if player:IsMounted() and not player:IsFlying() then
player:Dismount()
player:CastSpell(player, DAZE_SPELL_ID, true)
player:SendBroadcastMessage("You have been knocked off your mount!")
end
for i = 1, npcCount do
local selectedCreature = creatureEntries[math.random(#creatureEntries)]
local randomX = x + math.random(-18, 18)
local randomY = y + math.random(-18, 18)
local spawnedCreature = player:SpawnCreature(selectedCreature, randomX, randomY, z, o, 7, 130000)
spawnedCreature:SetLevel(level)
spawnedCreature:SetMaxHealth(health)
spawnedCreature:SetHealth(health)
spawnedCreature:AttackStart(player)
local selectedDialogue = npcdialogue[math.random(#npcdialogue)]
spawnedCreature:SendUnitYell(selectedDialogue, 0)
end
end
end
end
RegisterPlayerEvent(27, SpawnAttacker)

View File

@@ -0,0 +1,64 @@
local Rattlegore = {};
local function Thunderclap(eventId, delay, calls, creature)
creature:CastSpell(creature:GetVictim(), 26554, true)
end
local function WhirlwindKnockback(eventId, delay, calls, creature)
creature:CastSpell(creature:GetVictim(), 34109, true)
end
local function Enrage(eventId, delay, calls, creature)
creature:CastSpell(creature, 15716, true)
end
local function BoneArmor(eventId, delay, calls, creature)
creature:CastSpell(creature, 38882, true)
end
local function Thrash(eventId, delay, calls, creature)
creature:CastSpell(creature, 3391, true)
end
local function SweepingStrikes(eventId, delay, calls, creature)
creature:CastSpell(creature, 18765, true)
end
function Stun(eventId, delay, calls, creature)
local targets = creature:GetAITargets(10)
if #targets == 0 then
return
end
local target = targets[math.random(#targets)]
creature:CastSpell(target, 17308, true)
end
local function OnEnterCombat(event, creature, target)
creature:RegisterEvent(Thunderclap, 7000, 0)
creature:RegisterEvent(WhirlwindKnockback, 11000)
creature:RegisterEvent(Stun, 16000, 0)
creature:RegisterEvent(Thrash, 8500, 0)
creature:RegisterEvent(BoneArmor, 15000, 0)
creature:RegisterEvent(BoneArmor, 500, 1)
creature:RegisterEvent(SweepingStrikes, 100, 1)
end
local function OnHealthUpdate(event, creature, value)
if (creature:GetHealthPct() <= 20) then
creature:RemoveEvents()
creature:RegisterEvent(Enrage, 100, 1)
end
end
local function OnLeaveCombat(event, creature)
creature:RemoveEvents()
end
local function OnDied(event, creature, killer)
creature:RemoveEvents()
end
RegisterCreatureEvent(11622, 1, OnEnterCombat)
RegisterCreatureEvent(11622, 9, OnHealthUpdate)
RegisterCreatureEvent(11622, 2, OnLeaveCombat)
RegisterCreatureEvent(11622, 4, OnDied)

View File

@@ -0,0 +1,53 @@
local RisenConstruct = {};
local function ArcingSmash(eventId, delay, calls, creature)
creature:CastSpell(creature:GetVictim(), 1619, true)
end
local function Enrage(eventId, delay, calls, creature)
creature:CastSpell(creature, 15716, true)
end
local function Thrash(eventId, delay, calls, creature)
creature:CastSpell(creature, 3391, true)
end
local function SweepingStrikes(eventId, delay, calls, creature)
creature:CastSpell(creature, 18765, true)
end
function Stun(eventId, delay, calls, creature)
local targets = creature:GetAITargets(10)
if #targets == 0 then
return
end
local target = targets[math.random(#targets)]
creature:CastSpell(target, 17308, true)
end
local function OnEnterCombat(event, creature, target)
creature:RegisterEvent(ArcingSmash, 7000, 0)
creature:RegisterEvent(Stun, 13000, 0)
creature:RegisterEvent(Thrash, 8500, 0)
creature:RegisterEvent(SweepingStrikes, 100, 1)
end
local function OnHealthUpdate(event, creature, value)
if (creature:GetHealthPct() <= 20) then
creature:RemoveEvents()
creature:RegisterEvent(Enrage, 100, 1)
end
end
local function OnLeaveCombat(event, creature)
creature:RemoveEvents()
end
local function OnDied(event, creature, killer)
creature:RemoveEvents()
end
RegisterCreatureEvent(10488, 1, OnEnterCombat)
RegisterCreatureEvent(10488, 9, OnHealthUpdate)
RegisterCreatureEvent(10488, 2, OnLeaveCombat)
RegisterCreatureEvent(10488, 4, OnDied)

View File

@@ -0,0 +1,33 @@
local RisenGuard = {}
function RisenGuard.OnCombat(event, creature, target)
creature:RegisterEvent(RisenGuard.Ability2, 100, 1)
creature:RegisterEvent(RisenGuard.Ability1, 7000, 0)
creature:RegisterEvent(RisenGuard.Ability2, 12000, 0)
creature:RegisterEvent(RisenGuard.Ability3, 10000, 0)
end
function RisenGuard.Ability1(event, delay, calls, creature)
creature:CastSpell(creature:GetVictim(), 34113, true)
end
function RisenGuard.Ability2(event, delay, calls, creature)
creature:CastSpell(creature:GetVictim(), 8380, true)
end
function RisenGuard.Ability3(event, delay, calls, creature)
creature:CastSpell(creature:GetVictim(), 5164, true)
end
function RisenGuard.OnLeaveCombat(event, creature)
creature:RemoveEvents()
end
function RisenGuard.OnDeath(event, creature, killer)
creature:RemoveEvents()
end
RegisterCreatureEvent(10489, 1, RisenGuard.OnCombat)
RegisterCreatureEvent(10489, 2, RisenGuard.OnLeaveCombat)
RegisterCreatureEvent(10489, 4, RisenGuard.OnDeath)

View File

@@ -0,0 +1,22 @@
local questIds = {9265, 9264, 9263, 9262, 9261, 9260}
local itemId = 22892
local itemCount = 3
local totalLooted = {}
local function OnLootItem(event, player, item, count)
if item:GetEntry() == itemId then
for _, questId in pairs(questIds) do
if player:HasQuest(questId) then
if not totalLooted[questId] then
totalLooted[questId] = 0
end
totalLooted[questId] = totalLooted[questId] + count
if totalLooted[questId] >= itemCount then
player:CompleteQuest(questId)
end
end
end
end
end
RegisterPlayerEvent(32, OnLootItem)

View File

@@ -0,0 +1,49 @@
Bonk = {}
-- Create the item you want to give to the player
Bonk.ITEM_ID = 60112 -- replace with the ID of the item you want to give
Bonk.ITEM_ID2 = 37500 -- replace with the ID of the new item you want to give
-- Register the gossip event for the NPC
function Bonk.OnGossipHello(event, player, creature)
player:GossipMenuAddItem(0, "|TInterface\\Icons\\ability_druid_flightform:50:50:-13:0|tMech Wings for 75 silver.", 0, 1)
player:GossipMenuAddItem(0, "|TInterface\\Icons\\inv_misc_key_14:50:50:-13:0|tKeys to a Shredder for 45 silver.", 0, 2)
player:GossipSendMenu(1, creature)
end
function Bonk.OnGossipSelect(event, player, creature, sender, intid, code)
if intid == 1 then
if player:GetCoinage() < 7500 then
player:SendBroadcastMessage("You don't have enough coins.")
player:GossipComplete()
else
player:SetCoinage(player:GetCoinage() - 7500)
player:AddItem(Bonk.ITEM_ID, 1)
player:SendBroadcastMessage("You have received Mech Wings.")
player:GossipComplete()
end
elseif intid == 2 then
if player:GetCoinage() < 4500 then
player:SendBroadcastMessage("You don't have enough coins.")
player:GossipComplete()
else
player:SetCoinage(player:GetCoinage() - 4500)
player:AddItem(Bonk.ITEM_ID2, 1)
player:SendBroadcastMessage("You have received keys to a Refurbished Shredder.")
player:GossipComplete()
end
end
end
-- Send a unit yell when the NPC spawns
function Bonk.OnSpawn(event, creature)
creature:SendUnitYell("Step right up! I've got Mech Wings and keys to Refurbished Shredders!", 0)
creature:CastSpell(creature, 20374)
end
-- Register the gossip events with the NPC
RegisterCreatureGossipEvent(400043, 1, Bonk.OnGossipHello)
RegisterCreatureGossipEvent(400043, 2, Bonk.OnGossipSelect)
RegisterCreatureEvent(400043, 5, Bonk.OnSpawn)

View File

@@ -0,0 +1,48 @@
local SkeletalWarlord = {}
SkeletalWarlord.minChargeRange = 10
function SkeletalWarlord.OnEnterCombat(event, creature, target)
creature:RegisterEvent(SkeletalWarlord.Whirlwind, 15000, 0)
creature:RegisterEvent(SkeletalWarlord.MortalStrike, 7000, 0)
creature:RegisterEvent(SkeletalWarlord.Charge, 10000, 0)
end
function SkeletalWarlord.Whirlwind(eventId, delay, calls, creature)
creature:CastSpell(creature:GetVictim(), 36982, true)
end
function SkeletalWarlord.MortalStrike(eventId, delay, calls, creature)
creature:CastSpell(creature:GetVictim(), 21553, true)
end
function SkeletalWarlord.OnLeaveCombat(event, creature)
creature:RemoveEvents()
end
function SkeletalWarlord.OnDied(event, creature, killer)
creature:DespawnOrUnsummon(15000)
creature:RemoveEvents()
end
function SkeletalWarlord.Charge(eventId, delay, calls, creature)
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, 1, SkeletalWarlord.OnEnterCombat)
RegisterCreatureEvent(400056, 2, SkeletalWarlord.OnLeaveCombat)
RegisterCreatureEvent(400056, 4, SkeletalWarlord.OnDied)
RegisterCreatureEvent(1788, 1, SkeletalWarlord.OnEnterCombat)
RegisterCreatureEvent(1788, 2, SkeletalWarlord.OnLeaveCombat)
RegisterCreatureEvent(1788, 4, SkeletalWarlord.OnDied)

View File

@@ -0,0 +1,28 @@
local SkeletalWarrior = {}
function SkeletalWarrior.OnSpawn(event, creature)
creature:SetMaxHealth(7720)
creature:CastSpell(creature:GetVictim(), 17683, true)
end
function SkeletalWarrior.OnCombat(event, creature, target)
creature:RegisterEvent(SkeletalWarrior.Ability1, 10000, 0)
end
function SkeletalWarrior.Ability1(event, delay, calls, creature)
creature:CastSpell(creature:GetVictim(), 6547, true)
end
function SkeletalWarrior.OnLeaveCombat(event, creature)
creature:RemoveEvents()
end
function SkeletalWarrior.OnDeath(event, creature, killer)
creature:DespawnOrUnsummon(10000)
creature:RemoveEvents()
end
RegisterCreatureEvent(400016, 1, SkeletalWarrior.OnCombat)
RegisterCreatureEvent(400016, 2, SkeletalWarrior.OnLeaveCombat)
RegisterCreatureEvent(400016, 4, SkeletalWarrior.OnDeath)
RegisterCreatureEvent(400016, 5, SkeletalWarrior.OnSpawn)

View File

@@ -0,0 +1,62 @@
local SpectralAttendant = {}
function SpectralAttendant.OnSpawn(event, creature)
creature:SetMaxHealth(43240)
creature:CastSpell(creature, 17683, true)
end
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
function SpectralAttendant.Incinerate(eventId, delay, calls, creature)
creature:CastSpell(creature:GetVictim(), 29722, true)
end
function SpectralAttendant.AOEFear(eventId, delay, calls, creature)
creature:CastSpell(creature, 8122)
end
function SpectralAttendant.OnLeaveCombat(event, creature)
creature:RemoveEvents()
end
function SpectralAttendant.OnDied(event, creature, killer)
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)
RegisterCreatureEvent(400052, 4, SpectralAttendant.OnDied)

View File

@@ -0,0 +1,40 @@
local SpectralAttendant = {}
function SpectralAttendant.OnEnterCombat(event, creature, target)
creature:RegisterEvent(SpectralAttendant.Cripple, 6000, 0)
creature:RegisterEvent(SpectralAttendant.AOEFear, 13000, 0)
creature:RegisterEvent(SpectralAttendant.Teleport, math.random(14000,16000), 0)
end
function SpectralAttendant.Cripple(eventId, delay, calls, creature)
creature:CastSpell(creature:GetVictim(), 11443, true)
end
function SpectralAttendant.AOEFear(eventId, delay, calls, creature)
creature:CastSpell(creature, 8122)
end
function SpectralAttendant.OnLeaveCombat(event, creature)
creature:RemoveEvents()
end
function SpectralAttendant.OnDied(event, creature, killer)
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(11873, 1, SpectralAttendant.OnEnterCombat)
RegisterCreatureEvent(11873, 2, SpectralAttendant.OnLeaveCombat)
RegisterCreatureEvent(11873, 4, SpectralAttendant.OnDied)

View File

@@ -0,0 +1,20 @@
--DO NOT DELETE ME! FIXES AN ANNOYING AF BUG
local holidayEventIds = {17, 91}
local function OnPlayerLogin(event, player)
if not player:IsInWorld() then
return
end
for _, eventId in ipairs(holidayEventIds) do
local isHolidayActive = IsGameEventActive(eventId)
if isHolidayActive then
StopGameEvent(eventId)
StartGameEvent(eventId)
end
end
end
RegisterPlayerEvent(3, OnPlayerLogin)

View File

@@ -0,0 +1,32 @@
local StoneskinGargoyle = {}
local function GustOfWind(eventId, delay, calls, creature)
creature:CastSpell(creature:GetVictim(), 61663, true)
end
local function StoneStomp(eventId, delay, calls, creature)
local targets = creature:GetAITargets(10)
if #targets == 0 then
return
end
local target = targets[math.random(#targets)]
creature:CastSpell(target, 49675, true)
end
local function OnEnterCombat(event, creature, target)
creature:RegisterEvent(GustOfWind, 15000, 0)
creature:RegisterEvent(StoneStomp, 8000, 0)
end
local function OnLeaveCombat(event, creature)
creature:RemoveEvents()
end
local function OnDied(event, creature, killer)
creature:DespawnOrUnsummon(5000)
creature:RemoveEvents()
end
RegisterCreatureEvent(400053, 1, OnEnterCombat)
RegisterCreatureEvent(400053, 2, OnLeaveCombat)
RegisterCreatureEvent(400053, 4, OnDied)

View File

@@ -0,0 +1,45 @@
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,
14,
1637
}
-- 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 use that here.")
else
player:KilledMonsterCredit(NPC_ID)
player:SendBroadcastMessage("You have successfuly placed a trap!")
end
end
end
RegisterPlayerEvent(5, OnPlayerCastSpell)

View File

@@ -0,0 +1,59 @@
local GOSSIP_OPTION_CUT_TREE = 1
local LOG_ITEM_ID = 60116
local BARRIERS_BUILT_QUEST_ID = 30012
local SECOND_PERMITTED_QUEST_ID = 30020
function OnCreatureSpawn(event, creature)
creature:SetReactState(0)
end
function OnGossipHello(event, player, creature)
if player:IsMounted() then
player:SendBroadcastMessage("You must dismount first!")
return
end
if not player:HasItem(1311) then
player:SendBroadcastMessage("You need the Wood Cutter Axe in order to chop down this tree!")
return
end
if not (player:HasQuest(BARRIERS_BUILT_QUEST_ID) or player:HasQuest(SECOND_PERMITTED_QUEST_ID)) then
player:SendBroadcastMessage("You must be on a certain quest before you can chop down this tree!")
return
end
if player:HasItem(LOG_ITEM_ID, 20) then
player:SendBroadcastMessage("You have the maximum amount of logs already!")
return
end
creature:SetReactState(0)
player:GossipMenuAddItem(8, "Cut down this tree", 1, GOSSIP_OPTION_CUT_TREE)
player:GossipSendMenu(8, creature)
end
function OnGossipSelect(event, player, creature, sender, intid)
if intid == GOSSIP_OPTION_CUT_TREE then
player:CastSpell(creature, 62990, false)
player:Kill(creature)
player:KilledMonsterCredit(400091)
player:GossipComplete()
end
end
function OnCreatureDeath(event, creature, killer)
creature:DespawnOrUnsummon(12000)
creature:RemoveEvents()
-- Give the player 1-3 logs upon death
if killer ~= nil and killer:IsPlayer() then
local logs = math.random(1, 3)
killer:AddItem(LOG_ITEM_ID, logs)
end
end
RegisterCreatureEvent(400091, 5, OnCreatureSpawn)
RegisterCreatureGossipEvent(400091, 1, OnGossipHello)
RegisterCreatureGossipEvent(400091, 2, OnGossipSelect)
RegisterCreatureEvent(400091, 4, OnCreatureDeath)

View File

@@ -0,0 +1,38 @@
local VenomBelcher = {};
local function VenomSpit(eventId, delay, calls, creature)
creature:CastSpell(creature:GetVictim(), 24011, true)
end
local function SlowingPoison(eventId, delay, calls, creature)
creature:CastSpell(creature:GetVictim(), 14897, true)
end
function CastRetchingPlague(eventId, delay, calls, creature)
local targets = creature:GetAITargets(10)
if #targets == 0 then
return
end
local target = targets[math.random(#targets)]
creature:CastSpell(target, 30080, true)
end
local function OnEnterCombat(event, creature, target)
creature:RegisterEvent(VenomSpit, 7000, 0)
creature:RegisterEvent(CastRetchingPlague, 13000, 0)
creature:RegisterEvent(SlowingPoison, 16000, 0)
end
local function OnLeaveCombat(event, creature)
creature:RemoveEvents()
end
local function OnDied(event, creature, killer)
creature:RemoveEvents()
end
RegisterCreatureEvent(10417, 1, OnEnterCombat)
RegisterCreatureEvent(10417, 2, OnLeaveCombat)
RegisterCreatureEvent(10417, 4, OnDied)

View File

@@ -0,0 +1,95 @@
local UndeadWarlord = {};
local function CastShadowStrike(eventId, delay, calls, creature)
creature:CastSpell(creature:GetVictim(), 33914, true)
end
local function CastFear(eventId, delay, calls, creature)
creature:CastSpell(creature:GetVictim(), 5782, true)
end
local function CastSummonSkeleton(eventId, delay, calls, creature)
creature:CastSpell(creature, 59711, true)
end
local enterCombatDialogue = {
"Your life is forfeit to the Lich King!",
"The Scourge will devour your soul!",
"You dare challenge the might of the Scourge?",
"Your pitiful existence ends here!"
}
local leaveCombatDialogue = {
"Your cowardice prolongs the inevitable!",
"The Lich King's grasp reaches far, mortal!",
"We will meet again, and you will fall!",
"Your luck will run out soon enough."
}
local killTargetDialogue = {
"Another soul for the taking!",
"Your life serves the Scourge now!",
"You never stood a chance against the Scourge!",
"Your death only strengthens our ranks."
}
local deathDialogue = {
"You... How?",
"I'll be back!",
"This is not the end!",
"I'll haunt your dreams!"
}
function UndeadWarlord.OnEnterCombat(event, creature, target)
if math.random(100) <= 40 then
local randomDialogue = enterCombatDialogue[math.random(4)]
creature:SendUnitYell(randomDialogue, 0)
end
creature:RegisterEvent(CastShadowStrike, math.random(7000, 9000), 0)
creature:RegisterEvent(CastFear, math.random(9500, 13000), 0)
creature:RegisterEvent(CastSummonSkeleton, math.random(13500, 17000), 0)
end
function UndeadWarlord.OnLeaveCombat(event, creature)
if math.random(100) <= 40 then
local randomDialogue = leaveCombatDialogue[math.random(4)]
creature:SendUnitYell(randomDialogue, 0)
end
creature:RemoveEvents()
end
function UndeadWarlord.OnKilledTarget(event, creature, victim)
local randomDialogue = killTargetDialogue[math.random(4)]
creature:SendUnitYell(randomDialogue, 0)
end
function UndeadWarlord.OnDied(event, creature, killer)
local randomDialogue = deathDialogue[math.random(4)]
creature:SendUnitYell(randomDialogue, 0)
creature:CastSpell(creature, 100202, true)
creature:RemoveEvents()
end
function UndeadWarlord.OnSpawn(event, creature)
creature:SetMaxHealth(48420)
creature:CastSpell(creature:GetVictim(), 17683, true)
if creature == nil or not creature:IsInWorld() then return end
creature:SendUnitYell("Quickly servants! The Master expects swift results.", 0)
creature:CastSpell(creature, 59711, true)
creature:RegisterEvent(function (eventId, delay, calls, creature)
if creature == nil or not creature:IsInWorld() then return end
creature:CastSpell(creature, 59711, true)
end, 15000, 0)
end
RegisterCreatureEvent(300018, 1, UndeadWarlord.OnEnterCombat)
RegisterCreatureEvent(300018, 2, UndeadWarlord.OnLeaveCombat)
RegisterCreatureEvent(300018, 3, UndeadWarlord.OnKilledTarget)
RegisterCreatureEvent(300018, 4, UndeadWarlord.OnDied)
RegisterCreatureEvent(300018, 5, UndeadWarlord.OnSpawn)

38
Lakeshire/DarionTur.lua Normal file
View File

@@ -0,0 +1,38 @@
local CustomCreature = {}
local NPC_ID = 400081
local MAX_HEALTH = 8432 -- Set the desired max health value
local ABILITY_1 = 16856
local ABILITY_2 = 676
function CustomCreature.OnSpawn(event, creature)
creature:SetMaxHealth(MAX_HEALTH)
creature:SetHealth(MAX_HEALTH)
end
function CustomCreature.OnCombat(event, creature, target)
creature:RegisterEvent(CustomCreature.Ability1, 7000, 0)
creature:RegisterEvent(CustomCreature.Ability2, 22000, 0)
end
function CustomCreature.Ability1(event, delay, calls, creature)
creature:CastSpell(creature:GetVictim(), ABILITY_1, true)
end
function CustomCreature.Ability2(event, delay, calls, creature)
creature:CastSpell(creature:GetVictim(), ABILITY_2, true)
end
function CustomCreature.OnLeaveCombat(event, creature)
creature:RemoveEvents()
end
function CustomCreature.OnDeath(event, creature, killer)
creature:RemoveEvents()
end
RegisterCreatureEvent(NPC_ID, 5, CustomCreature.OnSpawn)
RegisterCreatureEvent(NPC_ID, 1, CustomCreature.OnCombat)
RegisterCreatureEvent(NPC_ID, 2, CustomCreature.OnLeaveCombat)
RegisterCreatureEvent(NPC_ID, 4, CustomCreature.OnDeath)

8
Lakeshire/DarionTur2.lua Normal file
View File

@@ -0,0 +1,8 @@
local NPC_ID_DAMION_TUR = 400079
local SOUND_ID = 20436
local function OnDamionTurSpawn(event, creature)
creature:PlayDirectSound(SOUND_ID)
end
RegisterCreatureEvent(NPC_ID_DAMION_TUR, 5, OnDamionTurSpawn)

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)

14
Lakeshire/Dumbassery.lua Normal file
View File

@@ -0,0 +1,14 @@
--I was being dumb. Don't ask.
local CREATURE_ID = 1069
local ITEM_ID = 65006
local ITEM_COUNT = 1
local REQUIRED_QUEST_ID = 30015
local function OnCreatureKill(event, player, creature)
if creature:GetEntry() == CREATURE_ID and player:HasQuest(REQUIRED_QUEST_ID) then
player:AddItem(ITEM_ID, ITEM_COUNT)
end
end
RegisterPlayerEvent(7, OnCreatureKill)

View File

@@ -0,0 +1,597 @@
local NPC_ENTRY1 = 400080
local REQUIRED_QUEST_ID = 30011
local function OnGossipHello(event, player, creature)
local questStatus = player:GetQuestStatus(REQUIRED_QUEST_ID)
if not player:HasQuest(REQUIRED_QUEST_ID) then
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
player:GossipMenuAddItem(0, "The scourge are coming! Please head to the inn!", 0, 1)
player:GossipSendMenu(1, creature)
end
local function OnGossipSelect(event, player, creature, sender, intid, code)
if (intid == 1) then
creature:MoveWaypoint()
player:GossipComplete()
player:KilledMonsterCredit(NPC_ENTRY1)
local random = math.random(0, 4)
if random == 0 then
creature:SendUnitSay("How could this be happening? We've always been safe here.", 0)
elseif random == 1 then
creature:SendUnitSay("Why would they attack us? We've never done anything to them.", 0)
elseif random == 2 then
creature:SendUnitSay("What are we going to do? We're not prepared for this kind of violence.", 0)
elseif random == 3 then
creature:SendUnitSay("This can't be real. It must be a terrible dream.", 0)
else
creature:SendUnitSay("I'm so scared. I don't know what the future holds for us now.", 0)
end
end
end
local function OnSpawn(event, creature)
creature:MoveStop()
creature:MoveIdle()
end
local function OnDeath(event, creature, killer)
creature:RemoveEvents()
creature:MoveStop()
creature:MoveIdle()
end
RegisterCreatureGossipEvent(NPC_ENTRY1, 1, OnGossipHello)
RegisterCreatureGossipEvent(NPC_ENTRY1, 2, OnGossipSelect)
RegisterCreatureEvent(NPC_ENTRY1, 5, OnSpawn)
RegisterCreatureEvent(NPC_ENTRY1, 3, OnDeath)
------------------------------------------------------------------------------------
local NPC_ENTRY2 = 400082
local REQUIRED_QUEST_ID = 30011
local function OnGossipHello(event, player, creature)
local questStatus = player:GetQuestStatus(REQUIRED_QUEST_ID)
if not player:HasQuest(REQUIRED_QUEST_ID) then
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
player:GossipMenuAddItem(0, "The scourge are coming! Please head to the inn!", 0, 1)
player:GossipSendMenu(1, creature)
end
local function OnGossipSelect(event, player, creature, sender, intid, code)
if (intid == 1) then
creature:MoveWaypoint()
player:GossipComplete()
player:KilledMonsterCredit(NPC_ENTRY1)
local random = math.random(0, 4)
if random == 0 then
creature:SendUnitSay("How could this be happening? We've always been safe here.", 0)
elseif random == 1 then
creature:SendUnitSay("What do we do now? We can't just sit here and wait to be slaughtered.", 0)
elseif random == 2 then
creature:SendUnitSay("What are we going to do? We're not prepared for this kind of violence.", 0)
elseif random == 3 then
creature:SendUnitSay("This can't be real. It must be a terrible dream.", 0)
else
creature:SendUnitSay("I'm so scared. I don't know what the future holds for us now.", 0)
end
end
end
local function OnSpawn(event, creature)
creature:MoveStop()
creature:MoveIdle()
end
local function OnDeath(event, creature, killer)
creature:RemoveEvents()
creature:MoveStop()
creature:MoveIdle()
end
RegisterCreatureGossipEvent(NPC_ENTRY2, 1, OnGossipHello)
RegisterCreatureGossipEvent(NPC_ENTRY2, 2, OnGossipSelect)
RegisterCreatureEvent(NPC_ENTRY2, 5, OnSpawn)
RegisterCreatureEvent(NPC_ENTRY2, 3, OnDeath)
------------------------------------------------------------------------------------
local NPC_ENTRY3 = 400083
local REQUIRED_QUEST_ID = 30011
local function OnGossipHello(event, player, creature)
local questStatus = player:GetQuestStatus(REQUIRED_QUEST_ID)
if not player:HasQuest(REQUIRED_QUEST_ID) then
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
player:GossipMenuAddItem(0, "The scourge are coming! Please head to the inn!", 0, 1)
player:GossipSendMenu(1, creature)
end
local function OnGossipSelect(event, player, creature, sender, intid, code)
if (intid == 1) then
creature:MoveWaypoint()
player:GossipComplete()
player:KilledMonsterCredit(NPC_ENTRY1)
local random = math.random(0, 4)
if random == 0 then
creature:SendUnitSay("How could this be happening? We've always been safe here.", 0)
elseif random == 1 then
creature:SendUnitSay("Why would they attack us? We've never done anything to them.", 0)
elseif random == 2 then
creature:SendUnitSay("This is a nightmare. Please tell me it's not real.", 0)
elseif random == 3 then
creature:SendUnitSay("Why did we ever leave Ironforge? We were safe there.", 0)
else
creature:SendUnitSay("I'm so scared. I don't know what the future holds for us now.", 0)
end
end
end
local function OnSpawn(event, creature)
creature:MoveStop()
creature:MoveIdle()
end
local function OnDeath(event, creature, killer)
creature:RemoveEvents()
creature:MoveStop()
creature:MoveIdle()
end
RegisterCreatureGossipEvent(NPC_ENTRY3, 1, OnGossipHello)
RegisterCreatureGossipEvent(NPC_ENTRY3, 2, OnGossipSelect)
RegisterCreatureEvent(NPC_ENTRY3, 5, OnSpawn)
RegisterCreatureEvent(NPC_ENTRY3, 3, OnDeath)
------------------------------------------------------------------------------------
local NPC_ENTRY4 = 400084
local REQUIRED_QUEST_ID = 30011
local function OnGossipHello(event, player, creature)
local questStatus = player:GetQuestStatus(REQUIRED_QUEST_ID)
if not player:HasQuest(REQUIRED_QUEST_ID) then
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
player:GossipMenuAddItem(0, "The scourge are coming! Please head to the inn!", 0, 1)
player:GossipSendMenu(1, creature)
end
local function OnGossipSelect(event, player, creature, sender, intid, code)
if (intid == 1) then
creature:MoveWaypoint()
player:GossipComplete()
player:KilledMonsterCredit(NPC_ENTRY1)
local random = math.random(0, 4)
if random == 0 then
creature:SendUnitSay("How could this be happening? We've always been safe here.", 0)
elseif random == 1 then
creature:SendUnitSay("I always knew this day would come. We should have been better prepared.", 0)
elseif random == 2 then
creature:SendUnitSay("What are we going to do? We're not prepared for this kind of violence.", 0)
elseif random == 3 then
creature:SendUnitSay("This can't be real. It must be a terrible dream.", 0)
else
creature:SendUnitSay("I hope the guards can hold them off.", 0)
end
end
end
local function OnSpawn(event, creature)
creature:MoveStop()
creature:MoveIdle()
end
local function OnDeath(event, creature, killer)
creature:RemoveEvents()
creature:MoveStop()
creature:MoveIdle()
end
RegisterCreatureGossipEvent(NPC_ENTRY4, 1, OnGossipHello)
RegisterCreatureGossipEvent(NPC_ENTRY4, 2, OnGossipSelect)
RegisterCreatureEvent(NPC_ENTRY4, 5, OnSpawn)
RegisterCreatureEvent(NPC_ENTRY4, 3, OnDeath)
------------------------------------------------------------------------------------
local NPC_ENTRY5 = 400085
local REQUIRED_QUEST_ID = 30011
local function OnGossipHello(event, player, creature)
local questStatus = player:GetQuestStatus(REQUIRED_QUEST_ID)
if not player:HasQuest(REQUIRED_QUEST_ID) then
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
player:GossipMenuAddItem(0, "The scourge are coming! Please head to the inn!", 0, 1)
player:GossipSendMenu(1, creature)
end
local function OnGossipSelect(event, player, creature, sender, intid, code)
if (intid == 1) then
creature:MoveWaypoint()
player:GossipComplete()
player:KilledMonsterCredit(NPC_ENTRY1)
local random = math.random(0, 4)
if random == 0 then
creature:SendUnitSay("How could this be happening? We've always been safe here.", 0)
elseif random == 1 then
creature:SendUnitSay("Why would they attack us? We've never done anything to them.", 0)
elseif random == 2 then
creature:SendUnitSay("The Scourge are unstoppable. What chance do we have?", 0)
elseif random == 3 then
creature:SendUnitSay("This can't be real. It must be a terrible dream.", 0)
else
creature:SendUnitSay("I'm so scared. I don't know what the future holds for us now.", 0)
end
end
end
local function OnSpawn(event, creature)
creature:MoveStop()
creature:MoveIdle()
end
local function OnDeath(event, creature, killer)
creature:RemoveEvents()
creature:MoveStop()
creature:MoveIdle()
end
RegisterCreatureGossipEvent(NPC_ENTRY5, 1, OnGossipHello)
RegisterCreatureGossipEvent(NPC_ENTRY5, 2, OnGossipSelect)
RegisterCreatureEvent(NPC_ENTRY5, 5, OnSpawn)
RegisterCreatureEvent(NPC_ENTRY5, 3, OnDeath)
------------------------------------------------------------------------------------
local NPC_ENTRY6 = 400086
local REQUIRED_QUEST_ID = 30011
local function OnGossipHello(event, player, creature)
local questStatus = player:GetQuestStatus(REQUIRED_QUEST_ID)
if not player:HasQuest(REQUIRED_QUEST_ID) then
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
player:GossipMenuAddItem(0, "The scourge are coming! Please head to the inn!", 0, 1)
player:GossipSendMenu(1, creature)
end
local function OnGossipSelect(event, player, creature, sender, intid, code)
if (intid == 1) then
creature:MoveWaypoint()
player:GossipComplete()
player:KilledMonsterCredit(NPC_ENTRY1)
local random = math.random(0, 4)
if random == 0 then
creature:SendUnitSay("How could this be happening? We've always been safe here.", 0)
elseif random == 1 then
creature:SendUnitSay("Why us? Why did they have to pick on our town?", 0)
elseif random == 2 then
creature:SendUnitSay("What are we going to do? We're not prepared for this kind of violence.", 0)
elseif random == 3 then
creature:SendUnitSay("This can't be real. It must be a terrible dream.", 0)
else
creature:SendUnitSay("I'm so scared. I don't know what the future holds for us now.", 0)
end
end
end
local function OnSpawn(event, creature)
creature:MoveStop()
creature:MoveIdle()
end
local function OnDeath(event, creature, killer)
creature:RemoveEvents()
creature:MoveStop()
creature:MoveIdle()
end
RegisterCreatureGossipEvent(NPC_ENTRY6, 1, OnGossipHello)
RegisterCreatureGossipEvent(NPC_ENTRY6, 2, OnGossipSelect)
RegisterCreatureEvent(NPC_ENTRY6, 5, OnSpawn)
RegisterCreatureEvent(NPC_ENTRY6, 3, OnDeath)
------------------------------------------------------------------------------------
local NPC_ENTRY7 = 400087
local REQUIRED_QUEST_ID = 30011
local function OnGossipHello(event, player, creature)
local questStatus = player:GetQuestStatus(REQUIRED_QUEST_ID)
if not player:HasQuest(REQUIRED_QUEST_ID) then
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
player:GossipMenuAddItem(0, "The scourge are coming! Please head to the inn!", 0, 1)
player:GossipSendMenu(1, creature)
end
local function OnGossipSelect(event, player, creature, sender, intid, code)
if (intid == 1) then
creature:MoveWaypoint()
player:GossipComplete()
player:KilledMonsterCredit(NPC_ENTRY1)
local random = math.random(0, 4)
if random == 0 then
creature:SendUnitSay("How could this be happening? We've always been safe here.", 0)
elseif random == 1 then
creature:SendUnitSay("I have family here. I won't let anything happen to them.", 0)
elseif random == 2 then
creature:SendUnitSay("What are we going to do? We're not prepared for this kind of violence.", 0)
elseif random == 3 then
creature:SendUnitSay("This can't be real. It must be a terrible dream.", 0)
else
creature:SendUnitSay("I'm so scared. I don't know what the future holds for us now.", 0)
end
end
end
local function OnSpawn(event, creature)
creature:MoveStop()
creature:MoveIdle()
end
local function OnDeath(event, creature, killer)
creature:RemoveEvents()
creature:MoveStop()
creature:MoveIdle()
end
RegisterCreatureGossipEvent(NPC_ENTRY7, 1, OnGossipHello)
RegisterCreatureGossipEvent(NPC_ENTRY7, 2, OnGossipSelect)
RegisterCreatureEvent(NPC_ENTRY7, 5, OnSpawn)
RegisterCreatureEvent(NPC_ENTRY7, 3, OnDeath)
------------------------------------------------------------------------------------
local NPC_ENTRY8 = 400088
local REQUIRED_QUEST_ID = 30011
local function OnGossipHello(event, player, creature)
local questStatus = player:GetQuestStatus(REQUIRED_QUEST_ID)
if not player:HasQuest(REQUIRED_QUEST_ID) then
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
player:GossipMenuAddItem(0, "The scourge are coming! Please head to the inn!", 0, 1)
player:GossipSendMenu(1, creature)
end
local function OnGossipSelect(event, player, creature, sender, intid, code)
if (intid == 1) then
creature:MoveWaypoint()
player:GossipComplete()
player:KilledMonsterCredit(NPC_ENTRY1)
local random = math.random(0, 4)
if random == 0 then
creature:SendUnitSay("How could this be happening? We've always been safe here.", 0)
elseif random == 1 then
creature:SendUnitSay("Why would they attack us? We've never done anything to them.", 0)
elseif random == 2 then
creature:SendUnitSay("What are we going to do? We're not prepared for this kind of violence.", 0)
elseif random == 3 then
creature:SendUnitSay("This can't be real. It must be a terrible dream.", 0)
else
creature:SendUnitSay("I'm so scared. I don't know what the future holds for us now.", 0)
end
end
end
local function OnSpawn(event, creature)
creature:MoveStop()
creature:MoveIdle()
end
local function OnDeath(event, creature, killer)
creature:RemoveEvents()
creature:MoveStop()
creature:MoveIdle()
end
RegisterCreatureGossipEvent(NPC_ENTRY8, 1, OnGossipHello)
RegisterCreatureGossipEvent(NPC_ENTRY8, 2, OnGossipSelect)
RegisterCreatureEvent(NPC_ENTRY8, 5, OnSpawn)
RegisterCreatureEvent(NPC_ENTRY8, 3, OnDeath)
------------------------------------------------------------------------------------
local NPC_ENTRY9 = 400089
local REQUIRED_QUEST_ID = 30011
local function OnGossipHello(event, player, creature)
local questStatus = player:GetQuestStatus(REQUIRED_QUEST_ID)
if not player:HasQuest(REQUIRED_QUEST_ID) then
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
player:GossipMenuAddItem(0, "The scourge are coming! Please head to the inn!", 0, 1)
player:GossipSendMenu(1, creature)
end
local function OnGossipSelect(event, player, creature, sender, intid, code)
if (intid == 1) then
creature:MoveWaypoint()
player:GossipComplete()
player:KilledMonsterCredit(NPC_ENTRY1)
local random = math.random(0, 4)
if random == 0 then
creature:SendUnitSay("How could this be happening? We've always been safe here.", 0)
elseif random == 1 then
creature:SendUnitSay("Why would they attack us? We've never done anything to them.", 0)
elseif random == 2 then
creature:SendUnitSay("What are we going to do? We're not prepared for this kind of violence.", 0)
elseif random == 3 then
creature:SendUnitSay("This can't be real. It must be a terrible dream.", 0)
else
creature:SendUnitSay("I'm so scared. I don't know what the future holds for us now.", 0)
end
end
end
local function OnSpawn(event, creature)
creature:MoveStop()
creature:MoveIdle()
end
local function OnDeath(event, creature, killer)
creature:RemoveEvents()
creature:MoveStop()
creature:MoveIdle()
end
RegisterCreatureGossipEvent(NPC_ENTRY9, 1, OnGossipHello)
RegisterCreatureGossipEvent(NPC_ENTRY9, 2, OnGossipSelect)
RegisterCreatureEvent(NPC_ENTRY9, 5, OnSpawn)
RegisterCreatureEvent(NPC_ENTRY9, 3, OnDeath)
local NPC_ENTRY10 = 849
local REQUIRED_QUEST_ID = 30011
local function OnGossipHello(event, player, creature)
local questStatus = player:GetQuestStatus(REQUIRED_QUEST_ID)
if not player:HasQuest(REQUIRED_QUEST_ID) then
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
player:GossipMenuAddItem(0, "The scourge are coming! Please head to the inn!", 0, 1)
player:GossipSendMenu(1, creature)
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 2 seconds (2000 milliseconds)
end
end
RegisterCreatureGossipEvent(NPC_ENTRY10, 1, OnGossipHello)
RegisterCreatureGossipEvent(NPC_ENTRY10, 2, OnGossipSelect)
local NPC_ENTRY11 = 848
local REQUIRED_QUEST_ID = 30011
local function OnGossipHello(event, player, creature)
local questStatus = player:GetQuestStatus(REQUIRED_QUEST_ID)
if not player:HasQuest(REQUIRED_QUEST_ID) then
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
player:GossipMenuAddItem(0, "The scourge are coming! Please head to the inn!", 0, 1)
player:GossipSendMenu(1, creature)
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 2 seconds (2000 milliseconds)
end
end
RegisterCreatureGossipEvent(NPC_ENTRY11, 1, OnGossipHello)
RegisterCreatureGossipEvent(NPC_ENTRY11, 2, OnGossipSelect)
------------------

View File

@@ -0,0 +1,27 @@
local LakeshireGuard = {};
local function CastCleave(eventId, delay, calls, creature)
creature:CastSpell(creature:GetVictim(), 20605, true)
end
local function OnEnterCombat(event, creature, target)
creature:RegisterEvent(CastCleave, 9000, 0)
end
local function OnLeaveCombat(event, creature)
creature:RemoveEvents()
end
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)

View File

@@ -0,0 +1,34 @@
-- Creature ID for the creature that gives the quests
local CREATURE_ID = 400096
-- Quest and sound IDs for the quests that should trigger the sounds
local QUEST_ACCEPT = {
[30015] = 20439,
[30016] = 20441,
[30017] = 20443,
[30018] = 20449
}
local QUEST_COMPLETE = {
[30014] = 20438,
[30015] = 20440,
[30016] = 20442,
[30017] = 20444,
[30018] = 20450
}
-- Register the event for quest accept
RegisterCreatureEvent(CREATURE_ID, 31, function(event, player, creature, quest)
local soundID = QUEST_ACCEPT[quest:GetId()]
if soundID then
player:PlayDistanceSound(soundID)
end
end)
-- Register the event for quest reward
RegisterCreatureEvent(CREATURE_ID, 34, function(event, player, creature, quest)
local soundID = QUEST_COMPLETE[quest:GetId()]
if soundID then
creature:PlayDistanceSound(soundID)
end
end)

View File

@@ -0,0 +1,74 @@
local GAME_EVENT_ID = 17 -- Set the game event ID
local npcIds = {3085, 841, 348, 8965, 1678, 8962, 8963, 5608, 5607, 847, 791, 381, 3361, 789, 5620, 3089, 9982, 6727, 6166, 379, 346, 1680} -- Add your NPC entries here
local targetLocations = {
{x = -9195.19, y = -2157.19, z = 57.186},
{x = -9201.69, y = -2147.54, z = 71.211},
{x = -9231.74, y = -2148.622, z = 71.211}
} -- Set the target locations
local function IsGameEventActive(eventId)
local activeEvents = GetActiveGameEvents()
for _, event in ipairs(activeEvents) do
if event == eventId then
return true
end
end
return false
end
local function MoveNpcsToLocation(event, gameEventId)
if gameEventId == GAME_EVENT_ID then
local players = GetPlayersInWorld() -- Get all players in the world
for _, player in ipairs(players) do
for _, npcId in ipairs(npcIds) do
local npcs = player:GetCreaturesInRange(1000, npcId) -- Get creatures within a radius of 1000 units from the player
for _, npc in ipairs(npcs) do
local targetLocation = targetLocations[math.random(#targetLocations)] -- Choose a random target location
local randomX = targetLocation.x + math.random(-2, 2)
local randomY = targetLocation.y + math.random(-2, 2)
npc:MoveTo(0, randomX, randomY, targetLocation.z, true)
end
end
end
end
end
local function DespawnNpcs(event, gameEventId)
if gameEventId == GAME_EVENT_ID then
local players = GetPlayersInWorld() -- Get all players in the world
for _, player in ipairs(players) do
for _, npcId in ipairs(npcIds) do
local npcs = player:GetCreaturesInRange(1000, npcId) -- Get creatures within a radius of 1000 units from the player
for _, npc in ipairs(npcs) do
npc:DespawnOrUnsummon()
npc:Respawn()
npc:MoveWaypoint()
end
end
end
end
end
local PLAYER_EVENT_ON_MAP_CHANGE = 27
local function MoveNpcsToLocationForPlayer(player)
for _, npcId in ipairs(npcIds) do
local npcs = player:GetCreaturesInRange(1000, npcId) -- Get creatures within a radius of 1000 units from the player
for _, npc in ipairs(npcs) do
local targetLocation = targetLocations[math.random(#targetLocations)] -- Choose a random target location
local randomX = targetLocation.x + math.random(-2, 2)
local randomY = targetLocation.y + math.random(-2, 2)
npc:MoveTo(0, randomX, randomY, targetLocation.z, true)
end
end
end
local function OnPlayerMapChange(event, player, newMap, newZone)
if IsGameEventActive(GAME_EVENT_ID) then
MoveNpcsToLocationForPlayer(player)
end
end
RegisterPlayerEvent(PLAYER_EVENT_ON_MAP_CHANGE, OnPlayerMapChange)
RegisterServerEvent(34, MoveNpcsToLocation)
RegisterServerEvent(35, DespawnNpcs)

View File

@@ -0,0 +1,14 @@
local RShredder = {};
function RShredder.OnSpawn(event, creature)
creature:CastSpell(creature, 100169, true)
creature:SetReactState(0)
end
function RShredder.OnDied(event, creature)
creature:DespawnOrUnsummon(5000)
creature:RemoveEvents()
end
RegisterCreatureEvent(400044, 4, RShredder.OnDied)
RegisterCreatureEvent(400044, 5, RShredder.OnSpawn)

59
Lakeshire/Riddle.lua Normal file
View File

@@ -0,0 +1,59 @@
local QUEST_ID = 30017
local GOSSIP_ITEM_REQUEST = "Lorekeeper Talandria sent me, she needs the Crusader's Tome to cleanse the skull of an undead warlord."
local GOSSIP_ITEM_RIDDLE = "Alive without breath, as cold as death. Endlessly roaming, the skies I'm combing. What am I?"
local GOSSIP_ITEM_ANSWER1 = "Is it a Death Knight?"
local GOSSIP_ITEM_ANSWER2 = "Is it a Frost Wyrm?"
local GOSSIP_ITEM_ANSWER3 = "Is it a Banshee?"
local NPC_ID = 400098
local ITEM_ID = 65007
local SPELL_ID = 29522
local function OnGossipSelect(event, player, creature, sender, intid, code)
if (intid == 1) then
player:GossipClearMenu()
player:GossipMenuAddItem(0, GOSSIP_ITEM_RIDDLE, 1, 2)
player:GossipSendMenu(1, creature)
creature:SendUnitSay("She did, did she? Very well then. Answer me this riddle correctly and I will give you the tome.", 0)
creature:PlayDistanceSound(20445)
elseif (intid == 2) then
player:GossipClearMenu()
player:GossipMenuAddItem(0, GOSSIP_ITEM_ANSWER1, 1, 3)
player:GossipMenuAddItem(0, GOSSIP_ITEM_ANSWER2, 1, 4)
player:GossipMenuAddItem(0, GOSSIP_ITEM_ANSWER3, 1, 5)
player:GossipSendMenu(1, creature)
elseif (intid == 3) then
creature:SetFaction(85)
creature:CastSpell(player, SPELL_ID, true)
creature:SendUnitYell("Incorrect!", 0)
creature:PlayDistanceSound(20447)
creature:DespawnOrUnsummon(5000)
player:GossipComplete()
elseif (intid == 4) then
player:AddItem(ITEM_ID, 1)
creature:SendUnitSay("You are correct! Here is your tome.", 0)
creature:PlayDistanceSound(20448)
creature:DespawnOrUnsummon(5000)
player:GossipComplete()
elseif (intid == 5) then
creature:SetFaction(85)
creature:CastSpell(player, SPELL_ID, true)
creature:SendUnitYell("Incorrect!", 0)
creature:PlayDistanceSound(20447)
creature:DespawnOrUnsummon(5000)
player:GossipComplete()
end
end
local function OnGossipHello(event, player, creature)
if player:HasQuest(QUEST_ID) then
player:GossipClearMenu()
player:GossipMenuAddItem(0, GOSSIP_ITEM_REQUEST, 1, 1)
player:GossipSendMenu(1, creature)
else
player:SendBroadcastMessage("This man seems to be unresponsive.")
end
end
RegisterCreatureGossipEvent(NPC_ID, 1, OnGossipHello)
RegisterCreatureGossipEvent(NPC_ID, 2, OnGossipSelect)

View File

@@ -0,0 +1,42 @@
local SpiritofThalgorath = {}
function SpiritofThalgorath.OnSpawn(event, creature)
creature:SendUnitYell("You will not defeat me so easily!", 0)
end
function SpiritofThalgorath.OnEnterCombat(event, creature, target)
creature:RegisterEvent(SpiritofThalgorath.Charge, 1000, 1)
creature:RegisterEvent(SpiritofThalgorath.Charge, 8000, 0)
creature:RegisterEvent(SpiritofThalgorath.ShadowBolt, 2000, 1)
creature:RegisterEvent(SpiritofThalgorath.ShadowBolt, 6000, 0)
end
function SpiritofThalgorath.Charge(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, 100, true)
else
creature:CastSpell(creature:GetVictim(), 100, true)
end
end
function SpiritofThalgorath.ShadowBolt(eventId, delay, calls, creature)
creature:CastSpell(creature:GetVictim(), 9613, false)
end
function SpiritofThalgorath.OnLeaveCombat(event, creature)
creature:RemoveEvents()
end
function SpiritofThalgorath.OnDied(event, creature, killer)
creature:RemoveEvents()
end
RegisterCreatureEvent(400103, 5, SpiritofThalgorath.OnSpawn)
RegisterCreatureEvent(400103, 1, SpiritofThalgorath.OnEnterCombat)
RegisterCreatureEvent(400103, 2, SpiritofThalgorath.OnLeaveCombat)
RegisterCreatureEvent(400103, 4, SpiritofThalgorath.OnDied)

View File

@@ -0,0 +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 = 400103
local SPAWN_TYPE = 3
local DESPAWN_TIMER = 200000 -- 3 minutes and 20 seconds in milliseconds
local CAST_SPELL_ID = 67040
local CAST_SPELL_ID2 = 32826
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: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(-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(-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(CREATURE_SPAWNER, 100)
if spawner then
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, CREATURE_EVENT_ON_DIE, OnCreatureDeath)
RegisterCreatureEvent(CREATURE_SPAWNER, CREATURE_EVENT_ON_DIE, OnSpawnerDeath)

View File

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

View File

@@ -0,0 +1,15 @@
local UNDEAD_BUNNY_ENTRY = 400100
local SPELL_TO_CAST = 364736
local CAST_DELAY = 120000
local UndeadBunny = {}
function UndeadBunny.OnSpawn(event, creature)
creature:RegisterEvent(UndeadBunny.CastSpellAfterDelay, CAST_DELAY, 1)
end
function UndeadBunny.CastSpellAfterDelay(event, delay, calls, creature)
creature:CastSpell(creature, SPELL_TO_CAST, true)
end
RegisterCreatureEvent(UNDEAD_BUNNY_ENTRY, 5, UndeadBunny.OnSpawn) -- 5 is the event for creature spawn