Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ------------------------------------------------------------------
- --[[
- This script was made by Stoneharry of www.MMOwned.com
- This script may be edited and changed at will, but full credits must be provided.
- Please respect the original author, thank you.
- ]]
- -- Variable declaration and generally setting up the script
- --?!MAP= 631
- local TirionNPCID = 38995
- local LichKingNPCID = 36597
- -- For 3.3.5a
- local OBJECT_END = 0x0006
- local UNIT_NPC_FLAGS = OBJECT_END + 0x004C
- local UNIT_FIELD_FLAGS = OBJECT_END + 0x0035
- local UNIT_FIELD_BYTES_1 = OBJECT_END + 0x0044
- local UNIT_FLAG_NOT_SELECTABLE = 0x02000000
- -- Unconfigurable Variables
- --[[local Lich = nil -- TO DO - fix variable collision with these
- local Tirion = nil
- local Ready = false
- local i = 0]]
- ICC = {}
- ICC.VAR = {}
- ------------------------------------------------------------------
- -- The gossip used to start the encounter - Tirion ---------------
- -- Also set up events etc ----------------------------------------
- ------------------------------------------------------------------
- function OnGossipTalk(pUnit, Event, player)
- local menu = GossipMenu(pUnit, 2975252, 1)
- menu:AddItem(9, "We are prepared, Highlord. Let us battle for the fate of Azeroth! For the light of dawn!", 1, false)
- menu:AddItem(0, "We are not yet prepared, Highlord.", 2, false)
- menu:Send(player)
- end
- function OnGossipSelect(pUnit, Event, player, id, code)
- if (id == 1) then
- local id = MapMgr:GetInstanceID()
- ICC[id].VAR.Tirion = pUnit
- ICC[id].VAR.Ready = true
- ICC[id].VAR.Tirion:SetUInt32Value(UNIT_NPC_FLAGS, 2) -- Quest flags disable gossip
- ICC[id].VAR.Tirion:SetUInt32Value(UNIT_FIELD_FLAGS, 2) -- Unattackable, used to prevent LK hitting him instead of players
- -- Gossip complete
- elseif (id == 2) then
- -- Gossip complete
- end
- end
- RegisterUnitGossipEvent(TirionNPCID, 1, OnGossipTalk)
- RegisterUnitGossipEvent(TirionNPCID, 2, OnGossipSelect)
- function OnSpawnHandleStart(pUnit, Event)
- pUnit:SetUInt32Value(UNIT_NPC_FLAGS, 1) -- Gossip Flags, for when the fight resets
- pUnit:RegisterEvent(CheckForStart, 2500, 1) -- Setting repeat to 0 only calls once for some reason
- end
- RegisterUnitEvent(TirionNPCID, 18, OnSpawnHandleStart)
- function OnSpawnHandleDefineAndBytes(pUnit, Event)
- pUnit:RegisterEvent(SetBytesAndHandleVariable, 2000, 1)
- end
- function SetBytesAndHandleVariable(pUnit)
- local id = MapMgr:GetInstanceID()
- ICC[id].VAR.Lich = pUnit
- ICC[id].VAR.Lich:SetUInt32Value(UNIT_FIELD_BYTES_1, 1) -- Sit on the throne
- ICC[id].VAR.Lich:SetUInt32Value(UNIT_FIELD_FLAGS, 2) -- Unattackable
- end
- RegisterUnitEvent(LichKingNPCID, 18, OnSpawnHandleDefineAndBytes)
- ------------------------------------------------------------------
- -- Mini-cinematic at the start -----------------------------------
- ------------------------------------------------------------------
- function CheckForStart(pUnit)
- local id = MapMgr:GetInstanceID()
- if (ICC[id].VAR.Ready and ICC[id].VAR.Lich ~= nil) then
- ICC[id].VAR.Ready = false
- ICC[id].VAR.i = 0
- ICC[id].VAR.Tirion:GetAIInterface():MoveTo(489.14, -2124.45, 1040.9, 0) -- Closer to LK
- ICC[id].VAR.Tirion:RegisterEvent(WalkTowardsLichKingThenEmotes, 7500, 1)
- else
- pUnit:RegisterEvent(CheckForStart, 2500, 1)
- end
- end
- function WalkTowardsLichKingThenEmotes(pUnit)
- local id = MapMgr:GetInstanceID()
- if (ICC[id].VAR.i == 0) then
- ICC[id].VAR.Tirion:EventAddEmote(175, 4000)
- ICC[id].VAR.Lich:SetUInt32Value(UNIT_FIELD_BYTES_1, 0) -- Stand up
- PlaySoundToSet(Tirion, 17349) -- Voice of message - Tirion since players are closer to him
- ICC[id].VAR.Lich:SendChatMessage(14, 0, "So... the Light's vaunted justice has finally arrived. Shall I lay down Frostmourne and throw myself at your mercy, Fordring?", 0)
- ICC[id].VAR.Tirion:RegisterEvent(WalkTowardsLichKingThenEmotes, 4000, 1)
- elseif (ICC[id].VAR.i == 1) then
- ICC[id].VAR.Lich:GetAIInterface():StopMovement(0) -- Resets bytes bug
- ICC[id].VAR.Lich:GetAIInterface():MoveTo(462.01, -2124.146, 1040.9, 0) -- Down from throne to floor
- ICC[id].VAR.Tirion:RegisterEvent(WalkTowardsLichKingThenEmotes, 9500, 1)
- elseif (ICC[id].VAR.i == 2) then
- ICC[id].VAR.Tirion:SendChatMessage(14,0,"We will grant you a swift death, Arthas. More than can be said for the thousands you've tortured and slain.", 0)
- PlaySoundToSet(Tirion, 17390)
- ICC[id].VAR.Tirion:RegisterEvent(WalkTowardsLichKingThenEmotes, 9000, 1)
- elseif (ICC[id].VAR.i == 3) then
- ICC[id].VAR.Lich:SendChatMessage(14,0,"You will learn of that first hand. When my work is complete, you will beg for mercy -- and I will deny you. Your anguished cries will be testament to my unbridled power.", 0)
- PlaySoundToSet(Tirion, 17350)
- ICC[id].VAR.Lich:EventAddEmote(397, 4000)
- ICC[id].VAR.Tirion:RegisterEvent(WalkTowardsLichKingThenEmotes, 4500, 1)
- elseif (ICC[id].VAR.i == 4) then
- ICC[id].VAR.Lich:EventAddEmote(1, 6000)
- ICC[id].VAR.Tirion:RegisterEvent(WalkTowardsLichKingThenEmotes, 12000, 1)
- elseif (ICC[id].VAR.i == 5) then
- ICC[id].VAR.Lich:EventAddEmote(392, 3500)
- ICC[id].VAR.Tirion:RegisterEvent(WalkTowardsLichKingThenEmotes, 7500, 1)
- elseif (ICC[id].VAR.i == 6) then
- ICC[id].VAR.Tirion:SendChatMessage(14,0,"So be it. Champions, attack!", 0)
- PlaySoundToSet(Tirion, 17391)
- ICC[id].VAR.Tirion:EventAddEmote(397, 2000)
- ICC[id].VAR.Tirion:RegisterEvent(WalkTowardsLichKingThenEmotes, 2000, 1)
- elseif (ICC[id].VAR.i == 7) then
- ICC[id].VAR.Tirion:GetAIInterface():setMoveRunFlag(true)
- ICC[id].VAR.Tirion:GetAIInterface():MoveTo(472.88, -2124.2, 1040.9, 0) -- Run towards LK
- ICC[id].VAR.Tirion:RegisterEvent(WalkTowardsLichKingThenEmotes, 1000, 1)
- elseif (ICC[id].VAR.i == 8) then
- ICC[id].VAR.Lich:SendChatMessage(14,0,"I'll keep you alive to witness the end, Fordring. I would not want the Light's greatest champion to miss seeing this wretched world remade in my image.", 0)
- PlaySoundToSet(Tirion, 17351)
- ICC[id].VAR.Tirion:RegisterEvent(WalkTowardsLichKingThenEmotes, 500, 1)
- elseif (ICC[id].VAR.i == 9) then
- ICC[id].VAR.Lich:CastSpell(Tirion, 71614, false) -- Freeze
- ICC[id].VAR.Lich:SetUInt32Value(UNIT_FIELD_FLAGS, 0) -- Attackable
- end
- ICC[id].VAR.i = ICC[id].VAR.i + 1
- end
- ------------------------------------------------------------------
- -- Handle the ICC debuff -----------------------------------------
- ------------------------------------------------------------------
- function OnZoneChange(event, player, zone, oldzone)
- local race = player:getRace()
- if (zone == 4812) then
- player:CastSpell(player, 69127, true) -- Chill of the Throne
- player:CastSpell(player, 69127, true) -- Hack'y way of applying the correct aura types.
- if (race == 1 or race == 3 or race == 4 or race == 7 or race == 11) then
- player:CastSpell(player, 73828, true) -- Strength of Wyrn
- else
- player:CastSpell(player, 73822, true) -- Hellscreem's warsong
- end
- elseif (oldzone == 4812) then
- player:RemoveAura(69127) -- Chill of the Throne
- if (race == 1 or race == 3 or race == 4 or race == 7 or race == 11) then
- player:RemoveAura(73828) -- Strength of Wyrn
- else
- player:RemoveAura(73822) -- Hellscreem's warsong
- end
- end
- end
- RegisterServerHook(15, OnZoneChange)
- -- Playing sounds to set
- function PlaySoundToSet(object, ID)
- local pack = LuaPacket(722, 4)
- pack:WriteUint32(ID)
- object:SendMessageToSet(pack, true)
- end
- ------------------------------------------------------------------
Advertisement
Add Comment
Please, Sign In to add comment