Advertisement
Guest User

Silithus

a guest
Mar 22nd, 2012
183
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 6.53 KB | None | 0 0
  1. --Gameobjects
  2. local SILITHYST_MOUND = 181597
  3. local SILITHYST_GEYSER = 181598
  4.  
  5. --Spells
  6. local TRACES_OF_SILITHYST = 29534
  7. local SILITHYST_SPELL = 29519
  8. local SPELL_CENARION_FAVOR = 30754
  9.  
  10. --Areatriggers
  11. local ALLIANCE_RETURN = 4162
  12. local HORDE_RETURN = 4168
  13.  
  14. --Quests
  15. local ALLIANCE_QUEST = 9419
  16. local HORDE_QUEST = 9422
  17.  
  18. --Rewards
  19. local REPUTATION_FACTION = 609
  20. local REPUTATION_VALUE = 20
  21. local HONOR_VALUE = 20
  22.  
  23. --Zone
  24. local ZONE_SILITHUS = 1377
  25.  
  26. --WorldStates
  27. local HORDE_COUNT = 2314
  28. local ALLIANCE_COUNT = 2313
  29. local TOTAL_COUNT = 2317
  30. local TOTAL_COUNT_VAL = 200
  31.  
  32. --Other locals Requred for controlling the zone, because the player does not support the "GetWorldState" method.
  33. local captureALLIANCE = 0
  34. local captureHORDE = 0
  35.  
  36. function SilithysMound_OnUse(go,_,player)
  37. if (player:HasAura(SILITHYST_SPELL) == false) then
  38.     if (player:IsMounted() == true) then
  39.         player:Dismount()
  40.     end
  41.     player:AddAura(SILITHYST_SPELL, -1)
  42.     go:Despawn(1, 360000) -- These respawn timers are not exact perhaps. I have no idea what is the blizzlike value. Set to 5 min.
  43. else
  44.     go:Despawn(1, 360000) -- These respawn timers are not exact perhaps. I have no idea what is the blizzlike value. Set to 5 min.
  45. end
  46. end
  47.  
  48. function SilithysGeyser_OnUse(go,_,player)
  49. if (player:HasAura(SILITHYST_SPELL) == false) then
  50.     if (player:IsMounted() == true) then
  51.         player:Dismount()
  52.     end
  53.     player:AddAura(SILITHYST_SPELL, -1)
  54.     go:Despawn(1, 360000) -- These respawn timers are not exact perhaps. I have no idea what is the blizzlike value. Set to 5 min.
  55. else
  56.     go:Despawn(1, 360000) -- These respawn timers are not exact perhaps. I have no idea what is the blizzlike value. Set to 5 min.
  57. end
  58. end
  59.  
  60. function SilithusZoneReturn(event, player, AreaTriggerId)
  61. local zoneid = player:GetZoneId()
  62. if (zoneid == ZONE_SILITHUS) then
  63.     local PLRrace = player:GetTeam()
  64.     if (AreaTriggerId == ALLIANCE_RETURN) then
  65.         if (player:HasAura(SILITHYST_SPELL) == true) then
  66.             if (PLRrace == 0)then -- If horde are not winners yet
  67.             if (captureHORDE < TOTAL_COUNT_VAL)then
  68.                 player:RemoveAura(SILITHYST_SPELL)
  69.                 if player:HasAura(TRACES_OF_SILITHYST) then
  70.                     player:RemoveAura(TRACES_OF_SILITHYST)
  71.                 end
  72.                 player:CastSpell(TRACES_OF_SILITHYST)
  73.                 if (player:GetQuestObjectiveCompletion(ALLIANCE_QUEST, 0) == 0) then
  74.                     player:AdvanceQuestObjective(ALLIANCE_QUEST, 0)
  75.                 end
  76.                 local repA = player:GetStanding(REPUTATION_FACTION)
  77.                 if (repA < 42000) then
  78.                     player:SetStanding(REPUTATION_FACTION, repA + REPUTATION_VALUE)
  79.                 end
  80.                 player:GiveHonor(HONOR_VALUE)
  81.                 if (captureALLIANCE == nil) then
  82.                     captureALLIANCE = 0
  83.                 end
  84.                 local captureALLIANCE1 = (captureALLIANCE + 1)
  85.                 if (captureALLIANCE1 < TOTAL_COUNT_VAL) then
  86.                     player:SetWorldStateForZone(ALLIANCE_COUNT, captureALLIANCE1)
  87.                     captureALLIANCE = captureALLIANCE1
  88.                 elseif (captureALLIANCE1 == TOTAL_COUNT_VAL) then
  89.                     player:SetWorldStateForZone(ALLIANCE_COUNT, TOTAL_COUNT_VAL)
  90.                     captureALLIANCE = TOTAL_COUNT_VAL
  91.                     for k,v in pairs(GetPlayersInWorld()) do
  92.                         if (v:GetZoneId() == ZONE_SILITHUS) then
  93.                             if (v:GetTeam() == 0) then
  94.                                 v:AddAura(SPELL_CENARION_FAVOR, 0)
  95.                             end
  96.                         end
  97.                     end
  98.                 end
  99.             end
  100.             end
  101.         end
  102.     elseif(AreaTriggerId == HORDE_RETURN) then
  103.     if (player:HasAura(SILITHYST_SPELL) == true) then
  104.             if (PLRrace == 1)then
  105.             if (captureALLIANCE < TOTAL_COUNT_VAL)then -- If alliance are not winners yet
  106.                 player:RemoveAura(SILITHYST_SPELL)
  107.                 if player:HasAura(TRACES_OF_SILITHYST) then
  108.                     player:RemoveAura(TRACES_OF_SILITHYST)
  109.                 end
  110.                 player:CastSpell(TRACES_OF_SILITHYST)
  111.                 if (player:GetQuestObjectiveCompletion(HORDE_QUEST, 0) == 0) then
  112.                     player:AdvanceQuestObjective(HORDE_QUEST, 0)
  113.                 end
  114.                 local repH = player:GetStanding(REPUTATION_FACTION)
  115.                 if (repH < 42000) then
  116.                     player:SetStanding(REPUTATION_FACTION, repH + REPUTATION_VALUE)
  117.                 end
  118.                 player:GiveHonor(HONOR_VALUE)
  119.                 if (captureHORDE == nil) then
  120.                     captureHORDE = 0
  121.                 end
  122.                 local captureHORDE1 = (captureHORDE + 1)
  123.                 if (captureHORDE1 < TOTAL_COUNT_VAL) then
  124.                     player:SetWorldStateForZone(HORDE_COUNT, captureHORDE1)
  125.                     captureHORDE = captureHORDE1
  126.                 elseif (captureHORDE1 == TOTAL_COUNT_VAL) then
  127.                     player:SetWorldStateForZone(HORDE_COUNT, TOTAL_COUNT_VAL)
  128.                     captureHORDE = TOTAL_COUNT_VAL
  129.                     for k,v in pairs(GetPlayersInWorld()) do
  130.                         if (v:GetZoneId() == ZONE_SILITHUS) then
  131.                             if (v:GetTeam() == 1) then
  132.                                 v:AddAura(SPELL_CENARION_FAVOR, 0)
  133.                             end
  134.                         end
  135.                     end
  136.                 end
  137.                 end
  138.             end
  139.         end
  140.     end
  141. end
  142. end
  143.  
  144. function OnZoneSI(event, player, ZoneId, OldZoneId)
  145. local PlayerZone = player:GetZoneId() -- Am i in Silithus?
  146. local team = player:GetTeam() -- What team am i? (alliance = 0, horde = 1)
  147. if (PlayerZone == ZONE_SILITHUS) then
  148.     player:SetWorldStateForZone(TOTAL_COUNT, TOTAL_COUNT_VAL)
  149.     if (team == 1) then
  150.         if (captureHORDE == TOTAL_COUNT_VAL) then
  151.             if (player:HasAura(SPELL_CENARION_FAVOR) == false) then
  152.                 player:AddAura(SPELL_CENARION_FAVOR, 0)
  153.             end
  154.         else
  155.             if (player:HasAura(SPELL_CENARION_FAVOR) == true) then
  156.                 player:RemoveAura(SPELL_CENARION_FAVOR)
  157.             end
  158.         end
  159.     elseif (team == 0) then
  160.         if (captureALLIANCE == TOTAL_COUNT_VAL) then
  161.             if (player:HasAura(SPELL_CENARION_FAVOR) == false) then
  162.                 player:AddAura(SPELL_CENARION_FAVOR, 0)
  163.             end
  164.         else
  165.             if (player:HasAura(SPELL_CENARION_FAVOR) == true) then
  166.                 player:RemoveAura(SPELL_CENARION_FAVOR)
  167.             end
  168.         end
  169.     end
  170. end
  171. end
  172.  
  173. function OnSiJoin(event, player)
  174. local team = player:GetTeam()
  175. local logzone = player:GetZoneId()
  176. if (logzone == ZONE_SILITHUS) then
  177.     player:SetWorldStateForZone(TOTAL_COUNT, TOTAL_COUNT_VAL)
  178.         if (team == 1) then
  179.         if (captureHORDE == TOTAL_COUNT_VAL) then
  180.             if (player:HasAura(SPELL_CENARION_FAVOR) == false) then
  181.                 player:AddAura(SPELL_CENARION_FAVOR, 0)
  182.             end
  183.         else
  184.             if (player:HasAura(SPELL_CENARION_FAVOR) == true) then
  185.                 player:RemoveAura(SPELL_CENARION_FAVOR)
  186.             end
  187.         end
  188.     elseif (team == 0) then
  189.         if (captureALLIANCE == TOTAL_COUNT_VAL) then
  190.             if (player:HasAura(SPELL_CENARION_FAVOR) == false) then
  191.                 player:AddAura(SPELL_CENARION_FAVOR, 0)
  192.             end
  193.         else
  194.             if (player:HasAura(SPELL_CENARION_FAVOR) == true) then
  195.                 player:RemoveAura(SPELL_CENARION_FAVOR)
  196.             end
  197.         end
  198.     end
  199. end
  200. end
  201.  
  202. RegisterGameObjectEvent(SILITHYST_MOUND, 4, SilithysMound_OnUse)
  203. RegisterGameObjectEvent(SILITHYST_GEYSER, 4, SilithysGeyser_OnUse)
  204. RegisterServerHook(26, SilithusZoneReturn)
  205. RegisterServerHook(15, OnZoneSI)
  206. RegisterServerHook(4, OnSiJoin)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement