Advertisement
Guest User

Keep Claimed Fix

a guest
May 24th, 2022
163
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 135.88 KB | None | 0 0
  1. if not RoR_SoR then RoR_SoR= {} end
  2. local version = 124
  3. local ZoneLockTimer = 10
  4. local RoR_Window_Scale
  5.  
  6. local c_DEFAULT_HIDE_TIMER = 1.0
  7. local c_DEFAULT_FADEIN_TIMER = 0.3
  8. local c_DEFAULT_FADEOUT_TIMER = 0.3
  9.  
  10. local SEND_BEGIN = 1
  11. local SEND_FINISH = 2
  12.  
  13. local HasReloaded = false
  14.  
  15. local PopConvert = {["Scouts"]=L"0-9",["Parties"]=L"10-24",["Warbands"]=L"25-99",["Vanguard"]=L"100-199",["Battlehost"]=L"200-299",["Warhost"]=L"300+"}
  16.  
  17. Popper = {m_HideCountdown = c_DEFAULT_HIDE_TIMER, m_IsShowing = false,}
  18.  
  19. RoR_SoR.StateTimer = 2
  20. RoR_SoR.DebugKeep = false
  21. RoR_SoR.DebugBO = false
  22. RoR_SoR.RealmColors = {{r=155,g=155,b=155},{r=107,g=191,b=255},{r=255,g=105,b=105},{r=75,g=75,b=255},{r=255,g=25,b=25}}
  23. RoR_SoR.FortColors = {{r=155,g=155,b=155},{r=75,g=75,b=255},{r=255,g=25,b=25}}
  24. RoR_SoR.InvFortColors = {{r=155,g=155,b=155},{r=255,g=25,b=25},{r=75,g=75,b=255}}
  25. RoR_SoR.CappingRealmColors = {{r=255,g=255,b=255},{r=255,g=105,b=105},{r=107,g=191,b=255}}
  26. RoR_SoR.T4_ActiveZones = {[3]=1,[5]=2,[9]=3,[103]=1,[105]=2,[109]=3,[209]=3,[205]=2,[203]=1}
  27. RoR_SoR.Forts = {[4]=2,[10]=1,[104]=2,[110]=1,[204]=2,[210]=1}
  28. RoR_SoR.FortBG = {{10,4},{110,104},{210,204}}
  29. RoR_SoR.City = {[161]=2,[162]=1}
  30. RoR_SoR.CityCampaign = {[161]=4,[162]=3}
  31. RoR_SoR.Ram = {[1] = "RamOrder",[2] = "RamDestruction"}
  32. RoR_SoR.KeepLord = {[1] = "SoR_LordIcon",[2] = "SoR_LordIcon"}
  33. RoR_SoR.FortLord = {[1] = "Lord_1",[2] = "Lord_2"}
  34. RoR_SoR.ZoneNames = {[1]={1,7},[2]={2,8},[3]={3,3},[4]={4,4},[5]={5,5},[6]={6,11},[7]={1,7},[8]={2,8},[9]={9,9},[10]={10,10},[11]={6,11},[100]={100,106},[101]={107,101},[102]={102,108},[103]={103,103},[104]={104,108},[105]={105,105},[106]={100,106},[107]={107,101},[108]={102,108},[109]={109,109},[110]={110,110},[200]={200,206},[201]={207,201},[202]={202,208},[203]={203,203},[204]={204,204},[205]={205,205},[206]={200,206},[207]={207,201},[208]={202,208},[209]={209,209},[210]={210,210}}
  35. RoR_SoR.TierNames = {[1]={006,011,100,106,200,206},[2]={001,007,101,107,201,207},[3]={002,008,102,108,202,208},[4]={003,005,009,103,105,109,209,205,203}}
  36. RoR_SoR.ParingPortrait = {[1] = "PairingElvesSelected",[2] = "PairingEvCSelected",[3]="PairingGvDSelected"}
  37. RoR_SoR.KeepStatus = {}
  38.  
  39. RoR_SoR.KeepHealth = {}
  40. RoR_SoR.ZoneStatus = {}
  41. RoR_SoR.KeepProgress = {[1]={},[2]={}}
  42. RoR_SoR.Pairings = {[1]={},[2]={},[3]={},[161]={},[162]={}}
  43. RoR_SoR.NumberWindows = {}
  44. --Number_Window_Template
  45.  
  46.  
  47. if not RoR_SoR.City_Status then RoR_SoR.City_Status = {} end
  48.  
  49. RoR_SoR.SafeKeep = {}
  50.  
  51.  
  52. RoR_SoR.TextLock = towstring(GetStringFromTable("MapSystem", StringTables.MapSystem.TEXT_CAMPAIGN_PAIRING_LOCKED ) )
  53. RoR_SoR.TextZoneLocked =    towstring(GetStringFromTable("Hardcoded", 1268))
  54. RoR_SoR.TextTaken = towstring(GetStringFromTable("Hardcoded", 274))
  55.  
  56. RoR_SoR.TextNeutral = towstring(GetStringFromTable("Default", StringTables.Default.LABEL_UNCONTROLLED ) )
  57. RoR_SoR.TextOrder = towstring(GetStringFromTable("Default", StringTables.Default.LABEL_UNCONTROLLED ) )
  58. RoR_SoR.TextDestro = towstring(GetStringFromTable("Default", StringTables.Default.LABEL_ORDER_CONTROLLED ) )
  59.  
  60.  
  61. RoR_SoR.PairingIconSliceNames = {}
  62. RoR_SoR.PairingIconSliceNames[GameData.Pairing.GREENSKIN_DWARVES] = {}
  63. RoR_SoR.PairingIconSliceNames[GameData.Pairing.GREENSKIN_DWARVES][GameData.Realm.ORDER] = "Order-Dwarf"
  64. RoR_SoR.PairingIconSliceNames[GameData.Pairing.GREENSKIN_DWARVES][GameData.Realm.DESTRUCTION] = "Dest-Greenskin"
  65. RoR_SoR.PairingIconSliceNames[GameData.Pairing.GREENSKIN_DWARVES][GameData.Realm.NONE] = "CONTESTED"
  66. RoR_SoR.PairingIconSliceNames[GameData.Pairing.EMPIRE_CHAOS] = {}
  67. RoR_SoR.PairingIconSliceNames[GameData.Pairing.EMPIRE_CHAOS][GameData.Realm.ORDER] = "Order-Empire"
  68. RoR_SoR.PairingIconSliceNames[GameData.Pairing.EMPIRE_CHAOS][GameData.Realm.DESTRUCTION] = "Dest-Chaos"
  69. RoR_SoR.PairingIconSliceNames[GameData.Pairing.EMPIRE_CHAOS][GameData.Realm.NONE] = "CONTESTED"
  70. RoR_SoR.PairingIconSliceNames[GameData.Pairing.ELVES_DARKELVES] = {}
  71. RoR_SoR.PairingIconSliceNames[GameData.Pairing.ELVES_DARKELVES][GameData.Realm.ORDER] = "Order-HighElf"
  72. RoR_SoR.PairingIconSliceNames[GameData.Pairing.ELVES_DARKELVES][GameData.Realm.DESTRUCTION] = "Dest-DarkElf"
  73. RoR_SoR.PairingIconSliceNames[GameData.Pairing.ELVES_DARKELVES][GameData.Realm.NONE] = "CONTESTED"
  74.  
  75.  
  76. function RoR_SoR.OnInitialize()
  77. --This is for debugging
  78. RoR_SoR.Debug_T2_BO_Texts = {[1]=L"StreamName: ",[2]=L"ZoneID: ",[3]=L"BO1_ID: ",[4]=L"BO1_OWNER: ",[5]=L"BO1_STATE: ",[6]=L"BO1_TIMER: ",[7]=L"BO2_ID: ",
  79.                         [8]=L"BO2_OWNER: ",[9]=L"BO2_STATE: ",[10]=L"BO2_TIMER: ",[11]=L"BO3_ID: ",[12]=L"BO3_OWNER: ",[13]=L"BO3_STATE: ",[14]=L"BO3_TIMER: ",
  80.                         [15]=L"BO4_ID: ",[16]=L"BO4_OWNER: ",[17]=L"BO4_STATE: ",[18]=L"BO4_TIMER: ",[19]=L"VP's: ",[20]=L"Supply: ",[21]=L"Guilds: "}
  81.  
  82. RoR_SoR.Debug_T3_BO_Texts = {[1]=L"StreamName: ",[2]=L"ZoneID: ",[3]=L"BO1_ID: ",[4]=L"BO1_OWNER: ",[5]=L"BO1_STATE: ",[6]=L"BO1_TIMER: ",[7]=L"BO2_ID: ",
  83.                         [8]=L"BO2_OWNER: ",[9]=L"BO2_STATE: ",[10]=L"BO2_TIMER: ",[11]=L"BO3_ID: ",[12]=L"BO3_OWNER: ",[13]=L"BO3_STATE: ",[14]=L"BO3_TIMER: ",
  84.                         [15]=L"BO4_ID: ",[16]=L"BO4_OWNER: ",[17]=L"BO4_STATE: ",[18]=L"BO4_TIMER: ",[19]=L"VP's: ",[20]=L"Supply: ",[21]=L"Guilds: ",[22]=L"ACTIVE_ZONE: "}                       
  85.  
  86.                        
  87. RoR_SoR.Debug_T2_KEEP_Texts = {[1]=L"StreamName: ",[2]=L"ZoneID: ",[3]=L"KEEP1_ID: ",[4]=L"KEEP1_RANK: ",[5]=L"KEEP1_OWNER: ",[6]=L"KEEP1_STATUS: ",[7]=L"KEEP1_MESSAGE: ",
  88.                         [8]=L"KEEP_1_CLAIMED: ",[9]=L"KEEP_1_INNER: ",[10]=L"KEEP_1_LORD: ",[11]=L"KEEP1_??: ",[12]=L"KEEP2_ID: ",[13]=L"KEEP2_RANK: ",[14]=L"KEEP2_OWNER: ",[15]=L"KEEP2_STATUS: ",
  89.                         [16]=L"KEEP2_MESSAGE: ",[17]=L"KEEP_2_CLAIMED: ",[18]=L"KEEP_2_INNER_DOOR: ",[19]=L"KEEP_2_LORD: ",[20]=L"KEEP2_??: ",[21]=L"AAO: "}
  90.  
  91. RoR_SoR.Debug_T3_KEEP_Texts = {[1]=L"StreamName: ",[2]=L"ZoneID: ",[3]=L"KEEP1_ID: ",[4]=L"KEEP1_OWNER: ",[5]=L"KEEP1_RANK: ",[6]=L"KEEP1_STATUS: ",[7]=L"KEEP1_MESSAGE: ",
  92.                         [8]=L"KEEP_1_OUTER: ",[9]=L"KEEP_1_INNER: ",[10]=L"KEEP_1_LORD: ",[11]=L"KEEP_1_CLAIMED: ",[12]=L"KEEP2_ID: ",[13]=L"KEEP2_OWNER: ",[14]=L"KEEP2_RANK: ",[15]=L"KEEP2_STATUS: ",
  93.                         [16]=L"KEEP2_MESSAGE: ",[17]=L"KEEP_2_OUTER_DOOR: ",[18]=L"KEEP_2_INNER_DOOR: ",[19]=L"KEEP_2_LORD: ",[20]=L"KEEP_2_CLAIMED: ",[21]=L"ACTIVE_ZONE: ",[22]=L"AAO: ",[23]=L"Order Pop: ",[24]=L"Destro Pop: "}                       
  94.                        
  95. RoR_SoR.Debug_KEEP_STATUS = {[1]=L"KEEPSTATUS_SAFE",[2]=L"KEEPSTATUS_OUTER_WALLS_UNDER_ATTACK",[3]=L"KEEPSTATUS_INNER_SANCTUM_UNDER_ATTACK",[4]=L"KEEPSTATUS_KEEP_LORD_UNDER_ATTACK",
  96.                             [5]=L"KEEPSTATUS_SEIZED",[6]=L"KEEPSTATUS_LOCKED"}                     
  97.                        
  98. RoR_SoR.Debug_KEEP_MESSAGE = {[0]=L"Safe",[1]=L"Outer75",[2]=L"Outer50",[3]=L"Outer20",[4]=L"Outer0",[5]=L"Inner75",[6]=L"Inner50",[7]=L"Inner20",[8]=L"Inner0",[9]=L"Lord100",[10]=L"Lord50",[11]=L"Lord20",[12]=L"Fallen"}           
  99.  
  100. RoR_SoR.CITY_MESSAGE = {[1]=L"No Siege Active",[2]=L"city siege about to start",[3]=L"Signup for sieges",[4]=L"DEFENDED",[5]=L"ATTACKERS WIN",[8]=L"Sieges active, signup closed",[10]=L"Siege fully ended"}           
  101.  
  102. CreateWindow("RoR_SoR_Main_Window", false)
  103. CreateWindow("RoR_SoR_Opacity", false)
  104. CreateWindow("RoR_SoR_Scale", false)
  105. CreateWindow("RoR_SoR_Offset", false)
  106. CreateWindow("RoR_SoR_Popper", false)
  107. CreateWindow("RoR_SoR_Button", true)
  108.  
  109.  
  110. LayoutEditor.RegisterWindow( "RoR_SoR_Main_Window", L"SoR Anchor Window", L"SoR Anchor Window", true, true, true, nil )
  111. LayoutEditor.RegisterWindow( "RoR_SoR_Button", L"SoR Toggle Button", L"SoR Toggle Button", false, false, false, nil )  
  112.  
  113. TextLogAddEntry("Chat", 0, L"<icon00057> RoR_SoR "..towstring(version)..L" Loaded.")
  114. LabelSetText("RoR_SoR_PopperLabel",L"State of Realm")
  115.    
  116. RoR_Window_Scale = (tonumber(WindowGetScale("RoR_SoR_Main_Window")))
  117. RoR_Window_Alpha = (tonumber(WindowGetAlpha("RoR_SoR_Main_Window")))
  118.  
  119. RoR_SoR.Timers = {}
  120. RoR_SoR.OpenZones = {}
  121. RoR_SoR.ZoneTimer = {}
  122. RoR_SoR.BO_States = {}
  123. RoR_SoR.BO_IDs = {}
  124. RoR_SoR.KEEP_States = {}
  125. RoR_SoR.KEEP_IDs = {}
  126. RoR_SoR.HideChannel(65)
  127. RoR_SoR.Fort = {}
  128.  
  129. if not RoR_SoR.Settings then RoR_SoR.DefaultSettings() end 
  130.  
  131. if (not RoR_SoR.Settings.Version) or (RoR_SoR.Settings.Version < version) then RoR_SoR.DefaultSettings() end
  132.  
  133.     if (LibSlash ~= nil) then
  134.     LibSlash.RegisterSlashCmd("soroffset", function(input) RoR_SoR.Offset(input) end)
  135.     end
  136.  
  137. WindowSetScale("RoR_SoR_Popper",RoR_Window_Scale)
  138. WindowSetShowing("RoR_SoR_ButtonCombat",false)
  139.  
  140. RoR_SoR.HideChannel(65)
  141. local siegeWindow = "SiegeWeaponGeneralFireWindowChatLogDisplay"
  142. LogDisplaySetFilterState(siegeWindow, "Chat", 65, false)
  143.  
  144. if(GameData.Player.career.line>0)
  145.   then
  146.     RoR_SoR:RegisterSelfEvents()
  147.   else
  148.     RegisterEventHandler(SystemData.Events.LOADING_END,"RoR_SoR.OnLoadingEnd")
  149.   end
  150.  
  151. RoR_SoR.stateMachineName = "RoR_SoR"
  152. RoR_SoR.state = {[SEND_BEGIN] = { handler=nil,time=RoR_SoR.StateTimer,nextState=SEND_FINISH } , [SEND_FINISH] = { handler=RoR_SoR.CheckCampaign,time=RoR_SoR.StateTimer,nextState=SEND_BEGIN, } , }
  153. RoR_SoR.StartMachine()
  154.  
  155. --if the RoR_CitySiege table can't be found due to a reloadui, load the current city-rating timer from the backup save and set flag HasRealoded (will persist untill it get response from valid RoR_CitySiege table)
  156. if RoR_CitySiege.GetCity(GameData.CityId.EMPIRE) == nil or RoR_CitySiege.GetCity(GameData.CityId.CHAOS) == nil then
  157.     RoR_SoR.Pairings[162].Timer = RoR_SoR.City_Status[GameData.CityId.EMPIRE].ratingTimer
  158.     RoR_SoR.Pairings[161].Timer = RoR_SoR.City_Status[GameData.CityId.CHAOS].ratingTimer
  159.    
  160.     RoR_SoR.Pairings[162].Timer2 = RoR_SoR.City_Status[GameData.CityId.EMPIRE].timeLeft
  161.     RoR_SoR.Pairings[161].Timer2 = RoR_SoR.City_Status[GameData.CityId.CHAOS].timeLeft
  162.    
  163.     HasReloaded = true
  164. end
  165.  
  166. RoR_SoR.Restack()
  167. end
  168.  
  169. function RoR_SoR:RegisterSelfEvents()
  170. RegisterEventHandler( SystemData.Events.ENTER_WORLD, "RoR_SoR.Enable" )
  171. RegisterEventHandler( SystemData.Events.INTERFACE_RELOADED, "RoR_SoR.Enable" )
  172. RegisterEventHandler(SystemData.Events.ALL_MODULES_INITIALIZED, "RoR_SoR.Enable")
  173.  
  174.  
  175. RegisterEventHandler(SystemData.Events.SCENARIO_END, "RoR_SoR.OnScenario")
  176. RegisterEventHandler(SystemData.Events.SCENARIO_BEGIN, "RoR_SoR.OnScenario")
  177.  
  178. RegisterEventHandler(  SystemData.Events.PUBLIC_QUEST_ADDED,   "RoR_SoR.UpdateObjectives")
  179. RegisterEventHandler(  SystemData.Events.PUBLIC_QUEST_UPDATED, "RoR_SoR.UpdateObjectives")
  180. RegisterEventHandler(  SystemData.Events.PUBLIC_QUEST_INFO_UPDATED, "RoR_SoR.UpdateObjectives")
  181. RegisterEventHandler(  SystemData.Events.PUBLIC_QUEST_REMOVED, "RoR_SoR.UpdateObjectives")
  182.  
  183. --RegisterEventHandler( SystemData.Events.PLAYER_COMBAT_FLAG_UPDATED, "RoR_SoR.OnCombat" )                     
  184. RegisterEventHandler(TextLogGetUpdateEventId("Chat"), "RoR_SoR.OnChatLogUpdated")
  185. RoR_SoR.Enable()
  186.  
  187. end
  188.  
  189. function RoR_SoR:OnLoadingEnd()
  190.   --register events
  191.   RoR_SoR:RegisterSelfEvents()
  192.   UnregisterEventHandler(SystemData.Events.LOADING_END,"RoR_SoR.OnLoadingEnd")
  193. end
  194.  
  195. function RoR_SoR.StartMachine()
  196.     local stateMachine = TimedStateMachine.New( RoR_SoR.state,SEND_BEGIN)
  197.     TimedStateMachineManager.AddStateMachine( RoR_SoR.stateMachineName, stateMachine )
  198. end
  199.  
  200. function RoR_SoR.CheckCampaign()
  201. --if WindowGetShowing("RoR_SoR_Main_Window") or RoR_SoR.Settings.Enabled == false then return end
  202.  
  203. if RoR_SoR.Settings.ShowPairings == true then
  204.     for k,v in pairs(RoR_SoR.Forts) do
  205.     local CampaignData = GetCampaignZoneData(k)
  206.         if CampaignData.controllingRealm ~= 0 and CampaignData.controllingRealm ~= CampaignData.initialRealm then  
  207.         RoR_SoR.SET_PAIRINGS("SoR_:"..tostring(CampaignData.pairingId)..":"..tostring(CampaignData.controllingRealm))
  208.         end
  209.     end
  210. end
  211.  
  212.  
  213. if RoR_SoR.Settings.ShowCity == true then --contested City siege
  214.     --/script RoR_SoR.SET_CITY(StringSplit(tostring("SoR_C:162:1:10:8:2:100:3"),":"))
  215.     local SiegedRealm = 0
  216.     local cityData = {}
  217.     cityData[GameData.CityId.EMPIRE] = GetCampaignCityData(GameData.CityId.EMPIRE)
  218.     cityData[GameData.CityId.CHAOS] = GetCampaignCityData(GameData.CityId.CHAOS)
  219.     if cityData[GameData.CityId.EMPIRE].controllingRealm ~= cityData[GameData.CityId.EMPIRE].initialRealm then
  220.         local SiegeData = RoR_SoR.City_Status[GameData.CityId.EMPIRE]
  221.         local CityRank = GetCityRatingForCityId(GameData.CityId.EMPIRE)
  222.         if SiegeData ~= nil then
  223.        
  224.         local SoR_CITY_SPLIT_TEXT_STREAM = StringSplit(tostring("SoR_C:162:"..tostring(cityData[GameData.CityId.EMPIRE].cityState)..":"..tostring(SiegeData.instanceCount)..":"..tostring(SiegeData.destroWins)..":"..tostring(SiegeData.orderWins)..":"..tostring(SiegeData.timeLeft))..":"..tostring(CityRank), ":")
  225.         RoR_SoR.SET_CITY(SoR_CITY_SPLIT_TEXT_STREAM)
  226.         SiegedRealm = 1
  227.         end
  228.         end
  229.     --if cityData[GameData.CityId.CHAOS].controllingRealm == 0 then
  230.     if cityData[GameData.CityId.CHAOS].controllingRealm ~= cityData[GameData.CityId.CHAOS].initialRealm then
  231.         local SiegeData = RoR_SoR.City_Status[GameData.CityId.CHAOS]
  232.         local CityRank = GetCityRatingForCityId(GameData.CityId.CHAOS)
  233.         if SiegeData ~= nil then
  234.            
  235.         local SoR_CITY_SPLIT_TEXT_STREAM = StringSplit(tostring("SoR_C:161:"..tostring(cityData[GameData.CityId.CHAOS].cityState)..":"..tostring(SiegeData.instanceCount)..":"..tostring(SiegeData.destroWins)..":"..tostring(SiegeData.orderWins)..":"..tostring(SiegeData.timeLeft))..":"..tostring(CityRank), ":")
  236.         RoR_SoR.SET_CITY(SoR_CITY_SPLIT_TEXT_STREAM)
  237.         SiegedRealm = 2
  238.         end
  239.         end
  240.  
  241. end
  242.     --Normal city status:
  243.     --Map_ID,Realm_ID,City_ID
  244.     if not DoesWindowExist("SoR_161") and  RoR_SoR.Settings.ShowCity_Status then
  245.         RoR_SoR.SET_CAMPAIGN("SoR_:161:2:4")
  246.     end
  247.    
  248.     if not DoesWindowExist("SoR_162") and RoR_SoR.Settings.ShowCity_Status then
  249.         RoR_SoR.SET_CAMPAIGN("SoR_:162:1:3")       
  250.     end
  251.    
  252.    
  253. end
  254.  
  255. function RoR_SoR.UpdateCardRewards(...)
  256. d(...)
  257. --input
  258. --[[
  259. local link = tostring(CreateHyperLink(towstring(input),L"", {0,0,0}, {} ))
  260.     if string.match(link,"LINK data=\"LFG:") then
  261.         local extractor = string.match(link,"LINK data=\"([^%.]+)\" text=.")
  262.         d(extractor)
  263.      end
  264. --]]     
  265.      
  266. end
  267.  
  268.  
  269. function RoR_SoR.OnShutdown()
  270.    
  271. UnregisterEventHandler(TextLogGetUpdateEventId("Chat"), "RoR_SoR.OnChatLogUpdated")
  272. UnregisterEventHandler( SystemData.Events.ENTER_WORLD, "RoR_SoR.Enable" )
  273. UnregisterEventHandler( SystemData.Events.INTERFACE_RELOADED, "RoR_SoR.Enable" )
  274.  
  275. UnregisterEventHandler(SystemData.Events.SCENARIO_END, "RoR_SoR.OnScenario")
  276. UnregisterEventHandler(SystemData.Events.SCENARIO_BEGIN, "RoR_SoR.OnScenario")
  277.  
  278. UnregisterEventHandler(  SystemData.Events.PUBLIC_QUEST_ADDED,   "RoR_SoR.UpdateObjectives")
  279. UnregisterEventHandler(  SystemData.Events.PUBLIC_QUEST_UPDATED, "RoR_SoR.UpdateObjectives")
  280. UnregisterEventHandler(  SystemData.Events.PUBLIC_QUEST_INFO_UPDATED, "RoR_SoR.UpdateObjectives")
  281. UnregisterEventHandler(  SystemData.Events.PUBLIC_QUEST_REMOVED, "RoR_SoR.UpdateObjectives")
  282.        
  283. end
  284.  
  285. function RoR_SoR.OnChatLogUpdated(updateType, filterType)
  286.     if WindowGetShowing("RoR_SoR_Main_Window") == true then
  287.         if( updateType == SystemData.TextLogUpdate.ADDED ) then            
  288.             if filterType == SystemData.ChatLogFilters.CHANNEL_9 then  
  289.                 local _, filterId, text = TextLogGetEntry( "Chat", TextLogGetNumEntries("Chat") - 1 )
  290.                 RoR_SoR.Text_Stream_Fetch(text)
  291.             end
  292.         end
  293.     end
  294. end
  295.  
  296. function RoR_SoR.GetBanner()
  297.     if RoR_SoR.Settings.DrawBanner then return -3 else return 6 end
  298. end    
  299.  
  300. function RoR_SoR.GetParing(zone)
  301. local zone = tonumber(zone)
  302.     if (zone/200 >= 1) then
  303.         return 1
  304.     elseif (zone/100 >= 1) then
  305.         return 2
  306.     else
  307.         return 3
  308.     end
  309. return false
  310. end
  311.  
  312. function RoR_SoR.Enable()
  313.  
  314. if RoR_SoR.Settings.Enabled == true then
  315.  
  316. local ShowT1 = L""
  317. local ShowT4 = L""
  318. local ShowForts = L""
  319. if RoR_SoR.Settings.ShowT1 == true then ShowT1 = L" T1" end
  320. if RoR_SoR.Settings.ShowT4 == true then ShowT4 = L" T4" end
  321. if RoR_SoR.Settings.ShowForts == true then ShowForts = L" Forts" end
  322.  
  323. SendChatText(L".sorenable"..ShowT1..ShowT4..ShowForts,ChatSettings.Channels[0].serverCmd)
  324. RoR_SoR.Restack()
  325. elseif RoR_SoR.Settings.Enabled == false then
  326. --[[
  327. local HideT1 = L""
  328. local HideT4 = L""
  329. local HideFort = L""
  330. if RoR_SoR.Settings.ShowT1 == false then HideT1 = L" T1" end
  331. if RoR_SoR.Settings.ShowT4 == false then HideT4 = L" T4" end
  332. if RoR_SoR.Settings.ShowFort == false then HideFort = L" Forts" end
  333.  
  334. SendChatText(L".sordisable"..HideT1..HideT4..HideFort,ChatSettings.Channels[0].serverCmd)
  335. --]]
  336. SendChatText(L".sordisable",ChatSettings.Channels[0].serverCmd)
  337. RoR_SoR.Restack()
  338. end
  339.  
  340. end
  341.  
  342. function RoR_SoR.Disable()
  343. local HideT1 = L""
  344. local HideT4 = L""
  345. local HideForts = L""
  346. if RoR_SoR.Settings.ShowT1 == false then HideT1 = L" T1" end
  347. if RoR_SoR.Settings.ShowT4 == false then HideT4 = L" T4" end
  348. if RoR_SoR.Settings.ShowForts == false then HideForts = L" Forts" end
  349. SendChatText(L".sordisable"..HideT1..HideT4..HideForts,ChatSettings.Channels[0].serverCmd)
  350. RoR_SoR.Restack()
  351. return
  352. end
  353.  
  354.  
  355. function RoR_SoR.Text_Stream_Fetch(text)
  356. local text = towstring(text)
  357.  
  358.     if text:find(L"SoR_") and (not text:find(L"SoR_F")) then
  359.         --Check For BO stream
  360.         if text:match( L"SoR_+[^%.]+_BO:([^%.]+).") then   
  361.         local SoR_BO_SPLIT_TEXT_STREAM = StringSplit(tostring(text), ":")
  362.         if SoR_BO_SPLIT_TEXT_STREAM[15] == nil then return end -- check and exit if short string
  363.         --Create window if not exist
  364.             local Window_Name = tostring(SoR_BO_SPLIT_TEXT_STREAM[2])
  365.  
  366.             --Setup Tier 4 BO zone stuff
  367.             if (SoR_BO_SPLIT_TEXT_STREAM[1] == "SoR_T4_BO") and (RoR_SoR.Settings.ShowT4 == true) then         
  368.                 local Fetch_Active_Zone = tonumber(SoR_BO_SPLIT_TEXT_STREAM[22])
  369.                     if (not DoesWindowExist("SoR_"..Window_Name)) then
  370.                         CreateWindowFromTemplate("SoR_"..Window_Name, "RoR_SoR_RealmTemplate", "Root")
  371.                             RoR_SoR.BO_States[Window_Name] = {}
  372.                             RoR_SoR.KEEP_States[Window_Name] = {}
  373.                             RoR_SoR.KeepHealth[Window_Name] = {[1]=0,[2]=0}
  374.                             local ZoneData = GetCampaignZoneData(tonumber(Window_Name))
  375.                             RoR_SoR.OpenZones[Window_Name] =  tonumber(ZoneData.tierId)
  376.                         LabelSetText("SoR_"..Window_Name.."_BannerLabel",towstring(GetZoneName(tonumber(Window_Name))))
  377.                         LabelSetText("SoR_"..Window_Name.."_BannerLabel_BG",towstring(GetZoneName(tonumber(Window_Name))))                     
  378.                         LabelSetTextColor("SoR_"..Window_Name.."_BannerLabel",255,255,255)
  379.                         local BannerW,_ = LabelGetTextDimensions("SoR_"..Window_Name.."_BannerLabel")
  380.                         WindowSetDimensions( "SoR_"..Window_Name.."BannerMid", BannerW, 40 )   
  381.                     end
  382.             --Setup Tier 1 BO zone stuff   
  383.             elseif  (SoR_BO_SPLIT_TEXT_STREAM[1] == "SoR_T1_BO") and (RoR_SoR.Settings.ShowT1 == true) then
  384.                 if (not DoesWindowExist("SoR_"..Window_Name)) then     
  385.                     CreateWindowFromTemplate("SoR_"..Window_Name, "RoR_SoR_RealmTemplate", "Root")
  386.                     RoR_SoR.BO_States[Window_Name] = {}
  387.                     local ZoneData = GetCampaignZoneData(tonumber(Window_Name))
  388.                     RoR_SoR.OpenZones[Window_Name] =  tonumber(ZoneData.tierId)
  389.                     LabelSetText("SoR_"..Window_Name.."_BannerLabel",towstring(GetZoneName(RoR_SoR.ZoneNames[tonumber(Window_Name)][1]))..L" · "..towstring(GetZoneName(RoR_SoR.ZoneNames[tonumber(Window_Name)][2])))
  390.                     LabelSetText("SoR_"..Window_Name.."_BannerLabel_BG",towstring(GetZoneName(RoR_SoR.ZoneNames[tonumber(Window_Name)][1]))..L" · "..towstring(GetZoneName(RoR_SoR.ZoneNames[tonumber(Window_Name)][2]))) 
  391.                     LabelSetTextColor("SoR_"..Window_Name.."_BannerLabel",255,255,255)
  392.                     local BannerW,_ = LabelGetTextDimensions("SoR_"..Window_Name.."_BannerLabel")
  393.                     WindowSetDimensions( "SoR_"..Window_Name.."BannerMid", BannerW, 40 )           
  394.                 end
  395.                 RoR_SoR.T1_UPDATE(Window_Name,SoR_BO_SPLIT_TEXT_STREAM)
  396.             --Setup Tier 2-3 BO zone stuff
  397.             elseif((SoR_BO_SPLIT_TEXT_STREAM[1] == "SoR_T2_BO") or (SoR_BO_SPLIT_TEXT_STREAM[1] == "SoR_T3_BO")) and (RoR_SoR.Settings.ShowT4 == true) then --Setup Tier 2 and 3 BO zone stuff
  398.                 if (not DoesWindowExist("SoR_"..Window_Name)) then     
  399.                     CreateWindowFromTemplate("SoR_"..Window_Name, "RoR_SoR_RealmTemplate", "Root")
  400.                     RoR_SoR.BO_States[Window_Name] = {}
  401.                     local ZoneData = GetCampaignZoneData(tonumber(Window_Name))
  402.                     RoR_SoR.OpenZones[Window_Name] =  tonumber(ZoneData.tierId)
  403.                     RoR_SoR.KEEP_States[Window_Name] = {}
  404.                     LabelSetText("SoR_"..Window_Name.."_BannerLabel",towstring(GetZoneName(RoR_SoR.ZoneNames[tonumber(Window_Name)][1]))..L" · "..towstring(GetZoneName(RoR_SoR.ZoneNames[tonumber(Window_Name)][2])))
  405.                     LabelSetText("SoR_"..Window_Name.."_BannerLabel_BG",towstring(GetZoneName(RoR_SoR.ZoneNames[tonumber(Window_Name)][1]))..L" · "..towstring(GetZoneName(RoR_SoR.ZoneNames[tonumber(Window_Name)][2]))) 
  406.                     LabelSetTextColor("SoR_"..Window_Name.."_BannerLabel",255,255,255)
  407.                     local BannerW,_ = LabelGetTextDimensions("SoR_"..Window_Name.."_BannerLabel")
  408.                     WindowSetDimensions( "SoR_"..Window_Name.."BannerMid", BannerW, 40 )                   
  409.                 end            
  410.             end    
  411.             if RoR_SoR.DebugBO == true then
  412.                 if SoR_BO_SPLIT_TEXT_STREAM[1] == "SoR_T4_BO" or SoR_BO_SPLIT_TEXT_STREAM[1] == "SoR_T3_BO" then
  413.                     d(SoR_BO_SPLIT_TEXT_STREAM)
  414.                 else
  415.                     d(SoR_BO_SPLIT_TEXT_STREAM)
  416.                 end
  417.             end
  418.         RoR_SoR.SET_BO(SoR_BO_SPLIT_TEXT_STREAM)
  419.  
  420.         --Check for KEEP stream
  421.         elseif text:match( L"SoR_+[^%.]+_Keep:([^%.]+).") then 
  422.             local SoR_KEEP_SPLIT_TEXT_STREAM = StringSplit(tostring(text), ":")
  423.             --if SoR_KEEP_SPLIT_TEXT_STREAM[10] == nil then return end
  424.                 if RoR_SoR.DebugKeep == true then                  
  425.                         d(SoR_KEEP_SPLIT_TEXT_STREAM)
  426.                 end
  427.             RoR_SoR.SET_KEEP(SoR_KEEP_SPLIT_TEXT_STREAM)
  428.         end
  429.     end
  430.    
  431.         --Check for Fort stream    
  432.         if text:find(L"SoR_F") and RoR_SoR.Settings.ShowForts == true  then
  433.         local SoR_FORT_SPLIT_TEXT_STREAM = StringSplit(tostring(text), ":")
  434.             if RoR_SoR.DebugKeep == true then          
  435.                     d(SoR_FORT_SPLIT_TEXT_STREAM)
  436.             end
  437.             RoR_SoR.SET_FORT(SoR_FORT_SPLIT_TEXT_STREAM)
  438.         end
  439.        
  440.         if text:find(L"SoR_C") and RoR_SoR.Settings.ShowForts == true  then
  441.         local SoR_FORT_SPLIT_TEXT_STREAM = StringSplit(tostring(text), ":")
  442.             if RoR_SoR.DebugKeep == true then
  443.                     d(SoR_FORT_SPLIT_TEXT_STREAM)
  444.            
  445.             end
  446.             RoR_SoR.SET_CITY(SoR_FORT_SPLIT_TEXT_STREAM)
  447.             end
  448.        
  449. end
  450.  
  451.  
  452. function RoR_SoR.SET_CAMPAIGN(Input)
  453.     local SoR_CAMPAIGN_SPLIT_TEXT_STREAM = Input
  454.  
  455.     if type(SoR_CAMPAIGN_SPLIT_TEXT_STREAM)~= "table" then
  456.         SoR_CAMPAIGN_SPLIT_TEXT_STREAM = StringSplit(SoR_CAMPAIGN_SPLIT_TEXT_STREAM,":")
  457.     end
  458.        
  459.     local Window_Name = "P_"..tostring(SoR_CAMPAIGN_SPLIT_TEXT_STREAM[2])
  460.     local Pairing_ID = tonumber(SoR_CAMPAIGN_SPLIT_TEXT_STREAM[2])
  461.     local Realm_ID = tonumber(SoR_CAMPAIGN_SPLIT_TEXT_STREAM[3])   
  462.     local City_ID = tonumber(SoR_CAMPAIGN_SPLIT_TEXT_STREAM[4])
  463.  
  464. --28800 max timer
  465.  
  466.     --check for valid RoR_CitySiege table
  467.     if RoR_CitySiege.GetCity(City_ID) ~= nil then
  468.             RoR_SoR.City_Status[City_ID] = RoR_CitySiege.GetCity(City_ID)          
  469.             RoR_SoR.Pairings[Pairing_ID].Timer = RoR_SoR.City_Status[City_ID].ratingTimer
  470.            
  471.        
  472.             RoR_SoR.Pairings[Pairing_ID].Timer2 = RoR_SoR.City_Status[City_ID].timeLeft
  473.             --HasReloaded = false
  474.     else       
  475.  
  476.     end
  477.  
  478.     if DoesWindowExist("SoR_"..Window_Name) then
  479.  
  480.     RoR_SoR.ZoneTimer[Window_Name] = ZoneLockTimer
  481.    
  482.     WindowClearAnchors("SoR_"..Window_Name.."Banner")
  483.     WindowAddAnchor("SoR_"..Window_Name.."Banner","top", "SoR_"..Window_Name, "top", 0,RoR_SoR.GetBanner())
  484.    
  485.     LabelSetText("SoR_"..Window_Name.."_BannerLabel",towstring(GetCityName(City_ID)))  
  486.     LabelSetText("SoR_"..Window_Name.."_BannerLabel_BG",towstring(GetCityName(City_ID)))
  487.  
  488.     local Color = RoR_SoR.RealmColors[Realm_ID+1]
  489.     local Sizes = {[true]=15,[false]=0}
  490.  
  491.     LabelSetText("SoR_"..Window_Name.."Lock_STATUS",TimeUtils.FormatTimeCondensed(RoR_SoR.Pairings[Pairing_ID].Timer))     
  492.     LabelSetText("SoR_"..Window_Name.."Lock_STATUS_BG",TimeUtils.FormatTimeCondensed(RoR_SoR.Pairings[Pairing_ID].Timer))  
  493.    
  494.     LabelSetText("SoR_"..Window_Name.."_TIMER",TimeUtils.FormatTimeCondensed(RoR_SoR.Pairings[Pairing_ID].Timer))
  495.     LabelSetText("SoR_"..Window_Name.."_TIMER_BG",TimeUtils.FormatTimeCondensed(RoR_SoR.Pairings[Pairing_ID].Timer))       
  496.  
  497.  
  498.     MapUtils.UpdateCityRatingWindow( City_ID, "SoR_"..Window_Name.."CityRating")
  499.        
  500.     WindowSetShowing("SoR_"..Window_Name.."Lock",RoR_SoR.Pairings[Pairing_ID].Timer2 > 0)
  501.     WindowSetShowing("SoR_"..Window_Name.."_TIMER",RoR_SoR.Pairings[Pairing_ID].Timer > 0)
  502.     WindowSetShowing("SoR_"..Window_Name.."_TIMER_BG",RoR_SoR.Pairings[Pairing_ID].Timer > 0)
  503.        
  504.     --WindowSetDimensions( "SoR_"..Window_Name, 300, 85+Sizes[RoR_SoR.Pairings[Pairing_ID].Timer2 > 0])    
  505.     WindowSetDimensions( "SoR_"..Window_Name, 300, 85)     
  506.        
  507.     local BannerW,_ = LabelGetTextDimensions("SoR_"..Window_Name.."_BannerLabel")
  508.     WindowSetDimensions( "SoR_"..Window_Name.."BannerMid", BannerW, 40 )           
  509.        
  510.     DynamicImageSetTexture( "SoR_"..Window_Name.."BG", "City_"..Pairing_ID, 300, 105 )
  511.    
  512.         --WindowSetTintColor("SoR_"..Window_Name.."Background2Border",Color.r,Color.g,Color.b)
  513.         WindowSetTintColor("SoR_"..Window_Name.."Background2Background2",Color.r,Color.g,Color.b)
  514.         LabelSetTextColor("SoR_"..Window_Name.."_BannerLabel",255,228,65)
  515.     else           
  516.     CreateWindowFromTemplate("SoR_"..Window_Name, "RoR_SoR_City_Status_Template", "Root")
  517.     RoR_SoR.OpenZones[Window_Name] =  tonumber(16)
  518.     RoR_SoR.Timers[Window_Name] = {}
  519.     RoR_SoR.SET_CAMPAIGN(SoR_CAMPAIGN_SPLIT_TEXT_STREAM)
  520.     end
  521.     RoR_SoR.Restack()  
  522. end
  523.  
  524.  
  525.  
  526.  
  527. function RoR_SoR.SET_PAIRINGS(Input)
  528.     local SoR_PAIRING_SPLIT_TEXT_STREAM = Input
  529.  
  530.     if type(SoR_PAIRING_SPLIT_TEXT_STREAM)~= "table" then
  531.         SoR_PAIRING_SPLIT_TEXT_STREAM = StringSplit(SoR_PAIRING_SPLIT_TEXT_STREAM,":")
  532.     end
  533.        
  534.     local Window_Name = "P_"..tostring(SoR_PAIRING_SPLIT_TEXT_STREAM[2])
  535.     local Pairing_ID = tonumber(SoR_PAIRING_SPLIT_TEXT_STREAM[2])
  536.     local Owning_Realm = tonumber(SoR_PAIRING_SPLIT_TEXT_STREAM[3])
  537.     local Pairing_Data = GetCampaignPairingData(Pairing_ID)
  538.  
  539. --28800 max timer
  540.     RoR_SoR.Pairings[Pairing_ID].Timer = Pairing_Data.captureTimeRemaining
  541.    
  542.    
  543.     if DoesWindowExist("SoR_"..Window_Name) then
  544.  
  545.     local UnlockTimer = RoR_SoR.Pairings[Pairing_ID].Timer
  546.     RoR_SoR.ZoneTimer[Window_Name] = ZoneLockTimer
  547.    
  548.     WindowClearAnchors("SoR_"..Window_Name.."Banner")
  549.     WindowAddAnchor("SoR_"..Window_Name.."Banner","top", "SoR_"..Window_Name, "top", 0,RoR_SoR.GetBanner())
  550.    
  551.     LabelSetText("SoR_"..Window_Name.."_BannerLabel",towstring(GetStringFromTable("MapSystem",Pairing_ID-1)))  
  552.     LabelSetText("SoR_"..Window_Name.."_BannerLabel_BG",towstring(GetStringFromTable("MapSystem",Pairing_ID-1)))
  553.  
  554.     local Color = RoR_SoR.RealmColors[Owning_Realm+1]
  555.  
  556.     LabelSetText("SoR_"..Window_Name.."_STATUS",L"Pairing Controlled By: "..towstring(CreateHyperLink(L"0",towstring(GetRealmName(Owning_Realm)), {Color.r,Color.g,Color.b}, {} )))    
  557.     LabelSetText("SoR_"..Window_Name.."_STATUS_BG",L"Pairing Controlled By: "..towstring(GetRealmName(Owning_Realm)))  
  558.    
  559.     LabelSetText("SoR_"..Window_Name.."_TIMER",TimeUtils.FormatClock(UnlockTimer))
  560.     LabelSetText("SoR_"..Window_Name.."_TIMER_BG",TimeUtils.FormatClock(UnlockTimer))      
  561.        
  562.     local BannerW,_ = LabelGetTextDimensions("SoR_"..Window_Name.."_BannerLabel")
  563.     WindowSetDimensions( "SoR_"..Window_Name.."BannerMid", BannerW, 40 )           
  564.        
  565.     for i=1,3 do   
  566.         DynamicImageSetTextureSlice("SoR_"..Window_Name.."InfoZone"..i,"Zone-"..tostring(RoR_SoR.PairingIconSliceNames[Pairing_ID][Owning_Realm])) 
  567.     end
  568.         DynamicImageSetTextureSlice("SoR_"..Window_Name.."InfoFort1","Fort-"..tostring(RoR_SoR.PairingIconSliceNames[Pairing_ID][Owning_Realm]))   
  569.         DynamicImageSetTextureSlice("SoR_"..Window_Name.."InfoFort2","Fort-"..tostring(RoR_SoR.PairingIconSliceNames[Pairing_ID][Owning_Realm]))
  570.         DynamicImageSetTexture( "SoR_"..Window_Name.."BG", "Fort_"..RoR_SoR.FortBG[Pairing_ID][Owning_Realm],0,0 ) 
  571.         --WindowSetTintColor("SoR_"..Window_Name.."Background2Border",Color.r,Color.g,Color.b)
  572.         WindowSetTintColor("SoR_"..Window_Name.."Background2Background2",Color.r,Color.g,Color.b)
  573.     else           
  574.     CreateWindowFromTemplate("SoR_"..Window_Name, "RoR_SoR_PairingTemplate", "Root")
  575.     RoR_SoR.OpenZones[Window_Name] =  tonumber(6)
  576.     RoR_SoR.Timers[Window_Name] = {}
  577.     RoR_SoR.SET_PAIRINGS(SoR_PAIRING_SPLIT_TEXT_STREAM)
  578.     end
  579.     RoR_SoR.Restack()  
  580. end
  581.  
  582.  
  583. function RoR_SoR.SET_CITY(Input)
  584. --SoR_F:10:2:85:BO 1:1:BO 2:2:BO 3:1:BO 4:2:BO 5:2:100
  585. --SoR_F:10:2:85:BO 1:1:BO 2:2:BO 3:1:BO 4:2:BO 5:2:100:100:100:25:25:10:10
  586. --SoR_C:10:3:100:100:100:100:25:25:10:10
  587. --attackers:defenders:reserved_A:reserved_B:wait_A:wait_B
  588.     local SoR_FORT_SPLIT_TEXT_STREAM = Input
  589.     local Window_Name = tostring(SoR_FORT_SPLIT_TEXT_STREAM[2])
  590.     local C_Stage = tonumber(SoR_FORT_SPLIT_TEXT_STREAM[3])
  591.     local C_Instances = tonumber(SoR_FORT_SPLIT_TEXT_STREAM[4])
  592.     local C_DestroWins = tonumber(SoR_FORT_SPLIT_TEXT_STREAM[5])   
  593.     local C_OrderWins = tonumber(SoR_FORT_SPLIT_TEXT_STREAM[6])    
  594.     local C_Timer = tonumber(SoR_FORT_SPLIT_TEXT_STREAM[7])
  595.     local C_Rank =  tonumber(SoR_FORT_SPLIT_TEXT_STREAM[8])
  596.     local City_ID = RoR_SoR.CityCampaign[tonumber(SoR_FORT_SPLIT_TEXT_STREAM[2])]
  597.    
  598.    
  599.     if RoR_CitySiege.GetCity(City_ID) ~= nil then
  600.             RoR_SoR.City_Status[City_ID] = RoR_CitySiege.GetCity(City_ID)          
  601.             RoR_SoR.Pairings[tonumber(Window_Name)].Timer = RoR_SoR.City_Status[City_ID].ratingTimer           
  602.             RoR_SoR.Pairings[tonumber(Window_Name)].Timer2 = RoR_SoR.City_Status[City_ID].timeLeft
  603.        
  604.             --HasReloaded = false
  605.     else       
  606.         --if the RoR_CitySiege table can't be found due to a reloadui, save the current rating timer into the backup save
  607.  
  608.     end
  609.    
  610.    
  611.     if DoesWindowExist("SoR_"..Window_Name) then
  612.      
  613.     DynamicImageSetTextureOrientation ("SoR_"..Window_Name.."Flames", Window_Name == "162")
  614.    
  615.     WindowClearAnchors("SoR_"..Window_Name.."Banner")
  616.     WindowAddAnchor("SoR_"..Window_Name.."Banner","top", "SoR_"..Window_Name, "top", 0,RoR_SoR.GetBanner())
  617.  
  618.     DynamicImageSetTextureSlice("SoR_"..Window_Name.."CITY_RANK", "KeepDifficulty-"..C_Rank.."-star" )
  619.  
  620.    
  621.     LabelSetText("SoR_"..Window_Name.."_BannerLabel",towstring(GetZoneName(tonumber(Window_Name))))
  622.     LabelSetText("SoR_"..Window_Name.."_BannerLabel_BG",towstring(GetZoneName(tonumber(Window_Name))))
  623.  
  624. --  LabelSetText("SoR_"..Window_Name.."_STAGE",L"State: "..towstring(C_Stage))     
  625. --  LabelSetText("SoR_"..Window_Name.."_STAGE_BG",L"State: "..towstring(C_Stage))
  626.  
  627.     LabelSetText("SoR_"..Window_Name.."_STAGE_INFO",towstring(RoR_SoR.CITY_MESSAGE[C_Stage]))      
  628.     LabelSetText("SoR_"..Window_Name.."_STAGE_INFO_BG",towstring(RoR_SoR.CITY_MESSAGE[C_Stage]))   
  629.  
  630.  
  631.     WindowSetShowing("SoR_"..Window_Name.."_TIMER",C_Timer>0.1)    
  632.     WindowSetShowing("SoR_"..Window_Name.."_TIMER_BG",C_Timer>0.1) 
  633.    
  634.    
  635.     LabelSetText("SoR_"..Window_Name.."_HEALTH",towstring(C_Instances))
  636.     LabelSetText("SoR_"..Window_Name.."_HEALTH_BG",towstring(C_Instances))         
  637.    
  638.     LabelSetTextColor("SoR_"..Window_Name.."_BannerLabel",255,225,100)
  639.     local BannerW,_ = LabelGetTextDimensions("SoR_"..Window_Name.."_BannerLabel")
  640.     WindowSetDimensions( "SoR_"..Window_Name.."BannerMid", BannerW, 40 )               
  641.     DynamicImageSetTexture( "SoR_"..Window_Name.."BG", "Fort_"..Window_Name,0,0 )      
  642.    
  643.     WindowSetTintColor("SoR_"..Window_Name.."Background2Background2",180,0,255)
  644.    
  645.         RoR_SoR.ZoneTimer[Window_Name] = ZoneLockTimer
  646.         RoR_SoR.Timers[Window_Name][1] = tonumber(C_Timer)
  647.  
  648.         if (Window_Name == "162") then
  649.             DynamicImageSetTexture( "SoR_"..Window_Name.."VictorBanner", "scenario_widgets", 115, 149 )
  650.         else
  651.             DynamicImageSetTexture( "SoR_"..Window_Name.."VictorBanner", "scenario_widgets", 185, 149 )
  652.         end
  653.  
  654.         local Attck_Color = RoR_SoR.RealmColors[4-RoR_SoR.City[tonumber(Window_Name)]]
  655.         local Defend_Color = RoR_SoR.RealmColors[RoR_SoR.City[tonumber(Window_Name)]+1]
  656.    
  657.    
  658.         LabelSetText("SoR_"..Window_Name.."Destro_Wins",towstring(C_DestroWins))
  659.         LabelSetText("SoR_"..Window_Name.."Destro_Wins_BG",towstring(C_DestroWins))
  660.        
  661.         LabelSetText("SoR_"..Window_Name.."Order_Wins",towstring(C_OrderWins))
  662.         LabelSetText("SoR_"..Window_Name.."Order_Wins_BG",towstring(C_OrderWins))      
  663.    
  664.     else           
  665.     CreateWindowFromTemplate("SoR_"..Window_Name, "RoR_SoR_CityTemplate", "Root")  
  666.     RoR_SoR.OpenZones[Window_Name] =  tonumber(5)  
  667.     RoR_SoR.Timers[Window_Name] = {}   
  668.     RoR_SoR.City[Window_Name] = {BO={},Owner={},Stage=0,Health=L""}    
  669.     RoR_SoR.SET_CITY(SoR_FORT_SPLIT_TEXT_STREAM)
  670.     WindowStartAlphaAnimation( "SoR_"..Window_Name.."Flames", Window.AnimationType.LOOP, 1.0, 0.2, 0.5, false, 0.0, 0 ) --start the Burning BO pulse   
  671.     end
  672.     RoR_SoR.Restack()  
  673. end
  674.  
  675.  
  676. function RoR_SoR.SET_FORT(Input)
  677. --SoR_F:10:2:85:BO 1:1:BO 2:2:BO 3:1:BO 4:2:BO 5:2:100
  678. --SoR_F:10:2:85:BO 1:1:BO 2:2:BO 3:1:BO 4:2:BO 5:2:100:100:100:25:25:10:10
  679. --5,7,9,11,13
  680. --attackers:defenders:reserved_A:reserved_B:wait_A:wait_B
  681.     local SoR_FORT_SPLIT_TEXT_STREAM = Input
  682.     local Window_Name = tostring(SoR_FORT_SPLIT_TEXT_STREAM[2])
  683.     local F_Stage = tonumber(SoR_FORT_SPLIT_TEXT_STREAM[3])
  684.    
  685.    
  686.     if DoesWindowExist("SoR_"..Window_Name) then
  687.  
  688.     WindowClearAnchors("SoR_"..Window_Name.."Banner")
  689.     WindowAddAnchor("SoR_"..Window_Name.."Banner","top", "SoR_"..Window_Name, "top", 0,RoR_SoR.GetBanner())
  690.     WindowSetTintColor("SoR_"..Window_Name.."Background2Background2",217,164,10)       
  691.    
  692.             local F_attackers = 0
  693.             local F_defenders = 0
  694.             local F_reserved_A = 0
  695.             local F_reserved_D = 0
  696.             local F_wait_A = 0 
  697.             local F_wait_D = 0     
  698.    
  699.     LabelSetText("SoR_"..Window_Name.."_BannerLabel",towstring(GetZoneName(tonumber(Window_Name))))
  700.     LabelSetText("SoR_"..Window_Name.."_BannerLabel_BG",towstring(GetZoneName(tonumber(Window_Name))))
  701.  
  702.     LabelSetText("SoR_"..Window_Name.."_STAGE",L"Stage: "..towstring(F_Stage))     
  703.     LabelSetText("SoR_"..Window_Name.."_STAGE_BG",L"Stage: "..towstring(F_Stage))  
  704.    
  705.     WindowSetShowing("SoR_"..Window_Name.."LORD",F_Stage == 3)
  706.    
  707.     LabelSetTextColor("SoR_"..Window_Name.."_BannerLabel",255,225,100)
  708.     local BannerW,_ = LabelGetTextDimensions("SoR_"..Window_Name.."_BannerLabel")
  709.     WindowSetDimensions( "SoR_"..Window_Name.."BannerMid", BannerW, 40 )           
  710.     DynamicImageSetTexture( "SoR_"..Window_Name.."KEEP1KEEPICON", RoR_SoR.GetKeepTexture(RoR_SoR.Forts[tonumber(Window_Name)],1),42,42 )   
  711.     DynamicImageSetTexture( "SoR_"..Window_Name.."BG", "Fort_"..Window_Name,0,0 )      
  712.    
  713.         if F_Stage == 1 then
  714.             local F_Timer = tonumber(SoR_FORT_SPLIT_TEXT_STREAM[4])
  715.        
  716.             F_attackers = tonumber(SoR_FORT_SPLIT_TEXT_STREAM[5]) or 0
  717.             F_defenders = tonumber(SoR_FORT_SPLIT_TEXT_STREAM[6]) or 0
  718.             F_reserved_A = tonumber(SoR_FORT_SPLIT_TEXT_STREAM[7]) or 0
  719.             F_reserved_D = tonumber(SoR_FORT_SPLIT_TEXT_STREAM[8]) or 0
  720.             F_wait_A = tonumber(SoR_FORT_SPLIT_TEXT_STREAM[9]) or 0
  721.             F_wait_D = tonumber(SoR_FORT_SPLIT_TEXT_STREAM[10]) or 0       
  722.            
  723.             --LabelSetText("SoR_"..Window_Name.."_INFO",L"A: "..towstring(F_attackers)..L" D: "..towstring(F_defenders)..L"<br>Reserved_A: "..towstring(F_reserved_A)..L"<br>Reserved_B: "..towstring(F_reserved_B)..L"<br>Wait_A: "..towstring(F_wait_A)..L"<br>Wait_B: "..towstring(F_wait_B))
  724.             --LabelSetText("SoR_"..Window_Name.."_INFOBG",towstring(LabelGetText("SoR_"..Window_Name.."_INFO")))   
  725.            
  726.             WindowSetShowing( "SoR_"..Window_Name.."_TIMER",true)  
  727.             WindowSetShowing( "SoR_"..Window_Name.."_HEALTH",false)
  728.             WindowSetShowing( "SoR_"..Window_Name.."_HEALTH_BG",false)         
  729.             --WindowSetShowing( "SoR_"..Window_Name.."KEEP1LORD_ICON",false)   
  730.             WindowSetShowing( "SoR_"..Window_Name.."KEEP1KEEPDOOR1",true)              
  731.                        
  732.             RoR_SoR.Timers[Window_Name][1] = F_Timer   
  733.             for i=1,5 do               
  734.                 WindowSetShowing( "SoR_"..Window_Name.."BO"..i,false)  
  735.                 WindowSetShowing( "SoR_"..Window_Name.."BO"..i,false)                  
  736.             end
  737.            
  738.         elseif  F_Stage == 2 then
  739.             local F_Timer = tonumber(SoR_FORT_SPLIT_TEXT_STREAM[15])
  740.            
  741.              F_attackers = tonumber(SoR_FORT_SPLIT_TEXT_STREAM[16]) or 0
  742.              F_defenders = tonumber(SoR_FORT_SPLIT_TEXT_STREAM[17]) or 0
  743.              F_reserved_A = tonumber(SoR_FORT_SPLIT_TEXT_STREAM[18]) or 0
  744.              F_reserved_D = tonumber(SoR_FORT_SPLIT_TEXT_STREAM[19]) or 0
  745.              F_wait_A = tonumber(SoR_FORT_SPLIT_TEXT_STREAM[20]) or 0  
  746.              F_wait_D = tonumber(SoR_FORT_SPLIT_TEXT_STREAM[21]) or 0          
  747.            
  748.     --      LabelSetText("SoR_"..Window_Name.."_INFO",L"Attackers: "..towstring(F_attackers)..L"<br>Defenders: "..towstring(F_defenders)..L"<br>Reserved_A: "..towstring(F_reserved_A)..L"<br>Reserved_B: "..towstring(F_reserved_B)..L"<br>Wait_A: "..towstring(F_wait_A)..L"<br>Wait_B: "..towstring(F_wait_B))
  749.     --      LabelSetText("SoR_"..Window_Name.."_INFOBG",towstring(LabelGetText("SoR_"..Window_Name.."_INFO")))
  750.                
  751.                        
  752.             WindowSetShowing( "SoR_"..Window_Name.."_TIMER",true)  
  753.             WindowSetShowing( "SoR_"..Window_Name.."_HEALTH",true) 
  754.             WindowSetShowing( "SoR_"..Window_Name.."_HEALTH_BG",true)          
  755.             --WindowSetShowing( "SoR_"..Window_Name.."KEEP1LORD_ICON",false)   
  756.             WindowSetShowing( "SoR_"..Window_Name.."KEEP1KEEPDOOR1",true)                  
  757.             LabelSetText("SoR_"..Window_Name.."_HEALTH",towstring(SoR_FORT_SPLIT_TEXT_STREAM[4])..L"%")
  758.             LabelSetText("SoR_"..Window_Name.."_HEALTH_BG",towstring(SoR_FORT_SPLIT_TEXT_STREAM[4])..L"%")         
  759.             RoR_SoR.Fort[Window_Name].Health = towstring(SoR_FORT_SPLIT_TEXT_STREAM[4])..L"%"
  760.             RoR_SoR.Fort[Window_Name].Stage = 2
  761.             RoR_SoR.Timers[Window_Name][1] = F_Timer
  762.                    
  763.             for i=1,5 do           
  764.                 WindowSetShowing( "SoR_"..Window_Name.."BO"..i,true)   
  765.                 WindowSetShowing( "SoR_"..Window_Name.."BO"..i,true)
  766.            
  767.                 DynamicImageSetTexture( "SoR_"..Window_Name.."BO"..i.."FlagBG", RoR_SoR.GetFlag(SoR_FORT_SPLIT_TEXT_STREAM[4+(i*2)],0),31,31 )                 
  768.                 RoR_SoR.Fort[Window_Name].BO[i] = towstring(SoR_FORT_SPLIT_TEXT_STREAM[3+(i*2)])
  769.                 RoR_SoR.Fort[Window_Name].Owner[i] = tonumber(SoR_FORT_SPLIT_TEXT_STREAM[4+(i*2)])
  770.  
  771.  
  772.                 local ShortBOName = L""
  773.                     if RoR_SoR.Settings.ShowBONames then
  774.                         local   RealmColor = RoR_SoR.RealmColors[RoR_SoR.Fort[Window_Name].Owner[i]+1]         
  775.                         LabelSetTextColor("SoR_"..Window_Name.."BO"..i.."TIMER",RealmColor.r,RealmColor.g,RealmColor.b)            
  776.                         ShortBOName = wstring.match(wstring.gsub(wstring.gsub(wstring.gsub(wstring.gsub(towstring(RoR_SoR.Fort[Window_Name].BO[tonumber(i)]),L" of ", L""), L"%s",L""), L"%l*", L""), L"'", L""), L"([^^]+)^?.*") or L"" --This is for Shortening Guildnames
  777.                     end
  778.                 LabelSetText("SoR_"..Window_Name.."BO"..i.."TIMER",ShortBOName)
  779.                 LabelSetText("SoR_"..Window_Name.."BO"..i.."TIMER_BG",ShortBOName)
  780.                
  781.             end
  782.            
  783.         elseif  F_Stage == 3 then
  784.             local F_Timer = tonumber(SoR_FORT_SPLIT_TEXT_STREAM[5])
  785.            
  786.              F_attackers = tonumber(SoR_FORT_SPLIT_TEXT_STREAM[6]) or 0
  787.              F_defenders = tonumber(SoR_FORT_SPLIT_TEXT_STREAM[7]) or 0
  788.              F_reserved_A = tonumber(SoR_FORT_SPLIT_TEXT_STREAM[8]) or 0
  789.              F_reserved_D = tonumber(SoR_FORT_SPLIT_TEXT_STREAM[9]) or 0
  790.              F_wait_A = tonumber(SoR_FORT_SPLIT_TEXT_STREAM[10]) or 0  
  791.              F_wait_D = tonumber(SoR_FORT_SPLIT_TEXT_STREAM[11]) or 0      
  792.  
  793.         --  LabelSetText("SoR_"..Window_Name.."_INFO",L"Attackers: "..towstring(F_attackers)..L"<br>Defenders: "..towstring(F_defenders)..L"<br>Reserved_A: "..towstring(F_reserved_A)..L"<br>Reserved_B: "..towstring(F_reserved_B)..L"<br>Wait_A: "..towstring(F_wait_A)..L"<br>Wait_B: "..towstring(F_wait_B))
  794.         --  LabelSetText("SoR_"..Window_Name.."_INFOBG",towstring(LabelGetText("SoR_"..Window_Name.."_INFO")))             
  795.         --SoR_F:10:3:100:100:100:100:25:25:10:10
  796.             WindowSetShowing( "SoR_"..Window_Name.."_TIMER",true)  
  797.             WindowSetShowing( "SoR_"..Window_Name.."_HEALTH",true)
  798.             WindowSetShowing( "SoR_"..Window_Name.."_HEALTH_BG",true)          
  799.             --WindowSetShowing( "SoR_"..Window_Name.."KEEP1LORD_ICON",true)                    
  800.             WindowSetShowing( "SoR_"..Window_Name.."KEEP1KEEPDOOR1",false)         
  801.             LabelSetText("SoR_"..Window_Name.."_HEALTH",towstring(SoR_FORT_SPLIT_TEXT_STREAM[4])..L"%")
  802.             LabelSetText("SoR_"..Window_Name.."_HEALTH_BG",towstring(SoR_FORT_SPLIT_TEXT_STREAM[4])..L"%")         
  803.             RoR_SoR.Timers[Window_Name][1] = F_Timer   
  804.             RoR_SoR.Fort[Window_Name].Health = towstring(SoR_FORT_SPLIT_TEXT_STREAM[4])..L"%"
  805.             RoR_SoR.Fort[Window_Name].Stage = 3
  806.            
  807.             DynamicImageSetTexture("SoR_"..Window_Name.."LORDBanner",RoR_SoR.FortLord[RoR_SoR.Forts[tonumber(Window_Name)]],256,48)
  808.            
  809.             local   RealmColor = RoR_SoR.RealmColors[RoR_SoR.Forts[tonumber(Window_Name)]+1]               
  810.             StatusBarSetMaximumValue("SoR_"..Window_Name.."LORDLEFTBAR",100)
  811.             StatusBarSetForegroundTint("SoR_"..Window_Name.."LORDLEFTBAR",RealmColor.r,RealmColor.g,RealmColor.b)
  812.             StatusBarSetCurrentValue("SoR_"..Window_Name.."LORDLEFTBAR", tonumber(SoR_FORT_SPLIT_TEXT_STREAM[4]) )
  813.            
  814.             StatusBarSetMaximumValue("SoR_"..Window_Name.."LORDRIGHTBAR",100)
  815.             StatusBarSetForegroundTint("SoR_"..Window_Name.."LORDRIGHTBAR",RealmColor.r,RealmColor.g,RealmColor.b)
  816.             StatusBarSetCurrentValue("SoR_"..Window_Name.."LORDRIGHTBAR", tonumber(SoR_FORT_SPLIT_TEXT_STREAM[4]) )
  817.            
  818.            
  819.             for i=1,5 do           
  820.                 WindowSetShowing( "SoR_"..Window_Name.."BO"..i,false)  
  821.                 WindowSetShowing( "SoR_"..Window_Name.."BO"..i,false)      
  822.             end
  823.  
  824.         end
  825.         RoR_SoR.ZoneTimer[Window_Name] = ZoneLockTimer
  826.  
  827.         local Attck_Color = RoR_SoR.RealmColors[4-RoR_SoR.Forts[tonumber(Window_Name)]]
  828.         local Defend_Color = RoR_SoR.RealmColors[RoR_SoR.Forts[tonumber(Window_Name)]+1]
  829.        
  830.         LabelSetText("SoR_"..Window_Name.."POP_INFO_ATTACK_Label_Attack",towstring(F_attackers+F_reserved_A))
  831.         LabelSetText("SoR_"..Window_Name.."POP_INFO_ATTACK_Label_AttackBG",towstring(LabelGetText("SoR_"..Window_Name.."POP_INFO_ATTACK_Label_Attack")))           
  832.         LabelSetText("SoR_"..Window_Name.."POP_INFO_ATTACK_Label_Defend",towstring(F_defenders+F_reserved_D))
  833.         LabelSetText("SoR_"..Window_Name.."POP_INFO_ATTACK_Label_DefendBG",towstring(LabelGetText("SoR_"..Window_Name.."POP_INFO_ATTACK_Label_Defend")))       
  834.         LabelSetTextColor("SoR_"..Window_Name.."POP_INFO_ATTACK_Label_Attack",Attck_Color.r,Attck_Color.g,Attck_Color.b)
  835.         LabelSetTextColor("SoR_"..Window_Name.."POP_INFO_ATTACK_Label_Defend",Defend_Color.r,Defend_Color.g,Defend_Color.b)
  836.  
  837.         LabelSetText("SoR_"..Window_Name.."POP_INFO_WAIT_Label_Attack",towstring(F_wait_A))
  838.         LabelSetText("SoR_"..Window_Name.."POP_INFO_WAIT_Label_AttackBG",towstring(LabelGetText("SoR_"..Window_Name.."POP_INFO_WAIT_Label_Attack")))           
  839.         LabelSetText("SoR_"..Window_Name.."POP_INFO_WAIT_Label_Defend",towstring(F_wait_D))
  840.         LabelSetText("SoR_"..Window_Name.."POP_INFO_WAIT_Label_DefendBG",towstring(LabelGetText("SoR_"..Window_Name.."POP_INFO_WAIT_Label_Defend")))               
  841.         LabelSetTextColor("SoR_"..Window_Name.."POP_INFO_WAIT_Label_Attack",Attck_Color.r,Attck_Color.g,Attck_Color.b)
  842.         LabelSetTextColor("SoR_"..Window_Name.."POP_INFO_WAIT_Label_Defend",Defend_Color.r,Defend_Color.g,Defend_Color.b)
  843.         --RoR_SoR.Forts = {[4]=2,[10]=1,[104]=2,[110]=1,[204]=2,[210]=1}
  844.        
  845.                     RoR_SoR.ZoneStatus[Window_Name] = {}   
  846.                     RoR_SoR.ZoneStatus[Window_Name].Attackers_Pop = tonumber(F_attackers+F_reserved_A) or 0
  847.                     RoR_SoR.ZoneStatus[Window_Name].Defenders_Pop = tonumber(F_defenders+F_reserved_D) or 0
  848.                     RoR_SoR.ZoneStatus[Window_Name].A_Wait_Pop = tonumber(F_wait_A) or 0   
  849.                     RoR_SoR.ZoneStatus[Window_Name].D_Wait_Pop = tonumber(F_wait_D) or 0                   
  850.        
  851.     else           
  852.     CreateWindowFromTemplate("SoR_"..Window_Name, "RoR_SoR_FortTemplate", "Root")  
  853.     RoR_SoR.OpenZones[Window_Name] =  tonumber(5)  
  854.     RoR_SoR.Timers[Window_Name] = {}   
  855.     RoR_SoR.Fort[Window_Name] = {BO={},Owner={},Stage=0,Health=L""}    
  856.     RoR_SoR.SET_FORT(SoR_FORT_SPLIT_TEXT_STREAM)   
  857.     end
  858.     RoR_SoR.Restack()  
  859. end
  860.  
  861.  
  862.  
  863.  
  864. local function CompareEntry(entryA, entryB)
  865.     return (entryA.Tier > entryB.Tier)
  866. end
  867.  
  868. function  RoR_SoR.Restack()
  869.         RoR_Window_Scale = (tonumber(WindowGetScale("RoR_SoR_Main_Window")))
  870.         WindowSetScale("RoR_SoR_Popper",RoR_Window_Scale)
  871.         local uiScale = InterfaceCore.GetScale()
  872.         local ResolutionScale = InterfaceCore.GetResolutionScale()         
  873.         local Inteface_Scale = SystemData.Settings.Interface.globalUiScale
  874.         RoR_SoR.StackSort = {};
  875.        
  876.         for k,v in pairs(RoR_SoR.OpenZones) do
  877.         WindowSetScale("SoR_"..k,WindowGetScale("RoR_SoR_Main_Window"))    
  878.             table.insert(RoR_SoR.StackSort,{Zone=k,Tier=v})
  879.             table.sort(RoR_SoR.StackSort, CompareEntry)        
  880.         end
  881.        
  882.         local TotalHeight = 0
  883.         for k,v in ipairs(RoR_SoR.StackSort) do    
  884.         local width,height = WindowGetDimensions( "SoR_"..v.Zone)  
  885.         local WndScale = WindowGetScale("SoR_"..v.Zone)
  886.         width = width*WndScale
  887.         height = ((height+RoR_SoR.Settings.Offset)*WndScale)/Inteface_Scale
  888.         TotalHeight = TotalHeight + height
  889.             WindowClearAnchors( "SoR_"..v.Zone )
  890.             if RoR_SoR.Settings.StackDir == 1 then
  891.             WindowAddAnchor( "SoR_"..v.Zone , "bottom", "RoR_SoR_Main_Window", "top", 0,(0-(height))+(TotalHeight))        
  892.             --  WindowAddAnchor( "SoR_"..v.Zone , "bottom", "RoR_SoR_Main_Window", "top", 0,((175*tonumber(k-1))*RoR_Window_Scale)/(uiScale/ResolutionScale/Inteface_Scale))
  893.             elseif  RoR_SoR.Settings.StackDir == 2 then
  894.             WindowAddAnchor( "SoR_"..v.Zone , "top", "RoR_SoR_Main_Window", "bottom", 0,height-(TotalHeight))              
  895.             --  WindowAddAnchor( "SoR_"..v.Zone , "top", "RoR_SoR_Main_Window", "bottom", 0,0-((((175*tonumber(k-1)))*RoR_Window_Scale)/(uiScale/ResolutionScale/Inteface_Scale)))
  896.             end
  897.         end
  898.    
  899.     if RoR_SoR.Settings.Enabled then
  900.         WindowSetTintColor("RoR_SoR_ButtonBtn",255,255,255)
  901.     else
  902.         WindowSetTintColor("RoR_SoR_ButtonBtn",125,125,125)
  903.     end
  904.    
  905. return
  906. end
  907.  
  908.  
  909. function RoR_SoR.SET_BO(Input)
  910.     local SoR_BO_SPLIT_TEXT_STREAM = Input
  911.     local Window_Name = tostring(SoR_BO_SPLIT_TEXT_STREAM[2])
  912.     if DoesWindowExist("SoR_"..Window_Name) then
  913.         RoR_SoR.Timers[SoR_BO_SPLIT_TEXT_STREAM[2]] = {}
  914.         WindowSetScale("SoR_"..Window_Name,WindowGetScale("RoR_SoR_Main_Window"))
  915.         DynamicImageSetTextureSlice("SoR_"..Window_Name.."BG", RoR_SoR.ParingPortrait[RoR_SoR.GetParing(Window_Name)])
  916.         RoR_SoR.ZoneTimer[Window_Name] = ZoneLockTimer
  917.         RoR_SoR.BO_IDs[Window_Name] = {}
  918.  
  919.  
  920.         RoR_SoR.Restack()
  921.        
  922.         local Lock_Counter = 0 
  923.         for i=1,4 do   
  924.             local BO_State = tonumber(SoR_BO_SPLIT_TEXT_STREAM[1+(4*i)])
  925.             local BO_Owner = tonumber(SoR_BO_SPLIT_TEXT_STREAM[(4*i)])
  926.                
  927.             RoR_SoR.BO_IDs[Window_Name][i] = {}
  928.             RoR_SoR.BO_IDs[Window_Name][i].ID = SoR_BO_SPLIT_TEXT_STREAM[(4*i)-1]
  929.             RoR_SoR.BO_IDs[Window_Name][i].Owner = BO_Owner
  930.            
  931.            
  932.             local RealmColor = nil
  933.             if BO_State == 4 then
  934.                 if RoR_SoR.BO_States[Window_Name][i] ~= 4 then
  935.                     WindowStartAlphaAnimation( "SoR_"..Window_Name.."BO"..i.."Flag", Window.AnimationType.LOOP, 1.0, 0.2, 0.5, false, 0.0, 0 ) --start the Burning BO pulse
  936.                     RoR_SoR.BO_States[Window_Name][i] = 4
  937.                 end
  938.                 RealmColor = RoR_SoR.CappingRealmColors[SoR_BO_SPLIT_TEXT_STREAM[(4*i)]+1]             
  939.                 WindowSetDimensions("SoR_"..Window_Name.."BO"..i.."Flag",31,31)            
  940.             else
  941.                 RoR_SoR.BO_States[Window_Name][i] = nil
  942.                 RealmColor = RoR_SoR.RealmColors[SoR_BO_SPLIT_TEXT_STREAM[(4*i)]+1]
  943.                 WindowStopAlphaAnimation("SoR_"..Window_Name.."BO"..i.."Flag")
  944.             end
  945.            
  946.             LabelSetTextColor("SoR_"..Window_Name.."BO"..i.."TIMER",RealmColor.r,RealmColor.g,RealmColor.b)
  947.            
  948.             local OB_Name = L""
  949.             local ShortBOName = L""
  950.            
  951.         if RoR_SoR.Settings.ShowBONames then
  952.             if tonumber(RoR_SoR.BO_IDs[Window_Name][i].ID) ~= 0 then
  953.                 OB_Name = towstring(GetObjectiveName(tonumber(RoR_SoR.BO_IDs[Window_Name][i].ID)))
  954.                 ShortBOName = wstring.match(wstring.gsub(wstring.gsub(wstring.gsub(wstring.gsub(towstring(OB_Name),L" of ", L""), L"%s",L""), L"%l*", L""), L"'", L""), L"([^^]+)^?.*") or L"" --This is for Shortening Guildnames
  955.             end
  956.         end
  957.            
  958.             LabelSetText("SoR_"..Window_Name.."BO"..i.."TIMER",ShortBOName)    
  959.             LabelSetText("SoR_"..Window_Name.."BO"..i.."TIMER_BG",ShortBOName)             
  960.             DynamicImageSetTexture( "SoR_"..Window_Name.."BO"..i.."Flag", RoR_SoR.GetFlag(BO_Owner,BO_State),31,31 )   
  961.             DynamicImageSetTexture( "SoR_"..Window_Name.."BO"..i.."FlagBG", RoR_SoR.GetFlag2(BO_Owner,BO_State),31,31 )            
  962.             RoR_SoR.BO_States[Window_Name][i] = BO_State
  963.            
  964.             if tonumber(SoR_BO_SPLIT_TEXT_STREAM[2+(4*i)]) > 0 and tonumber(SoR_BO_SPLIT_TEXT_STREAM[2+(4*i)]) < 300 then
  965.                 RoR_SoR.Timers[SoR_BO_SPLIT_TEXT_STREAM[2]][i] = tonumber(SoR_BO_SPLIT_TEXT_STREAM[2+(4*i)])           
  966.             --  LabelSetText("SoR_"..Window_Name.."BO"..i.."TIMER",towstring(SoR_BO_SPLIT_TEXT_STREAM[2+(4*i)]))
  967.             end
  968.             if (BO_State == 6) or (BO_State == 9) then Lock_Counter = Lock_Counter+1 end           
  969.         end
  970.        
  971.         --Zonelock
  972.         if Lock_Counter == 4 then LabelSetText("SoR_"..Window_Name.."LockedText",towstring(GetStringFromTable("Hardcoded", 1268)))end      
  973.             WindowSetShowing("SoR_"..Window_Name.."LockTint",(Lock_Counter==4))
  974.                        
  975.         else
  976.             RoR_SoR.Timers[SoR_BO_SPLIT_TEXT_STREAM[2]] = nil
  977.         end
  978. end
  979.  
  980. --Hide Keepstuff for T1
  981. function RoR_SoR.T1_UPDATE(Input,TEXT_STREAM)
  982. local Window_Name = tostring(Input)
  983. local TEXT_STREAM = TEXT_STREAM
  984.  
  985. if TEXT_STREAM[21] ~= nil then
  986. local AAO = StringSplit(tostring(TEXT_STREAM[21]), ",")
  987.             if AAO[2] ~= nil then
  988.             local ClaimColor = RoR_SoR.RealmColors[AAO[1]+1]
  989.             LabelSetTextColor("SoR_"..Window_Name.."AAO",ClaimColor.r,ClaimColor.g,ClaimColor.b)
  990.             LabelSetText("SoR_"..Window_Name.."AAO",towstring(AAO[2])..L"%")   
  991.             LabelSetText("SoR_"..Window_Name.."AAO_BG",towstring(AAO[2])..L"%")            
  992.             WindowSetShowing("SoR_"..Window_Name.."AAO",tonumber(AAO[2])>0)
  993.             WindowSetShowing("SoR_"..Window_Name.."AAO_BG",tonumber(AAO[2])>0)         
  994.             else
  995.             WindowSetShowing("SoR_"..Window_Name.."AAO",false)
  996.             WindowSetShowing("SoR_"..Window_Name.."AAO_BG",false)          
  997.             end
  998.  end
  999.  
  1000.     if DoesWindowExist("SoR_"..Window_Name) then   
  1001.    
  1002.         WindowClearAnchors("SoR_"..Window_Name.."Banner")
  1003.         WindowAddAnchor("SoR_"..Window_Name.."Banner","top", "SoR_"..Window_Name, "top", 0,RoR_SoR.GetBanner())
  1004.    
  1005.         WindowSetShowing("SoR_"..Window_Name.."KEEP1",false)
  1006.         WindowSetShowing("SoR_"..Window_Name.."KEEP2",false)   
  1007.         WindowSetShowing("SoR_"..Window_Name.."CLAIM_WINDOW1",false)
  1008.         WindowSetShowing("SoR_"..Window_Name.."CLAIM_WINDOW2",false)
  1009.         WindowSetShowing("SoR_"..Window_Name.."POP",false)     
  1010.         RoR_SoR.ZoneTimer[Window_Name] = ZoneLockTimer
  1011.     local ZoneVP   
  1012.         if Input == "106" then
  1013.             WindowSetShowing("SoR_"..Window_Name.."BO4",false) -- Hide the 4:th BO of Nordland
  1014.             DynamicImageSetTexture ("SoR_"..Window_Name.."VPBanner", "Realm2", 256,128)
  1015.             ZoneVP = GetCampaignZoneData(106 )
  1016.         elseif Input == "206" then
  1017.             DynamicImageSetTexture ("SoR_"..Window_Name.."VPBanner", "Realm3", 256,128)
  1018.             ZoneVP = GetCampaignZoneData(200 )         
  1019.         else
  1020.             DynamicImageSetTexture ("SoR_"..Window_Name.."VPBanner", "Realm1", 256,128)
  1021.             ZoneVP = GetCampaignZoneData(6 )   
  1022.         end            
  1023. --Update the "progressbars" in the zone pairings
  1024. --local Width_Zone1_Order = ( ( ZoneVP.controlPoints[1] / 100 ) * 147 )
  1025. --WindowSetDimensions( "SoR_"..Window_Name.."VPORDER", Width_Zone1_Order+2, 4 )
  1026.             StatusBarSetMaximumValue("SoR_"..Window_Name.."VPORDERBAR",100)
  1027.             StatusBarSetForegroundTint("SoR_"..Window_Name.."VPORDERBAR",RoR_SoR.RealmColors[2].r,RoR_SoR.RealmColors[2].g,RoR_SoR.RealmColors[2].b)
  1028.             StatusBarSetCurrentValue("SoR_"..Window_Name.."VPORDERBAR", tonumber(ZoneVP.controlPoints[1]))
  1029.  
  1030.  
  1031. --local Width_Zone1_Destro = ( ( ZoneVP.controlPoints[2] / 100 ) * 147 )
  1032. --WindowSetDimensions( "SoR_"..Window_Name.."VPDESTRO", Width_Zone1_Destro+2, 4 )
  1033.             StatusBarSetMaximumValue("SoR_"..Window_Name.."VPDESTROBAR",100)
  1034.             StatusBarSetForegroundTint("SoR_"..Window_Name.."VPDESTROBAR",RoR_SoR.RealmColors[3].r,RoR_SoR.RealmColors[3].g,RoR_SoR.RealmColors[3].b)
  1035.             StatusBarSetCurrentValue("SoR_"..Window_Name.."VPDESTROBAR", tonumber(ZoneVP.controlPoints[2]))
  1036.    
  1037.         LabelSetText("SoR_"..Window_Name.."VPPERCENT_ORDER",towstring((ZoneVP.controlPoints[1])*2)..L"%")
  1038.         LabelSetText("SoR_"..Window_Name.."VPPERCENT_ORDER_BG",towstring((ZoneVP.controlPoints[1])*2)..L"%")
  1039.        
  1040.         LabelSetText("SoR_"..Window_Name.."VPPERCENT_DESTRO",towstring((ZoneVP.controlPoints[2])*2)..L"%")
  1041.         LabelSetText("SoR_"..Window_Name.."VPPERCENT_DESTRO_BG",towstring((ZoneVP.controlPoints[2])*2)..L"%")      
  1042.  
  1043.     end
  1044. end
  1045.  
  1046. function RoR_SoR.SET_KEEP(Input)
  1047.     local SoR_KEEP_SPLIT_TEXT_STREAM = Input
  1048.     local Window_Name = tostring(SoR_KEEP_SPLIT_TEXT_STREAM[2])
  1049.  
  1050. --check if Fort Data:  
  1051.     if RoR_SoR.Forts[tonumber(SoR_KEEP_SPLIT_TEXT_STREAM[2])] ~= nil then
  1052.         if DoesWindowExist("SoR_"..Window_Name) then       
  1053.         local F_ZoneID = SoR_KEEP_SPLIT_TEXT_STREAM[2]
  1054.         local F_AAO = StringSplit(tostring(SoR_KEEP_SPLIT_TEXT_STREAM[4]), ",")        
  1055.         local F_Order_Pop = SoR_KEEP_SPLIT_TEXT_STREAM[5]          
  1056.         local F_Destro_Pop = SoR_KEEP_SPLIT_TEXT_STREAM[6]             
  1057.  
  1058.         LabelSetText("SoR_"..Window_Name.."POPAAO",towstring(F_AAO[2])..L"%")    
  1059.         LabelSetText("SoR_"..Window_Name.."POPAAO_BG",towstring(F_AAO[2])..L"%")       
  1060.        
  1061.         LabelSetText("SoR_"..Window_Name.."POPOrder",towstring(F_Order_Pop))     
  1062.         LabelSetText("SoR_"..Window_Name.."POPOrder_BG",towstring(F_Order_Pop))        
  1063.        
  1064.         LabelSetText("SoR_"..Window_Name.."POPDestro",towstring(F_Destro_Pop))   
  1065.         LabelSetText("SoR_"..Window_Name.."POPDestro_BG",towstring(F_Destro_Pop))  
  1066.  
  1067.             local ClaimColor = RoR_SoR.RealmColors[F_AAO[1]+1]
  1068.             LabelSetTextColor("SoR_"..Window_Name.."POPAAO",ClaimColor.r,ClaimColor.g,ClaimColor.b)
  1069.  
  1070.         WindowSetShowing("SoR_"..Window_Name.."POPAAO",tonumber(F_AAO[2])>0)           
  1071.         WindowSetShowing("SoR_"..Window_Name.."POPAAO_BG",tonumber(F_AAO[2])>0)
  1072.  
  1073.                 RoR_SoR.ZoneStatus[Window_Name] = {}   
  1074.                     RoR_SoR.ZoneStatus[Window_Name].Order_Pop = tonumber(F_Order_Pop) or 0 
  1075.                     RoR_SoR.ZoneStatus[Window_Name].Destro_Pop = tonumber(F_Destro_Pop) or 0
  1076.                     RoR_SoR.ZoneStatus[Window_Name].AAO = F_AAO
  1077.                    
  1078.         end
  1079.        
  1080.    
  1081.        
  1082.     else   
  1083.     --check if Keep data:  
  1084.         if DoesWindowExist("SoR_"..Window_Name) then
  1085.        
  1086.                 if not RoR_SoR.KeepHealth[Window_Name] then RoR_SoR.KeepHealth[Window_Name] = {[1]=0,[2]=0} end
  1087.                
  1088.                 local KEEP1_ID = tonumber(SoR_KEEP_SPLIT_TEXT_STREAM[3])
  1089.                 local KEEP2_ID = tonumber(SoR_KEEP_SPLIT_TEXT_STREAM[12])  
  1090.                 local KEEP1_State = tonumber(SoR_KEEP_SPLIT_TEXT_STREAM[6])
  1091.                 local KEEP1_Extra = tonumber(SoR_KEEP_SPLIT_TEXT_STREAM[7])
  1092.                 local KEEP1_Owner = tonumber(SoR_KEEP_SPLIT_TEXT_STREAM[4])
  1093.                 local KEEP2_State = tonumber(SoR_KEEP_SPLIT_TEXT_STREAM[15])
  1094.                 local KEEP2_Extra = tonumber(SoR_KEEP_SPLIT_TEXT_STREAM[16])               
  1095.                 local KEEP2_Owner = tonumber(SoR_KEEP_SPLIT_TEXT_STREAM[13])           
  1096.                 local KEEP1_RankA = (SoR_KEEP_SPLIT_TEXT_STREAM[5])        
  1097.                 local KEEP2_RankA = (SoR_KEEP_SPLIT_TEXT_STREAM[14])   
  1098.                
  1099.                 local KEEP1_Door1 = tonumber(SoR_KEEP_SPLIT_TEXT_STREAM[9])        
  1100.                 local KEEP1_Door2 = tonumber(SoR_KEEP_SPLIT_TEXT_STREAM[8])        
  1101.  
  1102.                 local KEEP2_Door1 = tonumber(SoR_KEEP_SPLIT_TEXT_STREAM[18])                               
  1103.                 local KEEP2_Door2 = tonumber(SoR_KEEP_SPLIT_TEXT_STREAM[17])
  1104.                
  1105.                 local KEEP1_Lord = tonumber(SoR_KEEP_SPLIT_TEXT_STREAM[10])                            
  1106.                 local KEEP2_Lord = tonumber(SoR_KEEP_SPLIT_TEXT_STREAM[19])        
  1107.  
  1108.                 local KEEP1_CLAIM = SoR_KEEP_SPLIT_TEXT_STREAM[11]
  1109.                 local KEEP2_CLAIM = SoR_KEEP_SPLIT_TEXT_STREAM[20]
  1110.            
  1111.                 local KEEP1_Rank = StringSplit(tostring(KEEP1_RankA), ",")
  1112.                 local KEEP2_Rank = StringSplit(tostring(KEEP2_RankA), ",")
  1113.                 KEEP1_Rank[1] = tonumber(KEEP1_Rank[1])
  1114.                 KEEP2_Rank[1] = tonumber(KEEP2_Rank[1])
  1115.            
  1116.    
  1117.                 WindowClearAnchors("SoR_"..Window_Name.."Banner")
  1118.                 WindowAddAnchor("SoR_"..Window_Name.."Banner","top", "SoR_"..Window_Name, "top", 0,RoR_SoR.GetBanner())
  1119.                
  1120.                 WindowSetTintColor("SoR_"..Window_Name.."Background2Background2",175,175,175)      
  1121.    
  1122.                 if not RoR_SoR.KeepProgress[1][Window_Name] then RoR_SoR.KeepProgress[1][Window_Name] = 0 end
  1123.                 if not RoR_SoR.KeepProgress[2][Window_Name] then RoR_SoR.KeepProgress[2][Window_Name] = 0 end
  1124.                    
  1125.                 if KEEP1_Rank[2] ~= nil then           
  1126.                     WindowSetShowing("SoR_"..Window_Name.."KEEP1PROGRESS",true)            
  1127.                     WindowSetShowing("SoR_"..Window_Name.."KEEP1PROGRESSBAR",(tonumber(KEEP1_Rank[2]) > 6))
  1128.                    
  1129.                     if  tonumber(RoR_SoR.KeepProgress[1][Window_Name]) < (tonumber(KEEP1_Rank[2])) then
  1130.                         WindowStartAlphaAnimation("SoR_"..Window_Name.."KEEP1PROGRESSBLINK", 1, 1.0, 0.0, 1.5, true, 0.0, 0 ) --start the Door2 pulse
  1131.                         local Number_Randomizer = math.random(999)
  1132.                         RoR_SoR.NumberWindows[Number_Randomizer] = {timer=2.5}
  1133.                         CreateWindowFromTemplate("SoR_Number_Window"..Number_Randomizer, "Number_Window_Template", "SoR_"..Window_Name.."KEEP1PROGRESS")                       
  1134.                         WindowStartAlphaAnimation("SoR_Number_Window"..Number_Randomizer, 1, 1.0, 0.0, 1.5, true, 1.5, 0 ) --start the Door2 pulse
  1135.                         LabelSetText("SoR_Number_Window"..Number_Randomizer.."Label",L"+"..towstring(tonumber(KEEP1_Rank[2])-tonumber(RoR_SoR.KeepProgress[1][Window_Name])))
  1136.                         LabelSetText("SoR_Number_Window"..Number_Randomizer.."LabelBG",L"+"..towstring(tonumber(KEEP1_Rank[2])-tonumber(RoR_SoR.KeepProgress[1][Window_Name])))
  1137.                         WindowSetScale("SoR_Number_Window"..Number_Randomizer,WindowGetScale("RoR_SoR_Main_Window"))
  1138.                     end
  1139.                    
  1140.                     local BarWidth,BarHeight = WindowGetDimensions( "SoR_"..Window_Name.."KEEP1PROGRESS")
  1141.                     local TotalSize = BarWidth / 100
  1142.                     WindowSetDimensions( "SoR_"..Window_Name.."KEEP1PROGRESSBAR", math.abs(tonumber(KEEP1_Rank[2])*TotalSize), BarHeight )
  1143.                     RoR_SoR.KeepProgress[1][Window_Name] = KEEP1_Rank[2]
  1144.                 else
  1145.                     WindowSetShowing("SoR_"..Window_Name.."KEEP1PROGRESS",false)                   
  1146.                 end
  1147.            
  1148.                 if KEEP2_Rank[2] ~= nil then
  1149.                     WindowSetShowing("SoR_"..Window_Name.."KEEP2PROGRESS",true)                
  1150.                     WindowSetShowing("SoR_"..Window_Name.."KEEP2PROGRESSBAR",(tonumber(KEEP2_Rank[2]) > 6))
  1151.                    
  1152.                    
  1153.                     if  tonumber(RoR_SoR.KeepProgress[2][Window_Name]) < (tonumber(KEEP2_Rank[2])) then
  1154.                         WindowStartAlphaAnimation("SoR_"..Window_Name.."KEEP2PROGRESSBLINK", 1, 1.0, 0.0, 1.5, true, 0.0, 0 ) --start the Door2 pulse
  1155.                         local Number_Randomizer = math.random(999)
  1156.                         RoR_SoR.NumberWindows[Number_Randomizer] = {timer=2.5}
  1157.                         CreateWindowFromTemplate("SoR_Number_Window"..Number_Randomizer, "Number_Window_Template", "SoR_"..Window_Name.."KEEP2PROGRESS")                       
  1158.                         WindowStartAlphaAnimation("SoR_Number_Window"..Number_Randomizer, 1, 1.0, 0.0, 1.5, true, 1.5, 0 ) --start the Door2 pulse
  1159.                         LabelSetText("SoR_Number_Window"..Number_Randomizer.."Label",L"+"..towstring(tonumber(KEEP2_Rank[2])-tonumber(RoR_SoR.KeepProgress[2][Window_Name])))
  1160.                         LabelSetText("SoR_Number_Window"..Number_Randomizer.."LabelBG",L"+"..towstring(tonumber(KEEP2_Rank[2])-tonumber(RoR_SoR.KeepProgress[2][Window_Name])))
  1161.                         WindowSetScale("SoR_Number_Window"..Number_Randomizer,WindowGetScale("RoR_SoR_Main_Window"))
  1162.                     end
  1163.                    
  1164.                     local BarWidth,BarHeight = WindowGetDimensions( "SoR_"..Window_Name.."KEEP2PROGRESS")
  1165.                     local TotalSize = BarWidth / 100
  1166.                     WindowSetDimensions( "SoR_"..Window_Name.."KEEP2PROGRESSBAR",math.abs(tonumber(KEEP2_Rank[2])*TotalSize), BarHeight )
  1167.                     RoR_SoR.KeepProgress[2][Window_Name] = KEEP2_Rank[2]
  1168.                 else
  1169.                     WindowSetShowing("SoR_"..Window_Name.."KEEP2PROGRESS",false)               
  1170.                 end
  1171.  
  1172. --EXTRA SPLITS
  1173.                 local KEEP1_Special = StringSplit(tostring(KEEP1_Extra), ",")
  1174.                 local KEEP2_Special = StringSplit(tostring(KEEP2_Extra), ",")              
  1175.                
  1176.                 KEEP1_Special[1] = tonumber(KEEP1_Special[1])
  1177.                 KEEP2_Special[1] = tonumber(KEEP2_Special[1])
  1178.                
  1179.                 if KEEP1_Special[1] > 0 and 600 > KEEP1_Special[1] then LabelSetText("SoR_"..Window_Name.."KEEP1SAFETIMER",TimeUtils.FormatTimeCondensed(KEEP1_Special[1]));LabelSetText("SoR_"..Window_Name.."KEEP1SAFETIMERBG",LabelGetText("SoR_"..Window_Name.."KEEP1SAFETIMER")) end
  1180.                 if KEEP2_Special[1] > 0 and 600 > KEEP2_Special[1] then LabelSetText("SoR_"..Window_Name.."KEEP2SAFETIMER",TimeUtils.FormatTimeCondensed(KEEP2_Special[1]));LabelSetText("SoR_"..Window_Name.."KEEP2SAFETIMERBG",LabelGetText("SoR_"..Window_Name.."KEEP2SAFETIMER")) end
  1181.        
  1182.                 RoR_SoR.SafeKeep[Window_Name] = {[1]=KEEP1_Special[1],[2]=KEEP2_Special[1]}
  1183.        
  1184.                 WindowSetShowing("SoR_"..Window_Name.."KEEP1SAFE",KEEP1_Special[1] > 0 and 585 > KEEP1_Special[1])
  1185.                 WindowSetShowing("SoR_"..Window_Name.."KEEP2SAFE",KEEP2_Special[1] > 0 and 585 > KEEP2_Special[1])
  1186.                
  1187.                 local perc1 = KEEP1_Special[1]/60
  1188.                 local perc2 = KEEP2_Special[1]/60
  1189.                     local FillStart = 90
  1190.                     local FillEnd = 360
  1191.                     --local startFill = 280 * (1 - (MoralePerC / GetMoralePercentForLevel(q)))
  1192.                     CircleImageSetFillParams("SoR_"..Window_Name.."KEEP1SAFECircle", FillStart,   FillEnd-(perc1 * 36))
  1193.                     CircleImageSetFillParams("SoR_"..Window_Name.."KEEP2SAFECircle", FillStart,   FillEnd-(perc2 * 36))        
  1194.        
  1195.         ---
  1196.  
  1197.        
  1198.         RoR_SoR.KEEP_IDs[Window_Name] = {
  1199.             [1]={
  1200.                 ID=KEEP1_ID,
  1201.                 Owner=KEEP1_Owner,
  1202.                 Rank=KEEP1_Rank[1],
  1203.                 State=KEEP1_State,
  1204.                 Claim=KEEP1_CLAIM,
  1205.                 Supply=KEEP1_Rank[2]
  1206.             },
  1207.             [2]={
  1208.                 ID=KEEP2_ID,
  1209.                 Owner=KEEP2_Owner,
  1210.                 Rank=KEEP2_Rank[1],
  1211.                 State=KEEP2_State,
  1212.                 Claim=KEEP2_CLAIM,
  1213.                 Supply=KEEP2_Rank[2]
  1214.             }
  1215.         }
  1216.                 RoR_SoR.KeepStatus[Window_Name] = {[1]=L"",[2]=L""}
  1217.                 RoR_SoR.ZoneStatus[Window_Name] = {}       
  1218.     --Claim button and text    
  1219.             local Claimed_Keep_1 = RoR_SoR.GetKeepClaim2(KEEP1_ID)
  1220.             local Claimed_Keep_2 = RoR_SoR.GetKeepClaim2(KEEP2_ID)
  1221.            
  1222.             local Can_Claim = GuildWindowTabAdmin.GetGuildCommandPermission(SystemData.GuildPermissons.CLAIM_KEEP, GuildWindowTabAdmin.GetLocalMemberTitleNumber())
  1223.             local Guild_Name = towstring(GameData.Guild.m_GuildName) or L""
  1224.             local Claimed_Keep_1_Name = ((towstring(KEEP1_CLAIM) == Guild_Name) and Can_Claim) or false
  1225.             local Claimed_Keep_2_Name = ((towstring(KEEP2_CLAIM) == Guild_Name) and Can_Claim) or false
  1226.  
  1227.             WindowSetShowing("SoR_"..Window_Name.."CLAIM_WINDOW1BUTTON",Claimed_Keep_1)
  1228.             WindowSetShowing("SoR_"..Window_Name.."CLAIM_WINDOW2BUTTON",Claimed_Keep_2)    
  1229.             WindowSetShowing("SoR_"..Window_Name.."CLAIM_WINDOW1TEXT",not Claimed_Keep_1 and not Claimed_Keep_1_Name)
  1230.             WindowSetShowing("SoR_"..Window_Name.."CLAIM_WINDOW2TEXT",not Claimed_Keep_2 and not Claimed_Keep_2_Name)      
  1231.             WindowSetShowing("SoR_"..Window_Name.."CLAIM_WINDOW1TEXT_BG",not Claimed_Keep_1 and not Claimed_Keep_1_Name)
  1232.             WindowSetShowing("SoR_"..Window_Name.."CLAIM_WINDOW2TEXT_BG",not Claimed_Keep_2 and not Claimed_Keep_2_Name)           
  1233.        
  1234.             WindowSetShowing("SoR_"..Window_Name.."CLAIM_WINDOW1BUTTON2",Claimed_Keep_1_Name)
  1235.             WindowSetShowing("SoR_"..Window_Name.."CLAIM_WINDOW2BUTTON2",Claimed_Keep_2_Name)          
  1236.  
  1237.    
  1238.             ButtonSetText("SoR_"..Window_Name.."CLAIM_WINDOW1BUTTON",L"[CLAIM KEEP]")
  1239.             ButtonSetText("SoR_"..Window_Name.."CLAIM_WINDOW2BUTTON",L"[CLAIM KEEP]")
  1240.            
  1241.             WindowSetId("SoR_"..Window_Name.."CLAIM_WINDOW1BUTTON2",KEEP1_ID)
  1242.             WindowSetId("SoR_"..Window_Name.."CLAIM_WINDOW2BUTTON2",KEEP2_ID)
  1243.  
  1244.             ButtonSetText("SoR_"..Window_Name.."CLAIM_WINDOW1BUTTON2",L"[RELEASE KEEP]")
  1245.             ButtonSetText("SoR_"..Window_Name.."CLAIM_WINDOW2BUTTON2",L"[RELEASE KEEP]")               
  1246.            
  1247.            
  1248. --GameData.Guild.m_GuildName           
  1249.                
  1250.     --Calculate and show AAO and Population
  1251.     local Order_Pop
  1252.     local Destro_Pop
  1253.    
  1254. if RoR_SoR.Settings.AAONumbers == true then
  1255.     Order_Pop = PopConvert[tostring(SoR_KEEP_SPLIT_TEXT_STREAM[22])] or SoR_KEEP_SPLIT_TEXT_STREAM[22]
  1256.     Destro_Pop = PopConvert[tostring(SoR_KEEP_SPLIT_TEXT_STREAM[23])] or SoR_KEEP_SPLIT_TEXT_STREAM[23]
  1257. else
  1258.     Order_Pop = SoR_KEEP_SPLIT_TEXT_STREAM[22]
  1259.     Destro_Pop = SoR_KEEP_SPLIT_TEXT_STREAM[23]
  1260. end
  1261.  
  1262.                     RoR_SoR.ZoneStatus[Window_Name].Order_Pop = Order_Pop
  1263.                     RoR_SoR.ZoneStatus[Window_Name].Destro_Pop = Destro_Pop
  1264.                
  1265.                 RoR_SoR.ZoneStatus[Window_Name].AAO = StringSplit(tostring(SoR_KEEP_SPLIT_TEXT_STREAM[21]), ",")
  1266.  
  1267.                 for k,v in pairs(RoR_SoR.TierNames[4]) do
  1268.                     if tostring(v) == tostring(Window_Name) then
  1269.                    
  1270.                     if RoR_SoR.Settings.AAONumbers == true then
  1271.                             Order_Pop = PopConvert[tostring(SoR_KEEP_SPLIT_TEXT_STREAM[23])] or SoR_KEEP_SPLIT_TEXT_STREAM[23]
  1272.                             Destro_Pop = PopConvert[tostring(SoR_KEEP_SPLIT_TEXT_STREAM[24])] or SoR_KEEP_SPLIT_TEXT_STREAM[24]
  1273.                     else
  1274.                             Order_Pop = SoR_KEEP_SPLIT_TEXT_STREAM[23]
  1275.                             Destro_Pop = SoR_KEEP_SPLIT_TEXT_STREAM[24]
  1276.                     end
  1277.                                            
  1278.                         RoR_SoR.ZoneStatus[Window_Name].AAO = StringSplit(tostring(SoR_KEEP_SPLIT_TEXT_STREAM[22]), ",")
  1279.                        
  1280.                         RoR_SoR.ZoneStatus[Window_Name].Order_Pop = Order_Pop
  1281.                         RoR_SoR.ZoneStatus[Window_Name].Destro_Pop = Destro_Pop
  1282.                        
  1283.                        
  1284.                         break
  1285.                     end
  1286.                 end
  1287.                
  1288.                 if RoR_SoR.ZoneStatus[Window_Name].AAO[2] ~= nil then
  1289.                 local ClaimColor = RoR_SoR.RealmColors[RoR_SoR.ZoneStatus[Window_Name].AAO[1]+1]
  1290.                 LabelSetTextColor("SoR_"..Window_Name.."AAO",ClaimColor.r,ClaimColor.g,ClaimColor.b)
  1291.                 LabelSetText("SoR_"..Window_Name.."AAO",towstring(RoR_SoR.ZoneStatus[Window_Name].AAO[2])..L"%")   
  1292.                 LabelSetText("SoR_"..Window_Name.."AAO_BG",towstring(RoR_SoR.ZoneStatus[Window_Name].AAO[2])..L"%")                        
  1293.                 WindowSetShowing("SoR_"..Window_Name.."AAO",tonumber(RoR_SoR.ZoneStatus[Window_Name].AAO[2])>0) -- Hide T1 Stuff
  1294.                 WindowSetShowing("SoR_"..Window_Name.."AAO_BG",tonumber(RoR_SoR.ZoneStatus[Window_Name].AAO[2])>0) -- Hide T1 Stuff        
  1295.                 else
  1296.                 WindowSetShowing("SoR_"..Window_Name.."AAO",false) -- Hide T1 Stuff
  1297.                 WindowSetShowing("SoR_"..Window_Name.."AAO_BG",false) -- Hide T1 Stuff                     
  1298.                 end
  1299.                
  1300.                 WindowSetShowing("SoR_"..Window_Name.."VP",false) -- Hide T1 Stuff
  1301.                 WindowSetShowing("SoR_"..Window_Name.."CLAIM_WINDOW1TEXTPROXY",false)
  1302.                 WindowSetShowing("SoR_"..Window_Name.."CLAIM_WINDOW2TEXTPROXY",false)          
  1303.                 DynamicImageSetTexture( "SoR_"..Window_Name.."KEEP1KEEPICON", RoR_SoR.GetKeepTexture(KEEP1_Owner,KEEP1_State),42,42 )  
  1304.                 DynamicImageSetTexture( "SoR_"..Window_Name.."KEEP2KEEPICON", RoR_SoR.GetKeepTexture(KEEP2_Owner,KEEP2_State),42,42 )
  1305.  
  1306.                 DynamicImageSetTexture( "SoR_"..Window_Name.."KEEP1LORD_ICON", RoR_SoR.KeepLord[KEEP1_Owner],22,22 )   
  1307.                 DynamicImageSetTexture( "SoR_"..Window_Name.."KEEP2LORD_ICON", RoR_SoR.KeepLord[KEEP2_Owner],22,22 )           
  1308.     --          DynamicImageSetTextureSlice( "SoR_"..Window_Name.."KEEP1LORD_ICON", RoR_SoR.KeepLord[KEEP1_Owner] )
  1309.     --          DynamicImageSetTextureSlice( "SoR_"..Window_Name.."KEEP2LORD_ICON", RoR_SoR.KeepLord[KEEP2_Owner] )        
  1310.        
  1311.                 LabelSetText("SoR_"..Window_Name.."POPOrder",towstring(RoR_SoR.ZoneStatus[Window_Name].Order_Pop)) 
  1312.                 LabelSetText("SoR_"..Window_Name.."POPOrder_BG",towstring(RoR_SoR.ZoneStatus[Window_Name].Order_Pop))              
  1313.                 LabelSetText("SoR_"..Window_Name.."POPDestro",towstring(RoR_SoR.ZoneStatus[Window_Name].Destro_Pop))               
  1314.                 LabelSetText("SoR_"..Window_Name.."POPDestro_BG",towstring(RoR_SoR.ZoneStatus[Window_Name].Destro_Pop))        
  1315.     --Check if keeps are claimed and do the keep branding
  1316.     if KEEP1_CLAIM ~= "0" then
  1317.     local ClaimColor = RoR_SoR.RealmColors[KEEP1_Owner+1]
  1318.     LabelSetText("SoR_"..Window_Name.."CLAIM_WINDOW1TEXTPROXY",L"<"..towstring(KEEP1_CLAIM)..L">")
  1319.     local Width,Height = LabelGetTextDimensions("SoR_"..Window_Name.."CLAIM_WINDOW1TEXTPROXY")
  1320.     if Width < 110 then
  1321.     LabelSetText("SoR_"..Window_Name.."CLAIM_WINDOW1TEXT",L"<"..towstring(KEEP1_CLAIM)..L">")
  1322.     LabelSetText("SoR_"..Window_Name.."CLAIM_WINDOW1TEXT_BG",L"<"..towstring(KEEP1_CLAIM)..L">")
  1323.     else
  1324.    
  1325.     local ShortGName = towstring(KEEP1_CLAIM)
  1326.     ShortGName = wstring.gsub(ShortGName, L" of ", L"O")
  1327.     ShortGName = wstring.gsub(ShortGName, L"%s", L"")
  1328.     -- ShortGName = wstring.gsub(ShortGName, L"%l*", L"")
  1329.     ShortGName = towstring(wstring.match(towstring(ShortGName), L"([^^]+)^?.*"))
  1330.     --local ShortGName = wstring.match(wstring.gsub(wstring.gsub(wstring.gsub(towstring(KEEP1_CLAIM),L" of ", L"O"), L"%s",L""), L"%l*", L""), L"([^^]+)^?.*")  --This is for Shortening Guildnames
  1331.     LabelSetText("SoR_"..Window_Name.."CLAIM_WINDOW1TEXT",L"<"..towstring(ShortGName)..L">")
  1332.     LabelSetText("SoR_"..Window_Name.."CLAIM_WINDOW1TEXT_BG",L"<"..towstring(ShortGName)..L">")
  1333.     end
  1334.  
  1335.     LabelSetTextColor("SoR_"..Window_Name.."CLAIM_WINDOW1TEXT",ClaimColor.r,ClaimColor.g,ClaimColor.b)
  1336.     WindowSetShowing("SoR_"..Window_Name.."KEEP1KEEPGLOW",true)
  1337.     else
  1338.     local ClaimColor = RoR_SoR.RealmColors[1]
  1339.    
  1340.     if RoR_SoR.Settings.ShowUnclaimed then
  1341.         local Keep_Name = L""
  1342.        
  1343.         if RoR_SoR.Settings.ShowBONames then
  1344.             Keep_Name = towstring(GetKeepName(tonumber(KEEP1_ID)))
  1345.         else
  1346.             Keep_Name = L"UnClaimed"
  1347.         end
  1348.            
  1349.         LabelSetText("SoR_"..Window_Name.."CLAIM_WINDOW1TEXT",Keep_Name) --unclaimed
  1350.         LabelSetText("SoR_"..Window_Name.."CLAIM_WINDOW1TEXT_BG",Keep_Name) --unclaimed
  1351.     else
  1352.         LabelSetText("SoR_"..Window_Name.."CLAIM_WINDOW1TEXT",L"") --unclaimed
  1353.         LabelSetText("SoR_"..Window_Name.."CLAIM_WINDOW1TEXT_BG",L"") --unclaimed  
  1354.     end
  1355.    
  1356.     LabelSetTextColor("SoR_"..Window_Name.."CLAIM_WINDOW1TEXT",ClaimColor.r,ClaimColor.g,ClaimColor.b)
  1357.     WindowSetShowing("SoR_"..Window_Name.."KEEP1KEEPGLOW",false)
  1358.     end
  1359.  
  1360.     if KEEP2_CLAIM ~= "0" then
  1361.     local ClaimColor = RoR_SoR.RealmColors[KEEP2_Owner+1]
  1362.     LabelSetText("SoR_"..Window_Name.."CLAIM_WINDOW2TEXTPROXY",L"<"..towstring(KEEP2_CLAIM)..L">")
  1363.     local Width,Height = LabelGetTextDimensions("SoR_"..Window_Name.."CLAIM_WINDOW2TEXTPROXY")
  1364.     if Width < 110 then
  1365.     LabelSetText("SoR_"..Window_Name.."CLAIM_WINDOW2TEXT",L"<"..towstring(KEEP2_CLAIM)..L">")
  1366.     LabelSetText("SoR_"..Window_Name.."CLAIM_WINDOW2TEXT_BG",L"<"..towstring(KEEP2_CLAIM)..L">")
  1367.     else
  1368.     local ShortGName = towstring(KEEP2_CLAIM)
  1369.     ShortGName = wstring.gsub(ShortGName, L" of ", L"O")
  1370.     ShortGName = wstring.gsub(ShortGName, L"%s", L"")
  1371.     -- ShortGName = wstring.gsub(ShortGName, L"%l*", L"")
  1372.     ShortGName = towstring(wstring.match(towstring(ShortGName), L"([^^]+)^?.*"))
  1373.     LabelSetText("SoR_"..Window_Name.."CLAIM_WINDOW2TEXT",L"<"..towstring(ShortGName)..L">")
  1374.     LabelSetText("SoR_"..Window_Name.."CLAIM_WINDOW2TEXT_BG",L"<"..towstring(ShortGName)..L">")
  1375.     end
  1376.  
  1377.     LabelSetTextColor("SoR_"..Window_Name.."CLAIM_WINDOW2TEXT",ClaimColor.r,ClaimColor.g,ClaimColor.b)
  1378.     WindowSetShowing("SoR_"..Window_Name.."KEEP2KEEPGLOW",true)
  1379.     else
  1380.     local ClaimColor = RoR_SoR.RealmColors[1]
  1381.    
  1382.     if RoR_SoR.Settings.ShowUnclaimed then
  1383.         local Keep_Name = L""
  1384.        
  1385.         if RoR_SoR.Settings.ShowBONames then
  1386.             Keep_Name = towstring(GetKeepName(tonumber(KEEP2_ID)))
  1387.         else
  1388.             Keep_Name = L"UnClaimed"
  1389.         end
  1390.        
  1391.         LabelSetText("SoR_"..Window_Name.."CLAIM_WINDOW2TEXT",Keep_Name)--unclaimed
  1392.         LabelSetText("SoR_"..Window_Name.."CLAIM_WINDOW2TEXT_BG",Keep_Name)--unclaimed
  1393.     else
  1394.         LabelSetText("SoR_"..Window_Name.."CLAIM_WINDOW2TEXT",L"")--unclaimed
  1395.         LabelSetText("SoR_"..Window_Name.."CLAIM_WINDOW2TEXT_BG",L"")--unclaimed
  1396.     end
  1397.    
  1398.     LabelSetTextColor("SoR_"..Window_Name.."CLAIM_WINDOW2TEXT",ClaimColor.r,ClaimColor.g,ClaimColor.b)
  1399.     WindowSetShowing("SoR_"..Window_Name.."KEEP2KEEPGLOW",false)
  1400.     end
  1401.  
  1402.                 WindowSetShowing("SoR_"..Window_Name.."KEEP1LORD_ICON",(KEEP1_State == 4))
  1403.                 WindowSetShowing("SoR_"..Window_Name.."KEEP2LORD_ICON",(KEEP2_State == 4)) 
  1404.  
  1405.         --Set the different Keep states
  1406.         --KEEP 1
  1407.     WindowSetShowing("SoR_"..Window_Name.."KEEP1HPBAR",false)      
  1408.    
  1409.         local BarWidth,BarHeight = WindowGetDimensions( "SoR_"..Window_Name.."KEEP1HPBAR")
  1410.         local TotalSize = BarWidth / 100
  1411.    
  1412.     local Keep1SiegeData = GetKeepData(KEEP1_ID)
  1413.     if Keep1SiegeData.siege then
  1414.         DynamicImageSetTextureSlice("SoR_"..Window_Name.."KEEP1RAM",RoR_SoR.Ram[KEEP1_Owner])
  1415.         WindowSetShowing("SoR_"..Window_Name.."KEEP1RAM",Keep1SiegeData.siege[1].current>0)
  1416.     else
  1417.         WindowSetShowing("SoR_"..Window_Name.."KEEP1RAM",false)
  1418.     end
  1419.    
  1420.     local LabelText = L""  
  1421.         if KEEP1_State == 1 then    --Safe
  1422.         LabelSetText("SoR_"..Window_Name.."KEEP1HEALTH",L"")
  1423.         LabelSetText("SoR_"..Window_Name.."KEEP1HEALTH_BG",L"")
  1424.         WindowStopAlphaAnimation( "SoR_"..Window_Name.."KEEP1KEEPDOOR1")
  1425.         WindowStopAlphaAnimation( "SoR_"..Window_Name.."KEEP1KEEPDOOR2")
  1426.         WindowStopAlphaAnimation( "SoR_"..Window_Name.."KEEP1LORD_ICON")
  1427.         RoR_SoR.KEEP_States[Window_Name][1] = 1
  1428.         WindowSetShowing("SoR_"..Window_Name.."KEEP1HPBAR",false)      
  1429.         elseif KEEP1_State == 2 then    --OuterDoor attacked
  1430.             if KEEP1_Door2 > 0 then LabelText = towstring(KEEP1_Door2)..L"%" else LabelText = L"" end
  1431.             if RoR_SoR.KEEP_States[Window_Name][1] ~= 2 then
  1432.                 RoR_SoR.KEEP_States[Window_Name][1] = 2    
  1433.                 WindowStartAlphaAnimation( "SoR_"..Window_Name.."KEEP1KEEPDOOR2", Window.AnimationType.LOOP, 1.0, 0.0, 0.5, false, 0.0, 0 ) --start the Door2 pulse
  1434.             end
  1435.  
  1436.             LabelSetText("SoR_"..Window_Name.."KEEP1HEALTH",LabelText)
  1437.             LabelSetText("SoR_"..Window_Name.."KEEP1HEALTH_BG",LabelText)      
  1438.             RoR_SoR.KeepStatus[Window_Name][1] = LabelText
  1439.             WindowSetShowing("SoR_"..Window_Name.."KEEP1HPBAR",LabelText ~= L"")
  1440.             WindowSetDimensions( "SoR_"..Window_Name.."KEEP1HPBARBAR", math.abs(tonumber(KEEP1_Door2)*TotalSize), BarHeight )  
  1441.    
  1442.             if KEEP1_Door2 < RoR_SoR.KeepHealth[Window_Name][KEEP1_Owner] then
  1443.                         local Number_Randomizer = math.random(999)
  1444.                         RoR_SoR.NumberWindows[Number_Randomizer] = {timer=2.5}
  1445.                         CreateWindowFromTemplate("SoR_Number_Window"..Number_Randomizer, "Number_Window_Template", "SoR_"..Window_Name.."KEEP1HEALTH")                     
  1446.                         WindowStartAlphaAnimation("SoR_Number_Window"..Number_Randomizer, 1, 1.0, 0.0, 1.5, true, 1.5, 0 ) --start the Door2 pulse
  1447.                         LabelSetText("SoR_Number_Window"..Number_Randomizer.."Label",L"-"..towstring(RoR_SoR.KeepHealth[Window_Name][KEEP1_Owner]-KEEP1_Door2))
  1448.                         LabelSetTextColor("SoR_Number_Window"..Number_Randomizer.."Label",DefaultColor.ORANGE.r,DefaultColor.ORANGE.g,DefaultColor.ORANGE.b)
  1449.                         LabelSetText("SoR_Number_Window"..Number_Randomizer.."LabelBG",L"-"..towstring(RoR_SoR.KeepHealth[Window_Name][KEEP1_Owner]-KEEP1_Door2))
  1450.                         WindowSetScale("SoR_Number_Window"..Number_Randomizer,WindowGetScale("RoR_SoR_Main_Window"))
  1451.             elseif KEEP1_Door2 > RoR_SoR.KeepHealth[Window_Name][KEEP1_Owner] then
  1452.                         local Number_Randomizer = math.random(999)
  1453.                         RoR_SoR.NumberWindows[Number_Randomizer] = {timer=2.5}
  1454.                         CreateWindowFromTemplate("SoR_Number_Window"..Number_Randomizer, "Number_Window_Template", "SoR_"..Window_Name.."KEEP1HEALTH")                     
  1455.                         WindowStartAlphaAnimation("SoR_Number_Window"..Number_Randomizer, 1, 1.0, 0.0, 1.5, true, 1.5, 0 ) --start the Door2 pulse
  1456.                         LabelSetText("SoR_Number_Window"..Number_Randomizer.."Label",L"+"..towstring(KEEP1_Door2 - RoR_SoR.KeepHealth[Window_Name][KEEP1_Owner]))
  1457.                         LabelSetTextColor("SoR_Number_Window"..Number_Randomizer.."Label",DefaultColor.GREEN.r,DefaultColor.GREEN.g,DefaultColor.GREEN.b)
  1458.                         LabelSetText("SoR_Number_Window"..Number_Randomizer.."LabelBG",L"+"..towstring(KEEP1_Door2 - RoR_SoR.KeepHealth[Window_Name][KEEP1_Owner]))
  1459.                         WindowSetScale("SoR_Number_Window"..Number_Randomizer,WindowGetScale("RoR_SoR_Main_Window"))
  1460.             end
  1461.    
  1462.             RoR_SoR.KeepHealth[Window_Name][KEEP1_Owner] = KEEP1_Door2
  1463.            
  1464.         elseif KEEP1_State == 3 then    --InnerDoor attacked
  1465.             if KEEP1_Door1 > 0 then LabelText = towstring(KEEP1_Door1)..L"%" else LabelText = L"" end  
  1466.             if RoR_SoR.KEEP_States[Window_Name][1] ~= 3 then
  1467.                 RoR_SoR.KEEP_States[Window_Name][1] = 3    
  1468.                 WindowStartAlphaAnimation( "SoR_"..Window_Name.."KEEP1KEEPDOOR1", Window.AnimationType.LOOP, 1.0, 0.0, 0.5, false, 0.0, 0 ) --start the Door1 pulse
  1469.             end
  1470.            
  1471.            
  1472.             LabelSetText("SoR_"..Window_Name.."KEEP1HEALTH",LabelText) 
  1473.             LabelSetText("SoR_"..Window_Name.."KEEP1HEALTH_BG",LabelText)  
  1474.             RoR_SoR.KeepStatus[Window_Name][1] = LabelText 
  1475.             WindowSetShowing("SoR_"..Window_Name.."KEEP1HPBAR", LabelText ~= L"")
  1476.             WindowSetDimensions( "SoR_"..Window_Name.."KEEP1HPBARBAR", math.abs(tonumber(KEEP1_Door1)*TotalSize), BarHeight )  
  1477.            
  1478.             if KEEP1_Door1 < RoR_SoR.KeepHealth[Window_Name][KEEP1_Owner] then
  1479.                         local Number_Randomizer = math.random(999)
  1480.                         RoR_SoR.NumberWindows[Number_Randomizer] = {timer=2.5}
  1481.                         CreateWindowFromTemplate("SoR_Number_Window"..Number_Randomizer, "Number_Window_Template", "SoR_"..Window_Name.."KEEP1HEALTH")                     
  1482.                         WindowStartAlphaAnimation("SoR_Number_Window"..Number_Randomizer, 1, 1.0, 0.0, 1.5, true, 1.5, 0 ) --start the Door2 pulse
  1483.                         LabelSetText("SoR_Number_Window"..Number_Randomizer.."Label",L"-"..towstring(RoR_SoR.KeepHealth[Window_Name][KEEP1_Owner]-KEEP1_Door1))
  1484.                         LabelSetTextColor("SoR_Number_Window"..Number_Randomizer.."Label",DefaultColor.ORANGE.r,DefaultColor.ORANGE.g,DefaultColor.ORANGE.b)
  1485.                         LabelSetText("SoR_Number_Window"..Number_Randomizer.."LabelBG",L"-"..towstring(RoR_SoR.KeepHealth[Window_Name][KEEP1_Owner]-KEEP1_Door1))
  1486.                         WindowSetScale("SoR_Number_Window"..Number_Randomizer,WindowGetScale("RoR_SoR_Main_Window"))
  1487.             elseif KEEP1_Door1 > RoR_SoR.KeepHealth[Window_Name][KEEP1_Owner] then
  1488.                         local Number_Randomizer = math.random(999)
  1489.                         RoR_SoR.NumberWindows[Number_Randomizer] = {timer=2.5}
  1490.                         CreateWindowFromTemplate("SoR_Number_Window"..Number_Randomizer, "Number_Window_Template", "SoR_"..Window_Name.."KEEP1HEALTH")                     
  1491.                         WindowStartAlphaAnimation("SoR_Number_Window"..Number_Randomizer, 1, 1.0, 0.0, 1.5, true, 1.5, 0 ) --start the Door2 pulse
  1492.                         LabelSetText("SoR_Number_Window"..Number_Randomizer.."Label",L"+"..towstring(KEEP1_Door1 - RoR_SoR.KeepHealth[Window_Name][KEEP1_Owner]))
  1493.                         LabelSetTextColor("SoR_Number_Window"..Number_Randomizer.."Label",DefaultColor.GREEN.r,DefaultColor.GREEN.g,DefaultColor.GREEN.b)
  1494.                         LabelSetText("SoR_Number_Window"..Number_Randomizer.."LabelBG",L"+"..towstring(KEEP1_Door1 - RoR_SoR.KeepHealth[Window_Name][KEEP1_Owner]))
  1495.                         WindowSetScale("SoR_Number_Window"..Number_Randomizer,WindowGetScale("RoR_SoR_Main_Window"))
  1496.             end
  1497.            
  1498.            
  1499.            
  1500.             RoR_SoR.KeepHealth[Window_Name][KEEP1_Owner] = KEEP1_Door1
  1501.         elseif KEEP1_State == 4 then    --Lord Attacked
  1502.  
  1503.  
  1504.        
  1505.         LabelSetText("SoR_"..Window_Name.."KEEP1HEALTH",towstring(KEEP1_Lord)..L"%")
  1506.         LabelSetText("SoR_"..Window_Name.."KEEP1HEALTH_BG",towstring(KEEP1_Lord)..L"%")
  1507.         RoR_SoR.KeepStatus[Window_Name][1] = towstring(KEEP1_Lord)..L"%"   
  1508.         WindowSetShowing("SoR_"..Window_Name.."KEEP1HPBAR",LabelGetText("SoR_"..Window_Name.."KEEP1HEALTH") ~= L"")
  1509.         WindowSetDimensions( "SoR_"..Window_Name.."KEEP1HPBARBAR", math.abs(tonumber(KEEP1_Lord)*TotalSize), BarHeight )   
  1510.             if RoR_SoR.KEEP_States[Window_Name][1] ~= 4 then
  1511.                 RoR_SoR.KEEP_States[Window_Name][1] = 4
  1512.                 WindowStartAlphaAnimation( "SoR_"..Window_Name.."KEEP1LORD_ICON", Window.AnimationType.LOOP, 1.0, 0.0, 0.5, false, 0.0, 0 ) --start the Lord pulse         
  1513.             end
  1514.        
  1515.             if KEEP1_Lord < RoR_SoR.KeepHealth[Window_Name][KEEP1_Owner] then
  1516.                         local Number_Randomizer = math.random(999)
  1517.                         RoR_SoR.NumberWindows[Number_Randomizer] = {timer=2.5}
  1518.                         CreateWindowFromTemplate("SoR_Number_Window"..Number_Randomizer, "Number_Window_Template", "SoR_"..Window_Name.."KEEP1HEALTH")                     
  1519.                         WindowStartAlphaAnimation("SoR_Number_Window"..Number_Randomizer, 1, 1.0, 0.0, 1.5, true, 1.5, 0 ) --start the Door2 pulse
  1520.                         LabelSetText("SoR_Number_Window"..Number_Randomizer.."Label",L"-"..towstring(RoR_SoR.KeepHealth[Window_Name][KEEP1_Owner]-KEEP1_Lord))
  1521.                         LabelSetTextColor("SoR_Number_Window"..Number_Randomizer.."Label",DefaultColor.ORANGE.r,DefaultColor.ORANGE.g,DefaultColor.ORANGE.b)
  1522.                         LabelSetText("SoR_Number_Window"..Number_Randomizer.."LabelBG",L"-"..towstring(RoR_SoR.KeepHealth[Window_Name][KEEP1_Owner]-KEEP1_Lord))
  1523.                         WindowSetScale("SoR_Number_Window"..Number_Randomizer,WindowGetScale("RoR_SoR_Main_Window"))
  1524.             elseif KEEP1_Lord > RoR_SoR.KeepHealth[Window_Name][KEEP1_Owner] then
  1525.                         local Number_Randomizer = math.random(999)
  1526.                         RoR_SoR.NumberWindows[Number_Randomizer] = {timer=2.5}
  1527.                         CreateWindowFromTemplate("SoR_Number_Window"..Number_Randomizer, "Number_Window_Template", "SoR_"..Window_Name.."KEEP1HEALTH")                     
  1528.                         WindowStartAlphaAnimation("SoR_Number_Window"..Number_Randomizer, 1, 1.0, 0.0, 1.5, true, 1.5, 0 ) --start the Door2 pulse
  1529.                         LabelSetText("SoR_Number_Window"..Number_Randomizer.."Label",L"+"..towstring(KEEP1_Lord - RoR_SoR.KeepHealth[Window_Name][KEEP1_Owner]))
  1530.                         LabelSetTextColor("SoR_Number_Window"..Number_Randomizer.."Label",DefaultColor.GREEN.r,DefaultColor.GREEN.g,DefaultColor.GREEN.b)
  1531.                         LabelSetText("SoR_Number_Window"..Number_Randomizer.."LabelBG",L"+"..towstring(KEEP1_Lord - RoR_SoR.KeepHealth[Window_Name][KEEP1_Owner]))
  1532.                         WindowSetScale("SoR_Number_Window"..Number_Randomizer,WindowGetScale("RoR_SoR_Main_Window"))
  1533.             end
  1534.        
  1535.         RoR_SoR.KeepHealth[Window_Name][KEEP1_Owner] = KEEP1_Lord
  1536.         elseif KEEP1_State == 5 then    --Captured
  1537.             RoR_SoR.KEEP_States[Window_Name][1] = 5
  1538.             LabelSetText("SoR_"..Window_Name.."KEEP1HEALTH",L"Captured")
  1539.             LabelSetText("SoR_"..Window_Name.."KEEP1HEALTH_BG",L"Captured")
  1540.             WindowSetShowing("SoR_"..Window_Name.."KEEP1HPBAR",false)
  1541.         elseif KEEP1_State == 6 then    --Locked
  1542.             RoR_SoR.KEEP_States[Window_Name][1] = 6
  1543.             LabelSetText("SoR_"..Window_Name.."KEEP1HEALTH",L"Locked")     
  1544.             LabelSetText("SoR_"..Window_Name.."KEEP1HEALTH_BG",L"Locked")      
  1545.             WindowSetShowing("SoR_"..Window_Name.."KEEP1HPBAR",false)
  1546.         end
  1547.        
  1548.        
  1549.     local Keep2SiegeData = GetKeepData(KEEP2_ID)
  1550.     if Keep2SiegeData.siege then
  1551.         DynamicImageSetTextureSlice("SoR_"..Window_Name.."KEEP2RAM",RoR_SoR.Ram[KEEP2_Owner])
  1552.         WindowSetShowing("SoR_"..Window_Name.."KEEP2RAM",Keep2SiegeData.siege[1].current>0)
  1553.     else
  1554.         WindowSetShowing("SoR_"..Window_Name.."KEEP2RAM",false)
  1555.     end
  1556.         --KEEP 2
  1557.         WindowSetShowing("SoR_"..Window_Name.."KEEP2HPBAR",false)          
  1558.        
  1559.         local BarWidth2,BarHeight2 = WindowGetDimensions( "SoR_"..Window_Name.."KEEP2HPBAR")
  1560.         local TotalSize2 = BarWidth2 / 100
  1561.        
  1562.         if KEEP2_State == 1 then    --Safe
  1563.         LabelSetText("SoR_"..Window_Name.."KEEP2HEALTH",L"")
  1564.         LabelSetText("SoR_"..Window_Name.."KEEP2HEALTH_BG",L"")
  1565.         WindowStopAlphaAnimation( "SoR_"..Window_Name.."KEEP2KEEPDOOR1")
  1566.         WindowStopAlphaAnimation( "SoR_"..Window_Name.."KEEP2KEEPDOOR2")
  1567.         WindowStopAlphaAnimation( "SoR_"..Window_Name.."KEEP2LORD_ICON")
  1568.         RoR_SoR.KEEP_States[Window_Name][2] = 1
  1569.         WindowSetShowing("SoR_"..Window_Name.."KEEP2HPBAR",false)
  1570.         elseif KEEP2_State == 2 then    --OuterDoor attacked
  1571.             if KEEP2_Door2 > 0 then LabelText = towstring(KEEP2_Door2)..L"%" else LabelText = L"" end
  1572.             if RoR_SoR.KEEP_States[Window_Name][2] ~= 2 then
  1573.                 RoR_SoR.KEEP_States[Window_Name][2] = 2    
  1574.                 WindowStartAlphaAnimation( "SoR_"..Window_Name.."KEEP2KEEPDOOR2", Window.AnimationType.LOOP, 1.0, 0.0, 0.5, false, 0.0, 0 ) --start the Door2 pulse
  1575.             end
  1576.  
  1577.            
  1578.             LabelSetText("SoR_"..Window_Name.."KEEP2HEALTH",LabelText)
  1579.             LabelSetText("SoR_"..Window_Name.."KEEP2HEALTH_BG",LabelText)
  1580.             RoR_SoR.KeepStatus[Window_Name][2] = LabelText 
  1581.             WindowSetShowing("SoR_"..Window_Name.."KEEP2HPBAR",LabelText ~= L"")
  1582.             WindowSetDimensions( "SoR_"..Window_Name.."KEEP2HPBARBAR", math.abs(tonumber(KEEP2_Door2)*TotalSize2), BarHeight2 )
  1583.            
  1584.             if KEEP2_Door2 < RoR_SoR.KeepHealth[Window_Name][KEEP2_Owner] then
  1585.                         local Number_Randomizer = math.random(999)
  1586.                         RoR_SoR.NumberWindows[Number_Randomizer] = {timer=2.5}
  1587.                         CreateWindowFromTemplate("SoR_Number_Window"..Number_Randomizer, "Number_Window_Template", "SoR_"..Window_Name.."KEEP2HEALTH")                     
  1588.                         WindowStartAlphaAnimation("SoR_Number_Window"..Number_Randomizer, 1, 1.0, 0.0, 1.5, true, 1.5, 0 ) --start the Door2 pulse
  1589.                         LabelSetText("SoR_Number_Window"..Number_Randomizer.."Label",L"-"..towstring(RoR_SoR.KeepHealth[Window_Name][KEEP2_Owner]-KEEP2_Door2))
  1590.                         LabelSetTextColor("SoR_Number_Window"..Number_Randomizer.."Label",DefaultColor.ORANGE.r,DefaultColor.ORANGE.g,DefaultColor.ORANGE.b)
  1591.                         LabelSetText("SoR_Number_Window"..Number_Randomizer.."LabelBG",L"-"..towstring(RoR_SoR.KeepHealth[Window_Name][KEEP2_Owner]-KEEP2_Door2))
  1592.                         WindowSetScale("SoR_Number_Window"..Number_Randomizer,WindowGetScale("RoR_SoR_Main_Window"))
  1593.             elseif KEEP2_Door2 > RoR_SoR.KeepHealth[Window_Name][KEEP2_Owner] then
  1594.                         local Number_Randomizer = math.random(999)
  1595.                         RoR_SoR.NumberWindows[Number_Randomizer] = {timer=2.5}
  1596.                         CreateWindowFromTemplate("SoR_Number_Window"..Number_Randomizer, "Number_Window_Template", "SoR_"..Window_Name.."KEEP2HEALTH")                     
  1597.                         WindowStartAlphaAnimation("SoR_Number_Window"..Number_Randomizer, 1, 1.0, 0.0, 1.5, true, 1.5, 0 ) --start the Door2 pulse
  1598.                         LabelSetText("SoR_Number_Window"..Number_Randomizer.."Label",L"+"..towstring(KEEP2_Door2 - RoR_SoR.KeepHealth[Window_Name][KEEP2_Owner]))
  1599.                         LabelSetTextColor("SoR_Number_Window"..Number_Randomizer.."Label",DefaultColor.GREEN.r,DefaultColor.GREEN.g,DefaultColor.GREEN.b)
  1600.                         LabelSetText("SoR_Number_Window"..Number_Randomizer.."LabelBG",L"+"..towstring(KEEP2_Door2 - RoR_SoR.KeepHealth[Window_Name][KEEP2_Owner]))
  1601.                         WindowSetScale("SoR_Number_Window"..Number_Randomizer,WindowGetScale("RoR_SoR_Main_Window"))
  1602.             end
  1603.            
  1604.            
  1605.             RoR_SoR.KeepHealth[Window_Name][KEEP2_Owner] = KEEP2_Door2
  1606.         elseif KEEP2_State == 3 then    --InnerDoor attacked
  1607.             if KEEP2_Door1 > 0 then LabelText = towstring(KEEP2_Door1)..L"%" else LabelText = L"" end
  1608.             if RoR_SoR.KEEP_States[Window_Name][2] ~= 3 then
  1609.                 RoR_SoR.KEEP_States[Window_Name][2] = 3    
  1610.                 WindowStartAlphaAnimation( "SoR_"..Window_Name.."KEEP2KEEPDOOR1", Window.AnimationType.LOOP, 1.0, 0.0, 0.5, false, 0.0, 0 ) --start the Door1 pulse
  1611.             end
  1612.            
  1613.            
  1614.             LabelSetText("SoR_"..Window_Name.."KEEP2HEALTH",LabelText) 
  1615.             LabelSetText("SoR_"..Window_Name.."KEEP2HEALTH_BG",LabelText)
  1616.             WindowSetShowing("SoR_"..Window_Name.."KEEP2HPBAR",LabelText ~= L"")
  1617.             WindowSetDimensions( "SoR_"..Window_Name.."KEEP2HPBARBAR", math.abs(tonumber(KEEP2_Door1)*TotalSize2), BarHeight2 )    
  1618.             RoR_SoR.KeepStatus[Window_Name][2] = LabelText 
  1619.            
  1620.             if KEEP2_Door1 < RoR_SoR.KeepHealth[Window_Name][KEEP2_Owner] then
  1621.                         local Number_Randomizer = math.random(999)
  1622.                         RoR_SoR.NumberWindows[Number_Randomizer] = {timer=2.5}
  1623.                         CreateWindowFromTemplate("SoR_Number_Window"..Number_Randomizer, "Number_Window_Template", "SoR_"..Window_Name.."KEEP2HEALTH")                     
  1624.                         WindowStartAlphaAnimation("SoR_Number_Window"..Number_Randomizer, 1, 1.0, 0.0, 1.5, true, 1.5, 0 ) --start the Door2 pulse
  1625.                         LabelSetText("SoR_Number_Window"..Number_Randomizer.."Label",L"-"..towstring(RoR_SoR.KeepHealth[Window_Name][KEEP2_Owner]-KEEP2_Door1))
  1626.                         LabelSetTextColor("SoR_Number_Window"..Number_Randomizer.."Label",DefaultColor.ORANGE.r,DefaultColor.ORANGE.g,DefaultColor.ORANGE.b)
  1627.                         LabelSetText("SoR_Number_Window"..Number_Randomizer.."LabelBG",L"-"..towstring(RoR_SoR.KeepHealth[Window_Name][KEEP2_Owner]-KEEP2_Door1))
  1628.                         WindowSetScale("SoR_Number_Window"..Number_Randomizer,WindowGetScale("RoR_SoR_Main_Window"))
  1629.             elseif KEEP2_Door1 > RoR_SoR.KeepHealth[Window_Name][KEEP2_Owner] then
  1630.                         local Number_Randomizer = math.random(999)
  1631.                         RoR_SoR.NumberWindows[Number_Randomizer] = {timer=2.5}
  1632.                         CreateWindowFromTemplate("SoR_Number_Window"..Number_Randomizer, "Number_Window_Template", "SoR_"..Window_Name.."KEEP2HEALTH")                     
  1633.                         WindowStartAlphaAnimation("SoR_Number_Window"..Number_Randomizer, 1, 1.0, 0.0, 1.5, true, 1.5, 0 ) --start the Door2 pulse
  1634.                         LabelSetText("SoR_Number_Window"..Number_Randomizer.."Label",L"+"..towstring(KEEP2_Door1 - RoR_SoR.KeepHealth[Window_Name][KEEP2_Owner]))
  1635.                         LabelSetTextColor("SoR_Number_Window"..Number_Randomizer.."Label",DefaultColor.GREEN.r,DefaultColor.GREEN.g,DefaultColor.GREEN.b)
  1636.                         LabelSetText("SoR_Number_Window"..Number_Randomizer.."LabelBG",L"+"..towstring(KEEP2_Door1 - RoR_SoR.KeepHealth[Window_Name][KEEP2_Owner]))
  1637.                         WindowSetScale("SoR_Number_Window"..Number_Randomizer,WindowGetScale("RoR_SoR_Main_Window"))
  1638.             end
  1639.            
  1640.             RoR_SoR.KeepHealth[Window_Name][KEEP2_Owner] = KEEP2_Door1         
  1641.         elseif KEEP2_State == 4 then    --Lord Attacked        
  1642.         LabelSetText("SoR_"..Window_Name.."KEEP2HEALTH",towstring(KEEP2_Lord)..L"%")
  1643.         LabelSetText("SoR_"..Window_Name.."KEEP2HEALTH_BG",towstring(KEEP2_Lord)..L"%")
  1644.         RoR_SoR.KeepStatus[Window_Name][2] = towstring(KEEP2_Lord)..L"%"
  1645.         WindowSetShowing("SoR_"..Window_Name.."KEEP2HPBAR",LabelGetText("SoR_"..Window_Name.."KEEP2HEALTH") ~= L"")
  1646.         WindowSetDimensions( "SoR_"..Window_Name.."KEEP2HPBARBAR", math.abs(tonumber(KEEP2_Lord)*TotalSize2), BarHeight2 )         
  1647.        
  1648.             if RoR_SoR.KEEP_States[Window_Name][2] ~= 4 then
  1649.                 RoR_SoR.KEEP_States[Window_Name][2] = 4
  1650.                 WindowStartAlphaAnimation( "SoR_"..Window_Name.."KEEP2LORD_ICON", Window.AnimationType.LOOP, 1.0, 0.0, 0.5, false, 0.0, 0 ) --start the Lord pulse         
  1651.             end
  1652.            
  1653.             if KEEP2_Lord < RoR_SoR.KeepHealth[Window_Name][KEEP2_Owner] then
  1654.                         local Number_Randomizer = math.random(999)
  1655.                         RoR_SoR.NumberWindows[Number_Randomizer] = {timer=2.5}
  1656.                         CreateWindowFromTemplate("SoR_Number_Window"..Number_Randomizer, "Number_Window_Template", "SoR_"..Window_Name.."KEEP2HEALTH")                     
  1657.                         WindowStartAlphaAnimation("SoR_Number_Window"..Number_Randomizer, 1, 1.0, 0.0, 1.5, true, 1.5, 0 ) --start the Door2 pulse
  1658.                         LabelSetText("SoR_Number_Window"..Number_Randomizer.."Label",L"-"..towstring(RoR_SoR.KeepHealth[Window_Name][KEEP2_Owner]-KEEP2_Lord))
  1659.                         LabelSetTextColor("SoR_Number_Window"..Number_Randomizer.."Label",DefaultColor.ORANGE.r,DefaultColor.ORANGE.g,DefaultColor.ORANGE.b)
  1660.                         LabelSetText("SoR_Number_Window"..Number_Randomizer.."LabelBG",L"-"..towstring(RoR_SoR.KeepHealth[Window_Name][KEEP2_Owner]-KEEP2_Lord))
  1661.                         WindowSetScale("SoR_Number_Window"..Number_Randomizer,WindowGetScale("RoR_SoR_Main_Window"))
  1662.             elseif KEEP2_Lord > RoR_SoR.KeepHealth[Window_Name][KEEP2_Owner] then
  1663.                         local Number_Randomizer = math.random(999)
  1664.                         RoR_SoR.NumberWindows[Number_Randomizer] = {timer=2.5}
  1665.                         CreateWindowFromTemplate("SoR_Number_Window"..Number_Randomizer, "Number_Window_Template", "SoR_"..Window_Name.."KEEP2HEALTH")                     
  1666.                         WindowStartAlphaAnimation("SoR_Number_Window"..Number_Randomizer, 1, 1.0, 0.0, 1.5, true, 1.5, 0 ) --start the Door2 pulse
  1667.                         LabelSetText("SoR_Number_Window"..Number_Randomizer.."Label",L"+"..towstring(KEEP2_Lord - RoR_SoR.KeepHealth[Window_Name][KEEP2_Owner]))
  1668.                         LabelSetTextColor("SoR_Number_Window"..Number_Randomizer.."Label",DefaultColor.GREEN.r,DefaultColor.GREEN.g,DefaultColor.GREEN.b)
  1669.                         LabelSetText("SoR_Number_Window"..Number_Randomizer.."LabelBG",L"+"..towstring(KEEP2_Lord - RoR_SoR.KeepHealth[Window_Name][KEEP2_Owner]))
  1670.                         WindowSetScale("SoR_Number_Window"..Number_Randomizer,WindowGetScale("RoR_SoR_Main_Window"))
  1671.             end
  1672.            
  1673.         RoR_SoR.KeepHealth[Window_Name][KEEP2_Owner] = KEEP2_Lord              
  1674.         elseif KEEP2_State == 5 then    --Captured
  1675.             RoR_SoR.KEEP_States[Window_Name][2] = 5
  1676.             LabelSetText("SoR_"..Window_Name.."KEEP2HEALTH",L"Captured")
  1677.             LabelSetText("SoR_"..Window_Name.."KEEP2HEALTH_BG",L"Captured")
  1678.             WindowSetShowing("SoR_"..Window_Name.."KEEP2HPBAR",false)
  1679.         elseif KEEP2_State == 6 then    --Locked
  1680.             RoR_SoR.KEEP_States[Window_Name][2] = 6
  1681.             LabelSetText("SoR_"..Window_Name.."KEEP2HEALTH",L"Locked") 
  1682.             LabelSetText("SoR_"..Window_Name.."KEEP2HEALTH_BG",L"Locked")  
  1683.             WindowSetShowing("SoR_"..Window_Name.."KEEP2HPBAR",false)
  1684.         end                
  1685.            
  1686.                
  1687.                 if KEEP1_Rank[1] > 0 then
  1688.                     DynamicImageSetTextureSlice("SoR_"..Window_Name.."KEEP1KEEPRANK", "KeepDifficulty-"..KEEP1_Rank[1].."-star" )
  1689.                 else
  1690.                     DynamicImageSetTextureSlice("SoR_"..Window_Name.."KEEP1KEEPRANK", "KeepDifficulty-1-star" )
  1691.                 end
  1692.                
  1693.                 if KEEP2_Rank[1] > 0 then
  1694.                     DynamicImageSetTextureSlice("SoR_"..Window_Name.."KEEP2KEEPRANK", "KeepDifficulty-"..KEEP2_Rank[1].."-star" )
  1695.                 else
  1696.                     DynamicImageSetTextureSlice("SoR_"..Window_Name.."KEEP2KEEPRANK", "KeepDifficulty-1-star" )
  1697.                 end
  1698.                 WindowSetShowing("SoR_"..Window_Name.."KEEP1KEEPRANK",KEEP1_Rank[1]>0)
  1699.                 WindowSetShowing("SoR_"..Window_Name.."KEEP2KEEPRANK",KEEP2_Rank[1]>0)
  1700.  
  1701.                 WindowSetShowing("SoR_"..Window_Name.."KEEP1KEEPDOOR1",KEEP1_Door1>0)
  1702.                 WindowSetShowing("SoR_"..Window_Name.."KEEP1KEEPDOOR2",KEEP1_Door2>0)          
  1703.                
  1704.                 WindowSetShowing("SoR_"..Window_Name.."KEEP2KEEPDOOR1",KEEP2_Door1>0)          
  1705.                 WindowSetShowing("SoR_"..Window_Name.."KEEP2KEEPDOOR2",KEEP2_Door2>0)  
  1706.  
  1707.                 if KEEP1_Door2>0 then
  1708.                     WindowClearAnchors("SoR_"..Window_Name.."KEEP1KEEPDOOR1")
  1709.                     WindowAddAnchor( "SoR_"..Window_Name.."KEEP1KEEPDOOR1", "topleft", "SoR_"..Window_Name.."KEEP1", "topleft",10,28 )                 
  1710.                 else
  1711.                     WindowClearAnchors("SoR_"..Window_Name.."KEEP1KEEPDOOR1")
  1712.                     WindowAddAnchor( "SoR_"..Window_Name.."KEEP1KEEPDOOR1", "topleft", "SoR_"..Window_Name.."KEEP1", "topleft",20,28 )
  1713.                 end
  1714.                
  1715.                
  1716.                 if KEEP2_Door2>0 then
  1717.                     WindowClearAnchors("SoR_"..Window_Name.."KEEP2KEEPDOOR1")
  1718.                     WindowAddAnchor( "SoR_"..Window_Name.."KEEP2KEEPDOOR1", "topleft", "SoR_"..Window_Name.."KEEP2", "topleft",10,28 )                 
  1719.                 else
  1720.                     WindowClearAnchors("SoR_"..Window_Name.."KEEP2KEEPDOOR1")
  1721.                     WindowAddAnchor( "SoR_"..Window_Name.."KEEP2KEEPDOOR1", "topleft", "SoR_"..Window_Name.."KEEP2", "topleft",20,28 )
  1722.                 end
  1723.                    
  1724.         end
  1725.     end
  1726. end
  1727. -- Tooltip function
  1728. function RoR_SoR.OnMouseOverStart()
  1729.     local WinParent = WindowGetParent(SystemData.MouseOverWindow.name)
  1730.     local WindowName = tostring(SystemData.MouseOverWindow.name)
  1731.     local Line1,Line2,Line3,Line4,Line5,Line6 = L"",L"",L"",nil,L""
  1732.     local Owner,State = nil,nil
  1733.     local ClaimColor = RoR_SoR.RealmColors[1]
  1734.     local IsFort = false
  1735.     local F_Stage,F_Health = 0,L""
  1736.     RoR_SoR.Lines = {}
  1737.    
  1738.     --Fort Tooltips
  1739.     if RoR_SoR.Forts[tonumber(string.match( WindowName,"SoR_(%d+)."))] ~= nil then
  1740.     IsFort = true
  1741.         if WindowName:match("SoR_+[^%.]+BO.") then
  1742.            
  1743.             local BoId = string.match( WindowName,"SoR_(%d+)BO.")
  1744.             local Number = string.match( WindowName,"BO(%d+)")
  1745.            
  1746.             if tonumber(RoR_SoR.Fort[BoId].Stage) ~= 2 then return end     
  1747.            
  1748.             Owner = RoR_SoR.Fort[BoId].Owner[tonumber(Number)]
  1749.            
  1750.             Line1 = towstring(RoR_SoR.Fort[BoId].BO[tonumber(Number)])
  1751.             Line2 = L""
  1752.             Line3 = RoR_SoR.GetTooltipIcon(Owner,16)
  1753.            
  1754.         elseif WindowName:match("SoR_+[^%.]+KEEP.") then
  1755.             local KeepId = string.match( WindowName,"SoR_(%d+)KEEP.")
  1756.             local Number = string.match( WindowName,"KEEP(%d+)")
  1757.  
  1758.             F_Stage = tonumber(RoR_SoR.Fort[KeepId].Stage)+1
  1759.             F_Health = RoR_SoR.Fort[KeepId].Health
  1760.             Owner = RoR_SoR.Forts[tonumber(KeepId)]
  1761.            
  1762.             Line1 = towstring(GetZoneName(tonumber(KeepId)))
  1763.             Line2 = L""
  1764.             Line3 = RoR_SoR.GetKeepIcon(Owner,16)..L"Fort"
  1765.             Line5 = towstring(RoR_SoR.GetKeepIcon2(Owner,F_Stage))..towstring(F_Health)
  1766.             Line6 = L""
  1767.         end        
  1768.     end
  1769.    
  1770.     --Normal Zones Tooltips
  1771.     if IsFort == false then
  1772.         if WindowName:match("SoR_+[^%.]+BO.") then
  1773.             local BoId = string.match( WindowName,"SoR_(%d+)BO.")
  1774.             local Number = string.match( WindowName,"BO(%d+)") 
  1775.             local Final = RoR_SoR.BO_IDs[tostring(BoId)][tonumber(Number)].ID
  1776.             Owner = RoR_SoR.BO_IDs[tostring(BoId)][tonumber(Number)].Owner
  1777.             State = RoR_SoR.BO_States[tostring(BoId)][tonumber(Number)]
  1778.             Line6 = L""
  1779.            
  1780.         Line1 = towstring(GetObjectiveName(tonumber(Final)))
  1781.         if (RoR_SoR.Timers[tostring(BoId)][tonumber(Number)] ~= nil) and (RoR_SoR.Timers[tostring(BoId)][tonumber(Number)] > 0) then Line2 = L"<icon29979>"..towstring(TimeUtils.FormatClock(RoR_SoR.Timers[tostring(BoId)][tonumber(Number)])) else Line2 = L"" end
  1782.         Line3 =RoR_SoR.GetTooltipIcon(Owner,State)
  1783.  
  1784.  
  1785.         elseif WindowName:match("SoR_+[^%.]+KEEP.") then
  1786.             local KeepId = string.match( WindowName,"SoR_(%d+)KEEP.")
  1787.             local Number = string.match( WindowName,"KEEP(%d+)")
  1788.             local KEEP_DATA = RoR_SoR.KEEP_IDs[tostring(KeepId)][tonumber(Number)]
  1789.             local Final = KEEP_DATA.ID
  1790.            
  1791.             Owner = KEEP_DATA.Owner
  1792.             State = KEEP_DATA.State
  1793.            
  1794.         Line1 = towstring(GetKeepName(tonumber(Final)))
  1795.         Line2 = RoR_SoR.GetKeepRank(KEEP_DATA.Rank)
  1796.         Line3 =RoR_SoR.GetKeepIcon(Owner,State)
  1797.         Line6 = KEEP_DATA.Supply
  1798.         if State ~= 1 then
  1799.         Line5 = towstring(RoR_SoR.GetKeepIcon2(Owner,State))..towstring(RoR_SoR.KeepStatus[tostring(KeepId)][tonumber(Number)])
  1800.         end
  1801.  
  1802.             if KEEP_DATA.Claim ~= "0" then
  1803.                     Line4 = L"<"..towstring(KEEP_DATA.Claim)..L">"
  1804.                     ClaimColor = RoR_SoR.RealmColors[Owner+1] or 1
  1805.                 else
  1806.                     Line4 = L"UnClaimed" --unclaimed
  1807.                     ClaimColor = RoR_SoR.RealmColors[1] or 1
  1808.                 end
  1809.             end
  1810.     end
  1811.     --creates the tooltip from the info above
  1812.         Tooltips.CreateTextOnlyTooltip(SystemData.MouseOverWindow.name,nil)
  1813.         Tooltips.SetTooltipText( 1, 1, Line1)
  1814.         Tooltips.SetTooltipColorDef( 1, 1, Tooltips.MAP_DESC_TEXT_COLOR )
  1815.             if Line2 ~= L"" then
  1816.                 Tooltips.SetTooltipText( 3, 1,towstring(Line3))
  1817.                 Tooltips.SetTooltipText( 3, 3,towstring(Line2))                
  1818.             else
  1819.                 Tooltips.SetTooltipText( 3, 1,towstring(Line3))
  1820.             end
  1821.         if Line4 ~= nil then
  1822.             Tooltips.SetTooltipText( 2, 2,Line4)           
  1823.             Tooltips.SetTooltipColorDef( 2, 2, ClaimColor)
  1824.         end
  1825.         Tooltips.SetTooltipColorDef( 3, 1, RoR_SoR.RealmColors[Owner+1] or 1 )
  1826.        
  1827.         if Line5 ~= L"" then
  1828.             Tooltips.SetTooltipText( 4, 1,towstring(Line5))        
  1829.             Tooltips.SetTooltipColorDef( 4, 1, Tooltips.COLOR_BODY)
  1830.         end
  1831.         if Line6 ~= L"" then
  1832.             Tooltips.SetTooltipText( 5, 1, towstring("<icon00046> Supply: "..Line6.."%"))
  1833.         end
  1834.        
  1835.         Tooltips.Finalize()    
  1836.         Tooltips.AnchorTooltip( Tooltips.ANCHOR_WINDOW_TOP )
  1837.        
  1838.         RoR_SoR.Lines[1] = Line1
  1839.         RoR_SoR.Lines[2] = Line2
  1840.         RoR_SoR.Lines[3] = Line3
  1841.         RoR_SoR.Lines[4] = Line4
  1842.         RoR_SoR.Lines[5] = Line5
  1843.         RoR_SoR.Lines[6] = Line6
  1844.  
  1845.        
  1846. end
  1847.  
  1848. function RoR_SoR.MainTooltip()
  1849.         Tooltips.CreateTextOnlyTooltip(SystemData.MouseOverWindow.name,nil)
  1850.         Tooltips.SetTooltipText( 1, 1, L"State Of Realm")
  1851.         Tooltips.SetTooltipColorDef( 1, 1, Tooltips.MAP_DESC_TEXT_COLOR )
  1852.         Tooltips.SetTooltipText( 1, 3, towstring(version)) 
  1853.         Tooltips.SetTooltipText( 3, 1, L"LMB: Toggle Show/Hide<br>RMB: RoR Menu")
  1854.         Tooltips.Finalize()    
  1855.         Tooltips.AnchorTooltip( Tooltips.ANCHOR_WINDOW_TOP )
  1856.     return 
  1857. end
  1858.  
  1859.  
  1860. function RoR_SoR.TIMER_UPDATE(elapsedTime)
  1861.     if RoR_SoR.Timers ~= nil then
  1862.         for k,v in pairs(RoR_SoR.Timers) do
  1863.             if v ~= nil then
  1864.                 for a,b in pairs(v) do
  1865.     --          k - Area id , v - bonumber, a-bonumber, b-value
  1866.                 RoR_SoR.Timers[tostring(k)][a] = b-elapsedTime
  1867.                
  1868.                     if DoesWindowExist("SoR_"..k) then 
  1869.                         if RoR_SoR.Fort[tostring(k)] == nil and RoR_SoR.City[tostring(k)] == nil then
  1870.                             LabelSetText("SoR_"..k.."BO"..a.."TIMER",towstring(towstring(TimeUtils.FormatClock(RoR_SoR.Timers[tostring(k)][a]))))
  1871.                             LabelSetText("SoR_"..k.."BO"..a.."TIMER_BG",towstring(towstring(TimeUtils.FormatClock(RoR_SoR.Timers[tostring(k)][a]))))                       
  1872.                             if RoR_SoR.BO_States[k][a] ~= 4 then
  1873.                                 local Builer = 31 - (tonumber(RoR_SoR.Timers[tostring(k)][a])/1.34)
  1874.                                 if (Builer >= 0) and (RoR_SoR.Timers[tostring(k)][a] >= 0) then
  1875.                                     WindowSetDimensions("SoR_"..k.."BO"..a.."Flag",31,Builer)
  1876.                                 else
  1877.                                     WindowSetDimensions("SoR_"..k.."BO"..a.."Flag",31,31)
  1878.                                 end
  1879.                             end
  1880.                         else
  1881.                             LabelSetText("SoR_"..k.."_TIMER",towstring(towstring(TimeUtils.FormatClock(RoR_SoR.Timers[tostring(k)][a])))..L"<icon29979>")
  1882.                             LabelSetText("SoR_"..k.."_TIMER_BG",towstring(towstring(TimeUtils.FormatClock(RoR_SoR.Timers[tostring(k)][a])))..L"<icon29979>")                       
  1883.                         end
  1884.                     end
  1885.                 end
  1886.             end    
  1887.         WindowSetAlpha("SoR_"..k.."Background2",WindowGetAlpha("RoR_SoR_Main_Window"))
  1888.         --WindowSetShowing("SoR_"..k.."Background2",RoR_SoR.Settings.DrawBackground or false)
  1889.         WindowSetShowing("SoR_"..k.."Banner",RoR_SoR.Settings.DrawBanner or false) 
  1890.             if DoesWindowExist("SoR_"..k.."BG") then
  1891.                 WindowSetAlpha("SoR_"..k.."BG",0.3*(WindowGetAlpha("RoR_SoR_Main_Window")))
  1892.                 WindowSetShowing("SoR_"..k.."BG",RoR_SoR.Settings.DrawBackground)      
  1893.             end
  1894.         end
  1895.        
  1896.    
  1897.    
  1898.                 local windowName  = SystemData.MouseOverWindow.name
  1899.                 if DoesWindowExist(windowName) then
  1900.                     if (windowName:find("SoR_") or WindowGetParent (windowName) == "RoR_SoR_Main_Window" or (Popper.m_IsShowing ==true and WindowGetShowing("EA_Window_ContextMenu1") == true))then
  1901.                         RoR_SoR.ShowPopper()
  1902.                     else
  1903.                         RoR_SoR.HidePopper ()
  1904.                     end
  1905.                 end
  1906.            
  1907.        
  1908.     end
  1909.  
  1910.     if RoR_SoR.Settings.OnlyActive == true then
  1911.         if RoR_SoR.ZoneNames[GameData.Player.zone] ~= nil and (RoR_SoR.OpenZones[tostring(RoR_SoR.ZoneNames[GameData.Player.zone][1])] ~= nil or RoR_SoR.OpenZones[tostring(RoR_SoR.ZoneNames[GameData.Player.zone][2])] ~= nil) then      
  1912.             for k,v in pairs(RoR_SoR.OpenZones) do     
  1913.                 local Window_Name = tostring(k)
  1914.                 if (RoR_SoR.ZoneNames[GameData.Player.zone][1] ~= tonumber(Window_Name)) and (RoR_SoR.ZoneNames[GameData.Player.zone][2] ~= tonumber(Window_Name)) then
  1915.                     RoR_SoR.RemoveWindow(k)        
  1916.                 end
  1917.             end
  1918.  
  1919.         end
  1920.     end
  1921.  
  1922.  
  1923.     RoR_SoR.OnScenario()
  1924.  
  1925.  
  1926.  
  1927.     if RoR_SoR.ZoneTimer ~= nil then
  1928.         for k,v in pairs(RoR_SoR.ZoneTimer) do
  1929.             if DoesWindowExist("SoR_"..k) then
  1930.                 if v > 0 then
  1931.                 RoR_SoR.ZoneTimer[k] = RoR_SoR.ZoneTimer[k] - elapsedTime
  1932.                 else
  1933.                 RoR_SoR.RemoveWindow(k)        
  1934.                 RoR_SoR.ZoneTimer[k] = nil
  1935.                 end
  1936.             else
  1937.             RoR_SoR.ZoneTimer[k] = nil
  1938.             end
  1939.         end
  1940.             RoR_SoR.Restack()  
  1941.     end
  1942.  
  1943.  
  1944.     if RoR_SoR.Pairings ~= nil then
  1945.         for k,v in pairs(RoR_SoR.Pairings) do
  1946.             if DoesWindowExist("SoR_P_"..k) then
  1947.                 local Window_Name = "P_"..tostring(k)
  1948.                 if RoR_SoR.Pairings[k].Timer and RoR_SoR.Pairings[k].Timer > 0 then
  1949.                
  1950.                         RoR_SoR.Pairings[k].Timer = RoR_SoR.Pairings[k].Timer - elapsedTime
  1951.                         LabelSetText("SoR_"..Window_Name.."_TIMER",TimeUtils.FormatTimeCondensed(RoR_SoR.Pairings[k].Timer))
  1952.                         LabelSetText("SoR_"..Window_Name.."_TIMER_BG",TimeUtils.FormatTimeCondensed(RoR_SoR.Pairings[k].Timer))                    
  1953.                 end
  1954.                
  1955.                 if RoR_SoR.Pairings[k].Timer2 and RoR_SoR.Pairings[k].Timer2 > 0 then
  1956.                
  1957.                         RoR_SoR.Pairings[k].Timer2 = RoR_SoR.Pairings[k].Timer2 - elapsedTime
  1958.                         LabelSetText("SoR_"..Window_Name.."Lock_STATUS",TimeUtils.FormatTimeCondensed(RoR_SoR.Pairings[k].Timer2))
  1959.                         LabelSetText("SoR_"..Window_Name.."Lock_STATUS_BG",TimeUtils.FormatTimeCondensed(RoR_SoR.Pairings[k].Timer2))                      
  1960.                 end
  1961.             else
  1962.             --RoR_SoR.ZoneTimer[k] = nil
  1963.             end
  1964.         end
  1965.     end
  1966.  
  1967.    
  1968.     for k,v in pairs(RoR_SoR.SafeKeep) do
  1969.                     local FillStart = 90
  1970.                     local FillEnd = 360
  1971.             if DoesWindowExist("SoR_"..k) then 
  1972.                 if RoR_SoR.SafeKeep[k][1] > 0 and 600 > RoR_SoR.SafeKeep[k][1] then
  1973.                     RoR_SoR.SafeKeep[k][1] = RoR_SoR.SafeKeep[k][1] - elapsedTime
  1974.                     LabelSetText("SoR_"..k.."KEEP1SAFETIMER",TimeUtils.FormatTimeCondensed(RoR_SoR.SafeKeep[k][1]))
  1975.                     LabelSetText("SoR_"..k.."KEEP1SAFETIMERBG",LabelGetText("SoR_"..k.."KEEP1SAFETIMER"))
  1976.                     local perc1 = RoR_SoR.SafeKeep[k][1]/60
  1977.                     CircleImageSetFillParams("SoR_"..k.."KEEP1SAFECircle", FillStart,   FillEnd-(perc1 * 36))
  1978.                    
  1979.                 end                
  1980.                    
  1981.                 if RoR_SoR.SafeKeep[k][2] > 0 and 600 > RoR_SoR.SafeKeep[k][2] then            
  1982.                     RoR_SoR.SafeKeep[k][2] = RoR_SoR.SafeKeep[k][2] - elapsedTime
  1983.                     LabelSetText("SoR_"..k.."KEEP2SAFETIMER",TimeUtils.FormatTimeCondensed(RoR_SoR.SafeKeep[k][2]))
  1984.                     LabelSetText("SoR_"..k.."KEEP2SAFETIMERBG",LabelGetText("SoR_"..k.."KEEP2SAFETIMER"))
  1985.                     local perc2 = RoR_SoR.SafeKeep[k][2]/60
  1986.                     CircleImageSetFillParams("SoR_"..k.."KEEP2SAFECircle", FillStart,   FillEnd-(perc2 * 36))      
  1987.                 end
  1988.                     end
  1989.     end
  1990.  
  1991.     if RoR_Window_Scale ~= WindowGetScale("RoR_SoR_Main_Window") then
  1992.         RoR_SoR.OnSizeUpdated()
  1993.         RoR_Window_Scale = WindowGetScale("RoR_SoR_Main_Window")
  1994.     end
  1995.    
  1996.  
  1997.     if HasReloaded == true then
  1998.         --if the RoR_CitySiege table can't be found due to a reloadui, use the Backup table untill official table is present again
  1999.         RoR_SoR.City_Status[GameData.CityId.CHAOS].ratingTimer = RoR_SoR.Pairings[161].Timer
  2000.         RoR_SoR.City_Status[GameData.CityId.EMPIRE].ratingTimer = RoR_SoR.Pairings[162].Timer
  2001.        
  2002.        
  2003.         RoR_SoR.City_Status[GameData.CityId.CHAOS].timeLeft = RoR_SoR.Pairings[161].Timer2
  2004.         RoR_SoR.City_Status[GameData.CityId.EMPIRE].timeLeft = RoR_SoR.Pairings[162].Timer2
  2005.        
  2006.     else
  2007.         --While the RoR_CitySiege table is present, save it into the backup table incase of an reloadui
  2008.         if RoR_SoR.Pairings ~= nil then
  2009.         RoR_SoR.City_Status[GameData.CityId.CHAOS] = RoR_CitySiege.GetCity(GameData.CityId.CHAOS)          
  2010.         RoR_SoR.Pairings[161].Timer = RoR_SoR.City_Status[GameData.CityId.CHAOS].ratingTimer
  2011.         RoR_SoR.Pairings[161].Timer2 = RoR_SoR.City_Status[GameData.CityId.CHAOS].timeLeft
  2012.  
  2013.         RoR_SoR.City_Status[GameData.CityId.EMPIRE] = RoR_CitySiege.GetCity(GameData.CityId.EMPIRE)            
  2014.         RoR_SoR.Pairings[162].Timer = RoR_SoR.City_Status[GameData.CityId.EMPIRE].ratingTimer          
  2015.         RoR_SoR.Pairings[162].Timer2 = RoR_SoR.City_Status[GameData.CityId.EMPIRE].timeLeft
  2016.         end
  2017.     end
  2018.    
  2019.     if RoR_SoR.NumberWindows ~= nil then
  2020.         for k,v in pairs(RoR_SoR.NumberWindows) do
  2021.         if DoesWindowExist("SoR_Number_Window"..k) then
  2022.             if v.timer > 0 then
  2023.             RoR_SoR.NumberWindows[k].timer = v.timer - elapsedTime
  2024.             else
  2025.             DestroyWindow("SoR_Number_Window"..k)
  2026.             RoR_SoR.NumberWindows[k] = nil         
  2027.             end
  2028.             else
  2029.             RoR_SoR.NumberWindows[k] = nil
  2030.         end
  2031.         end
  2032.     end
  2033.    
  2034. end
  2035.  
  2036. function RoR_SoR.OnSizeUpdated()
  2037.     RoR_SoR.Restack()
  2038.     return     
  2039. end
  2040.  
  2041. function RoR_SoR.RemoveWindow(Number)
  2042.     if Number == nil then return end
  2043.     if DoesWindowExist("SoR_"..Number) then
  2044.         DestroyWindow("SoR_"..Number)
  2045.        
  2046.         RoR_SoR.OpenZones[Number] = nil
  2047.         RoR_SoR.BO_States[Number] = nil
  2048.         RoR_SoR.KEEP_States[Number] = nil
  2049.         RoR_SoR.ZoneTimer[Number] = nil
  2050.         RoR_SoR.BO_IDs[Number] = nil
  2051.         RoR_SoR.KEEP_IDs[Number] = nil
  2052.         RoR_SoR.Timers[tostring(Number)] = nil
  2053.         RoR_SoR.Fort[tostring(Number)] = nil       
  2054.     end
  2055.     return
  2056. end
  2057.  
  2058. function RoR_SoR.ClearTier(Number)
  2059. local Number = Number
  2060. if RoR_SoR.StackSort == nil then return end
  2061.         for k,v in ipairs(RoR_SoR.StackSort) do
  2062.             if Number == 0 then            
  2063.                 RoR_SoR.RemoveWindow(v.Zone)
  2064.             elseif Number == 1 then
  2065.                 if v.Tier == 1 then
  2066.                 RoR_SoR.RemoveWindow(v.Zone)
  2067.                 end
  2068.             elseif Number == 2 then
  2069.                 if (v.Tier == 2) or (v.Tier == 3) or (v.Tier == 4) then
  2070.                 RoR_SoR.RemoveWindow(v.Zone)
  2071.                 end
  2072.             elseif Number == 3 then
  2073.                 if (v.Tier == 5) then
  2074.                 RoR_SoR.RemoveWindow(v.Zone)
  2075.                 end            
  2076.             end
  2077.         end
  2078.         RoR_SoR.Restack()      
  2079. return
  2080. end
  2081.  
  2082. function RoR_SoR.GetFlag(BO_OWNER,BO_STATE)
  2083.     local Owner = tonumber(BO_OWNER)
  2084.     local State = tonumber(BO_STATE)
  2085.  
  2086.     if State == 0 then
  2087.         if Owner == 0 then return "SoR_Neutral" end
  2088.         if Owner == 1 then return "SoR_Order" end
  2089.         if Owner == 2 then return "SoR_Destro" end
  2090.     elseif State == 4 then
  2091.         if Owner == 0 then return "SoR_Neutral-Burning" end
  2092.         if Owner == 1 then return "SoR_Order-Burning" end
  2093.         if Owner == 2 then return "SoR_Destro-Burning" end
  2094.     elseif State == 8 then
  2095.         if Owner == 0 then return "SoR_Neutral-Locked" end
  2096.         if Owner == 1 then return "SoR_Order-Locked" end
  2097.         if Owner == 2 then return "SoR_Destro-Locked" end
  2098.     elseif State == 9 then
  2099.         if Owner == 0 then return "SoR_Neutral-Locked" end
  2100.         if Owner == 1 then return "SoR_Order-Locked" end
  2101.         if Owner == 2 then return "SoR_Destro-Locked" end  
  2102.     elseif State == 10 then
  2103.         if Owner == 0 then return "SoR_Neutral" end
  2104.         if Owner == 1 then return "SoR_Order-Locked" end
  2105.         if Owner == 2 then return "SoR_Destro-Locked" end      
  2106.     elseif State == 16 then
  2107.         if Owner == 0 then return "SoR_Neutral-Glowing" end
  2108.         if Owner == 1 then return "SoR_Order-Glowing" end
  2109.         if Owner == 2 then return "SoR_Destro-Glowing" end
  2110.     else
  2111.         if Owner == 0 then return "SoR_Neutral" end
  2112.         if Owner == 1 then return "SoR_Order" end
  2113.         if Owner == 2 then return "SoR_Destro" end
  2114.     end
  2115.  
  2116. end
  2117.  
  2118. function RoR_SoR.GetFlag2(BO_OWNER,BO_STATE)
  2119.     local Owner = tonumber(BO_OWNER)
  2120.     local State = tonumber(BO_STATE)
  2121.  
  2122.     if State == 0 then
  2123.         if Owner == 0 then return "SoR_Neutral" end
  2124.         if Owner == 1 then return "SoR_Order" end
  2125.         if Owner == 2 then return "SoR_Destro" end
  2126.     elseif State == 4 then
  2127.         if Owner == 0 then return "" end
  2128.         if Owner == 1 then return "" end
  2129.         if Owner == 2 then return "" end
  2130.     elseif State == 8 then
  2131.         if Owner == 0 then return "SoR_Neutral-Locked" end
  2132.         if Owner == 1 then return "SoR_Order-Locked" end
  2133.         if Owner == 2 then return "SoR_Destro-Locked" end
  2134.     elseif State == 9 then
  2135.         if Owner == 0 then return "SoR_Neutral-Locked" end
  2136.         if Owner == 1 then return "SoR_Order-Locked" end
  2137.         if Owner == 2 then return "SoR_Destro-Locked" end  
  2138.     elseif State == 10 then
  2139.         if Owner == 0 then return "SoR_Neutral" end
  2140.         if Owner == 1 then return "SoR_Order-Locked" end
  2141.         if Owner == 2 then return "SoR_Destro-Locked" end      
  2142.     elseif State == 16 then
  2143.         if Owner == 0 then return "SoR_Neutral-Glowing" end
  2144.         if Owner == 1 then return "SoR_Order" end
  2145.         if Owner == 2 then return "SoR_Destro" end
  2146.     else
  2147.         if Owner == 0 then return "SoR_Neutral" end
  2148.         if Owner == 1 then return "SoR_Order" end
  2149.         if Owner == 2 then return "SoR_Destro" end
  2150.     end
  2151.  
  2152. end
  2153.  
  2154. function RoR_SoR.GetKeepTexture(KEEP_OWNER,KEEP_STATE)
  2155.     local Owner = tonumber(KEEP_OWNER)
  2156.     local State = tonumber(KEEP_STATE)
  2157.  
  2158.     if State == 1 then
  2159.         if Owner == 0 then return "SoR_Keep_Neutral" end
  2160.         if Owner == 1 then return "SoR_Keep_Order" end
  2161.         if Owner == 2 then return "SoR_Keep_Destro" end
  2162.     elseif State == 2 then
  2163.         if Owner == 0 then return "FlagNeutral-Burning" end
  2164.         if Owner == 1 then return "SoR_Keep_Order-Attacked" end
  2165.         if Owner == 2 then return "SoR_Keep_Destro-Attacked" end
  2166.     elseif State == 3 then
  2167.         if Owner == 0 then return "FlagNeutral-Burning" end
  2168.         if Owner == 1 then return "SoR_Keep_Order-Attacked" end
  2169.         if Owner == 2 then return "SoR_Keep_Destro-Attacked" end   
  2170.     elseif State == 4 then
  2171.         if Owner == 0 then return "BombNeutral" end
  2172.         if Owner == 1 then return "SoR_Keep_Order-Attacked" end
  2173.         if Owner == 2 then return "SoR_Keep_Destro-Attacked" end
  2174.     elseif State == 5 then
  2175.         if Owner == 0 then return "FlagNeutral-Burning" end
  2176.         if Owner == 1 then return "SoR_Keep_Order" end
  2177.         if Owner == 2 then return "SoR_Keep_Destro" end
  2178.     elseif State == 6 then
  2179.         if Owner == 0 then return "FlagNeutral-Burning" end
  2180.         if Owner == 1 then return "SoR_Keep_Order" end
  2181.         if Owner == 2 then return "SoR_Keep_Destro" end
  2182.     else
  2183.         if Owner == 0 then return "SoR_Keep_Neutral" end
  2184.         if Owner == 1 then return "SoR_Keep_Order" end
  2185.         if Owner == 2 then return "SoR_Keep_Destro" end
  2186.     end
  2187. end
  2188.  
  2189. function RoR_SoR.GetTooltipIcon(BO_OWNER,BO_STATE)
  2190. local Owner = tonumber(BO_OWNER)
  2191. local State = tonumber(BO_STATE)
  2192.  
  2193. if State == 0 then
  2194.     if Owner == 0 then return L"<icon29982> "..towstring(RoR_SoR.TextNeutral) end --neutral
  2195.     if Owner == 1 then return L"<icon29990> "..towstring(RoR_SoR.TextDestro) end
  2196.     if Owner == 2 then return L"<icon29985> "..towstring(RoR_SoR.TextOrder) end
  2197. elseif State == 2 then
  2198.     if Owner == 0 then return L"<icon29982> Abandoned" end
  2199.     if Owner == 1 then return L"<icon29990> Order Abandoned" end
  2200.     if Owner == 2 then return L"<icon29985> Destro Abandoned" end      
  2201. elseif State == 4 then
  2202.     if Owner == 0 then return L"<icon29984> Capping" end
  2203.     if Owner == 1 then return L"<icon29992> Destro Capping" end
  2204.     if Owner == 2 then return L"<icon29987> Order Capping" end
  2205. elseif State == 8 then
  2206.     if Owner == 0 then return L"<icon29983> Unlocking" end
  2207.     if Owner == 1 then return L"<icon29991> Order "..towstring(RoR_SoR.TextLock) end
  2208.     if Owner == 2 then return L"<icon29986> Destro "..towstring(RoR_SoR.TextLock) end
  2209. elseif State == 9 then
  2210.     if Owner == 0 then return L"<icon29983> "..towstring(RoR_SoR.TextLock) end
  2211.     if Owner == 1 then return L"<icon29991> Order "..towstring(RoR_SoR.TextLock) end
  2212.     if Owner == 2 then return L"<icon29986> Destro "..towstring(RoR_SoR.TextLock) end  
  2213. elseif State == 10 then
  2214.     if Owner == 0 then return L"<icon29982> Neutral "..towstring(RoR_SoR.TextLock) end--neutral
  2215.     if Owner == 1 then return L"<icon29991> Order "..towstring(RoR_SoR.TextLock) end
  2216.     if Owner == 2 then return L"<icon29986> Destro "..towstring(RoR_SoR.TextLock) end      
  2217. elseif State == 16 then
  2218.     if Owner == 0 then return L"<icon29982> Securing" end
  2219.     if Owner == 1 then return L"<icon29993> Order securing" end -- securing / holding
  2220.     if Owner == 2 then return L"<icon29988> Destro securing" end
  2221. else
  2222.     if Owner == 0 then return L"<icon29982> Neutral" end--neutral
  2223.     if Owner == 1 then return L"<icon29990> Order" end
  2224.     if Owner == 2 then return L"<icon29985> Destro" end
  2225. end
  2226.  
  2227. end
  2228.  
  2229. function RoR_SoR.GetKeepIcon(KEEP_OWNER,KEEP_STATE)
  2230. local Owner = tonumber(KEEP_OWNER)
  2231. local State = tonumber(KEEP_STATE)
  2232.  
  2233. if State == 1 then
  2234.     if Owner == 0 then return L"<icon29995> Neutral Keep" end
  2235.     if Owner == 1 then return L"<icon29998> Order Keep" end
  2236.     if Owner == 2 then return L"<icon29996> Destro Keep" end
  2237. elseif State == 2 then
  2238.     if Owner == 0 then return L"<icon29995> Under Attack" end
  2239.     if Owner == 1 then return L"<icon29999> Under Attack" end
  2240.     if Owner == 2 then return L"<icon29997> Under Attack" end
  2241. elseif State == 3 then
  2242.     if Owner == 0 then return L"<icon29995> Under Attack" end
  2243.     if Owner == 1 then return L"<icon29999> Under Attack" end
  2244.     if Owner == 2 then return L"<icon29997> Under Attack" end  
  2245. elseif State == 4 then
  2246.     if Owner == 0 then return L"<icon29995> Under Attack" end
  2247.     if Owner == 1 then return L"<icon29999> Under Attack" end
  2248.     if Owner == 2 then return L"<icon29997> Under Attack" end
  2249. elseif State == 5 then
  2250.     if Owner == 0 then return L"<icon29995> Neutral Keep" end
  2251.     if Owner == 1 then return L"<icon29998> Order Keep" end
  2252.     if Owner == 2 then return L"<icon29996> Destro Keep" end
  2253. elseif State == 6 then
  2254.     if Owner == 0 then return L"<icon29995> Neutral Keep" end
  2255.     if Owner == 1 then return L"<icon29998> Order Keep" end
  2256.     if Owner == 2 then return L"<icon29996> Destro Keep" end
  2257. elseif State == 16 then
  2258.     if Owner == 0 then return L"<icon29995> Neutral " end
  2259.     if Owner == 1 then return L"<icon29998> Order " end
  2260.     if Owner == 2 then return L"<icon29996> Destro " end   
  2261. else
  2262.     if Owner == 0 then return L"<icon29995> Neutral Keep" end
  2263.     if Owner == 1 then return L"<icon29998> Order Keep" end
  2264.     if Owner == 2 then return L"<icon29996> Destro Keep" end
  2265. end
  2266. end
  2267.  
  2268. function RoR_SoR.GetKeepIcon2(KEEP_OWNER,KEEP_STATE)
  2269. local Owner = tonumber(KEEP_OWNER)
  2270. local State = tonumber(KEEP_STATE)
  2271.  
  2272. if State == 1 then
  2273.     if Owner == 0 then return L"" end
  2274.     if Owner == 1 then return L"" end
  2275.     if Owner == 2 then return L"" end
  2276. elseif State == 2 then
  2277.     if Owner == 0 then return L"<icon29980> Outer Door: " end
  2278.     if Owner == 1 then return L"<icon29980> Outer Door: " end
  2279.     if Owner == 2 then return L"<icon29980> Outer Door: " end
  2280. elseif State == 3 then
  2281.     if Owner == 0 then return L"<icon29980> Inner Door: " end
  2282.     if Owner == 1 then return L"<icon29980> Inner Door: " end
  2283.     if Owner == 2 then return L"<icon29980> Inner Door: " end
  2284. elseif State == 4 then
  2285.     if Owner == 0 then return L"<icon29981> Lord: " end
  2286.     if Owner == 1 then return L"<icon29981> Lord: " end
  2287.     if Owner == 2 then return L"<icon29981> Lord: " end
  2288. elseif State == 5 then
  2289.     if Owner == 0 then return L"5,0" end
  2290.     if Owner == 1 then return L"Captured, Order Controlled" end
  2291.     if Owner == 2 then return L"Captured, Destro Controlled" end
  2292. elseif State == 6 then
  2293.     if Owner == 0 then return towstring(RoR_SoR.TextLock) end
  2294.     if Owner == 1 then return towstring(RoR_SoR.TextLock) end
  2295.     if Owner == 2 then return towstring(RoR_SoR.TextLock) end
  2296. else
  2297.     if Owner == 0 then return L"7,0" end
  2298.     if Owner == 1 then return L"7,1" end
  2299.     if Owner == 2 then return L"7,2" end
  2300. end
  2301. end
  2302.  
  2303.  
  2304. function RoR_SoR.GetKeepRank(KeepRank)
  2305. local Rank = tonumber(KeepRank)
  2306.  
  2307. if Rank == 1 then return L"1 <icon43>"
  2308. elseif Rank == 2 then return L"2 <icon43><icon43>"
  2309. elseif Rank == 3 then return L"3 <icon43><icon43><icon43>"
  2310. elseif Rank == 4 then return L"4 <icon43><icon43><icon43><icon43>"
  2311. elseif Rank == 5 then return L"5 <icon43><icon43><icon43><icon43><icon43>"
  2312. else return L""
  2313.  
  2314. end
  2315. end
  2316.  
  2317. function RoR_SoR.AnswerDialog(LineWord1,LineWord2,LineWord3,LineWord4,LineWord5,SelectedChannel,Type)
  2318. local TypeName = {"/say ","/party ","/warband ","/2 ","/t4 "}
  2319.  
  2320.     if Type == 1 then
  2321.             SendChatText(towstring(TypeName[SelectedChannel])..towstring(LineWord1)..L": "..towstring(LineWord3)..L" · "..towstring(LineWord2)..L" · "..towstring(LineWord4)..L" · "..towstring(LineWord5), L"")            
  2322.     elseif Type == 2 then
  2323.             SendChatText(towstring(TypeName[SelectedChannel])..L"Declaring Attack on: "..towstring(LineWord1), L"")
  2324.     elseif Type == 3 then
  2325.             SendChatText(towstring(TypeName[SelectedChannel])..L"Declaring Defence on: "..towstring(LineWord1), L"")
  2326.     elseif Type == 4 then
  2327.             SendChatText(towstring(TypeName[SelectedChannel])..L"Relocate to: "..towstring(LineWord1), L"")
  2328.     elseif Type == 5 then
  2329.             SendChatText(towstring(TypeName[SelectedChannel])..towstring(LineWord1)..L" RvR Population: "..towstring(LineWord2)..L" · "..towstring(LineWord3)..towstring(LineWord4), L"")         
  2330.     end
  2331. end            
  2332.  
  2333.  
  2334. function RoR_SoR.Toggle()
  2335.  
  2336. RoR_SoR.Settings.Enabled = not RoR_SoR.Settings.Enabled
  2337.  
  2338.     RoR_SoR.SetWindowShow()
  2339. RoR_SoR.Enable()   
  2340. end
  2341.  
  2342. function RoR_SoR.SetWindowShow()
  2343.     WindowSetShowing("RoR_SoR_Main_Window",RoR_SoR.Settings.Enabled)
  2344.     WindowSetShowing("RoR_SoR_Popper",RoR_SoR.Settings.Enabled)
  2345.     for k,v in pairs(RoR_SoR.Timers) do
  2346.         WindowSetShowing("SoR_"..k,RoR_SoR.Settings.Enabled)   
  2347.     end
  2348. return
  2349. end
  2350.  
  2351. function RoR_SoR.OnCombat()
  2352.     if RoR_SoR.Settings.HideCombat == true then
  2353.         if GameData.Player.inCombat == true then
  2354.             WindowSetShowing("RoR_SoR_ButtonCombat",true)      
  2355.             WindowSetShowing("RoR_SoR_Main_Window",false)
  2356.             WindowSetShowing("RoR_SoR_Popper",false)
  2357.             for k,v in pairs(RoR_SoR.Timers) do
  2358.             WindowSetShowing("SoR_"..k,false)  
  2359.             end    
  2360.         else
  2361.         WindowSetShowing("RoR_SoR_ButtonCombat",false)
  2362.         RoR_SoR.SetWindowShow()
  2363.         end
  2364.     else
  2365.     RoR_SoR.SetWindowShow()
  2366.     end
  2367. end
  2368.  
  2369.  
  2370. function RoR_SoR.OnScenario()
  2371.     if RoR_SoR.Settings.HideCombat == true then
  2372.         if (GameData.Player.isInScenario) == true then
  2373.             WindowSetShowing("RoR_SoR_ButtonCombat",true)      
  2374.             WindowSetShowing("RoR_SoR_Main_Window",false)
  2375.             WindowSetShowing("RoR_SoR_Popper",false)
  2376.             for k,v in pairs(RoR_SoR.Timers) do
  2377.             WindowSetShowing("SoR_"..k,false)  
  2378.             end    
  2379.         else
  2380.         WindowSetShowing("RoR_SoR_ButtonCombat",false)
  2381.         RoR_SoR.SetWindowShow()
  2382.         end
  2383.     else
  2384.     WindowSetShowing("RoR_SoR_ButtonCombat",false)
  2385.     RoR_SoR.SetWindowShow()
  2386.     end
  2387. end
  2388.  
  2389.  
  2390.  
  2391. function RoR_SoR.BroadCastOption()
  2392. local LineWord1 = towstring(RoR_SoR.Lines[1])
  2393. local LineWord2 = towstring(RoR_SoR.Lines[2])
  2394. local LineWord3 = towstring(RoR_SoR.Lines[3])
  2395. local LineWord4 = towstring(RoR_SoR.Lines[4])
  2396. local LineWord5 = towstring(RoR_SoR.Lines[5])
  2397.  
  2398. local function MakeCallBack( SelectedOption1,SelectedOption2 )
  2399.             return function() RoR_SoR.AnswerDialog(SelectedOption1,SelectedOption2) end
  2400.         end
  2401.        
  2402. local function MakeCallBack2( LineWord1,LineWord2,LineWord3,LineWord4,LineWord5,SelectedType )
  2403.             return function() RoR_SoR.ContextMenu1(LineWord1,LineWord2,LineWord3,LineWord4,LineWord5,SelectedType ) end
  2404.         end    
  2405.        
  2406.     EA_Window_ContextMenu.CreateContextMenu( "BroadCast Selection", EA_Window_ContextMenu.CONTEXT_MENU_1, LineWord1 )
  2407.     EA_Window_ContextMenu.AddMenuDivider( EA_Window_ContextMenu.CONTEXT_MENU_1 )   
  2408.     EA_Window_ContextMenu.AddCascadingMenuItem( L"<icon29962>BroadCast Status", MakeCallBack2(LineWord1,LineWord2,LineWord3,LineWord4,LineWord5,1 ), false, 1 )
  2409.     EA_Window_ContextMenu.AddCascadingMenuItem( L"<icon29960>Declare Attack", MakeCallBack2(LineWord1,LineWord2,LineWord3,LineWord4,LineWord5,2 ), false, 1 )  
  2410.     EA_Window_ContextMenu.AddCascadingMenuItem( L"<icon29961>Declare Defence", MakeCallBack2(LineWord1,LineWord2,LineWord3,LineWord4,LineWord5,3 ), false, 1 )
  2411.     EA_Window_ContextMenu.AddCascadingMenuItem( L"<icon29963>Relocating", MakeCallBack2(LineWord1,LineWord2,LineWord3,LineWord4,LineWord5,4 ), false, 1 )      
  2412.     EA_Window_ContextMenu.Finalize()
  2413.  
  2414. end
  2415.  
  2416. function RoR_SoR.POPOption()
  2417. local WindowName = tostring(SystemData.MouseOverWindow.name)
  2418. local Zone_Id = string.match( WindowName,"SoR_(%d+)POP")
  2419. local Line1 = towstring(GetZoneName(tonumber(Zone_Id)))
  2420. LineWord1,LineWord2,LineWord3,LineWord4,LineWord5 = L""
  2421.  
  2422. if RoR_SoR.Forts[tonumber(Zone_Id)] ~= nil then
  2423. local Color_A = RoR_SoR.InvFortColors[(RoR_SoR.Forts[tonumber(Zone_Id)])+1]
  2424. local Color_D = RoR_SoR.FortColors[(RoR_SoR.Forts[tonumber(Zone_Id)])+1]
  2425.  
  2426. LineWord1 = towstring(Line1)
  2427. LineWord2 = towstring(CreateHyperLink(L"0",L"Attackers: "..towstring(RoR_SoR.ZoneStatus[tostring(Zone_Id)].Attackers_Pop), {Color_A.r,Color_A.g,Color_A.b}, {} ))
  2428. LineWord3 = towstring(CreateHyperLink(L"0",L"Defenders: "..towstring(RoR_SoR.ZoneStatus[tostring(Zone_Id)].Defenders_Pop), {Color_D.r,Color_D.g,Color_D.b}, {} ))
  2429. LineWord4 = L""
  2430. LineWord5 = L"5"
  2431. else
  2432. LineWord1 = towstring(Line1)
  2433. LineWord2 = towstring(CreateHyperLink(L"0",L"Order: "..towstring(RoR_SoR.ZoneStatus[tostring(Zone_Id)].Order_Pop), {75,75,255}, {} ))
  2434. LineWord3 = towstring(CreateHyperLink(L"0",L"Destro: "..towstring(RoR_SoR.ZoneStatus[tostring(Zone_Id)].Destro_Pop), {255,25,25}, {} ))
  2435. LineWord4 = L""
  2436.     if RoR_SoR.ZoneStatus[tostring(Zone_Id)].AAO[1] ~= "0" then
  2437.         local Color = RoR_SoR.RealmColors[(RoR_SoR.ZoneStatus[tostring(Zone_Id)].AAO[1])+3]
  2438.         LineWord4 = L" · AAO: "..towstring(CreateHyperLink(L"0",towstring(GetRealmName(tonumber(RoR_SoR.ZoneStatus[tostring(Zone_Id)].AAO[1])))..L" "..towstring(RoR_SoR.ZoneStatus[tostring(Zone_Id)].AAO[2])..L"%", {Color.r,Color.g,Color.b}, {} ))
  2439.     end
  2440.  LineWord5 = L"5"
  2441. end
  2442.  
  2443.  
  2444. local function MakeCallBack( SelectedOption1,SelectedOption2 )
  2445.             return function() RoR_SoR.AnswerDialog(SelectedOption1,SelectedOption2) end
  2446.         end
  2447.        
  2448. local function MakeCallBack2( LineWord1,LineWord2,LineWord3,LineWord4,LineWord5,SelectedType )
  2449.             return function() RoR_SoR.ContextMenu1(LineWord1,LineWord2,LineWord3,LineWord4,LineWord5,SelectedType ) end
  2450.         end    
  2451.        
  2452.     EA_Window_ContextMenu.CreateContextMenu( "BroadCast Selection", EA_Window_ContextMenu.CONTEXT_MENU_1, LineWord1 )
  2453.     EA_Window_ContextMenu.AddMenuDivider( EA_Window_ContextMenu.CONTEXT_MENU_1 )   
  2454.     EA_Window_ContextMenu.AddCascadingMenuItem( L"<icon29962>BroadCast Population", MakeCallBack2(LineWord1,LineWord2,LineWord3,LineWord4,LineWord5,5 ), false, 1 )
  2455.     EA_Window_ContextMenu.Finalize()
  2456.  
  2457. end
  2458.  
  2459. function RoR_SoR.ContextMenu1(LineWord1,LineWord2,LineWord3,LineWord4,LineWord5,SelectedType)
  2460. local function MakeCallBack( LineWord1,LineWord2,LineWord3,LineWord4,LineWord5,SelectedChannel,Type)
  2461.             return function() RoR_SoR.AnswerDialog(LineWord1,LineWord2,LineWord3,LineWord4,LineWord5,SelectedChannel,Type) end
  2462.         end
  2463. local TypeName = {"<icon29962>BroadCast Status","<icon29960>Declare Attack","<icon29961>Declare Defence","<icon29963>Relocate","<icon29963>BroadCast Population"}
  2464.        
  2465.     EA_Window_ContextMenu.CreateContextMenu( tostring(TypeName[SelectedType]), EA_Window_ContextMenu.CONTEXT_MENU_2,towstring(TypeName[SelectedType]) )
  2466.     EA_Window_ContextMenu.AddMenuDivider( EA_Window_ContextMenu.CONTEXT_MENU_2 )   
  2467.     EA_Window_ContextMenu.AddMenuItem( L"/Say", MakeCallBack(LineWord1,LineWord2,LineWord3,LineWord4,LineWord5,1,SelectedType ), false, true, EA_Window_ContextMenu.CONTEXT_MENU_2 )
  2468.     EA_Window_ContextMenu.AddMenuItem( L"/Party", MakeCallBack(LineWord1,LineWord2,LineWord3,LineWord4,LineWord5,2,SelectedType ), (not PartyUtils.IsPartyActive()), true, EA_Window_ContextMenu.CONTEXT_MENU_2 )
  2469.     EA_Window_ContextMenu.AddMenuItem( L"/Warband", MakeCallBack(LineWord1,LineWord2,LineWord3,LineWord4,LineWord5,3,SelectedType ), (not IsWarBandActive()), true, EA_Window_ContextMenu.CONTEXT_MENU_2 ) 
  2470.     EA_Window_ContextMenu.AddMenuItem( L"/Region", MakeCallBack(LineWord1,LineWord2,LineWord3,LineWord4,LineWord5,4,SelectedType ), (not GameData.Player.rvrZoneFlagged), true, EA_Window_ContextMenu.CONTEXT_MENU_2 ) 
  2471.     EA_Window_ContextMenu.AddMenuItem( L"/RvR", MakeCallBack(LineWord1,LineWord2,LineWord3,LineWord4,LineWord5,5,SelectedType ), false, true, EA_Window_ContextMenu.CONTEXT_MENU_2 )     
  2472.     EA_Window_ContextMenu.Finalize(2, nil)
  2473.  
  2474. end
  2475.  
  2476.  
  2477.  
  2478. function RoR_SoR.OnTabRBU()
  2479. local function MakeCallBack( SelectedOption )
  2480.             return function() RoR_SoR.ToggleShow(SelectedOption) end
  2481.         end
  2482.  
  2483.   EA_Window_ContextMenu.CreateContextMenu( SystemData.MouseOverWindow.name, EA_Window_ContextMenu.CONTEXT_MENU_1,L"SoR Options")
  2484.   EA_Window_ContextMenu.AddMenuDivider( EA_Window_ContextMenu.CONTEXT_MENU_1 ) 
  2485.   if RoR_SoR.Settings.ShowT1 == true then
  2486.   EA_Window_ContextMenu.AddMenuItem( L"<icon00057> Tier 1" , MakeCallBack(1), false, true )
  2487.   else
  2488.    EA_Window_ContextMenu.AddMenuItem( L"<icon00058> Tier 1" , MakeCallBack(1), false, true )
  2489.  end
  2490.  
  2491.   if RoR_SoR.Settings.ShowT4 == true then
  2492.   EA_Window_ContextMenu.AddMenuItem( L"<icon00057> Tier 4" , MakeCallBack(2), false, true )
  2493.   else
  2494.    EA_Window_ContextMenu.AddMenuItem( L"<icon00058> Tier 4" ,MakeCallBack(2), false, true )
  2495.  end
  2496.  
  2497.  if RoR_SoR.Settings.ShowForts == true then
  2498.   EA_Window_ContextMenu.AddMenuItem( L"<icon00057> Forts" , MakeCallBack(6), false, true )
  2499.   else
  2500.    EA_Window_ContextMenu.AddMenuItem( L"<icon00058> Forts" ,MakeCallBack(6), false, true )
  2501.  end
  2502.  
  2503.   if RoR_SoR.Settings.ShowCity == true then
  2504.     EA_Window_ContextMenu.AddMenuItem( L"<icon00057> City sieges" , MakeCallBack(12), false, true )
  2505.   else
  2506.    EA_Window_ContextMenu.AddMenuItem( L"<icon00058> City sieges" ,MakeCallBack(12), false, true )
  2507.  end
  2508.  
  2509.   if RoR_SoR.Settings.ShowCity_Status == true then
  2510.     EA_Window_ContextMenu.AddMenuItem( L"<icon00057> City Status" , MakeCallBack(14), false, true )
  2511.   else
  2512.    EA_Window_ContextMenu.AddMenuItem( L"<icon00058> City Status" ,MakeCallBack(14), false, true )
  2513.  end
  2514.  
  2515.   if RoR_SoR.Settings.ShowPairings == true then
  2516.     EA_Window_ContextMenu.AddMenuItem( L"<icon00057> Locked Pairings" , MakeCallBack(13), false, true )
  2517.   else
  2518.    EA_Window_ContextMenu.AddMenuItem( L"<icon00058> Locked Pairings" ,MakeCallBack(13), false, true )
  2519.  end
  2520.  
  2521.     if RoR_SoR.Settings.OnlyActive == true then
  2522.   EA_Window_ContextMenu.AddMenuItem( L"<icon00057> Only Your Zone" , MakeCallBack(9), false, true )
  2523.   else
  2524.    EA_Window_ContextMenu.AddMenuItem(L"<icon00058> Only Your Zone" ,MakeCallBack(9), false, true )
  2525.    end
  2526.  
  2527.     if RoR_SoR.Settings.StackDir == 1 then
  2528.       EA_Window_ContextMenu.AddMenuItem( L"Set Stack up" , MakeCallBack(3), false, true )
  2529.   else
  2530.    EA_Window_ContextMenu.AddMenuItem( L"Set Stack down" ,MakeCallBack(4), false, true )
  2531.  end
  2532.    if RoR_SoR.Settings.HideCombat == true then
  2533.   EA_Window_ContextMenu.AddMenuItem( L"<icon00057> Hide In Scenario" , MakeCallBack(5), false, true )
  2534.   else
  2535.    EA_Window_ContextMenu.AddMenuItem(L"<icon00058> Hide In Scenario" ,MakeCallBack(5), false, true )
  2536.    end
  2537.    
  2538.   if RoR_SoR.Settings.DrawBackground == true then
  2539.   EA_Window_ContextMenu.AddMenuItem( L"<icon00057> Show Background" , MakeCallBack(7), false, true )
  2540.   else
  2541.    EA_Window_ContextMenu.AddMenuItem(L"<icon00058> Show Background" ,MakeCallBack(7), false, true )
  2542.    end
  2543.  
  2544.    if RoR_SoR.Settings.DrawBanner == true then
  2545.   EA_Window_ContextMenu.AddMenuItem( L"<icon00057> Show Banners" , MakeCallBack(8), false, true )
  2546.   else
  2547.    EA_Window_ContextMenu.AddMenuItem(L"<icon00058> Show Banners" ,MakeCallBack(8), false, true )
  2548.    end
  2549.  
  2550.    if RoR_SoR.Settings.ShowBONames == true then
  2551.   EA_Window_ContextMenu.AddMenuItem( L"<icon00057> Show BO Names" , MakeCallBack(10), false, true )
  2552.   else
  2553.    EA_Window_ContextMenu.AddMenuItem(L"<icon00058> Show BO Names" ,MakeCallBack(10), false, true )
  2554.    end
  2555.  
  2556.    if RoR_SoR.Settings.ShowUnclaimed == true then
  2557.   EA_Window_ContextMenu.AddMenuItem( L"<icon00057> Show Unclaimed Label" , MakeCallBack(11), false, true )
  2558.   else
  2559.    EA_Window_ContextMenu.AddMenuItem(L"<icon00058> Show Unclaimed Label" ,MakeCallBack(11), false, true )
  2560.    end
  2561.    
  2562.     if RoR_SoR.Settings.AAONumbers == true then
  2563.   EA_Window_ContextMenu.AddMenuItem( L"Show AAO Labels" , MakeCallBack(15), false, true )
  2564.   else
  2565.    EA_Window_ContextMenu.AddMenuItem(L"Show AAO Numbers" ,MakeCallBack(15), false, true )
  2566.    end  
  2567.  
  2568.    
  2569.     --EA_Window_ContextMenu.AddMenuItem( GetString( StringTables.Default.LABEL_SET_OPACITY ), EA_Window_ContextMenu.OnWindowOptionsSetAlpha, false, true )
  2570. EA_Window_ContextMenu.AddMenuItem( L"Set Alpha...", RoR_SoR.OnWindowOptionsSetOpacity, false, true )   
  2571.     EA_Window_ContextMenu.AddMenuItem(L"Set Scale...", RoR_SoR.OnWindowOptionsSetScale, false, true )
  2572.     EA_Window_ContextMenu.AddMenuItem(L"Set Offset...", RoR_SoR.OnWindowOptionsSetOffset, false, true )
  2573.    
  2574.     EA_Window_ContextMenu.AddMenuDivider( EA_Window_ContextMenu.CONTEXT_MENU_1 )     
  2575.     EA_Window_ContextMenu.AddMenuItem(L"Reset SoR Settings..." ,RoR_SoR.ResetDialog, false, true )
  2576.     EA_Window_ContextMenu.Finalize()   
  2577. end
  2578.  
  2579. function RoR_SoR.ToggleShow(SelectedOption)
  2580.     if SelectedOption == 1 then RoR_SoR.Settings.ShowT1 = not RoR_SoR.Settings.ShowT1 ; RoR_SoR.ClearTier(1)
  2581.     elseif SelectedOption == 2 then RoR_SoR.Settings.ShowT4 = not RoR_SoR.Settings.ShowT4  ; RoR_SoR.ClearTier(2)
  2582.     elseif SelectedOption == 3 then RoR_SoR.Settings.StackDir = 2
  2583.     elseif SelectedOption == 4 then RoR_SoR.Settings.StackDir = 1
  2584.     elseif SelectedOption == 5 then RoR_SoR.Settings.HideCombat = not RoR_SoR.Settings.HideCombat ; RoR_SoR.OnCombat()
  2585.     elseif SelectedOption == 6 then RoR_SoR.Settings.ShowForts = not RoR_SoR.Settings.ShowForts ; RoR_SoR.ClearTier(3)
  2586.     elseif SelectedOption == 7 then RoR_SoR.Settings.DrawBackground  = not RoR_SoR.Settings.DrawBackground 
  2587.     elseif SelectedOption == 8 then RoR_SoR.Settings.DrawBanner  = not RoR_SoR.Settings.DrawBanner 
  2588.     elseif SelectedOption == 9 then RoR_SoR.Settings.OnlyActive  = not RoR_SoR.Settings.OnlyActive ; RoR_SoR.ClearTier(0)
  2589.     elseif SelectedOption == 10 then RoR_SoR.Settings.ShowBONames    = not RoR_SoR.Settings.ShowBONames
  2590.     elseif SelectedOption == 11 then RoR_SoR.Settings.ShowUnclaimed  = not RoR_SoR.Settings.ShowUnclaimed  
  2591.     elseif SelectedOption == 12 then RoR_SoR.Settings.ShowCity   = not RoR_SoR.Settings.ShowCity   
  2592.     elseif SelectedOption == 13 then RoR_SoR.Settings.ShowPairings   = not RoR_SoR.Settings.ShowPairings   
  2593.     elseif SelectedOption == 14 then RoR_SoR.Settings.ShowCity_Status = not RoR_SoR.Settings.ShowCity_Status; RoR_SoR.ZoneTimer["P_161"] = 0.1;RoR_SoR.ZoneTimer["P_162"] = 0.1
  2594.     elseif SelectedOption == 15 then RoR_SoR.Settings.AAONumbers     = not RoR_SoR.Settings.AAONumbers     
  2595.     end
  2596.     RoR_SoR.Enable()
  2597.     return
  2598. end
  2599.  
  2600. function RoR_SoR.ShowPopper ()
  2601.     if WindowGetAlpha("RoR_SoR_Popper") < 1 then
  2602.         WindowStartAlphaAnimation("RoR_SoR_Popper", Window.AnimationType.SINGLE_NO_RESET, WindowGetAlpha("RoR_SoR_Popper"), 1, c_DEFAULT_FADEIN_TIMER, false, 0, 0)
  2603.     end
  2604.     WindowSetShowing ("RoR_SoR_Popper", true)
  2605.     Popper.m_IsShowing      = true
  2606.     Popper.m_HideCountdown  = c_DEFAULT_HIDE_TIMER
  2607. return
  2608. end
  2609.  
  2610. function RoR_SoR.HidePopper ()
  2611.     if WindowGetAlpha("RoR_SoR_Popper") > 0 then
  2612.         WindowStartAlphaAnimation("RoR_SoR_Popper", Window.AnimationType.SINGLE_NO_RESET_HIDE, WindowGetAlpha("RoR_SoR_Popper"), 0, c_DEFAULT_FADEOUT_TIMER, false, 0, 0)  
  2613.     end
  2614.     Popper.m_IsShowing      = false;
  2615.     Popper.m_HideCountdown  = c_DEFAULT_HIDE_TIMER
  2616. end
  2617.  
  2618. function RoR_SoR.HideChannel(channelId)
  2619.     for _, wndGroup in ipairs(EA_ChatWindowGroups) do
  2620.         if wndGroup.used == true then
  2621.             for tabId, tab in ipairs(wndGroup.Tabs) do
  2622.                 local tabName = EA_ChatTabManager.GetTabName( tab.tabManagerId )       
  2623.                 if tabName then
  2624.                     if tab.tabText ~= L"Debug" then
  2625.                         LogDisplaySetFilterState(tabName.."TextLog", "Chat", channelId, false)
  2626.                     else
  2627.                         LogDisplaySetFilterState(tabName.."TextLog", "Chat", channelId, true)
  2628.                         LogDisplaySetFilterColor(tabName.."TextLog", "Chat", channelId, 168, 187, 160 )
  2629.                     end
  2630.                 end        
  2631.             end        
  2632.         end    
  2633.     end
  2634. end
  2635.  
  2636.  
  2637. function RoR_SoR.GetKeepClaim2(KeepId)
  2638. local Zone
  2639. local Keep_Number
  2640. if RoR_SoR.ZoneNames[GameData.Player.zone] == nil then
  2641. --d("Player Zone")
  2642. Zone = GameData.Player.zone
  2643. else
  2644. --d("Zone name")
  2645. Zone = RoR_SoR.ZoneNames[GameData.Player.zone][1]
  2646. end
  2647.  
  2648.  
  2649. if not DoesWindowExist("SoR_"..Zone) then return false end
  2650. --d("Window Exist")
  2651.  
  2652. if RoR_SoR.KEEP_IDs[tostring(Zone)] ~= nil then
  2653.     for i=1,2 do
  2654.         if KeepId == RoR_SoR.KEEP_IDs[tostring(Zone)][i].ID then
  2655.             Keep_Number = i
  2656.             break
  2657.         end
  2658.     end
  2659.  
  2660.  
  2661. if RoR_SoR.KEEP_IDs[tostring(Zone)][Keep_Number] == nil then return false end
  2662. --d("Keep Id exist")
  2663.  
  2664. local ObjectData = GetActiveObjectivesData()
  2665. local Keep_Data = RoR_SoR.KEEP_IDs[tostring(Zone)][Keep_Number]
  2666. --if Keep_Data.ID == nil then return false end
  2667.  
  2668. local KEEP_ID,KEEP_CLAIM,KEEP_OWNER,KEEP_STATE = nil,nil,nil,nil
  2669.                        
  2670.     if ObjectData ~= nil and ObjectData[1] ~= nil then
  2671.     --d(L"Is Keep Claimed? "..towstring(RoR_SoR_T2.KeepClaim[T2ComboZone[GameData.Player.zone]][KEEP_ID]))
  2672.         if ObjectData[1].isKeep then
  2673. --d("in a keep")       
  2674.                             --search what ID the keep has
  2675.                     if tostring(GetKeepName(tonumber(KeepId))) == tostring(ObjectData[1].name) then
  2676.                         KEEP_ID = Keep_Data.ID
  2677.                         KEEP_CLAIM = Keep_Data.Claim
  2678.                         KEEP_OWNER = Keep_Data.Owner
  2679.                         KEEP_STATE = Keep_Data.State
  2680. --d(L"Keep ID: "..towstring(KEEP_ID))                      
  2681.                     else
  2682.                     return false
  2683.                     end
  2684.             if KEEP_CLAIM == "0" then
  2685.         --  d("Unclaimed")
  2686.                 if (tonumber(ObjectData[1].controllingRealm) == tonumber(GameData.Player.realm)) then
  2687.         --      d("Your Realm Keep")
  2688.                     if KEEP_STATE == 1 then
  2689.                 --  d("Safe")
  2690.                         if GuildWindowTabAdmin.GetGuildCommandPermission(SystemData.GuildPermissons.CLAIM_KEEP, GuildWindowTabAdmin.GetLocalMemberTitleNumber()) then
  2691.                 --      d("Have Claim Rights")                     
  2692.                         return true
  2693.                         else
  2694.                 --      d("NO Claim Rights")
  2695.                         return false
  2696.                         end
  2697.                     else
  2698.                 --  d("Unsafe")
  2699.                     return false
  2700.                     end
  2701.                 else
  2702.             --  d("Enemy keep")
  2703.                 return false               
  2704.                 end
  2705.             else
  2706.             --d("Claimed")
  2707.             return false
  2708.             end
  2709.         return false
  2710.         end
  2711.     return false
  2712.     end
  2713. end
  2714. return false
  2715.  
  2716. end
  2717.  
  2718. function RoR_SoR.UpdateObjectives()
  2719. local Zone
  2720. if (GameData.Player.isInScenario) == true or (GameData.Player.isInSiege) == true then return end
  2721. if RoR_SoR.ZoneNames[GameData.Player.zone] == nil or RoR_SoR.ZoneNames[GameData.Player.zone][2] == nil then
  2722. --d("Player Zone")
  2723. Zone = GameData.Player.zone
  2724. else
  2725. --d("Zone name")
  2726. Zone = RoR_SoR.ZoneNames[GameData.Player.zone][2]
  2727. end
  2728.  
  2729. if DoesWindowExist("SoR_"..Zone) then
  2730.  
  2731. local BO_IDS = RoR_SoR.BO_IDs[tostring(Zone)]
  2732. local ObjectData = GetActiveObjectivesData()
  2733. if BO_IDS ~= nil then
  2734.         for k,v in pairs(BO_IDS) do
  2735.             if #ObjectData > 0 then
  2736.                 if tonumber(v.ID) == tonumber(ObjectData[1].id) then
  2737.                 WindowSetAlpha("SoR_"..Zone.."BO"..k.."Location",1)
  2738.                 else
  2739.                 WindowSetAlpha("SoR_"..Zone.."BO"..k.."Location",0)
  2740.                 end
  2741.             else
  2742.                 WindowSetAlpha("SoR_"..Zone.."BO"..k.."Location",0)
  2743.             end        
  2744.         end
  2745. else
  2746.     return
  2747. end
  2748. end
  2749.  
  2750. end
  2751.  
  2752.  
  2753.  
  2754. function RoR_SoR.KeepClaimDialog()
  2755. local function MakeCallBack()
  2756.             return function() SendChatText(L".claim", L"") end
  2757.         end
  2758. DialogManager.MakeTwoButtonDialog( L"Claim Keep?", GetString(StringTables.Default.LABEL_YES),MakeCallBack(),GetString(StringTables.Default.LABEL_NO),nil )
  2759. end
  2760.  
  2761.  
  2762. function RoR_SoR.KeepUnClaimDialog()
  2763. local KeepNumber = WindowGetId (SystemData.ActiveWindow.name)
  2764.  
  2765. local function MakeCallBack()
  2766.             return function() SendChatText(L"/guildreleasekeep "..towstring(KeepNumber), L"") end
  2767.         end
  2768. DialogManager.MakeTwoButtonDialog( L"Release Keep?", GetString(StringTables.Default.LABEL_YES),MakeCallBack(),GetString(StringTables.Default.LABEL_NO),nil )
  2769. end
  2770.  
  2771.  
  2772.  function RoR_SoR.Offset(input)
  2773.  local input = tonumber(input)
  2774.  RoR_SoR.Settings.Offset = input
  2775.  EA_ChatWindow.Print(L"Offset is set to:"..towstring(input))
  2776.  end
  2777.  
  2778.  
  2779. function RoR_SoR.ResetDialog()
  2780. DialogManager.MakeTwoButtonDialog( L"Are you sure you want to reset SoR settings?", GetString(StringTables.Default.LABEL_YES),RoR_SoR.DefaultSettings,GetString(StringTables.Default.LABEL_NO),nil )
  2781. end
  2782.  
  2783.  
  2784. function RoR_SoR.OnWindowOptionsSetOpacity()
  2785. LabelSetText("RoR_SoR_OpacityTitleBarText",L"Alpha")
  2786.     local alpha = WindowGetAlpha( "RoR_SoR_Main_Window" )    
  2787.     SliderBarSetCurrentPosition("RoR_SoR_OpacitySlider", alpha )    
  2788.    
  2789.     WindowClearAnchors( "RoR_SoR_Opacity" )
  2790.     WindowAddAnchor( "RoR_SoR_Opacity", "center", EA_Window_ContextMenu.activeWindow, "center", 0 , 0 )
  2791.  
  2792.     WindowSetShowing( "RoR_SoR_Opacity", true )
  2793. end
  2794.  
  2795. function RoR_SoR.OnSlideWindowOptionsOpacity( slidePos )
  2796.     local alpha = slidePos
  2797.    
  2798.     -- Requirements call for 10%-100% range, not 0% to 100%.
  2799.     if (alpha < 0.01) then
  2800.         alpha = 0.01
  2801.     end
  2802.     if (EA_Window_ContextMenu.activeWindow ~= nil) then
  2803.         WindowSetAlpha( "RoR_SoR_Main_Window", alpha )
  2804.     end
  2805. end
  2806.  
  2807. function RoR_SoR.CloseSetOpacityWindow()
  2808.     WindowSetShowing( "RoR_SoR_Opacity", false )
  2809. end
  2810.  
  2811. function RoR_SoR.OnWindowOptionsSetScale()
  2812.   LabelSetText("RoR_SoR_ScaleTitleBarText",L"Scale")
  2813.     local uiScale = InterfaceCore.GetScale()
  2814.     local scale = WindowGetScale("RoR_SoR_Main_Window" )    
  2815.     SliderBarSetCurrentPosition("RoR_SoR_ScaleSlider", scale/1.5 )    
  2816.    
  2817.    WindowClearAnchors( "RoR_SoR_Scale" )
  2818.    WindowAddAnchor( "RoR_SoR_Scale", "topleft", "Root", "topleft", SystemData.MousePosition.x/uiScale,SystemData.MousePosition.y/uiScale ) 
  2819.     WindowSetShowing( "RoR_SoR_Scale", true )
  2820.    
  2821. end
  2822.  
  2823. function RoR_SoR.OnSlideWindowOptionsScale( slidePos )
  2824.     local scale = slidePos*1.5
  2825.    
  2826.     if (scale < 0.3) then
  2827.         scale = 0.3
  2828.     end
  2829.     if (EA_Window_ContextMenu.activeWindow ~= nil) then
  2830.         WindowSetScale("RoR_SoR_Main_Window" , scale )
  2831.     end
  2832. end
  2833.  
  2834. function RoR_SoR.CloseSetScaleWindow()
  2835.     WindowSetShowing( "RoR_SoR_Scale", false )
  2836. end
  2837.  
  2838.  
  2839. function RoR_SoR.OnWindowOptionsSetOffset()
  2840.   LabelSetText("RoR_SoR_OffsetTitleBarText",L"Offset")
  2841.     local offset = RoR_SoR.Settings.Offset  
  2842.     SliderBarSetCurrentPosition("RoR_SoR_OffsetSlider",(0.5)+(offset/100))    
  2843.    
  2844.    WindowClearAnchors( "RoR_SoR_Offset" )
  2845.    WindowAddAnchor( "RoR_SoR_Offset", "center", EA_Window_ContextMenu.activeWindow, "center", 0 , 0 )
  2846.  
  2847.     WindowSetShowing( "RoR_SoR_Offset", true )
  2848. end
  2849.  
  2850. function RoR_SoR.OnSlideWindowOptionsOffset( slidePos )
  2851.     local offset = slidePos*100
  2852.  
  2853.     if (EA_Window_ContextMenu.activeWindow ~= nil) then
  2854.         RoR_SoR.Settings.Offset = (-50)+offset
  2855.     end
  2856.     RoR_SoR.Restack()
  2857. end
  2858.  
  2859. function RoR_SoR.CloseSetOffsetWindow()
  2860.     WindowSetShowing( "RoR_SoR_Offset", false )
  2861. end
  2862.  
  2863.  function RoR_SoR.Calc_Difference(value1,value2)
  2864.  if value1 > value2 then
  2865.     return L"-"..towstring(value2-value1)
  2866. else
  2867.     return L"+"..towstring(value1-value2)
  2868. end
  2869. end
  2870.  
  2871.  
  2872. function RoR_SoR.DefaultSettings()
  2873. RoR_SoR.Settings ={
  2874. ShowT1 = true,
  2875. ShowT4 = true,
  2876. StackDir = 1,
  2877. Offset = 1,
  2878. Enabled = true,
  2879. HideCombat = false,
  2880. AAONumbers = true,
  2881. HideScenario = false,
  2882. ShowForts = true,
  2883. DrawBackground = true,
  2884. DrawBanner = true,
  2885. OnlyActive = false,
  2886. ShowBONames = true,
  2887. ShowUnclaimed = true,
  2888. ShowPairings = true,
  2889. ShowCity = true,
  2890. ShowCity_Status = true,
  2891. Version = version
  2892. }
  2893. WindowSetScale("RoR_SoR_Main_Window",0.753)
  2894. WindowClearAnchors("RoR_SoR_Main_Window")
  2895. WindowAddAnchor("RoR_SoR_Main_Window","top", "Root","top", 350,100)
  2896. WindowSetOffsetFromParent("RoR_SoR_Main_Window",350,100)
  2897.  
  2898. EA_ChatWindow.Print(L"State of Realm has been resetted to default settings")
  2899. end
  2900.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement