diff --git a/AUndeadWarlord.lua b/AUndeadWarlord.lua index 2aca7be..668db3f 100644 --- a/AUndeadWarlord.lua +++ b/AUndeadWarlord.lua @@ -67,12 +67,19 @@ function UndeadWarlord.OnDied(event, creature, killer) 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 () creature:CastSpell(creature, 59711, true) end, 5000, 0) +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) diff --git a/Barrier.lua b/Barrier.lua new file mode 100644 index 0000000..2818b91 --- /dev/null +++ b/Barrier.lua @@ -0,0 +1,22 @@ +local npcId = 400092 +local spellId = 100199 +local range = 8 +local killCreditNpcId = 400095 + +function OnSpellCast(event, player, spell) +if spell:GetEntry() == spellId 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 placed the barrier and received kill credit for NPC " .. killCreditNpcId .. ".") +end +end +end + +RegisterPlayerEvent(5, OnSpellCast) + + + diff --git a/BlightedZombie2.lua b/BlightedZombie2.lua index 6454bbc..b0ab9b4 100644 --- a/BlightedZombie2.lua +++ b/BlightedZombie2.lua @@ -24,6 +24,3 @@ end RegisterCreatureEvent(4475, 1, BlightedZombie.OnCombat) RegisterCreatureEvent(4475, 2, BlightedZombie.OnLeaveCombat) RegisterCreatureEvent(4475, 4, BlightedZombie.OnDeath) - - - diff --git a/BlisteringZombie2.lua b/BlisteringZombie2.lua new file mode 100644 index 0000000..917b472 --- /dev/null +++ b/BlisteringZombie2.lua @@ -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(5000) + creature:RemoveEvents() +end + +RegisterCreatureEvent(400077, 1, BlisteringZombie.OnCombat) +RegisterCreatureEvent(400077, 2, BlisteringZombie.OnLeaveCombat) +RegisterCreatureEvent(400077, 4, BlisteringZombie.OnDeath) +RegisterCreatureEvent(400077, 5, BlisteringZombie.OnSpawn) \ No newline at end of file diff --git a/LAkeshireVillagers2.lua b/LAkeshireVillagers2.lua new file mode 100644 index 0000000..e69de29 diff --git a/LakeshireCitizenScript.lua b/LakeshireCitizenScript.lua new file mode 100644 index 0000000..741be40 --- /dev/null +++ b/LakeshireCitizenScript.lua @@ -0,0 +1,440 @@ +local NPC_ENTRY1 = 400080 +local REQUIRED_QUEST_ID = 30011 + +local function OnGossipHello(event, player, creature) +if not player:HasQuest(REQUIRED_QUEST_ID) then +player:SendBroadcastMessage("You must be on a certain quest to interact with this person.") +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 function OnGossipHello(event, player, creature) +if not player:HasQuest(REQUIRED_QUEST_ID) then +player:SendBroadcastMessage("You must be on a certain quest to interact with this person.") +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 function OnGossipHello(event, player, creature) +if not player:HasQuest(REQUIRED_QUEST_ID) then +player:SendBroadcastMessage("You must be on a certain quest to interact with this person.") +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 function OnGossipHello(event, player, creature) +if not player:HasQuest(REQUIRED_QUEST_ID) then +player:SendBroadcastMessage("You must be on a certain quest to interact with this person.") +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 function OnGossipHello(event, player, creature) +if not player:HasQuest(REQUIRED_QUEST_ID) then +player:SendBroadcastMessage("You must be on a certain quest to interact with this person.") +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 function OnGossipHello(event, player, creature) +if not player:HasQuest(REQUIRED_QUEST_ID) then +player:SendBroadcastMessage("You must be on a certain quest to interact with this person.") +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 function OnGossipHello(event, player, creature) +if not player:HasQuest(REQUIRED_QUEST_ID) then +player:SendBroadcastMessage("You must be on a certain quest to interact with this person.") +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 function OnGossipHello(event, player, creature) +if not player:HasQuest(REQUIRED_QUEST_ID) then +player:SendBroadcastMessage("You must be on a certain quest to interact with this person.") +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 function OnGossipHello(event, player, creature) +if not player:HasQuest(REQUIRED_QUEST_ID) then +player:SendBroadcastMessage("You must be on a certain quest to interact with this person.") +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) \ No newline at end of file diff --git a/LakeshireGuard.lua b/LakeshireGuard.lua new file mode 100644 index 0000000..25c1ba5 --- /dev/null +++ b/LakeshireGuard.lua @@ -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) + diff --git a/OrgGuardKillCred.lua b/OrgGuardKillCred.lua index 640a22d..4ba796b 100644 --- a/OrgGuardKillCred.lua +++ b/OrgGuardKillCred.lua @@ -24,10 +24,10 @@ function OnSpellCast(event, caster, spell) end end - -- If the target is not a valid NPC - if not isValidTarget then + -- If the target is not a valid NPC or if the target's health is greater than 90% + if not isValidTarget or target:GetHealthPct() > 90 then -- Send a broadcast message to the player - caster:SendBroadcastMessage("Invalid target.") + caster:SendBroadcastMessage("That defender is doing fine. Find one that needs more help!") -- Cancel the spell spell:Cancel() else diff --git a/Scorn.lua b/Scorn.lua new file mode 100644 index 0000000..9bc9d85 --- /dev/null +++ b/Scorn.lua @@ -0,0 +1,76 @@ +local Scorn = {}; + +local function LichSlap(eventId, delay, calls, creature) +if not creature:IsCasting() then +creature:CastSpell(creature:GetVictim(), 28873, true) +end +end + +local function Enrage(eventId, delay, calls, creature) +if not creature:IsCasting() then +creature:CastSpell(creature, 15716, true) +end +end + +local function FrostboltVolley(eventId, delay, calls, creature) +if not creature:IsCasting() then +creature:CastSpell(creature, 22643, true) +end +end + +local function FrostNova(eventId, delay, calls, creature) +if not creature:IsCasting() then +creature:CastSpell(creature, 15531, true) +end +end + +function MindFlay(eventId, delay, calls, creature) +if not creature:IsCasting() then +local targets = creature:GetAITargets(5) +if #targets == 0 then +return +end +local target = targets[math.random(#targets)] +creature:CastSpell(target, 17318, true) +end +end + +function ManaBurn(eventId, delay, calls, creature) +if not creature:IsCasting() then +local targets = creature:GetAITargets(5) +if #targets == 0 then +return +end +local target = targets[math.random(#targets)] +creature:CastSpell(target, 8129, true) +end +end + +local function OnEnterCombat(event, creature, target) +creature:RegisterEvent(LichSlap, math.random(8000,12000), 0) +creature:RegisterEvent(MindFlay, math.random(14000,18000), 0) +creature:RegisterEvent(FrostboltVolley, math.random(7000,11000), 0) +creature:RegisterEvent(FrostNova, 1000, 1) +creature:RegisterEvent(FrostNova, math.random(6000,9000), 0) +creature:RegisterEvent(ManaBurn, math.random(17000,24000), 0) +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(400075, 1, OnEnterCombat) +RegisterCreatureEvent(400075, 9, OnHealthUpdate) +RegisterCreatureEvent(400075, 2, OnLeaveCombat) +RegisterCreatureEvent(400075, 4, OnDied) \ No newline at end of file diff --git a/SkeletalWarrior.lua b/SkeletalWarrior.lua new file mode 100644 index 0000000..7d72b3a --- /dev/null +++ b/SkeletalWarrior.lua @@ -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(5000) + creature:RemoveEvents() +end + +RegisterCreatureEvent(400016, 1, SkeletalWarrior.OnCombat) +RegisterCreatureEvent(400016, 2, SkeletalWarrior.OnLeaveCombat) +RegisterCreatureEvent(400016, 4, SkeletalWarrior.OnDeath) +RegisterCreatureEvent(400016, 5, SkeletalWarrior.OnSpawn) diff --git a/TreeChopping.lua b/TreeChopping.lua new file mode 100644 index 0000000..2c97bd9 --- /dev/null +++ b/TreeChopping.lua @@ -0,0 +1,54 @@ +local GOSSIP_OPTION_CUT_TREE = 1 +local LOG_ITEM_ID = 60116 +local BARRIERS_BUILT_QUEST_ID = 30012 + +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) then + player:SendBroadcastMessage("You must have the 'Barriers Built' quest before you can chop down this tree.") + 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)