Guest User

Untitled

a guest
Apr 23rd, 2017
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 479.51 KB | None | 0 0
  1. -- -------------------------------------------------------------------------- --
  2. -- BattlegroundTargets by kunda --
  3. -- -------------------------------------------------------------------------- --
  4. -- --
  5. -- Features: --
  6. -- # Shows all battleground players with role, spec and class --
  7. -- - Left-click : set target --
  8. -- - Right-click: set focus --
  9. -- # Independent settings for '10v10', '15v15' and '40v40' --
  10. -- # Independent settings for 'Friend' and 'Enemy' --
  11. -- # Target --
  12. -- # Target of Target --
  13. -- # Main Assist Target --
  14. -- # Focus --
  15. -- # Flag/Orb/Cart Carrier --
  16. -- # Target Count --
  17. -- # Health --
  18. -- # Range Check --
  19. -- # PvP Trinket Timer --
  20. -- --
  21. -- -------------------------------------------------------------------------- --
  22. -- --
  23. -- These events are always registered: --
  24. -- - PLAYER_REGEN_DISABLED --
  25. -- - PLAYER_REGEN_ENABLED --
  26. -- - ZONE_CHANGED_NEW_AREA (to determine if current zone is a battleground) --
  27. -- - PLAYER_LEVEL_UP (only registered if playerLevel < maxLevel) --
  28. -- --
  29. -- Registered events in battleground: --
  30. -- # If enabled: ------------------------------------------------------------ --
  31. -- - UPDATE_BATTLEFIELD_SCORE --
  32. -- - GROUP_ROSTER_UPDATE --
  33. -- - PLAYER_DEAD --
  34. -- - PLAYER_UNGHOST --
  35. -- - PLAYER_ALIVE --
  36. -- --
  37. -- # Range Check: ----------------------------------------------------------- --
  38. -- - Events: - COMBAT_LOG_EVENT_UNFILTERED (Enemy only) --
  39. -- - PLAYER_TARGET_CHANGED --
  40. -- - UNIT_HEALTH_FREQUENT --
  41. -- - UPDATE_MOUSEOVER_UNIT --
  42. -- - UNIT_TARGET --
  43. -- - The data to determine the distance to an enemy is not always available.--
  44. -- This is restricted by the WoW API. --
  45. -- - This feature is a compromise between CPU usage (FPS), lag/network --
  46. -- bandwidth (no SendAdd0nMessage), fast and easy visual recognition and --
  47. -- suitable data. --
  48. -- --
  49. -- # Health: ---------------------------------------------------------------- --
  50. -- - Events: - UNIT_TARGET --
  51. -- - UNIT_HEALTH_FREQUENT --
  52. -- - UPDATE_MOUSEOVER_UNIT --
  53. -- - The health from an enemy is not always available. --
  54. -- This is restricted by the WoW API. --
  55. -- - A raidmember/raidpet MUST target(focus/mouseover) an enemy OR --
  56. -- you/yourpet MUST target/focus/mouseover an enemy to get the health. --
  57. -- --
  58. -- # Target: ---------------------------------------------------------------- --
  59. -- - Event: - PLAYER_TARGET_CHANGED --
  60. -- --
  61. -- # Target of Target: ------------------------------------------------------ --
  62. -- - Events: - UNIT_TARGET --
  63. -- - PLAYER_TARGET_CHANGED --
  64. -- --
  65. -- # Target Count: ---------------------------------------------------------- --
  66. -- - Event: - UNIT_TARGET --
  67. -- --
  68. -- # Main Assist Target: ---------------------------------------------------- --
  69. -- - Event: - UNIT_TARGET --
  70. -- --
  71. -- # Leader: ---------------------------------------------------------------- --
  72. -- - Event: - UNIT_TARGET --
  73. -- - PARTY_LEADER_CHANGED (Friend only) --
  74. -- --
  75. -- # Level: (only registered if playerLevel < maxLevel) --------------------- --
  76. -- - Event: - UNIT_TARGET --
  77. -- --
  78. -- # Focus: ----------------------------------------------------------------- --
  79. -- - Event: - PLAYER_FOCUS_CHANGED --
  80. -- --
  81. -- # Enemy Carrier: --------------------------------------------------------- --
  82. -- - Events: - CHAT_MSG_BG_SYSTEM_HORDE --
  83. -- - CHAT_MSG_BG_SYSTEM_ALLIANCE --
  84. -- - CHAT_MSG_RAID_BOSS_EMOTE --
  85. -- - UNIT_TARGET --
  86. -- Carrier detection in case of ReloadUI or mid-battle-joins: (temporarily --
  87. -- registered until each enemy is scanned) --
  88. -- - UNIT_TARGET --
  89. -- - UPDATE_MOUSEOVER_UNIT --
  90. -- - PLAYER_TARGET_CHANGED --
  91. -- --
  92. -- # PvP Trinket: ----------------------------------------------------------- --
  93. -- - Event: - COMBAT_LOG_EVENT_UNFILTERED --
  94. -- - Without SendAdd0nMessage(). Limited to your CombatLog range. --
  95. -- --
  96. -- # No SendAdd0nMessage(): ------------------------------------------------- --
  97. -- This AddOn does not use/need SendAdd0nMessage(). SendAdd0nMessage() --
  98. -- increases the available data by transmitting information to other --
  99. -- players. This has certain pros and cons. I may include (opt-in) such --
  100. -- functionality in some future release. maybe. dontknow. --
  101. -- --
  102. -- -------------------------------------------------------------------------- --
  103. -- --
  104. -- slash commands: /bgt - /bgtargets - /battlegroundtargets --
  105. -- --
  106. -- -------------------------------------------------------------------------- --
  107. -- --
  108. -- Thanks to all who helped with the localization. --
  109. -- --
  110. -- -------------------------------------------------------------------------- --
  111.  
  112. local _G = _G
  113. local pairs = pairs
  114. local print = print
  115. local type = type
  116. local unpack = unpack
  117. local band = bit.band
  118. local math_min = math.min
  119. local math_max = math.max
  120. local floor = math.floor
  121. local random = math.random
  122. local strfind = string.find
  123. local strmatch = string.match
  124. local tostring = tostring
  125. local format = string.format
  126. local tinsert = table.insert
  127. local table_sort = table.sort
  128. local wipe = table.wipe
  129. local CheckInteractDistance = CheckInteractDistance
  130. local CreateFrame = CreateFrame
  131. local GetBattlefieldArenaFaction = GetBattlefieldArenaFaction
  132. local GetBattlefieldScore = GetBattlefieldScore
  133. local GetBattlefieldStatus = GetBattlefieldStatus
  134. local GetBattlegroundInfo = GetBattlegroundInfo
  135. local GetClassInfoByID = GetClassInfoByID
  136. local GetCurrentMapAreaID = GetCurrentMapAreaID
  137. local GetLocale = GetLocale
  138. local GetMaxPlayerLevel = GetMaxPlayerLevel
  139. local GetNumBattlefieldScores = GetNumBattlefieldScores
  140. local GetNumBattlegroundTypes = GetNumBattlegroundTypes
  141. local GetNumGroupMembers = GetNumGroupMembers
  142. local GetNumSpecializationsForClassID = GetNumSpecializationsForClassID
  143. local GetMaxBattlefieldID = GetMaxBattlefieldID
  144. local GetRaidRosterInfo = GetRaidRosterInfo
  145. local GetRealZoneText = GetRealZoneText
  146. local GetSpecializationInfoForClassID = GetSpecializationInfoForClassID
  147. local GetSpellInfo = GetSpellInfo
  148. local GetTime = GetTime
  149. local InCombatLockdown = InCombatLockdown
  150. local IsActiveBattlefieldArena = IsActiveBattlefieldArena
  151. local IsInInstance = IsInInstance
  152. local IsRatedBattleground = IsRatedBattleground
  153. local IsSpellInRange = IsSpellInRange
  154. local IsSpellKnown = IsSpellKnown
  155. local RequestBattlefieldScoreData = RequestBattlefieldScoreData
  156. local SetBattlefieldScoreFaction = SetBattlefieldScoreFaction
  157. local SetMapToCurrentZone = SetMapToCurrentZone
  158. local UnitBuff = UnitBuff
  159. local UnitClass = UnitClass
  160. local UnitDebuff = UnitDebuff
  161. local UnitExists = UnitExists
  162. local UnitFactionGroup = UnitFactionGroup
  163. local UnitHealth = UnitHealth
  164. local UnitHealthMax = UnitHealthMax
  165. local UnitInRange = UnitInRange
  166. local UnitIsGhost = UnitIsGhost
  167. local UnitIsGroupLeader = UnitIsGroupLeader
  168. local UnitLevel = UnitLevel
  169. local UnitName = UnitName
  170.  
  171. -- -------------------------------------------------------------------------- --
  172.  
  173. local function GetUnitFullName(unit)
  174. local name, server = UnitName(unit)
  175. if server and server ~= "" then
  176. --print("INPUT_NAME_CHECK: _UN1_", unit, name.."-"..server)
  177. return name.."-"..server
  178. else
  179. --print("INPUT_NAME_CHECK: _UN2_", unit, name)
  180. return name
  181. end
  182. end
  183.  
  184. local function UnitInCheckedRange(unit)
  185. local inRange, checkedRange = UnitInRange(unit)
  186. --print("RANGE_CHK UnitInRange:", inRange, checkedRange, "#", unit, "#", UnitInRange(unit))
  187. if inRange and checkedRange then
  188. return true
  189. end
  190. end
  191.  
  192. --[[ TEST
  193. local XCheckInteractDistance = CheckInteractDistance
  194. local function CheckInteractDistance(unit, interaction)
  195. local inRange = XCheckInteractDistance(unit, interaction)
  196. print("RANGE_CHK CheckInteractDistance:", inRange, "#", unit, interaction)
  197. return inRange
  198. end
  199. local XIsSpellInRange = IsSpellInRange
  200. local function IsSpellInRange(spell, unit)
  201. local inRange = XIsSpellInRange(spell, unit)
  202. print("RANGE_CHK IsSpellInRange:", inRange, "#", spell, unit)
  203. return inRange
  204. end
  205. --]]
  206.  
  207. -- -------------------------------------------------------------------------- --
  208.  
  209. BattlegroundTargets_Options = {} -- SavedVariable options table
  210. local BattlegroundTargets = CreateFrame("Frame")
  211.  
  212. -- external resources BEGIN ------------------------------------------------- --
  213. local _, prg = ...
  214. if type(prg) ~= "table" then print("|cffffff7fBattlegroundTargets:|r ERROR: Restart WoW.") return end
  215.  
  216. -- FLG | flag carrier
  217. if type(prg.FLG) ~= "table" then print("|cffffff7fBattlegroundTargets:|r ERROR: Restart WoW.") return end
  218. local FLG = prg.FLG
  219.  
  220. -- L | localization L[
  221. if type(prg.L) ~= "table" then print("|cffffff7fBattlegroundTargets:|r ERROR: Restart WoW.") return end
  222. for k, v in pairs(prg.L) do if type(v) ~= "string" then prg.L[k] = tostring(k) end end
  223. local L = prg.L
  224.  
  225. -- RNA | bg race names
  226. if type(prg.RNA) ~= "table" then print("|cffffff7fBattlegroundTargets:|r ERROR: Restart WoW.") return end
  227. local RNA = prg.RNA
  228.  
  229. -- TEMPLATE | templates
  230. if type(prg.TEMPLATE) ~= "table" then print("|cffffff7fBattlegroundTargets:|r ERROR: Restart WoW.") return end
  231. local TEMPLATE = prg.TEMPLATE
  232.  
  233. -- TLT | unspecified talents
  234. if type(prg.TLT) ~= "table" then print("|cffffff7fBattlegroundTargets:|r ERROR: Restart WoW.") return end
  235. local TLT = prg.TLT
  236.  
  237. -- TSL | transliteration table
  238. if type(prg.TSL) ~= "table" then print("|cffffff7fBattlegroundTargets:|r ERROR: Restart WoW.") return end
  239. local TSL = prg.TSL
  240.  
  241. -- utf8replace | utf8.lua (for transliteration)
  242. if type(prg.utf8replace) ~= "function" then print("|cffffff7fBattlegroundTargets:|r ERROR: Restart WoW.") return end
  243. local utf8replace = prg.utf8replace
  244. -- external resources END --------------------------------------------------- --
  245.  
  246. local GVAR = {} -- UI Widgets
  247.  
  248. local locale = GetLocale()
  249.  
  250. local inWorld = nil
  251. local inBattleground = nil
  252. local inCombat = nil
  253. local isConfig = nil
  254. local fraction = "Enemy" -- for config
  255.  
  256. local reCheckBG = nil
  257. local reCheckScore = nil
  258. local reSizeCheck = 0
  259. local reSetLayout = nil
  260. local rePosMain = nil
  261.  
  262. local isDeadUpdateStop
  263.  
  264. local flagDebuff = 0 -- flag debuff -- FLGRST
  265. local flags = 0 -- number of current flags (friend and enemy)
  266. local isFlagBG = 0 -- flagBG from bgMaps
  267. local flagCHK = nil -- is flag check active
  268. local flagflag = nil -- check value to do one flag check after bg entry
  269.  
  270. local range_CL_Throttle = 0 -- THROTTLE | rangecheck: [combatlog]
  271. local range_CL_Frequency = 3 -- THROTTLE | rangecheck: [combatlog] 50/50 or 66/33 or 75/25 (%Yes/%No) => 64/36 = 36% filter
  272.  
  273. local rangeFrequency = 0.125 -- THROTTLE/FORCE_UPDATE | class_range_ : max/forced update frequency in seconds per button
  274. local healthFrequency = 0.2 -- THROTTLE | health_ : max update frequency in seconds per button
  275. local focusFrequency = 0.25 -- FORCE_UPDATE | focus_ : forced update frequency in seconds per button
  276. local targetFrequency = 0.2 -- FORCE_UPDATE | targeet : forced update frequency in seconds per button
  277. local carrierDebuffFrequency = 2 -- THROTTLE/FORCE_UPDATE | carrier_debuff_ : max/forced update frequency in seconds per button
  278. local leaderFrequency = 5 -- THROTTLE | leader_ : max update frequency in seconds per button
  279. local assistFrequency = 1 -- FORCE_UPDATE | assist_ : forced update frequency in seconds per button - immediate assist target check
  280. local targetCountFrequency = 10 -- FORCE_UPDATE | targetcount_ : forced update frequency in seconds - complete raid check
  281. local pvptrinketFrequency = 0.95 -- FORCE_UPDATE | pvp_trinket_ : forced update frequency in seconds
  282.  
  283. local scoreLastUpdate = GetTime() -- WARNING | scoreupdate: BattlefieldScoreUpdate()
  284. local scoreWarning = 60 -- WARNING | scoreupdate: inCombat-score-warning-icon
  285. local scoreFrequency = 1 -- THROTTLE | scoreupdate: 1 second | 2 seconds | 5 seconds
  286. local scoreCount = 0 -- THROTTLE | scoreupdate: 0-30 updates: 1 second | 31-60 updates: 2 seconds | 61+ updates: 5 seconds
  287.  
  288. local playerName = GetUnitFullName("player")
  289. local _, playerClassEN = UnitClass("player")
  290. local playerLevel = UnitLevel("player") -- LVLCHK
  291. local maxLevel = GetMaxPlayerLevel()
  292. local isLowLevel = nil
  293.  
  294. local playerTargetName
  295. local playerFocusName
  296. local isAssistName, isAssistUnitId, playerAssistTargetName
  297. local isTargetButton
  298.  
  299. local playerFactionDEF = 0 -- player faction (DEFAULT)
  300. local oppositeFactionDEF = 0 -- opposite faction (DEFAULT)
  301. local playerFactionBG = 0 -- player faction (in battleground)
  302. local oppositeFactionBG = 0 -- opposite faction (in battleground)
  303. local oppositeFactionREAL -- real opposite faction
  304.  
  305. --local eventTest = {} -- TEST event order
  306.  
  307. local FRAMES = {
  308. "Friend", -- FriendMainFrame / FriendButton
  309. "Enemy", -- EnemyMainFrame / EnemyButton
  310. }
  311.  
  312. local DATA = {}
  313. DATA.TargetCountNames = {} -- key = unitName | value (string) = targetName
  314. DATA.TargetCountTargetID = {} -- key = unitName | value (string) = targetID
  315. DATA.TargetFCountNum = {} -- key = unitName | value (number) = target count friend
  316. DATA.TargetECountNum = {} -- key = unitName | value (number) = target count enemy
  317.  
  318. DATA.PvPTrinketEndTime = {} -- key = unitName | value (number) = endtime: when the trinket is ready for use again
  319. DATA.PvPTrinketId = {} -- key = unitName | value (number) = spellId of trinket
  320.  
  321. local pvptrinketIDs = {
  322. [7744] = 30, -- Will of the Forsaken (Undead)
  323. [42292] = 120, --trinket
  324. [59752] = 30, -- human
  325.  
  326. [195710] = 180, -- 180 PvP talent Trinket
  327. [208683] = 120 -- 120 PvP talent Trinket
  328. }
  329.  
  330. DATA.TransName = {} -- key = unitName | value (string) = transliteration name
  331. DATA.FirstFlagCheck = {} -- key = unitName | value (number) = 1
  332.  
  333. for frc = 1, #FRAMES do
  334. local side = FRAMES[frc]
  335. DATA[side] = {}
  336.  
  337. DATA[side].MainMoverModeValue = false
  338.  
  339. DATA[side].rangeSpellName = nil -- value (string) | for class-spell based range check
  340. DATA[side].rangeMin = nil -- value (number) | for class-spell based range check
  341. DATA[side].rangeMax = nil -- value (number) | for class-spell based range check
  342.  
  343. DATA[side].hasFlag = nil -- value (string) = player name
  344. DATA[side].isLeader = nil -- value (string) = player name
  345. DATA[side].healthBarWidth = 0.01 -- value (number) = health bar width
  346. DATA[side].totHealthBarWidth = 0.01 -- value (number) = target of target health bar width
  347.  
  348. DATA[side].MainData = {} -- key = numerical | value = all player data
  349. DATA[side].Name4Flag = {} -- key = unitName without realm | value (number) = button number
  350. DATA[side].Name2Button = {} -- key = unitName | value (number) = button number
  351. DATA[side].Name2UnitID = {} -- key = unitName | value (string) = unitID
  352. DATA[side].UnitID2Name = {} -- key = unitID | value (string) = unitName
  353. DATA[side].Name2Level = {} -- key = unitName | value (number) = level
  354. DATA[side].Name2Percent = {} -- key = unitName | value (number) = health in percent
  355. DATA[side].Name2Range = {} -- key = unitName | value (number) = distance in ym
  356.  
  357. DATA[side].Roles = {0,0,0,0}
  358. end
  359.  
  360. local SPELL_Range = {} -- key = spellId | value = maxRange
  361.  
  362. local currentSize = 10
  363. local currentBGMap = nil
  364. local testSize = 10
  365. local testData = {
  366. Loaded = nil, -- testData.Loaded
  367. CarrierDisplay = "flag", -- testData.CarrierDisplay
  368. Friend = {}, -- testData.Friend
  369. Enemy = {} -- testData.Enemy
  370. }
  371. for frc = 1, #FRAMES do
  372. local side = FRAMES[frc]
  373. testData[side] = {
  374. IconTarget = 2, -- testData[side].IconTarget | testData.Friend.IconTarget | testData.Enemy.IconTarget
  375. IconFocus = 5, -- testData[side].IconFocus | testData.Friend.IconFocus | testData.Enemy.IconFocus
  376. IconFlag = {button = 3, txt = 1}, -- testData[side].IconFlag | testData.Friend.IconFlag | testData.Enemy.IconFlag
  377. IconOrb = {[121164] = {button = 2}, -- testData[side].IconOrb (Blue) | testData.Friend.IconOrb | testData.Enemy.IconOrb
  378. [121175] = {button = 4}, -- testData[side].IconOrb (Puprle) | testData.Friend.IconOrb | testData.Enemy.IconOrb
  379. [121176] = {button = 7}, -- testData[side].IconOrb (Green) | testData.Friend.IconOrb | testData.Enemy.IconOrb
  380. [121177] = {button = nil}}, -- testData[side].IconOrb (Orange) | testData.Friend.IconOrb | testData.Enemy.IconOrb
  381. IconTargetAssi = 4, -- testData[side].IconTargetAssi | testData.Friend.IconTargetAssi | testData.Enemy.IconTargetAssi
  382. IconSourceAssi = 4, -- testData[side].IconSourceAssi | testData.Friend.IconSourceAssi | testData.Enemy.IconSourceAssi
  383. targetFCount = {}, -- testData[side].targetFCount | testData.Friend.targetFCount | testData.Enemy.targetFCount
  384. targetECount = {}, -- testData[side].targetECount | testData.Friend.targetECount | testData.Enemy.targetECount
  385. Health = {}, -- testData[side].Health | testData.Friend.Health | testData.Enemy.Health
  386. Range = {}, -- testData[side].Range | testData.Friend.Range | testData.Enemy.Range
  387. TargetofTarget = {}, -- testData[side].TargetofTarget | testData.Friend.TargetofTarget | testData.Enemy.TargetofTarget
  388. Leader = 4, -- testData[side].Leader | testData.Friend.Leader | testData.Enemy.Leader
  389. PVPTrinket = {}, -- testData[side].PVPTrinket | testData.Friend.PVPTrinket | testData.Enemy.PVPTrinket
  390. }
  391. end
  392.  
  393. local mapID = {}
  394. local bgMaps = {}
  395. local function BuildBattlegroundMapTable()
  396. for i = 1, GetNumBattlegroundTypes() do
  397. local localizedName, _, _, _, bgID, _, _, _, gameType, icon = GetBattlegroundInfo(i)
  398. --print(localizedName, bgID, gameType, icon, i, "#", GetBattlegroundInfo(i))
  399. if bgID == 1 then mapID[401] = localizedName bgMaps[localizedName] = {bgSize = 40, flagBG = 0} -- Alterac Valley
  400. elseif bgID == 2 then mapID[443] = localizedName bgMaps[localizedName] = {bgSize = 10, flagBG = 1} -- Warsong Gulch
  401. elseif bgID == 3 then mapID[461] = localizedName bgMaps[localizedName] = {bgSize = 15, flagBG = 0} -- Arathi Basin
  402. elseif bgID == 7 then mapID[482] = localizedName bgMaps[localizedName] = {bgSize = 15, flagBG = 2} -- Eye of the Storm
  403. elseif bgID == 9 then mapID[512] = localizedName bgMaps[localizedName] = {bgSize = 15, flagBG = 0} -- Strand of the Ancients
  404. elseif bgID == 30 then mapID[540] = localizedName bgMaps[localizedName] = {bgSize = 40, flagBG = 0} -- Isle of Conquest
  405. elseif bgID == 108 then mapID[626] = localizedName bgMaps[localizedName] = {bgSize = 10, flagBG = 3} -- Twin Peaks
  406. elseif bgID == 120 then mapID[736] = localizedName bgMaps[localizedName] = {bgSize = 10, flagBG = 0} -- The Battle for Gilneas
  407. elseif bgID == 699 then mapID[856] = localizedName bgMaps[localizedName] = {bgSize = 10, flagBG = 5} -- Temple of Kotmogu
  408. elseif bgID == 708 then mapID[860] = localizedName bgMaps[localizedName] = {bgSize = 10, flagBG = 0} -- Silvershard Mines
  409. elseif bgID == 754 then mapID[935] = localizedName bgMaps[localizedName] = {bgSize = 15, flagBG = 4} -- Deepwind Gorge
  410. elseif bgID == 789 then bgMaps[localizedName] = {bgSize = 40, flagBG = 0} -- Southshore vs Tarren Mill
  411. end
  412. end
  413. end
  414.  
  415. local totalFlags = {
  416. 2, -- flagBG = 1 Warsong Gulch
  417. 1, -- flagBG = 2 Eye of the Storm
  418. 2, -- flagBG = 3 Twin Peaks
  419. 4, -- flagBG = 4 Temple of Kotmogu
  420. 2, -- flagBG = 5 Deepwind Gorge
  421. }
  422.  
  423. local flagIDs = {
  424. [34976] = 1, -- Netherstorm Flag Eye of the Storm
  425. [140876] = 1, -- Alliance Mine Cart Deepwind Gorge
  426. [141210] = 1, -- Horde Mine Cart Deepwind Gorge
  427. [156618] = 1, -- Horde Flag Warsong Gulch & Twin Peaks
  428. [156621] = 1, -- Alliance Flag Warsong Gulch & Twin Peaks
  429. }
  430.  
  431. local debuffIDs = {
  432. [46392] = 1, -- Focused Assault
  433. [46393] = 1, -- Brutal Assault
  434. }
  435.  
  436. local hasOrb = {Green={name=nil,orbval=nil},Blue={name=nil,orbval=nil},Purple={name=nil,orbval=nil},Orange={name=nil,orbval=nil}}
  437.  
  438. local orbIDs = {
  439. [121164] = {color = "Blue", texture = "Interface\\MiniMap\\TempleofKotmogu_ball_cyan"}, -- |cFF01DFD__7__Blue|r |cFF01DFD7Blue|r
  440. [121175] = {color = "Purple", texture = "Interface\\MiniMap\\TempleofKotmogu_ball_purple"}, -- |cFFBF00F__F__Purple|r |cFFBF00FFPurple|r
  441. [121176] = {color = "Green", texture = "Interface\\MiniMap\\TempleofKotmogu_ball_green"}, -- |cFF01DF0__1__Green|r |cFF01DF01Green|r
  442. [121177] = {color = "Orange", texture = "Interface\\MiniMap\\TempleofKotmogu_ball_orange"}, -- |cFFFF800__0__Orange|r |cFFFF8000Orange|r
  443. }
  444.  
  445. local orbColIDs = {
  446. ["Blue"] = 121164,-- code = {0.0039, 0.8745, 0.8431}
  447. ["Purple"] = 121175,-- code = {0.7490, 0 , 1 }
  448. ["Green"] = 121176,-- code = {0.0039, 0.8745, 0.0039}
  449. ["Orange"] = 121177,-- code = {1 , 0.5019, 0 }
  450. }
  451.  
  452. local function orbData(str)
  453. local colorCode = strmatch(str, "^|cFF%x%x%x%x%x(%x).*|r$")
  454. --print("colorCode:", colorCode)
  455. if colorCode == "7" then return "Blue", "Interface\\MiniMap\\TempleofKotmogu_ball_cyan" -- |cFF01DFD__7__Blue|r |cFF01DFD7Blue|r
  456. elseif colorCode == "F" then return "Purple", "Interface\\MiniMap\\TempleofKotmogu_ball_purple" -- |cFFBF00F__F__Purple|r |cFFBF00FFPurple|r
  457. elseif colorCode == "1" then return "Green", "Interface\\MiniMap\\TempleofKotmogu_ball_green" -- |cFF01DF0__1__Green|r |cFF01DF01Green|r
  458. elseif colorCode == "0" then return "Orange", "Interface\\MiniMap\\TempleofKotmogu_ball_orange" -- |cFFFF800__0__Orange|r |cFFFF8000Orange|r
  459. end
  460. return nil, nil
  461. end
  462.  
  463. local sortBy = {
  464. L["Role"].." / "..L["Class"].."* / "..L["Name"], -- 1
  465. L["Role"].." / "..L["Name"], -- 2
  466. L["Class"].."* / "..L["Role"].." / "..L["Name"], -- 3
  467. L["Class"].."* / "..L["Name"], -- 4
  468. L["Name"], -- 5
  469. }
  470.  
  471. local sortDetail = {
  472. "*"..L["Class"].." ("..locale..")", -- 1
  473. "*"..L["Class"].." (english)", -- 2
  474. "*"..L["Class"].." (Blizzard)", -- 3
  475. }
  476.  
  477. local fontStyles = {
  478. {font = "Fonts\\2002.ttf", name = "2002 - |cffa070ddLatin-1|r |cff68ccefkoKR|r |cffff7c0aruRU|r"}, -- 1
  479. {font = "Fonts\\2002B.ttf", name = "2002 Bold - |cffa070ddLatin-1|r |cff68ccefkoKR|r |cffff7c0aruRU|r"}, -- 2
  480. {font = "Fonts\\ARIALN.TTF", name = "Arial Narrow - |cffa070ddLatin|r |cffff7c0aruRU|r"}, -- 3
  481. {font = "Fonts\\ARHei.ttf", name = "AR CrystalzcuheiGBK Demibold - |cffff7c0aruRU|r |cffc69b6dzhCN|r |cffc41e3azhTW|r"}, -- 4
  482. {font = "Fonts\\bHEI00M.ttf", name = "AR Heiti2 Medium B5 - |cffff7c0aruRU|r |cffc41e3azhTW|r"}, -- 5
  483. {font = "Fonts\\bHEI01B.ttf", name = "AR Heiti2 Bold B5 - |cffff7c0aruRU|r |cffc41e3azhTW|r"}, -- 6
  484. {font = "Fonts\\bKAI00M.ttf", name = "AR Kaiti Medium B5 - |cffff7c0aruRU|r |cffc41e3azhTW|r"}, -- 7
  485. {font = "Fonts\\bLEI00D.ttf", name = "AR Leisu Demi B5 - |cffff7c0aruRU|r |cffc41e3azhTW|r"}, -- 8
  486. {font = "Fonts\\ARKai_C.ttf", name = "AR ZhongkaiGBK Medium C - |cffff7c0aruRU|r |cffc69b6dzhCN|r |cffc41e3azhTW|r"}, -- 9
  487. {font = "Fonts\\ARKai_T.ttf", name = "AR ZhongkaiGBK Medium T - |cffff7c0aruRU|r |cffc69b6dzhCN|r |cffc41e3azhTW|r"}, -- 10
  488. {font = "Fonts\\FRIZQT__.TTF", name = "Friz Quadrata TT - |cffa070ddLatin-1|r"}, -- 11
  489. {font = "Fonts\\FRIZQT___CYR.TTF", name = "Friz Quadrata TT Cyr - |cffff7c0aruRU|r"}, -- 12
  490. {font = "Fonts\\MORPHEUS.TTF", name = "Morpheus - |cffa070ddLatin-1|r"}, -- 13
  491. {font = "Fonts\\MORPHEUS_CYR.TTF", name = "Morpheus Cyr - |cffa070ddLatin-1|r |cffff7c0aruRU|r"}, -- 14
  492. {font = "Fonts\\NIM_____.ttf", name = "Nimrod MT - |cffa070ddLatin|r |cffff7c0aruRU|r"}, -- 15
  493. {font = "Fonts\\SKURRI.TTF", name = "Skurri - |cffa070ddLatin-1|r"}, -- 16
  494. {font = "Fonts\\SKURRI_CYR.TTF", name = "Skurri Cyr - |cffa070ddLatin-1|r |cffff7c0aruRU|r"}, -- 17
  495. {font = "Fonts\\K_Pagetext.TTF", name = "YDIMokM - |cffa070ddLatin-1|r |cff68ccefkoKR|r |cffff7c0aruRU|r"}, -- 18
  496. {font = "Fonts\\K_Damage.TTF", name = "YDIWingsM - |cff68ccefkoKR|r |cffff7c0aruRU|r"}, -- 19
  497. }
  498.  
  499. local defaultFont = 1
  500. -- if locale == "deDE" then defaultFont = 1
  501. --elseif locale == "enGB" then defaultFont = 1 -> enUS
  502. --elseif locale == "enUS" then defaultFont = 1
  503. --elseif locale == "esES" then defaultFont = 1
  504. --elseif locale == "esMX" then defaultFont = 1
  505. --elseif locale == "frFR" then defaultFont = 1
  506. --elseif locale == "itIT" then defaultFont = 1
  507. --elseif locale == "koKR" then defaultFont = 1 -- 2002.ttf (same as defined in Fonts.xml)
  508. --elseif locale == "ptBR" then defaultFont = 1
  509. --elseif locale == "ptPT" then defaultFont = 1 -> ptBR
  510. if locale == "ruRU" then defaultFont = 12 -- FRIZQT___CYR.TTF (same as defined in Fonts.xml)
  511. elseif locale == "zhCN" then defaultFont = 10 -- ARKai_T.ttf (same as defined in Fonts.xml)
  512. elseif locale == "zhTW" then defaultFont = 10 -- ARKai_T.ttf (same as defined in Fonts.xml)
  513. --elseif locale == "enCN" then defaultFont = 10 -> zhCN
  514. --elseif locale == "enTW" then defaultFont = 10 -> zhTW
  515. end
  516.  
  517. local fontPath = fontStyles[defaultFont].font
  518.  
  519. local classcolors = {}
  520. for class, color in pairs(RAID_CLASS_COLORS) do -- Constants.lua
  521. classcolors[class] = {r = color.r, g = color.g, b = color.b, colorStr = format("%.2x%.2x%.2x", color.r*255, color.g*255, color.b*255)}
  522. end
  523. classcolors["ZZZFAILURE"] = {r = 0.6, g = 0.6, b = 0.6, colorStr = "999999"}
  524. --for k, v in pairs(classcolors) do print(k, v.r, v.g, v.b, v.colorStr) end
  525.  
  526. -- texture: Interface\\WorldStateFrame\\Icons-Classes
  527. local classes = {
  528. DEATHKNIGHT = {coords = {0.2578125, 0.4921875, 0.5078125, 0.7421875 }}, -- ( 66/256, 126/256, 130/256, 190/256)
  529. DRUID = {coords = {0.74609375, 0.98046875, 0.0078125, 0.2421875 }}, -- (191/256, 251/256, 2/256, 62/256)
  530. HUNTER = {coords = {0.0078125, 0.2421875, 0.26171875, 0.49609375}}, -- ( 2/256, 62/256, 67/256, 127/256)
  531. MAGE = {coords = {0.25, 0.484375, 0.01171875, 0.24609375}}, -- ( 64/256, 124/256, 3/256, 63/256)
  532. MONK = {coords = {0.5, 0.734375, 0.51171875, 0.74609375}}, -- (128/256, 188/256, 131/256, 191/256)
  533. PALADIN = {coords = {0.0078125, 0.2421875, 0.51171875, 0.74609375}}, -- ( 2/256, 62/256, 131/256, 191/256)
  534. PRIEST = {coords = {0.5, 0.734375, 0.265625, 0.5 }}, -- (128/256, 188/256, 68/256, 128/256)
  535. ROGUE = {coords = {0.50390625, 0.73828125, 0.01171875, 0.24609375}}, -- (129/256, 189/256, 3/256, 63/256)
  536. SHAMAN = {coords = {0.25390625, 0.48828125, 0.2578125, 0.4921875 }}, -- ( 65/256, 125/256, 66/256, 126/256)
  537. WARLOCK = {coords = {0.75, 0.984375, 0.2578125, 0.4921875 }}, -- (192/256, 252/256, 66/256, 126/256)
  538. WARRIOR = {coords = {0.0078125, 0.2421875, 0.0078125, 0.2421875 }}, -- ( 2/256, 62/256, 2/256, 62/256)
  539. DEMONHUNTER = {coords = {0.74609375, 0.98046875, 0.5078125, 0.7421875 }}, -- (191/256, 251/256, 131/256, 191/256)
  540. ZZZFAILURE = {coords = {0, 0, 0, 0}},
  541. }
  542.  
  543. -- roles: 1 = HEALER | 2 = TANK | 3 = DAMAGER
  544. local classROLES = {HEALER = {}, TANK = {}, DAMAGER = {}}
  545. for classID = 1, MAX_CLASSES do
  546. local _, classTag = GetClassInfoByID(classID)
  547. local numTabs = GetNumSpecializationsForClassID(classID)
  548. --print(numTabs, classID, "#", GetNumSpecializationsForClassID(classID))
  549. classes[classTag].spec = {}
  550. classes[classTag].fixname = {}
  551. classes[classTag].fix = false
  552. for i = 1, numTabs do
  553. local id, name, _, icon, _, role = GetSpecializationInfoForClassID(classID, i)
  554. --print(role, id, classID, i, name, icon, "#", GetSpecializationInfoForClassID(classID, i))
  555. if role == "DAMAGER" then classes[classTag].spec[i] = {role = 3, specID = id, specName = name, icon = icon} tinsert(classROLES.DAMAGER, {classTag = classTag, specIndex = i}) -- DAMAGER: total = 23
  556. elseif role == "HEALER" then classes[classTag].spec[i] = {role = 1, specID = id, specName = name, icon = icon} tinsert(classROLES.HEALER, {classTag = classTag, specIndex = i}) -- HEALER : total = 6
  557. elseif role == "TANK" then classes[classTag].spec[i] = {role = 2, specID = id, specName = name, icon = icon} tinsert(classROLES.TANK, {classTag = classTag, specIndex = i}) -- TANK : total = 5
  558. end
  559. --locale fix
  560. local _ , fname = GetSpecializationInfoForClassID(classID, i, 3)
  561. if name ~= fname then
  562. classes[classTag].fixname[fname] = name
  563. classes[classTag].fix = true
  564. end
  565. end
  566. end
  567.  
  568. for classTag in pairs(TLT) do
  569. if not classes[classTag].spec then classes[classTag].spec = {} end
  570. for i = 1, #TLT[classTag].spec do
  571. tinsert(classes[classTag].spec, TLT[classTag].spec[i])
  572. end
  573. end
  574.  
  575. --[[
  576. for k, v in pairs(classes) do
  577. if classes[k] and classes[k].spec then
  578. for i = 1, #classes[k].spec do
  579. local str = ""
  580. for k2, v2 in pairs(classes[k].spec[i]) do
  581. str = str .. k2 .. ": " .. v2 .. " - "
  582. end
  583. print(k, str)
  584. end
  585. end
  586. end
  587. --]]
  588.  
  589. -- 10 HEALER 1- 3 | 15 HEALER 2- 4 | 40 HEALER 3- 6
  590. -- 10 TANK 1- 2 | 15 TANK 2- 4 | 40 TANK 2- 4
  591. -- 10 DAMAGER 5- 8 | 15 DAMAGER 7-11 | 40 DAMAGER 30-35
  592. testData.Friend.MainTestDATA = {[10] = {}, [15] = {}, [40] = {}}
  593. testData.Enemy.MainTestDATA = {[10] = {}, [15] = {}, [40] = {}}
  594. local function newTestData()
  595. local classDATA = {}
  596. for frc = 1, #FRAMES do
  597. local side = FRAMES[frc]
  598. local healerRND10, tankRND10 = random(1,3), random(1,2)
  599. local healerRND15, tankRND15 = random(2,4), random(1,3)
  600. local healerRND40, tankRND40 = random(3,6), random(2,4)
  601. local damagerRND10 = 10-healerRND10-tankRND10
  602. local damagerRND15 = 15-healerRND15-tankRND15
  603. local damagerRND40 = 40-healerRND40-tankRND40
  604. classDATA[side] = {
  605. HEALER = {[10] = healerRND10, [15] = healerRND15, [40] = healerRND40},
  606. TANK = {[10] = tankRND10, [15] = tankRND15, [40] = tankRND40},
  607. DAMAGER = {[10] = damagerRND10, [15] = damagerRND15, [40] = damagerRND40}
  608. }
  609. end
  610.  
  611. for frc = 1, #FRAMES do
  612. local side = FRAMES[frc]
  613. ----------
  614. for bracket = 1, 3 do
  615. local bracketSize
  616. if bracket == 1 then bracketSize = 10
  617. elseif bracket == 2 then bracketSize = 15
  618. elseif bracket == 3 then bracketSize = 40
  619. end
  620. local charnum1 = random(65, 90) -- 65 = A | 90 = Z
  621. local charnum2 = random(97,111) -- 97 = a | 111 = o
  622. wipe(testData[side].MainTestDATA[bracketSize])
  623. for role in pairs(classROLES) do
  624. local index = 0
  625. while index < classDATA[side][role][bracketSize] do
  626. local rndNum = random(1, #classROLES[role])
  627. local classToken = classROLES[role][rndNum].classTag
  628. local specIndex = classROLES[role][rndNum].specIndex
  629. tinsert(testData[side].MainTestDATA[bracketSize], {
  630. name = L["Target"].."_"..strchar(charnum1)..strchar(charnum2).."-servername",
  631. classToken = classToken,
  632. talentSpec = classes[classToken].spec[specIndex].role,
  633. specIcon = classes[classToken].spec[specIndex].icon
  634. })
  635. if charnum1 == 90 then charnum1 = 65 else charnum1 = charnum1 + 1 end
  636. if charnum2 == 111 then charnum2 = 97 else charnum2 = charnum2 + 1 end
  637. index = index + 1
  638. end
  639. end
  640. end
  641. ----------
  642. end
  643. end
  644.  
  645. local class_LocaSort = {}
  646. FillLocalizedClassList(class_LocaSort, false) -- Constants.lua
  647.  
  648. local class_BlizzSort = {}
  649. for i = 1, #CLASS_SORT_ORDER do -- Constants.lua
  650. class_BlizzSort[ CLASS_SORT_ORDER[i] ] = i
  651. end
  652.  
  653. local class_IntegerSort = { -- .cid .blizz .eng .loc
  654. {cid = "DEATHKNIGHT", blizz = class_BlizzSort.DEATHKNIGHT or 2, eng = "Death Knight", loc = class_LocaSort.DEATHKNIGHT or "Death Knight"}, -- 1
  655. {cid = "DRUID", blizz = class_BlizzSort.DRUID or 7, eng = "Druid", loc = class_LocaSort.DRUID or "Druid"}, -- 2
  656. {cid = "HUNTER", blizz = class_BlizzSort.HUNTER or 11, eng = "Hunter", loc = class_LocaSort.HUNTER or "Hunter"}, -- 3
  657. {cid = "MAGE", blizz = class_BlizzSort.MAGE or 9, eng = "Mage", loc = class_LocaSort.MAGE or "Mage"}, -- 4
  658. {cid = "MONK", blizz = class_BlizzSort.MONK or 4, eng = "Monk", loc = class_LocaSort.MONK or "Monk"}, -- 5
  659. {cid = "PALADIN", blizz = class_BlizzSort.PALADIN or 3, eng = "Paladin", loc = class_LocaSort.PALADIN or "Paladin"}, -- 6
  660. {cid = "PRIEST", blizz = class_BlizzSort.PRIEST or 5, eng = "Priest", loc = class_LocaSort.PRIEST or "Priest"}, -- 7
  661. {cid = "ROGUE", blizz = class_BlizzSort.ROGUE or 8, eng = "Rogue", loc = class_LocaSort.ROGUE or "Rogue"}, -- 8
  662. {cid = "SHAMAN", blizz = class_BlizzSort.SHAMAN or 6, eng = "Shaman", loc = class_LocaSort.SHAMAN or "Shaman"}, -- 9
  663. {cid = "WARLOCK", blizz = class_BlizzSort.WARLOCK or 10, eng = "Warlock", loc = class_LocaSort.WARLOCK or "Warlock"}, -- 10
  664. {cid = "WARRIOR", blizz = class_BlizzSort.WARRIOR or 1, eng = "Warrior", loc = class_LocaSort.WARRIOR or "Warrior"}, -- 11
  665. {cid = "DEMONHUNTER", blizz = class_BlizzSort.DEMONHUNTER or 12, eng = "Demon Hunter", loc = class_LocaSort.DEMONHUNTER or "Demon Hunter"}, -- 12
  666. }
  667.  
  668. local ranges = {
  669. Friend = {
  670. DEATHKNIGHT = {id = 61999, lvl = 72}, -- Raise Ally ( 0 - 40yd/m) - Lvl 72 DKN72
  671. DRUID = {id = 50769, lvl = 14}, -- Revive ( 0 - 40yd/m) - Lvl 4
  672. HUNTER = {id = 136, lvl = 111}, --none Misdirection ( 0 -100yd/m) - Lvl 42 HUN42 -- no_def_range
  673. MAGE = {id = 130, lvl = 32}, -- Slow Fall ( 0 - 40yd/m) - Lvl 29 MAG32
  674. MONK = {id = 115178, lvl = 14}, -- Resuscitate ( 0 - 40yd/m) - Lvl 18 MON18
  675. PALADIN = {id = 633, lvl = 22}, -- LoH ( 0 - 40yd/m) - Lvl 9
  676. PRIEST = {id = 2006, lvl = 14}, -- Resurection ( 0 - 40yd/m) - Lvl 7
  677. ROGUE = {id = 57934, lvl = 64}, -- Tricks of the Trade ( 0 -100yd/m) - Lvl 78 ROG78 -- no_def_range
  678. SHAMAN = {id = 2008, lvl = 14}, -- Ancestral Spirit ( 0 - 40yd/m) - Lvl 7
  679. WARLOCK = {id = 20707, lvl = 18}, -- Soulstone ( 0 - 40yd/m) - Lvl 18 WLK18
  680. WARRIOR = {id = 198304, lvl = 72}, -- Intercept ( 0 -100yd/m) - Lvl 72 WRR72 -- no_def_range
  681. DEMONHUNTER = {id = 6603, lvl = 98}, -- Intercept ( 0 -100yd/m) - Lvl 72 WRR72 -- no_def_range
  682. },
  683. Enemy = {
  684. DEATHKNIGHT = {id = 49576, lvl = 55}, -- Death Grip ( 0 - 40yd/m) - Lvl 55
  685. DRUID = {id = 339, lvl = 22}, -- Entangling Roots ( 0 - 40yd/m) - Lvl 1
  686. HUNTER = {id = 75, lvl = 1}, -- Auto Shot ( 0 - 40yd/m) - Lvl 1
  687. MAGE = {id = 2139, lvl = 34}, -- Counterspell ( 0 - 40yd/m) - Lvl 1
  688. MONK = {id = 117952, lvl = 36}, -- Crackling Jade L ( 0 - 40yd/m) - Lvl 14 MON14
  689. PALADIN = {id = 20271, lvl = 3}, -- Judgment ( 0 - 30yd/m) - Lvl 3
  690. PRIEST = {id = 585, lvl = 1}, -- smite ( 0 - 40yd/m) - Lvl 4
  691. ROGUE = {id = 6770, lvl = 12}, -- Sap ( 0 - 10yd/m) - Lvl 12 ROG12
  692. SHAMAN = {id = 403, lvl = 1}, -- Lightning Bolt ( 0 - 30yd/m) - Lvl 1
  693. WARLOCK = {id = 689, lvl = 1}, -- Drain Life ( 0 - 40yd/m) - Lvl 1
  694. WARRIOR = {id = 100, lvl = 3}, -- Charge ( 8 - 25yd/m) - Lvl 3
  695. DEMONHUNTER = {id = 162794, lvl = 100}, -- Chaos Strike ( 8 - 25yd/m) - Lvl 3 ]]
  696. }
  697. }
  698. --[[
  699. for k1, v1 in pairs(ranges) do
  700. for k2, v2 in pairs(v1) do
  701. local name, _, _, _, min, max = GetSpellInfo(v2.id)
  702. print(k1, k2, "#", "id:", v2.id, "lvl:", v2.lvl, "#", name, min, max, "#", IsSpellKnown(v2.id), "#", GetSpellInfo(v2.id))
  703. end
  704. end
  705. --]]
  706.  
  707. local rangeDisplay = { -- RANGE_DISP_LAY
  708. "STD 100", -- 1 STD Standard (with 'block')
  709. "STD 50", -- 2
  710. "STD 10", -- 3
  711. "STD 100 mono", -- 4
  712. "STD 50 mono", -- 5
  713. "STD 10 mono", -- 6
  714. "X 10", -- 7 X (without 'block')
  715. "X 100 mono", -- 8
  716. "X 50 mono", -- 9
  717. "X 10 mono", -- 10
  718. }
  719.  
  720. local Textures = {}
  721. Textures.AddonIcon = "Interface\\AddOns\\BattlegroundTargets\\BattlegroundTargets-texture-button"
  722. Textures.Path = "Interface\\AddOns\\BattlegroundTargets\\BattlegroundTargets-texture-icons"
  723. Textures.RoleIcon ={{0.75, 1, 0, 0.25}, -- {48/64, 64/64, 0/64, 16/64} -- 1 HEALER
  724. {0.75, 1, 0.25, 0.5}, -- {48/64, 64/64, 16/64, 32/64} -- 2 TANK
  725. {0.75, 1, 0.5, 0.75}, -- {48/64, 64/64, 32/64, 48/64} -- 3 DAMAGER
  726. {0.75, 1, 0.75, 1}} -- {48/64, 64/64, 48/64, 64/64} -- 4 UNKNOWN
  727. Textures.UpdateWarning = {0, 0.546875, 0.734375, 0.984375} -- { 0/64, 35/64, 47/64, 63/64},
  728. Textures.CombatIcon = {0.015625, 0.265625, 0.734375, 0.984375} -- { 1/64, 17/64, 47/64, 63/64},
  729. Textures.FriendIcon = {path = "Interface\\Common\\friendship-heart", coords = {6/32, 26/32, 3/32, 23/32}}
  730. Textures.EnemyIcon = {path = "Interface\\PVPFrame\\Icon-Combat", coords = {0, 1, 0, 1}}
  731. Textures.FriendIconStr = "|TInterface\\Common\\friendship-heart:16:16:0:0:32:32:6:26:3:23|t"
  732. Textures.EnemyIconStr = "|TInterface\\PVPFrame\\Icon-Combat:16:16:0:0:16:16:0:16:0:16|t"
  733. Textures.MoverModeStr = "|TInterface\\Common\\UI-ModelControlPanel:14:14:0:0:64:128:20:34:38:52|t"
  734.  
  735. local raidUnitID = {}
  736. for i = 1, 40 do
  737. raidUnitID["raid"..i] = 1
  738. raidUnitID["raidpet"..i] = 1
  739. end
  740. local playerUnitID = {
  741. target = 1,
  742. pettarget = 1,
  743. focus = 1,
  744. mouseover = 1,
  745. }
  746. local sumPos = {0, 45, 90, 135, 180, 225, 270, 315, 360} -- SUMPOSi
  747. -- ---------------------------------------------------------------------------------------------------------------------
  748.  
  749.  
  750.  
  751. -- ---------------------------------------------------------------------------------------------------------------------
  752. local function Print(...) print("|cffffff7fBattlegroundTargets:|r", ...) end
  753.  
  754. local function NOOP() end
  755.  
  756. local function Desaturation(texture, desaturation)
  757. local shaderSupported = texture:SetDesaturated(desaturation)
  758. if not shaderSupported then
  759. if desaturation then
  760. texture:SetVertexColor(0.5, 0.5, 0.5)
  761. else
  762. texture:SetVertexColor(1.0, 1.0, 1.0)
  763. end
  764. end
  765. end
  766. -- ---------------------------------------------------------------------------------------------------------------------
  767.  
  768.  
  769.  
  770. -- ---------------------------------------------------------------------------------------------------------------------
  771. function BattlegroundTargets:InitOptions()
  772. SlashCmdList["BATTLEGROUNDTARGETS"] = function()
  773. BattlegroundTargets:Frame_Toggle(GVAR.OptionsFrame)
  774. end
  775. SLASH_BATTLEGROUNDTARGETS1 = "/bgt"
  776. SLASH_BATTLEGROUNDTARGETS2 = "/bgtargets"
  777. SLASH_BATTLEGROUNDTARGETS3 = "/battlegroundtargets"
  778.  
  779. if type(BattlegroundTargets_Options.version) ~= "number" then
  780. BattlegroundTargets_Options.version = 27
  781. end
  782.  
  783. if BattlegroundTargets_Options.version < 22 then
  784. wipe(BattlegroundTargets_Options)
  785. Print("Option reset.")
  786. BattlegroundTargets_Options.version = 27
  787. end
  788.  
  789. if BattlegroundTargets_Options.version == 22 then -- targetoftarget position reset
  790. if type(BattlegroundTargets_Options.ButtonToTPosition) == "table" then
  791. local v10 = BattlegroundTargets_Options.ButtonToTPosition[10]
  792. if v10 <= 4 then
  793. BattlegroundTargets_Options.ButtonToTPosition[10] = v10 + 4
  794. elseif v10 < 9 then
  795. BattlegroundTargets_Options.ButtonToTPosition[10] = v10 - 4
  796. end
  797. local v15 = BattlegroundTargets_Options.ButtonToTPosition[15]
  798. if v15 <= 4 then
  799. BattlegroundTargets_Options.ButtonToTPosition[15] = v15 + 4
  800. elseif v15 < 9 then
  801. BattlegroundTargets_Options.ButtonToTPosition[15] = v15 - 4
  802. end
  803. local v40 = BattlegroundTargets_Options.ButtonToTPosition[40]
  804. if v40 <= 4 then
  805. BattlegroundTargets_Options.ButtonToTPosition[40] = v40 + 4
  806. elseif v40 < 9 then
  807. BattlegroundTargets_Options.ButtonToTPosition[40] = v40 - 4
  808. end
  809. end
  810. BattlegroundTargets_Options.version = 23
  811. end
  812.  
  813. if BattlegroundTargets_Options.version == 23 then
  814. if type(BattlegroundTargets_Options.pos) == "table" then
  815. local pos = {}
  816. for k, v in pairs(BattlegroundTargets_Options.pos) do
  817. if strfind(k, "BattlegroundTargets_MainFrame", 1, true) then
  818. local size = strmatch(k, "^BattlegroundTargets_MainFrame(.*)$")
  819. if size and size ~= "" then
  820. pos["BattlegroundTargets_EnemyMainFrame"..size] = v
  821. else
  822. pos["BattlegroundTargets_EnemyMainFrame"] = v
  823. end
  824. elseif strfind(k, "BattlegroundTargets_OptionsFrame", 1, true) then
  825. pos["BattlegroundTargets_OptionsFrame"] = v
  826. end
  827. end
  828. BattlegroundTargets_Options.pos = nil
  829. BattlegroundTargets_Options.pos = pos
  830. end
  831. BattlegroundTargets_Options.version = 24
  832. end
  833.  
  834. if BattlegroundTargets_Options.version == 24 then
  835. BattlegroundTargets_Options.Enemy = {}
  836. BattlegroundTargets_Options.Enemy.EnableBracket = BattlegroundTargets_Options.EnableBracket BattlegroundTargets_Options.EnableBracket = nil
  837. BattlegroundTargets_Options.Enemy.IndependentPositioning = BattlegroundTargets_Options.IndependentPositioning BattlegroundTargets_Options.IndependentPositioning = nil
  838. BattlegroundTargets_Options.Enemy.LayoutTH = BattlegroundTargets_Options.LayoutTH BattlegroundTargets_Options.LayoutTH = nil
  839. BattlegroundTargets_Options.Enemy.LayoutSpace = BattlegroundTargets_Options.LayoutSpace BattlegroundTargets_Options.LayoutSpace = nil
  840. BattlegroundTargets_Options.Enemy.SummaryToggle = BattlegroundTargets_Options.SummaryToggle BattlegroundTargets_Options.SummaryToggle = nil
  841. BattlegroundTargets_Options.Enemy.SummaryScale = BattlegroundTargets_Options.SummaryScale BattlegroundTargets_Options.SummaryScale = nil
  842. BattlegroundTargets_Options.Enemy.SummaryPos = BattlegroundTargets_Options.SummaryPos BattlegroundTargets_Options.SummaryPos = nil
  843. BattlegroundTargets_Options.Enemy.ButtonShowRole = BattlegroundTargets_Options.ButtonShowRole BattlegroundTargets_Options.ButtonShowRole = nil
  844. BattlegroundTargets_Options.Enemy.ButtonShowSpec = BattlegroundTargets_Options.ButtonShowSpec BattlegroundTargets_Options.ButtonShowSpec = nil
  845. BattlegroundTargets_Options.Enemy.ButtonClassIcon = BattlegroundTargets_Options.ButtonClassIcon BattlegroundTargets_Options.ButtonClassIcon = nil
  846. BattlegroundTargets_Options.Enemy.ButtonShowRealm = BattlegroundTargets_Options.ButtonShowRealm BattlegroundTargets_Options.ButtonShowRealm = nil
  847. BattlegroundTargets_Options.Enemy.ButtonShowLeader = BattlegroundTargets_Options.ButtonShowLeader BattlegroundTargets_Options.ButtonShowLeader = nil
  848. BattlegroundTargets_Options.Enemy.ButtonShowTarget = BattlegroundTargets_Options.ButtonShowTarget BattlegroundTargets_Options.ButtonShowTarget = nil
  849. BattlegroundTargets_Options.Enemy.ButtonTargetScale = BattlegroundTargets_Options.ButtonTargetScale BattlegroundTargets_Options.ButtonTargetScale = nil
  850. BattlegroundTargets_Options.Enemy.ButtonTargetPosition = BattlegroundTargets_Options.ButtonTargetPosition BattlegroundTargets_Options.ButtonTargetPosition = nil
  851. BattlegroundTargets_Options.Enemy.ButtonShowAssist = BattlegroundTargets_Options.ButtonShowAssist BattlegroundTargets_Options.ButtonShowAssist = nil
  852. BattlegroundTargets_Options.Enemy.ButtonAssistScale = BattlegroundTargets_Options.ButtonAssistScale BattlegroundTargets_Options.ButtonAssistScale = nil
  853. BattlegroundTargets_Options.Enemy.ButtonAssistPosition = BattlegroundTargets_Options.ButtonAssistPosition BattlegroundTargets_Options.ButtonAssistPosition = nil
  854. BattlegroundTargets_Options.Enemy.ButtonShowFocus = BattlegroundTargets_Options.ButtonShowFocus BattlegroundTargets_Options.ButtonShowFocus = nil
  855. BattlegroundTargets_Options.Enemy.ButtonFocusScale = BattlegroundTargets_Options.ButtonFocusScale BattlegroundTargets_Options.ButtonFocusScale = nil
  856. BattlegroundTargets_Options.Enemy.ButtonFocusPosition = BattlegroundTargets_Options.ButtonFocusPosition BattlegroundTargets_Options.ButtonFocusPosition = nil
  857. BattlegroundTargets_Options.Enemy.ButtonShowFlag = BattlegroundTargets_Options.ButtonShowFlag BattlegroundTargets_Options.ButtonShowFlag = nil
  858. BattlegroundTargets_Options.Enemy.ButtonFlagScale = BattlegroundTargets_Options.ButtonFlagScale BattlegroundTargets_Options.ButtonFlagScale = nil
  859. BattlegroundTargets_Options.Enemy.ButtonFlagPosition = BattlegroundTargets_Options.ButtonFlagPosition BattlegroundTargets_Options.ButtonFlagPosition = nil
  860. BattlegroundTargets_Options.Enemy.ButtonShowFTargetCount = false
  861. BattlegroundTargets_Options.Enemy.ButtonShowETargetCount = BattlegroundTargets_Options.ButtonShowTargetCount BattlegroundTargets_Options.ButtonShowTargetCount = nil
  862. BattlegroundTargets_Options.Enemy.ButtonTargetofTarget = BattlegroundTargets_Options.ButtonTargetofTarget BattlegroundTargets_Options.ButtonTargetofTarget = nil
  863. BattlegroundTargets_Options.Enemy.ButtonToTScale = BattlegroundTargets_Options.ButtonToTScale BattlegroundTargets_Options.ButtonToTScale = nil
  864. BattlegroundTargets_Options.Enemy.ButtonToTPosition = BattlegroundTargets_Options.ButtonToTPosition BattlegroundTargets_Options.ButtonToTPosition = nil
  865. BattlegroundTargets_Options.Enemy.ButtonShowHealthBar = BattlegroundTargets_Options.ButtonShowHealthBar BattlegroundTargets_Options.ButtonShowHealthBar = nil
  866. BattlegroundTargets_Options.Enemy.ButtonShowHealthText = BattlegroundTargets_Options.ButtonShowHealthText BattlegroundTargets_Options.ButtonShowHealthText = nil
  867. BattlegroundTargets_Options.Enemy.ButtonRangeCheck = BattlegroundTargets_Options.ButtonRangeCheck BattlegroundTargets_Options.ButtonRangeCheck = nil
  868. BattlegroundTargets_Options.ButtonTypeRangeCheck = nil
  869. BattlegroundTargets_Options.Enemy.ButtonRangeDisplay = BattlegroundTargets_Options.ButtonRangeDisplay BattlegroundTargets_Options.ButtonRangeDisplay = nil
  870. BattlegroundTargets_Options.Enemy.ButtonSortBy = BattlegroundTargets_Options.ButtonSortBy BattlegroundTargets_Options.ButtonSortBy = nil
  871. BattlegroundTargets_Options.Enemy.ButtonSortDetail = BattlegroundTargets_Options.ButtonSortDetail BattlegroundTargets_Options.ButtonSortDetail = nil
  872. BattlegroundTargets_Options.Enemy.ButtonFontNameSize = BattlegroundTargets_Options.ButtonFontNameSize BattlegroundTargets_Options.ButtonFontNameSize = nil
  873. BattlegroundTargets_Options.Enemy.ButtonFontNameStyle = BattlegroundTargets_Options.ButtonFontNameStyle BattlegroundTargets_Options.ButtonFontNameStyle = nil
  874. BattlegroundTargets_Options.Enemy.ButtonFontNumberSize = BattlegroundTargets_Options.ButtonFontNumberSize BattlegroundTargets_Options.ButtonFontNumberSize = nil
  875. BattlegroundTargets_Options.Enemy.ButtonFontNumberStyle = BattlegroundTargets_Options.ButtonFontNumberStyle BattlegroundTargets_Options.ButtonFontNumberStyle = nil
  876. BattlegroundTargets_Options.Enemy.ButtonScale = BattlegroundTargets_Options.ButtonScale BattlegroundTargets_Options.ButtonScale = nil
  877. BattlegroundTargets_Options.Enemy.ButtonWidth = BattlegroundTargets_Options.ButtonWidth BattlegroundTargets_Options.ButtonWidth = nil
  878. BattlegroundTargets_Options.Enemy.ButtonHeight = BattlegroundTargets_Options.ButtonHeight BattlegroundTargets_Options.ButtonHeight = nil
  879. BattlegroundTargets_Options.version = 25
  880. end
  881.  
  882. if BattlegroundTargets_Options.version == 25 then
  883. if type(BattlegroundTargets_Options.pos) == "table" then
  884. BattlegroundTargets_Options.FramePosition = {}
  885. -- friend
  886. local posFdef = BattlegroundTargets_Options.pos.BattlegroundTargets_FriendMainFrame
  887. if posFdef then
  888. BattlegroundTargets_Options.FramePosition.FriendMainFrame10 = posFdef
  889. BattlegroundTargets_Options.FramePosition.FriendMainFrame15 = posFdef
  890. BattlegroundTargets_Options.FramePosition.FriendMainFrame40 = posFdef
  891. end
  892. local posF10 = BattlegroundTargets_Options.pos.BattlegroundTargets_FriendMainFrame10 if posF10 then BattlegroundTargets_Options.FramePosition.FriendMainFrame10 = posF10 end
  893. local posF15 = BattlegroundTargets_Options.pos.BattlegroundTargets_FriendMainFrame15 if posF15 then BattlegroundTargets_Options.FramePosition.FriendMainFrame15 = posF15 end
  894. local posF40 = BattlegroundTargets_Options.pos.BattlegroundTargets_FriendMainFrame40 if posF40 then BattlegroundTargets_Options.FramePosition.FriendMainFrame40 = posF40 end
  895. -- enemy
  896. local posEdef = BattlegroundTargets_Options.pos.BattlegroundTargets_EnemyMainFrame
  897. if posEdef then
  898. BattlegroundTargets_Options.FramePosition.EnemyMainFrame10 = posEdef
  899. BattlegroundTargets_Options.FramePosition.EnemyMainFrame15 = posEdef
  900. BattlegroundTargets_Options.FramePosition.EnemyMainFrame40 = posEdef
  901. end
  902. local posE10 = BattlegroundTargets_Options.pos.BattlegroundTargets_EnemyMainFrame10 if posE10 then BattlegroundTargets_Options.FramePosition.EnemyMainFrame10 = posE10 end
  903. local posE15 = BattlegroundTargets_Options.pos.BattlegroundTargets_EnemyMainFrame15 if posE15 then BattlegroundTargets_Options.FramePosition.EnemyMainFrame15 = posE15 end
  904. local posE40 = BattlegroundTargets_Options.pos.BattlegroundTargets_EnemyMainFrame40 if posE40 then BattlegroundTargets_Options.FramePosition.EnemyMainFrame40 = posE40 end
  905. -- options
  906. local posOpt = BattlegroundTargets_Options.pos.BattlegroundTargets_OptionsFrame
  907. if posOpt then
  908. BattlegroundTargets_Options.FramePosition.OptionsFrame = posOpt
  909. end
  910. end
  911. BattlegroundTargets_Options.pos = nil
  912. if BattlegroundTargets_Options.Friend then BattlegroundTargets_Options.Friend.IndependentPositioning = nil end
  913. if BattlegroundTargets_Options.Enemy then BattlegroundTargets_Options.Enemy.IndependentPositioning = nil end
  914. BattlegroundTargets_Options.version = 26
  915. end
  916.  
  917. if BattlegroundTargets_Options.version == 26 then
  918. for frc = 1, #FRAMES do
  919. local side = FRAMES[frc]
  920. if type(BattlegroundTargets_Options[side]) == "table" then
  921. if type(BattlegroundTargets_Options[side].ButtonShowRole) == "table" then BattlegroundTargets_Options[side].ButtonRoleToggle = BattlegroundTargets_Options[side].ButtonShowRole BattlegroundTargets_Options[side].ButtonShowRole = nil end
  922. if type(BattlegroundTargets_Options[side].ButtonShowSpec) == "table" then BattlegroundTargets_Options[side].ButtonSpecToggle = BattlegroundTargets_Options[side].ButtonShowSpec BattlegroundTargets_Options[side].ButtonShowSpec = nil end
  923. if type(BattlegroundTargets_Options[side].ButtonClassIcon) == "table" then BattlegroundTargets_Options[side].ButtonClassToggle = BattlegroundTargets_Options[side].ButtonClassIcon BattlegroundTargets_Options[side].ButtonClassIcon = nil end
  924. if type(BattlegroundTargets_Options[side].ButtonShowRealm) == "table" then BattlegroundTargets_Options[side].ButtonRealmToggle = BattlegroundTargets_Options[side].ButtonShowRealm BattlegroundTargets_Options[side].ButtonShowRealm = nil end
  925. if type(BattlegroundTargets_Options[side].ButtonShowLeader) == "table" then BattlegroundTargets_Options[side].ButtonLeaderToggle = BattlegroundTargets_Options[side].ButtonShowLeader BattlegroundTargets_Options[side].ButtonShowLeader = nil end
  926. if type(BattlegroundTargets_Options[side].ButtonShowTarget) == "table" then BattlegroundTargets_Options[side].ButtonTargetToggle = BattlegroundTargets_Options[side].ButtonShowTarget BattlegroundTargets_Options[side].ButtonShowTarget = nil end
  927. --if type(BattlegroundTargets_Options[side].ButtonTargetScale) == "table" then BattlegroundTargets_Options[side].ButtonTargetScale = BattlegroundTargets_Options[side].ButtonTargetScale end
  928. --if type(BattlegroundTargets_Options[side].ButtonTargetPosition) == "table" then BattlegroundTargets_Options[side].ButtonTargetPosition = BattlegroundTargets_Options[side].ButtonTargetPosition end
  929. if type(BattlegroundTargets_Options[side].ButtonShowAssist) == "table" then BattlegroundTargets_Options[side].ButtonAssistToggle = BattlegroundTargets_Options[side].ButtonShowAssist BattlegroundTargets_Options[side].ButtonShowAssist = nil end
  930. --if type(BattlegroundTargets_Options[side].ButtonAssistScale) == "table" then BattlegroundTargets_Options[side].ButtonAssistScale = BattlegroundTargets_Options[side].ButtonAssistScale end
  931. --if type(BattlegroundTargets_Options[side].ButtonAssistPosition) == "table" then BattlegroundTargets_Options[side].ButtonAssistPosition = BattlegroundTargets_Options[side].ButtonAssistPosition end
  932. if type(BattlegroundTargets_Options[side].ButtonShowFocus) == "table" then BattlegroundTargets_Options[side].ButtonFocusToggle = BattlegroundTargets_Options[side].ButtonShowFocus BattlegroundTargets_Options[side].ButtonShowFocus = nil end
  933. --if type(BattlegroundTargets_Options[side].ButtonFocusScale) == "table" then BattlegroundTargets_Options[side].ButtonFocusScale = BattlegroundTargets_Options[side].ButtonFocusScale end
  934. --if type(BattlegroundTargets_Options[side].ButtonFocusPosition) == "table" then BattlegroundTargets_Options[side].ButtonFocusPosition = BattlegroundTargets_Options[side].ButtonFocusPosition end
  935. if type(BattlegroundTargets_Options[side].ButtonShowFlag) == "table" then BattlegroundTargets_Options[side].ButtonFlagToggle = BattlegroundTargets_Options[side].ButtonShowFlag BattlegroundTargets_Options[side].ButtonShowFlag = nil end
  936. --if type(BattlegroundTargets_Options[side].ButtonFlagScale) == "table" then BattlegroundTargets_Options[side].ButtonFlagScale = BattlegroundTargets_Options[side].ButtonFlagScale end
  937. --if type(BattlegroundTargets_Options[side].ButtonFlagPosition) == "table" then BattlegroundTargets_Options[side].ButtonFlagPosition = BattlegroundTargets_Options[side].ButtonFlagPosition end
  938. if type(BattlegroundTargets_Options[side].ButtonShowFTargetCount) == "table" then BattlegroundTargets_Options[side].ButtonFTargetCountToggle = BattlegroundTargets_Options[side].ButtonShowFTargetCount BattlegroundTargets_Options[side].ButtonShowFTargetCount = nil end
  939. if type(BattlegroundTargets_Options[side].ButtonShowETargetCount) == "table" then BattlegroundTargets_Options[side].ButtonETargetCountToggle = BattlegroundTargets_Options[side].ButtonShowETargetCount BattlegroundTargets_Options[side].ButtonShowETargetCount = nil end
  940. --if type(BattlegroundTargets_Options[side].ButtonPvPTrinketToggle) == "table" then BattlegroundTargets_Options[side].ButtonPvPTrinketToggle = BattlegroundTargets_Options[side].ButtonPvPTrinketToggle end
  941. if type(BattlegroundTargets_Options[side].ButtonTargetofTarget) == "table" then BattlegroundTargets_Options[side].ButtonToTToggle = BattlegroundTargets_Options[side].ButtonTargetofTarget BattlegroundTargets_Options[side].ButtonTargetofTarget = nil end
  942. --if type(BattlegroundTargets_Options[side].ButtonToTScale) == "table" then BattlegroundTargets_Options[side].ButtonToTScale = BattlegroundTargets_Options[side].ButtonToTScale end
  943. --if type(BattlegroundTargets_Options[side].ButtonToTPosition) == "table" then BattlegroundTargets_Options[side].ButtonToTPosition = BattlegroundTargets_Options[side].ButtonToTPosition end
  944. if type(BattlegroundTargets_Options[side].ButtonShowHealthBar) == "table" then BattlegroundTargets_Options[side].ButtonHealthBarToggle = BattlegroundTargets_Options[side].ButtonShowHealthBar BattlegroundTargets_Options[side].ButtonShowHealthBar = nil end
  945. if type(BattlegroundTargets_Options[side].ButtonShowHealthText) == "table" then BattlegroundTargets_Options[side].ButtonHealthTextToggle = BattlegroundTargets_Options[side].ButtonShowHealthText BattlegroundTargets_Options[side].ButtonShowHealthText = nil end
  946. if type(BattlegroundTargets_Options[side].ButtonRangeCheck) == "table" then BattlegroundTargets_Options[side].ButtonRangeToggle = BattlegroundTargets_Options[side].ButtonRangeCheck BattlegroundTargets_Options[side].ButtonRangeCheck = nil end
  947. --if type(BattlegroundTargets_Options[side].ButtonRangeDisplay) == "table" then BattlegroundTargets_Options[side].ButtonRangeDisplay = BattlegroundTargets_Options[side].ButtonRangeDisplay end
  948. --if type(BattlegroundTargets_Options[side].ButtonSortBy) == "table" then BattlegroundTargets_Options[side].ButtonSortBy = BattlegroundTargets_Options[side].ButtonSortBy end
  949. --if type(BattlegroundTargets_Options[side].ButtonSortDetail) == "table" then BattlegroundTargets_Options[side].ButtonSortDetail = BattlegroundTargets_Options[side].ButtonSortDetail end
  950. --if type(BattlegroundTargets_Options[side].ButtonFontNameSize) == "table" then BattlegroundTargets_Options[side].ButtonFontNameSize = BattlegroundTargets_Options[side].ButtonFontNameSize end
  951. --if type(BattlegroundTargets_Options[side].ButtonFontNameStyle) == "table" then BattlegroundTargets_Options[side].ButtonFontNameStyle = BattlegroundTargets_Options[side].ButtonFontNameStyle end
  952. --if type(BattlegroundTargets_Options[side].ButtonFontNumberSize) == "table" then BattlegroundTargets_Options[side].ButtonFontNumberSize = BattlegroundTargets_Options[side].ButtonFontNumberSize end
  953. --if type(BattlegroundTargets_Options[side].ButtonFontNumberStyle) == "table" then BattlegroundTargets_Options[side].ButtonFontNumberStyle = BattlegroundTargets_Options[side].ButtonFontNumberStyle end
  954. --if type(BattlegroundTargets_Options[side].ButtonScale) == "table" then BattlegroundTargets_Options[side].ButtonScale = BattlegroundTargets_Options[side].ButtonScale end
  955. --if type(BattlegroundTargets_Options[side].ButtonWidth) == "table" then BattlegroundTargets_Options[side].ButtonWidth = BattlegroundTargets_Options[side].ButtonWidth end
  956. --if type(BattlegroundTargets_Options[side].ButtonHeight) == "table" then BattlegroundTargets_Options[side].ButtonHeight = BattlegroundTargets_Options[side].ButtonHeight end
  957. end
  958. end
  959. BattlegroundTargets_Options.version = 27
  960. end
  961.  
  962. --BattlegroundTargets_Options = {} -- TEST
  963.  
  964. if type(BattlegroundTargets_Options.FramePosition) ~= "table" then BattlegroundTargets_Options.FramePosition = {} end
  965. if type(BattlegroundTargets_Options.MinimapButton) ~= "boolean" then BattlegroundTargets_Options.MinimapButton = false end
  966. if type(BattlegroundTargets_Options.MinimapButtonPos) ~= "number" then BattlegroundTargets_Options.MinimapButtonPos = -90 end
  967. if type(BattlegroundTargets_Options.TransliterationToggle) ~= "boolean" then BattlegroundTargets_Options.TransliterationToggle = false end
  968.  
  969. for frc = 1, #FRAMES do
  970. local side = FRAMES[frc]
  971. if type(BattlegroundTargets_Options[side]) ~= "table" then BattlegroundTargets_Options[side] = {} end
  972.  
  973. if type(BattlegroundTargets_Options[side].EnableBracket) ~= "table" then BattlegroundTargets_Options[side].EnableBracket = {} end
  974. if type(BattlegroundTargets_Options[side].EnableBracket[10]) ~= "boolean" then BattlegroundTargets_Options[side].EnableBracket[10] = false end
  975. if type(BattlegroundTargets_Options[side].EnableBracket[15]) ~= "boolean" then BattlegroundTargets_Options[side].EnableBracket[15] = false end
  976. if type(BattlegroundTargets_Options[side].EnableBracket[40]) ~= "boolean" then BattlegroundTargets_Options[side].EnableBracket[40] = false end
  977.  
  978. if type(BattlegroundTargets_Options[side].LayoutTH) ~= "table" then BattlegroundTargets_Options[side].LayoutTH = {} end
  979. if type(BattlegroundTargets_Options[side].LayoutTH[10]) ~= "number" then BattlegroundTargets_Options[side].LayoutTH[10] = 18 end
  980. if type(BattlegroundTargets_Options[side].LayoutTH[15]) ~= "number" then BattlegroundTargets_Options[side].LayoutTH[15] = 18 end
  981. if type(BattlegroundTargets_Options[side].LayoutTH[40]) ~= "number" then BattlegroundTargets_Options[side].LayoutTH[40] = 24 end
  982. if type(BattlegroundTargets_Options[side].LayoutSpace) ~= "table" then BattlegroundTargets_Options[side].LayoutSpace = {} end
  983. if type(BattlegroundTargets_Options[side].LayoutSpace[10]) ~= "number" then BattlegroundTargets_Options[side].LayoutSpace[10] = 0 end
  984. if type(BattlegroundTargets_Options[side].LayoutSpace[15]) ~= "number" then BattlegroundTargets_Options[side].LayoutSpace[15] = 0 end
  985. if type(BattlegroundTargets_Options[side].LayoutSpace[40]) ~= "number" then BattlegroundTargets_Options[side].LayoutSpace[40] = 0 end
  986.  
  987. if type(BattlegroundTargets_Options[side].SummaryToggle) ~= "table" then BattlegroundTargets_Options[side].SummaryToggle = {} end
  988. if type(BattlegroundTargets_Options[side].SummaryToggle[10]) ~= "boolean" then BattlegroundTargets_Options[side].SummaryToggle[10] = false end
  989. if type(BattlegroundTargets_Options[side].SummaryToggle[15]) ~= "boolean" then BattlegroundTargets_Options[side].SummaryToggle[15] = false end
  990. if type(BattlegroundTargets_Options[side].SummaryToggle[40]) ~= "boolean" then BattlegroundTargets_Options[side].SummaryToggle[40] = false end
  991. if type(BattlegroundTargets_Options[side].SummaryScale) ~= "table" then BattlegroundTargets_Options[side].SummaryScale = {} end
  992. if type(BattlegroundTargets_Options[side].SummaryScale[10]) ~= "number" then BattlegroundTargets_Options[side].SummaryScale[10] = 0.6 end
  993. if type(BattlegroundTargets_Options[side].SummaryScale[15]) ~= "number" then BattlegroundTargets_Options[side].SummaryScale[15] = 0.6 end
  994. if type(BattlegroundTargets_Options[side].SummaryScale[40]) ~= "number" then BattlegroundTargets_Options[side].SummaryScale[40] = 0.5 end
  995. if type(BattlegroundTargets_Options[side].SummaryPos) ~= "table" then BattlegroundTargets_Options[side].SummaryPos = {} end
  996. if type(BattlegroundTargets_Options[side].SummaryPos[10]) ~= "number" then BattlegroundTargets_Options[side].SummaryPos[10] = 1 end
  997. if type(BattlegroundTargets_Options[side].SummaryPos[15]) ~= "number" then BattlegroundTargets_Options[side].SummaryPos[15] = 1 end
  998. if type(BattlegroundTargets_Options[side].SummaryPos[40]) ~= "number" then BattlegroundTargets_Options[side].SummaryPos[40] = 1 end
  999.  
  1000. if type(BattlegroundTargets_Options[side].ButtonRoleToggle) ~= "table" then BattlegroundTargets_Options[side].ButtonRoleToggle = {} end
  1001. if type(BattlegroundTargets_Options[side].ButtonSpecToggle) ~= "table" then BattlegroundTargets_Options[side].ButtonSpecToggle = {} end
  1002. if type(BattlegroundTargets_Options[side].ButtonClassToggle) ~= "table" then BattlegroundTargets_Options[side].ButtonClassToggle = {} end
  1003. if type(BattlegroundTargets_Options[side].ButtonRealmToggle) ~= "table" then BattlegroundTargets_Options[side].ButtonRealmToggle = {} end
  1004. if type(BattlegroundTargets_Options[side].ButtonLeaderToggle) ~= "table" then BattlegroundTargets_Options[side].ButtonLeaderToggle = {} end
  1005. if type(BattlegroundTargets_Options[side].ButtonTargetToggle) ~= "table" then BattlegroundTargets_Options[side].ButtonTargetToggle = {} end
  1006. if type(BattlegroundTargets_Options[side].ButtonTargetScale) ~= "table" then BattlegroundTargets_Options[side].ButtonTargetScale = {} end
  1007. if type(BattlegroundTargets_Options[side].ButtonTargetPosition) ~= "table" then BattlegroundTargets_Options[side].ButtonTargetPosition = {} end
  1008. if type(BattlegroundTargets_Options[side].ButtonAssistToggle) ~= "table" then BattlegroundTargets_Options[side].ButtonAssistToggle = {} end
  1009. if type(BattlegroundTargets_Options[side].ButtonAssistScale) ~= "table" then BattlegroundTargets_Options[side].ButtonAssistScale = {} end
  1010. if type(BattlegroundTargets_Options[side].ButtonAssistPosition) ~= "table" then BattlegroundTargets_Options[side].ButtonAssistPosition = {} end
  1011. if type(BattlegroundTargets_Options[side].ButtonFocusToggle) ~= "table" then BattlegroundTargets_Options[side].ButtonFocusToggle = {} end
  1012. if type(BattlegroundTargets_Options[side].ButtonFocusScale) ~= "table" then BattlegroundTargets_Options[side].ButtonFocusScale = {} end
  1013. if type(BattlegroundTargets_Options[side].ButtonFocusPosition) ~= "table" then BattlegroundTargets_Options[side].ButtonFocusPosition = {} end
  1014. if type(BattlegroundTargets_Options[side].ButtonFlagToggle) ~= "table" then BattlegroundTargets_Options[side].ButtonFlagToggle = {} end
  1015. if type(BattlegroundTargets_Options[side].ButtonFlagScale) ~= "table" then BattlegroundTargets_Options[side].ButtonFlagScale = {} end
  1016. if type(BattlegroundTargets_Options[side].ButtonFlagPosition) ~= "table" then BattlegroundTargets_Options[side].ButtonFlagPosition = {} end
  1017. if type(BattlegroundTargets_Options[side].ButtonFTargetCountToggle) ~= "table" then BattlegroundTargets_Options[side].ButtonFTargetCountToggle = {} end
  1018. if type(BattlegroundTargets_Options[side].ButtonETargetCountToggle) ~= "table" then BattlegroundTargets_Options[side].ButtonETargetCountToggle = {} end
  1019. if type(BattlegroundTargets_Options[side].ButtonPvPTrinketToggle) ~= "table" then BattlegroundTargets_Options[side].ButtonPvPTrinketToggle = {} end
  1020. if type(BattlegroundTargets_Options[side].ButtonToTToggle) ~= "table" then BattlegroundTargets_Options[side].ButtonToTToggle = {} end
  1021. if type(BattlegroundTargets_Options[side].ButtonToTScale) ~= "table" then BattlegroundTargets_Options[side].ButtonToTScale = {} end
  1022. if type(BattlegroundTargets_Options[side].ButtonToTPosition) ~= "table" then BattlegroundTargets_Options[side].ButtonToTPosition = {} end
  1023. if type(BattlegroundTargets_Options[side].ButtonHealthBarToggle) ~= "table" then BattlegroundTargets_Options[side].ButtonHealthBarToggle = {} end
  1024. if type(BattlegroundTargets_Options[side].ButtonHealthTextToggle) ~= "table" then BattlegroundTargets_Options[side].ButtonHealthTextToggle = {} end
  1025. if type(BattlegroundTargets_Options[side].ButtonRangeToggle) ~= "table" then BattlegroundTargets_Options[side].ButtonRangeToggle = {} end
  1026. if type(BattlegroundTargets_Options[side].ButtonRangeDisplay) ~= "table" then BattlegroundTargets_Options[side].ButtonRangeDisplay = {} end
  1027. if type(BattlegroundTargets_Options[side].ButtonSortBy) ~= "table" then BattlegroundTargets_Options[side].ButtonSortBy = {} end
  1028. if type(BattlegroundTargets_Options[side].ButtonSortDetail) ~= "table" then BattlegroundTargets_Options[side].ButtonSortDetail = {} end
  1029. if type(BattlegroundTargets_Options[side].ButtonFontNameSize) ~= "table" then BattlegroundTargets_Options[side].ButtonFontNameSize = {} end
  1030. if type(BattlegroundTargets_Options[side].ButtonFontNameStyle) ~= "table" then BattlegroundTargets_Options[side].ButtonFontNameStyle = {} end
  1031. if type(BattlegroundTargets_Options[side].ButtonFontNumberSize) ~= "table" then BattlegroundTargets_Options[side].ButtonFontNumberSize = {} end
  1032. if type(BattlegroundTargets_Options[side].ButtonFontNumberStyle) ~= "table" then BattlegroundTargets_Options[side].ButtonFontNumberStyle = {} end
  1033. if type(BattlegroundTargets_Options[side].ButtonScale) ~= "table" then BattlegroundTargets_Options[side].ButtonScale = {} end
  1034. if type(BattlegroundTargets_Options[side].ButtonWidth) ~= "table" then BattlegroundTargets_Options[side].ButtonWidth = {} end
  1035. if type(BattlegroundTargets_Options[side].ButtonHeight) ~= "table" then BattlegroundTargets_Options[side].ButtonHeight = {} end
  1036.  
  1037. if type(BattlegroundTargets_Options[side].ButtonRoleToggle[10]) ~= "boolean" then BattlegroundTargets_Options[side].ButtonRoleToggle[10] = true end
  1038. if type(BattlegroundTargets_Options[side].ButtonSpecToggle[10]) ~= "boolean" then BattlegroundTargets_Options[side].ButtonSpecToggle[10] = false end
  1039. if type(BattlegroundTargets_Options[side].ButtonClassToggle[10]) ~= "boolean" then BattlegroundTargets_Options[side].ButtonClassToggle[10] = false end
  1040. if type(BattlegroundTargets_Options[side].ButtonRealmToggle[10]) ~= "boolean" then BattlegroundTargets_Options[side].ButtonRealmToggle[10] = true end
  1041. if type(BattlegroundTargets_Options[side].ButtonLeaderToggle[10]) ~= "boolean" then BattlegroundTargets_Options[side].ButtonLeaderToggle[10] = true end
  1042. if type(BattlegroundTargets_Options[side].ButtonTargetToggle[10]) ~= "boolean" then BattlegroundTargets_Options[side].ButtonTargetToggle[10] = true end
  1043. if type(BattlegroundTargets_Options[side].ButtonTargetScale[10]) ~= "number" then BattlegroundTargets_Options[side].ButtonTargetScale[10] = 1.5 end
  1044. if type(BattlegroundTargets_Options[side].ButtonTargetPosition[10]) ~= "number" then BattlegroundTargets_Options[side].ButtonTargetPosition[10] = 100 end
  1045. if type(BattlegroundTargets_Options[side].ButtonAssistToggle[10]) ~= "boolean" then BattlegroundTargets_Options[side].ButtonAssistToggle[10] = false end
  1046. if type(BattlegroundTargets_Options[side].ButtonAssistScale[10]) ~= "number" then BattlegroundTargets_Options[side].ButtonAssistScale[10] = 1.2 end
  1047. if type(BattlegroundTargets_Options[side].ButtonAssistPosition[10]) ~= "number" then BattlegroundTargets_Options[side].ButtonAssistPosition[10] = 100 end
  1048. if type(BattlegroundTargets_Options[side].ButtonFocusToggle[10]) ~= "boolean" then BattlegroundTargets_Options[side].ButtonFocusToggle[10] = false end
  1049. if type(BattlegroundTargets_Options[side].ButtonFocusScale[10]) ~= "number" then BattlegroundTargets_Options[side].ButtonFocusScale[10] = 1 end
  1050. if type(BattlegroundTargets_Options[side].ButtonFocusPosition[10]) ~= "number" then BattlegroundTargets_Options[side].ButtonFocusPosition[10] = 70 end
  1051. if type(BattlegroundTargets_Options[side].ButtonFlagToggle[10]) ~= "boolean" then BattlegroundTargets_Options[side].ButtonFlagToggle[10] = true end
  1052. if type(BattlegroundTargets_Options[side].ButtonFlagScale[10]) ~= "number" then BattlegroundTargets_Options[side].ButtonFlagScale[10] = 1.2 end
  1053. if type(BattlegroundTargets_Options[side].ButtonFlagPosition[10]) ~= "number" then BattlegroundTargets_Options[side].ButtonFlagPosition[10] = 60 end
  1054. if type(BattlegroundTargets_Options[side].ButtonFTargetCountToggle[10]) ~= "boolean" then BattlegroundTargets_Options[side].ButtonFTargetCountToggle[10] = false end
  1055. if type(BattlegroundTargets_Options[side].ButtonETargetCountToggle[10]) ~= "boolean" then BattlegroundTargets_Options[side].ButtonETargetCountToggle[10] = false end
  1056. if type(BattlegroundTargets_Options[side].ButtonPvPTrinketToggle[10]) ~= "boolean" then BattlegroundTargets_Options[side].ButtonPvPTrinketToggle[10] = false end
  1057. if type(BattlegroundTargets_Options[side].ButtonToTToggle[10]) ~= "boolean" then BattlegroundTargets_Options[side].ButtonToTToggle[10] = false end
  1058. if type(BattlegroundTargets_Options[side].ButtonToTScale[10]) ~= "number" then BattlegroundTargets_Options[side].ButtonToTScale[10] = 0.8 end
  1059. if type(BattlegroundTargets_Options[side].ButtonToTPosition[10]) ~= "number" then BattlegroundTargets_Options[side].ButtonToTPosition[10] = 8 end
  1060. if type(BattlegroundTargets_Options[side].ButtonHealthBarToggle[10]) ~= "boolean" then BattlegroundTargets_Options[side].ButtonHealthBarToggle[10] = false end
  1061. if type(BattlegroundTargets_Options[side].ButtonHealthTextToggle[10]) ~= "boolean" then BattlegroundTargets_Options[side].ButtonHealthTextToggle[10] = false end
  1062. if type(BattlegroundTargets_Options[side].ButtonRangeToggle[10]) ~= "boolean" then BattlegroundTargets_Options[side].ButtonRangeToggle[10] = false end
  1063. if type(BattlegroundTargets_Options[side].ButtonRangeDisplay[10]) ~= "number" then BattlegroundTargets_Options[side].ButtonRangeDisplay[10] = 1 end
  1064. if type(BattlegroundTargets_Options[side].ButtonSortBy[10]) ~= "number" then BattlegroundTargets_Options[side].ButtonSortBy[10] = 1 end
  1065. if type(BattlegroundTargets_Options[side].ButtonSortDetail[10]) ~= "number" then BattlegroundTargets_Options[side].ButtonSortDetail[10] = 3 end
  1066. if type(BattlegroundTargets_Options[side].ButtonFontNameSize[10]) ~= "number" then BattlegroundTargets_Options[side].ButtonFontNameSize[10] = 12 end
  1067. if type(BattlegroundTargets_Options[side].ButtonFontNameStyle[10]) ~= "number" then BattlegroundTargets_Options[side].ButtonFontNameStyle[10] = defaultFont end
  1068. if type(BattlegroundTargets_Options[side].ButtonFontNumberSize[10]) ~= "number" then BattlegroundTargets_Options[side].ButtonFontNumberSize[10] = 10 end
  1069. if type(BattlegroundTargets_Options[side].ButtonFontNumberStyle[10]) ~= "number" then BattlegroundTargets_Options[side].ButtonFontNumberStyle[10] = 1 end
  1070. if type(BattlegroundTargets_Options[side].ButtonScale[10]) ~= "number" then BattlegroundTargets_Options[side].ButtonScale[10] = 1 end
  1071. if type(BattlegroundTargets_Options[side].ButtonWidth[10]) ~= "number" then BattlegroundTargets_Options[side].ButtonWidth[10] = 175 end
  1072. if type(BattlegroundTargets_Options[side].ButtonHeight[10]) ~= "number" then BattlegroundTargets_Options[side].ButtonHeight[10] = 20 end
  1073.  
  1074. if type(BattlegroundTargets_Options[side].ButtonRoleToggle[15]) ~= "boolean" then BattlegroundTargets_Options[side].ButtonRoleToggle[15] = true end
  1075. if type(BattlegroundTargets_Options[side].ButtonSpecToggle[15]) ~= "boolean" then BattlegroundTargets_Options[side].ButtonSpecToggle[15] = false end
  1076. if type(BattlegroundTargets_Options[side].ButtonClassToggle[15]) ~= "boolean" then BattlegroundTargets_Options[side].ButtonClassToggle[15] = false end
  1077. if type(BattlegroundTargets_Options[side].ButtonRealmToggle[15]) ~= "boolean" then BattlegroundTargets_Options[side].ButtonRealmToggle[15] = true end
  1078. if type(BattlegroundTargets_Options[side].ButtonLeaderToggle[15]) ~= "boolean" then BattlegroundTargets_Options[side].ButtonLeaderToggle[15] = true end
  1079. if type(BattlegroundTargets_Options[side].ButtonTargetToggle[15]) ~= "boolean" then BattlegroundTargets_Options[side].ButtonTargetToggle[15] = true end
  1080. if type(BattlegroundTargets_Options[side].ButtonTargetScale[15]) ~= "number" then BattlegroundTargets_Options[side].ButtonTargetScale[15] = 1.5 end
  1081. if type(BattlegroundTargets_Options[side].ButtonTargetPosition[15]) ~= "number" then BattlegroundTargets_Options[side].ButtonTargetPosition[15] = 100 end
  1082. if type(BattlegroundTargets_Options[side].ButtonAssistToggle[15]) ~= "boolean" then BattlegroundTargets_Options[side].ButtonAssistToggle[15] = false end
  1083. if type(BattlegroundTargets_Options[side].ButtonAssistScale[15]) ~= "number" then BattlegroundTargets_Options[side].ButtonAssistScale[15] = 1.2 end
  1084. if type(BattlegroundTargets_Options[side].ButtonAssistPosition[15]) ~= "number" then BattlegroundTargets_Options[side].ButtonAssistPosition[15] = 100 end
  1085. if type(BattlegroundTargets_Options[side].ButtonFocusToggle[15]) ~= "boolean" then BattlegroundTargets_Options[side].ButtonFocusToggle[15] = false end
  1086. if type(BattlegroundTargets_Options[side].ButtonFocusScale[15]) ~= "number" then BattlegroundTargets_Options[side].ButtonFocusScale[15] = 1 end
  1087. if type(BattlegroundTargets_Options[side].ButtonFocusPosition[15]) ~= "number" then BattlegroundTargets_Options[side].ButtonFocusPosition[15] = 70 end
  1088. if type(BattlegroundTargets_Options[side].ButtonFlagToggle[15]) ~= "boolean" then BattlegroundTargets_Options[side].ButtonFlagToggle[15] = true end
  1089. if type(BattlegroundTargets_Options[side].ButtonFlagScale[15]) ~= "number" then BattlegroundTargets_Options[side].ButtonFlagScale[15] = 1.2 end
  1090. if type(BattlegroundTargets_Options[side].ButtonFlagPosition[15]) ~= "number" then BattlegroundTargets_Options[side].ButtonFlagPosition[15] = 60 end
  1091. if type(BattlegroundTargets_Options[side].ButtonFTargetCountToggle[15]) ~= "boolean" then BattlegroundTargets_Options[side].ButtonFTargetCountToggle[15] = false end
  1092. if type(BattlegroundTargets_Options[side].ButtonETargetCountToggle[15]) ~= "boolean" then BattlegroundTargets_Options[side].ButtonETargetCountToggle[15] = false end
  1093. if type(BattlegroundTargets_Options[side].ButtonPvPTrinketToggle[15]) ~= "boolean" then BattlegroundTargets_Options[side].ButtonPvPTrinketToggle[15] = false end
  1094. if type(BattlegroundTargets_Options[side].ButtonToTToggle[15]) ~= "boolean" then BattlegroundTargets_Options[side].ButtonToTToggle[15] = false end
  1095. if type(BattlegroundTargets_Options[side].ButtonToTScale[15]) ~= "number" then BattlegroundTargets_Options[side].ButtonToTScale[15] = 0.8 end
  1096. if type(BattlegroundTargets_Options[side].ButtonToTPosition[15]) ~= "number" then BattlegroundTargets_Options[side].ButtonToTPosition[15] = 8 end
  1097. if type(BattlegroundTargets_Options[side].ButtonHealthBarToggle[15]) ~= "boolean" then BattlegroundTargets_Options[side].ButtonHealthBarToggle[15] = false end
  1098. if type(BattlegroundTargets_Options[side].ButtonHealthTextToggle[15]) ~= "boolean" then BattlegroundTargets_Options[side].ButtonHealthTextToggle[15] = false end
  1099. if type(BattlegroundTargets_Options[side].ButtonRangeToggle[15]) ~= "boolean" then BattlegroundTargets_Options[side].ButtonRangeToggle[15] = false end
  1100. if type(BattlegroundTargets_Options[side].ButtonRangeDisplay[15]) ~= "number" then BattlegroundTargets_Options[side].ButtonRangeDisplay[15] = 1 end
  1101. if type(BattlegroundTargets_Options[side].ButtonSortBy[15]) ~= "number" then BattlegroundTargets_Options[side].ButtonSortBy[15] = 1 end
  1102. if type(BattlegroundTargets_Options[side].ButtonSortDetail[15]) ~= "number" then BattlegroundTargets_Options[side].ButtonSortDetail[15] = 3 end
  1103. if type(BattlegroundTargets_Options[side].ButtonFontNameSize[15]) ~= "number" then BattlegroundTargets_Options[side].ButtonFontNameSize[15] = 12 end
  1104. if type(BattlegroundTargets_Options[side].ButtonFontNameStyle[15]) ~= "number" then BattlegroundTargets_Options[side].ButtonFontNameStyle[15] = defaultFont end
  1105. if type(BattlegroundTargets_Options[side].ButtonFontNumberSize[15]) ~= "number" then BattlegroundTargets_Options[side].ButtonFontNumberSize[15] = 10 end
  1106. if type(BattlegroundTargets_Options[side].ButtonFontNumberStyle[15]) ~= "number" then BattlegroundTargets_Options[side].ButtonFontNumberStyle[15] = 1 end
  1107. if type(BattlegroundTargets_Options[side].ButtonScale[15]) ~= "number" then BattlegroundTargets_Options[side].ButtonScale[15] = 1 end
  1108. if type(BattlegroundTargets_Options[side].ButtonWidth[15]) ~= "number" then BattlegroundTargets_Options[side].ButtonWidth[15] = 175 end
  1109. if type(BattlegroundTargets_Options[side].ButtonHeight[15]) ~= "number" then BattlegroundTargets_Options[side].ButtonHeight[15] = 20 end
  1110.  
  1111. if type(BattlegroundTargets_Options[side].ButtonRoleToggle[40]) ~= "boolean" then BattlegroundTargets_Options[side].ButtonRoleToggle[40] = true end
  1112. if type(BattlegroundTargets_Options[side].ButtonSpecToggle[40]) ~= "boolean" then BattlegroundTargets_Options[side].ButtonSpecToggle[40] = false end
  1113. if type(BattlegroundTargets_Options[side].ButtonClassToggle[40]) ~= "boolean" then BattlegroundTargets_Options[side].ButtonClassToggle[40] = false end
  1114. if type(BattlegroundTargets_Options[side].ButtonRealmToggle[40]) ~= "boolean" then BattlegroundTargets_Options[side].ButtonRealmToggle[40] = false end
  1115. if type(BattlegroundTargets_Options[side].ButtonLeaderToggle[40]) ~= "boolean" then BattlegroundTargets_Options[side].ButtonLeaderToggle[40] = true end
  1116. if type(BattlegroundTargets_Options[side].ButtonTargetToggle[40]) ~= "boolean" then BattlegroundTargets_Options[side].ButtonTargetToggle[40] = true end
  1117. if type(BattlegroundTargets_Options[side].ButtonTargetScale[40]) ~= "number" then BattlegroundTargets_Options[side].ButtonTargetScale[40] = 1 end
  1118. if type(BattlegroundTargets_Options[side].ButtonTargetPosition[40]) ~= "number" then BattlegroundTargets_Options[side].ButtonTargetPosition[40] = 85 end
  1119. if type(BattlegroundTargets_Options[side].ButtonAssistToggle[40]) ~= "boolean" then BattlegroundTargets_Options[side].ButtonAssistToggle[40] = false end
  1120. if type(BattlegroundTargets_Options[side].ButtonAssistScale[40]) ~= "number" then BattlegroundTargets_Options[side].ButtonAssistScale[40] = 1 end
  1121. if type(BattlegroundTargets_Options[side].ButtonAssistPosition[40]) ~= "number" then BattlegroundTargets_Options[side].ButtonAssistPosition[40] = 70 end
  1122. if type(BattlegroundTargets_Options[side].ButtonFocusToggle[40]) ~= "boolean" then BattlegroundTargets_Options[side].ButtonFocusToggle[40] = false end
  1123. if type(BattlegroundTargets_Options[side].ButtonFocusScale[40]) ~= "number" then BattlegroundTargets_Options[side].ButtonFocusScale[40] = 1 end
  1124. if type(BattlegroundTargets_Options[side].ButtonFocusPosition[40]) ~= "number" then BattlegroundTargets_Options[side].ButtonFocusPosition[40] = 55 end
  1125. if type(BattlegroundTargets_Options[side].ButtonFlagToggle[40]) ~= "boolean" then BattlegroundTargets_Options[side].ButtonFlagToggle[40] = false end
  1126. if type(BattlegroundTargets_Options[side].ButtonFlagScale[40]) ~= "number" then BattlegroundTargets_Options[side].ButtonFlagScale[40] = 1 end
  1127. if type(BattlegroundTargets_Options[side].ButtonFlagPosition[40]) ~= "number" then BattlegroundTargets_Options[side].ButtonFlagPosition[40] = 100 end
  1128. if type(BattlegroundTargets_Options[side].ButtonFTargetCountToggle[40]) ~= "boolean" then BattlegroundTargets_Options[side].ButtonFTargetCountToggle[40] = false end
  1129. if type(BattlegroundTargets_Options[side].ButtonETargetCountToggle[40]) ~= "boolean" then BattlegroundTargets_Options[side].ButtonETargetCountToggle[40] = false end
  1130. if type(BattlegroundTargets_Options[side].ButtonPvPTrinketToggle[40]) ~= "boolean" then BattlegroundTargets_Options[side].ButtonPvPTrinketToggle[40] = false end
  1131. if type(BattlegroundTargets_Options[side].ButtonToTToggle[40]) ~= "boolean" then BattlegroundTargets_Options[side].ButtonToTToggle[40] = false end
  1132. if type(BattlegroundTargets_Options[side].ButtonToTScale[40]) ~= "number" then BattlegroundTargets_Options[side].ButtonToTScale[40] = 0.6 end
  1133. if type(BattlegroundTargets_Options[side].ButtonToTPosition[40]) ~= "number" then BattlegroundTargets_Options[side].ButtonToTPosition[40] = 9 end
  1134. if type(BattlegroundTargets_Options[side].ButtonHealthBarToggle[40]) ~= "boolean" then BattlegroundTargets_Options[side].ButtonHealthBarToggle[40] = false end
  1135. if type(BattlegroundTargets_Options[side].ButtonHealthTextToggle[40]) ~= "boolean" then BattlegroundTargets_Options[side].ButtonHealthTextToggle[40] = false end
  1136. if type(BattlegroundTargets_Options[side].ButtonRangeToggle[40]) ~= "boolean" then BattlegroundTargets_Options[side].ButtonRangeToggle[40] = false end
  1137. if type(BattlegroundTargets_Options[side].ButtonRangeDisplay[40]) ~= "number" then BattlegroundTargets_Options[side].ButtonRangeDisplay[40] = 7 end
  1138. if type(BattlegroundTargets_Options[side].ButtonSortBy[40]) ~= "number" then BattlegroundTargets_Options[side].ButtonSortBy[40] = 1 end
  1139. if type(BattlegroundTargets_Options[side].ButtonSortDetail[40]) ~= "number" then BattlegroundTargets_Options[side].ButtonSortDetail[40] = 3 end
  1140. if type(BattlegroundTargets_Options[side].ButtonFontNameSize[40]) ~= "number" then BattlegroundTargets_Options[side].ButtonFontNameSize[40] = 10 end
  1141. if type(BattlegroundTargets_Options[side].ButtonFontNameStyle[40]) ~= "number" then BattlegroundTargets_Options[side].ButtonFontNameStyle[40] = defaultFont end
  1142. if type(BattlegroundTargets_Options[side].ButtonFontNumberSize[40]) ~= "number" then BattlegroundTargets_Options[side].ButtonFontNumberSize[40] = 10 end
  1143. if type(BattlegroundTargets_Options[side].ButtonFontNumberStyle[40]) ~= "number" then BattlegroundTargets_Options[side].ButtonFontNumberStyle[40] = 1 end
  1144. if type(BattlegroundTargets_Options[side].ButtonScale[40]) ~= "number" then BattlegroundTargets_Options[side].ButtonScale[40] = 1 end
  1145. if type(BattlegroundTargets_Options[side].ButtonWidth[40]) ~= "number" then BattlegroundTargets_Options[side].ButtonWidth[40] = 100 end
  1146. if type(BattlegroundTargets_Options[side].ButtonHeight[40]) ~= "number" then BattlegroundTargets_Options[side].ButtonHeight[40] = 16 end
  1147. end
  1148. end
  1149. -- ---------------------------------------------------------------------------------------------------------------------
  1150.  
  1151.  
  1152.  
  1153. -- ---------------------------------------------------------------------------------------------------------------------
  1154. function BattlegroundTargets:LDBcheck()
  1155. if LibStub and LibStub:GetLibrary("CallbackHandler-1.0", true) and LibStub:GetLibrary("LibDataBroker-1.1", true) then
  1156. LibStub:GetLibrary("LibDataBroker-1.1"):NewDataObject("BattlegroundTargets", {
  1157. type = "launcher",
  1158. icon = Textures.AddonIcon,
  1159. OnClick = function(self, button)
  1160. BattlegroundTargets:Frame_Toggle(GVAR.OptionsFrame)
  1161. end,
  1162. })
  1163. end
  1164. end
  1165. -- ---------------------------------------------------------------------------------------------------------------------
  1166.  
  1167.  
  1168.  
  1169. -- ---------------------------------------------------------------------------------------------------------------------
  1170. function BattlegroundTargets:CreateInterfaceOptions()
  1171. GVAR.InterfaceOptions = CreateFrame("Frame", nil)
  1172. GVAR.InterfaceOptions.name = "BattlegroundTargets"
  1173.  
  1174. GVAR.InterfaceOptions.Title = GVAR.InterfaceOptions:CreateFontString(nil, "ARTWORK", "GameFontNormalLarge")
  1175. GVAR.InterfaceOptions.Title:SetText("BattlegroundTargets")
  1176. GVAR.InterfaceOptions.Title:SetJustifyH("LEFT")
  1177. GVAR.InterfaceOptions.Title:SetJustifyV("TOP")
  1178. GVAR.InterfaceOptions.Title:SetPoint("TOPLEFT", 16, -16)
  1179.  
  1180. GVAR.InterfaceOptions.CONFIG = CreateFrame("Button", nil, GVAR.InterfaceOptions)
  1181. TEMPLATE.TextButton(GVAR.InterfaceOptions.CONFIG, L["Open Configuration"], 1)
  1182. GVAR.InterfaceOptions.CONFIG:SetWidth(180)
  1183. GVAR.InterfaceOptions.CONFIG:SetHeight(22)
  1184. GVAR.InterfaceOptions.CONFIG:SetPoint("TOPLEFT", GVAR.InterfaceOptions.Title, "BOTTOMLEFT", 0, -10)
  1185. GVAR.InterfaceOptions.CONFIG:SetScript("OnClick", function()
  1186. InterfaceOptionsFrame_Show()
  1187. HideUIPanel(GameMenuFrame)
  1188. BattlegroundTargets:Frame_Toggle(GVAR.OptionsFrame)
  1189. end)
  1190.  
  1191. GVAR.InterfaceOptions.SlashCommandText = GVAR.InterfaceOptions:CreateFontString(nil, "ARTWORK", "GameFontNormalSmall")
  1192. GVAR.InterfaceOptions.SlashCommandText:SetText("/bgt - /bgtargets - /battlegroundtargets")
  1193. GVAR.InterfaceOptions.SlashCommandText:SetNonSpaceWrap(true)
  1194. GVAR.InterfaceOptions.SlashCommandText:SetPoint("LEFT", GVAR.InterfaceOptions.CONFIG, "RIGHT", 10, 0)
  1195. GVAR.InterfaceOptions.SlashCommandText:SetTextColor(1, 1, 0.49, 1)
  1196.  
  1197. InterfaceOptions_AddCategory(GVAR.InterfaceOptions)
  1198. end
  1199. -- ---------------------------------------------------------------------------------------------------------------------
  1200.  
  1201.  
  1202.  
  1203. -- ---------------------------------------------------------------------------------------------------------------------
  1204. function BattlegroundTargets:CreateFrames()
  1205. for frc = 1, #FRAMES do
  1206. local side = FRAMES[frc]
  1207. local framename = side.."MainFrame" -- FriendMainFrame / EnemyMainFrame
  1208. local buttonname = side.."Button" -- FriendButton / EnemyButton
  1209.  
  1210. -- main frame
  1211. GVAR[framename] = CreateFrame("Frame", "BattlegroundTargets_"..framename, UIParent)
  1212. GVAR[framename]:EnableMouse(true)
  1213. GVAR[framename]:SetMovable(true)
  1214. GVAR[framename]:SetResizable(true)
  1215. GVAR[framename]:SetToplevel(true)
  1216. GVAR[framename]:SetClampedToScreen(true) -- TODO bug? -- CLAMP_FIX_MAIN TODO
  1217. GVAR[framename]:SetWidth(0.001)
  1218. GVAR[framename]:SetHeight(0.001)
  1219. GVAR[framename]:Hide()
  1220. -- main frame
  1221.  
  1222. -- create global_OnUpdate
  1223. GVAR[side.."ScreenShot_Timer_Button"] = CreateFrame("Button", nil, GVAR[framename])
  1224. GVAR[side.."Target_Timer_Button"] = CreateFrame("Button", nil, GVAR[framename])
  1225. GVAR[side.."PVPTrinket_Timer_Button"] = CreateFrame("Button", nil, GVAR[framename])
  1226. GVAR[side.."RangeCheck_Timer_Button"] = CreateFrame("Button", nil, GVAR[framename])
  1227. -- create global_OnUpdate
  1228.  
  1229. -- create button
  1230. GVAR[buttonname] = {}
  1231. for i = 1, 40 do
  1232. GVAR[buttonname][i] = CreateFrame("Button", nil, UIParent, "SecureActionButtonTemplate") -- button_name
  1233. local button = GVAR[buttonname][i]
  1234. button:SetPoint("TOPLEFT", GVAR[framename], "BOTTOMLEFT", 0, 0)
  1235. button:Hide()
  1236. button:RegisterForClicks("AnyUp")
  1237. button:SetAttribute("type1", "macro")
  1238. button:SetAttribute("type2", "macro")
  1239. button:SetAttribute("macrotext1", "")
  1240. button:SetAttribute("macrotext2", "")
  1241. button:SetScript("OnEnter", function(self)
  1242. self.HighlightT:SetColorTexture(1, 1, 0.49, 1)
  1243. self.HighlightR:SetColorTexture(1, 1, 0.49, 1)
  1244. self.HighlightB:SetColorTexture(1, 1, 0.49, 1)
  1245. self.HighlightL:SetColorTexture(1, 1, 0.49, 1)
  1246. end)
  1247. button:SetScript("OnLeave", function(self)
  1248. if isTargetButton == self then
  1249. self.HighlightT:SetColorTexture(0.5, 0.5, 0.5, 1)
  1250. self.HighlightR:SetColorTexture(0.5, 0.5, 0.5, 1)
  1251. self.HighlightB:SetColorTexture(0.5, 0.5, 0.5, 1)
  1252. self.HighlightL:SetColorTexture(0.5, 0.5, 0.5, 1)
  1253. else
  1254. self.HighlightT:SetColorTexture(0, 0, 0, 1)
  1255. self.HighlightR:SetColorTexture(0, 0, 0, 1)
  1256. self.HighlightB:SetColorTexture(0, 0, 0, 1)
  1257. self.HighlightL:SetColorTexture(0, 0, 0, 1)
  1258. end
  1259. end)
  1260.  
  1261. button.ToTButton = CreateFrame("Button", nil, button) -- target_of_target -- xBUT -- button_name
  1262. button.ToTButton:EnableMouse(false)
  1263. button.ToTButton:SetAlpha(0)
  1264. end
  1265. -- create button
  1266.  
  1267. -- MonoblockAnchor
  1268. GVAR[framename].MonoblockAnchor = CreateFrame("Frame", nil, GVAR[buttonname][1]) -- SUMPOSi
  1269. GVAR[framename].MonoblockAnchor:SetPoint("TOPLEFT", GVAR[buttonname][1], "TOPLEFT", 0, 0)
  1270. -- MonoblockAnchor
  1271. end
  1272.  
  1273. -- main mover
  1274. local function OnMouseDown(side, framename)
  1275. if inCombat or InCombatLockdown() then return end
  1276. GVAR[framename].isMoving = true
  1277. BattlegroundTargets:ClickOnFractionTab(side)
  1278. GVAR[framename]:StartMoving()
  1279. end
  1280. local function OnMouseUp(side, framename)
  1281. if not GVAR[framename].isMoving then return end
  1282. GVAR[framename].isMoving = nil
  1283. GVAR[framename]:StopMovingOrSizing()
  1284. if inCombat or InCombatLockdown() then
  1285. rePosMain = true
  1286. return
  1287. end
  1288. rePosMain = nil
  1289. BattlegroundTargets:Frame_SavePosition("BattlegroundTargets_"..framename, side)
  1290. end
  1291.  
  1292. for frc = 1, #FRAMES do
  1293. local side = FRAMES[frc]
  1294. local framename = side.."MainFrame" -- FriendMainFrame / EnemyMainFrame
  1295. local buttonname = side.."Button" -- FriendButton / EnemyButton
  1296.  
  1297. --------------------
  1298. GVAR[framename].MainMoverFrame = CreateFrame("Frame", nil, GVAR[buttonname][1])
  1299. GVAR[framename].MainMoverFrame:SetPoint("TOPLEFT", GVAR[buttonname][1], "TOPLEFT", 0, 0)
  1300. GVAR[framename].MainMoverFrame:Hide()
  1301.  
  1302. GVAR[framename].MainMoverTexture = GVAR[framename].MainMoverFrame:CreateTexture(nil, "BORDER")
  1303. GVAR[framename].MainMoverTexture:SetColorTexture(0, 0, 0, 0)
  1304. GVAR[framename].MainMoverTexture:SetAllPoints()
  1305.  
  1306. -- mover mode frame
  1307. GVAR[framename].MainMoverBGTexture = GVAR[framename].MainMoverFrame:CreateTexture(nil, "ARTWORK")
  1308. GVAR[framename].MainMoverBGTexture:SetColorTexture(0, 0, 0, 1)
  1309. GVAR[framename].MainMoverBGTexture:SetPoint("CENTER", GVAR[framename].MainMoverFrame, "CENTER", 0, 0)
  1310.  
  1311. GVAR[framename].MainMoverFracTxt = GVAR[framename].MainMoverFrame:CreateFontString(nil, "ARTWORK", "GameFontNormalSmall")
  1312. GVAR[framename].MainMoverFracTxt:SetPoint("TOP", GVAR[framename].MainMoverBGTexture, "TOP", 0, 0)
  1313. if side == "Friend" then
  1314. GVAR[framename].MainMoverFracTxt:SetText(Textures.FriendIconStr.." "..L["Friendly Players"])
  1315. elseif side == "Enemy" then
  1316. GVAR[framename].MainMoverFracTxt:SetText(Textures.EnemyIconStr.." "..L["Enemy Players"])
  1317. end
  1318. GVAR[framename].MainMoverFracTxt:SetTextColor(1, 1, 1, 1)
  1319.  
  1320. GVAR[framename].MainMoverTxt = GVAR[framename].MainMoverFrame:CreateFontString(nil, "OVERLAY", "GameFontNormalSmall")
  1321. GVAR[framename].MainMoverTxt:SetPoint("TOP", GVAR[framename].MainMoverFracTxt, "BOTTOM", 0, -10)
  1322. GVAR[framename].MainMoverTxt:SetText(L["click & move"])
  1323. GVAR[framename].MainMoverTxt:SetWidth( GVAR[framename].MainMoverTxt:GetStringWidth() )
  1324. GVAR[framename].MainMoverTxt:SetHeight( GVAR[framename].MainMoverTxt:GetStringHeight() )
  1325. GVAR[framename].MainMoverTxt:SetTextColor(0.5, 0.5, 0.5, 1)
  1326.  
  1327. GVAR[framename].MainMoverModeButton = CreateFrame("CheckButton", nil, GVAR[framename].MainMoverFrame)
  1328. TEMPLATE.CheckButton(GVAR[framename].MainMoverModeButton, 16, 4, Textures.MoverModeStr.." "..L["Mode"])
  1329. GVAR[framename].MainMoverModeButton:SetPoint("TOP", GVAR[framename].MainMoverTxt, "BOTTOM", 0, -10)
  1330. GVAR[framename].MainMoverModeButton:SetChecked(DATA[side].MainMoverModeValue)
  1331. GVAR[framename].MainMoverModeButton:SetScript("OnClick", function()
  1332. --if inCombat or InCombatLockdown() then return end
  1333. GVAR[framename].MainMoverTexture:SetColorTexture(0, 0, 1, 0.4)
  1334. BattlegroundTargets:ClickOnFractionTab(side)
  1335. if DATA[side].MainMoverModeValue then
  1336. DATA[side].MainMoverModeValue = false
  1337. else
  1338. DATA[side].MainMoverModeValue = true
  1339. end
  1340. end)
  1341.  
  1342. local maxW = GVAR[framename].MainMoverFracTxt:GetWidth()
  1343. local maxW2 = GVAR[framename].MainMoverTxt:GetWidth()
  1344. if maxW2 > maxW then maxW = maxW2 end
  1345. local maxW3 = GVAR[framename].MainMoverModeButton:GetWidth()
  1346. if maxW3 > maxW then maxW = maxW3 end
  1347. local maxH = GVAR[framename].MainMoverFracTxt:GetHeight() + 10 + GVAR[framename].MainMoverTxt:GetHeight() + 10 + GVAR[framename].MainMoverModeButton:GetHeight()
  1348. GVAR[framename].MainMoverBGTexture:SetWidth(maxW+5)
  1349. GVAR[framename].MainMoverBGTexture:SetHeight(maxH+5)
  1350. -- mover mode frame
  1351.  
  1352. GVAR[framename].MainMoverFrame:SetScript("OnLeave", function()
  1353. if GVAR[framename].MainMoverModeButton:IsMouseOver() then return end
  1354. GVAR[framename].MainMoverTxt:SetTextColor(0.5, 0.5, 0.5, 1)
  1355. if DATA[side].MainMoverModeValue then return end
  1356. GVAR[framename].MainMoverTexture:SetColorTexture(0, 0, 0, 0)
  1357. GVAR[framename].MainMoverFrame:Hide()
  1358. GVAR[framename].MainMoverButton[1]:Show()
  1359. GVAR[framename].MainMoverButton[2]:Show()
  1360. end)
  1361. GVAR[framename].MainMoverFrame:SetScript("OnEnter", function()
  1362. GVAR[framename].MainMoverTexture:SetColorTexture(0, 0, 1, 0.4)
  1363. GVAR[framename].MainMoverTxt:SetTextColor(1, 1, 1, 1)
  1364. GVAR[framename].MainMoverButton[1]:Hide()
  1365. GVAR[framename].MainMoverButton[2]:Hide()
  1366. end)
  1367. GVAR[framename].MainMoverFrame:SetScript("OnMouseDown", function() OnMouseDown(side, framename) end)
  1368. GVAR[framename].MainMoverFrame:SetScript("OnMouseUp", function() OnMouseUp(side, framename) end)
  1369. --------------------
  1370.  
  1371. --------------------
  1372. GVAR[framename].MainMoverButton = CreateFrame("Frame", nil, GVAR[framename])
  1373. GVAR[framename].MainMoverButton:SetPoint("CENTER", GVAR[framename].MonoblockAnchor, "CENTER", 0, 0)
  1374. for topORbottom = 1, 2 do
  1375. GVAR[framename].MainMoverButton[topORbottom] = CreateFrame("Button", nil, GVAR[framename].MainMoverButton)
  1376. GVAR[framename].MainMoverButton[topORbottom]:SetWidth(200)
  1377. GVAR[framename].MainMoverButton[topORbottom]:SetHeight(25)
  1378. if topORbottom == 1 then
  1379. GVAR[framename].MainMoverButton[topORbottom]:SetPoint("BOTTOM", GVAR[framename].MonoblockAnchor, "TOP", 0, 0) -- TOP
  1380. else
  1381. GVAR[framename].MainMoverButton[topORbottom]:SetPoint("TOP", GVAR[framename].MonoblockAnchor, "BOTTOM", 0, 0) -- BOTTOM
  1382. end
  1383. GVAR[framename].MainMoverButton[topORbottom].Texture = GVAR[framename].MainMoverButton[topORbottom]:CreateTexture(nil, "BACKGROUND")
  1384. GVAR[framename].MainMoverButton[topORbottom].Texture:SetAllPoints()
  1385. GVAR[framename].MainMoverButton[topORbottom].Texture:SetColorTexture(1, 1, 1, 0.2)
  1386. GVAR[framename].MainMoverButton[topORbottom].Txt = GVAR[framename].MainMoverButton[topORbottom]:CreateFontString(nil, "ARTWORK", "GameFontNormalSmall")
  1387. GVAR[framename].MainMoverButton[topORbottom].Txt:SetAllPoints()
  1388. if side == "Friend" then
  1389. GVAR[framename].MainMoverButton[topORbottom].Txt:SetText(Textures.FriendIconStr.." "..L["Friendly Players"])
  1390. elseif side == "Enemy" then
  1391. GVAR[framename].MainMoverButton[topORbottom].Txt:SetText(Textures.EnemyIconStr.." "..L["Enemy Players"])
  1392. end
  1393. GVAR[framename].MainMoverButton[topORbottom].Txt:SetTextColor(1, 1, 1, 1)
  1394.  
  1395. GVAR[framename].MainMoverButton[topORbottom]:SetScript("OnEnter", function(self)
  1396. if inCombat or InCombatLockdown() then return end
  1397. GVAR[framename].MainMoverTxt:SetTextColor(1, 1, 1, 1)
  1398. GVAR[framename].MainMoverFrame:SetFrameLevel( GVAR[side.."Button"][1]:GetFrameLevel() + 10 )
  1399. GVAR[framename].MainMoverFrame:Show()
  1400. end)
  1401. GVAR[framename].MainMoverButton[topORbottom]:SetScript("OnLeave", function(self)
  1402. if not GVAR[framename].MainMoverFrame:IsMouseOver() then
  1403. GVAR[framename].MainMoverFrame:Hide()
  1404. end
  1405. end)
  1406. GVAR[framename].MainMoverButton[topORbottom]:SetScript("OnMouseDown", function() OnMouseDown(side, framename) end)
  1407. GVAR[framename].MainMoverButton[topORbottom]:SetScript("OnMouseUp", function() OnMouseUp(side, framename) end)
  1408. end
  1409. --------------------
  1410. end
  1411. -- main mover
  1412.  
  1413. -- button
  1414. BattlegroundTargets.targetCountTimer = 0 -- _TIMER_
  1415. BattlegroundTargets.pvptrinketTimer = 0 -- _TIMER_ -- pvp_trinket_
  1416. for frc = 1, #FRAMES do
  1417. local side = FRAMES[frc]
  1418. local buttonname = GVAR[side.."Button"]
  1419. for buttontype = 1, 2 do
  1420. for i = 1, 40 do
  1421. local button
  1422.  
  1423. if buttontype == 1 then
  1424. button = buttonname[i]
  1425. button.carrierDebuffTimer = 0 -- _TIMER_ -- carrier_debuff_
  1426. button.healthTimer = 0 -- _TIMER_ -- health_
  1427. button.rangeTimer = 0 -- _TIMER_ -- class_range_
  1428. button.leaderTimer = 0 -- _TIMER_ -- leader_
  1429. button.assistTimer = 0 -- _TIMER_ -- assist_
  1430. else--if buttontype == 2 then
  1431. button = buttonname[i].ToTButton
  1432. end
  1433.  
  1434. button.colR = 0
  1435. button.colG = 0
  1436. button.colB = 0
  1437. button.colR5 = 0
  1438. button.colG5 = 0
  1439. button.colB5 = 0
  1440.  
  1441. button.HighlightT = button:CreateTexture(nil, "BACKGROUND")
  1442. button.HighlightT:SetHeight(1)
  1443. button.HighlightT:SetPoint("TOP", 0, 0)
  1444. button.HighlightT:SetColorTexture(0, 0, 0, 1)
  1445. button.HighlightR = button:CreateTexture(nil, "BACKGROUND")
  1446. button.HighlightR:SetWidth(1)
  1447. button.HighlightR:SetPoint("RIGHT", 0, 0)
  1448. button.HighlightR:SetColorTexture(0, 0, 0, 1)
  1449. button.HighlightB = button:CreateTexture(nil, "BACKGROUND")
  1450. button.HighlightB:SetHeight(1)
  1451. button.HighlightB:SetPoint("BOTTOM", 0, 0)
  1452. button.HighlightB:SetColorTexture(0, 0, 0, 1)
  1453. button.HighlightL = button:CreateTexture(nil, "BACKGROUND")
  1454. button.HighlightL:SetWidth(1)
  1455. button.HighlightL:SetPoint("LEFT", 0, 0)
  1456. button.HighlightL:SetColorTexture(0, 0, 0, 1)
  1457.  
  1458. button.BackgroundX = button:CreateTexture(nil, "BACKGROUND")
  1459. button.BackgroundX:SetPoint("TOPLEFT", 1, -1)
  1460. button.BackgroundX:SetColorTexture(0, 0, 0, 1)
  1461.  
  1462. button.RangeTexture = button:CreateTexture(nil, "BORDER")
  1463. button.RangeTexture:SetPoint("LEFT", button, "LEFT", 1, 0)
  1464. button.RangeTexture:SetColorTexture(0, 0, 0, 0)
  1465.  
  1466. button.RangeTxt = button:CreateFontString(nil, "OVERLAY", "GameFontNormal")
  1467. button.RangeTxt:SetWidth(50)
  1468. button.RangeTxt:SetPoint("RIGHT", button.RangeTexture, "RIGHT", 0, 0)
  1469. button.RangeTxt:SetJustifyH("RIGHT")
  1470. button.RangeTxt:SetShadowOffset(0, 0)
  1471. button.RangeTxt:SetShadowColor(0, 0, 0, 0)
  1472. button.RangeTxt:SetTextColor(1, 1, 1, 1)
  1473. --button.RangeTxt:SetAlpha(0.6)
  1474.  
  1475. button.PVPTrinketTexture = button:CreateTexture(nil, "BORDER")
  1476. button.PVPTrinketTexture:SetPoint("RIGHT", button, "LEFT", -2, 0)
  1477. button.PVPTrinketTexture:SetTexture( 1322720) --old ("Interface\\Icons\\INV_Jewelry_TrinketPVP_01")
  1478. --button.PVPTrinketTexture:SetTexCoord(0.07812501, 0.92187499, 0.07812501, 0.92187499)--(5/64, 59/64, 5/64, 59/64)
  1479. button.PVPTrinketTxt = button:CreateFontString(nil, "OVERLAY", "GameFontNormal")
  1480. button.PVPTrinketTxt:SetWidth(50)
  1481. button.PVPTrinketTxt:SetPoint("CENTER", button.PVPTrinketTexture, "CENTER", 0, 0)
  1482. button.PVPTrinketTxt:SetJustifyH("CENTER")
  1483. button.PVPTrinketTxt:SetShadowOffset(0, 0)
  1484. button.PVPTrinketTxt:SetShadowColor(0, 0, 0, 0)
  1485. button.PVPTrinketTxt:SetTextColor(1, 1, 1, 1)
  1486.  
  1487. button.FactionTexture = button:CreateTexture(nil, "BORDER")
  1488. button.FactionTexture:SetPoint("LEFT", button.BackgroundX, "LEFT", 1, 0)
  1489.  
  1490. button.RoleTexture = button:CreateTexture(nil, "BORDER")
  1491. button.RoleTexture:SetPoint("LEFT", button.RangeTexture, "RIGHT", 0, 0)
  1492. button.RoleTexture:SetTexture(Textures.Path)
  1493. button.RoleTexture:SetTexCoord(0, 0, 0, 0)
  1494.  
  1495. button.SpecTexture = button:CreateTexture(nil, "BORDER")
  1496. button.SpecTexture:SetPoint("LEFT", button.RoleTexture, "RIGHT", 0, 0)
  1497. button.SpecTexture:SetTexture(nil)
  1498. button.SpecTexture:SetTexCoord(0.07812501, 0.92187499, 0.07812501, 0.92187499)--(5/64, 59/64, 5/64, 59/64)
  1499.  
  1500. button.ClassTexture = button:CreateTexture(nil, "BORDER")
  1501. button.ClassTexture:SetPoint("LEFT", button.SpecTexture, "RIGHT", 0, 0)
  1502. button.ClassTexture:SetTexture("Interface\\WorldStateFrame\\Icons-Classes")
  1503. button.ClassTexture:SetTexCoord(0, 0, 0, 0)
  1504.  
  1505. button.LeaderTexture = button:CreateTexture(nil, "ARTWORK")
  1506. button.LeaderTexture:SetTexture("Interface\\GroupFrame\\UI-Group-LeaderIcon")
  1507. button.LeaderTexture:SetAlpha(0)
  1508.  
  1509. button.ClassColorBackground = button:CreateTexture(nil, "BORDER")
  1510. button.ClassColorBackground:SetColorTexture(0, 0, 0, 0)
  1511.  
  1512. button.HealthBar = button:CreateTexture(nil, "ARTWORK")
  1513. button.HealthBar:SetPoint("LEFT", button.ClassColorBackground, "LEFT", 0, 0)
  1514. button.HealthBar:SetColorTexture(0, 0, 0, 0)
  1515.  
  1516. button.HealthTextButton = CreateFrame("Button", nil, button) -- xBUT
  1517. button.HealthText = button.HealthTextButton:CreateFontString(nil, "OVERLAY", "GameFontNormal")
  1518. button.HealthText:SetWidth(100)
  1519. button.HealthText:SetPoint("RIGHT", button.ClassColorBackground, "RIGHT", 0, 0)
  1520. button.HealthText:SetJustifyH("RIGHT")
  1521. button.HealthText:SetShadowOffset(0, 0)
  1522. button.HealthText:SetShadowColor(0, 0, 0, 0)
  1523. button.HealthText:SetTextColor(1, 1, 1, 1)
  1524. --button.HealthText:SetAlpha(0.6)
  1525.  
  1526. button.Name = button:CreateFontString(nil, "OVERLAY", "GameFontNormal")
  1527. button.Name:SetPoint("LEFT", button.ClassColorBackground, "LEFT", 2, 0)
  1528. button.Name:SetJustifyH("LEFT")
  1529. button.Name:SetShadowOffset(0, 0)
  1530. button.Name:SetShadowColor(0, 0, 0, 1)
  1531. button.Name:SetTextColor(0, 0, 0, 1)
  1532.  
  1533. -- target count
  1534. button.TargetCountBackground = button:CreateTexture(nil, "ARTWORK")
  1535. button.TargetCountBackground:SetPoint("RIGHT", button, "RIGHT", -1, 0)
  1536. button.TargetCountBackground:SetColorTexture(0, 0, 0, 1)
  1537.  
  1538. button.ETargetCount = button:CreateFontString(nil, "OVERLAY", "GameFontNormal")
  1539. button.ETargetCount:SetPoint("RIGHT", button.TargetCountBackground, "RIGHT", 0, 0)
  1540. button.ETargetCount:SetJustifyH("CENTER")
  1541. button.ETargetCount:SetShadowOffset(0, 0)
  1542. button.ETargetCount:SetShadowColor(0, 0, 0, 1)
  1543. button.ETargetCount:SetTextColor(1, 1, 1, 1)
  1544.  
  1545. button.FTargetCount = button:CreateFontString(nil, "OVERLAY", "GameFontNormal")
  1546. button.FTargetCount:SetPoint("LEFT", button.TargetCountBackground, "LEFT", 0, 0)
  1547. button.FTargetCount:SetJustifyH("CENTER")
  1548. button.FTargetCount:SetShadowOffset(0, 0)
  1549. button.FTargetCount:SetShadowColor(0, 0, 0, 0)
  1550. button.FTargetCount:SetTextColor(0, 1, 0, 1)
  1551. -- target count
  1552.  
  1553. button.TargetTextureButton = CreateFrame("Button", nil, button) -- xBUT
  1554. button.TargetTexture = button.TargetTextureButton:CreateTexture(nil, "OVERLAY")
  1555. button.TargetTexture:SetTexture("Interface\\Minimap\\Tracking\\Target")
  1556. button.TargetTexture:SetAlpha(0)
  1557.  
  1558. button.FocusTextureButton = CreateFrame("Button", nil, button) -- xBUT
  1559. button.FocusTexture = button.FocusTextureButton:CreateTexture(nil, "OVERLAY")
  1560. button.FocusTexture:SetTexture("Interface\\Minimap\\Tracking\\Focus")
  1561. button.FocusTexture:SetAlpha(0)
  1562.  
  1563. -- carrier
  1564. button.FlagTextureButton = CreateFrame("Button", nil, button) -- xBUT
  1565. button.FlagTexture = button.FlagTextureButton:CreateTexture(nil, "OVERLAY")
  1566. button.FlagTexture:SetTexture(Textures.flagTexture)
  1567. button.FlagTexture:SetAlpha(0)
  1568.  
  1569. button.FlagDebuffButton = CreateFrame("Button", nil, button) -- xBUT
  1570. button.FlagDebuff = button.FlagDebuffButton:CreateFontString(nil, "OVERLAY", "GameFontNormal")
  1571. button.FlagDebuff:SetWidth(50)
  1572. button.FlagDebuff:SetPoint("CENTER", button.FlagTexture, "CENTER", 0, 0)
  1573. --button.FlagDebuff:SetPoint("TOP", button, "TOP", 0, 0)
  1574. button.FlagDebuff:SetJustifyH("CENTER")
  1575. button.FlagDebuff:SetJustifyV("TOP")
  1576. button.FlagDebuff:SetShadowOffset(0, 0)
  1577. button.FlagDebuff:SetShadowColor(0, 0, 0, 0)
  1578. button.FlagDebuff:SetTextColor(1, 1, 1, 1)
  1579.  
  1580. button.OrbCornerTL = button.FlagDebuffButton:CreateTexture(nil, "OVERLAY")
  1581. button.OrbCornerTL:SetPoint("LEFT", button.FlagTexture, "LEFT", 0, 0)
  1582. button.OrbCornerTL:SetPoint("TOP", button, "TOP", 0, -2)
  1583. button.OrbCornerTL:SetColorTexture(0, 0, 0, 1)
  1584. button.OrbCornerTR = button.FlagDebuffButton:CreateTexture(nil, "OVERLAY")
  1585. button.OrbCornerTR:SetPoint("RIGHT", button.FlagTexture, "RIGHT", 0, 0)
  1586. button.OrbCornerTR:SetPoint("TOP", button, "TOP", 0, -2)
  1587. button.OrbCornerTR:SetColorTexture(0, 0, 0, 1)
  1588. button.OrbCornerBL = button.FlagDebuffButton:CreateTexture(nil, "OVERLAY")
  1589. button.OrbCornerBL:SetPoint("LEFT", button.FlagTexture, "LEFT", 0, 0)
  1590. button.OrbCornerBL:SetPoint("BOTTOM", button, "BOTTOM", 0, 2)
  1591. button.OrbCornerBL:SetColorTexture(0, 0, 0, 1)
  1592. button.OrbCornerBR = button.FlagDebuffButton:CreateTexture(nil, "OVERLAY")
  1593. button.OrbCornerBR:SetPoint("RIGHT", button.FlagTexture, "RIGHT", 0, 0)
  1594. button.OrbCornerBR:SetPoint("BOTTOM", button, "BOTTOM", 0, 2)
  1595. button.OrbCornerBR:SetColorTexture(0, 0, 0, 1)
  1596. -- carrier
  1597.  
  1598. button.AssistTextureButton = CreateFrame("Button", nil, button) -- xBUT
  1599. button.AssistTargetTexture = button.AssistTextureButton:CreateTexture(nil, "OVERLAY")
  1600. button.AssistTargetTexture:SetTexture("Interface\\RaidFrame\\UI-RaidFrame-MainAssist")
  1601. button.AssistTargetTexture:SetTexCoord(0.07812501, 0.92187499, 0.07812501, 0.92187499)--(5/64, 59/64, 5/64, 59/64)
  1602. button.AssistTargetTexture:SetAlpha(0)
  1603.  
  1604. button.AssistSourceTexture = button.AssistTextureButton:CreateTexture(nil, "ARTWORK")
  1605. button.AssistSourceTexture:SetTexture("Interface\\GroupFrame\\UI-Group-AssistantIcon")
  1606. button.AssistSourceTexture:SetAlpha(0)
  1607. end
  1608. end
  1609. end
  1610. -- button
  1611.  
  1612. local function FontTemplate(button)
  1613. button:SetSize(60, 20)
  1614. button:SetJustifyH("CENTER")
  1615. button:SetFont(fontPath, 20, "OUTLINE")
  1616. button:SetShadowOffset(0, 0)
  1617. button:SetShadowColor(0, 0, 0, 0)
  1618. button:SetTextColor(1, 1, 1, 1)
  1619. end
  1620.  
  1621. for frc = 1, #FRAMES do
  1622. local side = FRAMES[frc]
  1623.  
  1624. GVAR[side.."ScoreUpdateTexture"] = GVAR[side.."Button"][1]:CreateTexture(nil, "OVERLAY")
  1625. local ScoreUpdateTexture = GVAR[side.."ScoreUpdateTexture"]
  1626. ScoreUpdateTexture:SetSize(30.45, 13.92) -- (26.25*1.16, 12*1.16)
  1627. ScoreUpdateTexture:SetPoint("BOTTOMLEFT", GVAR[side.."Button"][1], "TOPLEFT", 1, 1)
  1628. ScoreUpdateTexture:SetTexture(Textures.Path)
  1629. ScoreUpdateTexture:SetTexCoord(unpack(Textures.UpdateWarning))
  1630.  
  1631. GVAR[side.."IsGhostTexture"] = GVAR[side.."Button"][1]:CreateTexture(nil, "OVERLAY")
  1632. local IsGhostTexture = GVAR[side.."IsGhostTexture"]
  1633. IsGhostTexture:SetSize(24, 24)
  1634. IsGhostTexture:SetPoint("LEFT", ScoreUpdateTexture, "RIGHT", 0, 0)
  1635. IsGhostTexture:SetTexture("Interface\\WorldStateFrame\\SkullBones")
  1636. IsGhostTexture:SetTexCoord(0, 0.5, 0, 0.5)
  1637. IsGhostTexture:Hide()
  1638.  
  1639. GVAR[side.."Summary"] = CreateFrame("Frame", nil, GVAR[side.."Button"][1]) -- SUMMARY
  1640. local Summary = GVAR[side.."Summary"]
  1641. Summary:SetToplevel(true)
  1642. Summary:SetSize(140, 60)
  1643.  
  1644. Summary.Healer = Summary:CreateTexture(nil, "ARTWORK")
  1645. Summary.Healer:SetSize(20, 20)
  1646. Summary.Healer:SetPoint("TOPLEFT", Summary, "TOPLEFT", 60, 0)
  1647. Summary.Healer:SetTexture(Textures.Path)
  1648. Summary.Healer:SetTexCoord(unpack(Textures.RoleIcon[1]))
  1649. Summary.Tank = Summary:CreateTexture(nil, "ARTWORK")
  1650. Summary.Tank:SetSize(20, 20)
  1651. Summary.Tank:SetPoint("TOP", Summary.Healer, "BOTTOM", 0, 0)
  1652. Summary.Tank:SetTexture(Textures.Path)
  1653. Summary.Tank:SetTexCoord(unpack(Textures.RoleIcon[2]))
  1654. Summary.Damage = Summary:CreateTexture(nil, "ARTWORK")
  1655. Summary.Damage:SetSize(20, 20)
  1656. Summary.Damage:SetPoint("TOP", Summary.Tank, "BOTTOM", 0, 0)
  1657. Summary.Damage:SetTexture(Textures.Path)
  1658. Summary.Damage:SetTexCoord(unpack(Textures.RoleIcon[3]))
  1659.  
  1660. Summary.HealerFriend = Summary:CreateFontString(nil, "ARTWORK", "GameFontNormal")
  1661. Summary.HealerFriend:SetPoint("RIGHT", Summary.Healer, "LEFT", 15, 0)
  1662. FontTemplate(Summary.HealerFriend)
  1663. Summary.HealerEnemy = Summary:CreateFontString(nil, "ARTWORK", "GameFontNormal")
  1664. Summary.HealerEnemy:SetPoint("LEFT", Summary.Healer, "RIGHT", -15, 0)
  1665. FontTemplate(Summary.HealerEnemy)
  1666. Summary.TankFriend = Summary:CreateFontString(nil, "ARTWORK", "GameFontNormal")
  1667. Summary.TankFriend:SetPoint("RIGHT", Summary.Tank, "LEFT", 15, 0)
  1668. FontTemplate(Summary.TankFriend)
  1669. Summary.TankEnemy = Summary:CreateFontString(nil, "ARTWORK", "GameFontNormal")
  1670. Summary.TankEnemy:SetPoint("LEFT", Summary.Tank, "RIGHT", -15, 0)
  1671. FontTemplate(Summary.TankEnemy)
  1672. Summary.DamageFriend = Summary:CreateFontString(nil, "ARTWORK", "GameFontNormal")
  1673. Summary.DamageFriend:SetPoint("RIGHT", Summary.Damage, "LEFT", 15, 0)
  1674. FontTemplate(Summary.DamageFriend)
  1675. Summary.DamageEnemy = Summary:CreateFontString(nil, "ARTWORK", "GameFontNormal")
  1676. Summary.DamageEnemy:SetPoint("LEFT", Summary.Damage, "RIGHT", -15, 0)
  1677. FontTemplate(Summary.DamageEnemy)
  1678.  
  1679. Summary.Logo1 = Summary:CreateTexture(nil, "BACKGROUND")
  1680. Summary.Logo1:SetSize(60, 60)
  1681. Summary.Logo1:SetPoint("RIGHT", Summary.Tank, "LEFT", 0, 0)
  1682. Summary.Logo2 = Summary:CreateTexture(nil, "BACKGROUND")
  1683. Summary.Logo2:SetSize(60, 60)
  1684. Summary.Logo2:SetPoint("LEFT", Summary.Tank, "RIGHT", 0, 0)
  1685.  
  1686. if playerFactionDEF == 0 then -- summary_flag_texture - 12 - initial
  1687. Summary.Logo1:SetTexture("Interface\\FriendsFrame\\PlusManz-Horde")
  1688. Summary.Logo2:SetTexture("Interface\\FriendsFrame\\PlusManz-Alliance")
  1689. elseif playerFactionDEF == 1 then
  1690. Summary.Logo1:SetTexture("Interface\\FriendsFrame\\PlusManz-Alliance")
  1691. Summary.Logo2:SetTexture("Interface\\FriendsFrame\\PlusManz-Horde")
  1692. else
  1693. Summary.Logo1:SetTexture("Interface\\Timer\\Panda-Logo")
  1694. Summary.Logo2:SetTexture("Interface\\Timer\\Panda-Logo")
  1695. end
  1696. end
  1697.  
  1698. BattlegroundTargets:SetupMonoblockPosition("Enemy")
  1699. BattlegroundTargets:SetupMonoblockPosition("Friend")
  1700. end
  1701. -- ---------------------------------------------------------------------------------------------------------------------
  1702.  
  1703.  
  1704.  
  1705. -- ---------------------------------------------------------------------------------------------------------------------
  1706. function BattlegroundTargets:CreateOptionsFrame()
  1707. local BattlegroundTargets_Options = BattlegroundTargets_Options
  1708.  
  1709. BattlegroundTargets:DefaultShuffle()
  1710.  
  1711. local heightBase = 58
  1712. local heightBracket = 585
  1713.  
  1714. -- 10+16+10+22 58 -- heightBase
  1715.  
  1716. -- 10+22 32 -- fraction
  1717. -- 10+16 26 -- top enable
  1718. -- 8+1+8 + 16+10 + 16+10 + 16 + 10 95 -- scale -> height
  1719. -- 8+1+8 + 16 + 33 -- sort
  1720. -- 8+1+8 + 16+10 + 16 + 59 -- layout -> summary
  1721. -- 8+1+8 + 16+10 + 16+10 + 16 + 85 -- row role -> targetcount
  1722. -- 8+1+8 + 16+10 + 16+10 + 16+10 + 16+10 + 16 137 -- target -> targetassist
  1723. -- 8+1+8 + 16+10 + 16 + 59 -- health -> range
  1724. -- 8+1+8 + 16+10 + 16 + 59 -- fonts
  1725. -- =====
  1726. -- 585
  1727. local heightTotal = heightBase + heightBracket + 30 + 10
  1728.  
  1729.  
  1730.  
  1731. -- ####################################################################################################
  1732. -- xMx local func
  1733. local function HighlightOnEnter(what)
  1734. GVAR.OptionsFrame.LayoutTHText.Background:SetColorTexture(1, 1, 1, 0.15) -- COPYHL
  1735. GVAR.OptionsFrame.LayoutTHx18.Highlight:Show()
  1736. GVAR.OptionsFrame.LayoutTHx24.Highlight:Show()
  1737. GVAR.OptionsFrame.LayoutTHx42.Highlight:Show()
  1738. GVAR.OptionsFrame.LayoutTHx81.Highlight:Show()
  1739. GVAR.OptionsFrame.LayoutSpace.Background:SetColorTexture(1, 1, 1, 0.15) -- COPYHL
  1740. GVAR.OptionsFrame.SummaryText.Background:SetColorTexture(1, 1, 1, 0.15) -- COPYHL
  1741. GVAR.OptionsFrame.SummaryToggle.Highlight:Show()
  1742. GVAR.OptionsFrame.SummaryScale.Background:SetColorTexture(1, 1, 1, 0.15) -- COPYHL
  1743. GVAR.OptionsFrame.SummaryPosition.Background:SetColorTexture(1, 1, 1, 0.15) -- COPYHL
  1744. ----------
  1745. GVAR.OptionsFrame.ShowRole.Highlight:Show()
  1746. GVAR.OptionsFrame.ShowSpec.Highlight:Show()
  1747. GVAR.OptionsFrame.ClassIcon.Highlight:Show()
  1748. GVAR.OptionsFrame.ShowLeader.Highlight:Show()
  1749. GVAR.OptionsFrame.ShowRealm.Highlight:Show()
  1750. GVAR.OptionsFrame.ShowPVPTrinket.Highlight:Show()
  1751. GVAR.OptionsFrame.ShowFTargetCount.Highlight:Show()
  1752. GVAR.OptionsFrame.ShowETargetCount.Highlight:Show()
  1753. ----------
  1754. GVAR.OptionsFrame.ShowTargetIndicator.Highlight:Show()
  1755. GVAR.OptionsFrame.TargetScaleSlider.Background:SetColorTexture(1, 1, 1, 0.15) -- COPYHL
  1756. GVAR.OptionsFrame.TargetPositionSlider.Background:SetColorTexture(1, 1, 1, 0.15) -- COPYHL
  1757. GVAR.OptionsFrame.TargetofTarget.Highlight:Show()
  1758. GVAR.OptionsFrame.ToTScaleSlider.Background:SetColorTexture(1, 1, 1, 0.15) -- COPYHL
  1759. GVAR.OptionsFrame.ToTPositionSlider.Background:SetColorTexture(1, 1, 1, 0.15) -- COPYHL
  1760. GVAR.OptionsFrame.ShowFocusIndicator.Highlight:Show()
  1761. GVAR.OptionsFrame.FocusScaleSlider.Background:SetColorTexture(1, 1, 1, 0.15) -- COPYHL
  1762. GVAR.OptionsFrame.FocusPositionSlider.Background:SetColorTexture(1, 1, 1, 0.15) -- COPYHL
  1763. GVAR.OptionsFrame.ShowFlag.Highlight:Show()
  1764. GVAR.OptionsFrame.FlagScaleSlider.Background:SetColorTexture(1, 1, 1, 0.15) -- COPYHL
  1765. GVAR.OptionsFrame.FlagPositionSlider.Background:SetColorTexture(1, 1, 1, 0.15) -- COPYHL
  1766. GVAR.OptionsFrame.ShowAssist.Highlight:Show()
  1767. GVAR.OptionsFrame.AssistScaleSlider.Background:SetColorTexture(1, 1, 1, 0.15) -- COPYHL
  1768. GVAR.OptionsFrame.AssistPositionSlider.Background:SetColorTexture(1, 1, 1, 0.15) -- COPYHL
  1769. ----------
  1770. GVAR.OptionsFrame.ShowHealthBar.Highlight:Show()
  1771. GVAR.OptionsFrame.ShowHealthText.Highlight:Show()
  1772. GVAR.OptionsFrame.RangeCheck.Highlight:Show()
  1773. GVAR.OptionsFrame.RangeDisplayPullDown:LockHighlight()
  1774. GVAR.OptionsFrame.SortByTitle.Background:SetColorTexture(1, 1, 1, 0.15) -- COPYHL
  1775. GVAR.OptionsFrame.SortByPullDown:LockHighlight()
  1776. GVAR.OptionsFrame.SortDetailPullDown:LockHighlight()
  1777. ----------
  1778. GVAR.OptionsFrame.FontNameTitle.Background:SetColorTexture(1, 1, 1, 0.15) -- COPYHL
  1779. GVAR.OptionsFrame.FontNamePullDown:LockHighlight()
  1780. GVAR.OptionsFrame.FontNameSlider.Background:SetColorTexture(1, 1, 1, 0.15) -- COPYHL
  1781. GVAR.OptionsFrame.FontNumberTitle.Background:SetColorTexture(1, 1, 1, 0.15) -- COPYHL
  1782. GVAR.OptionsFrame.FontNumberPullDown:LockHighlight()
  1783. GVAR.OptionsFrame.FontNumberSlider.Background:SetColorTexture(1, 1, 1, 0.15) -- COPYHL
  1784. GVAR.OptionsFrame.ScaleTitle.Background:SetColorTexture(1, 1, 1, 0.15) -- COPYHL
  1785. GVAR.OptionsFrame.ScaleSlider.Background:SetColorTexture(1, 1, 1, 0.15) -- COPYHL
  1786. GVAR.OptionsFrame.WidthTitle.Background:SetColorTexture(1, 1, 1, 0.15) -- COPYHL
  1787. GVAR.OptionsFrame.WidthSlider.Background:SetColorTexture(1, 1, 1, 0.15) -- COPYHL
  1788. GVAR.OptionsFrame.HeightTitle.Background:SetColorTexture(1, 1, 1, 0.15) -- COPYHL
  1789. GVAR.OptionsFrame.HeightSlider.Background:SetColorTexture(1, 1, 1, 0.15) -- COPYHL
  1790. if what == "sameSize" then
  1791. if currentSize == 10 then
  1792. GVAR.OptionsFrame.TabRaidSize10:LockHighlight()
  1793. elseif currentSize == 15 then
  1794. GVAR.OptionsFrame.TabRaidSize15:LockHighlight()
  1795. end
  1796. if fraction == "Enemy" then
  1797. GVAR.OptionsFrame.EnableFriendBracket:LockHighlight()
  1798. else
  1799. GVAR.OptionsFrame.EnableEnemyBracket:LockHighlight()
  1800. end
  1801. else--if what == "diffSize" then
  1802. if currentSize == 10 then
  1803. GVAR.OptionsFrame.TabRaidSize15:LockHighlight()
  1804. elseif currentSize == 15 then
  1805. GVAR.OptionsFrame.TabRaidSize10:LockHighlight()
  1806. end
  1807. if fraction == "Enemy" then
  1808. GVAR.OptionsFrame.EnableEnemyBracket:LockHighlight()
  1809. else
  1810. GVAR.OptionsFrame.EnableFriendBracket:LockHighlight()
  1811. end
  1812. end
  1813. end
  1814. local function HighlightOnLeave()
  1815. GVAR.OptionsFrame.TabRaidSize15:UnlockHighlight()
  1816. GVAR.OptionsFrame.TabRaidSize10:UnlockHighlight()
  1817. GVAR.OptionsFrame.EnableFriendBracket:UnlockHighlight()
  1818. GVAR.OptionsFrame.EnableEnemyBracket:UnlockHighlight()
  1819. ----------
  1820. GVAR.OptionsFrame.LayoutTHText.Background:SetColorTexture(0, 0, 0, 0)
  1821. GVAR.OptionsFrame.LayoutTHx18.Highlight:Hide()
  1822. GVAR.OptionsFrame.LayoutTHx24.Highlight:Hide()
  1823. GVAR.OptionsFrame.LayoutTHx42.Highlight:Hide()
  1824. GVAR.OptionsFrame.LayoutTHx81.Highlight:Hide()
  1825. GVAR.OptionsFrame.LayoutSpace.Background:SetColorTexture(0, 0, 0, 0)
  1826. GVAR.OptionsFrame.SummaryText.Background:SetColorTexture(0, 0, 0, 0)
  1827. GVAR.OptionsFrame.SummaryToggle.Highlight:Hide()
  1828. GVAR.OptionsFrame.SummaryScale.Background:SetColorTexture(0, 0, 0, 0)
  1829. GVAR.OptionsFrame.SummaryPosition.Background:SetColorTexture(0, 0, 0, 0)
  1830. ----------
  1831. GVAR.OptionsFrame.ShowRole.Highlight:Hide()
  1832. GVAR.OptionsFrame.ShowSpec.Highlight:Hide()
  1833. GVAR.OptionsFrame.ClassIcon.Highlight:Hide()
  1834. GVAR.OptionsFrame.ShowLeader.Highlight:Hide()
  1835. GVAR.OptionsFrame.ShowRealm.Highlight:Hide()
  1836. GVAR.OptionsFrame.ShowPVPTrinket.Highlight:Hide()
  1837. GVAR.OptionsFrame.ShowFTargetCount.Highlight:Hide()
  1838. GVAR.OptionsFrame.ShowETargetCount.Highlight:Hide()
  1839. ----------
  1840. GVAR.OptionsFrame.ShowTargetIndicator.Highlight:Hide()
  1841. GVAR.OptionsFrame.TargetScaleSlider.Background:SetColorTexture(0, 0, 0, 0)
  1842. GVAR.OptionsFrame.TargetPositionSlider.Background:SetColorTexture(0, 0, 0, 0)
  1843. GVAR.OptionsFrame.TargetofTarget.Highlight:Hide()
  1844. GVAR.OptionsFrame.ToTScaleSlider.Background:SetColorTexture(0, 0, 0, 0)
  1845. GVAR.OptionsFrame.ToTPositionSlider.Background:SetColorTexture(0, 0, 0, 0)
  1846. GVAR.OptionsFrame.ShowFocusIndicator.Highlight:Hide()
  1847. GVAR.OptionsFrame.FocusScaleSlider.Background:SetColorTexture(0, 0, 0, 0)
  1848. GVAR.OptionsFrame.FocusPositionSlider.Background:SetColorTexture(0, 0, 0, 0)
  1849. GVAR.OptionsFrame.ShowFlag.Highlight:Hide()
  1850. GVAR.OptionsFrame.FlagScaleSlider.Background:SetColorTexture(0, 0, 0, 0)
  1851. GVAR.OptionsFrame.FlagPositionSlider.Background:SetColorTexture(0, 0, 0, 0)
  1852. GVAR.OptionsFrame.ShowAssist.Highlight:Hide()
  1853. GVAR.OptionsFrame.AssistScaleSlider.Background:SetColorTexture(0, 0, 0, 0)
  1854. GVAR.OptionsFrame.AssistPositionSlider.Background:SetColorTexture(0, 0, 0, 0)
  1855. ----------
  1856. GVAR.OptionsFrame.ShowHealthBar.Highlight:Hide()
  1857. GVAR.OptionsFrame.ShowHealthText.Highlight:Hide()
  1858. GVAR.OptionsFrame.RangeCheck.Highlight:Hide()
  1859. GVAR.OptionsFrame.RangeDisplayPullDown:UnlockHighlight()
  1860. GVAR.OptionsFrame.SortByTitle.Background:SetColorTexture(0, 0, 0, 0)
  1861. GVAR.OptionsFrame.SortByPullDown:UnlockHighlight()
  1862. GVAR.OptionsFrame.SortDetailPullDown:UnlockHighlight()
  1863. ----------
  1864. GVAR.OptionsFrame.FontNameTitle.Background:SetColorTexture(0, 0, 0, 0)
  1865. GVAR.OptionsFrame.FontNamePullDown:UnlockHighlight()
  1866. GVAR.OptionsFrame.FontNameSlider.Background:SetColorTexture(0, 0, 0, 0)
  1867. GVAR.OptionsFrame.FontNumberTitle.Background:SetColorTexture(0, 0, 0, 0)
  1868. GVAR.OptionsFrame.FontNumberPullDown:UnlockHighlight()
  1869. GVAR.OptionsFrame.FontNumberSlider.Background:SetColorTexture(0, 0, 0, 0)
  1870. GVAR.OptionsFrame.ScaleTitle.Background:SetColorTexture(0, 0, 0, 0)
  1871. GVAR.OptionsFrame.ScaleSlider.Background:SetColorTexture(0, 0, 0, 0)
  1872. GVAR.OptionsFrame.WidthTitle.Background:SetColorTexture(0, 0, 0, 0)
  1873. GVAR.OptionsFrame.WidthSlider.Background:SetColorTexture(0, 0, 0, 0)
  1874. GVAR.OptionsFrame.HeightTitle.Background:SetColorTexture(0, 0, 0, 0)
  1875. GVAR.OptionsFrame.HeightSlider.Background:SetColorTexture(0, 0, 0, 0)
  1876. end
  1877.  
  1878. local function ConfigFontNumberOptionCheck(size)
  1879. if BattlegroundTargets_Options[fraction].SummaryToggle[size] or
  1880. BattlegroundTargets_Options[fraction].ButtonFlagToggle[size] or
  1881. BattlegroundTargets_Options[fraction].ButtonHealthTextToggle[size] or
  1882. BattlegroundTargets_Options[fraction].ButtonFTargetCountToggle[size] or
  1883. BattlegroundTargets_Options[fraction].ButtonETargetCountToggle[size] or
  1884. BattlegroundTargets_Options[fraction].ButtonPvPTrinketToggle[size]
  1885. then
  1886. TEMPLATE.EnablePullDownMenu(GVAR.OptionsFrame.FontNumberPullDown)
  1887. GVAR.OptionsFrame.FontNumberTitle:SetTextColor(1, 1, 1, 1)
  1888. TEMPLATE.EnableSlider(GVAR.OptionsFrame.FontNumberSlider)
  1889. else
  1890. TEMPLATE.DisablePullDownMenu(GVAR.OptionsFrame.FontNumberPullDown)
  1891. GVAR.OptionsFrame.FontNumberTitle:SetTextColor(0.5, 0.5, 0.5, 1)
  1892. TEMPLATE.DisableSlider(GVAR.OptionsFrame.FontNumberSlider)
  1893. end
  1894. end
  1895. -- ###
  1896. -- ####################################################################################################
  1897.  
  1898.  
  1899.  
  1900. -- ####################################################################################################
  1901. -- xMx OptionsFrame
  1902. GVAR.OptionsFrame = CreateFrame("Frame", "BattlegroundTargets_OptionsFrame", UIParent)
  1903. TEMPLATE.BorderTRBL(GVAR.OptionsFrame)
  1904. GVAR.OptionsFrame:EnableMouse(true)
  1905. GVAR.OptionsFrame:SetMovable(true)
  1906. GVAR.OptionsFrame:SetToplevel(true)
  1907. GVAR.OptionsFrame:SetClampedToScreen(false) -- TODO bug? (true) -- CLAMP_FIX_OPTIONS
  1908. -- BOOM GVAR.OptionsFrame:SetClampRectInsets()
  1909. -- BOOM GVAR.OptionsFrame:SetWidth()
  1910. GVAR.OptionsFrame:SetHeight(heightTotal)
  1911. GVAR.OptionsFrame:Hide()
  1912. GVAR.OptionsFrame:SetScript("OnShow", function() BattlegroundTargets:OptionsFrameShow() end)
  1913. GVAR.OptionsFrame:SetScript("OnHide", function() BattlegroundTargets:OptionsFrameHide() end)
  1914. GVAR.OptionsFrame:SetScript("OnMouseWheel", NOOP)
  1915.  
  1916. -- CLAMP_FIX_OPTIONS BEGIN
  1917. GVAR.OptionsFrame.ClampDummy1 = GVAR.OptionsFrame:CreateTexture(nil, "BACKGROUND") -- horizontal top
  1918. -- BOOM GVAR.OptionsFrame.ClampDummy1:SetSize(w, 1)
  1919. GVAR.OptionsFrame.ClampDummy1:SetPoint("TOP", GVAR.OptionsFrame, "TOP", 0, -40)
  1920. GVAR.OptionsFrame.ClampDummy1:SetColorTexture(0, 0.5, 2, 0.5)
  1921. GVAR.OptionsFrame.ClampDummy1:Hide()
  1922. GVAR.OptionsFrame.ClampDummy2 = GVAR.OptionsFrame:CreateTexture(nil, "BACKGROUND") -- horizontal bottom
  1923. -- BOOM GVAR.OptionsFrame.ClampDummy2:SetSize(w, 1)
  1924. GVAR.OptionsFrame.ClampDummy2:SetPoint("BOTTOM", GVAR.OptionsFrame, "BOTTOM", 0, 40)
  1925. GVAR.OptionsFrame.ClampDummy2:SetColorTexture(0, 0.5, 2, 0.5)
  1926. GVAR.OptionsFrame.ClampDummy2:Hide()
  1927. GVAR.OptionsFrame.ClampDummy3 = GVAR.OptionsFrame:CreateTexture(nil, "BACKGROUND") -- vertical left
  1928. -- BOOM GVAR.OptionsFrame.ClampDummy3:SetSize(1, h)
  1929. GVAR.OptionsFrame.ClampDummy3:SetPoint("LEFT", GVAR.OptionsFrame, "LEFT", 40, 0)
  1930. GVAR.OptionsFrame.ClampDummy3:SetColorTexture(0, 0.5, 2, 0.5)
  1931. GVAR.OptionsFrame.ClampDummy3:Hide()
  1932. GVAR.OptionsFrame.ClampDummy4 = GVAR.OptionsFrame:CreateTexture(nil, "BACKGROUND") -- horizontal right
  1933. -- BOOM GVAR.OptionsFrame.ClampDummy4:SetSize(1, h)
  1934. GVAR.OptionsFrame.ClampDummy4:SetPoint("RIGHT", GVAR.OptionsFrame, "RIGHT", -40, 0)
  1935. GVAR.OptionsFrame.ClampDummy4:SetColorTexture(0, 0.5, 2, 0.5)
  1936. GVAR.OptionsFrame.ClampDummy4:Hide()
  1937. -- CLAMP_FIX_OPTIONS END
  1938.  
  1939. -- close
  1940. GVAR.OptionsFrame.CloseConfig = CreateFrame("Button", nil, GVAR.OptionsFrame)
  1941. TEMPLATE.TextButton(GVAR.OptionsFrame.CloseConfig, L["Close Configuration"], 1)
  1942. GVAR.OptionsFrame.CloseConfig:SetPoint("BOTTOM", GVAR.OptionsFrame, "BOTTOM", 0, 10)
  1943. GVAR.OptionsFrame.CloseConfig:SetPoint("LEFT", GVAR.OptionsFrame, "LEFT", 10, 0)
  1944. -- BOOM GVAR.OptionsFrame.CloseConfig:SetWidth()
  1945. GVAR.OptionsFrame.CloseConfig:SetHeight(30)
  1946. GVAR.OptionsFrame.CloseConfig:SetScript("OnClick", function() GVAR.OptionsFrame:Hide() end)
  1947. -- ###
  1948. -- ####################################################################################################
  1949.  
  1950.  
  1951.  
  1952. -- ####################################################################################################
  1953. -- xMx Base
  1954. GVAR.OptionsFrame.Base = CreateFrame("Frame", nil, GVAR.OptionsFrame)
  1955. TEMPLATE.BorderTRBL(GVAR.OptionsFrame.Base)
  1956. -- BOOM GVAR.OptionsFrame.Base:SetWidth()
  1957. GVAR.OptionsFrame.Base:SetHeight(heightBase)
  1958. GVAR.OptionsFrame.Base:SetPoint("TOPLEFT", GVAR.OptionsFrame, "TOPLEFT", 0, 0)
  1959. GVAR.OptionsFrame.Base:EnableMouse(true)
  1960.  
  1961. GVAR.OptionsFrame.Title = GVAR.OptionsFrame.Base:CreateFontString(nil, "ARTWORK", "GameFontNormalLarge")
  1962. -- BOOM GVAR.OptionsFrame.Title:SetWidth()
  1963. GVAR.OptionsFrame.Title:SetHeight(16)
  1964. GVAR.OptionsFrame.Title:SetPoint("TOPLEFT", GVAR.OptionsFrame.Base, "TOPLEFT", 0, -10)
  1965. GVAR.OptionsFrame.Title:SetJustifyH("CENTER")
  1966. GVAR.OptionsFrame.Title:SetText("BattlegroundTargets")
  1967.  
  1968. -- tabs
  1969. GVAR.OptionsFrame.TabGeneral = CreateFrame("Button", nil, GVAR.OptionsFrame.Base)
  1970. TEMPLATE.TabButton(GVAR.OptionsFrame.TabGeneral, L["Options"], nil, "monotext")
  1971. -- BOOM GVAR.OptionsFrame.TabGeneral:SetWidth()
  1972. GVAR.OptionsFrame.TabGeneral:SetHeight(22)
  1973. -- BOOM GVAR.OptionsFrame.TabGeneral:SetPoint()
  1974. GVAR.OptionsFrame.TabGeneral:SetScript("OnClick", function()
  1975. if GVAR.OptionsFrame.ConfigGeneral:IsShown() then
  1976. TEMPLATE.SetTabButton(GVAR.OptionsFrame.TabGeneral, nil)
  1977. GVAR.OptionsFrame.ConfigGeneral:Hide()
  1978. GVAR.OptionsFrame.ConfigBrackets:Show()
  1979. GVAR.OptionsFrame["TabRaidSize"..testSize].TextureBottom:SetColorTexture(0, 0, 0, 1)
  1980. else
  1981. TEMPLATE.SetTabButton(GVAR.OptionsFrame.TabGeneral, true)
  1982. GVAR.OptionsFrame.ConfigGeneral:Show()
  1983. GVAR.OptionsFrame.ConfigBrackets:Hide()
  1984. GVAR.OptionsFrame["TabRaidSize"..testSize].TextureBottom:SetColorTexture(0.8, 0.2, 0.2, 1)
  1985. end
  1986. end)
  1987.  
  1988. GVAR.OptionsFrame.TabRaidSize10 = CreateFrame("Button", nil, GVAR.OptionsFrame.Base)
  1989. TEMPLATE.TabButton(GVAR.OptionsFrame.TabRaidSize10, L["10v10"], BattlegroundTargets_Options.Friend.EnableBracket[10] or BattlegroundTargets_Options.Enemy.EnableBracket[10])
  1990. -- BOOM GVAR.OptionsFrame.TabRaidSize10:SetWidth()
  1991. GVAR.OptionsFrame.TabRaidSize10:SetHeight(22)
  1992. -- BOOM GVAR.OptionsFrame.TabRaidSize10:SetPoint()
  1993. GVAR.OptionsFrame.TabRaidSize10:SetPoint("LEFT", GVAR.OptionsFrame.TabGeneral, "RIGHT", 10, 0)
  1994. GVAR.OptionsFrame.TabRaidSize10:SetScript("OnClick", function()
  1995. BattlegroundTargets:ClickOnBracketTab(10, fraction)
  1996. end)
  1997.  
  1998. -- copy settings1
  1999. GVAR.OptionsFrame.CopySettings1 = CreateFrame("Button", nil, GVAR.OptionsFrame.Base)
  2000. TEMPLATE.IconButton(GVAR.OptionsFrame.CopySettings1, 1)
  2001. GVAR.OptionsFrame.CopySettings1:SetPoint("LEFT", GVAR.OptionsFrame.TabRaidSize10, "RIGHT", 10, 5)
  2002. GVAR.OptionsFrame.CopySettings1:SetHeight(20.4) -- 17 * 1.2 -- COPY_HW
  2003. GVAR.OptionsFrame.CopySettings1:SetWidth(30) -- 25 * 1.2
  2004. GVAR.OptionsFrame.CopySettings1:SetScript("OnClick", function() BattlegroundTargets:CopyAllSettings(currentSize) end)
  2005. GVAR.OptionsFrame.CopySettings1:SetScript("OnEnter", function() HighlightOnEnter("diffSize") end)
  2006. GVAR.OptionsFrame.CopySettings1:SetScript("OnLeave", HighlightOnLeave)
  2007.  
  2008. GVAR.OptionsFrame.TabRaidSize15 = CreateFrame("Button", nil, GVAR.OptionsFrame.Base)
  2009. TEMPLATE.TabButton(GVAR.OptionsFrame.TabRaidSize15, L["15v15"], BattlegroundTargets_Options.Friend.EnableBracket[15] or BattlegroundTargets_Options.Enemy.EnableBracket[15])
  2010. -- BOOM GVAR.OptionsFrame.TabRaidSize15:SetWidth()
  2011. GVAR.OptionsFrame.TabRaidSize15:SetHeight(22)
  2012. -- BOOM GVAR.OptionsFrame.TabRaidSize15:SetPoint()
  2013. GVAR.OptionsFrame.TabRaidSize15:SetPoint("LEFT", GVAR.OptionsFrame.CopySettings1, "RIGHT", 10, -5)
  2014. GVAR.OptionsFrame.TabRaidSize15:SetScript("OnClick", function()
  2015. BattlegroundTargets:ClickOnBracketTab(15, fraction)
  2016. end)
  2017.  
  2018. GVAR.OptionsFrame.TabRaidSize40 = CreateFrame("Button", nil, GVAR.OptionsFrame.Base)
  2019. TEMPLATE.TabButton(GVAR.OptionsFrame.TabRaidSize40, L["40v40"], BattlegroundTargets_Options.Friend.EnableBracket[40] or BattlegroundTargets_Options.Enemy.EnableBracket[40])
  2020. -- BOOM GVAR.OptionsFrame.TabRaidSize40:SetWidth()
  2021. GVAR.OptionsFrame.TabRaidSize40:SetHeight(22)
  2022. -- BOOM GVAR.OptionsFrame.TabRaidSize40:SetPoint()
  2023. GVAR.OptionsFrame.TabRaidSize40:SetPoint("LEFT", GVAR.OptionsFrame.TabRaidSize15, "RIGHT", 10, 0)
  2024. GVAR.OptionsFrame.TabRaidSize40:SetScript("OnClick", function()
  2025. BattlegroundTargets:ClickOnBracketTab(40, fraction)
  2026. end)
  2027.  
  2028. if testSize == 10 then
  2029. TEMPLATE.SetTabButton(GVAR.OptionsFrame.TabGeneral, nil)
  2030. TEMPLATE.SetTabButton(GVAR.OptionsFrame.TabRaidSize10, true)
  2031. TEMPLATE.SetTabButton(GVAR.OptionsFrame.TabRaidSize15, nil)
  2032. TEMPLATE.SetTabButton(GVAR.OptionsFrame.TabRaidSize40, nil)
  2033. elseif testSize == 15 then
  2034. TEMPLATE.SetTabButton(GVAR.OptionsFrame.TabGeneral, nil)
  2035. TEMPLATE.SetTabButton(GVAR.OptionsFrame.TabRaidSize10, nil)
  2036. TEMPLATE.SetTabButton(GVAR.OptionsFrame.TabRaidSize15, true)
  2037. TEMPLATE.SetTabButton(GVAR.OptionsFrame.TabRaidSize40, nil)
  2038. elseif testSize == 40 then
  2039. TEMPLATE.SetTabButton(GVAR.OptionsFrame.TabGeneral, nil)
  2040. TEMPLATE.SetTabButton(GVAR.OptionsFrame.TabRaidSize10, nil)
  2041. TEMPLATE.SetTabButton(GVAR.OptionsFrame.TabRaidSize15, nil)
  2042. TEMPLATE.SetTabButton(GVAR.OptionsFrame.TabRaidSize40, true)
  2043. end
  2044. -- ###
  2045. -- ####################################################################################################
  2046.  
  2047.  
  2048.  
  2049. -- ####################################################################################################
  2050. -- xMx ConfigBrackets
  2051. GVAR.OptionsFrame.ConfigBrackets = CreateFrame("Frame", nil, GVAR.OptionsFrame)
  2052. -- BOOM GVAR.OptionsFrame.ConfigBrackets:SetWidth()
  2053. GVAR.OptionsFrame.ConfigBrackets:SetHeight(heightBracket)
  2054. GVAR.OptionsFrame.ConfigBrackets:SetPoint("TOPLEFT", GVAR.OptionsFrame.Base, "BOTTOMLEFT", 0, -1)
  2055. GVAR.OptionsFrame.ConfigBrackets:Hide()
  2056.  
  2057. -- EnableBracket
  2058. GVAR.OptionsFrame.EnableFriendBracket = CreateFrame("Button", nil, GVAR.OptionsFrame.ConfigBrackets)
  2059. TEMPLATE.TabButton(
  2060. GVAR.OptionsFrame.EnableFriendBracket,
  2061. Textures.FriendIconStr.." "..L["Friendly Players"],--L["Friend"],--
  2062. BattlegroundTargets_Options.Friend.EnableBracket[currentSize])
  2063. -- BOOM GVAR.OptionsFrame.EnableFriendBracket:SetWidth()
  2064. GVAR.OptionsFrame.EnableFriendBracket:SetHeight(22)
  2065. -- BOOM GVAR.OptionsFrame.EnableFriendBracket:SetPoint()
  2066. GVAR.OptionsFrame.EnableFriendBracket:SetScript("OnClick", function()
  2067. BattlegroundTargets:ClickOnFractionTab("Friend")
  2068. end)
  2069.  
  2070. -- copy settings2
  2071. GVAR.OptionsFrame.CopySettings2 = CreateFrame("Button", nil, GVAR.OptionsFrame.ConfigBrackets)
  2072. TEMPLATE.IconButton(GVAR.OptionsFrame.CopySettings2, 2)
  2073. GVAR.OptionsFrame.CopySettings2:SetPoint("LEFT", GVAR.OptionsFrame.EnableFriendBracket, "RIGHT", 10, 5)
  2074. GVAR.OptionsFrame.CopySettings2:SetHeight(20.4) -- 17 * 1.2 -- COPY_HW
  2075. GVAR.OptionsFrame.CopySettings2:SetWidth(30) -- 25 * 1.2
  2076. GVAR.OptionsFrame.CopySettings2:SetScript("OnClick", function() BattlegroundTargets:CopyAllSettings(currentSize, "sameSize") end)
  2077. GVAR.OptionsFrame.CopySettings2:SetScript("OnEnter", function() HighlightOnEnter("sameSize") end)
  2078. GVAR.OptionsFrame.CopySettings2:SetScript("OnLeave", HighlightOnLeave)
  2079.  
  2080. GVAR.OptionsFrame.EnableEnemyBracket = CreateFrame("Button", nil, GVAR.OptionsFrame.ConfigBrackets)
  2081. TEMPLATE.TabButton(
  2082. GVAR.OptionsFrame.EnableEnemyBracket,
  2083. Textures.EnemyIconStr.." "..L["Enemy Players"],--L["Enemy"],--
  2084. BattlegroundTargets_Options.Enemy.EnableBracket[currentSize])
  2085. -- BOOM GVAR.OptionsFrame.EnableEnemyBracket:SetWidth()
  2086. GVAR.OptionsFrame.EnableEnemyBracket:SetHeight(22)
  2087. GVAR.OptionsFrame.EnableEnemyBracket:SetPoint("LEFT", GVAR.OptionsFrame.CopySettings2, "RIGHT", 10, -5)
  2088. GVAR.OptionsFrame.EnableEnemyBracket:SetScript("OnClick", function()
  2089. BattlegroundTargets:ClickOnFractionTab("Enemy")
  2090. end)
  2091.  
  2092. if fraction == "Friend" then
  2093. TEMPLATE.SetTabButton(GVAR.OptionsFrame.EnableFriendBracket, true)
  2094. TEMPLATE.SetTabButton(GVAR.OptionsFrame.EnableEnemyBracket, nil)
  2095. else
  2096. TEMPLATE.SetTabButton(GVAR.OptionsFrame.EnableFriendBracket, nil)
  2097. TEMPLATE.SetTabButton(GVAR.OptionsFrame.EnableEnemyBracket, true)
  2098. end
  2099.  
  2100.  
  2101.  
  2102. -- DUMMY
  2103. GVAR.OptionsFrame.Dummy0 = GVAR.OptionsFrame.ConfigBrackets:CreateTexture(nil, "ARTWORK")
  2104. -- BOOM GVAR.OptionsFrame.Dummy0:SetWidth()
  2105. GVAR.OptionsFrame.Dummy0:SetHeight(1)
  2106. GVAR.OptionsFrame.Dummy0:SetPoint("LEFT", GVAR.OptionsFrame, "LEFT", 0, 0)
  2107. GVAR.OptionsFrame.Dummy0:SetPoint("TOP", GVAR.OptionsFrame.EnableFriendBracket, "BOTTOM", 0, 2)
  2108. GVAR.OptionsFrame.Dummy0:SetColorTexture(0.8, 0.2, 0.2, 1)
  2109.  
  2110.  
  2111.  
  2112. -- enable fraction
  2113. GVAR.OptionsFrame.EnableFraction = CreateFrame("CheckButton", nil, GVAR.OptionsFrame.ConfigBrackets)
  2114. TEMPLATE.CheckButton(GVAR.OptionsFrame.EnableFraction, 16, 4, L["Enable"])
  2115. GVAR.OptionsFrame.EnableFraction:SetPoint("LEFT", GVAR.OptionsFrame, "LEFT", 10, 0)
  2116. GVAR.OptionsFrame.EnableFraction:SetPoint("TOP", GVAR.OptionsFrame.Dummy0, "BOTTOM", 0, -8)
  2117. GVAR.OptionsFrame.EnableFraction:SetChecked(BattlegroundTargets_Options[fraction].EnableBracket[currentSize])
  2118. GVAR.OptionsFrame.EnableFraction:SetScript("OnClick", function()
  2119. BattlegroundTargets_Options[fraction].EnableBracket[currentSize] = not BattlegroundTargets_Options[fraction].EnableBracket[currentSize]
  2120. GVAR.OptionsFrame.EnableFraction:SetChecked(BattlegroundTargets_Options[fraction].EnableBracket[currentSize])
  2121. BattlegroundTargets:CheckForEnabledBracket(currentSize, fraction)
  2122. if BattlegroundTargets_Options.Friend.EnableBracket[currentSize] or BattlegroundTargets_Options.Enemy.EnableBracket[currentSize] then
  2123. BattlegroundTargets:EnableConfigMode()
  2124. else
  2125. BattlegroundTargets:DisableConfigMode()
  2126. end
  2127. end)
  2128.  
  2129.  
  2130.  
  2131. -- DUMMY
  2132. GVAR.OptionsFrame.Dummy1 = GVAR.OptionsFrame.ConfigBrackets:CreateTexture(nil, "ARTWORK")
  2133. -- BOOM GVAR.OptionsFrame.Dummy1:SetWidth()
  2134. GVAR.OptionsFrame.Dummy1:SetHeight(1)
  2135. GVAR.OptionsFrame.Dummy1:SetPoint("LEFT", GVAR.OptionsFrame, "LEFT", 10, 0)
  2136. GVAR.OptionsFrame.Dummy1:SetPoint("TOP", GVAR.OptionsFrame.EnableFraction, "BOTTOM", 0, -8)
  2137. GVAR.OptionsFrame.Dummy1:SetColorTexture(0.8, 0.2, 0.2, 1)
  2138.  
  2139.  
  2140.  
  2141. -- scale
  2142. GVAR.OptionsFrame.ScaleTitle = GVAR.OptionsFrame.ConfigBrackets:CreateFontString(nil, "ARTWORK", "GameFontNormalSmall")
  2143. GVAR.OptionsFrame.ScaleSlider = CreateFrame("Slider", nil, GVAR.OptionsFrame.ConfigBrackets)
  2144. GVAR.OptionsFrame.ScaleValue = GVAR.OptionsFrame.ConfigBrackets:CreateFontString(nil, "ARTWORK", "GameFontNormalSmall")
  2145. GVAR.OptionsFrame.ScaleTitle:SetHeight(16)
  2146. GVAR.OptionsFrame.ScaleTitle:SetPoint("LEFT", GVAR.OptionsFrame, "LEFT", 10, 0)
  2147. GVAR.OptionsFrame.ScaleTitle:SetPoint("TOP", GVAR.OptionsFrame.Dummy1, "BOTTOM", 0, -8)
  2148. GVAR.OptionsFrame.ScaleTitle:SetJustifyH("LEFT")
  2149. GVAR.OptionsFrame.ScaleTitle:SetText(L["Scale"]..":")
  2150. GVAR.OptionsFrame.ScaleTitle:SetTextColor(1, 1, 1, 1)
  2151. GVAR.OptionsFrame.ScaleTitle.Background = GVAR.OptionsFrame.ConfigBrackets:CreateTexture(nil, "BACKGROUND")
  2152. GVAR.OptionsFrame.ScaleTitle.Background:SetPoint("TOPLEFT", GVAR.OptionsFrame.ScaleTitle, "TOPLEFT", 0, 0)
  2153. GVAR.OptionsFrame.ScaleTitle.Background:SetPoint("BOTTOMRIGHT", GVAR.OptionsFrame.ScaleTitle, "BOTTOMRIGHT", 0, 0)
  2154. GVAR.OptionsFrame.ScaleTitle.Background:SetColorTexture(0, 0, 0, 0)
  2155. TEMPLATE.Slider(GVAR.OptionsFrame.ScaleSlider, 180, 5, 50, 250, BattlegroundTargets_Options[fraction].ButtonScale[currentSize]*100,
  2156. function(self, value)
  2157. local nvalue = value/100
  2158. if nvalue == BattlegroundTargets_Options[fraction].ButtonScale[currentSize] then return end
  2159. BattlegroundTargets_Options[fraction].ButtonScale[currentSize] = nvalue
  2160. GVAR.OptionsFrame.ScaleValue:SetText(value.."%")
  2161. BattlegroundTargets:EnableConfigMode()
  2162. end,
  2163. "blank")
  2164. GVAR.OptionsFrame.ScaleSlider:SetPoint("LEFT", GVAR.OptionsFrame.ScaleTitle, "RIGHT", 20, 0)
  2165. GVAR.OptionsFrame.ScaleValue:SetHeight(20)
  2166. GVAR.OptionsFrame.ScaleValue:SetPoint("LEFT", GVAR.OptionsFrame.ScaleSlider, "RIGHT", 5, 0)
  2167. GVAR.OptionsFrame.ScaleValue:SetJustifyH("LEFT")
  2168. GVAR.OptionsFrame.ScaleValue:SetText((BattlegroundTargets_Options[fraction].ButtonScale[currentSize]*100).."%")
  2169. GVAR.OptionsFrame.ScaleValue:SetTextColor(1, 1, 0.49, 1)
  2170.  
  2171. -- width
  2172. GVAR.OptionsFrame.WidthTitle = GVAR.OptionsFrame.ConfigBrackets:CreateFontString(nil, "ARTWORK", "GameFontNormalSmall")
  2173. GVAR.OptionsFrame.WidthSlider = CreateFrame("Slider", nil, GVAR.OptionsFrame.ConfigBrackets)
  2174. GVAR.OptionsFrame.WidthValue = GVAR.OptionsFrame.ConfigBrackets:CreateFontString(nil, "ARTWORK", "GameFontNormalSmall")
  2175. GVAR.OptionsFrame.WidthTitle:SetHeight(16)
  2176. GVAR.OptionsFrame.WidthTitle:SetPoint("LEFT", GVAR.OptionsFrame, "LEFT", 10, 0)
  2177. GVAR.OptionsFrame.WidthTitle:SetPoint("TOP", GVAR.OptionsFrame.ScaleSlider, "BOTTOM", 0, -10)
  2178. GVAR.OptionsFrame.WidthTitle:SetJustifyH("LEFT")
  2179. GVAR.OptionsFrame.WidthTitle:SetText(L["Width"]..":")
  2180. GVAR.OptionsFrame.WidthTitle:SetTextColor(1, 1, 1, 1)
  2181. GVAR.OptionsFrame.WidthTitle.Background = GVAR.OptionsFrame.ConfigBrackets:CreateTexture(nil, "BACKGROUND")
  2182. GVAR.OptionsFrame.WidthTitle.Background:SetPoint("TOPLEFT", GVAR.OptionsFrame.WidthTitle, "TOPLEFT", 0, 0)
  2183. GVAR.OptionsFrame.WidthTitle.Background:SetPoint("BOTTOMRIGHT", GVAR.OptionsFrame.WidthTitle, "BOTTOMRIGHT", 0, 0)
  2184. GVAR.OptionsFrame.WidthTitle.Background:SetColorTexture(0, 0, 0, 0)
  2185. TEMPLATE.Slider(GVAR.OptionsFrame.WidthSlider, 180, 5, 50, 300, BattlegroundTargets_Options[fraction].ButtonWidth[currentSize],
  2186. function(self, value)
  2187. if value == BattlegroundTargets_Options[fraction].ButtonWidth[currentSize] then return end
  2188. BattlegroundTargets_Options[fraction].ButtonWidth[currentSize] = value
  2189. GVAR.OptionsFrame.WidthValue:SetText(value)
  2190. BattlegroundTargets:EnableConfigMode()
  2191. end,
  2192. "blank")
  2193. GVAR.OptionsFrame.WidthSlider:SetPoint("LEFT", GVAR.OptionsFrame.WidthTitle, "RIGHT", 20, 0)
  2194. GVAR.OptionsFrame.WidthValue:SetHeight(20)
  2195. GVAR.OptionsFrame.WidthValue:SetPoint("LEFT", GVAR.OptionsFrame.WidthSlider, "RIGHT", 5, 0)
  2196. GVAR.OptionsFrame.WidthValue:SetJustifyH("LEFT")
  2197. GVAR.OptionsFrame.WidthValue:SetText(BattlegroundTargets_Options[fraction].ButtonWidth[currentSize])
  2198. GVAR.OptionsFrame.WidthValue:SetTextColor(1, 1, 0.49, 1)
  2199.  
  2200. -- height
  2201. GVAR.OptionsFrame.HeightTitle = GVAR.OptionsFrame.ConfigBrackets:CreateFontString(nil, "ARTWORK", "GameFontNormalSmall")
  2202. GVAR.OptionsFrame.HeightSlider = CreateFrame("Slider", nil, GVAR.OptionsFrame.ConfigBrackets)
  2203. GVAR.OptionsFrame.HeightValue = GVAR.OptionsFrame.ConfigBrackets:CreateFontString(nil, "ARTWORK", "GameFontNormalSmall")
  2204. GVAR.OptionsFrame.HeightTitle:SetHeight(16)
  2205. GVAR.OptionsFrame.HeightTitle:SetPoint("LEFT", GVAR.OptionsFrame, "LEFT", 10, 0)
  2206. GVAR.OptionsFrame.HeightTitle:SetPoint("TOP", GVAR.OptionsFrame.WidthTitle, "BOTTOM", 0, -10)
  2207. GVAR.OptionsFrame.HeightTitle:SetJustifyH("LEFT")
  2208. GVAR.OptionsFrame.HeightTitle:SetText(L["Height"]..":")
  2209. GVAR.OptionsFrame.HeightTitle:SetTextColor(1, 1, 1, 1)
  2210. GVAR.OptionsFrame.HeightTitle.Background = GVAR.OptionsFrame.ConfigBrackets:CreateTexture(nil, "BACKGROUND")
  2211. GVAR.OptionsFrame.HeightTitle.Background:SetPoint("TOPLEFT", GVAR.OptionsFrame.HeightTitle, "TOPLEFT", 0, 0)
  2212. GVAR.OptionsFrame.HeightTitle.Background:SetPoint("BOTTOMRIGHT", GVAR.OptionsFrame.HeightTitle, "BOTTOMRIGHT", 0, 0)
  2213. GVAR.OptionsFrame.HeightTitle.Background:SetColorTexture(0, 0, 0, 0)
  2214. TEMPLATE.Slider(GVAR.OptionsFrame.HeightSlider, 180, 1, 10, 50, BattlegroundTargets_Options[fraction].ButtonHeight[currentSize],
  2215. function(self, value)
  2216. if value == BattlegroundTargets_Options[fraction].ButtonHeight[currentSize] then return end
  2217. BattlegroundTargets_Options[fraction].ButtonHeight[currentSize] = value
  2218. GVAR.OptionsFrame.HeightValue:SetText(value)
  2219. BattlegroundTargets:EnableConfigMode()
  2220. end,
  2221. "blank")
  2222. GVAR.OptionsFrame.HeightSlider:SetPoint("LEFT", GVAR.OptionsFrame.HeightTitle, "RIGHT", 20, 0)
  2223. GVAR.OptionsFrame.HeightValue:SetHeight(20)
  2224. GVAR.OptionsFrame.HeightValue:SetPoint("LEFT", GVAR.OptionsFrame.HeightSlider, "RIGHT", 5, 0)
  2225. GVAR.OptionsFrame.HeightValue:SetJustifyH("LEFT")
  2226. GVAR.OptionsFrame.HeightValue:SetText(BattlegroundTargets_Options[fraction].ButtonHeight[currentSize])
  2227. GVAR.OptionsFrame.HeightValue:SetTextColor(1, 1, 0.49, 1)
  2228.  
  2229. local equalTextWidthSliders, sw = 0, 0
  2230. sw = GVAR.OptionsFrame.ScaleTitle:GetStringWidth() if sw > equalTextWidthSliders then equalTextWidthSliders = sw end
  2231. sw = GVAR.OptionsFrame.WidthTitle:GetStringWidth() if sw > equalTextWidthSliders then equalTextWidthSliders = sw end
  2232. sw = GVAR.OptionsFrame.HeightTitle:GetStringWidth() if sw > equalTextWidthSliders then equalTextWidthSliders = sw end
  2233. GVAR.OptionsFrame.ScaleSlider:SetPoint("LEFT", GVAR.OptionsFrame.ScaleTitle, "LEFT", equalTextWidthSliders+10, 0)
  2234. GVAR.OptionsFrame.WidthSlider:SetPoint("LEFT", GVAR.OptionsFrame.WidthTitle, "LEFT", equalTextWidthSliders+10, 0)
  2235. GVAR.OptionsFrame.HeightSlider:SetPoint("LEFT", GVAR.OptionsFrame.HeightTitle, "LEFT", equalTextWidthSliders+10, 0)
  2236.  
  2237.  
  2238.  
  2239. -- DUMMY
  2240. GVAR.OptionsFrame.Dummy2 = GVAR.OptionsFrame.ConfigBrackets:CreateTexture(nil, "ARTWORK")
  2241. -- BOOM GVAR.OptionsFrame.Dummy2:SetWidth()
  2242. GVAR.OptionsFrame.Dummy2:SetHeight(1)
  2243. GVAR.OptionsFrame.Dummy2:SetPoint("LEFT", GVAR.OptionsFrame, "LEFT", 10, 0)
  2244. GVAR.OptionsFrame.Dummy2:SetPoint("TOP", GVAR.OptionsFrame.HeightTitle, "BOTTOM", 0, -8)
  2245. GVAR.OptionsFrame.Dummy2:SetColorTexture(0.73, 0.26, 0.21, 0.5)
  2246.  
  2247.  
  2248.  
  2249. -- sort by
  2250. local sortW = 0
  2251. GVAR.OptionsFrame.SortByTitle = GVAR.OptionsFrame.ConfigBrackets:CreateFontString(nil, "ARTWORK", "GameFontNormalSmall")
  2252. GVAR.OptionsFrame.SortByTitle:SetHeight(16)
  2253. GVAR.OptionsFrame.SortByTitle:SetPoint("LEFT", GVAR.OptionsFrame, "LEFT", 10, 0)
  2254. GVAR.OptionsFrame.SortByTitle:SetPoint("TOP", GVAR.OptionsFrame.Dummy2, "BOTTOM", 0, -8)
  2255. GVAR.OptionsFrame.SortByTitle:SetJustifyH("LEFT")
  2256. GVAR.OptionsFrame.SortByTitle:SetText(L["Sort By"]..":")
  2257. GVAR.OptionsFrame.SortByTitle:SetTextColor(1, 1, 1, 1)
  2258. GVAR.OptionsFrame.SortByTitle.Background = GVAR.OptionsFrame.ConfigBrackets:CreateTexture(nil, "BACKGROUND")
  2259. GVAR.OptionsFrame.SortByTitle.Background:SetPoint("TOPLEFT", GVAR.OptionsFrame.SortByTitle, "TOPLEFT", 0, 0)
  2260. GVAR.OptionsFrame.SortByTitle.Background:SetPoint("BOTTOMRIGHT", GVAR.OptionsFrame.SortByTitle, "BOTTOMRIGHT", 0, 0)
  2261. GVAR.OptionsFrame.SortByTitle.Background:SetColorTexture(0, 0, 0, 0)
  2262. sortW = sortW + 10 + GVAR.OptionsFrame.SortByTitle:GetStringWidth()
  2263.  
  2264. GVAR.OptionsFrame.SortByPullDown = CreateFrame("Button", nil, GVAR.OptionsFrame.ConfigBrackets)
  2265. TEMPLATE.PullDownMenu(
  2266. GVAR.OptionsFrame.SortByPullDown,
  2267. sortBy,
  2268. sortBy[ BattlegroundTargets_Options[fraction].ButtonSortBy[currentSize] ],
  2269. 0,
  2270. function(value) -- PDFUNC
  2271. BattlegroundTargets_Options[fraction].ButtonSortBy[currentSize] = value
  2272. BattlegroundTargets:EnableConfigMode()
  2273. end,
  2274. function(self, button) -- TODO check - potential bug port
  2275. GVAR.OptionsFrame.SortByPullDown.spookval = BattlegroundTargets_Options[fraction].ButtonSortBy[currentSize]
  2276. BattlegroundTargets_Options[fraction].ButtonSortBy[currentSize] = self.value1
  2277. BattlegroundTargets:EnableConfigMode()
  2278. end,
  2279. function(self, button) -- TODO check - potential bug port
  2280. BattlegroundTargets_Options[fraction].ButtonSortBy[currentSize] = GVAR.OptionsFrame.SortByPullDown.spookval or self.value1
  2281. BattlegroundTargets:EnableConfigMode()
  2282. end
  2283. )
  2284. GVAR.OptionsFrame.SortByPullDown:SetPoint("LEFT", GVAR.OptionsFrame.SortByTitle, "RIGHT", 10, 0)
  2285. GVAR.OptionsFrame.SortByPullDown:SetHeight(18)
  2286. TEMPLATE.EnablePullDownMenu(GVAR.OptionsFrame.SortByPullDown)
  2287. sortW = sortW + 10 + GVAR.OptionsFrame.SortByPullDown:GetWidth()
  2288.  
  2289. -- sort detail
  2290. GVAR.OptionsFrame.SortDetailPullDown = CreateFrame("Button", nil, GVAR.OptionsFrame.ConfigBrackets)
  2291. TEMPLATE.PullDownMenu(
  2292. GVAR.OptionsFrame.SortDetailPullDown,
  2293. sortDetail,
  2294. sortBy[ BattlegroundTargets_Options[fraction].ButtonSortDetail[currentSize] ],
  2295. 0,
  2296. function(value) -- PDFUNC
  2297. BattlegroundTargets_Options[fraction].ButtonSortDetail[currentSize] = value
  2298. BattlegroundTargets:EnableConfigMode()
  2299. end,
  2300. function(self, button) -- TODO check - potential bug port
  2301. GVAR.OptionsFrame.SortDetailPullDown.spookval = BattlegroundTargets_Options[fraction].ButtonSortDetail[currentSize]
  2302. BattlegroundTargets_Options[fraction].ButtonSortDetail[currentSize] = self.value1
  2303. BattlegroundTargets:EnableConfigMode()
  2304. end,
  2305. function(self, button) -- TODO check - potential bug port
  2306. BattlegroundTargets_Options[fraction].ButtonSortDetail[currentSize] = GVAR.OptionsFrame.SortDetailPullDown.spookval or self.value1
  2307. BattlegroundTargets:EnableConfigMode()
  2308. end
  2309. )
  2310. GVAR.OptionsFrame.SortDetailPullDown:SetPoint("LEFT", GVAR.OptionsFrame.SortByPullDown, "RIGHT", 10, 0)
  2311. GVAR.OptionsFrame.SortDetailPullDown:SetHeight(18)
  2312. TEMPLATE.EnablePullDownMenu(GVAR.OptionsFrame.SortDetailPullDown)
  2313. sortW = sortW + 10 + GVAR.OptionsFrame.SortDetailPullDown:GetWidth()
  2314.  
  2315. -- sort info
  2316. ----- text
  2317. local infoTxt1 = sortDetail[1]..":\n"
  2318. table_sort(class_IntegerSort, function(a, b) return a.loc < b.loc end)
  2319. for i = 1, #class_IntegerSort do
  2320. infoTxt1 = infoTxt1.." |cff"..classcolors[class_IntegerSort[i].cid].colorStr..class_IntegerSort[i].loc.."|r"
  2321. if i <= #class_IntegerSort then
  2322. infoTxt1 = infoTxt1.."\n"
  2323. end
  2324. end
  2325. local infoTxt2 = sortDetail[2]..":\n"
  2326. table_sort(class_IntegerSort, function(a, b) return a.eng < b.eng end)
  2327. for i = 1, #class_IntegerSort do
  2328. infoTxt2 = infoTxt2.." |cff"..classcolors[class_IntegerSort[i].cid].colorStr..class_IntegerSort[i].eng.." ("..class_IntegerSort[i].loc..")|r"
  2329. if i <= #class_IntegerSort then
  2330. infoTxt2 = infoTxt2.."\n"
  2331. end
  2332. end
  2333. local infoTxt3 = sortDetail[3]..":\n"
  2334. table_sort(class_IntegerSort, function(a, b) return a.blizz < b.blizz end)
  2335. for i = 1, #class_IntegerSort do
  2336. infoTxt3 = infoTxt3.." |cff"..classcolors[class_IntegerSort[i].cid].colorStr..class_IntegerSort[i].loc.."|r"
  2337. if i <= #class_IntegerSort then
  2338. infoTxt3 = infoTxt3.."\n"
  2339. end
  2340. end
  2341. ----- text
  2342. GVAR.OptionsFrame.SortInfo = CreateFrame("Button", nil, GVAR.OptionsFrame.ConfigBrackets)
  2343. GVAR.OptionsFrame.SortInfo:SetWidth(16)
  2344. GVAR.OptionsFrame.SortInfo:SetHeight(16)
  2345. GVAR.OptionsFrame.SortInfo:SetPoint("LEFT", GVAR.OptionsFrame.SortDetailPullDown, "RIGHT", 10, 0)
  2346. GVAR.OptionsFrame.SortInfo.Texture = GVAR.OptionsFrame.SortInfo:CreateTexture(nil, "ARTWORK")
  2347. GVAR.OptionsFrame.SortInfo.Texture:SetWidth(16)
  2348. GVAR.OptionsFrame.SortInfo.Texture:SetHeight(16)
  2349. GVAR.OptionsFrame.SortInfo.Texture:SetPoint("LEFT", 0, 0)
  2350. GVAR.OptionsFrame.SortInfo.Texture:SetTexture("Interface\\FriendsFrame\\InformationIcon")
  2351. GVAR.OptionsFrame.SortInfo.TextFrame = CreateFrame("Frame", nil, GVAR.OptionsFrame.SortInfo)
  2352. TEMPLATE.BorderTRBL(GVAR.OptionsFrame.SortInfo.TextFrame)
  2353. GVAR.OptionsFrame.SortInfo.TextFrame:SetToplevel(true)
  2354. GVAR.OptionsFrame.SortInfo.TextFrame:SetPoint("BOTTOM", GVAR.OptionsFrame.SortInfo.Texture, "TOP", 0, 0)
  2355. GVAR.OptionsFrame.SortInfo.TextFrame:Hide()
  2356. GVAR.OptionsFrame.SortInfo.Text1 = GVAR.OptionsFrame.SortInfo.TextFrame:CreateFontString(nil, "ARTWORK", "GameFontNormalSmall")
  2357. GVAR.OptionsFrame.SortInfo.Text1:SetPoint("TOPLEFT", GVAR.OptionsFrame.SortInfo.TextFrame, "TOPLEFT", 10, -10)
  2358. GVAR.OptionsFrame.SortInfo.Text1:SetJustifyH("LEFT")
  2359. GVAR.OptionsFrame.SortInfo.Text1:SetText(infoTxt1)
  2360. GVAR.OptionsFrame.SortInfo.Text1:SetTextColor(1, 1, 0.49, 1)
  2361. GVAR.OptionsFrame.SortInfo.Text2 = GVAR.OptionsFrame.SortInfo.TextFrame:CreateFontString(nil, "ARTWORK", "GameFontNormalSmall")
  2362. GVAR.OptionsFrame.SortInfo.Text2:SetPoint("LEFT", GVAR.OptionsFrame.SortInfo.Text1, "RIGHT", 0, 0)
  2363. GVAR.OptionsFrame.SortInfo.Text2:SetJustifyH("LEFT")
  2364. GVAR.OptionsFrame.SortInfo.Text2:SetText(infoTxt2)
  2365. GVAR.OptionsFrame.SortInfo.Text2:SetTextColor(1, 1, 0.49, 1)
  2366. GVAR.OptionsFrame.SortInfo.Text3 = GVAR.OptionsFrame.SortInfo.TextFrame:CreateFontString(nil, "ARTWORK", "GameFontNormalSmall")
  2367. GVAR.OptionsFrame.SortInfo.Text3:SetPoint("LEFT", GVAR.OptionsFrame.SortInfo.Text2, "RIGHT", 0, 0)
  2368. GVAR.OptionsFrame.SortInfo.Text3:SetJustifyH("LEFT")
  2369. GVAR.OptionsFrame.SortInfo.Text3:SetText(infoTxt3)
  2370. GVAR.OptionsFrame.SortInfo.Text3:SetTextColor(1, 1, 0.49, 1)
  2371. GVAR.OptionsFrame.SortInfo:SetScript("OnEnter", function() GVAR.OptionsFrame.SortInfo.TextFrame:Show() end)
  2372. GVAR.OptionsFrame.SortInfo:SetScript("OnLeave", function() GVAR.OptionsFrame.SortInfo.TextFrame:Hide() end)
  2373. -----
  2374. local txtWidth1 = GVAR.OptionsFrame.SortInfo.Text1:GetStringWidth()
  2375. local txtWidth2 = GVAR.OptionsFrame.SortInfo.Text2:GetStringWidth()
  2376. local txtWidth3 = GVAR.OptionsFrame.SortInfo.Text3:GetStringWidth()
  2377. GVAR.OptionsFrame.SortInfo.Text1:SetWidth(txtWidth1+10)
  2378. GVAR.OptionsFrame.SortInfo.Text2:SetWidth(txtWidth2+10)
  2379. GVAR.OptionsFrame.SortInfo.Text3:SetWidth(txtWidth3+10)
  2380. GVAR.OptionsFrame.SortInfo.TextFrame:SetWidth(10+ txtWidth1+10 + txtWidth2+10 + txtWidth3+10 +10)
  2381. local txtHeight = GVAR.OptionsFrame.SortInfo.Text1:GetStringHeight()
  2382. GVAR.OptionsFrame.SortInfo.Text1:SetHeight(txtHeight+10)
  2383. GVAR.OptionsFrame.SortInfo.Text2:SetHeight(txtHeight+10)
  2384. GVAR.OptionsFrame.SortInfo.Text3:SetHeight(txtHeight+10)
  2385. GVAR.OptionsFrame.SortInfo.TextFrame:SetHeight(10+ txtHeight+10 +10)
  2386. -----
  2387. sortW = sortW + 10 + 16 +10
  2388.  
  2389.  
  2390.  
  2391. -- DUMMY
  2392. GVAR.OptionsFrame.Dummy3 = GVAR.OptionsFrame.ConfigBrackets:CreateTexture(nil, "ARTWORK")
  2393. -- BOOM GVAR.OptionsFrame.Dummy3:SetWidth()
  2394. GVAR.OptionsFrame.Dummy3:SetHeight(1)
  2395. GVAR.OptionsFrame.Dummy3:SetPoint("LEFT", GVAR.OptionsFrame, "LEFT", 10, 0)
  2396. GVAR.OptionsFrame.Dummy3:SetPoint("TOP", GVAR.OptionsFrame.SortByTitle, "BOTTOM", 0, -8)
  2397. GVAR.OptionsFrame.Dummy3:SetColorTexture(0.8, 0.2, 0.2, 1)
  2398.  
  2399.  
  2400.  
  2401. -- layout
  2402. GVAR.OptionsFrame.LayoutTHText = GVAR.OptionsFrame.ConfigBrackets:CreateFontString(nil, "ARTWORK", "GameFontNormalSmall")
  2403. GVAR.OptionsFrame.LayoutTHText:SetHeight(16)
  2404. GVAR.OptionsFrame.LayoutTHText:SetPoint("LEFT", GVAR.OptionsFrame, "LEFT", 26, 0)
  2405. GVAR.OptionsFrame.LayoutTHText:SetPoint("TOP", GVAR.OptionsFrame.Dummy3, "BOTTOM", 0, -8)
  2406. GVAR.OptionsFrame.LayoutTHText:SetJustifyH("LEFT")
  2407. GVAR.OptionsFrame.LayoutTHText:SetText(L["Layout"]..":")
  2408. GVAR.OptionsFrame.LayoutTHText:SetTextColor(1, 1, 1, 1)
  2409. GVAR.OptionsFrame.LayoutTHText.Background = GVAR.OptionsFrame.ConfigBrackets:CreateTexture(nil, "BACKGROUND")
  2410. GVAR.OptionsFrame.LayoutTHText.Background:SetPoint("TOPLEFT", GVAR.OptionsFrame.LayoutTHText, "TOPLEFT", 0, 0)
  2411. GVAR.OptionsFrame.LayoutTHText.Background:SetPoint("BOTTOMRIGHT", GVAR.OptionsFrame.LayoutTHText, "BOTTOMRIGHT", 0, 0)
  2412. GVAR.OptionsFrame.LayoutTHText.Background:SetColorTexture(0, 0, 0, 0)
  2413.  
  2414. GVAR.OptionsFrame.LayoutTHx18 = CreateFrame("CheckButton", nil, GVAR.OptionsFrame.ConfigBrackets)
  2415. TEMPLATE.CheckButton(GVAR.OptionsFrame.LayoutTHx18, 16, 4, nil)
  2416. GVAR.OptionsFrame.LayoutTHx18:SetPoint("LEFT", GVAR.OptionsFrame.LayoutTHText, "RIGHT", 10, 0)
  2417. GVAR.OptionsFrame.LayoutTHx18:SetScript("OnClick", function()
  2418. BattlegroundTargets_Options[fraction].LayoutTH[currentSize] = 18
  2419. GVAR.OptionsFrame.LayoutTHx18:SetChecked(true)
  2420. GVAR.OptionsFrame.LayoutTHx24:SetChecked(false)
  2421. GVAR.OptionsFrame.LayoutTHx42:SetChecked(false)
  2422. GVAR.OptionsFrame.LayoutTHx81:SetChecked(false)
  2423. TEMPLATE.DisableSlider(GVAR.OptionsFrame.LayoutSpace)
  2424. BattlegroundTargets:SetupMainFrameLayout(fraction)
  2425. end)
  2426. GVAR.OptionsFrame.LayoutTHx24 = CreateFrame("CheckButton", nil, GVAR.OptionsFrame.ConfigBrackets)
  2427. TEMPLATE.CheckButton(GVAR.OptionsFrame.LayoutTHx24, 16, 4, nil)
  2428. GVAR.OptionsFrame.LayoutTHx24:SetPoint("LEFT", GVAR.OptionsFrame.LayoutTHx18, "RIGHT", 0, 0)
  2429. GVAR.OptionsFrame.LayoutTHx24:SetScript("OnClick", function()
  2430. BattlegroundTargets_Options[fraction].LayoutTH[currentSize] = 24
  2431. GVAR.OptionsFrame.LayoutTHx18:SetChecked(false)
  2432. GVAR.OptionsFrame.LayoutTHx24:SetChecked(true)
  2433. GVAR.OptionsFrame.LayoutTHx42:SetChecked(false)
  2434. GVAR.OptionsFrame.LayoutTHx81:SetChecked(false)
  2435. TEMPLATE.EnableSlider(GVAR.OptionsFrame.LayoutSpace)
  2436. BattlegroundTargets:SetupMainFrameLayout(fraction)
  2437. end)
  2438. GVAR.OptionsFrame.LayoutTHx42 = CreateFrame("CheckButton", nil, GVAR.OptionsFrame.ConfigBrackets)
  2439. TEMPLATE.CheckButton(GVAR.OptionsFrame.LayoutTHx42, 16, 4, nil)
  2440. GVAR.OptionsFrame.LayoutTHx42:SetPoint("LEFT", GVAR.OptionsFrame.LayoutTHx24, "RIGHT", 0, 0)
  2441. GVAR.OptionsFrame.LayoutTHx42:SetScript("OnClick", function()
  2442. BattlegroundTargets_Options[fraction].LayoutTH[currentSize] = 42
  2443. GVAR.OptionsFrame.LayoutTHx18:SetChecked(false)
  2444. GVAR.OptionsFrame.LayoutTHx24:SetChecked(false)
  2445. GVAR.OptionsFrame.LayoutTHx42:SetChecked(true)
  2446. GVAR.OptionsFrame.LayoutTHx81:SetChecked(false)
  2447. TEMPLATE.EnableSlider(GVAR.OptionsFrame.LayoutSpace)
  2448. BattlegroundTargets:SetupMainFrameLayout(fraction)
  2449. end)
  2450. GVAR.OptionsFrame.LayoutTHx81 = CreateFrame("CheckButton", nil, GVAR.OptionsFrame.ConfigBrackets)
  2451. TEMPLATE.CheckButton(GVAR.OptionsFrame.LayoutTHx81, 16, 4, nil)
  2452. GVAR.OptionsFrame.LayoutTHx81:SetPoint("LEFT", GVAR.OptionsFrame.LayoutTHx42, "RIGHT", 0, 0)
  2453. GVAR.OptionsFrame.LayoutTHx81:SetScript("OnClick", function()
  2454. BattlegroundTargets_Options[fraction].LayoutTH[currentSize] = 81
  2455. GVAR.OptionsFrame.LayoutTHx18:SetChecked(false)
  2456. GVAR.OptionsFrame.LayoutTHx24:SetChecked(false)
  2457. GVAR.OptionsFrame.LayoutTHx42:SetChecked(false)
  2458. GVAR.OptionsFrame.LayoutTHx81:SetChecked(true)
  2459. TEMPLATE.EnableSlider(GVAR.OptionsFrame.LayoutSpace)
  2460. BattlegroundTargets:SetupMainFrameLayout(fraction)
  2461. end)
  2462. GVAR.OptionsFrame.LayoutSpace = CreateFrame("Slider", nil, GVAR.OptionsFrame.ConfigBrackets)
  2463. GVAR.OptionsFrame.LayoutSpaceText = GVAR.OptionsFrame.ConfigBrackets:CreateFontString(nil, "ARTWORK", "GameFontNormalSmall")
  2464. TEMPLATE.Slider(GVAR.OptionsFrame.LayoutSpace, 100, 5, 0, 300, BattlegroundTargets_Options[fraction].LayoutSpace[currentSize],
  2465. function(self, value)
  2466. if value == BattlegroundTargets_Options[fraction].LayoutSpace[currentSize] then return end
  2467. BattlegroundTargets_Options[fraction].LayoutSpace[currentSize] = value
  2468. GVAR.OptionsFrame.LayoutSpaceText:SetText(value)
  2469. BattlegroundTargets:EnableConfigMode()
  2470. end,
  2471. "blank")
  2472. GVAR.OptionsFrame.LayoutSpace:SetPoint("LEFT", GVAR.OptionsFrame.LayoutTHx81, "RIGHT", 0, 0)
  2473. GVAR.OptionsFrame.LayoutSpaceText:SetHeight(20)
  2474. GVAR.OptionsFrame.LayoutSpaceText:SetPoint("LEFT", GVAR.OptionsFrame.LayoutSpace, "RIGHT", 5, 0)
  2475. GVAR.OptionsFrame.LayoutSpaceText:SetJustifyH("LEFT")
  2476. GVAR.OptionsFrame.LayoutSpaceText:SetText(BattlegroundTargets_Options[fraction].LayoutSpace[currentSize])
  2477. GVAR.OptionsFrame.LayoutSpaceText:SetTextColor(1, 1, 0.49, 1)
  2478. local layoutW = GVAR.OptionsFrame.LayoutTHText:GetStringWidth() + 10 +
  2479. GVAR.OptionsFrame.LayoutTHx18:GetWidth() + 0 +
  2480. GVAR.OptionsFrame.LayoutTHx24:GetWidth() + 0 +
  2481. GVAR.OptionsFrame.LayoutTHx42:GetWidth() + 0 +
  2482. GVAR.OptionsFrame.LayoutTHx81:GetWidth() + 0 +
  2483. GVAR.OptionsFrame.LayoutSpace:GetWidth() + 50
  2484.  
  2485.  
  2486.  
  2487. -- summary
  2488. GVAR.OptionsFrame.SummaryText = GVAR.OptionsFrame.ConfigBrackets:CreateFontString(nil, "ARTWORK", "GameFontNormalSmall")
  2489. GVAR.OptionsFrame.SummaryText:SetHeight(16)
  2490. GVAR.OptionsFrame.SummaryText:SetPoint("LEFT", GVAR.OptionsFrame, "LEFT", 26, 0)
  2491. GVAR.OptionsFrame.SummaryText:SetPoint("TOP", GVAR.OptionsFrame.LayoutTHText, "BOTTOM", 0, -10)
  2492. GVAR.OptionsFrame.SummaryText:SetJustifyH("LEFT")
  2493. GVAR.OptionsFrame.SummaryText:SetText(L["Summary"]..":")
  2494. GVAR.OptionsFrame.SummaryText:SetTextColor(1, 1, 1, 1)
  2495. GVAR.OptionsFrame.SummaryText.Background = GVAR.OptionsFrame.ConfigBrackets:CreateTexture(nil, "BACKGROUND")
  2496. GVAR.OptionsFrame.SummaryText.Background:SetPoint("TOPLEFT", GVAR.OptionsFrame.SummaryText, "TOPLEFT", 0, 0)
  2497. GVAR.OptionsFrame.SummaryText.Background:SetPoint("BOTTOMRIGHT", GVAR.OptionsFrame.SummaryText, "BOTTOMRIGHT", 0, 0)
  2498. GVAR.OptionsFrame.SummaryText.Background:SetColorTexture(0, 0, 0, 0)
  2499.  
  2500. GVAR.OptionsFrame.SummaryToggle = CreateFrame("CheckButton", nil, GVAR.OptionsFrame.ConfigBrackets) -- SUMMARY
  2501. TEMPLATE.CheckButton(GVAR.OptionsFrame.SummaryToggle, 16, 0, "")
  2502. GVAR.OptionsFrame.SummaryToggle:SetPoint("LEFT", GVAR.OptionsFrame.SummaryText, "RIGHT", 10, 0)
  2503. GVAR.OptionsFrame.SummaryToggle:SetChecked(BattlegroundTargets_Options[fraction].SummaryToggle[currentSize])
  2504. TEMPLATE.EnableCheckButton(GVAR.OptionsFrame.SummaryToggle)
  2505. GVAR.OptionsFrame.SummaryToggle:SetScript("OnClick", function()
  2506. BattlegroundTargets_Options[fraction].SummaryToggle[currentSize] = not BattlegroundTargets_Options[fraction].SummaryToggle[currentSize]
  2507. if BattlegroundTargets_Options[fraction].SummaryToggle[currentSize] then
  2508. TEMPLATE.EnableSlider(GVAR.OptionsFrame.SummaryScale)
  2509. TEMPLATE.EnableSlider(GVAR.OptionsFrame.SummaryPosition)
  2510. else
  2511. TEMPLATE.DisableSlider(GVAR.OptionsFrame.SummaryScale)
  2512. TEMPLATE.DisableSlider(GVAR.OptionsFrame.SummaryPosition)
  2513. end
  2514. ConfigFontNumberOptionCheck(currentSize)
  2515. BattlegroundTargets:EnableConfigMode()
  2516. end)
  2517.  
  2518. GVAR.OptionsFrame.SummaryScale = CreateFrame("Slider", nil, GVAR.OptionsFrame.ConfigBrackets)
  2519. GVAR.OptionsFrame.SummaryScaleText = GVAR.OptionsFrame.ConfigBrackets:CreateFontString(nil, "ARTWORK", "GameFontNormalSmall")
  2520. TEMPLATE.Slider(GVAR.OptionsFrame.SummaryScale, 85, 5, 40, 150, BattlegroundTargets_Options[fraction].SummaryScale[currentSize],
  2521. function(self, value)
  2522. local nvalue = value/100
  2523. if nvalue == BattlegroundTargets_Options[fraction].SummaryScale[currentSize] then return end
  2524. BattlegroundTargets_Options[fraction].SummaryScale[currentSize] = nvalue
  2525. GVAR.OptionsFrame.SummaryScaleText:SetText(value.."%")
  2526. BattlegroundTargets:EnableConfigMode()
  2527. end,
  2528. "blank")
  2529. GVAR.OptionsFrame.SummaryScale:SetPoint("LEFT", GVAR.OptionsFrame.SummaryToggle, "RIGHT", 10, 0)
  2530. GVAR.OptionsFrame.SummaryScaleText:SetHeight(16)
  2531. GVAR.OptionsFrame.SummaryScaleText:SetPoint("LEFT", GVAR.OptionsFrame.SummaryScale, "RIGHT", 5, 0)
  2532. GVAR.OptionsFrame.SummaryScaleText:SetJustifyH("LEFT")
  2533. GVAR.OptionsFrame.SummaryScaleText:SetText((BattlegroundTargets_Options[fraction].SummaryScale[currentSize]*100).."%")
  2534. GVAR.OptionsFrame.SummaryScaleText:SetTextColor(1, 1, 0.49, 1)
  2535.  
  2536. GVAR.OptionsFrame.SummaryPosition = CreateFrame("Slider", nil, GVAR.OptionsFrame.ConfigBrackets) -- SUMPOSi
  2537. GVAR.OptionsFrame.SummaryPositionText = GVAR.OptionsFrame.ConfigBrackets:CreateFontString(nil, "ARTWORK", "GameFontNormalSmall")
  2538. TEMPLATE.Slider(GVAR.OptionsFrame.SummaryPosition, 85, 1, 1, 9, BattlegroundTargets_Options[fraction].SummaryPos[currentSize],
  2539. function(self, value)
  2540. if value == BattlegroundTargets_Options[fraction].SummaryPos[currentSize] then return end
  2541. BattlegroundTargets_Options[fraction].SummaryPos[currentSize] = value
  2542. GVAR.OptionsFrame.SummaryPositionText:SetText(sumPos[ value ])
  2543. BattlegroundTargets:EnableConfigMode()
  2544. end,
  2545. "blank")
  2546. GVAR.OptionsFrame.SummaryPosition:SetPoint("LEFT", GVAR.OptionsFrame.SummaryScale, "RIGHT", 50, 0)
  2547. GVAR.OptionsFrame.SummaryPositionText:SetHeight(20)
  2548. GVAR.OptionsFrame.SummaryPositionText:SetWidth(50)
  2549. GVAR.OptionsFrame.SummaryPositionText:SetPoint("LEFT", GVAR.OptionsFrame.SummaryPosition, "RIGHT", 5, 0)
  2550. GVAR.OptionsFrame.SummaryPositionText:SetJustifyH("LEFT")
  2551. GVAR.OptionsFrame.SummaryPositionText:SetText(sumPos[ BattlegroundTargets_Options[fraction].SummaryPos[currentSize] ])
  2552. GVAR.OptionsFrame.SummaryPositionText:SetTextColor(1, 1, 0.49, 1)
  2553.  
  2554. if BattlegroundTargets_Options[fraction].SummaryToggle[currentSize] then
  2555. TEMPLATE.EnableSlider(GVAR.OptionsFrame.SummaryScale)
  2556. TEMPLATE.EnableSlider(GVAR.OptionsFrame.SummaryPosition)
  2557. else
  2558. TEMPLATE.DisableSlider(GVAR.OptionsFrame.SummaryScale)
  2559. TEMPLATE.DisableSlider(GVAR.OptionsFrame.SummaryPosition)
  2560. end
  2561. local summaryW = GVAR.OptionsFrame.SummaryText:GetStringWidth() + 10 +
  2562. GVAR.OptionsFrame.SummaryToggle:GetWidth() + 10 +
  2563. GVAR.OptionsFrame.SummaryScale:GetWidth() + 10 +
  2564. GVAR.OptionsFrame.SummaryPosition:GetWidth() + 50
  2565.  
  2566.  
  2567.  
  2568. -- DUMMY
  2569. GVAR.OptionsFrame.Dummy4 = GVAR.OptionsFrame.ConfigBrackets:CreateTexture(nil, "ARTWORK")
  2570. -- BOOM GVAR.OptionsFrame.Dummy4:SetWidth()
  2571. GVAR.OptionsFrame.Dummy4:SetHeight(1)
  2572. GVAR.OptionsFrame.Dummy4:SetPoint("LEFT", GVAR.OptionsFrame, "LEFT", 10, 0)
  2573. GVAR.OptionsFrame.Dummy4:SetPoint("TOP", GVAR.OptionsFrame.SummaryToggle, "BOTTOM", 0, -8)
  2574. GVAR.OptionsFrame.Dummy4:SetColorTexture(0.8, 0.2, 0.2, 1)
  2575.  
  2576.  
  2577.  
  2578. -- show role
  2579. GVAR.OptionsFrame.ShowRole = CreateFrame("CheckButton", nil, GVAR.OptionsFrame.ConfigBrackets)
  2580. TEMPLATE.CheckButton(GVAR.OptionsFrame.ShowRole, 16, 4, L["Role"])
  2581. GVAR.OptionsFrame.ShowRole:SetPoint("LEFT", GVAR.OptionsFrame, "LEFT", 10, 0)
  2582. GVAR.OptionsFrame.ShowRole:SetPoint("TOP", GVAR.OptionsFrame.Dummy4, "BOTTOM", 0, -8)
  2583. GVAR.OptionsFrame.ShowRole:SetChecked(BattlegroundTargets_Options[fraction].ButtonRoleToggle[currentSize])
  2584. GVAR.OptionsFrame.ShowRole:SetScript("OnClick", function()
  2585. BattlegroundTargets_Options[fraction].ButtonRoleToggle[currentSize] = not BattlegroundTargets_Options[fraction].ButtonRoleToggle[currentSize]
  2586. GVAR.OptionsFrame.ShowRole:SetChecked(BattlegroundTargets_Options[fraction].ButtonRoleToggle[currentSize])
  2587. BattlegroundTargets:EnableConfigMode()
  2588. end)
  2589.  
  2590. -- show spec
  2591. GVAR.OptionsFrame.ShowSpec = CreateFrame("CheckButton", nil, GVAR.OptionsFrame.ConfigBrackets)
  2592. TEMPLATE.CheckButton(GVAR.OptionsFrame.ShowSpec, 16, 4, L["Specialization"])
  2593. --GVAR.OptionsFrame.ShowSpec:SetPoint()
  2594. GVAR.OptionsFrame.ShowSpec:SetChecked(BattlegroundTargets_Options[fraction].ButtonSpecToggle[currentSize])
  2595. GVAR.OptionsFrame.ShowSpec:SetScript("OnClick", function()
  2596. BattlegroundTargets_Options[fraction].ButtonSpecToggle[currentSize] = not BattlegroundTargets_Options[fraction].ButtonSpecToggle[currentSize]
  2597. GVAR.OptionsFrame.ShowSpec:SetChecked(BattlegroundTargets_Options[fraction].ButtonSpecToggle[currentSize])
  2598. BattlegroundTargets:EnableConfigMode()
  2599. end)
  2600.  
  2601. -- class icon
  2602. GVAR.OptionsFrame.ClassIcon = CreateFrame("CheckButton", nil, GVAR.OptionsFrame.ConfigBrackets)
  2603. TEMPLATE.CheckButton(GVAR.OptionsFrame.ClassIcon, 16, 4, L["Class Icon"])
  2604. --GVAR.OptionsFrame.ClassIcon:SetPoint()
  2605. GVAR.OptionsFrame.ClassIcon:SetChecked(BattlegroundTargets_Options[fraction].ButtonClassToggle[currentSize])
  2606. GVAR.OptionsFrame.ClassIcon:SetScript("OnClick", function()
  2607. BattlegroundTargets_Options[fraction].ButtonClassToggle[currentSize] = not BattlegroundTargets_Options[fraction].ButtonClassToggle[currentSize]
  2608. GVAR.OptionsFrame.ClassIcon:SetChecked(BattlegroundTargets_Options[fraction].ButtonClassToggle[currentSize])
  2609. BattlegroundTargets:EnableConfigMode()
  2610. end)
  2611.  
  2612. -- show realm
  2613. GVAR.OptionsFrame.ShowRealm = CreateFrame("CheckButton", nil, GVAR.OptionsFrame.ConfigBrackets)
  2614. TEMPLATE.CheckButton(GVAR.OptionsFrame.ShowRealm, 16, 4, L["Realm"])
  2615. GVAR.OptionsFrame.ShowRealm:SetPoint("LEFT", GVAR.OptionsFrame, "LEFT", 10, 0)
  2616. GVAR.OptionsFrame.ShowRealm:SetPoint("TOP", GVAR.OptionsFrame.ShowRole, "BOTTOM", 0, -10)
  2617. GVAR.OptionsFrame.ShowRealm:SetChecked(BattlegroundTargets_Options[fraction].ButtonRealmToggle[currentSize])
  2618. GVAR.OptionsFrame.ShowRealm:SetScript("OnClick", function()
  2619. BattlegroundTargets_Options[fraction].ButtonRealmToggle[currentSize] = not BattlegroundTargets_Options[fraction].ButtonRealmToggle[currentSize]
  2620. GVAR.OptionsFrame.ShowRealm:SetChecked(BattlegroundTargets_Options[fraction].ButtonRealmToggle[currentSize])
  2621. BattlegroundTargets:EnableConfigMode()
  2622. end)
  2623.  
  2624. -- show leader
  2625. GVAR.OptionsFrame.ShowLeader = CreateFrame("CheckButton", nil, GVAR.OptionsFrame.ConfigBrackets)
  2626. TEMPLATE.CheckButton(GVAR.OptionsFrame.ShowLeader, 16, 4, L["Leader"])
  2627. --GVAR.OptionsFrame.ShowLeader:SetPoint()
  2628. GVAR.OptionsFrame.ShowLeader:SetChecked(BattlegroundTargets_Options[fraction].ButtonLeaderToggle[currentSize])
  2629. GVAR.OptionsFrame.ShowLeader:SetScript("OnClick", function()
  2630. BattlegroundTargets_Options[fraction].ButtonLeaderToggle[currentSize] = not BattlegroundTargets_Options[fraction].ButtonLeaderToggle[currentSize]
  2631. GVAR.OptionsFrame.ShowLeader:SetChecked(BattlegroundTargets_Options[fraction].ButtonLeaderToggle[currentSize])
  2632. BattlegroundTargets:EnableConfigMode()
  2633. end)
  2634.  
  2635. -- pvp trinket
  2636. GVAR.OptionsFrame.ShowPVPTrinket = CreateFrame("CheckButton", nil, GVAR.OptionsFrame.ConfigBrackets)
  2637. TEMPLATE.CheckButton(GVAR.OptionsFrame.ShowPVPTrinket, 16, 4, L["PvP Trinket"])
  2638. GVAR.OptionsFrame.ShowPVPTrinket:SetPoint("LEFT", GVAR.OptionsFrame, "LEFT", 10, 0)
  2639. GVAR.OptionsFrame.ShowPVPTrinket:SetPoint("TOP", GVAR.OptionsFrame.ShowRealm, "BOTTOM", 0, -10)
  2640. GVAR.OptionsFrame.ShowPVPTrinket:SetChecked(BattlegroundTargets_Options[fraction].ButtonPvPTrinketToggle[currentSize])
  2641. GVAR.OptionsFrame.ShowPVPTrinket:SetScript("OnClick", function()
  2642. BattlegroundTargets_Options[fraction].ButtonPvPTrinketToggle[currentSize] = not BattlegroundTargets_Options[fraction].ButtonPvPTrinketToggle[currentSize]
  2643. GVAR.OptionsFrame.ShowPVPTrinket:SetChecked(BattlegroundTargets_Options[fraction].ButtonPvPTrinketToggle[currentSize])
  2644. ConfigFontNumberOptionCheck(currentSize)
  2645. BattlegroundTargets:EnableConfigMode()
  2646. end)
  2647.  
  2648. -- targetcount friend
  2649. GVAR.OptionsFrame.ShowFTargetCount = CreateFrame("CheckButton", nil, GVAR.OptionsFrame.ConfigBrackets)
  2650. TEMPLATE.CheckButton(GVAR.OptionsFrame.ShowFTargetCount, 16, 4, L["Target Count"].." " ..L["Friend"])
  2651. --GVAR.OptionsFrame.ShowFTargetCount:SetPoint()
  2652. GVAR.OptionsFrame.ShowFTargetCount:SetChecked(BattlegroundTargets_Options[fraction].ButtonFTargetCountToggle[currentSize])
  2653. GVAR.OptionsFrame.ShowFTargetCount:SetScript("OnClick", function()
  2654. BattlegroundTargets_Options[fraction].ButtonFTargetCountToggle[currentSize] = not BattlegroundTargets_Options[fraction].ButtonFTargetCountToggle[currentSize]
  2655. GVAR.OptionsFrame.ShowFTargetCount:SetChecked(BattlegroundTargets_Options[fraction].ButtonFTargetCountToggle[currentSize])
  2656. ConfigFontNumberOptionCheck(currentSize)
  2657. BattlegroundTargets:EnableConfigMode()
  2658. end)
  2659.  
  2660. -- targetcount enemy
  2661. GVAR.OptionsFrame.ShowETargetCount = CreateFrame("CheckButton", nil, GVAR.OptionsFrame.ConfigBrackets)
  2662. TEMPLATE.CheckButton(GVAR.OptionsFrame.ShowETargetCount, 16, 4, L["Target Count"].." "..L["Enemy"])
  2663. --GVAR.OptionsFrame.ShowETargetCount:SetPoint()
  2664. GVAR.OptionsFrame.ShowETargetCount:SetChecked(BattlegroundTargets_Options[fraction].ButtonETargetCountToggle[currentSize])
  2665. GVAR.OptionsFrame.ShowETargetCount:SetScript("OnClick", function()
  2666. BattlegroundTargets_Options[fraction].ButtonETargetCountToggle[currentSize] = not BattlegroundTargets_Options[fraction].ButtonETargetCountToggle[currentSize]
  2667. GVAR.OptionsFrame.ShowETargetCount:SetChecked(BattlegroundTargets_Options[fraction].ButtonETargetCountToggle[currentSize])
  2668. ConfigFontNumberOptionCheck(currentSize)
  2669. BattlegroundTargets:EnableConfigMode()
  2670. end)
  2671.  
  2672. local eq1, sw = 0, 0
  2673. sw = GVAR.OptionsFrame.ShowRole:GetWidth() if sw > eq1 then eq1 = sw end
  2674. sw = GVAR.OptionsFrame.ShowRealm:GetWidth() if sw > eq1 then eq1 = sw end
  2675. sw = GVAR.OptionsFrame.ShowPVPTrinket:GetWidth() if sw > eq1 then eq1 = sw end
  2676. GVAR.OptionsFrame.ShowSpec:SetPoint("LEFT", GVAR.OptionsFrame.ShowRole, "LEFT", eq1+50, 0)
  2677. GVAR.OptionsFrame.ShowLeader:SetPoint("LEFT", GVAR.OptionsFrame.ShowRealm, "LEFT", eq1+50, 0)
  2678. GVAR.OptionsFrame.ShowFTargetCount:SetPoint("LEFT", GVAR.OptionsFrame.ShowPVPTrinket, "LEFT", eq1+50, 0)
  2679.  
  2680. local eq2, sw = 0, 0
  2681. sw = GVAR.OptionsFrame.ShowSpec:GetWidth() if sw > eq2 then eq2 = sw end
  2682. sw = GVAR.OptionsFrame.ShowLeader:GetWidth() if sw > eq2 then eq2 = sw end
  2683. sw = GVAR.OptionsFrame.ShowFTargetCount:GetWidth() if sw > eq2 then eq2 = sw end
  2684. GVAR.OptionsFrame.ClassIcon:SetPoint("LEFT", GVAR.OptionsFrame.ShowSpec, "LEFT", eq2+50, 0)
  2685. GVAR.OptionsFrame.ShowETargetCount:SetPoint("LEFT", GVAR.OptionsFrame.ShowFTargetCount, "LEFT", eq2+50, 0)
  2686.  
  2687. local eq3, sw = 0, 0
  2688. sw = GVAR.OptionsFrame.ClassIcon:GetWidth() if sw > eq3 then eq3 = sw end
  2689. sw = GVAR.OptionsFrame.ShowETargetCount:GetWidth() if sw > eq3 then eq3 = sw end
  2690.  
  2691. local generalIconW = 10 + eq1 + 50 + eq2 + 50 + eq3 + 10
  2692.  
  2693.  
  2694.  
  2695. -- DUMMY
  2696. GVAR.OptionsFrame.Dummy5 = GVAR.OptionsFrame.ConfigBrackets:CreateTexture(nil, "ARTWORK")
  2697. -- BOOM GVAR.OptionsFrame.Dummy5:SetWidth()
  2698. GVAR.OptionsFrame.Dummy5:SetHeight(1)
  2699. GVAR.OptionsFrame.Dummy5:SetPoint("LEFT", GVAR.OptionsFrame, "LEFT", 10, 0)
  2700. GVAR.OptionsFrame.Dummy5:SetPoint("TOP", GVAR.OptionsFrame.ShowFTargetCount, "BOTTOM", 0, -8)
  2701. GVAR.OptionsFrame.Dummy5:SetColorTexture(0.73, 0.26, 0.21, 0.5)
  2702.  
  2703.  
  2704.  
  2705. -- ----- icons ----------------------------------------
  2706. local equalTextWidthIcons = 0
  2707. -- show target indicator
  2708. GVAR.OptionsFrame.ShowTargetIndicator = CreateFrame("CheckButton", nil, GVAR.OptionsFrame.ConfigBrackets)
  2709. TEMPLATE.CheckButton(GVAR.OptionsFrame.ShowTargetIndicator, 16, 4, L["Target"])
  2710. GVAR.OptionsFrame.ShowTargetIndicator:SetPoint("LEFT", GVAR.OptionsFrame, "LEFT", 10, 0)
  2711. GVAR.OptionsFrame.ShowTargetIndicator:SetPoint("TOP", GVAR.OptionsFrame.Dummy5, "BOTTOM", 0, -8)
  2712. GVAR.OptionsFrame.ShowTargetIndicator:SetChecked(BattlegroundTargets_Options[fraction].ButtonTargetToggle[currentSize])
  2713. GVAR.OptionsFrame.ShowTargetIndicator:SetScript("OnClick", function()
  2714. BattlegroundTargets_Options[fraction].ButtonTargetToggle[currentSize] = not BattlegroundTargets_Options[fraction].ButtonTargetToggle[currentSize]
  2715. GVAR.OptionsFrame.ShowTargetIndicator:SetChecked(BattlegroundTargets_Options[fraction].ButtonTargetToggle[currentSize])
  2716. if BattlegroundTargets_Options[fraction].ButtonTargetToggle[currentSize] then
  2717. TEMPLATE.EnableSlider(GVAR.OptionsFrame.TargetScaleSlider)
  2718. TEMPLATE.EnableSlider(GVAR.OptionsFrame.TargetPositionSlider)
  2719. else
  2720. TEMPLATE.DisableSlider(GVAR.OptionsFrame.TargetScaleSlider)
  2721. TEMPLATE.DisableSlider(GVAR.OptionsFrame.TargetPositionSlider)
  2722. end
  2723. BattlegroundTargets:EnableConfigMode()
  2724. end)
  2725. local iw = GVAR.OptionsFrame.ShowTargetIndicator:GetWidth()
  2726. if iw > equalTextWidthIcons then
  2727. equalTextWidthIcons = iw
  2728. end
  2729.  
  2730. -- target indicator scale
  2731. GVAR.OptionsFrame.TargetScaleSlider = CreateFrame("Slider", nil, GVAR.OptionsFrame.ConfigBrackets)
  2732. GVAR.OptionsFrame.TargetScaleSliderText = GVAR.OptionsFrame.ConfigBrackets:CreateFontString(nil, "ARTWORK", "GameFontNormalSmall")
  2733. TEMPLATE.Slider(GVAR.OptionsFrame.TargetScaleSlider, 85, 10, 100, 200, BattlegroundTargets_Options[fraction].ButtonTargetScale[currentSize]*100,
  2734. function(self, value)
  2735. local nvalue = value/100
  2736. if nvalue == BattlegroundTargets_Options[fraction].ButtonTargetScale[currentSize] then return end
  2737. BattlegroundTargets_Options[fraction].ButtonTargetScale[currentSize] = nvalue
  2738. GVAR.OptionsFrame.TargetScaleSliderText:SetText(value.."%")
  2739. BattlegroundTargets:EnableConfigMode()
  2740. end,
  2741. "blank")
  2742. GVAR.OptionsFrame.TargetScaleSlider:SetPoint("LEFT", GVAR.OptionsFrame.ShowTargetIndicator, "RIGHT", 10, 0)
  2743. GVAR.OptionsFrame.TargetScaleSliderText:SetHeight(20)
  2744. GVAR.OptionsFrame.TargetScaleSliderText:SetPoint("LEFT", GVAR.OptionsFrame.TargetScaleSlider, "RIGHT", 5, 0)
  2745. GVAR.OptionsFrame.TargetScaleSliderText:SetJustifyH("LEFT")
  2746. GVAR.OptionsFrame.TargetScaleSliderText:SetText((BattlegroundTargets_Options[fraction].ButtonTargetScale[currentSize]*100).."%")
  2747. GVAR.OptionsFrame.TargetScaleSliderText:SetTextColor(1, 1, 0.49, 1)
  2748.  
  2749. -- target indicator position
  2750. GVAR.OptionsFrame.TargetPositionSlider = CreateFrame("Slider", nil, GVAR.OptionsFrame.ConfigBrackets)
  2751. GVAR.OptionsFrame.TargetPositionSliderText = GVAR.OptionsFrame.ConfigBrackets:CreateFontString(nil, "ARTWORK", "GameFontNormalSmall")
  2752. TEMPLATE.Slider(GVAR.OptionsFrame.TargetPositionSlider, 85, 5, 0, 100, BattlegroundTargets_Options[fraction].ButtonTargetPosition[currentSize],
  2753. function(self, value)
  2754. if value == BattlegroundTargets_Options[fraction].ButtonTargetPosition[currentSize] then return end
  2755. BattlegroundTargets_Options[fraction].ButtonTargetPosition[currentSize] = value
  2756. GVAR.OptionsFrame.TargetPositionSliderText:SetText(value)
  2757. BattlegroundTargets:EnableConfigMode()
  2758. end,
  2759. "blank")
  2760. GVAR.OptionsFrame.TargetPositionSlider:SetPoint("LEFT", GVAR.OptionsFrame.TargetScaleSlider, "RIGHT", 50, 0)
  2761. GVAR.OptionsFrame.TargetPositionSliderText:SetHeight(20)
  2762. GVAR.OptionsFrame.TargetPositionSliderText:SetPoint("LEFT", GVAR.OptionsFrame.TargetPositionSlider, "RIGHT", 5, 0)
  2763. GVAR.OptionsFrame.TargetPositionSliderText:SetJustifyH("LEFT")
  2764. GVAR.OptionsFrame.TargetPositionSliderText:SetText(BattlegroundTargets_Options[fraction].ButtonTargetPosition[currentSize])
  2765. GVAR.OptionsFrame.TargetPositionSliderText:SetTextColor(1, 1, 0.49, 1)
  2766.  
  2767. -- show targetoftarget
  2768. GVAR.OptionsFrame.TargetofTarget = CreateFrame("CheckButton", nil, GVAR.OptionsFrame.ConfigBrackets)
  2769. TEMPLATE.CheckButton(GVAR.OptionsFrame.TargetofTarget, 16, 4, L["Target of Target"])
  2770. GVAR.OptionsFrame.TargetofTarget:SetPoint("LEFT", GVAR.OptionsFrame, "LEFT", 10, 0)
  2771. GVAR.OptionsFrame.TargetofTarget:SetPoint("TOP", GVAR.OptionsFrame.ShowTargetIndicator, "BOTTOM", 0, -10)
  2772. GVAR.OptionsFrame.TargetofTarget:SetChecked(BattlegroundTargets_Options[fraction].ButtonToTToggle[currentSize])
  2773. GVAR.OptionsFrame.TargetofTarget:SetScript("OnClick", function()
  2774. BattlegroundTargets_Options[fraction].ButtonToTToggle[currentSize] = not BattlegroundTargets_Options[fraction].ButtonToTToggle[currentSize]
  2775. GVAR.OptionsFrame.TargetofTarget:SetChecked(BattlegroundTargets_Options[fraction].ButtonToTToggle[currentSize])
  2776. ConfigFontNumberOptionCheck(currentSize)
  2777. if BattlegroundTargets_Options[fraction].ButtonToTToggle[currentSize] then
  2778. TEMPLATE.EnableSlider(GVAR.OptionsFrame.ToTScaleSlider)
  2779. TEMPLATE.EnableSlider(GVAR.OptionsFrame.ToTPositionSlider)
  2780. else
  2781. TEMPLATE.DisableSlider(GVAR.OptionsFrame.ToTScaleSlider)
  2782. TEMPLATE.DisableSlider(GVAR.OptionsFrame.ToTPositionSlider)
  2783. end
  2784. BattlegroundTargets:EnableConfigMode()
  2785. end)
  2786. local iw = GVAR.OptionsFrame.TargetofTarget:GetWidth()
  2787. if iw > equalTextWidthIcons then
  2788. equalTextWidthIcons = iw
  2789. end
  2790.  
  2791. -- targetoftarget scale
  2792. GVAR.OptionsFrame.ToTScaleSlider = CreateFrame("Slider", nil, GVAR.OptionsFrame.ConfigBrackets)
  2793. GVAR.OptionsFrame.ToTScaleSliderText = GVAR.OptionsFrame.ConfigBrackets:CreateFontString(nil, "ARTWORK", "GameFontNormalSmall")
  2794. TEMPLATE.Slider(GVAR.OptionsFrame.ToTScaleSlider, 85, 10, 50, 100, BattlegroundTargets_Options[fraction].ButtonToTScale[currentSize]*100,
  2795. function(self, value)
  2796. local nvalue = value/100
  2797. if nvalue == BattlegroundTargets_Options[fraction].ButtonToTScale[currentSize] then return end
  2798. BattlegroundTargets_Options[fraction].ButtonToTScale[currentSize] = nvalue
  2799. GVAR.OptionsFrame.ToTScaleSliderText:SetText(value.."%")
  2800. BattlegroundTargets:EnableConfigMode()
  2801. end,
  2802. "blank")
  2803. GVAR.OptionsFrame.ToTScaleSlider:SetPoint("LEFT", GVAR.OptionsFrame.TargetofTarget, "RIGHT", 10, 0)
  2804. GVAR.OptionsFrame.ToTScaleSliderText:SetHeight(20)
  2805. GVAR.OptionsFrame.ToTScaleSliderText:SetPoint("LEFT", GVAR.OptionsFrame.ToTScaleSlider, "RIGHT", 5, 0)
  2806. GVAR.OptionsFrame.ToTScaleSliderText:SetJustifyH("LEFT")
  2807. GVAR.OptionsFrame.ToTScaleSliderText:SetText((BattlegroundTargets_Options[fraction].ButtonToTScale[currentSize]*100).."%")
  2808. GVAR.OptionsFrame.ToTScaleSliderText:SetTextColor(1, 1, 0.49, 1)
  2809.  
  2810. -- targetoftarget position
  2811. GVAR.OptionsFrame.ToTPositionSlider = CreateFrame("Slider", nil, GVAR.OptionsFrame.ConfigBrackets)
  2812. GVAR.OptionsFrame.ToTPositionSliderText = GVAR.OptionsFrame.ConfigBrackets:CreateFontString(nil, "ARTWORK", "GameFontNormalSmall")
  2813. TEMPLATE.Slider(GVAR.OptionsFrame.ToTPositionSlider, 85, 1, 1, 9, BattlegroundTargets_Options[fraction].ButtonToTPosition[currentSize],
  2814. function(self, value)
  2815. if value == BattlegroundTargets_Options[fraction].ButtonToTPosition[currentSize] then return end
  2816. BattlegroundTargets_Options[fraction].ButtonToTPosition[currentSize] = value
  2817. GVAR.OptionsFrame.ToTPositionSliderText:SetText(value)
  2818. BattlegroundTargets:EnableConfigMode()
  2819. end,
  2820. "blank")
  2821. GVAR.OptionsFrame.ToTPositionSlider:SetPoint("LEFT", GVAR.OptionsFrame.ToTScaleSlider, "RIGHT", 50, 0)
  2822. GVAR.OptionsFrame.ToTPositionSliderText:SetHeight(20)
  2823. GVAR.OptionsFrame.ToTPositionSliderText:SetPoint("LEFT", GVAR.OptionsFrame.ToTPositionSlider, "RIGHT", 5, 0)
  2824. GVAR.OptionsFrame.ToTPositionSliderText:SetJustifyH("LEFT")
  2825. GVAR.OptionsFrame.ToTPositionSliderText:SetText(BattlegroundTargets_Options[fraction].ButtonToTPosition[currentSize])
  2826. GVAR.OptionsFrame.ToTPositionSliderText:SetTextColor(1, 1, 0.49, 1)
  2827.  
  2828. -- show focus indicator
  2829. GVAR.OptionsFrame.ShowFocusIndicator = CreateFrame("CheckButton", nil, GVAR.OptionsFrame.ConfigBrackets)
  2830. TEMPLATE.CheckButton(GVAR.OptionsFrame.ShowFocusIndicator, 16, 4, L["Focus"])
  2831. GVAR.OptionsFrame.ShowFocusIndicator:SetPoint("LEFT", GVAR.OptionsFrame, "LEFT", 10, 0)
  2832. GVAR.OptionsFrame.ShowFocusIndicator:SetPoint("TOP", GVAR.OptionsFrame.TargetofTarget, "BOTTOM", 0, -10)
  2833. GVAR.OptionsFrame.ShowFocusIndicator:SetChecked(BattlegroundTargets_Options[fraction].ButtonFocusToggle[currentSize])
  2834. GVAR.OptionsFrame.ShowFocusIndicator:SetScript("OnClick", function()
  2835. BattlegroundTargets_Options[fraction].ButtonFocusToggle[currentSize] = not BattlegroundTargets_Options[fraction].ButtonFocusToggle[currentSize]
  2836. GVAR.OptionsFrame.ShowFocusIndicator:SetChecked(BattlegroundTargets_Options[fraction].ButtonFocusToggle[currentSize])
  2837. if BattlegroundTargets_Options[fraction].ButtonFocusToggle[currentSize] then
  2838. TEMPLATE.EnableSlider(GVAR.OptionsFrame.FocusScaleSlider)
  2839. TEMPLATE.EnableSlider(GVAR.OptionsFrame.FocusPositionSlider)
  2840. else
  2841. TEMPLATE.DisableSlider(GVAR.OptionsFrame.FocusScaleSlider)
  2842. TEMPLATE.DisableSlider(GVAR.OptionsFrame.FocusPositionSlider)
  2843. end
  2844. BattlegroundTargets:EnableConfigMode()
  2845. end)
  2846. local iw = GVAR.OptionsFrame.ShowFocusIndicator:GetWidth()
  2847. if iw > equalTextWidthIcons then
  2848. equalTextWidthIcons = iw
  2849. end
  2850.  
  2851. -- focus indicator scale
  2852. GVAR.OptionsFrame.FocusScaleSlider = CreateFrame("Slider", nil, GVAR.OptionsFrame.ConfigBrackets)
  2853. GVAR.OptionsFrame.FocusScaleSliderText = GVAR.OptionsFrame.ConfigBrackets:CreateFontString(nil, "ARTWORK", "GameFontNormalSmall")
  2854. TEMPLATE.Slider(GVAR.OptionsFrame.FocusScaleSlider, 85, 10, 100, 200, BattlegroundTargets_Options[fraction].ButtonFocusScale[currentSize]*100,
  2855. function(self, value)
  2856. local nvalue = value/100
  2857. if nvalue == BattlegroundTargets_Options[fraction].ButtonFocusScale[currentSize] then return end
  2858. BattlegroundTargets_Options[fraction].ButtonFocusScale[currentSize] = nvalue
  2859. GVAR.OptionsFrame.FocusScaleSliderText:SetText(value.."%")
  2860. BattlegroundTargets:EnableConfigMode()
  2861. end,
  2862. "blank")
  2863. GVAR.OptionsFrame.FocusScaleSlider:SetPoint("LEFT", GVAR.OptionsFrame.ShowFocusIndicator, "RIGHT", 10, 0)
  2864. GVAR.OptionsFrame.FocusScaleSliderText:SetHeight(20)
  2865. GVAR.OptionsFrame.FocusScaleSliderText:SetPoint("LEFT", GVAR.OptionsFrame.FocusScaleSlider, "RIGHT", 5, 0)
  2866. GVAR.OptionsFrame.FocusScaleSliderText:SetJustifyH("LEFT")
  2867. GVAR.OptionsFrame.FocusScaleSliderText:SetText((BattlegroundTargets_Options[fraction].ButtonFocusScale[currentSize]*100).."%")
  2868. GVAR.OptionsFrame.FocusScaleSliderText:SetTextColor(1, 1, 0.49, 1)
  2869.  
  2870. -- focus indicator position
  2871. GVAR.OptionsFrame.FocusPositionSlider = CreateFrame("Slider", nil, GVAR.OptionsFrame.ConfigBrackets)
  2872. GVAR.OptionsFrame.FocusPositionSliderText = GVAR.OptionsFrame.ConfigBrackets:CreateFontString(nil, "ARTWORK", "GameFontNormalSmall")
  2873. TEMPLATE.Slider(GVAR.OptionsFrame.FocusPositionSlider, 85, 5, 0, 100, BattlegroundTargets_Options[fraction].ButtonFocusPosition[currentSize],
  2874. function(self, value)
  2875. if value == BattlegroundTargets_Options[fraction].ButtonFocusPosition[currentSize] then return end
  2876. BattlegroundTargets_Options[fraction].ButtonFocusPosition[currentSize] = value
  2877. GVAR.OptionsFrame.FocusPositionSliderText:SetText(value)
  2878. BattlegroundTargets:EnableConfigMode()
  2879. end,
  2880. "blank")
  2881. GVAR.OptionsFrame.FocusPositionSlider:SetPoint("LEFT", GVAR.OptionsFrame.FocusScaleSlider, "RIGHT", 50, 0)
  2882. GVAR.OptionsFrame.FocusPositionSliderText:SetHeight(20)
  2883. GVAR.OptionsFrame.FocusPositionSliderText:SetPoint("LEFT", GVAR.OptionsFrame.FocusPositionSlider, "RIGHT", 5, 0)
  2884. GVAR.OptionsFrame.FocusPositionSliderText:SetJustifyH("LEFT")
  2885. GVAR.OptionsFrame.FocusPositionSliderText:SetText(BattlegroundTargets_Options[fraction].ButtonFocusPosition[currentSize])
  2886. GVAR.OptionsFrame.FocusPositionSliderText:SetTextColor(1, 1, 0.49, 1)
  2887.  
  2888. -- flag/orb
  2889. GVAR.OptionsFrame.ShowFlag = CreateFrame("CheckButton", nil, GVAR.OptionsFrame.ConfigBrackets)
  2890. TEMPLATE.CheckButton(GVAR.OptionsFrame.ShowFlag, 16, 4, L["Flag"])
  2891. GVAR.OptionsFrame.ShowFlag:SetPoint("LEFT", GVAR.OptionsFrame, "LEFT", 10, 0)
  2892. GVAR.OptionsFrame.ShowFlag:SetPoint("TOP", GVAR.OptionsFrame.ShowFocusIndicator, "BOTTOM", 0, -10)
  2893. GVAR.OptionsFrame.ShowFlag:SetChecked(BattlegroundTargets_Options[fraction].ButtonFlagToggle[currentSize])
  2894. TEMPLATE.EnableCheckButton(GVAR.OptionsFrame.ShowFlag)
  2895. GVAR.OptionsFrame.ShowFlag:SetScript("OnClick", function()
  2896. BattlegroundTargets_Options[fraction].ButtonFlagToggle[currentSize] = not BattlegroundTargets_Options[fraction].ButtonFlagToggle[currentSize]
  2897. if BattlegroundTargets_Options[fraction].ButtonFlagToggle[currentSize] then
  2898. TEMPLATE.EnableSlider(GVAR.OptionsFrame.FlagScaleSlider)
  2899. TEMPLATE.EnableSlider(GVAR.OptionsFrame.FlagPositionSlider)
  2900. GVAR.OptionsFrame.CarrierSwitchEnableFunc()
  2901. else
  2902. TEMPLATE.DisableSlider(GVAR.OptionsFrame.FlagScaleSlider)
  2903. TEMPLATE.DisableSlider(GVAR.OptionsFrame.FlagPositionSlider)
  2904. GVAR.OptionsFrame.CarrierSwitchDisableFunc()
  2905. end
  2906. ConfigFontNumberOptionCheck(currentSize)
  2907. BattlegroundTargets:EnableConfigMode()
  2908. end)
  2909.  
  2910. -- flag
  2911. GVAR.OptionsFrame.CarrierSwitchFlag = CreateFrame("Button", nil, GVAR.OptionsFrame.ConfigBrackets)
  2912. GVAR.OptionsFrame.CarrierSwitchFlag:SetWidth(32)
  2913. GVAR.OptionsFrame.CarrierSwitchFlag:SetHeight(32)
  2914. GVAR.OptionsFrame.CarrierSwitchFlag:SetPoint("LEFT", GVAR.OptionsFrame.ShowFlag, "RIGHT", 0, 0)
  2915. GVAR.OptionsFrame.CarrierSwitchFlag.BG = GVAR.OptionsFrame.CarrierSwitchFlag:CreateTexture(nil, "BORDER")
  2916. GVAR.OptionsFrame.CarrierSwitchFlag.BG:SetWidth(27)
  2917. GVAR.OptionsFrame.CarrierSwitchFlag.BG:SetHeight(27)
  2918. GVAR.OptionsFrame.CarrierSwitchFlag.BG:SetPoint("CENTER", 0, 0)
  2919. GVAR.OptionsFrame.CarrierSwitchFlag.BG:SetColorTexture(0, 0, 0, 1)
  2920. GVAR.OptionsFrame.CarrierSwitchFlag.Texture = GVAR.OptionsFrame.CarrierSwitchFlag:CreateTexture(nil, "OVERLAY")
  2921. GVAR.OptionsFrame.CarrierSwitchFlag.Texture:SetWidth(30)
  2922. GVAR.OptionsFrame.CarrierSwitchFlag.Texture:SetHeight(30)
  2923. GVAR.OptionsFrame.CarrierSwitchFlag.Texture:SetPoint("CENTER", 0, 0)
  2924. GVAR.OptionsFrame.CarrierSwitchFlag.Texture:SetTexture(Textures.flagTexture)
  2925. GVAR.OptionsFrame.CarrierSwitchFlag:SetScript("OnEnter", function(self)
  2926. if testData.CarrierDisplay == "flag" then return end
  2927. GVAR.OptionsFrame.CarrierSwitchFlag.isDisplay = testData.CarrierDisplay
  2928. testData.CarrierDisplay = "flag"
  2929. BattlegroundTargets:EnableConfigMode()
  2930. GVAR.OptionsFrame.CarrierSwitchFlag.BG:SetColorTexture(0.12, 0.12, 0.12, 1)
  2931. end)
  2932. GVAR.OptionsFrame.CarrierSwitchFlag:SetScript("OnLeave", function(self)
  2933. if GVAR.OptionsFrame.CarrierSwitchFlag.isDisplay ~= testData.CarrierDisplay then
  2934. testData.CarrierDisplay = GVAR.OptionsFrame.CarrierSwitchFlag.isDisplay
  2935. BattlegroundTargets:EnableConfigMode()
  2936. end
  2937. if testData.CarrierDisplay == "flag" then return end
  2938. GVAR.OptionsFrame.CarrierSwitchFlag.BG:SetColorTexture(0, 0, 0, 1)
  2939. end)
  2940. GVAR.OptionsFrame.CarrierSwitchFlag:SetScript("OnMouseDown", function()
  2941. if GVAR.OptionsFrame.CarrierSwitchFlag.isDisplay == "flag" then return end
  2942. GVAR.OptionsFrame.CarrierSwitchFlag.BG:SetSize(25,25)
  2943. GVAR.OptionsFrame.CarrierSwitchFlag.Texture:SetSize(28,28)
  2944. end)
  2945. GVAR.OptionsFrame.CarrierSwitchFlag:SetScript("OnMouseUp", function()
  2946. if GVAR.OptionsFrame.CarrierSwitchFlag.isDisplay == "flag" then return end
  2947. GVAR.OptionsFrame.CarrierSwitchFlag.BG:SetSize(27,27)
  2948. GVAR.OptionsFrame.CarrierSwitchFlag.Texture:SetSize(30,30)
  2949. end)
  2950. GVAR.OptionsFrame.CarrierSwitchFlag:SetScript("OnClick", function()
  2951. if GVAR.OptionsFrame.CarrierSwitchFlag.isDisplay == "flag" then return end
  2952. testData.CarrierDisplay = "flag"
  2953. GVAR.OptionsFrame.CarrierSwitchFlag.isDisplay = "flag"
  2954. GVAR.OptionsFrame.CarrierSwitchFlag.BG:SetColorTexture(0.12, 0.12, 0.12, 1)
  2955. GVAR.OptionsFrame.CarrierSwitchOrb.BG:SetColorTexture(0, 0, 0, 1)
  2956. GVAR.OptionsFrame.CarrierSwitchCart.BG:SetColorTexture(0, 0, 0, 1)
  2957. BattlegroundTargets:EnableConfigMode()
  2958. end)
  2959. -- flag
  2960.  
  2961. -- orb
  2962. GVAR.OptionsFrame.CarrierSwitchOrb = CreateFrame("Button", nil, GVAR.OptionsFrame.ConfigBrackets)
  2963. GVAR.OptionsFrame.CarrierSwitchOrb:SetWidth(32)
  2964. GVAR.OptionsFrame.CarrierSwitchOrb:SetHeight(32)
  2965. GVAR.OptionsFrame.CarrierSwitchOrb:SetPoint("LEFT", GVAR.OptionsFrame.CarrierSwitchFlag, "RIGHT", 0, 0)
  2966. GVAR.OptionsFrame.CarrierSwitchOrb.BG = GVAR.OptionsFrame.CarrierSwitchOrb:CreateTexture(nil, "BORDER")
  2967. GVAR.OptionsFrame.CarrierSwitchOrb.BG:SetWidth(27)
  2968. GVAR.OptionsFrame.CarrierSwitchOrb.BG:SetHeight(27)
  2969. GVAR.OptionsFrame.CarrierSwitchOrb.BG:SetPoint("CENTER", 0, 0)
  2970. GVAR.OptionsFrame.CarrierSwitchOrb.BG:SetColorTexture(0, 0, 0, 1)
  2971. GVAR.OptionsFrame.CarrierSwitchOrb.Texture = GVAR.OptionsFrame.CarrierSwitchOrb:CreateTexture(nil, "OVERLAY")
  2972. GVAR.OptionsFrame.CarrierSwitchOrb.Texture:SetWidth(30)
  2973. GVAR.OptionsFrame.CarrierSwitchOrb.Texture:SetHeight(30)
  2974. GVAR.OptionsFrame.CarrierSwitchOrb.Texture:SetPoint("CENTER", 0, 0)
  2975. GVAR.OptionsFrame.CarrierSwitchOrb.Texture:SetTexture("Interface\\MiniMap\\TempleofKotmogu_ball_orange")
  2976. GVAR.OptionsFrame.CarrierSwitchOrb:SetScript("OnEnter", function(self)
  2977. if testData.CarrierDisplay == "orb" then return end
  2978. GVAR.OptionsFrame.CarrierSwitchFlag.isDisplay = testData.CarrierDisplay
  2979. testData.CarrierDisplay = "orb"
  2980. BattlegroundTargets:EnableConfigMode()
  2981. GVAR.OptionsFrame.CarrierSwitchOrb.BG:SetColorTexture(0.12, 0.12, 0.12, 1)
  2982. end)
  2983. GVAR.OptionsFrame.CarrierSwitchOrb:SetScript("OnLeave", function(self)
  2984. if GVAR.OptionsFrame.CarrierSwitchFlag.isDisplay ~= testData.CarrierDisplay then
  2985. testData.CarrierDisplay = GVAR.OptionsFrame.CarrierSwitchFlag.isDisplay
  2986. BattlegroundTargets:EnableConfigMode()
  2987. end
  2988. if testData.CarrierDisplay == "orb" then return end
  2989. GVAR.OptionsFrame.CarrierSwitchOrb.BG:SetColorTexture(0, 0, 0, 1)
  2990. end)
  2991. GVAR.OptionsFrame.CarrierSwitchOrb:SetScript("OnMouseDown", function()
  2992. if GVAR.OptionsFrame.CarrierSwitchFlag.isDisplay == "orb" then return end
  2993. GVAR.OptionsFrame.CarrierSwitchOrb.BG:SetSize(25,25)
  2994. GVAR.OptionsFrame.CarrierSwitchOrb.Texture:SetSize(28,28)
  2995. end)
  2996. GVAR.OptionsFrame.CarrierSwitchOrb:SetScript("OnMouseUp", function()
  2997. if GVAR.OptionsFrame.CarrierSwitchFlag.isDisplay == "orb" then return end
  2998. GVAR.OptionsFrame.CarrierSwitchOrb.BG:SetSize(27,27)
  2999. GVAR.OptionsFrame.CarrierSwitchOrb.Texture:SetSize(30,30)
  3000. end)
  3001. GVAR.OptionsFrame.CarrierSwitchOrb:SetScript("OnClick", function()
  3002. if GVAR.OptionsFrame.CarrierSwitchFlag.isDisplay == "orb" then return end
  3003. testData.CarrierDisplay = "orb"
  3004. GVAR.OptionsFrame.CarrierSwitchFlag.isDisplay = "orb"
  3005. GVAR.OptionsFrame.CarrierSwitchFlag.BG:SetColorTexture(0, 0, 0, 1)
  3006. GVAR.OptionsFrame.CarrierSwitchOrb.BG:SetColorTexture(0.12, 0.12, 0.12, 1)
  3007. GVAR.OptionsFrame.CarrierSwitchCart.BG:SetColorTexture(0, 0, 0, 1)
  3008. BattlegroundTargets:EnableConfigMode()
  3009. end)
  3010. -- orb
  3011.  
  3012. -- cart
  3013. GVAR.OptionsFrame.CarrierSwitchCart = CreateFrame("Button", nil, GVAR.OptionsFrame.ConfigBrackets)
  3014. GVAR.OptionsFrame.CarrierSwitchCart:SetWidth(32)
  3015. GVAR.OptionsFrame.CarrierSwitchCart:SetHeight(32)
  3016. GVAR.OptionsFrame.CarrierSwitchCart:SetPoint("LEFT", GVAR.OptionsFrame.CarrierSwitchOrb, "RIGHT", 0, 0)
  3017. GVAR.OptionsFrame.CarrierSwitchCart.BG = GVAR.OptionsFrame.CarrierSwitchCart:CreateTexture(nil, "BORDER")
  3018. GVAR.OptionsFrame.CarrierSwitchCart.BG:SetWidth(27)
  3019. GVAR.OptionsFrame.CarrierSwitchCart.BG:SetHeight(27)
  3020. GVAR.OptionsFrame.CarrierSwitchCart.BG:SetPoint("CENTER", 0, 0)
  3021. GVAR.OptionsFrame.CarrierSwitchCart.BG:SetColorTexture(0, 0, 0, 1)
  3022. GVAR.OptionsFrame.CarrierSwitchCart.Texture = GVAR.OptionsFrame.CarrierSwitchCart:CreateTexture(nil, "OVERLAY")
  3023. GVAR.OptionsFrame.CarrierSwitchCart.Texture:SetWidth(30)
  3024. GVAR.OptionsFrame.CarrierSwitchCart.Texture:SetHeight(30)
  3025. GVAR.OptionsFrame.CarrierSwitchCart.Texture:SetPoint("CENTER", 0, 0)
  3026. GVAR.OptionsFrame.CarrierSwitchCart.Texture:SetTexture(Textures.cartTexture)
  3027. GVAR.OptionsFrame.CarrierSwitchCart:SetScript("OnEnter", function(self)
  3028. if testData.CarrierDisplay == "cart" then return end
  3029. GVAR.OptionsFrame.CarrierSwitchFlag.isDisplay = testData.CarrierDisplay
  3030. testData.CarrierDisplay = "cart"
  3031. BattlegroundTargets:EnableConfigMode()
  3032. GVAR.OptionsFrame.CarrierSwitchCart.BG:SetColorTexture(0.12, 0.12, 0.12, 1)
  3033. end)
  3034. GVAR.OptionsFrame.CarrierSwitchCart:SetScript("OnLeave", function(self)
  3035. if GVAR.OptionsFrame.CarrierSwitchFlag.isDisplay ~= testData.CarrierDisplay then
  3036. testData.CarrierDisplay = GVAR.OptionsFrame.CarrierSwitchFlag.isDisplay
  3037. BattlegroundTargets:EnableConfigMode()
  3038. end
  3039. if testData.CarrierDisplay == "cart" then return end
  3040. GVAR.OptionsFrame.CarrierSwitchCart.BG:SetColorTexture(0, 0, 0, 1)
  3041. end)
  3042. GVAR.OptionsFrame.CarrierSwitchCart:SetScript("OnMouseDown", function()
  3043. if GVAR.OptionsFrame.CarrierSwitchFlag.isDisplay == "cart" then return end
  3044. GVAR.OptionsFrame.CarrierSwitchCart.BG:SetSize(25,25)
  3045. GVAR.OptionsFrame.CarrierSwitchCart.Texture:SetSize(28,28)
  3046. end)
  3047. GVAR.OptionsFrame.CarrierSwitchCart:SetScript("OnMouseUp", function()
  3048. if GVAR.OptionsFrame.CarrierSwitchFlag.isDisplay == "cart" then return end
  3049. GVAR.OptionsFrame.CarrierSwitchCart.BG:SetSize(27,27)
  3050. GVAR.OptionsFrame.CarrierSwitchCart.Texture:SetSize(30,30)
  3051. end)
  3052. GVAR.OptionsFrame.CarrierSwitchCart:SetScript("OnClick", function()
  3053. if GVAR.OptionsFrame.CarrierSwitchFlag.isDisplay == "cart" then return end
  3054. testData.CarrierDisplay = "cart"
  3055. GVAR.OptionsFrame.CarrierSwitchFlag.isDisplay = "cart"
  3056. GVAR.OptionsFrame.CarrierSwitchFlag.BG:SetColorTexture(0, 0, 0, 1)
  3057. GVAR.OptionsFrame.CarrierSwitchOrb.BG:SetColorTexture(0, 0, 0, 1)
  3058. GVAR.OptionsFrame.CarrierSwitchCart.BG:SetColorTexture(0.12, 0.12, 0.12, 1)
  3059. BattlegroundTargets:EnableConfigMode()
  3060. end)
  3061. -- cart
  3062.  
  3063. if testData.CarrierDisplay == "flag" then
  3064. GVAR.OptionsFrame.CarrierSwitchFlag.isDisplay = "flag"
  3065. GVAR.OptionsFrame.CarrierSwitchFlag.BG:SetColorTexture(0.12, 0.12, 0.12, 1)
  3066. GVAR.OptionsFrame.CarrierSwitchOrb.BG:SetColorTexture(0, 0, 0, 1)
  3067. GVAR.OptionsFrame.CarrierSwitchCart.BG:SetColorTexture(0, 0, 0, 1)
  3068. elseif testData.CarrierDisplay == "orb" then
  3069. GVAR.OptionsFrame.CarrierSwitchFlag.isDisplay = "orb"
  3070. GVAR.OptionsFrame.CarrierSwitchFlag.BG:SetColorTexture(0, 0, 0, 1)
  3071. GVAR.OptionsFrame.CarrierSwitchOrb.BG:SetColorTexture(0.12, 0.12, 0.12, 1)
  3072. GVAR.OptionsFrame.CarrierSwitchCart.BG:SetColorTexture(0, 0, 0, 1)
  3073. elseif testData.CarrierDisplay == "cart" then
  3074. GVAR.OptionsFrame.CarrierSwitchFlag.isDisplay = "cart"
  3075. GVAR.OptionsFrame.CarrierSwitchFlag.BG:SetColorTexture(0, 0, 0, 1)
  3076. GVAR.OptionsFrame.CarrierSwitchOrb.BG:SetColorTexture(0, 0, 0, 1)
  3077. GVAR.OptionsFrame.CarrierSwitchCart.BG:SetColorTexture(0.12, 0.12, 0.12, 1)
  3078. end
  3079.  
  3080. GVAR.OptionsFrame.CarrierSwitchEnableFunc = function()
  3081. GVAR.OptionsFrame.CarrierSwitchFlag:EnableMouse(true)
  3082. GVAR.OptionsFrame.CarrierSwitchOrb:EnableMouse(true)
  3083. GVAR.OptionsFrame.CarrierSwitchCart:EnableMouse(true)
  3084. GVAR.OptionsFrame.CarrierSwitchFlag:Enable()
  3085. GVAR.OptionsFrame.CarrierSwitchOrb:Enable()
  3086. GVAR.OptionsFrame.CarrierSwitchCart:Enable()
  3087. Desaturation(GVAR.OptionsFrame.CarrierSwitchFlag.Texture, false)
  3088. Desaturation(GVAR.OptionsFrame.CarrierSwitchOrb.Texture, false)
  3089. Desaturation(GVAR.OptionsFrame.CarrierSwitchCart.Texture, false)
  3090. if testData.CarrierDisplay == "flag" then
  3091. GVAR.OptionsFrame.CarrierSwitchFlag.BG:SetColorTexture(0.12, 0.12, 0.12, 1)
  3092. GVAR.OptionsFrame.CarrierSwitchOrb.BG:SetColorTexture(0, 0, 0, 1)
  3093. GVAR.OptionsFrame.CarrierSwitchCart.BG:SetColorTexture(0, 0, 0, 1)
  3094. elseif testData.CarrierDisplay == "orb" then
  3095. GVAR.OptionsFrame.CarrierSwitchFlag.BG:SetColorTexture(0, 0, 0, 1)
  3096. GVAR.OptionsFrame.CarrierSwitchOrb.BG:SetColorTexture(0.12, 0.12, 0.12, 1)
  3097. GVAR.OptionsFrame.CarrierSwitchCart.BG:SetColorTexture(0, 0, 0, 1)
  3098. elseif testData.CarrierDisplay == "cart" then
  3099. GVAR.OptionsFrame.CarrierSwitchFlag.BG:SetColorTexture(0, 0, 0, 1)
  3100. GVAR.OptionsFrame.CarrierSwitchOrb.BG:SetColorTexture(0, 0, 0, 1)
  3101. GVAR.OptionsFrame.CarrierSwitchCart.BG:SetColorTexture(0.12, 0.12, 0.12, 1)
  3102. end
  3103. end
  3104.  
  3105. GVAR.OptionsFrame.CarrierSwitchDisableFunc = function()
  3106. GVAR.OptionsFrame.CarrierSwitchFlag:EnableMouse(false)
  3107. GVAR.OptionsFrame.CarrierSwitchOrb:EnableMouse(false)
  3108. GVAR.OptionsFrame.CarrierSwitchCart:EnableMouse(false)
  3109. GVAR.OptionsFrame.CarrierSwitchFlag:Disable()
  3110. GVAR.OptionsFrame.CarrierSwitchOrb:Disable()
  3111. GVAR.OptionsFrame.CarrierSwitchCart:Disable()
  3112. Desaturation(GVAR.OptionsFrame.CarrierSwitchFlag.Texture, true)
  3113. Desaturation(GVAR.OptionsFrame.CarrierSwitchOrb.Texture, true)
  3114. Desaturation(GVAR.OptionsFrame.CarrierSwitchCart.Texture, true)
  3115. GVAR.OptionsFrame.CarrierSwitchFlag.BG:SetColorTexture(0, 0, 0, 1)
  3116. GVAR.OptionsFrame.CarrierSwitchOrb.BG:SetColorTexture(0, 0, 0, 1)
  3117. GVAR.OptionsFrame.CarrierSwitchCart.BG:SetColorTexture(0, 0, 0, 1)
  3118. end
  3119.  
  3120. local iw = GVAR.OptionsFrame.ShowFlag:GetWidth() + 32 + 32 + 32
  3121. if iw > equalTextWidthIcons then
  3122. equalTextWidthIcons = iw
  3123. end
  3124.  
  3125. -- flag scale
  3126. GVAR.OptionsFrame.FlagScaleSlider = CreateFrame("Slider", nil, GVAR.OptionsFrame.ConfigBrackets)
  3127. GVAR.OptionsFrame.FlagScaleSliderText = GVAR.OptionsFrame.ConfigBrackets:CreateFontString(nil, "ARTWORK", "GameFontNormalSmall")
  3128. TEMPLATE.Slider(GVAR.OptionsFrame.FlagScaleSlider, 85, 10, 100, 200, BattlegroundTargets_Options[fraction].ButtonFlagScale[currentSize]*100,
  3129. function(self, value)
  3130. local nvalue = value/100
  3131. if nvalue == BattlegroundTargets_Options[fraction].ButtonFlagScale[currentSize] then return end
  3132. BattlegroundTargets_Options[fraction].ButtonFlagScale[currentSize] = nvalue
  3133. GVAR.OptionsFrame.FlagScaleSliderText:SetText(value.."%")
  3134. BattlegroundTargets:EnableConfigMode()
  3135. end,
  3136. "blank")
  3137. GVAR.OptionsFrame.FlagScaleSlider:SetPoint("LEFT", GVAR.OptionsFrame.ShowFlag, "RIGHT", 10, 0)
  3138. GVAR.OptionsFrame.FlagScaleSliderText:SetHeight(20)
  3139. GVAR.OptionsFrame.FlagScaleSliderText:SetPoint("LEFT", GVAR.OptionsFrame.FlagScaleSlider, "RIGHT", 5, 0)
  3140. GVAR.OptionsFrame.FlagScaleSliderText:SetJustifyH("LEFT")
  3141. GVAR.OptionsFrame.FlagScaleSliderText:SetText((BattlegroundTargets_Options[fraction].ButtonFlagScale[currentSize]*100).."%")
  3142. GVAR.OptionsFrame.FlagScaleSliderText:SetTextColor(1, 1, 0.49, 1)
  3143.  
  3144. -- flag position
  3145. GVAR.OptionsFrame.FlagPositionSlider = CreateFrame("Slider", nil, GVAR.OptionsFrame.ConfigBrackets)
  3146. GVAR.OptionsFrame.FlagPositionSliderText = GVAR.OptionsFrame.ConfigBrackets:CreateFontString(nil, "ARTWORK", "GameFontNormalSmall")
  3147. TEMPLATE.Slider(GVAR.OptionsFrame.FlagPositionSlider, 85, 5, 0, 100, BattlegroundTargets_Options[fraction].ButtonFlagPosition[currentSize],
  3148. function(self, value)
  3149. if value == BattlegroundTargets_Options[fraction].ButtonFlagPosition[currentSize] then return end
  3150. BattlegroundTargets_Options[fraction].ButtonFlagPosition[currentSize] = value
  3151. GVAR.OptionsFrame.FlagPositionSliderText:SetText(value)
  3152. BattlegroundTargets:EnableConfigMode()
  3153. end,
  3154. "blank")
  3155. GVAR.OptionsFrame.FlagPositionSlider:SetPoint("LEFT", GVAR.OptionsFrame.FlagScaleSlider, "RIGHT", 50, 0)
  3156. GVAR.OptionsFrame.FlagPositionSliderText:SetHeight(20)
  3157. GVAR.OptionsFrame.FlagPositionSliderText:SetPoint("LEFT", GVAR.OptionsFrame.FlagPositionSlider, "RIGHT", 5, 0)
  3158. GVAR.OptionsFrame.FlagPositionSliderText:SetJustifyH("LEFT")
  3159. GVAR.OptionsFrame.FlagPositionSliderText:SetText(BattlegroundTargets_Options[fraction].ButtonFlagPosition[currentSize])
  3160. GVAR.OptionsFrame.FlagPositionSliderText:SetTextColor(1, 1, 0.49, 1)
  3161.  
  3162. -- show assist
  3163. GVAR.OptionsFrame.ShowAssist = CreateFrame("CheckButton", nil, GVAR.OptionsFrame.ConfigBrackets)
  3164. TEMPLATE.CheckButton(GVAR.OptionsFrame.ShowAssist, 16, 4, L["Main Assist Target"])
  3165. GVAR.OptionsFrame.ShowAssist:SetPoint("LEFT", GVAR.OptionsFrame, "LEFT", 10, 0)
  3166. GVAR.OptionsFrame.ShowAssist:SetPoint("TOP", GVAR.OptionsFrame.ShowFlag, "BOTTOM", 0, -10)
  3167. GVAR.OptionsFrame.ShowAssist:SetChecked(BattlegroundTargets_Options[fraction].ButtonAssistToggle[currentSize])
  3168. TEMPLATE.EnableCheckButton(GVAR.OptionsFrame.ShowAssist)
  3169. GVAR.OptionsFrame.ShowAssist:SetScript("OnClick", function()
  3170. BattlegroundTargets_Options[fraction].ButtonAssistToggle[currentSize] = not BattlegroundTargets_Options[fraction].ButtonAssistToggle[currentSize]
  3171. if BattlegroundTargets_Options[fraction].ButtonAssistToggle[currentSize] then
  3172. TEMPLATE.EnableSlider(GVAR.OptionsFrame.AssistScaleSlider)
  3173. TEMPLATE.EnableSlider(GVAR.OptionsFrame.AssistPositionSlider)
  3174. else
  3175. TEMPLATE.DisableSlider(GVAR.OptionsFrame.AssistScaleSlider)
  3176. TEMPLATE.DisableSlider(GVAR.OptionsFrame.AssistPositionSlider)
  3177. end
  3178. BattlegroundTargets:EnableConfigMode()
  3179. end)
  3180. local iw = GVAR.OptionsFrame.ShowAssist:GetWidth()
  3181. if iw > equalTextWidthIcons then
  3182. equalTextWidthIcons = iw
  3183. end
  3184.  
  3185. -- assist scale
  3186. GVAR.OptionsFrame.AssistScaleSlider = CreateFrame("Slider", nil, GVAR.OptionsFrame.ConfigBrackets)
  3187. GVAR.OptionsFrame.AssistScaleSliderText = GVAR.OptionsFrame.ConfigBrackets:CreateFontString(nil, "ARTWORK", "GameFontNormalSmall")
  3188. TEMPLATE.Slider(GVAR.OptionsFrame.AssistScaleSlider, 85, 10, 100, 200, BattlegroundTargets_Options[fraction].ButtonAssistScale[currentSize]*100,
  3189. function(self, value)
  3190. local nvalue = value/100
  3191. if nvalue == BattlegroundTargets_Options[fraction].ButtonAssistScale[currentSize] then return end
  3192. BattlegroundTargets_Options[fraction].ButtonAssistScale[currentSize] = nvalue
  3193. GVAR.OptionsFrame.AssistScaleSliderText:SetText(value.."%")
  3194. BattlegroundTargets:EnableConfigMode()
  3195. end,
  3196. "blank")
  3197. GVAR.OptionsFrame.AssistScaleSlider:SetPoint("LEFT", GVAR.OptionsFrame.ShowAssist, "RIGHT", 10, 0)
  3198. GVAR.OptionsFrame.AssistScaleSliderText:SetHeight(20)
  3199. GVAR.OptionsFrame.AssistScaleSliderText:SetPoint("LEFT", GVAR.OptionsFrame.AssistScaleSlider, "RIGHT", 5, 0)
  3200. GVAR.OptionsFrame.AssistScaleSliderText:SetJustifyH("LEFT")
  3201. GVAR.OptionsFrame.AssistScaleSliderText:SetText((BattlegroundTargets_Options[fraction].ButtonAssistScale[currentSize]*100).."%")
  3202. GVAR.OptionsFrame.AssistScaleSliderText:SetTextColor(1, 1, 0.49, 1)
  3203.  
  3204. -- assist position
  3205. GVAR.OptionsFrame.AssistPositionSlider = CreateFrame("Slider", nil, GVAR.OptionsFrame.ConfigBrackets)
  3206. GVAR.OptionsFrame.AssistPositionSliderText = GVAR.OptionsFrame.ConfigBrackets:CreateFontString(nil, "ARTWORK", "GameFontNormalSmall")
  3207. TEMPLATE.Slider(GVAR.OptionsFrame.AssistPositionSlider, 85, 5, 0, 100, BattlegroundTargets_Options[fraction].ButtonAssistPosition[currentSize],
  3208. function(self, value)
  3209. if value == BattlegroundTargets_Options[fraction].ButtonAssistPosition[currentSize] then return end
  3210. BattlegroundTargets_Options[fraction].ButtonAssistPosition[currentSize] = value
  3211. GVAR.OptionsFrame.AssistPositionSliderText:SetText(value)
  3212. BattlegroundTargets:EnableConfigMode()
  3213. end,
  3214. "blank")
  3215. GVAR.OptionsFrame.AssistPositionSlider:SetPoint("LEFT", GVAR.OptionsFrame.AssistScaleSlider, "RIGHT", 50, 0)
  3216. GVAR.OptionsFrame.AssistPositionSliderText:SetHeight(20)
  3217. GVAR.OptionsFrame.AssistPositionSliderText:SetPoint("LEFT", GVAR.OptionsFrame.AssistPositionSlider, "RIGHT", 5, 0)
  3218. GVAR.OptionsFrame.AssistPositionSliderText:SetJustifyH("LEFT")
  3219. GVAR.OptionsFrame.AssistPositionSliderText:SetText(BattlegroundTargets_Options[fraction].ButtonAssistPosition[currentSize])
  3220. GVAR.OptionsFrame.AssistPositionSliderText:SetTextColor(1, 1, 0.49, 1)
  3221.  
  3222.  
  3223. GVAR.OptionsFrame.TargetScaleSlider:SetPoint("LEFT", GVAR.OptionsFrame.ShowTargetIndicator, "LEFT", equalTextWidthIcons+10, 0)
  3224. GVAR.OptionsFrame.ToTScaleSlider:SetPoint("LEFT", GVAR.OptionsFrame.TargetofTarget, "LEFT", equalTextWidthIcons+10, 0)
  3225. GVAR.OptionsFrame.FocusScaleSlider:SetPoint("LEFT", GVAR.OptionsFrame.ShowFocusIndicator, "LEFT", equalTextWidthIcons+10, 0)
  3226. GVAR.OptionsFrame.FlagScaleSlider:SetPoint("LEFT", GVAR.OptionsFrame.ShowFlag, "LEFT", equalTextWidthIcons+10, 0)
  3227. GVAR.OptionsFrame.AssistScaleSlider:SetPoint("LEFT", GVAR.OptionsFrame.ShowAssist, "LEFT", equalTextWidthIcons+10, 0)
  3228. local iconW = 10 + equalTextWidthIcons + 10 + GVAR.OptionsFrame.TargetScaleSlider:GetWidth() + 50 + GVAR.OptionsFrame.TargetPositionSlider:GetWidth() + 50
  3229. -- ----- icons ----------------------------------------
  3230.  
  3231.  
  3232.  
  3233. -- DUMMY
  3234. GVAR.OptionsFrame.Dummy6 = GVAR.OptionsFrame.ConfigBrackets:CreateTexture(nil, "ARTWORK")
  3235. -- BOOM GVAR.OptionsFrame.Dummy6:SetWidth()
  3236. GVAR.OptionsFrame.Dummy6:SetHeight(1)
  3237. GVAR.OptionsFrame.Dummy6:SetPoint("LEFT", GVAR.OptionsFrame, "LEFT", 10, 0)
  3238. GVAR.OptionsFrame.Dummy6:SetPoint("TOP", GVAR.OptionsFrame.ShowAssist, "BOTTOM", 0, -8)
  3239. GVAR.OptionsFrame.Dummy6:SetColorTexture(0.73, 0.26, 0.21, 0.5)
  3240.  
  3241.  
  3242.  
  3243. -- health bar
  3244. GVAR.OptionsFrame.ShowHealthBar = CreateFrame("CheckButton", nil, GVAR.OptionsFrame.ConfigBrackets)
  3245. TEMPLATE.CheckButton(GVAR.OptionsFrame.ShowHealthBar, 16, 4, L["Health Bar"])
  3246. GVAR.OptionsFrame.ShowHealthBar:SetPoint("LEFT", GVAR.OptionsFrame, "LEFT", 10, 0)
  3247. GVAR.OptionsFrame.ShowHealthBar:SetPoint("TOP", GVAR.OptionsFrame.Dummy6, "BOTTOM", 0, -8)
  3248. GVAR.OptionsFrame.ShowHealthBar:SetChecked(BattlegroundTargets_Options[fraction].ButtonHealthBarToggle[currentSize])
  3249. GVAR.OptionsFrame.ShowHealthBar:SetScript("OnClick", function()
  3250. BattlegroundTargets_Options[fraction].ButtonHealthBarToggle[currentSize] = not BattlegroundTargets_Options[fraction].ButtonHealthBarToggle[currentSize]
  3251. GVAR.OptionsFrame.ShowHealthBar:SetChecked(BattlegroundTargets_Options[fraction].ButtonHealthBarToggle[currentSize])
  3252. BattlegroundTargets:EnableConfigMode()
  3253. end)
  3254.  
  3255. -- health percent
  3256. GVAR.OptionsFrame.ShowHealthText = CreateFrame("CheckButton", nil, GVAR.OptionsFrame.ConfigBrackets)
  3257. TEMPLATE.CheckButton(GVAR.OptionsFrame.ShowHealthText, 16, 4, L["Percent"])
  3258. GVAR.OptionsFrame.ShowHealthText:SetPoint("LEFT", GVAR.OptionsFrame.ShowHealthBar.Text, "RIGHT", 20, 0)
  3259. GVAR.OptionsFrame.ShowHealthText:SetChecked(BattlegroundTargets_Options[fraction].ButtonHealthTextToggle[currentSize])
  3260. GVAR.OptionsFrame.ShowHealthText:SetScript("OnClick", function()
  3261. BattlegroundTargets_Options[fraction].ButtonHealthTextToggle[currentSize] = not BattlegroundTargets_Options[fraction].ButtonHealthTextToggle[currentSize]
  3262. GVAR.OptionsFrame.ShowHealthText:SetChecked(BattlegroundTargets_Options[fraction].ButtonHealthTextToggle[currentSize])
  3263. ConfigFontNumberOptionCheck(currentSize)
  3264. BattlegroundTargets:EnableConfigMode()
  3265. end)
  3266.  
  3267.  
  3268.  
  3269. -- ----- range check ----------------------------------------
  3270. local rangeW = 0
  3271. -- range check
  3272. GVAR.OptionsFrame.RangeCheck = CreateFrame("CheckButton", nil, GVAR.OptionsFrame.ConfigBrackets)
  3273. TEMPLATE.CheckButton(GVAR.OptionsFrame.RangeCheck, 16, 4, L["Range"])
  3274. GVAR.OptionsFrame.RangeCheck:SetPoint("LEFT", GVAR.OptionsFrame, "LEFT", 10, 0)
  3275. GVAR.OptionsFrame.RangeCheck:SetPoint("TOP", GVAR.OptionsFrame.ShowHealthBar, "BOTTOM", 0, -10)
  3276. GVAR.OptionsFrame.RangeCheck:SetChecked(BattlegroundTargets_Options[fraction].ButtonRangeToggle[currentSize])
  3277. GVAR.OptionsFrame.RangeCheck:SetScript("OnClick", function()
  3278. BattlegroundTargets_Options[fraction].ButtonRangeToggle[currentSize] = not BattlegroundTargets_Options[fraction].ButtonRangeToggle[currentSize]
  3279. GVAR.OptionsFrame.RangeCheck:SetChecked(BattlegroundTargets_Options[fraction].ButtonRangeToggle[currentSize])
  3280. if BattlegroundTargets_Options[fraction].ButtonRangeToggle[currentSize] then
  3281. GVAR.OptionsFrame.RangeCheckInfo:Enable() Desaturation(GVAR.OptionsFrame.RangeCheckInfo.Texture, false)
  3282. TEMPLATE.EnablePullDownMenu(GVAR.OptionsFrame.RangeDisplayPullDown)
  3283. else
  3284. GVAR.OptionsFrame.RangeCheckInfo:Disable() Desaturation(GVAR.OptionsFrame.RangeCheckInfo.Texture, true)
  3285. TEMPLATE.DisablePullDownMenu(GVAR.OptionsFrame.RangeDisplayPullDown)
  3286. end
  3287. BattlegroundTargets:EnableConfigMode()
  3288. end)
  3289. rangeW = rangeW + 10 + GVAR.OptionsFrame.RangeCheck:GetWidth()
  3290.  
  3291. -- range check info
  3292. GVAR.OptionsFrame.RangeCheckInfo = CreateFrame("Button", nil, GVAR.OptionsFrame.ConfigBrackets)
  3293. GVAR.OptionsFrame.RangeCheckInfo:SetWidth(16)
  3294. GVAR.OptionsFrame.RangeCheckInfo:SetHeight(16)
  3295. GVAR.OptionsFrame.RangeCheckInfo:SetPoint("LEFT", GVAR.OptionsFrame.RangeCheck, "RIGHT", 10, 0)
  3296. GVAR.OptionsFrame.RangeCheckInfo.Texture = GVAR.OptionsFrame.RangeCheckInfo:CreateTexture(nil, "ARTWORK")
  3297. GVAR.OptionsFrame.RangeCheckInfo.Texture:SetWidth(16)
  3298. GVAR.OptionsFrame.RangeCheckInfo.Texture:SetHeight(16)
  3299. GVAR.OptionsFrame.RangeCheckInfo.Texture:SetPoint("LEFT", 0, 0)
  3300. GVAR.OptionsFrame.RangeCheckInfo.Texture:SetTexture("Interface\\FriendsFrame\\InformationIcon")
  3301. GVAR.OptionsFrame.RangeCheckInfo.TextFrame = CreateFrame("Frame", nil, GVAR.OptionsFrame.ConfigBrackets)
  3302. TEMPLATE.BorderTRBL(GVAR.OptionsFrame.RangeCheckInfo.TextFrame)
  3303. GVAR.OptionsFrame.RangeCheckInfo.TextFrame:SetToplevel(true)
  3304. GVAR.OptionsFrame.RangeCheckInfo.TextFrame:SetPoint("BOTTOM", GVAR.OptionsFrame.RangeCheckInfo.Texture, "TOP", 0, 0)
  3305. GVAR.OptionsFrame.RangeCheckInfo.TextFrame:Hide()
  3306. GVAR.OptionsFrame.RangeCheckInfo.Text = GVAR.OptionsFrame.RangeCheckInfo.TextFrame:CreateFontString(nil, "ARTWORK", "GameFontNormalSmall")
  3307. GVAR.OptionsFrame.RangeCheckInfo.Text:SetPoint("CENTER", 0, 0)
  3308. GVAR.OptionsFrame.RangeCheckInfo.Text:SetJustifyH("LEFT")
  3309. BattlegroundTargets:RangeInfoText( GVAR.OptionsFrame.RangeCheckInfo.Text ) --GVAR.OptionsFrame.RangeCheckInfo.Text:SetText()
  3310. GVAR.OptionsFrame.RangeCheckInfo.Text:SetTextColor(1, 1, 0.49, 1)
  3311. GVAR.OptionsFrame.RangeCheckInfo:SetScript("OnEnter", function()
  3312. local txtWidth = GVAR.OptionsFrame.RangeCheckInfo.Text:GetStringWidth()
  3313. local txtHeight = GVAR.OptionsFrame.RangeCheckInfo.Text:GetStringHeight()
  3314. GVAR.OptionsFrame.RangeCheckInfo.Text:SetWidth(txtWidth+10)
  3315. GVAR.OptionsFrame.RangeCheckInfo.Text:SetHeight(txtHeight+10)
  3316. GVAR.OptionsFrame.RangeCheckInfo.TextFrame:SetWidth(txtWidth+30)
  3317. GVAR.OptionsFrame.RangeCheckInfo.TextFrame:SetHeight(txtHeight+30)
  3318. GVAR.OptionsFrame.RangeCheckInfo.TextFrame:Show()
  3319. end)
  3320. GVAR.OptionsFrame.RangeCheckInfo:SetScript("OnLeave", function()
  3321. GVAR.OptionsFrame.RangeCheckInfo.TextFrame:Hide()
  3322. end)
  3323. rangeW = rangeW + 10 + 16
  3324.  
  3325. -- range alpha
  3326. GVAR.OptionsFrame.RangeDisplayPullDown = CreateFrame("Button", nil, GVAR.OptionsFrame.ConfigBrackets)
  3327. TEMPLATE.PullDownMenu(
  3328. GVAR.OptionsFrame.RangeDisplayPullDown,
  3329. rangeDisplay,
  3330. rangeDisplay[ BattlegroundTargets_Options[fraction].ButtonRangeDisplay[currentSize] ],
  3331. 0,
  3332. function(value) -- PDFUNC
  3333. BattlegroundTargets_Options[fraction].ButtonRangeDisplay[currentSize] = value
  3334. BattlegroundTargets:EnableConfigMode()
  3335. end,
  3336. function(self, button) -- TODO check - potential bug port
  3337. GVAR.OptionsFrame.RangeDisplayPullDown.spookval = BattlegroundTargets_Options[fraction].ButtonRangeDisplay[currentSize]
  3338. BattlegroundTargets_Options[fraction].ButtonRangeDisplay[currentSize] = self.value1
  3339. BattlegroundTargets:EnableConfigMode()
  3340. end,
  3341. function(self, button) -- TODO check - potential bug port
  3342. BattlegroundTargets_Options[fraction].ButtonRangeDisplay[currentSize] = GVAR.OptionsFrame.RangeDisplayPullDown.spookval or self.value1
  3343. BattlegroundTargets:EnableConfigMode()
  3344. end
  3345. )
  3346. GVAR.OptionsFrame.RangeDisplayPullDown:SetPoint("LEFT", GVAR.OptionsFrame.RangeCheckInfo, "RIGHT", 10, 0)
  3347. GVAR.OptionsFrame.RangeDisplayPullDown:SetHeight(18)
  3348. TEMPLATE.EnablePullDownMenu(GVAR.OptionsFrame.RangeDisplayPullDown)
  3349. rangeW = rangeW + 10 + GVAR.OptionsFrame.RangeDisplayPullDown:GetWidth() + 10
  3350. -- ----- range check ----------------------------------------
  3351.  
  3352.  
  3353.  
  3354. -- DUMMY
  3355. GVAR.OptionsFrame.Dummy7 = GVAR.OptionsFrame.ConfigBrackets:CreateTexture(nil, "ARTWORK")
  3356. -- BOOM GVAR.OptionsFrame.Dummy7:SetWidth()
  3357. GVAR.OptionsFrame.Dummy7:SetHeight(1)
  3358. GVAR.OptionsFrame.Dummy7:SetPoint("LEFT", GVAR.OptionsFrame, "LEFT", 10, 0)
  3359. GVAR.OptionsFrame.Dummy7:SetPoint("TOP", GVAR.OptionsFrame.RangeCheck, "BOTTOM", 0, -8)
  3360. GVAR.OptionsFrame.Dummy7:SetColorTexture(0.73, 0.26, 0.21, 0.5)
  3361.  
  3362.  
  3363.  
  3364. -- font name
  3365. GVAR.OptionsFrame.FontNameTitle = GVAR.OptionsFrame.ConfigBrackets:CreateFontString(nil, "ARTWORK", "GameFontNormalSmall")
  3366. GVAR.OptionsFrame.FontNameTitle:SetHeight(16)
  3367. GVAR.OptionsFrame.FontNameTitle:SetPoint("LEFT", GVAR.OptionsFrame, "LEFT", 10, 0)
  3368. GVAR.OptionsFrame.FontNameTitle:SetPoint("TOP", GVAR.OptionsFrame.Dummy7, "BOTTOM", 0, -8)
  3369. GVAR.OptionsFrame.FontNameTitle:SetJustifyH("LEFT")
  3370. GVAR.OptionsFrame.FontNameTitle:SetText(L["Text"]..": "..L["Name"])
  3371. GVAR.OptionsFrame.FontNameTitle:SetTextColor(1, 1, 1, 1)
  3372. GVAR.OptionsFrame.FontNameTitle.Background = GVAR.OptionsFrame.ConfigBrackets:CreateTexture(nil, "BACKGROUND")
  3373. GVAR.OptionsFrame.FontNameTitle.Background:SetPoint("TOPLEFT", GVAR.OptionsFrame.FontNameTitle, "TOPLEFT", 0, 0)
  3374. GVAR.OptionsFrame.FontNameTitle.Background:SetPoint("BOTTOMRIGHT", GVAR.OptionsFrame.FontNameTitle, "BOTTOMRIGHT", 0, 0)
  3375. GVAR.OptionsFrame.FontNameTitle.Background:SetColorTexture(0, 0, 0, 0)
  3376.  
  3377. -- font name size
  3378. GVAR.OptionsFrame.FontNameSlider = CreateFrame("Slider", nil, GVAR.OptionsFrame.ConfigBrackets)
  3379. TEMPLATE.Slider(GVAR.OptionsFrame.FontNameSlider, 80, 1, 5, 20, BattlegroundTargets_Options[fraction].ButtonFontNameSize[currentSize],
  3380. function(self, value)
  3381. if value == BattlegroundTargets_Options[fraction].ButtonFontNameSize[currentSize] then return end
  3382. BattlegroundTargets_Options[fraction].ButtonFontNameSize[currentSize] = value
  3383. GVAR.OptionsFrame.FontNameValue:SetText(value)
  3384. BattlegroundTargets:EnableConfigMode()
  3385. end,
  3386. "blank")
  3387. GVAR.OptionsFrame.FontNameSlider:SetPoint("LEFT", GVAR.OptionsFrame.FontNameTitle, "RIGHT", 10, 0)
  3388.  
  3389. GVAR.OptionsFrame.FontNameValue = GVAR.OptionsFrame.ConfigBrackets:CreateFontString(nil, "ARTWORK", "GameFontNormalSmall")
  3390. GVAR.OptionsFrame.FontNameValue:SetHeight(20)
  3391. GVAR.OptionsFrame.FontNameValue:SetPoint("LEFT", GVAR.OptionsFrame.FontNameSlider, "RIGHT", 5, 0)
  3392. GVAR.OptionsFrame.FontNameValue:SetJustifyH("LEFT")
  3393. GVAR.OptionsFrame.FontNameValue:SetText(BattlegroundTargets_Options[fraction].ButtonFontNameSize[currentSize])
  3394. GVAR.OptionsFrame.FontNameValue:SetTextColor(1, 1, 0.49, 1)
  3395.  
  3396. -- font name style
  3397. GVAR.OptionsFrame.FontNamePullDown = CreateFrame("Button", nil, GVAR.OptionsFrame.ConfigBrackets)
  3398. local fontStylesDB = {}
  3399. for i = 1, #fontStyles do tinsert(fontStylesDB, fontStyles[i].name) end
  3400. TEMPLATE.PullDownMenu(
  3401. GVAR.OptionsFrame.FontNamePullDown,
  3402. fontStylesDB,
  3403. fontStyles[ BattlegroundTargets_Options[fraction].ButtonFontNameStyle[currentSize] ].name,
  3404. 0,
  3405. function(value) -- PDFUNC
  3406. BattlegroundTargets_Options[fraction].ButtonFontNameStyle[currentSize] = value
  3407. BattlegroundTargets:EnableConfigMode()
  3408. end,
  3409. function(self, button)
  3410. BattlegroundTargets:LocalizedFontNameTest(true, self.value1)
  3411. end,
  3412. function(self, button)
  3413. BattlegroundTargets:LocalizedFontNameTest(false, true)
  3414. end
  3415. )
  3416. GVAR.OptionsFrame.FontNamePullDown:SetPoint("LEFT", GVAR.OptionsFrame.FontNameSlider, "RIGHT", 30, 0)
  3417. GVAR.OptionsFrame.FontNamePullDown:SetHeight(18)
  3418. TEMPLATE.EnablePullDownMenu(GVAR.OptionsFrame.FontNamePullDown)
  3419.  
  3420. GVAR.OptionsFrame.FontNameInfo = GVAR.OptionsFrame.FontNamePullDown.PullDownMenu:CreateFontString(nil, "ARTWORK", "GameFontNormalSmall")
  3421. GVAR.OptionsFrame.FontNameInfo:SetHeight(16)
  3422. GVAR.OptionsFrame.FontNameInfo:SetPoint("TOP", GVAR.OptionsFrame.FontNamePullDown.PullDownMenu, "BOTTOM", 0, -2)
  3423. GVAR.OptionsFrame.FontNameInfo:SetJustifyH("CENTER")
  3424. GVAR.OptionsFrame.FontNameInfo:SetText(CTRL_KEY_TEXT.." "..SHIFT_KEY_TEXT.." "..ALT_KEY)
  3425. GVAR.OptionsFrame.FontNameInfo:SetTextColor(0.5, 0.5, 0.5, 1)
  3426.  
  3427. GVAR.OptionsFrame.FontNamePullDown.PullDownMenu:SetPropagateKeyboardInput(true)
  3428. GVAR.OptionsFrame.FontNamePullDown.PullDownMenu:SetScript("OnKeyDown", function(self, key)
  3429. if key == "LSHIFT" or key == "RSHIFT" or key == "LCTRL" or key == "RCTRL" or key == "LALT" or key == "RALT" then
  3430. GVAR.OptionsFrame.FontNamePullDown.PullDownMenu:SetPropagateKeyboardInput(false)
  3431. BattlegroundTargets:LocalizedFontNameTest(false, false)
  3432. end
  3433. end)
  3434. GVAR.OptionsFrame.FontNamePullDown.PullDownMenu:SetScript("OnKeyUp", function(self, key)
  3435. GVAR.OptionsFrame.FontNamePullDown.PullDownMenu:SetPropagateKeyboardInput(true)
  3436. BattlegroundTargets:LocalizedFontNameTest(true, false)
  3437. end)
  3438.  
  3439. local oldOnEnter = GVAR.OptionsFrame.FontNamePullDown:GetScript("OnEnter")
  3440. local oldOnLeave = GVAR.OptionsFrame.FontNamePullDown:GetScript("OnLeave")
  3441. GVAR.OptionsFrame.FontNamePullDown:SetScript("OnEnter", function(self)
  3442. BattlegroundTargets:LocalizedFontNameTest(true)
  3443. if oldOnEnter then oldOnEnter() end
  3444. end)
  3445. GVAR.OptionsFrame.FontNamePullDown:SetScript("OnLeave", function(self)
  3446. BattlegroundTargets:LocalizedFontNameTest(false, true)
  3447. if oldOnLeave then oldOnLeave() end
  3448. end)
  3449. local oldOnEnter = GVAR.OptionsFrame.FontNamePullDown.PullDownMenu:GetScript("OnEnter")
  3450. local oldOnLeave = GVAR.OptionsFrame.FontNamePullDown.PullDownMenu:GetScript("OnLeave")
  3451. GVAR.OptionsFrame.FontNamePullDown.PullDownMenu:SetScript("OnEnter", function(self)
  3452. BattlegroundTargets:LocalizedFontNameTest(true)
  3453. if oldOnEnter then oldOnEnter() end
  3454. end)
  3455. GVAR.OptionsFrame.FontNamePullDown.PullDownMenu:SetScript("OnLeave", function(self)
  3456. BattlegroundTargets:LocalizedFontNameTest(false, true)
  3457. if oldOnLeave then oldOnLeave() end
  3458. end)
  3459.  
  3460. -- font number
  3461. GVAR.OptionsFrame.FontNumberTitle = GVAR.OptionsFrame.ConfigBrackets:CreateFontString(nil, "ARTWORK", "GameFontNormalSmall")
  3462. GVAR.OptionsFrame.FontNumberTitle:SetHeight(16)
  3463. GVAR.OptionsFrame.FontNumberTitle:SetPoint("LEFT", GVAR.OptionsFrame, "LEFT", 10, 0)
  3464. GVAR.OptionsFrame.FontNumberTitle:SetPoint("TOP", GVAR.OptionsFrame.FontNameSlider, "BOTTOM", 0, -10)
  3465. GVAR.OptionsFrame.FontNumberTitle:SetJustifyH("LEFT")
  3466. GVAR.OptionsFrame.FontNumberTitle:SetText(L["Text"]..": "..L["Number"])
  3467. GVAR.OptionsFrame.FontNumberTitle:SetTextColor(1, 1, 1, 1)
  3468. GVAR.OptionsFrame.FontNumberTitle.Background = GVAR.OptionsFrame.ConfigBrackets:CreateTexture(nil, "BACKGROUND")
  3469. GVAR.OptionsFrame.FontNumberTitle.Background:SetPoint("TOPLEFT", GVAR.OptionsFrame.FontNumberTitle, "TOPLEFT", 0, 0)
  3470. GVAR.OptionsFrame.FontNumberTitle.Background:SetPoint("BOTTOMRIGHT", GVAR.OptionsFrame.FontNumberTitle, "BOTTOMRIGHT", 0, 0)
  3471. GVAR.OptionsFrame.FontNumberTitle.Background:SetColorTexture(0, 0, 0, 0)
  3472.  
  3473. -- font number size
  3474. GVAR.OptionsFrame.FontNumberSlider = CreateFrame("Slider", nil, GVAR.OptionsFrame.ConfigBrackets)
  3475. TEMPLATE.Slider(GVAR.OptionsFrame.FontNumberSlider, 80, 1, 5, 20, BattlegroundTargets_Options[fraction].ButtonFontNumberSize[currentSize],
  3476. function(self, value)
  3477. if value == BattlegroundTargets_Options[fraction].ButtonFontNumberSize[currentSize] then return end
  3478. BattlegroundTargets_Options[fraction].ButtonFontNumberSize[currentSize] = value
  3479. GVAR.OptionsFrame.FontNumberValue:SetText(value)
  3480. BattlegroundTargets:EnableConfigMode()
  3481. end,
  3482. "blank")
  3483. GVAR.OptionsFrame.FontNumberSlider:SetPoint("LEFT", GVAR.OptionsFrame.FontNumberTitle, "RIGHT", 10, 0)
  3484.  
  3485. GVAR.OptionsFrame.FontNumberValue = GVAR.OptionsFrame.ConfigBrackets:CreateFontString(nil, "ARTWORK", "GameFontNormalSmall")
  3486. GVAR.OptionsFrame.FontNumberValue:SetHeight(20)
  3487. GVAR.OptionsFrame.FontNumberValue:SetPoint("LEFT", GVAR.OptionsFrame.FontNumberSlider, "RIGHT", 5, 0)
  3488. GVAR.OptionsFrame.FontNumberValue:SetJustifyH("LEFT")
  3489. GVAR.OptionsFrame.FontNumberValue:SetText(BattlegroundTargets_Options[fraction].ButtonFontNumberSize[currentSize])
  3490. GVAR.OptionsFrame.FontNumberValue:SetTextColor(1, 1, 0.49, 1)
  3491.  
  3492. -- font number style
  3493. GVAR.OptionsFrame.FontNumberPullDown = CreateFrame("Button", nil, GVAR.OptionsFrame.ConfigBrackets)
  3494. local fontStylesNumberDB = {}
  3495. for i = 1, #fontStyles do tinsert(fontStylesNumberDB, strmatch(fontStyles[i].name, "(.*) %- .*")) end
  3496. TEMPLATE.PullDownMenu(
  3497. GVAR.OptionsFrame.FontNumberPullDown,
  3498. fontStylesNumberDB,
  3499. strmatch(fontStyles[ BattlegroundTargets_Options[fraction].ButtonFontNumberStyle[currentSize] ].name, "(.*) %- .*"),
  3500. 0,
  3501. function(value) -- PDFUNC
  3502. BattlegroundTargets_Options[fraction].ButtonFontNumberStyle[currentSize] = value
  3503. BattlegroundTargets:EnableConfigMode()
  3504. end,
  3505. function(self, button)
  3506. BattlegroundTargets:LocalizedFontNumberTest(true, self.value1)
  3507. end,
  3508. function(self, button)
  3509. BattlegroundTargets:LocalizedFontNumberTest(false)
  3510. end
  3511. )
  3512. GVAR.OptionsFrame.FontNumberPullDown:SetPoint("LEFT", GVAR.OptionsFrame.FontNumberSlider, "RIGHT", 30, 0)
  3513. GVAR.OptionsFrame.FontNumberPullDown:SetHeight(18)
  3514. TEMPLATE.EnablePullDownMenu(GVAR.OptionsFrame.FontNumberPullDown)
  3515.  
  3516. local oldOnLeave = GVAR.OptionsFrame.FontNumberPullDown:GetScript("OnLeave")
  3517. GVAR.OptionsFrame.FontNumberPullDown:SetScript("OnLeave", function(self)
  3518. BattlegroundTargets:LocalizedFontNumberTest(false)
  3519. if oldOnLeave then oldOnLeave() end
  3520. end)
  3521. local oldOnLeave = GVAR.OptionsFrame.FontNumberPullDown.PullDownMenu:GetScript("OnLeave")
  3522. GVAR.OptionsFrame.FontNumberPullDown.PullDownMenu:SetScript("OnLeave", function(self)
  3523. BattlegroundTargets:LocalizedFontNumberTest(false)
  3524. if oldOnLeave then oldOnLeave() end
  3525. end)
  3526.  
  3527. local eq, sw = 0, 0
  3528. sw = GVAR.OptionsFrame.FontNameTitle:GetStringWidth() if sw > eq then eq = sw end
  3529. sw = GVAR.OptionsFrame.FontNumberTitle:GetStringWidth() if sw > eq then eq = sw end
  3530. GVAR.OptionsFrame.FontNameSlider:SetPoint("LEFT", GVAR.OptionsFrame.FontNameTitle, "LEFT", eq+10, 0)
  3531. GVAR.OptionsFrame.FontNumberSlider:SetPoint("LEFT", GVAR.OptionsFrame.FontNumberTitle, "LEFT", eq+10, 0)
  3532.  
  3533. local fontstyleW = 10+ eq+10 + GVAR.OptionsFrame.FontNameSlider:GetWidth() + 30 + GVAR.OptionsFrame.FontNamePullDown:GetWidth() + 10
  3534.  
  3535. -- testshuffler
  3536. GVAR.OptionsFrame.TestShuffler = CreateFrame("Button", nil, GVAR.OptionsFrame.ConfigBrackets)
  3537. BattlegroundTargets.shuffleStyle = true
  3538. GVAR.OptionsFrame.TestShuffler:SetPoint("BOTTOM", GVAR.OptionsFrame.Base, "BOTTOM", 0, 13)
  3539. GVAR.OptionsFrame.TestShuffler:SetPoint("RIGHT", GVAR.OptionsFrame, "RIGHT", -10, 0)
  3540. GVAR.OptionsFrame.TestShuffler:SetWidth(32)
  3541. GVAR.OptionsFrame.TestShuffler:SetHeight(32)
  3542. GVAR.OptionsFrame.TestShuffler:Hide()
  3543. GVAR.OptionsFrame.TestShuffler:SetScript("OnClick", function() BattlegroundTargets:ShufflerFunc("OnClick") end)
  3544. GVAR.OptionsFrame.TestShuffler:SetScript("OnEnter", function() BattlegroundTargets:ShufflerFunc("OnEnter") end)
  3545. GVAR.OptionsFrame.TestShuffler:SetScript("OnLeave", function() BattlegroundTargets:ShufflerFunc("OnLeave") end)
  3546. GVAR.OptionsFrame.TestShuffler:SetScript("OnMouseDown", function(self, button)
  3547. if button == "LeftButton" then BattlegroundTargets:ShufflerFunc("OnMouseDown") end
  3548. end)
  3549. GVAR.OptionsFrame.TestShuffler.Texture = GVAR.OptionsFrame.TestShuffler:CreateTexture(nil, "ARTWORK")
  3550. GVAR.OptionsFrame.TestShuffler.Texture:SetWidth(32)
  3551. GVAR.OptionsFrame.TestShuffler.Texture:SetHeight(32)
  3552. GVAR.OptionsFrame.TestShuffler.Texture:SetPoint("CENTER", 0, 0)
  3553. GVAR.OptionsFrame.TestShuffler.Texture:SetTexture("Interface\\Icons\\INV_Sigil_Thorim")
  3554. GVAR.OptionsFrame.TestShuffler:SetNormalTexture(GVAR.OptionsFrame.TestShuffler.Texture)
  3555. GVAR.OptionsFrame.TestShuffler.TextureHighlight = GVAR.OptionsFrame.TestShuffler:CreateTexture(nil, "OVERLAY")
  3556. GVAR.OptionsFrame.TestShuffler.TextureHighlight:SetWidth(32)
  3557. GVAR.OptionsFrame.TestShuffler.TextureHighlight:SetHeight(32)
  3558. GVAR.OptionsFrame.TestShuffler.TextureHighlight:SetPoint("CENTER", 0, 0)
  3559. GVAR.OptionsFrame.TestShuffler.TextureHighlight:SetTexture("Interface\\Buttons\\ButtonHilight-Square")
  3560. GVAR.OptionsFrame.TestShuffler:SetHighlightTexture(GVAR.OptionsFrame.TestShuffler.TextureHighlight)
  3561. -- ###
  3562. -- ####################################################################################################
  3563.  
  3564.  
  3565.  
  3566. -- ####################################################################################################
  3567. -- xMx ConfigGeneral
  3568. GVAR.OptionsFrame.ConfigGeneral = CreateFrame("Frame", nil, GVAR.OptionsFrame)
  3569. -- BOOM GVAR.OptionsFrame.ConfigGeneral:SetWidth()
  3570. GVAR.OptionsFrame.ConfigGeneral:SetHeight(heightBracket)
  3571. GVAR.OptionsFrame.ConfigGeneral:SetPoint("TOPLEFT", GVAR.OptionsFrame.Base, "BOTTOMLEFT", 0, 1)
  3572. GVAR.OptionsFrame.ConfigGeneral:Hide()
  3573.  
  3574. GVAR.OptionsFrame.GeneralTitle = GVAR.OptionsFrame.ConfigGeneral:CreateFontString(nil, "ARTWORK", "GameFontNormal")
  3575. GVAR.OptionsFrame.GeneralTitle:SetHeight(20)
  3576. GVAR.OptionsFrame.GeneralTitle:SetPoint("LEFT", GVAR.OptionsFrame, "LEFT", 10, 0)
  3577. GVAR.OptionsFrame.GeneralTitle:SetPoint("TOPLEFT", GVAR.OptionsFrame.ConfigGeneral, "TOPLEFT", 10, -10)
  3578. GVAR.OptionsFrame.GeneralTitle:SetJustifyH("LEFT")
  3579. GVAR.OptionsFrame.GeneralTitle:SetText(L["General Settings"]..":")
  3580.  
  3581. -- minimap button
  3582. GVAR.OptionsFrame.Minimap = CreateFrame("CheckButton", nil, GVAR.OptionsFrame.ConfigGeneral)
  3583. TEMPLATE.CheckButton(GVAR.OptionsFrame.Minimap, 16, 4, L["Show Minimap-Button"])
  3584. GVAR.OptionsFrame.Minimap:SetPoint("LEFT", GVAR.OptionsFrame, "LEFT", 10, 0)
  3585. GVAR.OptionsFrame.Minimap:SetPoint("TOP", GVAR.OptionsFrame.GeneralTitle, "BOTTOM", 0, -10)
  3586. GVAR.OptionsFrame.Minimap:SetChecked(BattlegroundTargets_Options.MinimapButton)
  3587. TEMPLATE.EnableCheckButton(GVAR.OptionsFrame.Minimap)
  3588. GVAR.OptionsFrame.Minimap:SetScript("OnClick", function()
  3589. BattlegroundTargets_Options.MinimapButton = not BattlegroundTargets_Options.MinimapButton
  3590. BattlegroundTargets:CreateMinimapButton()
  3591. end)
  3592.  
  3593. -- transliteration
  3594. local tsarrow = " |TInterface\\Tooltips\\ReforgeGreenArrow:8:0|t "
  3595. GVAR.OptionsFrame.TransLitOption = CreateFrame("CheckButton", nil, GVAR.OptionsFrame.ConfigGeneral)
  3596. TEMPLATE.CheckButton(GVAR.OptionsFrame.TransLitOption, 16, 4, "Cyrillic" .. tsarrow .. "Latin - Transliteration")
  3597. GVAR.OptionsFrame.TransLitOption:SetPoint("LEFT", GVAR.OptionsFrame, "LEFT", 10, 0)
  3598. GVAR.OptionsFrame.TransLitOption:SetPoint("TOP", GVAR.OptionsFrame.Minimap, "BOTTOM", 0, -10)
  3599. GVAR.OptionsFrame.TransLitOption:SetChecked(BattlegroundTargets_Options.TransliterationToggle)
  3600. TEMPLATE.EnableCheckButton(GVAR.OptionsFrame.TransLitOption)
  3601. GVAR.OptionsFrame.TransLitOption:SetScript("OnClick", function()
  3602. BattlegroundTargets_Options.TransliterationToggle = not BattlegroundTargets_Options.TransliterationToggle
  3603. if BattlegroundTargets_Options.TransliterationToggle then
  3604. GVAR.OptionsFrame.TransLitOptionInfoText:SetTextColor(1, 1, 1, 1)
  3605. else
  3606. GVAR.OptionsFrame.TransLitOptionInfoText:SetTextColor(0.5, 0.5, 0.5, 1)
  3607. end
  3608. end)
  3609. GVAR.OptionsFrame.TransLitOptionInfoText = GVAR.OptionsFrame.ConfigGeneral:CreateFontString(nil, "ARTWORK", "GameFontNormal")
  3610. GVAR.OptionsFrame.TransLitOptionInfoText:SetPoint("TOPLEFT", GVAR.OptionsFrame.TransLitOption, "BOTTOMLEFT", 30, -10)
  3611. GVAR.OptionsFrame.TransLitOptionInfoText:SetJustifyH("LEFT")
  3612. GVAR.OptionsFrame.TransLitOptionInfoText:SetFont(fontStyles[12].font, 12, "")
  3613. GVAR.OptionsFrame.TransLitOptionInfoText:SetShadowOffset(0, 0)
  3614. GVAR.OptionsFrame.TransLitOptionInfoText:SetShadowColor(0, 0, 0, 0)
  3615. if BattlegroundTargets_Options.TransliterationToggle then
  3616. GVAR.OptionsFrame.TransLitOptionInfoText:SetTextColor(1, 1, 1, 1)
  3617. else
  3618. GVAR.OptionsFrame.TransLitOptionInfoText:SetTextColor(0.5, 0.5, 0.5, 1)
  3619. end
  3620. GVAR.OptionsFrame.TransLitOptionInfoText:SetText(
  3621. L["ruRU_transliteration_test1"] .. tsarrow .. utf8replace(L["ruRU_transliteration_test1"], TSL) .. "\n" ..
  3622. L["ruRU_transliteration_test2"] .. tsarrow .. utf8replace(L["ruRU_transliteration_test2"], TSL) .. "\n" ..
  3623. L["ruRU_transliteration_test3"] .. tsarrow .. utf8replace(L["ruRU_transliteration_test3"], TSL) .. "\n" ..
  3624. L["ruRU_transliteration_test4"] .. tsarrow .. utf8replace(L["ruRU_transliteration_test4"], TSL) .. "\n" ..
  3625. L["ruRU_transliteration_test5"] .. tsarrow .. utf8replace(L["ruRU_transliteration_test5"], TSL))
  3626. -- ###
  3627. -- ####################################################################################################
  3628.  
  3629.  
  3630.  
  3631. -- ####################################################################################################
  3632. -- xMx Mover
  3633. GVAR.OptionsFrame.MoverTop = CreateFrame("Frame", nil, GVAR.OptionsFrame)
  3634. TEMPLATE.BorderTRBL(GVAR.OptionsFrame.MoverTop)
  3635. -- BOOM GVAR.OptionsFrame.MoverTop:SetWidth()
  3636. GVAR.OptionsFrame.MoverTop:SetHeight(20)
  3637. GVAR.OptionsFrame.MoverTop:SetPoint("BOTTOM", GVAR.OptionsFrame, "TOP", 0, -1)
  3638. GVAR.OptionsFrame.MoverTop:EnableMouse(true)
  3639. GVAR.OptionsFrame.MoverTop:EnableMouseWheel(true)
  3640. GVAR.OptionsFrame.MoverTop:SetScript("OnMouseWheel", NOOP)
  3641. GVAR.OptionsFrame.MoverTopText = GVAR.OptionsFrame.MoverTop:CreateFontString(nil, "ARTWORK", "GameFontNormalSmall")
  3642. GVAR.OptionsFrame.MoverTopText:SetPoint("CENTER", GVAR.OptionsFrame.MoverTop, "CENTER", 0, 0)
  3643. GVAR.OptionsFrame.MoverTopText:SetJustifyH("CENTER")
  3644. GVAR.OptionsFrame.MoverTopText:SetTextColor(0.5, 0.5, 0.5, 1)
  3645. GVAR.OptionsFrame.MoverTopText:SetText(L["click & move"])
  3646.  
  3647. GVAR.OptionsFrame.Close = CreateFrame("Button", nil, GVAR.OptionsFrame.MoverTop)
  3648. TEMPLATE.IconButton(GVAR.OptionsFrame.Close, 0)
  3649. GVAR.OptionsFrame.Close:SetWidth(20)
  3650. GVAR.OptionsFrame.Close:SetHeight(20)
  3651. GVAR.OptionsFrame.Close:SetPoint("RIGHT", GVAR.OptionsFrame.MoverTop, "RIGHT", 0, 0)
  3652. GVAR.OptionsFrame.Close:SetScript("OnClick", function() GVAR.OptionsFrame:Hide() end)
  3653.  
  3654. GVAR.OptionsFrame.MoverBottom = CreateFrame("Frame", nil, GVAR.OptionsFrame)
  3655. TEMPLATE.BorderTRBL(GVAR.OptionsFrame.MoverBottom)
  3656. -- BOOM GVAR.OptionsFrame.MoverBottom:SetWidth()
  3657. GVAR.OptionsFrame.MoverBottom:SetHeight(20)
  3658. GVAR.OptionsFrame.MoverBottom:SetPoint("TOP", GVAR.OptionsFrame, "BOTTOM", 0, 1)
  3659. GVAR.OptionsFrame.MoverBottom:EnableMouse(true)
  3660. GVAR.OptionsFrame.MoverBottom:EnableMouseWheel(true)
  3661. GVAR.OptionsFrame.MoverBottom:SetScript("OnMouseWheel", NOOP)
  3662. GVAR.OptionsFrame.MoverBottomText = GVAR.OptionsFrame.MoverBottom:CreateFontString(nil, "ARTWORK", "GameFontNormalSmall")
  3663. GVAR.OptionsFrame.MoverBottomText:SetPoint("CENTER", GVAR.OptionsFrame.MoverBottom, "CENTER", 0, 0)
  3664. GVAR.OptionsFrame.MoverBottomText:SetJustifyH("CENTER")
  3665. GVAR.OptionsFrame.MoverBottomText:SetTextColor(0.5, 0.5, 0.5, 1)
  3666. GVAR.OptionsFrame.MoverBottomText:SetText(L["click & move"])
  3667.  
  3668. local function OnEnter()
  3669. GVAR.OptionsFrame.MoverTopText:SetTextColor(1, 1, 1, 1)
  3670. GVAR.OptionsFrame.MoverBottomText:SetTextColor(1, 1, 1, 1)
  3671. GVAR.OptionsFrame.ClampDummy1:Show()
  3672. GVAR.OptionsFrame.ClampDummy2:Show()
  3673. GVAR.OptionsFrame.ClampDummy3:Show()
  3674. GVAR.OptionsFrame.ClampDummy4:Show()
  3675. end
  3676. local function OnLeave()
  3677. GVAR.OptionsFrame.MoverTopText:SetTextColor(0.5, 0.5, 0.5, 1)
  3678. GVAR.OptionsFrame.MoverBottomText:SetTextColor(0.5, 0.5, 0.5, 1)
  3679. GVAR.OptionsFrame.ClampDummy1:Hide()
  3680. GVAR.OptionsFrame.ClampDummy2:Hide()
  3681. GVAR.OptionsFrame.ClampDummy3:Hide()
  3682. GVAR.OptionsFrame.ClampDummy4:Hide()
  3683. end
  3684. local function OnMouseDown()
  3685. GVAR.OptionsFrame:StartMoving()
  3686. end
  3687. local function OnMouseUp()
  3688. GVAR.OptionsFrame:StopMovingOrSizing()
  3689. BattlegroundTargets:Frame_SavePosition("BattlegroundTargets_OptionsFrame")
  3690. end
  3691.  
  3692. GVAR.OptionsFrame.MoverTop:SetScript("OnEnter", OnEnter)
  3693. GVAR.OptionsFrame.MoverTop:SetScript("OnLeave", OnLeave)
  3694. GVAR.OptionsFrame.MoverTop:SetScript("OnMouseDown", OnMouseDown)
  3695. GVAR.OptionsFrame.MoverTop:SetScript("OnMouseUp", OnMouseUp)
  3696.  
  3697. GVAR.OptionsFrame.MoverBottom:SetScript("OnEnter", OnEnter)
  3698. GVAR.OptionsFrame.MoverBottom:SetScript("OnLeave", OnLeave)
  3699. GVAR.OptionsFrame.MoverBottom:SetScript("OnMouseDown", OnMouseDown)
  3700. GVAR.OptionsFrame.MoverBottom:SetScript("OnMouseUp", OnMouseUp)
  3701. -- ###
  3702. -- ####################################################################################################
  3703.  
  3704.  
  3705.  
  3706. -- ####################################################################################################
  3707. -- xMx width BOOM
  3708. local frameWidth = 400
  3709. if layoutW > frameWidth then frameWidth = layoutW end
  3710. if summaryW > frameWidth then frameWidth = summaryW end
  3711. if generalIconW > frameWidth then frameWidth = generalIconW end
  3712. if iconW > frameWidth then frameWidth = iconW end
  3713. if rangeW > frameWidth then frameWidth = rangeW end
  3714. if sortW > frameWidth then frameWidth = sortW end
  3715. if fontstyleW > frameWidth then frameWidth = fontstyleW end
  3716. if frameWidth < 400 then frameWidth = 400 end
  3717. if frameWidth > 650 then frameWidth = 650 end
  3718. -- OptionsFrame
  3719. GVAR.OptionsFrame:SetClampRectInsets((frameWidth-50)/2, -((frameWidth-50)/2), -(heightTotal-35), heightTotal-35)
  3720. GVAR.OptionsFrame:SetWidth(frameWidth)
  3721. GVAR.OptionsFrame.CloseConfig:SetWidth(frameWidth-20)
  3722. -- CLAMP_FIX_OPTIONS BEGIN
  3723. GVAR.OptionsFrame.ClampDummy1:SetSize(frameWidth+50, 2)
  3724. GVAR.OptionsFrame.ClampDummy2:SetSize(frameWidth+50, 2)
  3725. GVAR.OptionsFrame.ClampDummy3:SetSize(2, heightTotal+90) -- 50 + 40 (2xMover height)
  3726. GVAR.OptionsFrame.ClampDummy4:SetSize(2, heightTotal+90) -- 50 + 40 (2xMover height)
  3727. -- CLAMP_FIX_OPTIONS END
  3728. -- Base
  3729. GVAR.OptionsFrame.Base:SetWidth(frameWidth)
  3730. GVAR.OptionsFrame.Title:SetWidth(frameWidth)
  3731. local spacer = 10
  3732. local copyButtonWidth = GVAR.OptionsFrame.CopySettings1:GetWidth() + 20
  3733. local tabWidth1 = GVAR.OptionsFrame.TabGeneral.TabText:GetStringWidth() + 20
  3734. local tabWidth2 = floor( (frameWidth-tabWidth1-tabWidth1-copyButtonWidth-(6*spacer)) / 3 )
  3735. GVAR.OptionsFrame.TabGeneral:SetWidth(tabWidth1)
  3736. GVAR.OptionsFrame.TabRaidSize10:SetWidth(tabWidth2)
  3737. GVAR.OptionsFrame.TabRaidSize15:SetWidth(tabWidth2)
  3738. GVAR.OptionsFrame.TabRaidSize40:SetWidth(tabWidth2)
  3739. GVAR.OptionsFrame.TabGeneral:SetPoint("BOTTOMLEFT", GVAR.OptionsFrame.Base, "BOTTOMLEFT", spacer, -1)
  3740.  
  3741. local copyButtonWidth = GVAR.OptionsFrame.CopySettings2:GetWidth() + 20
  3742. local tabWidth1 = GVAR.OptionsFrame.EnableFriendBracket.TabText:GetStringWidth() + 20
  3743. local tabWidth2 = GVAR.OptionsFrame.EnableEnemyBracket.TabText:GetStringWidth() + 20
  3744. if tabWidth2 > tabWidth1 then tabWidth1 = tabWidth2 end
  3745. local tabWidth2 = floor( (frameWidth-tabWidth1-tabWidth1-copyButtonWidth-spacer) /2 )
  3746. GVAR.OptionsFrame.EnableFriendBracket:SetWidth(tabWidth1)
  3747. GVAR.OptionsFrame.EnableEnemyBracket:SetWidth(tabWidth1)
  3748. GVAR.OptionsFrame.EnableFriendBracket:SetPoint("TOPLEFT", GVAR.OptionsFrame.ConfigBrackets, "TOPLEFT", tabWidth2, -10)
  3749.  
  3750. GVAR.OptionsFrame.Dummy0:SetWidth(frameWidth) -- DUMMY
  3751. GVAR.OptionsFrame.Dummy1:SetWidth(frameWidth-20)
  3752. GVAR.OptionsFrame.Dummy2:SetWidth(frameWidth-20)
  3753. GVAR.OptionsFrame.Dummy3:SetWidth(frameWidth-20)
  3754. GVAR.OptionsFrame.Dummy4:SetWidth(frameWidth-20)
  3755. GVAR.OptionsFrame.Dummy5:SetWidth(frameWidth-20)
  3756. GVAR.OptionsFrame.Dummy6:SetWidth(frameWidth-20)
  3757. GVAR.OptionsFrame.Dummy7:SetWidth(frameWidth-20)
  3758. -- ConfigBrackets
  3759. GVAR.OptionsFrame.ConfigBrackets:SetWidth(frameWidth)
  3760. -- ConfigGeneral
  3761. GVAR.OptionsFrame.ConfigGeneral:SetWidth(frameWidth)
  3762. -- Mover
  3763. GVAR.OptionsFrame.MoverTop:SetWidth(frameWidth)
  3764. GVAR.OptionsFrame.MoverBottom:SetWidth(frameWidth)
  3765. -- ###
  3766. -- ####################################################################################################
  3767. end
  3768.  
  3769. function BattlegroundTargets:ClickOnBracketTab(bracketSize, fraction, force)
  3770. if not force and testSize == bracketSize then return end
  3771. testSize = bracketSize
  3772. local size10, size15, size40
  3773. if testSize == 10 then
  3774. size10 = true
  3775. elseif testSize == 15 then
  3776. size15 = true
  3777. elseif testSize == 40 then
  3778. size40 = true
  3779. end
  3780. GVAR.OptionsFrame.ConfigGeneral:Hide()
  3781. GVAR.OptionsFrame.ConfigBrackets:Show()
  3782. TEMPLATE.SetTabButton(GVAR.OptionsFrame.TabGeneral, nil)
  3783. TEMPLATE.SetTabButton(GVAR.OptionsFrame.TabRaidSize10, size10)
  3784. TEMPLATE.SetTabButton(GVAR.OptionsFrame.TabRaidSize15, size15)
  3785. TEMPLATE.SetTabButton(GVAR.OptionsFrame.TabRaidSize40, size40)
  3786. BattlegroundTargets:CheckForEnabledBracket(testSize, fraction)
  3787. local BattlegroundTargets_Options = BattlegroundTargets_Options
  3788. if BattlegroundTargets_Options.Friend.EnableBracket[testSize] or BattlegroundTargets_Options.Enemy.EnableBracket[testSize] then
  3789. BattlegroundTargets:EnableConfigMode()
  3790. else
  3791. BattlegroundTargets:DisableConfigMode()
  3792. end
  3793. end
  3794.  
  3795. function BattlegroundTargets:ClickOnFractionTab(side)
  3796. if fraction == side then return end
  3797. local fracF, fracE
  3798. if side == "Friend" then
  3799. fracF = true
  3800. elseif side == "Enemy" then
  3801. fracE = true
  3802. end
  3803. TEMPLATE.SetTabButton(GVAR.OptionsFrame.EnableFriendBracket, fracF)
  3804. TEMPLATE.SetTabButton(GVAR.OptionsFrame.EnableEnemyBracket, fracE)
  3805. BattlegroundTargets:CheckForEnabledBracket(currentSize, side)
  3806. fraction = side
  3807. local BattlegroundTargets_Options = BattlegroundTargets_Options
  3808. if BattlegroundTargets_Options.Friend.EnableBracket[currentSize] or BattlegroundTargets_Options.Enemy.EnableBracket[currentSize] then
  3809. BattlegroundTargets:EnableConfigMode()
  3810. else
  3811. BattlegroundTargets:DisableConfigMode()
  3812. end
  3813. end
  3814. -- ---------------------------------------------------------------------------------------------------------------------
  3815.  
  3816.  
  3817.  
  3818. -- ---------------------------------------------------------------------------------------------------------------------
  3819. function BattlegroundTargets:CreateMinimapButton()
  3820. if not BattlegroundTargets_Options.MinimapButton then
  3821. if BattlegroundTargets_MinimapButton then
  3822. BattlegroundTargets_MinimapButton:Hide()
  3823. end
  3824. return
  3825. else
  3826. if BattlegroundTargets_MinimapButton then
  3827. BattlegroundTargets_MinimapButton:Show()
  3828. return
  3829. end
  3830. end
  3831.  
  3832. local function MoveMinimapButton()
  3833. local xpos
  3834. local ypos
  3835. local minimapShape = GetMinimapShape and GetMinimapShape() or "ROUND"
  3836. if minimapShape == "SQUARE" then
  3837. xpos = 110 * cos(BattlegroundTargets_Options.MinimapButtonPos or 0)
  3838. ypos = 110 * sin(BattlegroundTargets_Options.MinimapButtonPos or 0)
  3839. xpos = math.max(-82, math.min(xpos, 84))
  3840. ypos = math.max(-86, math.min(ypos, 82))
  3841. else
  3842. xpos = 80 * cos(BattlegroundTargets_Options.MinimapButtonPos or 0)
  3843. ypos = 80 * sin(BattlegroundTargets_Options.MinimapButtonPos or 0)
  3844. end
  3845. BattlegroundTargets_MinimapButton:SetPoint("TOPLEFT", Minimap, "TOPLEFT", 54-xpos, ypos-54)
  3846. end
  3847.  
  3848. local function DragMinimapButton()
  3849. local xpos, ypos = GetCursorPosition()
  3850. local xmin, ymin = Minimap:GetLeft() or 400, Minimap:GetBottom() or 400
  3851. local scale = Minimap:GetEffectiveScale()
  3852. xpos = xmin-xpos/scale+70
  3853. ypos = ypos/scale-ymin-70
  3854. BattlegroundTargets_Options.MinimapButtonPos = math.deg(math.atan2(ypos, xpos))
  3855. MoveMinimapButton()
  3856. end
  3857.  
  3858. local MinimapButton = CreateFrame("Button", "BattlegroundTargets_MinimapButton", Minimap)
  3859. MinimapButton:EnableMouse(true)
  3860. MinimapButton:SetMovable(true)
  3861. MinimapButton:SetToplevel(true)
  3862. MinimapButton:SetWidth(32)
  3863. MinimapButton:SetHeight(32)
  3864. MinimapButton:SetPoint("TOPLEFT")
  3865. MinimapButton:SetFrameStrata("MEDIUM")
  3866. MinimapButton:RegisterForClicks("AnyUp")
  3867. MinimapButton:RegisterForDrag("LeftButton")
  3868.  
  3869. local texture = MinimapButton:CreateTexture(nil, "ARTWORK")
  3870. texture:SetWidth(54)
  3871. texture:SetHeight(54)
  3872. texture:SetPoint("TOPLEFT")
  3873. texture:SetTexture("Interface\\Minimap\\MiniMap-TrackingBorder")
  3874.  
  3875. local texture = MinimapButton:CreateTexture(nil, "BACKGROUND")
  3876. texture:SetWidth(24)
  3877. texture:SetHeight(24)
  3878. texture:SetPoint("TOPLEFT", 2, -4)
  3879. texture:SetTexture("Interface\\Minimap\\UI-Minimap-Background")
  3880.  
  3881. local NormalTexture = MinimapButton:CreateTexture(nil, "ARTWORK")
  3882. NormalTexture:SetWidth(12)
  3883. NormalTexture:SetHeight(14)
  3884. NormalTexture:SetPoint("TOPLEFT", 10.5, -8.5)
  3885. NormalTexture:SetTexture(Textures.AddonIcon)
  3886. NormalTexture:SetTexCoord(2/16, 14/16, 1/16, 15/16)
  3887. MinimapButton:SetNormalTexture(NormalTexture)
  3888.  
  3889. local PushedTexture = MinimapButton:CreateTexture(nil, "ARTWORK")
  3890. PushedTexture:SetWidth(10)
  3891. PushedTexture:SetHeight(12)
  3892. PushedTexture:SetPoint("TOPLEFT", 11.5, -9.5)
  3893. PushedTexture:SetTexture(Textures.AddonIcon)
  3894. PushedTexture:SetTexCoord(2/16, 14/16, 1/16, 15/16)
  3895. MinimapButton:SetPushedTexture(PushedTexture)
  3896.  
  3897. local HighlightTexture = MinimapButton:CreateTexture(nil, "ARTWORK")
  3898. HighlightTexture:SetPoint("TOPLEFT", 0, 0)
  3899. HighlightTexture:SetPoint("BOTTOMRIGHT", 0, 0)
  3900. HighlightTexture:SetTexture("Interface\\Minimap\\UI-Minimap-ZoomButton-Highlight")
  3901. MinimapButton:SetHighlightTexture(HighlightTexture)
  3902.  
  3903. MinimapButton:SetScript("OnEnter", function(self)
  3904. GameTooltip:SetOwner(self, "ANCHOR_RIGHT")
  3905. GameTooltip:AddLine("BattlegroundTargets", 1, 0.82, 0, 1)
  3906. GameTooltip:Show()
  3907. end)
  3908. MinimapButton:SetScript("OnLeave", function(self) GameTooltip:Hide() end)
  3909. MinimapButton:SetScript("OnClick", function(self, button) BattlegroundTargets:Frame_Toggle(GVAR.OptionsFrame) end)
  3910. MinimapButton:SetScript("OnDragStart", function(self) self:LockHighlight() self:SetScript("OnUpdate", DragMinimapButton) end)
  3911. MinimapButton:SetScript("OnDragStop", function(self) self:SetScript("OnUpdate", nil) self:UnlockHighlight() end)
  3912.  
  3913. MoveMinimapButton()
  3914. end
  3915. -- ---------------------------------------------------------------------------------------------------------------------
  3916.  
  3917. -- ---------------------------------------------------------------------------------------------------------------------
  3918. function BattlegroundTargets:SetOptions(side)
  3919. local BattlegroundTargets_Options = BattlegroundTargets_Options
  3920.  
  3921. if currentSize == 10 then
  3922. TEMPLATE.SetIconButton(GVAR.OptionsFrame.CopySettings1, 1)
  3923. elseif currentSize == 15 then
  3924. TEMPLATE.SetIconButton(GVAR.OptionsFrame.CopySettings1, 2)
  3925. end
  3926. if side == "Enemy" then
  3927. TEMPLATE.SetIconButton(GVAR.OptionsFrame.CopySettings2, 2)
  3928. else
  3929. TEMPLATE.SetIconButton(GVAR.OptionsFrame.CopySettings2, 1)
  3930. end
  3931.  
  3932. local LayoutTH = BattlegroundTargets_Options[side].LayoutTH[currentSize]
  3933. if LayoutTH == 18 then
  3934. GVAR.OptionsFrame.LayoutTHx18:SetChecked(true)
  3935. GVAR.OptionsFrame.LayoutTHx24:SetChecked(false)
  3936. GVAR.OptionsFrame.LayoutTHx42:SetChecked(false)
  3937. GVAR.OptionsFrame.LayoutTHx81:SetChecked(false)
  3938. elseif LayoutTH == 24 then
  3939. GVAR.OptionsFrame.LayoutTHx18:SetChecked(false)
  3940. GVAR.OptionsFrame.LayoutTHx24:SetChecked(true)
  3941. GVAR.OptionsFrame.LayoutTHx42:SetChecked(false)
  3942. GVAR.OptionsFrame.LayoutTHx81:SetChecked(false)
  3943. elseif LayoutTH == 42 then
  3944. GVAR.OptionsFrame.LayoutTHx18:SetChecked(false)
  3945. GVAR.OptionsFrame.LayoutTHx24:SetChecked(false)
  3946. GVAR.OptionsFrame.LayoutTHx42:SetChecked(true)
  3947. GVAR.OptionsFrame.LayoutTHx81:SetChecked(false)
  3948. elseif LayoutTH == 81 then
  3949. GVAR.OptionsFrame.LayoutTHx18:SetChecked(false)
  3950. GVAR.OptionsFrame.LayoutTHx24:SetChecked(false)
  3951. GVAR.OptionsFrame.LayoutTHx42:SetChecked(false)
  3952. GVAR.OptionsFrame.LayoutTHx81:SetChecked(true)
  3953. end
  3954. GVAR.OptionsFrame.LayoutSpace:SetValue(BattlegroundTargets_Options[side].LayoutSpace[currentSize])
  3955. GVAR.OptionsFrame.LayoutSpaceText:SetText(BattlegroundTargets_Options[side].LayoutSpace[currentSize])
  3956.  
  3957. GVAR.OptionsFrame.SummaryToggle:SetChecked(BattlegroundTargets_Options[side].SummaryToggle[currentSize])
  3958. GVAR.OptionsFrame.SummaryScale:SetValue(BattlegroundTargets_Options[side].SummaryScale[currentSize]*100)
  3959. GVAR.OptionsFrame.SummaryScaleText:SetText((BattlegroundTargets_Options[side].SummaryScale[currentSize]*100).."%")
  3960. GVAR.OptionsFrame.SummaryPosition:SetValue(BattlegroundTargets_Options[side].SummaryPos[currentSize])
  3961. GVAR.OptionsFrame.SummaryPositionText:SetText(sumPos[ BattlegroundTargets_Options[side].SummaryPos[currentSize] ])
  3962.  
  3963. GVAR.OptionsFrame.ShowRole:SetChecked(BattlegroundTargets_Options[side].ButtonRoleToggle[currentSize])
  3964. GVAR.OptionsFrame.ShowSpec:SetChecked(BattlegroundTargets_Options[side].ButtonSpecToggle[currentSize])
  3965. GVAR.OptionsFrame.ClassIcon:SetChecked(BattlegroundTargets_Options[side].ButtonClassToggle[currentSize])
  3966. GVAR.OptionsFrame.ShowLeader:SetChecked(BattlegroundTargets_Options[side].ButtonLeaderToggle[currentSize])
  3967. GVAR.OptionsFrame.ShowRealm:SetChecked(BattlegroundTargets_Options[side].ButtonRealmToggle[currentSize])
  3968. GVAR.OptionsFrame.ShowPVPTrinket:SetChecked(BattlegroundTargets_Options[side].ButtonPvPTrinketToggle[currentSize])
  3969.  
  3970. GVAR.OptionsFrame.ShowTargetIndicator:SetChecked(BattlegroundTargets_Options[side].ButtonTargetToggle[currentSize])
  3971. GVAR.OptionsFrame.TargetScaleSlider:SetValue(BattlegroundTargets_Options[side].ButtonTargetScale[currentSize]*100)
  3972. GVAR.OptionsFrame.TargetScaleSliderText:SetText((BattlegroundTargets_Options[side].ButtonTargetScale[currentSize]*100).."%")
  3973. GVAR.OptionsFrame.TargetPositionSlider:SetValue(BattlegroundTargets_Options[side].ButtonTargetPosition[currentSize])
  3974. GVAR.OptionsFrame.TargetPositionSliderText:SetText(BattlegroundTargets_Options[side].ButtonTargetPosition[currentSize])
  3975.  
  3976. GVAR.OptionsFrame.ShowFocusIndicator:SetChecked(BattlegroundTargets_Options[side].ButtonFocusToggle[currentSize])
  3977. GVAR.OptionsFrame.FocusScaleSlider:SetValue(BattlegroundTargets_Options[side].ButtonFocusScale[currentSize]*100)
  3978. GVAR.OptionsFrame.FocusScaleSliderText:SetText((BattlegroundTargets_Options[side].ButtonFocusScale[currentSize]*100).."%")
  3979. GVAR.OptionsFrame.FocusPositionSlider:SetValue(BattlegroundTargets_Options[side].ButtonFocusPosition[currentSize])
  3980. GVAR.OptionsFrame.FocusPositionSliderText:SetText(BattlegroundTargets_Options[side].ButtonFocusPosition[currentSize])
  3981.  
  3982. GVAR.OptionsFrame.ShowFlag:SetChecked(BattlegroundTargets_Options[side].ButtonFlagToggle[currentSize])
  3983. GVAR.OptionsFrame.FlagScaleSlider:SetValue(BattlegroundTargets_Options[side].ButtonFlagScale[currentSize]*100)
  3984. GVAR.OptionsFrame.FlagScaleSliderText:SetText((BattlegroundTargets_Options[side].ButtonFlagScale[currentSize]*100).."%")
  3985. GVAR.OptionsFrame.FlagPositionSlider:SetValue(BattlegroundTargets_Options[side].ButtonFlagPosition[currentSize])
  3986. GVAR.OptionsFrame.FlagPositionSliderText:SetText(BattlegroundTargets_Options[side].ButtonFlagPosition[currentSize])
  3987.  
  3988. GVAR.OptionsFrame.ShowAssist:SetChecked(BattlegroundTargets_Options[side].ButtonAssistToggle[currentSize])
  3989. GVAR.OptionsFrame.AssistScaleSlider:SetValue(BattlegroundTargets_Options[side].ButtonAssistScale[currentSize]*100)
  3990. GVAR.OptionsFrame.AssistScaleSliderText:SetText((BattlegroundTargets_Options[side].ButtonAssistScale[currentSize]*100).."%")
  3991. GVAR.OptionsFrame.AssistPositionSlider:SetValue(BattlegroundTargets_Options[side].ButtonAssistPosition[currentSize])
  3992. GVAR.OptionsFrame.AssistPositionSliderText:SetText(BattlegroundTargets_Options[side].ButtonAssistPosition[currentSize])
  3993.  
  3994. GVAR.OptionsFrame.ShowFTargetCount:SetChecked(BattlegroundTargets_Options[side].ButtonFTargetCountToggle[currentSize])
  3995. GVAR.OptionsFrame.ShowETargetCount:SetChecked(BattlegroundTargets_Options[side].ButtonETargetCountToggle[currentSize])
  3996. GVAR.OptionsFrame.TargetofTarget:SetChecked(BattlegroundTargets_Options[side].ButtonToTToggle[currentSize])
  3997. GVAR.OptionsFrame.ToTScaleSlider:SetValue(BattlegroundTargets_Options[side].ButtonToTScale[currentSize]*100)
  3998. GVAR.OptionsFrame.ToTScaleSliderText:SetText((BattlegroundTargets_Options[side].ButtonToTScale[currentSize]*100).."%")
  3999. GVAR.OptionsFrame.ToTPositionSlider:SetValue(BattlegroundTargets_Options[side].ButtonToTPosition[currentSize])
  4000. GVAR.OptionsFrame.ToTPositionSliderText:SetText(BattlegroundTargets_Options[side].ButtonToTPosition[currentSize])
  4001.  
  4002. GVAR.OptionsFrame.ShowHealthBar:SetChecked(BattlegroundTargets_Options[side].ButtonHealthBarToggle[currentSize])
  4003. GVAR.OptionsFrame.ShowHealthText:SetChecked(BattlegroundTargets_Options[side].ButtonHealthTextToggle[currentSize])
  4004.  
  4005. GVAR.OptionsFrame.RangeCheck:SetChecked(BattlegroundTargets_Options[side].ButtonRangeToggle[currentSize])
  4006. GVAR.OptionsFrame.RangeDisplayPullDown.PullDownButtonText:SetText(rangeDisplay[ BattlegroundTargets_Options[side].ButtonRangeDisplay[currentSize] ])
  4007.  
  4008. GVAR.OptionsFrame.SortByPullDown.PullDownButtonText:SetText(sortBy[ BattlegroundTargets_Options[side].ButtonSortBy[currentSize] ])
  4009. GVAR.OptionsFrame.SortDetailPullDown.PullDownButtonText:SetText(sortDetail[ BattlegroundTargets_Options[side].ButtonSortDetail[currentSize] ])
  4010. local ButtonSortBy = BattlegroundTargets_Options[side].ButtonSortBy[currentSize]
  4011. if ButtonSortBy == 1 or ButtonSortBy == 3 or ButtonSortBy == 4 then
  4012. GVAR.OptionsFrame.SortDetailPullDown:Show()
  4013. GVAR.OptionsFrame.SortInfo:Show()
  4014. else
  4015. GVAR.OptionsFrame.SortDetailPullDown:Hide()
  4016. GVAR.OptionsFrame.SortInfo:Hide()
  4017. end
  4018.  
  4019. GVAR.OptionsFrame.FontNamePullDown.PullDownButtonText:SetText(fontStyles[ BattlegroundTargets_Options[side].ButtonFontNameStyle[currentSize] ].name)
  4020. GVAR.OptionsFrame.FontNameSlider:SetValue(BattlegroundTargets_Options[side].ButtonFontNameSize[currentSize])
  4021. GVAR.OptionsFrame.FontNameValue:SetText(BattlegroundTargets_Options[side].ButtonFontNameSize[currentSize])
  4022. GVAR.OptionsFrame.FontNumberPullDown.PullDownButtonText:SetText(strmatch(fontStyles[ BattlegroundTargets_Options[side].ButtonFontNumberStyle[currentSize] ].name, "(.*) %- .*"))
  4023. GVAR.OptionsFrame.FontNumberSlider:SetValue(BattlegroundTargets_Options[side].ButtonFontNumberSize[currentSize])
  4024. GVAR.OptionsFrame.FontNumberValue:SetText(BattlegroundTargets_Options[side].ButtonFontNumberSize[currentSize])
  4025.  
  4026. GVAR.OptionsFrame.ScaleSlider:SetValue(BattlegroundTargets_Options[side].ButtonScale[currentSize]*100)
  4027. GVAR.OptionsFrame.ScaleValue:SetText((BattlegroundTargets_Options[side].ButtonScale[currentSize]*100).."%")
  4028.  
  4029. GVAR.OptionsFrame.WidthSlider:SetValue(BattlegroundTargets_Options[side].ButtonWidth[currentSize])
  4030. GVAR.OptionsFrame.WidthValue:SetText(BattlegroundTargets_Options[side].ButtonWidth[currentSize])
  4031.  
  4032. GVAR.OptionsFrame.HeightSlider:SetValue(BattlegroundTargets_Options[side].ButtonHeight[currentSize])
  4033. GVAR.OptionsFrame.HeightValue:SetText(BattlegroundTargets_Options[side].ButtonHeight[currentSize])
  4034. end
  4035.  
  4036.  
  4037.  
  4038. function BattlegroundTargets:CheckForEnabledBracket(bracketSize, side)
  4039. local BattlegroundTargets_Options = BattlegroundTargets_Options
  4040.  
  4041. if BattlegroundTargets_Options.Friend.EnableBracket[bracketSize] or BattlegroundTargets_Options.Enemy.EnableBracket[bracketSize] then
  4042. GVAR.OptionsFrame["TabRaidSize"..bracketSize].TabText:SetTextColor(0, 0.75, 0, 1)
  4043. else
  4044. GVAR.OptionsFrame["TabRaidSize"..bracketSize].TabText:SetTextColor(1, 0, 0, 1)
  4045. end
  4046.  
  4047. if BattlegroundTargets_Options.Friend.EnableBracket[bracketSize] and BattlegroundTargets_Options.Enemy.EnableBracket[bracketSize] then
  4048. GVAR.OptionsFrame.EnableFriendBracket.TabText:SetTextColor(0, 0.75, 0, 1)
  4049. GVAR.OptionsFrame.EnableEnemyBracket.TabText:SetTextColor(0, 0.75, 0, 1)
  4050. elseif BattlegroundTargets_Options.Friend.EnableBracket[bracketSize] then
  4051. GVAR.OptionsFrame.EnableFriendBracket.TabText:SetTextColor(0, 0.75, 0, 1)
  4052. GVAR.OptionsFrame.EnableEnemyBracket.TabText:SetTextColor(1, 0, 0, 1)
  4053. elseif BattlegroundTargets_Options.Enemy.EnableBracket[bracketSize] then
  4054. GVAR.OptionsFrame.EnableFriendBracket.TabText:SetTextColor(1, 0, 0, 1)
  4055. GVAR.OptionsFrame.EnableEnemyBracket.TabText:SetTextColor(0, 0.75, 0, 1)
  4056. else
  4057. GVAR.OptionsFrame.EnableFriendBracket.TabText:SetTextColor(1, 0, 0, 1)
  4058. GVAR.OptionsFrame.EnableEnemyBracket.TabText:SetTextColor(1, 0, 0, 1)
  4059. end
  4060.  
  4061. if side == "Friend" then
  4062. GVAR.FriendMainFrame.MainMoverButton[1].Texture:SetColorTexture(0, 0, 0, 1)
  4063. GVAR.FriendMainFrame.MainMoverButton[2].Texture:SetColorTexture(0, 0, 0, 1)
  4064. GVAR.EnemyMainFrame.MainMoverButton[1].Texture:SetColorTexture(1, 1, 1, 0.2)
  4065. GVAR.EnemyMainFrame.MainMoverButton[2].Texture:SetColorTexture(1, 1, 1, 0.2)
  4066. GVAR.FriendMainFrame.MainMoverFracTxt:SetTextColor(1, 1, 1, 1)
  4067. GVAR.EnemyMainFrame.MainMoverFracTxt:SetTextColor(0.5, 0.5, 0.5, 1)
  4068. else
  4069. GVAR.FriendMainFrame.MainMoverButton[1].Texture:SetColorTexture(1, 1, 1, 0.2)
  4070. GVAR.FriendMainFrame.MainMoverButton[2].Texture:SetColorTexture(1, 1, 1, 0.2)
  4071. GVAR.EnemyMainFrame.MainMoverButton[1].Texture:SetColorTexture(0, 0, 0, 1)
  4072. GVAR.EnemyMainFrame.MainMoverButton[2].Texture:SetColorTexture(0, 0, 0, 1)
  4073. GVAR.FriendMainFrame.MainMoverFracTxt:SetTextColor(0.5, 0.5, 0.5, 1)
  4074. GVAR.EnemyMainFrame.MainMoverFracTxt:SetTextColor(1, 1, 1, 1)
  4075. end
  4076.  
  4077. GVAR.OptionsFrame.EnableFraction:SetChecked(BattlegroundTargets_Options[side].EnableBracket[bracketSize])
  4078.  
  4079. if BattlegroundTargets_Options[side].EnableBracket[bracketSize] then
  4080. -- ----------------------------------------
  4081. GVAR.OptionsFrame.LayoutTHText:SetTextColor(1, 1, 1, 1)
  4082. TEMPLATE.EnableCheckButton(GVAR.OptionsFrame.LayoutTHx18)
  4083. if bracketSize == 10 or bracketSize == 15 then
  4084. TEMPLATE.DisableCheckButton(GVAR.OptionsFrame.LayoutTHx24)
  4085. TEMPLATE.DisableCheckButton(GVAR.OptionsFrame.LayoutTHx42)
  4086. else
  4087. TEMPLATE.EnableCheckButton(GVAR.OptionsFrame.LayoutTHx24)
  4088. TEMPLATE.EnableCheckButton(GVAR.OptionsFrame.LayoutTHx42)
  4089. end
  4090. TEMPLATE.EnableCheckButton(GVAR.OptionsFrame.LayoutTHx81)
  4091. if BattlegroundTargets_Options[side].LayoutTH[bracketSize] == 18 then
  4092. TEMPLATE.DisableSlider(GVAR.OptionsFrame.LayoutSpace)
  4093. else
  4094. TEMPLATE.EnableSlider(GVAR.OptionsFrame.LayoutSpace)
  4095. end
  4096.  
  4097. GVAR.OptionsFrame.SummaryText:SetTextColor(1, 1, 1, 1)
  4098. TEMPLATE.EnableCheckButton(GVAR.OptionsFrame.SummaryToggle)
  4099. if BattlegroundTargets_Options[side].SummaryToggle[bracketSize] then
  4100. TEMPLATE.EnableSlider(GVAR.OptionsFrame.SummaryScale)
  4101. TEMPLATE.EnableSlider(GVAR.OptionsFrame.SummaryPosition)
  4102. else
  4103. TEMPLATE.DisableSlider(GVAR.OptionsFrame.SummaryScale)
  4104. TEMPLATE.DisableSlider(GVAR.OptionsFrame.SummaryPosition)
  4105. end
  4106.  
  4107. if bracketSize == 40 then
  4108. GVAR.OptionsFrame.CopySettings1:Hide()
  4109. TEMPLATE.EnableIconButton(GVAR.OptionsFrame.CopySettings2)
  4110. else
  4111. GVAR.OptionsFrame.CopySettings1:Show()
  4112. GVAR.OptionsFrame.CopySettings2:Show()
  4113. TEMPLATE.EnableIconButton(GVAR.OptionsFrame.CopySettings1)
  4114. TEMPLATE.EnableIconButton(GVAR.OptionsFrame.CopySettings2)
  4115. end
  4116.  
  4117. TEMPLATE.EnableCheckButton(GVAR.OptionsFrame.ShowRole)
  4118. TEMPLATE.EnableCheckButton(GVAR.OptionsFrame.ShowSpec)
  4119. TEMPLATE.EnableCheckButton(GVAR.OptionsFrame.ClassIcon)
  4120. TEMPLATE.EnableCheckButton(GVAR.OptionsFrame.ShowLeader)
  4121. TEMPLATE.EnableCheckButton(GVAR.OptionsFrame.ShowRealm)
  4122. TEMPLATE.EnableCheckButton(GVAR.OptionsFrame.ShowPVPTrinket)
  4123.  
  4124. TEMPLATE.EnableCheckButton(GVAR.OptionsFrame.ShowTargetIndicator)
  4125. if BattlegroundTargets_Options[side].ButtonTargetToggle[bracketSize] then
  4126. TEMPLATE.EnableSlider(GVAR.OptionsFrame.TargetScaleSlider)
  4127. TEMPLATE.EnableSlider(GVAR.OptionsFrame.TargetPositionSlider)
  4128. else
  4129. TEMPLATE.DisableSlider(GVAR.OptionsFrame.TargetScaleSlider)
  4130. TEMPLATE.DisableSlider(GVAR.OptionsFrame.TargetPositionSlider)
  4131. end
  4132. TEMPLATE.EnableCheckButton(GVAR.OptionsFrame.ShowFocusIndicator)
  4133. if BattlegroundTargets_Options[side].ButtonFocusToggle[bracketSize] then
  4134. TEMPLATE.EnableSlider(GVAR.OptionsFrame.FocusScaleSlider)
  4135. TEMPLATE.EnableSlider(GVAR.OptionsFrame.FocusPositionSlider)
  4136. else
  4137. TEMPLATE.DisableSlider(GVAR.OptionsFrame.FocusScaleSlider)
  4138. TEMPLATE.DisableSlider(GVAR.OptionsFrame.FocusPositionSlider)
  4139. end
  4140. if bracketSize == 40 then
  4141. TEMPLATE.DisableCheckButton(GVAR.OptionsFrame.ShowFlag)
  4142. TEMPLATE.DisableSlider(GVAR.OptionsFrame.FlagScaleSlider)
  4143. TEMPLATE.DisableSlider(GVAR.OptionsFrame.FlagPositionSlider)
  4144. GVAR.OptionsFrame.CarrierSwitchDisableFunc()
  4145. else
  4146. TEMPLATE.EnableCheckButton(GVAR.OptionsFrame.ShowFlag)
  4147. if BattlegroundTargets_Options[side].ButtonFlagToggle[bracketSize] then
  4148. TEMPLATE.EnableSlider(GVAR.OptionsFrame.FlagScaleSlider)
  4149. TEMPLATE.EnableSlider(GVAR.OptionsFrame.FlagPositionSlider)
  4150. GVAR.OptionsFrame.CarrierSwitchEnableFunc()
  4151. else
  4152. TEMPLATE.DisableSlider(GVAR.OptionsFrame.FlagScaleSlider)
  4153. TEMPLATE.DisableSlider(GVAR.OptionsFrame.FlagPositionSlider)
  4154. GVAR.OptionsFrame.CarrierSwitchDisableFunc()
  4155. end
  4156. end
  4157. TEMPLATE.EnableCheckButton(GVAR.OptionsFrame.ShowAssist)
  4158. if BattlegroundTargets_Options[side].ButtonAssistToggle[bracketSize] then
  4159. TEMPLATE.EnableSlider(GVAR.OptionsFrame.AssistScaleSlider)
  4160. TEMPLATE.EnableSlider(GVAR.OptionsFrame.AssistPositionSlider)
  4161. else
  4162. TEMPLATE.DisableSlider(GVAR.OptionsFrame.AssistScaleSlider)
  4163. TEMPLATE.DisableSlider(GVAR.OptionsFrame.AssistPositionSlider)
  4164. end
  4165.  
  4166. TEMPLATE.EnableCheckButton(GVAR.OptionsFrame.ShowFTargetCount)
  4167. TEMPLATE.EnableCheckButton(GVAR.OptionsFrame.ShowETargetCount)
  4168. TEMPLATE.EnableCheckButton(GVAR.OptionsFrame.TargetofTarget)
  4169. if BattlegroundTargets_Options[side].ButtonToTToggle[bracketSize] then
  4170. TEMPLATE.EnableSlider(GVAR.OptionsFrame.ToTScaleSlider)
  4171. TEMPLATE.EnableSlider(GVAR.OptionsFrame.ToTPositionSlider)
  4172. else
  4173. TEMPLATE.DisableSlider(GVAR.OptionsFrame.ToTScaleSlider)
  4174. TEMPLATE.DisableSlider(GVAR.OptionsFrame.ToTPositionSlider)
  4175. end
  4176.  
  4177. TEMPLATE.EnableCheckButton(GVAR.OptionsFrame.ShowHealthBar)
  4178. TEMPLATE.EnableCheckButton(GVAR.OptionsFrame.ShowHealthText)
  4179.  
  4180. TEMPLATE.EnableCheckButton(GVAR.OptionsFrame.RangeCheck)
  4181. if BattlegroundTargets_Options[side].ButtonRangeToggle[bracketSize] then
  4182. GVAR.OptionsFrame.RangeCheckInfo:Enable() Desaturation(GVAR.OptionsFrame.RangeCheckInfo.Texture, false)
  4183. TEMPLATE.EnablePullDownMenu(GVAR.OptionsFrame.RangeDisplayPullDown)
  4184. else
  4185. GVAR.OptionsFrame.RangeCheckInfo:Disable() Desaturation(GVAR.OptionsFrame.RangeCheckInfo.Texture, true)
  4186. TEMPLATE.DisablePullDownMenu(GVAR.OptionsFrame.RangeDisplayPullDown)
  4187. end
  4188.  
  4189. TEMPLATE.EnablePullDownMenu(GVAR.OptionsFrame.SortByPullDown)
  4190. GVAR.OptionsFrame.SortByTitle:SetTextColor(1, 1, 1, 1)
  4191. TEMPLATE.EnablePullDownMenu(GVAR.OptionsFrame.SortDetailPullDown)
  4192. GVAR.OptionsFrame.SortInfo:Enable() Desaturation(GVAR.OptionsFrame.SortInfo.Texture, false)
  4193.  
  4194. TEMPLATE.EnablePullDownMenu(GVAR.OptionsFrame.FontNamePullDown)
  4195. GVAR.OptionsFrame.FontNameTitle:SetTextColor(1, 1, 1, 1)
  4196. TEMPLATE.EnableSlider(GVAR.OptionsFrame.FontNameSlider)
  4197. if BattlegroundTargets_Options[side].SummaryToggle[bracketSize] or
  4198. BattlegroundTargets_Options[side].ButtonFlagToggle[bracketSize] or
  4199. BattlegroundTargets_Options[side].ButtonHealthTextToggle[bracketSize] or
  4200. BattlegroundTargets_Options[side].ButtonFTargetCountToggle[bracketSize] or
  4201. BattlegroundTargets_Options[side].ButtonETargetCountToggle[bracketSize]
  4202. then
  4203. TEMPLATE.EnablePullDownMenu(GVAR.OptionsFrame.FontNumberPullDown)
  4204. GVAR.OptionsFrame.FontNumberTitle:SetTextColor(1, 1, 1, 1)
  4205. TEMPLATE.EnableSlider(GVAR.OptionsFrame.FontNumberSlider)
  4206. else
  4207. TEMPLATE.DisablePullDownMenu(GVAR.OptionsFrame.FontNumberPullDown)
  4208. GVAR.OptionsFrame.FontNumberTitle:SetTextColor(0.5, 0.5, 0.5, 1)
  4209. TEMPLATE.DisableSlider(GVAR.OptionsFrame.FontNumberSlider)
  4210. end
  4211.  
  4212. TEMPLATE.EnableSlider(GVAR.OptionsFrame.ScaleSlider)
  4213. GVAR.OptionsFrame.ScaleTitle:SetTextColor(1, 1, 1, 1)
  4214. TEMPLATE.EnableSlider(GVAR.OptionsFrame.WidthSlider)
  4215. GVAR.OptionsFrame.WidthTitle:SetTextColor(1, 1, 1, 1)
  4216. TEMPLATE.EnableSlider(GVAR.OptionsFrame.HeightSlider)
  4217. GVAR.OptionsFrame.HeightTitle:SetTextColor(1, 1, 1, 1)
  4218. GVAR.OptionsFrame.TestShuffler:Show()
  4219. -- ----------------------------------------
  4220. else
  4221. -- ----------------------------------------
  4222. GVAR.OptionsFrame.LayoutTHText:SetTextColor(0.5, 0.5, 0.5, 1)
  4223. TEMPLATE.DisableCheckButton(GVAR.OptionsFrame.LayoutTHx18)
  4224. TEMPLATE.DisableCheckButton(GVAR.OptionsFrame.LayoutTHx24)
  4225. TEMPLATE.DisableCheckButton(GVAR.OptionsFrame.LayoutTHx42)
  4226. TEMPLATE.DisableCheckButton(GVAR.OptionsFrame.LayoutTHx81)
  4227. TEMPLATE.DisableSlider(GVAR.OptionsFrame.LayoutSpace)
  4228.  
  4229. GVAR.OptionsFrame.SummaryText:SetTextColor(0.5, 0.5, 0.5, 1)
  4230. TEMPLATE.DisableCheckButton(GVAR.OptionsFrame.SummaryToggle)
  4231. TEMPLATE.DisableSlider(GVAR.OptionsFrame.SummaryScale)
  4232. TEMPLATE.DisableSlider(GVAR.OptionsFrame.SummaryPosition)
  4233.  
  4234. if bracketSize == 40 then
  4235. GVAR.OptionsFrame.CopySettings1:Hide()
  4236. TEMPLATE.DisableIconButton(GVAR.OptionsFrame.CopySettings2)
  4237. else
  4238. GVAR.OptionsFrame.CopySettings1:Show()
  4239. GVAR.OptionsFrame.CopySettings2:Show()
  4240. TEMPLATE.DisableIconButton(GVAR.OptionsFrame.CopySettings1)
  4241. TEMPLATE.DisableIconButton(GVAR.OptionsFrame.CopySettings2)
  4242. end
  4243.  
  4244. TEMPLATE.DisableCheckButton(GVAR.OptionsFrame.ShowRole)
  4245. TEMPLATE.DisableCheckButton(GVAR.OptionsFrame.ShowSpec)
  4246. TEMPLATE.DisableCheckButton(GVAR.OptionsFrame.ClassIcon)
  4247. TEMPLATE.DisableCheckButton(GVAR.OptionsFrame.ShowLeader)
  4248. TEMPLATE.DisableCheckButton(GVAR.OptionsFrame.ShowRealm)
  4249. TEMPLATE.DisableCheckButton(GVAR.OptionsFrame.ShowPVPTrinket)
  4250.  
  4251. TEMPLATE.DisableCheckButton(GVAR.OptionsFrame.ShowTargetIndicator)
  4252. TEMPLATE.DisableSlider(GVAR.OptionsFrame.TargetScaleSlider)
  4253. TEMPLATE.DisableSlider(GVAR.OptionsFrame.TargetPositionSlider)
  4254. TEMPLATE.DisableCheckButton(GVAR.OptionsFrame.ShowFocusIndicator)
  4255. TEMPLATE.DisableSlider(GVAR.OptionsFrame.FocusScaleSlider)
  4256. TEMPLATE.DisableSlider(GVAR.OptionsFrame.FocusPositionSlider)
  4257. TEMPLATE.DisableCheckButton(GVAR.OptionsFrame.ShowFlag)
  4258. TEMPLATE.DisableSlider(GVAR.OptionsFrame.FlagScaleSlider)
  4259. TEMPLATE.DisableSlider(GVAR.OptionsFrame.FlagPositionSlider)
  4260. GVAR.OptionsFrame.CarrierSwitchDisableFunc()
  4261. TEMPLATE.DisableCheckButton(GVAR.OptionsFrame.ShowAssist)
  4262. TEMPLATE.DisableSlider(GVAR.OptionsFrame.AssistScaleSlider)
  4263. TEMPLATE.DisableSlider(GVAR.OptionsFrame.AssistPositionSlider)
  4264.  
  4265. TEMPLATE.DisableCheckButton(GVAR.OptionsFrame.ShowFTargetCount)
  4266. TEMPLATE.DisableCheckButton(GVAR.OptionsFrame.ShowETargetCount)
  4267. TEMPLATE.DisableCheckButton(GVAR.OptionsFrame.TargetofTarget)
  4268. TEMPLATE.DisableSlider(GVAR.OptionsFrame.ToTScaleSlider)
  4269. TEMPLATE.DisableSlider(GVAR.OptionsFrame.ToTPositionSlider)
  4270.  
  4271. TEMPLATE.DisableCheckButton(GVAR.OptionsFrame.ShowHealthBar)
  4272. TEMPLATE.DisableCheckButton(GVAR.OptionsFrame.ShowHealthText)
  4273.  
  4274. TEMPLATE.DisableCheckButton(GVAR.OptionsFrame.RangeCheck)
  4275. GVAR.OptionsFrame.RangeCheckInfo:Disable() Desaturation(GVAR.OptionsFrame.RangeCheckInfo.Texture, true)
  4276. TEMPLATE.DisablePullDownMenu(GVAR.OptionsFrame.RangeDisplayPullDown)
  4277.  
  4278. TEMPLATE.DisablePullDownMenu(GVAR.OptionsFrame.SortByPullDown)
  4279. GVAR.OptionsFrame.SortByTitle:SetTextColor(0.5, 0.5, 0.5, 1)
  4280. TEMPLATE.DisablePullDownMenu(GVAR.OptionsFrame.SortDetailPullDown)
  4281. GVAR.OptionsFrame.SortInfo:Disable() Desaturation(GVAR.OptionsFrame.SortInfo.Texture, true)
  4282.  
  4283. TEMPLATE.DisablePullDownMenu(GVAR.OptionsFrame.FontNamePullDown)
  4284. GVAR.OptionsFrame.FontNameTitle:SetTextColor(0.5, 0.5, 0.5, 1)
  4285. TEMPLATE.DisableSlider(GVAR.OptionsFrame.FontNameSlider)
  4286. TEMPLATE.DisablePullDownMenu(GVAR.OptionsFrame.FontNumberPullDown)
  4287. GVAR.OptionsFrame.FontNumberTitle:SetTextColor(0.5, 0.5, 0.5, 1)
  4288. TEMPLATE.DisableSlider(GVAR.OptionsFrame.FontNumberSlider)
  4289.  
  4290. TEMPLATE.DisableSlider(GVAR.OptionsFrame.ScaleSlider)
  4291. GVAR.OptionsFrame.ScaleTitle:SetTextColor(0.5, 0.5, 0.5, 1)
  4292. TEMPLATE.DisableSlider(GVAR.OptionsFrame.WidthSlider)
  4293. GVAR.OptionsFrame.WidthTitle:SetTextColor(0.5, 0.5, 0.5, 1)
  4294. TEMPLATE.DisableSlider(GVAR.OptionsFrame.HeightSlider)
  4295. GVAR.OptionsFrame.HeightTitle:SetTextColor(0.5, 0.5, 0.5, 1)
  4296. GVAR.OptionsFrame.TestShuffler:Hide()
  4297. -- ----------------------------------------
  4298. end
  4299. end
  4300.  
  4301.  
  4302.  
  4303. function BattlegroundTargets:DisableInsecureConfigWidges()
  4304. TEMPLATE.DisableCheckButton(GVAR.OptionsFrame.Minimap)
  4305.  
  4306. TEMPLATE.DisableTabButton(GVAR.OptionsFrame.TabGeneral)
  4307. TEMPLATE.DisableTabButton(GVAR.OptionsFrame.TabRaidSize10)
  4308. TEMPLATE.DisableTabButton(GVAR.OptionsFrame.TabRaidSize15)
  4309. TEMPLATE.DisableTabButton(GVAR.OptionsFrame.TabRaidSize40)
  4310.  
  4311. TEMPLATE.DisableTabButton(GVAR.OptionsFrame.EnableFriendBracket)
  4312. TEMPLATE.DisableTabButton(GVAR.OptionsFrame.EnableEnemyBracket)
  4313.  
  4314. TEMPLATE.DisableCheckButton(GVAR.OptionsFrame.EnableFraction)
  4315.  
  4316. TEMPLATE.DisableIconButton(GVAR.OptionsFrame.CopySettings1)
  4317. TEMPLATE.DisableIconButton(GVAR.OptionsFrame.CopySettings2)
  4318.  
  4319. GVAR.OptionsFrame.LayoutTHText:SetTextColor(0.5, 0.5, 0.5, 1)
  4320. TEMPLATE.DisableCheckButton(GVAR.OptionsFrame.LayoutTHx18)
  4321. TEMPLATE.DisableCheckButton(GVAR.OptionsFrame.LayoutTHx24)
  4322. TEMPLATE.DisableCheckButton(GVAR.OptionsFrame.LayoutTHx42)
  4323. TEMPLATE.DisableCheckButton(GVAR.OptionsFrame.LayoutTHx81)
  4324. TEMPLATE.DisableSlider(GVAR.OptionsFrame.LayoutSpace)
  4325.  
  4326. GVAR.OptionsFrame.SummaryText:SetTextColor(0.5, 0.5, 0.5, 1)
  4327. TEMPLATE.DisableCheckButton(GVAR.OptionsFrame.SummaryToggle)
  4328. TEMPLATE.DisableSlider(GVAR.OptionsFrame.SummaryScale)
  4329. TEMPLATE.DisableSlider(GVAR.OptionsFrame.SummaryPosition)
  4330.  
  4331. TEMPLATE.DisableCheckButton(GVAR.OptionsFrame.ShowRole)
  4332. TEMPLATE.DisableCheckButton(GVAR.OptionsFrame.ShowSpec)
  4333. TEMPLATE.DisableCheckButton(GVAR.OptionsFrame.ClassIcon)
  4334. TEMPLATE.DisableCheckButton(GVAR.OptionsFrame.ShowLeader)
  4335. TEMPLATE.DisableCheckButton(GVAR.OptionsFrame.ShowRealm)
  4336. TEMPLATE.DisableCheckButton(GVAR.OptionsFrame.ShowPVPTrinket)
  4337.  
  4338. TEMPLATE.DisableCheckButton(GVAR.OptionsFrame.ShowTargetIndicator)
  4339. TEMPLATE.DisableSlider(GVAR.OptionsFrame.TargetScaleSlider)
  4340. TEMPLATE.DisableSlider(GVAR.OptionsFrame.TargetPositionSlider)
  4341. TEMPLATE.DisableCheckButton(GVAR.OptionsFrame.ShowFocusIndicator)
  4342. TEMPLATE.DisableSlider(GVAR.OptionsFrame.FocusScaleSlider)
  4343. TEMPLATE.DisableSlider(GVAR.OptionsFrame.FocusPositionSlider)
  4344. TEMPLATE.DisableCheckButton(GVAR.OptionsFrame.ShowFlag)
  4345. TEMPLATE.DisableSlider(GVAR.OptionsFrame.FlagScaleSlider)
  4346. TEMPLATE.DisableSlider(GVAR.OptionsFrame.FlagPositionSlider)
  4347. GVAR.OptionsFrame.CarrierSwitchDisableFunc()
  4348. TEMPLATE.DisableCheckButton(GVAR.OptionsFrame.ShowAssist)
  4349. TEMPLATE.DisableSlider(GVAR.OptionsFrame.AssistScaleSlider)
  4350. TEMPLATE.DisableSlider(GVAR.OptionsFrame.AssistPositionSlider)
  4351.  
  4352. TEMPLATE.DisableCheckButton(GVAR.OptionsFrame.ShowFTargetCount)
  4353. TEMPLATE.DisableCheckButton(GVAR.OptionsFrame.ShowETargetCount)
  4354. TEMPLATE.DisableCheckButton(GVAR.OptionsFrame.TargetofTarget)
  4355. TEMPLATE.DisableSlider(GVAR.OptionsFrame.ToTScaleSlider)
  4356. TEMPLATE.DisableSlider(GVAR.OptionsFrame.ToTPositionSlider)
  4357.  
  4358. TEMPLATE.DisableCheckButton(GVAR.OptionsFrame.ShowHealthBar)
  4359. TEMPLATE.DisableCheckButton(GVAR.OptionsFrame.ShowHealthText)
  4360.  
  4361. TEMPLATE.DisableCheckButton(GVAR.OptionsFrame.RangeCheck)
  4362. GVAR.OptionsFrame.RangeCheckInfo:Disable() Desaturation(GVAR.OptionsFrame.RangeCheckInfo.Texture, true)
  4363. TEMPLATE.DisablePullDownMenu(GVAR.OptionsFrame.RangeDisplayPullDown)
  4364.  
  4365. TEMPLATE.DisablePullDownMenu(GVAR.OptionsFrame.SortByPullDown)
  4366. GVAR.OptionsFrame.SortByTitle:SetTextColor(0.5, 0.5, 0.5, 1)
  4367. TEMPLATE.DisablePullDownMenu(GVAR.OptionsFrame.SortDetailPullDown)
  4368. GVAR.OptionsFrame.SortInfo:Disable() Desaturation(GVAR.OptionsFrame.SortInfo.Texture, true)
  4369.  
  4370. TEMPLATE.DisablePullDownMenu(GVAR.OptionsFrame.FontNamePullDown)
  4371. GVAR.OptionsFrame.FontNameTitle:SetTextColor(0.5, 0.5, 0.5, 1)
  4372. TEMPLATE.DisableSlider(GVAR.OptionsFrame.FontNameSlider)
  4373. TEMPLATE.DisablePullDownMenu(GVAR.OptionsFrame.FontNumberPullDown)
  4374. GVAR.OptionsFrame.FontNumberTitle:SetTextColor(0.5, 0.5, 0.5, 1)
  4375. TEMPLATE.DisableSlider(GVAR.OptionsFrame.FontNumberSlider)
  4376.  
  4377. TEMPLATE.DisableSlider(GVAR.OptionsFrame.ScaleSlider)
  4378. GVAR.OptionsFrame.ScaleTitle:SetTextColor(0.5, 0.5, 0.5, 1)
  4379. TEMPLATE.DisableSlider(GVAR.OptionsFrame.WidthSlider)
  4380. GVAR.OptionsFrame.WidthTitle:SetTextColor(0.5, 0.5, 0.5, 1)
  4381. TEMPLATE.DisableSlider(GVAR.OptionsFrame.HeightSlider)
  4382. GVAR.OptionsFrame.HeightTitle:SetTextColor(0.5, 0.5, 0.5, 1)
  4383. GVAR.OptionsFrame.TestShuffler:Hide()
  4384. end
  4385.  
  4386.  
  4387.  
  4388. function BattlegroundTargets:EnableInsecureConfigWidges()
  4389. local BattlegroundTargets_Options = BattlegroundTargets_Options
  4390.  
  4391. TEMPLATE.EnableTabButton(GVAR.OptionsFrame.TabGeneral, true)
  4392. TEMPLATE.EnableTabButton(GVAR.OptionsFrame.TabRaidSize10, BattlegroundTargets_Options.Friend.EnableBracket[10] or BattlegroundTargets_Options.Enemy.EnableBracket[10])
  4393. TEMPLATE.EnableTabButton(GVAR.OptionsFrame.TabRaidSize15, BattlegroundTargets_Options.Friend.EnableBracket[15] or BattlegroundTargets_Options.Enemy.EnableBracket[15])
  4394. TEMPLATE.EnableTabButton(GVAR.OptionsFrame.TabRaidSize40, BattlegroundTargets_Options.Friend.EnableBracket[40] or BattlegroundTargets_Options.Enemy.EnableBracket[40])
  4395.  
  4396. TEMPLATE.EnableTabButton(GVAR.OptionsFrame.EnableFriendBracket, BattlegroundTargets_Options.Friend.EnableBracket[testSize])
  4397. TEMPLATE.EnableTabButton(GVAR.OptionsFrame.EnableEnemyBracket, BattlegroundTargets_Options.Enemy.EnableBracket[testSize])
  4398.  
  4399. TEMPLATE.EnableCheckButton(GVAR.OptionsFrame.EnableFraction)
  4400. TEMPLATE.EnableCheckButton(GVAR.OptionsFrame.Minimap)
  4401.  
  4402. BattlegroundTargets:CheckForEnabledBracket(testSize, fraction)
  4403. end
  4404. -- ---------------------------------------------------------------------------------------------------------------------
  4405.  
  4406.  
  4407.  
  4408. -- ---------------------------------------------------------------------------------------------------------------------
  4409. function BattlegroundTargets:SetupMainFrameLayout(side)
  4410. if inCombat or InCombatLockdown() then
  4411. reCheckBG = true
  4412. return
  4413. end
  4414.  
  4415. local BattlegroundTargets_Options = BattlegroundTargets_Options
  4416.  
  4417. local LayoutTH = BattlegroundTargets_Options[side].LayoutTH[currentSize]
  4418. local LayoutSpace = BattlegroundTargets_Options[side].LayoutSpace[currentSize]
  4419. local isToTFX -- target_of_target
  4420. if BattlegroundTargets_Options[side].ButtonToTToggle[currentSize] and BattlegroundTargets_Options[side].ButtonToTPosition[currentSize] >= 9 then
  4421. isToTFX = true
  4422. end
  4423.  
  4424. local button = GVAR[side.."Button"]
  4425.  
  4426. if currentSize == 10 then
  4427. for i = 1, currentSize do
  4428. if LayoutTH == 81 then
  4429. if i == 6 then
  4430. button[i]:ClearAllPoints()
  4431. button[i]:SetPoint("TOPLEFT", button[1], "TOPRIGHT", LayoutSpace, 0)
  4432. elseif i > 1 then
  4433. button[i]:ClearAllPoints()
  4434. if isToTFX then
  4435. button[i]:SetPoint("TOPRIGHT", button[(i-1)].ToTButton, "BOTTOMRIGHT", 0, 0)
  4436. else
  4437. button[i]:SetPoint("TOPLEFT", button[(i-1)], "BOTTOMLEFT", 0, 0)
  4438. end
  4439. end
  4440. elseif LayoutTH == 18 then
  4441. if i > 1 then
  4442. button[i]:ClearAllPoints()
  4443. if isToTFX then
  4444. button[i]:SetPoint("TOPRIGHT", button[(i-1)].ToTButton, "BOTTOMRIGHT", 0, 0)
  4445. else
  4446. button[i]:SetPoint("TOPLEFT", button[(i-1)], "BOTTOMLEFT", 0, 0)
  4447. end
  4448. end
  4449. end
  4450. end
  4451. elseif currentSize == 15 then
  4452. for i = 1, currentSize do
  4453. if LayoutTH == 81 then
  4454. if i == 6 then
  4455. button[i]:ClearAllPoints()
  4456. button[i]:SetPoint("TOPLEFT", button[1], "TOPRIGHT", LayoutSpace, 0)
  4457. elseif i == 11 then
  4458. button[i]:ClearAllPoints()
  4459. button[i]:SetPoint("TOPLEFT", button[6], "TOPRIGHT", LayoutSpace, 0)
  4460. elseif i > 1 then
  4461. button[i]:ClearAllPoints()
  4462. if isToTFX then
  4463. button[i]:SetPoint("TOPRIGHT", button[(i-1)].ToTButton, "BOTTOMRIGHT", 0, 0)
  4464. else
  4465. button[i]:SetPoint("TOPLEFT", button[(i-1)], "BOTTOMLEFT", 0, 0)
  4466. end
  4467. end
  4468. elseif LayoutTH == 18 then
  4469. if i > 1 then
  4470. button[i]:ClearAllPoints()
  4471. if isToTFX then
  4472. button[i]:SetPoint("TOPRIGHT", button[(i-1)].ToTButton, "BOTTOMRIGHT", 0, 0)
  4473. else
  4474. button[i]:SetPoint("TOPLEFT", button[(i-1)], "BOTTOMLEFT", 0, 0)
  4475. end
  4476. end
  4477. end
  4478. end
  4479. elseif currentSize == 40 then
  4480. for i = 1, currentSize do
  4481. if LayoutTH == 81 then
  4482. if i == 6 then
  4483. button[i]:ClearAllPoints()
  4484. button[i]:SetPoint("TOPLEFT", button[1], "TOPRIGHT", LayoutSpace, 0)
  4485. elseif i == 11 then
  4486. button[i]:ClearAllPoints()
  4487. button[i]:SetPoint("TOPLEFT", button[6], "TOPRIGHT", LayoutSpace, 0)
  4488. elseif i == 16 then
  4489. button[i]:ClearAllPoints()
  4490. button[i]:SetPoint("TOPLEFT", button[11], "TOPRIGHT", LayoutSpace, 0)
  4491. elseif i == 21 then
  4492. button[i]:ClearAllPoints()
  4493. button[i]:SetPoint("TOPLEFT", button[16], "TOPRIGHT", LayoutSpace, 0)
  4494. elseif i == 26 then
  4495. button[i]:ClearAllPoints()
  4496. button[i]:SetPoint("TOPLEFT", button[21], "TOPRIGHT", LayoutSpace, 0)
  4497. elseif i == 31 then
  4498. button[i]:ClearAllPoints()
  4499. button[i]:SetPoint("TOPLEFT", button[26], "TOPRIGHT", LayoutSpace, 0)
  4500. elseif i == 36 then
  4501. button[i]:ClearAllPoints()
  4502. button[i]:SetPoint("TOPLEFT", button[31], "TOPRIGHT", LayoutSpace, 0)
  4503. elseif i > 1 then
  4504. button[i]:ClearAllPoints()
  4505. if isToTFX then
  4506. button[i]:SetPoint("TOPRIGHT", button[(i-1)].ToTButton, "BOTTOMRIGHT", 0, 0)
  4507. else
  4508. button[i]:SetPoint("TOPLEFT", button[(i-1)], "BOTTOMLEFT", 0, 0)
  4509. end
  4510. end
  4511. elseif LayoutTH == 42 then
  4512. if i == 11 then
  4513. button[i]:ClearAllPoints()
  4514. button[i]:SetPoint("TOPLEFT", button[1], "TOPRIGHT", LayoutSpace, 0)
  4515. elseif i == 21 then
  4516. button[i]:ClearAllPoints()
  4517. button[i]:SetPoint("TOPLEFT", button[11], "TOPRIGHT", LayoutSpace, 0)
  4518. elseif i == 31 then
  4519. button[i]:ClearAllPoints()
  4520. button[i]:SetPoint("TOPLEFT", button[21], "TOPRIGHT", LayoutSpace, 0)
  4521. elseif i > 1 then
  4522. button[i]:ClearAllPoints()
  4523. if isToTFX then
  4524. button[i]:SetPoint("TOPRIGHT", button[(i-1)].ToTButton, "BOTTOMRIGHT", 0, 0)
  4525. else
  4526. button[i]:SetPoint("TOPLEFT", button[(i-1)], "BOTTOMLEFT", 0, 0)
  4527. end
  4528. end
  4529. elseif LayoutTH == 24 then
  4530. if i == 21 then
  4531. button[i]:ClearAllPoints()
  4532. button[i]:SetPoint("TOPLEFT", button[1], "TOPRIGHT", LayoutSpace, 0)
  4533. elseif i > 1 then
  4534. button[i]:ClearAllPoints()
  4535. if isToTFX then
  4536. button[i]:SetPoint("TOPRIGHT", button[(i-1)].ToTButton, "BOTTOMRIGHT", 0, 0)
  4537. else
  4538. button[i]:SetPoint("TOPLEFT", button[(i-1)], "BOTTOMLEFT", 0, 0)
  4539. end
  4540. end
  4541. elseif LayoutTH == 18 then
  4542. if i > 1 then
  4543. button[i]:ClearAllPoints()
  4544. if isToTFX then
  4545. button[i]:SetPoint("TOPRIGHT", button[(i-1)].ToTButton, "BOTTOMRIGHT", 0, 0)
  4546. else
  4547. button[i]:SetPoint("TOPLEFT", button[(i-1)], "BOTTOMLEFT", 0, 0)
  4548. end
  4549. end
  4550. end
  4551. end
  4552. end
  4553. BattlegroundTargets:SetupMonoblockPosition(side)
  4554. end
  4555. -- ---------------------------------------------------------------------------------------------------------------------
  4556.  
  4557. -- ---------------------------------------------------------------------------------------------------------------------
  4558. function BattlegroundTargets:SetupMonoblockPosition(side) -- SUMPOSi
  4559. local BattlegroundTargets_Options = BattlegroundTargets_Options
  4560.  
  4561. local LayoutTH = BattlegroundTargets_Options[side].LayoutTH[currentSize]
  4562. local LayoutSpace = BattlegroundTargets_Options[side].LayoutSpace[currentSize]
  4563. local ButtonWidth = BattlegroundTargets_Options[side].ButtonWidth[currentSize]
  4564. local ButtonHeight = BattlegroundTargets_Options[side].ButtonHeight[currentSize]
  4565. local ButtonScale = BattlegroundTargets_Options[side].ButtonScale[currentSize]
  4566. local ButtonToTScale = BattlegroundTargets_Options[side].ButtonToTScale[currentSize]
  4567.  
  4568. local totalWidth, totalHeight, totalToTHeight
  4569. if currentSize == 10 then
  4570. if LayoutTH == 18 then totalWidth = ButtonWidth totalHeight = 10*ButtonHeight totalToTHeight = totalHeight + (10*ButtonHeight*ButtonToTScale)
  4571. elseif LayoutTH == 81 then totalWidth = (2*ButtonWidth) + LayoutSpace totalHeight = 5*ButtonHeight totalToTHeight = totalHeight + ( 5*ButtonHeight*ButtonToTScale)
  4572. end
  4573. elseif currentSize == 15 then
  4574. if LayoutTH == 18 then totalWidth = ButtonWidth totalHeight = 15*ButtonHeight totalToTHeight = totalHeight + (15*ButtonHeight*ButtonToTScale)
  4575. elseif LayoutTH == 81 then totalWidth = (3*ButtonWidth) + (2*LayoutSpace) totalHeight = 5*ButtonHeight totalToTHeight = totalHeight + ( 5*ButtonHeight*ButtonToTScale)
  4576. end
  4577. elseif currentSize == 40 then
  4578. if LayoutTH == 18 then totalWidth = ButtonWidth totalHeight = 40*ButtonHeight totalToTHeight = totalHeight + (40*ButtonHeight*ButtonToTScale)
  4579. elseif LayoutTH == 24 then totalWidth = (2*ButtonWidth) + (1*LayoutSpace) totalHeight = 20*ButtonHeight totalToTHeight = totalHeight + (20*ButtonHeight*ButtonToTScale)
  4580. elseif LayoutTH == 42 then totalWidth = (4*ButtonWidth) + (3*LayoutSpace) totalHeight = 10*ButtonHeight totalToTHeight = totalHeight + (10*ButtonHeight*ButtonToTScale)
  4581. elseif LayoutTH == 81 then totalWidth = (8*ButtonWidth) + (7*LayoutSpace) totalHeight = 5*ButtonHeight totalToTHeight = totalHeight + ( 5*ButtonHeight*ButtonToTScale)
  4582. end
  4583. end
  4584.  
  4585. if BattlegroundTargets_Options[side].ButtonToTToggle[currentSize] and BattlegroundTargets_Options[side].ButtonToTPosition[currentSize] >= 9 then -- target_of_target
  4586. totalHeight = totalToTHeight
  4587. end
  4588.  
  4589. if inBattleground and isDeadUpdateStop then
  4590. GVAR[side.."IsGhostTexture"]:Show()
  4591. end
  4592.  
  4593. local MainFrame = GVAR[side.."MainFrame"]
  4594. MainFrame:SetClampRectInsets(0, totalWidth*ButtonScale, 0, -(totalHeight*ButtonScale)) -- CLAMP_FIX_MAIN TODO
  4595. MainFrame.MonoblockAnchor:SetSize(totalWidth, totalHeight)
  4596. MainFrame.MainMoverFrame:SetSize(totalWidth, totalHeight)
  4597. MainFrame.MainMoverButton:SetSize(totalWidth, totalHeight)
  4598.  
  4599. local moverwidth = totalWidth*ButtonScale
  4600. if moverwidth < 200 then
  4601. moverwidth = 200
  4602. end
  4603. MainFrame.MainMoverButton[1]:SetWidth(moverwidth+40)
  4604. MainFrame.MainMoverButton[2]:SetWidth(moverwidth+40)
  4605.  
  4606. if BattlegroundTargets_Options[side].SummaryToggle[currentSize] then -- SUMMARY
  4607. local SummaryPos = BattlegroundTargets_Options[side].SummaryPos[currentSize]
  4608. local a1, a2, x, y
  4609. if SummaryPos == 1 then a1="TOP" a2="BOTTOM" x= 0 y=-10 -- 0
  4610. elseif SummaryPos == 2 then a1="TOPRIGHT" a2="BOTTOMLEFT" x=-10 y=-10 -- 45
  4611. elseif SummaryPos == 3 then a1="RIGHT" a2="LEFT" x=-10 y= 0 -- 90
  4612. elseif SummaryPos == 4 then a1="BOTTOMRIGHT" a2="TOPLEFT" x=-10 y= 10 -- 135
  4613. elseif SummaryPos == 5 then a1="BOTTOM" a2="TOP" x= 0 y= 10 -- 180
  4614. elseif SummaryPos == 6 then a1="BOTTOMLEFT" a2="TOPRIGHT" x= 10 y= 10 -- 225
  4615. elseif SummaryPos == 7 then a1="LEFT" a2="RIGHT" x= 10 y= 0 -- 270
  4616. elseif SummaryPos == 8 then a1="TOPLEFT" a2="BOTTOMRIGHT" x= 10 y=-10 -- 315
  4617. elseif SummaryPos == 9 then a1="TOP" a2="BOTTOM" x= 0 y=-10 -- 360 => indie pos TODO
  4618. else a1="TOP" a2="BOTTOM" x= 0 y=-10
  4619. end
  4620.  
  4621. local Summary = GVAR[side.."Summary"]
  4622. Summary:ClearAllPoints()
  4623. Summary:SetPoint(a1, GVAR[side.."MainFrame"].MonoblockAnchor, a2, x, y)
  4624. Summary:SetScale(BattlegroundTargets_Options[side].SummaryScale[currentSize])
  4625. Summary:Show()
  4626. else
  4627. GVAR[side.."Summary"]:Hide()
  4628. end
  4629. end
  4630. -- ---------------------------------------------------------------------------------------------------------------------
  4631.  
  4632. -- ---------------------------------------------------------------------------------------------------------------------
  4633. function BattlegroundTargets:SetupButtonLayout(side)
  4634. if inCombat or InCombatLockdown() then
  4635. reSetLayout = true
  4636. return
  4637. end
  4638.  
  4639. BattlegroundTargets:SetupMainFrameLayout(side)
  4640.  
  4641. local BattlegroundTargets_Options = BattlegroundTargets_Options
  4642.  
  4643. local ButtonScale = BattlegroundTargets_Options[side].ButtonScale[currentSize]
  4644. local ButtonWidth = BattlegroundTargets_Options[side].ButtonWidth[currentSize]
  4645. local ButtonHeight = BattlegroundTargets_Options[side].ButtonHeight[currentSize]
  4646. local ButtonFontNameSize = BattlegroundTargets_Options[side].ButtonFontNameSize[currentSize]
  4647. local fButtonFontNameStyle = fontStyles[ BattlegroundTargets_Options[side].ButtonFontNameStyle[currentSize] ].font
  4648. local ButtonFontNumberSize = BattlegroundTargets_Options[side].ButtonFontNumberSize[currentSize]
  4649. local fButtonFontNumberStyle = fontStyles[ BattlegroundTargets_Options[side].ButtonFontNumberStyle[currentSize] ].font
  4650. local ButtonRoleToggle = BattlegroundTargets_Options[side].ButtonRoleToggle[currentSize]
  4651. local ButtonSpecToggle = BattlegroundTargets_Options[side].ButtonSpecToggle[currentSize]
  4652. local ButtonClassToggle = BattlegroundTargets_Options[side].ButtonClassToggle[currentSize]
  4653. local ButtonFTargetCountToggle = BattlegroundTargets_Options[side].ButtonFTargetCountToggle[currentSize]
  4654. local ButtonETargetCountToggle = BattlegroundTargets_Options[side].ButtonETargetCountToggle[currentSize]
  4655. local ButtonTargetToggle = BattlegroundTargets_Options[side].ButtonTargetToggle[currentSize]
  4656. local ButtonTargetScale = BattlegroundTargets_Options[side].ButtonTargetScale[currentSize]
  4657. local ButtonTargetPosition = BattlegroundTargets_Options[side].ButtonTargetPosition[currentSize]
  4658. local ButtonFocusToggle = BattlegroundTargets_Options[side].ButtonFocusToggle[currentSize]
  4659. local ButtonFocusScale = BattlegroundTargets_Options[side].ButtonFocusScale[currentSize]
  4660. local ButtonFocusPosition = BattlegroundTargets_Options[side].ButtonFocusPosition[currentSize]
  4661. local ButtonFlagToggle = BattlegroundTargets_Options[side].ButtonFlagToggle[currentSize]
  4662. local ButtonFlagScale = BattlegroundTargets_Options[side].ButtonFlagScale[currentSize]
  4663. local ButtonFlagPosition = BattlegroundTargets_Options[side].ButtonFlagPosition[currentSize]
  4664. local ButtonAssistToggle = BattlegroundTargets_Options[side].ButtonAssistToggle[currentSize]
  4665. local ButtonAssistScale = BattlegroundTargets_Options[side].ButtonAssistScale[currentSize]
  4666. local ButtonAssistPosition = BattlegroundTargets_Options[side].ButtonAssistPosition[currentSize]
  4667. local ButtonRangeToggle = BattlegroundTargets_Options[side].ButtonRangeToggle[currentSize]
  4668. local ButtonRangeDisplay = BattlegroundTargets_Options[side].ButtonRangeDisplay[currentSize]
  4669.  
  4670. local B_uttonWidth_2 = ButtonWidth-2
  4671. local B_uttonHeight_2 = ButtonHeight-2
  4672.  
  4673. local fallbackFontSize = ButtonFontNameSize
  4674. if ButtonHeight < ButtonFontNameSize then
  4675. fallbackFontSize = ButtonHeight
  4676. end
  4677.  
  4678. local withIconWidth
  4679. local iconNum = 0
  4680. if ButtonRoleToggle and ButtonSpecToggle and ButtonClassToggle then
  4681. iconNum = 3
  4682. elseif (ButtonRoleToggle and ButtonSpecToggle) or (ButtonRoleToggle and ButtonClassToggle) or (ButtonSpecToggle and ButtonClassToggle) then
  4683. iconNum = 2
  4684. elseif ButtonRoleToggle or ButtonSpecToggle or ButtonClassToggle then
  4685. iconNum = 1
  4686. end
  4687. local rangedisplayWidth = B_uttonHeight_2--/1.66--old:B_uttonHeight_2/2
  4688. if ButtonRangeToggle and ButtonRangeDisplay < 7 then -- RANGE_DISP_LAY
  4689. withIconWidth = (ButtonWidth - ( (B_uttonHeight_2*iconNum) + (rangedisplayWidth) ) ) - 2
  4690. else
  4691. withIconWidth = (ButtonWidth - (B_uttonHeight_2*iconNum) ) - 2
  4692. end
  4693.  
  4694. local targetcountWidth = ButtonFontNumberSize * 1.5
  4695. if ButtonFTargetCountToggle and ButtonETargetCountToggle then
  4696. DATA[side].healthBarWidth = withIconWidth - targetcountWidth - targetcountWidth
  4697. elseif ButtonFTargetCountToggle or ButtonETargetCountToggle then
  4698. DATA[side].healthBarWidth = withIconWidth - targetcountWidth
  4699. else
  4700. DATA[side].healthBarWidth = withIconWidth
  4701. end
  4702.  
  4703. if ButtonRoleToggle then
  4704. DATA[side].totHealthBarWidth = (ButtonWidth - (B_uttonHeight_2*2)) - 2
  4705. else
  4706. DATA[side].totHealthBarWidth = (ButtonWidth - (B_uttonHeight_2*1)) - 2
  4707. end
  4708.  
  4709. ------------------------------
  4710. local ButtonTargetToggle_quad
  4711. local ButtonTargetToggle_leftPos
  4712. if ButtonTargetToggle then
  4713. ButtonTargetToggle_quad = B_uttonHeight_2 * ButtonTargetScale
  4714. ButtonTargetToggle_leftPos = -ButtonTargetToggle_quad
  4715. if ButtonTargetPosition >= 100 then
  4716. ButtonTargetToggle_leftPos = ButtonWidth
  4717. elseif ButtonTargetPosition > 0 then
  4718. ButtonTargetToggle_leftPos = ( (ButtonTargetToggle_quad + ButtonWidth) * (ButtonTargetPosition/100) ) - ButtonTargetToggle_quad
  4719. end
  4720. end
  4721.  
  4722. local ButtonFocusToggle_quad
  4723. local ButtonFocusToggle_leftPos
  4724. if ButtonFocusToggle then
  4725. ButtonFocusToggle_quad = B_uttonHeight_2 * ButtonFocusScale
  4726. ButtonFocusToggle_leftPos = -ButtonFocusToggle_quad
  4727. if ButtonFocusPosition >= 100 then
  4728. ButtonFocusToggle_leftPos = ButtonWidth
  4729. elseif ButtonFocusPosition > 0 then
  4730. ButtonFocusToggle_leftPos = ( (ButtonFocusToggle_quad + ButtonWidth) * (ButtonFocusPosition/100) ) - ButtonFocusToggle_quad
  4731. end
  4732. end
  4733.  
  4734. local ButtonFlagToggle_quad
  4735. local ButtonFlagToggle_leftPos
  4736. local ButtonFlagToggle_orbcornerSize
  4737. if ButtonFlagToggle then
  4738. ButtonFlagToggle_quad = B_uttonHeight_2 * ButtonFlagScale
  4739. ButtonFlagToggle_leftPos = -ButtonFlagToggle_quad
  4740. if ButtonFlagPosition >= 100 then
  4741. ButtonFlagToggle_leftPos = ButtonWidth
  4742. elseif ButtonFlagPosition > 0 then
  4743. ButtonFlagToggle_leftPos = ( (ButtonFlagToggle_quad + ButtonWidth) * (ButtonFlagPosition/100) ) - ButtonFlagToggle_quad
  4744. end
  4745. ButtonFlagToggle_orbcornerSize = B_uttonHeight_2/4
  4746. end
  4747.  
  4748. local ButtonAssistToggle_quad
  4749. local ButtonAssistToggle_leftPos
  4750. if ButtonAssistToggle then
  4751. ButtonAssistToggle_quad = B_uttonHeight_2 * ButtonAssistScale
  4752. ButtonAssistToggle_leftPos = -ButtonAssistToggle_quad
  4753. if ButtonAssistPosition >= 100 then
  4754. ButtonAssistToggle_leftPos = ButtonWidth
  4755. elseif ButtonAssistPosition > 0 then
  4756. ButtonAssistToggle_leftPos = ( (ButtonAssistToggle_quad + ButtonWidth) * (ButtonAssistPosition/100) ) - ButtonAssistToggle_quad
  4757. end
  4758. end
  4759.  
  4760. local ButtonGroupSymbolSize = B_uttonHeight_2/1.25
  4761. ------------------------------
  4762.  
  4763. local bbutton = GVAR[side.."Button"]
  4764. for i = 1, currentSize do
  4765. local button = bbutton[i]
  4766.  
  4767. local lvl = button:GetFrameLevel()
  4768. button.HealthTextButton:SetFrameLevel(lvl+1) -- xBUT
  4769. button.ToTButton:SetFrameLevel(lvl+1)
  4770. button.TargetTextureButton:SetFrameLevel(lvl+2)
  4771. button.AssistTextureButton:SetFrameLevel(lvl+3)
  4772. button.FocusTextureButton:SetFrameLevel(lvl+4)
  4773. button.FlagTextureButton:SetFrameLevel(lvl+5)
  4774. button.FlagDebuffButton:SetFrameLevel(lvl+6)
  4775.  
  4776. button:SetScale(ButtonScale)
  4777.  
  4778. button:SetSize(ButtonWidth, ButtonHeight)
  4779. button.HighlightT:SetWidth(ButtonWidth)
  4780. button.HighlightR:SetHeight(ButtonHeight)
  4781. button.HighlightB:SetWidth(ButtonWidth)
  4782. button.HighlightL:SetHeight(ButtonHeight)
  4783. button.BackgroundX:SetSize(B_uttonWidth_2, B_uttonHeight_2)
  4784.  
  4785. if ButtonRangeToggle and ButtonRangeDisplay < 7 then -- RANGE_DISP_LAY
  4786. button.RangeTexture:Show()
  4787. button.RangeTexture:SetSize(rangedisplayWidth, B_uttonHeight_2)
  4788. button.RangeTxt:SetFont(fButtonFontNumberStyle, ButtonFontNumberSize-1, "OUTLINE")
  4789. button.RangeTxt:SetHeight(fallbackFontSize)
  4790. else
  4791. button.RangeTexture:Hide()
  4792. button.RangeTxt:Hide()
  4793. end
  4794.  
  4795. button.LeaderTexture:SetSize(ButtonGroupSymbolSize, ButtonGroupSymbolSize)
  4796. button.LeaderTexture:SetPoint("LEFT", button, "LEFT", -(ButtonGroupSymbolSize/2), 0)
  4797.  
  4798. -- role spec classicon
  4799. button.RoleTexture:SetSize(B_uttonHeight_2, B_uttonHeight_2)
  4800. button.SpecTexture:SetSize(B_uttonHeight_2, B_uttonHeight_2)
  4801. button.ClassTexture:SetSize(B_uttonHeight_2, B_uttonHeight_2)
  4802.  
  4803. if ButtonRoleToggle and ButtonSpecToggle and ButtonClassToggle then
  4804. button.RoleTexture:Show()
  4805. button.SpecTexture:Show()
  4806. button.ClassTexture:Show()
  4807.  
  4808. if ButtonRangeToggle and ButtonRangeDisplay < 7 then -- RANGE_DISP_LAY
  4809. button.RoleTexture:SetPoint("LEFT", button.RangeTexture, "RIGHT", 0, 0)
  4810. else
  4811. button.RoleTexture:SetPoint("LEFT", button, "LEFT", 1, 0)
  4812. end
  4813. button.SpecTexture:SetPoint("LEFT", button.RoleTexture, "RIGHT", 0, 0)
  4814. button.ClassTexture:SetPoint("LEFT", button.SpecTexture, "RIGHT", 0, 0)
  4815. button.ClassColorBackground:SetPoint("LEFT", button.ClassTexture, "RIGHT", 0, 0)
  4816. elseif ButtonRoleToggle and ButtonSpecToggle then
  4817. button.RoleTexture:Show()
  4818. button.SpecTexture:Show()
  4819. button.ClassTexture:Hide()
  4820.  
  4821. if ButtonRangeToggle and ButtonRangeDisplay < 7 then -- RANGE_DISP_LAY
  4822. button.RoleTexture:SetPoint("LEFT", button.RangeTexture, "RIGHT", 0, 0)
  4823. else
  4824. button.RoleTexture:SetPoint("LEFT", button, "LEFT", 1, 0)
  4825. end
  4826. button.SpecTexture:SetPoint("LEFT", button.RoleTexture, "RIGHT", 0, 0)
  4827. button.ClassColorBackground:SetPoint("LEFT", button.SpecTexture, "RIGHT", 0, 0)
  4828. elseif ButtonRoleToggle and ButtonClassToggle then
  4829. button.RoleTexture:Show()
  4830. button.SpecTexture:Hide()
  4831. button.ClassTexture:Show()
  4832.  
  4833. if ButtonRangeToggle and ButtonRangeDisplay < 7 then -- RANGE_DISP_LAY
  4834. button.RoleTexture:SetPoint("LEFT", button.RangeTexture, "RIGHT", 0, 0)
  4835. else
  4836. button.RoleTexture:SetPoint("LEFT", button, "LEFT", 1, 0)
  4837. end
  4838. button.ClassTexture:SetPoint("LEFT", button.RoleTexture, "RIGHT", 0, 0)
  4839. button.ClassColorBackground:SetPoint("LEFT", button.ClassTexture, "RIGHT", 0, 0)
  4840. elseif ButtonSpecToggle and ButtonClassToggle then
  4841. button.RoleTexture:Hide()
  4842. button.SpecTexture:Show()
  4843. button.ClassTexture:Show()
  4844.  
  4845. if ButtonRangeToggle and ButtonRangeDisplay < 7 then -- RANGE_DISP_LAY
  4846. button.SpecTexture:SetPoint("LEFT", button.RangeTexture, "RIGHT", 0, 0)
  4847. else
  4848. button.SpecTexture:SetPoint("LEFT", button, "LEFT", 1, 0)
  4849. end
  4850. button.ClassTexture:SetPoint("LEFT", button.SpecTexture, "RIGHT", 0, 0)
  4851. button.ClassColorBackground:SetPoint("LEFT", button.ClassTexture, "RIGHT", 0, 0)
  4852. elseif ButtonRoleToggle then
  4853. button.RoleTexture:Show()
  4854. button.SpecTexture:Hide()
  4855. button.ClassTexture:Hide()
  4856.  
  4857. if ButtonRangeToggle and ButtonRangeDisplay < 7 then -- RANGE_DISP_LAY
  4858. button.RoleTexture:SetPoint("LEFT", button.RangeTexture, "RIGHT", 0, 0)
  4859. else
  4860. button.RoleTexture:SetPoint("LEFT", button, "LEFT", 1, 0)
  4861. end
  4862.  
  4863. button.ClassColorBackground:SetPoint("LEFT", button.RoleTexture, "RIGHT", 0, 0)
  4864. elseif ButtonSpecToggle then
  4865. button.RoleTexture:Hide()
  4866. button.SpecTexture:Show()
  4867. button.ClassTexture:Hide()
  4868.  
  4869. if ButtonRangeToggle and ButtonRangeDisplay < 7 then -- RANGE_DISP_LAY
  4870. button.SpecTexture:SetPoint("LEFT", button.RangeTexture, "RIGHT", 0, 0)
  4871. else
  4872. button.SpecTexture:SetPoint("LEFT", button, "LEFT", 1, 0)
  4873. end
  4874.  
  4875. button.ClassColorBackground:SetPoint("LEFT", button.SpecTexture, "RIGHT", 0, 0)
  4876. elseif ButtonClassToggle then
  4877. button.RoleTexture:Hide()
  4878. button.SpecTexture:Hide()
  4879. button.ClassTexture:Show()
  4880.  
  4881. if ButtonRangeToggle and ButtonRangeDisplay < 7 then -- RANGE_DISP_LAY
  4882. button.ClassTexture:SetPoint("LEFT", button.RangeTexture, "RIGHT", 0, 0)
  4883. else
  4884. button.ClassTexture:SetPoint("LEFT", button, "LEFT", 1, 0)
  4885. end
  4886.  
  4887. button.ClassColorBackground:SetPoint("LEFT", button.ClassTexture, "RIGHT", 0, 0)
  4888. else
  4889. button.RoleTexture:Hide()
  4890. button.SpecTexture:Hide()
  4891. button.ClassTexture:Hide()
  4892.  
  4893. if ButtonRangeToggle and ButtonRangeDisplay < 7 then -- RANGE_DISP_LAY
  4894. button.ClassColorBackground:SetPoint("LEFT", button.RangeTexture, "RIGHT", 0, 0)
  4895. else
  4896. button.ClassColorBackground:SetPoint("LEFT", button, "LEFT", 1, 0)
  4897. end
  4898. end
  4899. -- role spec classicon
  4900.  
  4901. button.Name:SetFont(fButtonFontNameStyle, ButtonFontNameSize, "")
  4902. button.Name:SetSize(DATA[side].healthBarWidth-2, fallbackFontSize)
  4903.  
  4904. button.HealthBar:SetSize(DATA[side].healthBarWidth, B_uttonHeight_2)
  4905.  
  4906. button.HealthText:SetFont(fButtonFontNumberStyle, ButtonFontNumberSize, "OUTLINE")
  4907. button.HealthText:SetHeight(fallbackFontSize)
  4908.  
  4909. button.ClassColorBackground:SetSize(DATA[side].healthBarWidth, B_uttonHeight_2)
  4910.  
  4911. -- pvp_trinket_
  4912. button.PVPTrinketTexture:SetSize(B_uttonHeight_2, B_uttonHeight_2)
  4913. button.PVPTrinketTxt:SetFont(fButtonFontNumberStyle, ButtonFontNumberSize-1, "OUTLINE")
  4914. button.PVPTrinketTxt:SetHeight(fallbackFontSize)
  4915.  
  4916. -- target count
  4917. if ButtonFTargetCountToggle and ButtonETargetCountToggle then
  4918. button.TargetCountBackground:SetSize(targetcountWidth*2, B_uttonHeight_2)
  4919. button.TargetCountBackground:Show()
  4920. elseif ButtonFTargetCountToggle or ButtonETargetCountToggle then
  4921. button.TargetCountBackground:SetSize(targetcountWidth, B_uttonHeight_2)
  4922. button.TargetCountBackground:Show()
  4923. else
  4924. button.TargetCountBackground:Hide()
  4925. end
  4926.  
  4927. if ButtonFTargetCountToggle then
  4928. button.FTargetCount:SetFont(fButtonFontNumberStyle, ButtonFontNumberSize, "")
  4929. button.FTargetCount:SetSize(targetcountWidth, fallbackFontSize)
  4930. button.FTargetCount:Show()
  4931. else
  4932. button.FTargetCount:Hide()
  4933. end
  4934.  
  4935. if ButtonETargetCountToggle then
  4936. button.ETargetCount:SetFont(fButtonFontNumberStyle, ButtonFontNumberSize, "")
  4937. button.ETargetCount:SetSize(targetcountWidth, fallbackFontSize)
  4938. button.ETargetCount:Show()
  4939. else
  4940. button.ETargetCount:Hide()
  4941. end
  4942. -- target count
  4943.  
  4944. if ButtonTargetToggle then
  4945. button.TargetTexture:SetSize(ButtonTargetToggle_quad, ButtonTargetToggle_quad)
  4946. button.TargetTexture:SetPoint("LEFT", button, "LEFT", ButtonTargetToggle_leftPos, 0)
  4947. button.TargetTexture:Show()
  4948. else
  4949. button.TargetTexture:Hide()
  4950. end
  4951.  
  4952. if ButtonFocusToggle then
  4953. button.FocusTexture:SetSize(ButtonFocusToggle_quad, ButtonFocusToggle_quad)
  4954. button.FocusTexture:SetPoint("LEFT", button, "LEFT", ButtonFocusToggle_leftPos, 0)
  4955. button.FocusTexture:Show()
  4956. else
  4957. button.FocusTexture:Hide()
  4958. end
  4959.  
  4960. if ButtonFlagToggle then
  4961. button.FlagTexture:SetPoint("LEFT", button, "LEFT", ButtonFlagToggle_leftPos, 0)
  4962. button.FlagTexture:Show()
  4963. button.FlagDebuff:SetFont(fButtonFontNumberStyle, ButtonFontNumberSize-2, "OUTLINE")
  4964. button.FlagDebuff:SetHeight(fallbackFontSize)
  4965. button.FlagDebuff:Show()
  4966. button.OrbCornerTL:SetSize(ButtonFlagToggle_orbcornerSize, ButtonFlagToggle_orbcornerSize)
  4967. button.OrbCornerTR:SetSize(ButtonFlagToggle_orbcornerSize, ButtonFlagToggle_orbcornerSize)
  4968. button.OrbCornerBL:SetSize(ButtonFlagToggle_orbcornerSize, ButtonFlagToggle_orbcornerSize)
  4969. button.OrbCornerBR:SetSize(ButtonFlagToggle_orbcornerSize, ButtonFlagToggle_orbcornerSize)
  4970. button.OrbCornerTL:Show()
  4971. button.OrbCornerTR:Show()
  4972. button.OrbCornerBL:Show()
  4973. button.OrbCornerBR:Show()
  4974. else
  4975. button.FlagTexture:Hide()
  4976. button.FlagDebuff:Hide()
  4977. button.OrbCornerTL:Hide()
  4978. button.OrbCornerTR:Hide()
  4979. button.OrbCornerBL:Hide()
  4980. button.OrbCornerBR:Hide()
  4981. end
  4982.  
  4983. if ButtonAssistToggle then
  4984. button.AssistSourceTexture:SetSize(ButtonGroupSymbolSize, ButtonGroupSymbolSize)
  4985. button.AssistSourceTexture:SetPoint("RIGHT", button, "RIGHT", (ButtonGroupSymbolSize/2), 0)
  4986. button.AssistSourceTexture:Show()
  4987. button.AssistTargetTexture:SetSize(ButtonAssistToggle_quad, ButtonAssistToggle_quad)
  4988. button.AssistTargetTexture:SetPoint("LEFT", button, "LEFT", ButtonAssistToggle_leftPos, 0)
  4989. button.AssistTargetTexture:Show()
  4990. else
  4991. button.AssistSourceTexture:Hide()
  4992. button.AssistTargetTexture:Hide()
  4993. end
  4994. end
  4995.  
  4996. if BattlegroundTargets_Options[side].ButtonToTToggle[currentSize] then -- target_of_target
  4997. local ButtonToTScale = BattlegroundTargets_Options[side].ButtonToTScale[currentSize]
  4998. local ButtonToTPosition = BattlegroundTargets_Options[side].ButtonToTPosition[currentSize]
  4999.  
  5000. local bbutton = GVAR[side.."Button"]
  5001. for i = 1, currentSize do
  5002. local button = bbutton[i]
  5003. local ToTButton = button.ToTButton
  5004.  
  5005. ToTButton:SetSize(ButtonWidth, ButtonHeight)
  5006.  
  5007. local lvl = ToTButton:GetFrameLevel()
  5008. ToTButton.HealthTextButton:SetFrameLevel(lvl+1) -- xBUT
  5009.  
  5010. ToTButton.HighlightT:Hide()
  5011. ToTButton.HighlightR:Hide()
  5012. ToTButton.HighlightB:Hide()
  5013. ToTButton.HighlightL:Hide()
  5014. ToTButton.RangeTexture:Hide()
  5015. ToTButton.RangeTxt:Hide()
  5016. ToTButton.PVPTrinketTexture:Hide()
  5017. ToTButton.PVPTrinketTxt:Hide()
  5018. ToTButton.SpecTexture:Hide()
  5019. ToTButton.ClassTexture:Hide()
  5020. ToTButton.LeaderTexture:Hide()
  5021. ToTButton.TargetCountBackground:Hide()
  5022. ToTButton.FTargetCount:Hide()
  5023. ToTButton.ETargetCount:Hide()
  5024. ToTButton.TargetTextureButton:Hide()
  5025. ToTButton.FocusTextureButton:Hide()
  5026. ToTButton.FlagTextureButton:Hide()
  5027. ToTButton.FlagDebuffButton:Hide()
  5028. ToTButton.AssistTextureButton:Hide()
  5029.  
  5030. ToTButton.BackgroundX:SetSize(ButtonWidth, ButtonHeight)
  5031.  
  5032. ToTButton.FactionTexture:SetSize(B_uttonHeight_2-2, B_uttonHeight_2-2) -- -2
  5033. if ButtonRoleToggle then
  5034. ToTButton.RoleTexture:SetPoint("LEFT", ToTButton.FactionTexture, "RIGHT", 2, 0) -- -2
  5035. ToTButton.RoleTexture:SetSize(B_uttonHeight_2, B_uttonHeight_2)
  5036. ToTButton.RoleTexture:SetAlpha(1)
  5037. ToTButton.ClassColorBackground:SetPoint("LEFT", ToTButton.RoleTexture, "RIGHT", 0, 0)
  5038. else
  5039. ToTButton.RoleTexture:SetAlpha(0)
  5040. ToTButton.ClassColorBackground:SetPoint("LEFT", ToTButton.FactionTexture, "RIGHT", 2, 0) -- -2
  5041. end
  5042.  
  5043. ToTButton.ClassColorBackground:SetSize(DATA[side].totHealthBarWidth, B_uttonHeight_2)
  5044.  
  5045. ToTButton.HealthBar:SetSize(DATA[side].totHealthBarWidth, B_uttonHeight_2)
  5046.  
  5047. ToTButton.HealthText:SetFont(fButtonFontNumberStyle, ButtonFontNumberSize, "OUTLINE")
  5048. ToTButton.HealthText:SetHeight(fallbackFontSize)
  5049.  
  5050. ToTButton.Name:SetFont(fButtonFontNameStyle, ButtonFontNameSize, "")
  5051. ToTButton.Name:SetSize(DATA[side].totHealthBarWidth - 2, fallbackFontSize)
  5052.  
  5053. ToTButton:ClearAllPoints()
  5054. if ButtonToTPosition == 1 then
  5055. ToTButton:SetPoint("RIGHT", button, "LEFT", 0, 0)
  5056. elseif ButtonToTPosition == 2 then
  5057. ToTButton:SetPoint("RIGHT", button, "LEFT", -10, 0)
  5058. elseif ButtonToTPosition == 3 then
  5059. ToTButton:SetPoint("RIGHT", button, "LEFT", -20, 0)
  5060. elseif ButtonToTPosition == 4 then
  5061. ToTButton:SetPoint("RIGHT", button, "LEFT", -30, 0)
  5062. elseif ButtonToTPosition == 5 then
  5063. ToTButton:SetPoint("LEFT", button, "RIGHT", 0, 0)
  5064. elseif ButtonToTPosition == 6 then
  5065. ToTButton:SetPoint("LEFT", button, "RIGHT", 10, 0)
  5066. elseif ButtonToTPosition == 7 then
  5067. ToTButton:SetPoint("LEFT", button, "RIGHT", 20, 0)
  5068. elseif ButtonToTPosition == 8 then
  5069. ToTButton:SetPoint("LEFT", button, "RIGHT", 30, 0)
  5070. elseif ButtonToTPosition == 9 then
  5071. ToTButton:SetPoint("TOPRIGHT", button, "BOTTOMRIGHT", 0, 0)
  5072. end
  5073.  
  5074. button.HighlightR:ClearAllPoints()
  5075. button.HighlightB:ClearAllPoints()
  5076. button.HighlightL:ClearAllPoints()
  5077. if ButtonToTPosition == 9 then
  5078. button.HighlightR:SetPoint("TOPRIGHT", button.HighlightT, "TOPRIGHT", 0, 0)
  5079. button.HighlightB:SetPoint("BOTTOMRIGHT", button.HighlightR, "BOTTOMRIGHT", 0, 0)
  5080. button.HighlightL:SetPoint("TOPLEFT", button.HighlightT, "TOPLEFT", 0, 0)
  5081. else
  5082. button.HighlightR:SetPoint("RIGHT", 0, 0)
  5083. button.HighlightB:SetPoint("BOTTOM", 0, 0)
  5084. button.HighlightL:SetPoint("LEFT", 0, 0)
  5085. end
  5086.  
  5087. ToTButton:SetScale(ButtonToTScale)
  5088. end
  5089. end
  5090.  
  5091. if BattlegroundTargets_Options[side].SummaryToggle[currentSize] then
  5092. local Summary = GVAR[side.."Summary"]
  5093. Summary.HealerFriend:SetFont(fButtonFontNumberStyle, ButtonFontNumberSize*2, "OUTLINE")
  5094. Summary.HealerEnemy:SetFont(fButtonFontNumberStyle, ButtonFontNumberSize*2, "OUTLINE")
  5095. Summary.TankFriend:SetFont(fButtonFontNumberStyle, ButtonFontNumberSize*2, "OUTLINE")
  5096. Summary.TankEnemy:SetFont(fButtonFontNumberStyle, ButtonFontNumberSize*2, "OUTLINE")
  5097. Summary.DamageFriend:SetFont(fButtonFontNumberStyle, ButtonFontNumberSize*2, "OUTLINE")
  5098. Summary.DamageEnemy:SetFont(fButtonFontNumberStyle, ButtonFontNumberSize*2, "OUTLINE")
  5099. end
  5100.  
  5101. reSetLayout = false
  5102. end
  5103. -- ---------------------------------------------------------------------------------------------------------------------
  5104.  
  5105. -- ---------------------------------------------------------------------------------------------------------------------
  5106. function BattlegroundTargets:SetupButtonTextures(side) -- BG_Faction_Dependent
  5107. local BattlegroundTargets_Options = BattlegroundTargets_Options
  5108.  
  5109. if BattlegroundTargets_Options[side].ButtonPvPTrinketToggle[currentSize] then -- pvp_trinket_
  5110. local trinketTexture
  5111. --[[if side == "Friend" then ---OLD
  5112. if playerFactionDEF == 0 then
  5113. trinketTexture = "Interface\\Icons\\INV_Jewelry_TrinketPVP_02" -- Horde
  5114. else
  5115. trinketTexture = "Interface\\Icons\\INV_Jewelry_TrinketPVP_01" -- Alliance
  5116. end
  5117. else
  5118. if oppositeFactionBG == 0 then
  5119. trinketTexture = "Interface\\Icons\\INV_Jewelry_TrinketPVP_02" -- Horde
  5120. else
  5121. trinketTexture = "Interface\\Icons\\INV_Jewelry_TrinketPVP_01" -- Alliance
  5122. end
  5123. end
  5124. --]]
  5125. if isLowLevel then
  5126. trinketTexture = 338784 --lowlevelpvptrinket3m
  5127. else
  5128. trinketTexture = 1322720 --newpvptalenttrinket2m
  5129. end
  5130.  
  5131. local button = GVAR[side.."Button"]
  5132. for i = 1, currentSize do
  5133. button[i].PVPTrinketTexture:SetTexture(trinketTexture)
  5134. end
  5135. end
  5136.  
  5137. if not BattlegroundTargets_Options[side].ButtonFlagToggle[currentSize] then return end
  5138.  
  5139. -- flag
  5140. if isFlagBG == 1 or isFlagBG == 2 or isFlagBG == 3 then
  5141. local flagIcon -- setup_flag_texture
  5142. if playerFactionBG ~= playerFactionDEF then
  5143. flagIcon = "Interface\\WorldStateFrame\\ColumnIcon-FlagCapture2" -- neutral_flag
  5144. elseif playerFactionDEF == 0 then
  5145. if isFlagBG == 2 then
  5146. flagIcon = "Interface\\WorldStateFrame\\AllianceFlag"
  5147. else
  5148. flagIcon = "Interface\\WorldStateFrame\\HordeFlag"
  5149. end
  5150. else
  5151. if isFlagBG == 2 then
  5152. flagIcon = "Interface\\WorldStateFrame\\HordeFlag"
  5153. else
  5154. flagIcon = "Interface\\WorldStateFrame\\AllianceFlag"
  5155. end
  5156. end
  5157. local quad = (BattlegroundTargets_Options[side].ButtonHeight[currentSize]-2) * BattlegroundTargets_Options[side].ButtonFlagScale[currentSize]
  5158. local button = GVAR[side.."Button"]
  5159. for i = 1, currentSize do
  5160. button[i].FlagTexture:SetSize(quad, quad)
  5161. button[i].FlagTexture:SetTexture(flagIcon)
  5162. button[i].FlagTexture:SetTexCoord(0.15625001, 0.84374999, 0.15625001, 0.84374999)--(5/32, 27/32, 5/32, 27/32)
  5163. end
  5164. -- cart
  5165. elseif isFlagBG == 4 then
  5166. local flagIcon -- setup_flag_texture
  5167. if playerFactionBG ~= playerFactionDEF then
  5168. flagIcon = "Interface\\Minimap\\Vehicle-SilvershardMines-MineCart" -- neutral_flag
  5169. elseif playerFactionDEF == 0 then
  5170. flagIcon = "Interface\\Minimap\\Vehicle-SilvershardMines-MineCartRed"
  5171. else
  5172. flagIcon = "Interface\\Minimap\\Vehicle-SilvershardMines-MineCartBlue"
  5173. end
  5174. local quad = (BattlegroundTargets_Options[side].ButtonHeight[currentSize]-2) * BattlegroundTargets_Options[side].ButtonFlagScale[currentSize] * 1.1
  5175. local button = GVAR[side.."Button"]
  5176. for i = 1, currentSize do
  5177. button[i].FlagTexture:SetSize(quad, quad)
  5178. button[i].FlagTexture:SetTexture(flagIcon)
  5179. button[i].FlagTexture:SetTexCoord(0.09375, 0.90625, 0.09375, 0.90625)--(3/32, 29/32, 3/32, 29/32)
  5180. end
  5181. -- orb
  5182. elseif isFlagBG == 5 then
  5183. local quad = (BattlegroundTargets_Options[side].ButtonHeight[currentSize]-2) * BattlegroundTargets_Options[side].ButtonFlagScale[currentSize] * 1.3
  5184. local button = GVAR[side.."Button"]
  5185. for i = 1, currentSize do
  5186. button[i].FlagTexture:SetSize(quad, quad)
  5187. button[i].FlagTexture:SetTexCoord(0.0625, 0.9375, 0.0625, 0.9375)--(2/32, 30/32, 2/32, 30/32)
  5188. end
  5189. end
  5190. end
  5191. -- ---------------------------------------------------------------------------------------------------------------------
  5192.  
  5193. -- ---------------------------------------------------------------------------------------------------------------------
  5194. function BattlegroundTargets:RangeInfoText(buttonTxt)
  5195. local rangeInfoTxt = ""
  5196. for frc = 1, #FRAMES do
  5197. local side = FRAMES[frc]
  5198. local minRange, maxRange
  5199. local rangeSpellCLASS = ranges[side][playerClassEN]
  5200. if rangeSpellCLASS then
  5201. local _, _, _, _, minR, maxR = GetSpellInfo(rangeSpellCLASS.id)
  5202. minRange = minR
  5203. maxRange = maxR
  5204. end
  5205. minRange = minRange or 0
  5206. maxRange = maxRange or 0
  5207. if side == "Friend" then
  5208. rangeInfoTxt = rangeInfoTxt.." "..L["Friendly Players"]..":\n\n"
  5209. else
  5210. rangeInfoTxt = rangeInfoTxt.." "..L["Enemy Players"]..":\n\n"
  5211. end
  5212. rangeInfoTxt = rangeInfoTxt.." |cffffffffCombatLog:|r 40 - max: |cffffff790-"..(40+maxRange).." (40+"..maxRange..")|r\n\n"
  5213. rangeInfoTxt = rangeInfoTxt.." |cffffffff"..L["Class"]..":|r\n"
  5214. table_sort(class_IntegerSort, function(a, b) return a.loc < b.loc end)
  5215. for i = 1, #class_IntegerSort do
  5216. local classEN = class_IntegerSort[i].cid
  5217. local rangeSpellId = ranges[side][classEN].id
  5218. local rangeSpellLvl = ranges[side][classEN].lvl
  5219. local name, _, _, _, minRange, maxRange = GetSpellInfo(rangeSpellId)
  5220. local txtStr = "|cff"..classcolors[classEN].colorStr..class_IntegerSort[i].loc.."|r "..(minRange or "?").."-"..(maxRange or "?").." |cffffffff"..(name or L["Unknown"]).."|r |cffbbbbbb(spell ID = "..rangeSpellId..", level = "..rangeSpellLvl..")|r"
  5221. if classEN == playerClassEN then
  5222. rangeInfoTxt = rangeInfoTxt..">>> "..txtStr.." <<<\n"
  5223. else
  5224. rangeInfoTxt = rangeInfoTxt.." "..txtStr.."\n"
  5225. end
  5226. end
  5227. if frc == 1 then
  5228. rangeInfoTxt = rangeInfoTxt.."\n\n\n"
  5229. end
  5230. end
  5231. buttonTxt:SetText(rangeInfoTxt)
  5232. end
  5233. -- ---------------------------------------------------------------------------------------------------------------------
  5234.  
  5235.  
  5236.  
  5237. -- ---------------------------------------------------------------------------------------------------------------------
  5238. function BattlegroundTargets:Frame_Toggle(frame, show)
  5239. if show then
  5240. frame:Show()
  5241. else
  5242. if frame:IsShown() then
  5243. frame:Hide()
  5244. else
  5245. frame:Show()
  5246. end
  5247. end
  5248. end
  5249.  
  5250. function BattlegroundTargets:Frame_SetupPosition(frameName, side)
  5251. local BattlegroundTargets_Options = BattlegroundTargets_Options
  5252.  
  5253. if frameName == "BattlegroundTargets_OptionsFrame" then
  5254. local saveName = "OptionsFrame"
  5255. local options = BattlegroundTargets_Options.FramePosition[saveName]
  5256. if options then
  5257. local x = options.x or 0
  5258. local y = options.y or 0
  5259. local point = options.point or "CENTER"
  5260. local s = options.s or 1
  5261. _G[frameName]:ClearAllPoints()
  5262. _G[frameName]:SetPoint(point, UIParent, point, x/s, y/s)
  5263. else
  5264. _G[frameName]:ClearAllPoints()
  5265. _G[frameName]:SetPoint("CENTER", UIParent, "CENTER", 0, 0)
  5266. end
  5267. else
  5268. local saveName = side.."MainFrame"..currentSize
  5269. local options = BattlegroundTargets_Options.FramePosition[saveName]
  5270. if options then
  5271. local x = options.x or 0
  5272. local y = options.y or 0
  5273. local point = options.point or "CENTER"
  5274. local s = options.s or 1
  5275. _G[frameName]:ClearAllPoints()
  5276. _G[frameName]:SetPoint(point, UIParent, point, x/s, y/s)
  5277. else
  5278. local x = -200
  5279. if currentSize == 40 then
  5280. x = -225
  5281. end
  5282. if side == "Enemy" then
  5283. _G[frameName]:ClearAllPoints()
  5284. _G[frameName]:SetPoint("TOPRIGHT", GVAR.OptionsFrame, "TOPLEFT", x, -400)
  5285. else
  5286. _G[frameName]:ClearAllPoints()
  5287. _G[frameName]:SetPoint("TOPRIGHT", GVAR.OptionsFrame, "TOPLEFT", x, 0)
  5288. end
  5289. local X = _G[frameName]:GetLeft()
  5290. local Y = _G[frameName]:GetTop()
  5291. _G[frameName]:ClearAllPoints()
  5292. _G[frameName]:SetPoint("TOPLEFT", UIParent, "BOTTOMLEFT", X, Y)
  5293. end
  5294. end
  5295. end
  5296.  
  5297. function BattlegroundTargets:Frame_SavePosition(frameName, side)
  5298. local BattlegroundTargets_Options = BattlegroundTargets_Options
  5299.  
  5300. -- from LibWindow-1.1
  5301. local frame = _G[frameName]
  5302. local s = frame:GetScale()
  5303. local left, top = frame:GetLeft()*s, frame:GetTop()*s
  5304. local right, bottom = frame:GetRight()*s, frame:GetBottom()*s
  5305. local pwidth, pheight = UIParent:GetWidth(), UIParent:GetHeight()
  5306. local x, y, point
  5307. if left < (pwidth-right) and left < abs((left+right)/2 - pwidth/2) then
  5308. x = left
  5309. point = "LEFT"
  5310. elseif (pwidth-right) < abs((left+right)/2 - pwidth/2) then
  5311. x = right-pwidth
  5312. point = "RIGHT"
  5313. else
  5314. x = (left+right)/2 - pwidth/2
  5315. point = ""
  5316. end
  5317. if bottom < (pheight-top) and bottom < abs((bottom+top)/2 - pheight/2) then
  5318. y = bottom
  5319. point = "BOTTOM"..point
  5320. elseif (pheight-top) < abs((bottom+top)/2 - pheight/2) then
  5321. y = top-pheight
  5322. point = "TOP"..point
  5323. else
  5324. y = (bottom+top)/2 - pheight/2
  5325. end
  5326. if point == "" then
  5327. point = "CENTER"
  5328. end
  5329. -- ------------------
  5330.  
  5331. local saveName
  5332. if frameName == "BattlegroundTargets_OptionsFrame" then
  5333. saveName = "OptionsFrame"
  5334. -- CLAMP_FIX_OPTIONS BEGIN
  5335. local frameWidth = frame:GetWidth()
  5336. --local frameHeight = frame:GetHeight()
  5337. --print(floor(pwidth), floor(pheight), "#", "t:", floor(top), "l:", floor(left), "b:", floor(bottom), "r:", floor(right), "#", floor(frameWidth), floor(frameHeight))
  5338. if -left > frameWidth-40 or -- LEFT
  5339. left > pwidth-40 or -- RIGHT
  5340. bottom > pheight-40 or -- TOP
  5341. top < 40 -- BOTTOM
  5342. then
  5343. x = 0
  5344. y = 0
  5345. point = "CENTER"
  5346. s = 1
  5347. end
  5348. -- CLAMP_FIX_OPTIONS END
  5349. else
  5350. saveName = side.."MainFrame"..currentSize
  5351. end
  5352.  
  5353. --print("saveName:", saveName, "x:", x, "y:", y, "point:", point, "scale:", s)
  5354.  
  5355. BattlegroundTargets_Options.FramePosition[saveName] = {}
  5356. BattlegroundTargets_Options.FramePosition[saveName].x = x
  5357. BattlegroundTargets_Options.FramePosition[saveName].y = y
  5358. BattlegroundTargets_Options.FramePosition[saveName].point = point
  5359. BattlegroundTargets_Options.FramePosition[saveName].s = s
  5360.  
  5361. _G[frameName]:ClearAllPoints()
  5362. _G[frameName]:SetPoint(point, UIParent, point, x/s, y/s)
  5363. end
  5364. -- ---------------------------------------------------------------------------------------------------------------------
  5365.  
  5366.  
  5367.  
  5368. -- ---------------------------------------------------------------------------------------------------------------------
  5369. function BattlegroundTargets:OptionsFrameHide()
  5370. PlaySound("igQuestListClose")
  5371. isConfig = false
  5372. BattlegroundTargets:EventRegister()
  5373. TEMPLATE.EnableTextButton(GVAR.InterfaceOptions.CONFIG)
  5374.  
  5375. for frc = 1, #FRAMES do
  5376. local side = FRAMES[frc]
  5377. DATA[side].MainMoverModeValue = false
  5378. local MainFrame = side.."MainFrame"
  5379. GVAR[MainFrame].MainMoverButton:Show()
  5380. GVAR[MainFrame].MainMoverButton[1]:Show()
  5381. GVAR[MainFrame].MainMoverButton[2]:Show()
  5382. GVAR[MainFrame].MainMoverFrame:Hide()
  5383. GVAR[MainFrame].MainMoverModeButton:SetChecked(false)
  5384. end
  5385.  
  5386. testData.Loaded = false
  5387. BattlegroundTargets:DisableConfigMode()
  5388. end
  5389.  
  5390. function BattlegroundTargets:OptionsFrameShow()
  5391. local BattlegroundTargets_Options = BattlegroundTargets_Options
  5392.  
  5393. PlaySound("igQuestListOpen")
  5394. isConfig = true
  5395. BattlegroundTargets:EventUnregister()
  5396. TEMPLATE.DisableTextButton(GVAR.InterfaceOptions.CONFIG)
  5397.  
  5398. BattlegroundTargets:Frame_SetupPosition("BattlegroundTargets_OptionsFrame")
  5399. GVAR.OptionsFrame:StartMoving()
  5400. GVAR.OptionsFrame:StopMovingOrSizing()
  5401.  
  5402. if inBattleground then
  5403. testSize = currentSize
  5404. end
  5405.  
  5406. GVAR.OptionsFrame.ConfigGeneral:Hide()
  5407. GVAR.OptionsFrame.ConfigBrackets:Show()
  5408.  
  5409. if testSize == 10 then
  5410. TEMPLATE.SetTabButton(GVAR.OptionsFrame.TabGeneral, nil)
  5411. TEMPLATE.SetTabButton(GVAR.OptionsFrame.TabRaidSize10, true)
  5412. TEMPLATE.SetTabButton(GVAR.OptionsFrame.TabRaidSize15, nil)
  5413. TEMPLATE.SetTabButton(GVAR.OptionsFrame.TabRaidSize40, nil)
  5414. elseif testSize == 15 then
  5415. TEMPLATE.SetTabButton(GVAR.OptionsFrame.TabGeneral, nil)
  5416. TEMPLATE.SetTabButton(GVAR.OptionsFrame.TabRaidSize10, nil)
  5417. TEMPLATE.SetTabButton(GVAR.OptionsFrame.TabRaidSize15, true)
  5418. TEMPLATE.SetTabButton(GVAR.OptionsFrame.TabRaidSize40, nil)
  5419. elseif testSize == 40 then
  5420. TEMPLATE.SetTabButton(GVAR.OptionsFrame.TabGeneral, nil)
  5421. TEMPLATE.SetTabButton(GVAR.OptionsFrame.TabRaidSize10, nil)
  5422. TEMPLATE.SetTabButton(GVAR.OptionsFrame.TabRaidSize15, nil)
  5423. TEMPLATE.SetTabButton(GVAR.OptionsFrame.TabRaidSize40, true)
  5424. end
  5425.  
  5426. if fraction == "Friend" then
  5427. TEMPLATE.SetTabButton(GVAR.OptionsFrame.EnableFriendBracket, true)
  5428. TEMPLATE.SetTabButton(GVAR.OptionsFrame.EnableEnemyBracket, nil)
  5429. else
  5430. TEMPLATE.SetTabButton(GVAR.OptionsFrame.EnableFriendBracket, nil)
  5431. TEMPLATE.SetTabButton(GVAR.OptionsFrame.EnableEnemyBracket, true)
  5432. end
  5433.  
  5434. if inCombat or InCombatLockdown() then
  5435. BattlegroundTargets:DisableInsecureConfigWidges()
  5436. else
  5437. BattlegroundTargets:EnableInsecureConfigWidges()
  5438. end
  5439.  
  5440. if BattlegroundTargets_Options.Friend.EnableBracket[testSize] or BattlegroundTargets_Options.Enemy.EnableBracket[testSize] then
  5441. BattlegroundTargets:EnableConfigMode()
  5442. else
  5443. BattlegroundTargets:DisableConfigMode()
  5444. end
  5445. end
  5446. -- ---------------------------------------------------------------------------------------------------------------------
  5447.  
  5448.  
  5449.  
  5450. -- ---------------------------------------------------------------------------------------------------------------------
  5451. function BattlegroundTargets:LocalizedFontNameTest(show, font)
  5452. local BattlegroundTargets_Options = BattlegroundTargets_Options
  5453. for frc = 1, #FRAMES do
  5454. local side = FRAMES[frc]
  5455. -- ----------
  5456. if BattlegroundTargets_Options[side].EnableBracket[currentSize] then
  5457. local button = GVAR[side.."Button"]
  5458. if show then
  5459. if font then
  5460. local f = fontStyles[font].font
  5461. local s = BattlegroundTargets_Options[side].ButtonFontNameSize[currentSize]
  5462. for i = 1, currentSize do
  5463. button[i].Name:SetFont(f, s, "")
  5464. end
  5465. if BattlegroundTargets_Options[side].ButtonToTToggle[currentSize] then -- target_of_target
  5466. for i = 1, currentSize do
  5467. button[i].ToTButton.Name:SetFont(f, s, "")
  5468. end
  5469. end
  5470. end
  5471. if IsModifierKeyDown() then return end
  5472. button[1].Name:SetText(L["Test_abc_"])
  5473. button[2].Name:SetText(L["Test_koKR_"])
  5474. button[3].Name:SetText(L["Test_ruRU_"])
  5475. button[4].Name:SetText(L["Test_zhCN_"])
  5476. button[5].Name:SetText(L["Test_zhTW_"])
  5477. button[6].Name:SetText(L["Test_Latin1_"])
  5478. button[7].Name:SetText(L["Test_Latin2_"])
  5479. button[8].Name:SetText(L["Test_Latin3_"])
  5480. button[9].Name:SetText(L["Test_Latin4_"])
  5481. button[10].Name:SetText(L["Test_Latin5_"])
  5482. else
  5483. if font then
  5484. local f = fontStyles[ BattlegroundTargets_Options[side].ButtonFontNameStyle[currentSize] ].font
  5485. local s = BattlegroundTargets_Options[side].ButtonFontNameSize[currentSize]
  5486. for i = 1, currentSize do
  5487. button[i].Name:SetFont(f, s, "")
  5488. end
  5489. if BattlegroundTargets_Options[side].ButtonToTToggle[currentSize] then -- target_of_target
  5490. for i = 1, currentSize do
  5491. button[i].ToTButton.Name:SetFont(f, s, "")
  5492. end
  5493. end
  5494. end
  5495. if isLowLevel then
  5496. for i = 1, 10 do
  5497. button[i].Name:SetText(playerLevel.." "..button[i].name4button)
  5498. end
  5499. else
  5500. for i = 1, 10 do
  5501. button[i].Name:SetText(button[i].name4button)
  5502. end
  5503. end
  5504. end
  5505. end
  5506. -- ----------
  5507. end
  5508. end
  5509.  
  5510. function BattlegroundTargets:LocalizedFontNumberTest(show, font)
  5511. local BattlegroundTargets_Options = BattlegroundTargets_Options
  5512. for frc = 1, #FRAMES do
  5513. local side = FRAMES[frc]
  5514. -- ----------
  5515. if BattlegroundTargets_Options[side].EnableBracket[currentSize] then
  5516. local button = GVAR[side.."Button"]
  5517. if show then
  5518. local f = fontStyles[font].font
  5519. local s = BattlegroundTargets_Options[side].ButtonFontNumberSize[currentSize]
  5520. for i = 1, currentSize do
  5521. button[i].HealthText:SetFont(f, s, "OUTLINE")
  5522. button[i].FTargetCount:SetFont(f, s, "")
  5523. button[i].ETargetCount:SetFont(f, s, "")
  5524. button[i].FlagDebuff:SetFont(f, s-2, "OUTLINE")
  5525. button[i].RangeTxt:SetFont(f, s-1, "OUTLINE")
  5526. button[i].PVPTrinketTxt:SetFont(f, s-1, "OUTLINE")
  5527. end
  5528. if BattlegroundTargets_Options[side].ButtonToTToggle[currentSize] then -- target_of_target
  5529. for i = 1, currentSize do
  5530. button[i].ToTButton.HealthText:SetFont(f, s, "OUTLINE")
  5531. end
  5532. end
  5533. local Summary = GVAR[side.."Summary"]
  5534. Summary.HealerFriend:SetFont(f, s*2, "OUTLINE")
  5535. Summary.HealerEnemy:SetFont(f, s*2, "OUTLINE")
  5536. Summary.TankFriend:SetFont(f, s*2, "OUTLINE")
  5537. Summary.TankEnemy:SetFont(f, s*2, "OUTLINE")
  5538. Summary.DamageFriend:SetFont(f, s*2, "OUTLINE")
  5539. Summary.DamageEnemy:SetFont(f, s*2, "OUTLINE")
  5540. else
  5541. local f = fontStyles[ BattlegroundTargets_Options[side].ButtonFontNumberStyle[currentSize] ].font
  5542. local s = BattlegroundTargets_Options[side].ButtonFontNumberSize[currentSize]
  5543. for i = 1, currentSize do
  5544. button[i].HealthText:SetFont(f, s, "OUTLINE")
  5545. button[i].FTargetCount:SetFont(f, s, "")
  5546. button[i].ETargetCount:SetFont(f, s, "")
  5547. button[i].FlagDebuff:SetFont(f, s-2, "OUTLINE")
  5548. button[i].RangeTxt:SetFont(f, s-1, "OUTLINE")
  5549. button[i].PVPTrinketTxt:SetFont(f, s-1, "OUTLINE")
  5550. end
  5551. if BattlegroundTargets_Options[side].ButtonToTToggle[currentSize] then -- target_of_target
  5552. for i = 1, currentSize do
  5553. button[i].ToTButton.HealthText:SetFont(f, s, "OUTLINE")
  5554. end
  5555. end
  5556. local Summary = GVAR[side.."Summary"]
  5557. Summary.HealerFriend:SetFont(f, s*2, "OUTLINE")
  5558. Summary.HealerEnemy:SetFont(f, s*2, "OUTLINE")
  5559. Summary.TankFriend:SetFont(f, s*2, "OUTLINE")
  5560. Summary.TankEnemy:SetFont(f, s*2, "OUTLINE")
  5561. Summary.DamageFriend:SetFont(f, s*2, "OUTLINE")
  5562. Summary.DamageEnemy:SetFont(f, s*2, "OUTLINE")
  5563. end
  5564. end
  5565. -- ----------
  5566. end
  5567. end
  5568. -- ---------------------------------------------------------------------------------------------------------------------
  5569.  
  5570.  
  5571.  
  5572. -- ---------------------------------------------------------------------------------------------------------------------
  5573. function BattlegroundTargets:EnableConfigMode()
  5574. if inCombat or InCombatLockdown() then
  5575. reCheckBG = true
  5576. return
  5577. end
  5578.  
  5579. local BattlegroundTargets_Options = BattlegroundTargets_Options
  5580.  
  5581. currentSize = testSize
  5582. if not testData.Loaded then
  5583. newTestData()
  5584. testData.Loaded = true
  5585. end
  5586.  
  5587. for frc = 1, #FRAMES do
  5588. local side = FRAMES[frc]
  5589.  
  5590. DATA[side].MainData = testData[side].MainTestDATA[currentSize]
  5591.  
  5592. if BattlegroundTargets_Options[side].EnableBracket[currentSize] then
  5593. BattlegroundTargets:Frame_SetupPosition("BattlegroundTargets_"..side.."MainFrame", side)
  5594.  
  5595. GVAR[side.."MainFrame"]:EnableMouse(true)
  5596. GVAR[side.."MainFrame"]:SetAlpha(1)
  5597. GVAR[side.."MainFrame"]:Show() -- POSiCHK
  5598. GVAR[side.."MainFrame"].MainMoverButton:Show()
  5599. GVAR[side.."ScoreUpdateTexture"]:Show()
  5600. GVAR[side.."IsGhostTexture"]:Show()
  5601.  
  5602. BattlegroundTargets:ShufflerFunc("ShuffleCheck", side)
  5603. BattlegroundTargets:SetupButtonLayout(side)
  5604. BattlegroundTargets:MainDataUpdate(side)
  5605. BattlegroundTargets:SetConfigButtonValues(side)
  5606.  
  5607. local button = GVAR[side.."Button"]
  5608. for i = 1, 40 do
  5609. if i < currentSize+1 then
  5610. button[i]:Show()
  5611. else
  5612. button[i]:Hide()
  5613. end
  5614. end
  5615. else
  5616. GVAR[side.."MainFrame"]:Hide()
  5617. local button = GVAR[side.."Button"]
  5618. for i = 1, 40 do
  5619. button[i]:Hide()
  5620. end
  5621. end
  5622.  
  5623. end
  5624.  
  5625. -- delete global_OnUpdate
  5626. for frc = 1, #FRAMES do
  5627. local side = FRAMES[frc]
  5628. GVAR[side.."MainFrame"]:SetScript("OnUpdate", nil)
  5629. GVAR[side.."ScreenShot_Timer_Button"]:SetScript("OnUpdate", nil)
  5630. GVAR[side.."Target_Timer_Button"]:SetScript("OnUpdate", nil)
  5631. GVAR[side.."PVPTrinket_Timer_Button"]:SetScript("OnUpdate", nil)
  5632. GVAR[side.."RangeCheck_Timer_Button"]:SetScript("OnUpdate", nil)
  5633. end
  5634.  
  5635. if BattlegroundTargets_Options.Friend.EnableBracket[currentSize] or BattlegroundTargets_Options.Enemy.EnableBracket[currentSize] then
  5636. BattlegroundTargets:SetOptions(fraction)
  5637. end
  5638. end
  5639. -- ---------------------------------------------------------------------------------------------------------------------
  5640.  
  5641. -- ---------------------------------------------------------------------------------------------------------------------
  5642. function BattlegroundTargets:DisableConfigMode()
  5643. if inCombat or InCombatLockdown() then
  5644. reCheckBG = true
  5645. return
  5646. end
  5647.  
  5648. currentSize = testSize
  5649. BattlegroundTargets:SetOptions(fraction)
  5650.  
  5651. GVAR.FriendMainFrame:Hide()
  5652. GVAR.EnemyMainFrame:Hide()
  5653. for i = 1, 40 do
  5654. GVAR.FriendButton[i]:Hide()
  5655. GVAR.EnemyButton[i]:Hide()
  5656. end
  5657.  
  5658. if isConfig then return end
  5659.  
  5660. local curTime = GetTime()
  5661. BattlegroundTargets.targetCountTimer = 0 -- immediate update
  5662. scoreFrequency = 0 -- immediate update
  5663. BattlegroundTargets:BattlefieldCheck()
  5664.  
  5665. if not inBattleground then return end
  5666.  
  5667. local BattlegroundTargets_Options = BattlegroundTargets_Options
  5668.  
  5669. if BattlegroundTargets_Options.Friend.EnableBracket[currentSize] or BattlegroundTargets_Options.Enemy.EnableBracket[currentSize] then
  5670. BattlegroundTargets:CheckIfPlayerIsGhost()
  5671.  
  5672. if BattlegroundTargets_Options.Friend.ButtonTargetToggle[currentSize] or BattlegroundTargets_Options.Enemy.ButtonTargetToggle[currentSize] then
  5673. BattlegroundTargets:CheckPlayerTarget()
  5674. end
  5675. if BattlegroundTargets_Options.Friend.ButtonAssistToggle[currentSize] or BattlegroundTargets_Options.Enemy.ButtonAssistToggle[currentSize] then
  5676. BattlegroundTargets:CheckAssist()
  5677. end
  5678. if BattlegroundTargets_Options.Friend.ButtonFocusToggle[currentSize] or BattlegroundTargets_Options.Enemy.ButtonFocusToggle[currentSize] then
  5679. BattlegroundTargets:CheckPlayerFocus()
  5680. end
  5681. end
  5682.  
  5683. for frc = 1, #FRAMES do
  5684. local side = FRAMES[frc]
  5685. if BattlegroundTargets_Options[side].EnableBracket[currentSize] then
  5686.  
  5687. if BattlegroundTargets_Options[side].ButtonRangeToggle[currentSize] then
  5688. BattlegroundTargets:UpdateRange(side, curTime)
  5689. end
  5690.  
  5691. if BattlegroundTargets_Options[side].ButtonFlagToggle[currentSize] then
  5692. if isFlagBG >= 1 and isFlagBG <= 4 then--if isFlagBG == 1 or isFlagBG == 2 or isFlagBG == 3 or isFlagBG == 4 then
  5693. local button = GVAR[side.."Button"][ DATA[side].Name2Button[ DATA[side].hasFlag ] ]
  5694. if button then
  5695. button.FlagTexture:SetAlpha(1)
  5696. BattlegroundTargets:SetFlagDebuff(button, flagDebuff)
  5697. end
  5698. elseif isFlagBG == 5 then
  5699. for k, v in pairs(hasOrb) do
  5700. local button = GVAR[side.."Button"][ DATA[side].Name2Button[ v.name ] ]
  5701. if button then
  5702. button.orbColor = k
  5703. button.FlagTexture:SetAlpha(1)
  5704. button.FlagTexture:SetTexture(orbIDs[ orbColIDs[k] ].texture)
  5705. BattlegroundTargets:SetFlagDebuff(button, v.orbval)
  5706. BattlegroundTargets:SetOrbCorner(button, k)
  5707. end
  5708. end
  5709. end
  5710. else
  5711. BattlegroundTargets:CheckFlagCarrierEND()
  5712. end
  5713.  
  5714. if BattlegroundTargets_Options[side].ButtonLeaderToggle[currentSize] then -- leader_
  5715. local button = GVAR[side.."Button"][ DATA[side].Name2Button[ DATA[side].isLeader ] ]
  5716. if button then
  5717. button.LeaderTexture:SetAlpha(1)
  5718. end
  5719. end
  5720.  
  5721. if curTime - scoreLastUpdate >= scoreWarning then
  5722. GVAR[side.."ScoreUpdateTexture"]:Show()
  5723. else
  5724. GVAR[side.."ScoreUpdateTexture"]:Hide()
  5725. end
  5726.  
  5727. end
  5728. end
  5729.  
  5730. end
  5731. -- ---------------------------------------------------------------------------------------------------------------------
  5732.  
  5733.  
  5734.  
  5735. -- ---------------------------------------------------------------------------------------------------------------------
  5736. function BattlegroundTargets:SetConfigButtonValues(side)
  5737. local BattlegroundTargets_Options = BattlegroundTargets_Options
  5738.  
  5739. local ButtonHealthBarToggle = BattlegroundTargets_Options[side].ButtonHealthBarToggle[currentSize]
  5740. local ButtonHealthTextToggle = BattlegroundTargets_Options[side].ButtonHealthTextToggle[currentSize]
  5741. local ButtonRangeToggle = BattlegroundTargets_Options[side].ButtonRangeToggle[currentSize]
  5742. local ButtonRangeDisplay = BattlegroundTargets_Options[side].ButtonRangeDisplay[currentSize]
  5743. local ButtonFTargetCountToggle = BattlegroundTargets_Options[side].ButtonFTargetCountToggle[currentSize]
  5744. local ButtonETargetCountToggle = BattlegroundTargets_Options[side].ButtonETargetCountToggle[currentSize]
  5745. local ButtonPvPTrinketToggle = BattlegroundTargets_Options[side].ButtonPvPTrinketToggle[currentSize]
  5746.  
  5747. local button = GVAR[side.."Button"]
  5748. for i = 1, currentSize do
  5749. local button = button[i]
  5750.  
  5751. -- target, focus, flag, assist, leader
  5752. button.TargetTexture:SetAlpha(0)
  5753. button.HighlightT:SetColorTexture(0, 0, 0, 1)
  5754. button.HighlightR:SetColorTexture(0, 0, 0, 1)
  5755. button.HighlightB:SetColorTexture(0, 0, 0, 1)
  5756. button.HighlightL:SetColorTexture(0, 0, 0, 1)
  5757. button.FocusTexture:SetAlpha(0)
  5758. button.FlagTexture:SetAlpha(0)
  5759. button.FlagDebuff:SetText("")
  5760. button.OrbCornerTL:SetAlpha(0)
  5761. button.OrbCornerTR:SetAlpha(0)
  5762. button.OrbCornerBL:SetAlpha(0)
  5763. button.OrbCornerBR:SetAlpha(0)
  5764. button.AssistTargetTexture:SetAlpha(0)
  5765. button.AssistSourceTexture:SetAlpha(0)
  5766. button.LeaderTexture:SetAlpha(0)
  5767.  
  5768. -- health
  5769. if ButtonHealthBarToggle then
  5770. local width = DATA[side].healthBarWidth * (testData[side].Health[i] / 100)
  5771. width = math_max(0.01, width)
  5772. width = math_min(DATA[side].healthBarWidth, width)
  5773. button.HealthBar:SetWidth(width)
  5774. else
  5775. button.HealthBar:SetWidth(DATA[side].healthBarWidth)
  5776. end
  5777. if ButtonHealthTextToggle then
  5778. button.HealthText:SetText(testData[side].Health[i])
  5779. else
  5780. button.HealthText:SetText("")
  5781. end
  5782.  
  5783. -- targetcount
  5784. if ButtonFTargetCountToggle then
  5785. button.FTargetCount:SetText(testData[side].targetFCount[i])
  5786. else
  5787. button.FTargetCount:SetText("0")
  5788. end
  5789. if ButtonETargetCountToggle then
  5790. button.ETargetCount:SetText(testData[side].targetECount[i])
  5791. else
  5792. button.ETargetCount:SetText("0")
  5793. end
  5794.  
  5795. -- range
  5796. if ButtonRangeToggle then
  5797. if testData[side].Range[i] < 40 then
  5798. BattlegroundTargets:Range_Display(true, button, testData[side].Range[i])
  5799. else
  5800. BattlegroundTargets:Range_Display(false, button, nil, ButtonRangeDisplay)
  5801. end
  5802. else
  5803. BattlegroundTargets:Range_Display(true, button, nil)
  5804. end
  5805.  
  5806. -- pvp_trinket_
  5807. if ButtonPvPTrinketToggle then
  5808. if testData[side].PVPTrinket[i].isEnable == 1 then
  5809. button.PVPTrinketTexture:SetAlpha(1)
  5810. button.PVPTrinketTxt:SetText(testData[side].PVPTrinket[i].isTime)
  5811. else
  5812. button.PVPTrinketTexture:SetAlpha(0)
  5813. button.PVPTrinketTxt:SetText("")
  5814. end
  5815. else
  5816. button.PVPTrinketTexture:SetAlpha(0)
  5817. button.PVPTrinketTxt:SetText("")
  5818. end
  5819. end
  5820.  
  5821. -- target_of_target
  5822. if BattlegroundTargets_Options[side].ButtonToTToggle[currentSize] then
  5823. local ButtonHealthBarToggle = BattlegroundTargets_Options[side].ButtonHealthBarToggle[currentSize]
  5824. local ButtonHealthTextToggle = BattlegroundTargets_Options[side].ButtonHealthTextToggle[currentSize]
  5825. local button = GVAR[side.."Button"]
  5826. for i = 1, currentSize do
  5827. local ToTButton = button[i].ToTButton
  5828. if testData[side].TargetofTarget[i].rnd <= 33 then
  5829. local totName = testData[side].TargetofTarget[i].totName
  5830. local classToken = testData[side].TargetofTarget[i].classToken
  5831. local talentSpec = Textures.RoleIcon[ testData[side].TargetofTarget[i].talentSpec ]
  5832. local isEnemy = testData[side].TargetofTarget[i].isEnemy
  5833. local num = testData[side].TargetofTarget[i].healthvalue
  5834. local colR = classcolors[classToken].r
  5835. local colG = classcolors[classToken].g
  5836. local colB = classcolors[classToken].b
  5837. local colR5 = colR*0.5
  5838. local colG5 = colG*0.5
  5839. local colB5 = colB*0.5
  5840.  
  5841. ToTButton.Name:SetText(totName)
  5842. ToTButton.RoleTexture:SetTexCoord(talentSpec[1], talentSpec[2], talentSpec[3], talentSpec[4])
  5843.  
  5844. if isEnemy == 2 then
  5845. ToTButton.FactionTexture:SetTexture(Textures.EnemyIcon.path)
  5846. ToTButton.FactionTexture:SetTexCoord(unpack(Textures.EnemyIcon.coords))
  5847. else
  5848. ToTButton.FactionTexture:SetTexture(Textures.FriendIcon.path)
  5849. ToTButton.FactionTexture:SetTexCoord(unpack(Textures.FriendIcon.coords))
  5850. end
  5851.  
  5852. if ButtonHealthBarToggle then
  5853. ToTButton.ClassColorBackground:SetColorTexture(colR5, colG5, colB5, 1)
  5854. ToTButton.HealthBar:SetColorTexture(colR, colG, colB, 1)
  5855. local width = DATA[side].totHealthBarWidth * (num / 100)
  5856. width = math_max(0.01, width)
  5857. width = math_min(DATA[side].totHealthBarWidth, width)
  5858. ToTButton.HealthBar:SetWidth(width)
  5859. else
  5860. --ToTButton.ClassColorBackground:SetColorTexture(colR5, colG5, colB5, 1)
  5861. ToTButton.HealthBar:SetColorTexture(colR, colG, colB, 1)
  5862. end
  5863. if ButtonHealthTextToggle then
  5864. ToTButton.HealthText:SetText(num)
  5865. else
  5866. ToTButton.HealthText:SetText("")
  5867. end
  5868.  
  5869. ToTButton:SetAlpha(1)
  5870. else
  5871. ToTButton:SetAlpha(0)
  5872. end
  5873. end
  5874. else
  5875. local button = GVAR[side.."Button"]
  5876. for i = 1, currentSize do
  5877. button[i].ToTButton:SetAlpha(0)
  5878. end
  5879. end
  5880.  
  5881. -- leader, target, focus, flag, assist
  5882. isTargetButton = nil
  5883. if BattlegroundTargets_Options[side].ButtonTargetToggle[currentSize] then
  5884. local button = GVAR[side.."Button"][testData[side].IconTarget]
  5885. button.TargetTexture:SetAlpha(1)
  5886. button.HighlightT:SetColorTexture(0.5, 0.5, 0.5, 1)
  5887. button.HighlightR:SetColorTexture(0.5, 0.5, 0.5, 1)
  5888. button.HighlightB:SetColorTexture(0.5, 0.5, 0.5, 1)
  5889. button.HighlightL:SetColorTexture(0.5, 0.5, 0.5, 1)
  5890. isTargetButton = button
  5891. end
  5892. if BattlegroundTargets_Options[side].ButtonFocusToggle[currentSize] then
  5893. GVAR[side.."Button"][testData[side].IconFocus].FocusTexture:SetAlpha(1)
  5894. end
  5895. if BattlegroundTargets_Options[side].ButtonFlagToggle[currentSize] then
  5896. if currentSize == 10 or currentSize == 15 then
  5897. if testData.CarrierDisplay == "flag" then
  5898. local quad = (BattlegroundTargets_Options[side].ButtonHeight[currentSize]-2) * BattlegroundTargets_Options[side].ButtonFlagScale[currentSize]
  5899. local button = GVAR[side.."Button"][testData[side].IconFlag.button]
  5900. button.FlagTexture:SetSize(quad, quad)
  5901. button.FlagTexture:SetTexture(Textures.flagTexture)
  5902. button.FlagTexture:SetTexCoord(0.15625001, 0.84374999, 0.15625001, 0.84374999)--(5/32, 27/32, 5/32, 27/32)
  5903. button.FlagTexture:SetAlpha(1)
  5904. button.FlagDebuff:SetText(testData[side].IconFlag.txt)
  5905. elseif testData.CarrierDisplay == "orb" then
  5906. local quad = (BattlegroundTargets_Options[side].ButtonHeight[currentSize]-2) * BattlegroundTargets_Options[side].ButtonFlagScale[currentSize] * 1.3
  5907. for k, v in pairs(testData[side].IconOrb) do
  5908. if v.button then
  5909. local button = GVAR[side.."Button"][v.button]
  5910. button.FlagTexture:SetSize(quad, quad)
  5911. button.FlagTexture:SetTexture(orbIDs[ k ].texture)
  5912. button.FlagTexture:SetTexCoord(0.0625, 0.9375, 0.0625, 0.9375)--(2/32, 30/32, 2/32, 30/32)
  5913. button.FlagTexture:SetAlpha(1)
  5914. BattlegroundTargets:SetFlagDebuff(button, v.orbval)
  5915. BattlegroundTargets:SetOrbCorner(button, orbIDs[k].color)
  5916. end
  5917. end
  5918. elseif testData.CarrierDisplay == "cart" then
  5919. local quad = (BattlegroundTargets_Options[side].ButtonHeight[currentSize]-2) * BattlegroundTargets_Options[side].ButtonFlagScale[currentSize] * 1.1
  5920. local button = GVAR[side.."Button"][testData[side].IconFlag.button]
  5921. button.FlagTexture:SetSize(quad, quad)
  5922. button.FlagTexture:SetTexture(Textures.cartTexture)
  5923. button.FlagTexture:SetTexCoord(0.09375, 0.90625, 0.09375, 0.90625)--(3/32, 29/32, 3/32, 29/32)
  5924. button.FlagTexture:SetAlpha(1)
  5925. button.FlagDebuff:SetText(testData[side].IconFlag.txt)
  5926. end
  5927. end
  5928. end
  5929. if BattlegroundTargets_Options[side].ButtonAssistToggle[currentSize] then
  5930. GVAR[side.."Button"][testData[side].IconTargetAssi].AssistTargetTexture:SetAlpha(1)
  5931. GVAR.FriendButton[testData.Friend.IconSourceAssi].AssistSourceTexture:SetAlpha(1)
  5932. end
  5933. if BattlegroundTargets_Options[side].ButtonLeaderToggle[currentSize] then
  5934. GVAR[side.."Button"][testData[side].Leader].LeaderTexture:SetAlpha(1)
  5935. end
  5936. end
  5937. -- ---------------------------------------------------------------------------------------------------------------------
  5938.  
  5939. -- ---------------------------------------------------------------------------------------------------------------------
  5940. function BattlegroundTargets:ClearConfigButtonValues(side, button, clearRange)
  5941. local BattlegroundTargets_Options = BattlegroundTargets_Options
  5942.  
  5943. -- colors
  5944. button.colR = 0
  5945. button.colG = 0
  5946. button.colB = 0
  5947. button.colR5 = 0
  5948. button.colG5 = 0
  5949. button.colB5 = 0
  5950.  
  5951. -- basic
  5952. button.Name:SetText("")
  5953. button.RoleTexture:SetTexCoord(0, 0, 0, 0)
  5954. button.SpecTexture:SetTexture(nil)
  5955. button.ClassTexture:SetTexCoord(0, 0, 0, 0)
  5956. button.ClassColorBackground:SetColorTexture(0, 0, 0, 0)
  5957.  
  5958. -- target
  5959. button.TargetTexture:SetAlpha(0)
  5960. button.HighlightT:SetColorTexture(0, 0, 0, 1)
  5961. button.HighlightR:SetColorTexture(0, 0, 0, 1)
  5962. button.HighlightB:SetColorTexture(0, 0, 0, 1)
  5963. button.HighlightL:SetColorTexture(0, 0, 0, 1)
  5964.  
  5965. -- targetcount
  5966. button.FTargetCount:SetText("")
  5967. button.ETargetCount:SetText("")
  5968.  
  5969. -- focus
  5970. button.FocusTexture:SetAlpha(0)
  5971.  
  5972. -- flag
  5973. button.FlagTexture:SetAlpha(0)
  5974. button.FlagDebuff:SetText("")
  5975. button.OrbCornerTL:SetAlpha(0)
  5976. button.OrbCornerTR:SetAlpha(0)
  5977. button.OrbCornerBL:SetAlpha(0)
  5978. button.OrbCornerBR:SetAlpha(0)
  5979.  
  5980. -- assist
  5981. button.AssistTargetTexture:SetAlpha(0)
  5982. button.AssistSourceTexture:SetAlpha(0)
  5983.  
  5984. -- leader
  5985. button.LeaderTexture:SetAlpha(0)
  5986.  
  5987. -- pvp trinket
  5988. button.PVPTrinketTexture:SetAlpha(0)
  5989. button.PVPTrinketTxt:SetText("")
  5990.  
  5991. -- health
  5992. button.HealthBar:SetColorTexture(0, 0, 0, 0)
  5993. button.HealthBar:SetWidth(DATA[side].healthBarWidth)
  5994. button.HealthText:SetText("")
  5995.  
  5996. -- target_of_target
  5997. button.ToTButton:SetAlpha(0)
  5998. button.ToTButton.Name:SetText("")
  5999. button.ToTButton.ClassColorBackground:SetColorTexture(0, 0, 0, 0)
  6000. button.ToTButton.RoleTexture:SetTexCoord(0, 0, 0, 0)
  6001. button.ToTButton.FactionTexture:SetTexCoord(0, 0, 0, 0)
  6002. button.ToTButton.HealthBar:SetColorTexture(0, 0, 0, 0)
  6003. button.ToTButton.HealthBar:SetWidth(DATA[side].healthBarWidth)
  6004. button.ToTButton.HealthText:SetText("")
  6005.  
  6006. -- range
  6007. button.RangeTexture:SetColorTexture(0, 0, 0, 0)
  6008.  
  6009. if clearRange then
  6010. if BattlegroundTargets_Options[side].ButtonRangeToggle[currentSize] then
  6011. BattlegroundTargets:Range_Display(false, button, nil, BattlegroundTargets_Options[side].ButtonRangeDisplay[currentSize])
  6012. else
  6013. BattlegroundTargets:Range_Display(true, button, nil)
  6014. end
  6015. end
  6016. end
  6017. -- ---------------------------------------------------------------------------------------------------------------------
  6018.  
  6019.  
  6020.  
  6021. -- ---------------------------------------------------------------------------------------------------------------------
  6022. function BattlegroundTargets:DefaultShuffle()
  6023. for frc = 1, #FRAMES do
  6024. local side = FRAMES[frc]
  6025. -- health range
  6026. for i = 1, 40 do
  6027. testData[side].Health[i] = random(0,100)
  6028. testData[side].Range[i] = random(0,100)
  6029. end
  6030. -- targetcount
  6031. for i = 1, 40 do
  6032. testData[side].targetFCount[i] = random(0,i)
  6033. testData[side].targetECount[i] = random(0,i)
  6034. end
  6035. -- target_of_target
  6036. for i = 1, 40 do
  6037. testData[side].TargetofTarget[i] = random(0,100)
  6038. end
  6039. local isOneValueCheck = 0
  6040. for i = 1, currentSize do
  6041. if testData[side].TargetofTarget[i] > 33 then
  6042. isOneValueCheck = isOneValueCheck + 1
  6043. end
  6044. end
  6045. if isOneValueCheck == currentSize then
  6046. testData[side].TargetofTarget[1] = 1
  6047. end
  6048. for i = 1, 40 do
  6049. local rndnum = testData[side].TargetofTarget[i]
  6050. local classToken = class_IntegerSort[ random(1,11) ].cid
  6051. local talentSpec
  6052. if classToken ~= "DEMONHUNTER" then
  6053. talentSpec = classes[ classToken ].spec[ random(1,3) ].role
  6054. else
  6055. talentSpec = classes[ classToken ].spec[ random(1,2) ].role
  6056. end
  6057. testData[side].TargetofTarget[i] = {
  6058. rnd = rndnum,
  6059. totName = L["Target of Target"]..i,
  6060. classToken = classToken,
  6061. talentSpec = talentSpec,
  6062. isEnemy = random(1,2),
  6063. healthvalue = random(1,100)
  6064. }
  6065. end
  6066. -- target focus assi leader
  6067. testData[side].IconTarget = random(1,10)
  6068. testData[side].IconFocus = random(1,10)
  6069. testData[side].IconTargetAssi = random(1,10)
  6070. testData[side].IconSourceAssi = random(1,10)
  6071. testData[side].Leader = random(1,10)
  6072. -- flag
  6073. testData[side].IconFlag.button = random(1,10)
  6074. testData[side].IconFlag.txt = random(1,10)
  6075. -- pvp_trinket_
  6076. testData[side].PVPTrinket[ random(1,10) ] = { -- show at least one
  6077. isEnable = 1,
  6078. isTime = random(1,120)
  6079. }
  6080. for i = 1, 40 do
  6081. testData[side].PVPTrinket[i] = {
  6082. isEnable = random(1,2),
  6083. isTime = random(1,120)
  6084. }
  6085. end
  6086. end
  6087. -- orb friend
  6088. local count1 = 0
  6089. for k, v in pairs(testData.Friend.IconOrb) do
  6090. if count1 == 3 then break end
  6091. if count1 == 0 then -- 10 20 30 40 50 60 70 80 90 100 100 100 100 100 100 100 100 100 100 100 - Increases damage done by x%.
  6092. v.button = random(1,10) -- -5 -10 -15 -20 -25 -30 -35 -40 -45 -50 -55 -60 -65 -70 -75 -80 -85 -90 -95 -100 - Reduces healing received by x%.
  6093. v.orbval = random(1,20)*30 ---> 30 60 90 120 150 180 210 240 270 300 330 360 390 420 450 480 510 540 570 600 - Increases damage taken by x%.
  6094. count1 = 1
  6095. else
  6096. v.button = nil
  6097. v.orbval = nil
  6098. if random(0,100) > 50 then
  6099. local b = random(1,10)
  6100. local numExists
  6101. for k2, v2 in pairs(testData.Friend.IconOrb) do
  6102. if v2.button == b then
  6103. numExists = true
  6104. break
  6105. end
  6106. end
  6107. if not numExists then
  6108. v.button = b
  6109. v.orbval = random(1,20)*30
  6110. count1 = count1 + 1
  6111. end
  6112. end
  6113. end
  6114. end
  6115. -- orb enemy
  6116. local count2 = 0
  6117. for k, v in pairs(testData.Enemy.IconOrb) do
  6118. if count1 + count2 == 4 then break end
  6119. if count2 == 0 then -- 10 20 30 40 50 60 70 80 90 100 100 100 100 100 100 100 100 100 100 100 - Increases damage done by x%.
  6120. v.button = random(1,10) -- -5 -10 -15 -20 -25 -30 -35 -40 -45 -50 -55 -60 -65 -70 -75 -80 -85 -90 -95 -100 - Reduces healing received by x%.
  6121. v.orbval = random(1,20)*30 ---> 30 60 90 120 150 180 210 240 270 300 330 360 390 420 450 480 510 540 570 600 - Increases damage taken by x%.
  6122. count2 = 1
  6123. else
  6124. v.button = nil
  6125. v.orbval = nil
  6126. if random(0,100) > 50 then
  6127. local b = random(1,10)
  6128. local numExists
  6129. for k2, v2 in pairs(testData.Enemy.IconOrb) do
  6130. if v2.button == b then
  6131. numExists = true
  6132. break
  6133. end
  6134. end
  6135. if not numExists then
  6136. v.button = b
  6137. v.orbval = random(1,20)*30
  6138. end
  6139. end
  6140. end
  6141. end
  6142. end
  6143.  
  6144. function BattlegroundTargets:ShufflerFunc(what, side)
  6145. if what == "OnLeave" then
  6146. GVAR.OptionsFrame:SetScript("OnUpdate", nil)
  6147. GVAR.OptionsFrame.TestShuffler.Texture:SetSize(32, 32)
  6148. GVAR.OptionsFrame.TestShuffler.TextureHighlight:SetSize(32, 32)
  6149. elseif what == "OnEnter" then
  6150. BattlegroundTargets.elapsed = 1
  6151. BattlegroundTargets.progBit = true
  6152. if not BattlegroundTargets.progNum then BattlegroundTargets.progNum = 0 end
  6153. if not BattlegroundTargets.progMod then BattlegroundTargets.progMod = 0 end
  6154. GVAR.OptionsFrame:SetScript("OnUpdate", function(self, elap)
  6155. if inCombat then GVAR.OptionsFrame:SetScript("OnUpdate", nil) return end
  6156. BattlegroundTargets.elapsed = BattlegroundTargets.elapsed + elap
  6157. if BattlegroundTargets.elapsed < 0.4 then return end
  6158. BattlegroundTargets.elapsed = 0
  6159. BattlegroundTargets:Shuffle(BattlegroundTargets.shuffleStyle) -- :Shuffle( _SHUFFLE_
  6160. end)
  6161. elseif what == "OnClick" then
  6162. GVAR.OptionsFrame.TestShuffler.Texture:SetSize(32, 32)
  6163. GVAR.OptionsFrame.TestShuffler.TextureHighlight:SetSize(32, 32)
  6164. BattlegroundTargets.shuffleStyle = not BattlegroundTargets.shuffleStyle
  6165. if BattlegroundTargets.shuffleStyle then
  6166. GVAR.OptionsFrame.TestShuffler.Texture:SetTexture("Interface\\Icons\\INV_Sigil_Thorim")
  6167. else
  6168. GVAR.OptionsFrame.TestShuffler.Texture:SetTexture("Interface\\Icons\\INV_Sigil_Mimiron")
  6169. end
  6170. elseif what == "OnMouseDown" then
  6171. GVAR.OptionsFrame.TestShuffler.Texture:SetSize(30, 30)
  6172. GVAR.OptionsFrame.TestShuffler.TextureHighlight:SetSize(30, 30)
  6173. elseif what == "ShuffleCheck" then
  6174. local BattlegroundTargets_Options = BattlegroundTargets_Options
  6175. if BattlegroundTargets_Options[side].ButtonTargetToggle[currentSize] or
  6176. BattlegroundTargets_Options[side].ButtonToTToggle[currentSize] or
  6177. BattlegroundTargets_Options[side].ButtonFlagToggle[currentSize] or
  6178. BattlegroundTargets_Options[side].ButtonHealthBarToggle[currentSize] or
  6179. BattlegroundTargets_Options[side].ButtonHealthTextToggle[currentSize] or
  6180. BattlegroundTargets_Options[side].ButtonFocusToggle[currentSize] or
  6181. BattlegroundTargets_Options[side].ButtonAssistToggle[currentSize] or
  6182. BattlegroundTargets_Options[side].ButtonLeaderToggle[currentSize] or
  6183. BattlegroundTargets_Options[side].ButtonRangeToggle[currentSize] or
  6184. BattlegroundTargets_Options[side].ButtonPvPTrinketToggle[currentSize]
  6185. then
  6186. GVAR.OptionsFrame.TestShuffler:Show()
  6187. else
  6188. GVAR.OptionsFrame.TestShuffler:Hide()
  6189. end
  6190. end
  6191. end
  6192.  
  6193. function BattlegroundTargets:Shuffle(shuffleStyle) -- :Shuffle( _SHUFFLE_
  6194. BattlegroundTargets.progBit = not BattlegroundTargets.progBit
  6195. if BattlegroundTargets.progBit then
  6196. GVAR.OptionsFrame.TestShuffler.TextureHighlight:SetAlpha(0)
  6197. else
  6198. GVAR.OptionsFrame.TestShuffler.TextureHighlight:SetAlpha(0.5)
  6199. end
  6200.  
  6201. if shuffleStyle then
  6202. BattlegroundTargets:DefaultShuffle()
  6203. else
  6204. if BattlegroundTargets.progMod == 0 then
  6205. BattlegroundTargets.progNum = BattlegroundTargets.progNum + 1
  6206. else
  6207. BattlegroundTargets.progNum = BattlegroundTargets.progNum - 1
  6208. end
  6209. if BattlegroundTargets.progNum >= 10 then
  6210. BattlegroundTargets.progNum = 10
  6211. BattlegroundTargets.progMod = 1
  6212. elseif BattlegroundTargets.progNum <= 1 then
  6213. BattlegroundTargets.progNum = 1
  6214. BattlegroundTargets.progMod = 0
  6215. end
  6216. testData.Friend.IconTarget = BattlegroundTargets.progNum
  6217. testData.Enemy.IconTarget = BattlegroundTargets.progNum
  6218. testData.Friend.IconFocus = BattlegroundTargets.progNum
  6219. testData.Enemy.IconFocus = BattlegroundTargets.progNum
  6220. testData.Friend.IconTargetAssi = BattlegroundTargets.progNum
  6221. testData.Enemy.IconTargetAssi = BattlegroundTargets.progNum
  6222. testData.Friend.IconSourceAssi = BattlegroundTargets.progNum
  6223. testData.Enemy.IconSourceAssi = BattlegroundTargets.progNum
  6224. testData.Friend.Leader = BattlegroundTargets.progNum
  6225. testData.Enemy.Leader = BattlegroundTargets.progNum
  6226.  
  6227. testData.Friend.IconFlag.button = BattlegroundTargets.progNum
  6228. testData.Enemy.IconFlag.button = BattlegroundTargets.progNum
  6229. testData.Friend.IconFlag.txt = BattlegroundTargets.progNum
  6230. testData.Enemy.IconFlag.txt = BattlegroundTargets.progNum
  6231.  
  6232. local num = BattlegroundTargets.progNum * 60 -- * 2 * 30
  6233. for k, v in pairs(testData.Friend.IconOrb) do
  6234. if v.button then
  6235. v.button = BattlegroundTargets.progNum
  6236. v.orbval = num
  6237. end
  6238. end
  6239. for k, v in pairs(testData.Enemy.IconOrb) do
  6240. if v.button then
  6241. v.button = BattlegroundTargets.progNum
  6242. v.orbval = num
  6243. end
  6244. end
  6245.  
  6246. local num = BattlegroundTargets.progNum * 10
  6247. for i = 1, 40 do
  6248. testData.Friend.Health[i] = num
  6249. testData.Enemy.Health[i] = num
  6250. testData.Friend.Range[i] = 100
  6251. testData.Enemy.Range[i] = 100
  6252. end
  6253. testData.Friend.Range[BattlegroundTargets.progNum] = 30
  6254. testData.Enemy.Range[BattlegroundTargets.progNum] = 30
  6255. end
  6256.  
  6257. local BattlegroundTargets_Options = BattlegroundTargets_Options
  6258.  
  6259. if BattlegroundTargets_Options.Friend.EnableBracket[currentSize] then
  6260. BattlegroundTargets:SetConfigButtonValues("Friend")
  6261. end
  6262. if BattlegroundTargets_Options.Enemy.EnableBracket[currentSize] then
  6263. BattlegroundTargets:SetConfigButtonValues("Enemy")
  6264. end
  6265. end
  6266. -- ---------------------------------------------------------------------------------------------------------------------
  6267.  
  6268.  
  6269.  
  6270. -- ---------------------------------------------------------------------------------------------------------------------
  6271. function BattlegroundTargets:CopyAllSettings(sourceSize, sameSize)
  6272. local destinationSize = 10
  6273. if sourceSize == 10 then
  6274. destinationSize = 15
  6275. elseif sourceSize == 40 then
  6276. destinationSize = 40
  6277. end
  6278.  
  6279. local sourceFraction = fraction
  6280. local destinationFraction = fraction
  6281.  
  6282. if sameSize then
  6283. destinationSize = sourceSize
  6284. if sourceFraction == "Enemy" then
  6285. destinationFraction = "Friend"
  6286. fraction = "Friend"
  6287. else
  6288. destinationFraction = "Enemy"
  6289. fraction = "Enemy"
  6290. end
  6291. end
  6292.  
  6293. BattlegroundTargets_Options[destinationFraction].LayoutTH[destinationSize] = BattlegroundTargets_Options[sourceFraction].LayoutTH[sourceSize]
  6294. BattlegroundTargets_Options[destinationFraction].LayoutSpace[destinationSize] = BattlegroundTargets_Options[sourceFraction].LayoutSpace[sourceSize]
  6295.  
  6296. BattlegroundTargets_Options[destinationFraction].SummaryToggle[destinationSize] = BattlegroundTargets_Options[sourceFraction].SummaryToggle[sourceSize]
  6297. BattlegroundTargets_Options[destinationFraction].SummaryScale[destinationSize] = BattlegroundTargets_Options[sourceFraction].SummaryScale[sourceSize]
  6298. BattlegroundTargets_Options[destinationFraction].SummaryPos[destinationSize] = BattlegroundTargets_Options[sourceFraction].SummaryPos[sourceSize]
  6299.  
  6300. BattlegroundTargets_Options[destinationFraction].ButtonRoleToggle[destinationSize] = BattlegroundTargets_Options[sourceFraction].ButtonRoleToggle[sourceSize]
  6301. BattlegroundTargets_Options[destinationFraction].ButtonSpecToggle[destinationSize] = BattlegroundTargets_Options[sourceFraction].ButtonSpecToggle[sourceSize]
  6302. BattlegroundTargets_Options[destinationFraction].ButtonClassToggle[destinationSize] = BattlegroundTargets_Options[sourceFraction].ButtonClassToggle[sourceSize]
  6303. BattlegroundTargets_Options[destinationFraction].ButtonLeaderToggle[destinationSize] = BattlegroundTargets_Options[sourceFraction].ButtonLeaderToggle[sourceSize]
  6304. BattlegroundTargets_Options[destinationFraction].ButtonRealmToggle[destinationSize] = BattlegroundTargets_Options[sourceFraction].ButtonRealmToggle[sourceSize]
  6305. BattlegroundTargets_Options[destinationFraction].ButtonPvPTrinketToggle[destinationSize] = BattlegroundTargets_Options[sourceFraction].ButtonPvPTrinketToggle[sourceSize]
  6306. BattlegroundTargets_Options[destinationFraction].ButtonTargetToggle[destinationSize] = BattlegroundTargets_Options[sourceFraction].ButtonTargetToggle[sourceSize]
  6307. BattlegroundTargets_Options[destinationFraction].ButtonTargetScale[destinationSize] = BattlegroundTargets_Options[sourceFraction].ButtonTargetScale[sourceSize]
  6308. BattlegroundTargets_Options[destinationFraction].ButtonTargetPosition[destinationSize] = BattlegroundTargets_Options[sourceFraction].ButtonTargetPosition[sourceSize]
  6309. BattlegroundTargets_Options[destinationFraction].ButtonFTargetCountToggle[destinationSize] = BattlegroundTargets_Options[sourceFraction].ButtonFTargetCountToggle[sourceSize]
  6310. BattlegroundTargets_Options[destinationFraction].ButtonETargetCountToggle[destinationSize] = BattlegroundTargets_Options[sourceFraction].ButtonETargetCountToggle[sourceSize]
  6311. BattlegroundTargets_Options[destinationFraction].ButtonToTToggle[destinationSize] = BattlegroundTargets_Options[sourceFraction].ButtonToTToggle[sourceSize]
  6312. BattlegroundTargets_Options[destinationFraction].ButtonToTScale[destinationSize] = BattlegroundTargets_Options[sourceFraction].ButtonToTScale[sourceSize]
  6313. BattlegroundTargets_Options[destinationFraction].ButtonToTPosition[destinationSize] = BattlegroundTargets_Options[sourceFraction].ButtonToTPosition[sourceSize]
  6314. BattlegroundTargets_Options[destinationFraction].ButtonFocusToggle[destinationSize] = BattlegroundTargets_Options[sourceFraction].ButtonFocusToggle[sourceSize]
  6315. BattlegroundTargets_Options[destinationFraction].ButtonFocusScale[destinationSize] = BattlegroundTargets_Options[sourceFraction].ButtonFocusScale[sourceSize]
  6316. BattlegroundTargets_Options[destinationFraction].ButtonFocusPosition[destinationSize] = BattlegroundTargets_Options[sourceFraction].ButtonFocusPosition[sourceSize]
  6317. BattlegroundTargets_Options[destinationFraction].ButtonFlagToggle[destinationSize] = BattlegroundTargets_Options[sourceFraction].ButtonFlagToggle[sourceSize]
  6318. BattlegroundTargets_Options[destinationFraction].ButtonFlagScale[destinationSize] = BattlegroundTargets_Options[sourceFraction].ButtonFlagScale[sourceSize]
  6319. BattlegroundTargets_Options[destinationFraction].ButtonFlagPosition[destinationSize] = BattlegroundTargets_Options[sourceFraction].ButtonFlagPosition[sourceSize]
  6320. BattlegroundTargets_Options[destinationFraction].ButtonAssistToggle[destinationSize] = BattlegroundTargets_Options[sourceFraction].ButtonAssistToggle[sourceSize]
  6321. BattlegroundTargets_Options[destinationFraction].ButtonAssistScale[destinationSize] = BattlegroundTargets_Options[sourceFraction].ButtonAssistScale[sourceSize]
  6322. BattlegroundTargets_Options[destinationFraction].ButtonAssistPosition[destinationSize] = BattlegroundTargets_Options[sourceFraction].ButtonAssistPosition[sourceSize]
  6323. BattlegroundTargets_Options[destinationFraction].ButtonHealthBarToggle[destinationSize] = BattlegroundTargets_Options[sourceFraction].ButtonHealthBarToggle[sourceSize]
  6324. BattlegroundTargets_Options[destinationFraction].ButtonHealthTextToggle[destinationSize] = BattlegroundTargets_Options[sourceFraction].ButtonHealthTextToggle[sourceSize]
  6325. BattlegroundTargets_Options[destinationFraction].ButtonRangeToggle[destinationSize] = BattlegroundTargets_Options[sourceFraction].ButtonRangeToggle[sourceSize]
  6326. BattlegroundTargets_Options[destinationFraction].ButtonRangeDisplay[destinationSize] = BattlegroundTargets_Options[sourceFraction].ButtonRangeDisplay[sourceSize]
  6327. BattlegroundTargets_Options[destinationFraction].ButtonSortBy[destinationSize] = BattlegroundTargets_Options[sourceFraction].ButtonSortBy[sourceSize]
  6328. BattlegroundTargets_Options[destinationFraction].ButtonSortDetail[destinationSize] = BattlegroundTargets_Options[sourceFraction].ButtonSortDetail[sourceSize]
  6329. BattlegroundTargets_Options[destinationFraction].ButtonFontNameStyle[destinationSize] = BattlegroundTargets_Options[sourceFraction].ButtonFontNameStyle[sourceSize]
  6330. BattlegroundTargets_Options[destinationFraction].ButtonFontNameSize[destinationSize] = BattlegroundTargets_Options[sourceFraction].ButtonFontNameSize[sourceSize]
  6331. BattlegroundTargets_Options[destinationFraction].ButtonFontNumberStyle[destinationSize] = BattlegroundTargets_Options[sourceFraction].ButtonFontNumberStyle[sourceSize]
  6332. BattlegroundTargets_Options[destinationFraction].ButtonFontNumberSize[destinationSize] = BattlegroundTargets_Options[sourceFraction].ButtonFontNumberSize[sourceSize]
  6333. BattlegroundTargets_Options[destinationFraction].ButtonScale[destinationSize] = BattlegroundTargets_Options[sourceFraction].ButtonScale[sourceSize]
  6334. BattlegroundTargets_Options[destinationFraction].ButtonWidth[destinationSize] = BattlegroundTargets_Options[sourceFraction].ButtonWidth[sourceSize]
  6335. BattlegroundTargets_Options[destinationFraction].ButtonHeight[destinationSize] = BattlegroundTargets_Options[sourceFraction].ButtonHeight[sourceSize]
  6336.  
  6337. if fraction == "Friend" then
  6338. TEMPLATE.SetTabButton(GVAR.OptionsFrame.EnableFriendBracket, true)
  6339. TEMPLATE.SetTabButton(GVAR.OptionsFrame.EnableEnemyBracket, nil)
  6340. else
  6341. TEMPLATE.SetTabButton(GVAR.OptionsFrame.EnableFriendBracket, nil)
  6342. TEMPLATE.SetTabButton(GVAR.OptionsFrame.EnableEnemyBracket, true)
  6343. end
  6344.  
  6345. BattlegroundTargets:ClickOnBracketTab(destinationSize, destinationFraction, "force")
  6346. end
  6347. -- ---------------------------------------------------------------------------------------------------------------------
  6348.  
  6349.  
  6350.  
  6351. -- ---------------------------------------------------------------------------------------------------------------------
  6352. local function sortfunc13(a, b) -- role / class / name | 13
  6353. if a.talentSpec == b.talentSpec then
  6354. if class_BlizzSort[ a.classToken ] == class_BlizzSort[ b.classToken ] then
  6355. if a.name < b.name then return true end
  6356. elseif class_BlizzSort[ a.classToken ] < class_BlizzSort[ b.classToken ] then return true end
  6357. elseif a.talentSpec < b.talentSpec then return true end
  6358. end
  6359. local function sortfunc11(a, b) -- role / class / name | 11
  6360. if a.talentSpec == b.talentSpec then
  6361. if class_LocaSort[ a.classToken ] == class_LocaSort[ b.classToken ] then
  6362. if a.name < b.name then return true end
  6363. elseif class_LocaSort[ a.classToken ] < class_LocaSort[ b.classToken ] then return true end
  6364. elseif a.talentSpec < b.talentSpec then return true end
  6365. end
  6366. local function sortfunc12(a, b) -- role / class / name | 12
  6367. if a.talentSpec == b.talentSpec then
  6368. if a.classToken == b.classToken then
  6369. if a.name < b.name then return true end
  6370. elseif a.classToken < b.classToken then return true end
  6371. elseif a.talentSpec < b.talentSpec then return true end
  6372. end
  6373. local function sortfunc2(a, b) -- role / name | 2
  6374. if a.talentSpec == b.talentSpec then
  6375. if a.name < b.name then return true end
  6376. elseif a.talentSpec < b.talentSpec then return true end
  6377. end
  6378. local function sortfunc33(a, b) -- class / role / name | 33
  6379. if class_BlizzSort[ a.classToken ] == class_BlizzSort[ b.classToken ] then
  6380. if a.talentSpec == b.talentSpec then
  6381. if a.name < b.name then return true end
  6382. elseif a.talentSpec < b.talentSpec then return true end
  6383. elseif class_BlizzSort[ a.classToken ] < class_BlizzSort[ b.classToken ] then return true end
  6384. end
  6385. local function sortfunc31(a, b) -- class / role / name | 31
  6386. if class_LocaSort[ a.classToken ] == class_LocaSort[ b.classToken ] then
  6387. if a.talentSpec == b.talentSpec then
  6388. if a.name < b.name then return true end
  6389. elseif a.talentSpec < b.talentSpec then return true end
  6390. elseif class_LocaSort[ a.classToken ] < class_LocaSort[ b.classToken ] then return true end
  6391. end
  6392. local function sortfunc32(a, b) -- class / role / name | 32
  6393. if a.classToken == b.classToken then
  6394. if a.talentSpec == b.talentSpec then
  6395. if a.name < b.name then return true end
  6396. elseif a.talentSpec < b.talentSpec then return true end
  6397. elseif a.classToken < b.classToken then return true end
  6398. end
  6399. local function sortfunc43(a, b) -- class / name | 43
  6400. if class_BlizzSort[ a.classToken ] == class_BlizzSort[ b.classToken ] then
  6401. if a.name < b.name then return true end
  6402. elseif class_BlizzSort[ a.classToken ] < class_BlizzSort[ b.classToken ] then return true end
  6403. end
  6404. local function sortfunc41(a, b) -- class / name | 41
  6405. if class_LocaSort[ a.classToken ] == class_LocaSort[ b.classToken ] then
  6406. if a.name < b.name then return true end
  6407. elseif class_LocaSort[ a.classToken ] < class_LocaSort[ b.classToken ] then return true end
  6408. end
  6409. local function sortfunc42(a, b) -- class / name | 42
  6410. if a.classToken == b.classToken then
  6411. if a.name < b.name then return true end
  6412. elseif a.classToken < b.classToken then return true end
  6413. end
  6414. local function sortfunc5(a, b) -- name | 5
  6415. if a.name < b.name then return true end
  6416. end
  6417.  
  6418. function BattlegroundTargets:MainDataUpdate(side)
  6419. local BattlegroundTargets_Options = BattlegroundTargets_Options
  6420.  
  6421. if not BattlegroundTargets_Options[side].EnableBracket[currentSize] then
  6422. wipe(DATA[side].Name2Button)
  6423. for i = 1, currentSize do
  6424. if DATA[side].MainData[i] then
  6425. DATA[side].Name2Button[ DATA[side].MainData[i].name ] = i
  6426. end
  6427. end
  6428. return
  6429. end
  6430.  
  6431. local ButtonSortBy = BattlegroundTargets_Options[side].ButtonSortBy[currentSize]
  6432. local ButtonSortDetail = BattlegroundTargets_Options[side].ButtonSortDetail[currentSize]
  6433. local ButtonSpecToggle = BattlegroundTargets_Options[side].ButtonSpecToggle[currentSize]
  6434. local ButtonClassToggle = BattlegroundTargets_Options[side].ButtonClassToggle[currentSize]
  6435. local ButtonLeaderToggle = BattlegroundTargets_Options[side].ButtonLeaderToggle[currentSize]
  6436. local ButtonRealmToggle = BattlegroundTargets_Options[side].ButtonRealmToggle[currentSize]
  6437. local ButtonFTargetCountToggle = BattlegroundTargets_Options[side].ButtonFTargetCountToggle[currentSize]
  6438. local ButtonETargetCountToggle = BattlegroundTargets_Options[side].ButtonETargetCountToggle[currentSize]
  6439. local ButtonPvPTrinketToggle = BattlegroundTargets_Options[side].ButtonPvPTrinketToggle[currentSize]
  6440. local ButtonToTToggle = BattlegroundTargets_Options[side].ButtonToTToggle[currentSize]
  6441. local ButtonHealthBarToggle = BattlegroundTargets_Options[side].ButtonHealthBarToggle[currentSize]
  6442. local ButtonHealthTextToggle = BattlegroundTargets_Options[side].ButtonHealthTextToggle[currentSize]
  6443. local ButtonTargetToggle = BattlegroundTargets_Options[side].ButtonTargetToggle[currentSize]
  6444. local ButtonFocusToggle = BattlegroundTargets_Options[side].ButtonFocusToggle[currentSize]
  6445. local ButtonFlagToggle = BattlegroundTargets_Options[side].ButtonFlagToggle[currentSize]
  6446. local ButtonAssistToggle = BattlegroundTargets_Options[side].ButtonAssistToggle[currentSize]
  6447. local ButtonRangeToggle = BattlegroundTargets_Options[side].ButtonRangeToggle[currentSize]
  6448. local SummaryToggle = BattlegroundTargets_Options[side].SummaryToggle[currentSize]
  6449. local TransliterationToggle = BattlegroundTargets_Options.TransliterationToggle
  6450.  
  6451. if ButtonSortBy == 1 then
  6452. if ButtonSortDetail == 3 then
  6453. table_sort(DATA[side].MainData, sortfunc13) -- role / class / name | 13
  6454. elseif ButtonSortDetail == 1 then
  6455. table_sort(DATA[side].MainData, sortfunc11) -- role / class / name | 11
  6456. else
  6457. table_sort(DATA[side].MainData, sortfunc12) -- role / class / name | 12
  6458. end
  6459. elseif ButtonSortBy == 2 then
  6460. table_sort(DATA[side].MainData, sortfunc2) -- role / name | 2
  6461. elseif ButtonSortBy == 3 then
  6462. if ButtonSortDetail == 3 then
  6463. table_sort(DATA[side].MainData, sortfunc33) -- class / role / name | 33
  6464. elseif ButtonSortDetail == 1 then
  6465. table_sort(DATA[side].MainData, sortfunc31) -- class / role / name | 31
  6466. else
  6467. table_sort(DATA[side].MainData, sortfunc32) -- class / role / name | 32
  6468. end
  6469. elseif ButtonSortBy == 4 then
  6470. if ButtonSortDetail == 3 then
  6471. table_sort(DATA[side].MainData, sortfunc43) -- class / name | 43
  6472. elseif ButtonSortDetail == 1 then
  6473. table_sort(DATA[side].MainData, sortfunc41) -- class / name | 41
  6474. else
  6475. table_sort(DATA[side].MainData, sortfunc42) -- class / name | 42
  6476. end
  6477. else
  6478. table_sort(DATA[side].MainData, sortfunc5) -- name | 5
  6479. end
  6480.  
  6481. local curTime = GetTime()
  6482. wipe(DATA[side].Name2Button)
  6483. wipe(DATA[side].Name4Flag)
  6484. local bname = GVAR[side.."Button"]
  6485. for i = 1, currentSize do
  6486. if DATA[side].MainData[i] then
  6487. local button = bname[i]
  6488.  
  6489. local qname = DATA[side].MainData[i].name
  6490. local qclassToken = DATA[side].MainData[i].classToken
  6491. local qspecIcon = DATA[side].MainData[i].specIcon
  6492. local qtalentSpec = DATA[side].MainData[i].talentSpec
  6493.  
  6494. DATA[side].Name2Button[qname] = i
  6495. button.buttonNum = i
  6496.  
  6497. local colR = classcolors[qclassToken].r
  6498. local colG = classcolors[qclassToken].g
  6499. local colB = classcolors[qclassToken].b
  6500. button.colR = colR
  6501. button.colG = colG
  6502. button.colB = colB
  6503. button.colR5 = colR*0.5
  6504. button.colG5 = colG*0.5
  6505. button.colB5 = colB*0.5
  6506. button.ClassColorBackground:SetColorTexture(button.colR5, button.colG5, button.colB5, 1)
  6507. button.HealthBar:SetColorTexture(colR, colG, colB, 1)
  6508.  
  6509. button.RoleTexture:SetTexCoord(Textures.RoleIcon[qtalentSpec][1], Textures.RoleIcon[qtalentSpec][2], Textures.RoleIcon[qtalentSpec][3], Textures.RoleIcon[qtalentSpec][4])
  6510.  
  6511. local onlyname, realmname = qname
  6512. if ButtonFlagToggle or not ButtonRealmToggle or TransliterationToggle then
  6513. if strfind(qname, "-", 1, true) then
  6514. onlyname, realmname = strmatch(qname, "(.-)%-(.*)$")
  6515. end
  6516. DATA[side].Name4Flag[onlyname] = i
  6517. end
  6518.  
  6519. if not ButtonRealmToggle then
  6520. if TransliterationToggle then
  6521. if not DATA.TransName[onlyname] then
  6522. DATA.TransName[onlyname] = utf8replace(onlyname, TSL)
  6523. end
  6524. button.name4button = DATA.TransName[onlyname]
  6525. else
  6526. button.name4button = onlyname
  6527. end
  6528. if isLowLevel and DATA[side].Name2Level[qname] then
  6529. button.Name:SetText(DATA[side].Name2Level[qname].." "..button.name4button)
  6530. else
  6531. button.Name:SetText(button.name4button)
  6532. end
  6533. else
  6534. if TransliterationToggle then
  6535. if not DATA.TransName[onlyname] then
  6536. DATA.TransName[onlyname] = utf8replace(onlyname, TSL)
  6537. end
  6538. if realmname then
  6539. button.name4button = DATA.TransName[onlyname] .. "-" .. realmname
  6540. else
  6541. button.name4button = DATA.TransName[onlyname]
  6542. end
  6543. else
  6544. button.name4button = qname
  6545. end
  6546. if isLowLevel and DATA[side].Name2Level[qname] then
  6547. button.Name:SetText(DATA[side].Name2Level[qname].." "..button.name4button)
  6548. else
  6549. button.Name:SetText(button.name4button)
  6550. end
  6551. end
  6552.  
  6553. if not inCombat then
  6554. button:SetAttribute("macrotext1", "/targetexact "..qname)
  6555. button:SetAttribute("macrotext2", "/targetexact "..qname.."\n/focus\n/targetlasttarget")
  6556. end
  6557.  
  6558. if ButtonFocusToggle then
  6559. if qname == playerFocusName then
  6560. button.FocusTexture:SetAlpha(1)
  6561. if not inCombat then
  6562. button:SetAttribute("macrotext2", "/targetexact "..playerFocusName.."\n/clearfocus\n/targetlasttarget")
  6563. end
  6564. else
  6565. button.FocusTexture:SetAlpha(0)
  6566. end
  6567. end
  6568.  
  6569. if ButtonRangeToggle then
  6570. button.RangeTexture:SetColorTexture(colR, colG, colB, 1)
  6571. end
  6572.  
  6573. if ButtonSpecToggle then
  6574. button.SpecTexture:SetTexture(qspecIcon)
  6575. end
  6576.  
  6577. if ButtonClassToggle then
  6578. button.ClassTexture:SetTexCoord(classes[qclassToken].coords[1], classes[qclassToken].coords[2], classes[qclassToken].coords[3], classes[qclassToken].coords[4])
  6579. end
  6580.  
  6581. if ButtonFTargetCountToggle then
  6582. button.FTargetCount:SetText(DATA.TargetFCountNum[qname] or "0")
  6583. end
  6584. if ButtonETargetCountToggle then
  6585. button.ETargetCount:SetText(DATA.TargetECountNum[qname] or "0")
  6586. end
  6587.  
  6588. local percentE = DATA[side].Name2Percent[qname]
  6589. if percentE then
  6590. if ButtonHealthBarToggle then
  6591. local width = DATA[side].healthBarWidth * (percentE / 100)
  6592. width = math_max(0.01, width)
  6593. width = math_min(DATA[side].healthBarWidth, width)
  6594. button.HealthBar:SetWidth(width)
  6595. end
  6596. if ButtonHealthTextToggle then
  6597. button.HealthText:SetText(percentE)
  6598. end
  6599. end
  6600.  
  6601. if ButtonTargetToggle then
  6602. if qname == playerTargetName then
  6603. button.HighlightT:SetColorTexture(0.5, 0.5, 0.5, 1)
  6604. button.HighlightR:SetColorTexture(0.5, 0.5, 0.5, 1)
  6605. button.HighlightB:SetColorTexture(0.5, 0.5, 0.5, 1)
  6606. button.HighlightL:SetColorTexture(0.5, 0.5, 0.5, 1)
  6607. button.TargetTexture:SetAlpha(1)
  6608. else
  6609. button.HighlightT:SetColorTexture(0, 0, 0, 1)
  6610. button.HighlightR:SetColorTexture(0, 0, 0, 1)
  6611. button.HighlightB:SetColorTexture(0, 0, 0, 1)
  6612. button.HighlightL:SetColorTexture(0, 0, 0, 1)
  6613. button.TargetTexture:SetAlpha(0)
  6614. end
  6615. end
  6616.  
  6617. if ButtonFlagToggle then
  6618. if qname == DATA[side].hasFlag then
  6619. button.FlagTexture:SetAlpha(1)
  6620. BattlegroundTargets:SetFlagDebuff(button, flagDebuff)
  6621. elseif qname == hasOrb.Blue.name then
  6622. button.FlagTexture:SetAlpha(1)
  6623. button.FlagTexture:SetTexture("Interface\\MiniMap\\TempleofKotmogu_ball_cyan")
  6624. BattlegroundTargets:SetFlagDebuff(button, hasOrb.Blue.orbval)
  6625. button.OrbCornerTL:SetAlpha(0.15)
  6626. button.OrbCornerTR:SetAlpha(0.15)
  6627. button.OrbCornerBL:SetAlpha(0.15)
  6628. button.OrbCornerBR:SetAlpha(1)
  6629. elseif qname == hasOrb.Purple.name then
  6630. button.FlagTexture:SetAlpha(1)
  6631. button.FlagTexture:SetTexture("Interface\\MiniMap\\TempleofKotmogu_ball_purple")
  6632. BattlegroundTargets:SetFlagDebuff(button, hasOrb.Purple.orbval)
  6633. button.OrbCornerTL:SetAlpha(1)
  6634. button.OrbCornerTR:SetAlpha(0.15)
  6635. button.OrbCornerBL:SetAlpha(0.15)
  6636. button.OrbCornerBR:SetAlpha(0.15)
  6637. elseif qname == hasOrb.Green.name then
  6638. button.FlagTexture:SetAlpha(1)
  6639. button.FlagTexture:SetTexture("Interface\\MiniMap\\TempleofKotmogu_ball_green")
  6640. BattlegroundTargets:SetFlagDebuff(button, hasOrb.Green.orbval)
  6641. button.OrbCornerTL:SetAlpha(0.15)
  6642. button.OrbCornerTR:SetAlpha(0.15)
  6643. button.OrbCornerBL:SetAlpha(1)
  6644. button.OrbCornerBR:SetAlpha(0.15)
  6645. elseif qname == hasOrb.Orange.name then
  6646. button.FlagTexture:SetAlpha(1)
  6647. button.FlagTexture:SetTexture("Interface\\MiniMap\\TempleofKotmogu_ball_orange")
  6648. BattlegroundTargets:SetFlagDebuff(button, hasOrb.Orange.orbval)
  6649. button.OrbCornerTL:SetAlpha(0.15)
  6650. button.OrbCornerTR:SetAlpha(1)
  6651. button.OrbCornerBL:SetAlpha(0.15)
  6652. button.OrbCornerBR:SetAlpha(0.15)
  6653. else
  6654. button.FlagTexture:SetAlpha(0)
  6655. button.FlagDebuff:SetText("")
  6656. button.OrbCornerTL:SetAlpha(0)
  6657. button.OrbCornerTR:SetAlpha(0)
  6658. button.OrbCornerBL:SetAlpha(0)
  6659. button.OrbCornerBR:SetAlpha(0)
  6660. end
  6661. end
  6662.  
  6663. if ButtonAssistToggle then
  6664. if qname == playerAssistTargetName then
  6665. button.AssistTargetTexture:SetAlpha(1)
  6666. else
  6667. button.AssistTargetTexture:SetAlpha(0)
  6668. end
  6669. if qname == isAssistName then
  6670. button.AssistSourceTexture:SetAlpha(1)
  6671. else
  6672. button.AssistSourceTexture:SetAlpha(0)
  6673. end
  6674. end
  6675.  
  6676. if ButtonLeaderToggle then -- leader_
  6677. if qname == DATA[side].isLeader then
  6678. button.LeaderTexture:SetAlpha(1)
  6679. else
  6680. button.LeaderTexture:SetAlpha(0)
  6681. end
  6682. end
  6683.  
  6684. if ButtonPvPTrinketToggle then -- pvp_trinket_
  6685. BattlegroundTargets:UpdatePvPTrinket(button, qname, curTime)
  6686. end
  6687.  
  6688. if ButtonToTToggle then -- target_of_target
  6689. if button.ToTButton.totData then
  6690. BattlegroundTargets:UpdateToTButton(button)
  6691. button.ToTButton:SetAlpha(1)
  6692. else
  6693. button.ToTButton:SetAlpha(0)
  6694. end
  6695. end
  6696.  
  6697. else
  6698. local button = GVAR[side.."Button"][i]
  6699. BattlegroundTargets:ClearConfigButtonValues(side, button, false)
  6700. if not inCombat then
  6701. button:SetAttribute("macrotext1", "")
  6702. button:SetAttribute("macrotext2", "")
  6703. end
  6704. end
  6705. end
  6706.  
  6707. if isConfig then
  6708. if SummaryToggle then --TODO summary option split results
  6709. for frc = 1, #FRAMES do
  6710. local fside = FRAMES[frc]
  6711. DATA[fside].Roles = {0,0,0,0}
  6712. for i = 1, currentSize do
  6713. if DATA[fside].MainData[i] then
  6714. local role = DATA[fside].MainData[i].talentSpec
  6715. DATA[fside].Roles[role] = DATA[fside].Roles[role] + 1
  6716. end
  6717. end
  6718. local Summary = GVAR[fside.."Summary"]
  6719. Summary.HealerFriend:SetText(DATA.Friend.Roles[1]) -- HEALER FRIEND
  6720. Summary.TankFriend:SetText(DATA.Friend.Roles[2]) -- TANK FRIEND
  6721. Summary.DamageFriend:SetText(DATA.Friend.Roles[3]) -- DAMAGER FRIEND
  6722. Summary.HealerEnemy:SetText(DATA.Enemy.Roles[1]) -- HEALER ENEMY
  6723. Summary.TankEnemy:SetText(DATA.Enemy.Roles[2]) -- TANK ENEMY
  6724. Summary.DamageEnemy:SetText(DATA.Enemy.Roles[3]) -- DAMAGER ENEMY
  6725. end
  6726. end
  6727. if isLowLevel then -- LVLCHK
  6728. local button = GVAR[side.."Button"]
  6729. for i = 1, currentSize do
  6730. button[i].Name:SetText(playerLevel.." "..button[i].name4button)
  6731. end
  6732. end
  6733. return
  6734. end
  6735.  
  6736. if ButtonRangeToggle then
  6737. BattlegroundTargets:UpdateRange(side, curTime)
  6738. end
  6739.  
  6740. -- SUMMARY
  6741. if SummaryToggle then --TODO summary option split results
  6742. local Summary = GVAR[side.."Summary"]
  6743. Summary.HealerFriend:SetText(DATA.Friend.Roles[1]) -- HEALER FRIEND
  6744. Summary.TankFriend:SetText(DATA.Friend.Roles[2]) -- TANK FRIEND
  6745. Summary.DamageFriend:SetText(DATA.Friend.Roles[3]) -- DAMAGER FRIEND
  6746. Summary.HealerEnemy:SetText(DATA.Enemy.Roles[1]) -- HEALER ENEMY
  6747. Summary.TankEnemy:SetText(DATA.Enemy.Roles[2]) -- TANK ENEMY
  6748. Summary.DamageEnemy:SetText(DATA.Enemy.Roles[3]) -- DAMAGER ENEMY
  6749. end
  6750. end
  6751. -- ---------------------------------------------------------------------------------------------------------------------
  6752.  
  6753. -- ---------------------------------------------------------------------------------------------------------------------
  6754. function BattlegroundTargets:BattlefieldScoreUpdate()
  6755. local curTime = GetTime()
  6756. local diff = curTime - scoreLastUpdate
  6757. if diff < scoreFrequency then return end
  6758. if scoreCount > 60 then
  6759. scoreFrequency = 5
  6760. elseif scoreCount > 30 then
  6761. scoreFrequency = 2
  6762. scoreCount = scoreCount + 1
  6763. else
  6764. scoreCount = scoreCount + 1
  6765. end
  6766.  
  6767. if inCombat or InCombatLockdown() then
  6768. if reCheckBG or diff >= scoreWarning then
  6769. GVAR.FriendScoreUpdateTexture:Show()
  6770. GVAR.EnemyScoreUpdateTexture:Show()
  6771. else
  6772. GVAR.FriendScoreUpdateTexture:Hide()
  6773. GVAR.EnemyScoreUpdateTexture:Hide()
  6774. end
  6775. reCheckScore = true
  6776. return
  6777. end
  6778.  
  6779. local wssf = WorldStateScoreFrame
  6780. if wssf and wssf:IsShown() and wssf.selectedTab and wssf.selectedTab > 1 then
  6781. return
  6782. end
  6783.  
  6784. reCheckScore = nil
  6785. scoreLastUpdate = curTime
  6786.  
  6787. GVAR.FriendScoreUpdateTexture:Hide()
  6788. GVAR.EnemyScoreUpdateTexture:Hide()
  6789.  
  6790. wipe(DATA.Friend.MainData)
  6791. wipe(DATA.Enemy.MainData)
  6792. DATA.Friend.Roles = {0,0,0,0} -- SUMMARY
  6793. DATA.Enemy.Roles = {0,0,0,0} -- SUMMARY
  6794.  
  6795. local numScore = GetNumBattlefieldScores()
  6796.  
  6797. if not oppositeFactionREAL then
  6798. for index = 1, numScore do
  6799. local _, _, _, _, _, faction, race = GetBattlefieldScore(index)
  6800. if faction == oppositeFactionBG then
  6801. local n = RNA[race]
  6802. if n == 0 then -- summary_flag_texture - 2 - set in bg
  6803. GVAR.FriendSummary.Logo2:SetTexture("Interface\\FriendsFrame\\PlusManz-Horde")
  6804. GVAR.EnemySummary.Logo2:SetTexture("Interface\\FriendsFrame\\PlusManz-Horde")
  6805. oppositeFactionREAL = 0
  6806. break
  6807. elseif n == 1 then
  6808. GVAR.FriendSummary.Logo2:SetTexture("Interface\\FriendsFrame\\PlusManz-Alliance")
  6809. GVAR.EnemySummary.Logo2:SetTexture("Interface\\FriendsFrame\\PlusManz-Alliance")
  6810. oppositeFactionREAL = 1
  6811. break
  6812. end
  6813. end
  6814. end
  6815. end
  6816.  
  6817. --[[
  6818. for index = 1, numScore do
  6819. local _, _, _, _, _, faction, race, _, classToken = GetBattlefieldScore(index)
  6820. if race and faction and classToken then
  6821. if not BattlegroundTargets_Options.RNA then BattlegroundTargets_Options.RNA = {} end
  6822. if not BattlegroundTargets_Options.RNA[locale] then BattlegroundTargets_Options.RNA[locale] = {} end
  6823. BattlegroundTargets_Options.RNA[locale][race] = 1
  6824. end
  6825. end
  6826. --]]
  6827.  
  6828. for index = 1, numScore do
  6829. local name, _, _, _, _, faction, _, _, classToken, _, _, _, _, _, _, talentSpec = GetBattlefieldScore(index)
  6830. --print("INPUT_NAME_CHECK: _score_", index, name, faction, classToken, talentSpec, "#", GetBattlefieldScore(index))
  6831.  
  6832.  
  6833.  
  6834. --bad locale fix
  6835.  
  6836. if classes[classToken].fix then
  6837. if classes[classToken].fixname[talentSpec] ~= nill then
  6838. -- print ("fixed: ".. talentSpec .. " to ".. classes[classToken].fixname[talentSpec])
  6839. talentSpec = classes[classToken].fixname[talentSpec]
  6840. end
  6841. end
  6842.  
  6843. --rus
  6844. --if talentSpec == "Повелительница зверей" then talentSpec = "Повелитель зверей" end
  6845.  
  6846.  
  6847.  
  6848.  
  6849. if not name then
  6850. if not BattlegroundTargets.UnknownNameIndex then
  6851. BattlegroundTargets.UnknownNameIndex = 1
  6852. name = L["Unknown"]
  6853. else
  6854. BattlegroundTargets.UnknownNameIndex = BattlegroundTargets.UnknownNameIndex + 1
  6855. name = L["Unknown"]..BattlegroundTargets.UnknownNameIndex
  6856. end
  6857. end
  6858.  
  6859. if faction == oppositeFactionBG then
  6860.  
  6861. local specrole = 4
  6862. local specicon = nil
  6863. local class = "ZZZFAILURE"
  6864. if classToken then
  6865. local token = classes[classToken] -- BGSPEC
  6866. if token then
  6867. if talentSpec and token.spec then
  6868. for i = 1, #token.spec do
  6869. if talentSpec == token.spec[i].specName then
  6870. specrole = token.spec[i].role
  6871. specicon = token.spec[i].icon
  6872. break
  6873. end
  6874. end
  6875. end
  6876. class = classToken
  6877. end
  6878. end
  6879.  
  6880. if not specicon then
  6881. if not testData.specTest then testData.specTest = {} end
  6882. if not testData.specTest[class] then testData.specTest[class] = {} end
  6883. if not talentSpec then talentSpec = "talentSpec_is_unknown!" end
  6884. if not testData.specTest[class][talentSpec] then
  6885. testData.specTest[class][talentSpec] = {locale=locale, faction=faction, classToken=classToken, talentSpec=talentSpec, name=name}
  6886. Print("ERROR#1 unknown spec:", locale, faction, classToken, talentSpec)
  6887. end
  6888. end
  6889.  
  6890. DATA.Enemy.Roles[specrole] = DATA.Enemy.Roles[specrole] + 1 -- SUMMARY
  6891. tinsert(DATA.Enemy.MainData, {
  6892. name = name,
  6893. classToken = class,
  6894. specIcon = specicon,
  6895. talentSpec = specrole
  6896. })
  6897.  
  6898. elseif faction == playerFactionBG then
  6899.  
  6900. local specrole = 4
  6901. local specicon = nil
  6902. local class = "ZZZFAILURE"
  6903. if classToken then
  6904. local token = classes[classToken] -- BGSPEC
  6905. if token then
  6906. if talentSpec and token.spec then
  6907. for i = 1, #token.spec do
  6908. if talentSpec == token.spec[i].specName then
  6909. specrole = token.spec[i].role
  6910. specicon = token.spec[i].icon
  6911. break
  6912. end
  6913. end
  6914. end
  6915. class = classToken
  6916. end
  6917. end
  6918. --bad hotfix for ru locale
  6919.  
  6920.  
  6921. if not specicon then
  6922. if not testData.specTest then testData.specTest = {} end
  6923. if not testData.specTest[class] then testData.specTest[class] = {} end
  6924. if not talentSpec then talentSpec = "talentSpec_is_unknown" end
  6925. if not testData.specTest[class][talentSpec] then
  6926. testData.specTest[class][talentSpec] = {locale=locale, faction=faction, classToken=classToken, talentSpec=talentSpec}
  6927. --Print("ERROR#2 unknown spec:", locale, faction, classToken, talentSpec)
  6928. end
  6929. end
  6930.  
  6931. DATA.Friend.Roles[specrole] = DATA.Friend.Roles[specrole] + 1 -- SUMMARY
  6932. tinsert(DATA.Friend.MainData, {
  6933. name = name,
  6934. classToken = class,
  6935. specIcon = specicon,
  6936. talentSpec = specrole
  6937. })
  6938.  
  6939. end
  6940. end
  6941.  
  6942. if BattlegroundTargets.GroupUpdateTimer and curTime > BattlegroundTargets.GroupUpdateTimer + 2 then
  6943. --print("Group Update Timer:", curTime - BattlegroundTargets.GroupUpdateTimer)
  6944. BattlegroundTargets:GroupUnitIDUpdate()
  6945. end
  6946.  
  6947. if BattlegroundTargets.TrackFaction and DATA.Enemy.MainData[1] then -- BG_FACTION_CHK
  6948. for i = 1, #DATA.Enemy.MainData do
  6949. if DATA.Enemy.MainData[i].name == playerName then
  6950. BattlegroundTargets.ForceDefaultFaction = true
  6951. break
  6952. end
  6953. end
  6954. BattlegroundTargets.TrackFaction = nil
  6955. if BattlegroundTargets.ForceDefaultFaction then
  6956. BattlegroundTargets:BattlefieldCheck()
  6957. return
  6958. end
  6959. end
  6960.  
  6961. if DATA.Enemy.MainData[1] then
  6962. BattlegroundTargets:MainDataUpdate("Enemy")
  6963. end
  6964.  
  6965. if DATA.Friend.MainData[1] then
  6966. BattlegroundTargets:MainDataUpdate("Friend")
  6967. end
  6968.  
  6969. if not flagflag and isFlagBG > 0 then
  6970. if DATA.Enemy.MainData[1] or DATA.Friend.MainData[1] then
  6971. if BattlegroundTargets_Options.Friend.ButtonFlagToggle[currentSize] or BattlegroundTargets_Options.Enemy.ButtonFlagToggle[currentSize] then
  6972. flagflag = true
  6973. flagCHK = true
  6974. BattlegroundTargets:CheckFlagCarrierSTART()
  6975. end
  6976. end
  6977. end
  6978.  
  6979. if reSizeCheck >= 10 then return end
  6980. BattlegroundTargets:BattlefieldCheck()
  6981. end
  6982. -- ---------------------------------------------------------------------------------------------------------------------
  6983.  
  6984. -- ---------------------------------------------------------------------------------------------------------------------
  6985. function BattlegroundTargets:BattlefieldCheck()
  6986. if not inWorld then return end
  6987. local _, instanceType = IsInInstance()
  6988. if instanceType == "pvp" then
  6989. BattlegroundTargets:IsBattleground()
  6990. else
  6991. BattlegroundTargets:IsNotBattleground()
  6992. end
  6993. end
  6994. -- ---------------------------------------------------------------------------------------------------------------------
  6995.  
  6996. -- ---------------------------------------------------------------------------------------------------------------------
  6997. function BattlegroundTargets:IsBattleground()
  6998. local BattlegroundTargets_Options = BattlegroundTargets_Options
  6999.  
  7000. inBattleground = true
  7001.  
  7002. -- Battleground name BEGIN ----------
  7003. local bgName, zoneName, mapName
  7004.  
  7005. if not currentBGMap then
  7006. local queueStatus, queueMapName
  7007. for i = 1, GetMaxBattlefieldID() do
  7008. local queueStatus, queueMapName = GetBattlefieldStatus(i)
  7009. --print(i, queueStatus, queueMapName, "#", GetBattlefieldStatus(i))
  7010. if queueStatus == "active" then
  7011. bgName = queueMapName
  7012. break
  7013. end
  7014. end
  7015. if bgMaps[bgName] then
  7016. currentBGMap = bgName
  7017. --print("currentBGMap1", bgName)
  7018. end
  7019. end
  7020.  
  7021. if not currentBGMap then
  7022. zoneName = GetRealZoneText()
  7023. if bgMaps[zoneName] then
  7024. currentBGMap = zoneName
  7025. --print("currentBGMap2", zoneName)
  7026. end
  7027. end
  7028.  
  7029. if not currentBGMap then
  7030. local wmf = WorldMapFrame
  7031. if wmf and not wmf:IsShown() then
  7032. SetMapToCurrentZone()
  7033. local mapId = GetCurrentMapAreaID()
  7034. mapName = mapID[mapId]
  7035. if bgMaps[mapName] then
  7036. currentBGMap = mapName
  7037. --print("currentBGMap3", mapName)
  7038. end
  7039. end
  7040. end
  7041.  
  7042. --print("reSizeCheck:", reSizeCheck, "#", currentBGMap, "#", "bgName:", bgName, "zoneName:", zoneName, "mapName:", mapName)
  7043.  
  7044. if currentBGMap then
  7045. reSizeCheck = 10
  7046. currentSize = bgMaps[ currentBGMap ].bgSize
  7047. isFlagBG = bgMaps[ currentBGMap ].flagBG
  7048. else
  7049. if reSizeCheck == 10 then
  7050. Print("ERROR", "unknown battleground name", locale, currentBGMap, "#", "bgName:", bgName, "zoneName:", zoneName, "mapName:", mapName)
  7051. end
  7052. reSizeCheck = reSizeCheck + 1
  7053. currentSize = 10
  7054. isFlagBG = 0
  7055. end
  7056. -- Battleground name END ----------
  7057.  
  7058. if IsRatedBattleground() then
  7059. currentSize = 10
  7060. end
  7061.  
  7062. -- BG_FACTION_CHK
  7063. if BattlegroundTargets.ForceDefaultFaction then
  7064. if playerFactionDEF == 0 then
  7065. playerFactionBG = 0 -- Horde
  7066. oppositeFactionBG = 1 -- Alliance
  7067. else--if playerFactionDEF == 1 then
  7068. playerFactionBG = 1 -- Alliance
  7069. oppositeFactionBG = 0 -- Horde
  7070. end
  7071. oppositeFactionREAL = nil -- reset real faction
  7072. elseif not IsActiveBattlefieldArena() then
  7073. local faction = GetBattlefieldArenaFaction()
  7074. if faction == 0 then
  7075. playerFactionBG = 0 -- Horde
  7076. oppositeFactionBG = 1 -- Alliance
  7077. elseif faction == 1 then
  7078. playerFactionBG = 1 -- Alliance
  7079. oppositeFactionBG = 0 -- Horde
  7080. else
  7081. Print("ERROR", "unknown battleground faction", locale, faction)
  7082. end
  7083. if playerFactionDEF ~= playerFactionBG then
  7084. BattlegroundTargets.TrackFaction = true
  7085. end
  7086. end
  7087.  
  7088. if playerLevel >= maxLevel then -- LVLCHK
  7089. isLowLevel = nil
  7090. else
  7091. isLowLevel = true
  7092. end
  7093.  
  7094. if inCombat then
  7095. reCheckBG = true
  7096. else
  7097. reCheckBG = false
  7098.  
  7099. -- --------------------------------------------------------
  7100. for frc = 1, #FRAMES do
  7101. local side = FRAMES[frc]
  7102. local button = GVAR[side.."Button"]
  7103. -- ----------
  7104. if BattlegroundTargets_Options[side].EnableBracket[currentSize] then
  7105. BattlegroundTargets:Frame_SetupPosition("BattlegroundTargets_"..side.."MainFrame", side)
  7106. GVAR[side.."MainFrame"]:EnableMouse(false)
  7107. GVAR[side.."MainFrame"]:SetAlpha(0)
  7108. GVAR[side.."MainFrame"]:Show() -- POSiCHK
  7109. GVAR[side.."MainFrame"].MainMoverFrame:Hide()
  7110. GVAR[side.."MainFrame"].MainMoverButton:Hide()
  7111. GVAR[side.."ScoreUpdateTexture"]:Hide()
  7112. GVAR[side.."IsGhostTexture"]:Hide()
  7113. for i = 1, 40 do
  7114. if i < currentSize+1 then
  7115. BattlegroundTargets:ClearConfigButtonValues(side, button[i], true)
  7116. button[i]:Show()
  7117. else
  7118. button[i]:Hide()
  7119. end
  7120. end
  7121. BattlegroundTargets:SetupButtonLayout(side)
  7122. BattlegroundTargets:SetupButtonTextures(side) -- BG_Faction_Dependent
  7123. if BattlegroundTargets_Options[side].SummaryToggle[currentSize] then
  7124. local Summary = GVAR[side.."Summary"]
  7125. Summary.HealerFriend:SetText("0")
  7126. Summary.TankFriend:SetText("0")
  7127. Summary.DamageFriend:SetText("0")
  7128. Summary.HealerEnemy:SetText("0")
  7129. Summary.TankEnemy:SetText("0")
  7130. Summary.DamageEnemy:SetText("0")
  7131. end
  7132. else
  7133. GVAR[side.."MainFrame"]:Hide()
  7134. for i = 1, 40 do
  7135. button[i]:Hide()
  7136. end
  7137. end
  7138. -- ----------
  7139. end
  7140. -- --------------------------------------------------------
  7141.  
  7142. -- delete global_OnUpdate
  7143. for frc = 1, #FRAMES do
  7144. local side = FRAMES[frc]
  7145. GVAR[side.."MainFrame"]:SetScript("OnUpdate", nil)
  7146. GVAR[side.."ScreenShot_Timer_Button"]:SetScript("OnUpdate", nil)
  7147. GVAR[side.."Target_Timer_Button"]:SetScript("OnUpdate", nil)
  7148. GVAR[side.."PVPTrinket_Timer_Button"]:SetScript("OnUpdate", nil)
  7149. GVAR[side.."RangeCheck_Timer_Button"]:SetScript("OnUpdate", nil)
  7150. end
  7151.  
  7152. -- set global_OnUpdate BEGIN -----------------------------------
  7153. local side
  7154. if BattlegroundTargets_Options.Enemy.EnableBracket[currentSize] then
  7155. side = "Enemy"
  7156. elseif BattlegroundTargets_Options.Friend.EnableBracket[currentSize] then
  7157. side = "Friend"
  7158. end
  7159.  
  7160. -- battleground score BEGIN --
  7161. if side then -- singleside
  7162. BattlegroundTargets:BattlefieldScoreRequest()
  7163. local elapsed = 0
  7164. GVAR[side.."MainFrame"]:SetScript("OnUpdate", function(self, elap)
  7165. elapsed = elapsed + elap
  7166. if elapsed < scoreFrequency then return end
  7167. elapsed = 0
  7168. BattlegroundTargets:BattlefieldScoreRequest()
  7169. end)
  7170. end
  7171. -- battleground score END -----
  7172.  
  7173. --[[ -- screenshot_ BEGIN TEST --
  7174. if side then -- singleside
  7175. local elapsed = 0
  7176. GVAR[side.."ScreenShot_Timer_Button"]:SetScript("OnUpdate", function(self, elap)
  7177. elapsed = elapsed + elap
  7178. if elapsed > 5 then
  7179. if not inBattleground then return end
  7180. if isConfig then return end
  7181. --if inCombat then return end
  7182. elapsed = 0
  7183. Screenshot()
  7184. end
  7185. end)
  7186. end
  7187. --]] -- screenshot_ END --
  7188.  
  7189. -- targeet target_of_target BEGIN --
  7190. if side then -- singleside
  7191. if BattlegroundTargets_Options.Friend.ButtonTargetToggle[currentSize] or
  7192. BattlegroundTargets_Options.Enemy.ButtonTargetToggle[currentSize] or
  7193. BattlegroundTargets_Options.Friend.ButtonToTToggle[currentSize] or
  7194. BattlegroundTargets_Options.Enemy.ButtonToTToggle[currentSize]
  7195. then
  7196. local elapsed = 0
  7197. GVAR[side.."Target_Timer_Button"]:SetScript("OnUpdate", function(self, elap)
  7198. elapsed = elapsed + elap
  7199. if elapsed < targetFrequency then return end
  7200. elapsed = 0
  7201. BattlegroundTargets:CheckUnitTarget("target", playerTargetName)
  7202. end)
  7203. end
  7204. end
  7205. -- targeet target_of_target END --
  7206.  
  7207. -- pvp_trinket_ BEGIN --
  7208. if side then -- singleside
  7209. if BattlegroundTargets_Options.Friend.ButtonPvPTrinketToggle[currentSize] or
  7210. BattlegroundTargets_Options.Enemy.ButtonPvPTrinketToggle[currentSize]
  7211. then
  7212. local elapsed = 0
  7213. GVAR[side.."PVPTrinket_Timer_Button"]:SetScript("OnUpdate", function(self, elap)
  7214. elapsed = elapsed + elap
  7215. if elapsed < pvptrinketFrequency then return end
  7216. elapsed = 0
  7217. BattlegroundTargets:UpdateAllPvPTrinkets(true)
  7218. end)
  7219. end
  7220. end
  7221. -- pvp_trinket_ END --
  7222.  
  7223. -- class_range_ BEGIN --
  7224. local Friend_ButtonRangeToggle = BattlegroundTargets_Options.Friend.EnableBracket[currentSize] and BattlegroundTargets_Options.Friend.ButtonRangeToggle[currentSize]
  7225. local Enemy_ButtonRangeToggle = BattlegroundTargets_Options.Enemy.EnableBracket[currentSize] and BattlegroundTargets_Options.Enemy.ButtonRangeToggle[currentSize]
  7226.  
  7227. if Friend_ButtonRangeToggle and Enemy_ButtonRangeToggle then
  7228. local elapsed = 0
  7229. GVAR.EnemyRangeCheck_Timer_Button:SetScript("OnUpdate", function(self, elap)
  7230. elapsed = elapsed + elap
  7231. if elapsed > rangeFrequency then
  7232. elapsed = 0
  7233. for uName, uID in pairs(DATA.Friend.Name2UnitID) do
  7234. local button = GVAR.FriendButton[ DATA.Friend.Name2Button[ uName ] ]
  7235. if button then
  7236. BattlegroundTargets:CheckClassRange("Friend", button, uID, uName, "onupdate")
  7237. end
  7238. end
  7239. BattlegroundTargets:UpdateRange("Enemy", GetTime())
  7240. end
  7241. end)
  7242.  
  7243. elseif Friend_ButtonRangeToggle then
  7244.  
  7245. local elapsed = 0
  7246. GVAR.FriendRangeCheck_Timer_Button:SetScript("OnUpdate", function(self, elap)
  7247. elapsed = elapsed + elap
  7248. if elapsed > rangeFrequency then
  7249. elapsed = 0
  7250. for uName, uID in pairs(DATA.Friend.Name2UnitID) do
  7251. local button = GVAR.FriendButton[ DATA.Friend.Name2Button[ uName ] ]
  7252. if button then
  7253. BattlegroundTargets:CheckClassRange("Friend", button, uID, uName, "onupdate")
  7254. end
  7255. end
  7256. end
  7257. end)
  7258.  
  7259. elseif Enemy_ButtonRangeToggle then
  7260.  
  7261. local elapsed = 0
  7262. GVAR.EnemyRangeCheck_Timer_Button:SetScript("OnUpdate", function(self, elap)
  7263. elapsed = elapsed + elap
  7264. if elapsed > rangeFrequency then
  7265. elapsed = 0
  7266. BattlegroundTargets:UpdateRange("Enemy", GetTime())
  7267. end
  7268. end)
  7269.  
  7270. end
  7271. -- class_range_ END --
  7272. -- set global_OnUpdate END -----------------------------------
  7273. end
  7274.  
  7275. BattlegroundTargets:EventUnregister()
  7276. BattlegroundTargets:EventRegister("showerror")
  7277. end
  7278. -- ---------------------------------------------------------------------------------------------------------------------
  7279.  
  7280. -- ---------------------------------------------------------------------------------------------------------------------
  7281. function BattlegroundTargets:IsNotBattleground()
  7282. if not inBattleground and not reCheckBG then return end
  7283.  
  7284. --for k, v in pairs(eventTest) do print("eventtest:", k, v) end -- TEST
  7285. --[[
  7286. for k, v in pairs(SPELL_Range) do
  7287. print("spellrange:", k, v, "#", SpellHasRange(k), "#", GetSpellInfo(k))
  7288. end
  7289. --]]
  7290.  
  7291. inBattleground = false
  7292.  
  7293. reCheckBG = nil
  7294. reCheckScore = nil
  7295.  
  7296. currentBGMap = nil
  7297. reSizeCheck = 0
  7298.  
  7299. oppositeFactionREAL = nil
  7300.  
  7301. flagDebuff = 0 -- FLGRST
  7302. flags = 0
  7303. isFlagBG = 0
  7304. flagCHK = nil
  7305. flagflag = nil
  7306.  
  7307. DATA.Friend.isLeader = nil
  7308. DATA.Friend.hasFlag = nil
  7309. DATA.Enemy.isLeader = nil
  7310. DATA.Enemy.hasFlag = nil
  7311. hasOrb = {Green={name=nil,orbval=nil},Blue={name=nil,orbval=nil},Purple={name=nil,orbval=nil},Orange={name=nil,orbval=nil}}
  7312.  
  7313. scoreFrequency = 1
  7314. scoreCount = 0
  7315.  
  7316. BattlegroundTargets.ForceDefaultFaction = nil
  7317. BattlegroundTargets.TrackFaction = nil
  7318. BattlegroundTargets.UnknownNameIndex = nil
  7319.  
  7320. if isLowLevel then -- LVLCHK
  7321. BattlegroundTargets:CheckPlayerLevel()
  7322. end
  7323. BattlegroundTargets:EventUnregister()
  7324.  
  7325. wipe(DATA.TargetCountNames) -- TC_DEFDEL
  7326. wipe(DATA.TargetCountTargetID) -- TC_DEFDEL
  7327. wipe(DATA.TargetFCountNum) -- TC_FRIEND_DEF
  7328. wipe(DATA.TargetECountNum) -- TC_ENEMY_DEF
  7329. wipe(DATA.TransName)
  7330. wipe(DATA.FirstFlagCheck)
  7331. wipe(DATA.PvPTrinketEndTime)
  7332.  
  7333. for frc = 1, #FRAMES do
  7334. local side = FRAMES[frc]
  7335. if not isConfig then
  7336. wipe(DATA[side].MainData)
  7337. end
  7338. wipe(DATA[side].Name4Flag)
  7339. wipe(DATA[side].Name2Button)
  7340. wipe(DATA[side].Name2Level)
  7341. wipe(DATA[side].Name2Percent)
  7342. wipe(DATA[side].Name2Range)
  7343. end
  7344.  
  7345. if testData.specTest then
  7346. ---debug( wait for next update
  7347. --for k, v in pairs(testData.specTest) do
  7348. -- for k2, v2 in pairs(v) do
  7349. --Print("ERROR#3 unknown spec:", v2.locale, v2.faction, v2.classToken, v2.talentSpec)
  7350. --end
  7351.  
  7352. --end
  7353. testData.specTest = nil
  7354. end
  7355.  
  7356. if inCombat or InCombatLockdown() then
  7357. reCheckBG = true
  7358. else
  7359. reCheckBG = false
  7360.  
  7361. if playerFactionDEF == 0 then -- summary_flag_texture - 2 - reset
  7362. GVAR.FriendSummary.Logo2:SetTexture("Interface\\FriendsFrame\\PlusManz-Alliance")
  7363. GVAR.EnemySummary.Logo2:SetTexture("Interface\\FriendsFrame\\PlusManz-Alliance")
  7364. elseif playerFactionDEF == 1 then
  7365. GVAR.FriendSummary.Logo2:SetTexture("Interface\\FriendsFrame\\PlusManz-Horde")
  7366. GVAR.EnemySummary.Logo2:SetTexture("Interface\\FriendsFrame\\PlusManz-Horde")
  7367. else
  7368. GVAR.FriendSummary.Logo2:SetTexture("Interface\\Timer\\Panda-Logo")
  7369. GVAR.EnemySummary.Logo2:SetTexture("Interface\\Timer\\Panda-Logo")
  7370. end
  7371.  
  7372. -- delete global_OnUpdate
  7373. for frc = 1, #FRAMES do
  7374. local side = FRAMES[frc]
  7375. GVAR[side.."MainFrame"]:SetScript("OnUpdate", nil)
  7376. GVAR[side.."ScreenShot_Timer_Button"]:SetScript("OnUpdate", nil)
  7377. GVAR[side.."Target_Timer_Button"]:SetScript("OnUpdate", nil)
  7378. GVAR[side.."PVPTrinket_Timer_Button"]:SetScript("OnUpdate", nil)
  7379. GVAR[side.."RangeCheck_Timer_Button"]:SetScript("OnUpdate", nil)
  7380. end
  7381.  
  7382. GVAR.FriendMainFrame:Hide()
  7383. GVAR.EnemyMainFrame:Hide()
  7384. for i = 1, 40 do
  7385. GVAR.FriendButton[i].FocusTextureButton:SetScript("OnUpdate", nil) -- TODO
  7386. GVAR.FriendButton[i]:Hide()
  7387. GVAR.EnemyButton[i].FocusTextureButton:SetScript("OnUpdate", nil) -- TODO
  7388. GVAR.EnemyButton[i]:Hide()
  7389. end
  7390. end
  7391. end
  7392. -- ---------------------------------------------------------------------------------------------------------------------
  7393.  
  7394.  
  7395.  
  7396. -- ---------------------------------------------------------------------------------------------------------------------
  7397. function BattlegroundTargets:GroupRosterUpdate()
  7398. local BattlegroundTargets_Options = BattlegroundTargets_Options
  7399.  
  7400. BattlegroundTargets:GroupUnitIDUpdate()
  7401.  
  7402. scoreFrequency = 0 -- immediate update
  7403. BattlegroundTargets:BattlefieldScoreRequest()
  7404.  
  7405. -- assist_
  7406. if (BattlegroundTargets_Options.Friend.EnableBracket[currentSize] and BattlegroundTargets_Options.Friend.ButtonAssistToggle[currentSize]) or
  7407. (BattlegroundTargets_Options.Enemy.EnableBracket[currentSize] and BattlegroundTargets_Options.Enemy.ButtonAssistToggle[currentSize])
  7408. then
  7409. BattlegroundTargets:CheckAssist()
  7410. end
  7411.  
  7412. -- leader_
  7413. if BattlegroundTargets_Options.Friend.EnableBracket[currentSize] and
  7414. BattlegroundTargets_Options.Friend.ButtonLeaderToggle[currentSize]
  7415. then
  7416. BattlegroundTargets:FriendLeaderUpdate()
  7417. end
  7418. end
  7419. -- ---------------------------------------------------------------------------------------------------------------------
  7420.  
  7421.  
  7422.  
  7423. -- ---------------------------------------------------------------------------------------------------------------------
  7424. function BattlegroundTargets:GroupUnitIDUpdate()
  7425. wipe(DATA.Friend.Name2UnitID)
  7426. local numMembers = GetNumGroupMembers()
  7427. local verified = 0
  7428.  
  7429. for num = 1, numMembers do
  7430. local unitID = "raid"..num
  7431. if UnitExists(unitID) then
  7432. local fName, _, _, _, _, class = GetRaidRosterInfo(num)
  7433. if fName then
  7434. DATA.Friend.Name2UnitID[ fName ] = unitID
  7435. DATA.Friend.UnitID2Name[ unitID ] = fName
  7436. verified = verified + 1
  7437. end
  7438. end
  7439. end
  7440.  
  7441. if numMembers == verified then
  7442. BattlegroundTargets.GroupUpdateTimer = nil
  7443. else
  7444. BattlegroundTargets.GroupUpdateTimer = GetTime()
  7445. end
  7446.  
  7447. --[[
  7448. print("- BEGIN ---------------------------")
  7449. print("numMembers:", numMembers, "verified:", verified)
  7450. for k,v in pairs(DATA.Friend.Name2UnitID) do print(k,v) end
  7451. print("- END ---------------------------")
  7452. --]]
  7453. end
  7454. -- ---------------------------------------------------------------------------------------------------------------------
  7455.  
  7456.  
  7457.  
  7458. -- ---------------------------------------------------------------------------------------------------------------------
  7459. function BattlegroundTargets:UpdateToTButton(sourceButton) -- target_of_target
  7460. local ToTButton = sourceButton.ToTButton
  7461.  
  7462. local totSide = ToTButton.totData.totSide
  7463. local totName = ToTButton.totData.totName
  7464. local totFullName = ToTButton.totData.totFullName
  7465. local classToken = ToTButton.totData.classToken
  7466. local talentSpec = Textures.RoleIcon[ ToTButton.totData.talentSpec ]
  7467. local targetID = ToTButton.totData.targetID
  7468.  
  7469. local colR = classcolors[classToken].r
  7470. local colG = classcolors[classToken].g
  7471. local colB = classcolors[classToken].b
  7472. local colR5 = colR*0.5
  7473. local colG5 = colG*0.5
  7474. local colB5 = colB*0.5
  7475.  
  7476. --print("*totupd*", totSide, totFullName, "#", totName, "#", sourceButton.buttonNum, targetID)
  7477.  
  7478. ToTButton.Name:SetText(totName)-- only name, no realm
  7479. ToTButton.ClassColorBackground:SetColorTexture(colR5, colG5, colB5, 1)
  7480. ToTButton.HealthBar:SetColorTexture(colR, colG, colB, 1)
  7481. ToTButton.RoleTexture:SetTexCoord(talentSpec[1], talentSpec[2], talentSpec[3], talentSpec[4])
  7482.  
  7483. local BattlegroundTargets_Options = BattlegroundTargets_Options
  7484. local ButtonHealthBarToggle = BattlegroundTargets_Options[totSide].ButtonHealthBarToggle[currentSize]
  7485. local ButtonHealthTextToggle = BattlegroundTargets_Options[totSide].ButtonHealthTextToggle[currentSize]
  7486.  
  7487. if ButtonHealthBarToggle or ButtonHealthTextToggle then
  7488. local percentE = DATA[totSide].Name2Percent[totFullName]
  7489. if percentE then
  7490. --------------------
  7491. if ButtonHealthBarToggle then
  7492. local width = DATA[totSide].totHealthBarWidth * (percentE / 100)
  7493. width = math_max(0.01, width)
  7494. width = math_min(DATA[totSide].totHealthBarWidth, width)
  7495. ToTButton.HealthBar:SetWidth(width)
  7496. end
  7497. if ButtonHealthTextToggle then
  7498. ToTButton.HealthText:SetText(percentE)
  7499. end
  7500. --------------------
  7501. else
  7502. --------------------
  7503. local maxHealth = UnitHealthMax(targetID)
  7504. if maxHealth then
  7505. local health = UnitHealth(targetID)
  7506. if health then
  7507. local width = 0.01
  7508. local percent = 0
  7509. if maxHealth > 0 and health > 0 then
  7510. local hvalue = maxHealth / health
  7511. width = DATA[totSide].totHealthBarWidth / hvalue
  7512. width = math_max(0.01, width)
  7513. width = math_min(DATA[totSide].totHealthBarWidth, width)
  7514. percent = floor( (100/hvalue) + 0.5 )
  7515. percent = math_max(0, percent)
  7516. percent = math_min(100, percent)
  7517. end
  7518. if ButtonHealthBarToggle then
  7519. ToTButton.HealthBar:SetWidth(width)
  7520. end
  7521. if ButtonHealthTextToggle then
  7522. ToTButton.HealthText:SetText(percent)
  7523. end
  7524. end
  7525. end
  7526. --------------------
  7527. end
  7528. end
  7529.  
  7530. if totSide == "Enemy" then
  7531. ToTButton.FactionTexture:SetTexture(Textures.EnemyIcon.path)
  7532. ToTButton.FactionTexture:SetTexCoord(unpack(Textures.EnemyIcon.coords))
  7533. else
  7534. ToTButton.FactionTexture:SetTexture(Textures.FriendIcon.path)
  7535. ToTButton.FactionTexture:SetTexCoord(unpack(Textures.FriendIcon.coords))
  7536. end
  7537. end
  7538. -- ---------------------------------------------------------------------------------------------------------------------
  7539.  
  7540.  
  7541.  
  7542. -- ---------------------------------------------------------------------------------------------------------------------
  7543. function BattlegroundTargets:CheckToTTarget(sourceButton, targetID, targetName, caller) -- target_of_target
  7544. local totFullName, totName, totRealm
  7545. if targetName then
  7546. if DATA.Friend.Name4Flag[targetName] or DATA.Enemy.Name4Flag[targetName] then
  7547. totName = targetName
  7548. elseif strfind(targetName, "-", 1, true) then
  7549. totName, totRealm = strmatch(targetName, "(.-)%-(.*)$")
  7550. end
  7551. totFullName = targetName
  7552. else
  7553. totFullName, totRealm = UnitName(targetID)
  7554. totName = totFullName
  7555. if totRealm and totRealm ~= "" then
  7556. totFullName = totFullName.."-"..totRealm
  7557. end
  7558. --print("INPUT_NAME_CHECK: _TOT_", targetID, "#", totFullName, "#", caller)
  7559. end
  7560.  
  7561. local totSide, classToken, talentSpec
  7562. local Friend_Name2Button = DATA.Friend.MainData[ DATA.Friend.Name2Button[totFullName] ]
  7563. local Enemy_Name2Button = DATA.Enemy.MainData[ DATA.Enemy.Name2Button[totFullName] ]
  7564. if Friend_Name2Button then
  7565. totSide = "Friend"
  7566. classToken = Friend_Name2Button.classToken
  7567. talentSpec = Friend_Name2Button.talentSpec
  7568. elseif Enemy_Name2Button then
  7569. totSide = "Enemy"
  7570. classToken = Enemy_Name2Button.classToken
  7571. talentSpec = Enemy_Name2Button.talentSpec
  7572. end
  7573.  
  7574. if classToken then
  7575. if BattlegroundTargets_Options.TransliterationToggle then
  7576. if DATA.TransName[totName] then
  7577. totName = DATA.TransName[totName]
  7578. end
  7579. end
  7580. sourceButton.ToTButton.totData = {
  7581. totSide = totSide,
  7582. totName = totName,
  7583. totFullName = totFullName,
  7584. classToken = classToken,
  7585. talentSpec = talentSpec,
  7586. targetID = targetID,
  7587. }
  7588. BattlegroundTargets:UpdateToTButton(sourceButton)
  7589. sourceButton.ToTButton:SetAlpha(1)
  7590. else
  7591. sourceButton.ToTButton.totData = nil
  7592. sourceButton.ToTButton:SetAlpha(0)
  7593. end
  7594. end
  7595. -- ---------------------------------------------------------------------------------------------------------------------
  7596.  
  7597.  
  7598.  
  7599. -- ---------------------------------------------------------------------------------------------------------------------
  7600. local function ct_substract(sourceName)
  7601. local targetName = DATA.TargetCountNames[ sourceName ]
  7602. if targetName then
  7603.  
  7604. if DATA.Enemy.Name2Button[ targetName ] then -- enemy
  7605. if DATA.TargetECountNum[ targetName ] then
  7606. DATA.TargetECountNum[ targetName ] = math_max(0, DATA.TargetECountNum[ targetName ] - 1) -- TC_ENEMY_DEF
  7607. end
  7608. elseif DATA.Friend.Name2Button[ targetName ] then -- friend
  7609. if DATA.TargetFCountNum[ targetName ] then
  7610. DATA.TargetFCountNum[ targetName ] = math_max(0, DATA.TargetFCountNum[ targetName ] - 1) -- TC_FRIEND_DEF
  7611. end
  7612. end
  7613.  
  7614. DATA.TargetCountNames[ sourceName ] = nil -- TC_DEFDEL
  7615. DATA.TargetCountTargetID[ sourceName ] = nil -- TC_DEFDEL
  7616. end
  7617. end
  7618.  
  7619. local function ct_check(targetID, sourceName, targetName)
  7620. if not sourceName then return end
  7621. if targetName then
  7622. ------------------
  7623. local oldTargetName = DATA.TargetCountNames[ sourceName ]
  7624. if oldTargetName and oldTargetName ~= targetName then
  7625. ct_substract(sourceName)
  7626. end
  7627.  
  7628. if not DATA.TargetCountNames[ sourceName ] or DATA.TargetCountNames[ sourceName ] ~= targetName then
  7629. DATA.TargetCountNames[ sourceName ] = targetName -- TC_DEFDEL
  7630. DATA.TargetCountTargetID[ sourceName ] = targetID -- TC_DEFDEL
  7631. -- ----------------------------------------------------
  7632. if (DATA.Friend.Name2Button[ sourceName ] and DATA.Enemy.Name2Button[ targetName ]) or -- friend -> enemy
  7633. (DATA.Enemy.Name2Button[ sourceName ] and DATA.Friend.Name2Button[ targetName ]) -- enemy -> friend
  7634. then
  7635. -- TC_ENEMY_DEF ----------
  7636. if DATA.TargetECountNum[ targetName ] then
  7637. DATA.TargetECountNum[ targetName ] = DATA.TargetECountNum[ targetName ] + 1
  7638. else
  7639. DATA.TargetECountNum[ targetName ] = 1
  7640. end
  7641. -- -----------------------
  7642. elseif (DATA.Friend.Name2Button[ sourceName ] and DATA.Friend.Name2Button[ targetName ]) or -- friend -> friend
  7643. (DATA.Enemy.Name2Button[ sourceName ] and DATA.Enemy.Name2Button[ targetName ]) -- enemy -> enemy
  7644. then
  7645. -- TC_FRIEND_DEF ----------
  7646. if DATA.TargetFCountNum[ targetName ] then
  7647. DATA.TargetFCountNum[ targetName ] = DATA.TargetFCountNum[ targetName ] + 1
  7648. else
  7649. DATA.TargetFCountNum[ targetName ] = 1
  7650. end
  7651. -- ------------------------
  7652. end
  7653. -- ----------------------------------------------------
  7654. end
  7655. ------------------
  7656. else
  7657. ct_substract(sourceName)
  7658. end
  7659. end
  7660.  
  7661. -- "player", playerName, "target", nil
  7662. -- "player", playerName, "focus" , "name-realm"
  7663. function BattlegroundTargets:CheckTarget(friendID, friendName, targetID, targetName, caller) -- targetcount_ -- target_of_target
  7664. if isDeadUpdateStop then return end
  7665. if targetID == "focus" then return end -- targetcount_focus
  7666.  
  7667. local BattlegroundTargets_Options = BattlegroundTargets_Options
  7668. local TargetCount = BattlegroundTargets_Options.Enemy.ButtonETargetCountToggle[currentSize] or
  7669. BattlegroundTargets_Options.Enemy.ButtonFTargetCountToggle[currentSize] or
  7670. BattlegroundTargets_Options.Friend.ButtonFTargetCountToggle[currentSize] or
  7671. BattlegroundTargets_Options.Friend.ButtonETargetCountToggle[currentSize]
  7672. local Friend_ButtonToTToggle = BattlegroundTargets_Options.Friend.ButtonToTToggle[currentSize]
  7673. local Enemy_ButtonToTToggle = BattlegroundTargets_Options.Enemy.ButtonToTToggle[currentSize]
  7674.  
  7675. -- connections
  7676. if TargetCount or Friend_ButtonToTToggle or Enemy_ButtonToTToggle then
  7677. local curTime = GetTime()
  7678. if curTime > BattlegroundTargets.targetCountTimer + targetCountFrequency then
  7679. BattlegroundTargets.targetCountTimer = curTime
  7680. wipe(DATA.TargetCountNames) -- TC_DEFDEL
  7681. wipe(DATA.TargetCountTargetID) -- TC_DEFDEL
  7682. wipe(DATA.TargetFCountNum) -- TC_FRIEND_DEF
  7683. wipe(DATA.TargetECountNum) -- TC_ENEMY_DEF
  7684. for fName, fID in pairs(DATA.Friend.Name2UnitID) do
  7685. if DATA.Friend.Name2Button[ fName ] then
  7686. -- BEGIN -------------
  7687. local tID = fID.."target"
  7688. local ftName = GetUnitFullName(tID)
  7689. --print("ttct1:", tID, fName, ftName)
  7690. ct_check(tID, fName, ftName)
  7691. ---------------
  7692. if ftName and fName ~= ftName then
  7693. local tID = fID.."targettarget"
  7694. local fttName = GetUnitFullName(fID.."targettarget")
  7695. --print("ttct2:", tID, ftName, fttName)
  7696. ct_check(tID, ftName, fttName)
  7697. ---------------
  7698. if fttName and ftName ~= fttName then
  7699. local tID = fID.."targettargettarget"
  7700. local ftttName = GetUnitFullName(fID.."targettargettarget")
  7701. --print("ttct3:", tID, fttName, ftttName)
  7702. ct_check(tID, fttName, ftttName)
  7703. ---------------
  7704. end
  7705. end
  7706. -- END -------------
  7707. end
  7708. end
  7709. else
  7710. ct_check(targetID, friendName, targetName)
  7711. if targetName ~= playername and targetID then
  7712. local targettargetID = targetID.."target"
  7713. local targettargetName = GetUnitFullName(targettargetID)
  7714. ct_check(targettargetID, targetName, targettargetName)
  7715. end
  7716. end
  7717. end
  7718.  
  7719. -- target_of_target display
  7720. if Friend_ButtonToTToggle or Enemy_ButtonToTToggle then
  7721. for frc = 1, #FRAMES do
  7722. local side = FRAMES[frc]
  7723. if BattlegroundTargets_Options[side].EnableBracket[currentSize] then
  7724. ---------------
  7725. local button = GVAR[side.."Button"]
  7726. for i = 1, currentSize do
  7727. if DATA[side].MainData[i] then
  7728. ---------------
  7729. local sourceName = DATA[side].MainData[i].name
  7730. local targetName = DATA.TargetCountNames[sourceName]
  7731. if targetName then
  7732. BattlegroundTargets:CheckToTTarget(button[i], DATA.TargetCountTargetID[sourceName], targetName, "checktarget")
  7733. else
  7734. button[i].ToTButton.totData = nil
  7735. button[i].ToTButton:SetAlpha(0)
  7736. end
  7737. ---------------
  7738. else
  7739. button[i].ToTButton.totData = nil
  7740. button[i].ToTButton:SetAlpha(0)
  7741. end
  7742. end
  7743. ---------------
  7744. end
  7745. end
  7746. end
  7747.  
  7748. -- targetcount_ display
  7749. if TargetCount then
  7750. for frc = 1, #FRAMES do
  7751. local side = FRAMES[frc]
  7752. if BattlegroundTargets_Options[side].EnableBracket[currentSize] then
  7753. ---------------
  7754. local button = GVAR[side.."Button"]
  7755. for i = 1, currentSize do
  7756. if DATA[side].MainData[i] then
  7757. ---------------
  7758. local count = DATA.TargetFCountNum[ DATA[side].MainData[i].name ]
  7759. if count then
  7760. button[i].FTargetCount:SetText(count)
  7761. else
  7762. button[i].FTargetCount:SetText("0")
  7763. end
  7764. ---------------
  7765. local count = DATA.TargetECountNum[ DATA[side].MainData[i].name ]
  7766. if count then
  7767. button[i].ETargetCount:SetText(count)
  7768. else
  7769. button[i].ETargetCount:SetText("0")
  7770. end
  7771. ---------------
  7772. else
  7773. button[i].FTargetCount:SetText("")
  7774. button[i].ETargetCount:SetText("")
  7775. end
  7776. end
  7777. ---------------
  7778. end
  7779. end
  7780. end
  7781. end
  7782. -- ---------------------------------------------------------------------------------------------------------------------
  7783.  
  7784.  
  7785.  
  7786. -- ---------------------------------------------------------------------------------------------------------------------
  7787. function BattlegroundTargets:CheckPlayerHealth(side, button, unitID, unitName, caller) -- health_
  7788. local curTime = GetTime()
  7789. if curTime < button.healthTimer + healthFrequency then
  7790. return
  7791. end
  7792.  
  7793. --[[ _TIMER_
  7794. local dif = curTime - button.healthTimer
  7795. print("health:", side, button.buttonNum, unitID, unitName, "#", dif, "#", caller)
  7796. --]]
  7797.  
  7798. button.healthTimer = curTime
  7799.  
  7800. local BattlegroundTargets_Options = BattlegroundTargets_Options
  7801. local ButtonHealthBarToggle = BattlegroundTargets_Options[side].ButtonHealthBarToggle[currentSize]
  7802. local ButtonHealthTextToggle = BattlegroundTargets_Options[side].ButtonHealthTextToggle[currentSize]
  7803.  
  7804. if ButtonHealthBarToggle or ButtonHealthTextToggle then
  7805. local width = 0.01
  7806. local percent = 0
  7807.  
  7808. local maxHealth = UnitHealthMax(unitID)
  7809. if maxHealth then
  7810. local health = UnitHealth(unitID)
  7811. if health then
  7812. if maxHealth > 0 and health > 0 then
  7813. local hvalue = maxHealth / health
  7814. width = DATA[side].healthBarWidth / hvalue
  7815. width = math_max(0.01, width)
  7816. width = math_min(DATA[side].healthBarWidth, width)
  7817. percent = floor( (100/hvalue) + 0.5 )
  7818. percent = math_max(0, percent)
  7819. percent = math_min(100, percent)
  7820. end
  7821. end
  7822. end
  7823.  
  7824. DATA[side].Name2Percent[unitName] = percent
  7825.  
  7826. if ButtonHealthBarToggle then
  7827. button.HealthBar:SetWidth(width)
  7828. end
  7829. if ButtonHealthTextToggle then
  7830. button.HealthText:SetText(percent)
  7831. end
  7832.  
  7833. if BattlegroundTargets_Options[side].EnableBracket[currentSize] and
  7834. BattlegroundTargets_Options[side].ButtonToTToggle[currentSize]
  7835. then
  7836. if percent == 0 then
  7837. BattlegroundTargets:ClearToTButtonByName(unitName)
  7838. elseif button.ToTButton.totData then
  7839. BattlegroundTargets:UpdateToTButton(button)
  7840. button.ToTButton:SetAlpha(1)
  7841. end
  7842. end
  7843. end
  7844. end
  7845. -- ---------------------------------------------------------------------------------------------------------------------
  7846.  
  7847.  
  7848.  
  7849. -- ---------------------------------------------------------------------------------------------------------------------
  7850. function BattlegroundTargets:CheckPlayerTarget()
  7851. local BattlegroundTargets_Options = BattlegroundTargets_Options
  7852.  
  7853. playerTargetName = GetUnitFullName("target")
  7854.  
  7855. for frc = 1, #FRAMES do
  7856. local side = FRAMES[frc]
  7857. if BattlegroundTargets_Options[side].EnableBracket[currentSize] then
  7858. -- targeet reset all BEGIN -----
  7859. local button = GVAR[side.."Button"]
  7860. for i = 1, currentSize do
  7861. button[i].TargetTexture:SetAlpha(0)
  7862. button[i].HighlightT:SetColorTexture(0, 0, 0, 1)
  7863. button[i].HighlightR:SetColorTexture(0, 0, 0, 1)
  7864. button[i].HighlightB:SetColorTexture(0, 0, 0, 1)
  7865. button[i].HighlightL:SetColorTexture(0, 0, 0, 1)
  7866. button[i].FlagDebuffButton:SetScript("OnUpdate", nil)
  7867. end
  7868. -- targeet reset all END -----
  7869. end
  7870. end
  7871.  
  7872. isTargetButton = nil
  7873. local isTargetSide
  7874.  
  7875. for frc = 1, #FRAMES do
  7876. local side = FRAMES[frc]
  7877. if BattlegroundTargets_Options[side].EnableBracket[currentSize] then
  7878. -- targeet BEGIN -----
  7879. local button = GVAR[side.."Button"][ DATA[side].Name2Button[ playerTargetName ] ]
  7880. if button then
  7881. if BattlegroundTargets_Options[side].ButtonTargetToggle[currentSize] then
  7882. button.TargetTexture:SetAlpha(1)
  7883. button.HighlightT:SetColorTexture(0.5, 0.5, 0.5, 1)
  7884. button.HighlightR:SetColorTexture(0.5, 0.5, 0.5, 1)
  7885. button.HighlightB:SetColorTexture(0.5, 0.5, 0.5, 1)
  7886. button.HighlightL:SetColorTexture(0.5, 0.5, 0.5, 1)
  7887. end
  7888. isTargetButton = button
  7889. isTargetSide = side
  7890. break
  7891. end
  7892. -- targeet END -----
  7893. end
  7894. end
  7895.  
  7896. BattlegroundTargets:CheckUnitTarget("target", playerTargetName)
  7897.  
  7898. if not isTargetButton then return end
  7899.  
  7900. -- -- carrier_debuff_ BEGIN -----
  7901. if BattlegroundTargets_Options[isTargetSide].ButtonFlagToggle[currentSize] then
  7902. if (DATA[isTargetSide].hasFlag and DATA[isTargetSide].hasFlag == playerTargetName) or isTargetButton.orbColor then
  7903. local elapsed = carrierDebuffFrequency -- immediate init update
  7904. isTargetButton.FlagDebuffButton:SetScript("OnUpdate", function(self, elap)
  7905. elapsed = elapsed + elap
  7906. if elapsed > carrierDebuffFrequency then
  7907. elapsed = 0
  7908. BattlegroundTargets:CarrierDebuffCheck(isTargetSide, isTargetButton, "target", playerTargetName)
  7909. end
  7910. end)
  7911. end
  7912. end
  7913. -- -- carrier_debuff_ END -----
  7914. end
  7915. -- ---------------------------------------------------------------------------------------------------------------------
  7916.  
  7917.  
  7918.  
  7919. -- ---------------------------------------------------------------------------------------------------------------------
  7920. function BattlegroundTargets:CheckPlayerFocus()
  7921. local BattlegroundTargets_Options = BattlegroundTargets_Options
  7922.  
  7923. playerFocusName = GetUnitFullName("focus")
  7924.  
  7925. -- reset focus_
  7926. for frc = 1, #FRAMES do
  7927. local side = FRAMES[frc]
  7928. if BattlegroundTargets_Options[side].EnableBracket[currentSize] then
  7929. local button = GVAR[side.."Button"]
  7930. for i = 1, currentSize do
  7931. button[i].FocusTexture:SetAlpha(0)
  7932. button[i].FocusTextureButton:SetScript("OnUpdate", nil) -- TODO
  7933. end
  7934. end
  7935. end
  7936.  
  7937. if not playerFocusName then return end
  7938.  
  7939. -- set focus_ -- TODO
  7940. for frc = 1, #FRAMES do
  7941. local side = FRAMES[frc]
  7942. if BattlegroundTargets_Options[side].EnableBracket[currentSize] then
  7943. local button = GVAR[side.."Button"][ DATA[side].Name2Button[ playerFocusName ] ]
  7944. if button then
  7945. -- focus_ BEGIN -----
  7946. button.FocusTexture:SetAlpha(1)
  7947. if not inCombat then
  7948. button:SetAttribute("macrotext2", "/targetexact "..playerFocusName.."\n/clearfocus\n/targetlasttarget")
  7949. end
  7950. local elapsed = focusFrequency -- immediate init update
  7951. button.FocusTextureButton:SetScript("OnUpdate", function(self, elap)
  7952. elapsed = elapsed + elap
  7953. if elapsed > focusFrequency then
  7954. elapsed = 0
  7955. BattlegroundTargets:CheckUnitTarget("focus", playerFocusName)
  7956. end
  7957. end)
  7958. -- focus_ END -----
  7959. break
  7960. end
  7961. end
  7962. end
  7963. end
  7964. -- ---------------------------------------------------------------------------------------------------------------------
  7965.  
  7966.  
  7967.  
  7968. -- ---------------------------------------------------------------------------------------------------------------------
  7969. function BattlegroundTargets:FriendLeaderUpdate() -- leader_
  7970. for unitName, unitID in pairs(DATA.Friend.Name2UnitID) do
  7971. if UnitIsGroupLeader(unitID) then
  7972. local clrButton = GVAR.FriendButton
  7973. for i = 1, currentSize do
  7974. clrButton[i].LeaderTexture:SetAlpha(0)
  7975. end
  7976. local button = GVAR.FriendButton[ DATA.Friend.Name2Button[ unitName ] ]
  7977. if button then
  7978. DATA.Friend.isLeader = unitName
  7979. button.leaderTimer = GetTime()
  7980. button.LeaderTexture:SetAlpha(1)
  7981. end
  7982. return
  7983. end
  7984. end
  7985. end
  7986. -- ---------------------------------------------------------------------------------------------------------------------
  7987.  
  7988. -- ---------------------------------------------------------------------------------------------------------------------
  7989. function BattlegroundTargets:CheckLeader(side, button, unitID, unitName) -- leader_
  7990. local BattlegroundTargets_Options = BattlegroundTargets_Options
  7991.  
  7992. if not BattlegroundTargets_Options[side].ButtonLeaderToggle[currentSize] then return end
  7993.  
  7994. if DATA[side].isLeader then
  7995. local curTime = GetTime()
  7996. if curTime < button.leaderTimer + leaderFrequency then
  7997. return
  7998. end
  7999. button.leaderTimer = curTime
  8000. if DATA[side].isLeader ~= unitName and UnitIsGroupLeader(unitID) then
  8001. local clrButton = GVAR[side.."Button"]
  8002. for i = 1, currentSize do
  8003. clrButton[i].LeaderTexture:SetAlpha(0)
  8004. end
  8005. DATA[side].isLeader = unitName
  8006. button.LeaderTexture:SetAlpha(1)
  8007. end
  8008. elseif UnitIsGroupLeader(unitID) then
  8009. local clrButton = GVAR[side.."Button"]
  8010. for i = 1, currentSize do
  8011. clrButton[i].LeaderTexture:SetAlpha(0)
  8012. end
  8013. DATA[side].isLeader = unitName
  8014. button.leaderTimer = GetTime()
  8015. button.LeaderTexture:SetAlpha(1)
  8016. end
  8017. end
  8018. -- ---------------------------------------------------------------------------------------------------------------------
  8019.  
  8020.  
  8021.  
  8022. -- ---------------------------------------------------------------------------------------------------------------------
  8023. function BattlegroundTargets:CheckAssist()
  8024. local BattlegroundTargets_Options = BattlegroundTargets_Options
  8025.  
  8026. isAssistUnitId = nil
  8027. isAssistName = nil
  8028. for i = 1, GetNumGroupMembers() do
  8029. local name, _, _, _, _, _, _, _, _, role = GetRaidRosterInfo(i)
  8030. if role == "MAINASSIST" and name then
  8031. isAssistName = name
  8032. isAssistUnitId = "raid"..i.."target"
  8033. break
  8034. end
  8035. end
  8036.  
  8037. -- reset assist_
  8038. for frc = 1, #FRAMES do
  8039. local side = FRAMES[frc]
  8040. if BattlegroundTargets_Options[side].EnableBracket[currentSize] then
  8041. local button = GVAR[side.."Button"]
  8042. for i = 1, currentSize do
  8043. button[i].AssistTargetTexture:SetAlpha(0)
  8044. button[i].AssistSourceTexture:SetAlpha(0)
  8045. end
  8046. end
  8047. end
  8048.  
  8049. if not isAssistName then return end
  8050.  
  8051. -- set source assist_
  8052. if BattlegroundTargets_Options.Friend.EnableBracket[currentSize] then
  8053. local button = GVAR.FriendButton[ DATA.Friend.Name2Button[isAssistName] ]
  8054. if button then
  8055. button.AssistSourceTexture:SetAlpha(1)
  8056. end
  8057. end
  8058.  
  8059. playerAssistTargetName = GetUnitFullName(isAssistUnitId)
  8060.  
  8061. if not playerAssistTargetName then return end
  8062.  
  8063. -- set target assist_
  8064. for frc = 1, #FRAMES do
  8065. local side = FRAMES[frc]
  8066. if BattlegroundTargets_Options[side].EnableBracket[currentSize] then
  8067. local button = GVAR[side.."Button"][ DATA[side].Name2Button[playerAssistTargetName] ]
  8068. if button then
  8069. button.AssistTargetTexture:SetAlpha(1)
  8070. break
  8071. end
  8072. end
  8073. end
  8074. end
  8075. -- ---------------------------------------------------------------------------------------------------------------------
  8076.  
  8077.  
  8078.  
  8079. -- ---------------------------------------------------------------------------------------------------------------------
  8080. function BattlegroundTargets:CheckUnitTarget(unitID, unitName, isEvent)
  8081. local friendID, friendName
  8082. local targetID, targetName
  8083.  
  8084. if isEvent then
  8085. if not raidUnitID[unitID] then return end
  8086. friendID = unitID
  8087. friendName = GetUnitFullName(unitID)
  8088. targetID = unitID.."target"
  8089. targetName = GetUnitFullName(targetID)
  8090. elseif unitID == "focus" then -- targetcount_focus
  8091. friendID = "player"
  8092. friendName = playerName
  8093. targetID = "focus"
  8094. targetName = unitName
  8095. elseif unitID == "target" then -- targeet
  8096. friendID = "player"
  8097. friendName = playerName
  8098. targetID = "target"
  8099. targetName = unitName
  8100. end
  8101. -- friendName = nil is possible
  8102. -- targetName = nil is possible
  8103. --print("friendID:", friendID, "friendName:", friendName, "targetID:", targetID, "targetName:", targetName)
  8104.  
  8105. BattlegroundTargets:CheckTarget(friendID, friendName, targetID, targetName, "checkunittarget") -- targetcount_ -- target_of_target
  8106. BattlegroundTargets:UpdateAllPvPTrinkets() -- pvp_trinket_
  8107.  
  8108. local side
  8109. if DATA.Enemy.Name2Button[ targetName ] then
  8110. side = "Enemy"
  8111. elseif DATA.Friend.Name2Button[ targetName ] then
  8112. side = "Friend"
  8113. end
  8114. if not side then return end
  8115.  
  8116. -- real opposite faction check
  8117. if not oppositeFactionREAL and side == "Enemy" then -- summary_flag_texture - 2 - set in bg
  8118. local factionGroup = UnitFactionGroup(targetID)
  8119. if factionGroup == "Horde" then
  8120. GVAR.FriendSummary.Logo2:SetTexture("Interface\\FriendsFrame\\PlusManz-Horde")
  8121. GVAR.EnemySummary.Logo2:SetTexture("Interface\\FriendsFrame\\PlusManz-Horde")
  8122. oppositeFactionREAL = 0
  8123. elseif factionGroup == "Alliance" then
  8124. GVAR.FriendSummary.Logo2:SetTexture("Interface\\FriendsFrame\\PlusManz-Alliance")
  8125. GVAR.EnemySummary.Logo2:SetTexture("Interface\\FriendsFrame\\PlusManz-Alliance")
  8126. oppositeFactionREAL = 1
  8127. end
  8128. end
  8129.  
  8130. local button = GVAR[side.."Button"][ DATA[side].Name2Button[targetName] ]
  8131. if not button then return end
  8132.  
  8133. local BattlegroundTargets_Options = BattlegroundTargets_Options
  8134. if not BattlegroundTargets_Options[side].EnableBracket[currentSize] then return end
  8135.  
  8136. BattlegroundTargets:CheckPlayerHealth(side, button, targetID, targetName, "checkunittarget") -- health_
  8137. BattlegroundTargets:CheckCarrierDebuff(side, button, targetID, targetName, "checkunittarget") -- FLAGSPY -- carrier_debuff_
  8138. BattlegroundTargets:CheckClassRange(side, button, targetID, targetName, "checkunittarget") -- class_range_
  8139. BattlegroundTargets:CheckLeader(side, button, targetID, targetName) -- leader_
  8140.  
  8141. -- target assist_
  8142. if isAssistName and BattlegroundTargets_Options[side].ButtonAssistToggle[currentSize] then
  8143. local curTime = GetTime()
  8144. if isAssistName == friendName then
  8145. local clrButton = GVAR[side.."Button"]
  8146. for i = 1, currentSize do
  8147. clrButton[i].AssistTargetTexture:SetAlpha(0)
  8148. end
  8149. playerAssistTargetName = targetName
  8150. button.AssistTargetTexture:SetAlpha(1)
  8151. elseif curTime > button.assistTimer + assistFrequency then
  8152. button.assistTimer = curTime
  8153. local clrButton = GVAR[side.."Button"]
  8154. for i = 1, currentSize do
  8155. clrButton[i].AssistTargetTexture:SetAlpha(0)
  8156. end
  8157. playerAssistTargetName = GetUnitFullName(isAssistUnitId)
  8158. local nButton = GVAR[side.."Button"][ DATA[side].Name2Button[playerAssistTargetName] ]
  8159. if nButton then
  8160. nButton.AssistTargetTexture:SetAlpha(1)
  8161. end
  8162. end
  8163. end
  8164.  
  8165. -- level
  8166. if isLowLevel and playerLevel ~= 100 then -- LVLCHK
  8167. local level = UnitLevel(targetID) or 0
  8168. if level > 0 then
  8169. DATA[side].Name2Level[targetName] = level
  8170. button.Name:SetText(level.." "..button.name4button)
  8171. end
  8172. end
  8173. end
  8174. -- ---------------------------------------------------------------------------------------------------------------------
  8175.  
  8176.  
  8177.  
  8178. -- ---------------------------------------------------------------------------------------------------------------------
  8179. function BattlegroundTargets:CheckUnitHealth(sourceID)
  8180. local BattlegroundTargets_Options = BattlegroundTargets_Options
  8181.  
  8182. for frc = 1, #FRAMES do
  8183. local side = FRAMES[frc]
  8184. if BattlegroundTargets_Options[side].EnableBracket[currentSize] then
  8185.  
  8186. local targetID
  8187. if side == "Enemy" then
  8188. if raidUnitID[sourceID] then
  8189. targetID = sourceID.."target"
  8190. elseif playerUnitID[sourceID] then
  8191. targetID = sourceID
  8192. end
  8193. else
  8194. if raidUnitID[sourceID] then
  8195. targetID = sourceID
  8196. --elseif playerUnitID[sourceID] then
  8197. -- targetID = sourceID
  8198. end
  8199. end
  8200.  
  8201. -- -----
  8202. if targetID then
  8203. local uName = GetUnitFullName(targetID)
  8204. local button = GVAR[side.."Button"][ DATA[side].Name2Button[ uName ] ]
  8205. if button then
  8206. BattlegroundTargets:CheckPlayerHealth(side, button, targetID, uName, "checkunithealth") -- health_
  8207. BattlegroundTargets:CheckCarrierDebuff(side, button, targetID, uName, "checkunithealth") -- FLAGSPY -- carrier_debuff_
  8208. BattlegroundTargets:CheckClassRange(side, button, targetID, uName, "checkunithealth") -- class_range_
  8209. end
  8210. end
  8211. -- -----
  8212.  
  8213. end
  8214. end
  8215. end
  8216. -- ---------------------------------------------------------------------------------------------------------------------
  8217.  
  8218. -- ---------------------------------------------------------------------------------------------------------------------
  8219. function BattlegroundTargets:CheckFlagCarrierCHECK(unitID, unitName) -- FLAGSPY
  8220. if not DATA.FirstFlagCheck[unitName] then return end
  8221.  
  8222. if isFlagBG >= 1 and isFlagBG <= 4 then--if isFlagBG == 1 or isFlagBG == 2 or isFlagBG == 3 or isFlagBG == 4 then
  8223.  
  8224. -- enemy buff & debuff check
  8225. for i = 1, 40 do
  8226. local _, _, _, _, _, _, _, _, _, _, spellId = UnitBuff(unitID, i)
  8227. if not spellId then break end
  8228. if flagIDs[spellId] then
  8229. DATA.Enemy.hasFlag = unitName
  8230. flagDebuff = 0
  8231. flags = flags + 1
  8232.  
  8233. for j = 1, 40 do
  8234. local _, _, _, count, _, _, _, _, _, _, spellId = UnitDebuff(unitID, j)
  8235. if not spellId then break end
  8236. if debuffIDs[spellId] then
  8237. flagDebuff = count
  8238. break
  8239. end
  8240. end
  8241.  
  8242. local button = GVAR.EnemyButton
  8243. for j = 1, currentSize do
  8244. button[j].FlagTexture:SetAlpha(0)
  8245. button[j].FlagDebuff:SetText("")
  8246. end
  8247. local button = GVAR.EnemyButton[ DATA.Enemy.Name2Button[unitName] ]
  8248. if button then
  8249. button.FlagTexture:SetAlpha(1)
  8250. BattlegroundTargets:SetFlagDebuff(button, flagDebuff)
  8251. end
  8252.  
  8253. BattlegroundTargets:CheckFlagCarrierEND()
  8254. return
  8255. end
  8256. end
  8257.  
  8258. elseif isFlagBG == 5 then
  8259.  
  8260. -- enemy debuff check
  8261. if flags >= totalFlags[isFlagBG] then
  8262. BattlegroundTargets:CheckFlagCarrierEND()
  8263. return
  8264. end
  8265. for i = 1, 40 do
  8266. local _, _, _, _, _, _, _, _, _, _, spellId, _, _, _, _, val2 = UnitDebuff(unitID, i)
  8267. --print(i, spellId, val2, "#", UnitDebuff(unitID, i))
  8268. if not spellId then break end
  8269. if orbIDs[spellId] then
  8270. flags = flags + 1 -- FLAG_TOK_CHK
  8271.  
  8272. local button = GVAR.EnemyButton[ DATA.Enemy.Name2Button[unitName] ]
  8273. if button then
  8274. local oID = orbIDs[spellId]
  8275. hasOrb[ oID.color ].name = unitName
  8276. hasOrb[ oID.color ].orbval = val2
  8277. button.orbColor = oID.color
  8278. button.FlagTexture:SetAlpha(1)
  8279. button.FlagTexture:SetTexture(oID.texture)
  8280. BattlegroundTargets:SetFlagDebuff(button, val2)
  8281. BattlegroundTargets:SetOrbCorner(button, oID.color)
  8282. end
  8283.  
  8284. if flags >= totalFlags[isFlagBG] then
  8285. BattlegroundTargets:CheckFlagCarrierEND()
  8286. return
  8287. end
  8288. break
  8289. end
  8290. end
  8291.  
  8292. end
  8293.  
  8294. DATA.FirstFlagCheck[unitName] = nil
  8295.  
  8296. local x
  8297. for k in pairs(DATA.FirstFlagCheck) do
  8298. x = true
  8299. break
  8300. end
  8301. if not x then
  8302. BattlegroundTargets:CheckFlagCarrierEND()
  8303. end
  8304. end
  8305. -- ---------------------------------------------------------------------------------------------------------------------
  8306.  
  8307. -- ---------------------------------------------------------------------------------------------------------------------
  8308. function BattlegroundTargets:CheckFlagCarrierSTART() -- FLAGSPY
  8309. local BattlegroundTargets_Options = BattlegroundTargets_Options
  8310.  
  8311. if isFlagBG >= 1 and isFlagBG <= 4 then--if isFlagBG == 1 or isFlagBG == 2 or isFlagBG == 3 or isFlagBG == 4 then
  8312.  
  8313. -- friend buff & debuff check
  8314. local function chk()
  8315. for num = 1, GetNumGroupMembers() do
  8316. local unitID = "raid"..num
  8317. for i = 1, 40 do
  8318. local _, _, _, _, _, _, _, _, _, _, spellId = UnitBuff(unitID, i)
  8319. if not spellId then break end
  8320. if flagIDs[spellId] then
  8321. flagDebuff = 0
  8322. flags = 1
  8323.  
  8324. for j = 1, 40 do
  8325. local _, _, _, count, _, _, _, _, _, _, spellId = UnitDebuff(unitID, j)
  8326. if not spellId then break end
  8327. if debuffIDs[spellId] then
  8328. flagDebuff = count
  8329. break
  8330. end
  8331. end
  8332.  
  8333. -- ----------
  8334. if BattlegroundTargets_Options.Friend.ButtonFlagToggle[currentSize] then
  8335. local button = GVAR.FriendButton
  8336. for j = 1, currentSize do
  8337. button[j].FlagTexture:SetAlpha(0)
  8338. button[j].FlagDebuff:SetText("")
  8339. end
  8340. local name = GetUnitFullName(unitID)
  8341. local button = GVAR.FriendButton[ DATA.Friend.Name2Button[name] ]
  8342. if button then
  8343. DATA.Friend.hasFlag = name
  8344. button.FlagTexture:SetAlpha(1)
  8345. BattlegroundTargets:SetFlagDebuff(button, flagDebuff)
  8346. end
  8347. end
  8348. -- ----------
  8349.  
  8350. return
  8351. end
  8352. end
  8353. end
  8354. end
  8355. chk()
  8356.  
  8357. elseif isFlagBG == 5 then
  8358.  
  8359. -- friend debuff check
  8360. for num = 1, GetNumGroupMembers() do
  8361. for i = 1, 40 do
  8362. local _, _, _, _, _, _, _, _, _, _, spellId, _, _, _, _, val2 = UnitDebuff("raid"..num, i)
  8363. if not spellId then break end
  8364. if orbIDs[spellId] then
  8365. flags = flags + 1 -- FLAG_TOK_CHK
  8366.  
  8367. -- ----------
  8368. if BattlegroundTargets_Options.Friend.ButtonFlagToggle[currentSize] then
  8369. local name = GetUnitFullName("raid"..num)
  8370. local button = GVAR.FriendButton[ DATA.Friend.Name2Button[name] ]
  8371. if button then
  8372. local oID = orbIDs[spellId]
  8373. hasOrb[ oID.color ].name = name
  8374. hasOrb[ oID.color ].orbval = val2
  8375. button.orbColor = oID.color
  8376. button.FlagTexture:SetAlpha(1)
  8377. button.FlagTexture:SetTexture(oID.texture)
  8378. BattlegroundTargets:SetFlagDebuff(button, val2)
  8379. BattlegroundTargets:SetOrbCorner(button, oID.color)
  8380. end
  8381.  
  8382. if flags >= totalFlags[isFlagBG] then
  8383. BattlegroundTargets:CheckFlagCarrierEND()
  8384. return
  8385. end
  8386. end
  8387. -- ----------
  8388.  
  8389. break
  8390. end
  8391. end
  8392. end
  8393.  
  8394. end
  8395.  
  8396. if flags >= totalFlags[isFlagBG] then
  8397. BattlegroundTargets:CheckFlagCarrierEND()
  8398. else
  8399. wipe(DATA.FirstFlagCheck)
  8400. for i = 1, #DATA.Enemy.MainData do
  8401. DATA.FirstFlagCheck[ DATA.Enemy.MainData[i].name ] = 1
  8402. end
  8403. BattlegroundTargets:RegisterEvent("UNIT_TARGET")
  8404. BattlegroundTargets:RegisterEvent("UPDATE_MOUSEOVER_UNIT")
  8405. BattlegroundTargets:RegisterEvent("PLAYER_TARGET_CHANGED")
  8406. end
  8407. end
  8408. -- ---------------------------------------------------------------------------------------------------------------------
  8409.  
  8410. -- ---------------------------------------------------------------------------------------------------------------------
  8411. function BattlegroundTargets:CheckFlagCarrierEND() -- FLAGSPY
  8412. local BattlegroundTargets_Options = BattlegroundTargets_Options
  8413.  
  8414. flagCHK = nil
  8415.  
  8416. wipe(DATA.FirstFlagCheck)
  8417.  
  8418. BattlegroundTargets:EventUnregister()
  8419. BattlegroundTargets:EventRegister()
  8420. end
  8421. -- ---------------------------------------------------------------------------------------------------------------------
  8422.  
  8423.  
  8424.  
  8425. -- ---------------------------------------------------------------------------------------------------------------------
  8426. function BattlegroundTargets:SetFlagDebuff(button, value)
  8427. if value and value > 0 then
  8428. button.FlagDebuff:SetText(value)
  8429. else
  8430. button.FlagDebuff:SetText("")
  8431. end
  8432. end
  8433.  
  8434. function BattlegroundTargets:SetOrbCorner(button, color)
  8435. if color == "Blue" then
  8436. button.OrbCornerTL:SetAlpha(0.15)
  8437. button.OrbCornerTR:SetAlpha(0.15)
  8438. button.OrbCornerBL:SetAlpha(0.15)
  8439. button.OrbCornerBR:SetAlpha(1)
  8440. elseif color == "Purple" then
  8441. button.OrbCornerTL:SetAlpha(1)
  8442. button.OrbCornerTR:SetAlpha(0.15)
  8443. button.OrbCornerBL:SetAlpha(0.15)
  8444. button.OrbCornerBR:SetAlpha(0.15)
  8445. elseif color == "Green" then
  8446. button.OrbCornerTL:SetAlpha(0.15)
  8447. button.OrbCornerTR:SetAlpha(0.15)
  8448. button.OrbCornerBL:SetAlpha(1)
  8449. button.OrbCornerBR:SetAlpha(0.15)
  8450. elseif color == "Orange" then
  8451. button.OrbCornerTL:SetAlpha(0.15)
  8452. button.OrbCornerTR:SetAlpha(1)
  8453. button.OrbCornerBL:SetAlpha(0.15)
  8454. button.OrbCornerBR:SetAlpha(0.15)
  8455. end
  8456. end
  8457.  
  8458. function BattlegroundTargets:OrbReturnCheck(message)
  8459. --print("orbreturncheck", message)
  8460. local orbColor = strmatch(message, FLG["TOK_PATTERN_RETURNED"]) -- Temple of Kotmogu: orb was returned
  8461. if orbColor then
  8462. local color = orbData(orbColor)
  8463. wipe(hasOrb[color])
  8464. flags = flags - 1 -- FLAG_TOK_CHK
  8465. if flags < 0 then
  8466. flags = 0
  8467. end
  8468.  
  8469. local BattlegroundTargets_Options = BattlegroundTargets_Options
  8470. for frc = 1, #FRAMES do
  8471. local side = FRAMES[frc]
  8472. if BattlegroundTargets_Options[side].EnableBracket[currentSize] then
  8473. local button = GVAR[side.."Button"]
  8474. for i = 1, currentSize do
  8475. if button[i].orbColor == color then
  8476. button[i].orbColor = nil
  8477. button[i].FlagTexture:SetAlpha(0)
  8478. button[i].FlagDebuff:SetText("")
  8479. button[i].OrbCornerTL:SetAlpha(0)
  8480. button[i].OrbCornerTR:SetAlpha(0)
  8481. button[i].OrbCornerBL:SetAlpha(0)
  8482. button[i].OrbCornerBR:SetAlpha(0)
  8483. return
  8484. end
  8485. end
  8486. end
  8487. end
  8488.  
  8489. end
  8490. end
  8491. -- ---------------------------------------------------------------------------------------------------------------------
  8492.  
  8493.  
  8494.  
  8495. -- ---------------------------------------------------------------------------------------------------------------------
  8496. function BattlegroundTargets:CheckCarrierDebuff(side, button, uID, uName, caller) -- FLAGSPY -- carrier_debuff_
  8497. if isFlagBG == 0 then return end
  8498.  
  8499. local BattlegroundTargets_Options = BattlegroundTargets_Options
  8500. if not BattlegroundTargets_Options[side].ButtonFlagToggle[currentSize] then return end
  8501.  
  8502. local curTime = GetTime()
  8503. if curTime < button.carrierDebuffTimer + carrierDebuffFrequency then
  8504. return
  8505. end
  8506. button.carrierDebuffTimer = curTime
  8507.  
  8508. if flagCHK then
  8509. BattlegroundTargets:CheckFlagCarrierCHECK(uID, uName)
  8510. end
  8511. if DATA[side].hasFlag == uName or button.orbColor then
  8512. BattlegroundTargets:CarrierDebuffCheck(side, button, uID, uName)
  8513. end
  8514. end
  8515.  
  8516. function BattlegroundTargets:CarrierDebuffCheck(side, button, uID, uName) -- carrier_debuff_
  8517. if isFlagBG > 0 and isFlagBG < 5 then
  8518. -- flag
  8519. for i = 1, 40 do
  8520. local _, _, _, count, _, _, _, _, _, _, spellId = UnitDebuff(uID, i)
  8521. --print(uID, uName, i, "#", spellId, count, "#", UnitDebuff(uID, i))
  8522. if debuffIDs[spellId] then
  8523. flagDebuff = count
  8524. BattlegroundTargets:SetFlagDebuff(button, flagDebuff)
  8525. return
  8526. end
  8527. if not spellId then return end
  8528. end
  8529. elseif isFlagBG == 5 then
  8530. -- orb
  8531. for i = 1, 40 do
  8532. local _, _, _, _, _, _, _, _, _, _, spellId, _, _, _, _, val2 = UnitDebuff(uID, i)
  8533. --print(uID, uName, i, "#", spellId, val2, "#", UnitDebuff(uID, i))
  8534. if orbIDs[spellId] then
  8535. local hasflg
  8536. for k, v in pairs(hasOrb) do
  8537. if v.name == uName then
  8538. hasflg = true
  8539. break
  8540. end
  8541. end
  8542. if not hasflg then
  8543. flags = flags + 1 -- FLAG_TOK_CHK
  8544. end
  8545.  
  8546. local oID = orbIDs[spellId]
  8547. hasOrb[ oID.color ].name = uName
  8548. hasOrb[ oID.color ].orbval = val2
  8549. button.orbColor = oID.color
  8550. button.FlagTexture:SetAlpha(1)
  8551. button.FlagTexture:SetTexture(oID.texture)
  8552. BattlegroundTargets:SetFlagDebuff(button, val2)
  8553. BattlegroundTargets:SetOrbCorner(button, oID.color)
  8554.  
  8555. if flagCHK and flags >= totalFlags[isFlagBG] then
  8556. BattlegroundTargets:CheckFlagCarrierEND()
  8557. end
  8558. return
  8559. end
  8560. if not spellId then return end
  8561. end
  8562. end
  8563. end
  8564. -- ---------------------------------------------------------------------------------------------------------------------
  8565.  
  8566.  
  8567.  
  8568. -- ---------------------------------------------------------------------------------------------------------------------
  8569. function BattlegroundTargets:CarrierCheck(message, messageFaction)
  8570. --print("carriercheck", isFlagBG, "#", message, "#", messageFaction)
  8571. if isFlagBG == 1 or isFlagBG == 3 then
  8572. BattlegroundTargets:Carrier_WG_TP(message, messageFaction)
  8573. elseif isFlagBG == 2 then
  8574. BattlegroundTargets:Carrier_EOTS(message, messageFaction)
  8575. elseif isFlagBG == 4 then
  8576. BattlegroundTargets:Carrier_DG(message, messageFaction)
  8577. elseif isFlagBG == 5 then
  8578. BattlegroundTargets:Carrier_TOK(message, messageFaction)
  8579. end
  8580. end
  8581. -- ---------------------------------------------------------------------------------------------------------------------
  8582.  
  8583. -- Warsong Gulch & Twin Peaks ------------------------------------------------------------------------------------------
  8584. function BattlegroundTargets:Carrier_WG_TP(message, messageFaction)
  8585. if messageFaction ~= playerFactionBG then
  8586. -- -------------------------------------------------------------------------
  8587. local fc = strmatch(message, FLG["WG_TP_DG_PATTERN_PICKED1"]) or -- Warsong Gulch & Twin Peaks: flag was picked
  8588. strmatch(message, FLG["WG_TP_DG_PATTERN_PICKED2"]) -- Warsong Gulch & Twin Peaks: flag was picked
  8589. if fc then
  8590. flags = flags + 1
  8591. for i = 1, currentSize do
  8592. GVAR.FriendButton[i].FlagTexture:SetAlpha(0)
  8593. GVAR.FriendButton[i].FlagDebuff:SetText("")
  8594. end
  8595. if flagCHK then
  8596. BattlegroundTargets:CheckFlagCarrierEND()
  8597. end
  8598. -- 1.) check for name-server
  8599. for fullname, fullnameButtonNum in pairs(DATA.Friend.Name2Button) do -- DATA.Friend.Name2Button and DATA.Friend.Name4Flag have same buttonNum
  8600. if fullname == fc then
  8601. local button = GVAR.FriendButton[fullnameButtonNum]
  8602. if button then
  8603. button.FlagTexture:SetAlpha(1)
  8604. BattlegroundTargets:SetFlagDebuff(button, flagDebuff)
  8605. DATA.Friend.hasFlag = fullname
  8606. return
  8607. end
  8608. return
  8609. end
  8610. end
  8611. -- 2.) check for name only
  8612. for name, buttonNum in pairs(DATA.Friend.Name4Flag) do
  8613. if name == fc then
  8614. local button = GVAR.FriendButton[buttonNum]
  8615. if button then
  8616. button.FlagTexture:SetAlpha(1)
  8617. BattlegroundTargets:SetFlagDebuff(button, flagDebuff)
  8618. for fullname, fullnameButtonNum in pairs(DATA.Friend.Name2Button) do -- DATA.Friend.Name2Button and DATA.Friend.Name4Flag have same buttonNum
  8619. if buttonNum == fullnameButtonNum then
  8620. DATA.Friend.hasFlag = fullname
  8621. return
  8622. end
  8623. end
  8624. end
  8625. return
  8626. end
  8627. end
  8628. -- ---
  8629. -- -------------------------------------------------------------------------
  8630. elseif strmatch(message, FLG["WG_TP_DG_MATCH_CAPTURED"]) then -- Warsong Gulch & Twin Peaks: flag was captured
  8631. for i = 1, currentSize do
  8632. GVAR.FriendButton[i].FlagTexture:SetAlpha(0)
  8633. GVAR.FriendButton[i].FlagDebuff:SetText("")
  8634. GVAR.EnemyButton[i].FlagTexture:SetAlpha(0)
  8635. GVAR.EnemyButton[i].FlagDebuff:SetText("")
  8636. end
  8637. DATA.Friend.hasFlag = nil
  8638. DATA.Enemy.hasFlag = nil
  8639. flagDebuff = 0
  8640. flags = 0
  8641. if flagCHK then
  8642. BattlegroundTargets:CheckFlagCarrierEND()
  8643. end
  8644. -- -------------------------------------------------------------------------
  8645. elseif strmatch(message, FLG["WG_TP_DG_MATCH_DROPPED"]) then -- Warsong Gulch & Twin Peaks: flag was dropped
  8646. for i = 1, currentSize do
  8647. GVAR.FriendButton[i].FlagTexture:SetAlpha(0)
  8648. GVAR.FriendButton[i].FlagDebuff:SetText("")
  8649. end
  8650. DATA.Friend.hasFlag = nil
  8651. flags = flags - 1
  8652. if flags <= 0 then
  8653. flagDebuff = 0
  8654. flags = 0
  8655. end
  8656. end
  8657. -- -------------------------------------------------------------------------
  8658. else
  8659. -- -------------------------------------------------------------------------
  8660. local efc = strmatch(message, FLG["WG_TP_DG_PATTERN_PICKED1"]) or -- Warsong Gulch & Twin Peaks: flag was picked
  8661. strmatch(message, FLG["WG_TP_DG_PATTERN_PICKED2"]) -- Warsong Gulch & Twin Peaks: flag was picked
  8662. if efc then
  8663. flags = flags + 1
  8664. for i = 1, currentSize do
  8665. GVAR.EnemyButton[i].FlagTexture:SetAlpha(0)
  8666. GVAR.EnemyButton[i].FlagDebuff:SetText("")
  8667. end
  8668. if flagCHK then
  8669. BattlegroundTargets:CheckFlagCarrierEND()
  8670. end
  8671. -- 1.) check for name-server
  8672. for fullname, fullnameButtonNum in pairs(DATA.Enemy.Name2Button) do -- DATA.Enemy.Name2Button and DATA.Enemy.Name4Flag have same buttonNum
  8673. if fullname == efc then
  8674. local button = GVAR.EnemyButton[fullnameButtonNum]
  8675. if button then
  8676. button.FlagTexture:SetAlpha(1)
  8677. BattlegroundTargets:SetFlagDebuff(button, flagDebuff)
  8678. DATA.Enemy.hasFlag = fullname
  8679. return
  8680. end
  8681. return
  8682. end
  8683. end
  8684. -- 2.) check for name only
  8685. for name, buttonNum in pairs(DATA.Enemy.Name4Flag) do
  8686. if name == efc then
  8687. local button = GVAR.EnemyButton[buttonNum]
  8688. if button then
  8689. button.FlagTexture:SetAlpha(1)
  8690. BattlegroundTargets:SetFlagDebuff(button, flagDebuff)
  8691. for fullname, fullnameButtonNum in pairs(DATA.Enemy.Name2Button) do -- DATA.Enemy.Name2Button and DATA.Enemy.Name4Flag have same buttonNum
  8692. if buttonNum == fullnameButtonNum then
  8693. DATA.Enemy.hasFlag = fullname
  8694. return
  8695. end
  8696. end
  8697. end
  8698. return
  8699. end
  8700. end
  8701. -- ---
  8702. -- -------------------------------------------------------------------------
  8703. elseif strmatch(message, FLG["WG_TP_DG_MATCH_CAPTURED"]) then -- Warsong Gulch & Twin Peaks: flag was captured
  8704. for i = 1, currentSize do
  8705. GVAR.FriendButton[i].FlagTexture:SetAlpha(0)
  8706. GVAR.FriendButton[i].FlagDebuff:SetText("")
  8707. GVAR.EnemyButton[i].FlagTexture:SetAlpha(0)
  8708. GVAR.EnemyButton[i].FlagDebuff:SetText("")
  8709. end
  8710. DATA.Friend.hasFlag = nil
  8711. DATA.Enemy.hasFlag = nil
  8712. flagDebuff = 0
  8713. flags = 0
  8714. if flagCHK then
  8715. BattlegroundTargets:CheckFlagCarrierEND()
  8716. end
  8717. -- -------------------------------------------------------------------------
  8718. elseif strmatch(message, FLG["WG_TP_DG_MATCH_DROPPED"]) then -- Warsong Gulch & Twin Peaks: flag was dropped
  8719. for i = 1, currentSize do
  8720. GVAR.EnemyButton[i].FlagTexture:SetAlpha(0)
  8721. GVAR.EnemyButton[i].FlagDebuff:SetText("")
  8722. end
  8723. DATA.Enemy.hasFlag = nil
  8724. flags = flags - 1
  8725. if flags <= 0 then
  8726. flagDebuff = 0
  8727. flags = 0
  8728. end
  8729. end
  8730. -- -----------------------------------------------------------------------------------------------------------------
  8731. end
  8732. end
  8733. -- ---------------------------------------------------------------------------------------------------------------------
  8734.  
  8735. -- Eye of the Storm ----------------------------------------------------------------------------------------------------
  8736. function BattlegroundTargets:Carrier_EOTS(message, messageFaction)
  8737. local BattlegroundTargets_Options = BattlegroundTargets_Options
  8738.  
  8739. -- ---------------------------------------------------------------------------
  8740. if message == FLG["EOTS_STRING_DROPPED"] or -- Eye of the Storm: flag was dropped
  8741. strmatch(message, FLG["EOTS_PATTERN_CAPTURED"]) -- Eye of the Storm: flag was captured
  8742. then
  8743. if BattlegroundTargets_Options.Friend.EnableBracket[currentSize] then
  8744. for i = 1, currentSize do
  8745. GVAR.FriendButton[i].FlagTexture:SetAlpha(0)
  8746. GVAR.FriendButton[i].FlagDebuff:SetText("")
  8747. end
  8748. DATA.Friend.hasFlag = nil
  8749. end
  8750. if BattlegroundTargets_Options.Enemy.EnableBracket[currentSize] then
  8751. for i = 1, currentSize do
  8752. GVAR.EnemyButton[i].FlagTexture:SetAlpha(0)
  8753. GVAR.EnemyButton[i].FlagDebuff:SetText("")
  8754. end
  8755. DATA.Enemy.hasFlag = nil
  8756. end
  8757. flagDebuff = 0
  8758. if flagCHK then
  8759. BattlegroundTargets:CheckFlagCarrierEND()
  8760. end
  8761. return
  8762. end
  8763.  
  8764. local flagcarrier = strmatch(message, FLG["EOTS_PATTERN_PICKED"]) -- Eye of the Storm: flag was picked
  8765. if flagcarrier then
  8766.  
  8767. if flagCHK then
  8768. BattlegroundTargets:CheckFlagCarrierEND()
  8769. end
  8770.  
  8771. for frc = 1, #FRAMES do
  8772. local side = FRAMES[frc]
  8773. -- -----
  8774. if BattlegroundTargets_Options[side].EnableBracket[currentSize] then
  8775. local button = GVAR[side.."Button"]
  8776. for i = 1, currentSize do
  8777. button[i].FlagTexture:SetAlpha(0)
  8778. button[i].FlagDebuff:SetText("")
  8779. end
  8780.  
  8781. -- 1.) check for name-server
  8782. for fullname, fullnameButtonNum in pairs(DATA[side].Name2Button) do -- DATA[side].Name2Button and DATA[side].Name4Flag have same buttonNum
  8783. if fullname == flagcarrier then
  8784. local button = GVAR[side.."Button"][fullnameButtonNum]
  8785. if button then
  8786. button.FlagTexture:SetAlpha(1)
  8787. BattlegroundTargets:SetFlagDebuff(button, flagDebuff)
  8788. DATA[side].hasFlag = fullname
  8789. return
  8790. end
  8791. return
  8792. end
  8793. end
  8794. -- 2.) check for name only
  8795. for name, buttonNum in pairs(DATA[side].Name4Flag) do
  8796. if name == flagcarrier then
  8797. local button = GVAR[side.."Button"][buttonNum]
  8798. if button then
  8799. button.FlagTexture:SetAlpha(1)
  8800. BattlegroundTargets:SetFlagDebuff(button, flagDebuff)
  8801. for fullname, fullnameButtonNum in pairs(DATA[side].Name2Button) do -- DATA[side].Name2Button and DATA[side].Name4Flag have same buttonNum
  8802. if buttonNum == fullnameButtonNum then
  8803. DATA[side].hasFlag = fullname
  8804. return
  8805. end
  8806. end
  8807. end
  8808. return
  8809. end
  8810. end
  8811. end
  8812. -- -----
  8813. end
  8814.  
  8815. end
  8816. end
  8817. -- ---------------------------------------------------------------------------------------------------------------------
  8818.  
  8819. -- Deepwind Gorge ------------------------------------------------------------------------------------------------------
  8820. function BattlegroundTargets:Carrier_DG(message, messageFaction)
  8821. local side = "Enemy"
  8822. if messageFaction == playerFactionBG then
  8823. side = "Friend"
  8824. end
  8825.  
  8826. local BattlegroundTargets_Options = BattlegroundTargets_Options
  8827. if not BattlegroundTargets_Options[side].EnableBracket[currentSize] then return end
  8828.  
  8829. -- -------------------------------------------------------------------------
  8830. if strmatch(message, FLG["WG_TP_DG_MATCH_DROPPED"]) or -- Deepwind Gorge: flag dropped
  8831. strmatch(message, FLG["WG_TP_DG_MATCH_CAPTURED"]) -- Deepwind Gorge: flag captured
  8832. then
  8833. local button = GVAR[side.."Button"]
  8834. for i = 1, currentSize do
  8835. button[i].FlagTexture:SetAlpha(0)
  8836. button[i].FlagDebuff:SetText("")
  8837. end
  8838. DATA[side].hasFlag = nil
  8839. flags = flags - 1
  8840. if flags <= 0 then
  8841. flagDebuff = 0
  8842. flags = 0
  8843. end
  8844. if flagCHK then
  8845. BattlegroundTargets:CheckFlagCarrierEND()
  8846. end
  8847. -- -------------------------------------------------------------------------
  8848. else
  8849. -- -------------------------------------------------------------------------
  8850. local flagcarrier = strmatch(message, FLG["WG_TP_DG_PATTERN_PICKED1"]) or -- Deepwind Gorge: flag picked
  8851. strmatch(message, FLG["WG_TP_DG_PATTERN_PICKED2"]) -- Deepwind Gorge: flag picked
  8852. if flagcarrier then
  8853. flags = flags + 1
  8854. local button = GVAR[side.."Button"]
  8855. for i = 1, currentSize do
  8856. button[i].FlagTexture:SetAlpha(0)
  8857. button[i].FlagDebuff:SetText("")
  8858. end
  8859. if flagCHK then
  8860. BattlegroundTargets:CheckFlagCarrierEND()
  8861. end
  8862. -- 1.) check for name-server
  8863. for fullname, fullnameButtonNum in pairs(DATA[side].Name2Button) do -- DATA[side].Name2Button and DATA[side].Name4Flag have same buttonNum
  8864. if fullname == flagcarrier then
  8865. local button = GVAR[side.."Button"][fullnameButtonNum]
  8866. if button then
  8867. button.FlagTexture:SetAlpha(1)
  8868. button.FlagDebuff:SetText("")
  8869. DATA[side].hasFlag = fullname
  8870. return
  8871. end
  8872. return
  8873. end
  8874. end
  8875. -- 2.) check for name only
  8876. for name, buttonNum in pairs(DATA[side].Name4Flag) do
  8877. if name == flagcarrier then
  8878. local button = GVAR[side.."Button"][buttonNum]
  8879. if button then
  8880. button.FlagTexture:SetAlpha(1)
  8881. button.FlagDebuff:SetText("")
  8882. for fullname, fullnameButtonNum in pairs(DATA[side].Name2Button) do -- DATA[side].Name2Button and DATA[side].Name4Flag have same buttonNum
  8883. if buttonNum == fullnameButtonNum then
  8884. DATA[side].hasFlag = fullname
  8885. return
  8886. end
  8887. end
  8888. end
  8889. return
  8890. end
  8891. end
  8892. -- ---
  8893. end
  8894. end
  8895. -- -------------------------------------------------------------------------
  8896. end
  8897. -- ---------------------------------------------------------------------------------------------------------------------
  8898.  
  8899. -- Temple of Kotmogu ---------------------------------------------------------------------------------------------------
  8900. function BattlegroundTargets:Carrier_TOK(message, messageFaction)
  8901. local side = "Enemy"
  8902. if messageFaction == playerFactionBG then
  8903. side = "Friend"
  8904. end
  8905.  
  8906. local BattlegroundTargets_Options = BattlegroundTargets_Options
  8907. if not BattlegroundTargets_Options[side].EnableBracket[currentSize] then return end
  8908.  
  8909. -- -------------------------------------------------------------------------
  8910. local orbCarrier, orbColor = strmatch(message, FLG["TOK_PATTERN_TAKEN"]) -- Temple of Kotmogu: orb was taken
  8911. if orbCarrier and orbColor then
  8912. local color, texture = orbData(orbColor)
  8913. --print("orb taken", side, orbCarrier, orbColor, color)
  8914. wipe(hasOrb[color])
  8915. flags = flags + 1 -- FLAG_TOK_CHK
  8916. if flagCHK and flags >= totalFlags[isFlagBG] then
  8917. BattlegroundTargets:CheckFlagCarrierEND()
  8918. end
  8919. local button = GVAR[side.."Button"]
  8920. for i = 1, currentSize do
  8921. if button[i].orbColor == color then
  8922. button[i].orbColor = nil
  8923. button[i].FlagTexture:SetAlpha(0)
  8924. button[i].FlagDebuff:SetText("")
  8925. button[i].OrbCornerTL:SetAlpha(0)
  8926. button[i].OrbCornerTR:SetAlpha(0)
  8927. button[i].OrbCornerBL:SetAlpha(0)
  8928. button[i].OrbCornerBR:SetAlpha(0)
  8929. break
  8930. end
  8931. end
  8932. -- 1.) check for name-server
  8933. for fullname, fullnameButtonNum in pairs(DATA[side].Name2Button) do -- DATA[side].Name2Button and DATA[side].Name4Flag have same buttonNum
  8934. if fullname == orbCarrier then
  8935. local button = GVAR[side.."Button"][fullnameButtonNum]
  8936. if button then
  8937.  
  8938. local unitID = DATA.Friend.Name2UnitID[ fullname ]
  8939. if unitID then
  8940. BattlegroundTargets:CarrierDebuffCheck("Friend", button, unitID, fullname)
  8941. else
  8942. button.orbColor = color
  8943. button.FlagTexture:SetAlpha(1)
  8944. button.FlagTexture:SetTexture(texture)
  8945. BattlegroundTargets:SetFlagDebuff(button, hasOrb[ color ].orbval)
  8946. BattlegroundTargets:SetOrbCorner(button, color)
  8947. hasOrb[color].name = fullname
  8948. end
  8949. return
  8950.  
  8951. end
  8952. return
  8953. end
  8954. end
  8955. -- 2.) check for name only
  8956. for name, buttonNum in pairs(DATA[side].Name4Flag) do
  8957. if name == orbCarrier then
  8958. local button = GVAR[side.."Button"][buttonNum]
  8959. if button then
  8960.  
  8961. for fullname, fullnameButtonNum in pairs(DATA[side].Name2Button) do -- DATA[side].Name2Button and DATA[side].Name4Flag have same buttonNum
  8962. if buttonNum == fullnameButtonNum then
  8963.  
  8964. local unitID = DATA.Friend.Name2UnitID[ fullname ]
  8965. if unitID then
  8966. BattlegroundTargets:CarrierDebuffCheck("Friend", button, unitID, fullname)
  8967. else
  8968. button.orbColor = color
  8969. button.FlagTexture:SetAlpha(1)
  8970. button.FlagTexture:SetTexture(texture)
  8971. BattlegroundTargets:SetFlagDebuff(button, hasOrb[ color ].orbval)
  8972. BattlegroundTargets:SetOrbCorner(button, color)
  8973. hasOrb[color].name = fullname
  8974. end
  8975. return
  8976.  
  8977. end
  8978. end
  8979.  
  8980. end
  8981. return
  8982. end
  8983. end
  8984. -- ---
  8985. end
  8986. -- -------------------------------------------------------------------------
  8987. end
  8988. -- ---------------------------------------------------------------------------------------------------------------------
  8989.  
  8990.  
  8991.  
  8992. -- ---------------------------------------------------------------------------------------------------------------------
  8993. function BattlegroundTargets:UpdateAllPvPTrinkets(force) -- pvp_trinket_
  8994. local curTime = GetTime()
  8995. if not force and curTime < BattlegroundTargets.pvptrinketTimer + pvptrinketFrequency then
  8996. return
  8997. end
  8998.  
  8999. --[[ _TIMER_
  9000. local dif = curTime - BattlegroundTargets.pvptrinketTimer
  9001. print("pVptrinket:", dif)
  9002. --]]
  9003.  
  9004. BattlegroundTargets.pvptrinketTimer = curTime
  9005.  
  9006. local BattlegroundTargets_Options = BattlegroundTargets_Options
  9007. for frc = 1, #FRAMES do
  9008. local side = FRAMES[frc]
  9009. if BattlegroundTargets_Options[side].EnableBracket[currentSize] and
  9010. BattlegroundTargets_Options[side].ButtonPvPTrinketToggle[currentSize]
  9011. then
  9012. local button = GVAR[side.."Button"]
  9013. for i = 1, currentSize do
  9014. if DATA[side].MainData[i] then
  9015. BattlegroundTargets:UpdatePvPTrinket(button[i], DATA[side].MainData[i].name, curTime)
  9016. end
  9017. end
  9018. end
  9019. end
  9020. end
  9021. -- ---------------------------------------------------------------------------------------------------------------------
  9022.  
  9023. -- ---------------------------------------------------------------------------------------------------------------------
  9024. function BattlegroundTargets:UpdatePvPTrinket(button, unitName, curTime) -- pvp_trinket_
  9025. if DATA.PvPTrinketEndTime[unitName] then
  9026. local trinketTime = floor(DATA.PvPTrinketEndTime[unitName] - curTime)
  9027. if trinketTime > 0 then
  9028.  
  9029. --icon change
  9030. --print (button, unitName, curTime ,DATA.PvPTrinketId[unitName] )
  9031. local id = DATA.PvPTrinketId[unitName]
  9032. if not isLowLevel then
  9033. if id == 195710 or --lowlevel
  9034. id == 208683 then --pvptrinkettalent
  9035. button.PVPTrinketTexture:SetTexture( GetSpellTexture(id) )
  9036. end
  9037. end
  9038.  
  9039.  
  9040. button.PVPTrinketTexture:SetAlpha(1)
  9041. button.PVPTrinketTxt:SetText(trinketTime)
  9042. else
  9043. DATA.PvPTrinketEndTime[unitName] = nil
  9044. if DATA.PvPTrinketId[unitName] == 214027 then
  9045. button.PVPTrinketTexture:SetAlpha(0.3)
  9046. else
  9047. button.PVPTrinketTexture:SetAlpha(0)
  9048. end
  9049. button.PVPTrinketTxt:SetText("")
  9050. end
  9051. else
  9052. if DATA.PvPTrinketId[unitName] == 214027 then
  9053. button.PVPTrinketTexture:SetAlpha(0.3)
  9054. else
  9055. button.PVPTrinketTexture:SetAlpha(0)
  9056. end
  9057. button.PVPTrinketTxt:SetText("")
  9058. end
  9059. end
  9060. -- ---------------------------------------------------------------------------------------------------------------------
  9061.  
  9062. -- ---------------------------------------------------------------------------------------------------------------------
  9063. local function CombatLogPVPTrinketCheck(clEvent, spellId, sourceName) -- pvp_trinket_
  9064. if pvptrinketIDs[spellId] and clEvent == "SPELL_CAST_SUCCESS" then
  9065. --print("cl trinket:", clEvent, spellId, sourceName)
  9066. -- --------------------
  9067. local enemyButton = GVAR.EnemyButton[ DATA.Enemy.Name2Button[sourceName] ]
  9068. if enemyButton then
  9069. local BattlegroundTargets_Options = BattlegroundTargets_Options
  9070. if BattlegroundTargets_Options.Enemy.EnableBracket[currentSize] and
  9071. BattlegroundTargets_Options.Enemy.ButtonPvPTrinketToggle[currentSize]
  9072. then
  9073. local curTime = GetTime()
  9074. DATA.PvPTrinketEndTime[sourceName] = floor(curTime + pvptrinketIDs[spellId])
  9075. DATA.PvPTrinketId[sourceName] = spellId
  9076. BattlegroundTargets:UpdatePvPTrinket(enemyButton, sourceName, curTime)
  9077. end
  9078. return
  9079. end
  9080. -- --------------------
  9081. local friendButton = GVAR.FriendButton[ DATA.Friend.Name2Button[sourceName] ]
  9082. if friendButton then
  9083. local BattlegroundTargets_Options = BattlegroundTargets_Options
  9084. if BattlegroundTargets_Options.Friend.EnableBracket[currentSize] and
  9085. BattlegroundTargets_Options.Friend.ButtonPvPTrinketToggle[currentSize]
  9086. then
  9087. local curTime = GetTime()
  9088. DATA.PvPTrinketEndTime[sourceName] = floor(curTime + pvptrinketIDs[spellId])
  9089. DATA.PvPTrinketId[sourceName] = spellId
  9090. BattlegroundTargets:UpdatePvPTrinket(friendButton, sourceName, curTime)
  9091. end
  9092. end
  9093. -- --------------------
  9094. end
  9095. end
  9096. -- ---------------------------------------------------------------------------------------------------------------------
  9097.  
  9098.  
  9099.  
  9100. -- ---------------------------------------------------------------------------------------------------------------------
  9101. local function range_check(side, unitID)
  9102. if DATA[side].rangeSpellName then
  9103. if IsSpellInRange(DATA[side].rangeSpellName, unitID) == 1 then
  9104. return DATA[side].rangeMax
  9105. end
  9106. else
  9107. if UnitInCheckedRange(unitID) then
  9108. return 40 -- inDefaultRange
  9109. elseif CheckInteractDistance(unitID, 3) then -- 3: Duel = 9.9 -- ?11/35? TODO_CHK
  9110. return 10
  9111. elseif CheckInteractDistance(unitID, 1) then -- 1: Inspect = 28 -- ?11/35? TODO_CHK
  9112. return 28
  9113. end
  9114. end
  9115. return false
  9116. end
  9117.  
  9118. local function clrc_idcheck(button, name) -- name is always enemy
  9119. for tcnSourceName, tcnTargetName in pairs(DATA.TargetCountNames) do -- TC_DEFDEL_same -- search target count for source name
  9120. if name == tcnTargetName then
  9121. local targetID = DATA.TargetCountTargetID[tcnSourceName] -- TC_DEFDEL_same -- target id is never nil
  9122. local isRange = range_check("Enemy", targetID)
  9123. if isRange then
  9124. DATA.Enemy.Name2Range[name] = isRange
  9125. BattlegroundTargets:Range_Display(true, button, isRange)
  9126. return true
  9127. else
  9128. DATA.Enemy.Name2Range[name] = nil
  9129. BattlegroundTargets:Range_Display(false, button, nil, BattlegroundTargets_Options.Enemy.ButtonRangeDisplay[currentSize])
  9130. end
  9131. return false
  9132. end
  9133. end
  9134. end
  9135.  
  9136. local function CombatLogRangeCheck(sourceName, destName, spellId)
  9137. if not SPELL_Range[spellId] then
  9138. local _, _, _, _, _, maxRange = GetSpellInfo(spellId)
  9139. if not maxRange then return end
  9140. SPELL_Range[spellId] = maxRange
  9141. end
  9142.  
  9143. --print("INPUT_NAME_CHECK: _CL_", sourceName, destName, spellId, "range:", SPELL_Range[spellId])
  9144.  
  9145. if DATA.Friend.Name2Button[ sourceName ] and DATA.Friend.Name2Button[ destName ] then return end
  9146.  
  9147. local isMatch
  9148.  
  9149. local sourceButton = GVAR.EnemyButton[ DATA.Enemy.Name2Button[sourceName] ]
  9150. -- source is enemy ----------------------------------------
  9151. if sourceButton then
  9152. while true do
  9153. if DATA.Enemy.Name2Percent[sourceName] == 0 then
  9154. DATA.Enemy.Name2Range[sourceName] = nil
  9155. BattlegroundTargets:Range_Display(false, sourceButton, nil, BattlegroundTargets_Options.Enemy.ButtonRangeDisplay[currentSize])
  9156. break--while_break
  9157. end
  9158.  
  9159. local curTime = GetTime()
  9160. if curTime < sourceButton.rangeTimer + rangeFrequency then
  9161. break--while_break
  9162. end
  9163.  
  9164. --[[ _TIMER_
  9165. local dif = curTime - sourceButton.rangeTimer
  9166. print("rAngecheck:", "Enemy", sourceName, sourceButton.buttonNum, "#", dif, "#", SPELL_Range[spellId], "CLrange: _sourceButton_")
  9167. --]]
  9168.  
  9169. sourceButton.rangeTimer = curTime
  9170.  
  9171. -- --------------------------------------------- BEGIN
  9172. -- source: enemy | dest: playerName
  9173. if destName == playerName then
  9174. isMatch = true
  9175. if SPELL_Range[spellId] <= 40 then -- inDefaultRange
  9176. DATA.Enemy.Name2Range[sourceName] = SPELL_Range[spellId]
  9177. BattlegroundTargets:Range_Display(true, sourceButton, DATA.Enemy.Name2Range[sourceName])
  9178. else
  9179. DATA.Enemy.Name2Range[sourceName] = nil
  9180. BattlegroundTargets:Range_Display(false, sourceButton, nil, BattlegroundTargets_Options.Enemy.ButtonRangeDisplay[currentSize])
  9181. end
  9182. -- --------------------------------------------- END
  9183.  
  9184. -- --------------------------------------------- BEGIN
  9185. -- source: enemy | dest: friend
  9186. elseif DATA.Friend.Name2Button[destName] then
  9187. isMatch = true
  9188. local is = clrc_idcheck(sourceButton, sourceName)
  9189. if is then
  9190. break--while_break
  9191. end
  9192. local friendID = DATA.Friend.Name2UnitID[destName]
  9193. if friendID and SPELL_Range[spellId] <= 40 then -- inDefaultRange +
  9194. local isRange = range_check("Friend", friendID)
  9195. if isRange then
  9196. DATA.Enemy.Name2Range[sourceName] = SPELL_Range[spellId] + isRange
  9197. BattlegroundTargets:Range_Display(true, sourceButton, DATA.Enemy.Name2Range[sourceName])
  9198. break--while_break
  9199. end
  9200. end
  9201. DATA.Enemy.Name2Range[sourceName] = nil
  9202. BattlegroundTargets:Range_Display(false, sourceButton, nil, BattlegroundTargets_Options.Enemy.ButtonRangeDisplay[currentSize])
  9203. -- --------------------------------------------- END
  9204.  
  9205. -- --------------------------------------------- BEGIN
  9206. -- source: enemy | dest: enemy
  9207. elseif DATA.Enemy.Name2Button[destName] then
  9208. isMatch = true
  9209. clrc_idcheck(sourceButton, sourceName)
  9210. clrc_idcheck(sourceButton, destName)
  9211. -- --------------------------------------------- END
  9212. end
  9213. break--while_break
  9214. end
  9215. end
  9216. -- source is enemy ----------------------------------------
  9217.  
  9218. if isMatch then return end
  9219.  
  9220. local destButton = GVAR.EnemyButton[ DATA.Enemy.Name2Button[destName] ]
  9221. -- dest is enemy ----------------------------------------
  9222. if destButton then
  9223.  
  9224. if DATA.Enemy.Name2Percent[destName] == 0 then
  9225. DATA.Enemy.Name2Range[destName] = nil
  9226. BattlegroundTargets:Range_Display(false, destButton, nil, BattlegroundTargets_Options.Enemy.ButtonRangeDisplay[currentSize])
  9227. return
  9228. end
  9229.  
  9230. local curTime = GetTime()
  9231. if curTime < destButton.rangeTimer + rangeFrequency then
  9232. return
  9233. end
  9234.  
  9235. --[[ _TIMER_
  9236. local dif = curTime - destButton.rangeTimer
  9237. print("rAngecheck:", "Enemy", destName, destButton.buttonNum, "#", dif, "#", SPELL_Range[spellId], "CLrange: _destButton_")
  9238. --]]
  9239.  
  9240. destButton.rangeTimer = curTime
  9241.  
  9242. -- --------------------------------------------- BEGIN
  9243. -- dest: enemy | source: playerName
  9244. if sourceName == playerName then
  9245. if SPELL_Range[spellId] <= 40 then -- inDefaultRange
  9246. DATA.Enemy.Name2Range[destName] = SPELL_Range[spellId]
  9247. BattlegroundTargets:Range_Display(true, destButton, DATA.Enemy.Name2Range[destName])
  9248. else
  9249. DATA.Enemy.Name2Range[destName] = nil
  9250. BattlegroundTargets:Range_Display(false, destButton, nil, BattlegroundTargets_Options.Enemy.ButtonRangeDisplay[currentSize])
  9251. end
  9252. -- --------------------------------------------- END
  9253.  
  9254. -- --------------------------------------------- BEGIN
  9255. -- dest: enemy | source: friend
  9256. elseif DATA.Friend.Name2Button[sourceName] then
  9257. clrc_idcheck(destButton, destName)
  9258. -- --------------------------------------------- END
  9259. end
  9260.  
  9261. end
  9262. -- dest is enemy ----------------------------------------
  9263. end
  9264. -- ---------------------------------------------------------------------------------------------------------------------
  9265.  
  9266. -- ---------------------------------------------------------------------------------------------------------------------
  9267. function BattlegroundTargets:CheckClassRange(side, button, unitID, unitName, caller) -- class_range_
  9268. local curTime = GetTime()
  9269. if curTime < button.rangeTimer + rangeFrequency then
  9270. return
  9271. end
  9272.  
  9273. if unitName == playerName then return end
  9274.  
  9275. local BattlegroundTargets_Options = BattlegroundTargets_Options
  9276. if not BattlegroundTargets_Options[side].ButtonRangeToggle[currentSize] then return end
  9277.  
  9278. --[[ _TIMER_
  9279. local dif = curTime - button.rangeTimer
  9280. print("rAngecheck:", side, unitName, button.buttonNum, "#", dif, "#", unitID, IsSpellInRange(DATA[side].rangeSpellName, unitID), "classrange", caller)
  9281. --]]
  9282.  
  9283. button.rangeTimer = curTime
  9284.  
  9285. local isRange = range_check(side, unitID)
  9286. if isRange then
  9287. DATA[side].Name2Range[unitName] = isRange
  9288. BattlegroundTargets:Range_Display(true, button, isRange)
  9289. else
  9290. DATA[side].Name2Range[unitName] = nil
  9291. BattlegroundTargets:Range_Display(false, button, nil, BattlegroundTargets_Options[side].ButtonRangeDisplay[currentSize])
  9292. end
  9293. end
  9294. -- ---------------------------------------------------------------------------------------------------------------------
  9295.  
  9296. -- ---------------------------------------------------------------------------------------------------------------------
  9297. function BattlegroundTargets:UpdateRange(side, curTime)
  9298. local BattlegroundTargets_Options = BattlegroundTargets_Options
  9299. local ButtonRangeDisplay = BattlegroundTargets_Options[side].ButtonRangeDisplay[currentSize]
  9300. local button = GVAR[side.."Button"]
  9301. for i = 1, currentSize do
  9302. if DATA[side].MainData[i] then
  9303. local name = DATA[side].MainData[i].name
  9304. if name == playerName then
  9305. BattlegroundTargets:Range_Display(true, button[i], nil)
  9306. elseif DATA[side].Name2Range[name] then
  9307. BattlegroundTargets:Range_Display(true, button[i], DATA[side].Name2Range[name])
  9308. else
  9309. DATA[side].Name2Range[name] = nil
  9310. BattlegroundTargets:Range_Display(false, button[i], nil, ButtonRangeDisplay)
  9311. end
  9312. end
  9313. end
  9314. end
  9315. -- ---------------------------------------------------------------------------------------------------------------------
  9316.  
  9317. -- ---------------------------------------------------------------------------------------------------------------------
  9318. function BattlegroundTargets:ClearRangeData(side)
  9319. local BattlegroundTargets_Options = BattlegroundTargets_Options
  9320. if not BattlegroundTargets_Options[side].ButtonRangeToggle[currentSize] then return end
  9321. wipe(DATA[side].Name2Range)
  9322. local ButtonRangeDisplay = BattlegroundTargets_Options[side].ButtonRangeDisplay[currentSize]
  9323. local button = GVAR[side.."Button"]
  9324. for i = 1, currentSize do
  9325. if DATA[side].MainData[i] then
  9326. if DATA[side].MainData[i].name == playerName then
  9327. BattlegroundTargets:Range_Display(true, button[i], nil)
  9328. else
  9329. BattlegroundTargets:Range_Display(false, button[i], nil, ButtonRangeDisplay)
  9330. end
  9331. end
  9332. end
  9333. end
  9334. -- ---------------------------------------------------------------------------------------------------------------------
  9335.  
  9336. -- ---------------------------------------------------------------------------------------------------------------------
  9337. function BattlegroundTargets:Range_Display(state, button, distance, display) -- RANGE_DISP_LAY
  9338. if state then
  9339. if distance and distance > 0 and distance ~= 40 then -- inDefaultRange
  9340. --print("range_display:", distance)
  9341. button.RangeTxt:SetText(distance)
  9342. else
  9343. button.RangeTxt:SetText("")
  9344. end
  9345. button.BackgroundX:SetAlpha(1)
  9346. button.TargetCountBackground:SetAlpha(1)
  9347. button.ClassColorBackground:SetAlpha(1)
  9348. button.RangeTexture:SetAlpha(1)
  9349. button.HealthBar:SetAlpha(1)
  9350. button.RoleTexture:SetAlpha(1)
  9351. button.SpecTexture:SetAlpha(1)
  9352. button.ClassTexture:SetAlpha(1)
  9353. button.ClassColorBackground:SetColorTexture(button.colR5, button.colG5, button.colB5, 1)
  9354. button.HealthBar:SetColorTexture(button.colR, button.colG, button.colB, 1)
  9355. elseif display == 1 then -- STD 100
  9356. button.RangeTxt:SetText("")
  9357. button.BackgroundX:SetAlpha(1)
  9358. button.TargetCountBackground:SetAlpha(1)
  9359. button.ClassColorBackground:SetAlpha(1)
  9360. button.RangeTexture:SetAlpha(0)
  9361. button.HealthBar:SetAlpha(1)
  9362. button.RoleTexture:SetAlpha(1)
  9363. button.SpecTexture:SetAlpha(1)
  9364. button.ClassTexture:SetAlpha(1)
  9365. elseif display == 2 then -- STD 50
  9366. button.RangeTxt:SetText("")
  9367. button.BackgroundX:SetAlpha(0.5)
  9368. button.TargetCountBackground:SetAlpha(0.1)
  9369. button.ClassColorBackground:SetAlpha(0.5)
  9370. button.RangeTexture:SetAlpha(0)
  9371. button.HealthBar:SetAlpha(0.5)
  9372. button.RoleTexture:SetAlpha(0.5)
  9373. button.SpecTexture:SetAlpha(0.5)
  9374. button.ClassTexture:SetAlpha(0.5)
  9375. elseif display == 3 then -- STD 10
  9376. button.RangeTxt:SetText("")
  9377. button.BackgroundX:SetAlpha(0.3)
  9378. button.TargetCountBackground:SetAlpha(0.1)
  9379. button.ClassColorBackground:SetAlpha(0.25)
  9380. button.RangeTexture:SetAlpha(0)
  9381. button.HealthBar:SetAlpha(0.1)
  9382. button.RoleTexture:SetAlpha(0.25)
  9383. button.SpecTexture:SetAlpha(0.25)
  9384. button.ClassTexture:SetAlpha(0.25)
  9385. elseif display == 4 then -- STD 100 mono
  9386. button.RangeTxt:SetText("")
  9387. button.BackgroundX:SetAlpha(1)
  9388. button.TargetCountBackground:SetAlpha(1)
  9389. button.ClassColorBackground:SetAlpha(1)
  9390. button.RangeTexture:SetAlpha(0)
  9391. button.HealthBar:SetAlpha(1)
  9392. button.RoleTexture:SetAlpha(1)
  9393. button.SpecTexture:SetAlpha(1)
  9394. button.ClassTexture:SetAlpha(1)
  9395. button.ClassColorBackground:SetColorTexture(0.2, 0.2, 0.2, 1)
  9396. button.HealthBar:SetColorTexture(0.4, 0.4, 0.4, 1)
  9397. elseif display == 5 then -- STD 50 mono
  9398. button.RangeTxt:SetText("")
  9399. button.BackgroundX:SetAlpha(0.5)
  9400. button.TargetCountBackground:SetAlpha(0.1)
  9401. button.ClassColorBackground:SetAlpha(0.5)
  9402. button.RangeTexture:SetAlpha(0)
  9403. button.HealthBar:SetAlpha(0.5)
  9404. button.RoleTexture:SetAlpha(0.5)
  9405. button.SpecTexture:SetAlpha(0.5)
  9406. button.ClassTexture:SetAlpha(0.5)
  9407. button.ClassColorBackground:SetColorTexture(0.2, 0.2, 0.2, 1)
  9408. button.HealthBar:SetColorTexture(0.4, 0.4, 0.4, 1)
  9409. elseif display == 6 then -- STD 10 mono
  9410. button.RangeTxt:SetText("")
  9411. button.BackgroundX:SetAlpha(0.3)
  9412. button.TargetCountBackground:SetAlpha(0.1)
  9413. button.ClassColorBackground:SetAlpha(0.25)
  9414. button.RangeTexture:SetAlpha(0)
  9415. button.HealthBar:SetAlpha(0.1)
  9416. button.RoleTexture:SetAlpha(0.25)
  9417. button.SpecTexture:SetAlpha(0.25)
  9418. button.ClassTexture:SetAlpha(0.25)
  9419. button.ClassColorBackground:SetColorTexture(0.2, 0.2, 0.2, 1)
  9420. button.HealthBar:SetColorTexture(0.4, 0.4, 0.4, 1)
  9421. elseif display == 7 then -- X 10
  9422. button.RangeTxt:SetText("")
  9423. button.BackgroundX:SetAlpha(0.3)
  9424. button.TargetCountBackground:SetAlpha(0.1)
  9425. button.ClassColorBackground:SetAlpha(0.25)
  9426. button.RangeTexture:SetAlpha(0)
  9427. button.HealthBar:SetAlpha(0.1)
  9428. button.RoleTexture:SetAlpha(0.25)
  9429. button.SpecTexture:SetAlpha(0.25)
  9430. button.ClassTexture:SetAlpha(0.25)
  9431. elseif display == 8 then -- X 100 mono
  9432. button.RangeTxt:SetText("")
  9433. button.BackgroundX:SetAlpha(1)
  9434. button.TargetCountBackground:SetAlpha(1)
  9435. button.ClassColorBackground:SetAlpha(1)
  9436. button.RangeTexture:SetAlpha(0)
  9437. button.HealthBar:SetAlpha(1)
  9438. button.RoleTexture:SetAlpha(1)
  9439. button.SpecTexture:SetAlpha(1)
  9440. button.ClassTexture:SetAlpha(1)
  9441. button.ClassColorBackground:SetColorTexture(0.2, 0.2, 0.2, 1)
  9442. button.HealthBar:SetColorTexture(0.4, 0.4, 0.4, 1)
  9443. elseif display == 9 then -- X 50 mono
  9444. button.RangeTxt:SetText("")
  9445. button.BackgroundX:SetAlpha(0.5)
  9446. button.TargetCountBackground:SetAlpha(0.1)
  9447. button.ClassColorBackground:SetAlpha(0.5)
  9448. button.RangeTexture:SetAlpha(0)
  9449. button.HealthBar:SetAlpha(0.5)
  9450. button.RoleTexture:SetAlpha(0.5)
  9451. button.SpecTexture:SetAlpha(0.5)
  9452. button.ClassTexture:SetAlpha(0.5)
  9453. button.ClassColorBackground:SetColorTexture(0.2, 0.2, 0.2, 1)
  9454. button.HealthBar:SetColorTexture(0.4, 0.4, 0.4, 1)
  9455. else--if display == 10 then -- X 10 mono
  9456. button.RangeTxt:SetText("")
  9457. button.BackgroundX:SetAlpha(0.3)
  9458. button.TargetCountBackground:SetAlpha(0.1)
  9459. button.ClassColorBackground:SetAlpha(0.25)
  9460. button.RangeTexture:SetAlpha(0)
  9461. button.HealthBar:SetAlpha(0.1)
  9462. button.RoleTexture:SetAlpha(0.25)
  9463. button.SpecTexture:SetAlpha(0.25)
  9464. button.ClassTexture:SetAlpha(0.25)
  9465. button.ClassColorBackground:SetColorTexture(0.2, 0.2, 0.2, 1)
  9466. button.HealthBar:SetColorTexture(0.4, 0.4, 0.4, 1)
  9467. end
  9468. end
  9469. -- ---------------------------------------------------------------------------------------------------------------------
  9470.  
  9471.  
  9472.  
  9473. -- ---------------------------------------------------------------------------------------------------------------------
  9474. function BattlegroundTargets:CheckPlayerLevel() -- LVLCHK
  9475. if playerLevel == maxLevel then
  9476. isLowLevel = nil
  9477. BattlegroundTargets:UnregisterEvent("PLAYER_LEVEL_UP")
  9478. elseif playerLevel < maxLevel then
  9479. isLowLevel = true
  9480. BattlegroundTargets:RegisterEvent("PLAYER_LEVEL_UP")
  9481. else--if playerLevel > maxLevel then
  9482. isLowLevel = nil
  9483. BattlegroundTargets:UnregisterEvent("PLAYER_LEVEL_UP")
  9484. Print("ERROR", "wrong level", locale, playerLevel, maxLevel)
  9485. end
  9486. end
  9487. -- ---------------------------------------------------------------------------------------------------------------------
  9488.  
  9489.  
  9490.  
  9491. -- ---------------------------------------------------------------------------------------------------------------------
  9492. function BattlegroundTargets:CheckFaction()
  9493. local faction = UnitFactionGroup("player")
  9494. if faction == "Horde" then
  9495. playerFactionDEF = 0 -- Horde
  9496. oppositeFactionDEF = 1 -- Alliance
  9497. BattlegroundTargets:UnregisterEvent("NEUTRAL_FACTION_SELECT_RESULT")
  9498. elseif faction == "Alliance" then
  9499. playerFactionDEF = 1 -- Alliance
  9500. oppositeFactionDEF = 0 -- Horde
  9501. BattlegroundTargets:UnregisterEvent("NEUTRAL_FACTION_SELECT_RESULT")
  9502. elseif faction == "Neutral" then
  9503. playerFactionDEF = 2 -- Neutral (eg.: Pandaren)
  9504. oppositeFactionDEF = 2 -- Neutral (eg.: Pandaren)
  9505. BattlegroundTargets:RegisterEvent("NEUTRAL_FACTION_SELECT_RESULT")
  9506. else
  9507. Print("ERROR", "unknown faction", locale, faction)
  9508. playerFactionDEF = 1 -- Dummy
  9509. oppositeFactionDEF = 0 -- Dummy
  9510. end
  9511. playerFactionBG = playerFactionDEF
  9512. oppositeFactionBG = oppositeFactionDEF
  9513.  
  9514. if playerFactionDEF == 0 then -- setup_flag_texture
  9515. Textures.flagTexture = "Interface\\WorldStateFrame\\HordeFlag"
  9516. Textures.cartTexture = "Interface\\Minimap\\Vehicle-SilvershardMines-MineCartRed"
  9517. if GVAR.FriendSummary and GVAR.FriendSummary.Logo1 then -- summary_flag_texture - 12 - initial reset
  9518. GVAR.FriendSummary.Logo1:SetTexture("Interface\\FriendsFrame\\PlusManz-Horde")
  9519. GVAR.EnemySummary.Logo1:SetTexture("Interface\\FriendsFrame\\PlusManz-Horde")
  9520. GVAR.FriendSummary.Logo2:SetTexture("Interface\\FriendsFrame\\PlusManz-Alliance")
  9521. GVAR.EnemySummary.Logo2:SetTexture("Interface\\FriendsFrame\\PlusManz-Alliance")
  9522. end
  9523. elseif playerFactionDEF == 1 then
  9524. Textures.flagTexture = "Interface\\WorldStateFrame\\AllianceFlag"
  9525. Textures.cartTexture = "Interface\\Minimap\\Vehicle-SilvershardMines-MineCartBlue"
  9526. if GVAR.FriendSummary and GVAR.FriendSummary.Logo1 then -- summary_flag_texture - 12 - initial reset
  9527. GVAR.FriendSummary.Logo1:SetTexture("Interface\\FriendsFrame\\PlusManz-Alliance")
  9528. GVAR.EnemySummary.Logo1:SetTexture("Interface\\FriendsFrame\\PlusManz-Alliance")
  9529. GVAR.FriendSummary.Logo2:SetTexture("Interface\\FriendsFrame\\PlusManz-Horde")
  9530. GVAR.EnemySummary.Logo2:SetTexture("Interface\\FriendsFrame\\PlusManz-Horde")
  9531. end
  9532. else
  9533. Textures.flagTexture = "Interface\\WorldStateFrame\\ColumnIcon-FlagCapture2" -- neutral_flag
  9534. Textures.cartTexture = "Interface\\Minimap\\Vehicle-SilvershardMines-MineCart" -- neutral_flag
  9535. end
  9536. end
  9537. -- ---------------------------------------------------------------------------------------------------------------------
  9538.  
  9539.  
  9540.  
  9541. -- ---------------------------------------------------------------------------------------------------------------------
  9542. function BattlegroundTargets:ClearToTButtonByName(unitName)
  9543. local BattlegroundTargets_Options = BattlegroundTargets_Options
  9544. --TODO use DATA.TargetCountNames
  9545. for frc = 1, #FRAMES do
  9546. local side = FRAMES[frc]
  9547. if BattlegroundTargets_Options[side].EnableBracket[currentSize] and
  9548. BattlegroundTargets_Options[side].ButtonToTToggle[currentSize]
  9549. then
  9550. local button = GVAR[side.."Button"]
  9551. for i = 1, currentSize do
  9552. local totdata = button[i].ToTButton.totData
  9553. if totdata and totdata.totFullName == unitName then
  9554. button[i].ToTButton.totData = nil
  9555. button[i].ToTButton:SetAlpha(0)
  9556. end
  9557. end
  9558. end
  9559. end
  9560. end
  9561. -- ---------------------------------------------------------------------------------------------------------------------
  9562.  
  9563.  
  9564.  
  9565. -- ---------------------------------------------------------------------------------------------------------------------
  9566. function BattlegroundTargets:CheckIfPlayerIsGhost(state)
  9567. if not inBattleground then return end
  9568. if not state and UnitIsGhost("player") then
  9569. isDeadUpdateStop = true
  9570.  
  9571. GVAR.FriendIsGhostTexture:Show()
  9572. GVAR.EnemyIsGhostTexture:Show()
  9573.  
  9574. BattlegroundTargets:UnregisterEvent("UPDATE_MOUSEOVER_UNIT")
  9575. BattlegroundTargets:UnregisterEvent("UNIT_TARGET")
  9576. BattlegroundTargets:UnregisterEvent("PLAYER_TARGET_CHANGED")
  9577. BattlegroundTargets:UnregisterEvent("PLAYER_FOCUS_CHANGED")
  9578.  
  9579. BattlegroundTargets:ClearRangeData("Friend")
  9580. BattlegroundTargets:ClearRangeData("Enemy")
  9581.  
  9582. --[[ TEST
  9583. Screenshot()
  9584. --]]
  9585. else
  9586. isDeadUpdateStop = false
  9587. if isConfig then return end
  9588. GVAR.FriendIsGhostTexture:Hide()
  9589. GVAR.EnemyIsGhostTexture:Hide()
  9590.  
  9591. BattlegroundTargets.targetCountTimer = 0 -- immediate update
  9592.  
  9593. BattlegroundTargets:EventRegister()
  9594. end
  9595. end
  9596. -- ---------------------------------------------------------------------------------------------------------------------
  9597.  
  9598.  
  9599.  
  9600. -- ---------------------------------------------------------------------------------------------------------------------
  9601. function BattlegroundTargets:BattlefieldScoreRequest()
  9602. local wssf = WorldStateScoreFrame
  9603. if wssf and wssf:IsShown() then
  9604. return
  9605. end
  9606. SetBattlefieldScoreFaction()
  9607. RequestBattlefieldScoreData()
  9608. end
  9609. -- ---------------------------------------------------------------------------------------------------------------------
  9610.  
  9611.  
  9612.  
  9613. -- ---------------------------------------------------------------------------------------------------------------------
  9614. function BattlegroundTargets:EventRegister(showerror)
  9615. if not inBattleground then return end
  9616.  
  9617. local BattlegroundTargets_Options = BattlegroundTargets_Options
  9618.  
  9619. if not BattlegroundTargets_Options.Friend.EnableBracket[currentSize] and
  9620. not BattlegroundTargets_Options.Enemy.EnableBracket[currentSize]
  9621. then
  9622. return
  9623. end
  9624.  
  9625. if isLowLevel then -- LVLCHK
  9626. BattlegroundTargets:RegisterEvent("UNIT_TARGET")
  9627. end
  9628.  
  9629. -- health_
  9630. if BattlegroundTargets_Options.Friend.ButtonHealthBarToggle[currentSize] or BattlegroundTargets_Options.Friend.ButtonHealthTextToggle[currentSize] or
  9631. BattlegroundTargets_Options.Enemy.ButtonHealthBarToggle[currentSize] or BattlegroundTargets_Options.Enemy.ButtonHealthTextToggle[currentSize]
  9632. then
  9633. BattlegroundTargets:RegisterEvent("UNIT_TARGET")
  9634. BattlegroundTargets:RegisterEvent("UNIT_HEALTH_FREQUENT")
  9635. BattlegroundTargets:RegisterEvent("UPDATE_MOUSEOVER_UNIT")
  9636. end
  9637.  
  9638. -- targetcount_
  9639. if BattlegroundTargets_Options.Friend.ButtonFTargetCountToggle[currentSize] or
  9640. BattlegroundTargets_Options.Friend.ButtonETargetCountToggle[currentSize] or
  9641. BattlegroundTargets_Options.Enemy.ButtonFTargetCountToggle[currentSize] or
  9642. BattlegroundTargets_Options.Enemy.ButtonETargetCountToggle[currentSize]
  9643. then
  9644. BattlegroundTargets:RegisterEvent("UNIT_TARGET")
  9645. end
  9646.  
  9647. -- targeet
  9648. if BattlegroundTargets_Options.Friend.ButtonTargetToggle[currentSize] or
  9649. BattlegroundTargets_Options.Enemy.ButtonTargetToggle[currentSize]
  9650. then
  9651. BattlegroundTargets:RegisterEvent("PLAYER_TARGET_CHANGED")
  9652. end
  9653.  
  9654. -- target_of_target
  9655. if BattlegroundTargets_Options.Friend.ButtonToTToggle[currentSize] or
  9656. BattlegroundTargets_Options.Enemy.ButtonToTToggle[currentSize]
  9657. then
  9658. BattlegroundTargets:RegisterEvent("PLAYER_TARGET_CHANGED")
  9659. BattlegroundTargets:RegisterEvent("UNIT_TARGET")
  9660. end
  9661.  
  9662. -- focus_
  9663. if BattlegroundTargets_Options.Friend.ButtonFocusToggle[currentSize] or
  9664. BattlegroundTargets_Options.Enemy.ButtonFocusToggle[currentSize]
  9665. then
  9666. BattlegroundTargets:RegisterEvent("PLAYER_FOCUS_CHANGED")
  9667. end
  9668.  
  9669. -- -----
  9670. if BattlegroundTargets_Options.Friend.ButtonFlagToggle[currentSize] or
  9671. BattlegroundTargets_Options.Enemy.ButtonFlagToggle[currentSize]
  9672. then
  9673. if isFlagBG > 0 then
  9674. BattlegroundTargets:RegisterEvent("UNIT_TARGET")
  9675. BattlegroundTargets:RegisterEvent("CHAT_MSG_BG_SYSTEM_HORDE")
  9676. BattlegroundTargets:RegisterEvent("CHAT_MSG_BG_SYSTEM_ALLIANCE")
  9677. if isFlagBG == 5 then
  9678. BattlegroundTargets:RegisterEvent("CHAT_MSG_RAID_BOSS_EMOTE")
  9679. end
  9680. end
  9681. end
  9682.  
  9683. -- assist_
  9684. if BattlegroundTargets_Options.Friend.ButtonAssistToggle[currentSize] or
  9685. BattlegroundTargets_Options.Enemy.ButtonAssistToggle[currentSize]
  9686. then
  9687. BattlegroundTargets:RegisterEvent("UNIT_TARGET")
  9688. end
  9689.  
  9690. -- leader_
  9691. if BattlegroundTargets_Options.Friend.ButtonLeaderToggle[currentSize] or
  9692. BattlegroundTargets_Options.Enemy.ButtonLeaderToggle[currentSize]
  9693. then
  9694. BattlegroundTargets:RegisterEvent("UNIT_TARGET")
  9695. end
  9696. if BattlegroundTargets_Options.Friend.EnableBracket[currentSize] and
  9697. BattlegroundTargets_Options.Friend.ButtonLeaderToggle[currentSize]
  9698. then
  9699. BattlegroundTargets:RegisterEvent("PARTY_LEADER_CHANGED")
  9700. end
  9701.  
  9702. -- pvp_trinket_
  9703. if BattlegroundTargets_Options.Friend.ButtonPvPTrinketToggle[currentSize] or
  9704. BattlegroundTargets_Options.Enemy.ButtonPvPTrinketToggle[currentSize]
  9705. then
  9706. BattlegroundTargets:RegisterEvent("COMBAT_LOG_EVENT_UNFILTERED")
  9707. end
  9708.  
  9709. -- class_range_
  9710. for frc = 1, #FRAMES do
  9711. local side = FRAMES[frc]
  9712. DATA[side].rangeSpellName = nil
  9713. DATA[side].rangeMin = nil
  9714. DATA[side].rangeMax = nil
  9715. if BattlegroundTargets_Options[side].ButtonRangeToggle[currentSize] then
  9716. local errortxt
  9717. local rangeSpellCLASS = ranges[side][playerClassEN]
  9718. if rangeSpellCLASS then
  9719. local rangeSpellID = rangeSpellCLASS.id
  9720. local isKnown = IsSpellKnown(rangeSpellID)
  9721. local SpellName, _, _, _, Min, Max = GetSpellInfo(rangeSpellID)
  9722. DATA[side].rangeSpellName = SpellName
  9723. DATA[side].rangeMin = Min
  9724. DATA[side].rangeMax = Max
  9725. if isKnown and SpellName and Min and Min >= 0 and Max and Max > 0 then
  9726. BattlegroundTargets:RegisterEvent("UNIT_HEALTH_FREQUENT")
  9727. BattlegroundTargets:RegisterEvent("UPDATE_MOUSEOVER_UNIT")
  9728. BattlegroundTargets:RegisterEvent("PLAYER_TARGET_CHANGED")
  9729. BattlegroundTargets:RegisterEvent("UNIT_TARGET")
  9730. else
  9731. local rangeSpellLEVEL = rangeSpellCLASS.lvl -- Friend: DKN72 HUN42 MAG29 MON18 ROG78 WLK18 WRR72 | Enemy: MON14 ROG12
  9732. if rangeSpellLEVEL > playerLevel then
  9733. errortxt = "WARNING rangecheck LEVEL - Level: "..rangeSpellLEVEL.." > "..(playerLevel or "0").." SpellID: "..(rangeSpellID or "-")
  9734. else
  9735. errortxt = "WARNING rangecheck UNKNOWN - SpellID: "..(rangeSpellID or "-")
  9736. end
  9737. end
  9738. else
  9739. errortxt = "ERROR rangecheck CLASS - Class: "..(playerClassEN or "-")
  9740. end
  9741. if errortxt and showerror then
  9742. Print(errortxt, locale, side, "SpellName:", DATA[side].rangeSpellName, "Min:", DATA[side].rangeMin, "Max:", DATA[side].rangeMax)
  9743. end
  9744. end
  9745. end
  9746. if BattlegroundTargets_Options.Enemy.ButtonRangeToggle[currentSize] then
  9747. BattlegroundTargets:RegisterEvent("COMBAT_LOG_EVENT_UNFILTERED")
  9748. end
  9749.  
  9750. BattlegroundTargets:RegisterEvent("UPDATE_BATTLEFIELD_SCORE")
  9751. BattlegroundTargets:RegisterEvent("GROUP_ROSTER_UPDATE")
  9752. BattlegroundTargets:RegisterEvent("PLAYER_DEAD")
  9753. BattlegroundTargets:RegisterEvent("PLAYER_UNGHOST")
  9754. BattlegroundTargets:RegisterEvent("PLAYER_ALIVE")
  9755. end
  9756.  
  9757. function BattlegroundTargets:EventUnregister()
  9758. BattlegroundTargets:UnregisterEvent("UPDATE_BATTLEFIELD_SCORE")
  9759. BattlegroundTargets:UnregisterEvent("GROUP_ROSTER_UPDATE")
  9760. BattlegroundTargets:UnregisterEvent("PLAYER_DEAD")
  9761. BattlegroundTargets:UnregisterEvent("PLAYER_UNGHOST")
  9762. BattlegroundTargets:UnregisterEvent("PLAYER_ALIVE")
  9763. BattlegroundTargets:UnregisterEvent("UNIT_HEALTH_FREQUENT")
  9764. BattlegroundTargets:UnregisterEvent("UPDATE_MOUSEOVER_UNIT")
  9765. BattlegroundTargets:UnregisterEvent("UNIT_TARGET")
  9766. BattlegroundTargets:UnregisterEvent("PLAYER_TARGET_CHANGED")
  9767. BattlegroundTargets:UnregisterEvent("PLAYER_FOCUS_CHANGED")
  9768. BattlegroundTargets:UnregisterEvent("PARTY_LEADER_CHANGED")
  9769. BattlegroundTargets:UnregisterEvent("CHAT_MSG_BG_SYSTEM_HORDE")
  9770. BattlegroundTargets:UnregisterEvent("CHAT_MSG_BG_SYSTEM_ALLIANCE")
  9771. BattlegroundTargets:UnregisterEvent("CHAT_MSG_RAID_BOSS_EMOTE")
  9772. BattlegroundTargets:UnregisterEvent("COMBAT_LOG_EVENT_UNFILTERED")
  9773. end
  9774. -- ---------------------------------------------------------------------------------------------------------------------
  9775.  
  9776.  
  9777.  
  9778. -- ---------------------------------------------------------------------------------------------------------------------
  9779. local function OnEvent(self, event, ...)
  9780. --if not eventTest[event] then eventTest[event] = 1 else eventTest[event] = eventTest[event] + 1 end -- TEST
  9781. --if isConfig then print("###", isConfig, event) end if not isConfig then print("***", isConfig, event) end
  9782. if event == "PLAYER_REGEN_DISABLED" then
  9783. inCombat = true
  9784. if isConfig then
  9785. if not inWorld then return end
  9786. BattlegroundTargets:DisableInsecureConfigWidges()
  9787. end
  9788. elseif event == "PLAYER_REGEN_ENABLED" then
  9789. inCombat = false
  9790. if reCheckBG then
  9791. if not inWorld then return end
  9792. BattlegroundTargets:BattlefieldCheck()
  9793. end
  9794. if reCheckScore then
  9795. if not inWorld then return end
  9796. BattlegroundTargets:BattlefieldScoreRequest()
  9797. end
  9798. if rePosMain then
  9799. rePosMain = nil
  9800. if GVAR.FriendMainFrame:IsShown() then
  9801. BattlegroundTargets:Frame_SavePosition("BattlegroundTargets_FriendMainFrame", "Friend")
  9802. end
  9803. if GVAR.EnemyMainFrame:IsShown() then
  9804. BattlegroundTargets:Frame_SavePosition("BattlegroundTargets_EnemyMainFrame", "Enemy")
  9805. end
  9806. end
  9807. if reSetLayout then
  9808. if not inWorld then return end
  9809. if BattlegroundTargets_Options.Friend.EnableBracket[currentSize] then
  9810. BattlegroundTargets:SetupButtonLayout("Friend")
  9811. end
  9812. if BattlegroundTargets_Options.Enemy.EnableBracket[currentSize] then
  9813. BattlegroundTargets:SetupButtonLayout("Enemy")
  9814. end
  9815. end
  9816. if isConfig then
  9817. if not inWorld then return end
  9818. BattlegroundTargets:EnableInsecureConfigWidges()
  9819. if BattlegroundTargets_Options.Friend.EnableBracket[currentSize] or BattlegroundTargets_Options.Enemy.EnableBracket[currentSize] then
  9820. BattlegroundTargets:EnableConfigMode()
  9821. else
  9822. BattlegroundTargets:DisableConfigMode()
  9823. end
  9824. end
  9825.  
  9826. elseif event == "COMBAT_LOG_EVENT_UNFILTERED" then
  9827. local _, clEvent, _, _, sourceName, sourceFlags, _, _, destName, destFlags, _, spellId = ...
  9828. if not sourceFlags or band(sourceFlags, 0x00000400) == 0 then return end
  9829. CombatLogPVPTrinketCheck(clEvent, spellId, sourceName)
  9830. if not destFlags or band(destFlags, 0x00000400) == 0 then return end
  9831. if sourceName == destName then return end
  9832. ---[[ TEST
  9833. range_CL_Throttle = range_CL_Throttle + 1
  9834. if range_CL_Throttle > range_CL_Frequency then
  9835. range_CL_Throttle = 0
  9836. range_CL_Frequency = random(1,3)
  9837. return
  9838. end
  9839. --]]
  9840. CombatLogRangeCheck(sourceName, destName, spellId)
  9841.  
  9842. elseif event == "UNIT_HEALTH_FREQUENT" then
  9843. local arg1 = ...
  9844. BattlegroundTargets:CheckUnitHealth(arg1)
  9845. elseif event == "UNIT_TARGET" then
  9846. local arg1 = ...
  9847. BattlegroundTargets:CheckUnitTarget(arg1, nil, 1)
  9848. elseif event == "UPDATE_MOUSEOVER_UNIT" then
  9849. BattlegroundTargets:CheckUnitHealth("mouseover")
  9850. elseif event == "PLAYER_TARGET_CHANGED" then
  9851. BattlegroundTargets:CheckPlayerTarget()
  9852. elseif event == "PLAYER_FOCUS_CHANGED" then
  9853. BattlegroundTargets:CheckPlayerFocus()
  9854.  
  9855. elseif event == "UPDATE_BATTLEFIELD_SCORE" then
  9856. BattlegroundTargets:BattlefieldScoreUpdate()
  9857. elseif event == "GROUP_ROSTER_UPDATE" then
  9858. BattlegroundTargets:GroupRosterUpdate()
  9859. elseif event == "PARTY_LEADER_CHANGED" then
  9860. BattlegroundTargets:FriendLeaderUpdate()
  9861.  
  9862. elseif event == "CHAT_MSG_BG_SYSTEM_HORDE" then
  9863. local arg1 = ...
  9864. BattlegroundTargets:CarrierCheck(arg1, 0)
  9865. elseif event == "CHAT_MSG_BG_SYSTEM_ALLIANCE" then
  9866. local arg1 = ...
  9867. BattlegroundTargets:CarrierCheck(arg1, 1)
  9868. elseif event == "CHAT_MSG_RAID_BOSS_EMOTE" then
  9869. local arg1 = ...
  9870. BattlegroundTargets:OrbReturnCheck(arg1)
  9871.  
  9872. elseif event == "PLAYER_DEAD" then
  9873. BattlegroundTargets:CheckIfPlayerIsGhost(true)
  9874. elseif event == "PLAYER_UNGHOST" then
  9875. BattlegroundTargets:CheckIfPlayerIsGhost(true)
  9876. elseif event == "PLAYER_ALIVE" then
  9877. BattlegroundTargets:CheckIfPlayerIsGhost()
  9878.  
  9879. elseif event == "ZONE_CHANGED_NEW_AREA" then
  9880. if isConfig then return end
  9881. BattlegroundTargets:BattlefieldCheck()
  9882.  
  9883. elseif event == "PLAYER_LEVEL_UP" then -- LVLCHK
  9884. local arg1 = ...
  9885. if arg1 then
  9886. playerLevel = arg1
  9887. BattlegroundTargets:CheckPlayerLevel()
  9888. end
  9889.  
  9890. elseif event == "NEUTRAL_FACTION_SELECT_RESULT" then
  9891. BattlegroundTargets:CheckFaction()
  9892.  
  9893. elseif event == "PLAYER_LOGIN" then
  9894. BuildBattlegroundMapTable()
  9895. BattlegroundTargets:CheckFaction()
  9896. BattlegroundTargets:InitOptions()
  9897. BattlegroundTargets:CreateInterfaceOptions()
  9898. BattlegroundTargets:LDBcheck()
  9899. BattlegroundTargets:CreateFrames()
  9900. BattlegroundTargets:CreateOptionsFrame()
  9901. tinsert(UISpecialFrames, "BattlegroundTargets_OptionsFrame")
  9902. BattlegroundTargets:UnregisterEvent("PLAYER_LOGIN")
  9903. elseif event == "PLAYER_ENTERING_WORLD" then
  9904. inWorld = true
  9905. BattlegroundTargets:CheckPlayerLevel() -- LVLCHK
  9906. BattlegroundTargets:BattlefieldCheck()
  9907. if BattlegroundTargets_Options.Friend.EnableBracket[currentSize] or BattlegroundTargets_Options.Enemy.EnableBracket[currentSize] then
  9908. BattlegroundTargets:CheckIfPlayerIsGhost()
  9909. end
  9910. BattlegroundTargets:CreateMinimapButton()
  9911. if not BattlegroundTargets_Options.FirstRun then
  9912. BattlegroundTargets:Frame_Toggle(GVAR.OptionsFrame)
  9913. BattlegroundTargets_Options.FirstRun = true
  9914. end
  9915. BattlegroundTargets:UnregisterEvent("PLAYER_ENTERING_WORLD")
  9916. end
  9917. end
  9918. -- ---------------------------------------------------------------------------------------------------------------------
  9919.  
  9920. BattlegroundTargets:RegisterEvent("PLAYER_REGEN_DISABLED")
  9921. BattlegroundTargets:RegisterEvent("PLAYER_REGEN_ENABLED")
  9922. BattlegroundTargets:RegisterEvent("ZONE_CHANGED_NEW_AREA")
  9923. BattlegroundTargets:RegisterEvent("PLAYER_LOGIN")
  9924. BattlegroundTargets:RegisterEvent("PLAYER_ENTERING_WORLD")
  9925. BattlegroundTargets:SetScript("OnEvent", OnEvent)
Add Comment
Please, Sign In to add comment