Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --##############################################################
- --# __ ___ _________ ____________ _____ #
- --#| | / / | | | | / _ \ #
- --#| | / / | ______| |____ ____| / / \ \ #
- --#| | / / | | | | / / \ \ #
- --#| |/ / | |______ | | / /_____\ \ #
- --#| / | | | | / \ #
- --#| \ | ______| | | / ___________ \ #
- --#| |\ \ | | | | / / \ \ #
- --#| | \ \ | |______ | | / / \ \ #
- --#| | \ \ | | | | / / \ \ #
- --#|__| \__\ |_________| |__| /__/ \__\ #
- --# #
- --# Copyright Keta #
- --# #
- --##############################################################
- ------------------------------------------------------------------
- -------------------------> Locals <-------------------------------
- local cityname
- local def_gname
- local att_gname
- local count = 0
- local gameisrunning = 0
- local stormwinddef = 0
- local stormwindatt = 0
- local gameislaunching = 0
- local flagtakenfirsttime_a = 0
- local flagtakenfirsttime_d = 0
- local flagpoints = 0
- local boss_state = 0
- ------------------------------------------------------------------
- function DefenderNPC_OnGossip(pUnit, event, player)
- if player:IsInGuild() then
- if (count == 0) then
- if player:GetGuildLeader() == player:GetName() then
- pUnit:GossipCreateMenu(50, player, 0)
- pUnit:GossipMenuAddItem(0, "Myself and my guild are ready to defend our city!", 1, 0)
- pUnit:GossipMenuAddItem(0, "[Exit]", 2, 0)
- pUnit:GossipSendMenu(player)
- else
- player:SendBroadcastMessage("You are not the guild leader, you do not have permission to initiate a guild war event. Contact you guild leader to initiate this event")
- end
- end
- if (count == 1) then
- pUnit:GossipCreateMenu(51, player, 0)
- if def_gname == player:GetGuildName() then
- pUnit:GossipMenuAddItem(0, "I am from " .. def_gname .. ". The fight is located in " .. cityname .. ". Let me aid them!", 8, 0)
- elseif player:GetGuildLeader() == player:GetName() then
- pUnit:GossipMenuAddItem(0, "Myself and my guild wish to challenge " .. def_gname .. " in " .. cityname .. ", and try to take over the city, and claim it for my guild.", 7, 0)
- pUnit:GossipMenuAddItem(0, "[Exit]", 2, 0)
- pUnit:GossipSendMenu(player)
- end
- end
- if (count == 2) then
- pUnit:GossipCreateMenu(51, player, 0)
- if def_gname == player:GetGuildName() then
- pUnit:GossipMenuAddItem(0, "I am from " .. def_gname .. ". The fight is located in " .. cityname .. ". Let me aid them!", 8, 0)
- elseif att_gname == player:GetGuildName() then
- pUnit:GossipMenuAddItem(0, "I am from " .. att_gname .. ". The fight is located in " .. cityname .. ". Let me aid them!", 9, 0)
- end
- pUnit:GossipMenuAddItem(0, "[Exit]", 2, 0)
- pUnit:GossipSendMenu(player)
- end
- else
- player:SendBroadcastMessage("You are not currently in a guild. Join one of the guild on the server, or create your own, to enter the game")
- end
- end
- function DefenderNPC_Select(pUnit, event, player, id, intid, code)
- if (intid == 1) then
- pUnit:GossipCreateMenu(52, player, 0)
- pUnit:GossipMenuAddItem(0, "Choose a city", 1, 0)
- pUnit:GossipMenuAddItem(1, "[Stormwind]", 3, 0)
- --pUnit:GossipMenuAddItem(1, "[Ironforge]", 4, 0)
- --pUnit:GossipMenuAddItem(1, "[Darnassus]", 5, 0)
- --pUnit:GossipMenuAddItem(1, "[Exodar]", 6, 0)
- pUnit:GossipMenuAddItem(0, "[Nevemind]", 2, 0)
- pUnit:GossipSendMenu(player)
- end
- if (intid == 2) then
- player:GossipComplete()
- end
- if (intid == 7) then
- SendWorldMessage("" .. player:GetGuildName() .. " has challenged " .. def_gname .. " in " .. cityname .. " and will try and take over the city!", 2)
- if math.random(1, 2) == 1 then
- player:Teleport(0, -8910.532227, 510.447845, 94, 2.054598)
- elseif math.random(1, 2) == 2 then
- player:Teleport(0, -8956.366211, 568.134827, 94, 5.616378)
- att_gname = player:GetGuildName()
- end
- end
- if (intid == 9) then
- if math.random(1, 2) == 1 then
- player:Teleport(0, -8910.532227, 510.447845, 94, 2.054598)
- elseif math.random(1, 2) == 2 then
- player:Teleport(0, -8956.366211, 568.134827, 94, 5.616378)
- end
- end
- if (intid == 8) then
- player:Teleport(0, -8397.78418, 278.347534, 121, 2.238385)
- end
- if (intid == 3) then
- SendWorldMessage("The Guild War event has initiated by " .. player:GetName() .. " and is being held in Stormwind City. Those of you who has a guild in the fight, help them in this heroic battle!", 2)
- count = count + 1
- def_gname = player:GetGuildName()
- player:SendBroadcastMessage("The battle will begin soon. Gather your guild members")
- cityname = "Stormwind City"
- player:Teleport(0, -8397.921875, 278.896240, 121, 2.23)
- end
- if (intid == 4) then
- count = count + 1
- player:SendBroadcastMessage("The battle will begin soon. Gather your guild members")
- cityname = "Ironforge"
- player:Teleport(xxx)
- end
- if (intid == 5) then
- count = count + 1
- player:SendBroadcastMessage("The battle will begin soon. Gather your guild members")
- cityname = "Darnassus"
- player:Teleport(xxx)
- end
- if (intid == 6) then
- count = count + 1
- player:SendBroadcastMessage("The battle will begin soon. Gather your guild members")
- cityname = "Exodar"
- player:Teleport(xxx)
- end
- end
- RegisterUnitGossipEvent(135790, 1, "DefenderNPC_OnGossip")
- RegisterUnitGossipEvent(135790, 2, "DefenderNPC_Select")
- ----------------------- Stormwind -------------------------
- function StormwindStarterNpc(pUnit, event, player)
- pUnit:GossipCreateMenu(100, player, 0)
- if stormwinddef == 0 then
- pUnit:GossipMenuAddItem(0, "We are ready. Send us out, when you are ready.", 1, 0)
- elseif gameislaunching >= 2 then
- pUnit:StopChannel()
- pUnit:GossipMenuAddItem(0, "I cannot stay here when my city is burning. Send me out to fight!", 3, 0)
- end
- pUnit:GossipMenuAddItem(0, "[Exit]", 2, 0)
- pUnit:GossipSendMenu(player)
- end
- function StormwindStarterNpc_Select(pUnit, event, player, id, intid, code)
- if (intid == 1) then
- def_gname = player:GetGuildName()
- pUnit:RemoveEvents()
- pUnit:SendChatMessage(12, 0, "I see you are ready to defend your city. I will initiate the summoning ritual")
- player:GossipComplete()
- stormwinddef = stormwinddef + 1
- gameislaunching = gameislaunching + 1
- pUnit:ChannelSpell(13540, pUnit)
- end
- if (intid == 2) then
- player:GossipComplete()
- end
- if (intid == 3) then
- player:SetFaction(1)
- player:FlagPvP()
- player:CastSpell(64446)
- player:LearnSpell(39957)
- player:Teleport(0, -8529.256836, 443.536133, 105, 2.23)
- end
- end
- RegisterUnitGossipEvent(880007, 1, "StormwindStarterNpc")
- RegisterUnitGossipEvent(880007, 2, "StormwindStarterNpc_Select")
- -----------------------------------------------------------
- function StormwindStarterNpc_2(pUnit, event, player)
- pUnit:GossipCreateMenu(100, player, 0)
- if stormwindatt == 0 then
- pUnit:GossipMenuAddItem(0, "We are ready. Send us in, when you are ready.", 1, 0)
- elseif gameislaunching == 2 then
- pUnit:StopChannel()
- pUnit:GossipMenuAddItem(0, "Im not staying here for one second more, send me in!", 3, 0)
- elseif gameislaunching == 3 then
- pUnit:StopChannel()
- pUnit:GossipMenuAddItem(0, "Im not staying here for one second more, send me in!", 4, 0)
- end
- pUnit:GossipMenuAddItem(0, "[Exit]", 2, 0)
- pUnit:GossipSendMenu(player)
- end
- function StormwindStarterNpc_Select2(pUnit, event, player, id, intid, code)
- if (intid == 1) then
- cityname = "Stormwind City"
- att_gname = player:GetGuildName()
- pUnit:RemoveEvents()
- pUnit:SendChatMessage(12, 0, "I see you are ready to try and take over this city. I will initiate the summoning ritual")
- player:GossipComplete()
- stormwindatt = stormwindatt + 1
- gameislaunching = gameislaunching + 1
- pUnit:ChannelSpell(13540, pUnit)
- end
- if (intid == 2) then
- player:GossipComplete()
- end
- if (intid == 3) then
- gameislaunching = gameislaunching + 1
- player:SetFaction(2)
- player:FlagPvP()
- player:CastSpell(64446)
- player:LearnSpell(44797)
- player:Teleport(0, -8888.982422, 573.122192, 93.541443, 0.680570)
- pUnit:SpawnCreature(100203, -8441.873947, 333.776639, 123.00000, 2.225899, 1, 900000)
- pUnit:SpawnGameObject(300300, -8306.773438, 546.262085, 99.602203, 5.419337, 900000)
- pUnit:SpawnGameObject(300301, -8989.271484, 850.816528, 29.620016, 2.305417, 900000)
- pUnit:SpawnGameObject(300302, -8815.850586, 360.302002, 100.586555, 4.715415, 900000)
- pUnit:SpawnGameObject(300303, -8761.326172, 1139.142700, 92.520309, 4.861132, 900000)
- pUnit:SpawnGameObject(300304, -8514.320313, 860.751465, 111.039368, 3.761577, 900000)
- print("Gameobjects placed")
- --SendWorldMessage("" .. def_gname .. " and " .. att_gname .. " is fighting in " .. cityname .. " and trying to take over the city! If you are a member of one of these guild, go aid them!", 2)
- pUnit:RegisterEvent("gametime", 900000, 1)
- end
- if (intid == 4) then
- player:SetFaction(2)
- player:FlagPvP()
- player:CastSpell(64446)
- player:LearnSpell(44797)
- player:Teleport(0, -8888.982422, 573.122192, 93.541443, 0.680570)
- end
- end
- function gametime(pUnit, event)
- print("Game Ended")
- pUnit:RemoveEvents()
- if boss_state == 1 then
- for k, v in pairs(GetPlayersInWorld()) do
- if v:HasSpell(39957) then
- v:Teleport(571, 1373.681519, -3208.5271, 163, 5)
- v:UnlearnSpell(39957)
- end
- end
- elseif boss_state == 0 then
- for k, v in pairs(GetPlayersInWorld()) do
- if v:HasSpell(44797) then
- v:Teleport(571, 1373.681519, -3208.5271, 163, 5)
- v:UnlearnSpell(44797)
- end
- end
- end
- end
- RegisterUnitGossipEvent(880006, 1, "StormwindStarterNpc_2")
- RegisterUnitGossipEvent(880006, 2, "StormwindStarterNpc_Select2")
- function flagpad_OnUse(GameObject,_,player)
- if player:HasAura(14268) then
- flagpoints = flagpoints + 1
- player:RemoveAura(14268)
- player:CastSpell(47292)
- player:SendBroadcastMessage("You have scored a point, and your opponents has been weakened!")
- if player:HasSpell(41855) then -- Dwarven District
- player:UnlearnSpell(41855)
- elseif player:HasSpell(41853) then -- Mage Quater
- player:UnlearnSpell(41853)
- elseif player:HasSpell(41865) then -- Old Town
- player:UnlearnSpell(41865)
- elseif player:HasSpell(41866) then -- The Park
- player:UnlearnSpell(41866)
- elseif player:HasSpell(41868) then -- Cathedral Square
- player:UnlearnSpell(41868)
- end
- else
- player:SendBroadcastMessage("You do not currently carry a flag. Take a flag from any of the flag locations, and capture it here.")
- end
- end
- RegisterGameObjectEvent(100200, 4, "flagpad_OnUse")
- function scoretablet_OnUse(GameObject,_,player)
- player:SendBroadcastMessage("The defenders has lost " .. flagpoints .. " flags so far!")
- end
- RegisterGameObjectEvent(100201, 4, "scoretablet_OnUse")
- function person_OnDeath(event, pPlayer)
- if pPlayer:HasAura(14268) then
- if pPlayer:HasSpell(41855) then -- Dwarven District
- pPlayer:SpawnGameObject(300300, -8306.773438, 546.262085, 99.602203, 5.419337, 0)
- pPlayer:RemoveAura(14268)
- pPlayer:UnlearnSpell(41855)
- elseif pPlayer:HasSpell(41853) then -- Mage Quater
- pPlayer:SpawnGameObject(300301, -8989.271484, 850.816528, 29.620016, 2.305417, 0)
- pPlayer:RemoveAura(14268)
- pPlayer:UnlearnSpell(41853)
- elseif pPlayer:HasSpell(41865) then -- Old Town
- pPlayer:SpawnGameObject(300302, -8815.850586, 360.302002, 100.586555, 4.715415, 0)
- pPlayer:RemoveAura(14268)
- pPlayer:UnlearnSpell(41865)
- elseif pPlayer:HasSpell(41866) then -- The Park
- pPlayer:SpawnGameObject(300303, -8761.326172, 1139.142700, 92.520309, 4.861132, 0)
- pPlayer:RemoveAura(14268)
- pPlayer:UnlearnSpell(41866)
- elseif pPlayer:HasSpell(41868) then -- Cathedral Square
- pPlayer:SpawnGameObject(300304, -8514.320313, 860.751465, 111.039368, 3.761577, 0)
- pPlayer:RemoveAura(14268)
- pPlayer:UnlearnSpell(41868)
- end
- end
- end
- RegisterServerHook(6, "person_OnDeath")
- -------------------------------------------------------------------------------------------
- function Dwarvendistrict_OnUse(GameObject,_,player) -- Dwarvendistrict
- if player:GetFaction() == 1 then
- player:SendBroadcastMessage("This is one of your flags. Protect it at all cost!")
- elseif player:GetFaction() == 2 then
- if player:HasAura(14268) then
- else
- if player:HasAura(1784) or player:HasAura(66) or player:HasAura(642) or player:HasAura(10278) or player:HasAura(5599) or player:HasAura(1022) then
- player:SendBroadcastMessage("You cant take the flag while being invisible, invulnerable to any sort of damage or stealthed")
- else
- player:CastSpell(14268)
- player:LearnSpell(41855)
- GameObject:Despawn(10, 0)
- end
- end
- end
- end
- RegisterGameObjectEvent(300300, 4, "Dwarvendistrict_OnUse")
- function Magequater_OnUse(GameObject,_,player) -- Magequater
- if player:GetFaction() == 1 then
- player:SendBroadcastMessage("This is one of your flags. Protect it at all cost!")
- elseif player:GetFaction() == 2 then
- if player:HasAura(14268) then
- else
- if player:HasAura(1784) or player:HasAura(66) or player:HasAura(642) or player:HasAura(10278) or player:HasAura(5599) or player:HasAura(1022) then
- player:SendBroadcastMessage("You cant take the flag while being invisible, invulnerable to any sort of damage or stealthed")
- else
- player:CastSpell(14268)
- player:LearnSpell(41853)
- GameObject:Despawn(10, 0)
- end
- end
- end
- end
- RegisterGameObjectEvent(300301, 4, "Magequater_OnUse")
- function Oldtown_OnUse(GameObject,_,player) -- Oldtown
- if player:GetFaction() == 1 then
- player:SendBroadcastMessage("This is one of your flags. Protect it at all cost!")
- elseif player:GetFaction() == 2 then
- if player:HasAura(14268) then
- else
- if player:HasAura(1784) or player:HasAura(66) or player:HasAura(642) or player:HasAura(10278) or player:HasAura(5599) or player:HasAura(1022) then
- player:SendBroadcastMessage("You cant take the flag while being invisible, invulnerable to any sort of damage or stealthed")
- else
- player:CastSpell(14268)
- player:LearnSpell(41865)
- GameObject:Despawn(10, 0)
- end
- end
- end
- end
- RegisterGameObjectEvent(300302, 4, "Oldtown_OnUse")
- function Thepark_OnUse(GameObject,_,player) -- Thepark
- if player:GetFaction() == 1 then
- player:SendBroadcastMessage("This is one of your flags. Protect it at all cost!")
- elseif player:GetFaction() == 2 then
- if player:HasAura(14268) then
- else
- if player:HasAura(1784) or player:HasAura(66) or player:HasAura(642) or player:HasAura(10278) or player:HasAura(5599) or player:HasAura(1022) then
- player:SendBroadcastMessage("You cant take the flag while being invisible, invulnerable to any sort of damage or stealthed")
- else
- player:CastSpell(14268)
- player:LearnSpell(41866)
- GameObject:Despawn(10, 0)
- end
- end
- end
- end
- RegisterGameObjectEvent(300303, 4, "Thepark_OnUse")
- function Cathsquare_OnUse(GameObject,_,player) -- Cathsquare
- if player:GetFaction() == 1 then
- player:SendBroadcastMessage("This is one of your flags. Protect it at all cost!")
- elseif player:GetFaction() == 2 then
- if player:HasAura(14268) then
- else
- if player:HasAura(1784) or player:HasAura(66) or player:HasAura(642) or player:HasAura(10278) or player:HasAura(5599) or player:HasAura(1022) then
- player:SendBroadcastMessage("You cant take the flag while being invisible, invulnerable to any sort of damage or stealthed")
- else
- player:CastSpell(14268)
- player:LearnSpell(41868)
- GameObject:Despawn(10, 0)
- end
- end
- end
- end
- RegisterGameObjectEvent(300304, 4, "Cathsquare_OnUse")
- ----------------------- Stormwind -------------------------
- ---------------------------- Boss --------------------------------------
- function boss_OnCombat(pUnit, event)
- pUnit:SendChatMessage(14, 0, "Looks like Im going to have to deal with you myself.")
- pUnit:CastSpell(53361)
- pUnit:RegisterEvent("SpawnAdds", 3000, 0)
- end
- function boss_OnKilledTarget(pUnit, event)
- pUnit:SendChatMessage(12, 0, "I honestly thought you would've been more of a challenge...")
- end
- function boss_OnDeath(pUnit, event)
- boss_state = boss_state + 1
- pUnit:SendChatMessage(14, 0, "No! This cannot... be...")
- pUnit:RegisterEvent("gametime", 1000, 0)
- end
- function boss_OnSpawn(pUnit, event)
- pUnit:CastSpell(40733)
- pUnit:SetCombatCapable(1)
- pUnit:RegisterEvent("disableshield", 3000, 0)
- end
- RegisterUnitEvent(100203, 1, "boss_OnCombat")
- RegisterUnitEvent(100203, 3, "boss_OnKilledTarget")
- RegisterUnitEvent(100203, 4, "boss_OnDeath")
- RegisterUnitEvent(100203, 18, "boss_OnSpawn")
- ------------------------------------------------------------------
- function disableshield(pUnit, event)
- if (flagpoints == 5) then
- pUnit:RemoveAura(40733)
- pUnit:SetCombatCapable(0)
- pUnit:RemoveEvents()
- pUnit:SendChatMessage(14, 0, "They have broken through! Dont let them enter the keep!!!")
- end
- end
- function SpawnAdds(pUnit, event)
- if pUnit:GetHealthPct() <= 59 then
- pUnit:SendChatMessage(14, 0, "You will not defeat me! Archers, assist me!")
- pUnit:RemoveEvents()
- pUnit:SpawnCreature(100202, -8459.856445, 336.957153, 140.6, 6, 14, 0, 0, 0, 34334)
- pUnit:SpawnCreature(100202, -8445.583008, 310.576996, 140.6, 1.328363, 14, 0, 0, 0, 34334)
- pUnit:SpawnCreature(100202, -8418.574219, 332.204071, 140.6, 3.26, 14, 0, 0, 0, 34334)
- pUnit:SpawnCreature(100202, -8440.947266, 352.062469, 140.6, 4.788041, 14, 0, 0, 0, 34334)
- end
- end
- ------------------------------------------------------------------
- function add_OnSpawn(pUnit, event)
- pUnit:SetCombatRangedCapable(0)
- pUnit:SetCombatMeleeCapable(1)
- pUnit:SetCombatCapable(1)
- pUnit:SetTauntedBy(pUnit:GetRandomPlayer(0))
- pUnit:RegisterEvent("shoot_arrow", 6000, 0)
- pUnit:RegisterEvent("shoot_autoshoot", 4000, 0)
- end
- RegisterUnitEvent(100202, 18, "add_OnSpawn")
- function shoot_autoshoot(pUnit, event)
- pUnit:CastSpellOnTarget(49197, pUnit:GetRandomPlayer(0))
- local armorreduce = math.random(1, 3)
- if (armorreduce == 1) then
- pUnit:CastSpell(47216)
- end
- end
- function shoot_arrow(pUnit, event)
- local arrow = math.random(1, 6)
- if (arrow == 1) then
- pUnit:CastSpellOnTarget(56095, pUnit:GetRandomPlayer(0))
- elseif (arrow == 2) then
- pUnit:CastSpellOnTarget(42671, pUnit:GetRandomPlayer(4))
- elseif (arrow == 3) then
- pUnit:CastSpellOnTarget(49197, pUnit:GetRandomPlayer(0))
- elseif (arrow == 4) then
- pUnit:CastSpellOnTarget(70309, pUnit:GetRandomPlayer(0))
- elseif (arrow == 5) then
- pUnit:CastSpellOnTarget(19801, pUnit:GetRandomPlayer(0))
- elseif (arrow == 6) then
- pUnit:CastSpellOnTarget(67993, pUnit:GetRandomPlayer(4))
- end
- end
- ---------------------------- Boss --------------------------------------
- ------------------------- Serverhooks ----------------------------------
- function preventcast(event, pPlayer, spellId)
- if (spellId == 1784) or (spellId == 66) or (spellId == 642) or (spellId == 10278) or (spellId == 5599) or (spellId == 1022) then
- if pPlayer:HasAura(14268) then
- if pPlayer:HasSpell(41855) then -- Dwarven District
- pPlayer:SpawnGameObject(300300, -8306.773438, 546.262085, 99.602203, 5.419337, 0)
- pPlayer:RemoveAura(14268)
- pPlayer:UnlearnSpell(41855)
- elseif pPlayer:HasSpell(41853) then -- Mage Quater
- pPlayer:SpawnGameObject(300301, -8989.271484, 850.816528, 29.620016, 2.305417, 0)
- pPlayer:RemoveAura(14268)
- pPlayer:UnlearnSpell(41853)
- elseif pPlayer:HasSpell(41865) then -- Old Town
- pPlayer:SpawnGameObject(300302, -8815.850586, 360.302002, 100.586555, 4.715415, 0)
- pPlayer:RemoveAura(14268)
- pPlayer:UnlearnSpell(41865)
- elseif pPlayer:HasSpell(41866) then -- The Park
- pPlayer:SpawnGameObject(300303, -8761.326172, 1139.142700, 92.520309, 4.861132, 0)
- pPlayer:RemoveAura(14268)
- pPlayer:UnlearnSpell(41866)
- elseif pPlayer:HasSpell(41868) then -- Cathedral Square
- pPlayer:SpawnGameObject(300304, -8514.320313, 860.751465, 111.039368, 3.761577, 0)
- pPlayer:RemoveAura(14268)
- pPlayer:UnlearnSpell(41868)
- end
- end
- end
- end
- RegisterServerHook(10, "preventcast")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement