Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ------------------------------------------------------------------------------------------------------------------------------------------------
- --[[
- Main Event Handler
- By Stoneharry
- ]]
- -------------------------------------------------------------------------------------------------------
- -- Variable Decleration ------------------------------------------------------------------------------
- -------------------------------------------------------------------------------------------------------
- local Selection = nil -- Our control unit
- local DoorA = nil -- Main gate
- local DoorB = nil -- Second gate
- local Guard = nil -- Guard that comes
- local Amount = 0 -- The amount of prisoners rescued, starts at 0 and automatically counts up
- local Ready = false -- When ready this will automatically go to true (when all requirements to move on is met)
- local door_a = nil -- Doors of the main cooridor
- local door_b = nil -- Doors of the main cooridor
- local door_c = nil -- Doors of the main cooridor
- local door_d = nil -- Doors of the main cooridor
- local door_e = nil -- Doors of the main cooridor
- local npc_a = nil -- Prisoner to release
- local npc_b = nil -- Prisoner to release
- local npc_c = nil -- Prisoner to release
- local Grim = nil -- Grim Ironbeard, the guy who kills the prisoner
- local COUNT_DOWN = 0 -- Time till bomb explodes, used for counting message to display
- local DISTANCE_HANDLER = nil -- The npc to handle the bomb explosion
- --[[
- Map:
- gates a-e are triggered by levers
- a-c = npc's in them
- d = has pile of rocks which need to be blown up by bombs from warden
- _________
- ¦ start ¦
- ¦__ __¦
- To Stormwind _¦ ¦_
- ^ b¦_ _¦a
- ______¦ ¦____¦ ¦_
- ¦_____ __d¦_ _¦c ___________
- ¦__¦ ¦_¦ __ ¦ ¦
- ___ e ___ ¦ ¦ ¦ ¦
- ¦ ¦___¦ ¦___¦ ¦
- ¦___________ ___ warden ¦
- ¦ ¦ ¦ ¦
- ¦__¦ ¦ ¦
- ¦___________¦
- ]]
- ------------------------------------------------------------------------------------------------------------------------------------------------
- -- Part A: Following the lead of the prisoner you were stuck with ------------------------------------------------------------------------------
- ------------------------------------------------------------------------------------------------------------------------------------------------
- -------------------------------------------------------------------------------------------------------
- -- The Prisoner ---------------------------------------------------------------------------------------
- -------------------------------------------------------------------------------------------------------
- function Bodyguard_Onspawn(pUnit, Event)
- pUnit:RegisterEvent("wait_a_sec_body", 1000, 0)
- end
- function wait_a_sec_body(pUnit)
- local plr = pUnit:GetClosestPlayer()
- if plr ~= nil then
- if plr:GetSelection() ~= nil then
- if plr:GetSelection():GetEntry() == 170611 then
- pUnit:RemoveEvents()
- Selection = pUnit
- Selection:SetFaction(35)
- Selection:SendChatMessage(12,0,"Ah, so you're awake "..plr:GetName()..", it's about time. The warden will be here soon, don't give him any reason to make your life difficult.")
- Selection:SpawnCreature(46921, -12.8, 102.3, -39.134, 4.75, 15, 0)
- end
- end
- end
- end
- RegisterUnitEvent(170611, 18, "Bodyguard_Onspawn")
- -- Warden
- function Warden_OnSpawn(pUnit, Event)
- pUnit:RegisterEvent("HangONAMo", 1000, 1)
- end
- function HangONAMo(pUnit)
- pUnit:MoveTo(-12.7, 79.5, -39.134, 0)
- pUnit:EquipWeapons(1975, 0, 0)
- pUnit:RegisterEvent("zzHangONAMo", 9000, 1)
- end
- function zzHangONAMo(pUnit)
- DoorA:SetByte(0x0006+0x000B,0,0) -- Open
- pUnit:RegisterEvent("zzzHangONAMo", 2000, 1)
- end
- function zzzHangONAMo(pUnit)
- pUnit:MoveTo(-12.6, 72.3, -39.134, 0)
- pUnit:RegisterEvent("zzzzHangONAMo", 2500, 1)
- end
- function zzzzHangONAMo(pUnit)
- pUnit:SendChatMessage(12,0,"So you worthless scum, how much longer do you think you will survive in here? There is no way to escape, nobody has ever escaped from here.")
- pUnit:Emote(1,3000)
- pUnit:RegisterEvent("zzzzHangONAMoemote", 3001, 1)
- pUnit:RegisterEvent("zzzzHangONAMoemotetw", 6000, 1)
- pUnit:RegisterEvent("zzzzHangONAMoemotetwzzz", 9100, 1)
- pUnit:RegisterEvent("zzzzHangONAMoemotzzetwzzz", 14100, 1)
- end
- function zzzzHangONAMoemote(pUnit)
- pUnit:Emote(5, 2000)
- end
- function zzzzHangONAMoemotetw(pUnit)
- pUnit:Emote(11, 3000)
- end
- function zzzzHangONAMoemotetwzzz(pUnit)
- pUnit:ReturnToSpawnPoint()
- end
- function zzzzHangONAMoemotzzetwzzz(pUnit, Event)
- DoorA:SetByte(0x0006+0x000B,0,1) -- Close
- Selection:RegisterEvent("X_EAJOEAT", 7001, 1)
- pUnit:Despawn(5000, 0)
- end
- -- Prisoner
- function X_EAJOEAT(pUnit)
- Selection:Emote(23, 2500)
- Selection:SendChatMessage(12,0,"He didn't notice that the key was missing!")
- Selection:RegisterEvent("aeogueajgoea", 4000, 1)
- end
- function aeogueajgoea(pUnit)
- Selection:MoveTo(-10.8, 67.4, -39.134, 0)
- Selection:RegisterEvent("aeogueajzzgoea", 1500, 1)
- end
- function aeogueajzzgoea(pUnit)
- Selection:Emote(69, 5000)
- Selection:RegisterEvent("aeogueazzjzzgoea", 5000, 1)
- Selection:RegisterEvent("aeogueazzjzzgosssea", 7400, 1)
- end
- function aeogueazzjzzgoea(pUnit)
- DoorB:SetByte(0x0006+0x000B,0,0) -- Open
- end
- function aeogueazzjzzgosssea(pUnit)
- Selection:Emote(4, 2500)
- Selection:SendChatMessage(12,0,"I'm good!")
- Selection:SetMovementFlags(1)
- Selection:RegisterEvent("testjeszzztS", 4200, 1)
- Selection:RegisterEvent("testjeszzzzztS", 6000, 1)
- Selection:RegisterEvent("testjeszzzzztSzz", 10000, 1)
- end
- function testjeszzztS(pUnit)
- Selection:SendChatMessage(12,0,"I'll distract the guard and you hit him from behind!")
- Selection:MoveTo(-12.62, 70.4, -39.134, 1.4)
- end
- function testjeszzzzztS(pUnit)
- Selection:MoveTo(-12.6, 73.6, -39.2, 1.5)
- end
- function testjeszzzzztSzz(pUnit)
- Selection:SendChatMessage(14,0,"Oi! Check out some of this!")
- Selection:Emote(5, 2000)
- Selection:RegisterEvent("testjeszzzzztzzzSzz", 3001, 1)
- end
- function testjeszzzzztzzzSzz(pUnit)
- Selection:Emote(10, 30000)
- Selection:SpawnCreature(325811, -12.31, 99.48, -39.134, 4.68556, 15, 0)
- end
- -- Warden
- RegisterUnitEvent(46921, 18, "Warden_OnSpawn")
- function Warden_Oncombat(pUnit, Event)
- pUnit:RemoveEvents()
- pUnit:SendChatMessage(12,0,"You dare attack me?!")
- DoorA:SetByte(0x0006+0x000B,0,1) -- Close
- Selection:RegisterEvent("Bodyguard_Onspawn", 10000, 1)
- pUnit:Despawn(10000, 0)
- end
- RegisterUnitEvent(46921, 1, "Warden_Oncombat")
- -- Guard that comes running
- function Guard_On_Spawn_Prison_Watch(pUnit, Event)
- pUnit:RegisterEvent("Hangonasecond_eaojte_prisonguard",1000,1)
- end
- function Hangonasecond_eaojte_prisonguard(pUnit)
- pUnit:EquipWeapons(1817,1200,0)
- pUnit:SendChatMessage(14,0,"What are you doing out of your cell! Get back in there!")
- Selection:SendChatMessage(15,0,"He's coming, hit him from behind when he comes in!")
- pUnit:SetMovementFlags(1)
- pUnit:MoveTo(-12.4, 82.14, -39.134, 0)
- pUnit:RegisterEvent("DOOR_SPAM_TEHE", 4000, 1)
- pUnit:RegisterEvent("DOOR_SPAM_TzzEHE", 6000, 1)
- pUnit:RegisterEvent("eaghipheaaaengzz_testjs_zgjo", 9000, 1)
- end
- function DOOR_SPAM_TEHE(pUnit)
- DoorA:SetByte(0x0006+0x000B,0,0) -- Open
- end
- function DOOR_SPAM_TzzEHE(pUnit)
- pUnit:AttackReaction(Selection, 1, 0)
- end
- function eaghipheaaaengzz_testjs_zgjo(pUnit)
- Selection:CastSpellOnTarget(5165, pUnit)
- Selection:SendChatMessage(12,0,"Finish him!")
- Guard = pUnit
- Selection:RegisterEvent("Check_For_Death_Tehe_Tehe_tehe", 2500, 0)
- end
- function Check_For_Death_Tehe_Tehe_tehe(pUnit)
- if Guard:IsAlive() == false then
- Selection:RemoveEvents()
- Selection:Emote(16, 3000)
- Selection:RegisterEvent("etsutiea_eahitea_equip_weapons", 1500, 1)
- Selection:RegisterEvent("etsutiea_eahitea_equip_weapozzns", 4000, 1)
- end
- end
- -- Prisoner
- function etsutiea_eahitea_equip_weapons(pUnit)
- Selection:EquipWeapons(1817,1200,0)
- Guard:EquipWeapons(0,0,0)
- end
- function etsutiea_eahitea_equip_weapozzns(pUnit)
- Guard = nil
- Selection:SendChatMessage(12, 0, "Free the rest of the prisoners and get yourself a weapon; once you have done that come get me so we can get out of here.")
- Selection:SetMovementFlags(0)
- Selection:MoveTo(-12.6, 80.35, -39.134, 0)
- Selection:SetNPCFlags(1) -- talkable
- Selection:RegisterEvent("Check_For_Whether_We_Can_Move_On_SELEC", 4000, 0)
- end
- RegisterUnitEvent(325811, 18, "Guard_On_Spawn_Prison_Watch")
- -------------------------------------------------------------------------------------------------------
- -- Prisoner's Gossip ----------------------------------------------------------------------------------
- -------------------------------------------------------------------------------------------------------
- function zzzWolly_On_Gossip(pUnit, event, player)
- pUnit:GossipCreateMenu(738, player, 0)
- if Amount == 3 and player:HasItem(25228) then
- pUnit:GossipMenuAddItem(0, "I have rescued all the prisoners and got a weapon.", 246, 0)
- end
- pUnit:GossipMenuAddItem(0, "Were not ready yet.", 250, 0)
- pUnit:GossipSendMenu(player)
- end
- function zzzWolly_Gossip_Submenus(pUnit, event, player, id, intid, code)
- if(intid == 246) then
- Amount = 0
- Selection:SetNPCFlags(2) -- 0 is bugged so quest flags (untalkable)
- Ready = true
- player:GossipComplete()
- end
- if(intid == 250) then
- player:GossipComplete()
- end
- end
- RegisterUnitGossipEvent(170611, 1, "zzzWolly_On_Gossip")
- RegisterUnitGossipEvent(170611, 2, "zzzWolly_Gossip_Submenus")
- -------------------------------------------------------------------------------------------------------
- -- Prisoner Jailbreak ---------------------------------------------------------------------------------
- -------------------------------------------------------------------------------------------------------
- function Check_For_Whether_We_Can_Move_On_SELEC(pUnit)
- if Ready == true then
- Ready = false
- Selection:RemoveEvents()
- Selection:SendChatMessage(12,0,"Right, let's do this.")
- Selection:Emote(5, 2000)
- Selection:RegisterEvent("move_on_to_next_part_Opening_last_Gate", 3000, 1)
- end
- end
- function move_on_to_next_part_Opening_last_Gate(pUnit)
- Selection:SetMovementFlags(1)
- Selection:MoveTo(-12.5, 128.3, -39.134, 0)
- Selection:RegisterEvent("emote_open_Gate_ten_seconds", 10000, 1)
- end
- function emote_open_Gate_ten_seconds(pUnit)
- Selection:Emote(25, 2000)
- Selection:RegisterEvent("esojtosetes_Esijgosi_zeigjz_zojte", 3000, 1)
- end
- function esojtosetes_Esijgosi_zeigjz_zojte(pUnit)
- Selection:SendChatMessage(12,0,"We need to get some dynamite so we can blow our way out of here. I believe there was some stored further in, once we have it we will need to return back here and blow open the spare cell.")
- Selection:Emote(1,7000)
- Selection:RegisterEvent("delay_a_sec_sec_Sec_te_hge_esi", 10000, 1)
- end
- function delay_a_sec_sec_Sec_te_hge_esi(pUnit)
- Selection:SendChatMessage(14,0,"Attack!")
- Selection:Emote(15,3000)
- door_e:SetByte(0x0006+0x000B,0,0) -- Open
- Selection:RegisterEvent("eojsog_zeojt_prison_attack_warden_boo_Hoo", 3500, 1)
- --Selection:RegisterEvent("ezojsog_zeojt_prison_attack_warden_boo_Hooz", 5000, 1)
- end
- function eojsog_zeojt_prison_attack_warden_boo_Hoo(pUnit)
- Selection:MoveTo(-12.8, 146.8, -40.384, 0)
- Selection:SetFaction(1857)
- --Grim:FullCastSpellOnTarget(11, Selection)
- Grim:SendChatMessage(12,0,"Bring it, ye' wee' ninny's.")
- Grim:AttackReaction(Selection, 100, 0)
- npc_a:AttackReaction(Grim, 100, 0)
- npc_b:AttackReaction(Grim, 100, 0)
- npc_c:AttackReaction(Grim, 100, 0)
- Selection:SetHealth(10)
- end
- --[[function ezojsog_zeojt_prison_attack_warden_boo_Hooz(pUnit)
- if Selection:IsAlive() then
- Guard:FullCastSpellOnTarget(11, Selection)
- end
- end]]
- -- Grim Ironbeard
- function Define_On_SPawn_Grim_Ironbeard(pUnit, Event)
- Grim = pUnit
- end
- function Define_On_DEAD_Grim_Ironbeard(pUnit)
- if npc_a:IsAlive() then
- npc_a:CastSpell(11)
- end
- if npc_b:IsAlive() then
- npc_b:CastSpell(11)
- end
- if npc_c:IsAlive() then
- npc_c:CastSpell(11)
- end
- if Selection:IsAlive() then
- Selection:CastSpell(11)
- end
- end
- RegisterUnitEvent(157211, 18, "Define_On_SPawn_Grim_Ironbeard")
- RegisterUnitEvent(157211, 4, "Define_On_DEAD_Grim_Ironbeard")
- -------------------------------------------------------------------------------------------------------
- -- First Two Gates ------------------------------------------------------------------------------------
- -------------------------------------------------------------------------------------------------------
- function zzzCPEACAE_Cage_asdasd_OnUseZXC(pMisc, event)
- -- Unclickable
- pMisc:SetUInt32Value(0x0006+0x0003,0x1)
- DoorB = pMisc
- end
- RegisterGameObjectEvent(184393, 2, "zzzCPEACAE_Cage_asdasd_OnUseZXC")
- function gzzzCPEACAE_Cage_asdasd_OnUseZXC(pMisc, event)
- pMisc:SetUInt32Value(0x0006+0x0003,0x1)
- DoorA = pMisc
- end
- RegisterGameObjectEvent(18936, 2, "gzzzCPEACAE_Cage_asdasd_OnUseZXC")
- -------------------------------------------------------------------------------------------------------
- -- Gates in first coordior and levers -----------------------------------------------------------------
- -------------------------------------------------------------------------------------------------------
- --[[
- Map:
- gates a-e are triggered by levers
- a-c = npc's in them
- _________
- ¦ start ¦
- ¦__ __¦
- _¦ ¦_
- b¦_ _¦a
- _¦ ¦_
- d¦_ _¦c
- ¦_¦
- e
- ]]
- -- Doors
- function door_goes_untargetablesojgs_a(pMisc, event)
- door_a = pMisc
- pMisc:SetUInt32Value(0x0006+0x0003,0x1) -- Unclickable
- end
- function door_goes_untargetablesojgs_b(pMisc, event)
- door_b = pMisc
- pMisc:SetUInt32Value(0x0006+0x0003,0x1) -- Unclickable
- end
- function door_goes_untargetablesojgs_c(pMisc, event)
- door_c = pMisc
- pMisc:SetUInt32Value(0x0006+0x0003,0x1) -- Unclickable
- end
- function door_goes_untargetablesojgs_d(pMisc, event)
- door_d = pMisc
- pMisc:SetUInt32Value(0x0006+0x0003,0x1) -- Unclickable
- end
- function door_goes_untargetablesojgs_e(pMisc, event)
- door_e = pMisc
- pMisc:SetUInt32Value(0x0006+0x0003,0x1) -- Unclickable
- end
- RegisterGameObjectEvent(189361, 2, "door_goes_untargetablesojgs_a") -- a
- RegisterGameObjectEvent(189362, 2, "door_goes_untargetablesojgs_b") -- b
- RegisterGameObjectEvent(189363, 2, "door_goes_untargetablesojgs_c") -- c
- RegisterGameObjectEvent(189364, 2, "door_goes_untargetablesojgs_d") -- d
- RegisterGameObjectEvent(189365, 2, "door_goes_untargetablesojgs_e") -- e
- function gameobject_door_stuck_open(pMisc, event)
- pMisc:SetUInt32Value(0x0006+0x0003,0x1) -- Unclickable
- pMisc:SetByte(0x0006+0x000B,0,0) -- Open
- end
- RegisterGameObjectEvent(189366, 2, "gameobject_door_stuck_open")
- function ffgameobject_door_stuck_open(pMisc, event)
- pMisc:SetUInt32Value(0x0006+0x0003,0x1) -- Unclickable
- end
- RegisterGameObjectEvent(189367, 2, "ffgameobject_door_stuck_open")
- -- Levers
- function lever_goes_untargetablesojgs_a(pMisc, Event)
- door_a:SetByte(0x0006+0x000B,0,0) -- Open
- npc_a:SendChatMessage(12,0,"I am in your debt.")
- npc_a:SetUnitToFollow(npc_a:GetClosestPlayer(), 5, 1)
- Amount = Amount + 1
- RegisterTimedEvent("Reset_Door_A_Tehe_Test_A", 20000, 1)
- end
- function Reset_Door_A_Tehe_Test_A(pMisc)
- door_a:SetByte(0x0006+0x000B,0,1) -- Close
- end
- RegisterGameObjectEvent(905671, 4, "lever_goes_untargetablesojgs_a") -- a
- function lever_goes_untargetablesojgs_b(pMisc, Event)
- door_b:SetByte(0x0006+0x000B,0,0) -- Open
- npc_b:SendChatMessage(12,0,"I'll help!")
- npc_b:SetUnitToFollow(npc_b:GetClosestPlayer(), 1.5, 1)
- Amount = Amount + 1
- RegisterTimedEvent("Reset_Door_A_Tehe_Test_b", 20000, 1)
- end
- function Reset_Door_A_Tehe_Test_b(pMisc)
- door_b:SetByte(0x0006+0x000B,0,1) -- Close
- end
- RegisterGameObjectEvent(905672, 4, "lever_goes_untargetablesojgs_b") -- b
- function lever_goes_untargetablesojgs_c(pMisc, Event)
- door_c:SetByte(0x0006+0x000B,0,0) -- Open
- npc_c:SendChatMessage(12,0,"Finally!")
- npc_c:SetUnitToFollow(npc_c:GetClosestPlayer(), 3, 1)
- Amount = Amount + 1
- RegisterTimedEvent("Reset_Door_A_Tehe_Test_c", 20000, 1)
- end
- function Reset_Door_A_Tehe_Test_c(pMisc)
- door_c:SetByte(0x0006+0x000B,0,1) -- Close
- end
- RegisterGameObjectEvent(905673, 4, "lever_goes_untargetablesojgs_c") -- c
- function lever_goes_untargetablesojgs_d(pMisc, Event)
- door_d:SetByte(0x0006+0x000B,0,0) -- Open
- RegisterTimedEvent("Reset_Door_A_Tehe_Test_d", 20000, 1)
- end
- function Reset_Door_A_Tehe_Test_d(pMisc)
- door_d:SetByte(0x0006+0x000B,0,1) -- Close
- end
- RegisterGameObjectEvent(905674, 4, "lever_goes_untargetablesojgs_d") -- d
- --[[function lever_goes_untargetablesojgs_e(pMisc, Event)
- door_e:SetByte(0x0006+0x000B,0,0) -- Open
- RegisterLuaEvent("Reset_Door_A_Tehe_Test_e", 20000, 1)
- end
- function Reset_Door_A_Tehe_Test_e(pMisc)
- door_e:SetByte(0x0006+0x000B,0,1) -- Close
- end
- RegisterGameObjectEvent(905675, 4, "lever_goes_untargetablesojgs_e") -- e]]
- -- Creatures
- function onspawndefine_npca(pUnit, Event)
- npc_a = pUnit
- end
- function onspawndefine_npcb(pUnit, Event)
- npc_b = pUnit
- end
- function onspawndefine_npcc(pUnit, Event)
- npc_c = pUnit
- end
- RegisterUnitEvent(40000,18,"onspawndefine_npca")
- RegisterUnitEvent(40002,18,"onspawndefine_npcb")
- RegisterUnitEvent(40003,18,"onspawndefine_npcc")
- ------------------------------------------------------------------------------------------------------------------------------------------------
- -- Part B: Killing the Warden and escaping -----------------------------------------------------------------------------------------------------
- ------------------------------------------------------------------------------------------------------------------------------------------------
- -------------------------------------------------------------------------------------------------------
- -- Warden Fight ---------------------------------------------------------------------------------------
- -------------------------------------------------------------------------------------------------------
- function Warden_For_Real_Fight_On_Spawn(pUnit, Event)
- pUnit:RegisterEvent("Delay_a_sec_while_we_set_to_unattackable", 1000, 1)
- end
- function Delay_a_sec_while_we_set_to_unattackable(pUnit)
- pUnit:SetFaction(35)
- pUnit:RegisterEvent("Check_For_Players_And_So_On", 1000, 0)
- end
- function Check_For_Players_And_So_On(pUnit)
- local plr = pUnit:GetClosestPlayer()
- if plr ~= nil then
- if pUnit:GetDistance(plr) < 11 then
- pUnit:SendChatMessage(12,0,"Looks like I'm going to have to deal with you personally.")
- pUnit:RemoveEvents()
- pUnit:RegisterEvent("Delay_A_Sec_Tzkkzoed", 5000, 1)
- end
- end
- end
- function Delay_A_Sec_Tzkkzoed(pUnit)
- pUnit:SendChatMessage(12,0,"See, while I've been watching over this prison, I've picked up a few tricks of my own!")
- pUnit:RegisterEvent("Delay_A_bit_more_sigh_sigH_eeit", 6000, 1)
- pUnit:RegisterEvent("Delay_A_bit_more_sigh_sigH_eeitzzg", 6500, 1)
- pUnit:RegisterEvent("Delay_A_bit_more_sigh_sigH_eeitzzgggd", 7500, 1)
- end
- function Delay_A_bit_more_sigh_sigH_eeit(pUnit)
- pUnit:CastSpellOnTarget(34806, pUnit:GetClosestPlayer())
- end
- function Delay_A_bit_more_sigh_sigH_eeitzzg(pUnit)
- pUnit:CastSpell(33916)
- end
- function Delay_A_bit_more_sigh_sigH_eeitzzgggd(pUnit)
- pUnit:RemoveAura(33915)
- pUnit:RemoveAura(33916)
- pUnit:SetFaction(21)
- end
- RegisterUnitEvent(46922, 18, "Warden_For_Real_Fight_On_Spawn")
- -------------------------------------------------------------------------------------------------------
- -- Rock rubble that gets blown up using dynamite ------------------------------------------------------
- -------------------------------------------------------------------------------------------------------
- function ffdzzzCPEACAE_Cage_asdasd_OnUseZXC(pMisc, event, player)
- if player:HasItem(18588) then
- player:CastSpell(74648) --boom
- player:RemoveItem(18588, 1)
- pMisc:SetByte(LCF.GAMEOBJECT_BYTES_1,0,1) -- Close
- else
- pMisc:SetByte(LCF.GAMEOBJECT_BYTES_1,0,0) -- Open
- player:SendAreaTriggerMessage("|CFFff0000You do not have any Dynamite!|R")
- end
- end
- RegisterGameObjectEvent(146085, 4, "ffdzzzCPEACAE_Cage_asdasd_OnUseZXC")
- -------------------------------------------------------------------------------------------------------
- -- Stormwind Mage ------------------------------------------------------
- -------------------------------------------------------------------------------------------------------
- function tyzzzWolly_On_Gossip(pUnit, event, player)
- pUnit:GossipCreateMenu(758, player, 0)
- pUnit:GossipMenuAddItem(0, "Get me out of here!", 24, 0)
- pUnit:GossipMenuAddItem(0, "I still have things to do.", 25, 0)
- pUnit:GossipSendMenu(player)
- end
- function tyzzzWolly_Gossip_Submenus(pUnit, event, player, id, intid, code)
- if(intid == 24) then
- player:GossipComplete()
- player:Teleport(0, -8322, 532, 122.3)
- player:CastSpell(64446)
- end
- if(intid == 25) then
- player:GossipComplete()
- end
- end
- RegisterUnitGossipEvent(184531, 1, "tyzzzWolly_On_Gossip")
- RegisterUnitGossipEvent(184531, 2, "tyzzzWolly_Gossip_Submenus")
- -------------------------------------------------------------------------------------------------------
- -- Equipment Manager ----------------------------------------------------------------------------------
- -------------------------------------------------------------------------------------------------------
- -- Credits to Neglected for pointing out GetEquippedItemBySlot returns the item object and not the entry
- function Every_so_Often_Check_what_items_player_Has_and_if_he_matches_all_then_continue(...)
- for a, plrs in pairs(GetPlayersInMap(35)) do
- if plrs ~= nil then
- if plrs:GetEquippedItemBySlot(0) ~= nil and plrs:GetEquippedItemBySlot(2) ~= nil and plrs:GetEquippedItemBySlot(4) ~= nil and plrs:GetEquippedItemBySlot(6) ~= nil and plrs:GetEquippedItemBySlot(7) ~= nil and plrs:GetEquippedItemBySlot(9) ~= nil and plrs:GetEquippedItemBySlot(18) ~= nil then
- if plrs:GetEquippedItemBySlot(0):GetEntryId() == 12427 then -- Head
- --plrs:SendBroadcastMessage("HEAD : 1")
- if plrs:GetEquippedItemBySlot(2):GetEntryId() == 12428 then -- Shoulder
- --plrs:SendBroadcastMessage("Shoulder : 2")
- if plrs:GetEquippedItemBySlot(4):GetEntryId() == 12422 then -- Chest
- --plrs:SendBroadcastMessage("Chest : 3")
- if plrs:GetEquippedItemBySlot(6):GetEntryId() == 12429 then -- Legs
- --plrs:SendBroadcastMessage("Legs : 4")
- if plrs:GetEquippedItemBySlot(7):GetEntryId() == 12426 then -- Feet
- --plrs:SendBroadcastMessage("Feet : 5")
- if plrs:GetEquippedItemBySlot(9):GetEntryId() == 29600 then -- Gloves
- --plrs:SendBroadcastMessage("Gloves : 6")
- if plrs:GetEquippedItemBySlot(18):GetEntryId() == 11364 then -- Tabard
- plrs:SetFaction(21)
- else
- plrs:SetFaction(1)
- end
- else
- plrs:SetFaction(1)
- end
- else
- plrs:SetFaction(1)
- end
- else
- plrs:SetFaction(1)
- end
- else
- plrs:SetFaction(1)
- end
- else
- plrs:SetFaction(1)
- end
- else
- plrs:SetFaction(1)
- end
- end
- end
- end
- end
- RegisterTimedEvent("Every_so_Often_Check_what_items_player_Has_and_if_he_matches_all_then_continue", 5000, 0)
- -------------------------------------------------------------------------------------------------------
- -- Priest - When entering Stormwind ------------------------------------------------------------------
- -------------------------------------------------------------------------------------------------------
- function PRISET_DETECTS_YOU_RAGERAGERAGE(pUnit)
- pUnit:RegisterEvent("Detect_Players_For_Changing_Factions_yet_Again", 1500, 0)
- end
- function Detect_Players_For_Changing_Factions_yet_Again(pUnit)
- local player = pUnit:GetClosestPlayer()
- if player ~= nil then
- pUnit:SendChatMessage(12,0,"Wait a minute, your no member of the Alliance! An escaped prisoner, get him!")
- pUnit:RemoveEvents()
- pUnit:RegisterEvent("give_him_a_second_to_read_it_and_for_reactions_etc", 1500, 1)
- SetDBCSpellVar(1245, "c_is_flags", 0x01000)
- SetDBCSpellVar(11549, "c_is_flags", 0x01000)
- player:CastSpell(1245)
- player:CastSpell(11549)
- end
- end
- function give_him_a_second_to_read_it_and_for_reactions_etc(pUnit)
- local player = pUnit:GetClosestPlayer()
- if player ~= nil then
- pUnit:FullCastSpellOnTarget(585, player)
- player:SetFaction(1)
- end
- end
- RegisterUnitEvent(150121,18, "PRISET_DETECTS_YOU_RAGERAGERAGE")
- -------------------------------------------------------------------------------------------------------
- -- King of Stormwind ---------------------------------------------------------------------------------
- -------------------------------------------------------------------------------------------------------
- function King_Of_Stormwind_Is_Looking_For_people_to_be_a_victim_of(pUnit, Event)
- pUnit:SetFaction(35)
- pUnit:RegisterEvent("Seen_anyone_yet_QuestionMark", 1500, 0)
- end
- function Seen_anyone_yet_QuestionMark(pUnit)
- pUnit:SetFaction(35)
- local pla = pUnit:GetClosestPlayer()
- if pla ~= nil then
- if pla:GetDistanceYards(pUnit) < 7 then
- pUnit:RemoveEvents()
- pUnit:SendChatMessage(12,0,"So, you've made it this. How much longer do you seriously think this is going to go on for? A prisoner escaping and killing the king? You know it's not going to happen.")
- pUnit:Emote(1,6000)
- pUnit:RegisterEvent("OH_WE_FOUND_SOMEONE_CHAT_THEM_UP_KING", 8000, 1)
- pUnit:RegisterEvent("OH_WE_FOUND_SOMEONE_CHAT_THEM_UP_KING_Attack", 11000, 1)
- end
- end
- end
- function OH_WE_FOUND_SOMEONE_CHAT_THEM_UP_KING(pUnit)
- pUnit:SendChatMessage(12,0,"This ends now, prisoner, prepare to die!")
- pUnit:Emote(5,2000)
- end
- function OH_WE_FOUND_SOMEONE_CHAT_THEM_UP_KING_Attack(pUnit)
- pUnit:SetFaction(21)
- end
- RegisterUnitEvent(29611,18,"King_Of_Stormwind_Is_Looking_For_people_to_be_a_victim_of")
- -------------------------------------------------------------------------------------------------------
- -- Blowing your way out of the keep -------------------------------------------------------------------
- -------------------------------------------------------------------------------------------------------
- function DEBUG_BLOW_UP_GATE_ITEM(item, event, player)
- DEBUG_BLOW_UP_GATE_ITEMtata(item, player)
- end
- function DEBUG_BLOW_UP_GATE_ITEMtata(item, player)
- DISTANCE_HANDLER = player:GetCreatureNearestCoords(-8538.5, 455.72, 104.6, 50)
- if DISTANCE_HANDLER ~= nil then
- local Distance = roundNum(DISTANCE_HANDLER:GetDistanceYards(player), 0)
- if Distance < 7 then
- player:RemoveItem(4378, 1)
- DISTANCE_HANDLER:SpawnGameObject(1934000, -8538.5, 455.72, 104.6, 0, 0, 1)
- DISTANCE_HANDLER:GetGameObjectNearestCoords(-8538.5, 455.72, 104.6, 1934000):SetScale(1)
- COUNT_DOWN = 6
- --DISTANCE_HANDLER:RegisterEvent("renamedfunctionTest", 1000, 0)
- RegisterTimedEvent("renamedfunctionTest", 1000, 6) -- Thanks to Dynashock for suggesting to use a TimedEvent since gameobject on spawn and handling through npc was basically... ****ed up and wouldn't call
- else
- player:SendAreaTriggerMessage("|CFFff0000You are "..Distance.." yards away!|R")
- end
- end
- end
- RegisterItemGossipEvent(4378, 1, "DEBUG_BLOW_UP_GATE_ITEM")
- -----------------------------------------------------------------------------
- -- Rounding Numbers
- -- example: roundNum(5.6)
- function roundNum(val, decimal)
- if (decimal) then
- return math.floor(((val * 10^decimal) + 0.5) / (10^decimal))
- else
- return math.floor(val+0.5)
- end
- end
- ----------------------------------------------------------------------------
- function renamedfunctionTest(pUnit)
- COUNT_DOWN = COUNT_DOWN - 1
- if COUNT_DOWN == 0 then
- --DISTANCE_HANDLER:RemoveEvents()
- DISTANCE_HANDLER:CastSpellAoF(-8538.5, 455.72, 104.6, 69689)
- DISTANCE_HANDLER:GetGameObjectNearestCoords(-8540.5, 457.8, 104.3, 190727):SetUInt32Value(0x0006+0x0003,0x400) -- destroy destructable object
- DISTANCE_HANDLER:GetGameObjectNearestCoords(-8538.5, 455.72, 104.6, 1934000):Despawn(1,0)
- else
- if COUNT_DOWN == 1 then
- local plr = DISTANCE_HANDLER:GetClosestPlayer()
- if plr ~= nil then
- plr:SendAreaTriggerMessage("|CFFff0000The bomb will explode in "..COUNT_DOWN.." second!|R")
- end
- else
- local plr = DISTANCE_HANDLER:GetClosestPlayer()
- if plr ~= nil then
- plr:SendAreaTriggerMessage("|CFFff0000The bomb will explode in "..COUNT_DOWN.." seconds!|R")
- end
- end
- end
- end
- -------------------------------------------------------------------------------------------------------
- -- Destructable Objects Testing - Works like a charm -------------------------------------------------
- -------------------------------------------------------------------------------------------------------
- --[[
- local test = nil
- function destryctabeobjectest(pMisc, event)
- test = pMisc
- end
- RegisterGameObjectEvent(193070, 2, "destryctabeobjectest")
- local abc = nil
- function destryctabeobjectest(pMisc, event)
- abc = pMisc
- end
- RegisterGameObjectEvent(190377, 2, "destryctabeobjectest")
- function flight_path_reality_system(event, plr, message, type, language)
- local message = string.lower(message)
- if message == "#hurt" then
- test:SetUInt32Value(0x0006+0x0003,0x200) -- damaged
- end
- if message == "#destroy" then
- test:SetUInt32Value(0x0006+0x0003,0x400) -- destroy
- end
- if message == "#rebuild" then
- test:RemoveFlag(0x0006+0x0003,0x400)
- test:RemoveFlag(0x0006+0x0003,0x200)
- end
- if message == "#a" then
- abc:SetUInt32Value(0x0006+0x0003,0x200) -- damaged
- end
- if message == "#b" then
- abc:SetUInt32Value(0x0006+0x0003,0x400) -- destroy
- end
- if message == "#c" then
- abc:RemoveFlag(0x0006+0x0003,0x400)
- abc:RemoveFlag(0x0006+0x0003,0x200)
- end
- end
- RegisterServerHook(16, "flight_path_reality_system")
- ]]
- --[[
- GO_FLAG_DAMAGED = 0x200,
- GO_FLAG_DESTROYED = 0x400,
- ]]
- -------------------------------------------------------------------------------------------------------
- -- The Ending Sequence -------------------------------------------------------------------
- -------------------------------------------------------------------------------------------------------
- function ENDING_GOSSIP_MENU(pUnit, event, player) -- Let the player decide to finish it - they have to interact, not automatic wtf is going on.
- pUnit:GossipCreateMenu(759, player, 0)
- pUnit:GossipMenuAddItem(0, "I'm ready.", 424, 0)
- if pUnit == 0 then
- pUnit:GossipMenuAddItem(4, "[DEBUG]", 424, 0) -- Random menu so that only one can show up
- end
- pUnit:GossipSendMenu(player)
- end
- function ENDING_GOSSIP_MENU_Submenus(pUnit, event, player, id, intid, code)
- if(intid == 424) then
- player:GossipComplete()
- player:SetPlayerLock(1)
- player:MovePlayerTo(-8546.86, 466.17, 104.55, 0, 0)
- DISTANCE_HANDLER:GetGameObjectNearestCoords(-8540.5, 457.8, 104.3, 190727):RemoveFlag(0x0006+0x0003,0x400) -- Rebuilds the concrete wall, for visual appear more than anything else.
- DISTANCE_HANDLER:SendChatMessage(42,0,"Well done, you've completed the game!")
- RegisterTimedEvent("DISCONECT_PLAYER_AND_KILL_HIS_CHARACTER", 10000, 1, player)
- end
- end
- function DISCONECT_PLAYER_AND_KILL_HIS_CHARACTER(player)
- player:SoftDisconnect()
- CharDBQuery("DELETE FROM corpses")
- CharDBQuery("DELETE FROM playeritems")
- CharDBQuery("DELETE FROM gm_tickets")
- CharDBQuery("DELETE FROM playerpets")
- CharDBQuery("DELETE FROM playerpetspells")
- CharDBQuery("DELETE FROM tutorials")
- CharDBQuery("DELETE FROM questlog")
- CharDBQuery("DELETE FROM playercooldowns")
- CharDBQuery("DELETE FROM mailbox")
- CharDBQuery("DELETE FROM social_friends")
- CharDBQuery("DELETE FROM social_ignores")
- CharDBQuery("DELETE FROM character_achievement WHERE achievement NOT IN (457, 467, 466, 465, 464, 463, 462, 461, 460, 459, 458, 1404, 1405, 1406, 1407, 1408, 1409, 1410, 1411, 1412, 1413, 1415, 1414, 1416, 1417, 1418, 1419, 1420, 1421, 1422, 1423, 1424, 1425, 1426, 1427, 1463, 1400, 456, 1402)")
- CharDBQuery("DELETE FROM character_achievement_progress")
- CharDBQuery("DELETE FROM characters")
- end
- RegisterUnitGossipEvent(205611, 1, "ENDING_GOSSIP_MENU")
- RegisterUnitGossipEvent(205611, 2, "ENDING_GOSSIP_MENU_Submenus")
- ------------------------------------------------------------------------------------------------------------------------------------------------
Advertisement
Add Comment
Please, Sign In to add comment