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 -- Global variables are automatically local to the script now
- local Tirion = nil]]
- local Ready = false
- local i = 0
- ------------------------------------------------------------------
- -- The gossip used to start the encounter - Tirion ---------------
- -- Also set up events etc ----------------------------------------
- ------------------------------------------------------------------
- function Tirion_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 Tirion_OnGossipSelect(pUnit, Event, player, id, code)
- if (id == 1) then
- Tirion = pUnit
- Ready = true
- Tirion:SetUInt32Value(UNIT_NPC_FLAGS, 2) -- Quest flags disable gossip
- -- Gossip complete
- elseif (id == 2) then
- pUnit:SetUInt32Value(UNIT_NPC_FLAGS, 1) -- Quest flags disable gossip
- -- Gossip complete
- end
- end
- RegisterUnitGossipEvent(TirionNPCID, 1, Tirion_OnGossipTalk)
- RegisterUnitGossipEvent(TirionNPCID, 2, Tirion_OnGossipSelect)
- function Tirion_OnSpawnHandleStart(pUnit, Event)
- TO_CREATURE(pUnit):RegisterEvent(CheckForStart_Tirion, 2500, 1) -- Setting repeat to 0 only calls once for some reason
- end
- RegisterUnitEvent(TirionNPCID, 18, Tirion_OnSpawnHandleStart)
- function LichKing_OnSpawnHandleDefineAndBytes(pUnit, Event)
- TO_CREATURE(pUnit):RegisterEvent(SetBytesAndHandleVariable_LichKing, 2000, 1)
- end
- function SetBytesAndHandleVariable_LichKing(pUnit)
- Lich = pUnit
- Lich:SetUInt32Value(UNIT_FIELD_BYTES_1, 1) -- Sit on the throne
- Lich:SetUInt32Value(UNIT_FIELD_FLAGS, 2) -- Unattackable -- Bugs it, he can't move
- end
- RegisterUnitEvent(LichKingNPCID, 18, LichKing_OnSpawnHandleDefineAndBytes)
- ------------------------------------------------------------------
- -- Mini-cinematic at the start -----------------------------------
- ------------------------------------------------------------------
- function CheckForStart_Tirion(pUnit)
- if (Ready == true and Lich ~= nil) then
- Ready = false
- Tirion:GetAIInterface():MoveTo(489.14, -2124.45, 1040.9, 0) -- Closer to LK
- TO_CREATURE(Tirion):RegisterEvent(WalkTowardsLichKingThenEmotes, 7000, 1)
- else
- TO_CREATURE(pUnit):RegisterEvent(CheckForStart_Tirion, 2500, 1)
- end
- end
- function WalkTowardsLichKingThenEmotes(pUnit)
- if (i == 0) then
- Tirion:EventAddEmote(175, 30000)
- Lich:SetUInt32Value(UNIT_FIELD_BYTES_1, 0) -- Stand up
- PlaySoundToSet(Tirion, 17349) -- Voice of message - Tirion since players are closer to him
- 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)
- TO_CREATURE(Tirion):RegisterEvent(WalkTowardsLichKingThenEmotes, 4000, 1)
- elseif (i == 1) then
- Lich:GetAIInterface():MoveTo(462.01, -2124.146, 1040.9, 0) -- Down from throne to floor
- TO_CREATURE(Tirion):RegisterEvent(WalkTowardsLichKingThenEmotes, 9500, 1)
- elseif (i == 2) then
- 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)
- TO_CREATURE(Tirion):RegisterEvent(WalkTowardsLichKingThenEmotes, 9000, 1)
- elseif (i == 3) then
- 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)
- Lich:EventAddEmote(397, 4000)
- end
- i = i + 1
- end
- ------------------------------------------------------------------
- -- Handle the ICC debuff -----------------------------------------
- ------------------------------------------------------------------
- function OnZoneChange_ICC(event, player, zone, oldzone)
- 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 (player:GetTeam() == 0) 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 (player:GetTeam() == 0) then
- player:RemoveAura(73828) -- Strength of Wyrn
- else
- player:RemoveAura(73822) -- Hellscreem's warsong
- end
- end
- end
- RegisterServerHook(15, OnZoneChange_ICC)
- -- 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