Advertisement
Guest User

Keep Claimed Fix

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