Advertisement
Guest User

Plater

a guest
Oct 7th, 2016
1,780
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 325.89 KB | None | 0 0
  1. if (true) then
  2. --return
  3. --but not today
  4. end
  5.  
  6. --details! framework
  7. local DF = _G ["DetailsFramework"]
  8. if (not DF) then
  9. print ("|cFFFFAA00Plater: framework not found, if you just installed or updated the addon, please restart your client.|r")
  10. return
  11. end
  12.  
  13. local unpack = unpack
  14. local ipairs = ipairs
  15. local pairs = pairs
  16. local GetCVar = GetCVar
  17. local SetCVar = SetCVar
  18. local InCombatLockdown = InCombatLockdown
  19. local UnitGroupRolesAssigned = UnitGroupRolesAssigned
  20. local CompareBit = bit.band
  21. local UnitIsPlayer = UnitIsPlayer
  22. local UnitClassification = UnitClassification
  23. local UnitDetailedThreatSituation = UnitDetailedThreatSituation
  24. local UnitAura = UnitAura
  25. local IsSpellInRange = IsSpellInRange
  26. local abs = math.abs
  27. local format = string.format
  28. local sort = table.sort
  29. local GetSpellInfo = GetSpellInfo
  30.  
  31. --endd
  32. --dump color palette
  33. --[=[
  34. local a = CreateFrame ("frame", nil, UIParent)
  35. a:SetSize (1400, 900)
  36. a:SetPoint ("topleft", UIParent, "topleft")
  37. local x = 5
  38. local y = -20
  39. for colorname, colortable in pairs (DF.alias_text_colors) do
  40. local f = a:CreateTexture (nil, "overlay")
  41. f:SetColorTexture (unpack (colortable))
  42. f:SetSize (100, 20)
  43. f:SetPoint ("topleft", a, "topleft", x, y)
  44. local t = a:CreateFontString (nil, "overlay", "GameFontNormal")
  45. t:SetPoint ("center", f, "center")
  46. t:SetText (colorname)
  47. y = y - 20
  48. if (y < -880) then
  49. y = -20
  50. x = x + 105
  51. end
  52. end
  53. --]=]
  54.  
  55. local LibSharedMedia = LibStub:GetLibrary ("LibSharedMedia-3.0")
  56.  
  57. LibSharedMedia:Register ("statusbar", "DGround", [[Interface\AddOns\Plater\images\bar_background]])
  58.  
  59. LibSharedMedia:Register ("statusbar", "Details D'ictum", [[Interface\AddOns\Plater\images\bar4]])
  60. LibSharedMedia:Register ("statusbar", "Details Vidro", [[Interface\AddOns\Plater\images\bar4_vidro]])
  61. LibSharedMedia:Register ("statusbar", "Details D'ictum (reverse)", [[Interface\AddOns\Plater\images\bar4_reverse]])
  62. LibSharedMedia:Register ("statusbar", "Details Serenity", [[Interface\AddOns\Plater\images\bar_serenity]])
  63. LibSharedMedia:Register ("statusbar", "BantoBar", [[Interface\AddOns\Plater\images\BantoBar]])
  64. LibSharedMedia:Register ("statusbar", "Skyline", [[Interface\AddOns\Plater\images\bar_skyline]])
  65. LibSharedMedia:Register ("statusbar", "WorldState Score", [[Interface\WorldStateFrame\WORLDSTATEFINALSCORE-HIGHLIGHT]])
  66. LibSharedMedia:Register ("statusbar", "DGround", [[Interface\AddOns\Plater\images\bar_background]])
  67. LibSharedMedia:Register ("statusbar", "PlaterBackground", [[Interface\AddOns\Plater\images\platebackground]])
  68. LibSharedMedia:Register ("statusbar", "PlaterTexture", [[Interface\AddOns\Plater\images\platetexture]])
  69. LibSharedMedia:Register ("statusbar", "PlaterHighlight", [[Interface\AddOns\Plater\images\plateselected]])
  70.  
  71. LibSharedMedia:Register ("statusbar", "testbar", [[Interface\AddOns\Plater\images\testbar.tga]])
  72. --LibSharedMedia:Register ("statusbar", "testbarBLP", [[Interface\AddOns\Plater\images\testbar]])
  73.  
  74. LibSharedMedia:Register ("font", "Oswald", [[Interface\Addons\Plater\fonts\Oswald-Regular.otf]])
  75. LibSharedMedia:Register ("font", "Nueva Std Cond", [[Interface\Addons\Plater\fonts\NuevaStd-Cond.otf]])
  76. LibSharedMedia:Register ("font", "Accidental Presidency", [[Interface\Addons\Plater\fonts\Accidental Presidency.ttf]])
  77. LibSharedMedia:Register ("font", "TrashHand", [[Interface\Addons\Plater\fonts\TrashHand.TTF]])
  78. LibSharedMedia:Register ("font", "Harry P", [[Interface\Addons\Plater\fonts\HARRYP__.TTF]])
  79. LibSharedMedia:Register ("font", "FORCED SQUARE", [[Interface\Addons\Plater\fonts\FORCED SQUARE.ttf]])
  80.  
  81.  
  82.  
  83. local _
  84. local default_config = {
  85.  
  86. profile = {
  87.  
  88. click_space = {150, 45},
  89. click_space_always_show = false,
  90. hide_friendly_castbars = false,
  91. hide_enemy_castbars = false,
  92.  
  93. plate_config = {
  94. friendlyplayer = {
  95. enabled = true,
  96. plate_order = 3,
  97. only_damaged = false,
  98. only_thename = false,
  99.  
  100. health = {70, 2},
  101. health_incombat = {70, 2},
  102. cast = {80, 8},
  103. cast_incombat = {80, 12},
  104. mana = {100, 3},
  105. mana_incombat = {100, 3},
  106. buff_frame_y_offset = 10,
  107.  
  108. actorname_text_spacing = 10,
  109. actorname_text_size = 10,
  110. actorname_text_font = "Arial Narrow",
  111. actorname_text_color = {1, 1, 1, 1},
  112. actorname_text_shadow = false,
  113. actorname_text_anchor = {side = 8, x = 0, y = 0},
  114.  
  115. spellname_text_size = 10,
  116. spellname_text_font = "Arial Narrow",
  117. spellname_text_color = {1, 1, 1, 1},
  118. spellname_text_shadow = false,
  119. spellname_text_anchor = {side = 9, x = 0, y = 0},
  120.  
  121. spellpercent_text_enabled = false,
  122. spellpercent_text_size = 10,
  123. spellpercent_text_font = "Arial Narrow",
  124. spellpercent_text_color = {1, 1, 1, 1},
  125. spellpercent_text_shadow = false,
  126. spellpercent_text_anchor = {side = 11, x = -2, y = 0},
  127.  
  128. level_text_enabled = false,
  129. level_text_anchor = {side = 7, x = 0, y = 1},
  130. level_text_size = 10,
  131. level_text_font = "Arial Narrow",
  132. level_text_shadow = false,
  133. level_text_alpha = 0.3,
  134.  
  135. percent_text_enabled = false,
  136. percent_text_size = 9,
  137. percent_text_font = "Arial Narrow",
  138. percent_text_shadow = false,
  139. percent_text_color = {.9, .9, .9, 1},
  140. percent_text_anchor = {side = 9, x = 0, y = 0},
  141. percent_text_alpha = 1,
  142. percent_text_ooc = false,
  143. },
  144. enemyplayer = {
  145. enabled = true,
  146. plate_order = 3,
  147.  
  148. use_playerclass_color = false,
  149. fixed_class_color = {1, .4, .1},
  150.  
  151. health = {120, 6},
  152. health_incombat = {130, 10},
  153. cast = {134, 12},
  154. cast_incombat = {134, 12},
  155. mana = {100, 3},
  156. mana_incombat = {100, 3},
  157. buff_frame_y_offset = 0,
  158.  
  159. actorname_text_spacing = 12,
  160. actorname_text_size = 12,
  161. actorname_text_font = "Arial Narrow",
  162. actorname_text_color = {1, 1, 1, 1},
  163. actorname_text_shadow = false,
  164. actorname_text_anchor = {side = 4, x = 0, y = 0},
  165.  
  166. spellname_text_size = 10,
  167. spellname_text_font = "Arial Narrow",
  168. spellname_text_color = {1, 1, 1, 1},
  169. spellname_text_shadow = false,
  170. spellname_text_anchor = {side = 9, x = 0, y = 0},
  171.  
  172. spellpercent_text_enabled = true,
  173. spellpercent_text_size = 10,
  174. spellpercent_text_font = "Arial Narrow",
  175. spellpercent_text_color = {1, 1, 1, 1},
  176. spellpercent_text_shadow = false,
  177. spellpercent_text_anchor = {side = 11, x = -2, y = 0},
  178.  
  179. level_text_enabled = true,
  180. level_text_anchor = {side = 7, x = 0, y = 1},
  181. level_text_size = 10,
  182. level_text_font = "Arial Narrow",
  183. level_text_shadow = false,
  184. level_text_alpha = 0.3,
  185.  
  186. percent_text_enabled = true,
  187. percent_text_size = 9,
  188. percent_text_font = "Arial Narrow",
  189. percent_text_shadow = false,
  190. percent_text_color = {.9, .9, .9, 1},
  191. percent_text_anchor = {side = 9, x = 0, y = 0},
  192. percent_text_alpha = 1,
  193. percent_text_ooc = true,
  194. },
  195. friendlynpc = {
  196. enabled = true,
  197. only_relevant = true,
  198. relevant_and_proffesions = false,
  199. only_names = false,
  200. all_names = false,
  201. relevance_state = 1,
  202. plate_order = 3,
  203.  
  204. health = {100, 2},
  205. health_incombat = {100, 2},
  206. cast = {100, 12},
  207. cast_incombat = {100, 12},
  208. mana = {100, 3},
  209. mana_incombat = {100, 3},
  210. buff_frame_y_offset = 0,
  211.  
  212. actorname_text_spacing = 10,
  213. actorname_text_size = 10,
  214. actorname_text_font = "Arial Narrow",
  215. actorname_text_color = {1, 1, 1, 1},
  216. actorname_text_shadow = false,
  217. actorname_text_anchor = {side = 8, x = 0, y = 0},
  218.  
  219. spellname_text_size = 10,
  220. spellname_text_font = "Arial Narrow",
  221. spellname_text_color = {1, 1, 1, 1},
  222. spellname_text_shadow = false,
  223. spellname_text_anchor = {side = 9, x = 0, y = 0},
  224.  
  225. spellpercent_text_enabled = false,
  226. spellpercent_text_size = 10,
  227. spellpercent_text_font = "Arial Narrow",
  228. spellpercent_text_color = {1, 1, 1, 1},
  229. spellpercent_text_shadow = false,
  230. spellpercent_text_anchor = {side = 11, x = -2, y = 0},
  231.  
  232. level_text_enabled = false,
  233. level_text_anchor = {side = 7, x = 0, y = 1},
  234. level_text_size = 10,
  235. level_text_font = "Arial Narrow",
  236. level_text_shadow = false,
  237. level_text_alpha = 0.3,
  238.  
  239. percent_text_enabled = false,
  240. percent_text_size = 9,
  241. percent_text_font = "Arial Narrow",
  242. percent_text_shadow = false,
  243. percent_text_color = {.9, .9, .9, 1},
  244. percent_text_anchor = {side = 9, x = 0, y = 0},
  245. percent_text_alpha = 1,
  246. percent_text_ooc = false,
  247.  
  248. filter = {
  249. [1] = true, --"important npc"
  250. [2] = true, --repair"
  251. [3] = false, --merchant"
  252. [4] = false, --innkeeper"
  253. [5] = true, --banker"
  254. [6] = true, --autioneer"
  255. [7] = true, --flyght master"
  256. [8] = false, --stable master"
  257. [9] = false, --pet master"
  258. [10] = false, --barber"
  259. [11] = false, --transmogrifier"
  260. [12] = false, --food and drink"
  261. [20] = false, --fishing trainer"
  262. [21] = false, --first aid trainer"
  263. [22] = false, --archaeology trainer"
  264. [23] = false, --cooking trainer"
  265. [24] = false, --mining trainer"
  266. [25] = false, --engineering trainer"
  267. [26] = false, --leatherworking trainer"
  268. [27] = false, --tailor trainer"
  269. [28] = false, --enchanting trainer"
  270. [29] = false, --blacksmith trainer"
  271. [30] = false, --inscription trainer"
  272. [31] = false, --herbalism trainer"
  273. [32] = false, --skinning trainer"
  274. [33] = false, --alchemy trainer"
  275. [34] = false, --"jewelcrafting trainer"
  276. },
  277.  
  278. quest_enabled = true,
  279. quest_color = {.5, 1, 0},
  280.  
  281. big_actortitle_text_size = 11,
  282. big_actortitle_text_font = "Arial Narrow",
  283. big_actortitle_text_color = {1, .8, .0},
  284. big_actortitle_text_shadow = false,
  285.  
  286. big_actorname_text_size = 9,
  287. big_actorname_text_font = "Arial Narrow",
  288. big_actorname_text_color = {.5, 1, .5},
  289. big_actorname_text_shadow = false,
  290. },
  291. enemynpc = {
  292. enabled = true,
  293. plate_order = 3,
  294.  
  295. health = {110, 2},
  296. health_incombat = {130, 10},
  297. cast = {134, 12},
  298. cast_incombat = {134, 12},
  299. mana = {100, 3},
  300. mana_incombat = {100, 3},
  301. buff_frame_y_offset = 0,
  302.  
  303. actorname_text_spacing = 12,
  304. actorname_text_size = 11,
  305. actorname_text_font = "Arial Narrow",
  306. actorname_text_color = {1, 1, 1, 1},
  307. actorname_text_shadow = false,
  308. actorname_text_anchor = {side = 4, x = 0, y = 0},
  309.  
  310. spellname_text_size = 12,
  311. spellname_text_font = "Arial Narrow",
  312. spellname_text_color = {1, 1, 1, 1},
  313. spellname_text_shadow = true,
  314. spellname_text_anchor = {side = 9, x = 0, y = 0},
  315.  
  316. spellpercent_text_enabled = true,
  317. spellpercent_text_size = 10,
  318. spellpercent_text_font = "Arial Narrow",
  319. spellpercent_text_color = {1, 1, 1, 1},
  320. spellpercent_text_shadow = false,
  321. spellpercent_text_anchor = {side = 11, x = -2, y = 0},
  322.  
  323. level_text_enabled = true,
  324. level_text_anchor = {side = 7, x = 0, y = 1},
  325. level_text_size = 8,
  326. level_text_font = "Arial Narrow",
  327. level_text_shadow = false,
  328. level_text_alpha = 0.3,
  329.  
  330. percent_text_enabled = true,
  331. percent_text_size = 9,
  332. percent_text_font = "Arial Narrow",
  333. percent_text_shadow = false,
  334. percent_text_color = {.9, .9, .9, 1},
  335. percent_text_anchor = {side = 9, x = 0, y = 0},
  336. percent_text_alpha = 1,
  337. percent_text_ooc = false,
  338. percent_show_health = false,
  339.  
  340. quest_enabled = true,
  341. quest_color_enemy = {1, .369, 0},
  342. quest_color_neutral = {1, .65, 0},
  343. },
  344.  
  345. player = {
  346. enabled = true,
  347. plate_order = 3,
  348. health = {150, 12},
  349. health_incombat = {150, 12},
  350. cast = {140, 8},
  351. cast_incombat = {140, 12},
  352. mana = {150, 8},
  353. mana_incombat = {150, 8},
  354. buff_frame_y_offset = 0,
  355. y_position_offset = -50, --deprecated
  356. pvp_always_incombat = true,
  357.  
  358. actorname_text_spacing = 10,
  359. actorname_text_size = 10,
  360. actorname_text_font = "Arial Narrow",
  361. actorname_text_color = {1, 1, 1, 1},
  362. actorname_text_shadow = false,
  363. actorname_text_anchor = {side = 8, x = 0, y = 0},
  364.  
  365. spellname_text_size = 10,
  366. spellname_text_font = "Arial Narrow",
  367. spellname_text_color = {1, 1, 1, 1},
  368. spellname_text_shadow = false,
  369. spellname_text_anchor = {side = 9, x = 0, y = 0},
  370.  
  371. level_text_enabled = false,
  372. level_text_anchor = {side = 7, x = 0, y = 1},
  373. level_text_size = 10,
  374. level_text_font = "Arial Narrow",
  375. level_text_shadow = false,
  376. level_text_alpha = 0.3,
  377.  
  378. percent_text_enabled = true,
  379. percent_text_size = 9,
  380. percent_text_font = "Arial Narrow",
  381. percent_text_shadow = true,
  382. percent_text_color = {.9, .9, .9, 1},
  383. percent_text_anchor = {side = 9, x = 0, y = 0},
  384. percent_text_alpha = 1,
  385. percent_text_ooc = false,
  386.  
  387. power_percent_text_enabled = true,
  388. power_percent_text_size = 9,
  389. power_percent_text_font = "Arial Narrow",
  390. power_percent_text_shadow = true,
  391. power_percent_text_color = {.9, .9, .9, 1},
  392. power_percent_text_anchor = {side = 9, x = 0, y = 0},
  393. power_percent_text_alpha = 1,
  394. },
  395. },
  396.  
  397. resources = {
  398. MONK = {
  399. chi_scale = 2,
  400. },
  401. MAGE = {
  402. arcane_charge_scale = 1,
  403. },
  404. DEATHKNIGHT = {
  405. rune_scale = 1,
  406. },
  407. PALADIN = {
  408. holypower_scale = 1,
  409. },
  410. ROGUE = {
  411. combopoint_scale = 1,
  412. },
  413. DRUID = {
  414. combopoint_scale = 1,
  415. },
  416. WARLOCK = {
  417. soulshard_scale = 1,
  418. },
  419. },
  420.  
  421. update_throttle = 0.15000000,
  422. culling_distance = 100,
  423. use_playerclass_color = false,
  424. aura_enabled = true,
  425. aura_width = 20,
  426. aura_height = 14,
  427. aura_x_offset = 0,
  428. aura_y_offset = 0,
  429. aura_alpha = 1,
  430. aura_timer = true,
  431. aura_custom = {},
  432.  
  433. height_animation = true,
  434. height_animation_speed = 15,
  435.  
  436. aura_tracker = {
  437. buff = {},
  438. debuff = {},
  439. buff_ban_percharacter = {},
  440. debuff_ban_percharacter = {},
  441. options = {},
  442. track_method = 0x1,
  443. buff_banned = {},
  444. debuff_banned = {},
  445. },
  446.  
  447. debuff_show_cc = true,
  448.  
  449. faction_hub_distance_to = 99999,
  450. faction_check_type = "string",
  451. range_check_type = "character",
  452. not_affecting_combat_enabled = true,
  453. not_affecting_combat_alpha = .3,
  454. range_check_alpha = 0.4,
  455. target_highlight = true,
  456. target_highlight_alpha = .5,
  457.  
  458. target_shady_alpha = .8,
  459. target_shady_enabled = true,
  460. target_shady_combat_only = true,
  461.  
  462. hover_highlight = true,
  463. hover_highlight_alpha = .3,
  464.  
  465. health_statusbar_texture = "PlaterTexture", --"DGround"
  466. health_selection_overlay = "PlaterHighlight",
  467. health_statusbar_bgtexture = "PlaterBackground",
  468. health_statusbar_bgcolor = {1, 1, 1, 1},
  469. health_statusbar_bgalpha = 1,
  470. health_statusbar_bgalpha_selected = .7,
  471.  
  472. cast_statusbar_texture = "DGround",
  473. cast_statusbar_bgtexture = "Details Serenity",
  474. cast_statusbar_bgcolor = {0, 0, 0, 0.8},
  475. cast_statusbar_color = {1, .7, 0, 1},
  476. cast_statusbar_color_nointerrupt = {.5, .5, .5, 1},
  477.  
  478. friendlyplates_auto_show = false, --removed
  479. friendlyplates_no_on_instances = true, --removed
  480. enemyplates_only_combat = false, --removed
  481. enemyplates_only_in_instances = false, --removed
  482.  
  483. indicator_faction = true,
  484. indicator_elite = true,
  485. indicator_rare = true,
  486. indicator_quest = true,
  487. indicator_enemyclass = false,
  488. indicator_extra_raidmark = true,
  489. indicator_anchor = {side = 2, x = -2, y = 0},
  490.  
  491. target_indicator = "NONE",
  492.  
  493. border_color = {0, 0, 0, .15},
  494. border_thickness = 3,
  495.  
  496. aggro_modifies = {
  497. health_bar_color = true,
  498. border_color = false,
  499. actor_name_color = false,
  500. },
  501.  
  502. tank = {
  503. colors = {
  504. aggro = {.5, .5, 1},
  505. noaggro = {1, 0, 0},
  506. pulling = {1, 1, 0},
  507. --nocombat = {0.698, 0.705, 1},
  508. nocombat = {0.380, 0.003, 0},
  509. },
  510. },
  511.  
  512. dps = {
  513. colors = {
  514. --aggro = {1, .5, .5},
  515. aggro = {1, 0.317, 0.172},
  516. noaggro = {.5, .5, 1},
  517. pulling = {1, 1, 0},
  518. },
  519. },
  520.  
  521. first_run = false,
  522. }
  523. }
  524.  
  525. local options_table = {
  526. name = "Plater Nameplates",
  527. type = "group",
  528. args = {
  529.  
  530. }
  531. }
  532.  
  533. local Plater = DF:CreateAddOn ("Plater", "PlaterDB", default_config, options_table)
  534.  
  535. --major
  536. local CUF_Name = "CompactUnitFrame" --blizzard cuf
  537. local NPF_Name = "NamePlateDriverFrame" --nameplate frame
  538. local NPB_Name = "NameplateBuffContainerMixin" --nameplate buff
  539. local CNP_Name = "CompactNamePlate" --compactnameplate
  540. local CBF_Name = "CastingBarFrame" --castingbar
  541. local BMX_Name = "NamePlateBorderTemplateMixin" --border mix-in
  542. local MAB_Name = "ClassNameplateManaBarFrame" --mana bar
  543.  
  544. --minor
  545. local STRING_DEFAULT = "Default"
  546. local STRING_OPTIONS = "FrameOptions"
  547.  
  548. Plater.FriendsCache = {}
  549. Plater.QuestCache = {}
  550. Plater.DriverFuncNames = {
  551. ["OnNameUpdate"] = "UpdateName",
  552. ["OnUpdateBuffs"] = "UpdateBuffs",
  553. ["OnUpdateHealth"] = "UpdateHealth",
  554. ["OnUpdateAnchor"] = "UpdateAnchor",
  555. ["OnBorderUpdate"] = "SetVertexColor",
  556. ["OnChangeHealthConfig"] = "UpdateHealthColor",
  557. ["OnSelectionUpdate"] = "UpdateSelectionHighlight",
  558. ["OnAuraUpdate"] = "OnUnitAuraUpdate",
  559. ["OnResourceUpdate"] = "SetupClassNameplateBar",
  560. ["OnOptionsUpdate"] = "UpdateNamePlateOptions",
  561. ["OnManaBarOptionsUpdate"] = "OnOptionsUpdated",
  562. ["OnCastBarEvent"] = "OnEvent",
  563. ["OnCastBarShow"] = "OnShow",
  564. ["OnTick"] = "OnUpdate",
  565. ["OnRaidTargetUpdate"] = "OnRaidTargetUpdate",
  566. }
  567. Plater.DriverConfigType = {
  568. ["FRIENDLY"] = "Friendly",
  569. ["ENEMY"] = "Enemy",
  570. ["PLAYER"] = "Player",
  571. }
  572. Plater.DriverConfigMembers = {
  573. ["UseClassColors"] = "useClassColors",
  574. ["UseRangeCheck"] = "fadeOutOfRange",
  575. ["UseAlwaysHostile"] = "considerSelectionInCombatAsHostile",
  576. ["CanShowUnitName"] = "displayName",
  577. ["HideCastBar"] = "hideCastbar",
  578. }
  579.  
  580. --const
  581. local CVAR_SHOWPERSONAL = "nameplateShowSelf"
  582. local CVAR_RESOURCEONTARGET = "nameplateResourceOnTarget"
  583. local CVAR_CULLINGDISTANCE = "nameplateMaxDistance"
  584. local CVAR_CEILING = "nameplateOtherTopInset"
  585. local CVAR_ANCHOR = "nameplateOtherAtBase"
  586. local CVAR_AGGROFLASH = "ShowNamePlateLoseAggroFlash"
  587. local CVAR_MOVEMENT_SPEED = "nameplateMotionSpeed"
  588. local CVAR_MIN_ALPHA = "nameplateMinAlpha"
  589. local CVAR_MIN_ALPHA_DIST = "nameplateMinAlphaDistance"
  590. local CVAR_SHOWALL = "nameplateShowAll"
  591. local CVAR_ENEMY_ALL = "nameplateShowEnemies"
  592. local CVAR_ENEMY_MINIONS = "nameplateShowEnemyMinions"
  593. local CVAR_ENEMY_MINUS = "nameplateShowEnemyMinus"
  594. local CVAR_PLATEMOTION = "nameplateMotion"
  595. local CVAR_FRIENDLY_ALL = "nameplateShowFriends"
  596. local CVAR_FRIENDLY_GUARDIAN = "nameplateShowFriendlyGuardians"
  597. local CVAR_FRIENDLY_PETS = "nameplateShowFriendlyPets"
  598. local CVAR_FRIENDLY_TOTEMS = "nameplateShowFriendlyTotems"
  599. local CVAR_FRIENDLY_MINIONS = "nameplateShowFriendlyMinions"
  600. local CVAR_CLASSCOLOR = "ShowClassColorInNameplate"
  601. local CVAR_SCALE_HORIZONTAL = "NamePlateHorizontalScale"
  602. local CVAR_SCALE_VERTICAL = "NamePlateVerticalScale"
  603.  
  604. local CAN_CHECK_AGGRO = true
  605.  
  606. --reaction
  607. local UNITREACTION_HOSTILE = 3
  608. local UNITREACTION_NEUTRAL = 4
  609. local UNITREACTION_FRIENDLY = 5
  610.  
  611. --filters
  612. local FILTER_DEBUFFS_BANNED = {}
  613. local FILTER_BUFFS_BANNED = {}
  614. local FILTER_BUFF_DETECTION = ""
  615. local FILTER_BUFF_DETECTION2 = ""
  616. local ALL_DEBUFFS = {}
  617. local ALL_BUFFS = {}
  618.  
  619. local BUFF_CACHE = {}
  620. local DEBUFF_CACHE = {}
  621.  
  622. --cvars
  623. local CVAR_ENABLED = "1"
  624. local CVAR_DISABLED = "0"
  625.  
  626. local CVAR_ANCHOR_HEAD = "0"
  627. local CVAR_ANCHOR_BOTH = "1"
  628. local CVAR_ANCHOR_FEET = "2"
  629.  
  630. --members
  631. local MEMBER_UNITID = "namePlateUnitToken"
  632. local MEMBER_GUID = "namePlateUnitGUID"
  633. local MEMBER_NPCTYPE = "namePlateNpcType"
  634. local MEMBER_NPCID = "namePlateNpcId"
  635. local MEMBER_QUEST = "namePlateIsQuestObjective"
  636. local MEMBER_REACTION = "namePlateUnitReaction"
  637. local MEMBER_ALPHA = "namePlateAlpha"
  638. local MEMBER_RANGE = "namePlateInRange"
  639. local MEMBER_NOCOMBAT = "namePlateNoCombat"
  640. local MEMBER_NAME = "namePlateUnitName"
  641. local MEMBER_TARGET = "namePlateIsTarget"
  642.  
  643. local CAN_USE_AURATIMER = true
  644. Plater.CanLoadFactionStrings = true
  645. local TOTAL_FACTIONS = 6 --legion
  646.  
  647. --> copied from blizzard code
  648. local function IsPlayerEffectivelyTank()
  649. local assignedRole = UnitGroupRolesAssigned ("player");
  650. if ( assignedRole == "NONE" ) then
  651. local spec = GetSpecialization();
  652. return spec and GetSpecializationRole(spec) == "TANK";
  653. end
  654. return assignedRole == "TANK";
  655. end
  656. --copied from blizzard code
  657. local function IsTapDenied (frame)
  658. return frame.optionTable.greyOutWhenTapDenied and not UnitPlayerControlled (frame.unit) and UnitIsTapDenied (frame.unit)
  659. end
  660.  
  661. function Plater.GetDriverSubObjectName (driverName, funcName, isChildMember)
  662. if (isChildMember) then
  663. return driverName [funcName]
  664. else
  665. return driverName .. "_" .. funcName
  666. end
  667. end
  668.  
  669. function Plater.GetDriverGlobalObject (driverName)
  670. return _G [driverName]
  671. end
  672. function Plater.Execute (driverName, funcName, ...)
  673. local subObject = Plater.GetDriverSubObjectName (driverName, funcName, false)
  674. if (subObject) then
  675. return _G [subObject] and _G [subObject] (...)
  676. end
  677. end
  678.  
  679. local InstallHook = hooksecurefunc
  680. local InstallOverride = function (driverName, funcName, newFunction)
  681. if (not funcName) then
  682. _G [driverName] = newFunction
  683. else
  684. _G [driverName] [funcName] = newFunction
  685. end
  686. end
  687.  
  688. function Plater.GetHashKey (inCombat)
  689. if (inCombat) then
  690. return "cast_incombat", "health_incombat", "actorname_text_spacing", "mana_incombat"
  691. else
  692. return "cast", "health", "actorname_text_spacing", "mana"
  693. end
  694. end
  695.  
  696. local ACTORTYPE_FRIENDLY_PLAYER = "friendlyplayer"
  697. local ACTORTYPE_FRIENDLY_NPC = "friendlynpc"
  698. local ACTORTYPE_ENEMY_PLAYER = "enemyplayer"
  699. local ACTORTYPE_ENEMY_NPC = "enemynpc"
  700. local ACTORTYPE_PLAYER = "player"
  701.  
  702. local type = type
  703. local string = "string"
  704. local number = "number"
  705. local char = "char"
  706. local floor = floor
  707. local table = "table"
  708.  
  709. local actorTypes = {ACTORTYPE_FRIENDLY_PLAYER, ACTORTYPE_ENEMY_PLAYER, ACTORTYPE_FRIENDLY_NPC, ACTORTYPE_ENEMY_NPC, ACTORTYPE_PLAYER}
  710. function Plater.GetActorTypeByIndex (index)
  711. return actorTypes [index] or error ("Invalid actor type")
  712. end
  713.  
  714. function Plater.SetShowActorType (actorType, value)
  715. Plater.db.profile.plate_config [actorType].enabled = value
  716. end
  717.  
  718. function Plater.InjectOnDefaultOptions (driverName, configType, configName, value)
  719. _G [STRING_DEFAULT .. driverName .. configType .. STRING_OPTIONS][configName] = value
  720. end
  721.  
  722. function Plater.IsShowingResourcesOnTarget()
  723. return GetCVar (CVAR_SHOWPERSONAL) == CVAR_ENABLED and GetCVar (CVAR_RESOURCEONTARGET) == CVAR_ENABLED
  724. end
  725.  
  726. local CrowdControl = {
  727. [33786] = true, -- Cyclone
  728. [339] = true, -- Entangling Toots
  729.  
  730. [3355] = true, -- Freezing trap
  731.  
  732. [118] = true, -- Polymorph sheep
  733. [28272] = true, -- Polymorph pig
  734. [126819] = true, -- Polymorph pig 2
  735. [61305] = true, -- Polymorph black cat
  736. [61721] = true, -- Polymorph rabbit
  737. [61780] = true, -- Polymorph turkey
  738. [28271] = true, -- Polymorph turtle
  739. [161354] = true, -- Polymorph Monkey
  740. [161353] = true, -- Polymorph Polar Bear Cub
  741. [161355] = true, -- Polymorph Penguin
  742.  
  743. [115078] = true, -- Paralysis
  744.  
  745. [20066] = true, -- Repentance
  746.  
  747. [2094] = true, -- Blind
  748. [6770] = true, -- Sap
  749.  
  750. [51514] = true, -- Hex
  751. }
  752. local LocalizedCrowdControl = {}
  753. Plater.GlobalNames = _G
  754. function Plater.SpellIsCC (spellName)
  755. return LocalizedCrowdControl [spellName]
  756. end
  757.  
  758. local TargetIndicators = {
  759. ["NONE"] = {
  760. path = [[Interface\ACHIEVEMENTFRAME\UI-Achievement-WoodBorder-Corner]],
  761. coords = {{.9, 1, .9, 1}, {.9, 1, .9, 1}, {.9, 1, .9, 1}, {.9, 1, .9, 1}},
  762. desaturated = false,
  763. width = 10,
  764. height = 10,
  765. x = 1,
  766. y = 1,
  767. },
  768. ["Magneto"] = {
  769. path = [[Interface\Artifacts\RelicIconFrame]],
  770. coords = {{0, .5, 0, .5}, {0, .5, .5, 1}, {.5, 1, .5, 1}, {.5, 1, 0, .5}},
  771. desaturated = false,
  772. width = 10,
  773. height = 10,
  774. x = 1,
  775. y = 1,
  776. },
  777. ["Gray Bold"] = {
  778. path = [[Interface\ContainerFrame\UI-Icon-QuestBorder]],
  779. coords = {{0, .5, 0, .5}, {0, .5, .5, 1}, {.5, 1, .5, 1}, {.5, 1, 0, .5}},
  780. desaturated = true,
  781. width = 10,
  782. height = 10,
  783. x = 2,
  784. y = 2,
  785. },
  786. ["Pins"] = {
  787. path = [[Interface\ITEMSOCKETINGFRAME\UI-ItemSockets]],
  788. coords = {{145/256, 161/256, 3/256, 19/256}, {145/256, 161/256, 19/256, 3/256}, {161/256, 145/256, 19/256, 3/256}, {161/256, 145/256, 3/256, 19/256}},
  789. desaturated = 1,
  790. width = 4,
  791. height = 4,
  792. x = 2,
  793. y = 2,
  794. },
  795. ["Golden"] = {
  796. path = [[Interface\PETBATTLES\PetBattle-GoldSpeedFrame]],
  797. coords = {{1/128, 67/128, 1/128, 67/128}, {1/128, 67/128, 67/128, 1/128}, {67/128, 1/128, 67/128, 1/128}, {67/128, 1/128, 1/128, 67/128}},
  798. desaturated = false,
  799. width = 12,
  800. height = 12,
  801. x = 4,
  802. y = 4,
  803. },
  804. ["Silver"] = {
  805. path = [[Interface\PETBATTLES\PETBATTLEHUD]],
  806. coords = {{848/1024, 868/1024, 454/512, 474/512}, {848/1024, 868/1024, 474/512, 495/512}, {868/1024, 889/1024, 474/512, 495/512}, {868/1024, 889/1024, 454/512, 474/512}}, --848 889 454 495
  807. desaturated = false,
  808. width = 6,
  809. height = 6,
  810. x = 1,
  811. y = 1,
  812. },
  813. ["Ornament"] = {
  814. path = [[Interface\PETBATTLES\PETJOURNAL]],
  815. coords = {{124/512, 161/512, 71/1024, 99/1024}, {119/512, 156/512, 29/1024, 57/1024}},
  816. desaturated = false,
  817. width = 22,
  818. height = 14,
  819. x = 16,
  820. y = 0,
  821. },
  822. ["Epic"] = {
  823. path = [[Interface\Reforging\Reforge-Texture]],
  824. coords = {
  825. {0/512, 16/512, 0/128, 16/128},
  826. {0/512, 16/512, 16/128, 0/128},
  827. {16/512, 0/512, 16/128, 0/128},
  828. {16/512, 0/512, 0/128, 16/128}
  829. },
  830. desaturated = false,
  831. width = 12,
  832. height = 12,
  833. x = 6,
  834. y = 6,
  835. },
  836. }
  837.  
  838. --> general values
  839.  
  840. local DB_TICK_THROTTLE
  841. local DB_PLATE_CONFIG
  842. local DB_BUFF_BANNED
  843. local DB_DEBUFF_BANNED
  844. local DB_AURA_ENABLED
  845. local DB_AURA_ALPHA
  846. local DB_AURA_X_OFFSET
  847. local DB_AURA_Y_OFFSET
  848. local DB_TRACK_METHOD
  849. local DB_TRACKING_BUFFLIST
  850. local DB_TRACKING_DEBUFFLIST
  851. local DB_BORDER_COLOR_R
  852. local DB_BORDER_COLOR_G
  853. local DB_BORDER_COLOR_B
  854. local DB_BORDER_COLOR_A
  855. local DB_BORDER_THICKNESS
  856. local DB_AGGRO_CHANGE_HEALTHBAR_COLOR
  857. local DB_AGGRO_CHANGE_NAME_COLOR
  858. local DB_AGGRO_CHANGE_BORDER_COLOR
  859. local DB_ANIMATION_HEIGHT
  860. local DB_ANIMATION_HEIGHT_SPEED
  861. local DB_TARGET_SHADY_ENABLED
  862. local DB_TARGET_SHADY_ALPHA
  863. local DB_TARGET_SHADY_COMBATONLY
  864.  
  865. local DB_NAME_NPCENEMY_ANCHOR
  866. local DB_NAME_NPCFRIENDLY_ANCHOR
  867. local DB_NAME_PLAYERENEMY_ANCHOR
  868. local DB_NAME_PLAYERFRIENDLY_ANCHOR
  869.  
  870. local DB_TEXTURE_CASTBAR
  871. local DB_TEXTURE_CASTBAR_BG
  872. local DB_TEXTURE_HEALTHBAR
  873. local DB_TEXTURE_HEALTHBAR_BG
  874.  
  875. local DB_CASTBAR_HIDE_ENEMIES
  876. local DB_CASTBAR_HIDE_FRIENDLY
  877.  
  878. -- ~profile
  879. function Plater:RefreshConfig()
  880. Plater.RefreshDBUpvalues()
  881.  
  882. Plater.UpdateAllPlates()
  883. if (PlaterOptionsPanelFrame) then
  884. PlaterOptionsPanelFrame.RefreshOptionsFrame()
  885. end
  886. Plater.UpdateUseCastBar()
  887. Plater.UpdateUseClassColors()
  888. end
  889. function Plater.RefreshDBUpvalues()
  890. local profile = Plater.db.profile
  891.  
  892. DB_TICK_THROTTLE = profile.update_throttle
  893. DB_PLATE_CONFIG = profile.plate_config
  894. DB_BUFF_BANNED = profile.aura_tracker.buff_banned
  895. DB_DEBUFF_BANNED = profile.aura_tracker.debuff_banned
  896. DB_TRACK_METHOD = profile.aura_tracker.track_method
  897. DB_TRACKING_BUFFLIST = profile.aura_tracker.buff
  898. DB_TRACKING_DEBUFFLIST = profile.aura_tracker.debuff
  899. DB_AURA_ENABLED = profile.aura_enabled
  900. DB_AURA_ALPHA = profile.aura_alpha
  901. DB_AURA_X_OFFSET = profile.aura_x_offset
  902. DB_AURA_Y_OFFSET = profile.aura_y_offset
  903. DB_BORDER_COLOR_R = profile.border_color [1]
  904. DB_BORDER_COLOR_G = profile.border_color [2]
  905. DB_BORDER_COLOR_B = profile.border_color [3]
  906. DB_BORDER_COLOR_A = profile.border_color [4]
  907. DB_BORDER_THICKNESS = profile.border_thickness
  908. DB_AGGRO_CHANGE_HEALTHBAR_COLOR = profile.aggro_modifies.health_bar_color
  909. DB_AGGRO_CHANGE_BORDER_COLOR = profile.aggro_modifies.border_color
  910. DB_AGGRO_CHANGE_NAME_COLOR = profile.aggro_modifies.actor_name_color
  911. DB_ANIMATION_HEIGHT = profile.height_animation
  912. DB_ANIMATION_HEIGHT_SPEED = profile.height_animation_speed
  913.  
  914. DB_TARGET_SHADY_ENABLED = profile.target_shady_enabled
  915. DB_TARGET_SHADY_ALPHA = profile.target_shady_alpha
  916. DB_TARGET_SHADY_COMBATONLY = profile.target_shady_combat_only
  917.  
  918. DB_NAME_NPCENEMY_ANCHOR = profile.plate_config.enemynpc.actorname_text_anchor.side
  919. DB_NAME_NPCFRIENDLY_ANCHOR = profile.plate_config.friendlynpc.actorname_text_anchor.side
  920. DB_NAME_PLAYERENEMY_ANCHOR = profile.plate_config.enemyplayer.actorname_text_anchor.side
  921. DB_NAME_PLAYERFRIENDLY_ANCHOR = profile.plate_config.friendlyplayer.actorname_text_anchor.side
  922.  
  923. DB_TEXTURE_CASTBAR = LibSharedMedia:Fetch ("statusbar", profile.cast_statusbar_texture)
  924. DB_TEXTURE_CASTBAR_BG = LibSharedMedia:Fetch ("statusbar", profile.cast_statusbar_bgtexture)
  925. DB_TEXTURE_HEALTHBAR = LibSharedMedia:Fetch ("statusbar", profile.health_statusbar_texture)
  926. DB_TEXTURE_HEALTHBAR_BG = LibSharedMedia:Fetch ("statusbar", profile.health_statusbar_bgtexture)
  927.  
  928. DB_CASTBAR_HIDE_ENEMIES = profile.hide_enemy_castbars
  929. DB_CASTBAR_HIDE_FRIENDLY = profile.hide_friendly_castbars
  930.  
  931. Plater.UpdateAuraCache()
  932. end
  933.  
  934. function Plater.OnInit()
  935.  
  936. --C_Timer.After (1, Plater.OpenOptionsPanel)
  937. C_Timer.After (1, function()
  938. --Plater.OpenInterfaceProfile()
  939. end)
  940.  
  941. Plater.RefreshDBUpvalues()
  942.  
  943. --constrói a lista de cc
  944. for spellId, _ in pairs (CrowdControl) do
  945. local spellName = GetSpellInfo (spellId)
  946. LocalizedCrowdControl [spellName] = true
  947. end
  948.  
  949. Plater.CombatTime = GetTime()
  950.  
  951. if (OmniCC) then
  952. --CAN_USE_AURATIMER = false
  953. end
  954.  
  955. Plater.RegenIsDisabled = false
  956. if (InCombatLockdown()) then
  957. Plater.RegenIsDisabled = true
  958. end
  959.  
  960. Plater.InjectOnDefaultOptions (CNP_Name, Plater.DriverConfigType ["FRIENDLY"], Plater.DriverConfigMembers ["CanShowUnitName"], false)
  961. Plater.InjectOnDefaultOptions (CNP_Name, Plater.DriverConfigType ["ENEMY"], Plater.DriverConfigMembers ["CanShowUnitName"], false)
  962. Plater.InjectOnDefaultOptions (CNP_Name, Plater.DriverConfigType ["FRIENDLY"], Plater.DriverConfigMembers ["UseRangeCheck"], false)
  963. Plater.InjectOnDefaultOptions (CNP_Name, Plater.DriverConfigType ["ENEMY"], Plater.DriverConfigMembers ["UseRangeCheck"], false)
  964. Plater.InjectOnDefaultOptions (CNP_Name, Plater.DriverConfigType ["ENEMY"], Plater.DriverConfigMembers ["UseAlwaysHostile"], false)
  965.  
  966. --configuração do personagem
  967. PlaterDBChr = PlaterDBChr or {first_run = {}}
  968. PlaterDBChr.debuffsBanned = PlaterDBChr.debuffsBanned or {}
  969. PlaterDBChr.buffsBanned = PlaterDBChr.buffsBanned or {}
  970. PlaterDBChr.spellRangeCheck = PlaterDBChr.spellRangeCheck or {}
  971.  
  972. for specID, _ in pairs (Plater.SpecList [select (2, UnitClass ("player"))]) do
  973. if (PlaterDBChr.spellRangeCheck [specID] == nil) then
  974. PlaterDBChr.spellRangeCheck [specID] = GetSpellInfo (Plater.DefaultSpellRangeList [specID])
  975. end
  976. end
  977. Plater.SpellForRangeCheck = ""
  978.  
  979. FILTER_DEBUFFS_BANNED = PlaterDBChr.debuffsBanned
  980. FILTER_BUFFS_BANNED = PlaterDBChr.buffsBanned
  981. FILTER_BUFF_DETECTION = GetSpellInfo (203761)
  982. FILTER_BUFF_DETECTION2 = GetSpellInfo (213486)
  983.  
  984. local re_ForceCVars = function()
  985. Plater.ForceCVars()
  986. end
  987. function Plater.ForceCVars()
  988. if (InCombatLockdown()) then
  989. return C_Timer.After (1, re_ForceCVars)
  990. end
  991. SetCVar (CVAR_MIN_ALPHA, 0.90135484)
  992. SetCVar (CVAR_MIN_ALPHA_DIST, -10^5.2)
  993. end
  994.  
  995. C_Timer.After (1, Plater.GetSpellForRangeCheck)
  996. C_Timer.After (4, Plater.UpdateCullingDistance)
  997. C_Timer.After (4.1, Plater.ForceCVars)
  998.  
  999. --verifica se é a primeira vez que rodou o addon no personagem
  1000. local check_first_run = function()
  1001. if (not UnitGUID ("player")) then
  1002. C_Timer.After (1, Plater.CheckFirstRun)
  1003. return
  1004. end
  1005. if (not Plater.db.profile.first_run) then
  1006. Plater.db.profile.first_run = true
  1007. C_Timer.After (15, Plater.SetCVarsOnFirstRun)
  1008. elseif (not PlaterDBChr.first_run [UnitGUID ("player")]) then
  1009. C_Timer.After (15, Plater.SetCVarsOnFirstRun)
  1010. else
  1011. Plater.ShutdownInterfaceOptionsPanel()
  1012. end
  1013. end
  1014. function Plater.CheckFirstRun()
  1015. check_first_run()
  1016. end
  1017. Plater.CheckFirstRun()
  1018.  
  1019. Plater.TargetTextures2Sides = {}
  1020. Plater.TargetTextures4Sides = {}
  1021. for i = 1, 2 do
  1022. local targetTexture = UIParent:CreateTexture (nil, "overlay")
  1023. tinsert (Plater.TargetTextures2Sides, targetTexture)
  1024. end
  1025. for i = 1, 4 do
  1026. local targetTexture = UIParent:CreateTexture (nil, "overlay")
  1027. tinsert (Plater.TargetTextures4Sides, targetTexture)
  1028. end
  1029.  
  1030. Plater:RegisterEvent ("NAME_PLATE_CREATED")
  1031. Plater:RegisterEvent ("NAME_PLATE_UNIT_ADDED")
  1032. Plater:RegisterEvent ("NAME_PLATE_UNIT_REMOVED")
  1033. Plater:RegisterEvent ("PLAYER_REGEN_DISABLED")
  1034. Plater:RegisterEvent ("PLAYER_REGEN_ENABLED")
  1035. Plater:RegisterEvent ("PLAYER_TARGET_CHANGED")
  1036. Plater:RegisterEvent ("ZONE_CHANGED_NEW_AREA")
  1037. Plater:RegisterEvent ("ZONE_CHANGED_INDOORS")
  1038. Plater:RegisterEvent ("ZONE_CHANGED")
  1039. Plater:RegisterEvent ("FRIENDLIST_UPDATE")
  1040. Plater:RegisterEvent ("PLAYER_LOGOUT")
  1041. Plater:RegisterEvent ("QUEST_ACCEPTED")
  1042. Plater:RegisterEvent ("QUEST_ACCEPT_CONFIRM")
  1043. Plater:RegisterEvent ("QUEST_COMPLETE")
  1044. Plater:RegisterEvent ("QUEST_POI_UPDATE")
  1045. Plater:RegisterEvent ("QUEST_QUERY_COMPLETE")
  1046. Plater:RegisterEvent ("QUEST_DETAIL")
  1047. Plater:RegisterEvent ("QUEST_FINISHED")
  1048. Plater:RegisterEvent ("QUEST_GREETING")
  1049. Plater:RegisterEvent ("QUEST_LOG_UPDATE")
  1050. Plater:RegisterEvent ("UNIT_QUEST_LOG_CHANGED")
  1051. Plater:RegisterEvent ("PLAYER_SPECIALIZATION_CHANGED")
  1052.  
  1053. --seta o nome do jogador na barra dele --ajuda a evitar os 'desconhecidos' pelo cliente do jogo (frame da unidade)
  1054. InstallHook (Plater.GetDriverSubObjectName (CUF_Name, Plater.DriverFuncNames.OnNameUpdate), function (self)
  1055. if (self.healthBar.actorName) then
  1056. local plateFrame = self:GetParent()
  1057. plateFrame [MEMBER_NAME] = UnitName (self.unit)
  1058.  
  1059. Plater.UpdateUnitName (plateFrame)
  1060.  
  1061. if (plateFrame.actorType == ACTORTYPE_FRIENDLY_PLAYER) then
  1062. Plater.FormatTextForFriend (self:GetParent(), self.healthBar.actorName, self.name:GetText(), DB_PLATE_CONFIG [self:GetParent().actorType])
  1063. end
  1064. end
  1065. end)
  1066.  
  1067. --quando trocar de target, da overwrite na textura de overlay do selected target (frame da unidade)
  1068. InstallHook (Plater.GetDriverSubObjectName (CUF_Name, Plater.DriverFuncNames.OnSelectionUpdate), function (self)
  1069. if (self.isNamePlate) then
  1070. if (self.selectionHighlight:IsShown()) then
  1071. local targetedOverlayTexture = LibSharedMedia:Fetch ("statusbar", Plater.db.profile.health_selection_overlay)
  1072. self.selectionHighlight:SetTexture (targetedOverlayTexture)
  1073. self.healthBar.background:SetAlpha (Plater.db.profile.health_statusbar_bgalpha_selected)
  1074. else
  1075. self.healthBar.background:SetAlpha (1)
  1076. end
  1077. Plater.UpdatePlateBorders()
  1078. end
  1079. end)
  1080.  
  1081. InstallHook (Plater.GetDriverGlobalObject (BMX_Name), Plater.DriverFuncNames.OnBorderUpdate, function (self)
  1082. Plater.UpdatePlateBorders (self.plateFrame)
  1083. end)
  1084.  
  1085. --sobrepõe a função que atualiza as auras
  1086. local Override_UNIT_AURA_EVENT = function (self, unit)
  1087. local nameplate = C_NamePlate.GetNamePlateForUnit (unit)
  1088. if (nameplate) then
  1089. local filter;
  1090. if (UnitIsUnit ("player", unit)) then
  1091. filter = "HELPFUL|INCLUDE_NAME_PLATE_ONLY|PLAYER";
  1092. else
  1093. local reaction = UnitReaction ("player", unit);
  1094. if (reaction and reaction <= 4) then
  1095. filter = "HARMFUL|PLAYER"; --"HARMFUL|INCLUDE_NAME_PLATE_ONLY|PLAYER"
  1096. elseif (reaction and reaction > 4) then
  1097. filter = "HELPFUL|PLAYER";
  1098. else
  1099. filter = "NONE";
  1100. end
  1101. end
  1102.  
  1103. nameplate.UnitFrame.BuffFrame:UpdateBuffs (unit, filter);
  1104. end
  1105. end
  1106. InstallOverride (NPF_Name, Plater.DriverFuncNames.OnAuraUpdate, Override_UNIT_AURA_EVENT)
  1107.  
  1108. local auraWatch = function (ticker)
  1109. ticker.cooldown.Timer:SetText (floor (ticker.expireTime-GetTime()))
  1110. end
  1111. local BUFF_MAX_DISPLAY = BUFF_MAX_DISPLAY
  1112. local CooldownFrame_Set = CooldownFrame_Set
  1113.  
  1114. function Plater.Override_UpdateBuffs (self, unit, filter)
  1115. --não esta sendo mais usado
  1116. if (true) then
  1117. return
  1118. end
  1119. end
  1120.  
  1121. InstallOverride (NPB_Name, Plater.DriverFuncNames.OnUpdateBuffs, Plater.Override_UpdateBuffs)
  1122. --buffcontainermixin é diferente de nameplate frame mixin
  1123.  
  1124. --sobrepõe a função, economiza processamento uma vez que o resultado da função original não é usado
  1125. local Override_UNIT_AURA_ANCHORUPDATE = function (self)
  1126. if (self.Point1) then
  1127. self:SetPoint (self.Point1, self.Anchor, self.Point2, self.X, self.Y)
  1128. end
  1129. end
  1130. InstallOverride (NPB_Name, Plater.DriverFuncNames.OnUpdateAnchor, Override_UNIT_AURA_ANCHORUPDATE)
  1131.  
  1132. --tamanho dos ícones dos debuffs sobre a nameplate
  1133. function Plater.UpdateAuraIcons (self, unit, filter)
  1134. local hasCC = false
  1135. local show_cc = Plater.db.profile.debuff_show_cc
  1136. local amtDebuffs = 0
  1137.  
  1138. local auraWidth = Plater.db.profile.aura_width
  1139. local auraHeight = Plater.db.profile.aura_height
  1140.  
  1141. for _, buffFrame in ipairs (self.buffList) do
  1142. if (buffFrame:IsShown()) then
  1143. buffFrame:SetSize (auraWidth, auraHeight)
  1144. buffFrame.Icon:SetSize (auraWidth-2, auraHeight-2)
  1145. amtDebuffs = amtDebuffs + 1
  1146. end
  1147. end
  1148.  
  1149. if (show_cc) then
  1150. for i = 1, BUFF_MAX_DISPLAY do
  1151. local name, rank, texture, count, debuffType, duration, expirationTime, caster, canStealOrPurge, nameplateShowPersonal, spellId = UnitDebuff (unit, i, nil, "HARMFUL") --, nil, "HARMFUL"
  1152. if (not name) then
  1153. break
  1154. end
  1155. if (Plater.SpellIsCC (name)) then
  1156. hasCC = name
  1157. break
  1158. end
  1159. end
  1160. end
  1161.  
  1162. self.amtDebuffs = amtDebuffs
  1163. Plater.UpdateBuffContainer (self:GetParent():GetParent())
  1164.  
  1165. if (show_cc) then
  1166. local UnitFrame = self:GetParent()
  1167. if (hasCC) then
  1168. local _, _, icon = GetSpellInfo (hasCC)
  1169. UnitFrame.ExtraIconFrame:SetIcon (icon, true)
  1170. --UnitFrame.ExtraIcon1Timer:Show()
  1171. --UnitFrame.ExtraIcon1:SetTexture (icon)
  1172. UnitFrame.hasCC = hasCC
  1173. else
  1174. if (UnitFrame.hasCC) then
  1175. UnitFrame.ExtraIconFrame:Hide()
  1176. --UnitFrame.ExtraIcon1:Hide()
  1177. --UnitFrame.ExtraIcon1Timer:Hide()
  1178. UnitFrame.hasCC = nil
  1179. end
  1180. end
  1181. end
  1182. end
  1183. InstallHook (Plater.GetDriverGlobalObject (NPB_Name), Plater.DriverFuncNames.OnUpdateBuffs, Plater.UpdateAuraIcons)
  1184. function Plater.RefreshAuras()
  1185. for _, plateFrame in ipairs (Plater.GetAllShownPlates()) do
  1186. Plater.UpdateAuraIcons (plateFrame.UnitFrame.BuffFrame, plateFrame [MEMBER_UNITID])
  1187. end
  1188. end
  1189.  
  1190. function Plater.PlateShowingDebuffFrame (plateFrame)
  1191. if (plateFrame.order == 3 and Plater.IsShowingResourcesOnTarget() and UnitIsUnit (plateFrame [MEMBER_UNITID], "target")) then --3 castbar, health, buffs
  1192. --puxa os resources pra cima
  1193. local SizeOf_healthBar_Height = plateFrame.UnitFrame.healthBar:GetHeight()
  1194. NamePlateTargetResourceFrame:SetPoint ("BOTTOM", plateFrame.UnitFrame.name, "TOP", 0, -4 + SizeOf_healthBar_Height + (Plater.db.profile.aura_height))
  1195. end
  1196. end
  1197.  
  1198. function Plater.PlateNotShowingDebuffFrame (plateFrame)
  1199. if (plateFrame.order == 3 and Plater.IsShowingResourcesOnTarget() and UnitIsUnit (plateFrame [MEMBER_UNITID], "target")) then --3 castbar, health, buffs
  1200. --puxa os resources pra baixo
  1201. local SizeOf_healthBar_Height = plateFrame.UnitFrame.healthBar:GetHeight()
  1202. NamePlateTargetResourceFrame:SetPoint ("BOTTOM", plateFrame.UnitFrame.name, "TOP", 0, -4 + SizeOf_healthBar_Height)
  1203. end
  1204. end
  1205.  
  1206. --1 debuff, health, castbar
  1207. --2 health, buffs, castbar
  1208. --3 castbar, health, buffs
  1209.  
  1210. function Plater.UpdateBuffContainer (plateFrame)
  1211. if ((plateFrame.UnitFrame.BuffFrame.amtDebuffs or 0) > 0) then
  1212. --esta plate possui debuffs sendo mostrados
  1213. Plater.PlateShowingDebuffFrame (plateFrame)
  1214. else
  1215. --esta plate não tem debuffs
  1216. Plater.PlateNotShowingDebuffFrame (plateFrame)
  1217. end
  1218. end
  1219.  
  1220. InstallHook (Plater.GetDriverGlobalObject (NPF_Name), Plater.DriverFuncNames.OnResourceUpdate, function (self, onTarget, resourceFrame)
  1221.  
  1222. --atualiza o tamanho da barra de mana
  1223. Plater.UpdateManaAndResourcesBar()
  1224.  
  1225. if (not onTarget) then
  1226. -- ele esta chamando duas vezes, uma com resources no alvo e outra não
  1227. --ignorarando a que ele diz que não esta no alvo
  1228. return
  1229. end
  1230.  
  1231. local plateFrame = C_NamePlate.GetNamePlateForUnit ("target")
  1232.  
  1233. if (plateFrame) then
  1234. local order = plateFrame.order
  1235. if (order == 1) then
  1236. NamePlateTargetResourceFrame:SetPoint ("BOTTOM", plateFrame.UnitFrame.name, "TOP", 0, 4);
  1237. elseif (order == 2) then
  1238. NamePlateTargetResourceFrame:SetPoint ("BOTTOM", plateFrame.UnitFrame.name, "TOP", 0, 4);
  1239. elseif (order == 3) then
  1240. Plater.UpdateBuffContainer (plateFrame)
  1241. end
  1242. end
  1243. end)
  1244.  
  1245. InstallHook (Plater.GetDriverSubObjectName (CBF_Name, Plater.DriverFuncNames.OnCastBarShow), function (self)
  1246. local plateFrame = C_NamePlate.GetNamePlateForUnit (self.unit or "")
  1247. if (plateFrame) then
  1248. if (plateFrame:GetAlpha() < 0.55) then
  1249. plateFrame.UnitFrame.castBar.extraBackground:Show()
  1250. else
  1251. plateFrame.UnitFrame.castBar.extraBackground:Hide()
  1252. end
  1253. end
  1254. end)
  1255.  
  1256. InstallHook (Plater.GetDriverSubObjectName (CBF_Name, Plater.DriverFuncNames.OnCastBarEvent), function (self, event, ...)
  1257.  
  1258. local unit = ...
  1259.  
  1260. if (event == "PLAYER_ENTERING_WORLD") then
  1261. if (not self.isNamePlate) then
  1262. return
  1263. end
  1264.  
  1265. unit = self.unit
  1266.  
  1267. local castname = UnitCastingInfo (unit)
  1268. local channelname = UnitChannelInfo (unit)
  1269. if (castname) then
  1270. event = "UNIT_SPELLCAST_START"
  1271. elseif (channelname) then
  1272. event = "UNIT_SPELLCAST_CHANNEL_START"
  1273. else
  1274. return
  1275. end
  1276. end
  1277.  
  1278. if (self.percentText) then
  1279. if (event == "UNIT_SPELLCAST_START") then
  1280. local unitCast = unit
  1281. if (unitCast ~= self.unit or not self.isNamePlate) then
  1282. return
  1283. end
  1284. local name, nameSubtext, text, texture, startTime, endTime, isTradeSkill, castID, notInterruptible, arg10 = UnitCastingInfo (unitCast)
  1285. self.Icon:SetTexture (texture)
  1286. self.Icon:Show()
  1287. self.Icon:SetDrawLayer ("OVERLAY", 5)
  1288. if (notInterruptible) then
  1289. self.BorderShield:ClearAllPoints()
  1290. self.BorderShield:SetPoint ("center", self.Icon, "center")
  1291. self.BorderShield:SetDrawLayer ("OVERLAY", 6)
  1292. self.BorderShield:Show()
  1293. else
  1294. self.BorderShield:Hide()
  1295. end
  1296.  
  1297. if (notInterruptible) then
  1298. self:SetStatusBarColor (unpack (Plater.db.profile.cast_statusbar_color_nointerrupt))
  1299. else
  1300. self:SetStatusBarColor (unpack (Plater.db.profile.cast_statusbar_color))
  1301. end
  1302.  
  1303. self.ReUpdateNextTick = true
  1304. self.ThrottleUpdate = 1
  1305.  
  1306. elseif (event == "UNIT_SPELLCAST_CHANNEL_START") then
  1307. local unitCast = unit
  1308. if (unitCast ~= self.unit or not self.isNamePlate) then
  1309. return
  1310. end
  1311.  
  1312. local name, nameSubtext, text, texture, startTime, endTime, isTradeSkill, notInterruptible = UnitChannelInfo (unitCast)
  1313.  
  1314. self.Icon:SetTexture (texture)
  1315. self.Icon:Show()
  1316. self.Icon:SetDrawLayer ("OVERLAY", 5)
  1317. if (notInterruptible) then
  1318. self.BorderShield:ClearAllPoints()
  1319. self.BorderShield:SetPoint ("center", self.Icon, "center")
  1320. self.BorderShield:SetDrawLayer ("OVERLAY", 6)
  1321. self.BorderShield:Show()
  1322. else
  1323. self.BorderShield:Hide()
  1324. end
  1325.  
  1326. if (notInterruptible) then
  1327. self:SetStatusBarColor (unpack (Plater.db.profile.cast_statusbar_color_nointerrupt))
  1328. else
  1329. self:SetStatusBarColor (unpack (Plater.db.profile.cast_statusbar_color))
  1330. end
  1331.  
  1332. self.ReUpdateNextTick = true
  1333. self.ThrottleUpdate = 1
  1334.  
  1335. end
  1336. end
  1337. end)
  1338.  
  1339. InstallHook (Plater.GetDriverSubObjectName (CBF_Name, Plater.DriverFuncNames.OnTick), function (self, deltaTime)
  1340. if (self.percentText) then --é uma castbar do plater?
  1341. self.ThrottleUpdate = self.ThrottleUpdate - deltaTime
  1342. if (self.ThrottleUpdate < 0) then
  1343. if (self.casting) then
  1344. self.percentText:SetText (format ("%.1f", abs (self.value - self.maxValue)))
  1345. elseif (self.channeling) then
  1346. self.percentText:SetText (format ("%.1f", abs (self.value - self.maxValue)))
  1347. else
  1348. self.percentText:SetText ("")
  1349. end
  1350.  
  1351. if (self.ReUpdateNextTick) then
  1352. self.BorderShield:ClearAllPoints()
  1353. self.BorderShield:SetPoint ("center", self.Icon, "center")
  1354. self.ReUpdateNextTick = nil
  1355. end
  1356.  
  1357. self.ThrottleUpdate = DB_TICK_THROTTLE
  1358. end
  1359. end
  1360. end)
  1361.  
  1362. InstallHook (Plater.GetDriverSubObjectName (CUF_Name, Plater.DriverFuncNames.OnUpdateHealth), function (self)
  1363. local plateFrame = self:GetParent()
  1364. if (plateFrame.isNamePlate) then
  1365. if (plateFrame.isSelf) then
  1366. local healthBar = self.healthBar
  1367. local min, max = healthBar:GetMinMaxValues()
  1368. if (healthBar:GetValue() / max < 0.27) then
  1369. if (not healthBar.PlayHealthFlash) then
  1370. Plater.CreateHealthFlashFrame (plateFrame)
  1371. end
  1372. healthBar.PlayHealthFlash()
  1373. else
  1374. if (healthBar.PlayHealthFlash) then
  1375. if (healthBar:GetValue() / max > 0.5) then
  1376. healthBar.canHealthFlash = true
  1377. end
  1378. end
  1379. end
  1380. else
  1381. local currentHealth = UnitHealth (plateFrame [MEMBER_UNITID])
  1382. self.healthBar:SetValue (currentHealth)
  1383. end
  1384. end
  1385. end)
  1386.  
  1387. local powerPercent = ClassNameplateManaBarFrame:CreateFontString (nil, "overlay", "GameFontNormal")
  1388. ClassNameplateManaBarFrame.powerPercent = powerPercent
  1389. powerPercent:SetPoint ("center")
  1390. powerPercent:SetText ("100%")
  1391.  
  1392. ClassNameplateManaBarFrame:HookScript ("OnValueChanged", function (self)
  1393. ClassNameplateManaBarFrame.powerPercent:SetText (floor (self:GetValue()/select (2, self:GetMinMaxValues()) * 100) .. "%")
  1394. end)
  1395.  
  1396. InstallHook (Plater.GetDriverGlobalObject (NPF_Name), Plater.DriverFuncNames.OnRaidTargetUpdate, function()
  1397. if (InCombatLockdown()) then
  1398. Plater.UpdateRaidMarker()
  1399. end
  1400. end)
  1401.  
  1402. InstallHook (Plater.GetDriverGlobalObject (NPF_Name), Plater.DriverFuncNames.OnOptionsUpdate, function()
  1403. Plater.UpdateSelfPlate()
  1404. end)
  1405. InstallHook (Plater.GetDriverGlobalObject (MAB_Name), Plater.DriverFuncNames.OnManaBarOptionsUpdate, function()
  1406. ClassNameplateManaBarFrame:SetSize (unpack (DB_PLATE_CONFIG.player.mana))
  1407. end)
  1408.  
  1409. --> ~db
  1410. Plater.db.RegisterCallback (Plater, "OnProfileChanged", "RefreshConfig")
  1411. Plater.db.RegisterCallback (Plater, "OnProfileCopied", "RefreshConfig")
  1412. Plater.db.RegisterCallback (Plater, "OnProfileReset", "RefreshConfig")
  1413. --Plater.db.RegisterCallback (Plater, "OnNewProfile", "RefreshConfig")
  1414. --Plater.db.RegisterCallback (Plater, "OnProfileDeleted", "RefreshConfig")
  1415. --Plater.db.RegisterCallback (Plater, "OnDatabaseReset", "RefreshConfig")
  1416.  
  1417. Plater.UpdateSelfPlate()
  1418. Plater.UpdateUseClassColors()
  1419. Plater.GetFactionNpcLocs()
  1420.  
  1421. C_Timer.After (4.1, Plater.QuestLogUpdated)
  1422. C_Timer.After (5.1, Plater.UpdateAllPlates)
  1423.  
  1424. for i = 1, 3 do
  1425. C_Timer.After (i, Plater.RefreshDBUpvalues)
  1426. end
  1427.  
  1428. end
  1429.  
  1430. function Plater.UpdateAllNames()
  1431. for _, plateFrame in ipairs (Plater.GetAllShownPlates()) do
  1432. if (plateFrame.actorType == ACTORTYPE_PLAYER) then
  1433. plateFrame.NameAnchor = 0
  1434. elseif (plateFrame.actorType == UNITREACTION_FRIENDLY) then
  1435. plateFrame.NameAnchor = DB_NAME_PLAYERFRIENDLY_ANCHOR
  1436. elseif (plateFrame.actorType == ACTORTYPE_ENEMY_PLAYER) then
  1437. plateFrame.NameAnchor = DB_NAME_PLAYERENEMY_ANCHOR
  1438. elseif (plateFrame.actorType == ACTORTYPE_FRIENDLY_NPC) then
  1439. plateFrame.NameAnchor = DB_NAME_NPCFRIENDLY_ANCHOR
  1440. elseif (plateFrame.actorType == ACTORTYPE_ENEMY_NPC) then
  1441. plateFrame.NameAnchor = DB_NAME_NPCENEMY_ANCHOR
  1442. end
  1443.  
  1444. Plater.UpdateUnitName (plateFrame)
  1445. end
  1446. end
  1447.  
  1448. function Plater.UpdateTextSize (plateFrame, nameString)
  1449. local stringSize = max (plateFrame.UnitFrame.healthBar:GetWidth() - 6, 44)
  1450. local name = plateFrame [MEMBER_NAME]
  1451.  
  1452. nameString:SetText (name)
  1453.  
  1454. while (nameString:GetStringWidth() > stringSize) do
  1455. name = strsub (name, 1, #name-1)
  1456. nameString:SetText (name)
  1457. if (string.len (name) <= 1) then
  1458. break
  1459. end
  1460. end
  1461. end
  1462.  
  1463. function Plater.UpdateUnitName (plateFrame, fontString)
  1464. local nameString
  1465. if (plateFrame.onlyShowThePlayerName) then
  1466. nameString = plateFrame.actorSubTitleSolo
  1467. else
  1468. nameString = fontString or plateFrame.actorName
  1469. end
  1470.  
  1471. if (plateFrame.NameAnchor >= 9) then
  1472. local stringSize = max (plateFrame.UnitFrame.healthBar:GetWidth() - 6, 44)
  1473. local name = plateFrame [MEMBER_NAME]
  1474. local nameString = fontString or plateFrame.actorName
  1475.  
  1476. nameString:SetText (name)
  1477. local stringWidth = nameString:GetStringWidth()
  1478.  
  1479. if (stringWidth > stringSize and nameString == plateFrame.actorName) then
  1480. plateFrame:TickUpdate (true)
  1481. else
  1482. Plater.UpdateTextSize (plateFrame, nameString)
  1483. end
  1484. else
  1485. nameString:SetText (plateFrame [MEMBER_NAME])
  1486. end
  1487. end
  1488.  
  1489. local tick_update = function (self)
  1490. if (self.UpdateActorNameSize) then
  1491. Plater.UpdateTextSize (self:GetParent(), self:GetParent().actorName)
  1492. end
  1493.  
  1494. self.UpdateActorNameSize = nil
  1495. self:SetScript ("OnUpdate", nil)
  1496. end
  1497. function Plater.TickUpdate (plateFrame, UpdateActorNameSize)
  1498. plateFrame.OnNextTickUpdate.UpdateActorNameSize = UpdateActorNameSize
  1499. plateFrame.OnNextTickUpdate:SetScript ("OnUpdate", tick_update)
  1500. end
  1501.  
  1502. local re_update_self_plate = function()
  1503. Plater.UpdateSelfPlate()
  1504. end
  1505. function Plater.UpdateSelfPlate()
  1506. if (InCombatLockdown()) then
  1507. return C_Timer.After (.3, re_update_self_plate)
  1508. end
  1509. C_NamePlate.SetNamePlateSelfSize (unpack (DB_PLATE_CONFIG.player.health))
  1510. ClassNameplateManaBarFrame:SetSize (unpack (DB_PLATE_CONFIG.player.mana))
  1511. end
  1512.  
  1513. -- se o jogador estiver em combate, colorir a barra de acordo com o aggro do jogador ~aggro ãggro
  1514.  
  1515. local set_aggro_color = function (self, r, g, b) --self.actorName
  1516. if (DB_AGGRO_CHANGE_HEALTHBAR_COLOR) then
  1517. Plater.ForceChangeHealthBarColor (self, r, g, b)
  1518. end
  1519. if (DB_AGGRO_CHANGE_BORDER_COLOR) then
  1520. Plater.ForceChangeBorderColor (self, r, g, b)
  1521. end
  1522. if (DB_AGGRO_CHANGE_NAME_COLOR) then
  1523. self.actorName:SetTextColor (r, g, b)
  1524. end
  1525. end
  1526.  
  1527. function Plater.UpdateAggroPlates (self)
  1528. if (not self.displayedUnit or UnitIsPlayer (self.displayedUnit) or Plater.petCache [self:GetParent() [MEMBER_GUID]] or self.displayedUnit:match ("pet%d$")) then
  1529. --não computar aggro de jogadores inimigos
  1530. return
  1531. end
  1532.  
  1533. local isTanking, threatStatus = UnitDetailedThreatSituation ("player", self.displayedUnit)
  1534. -- (3 = securely tanking, 2 = insecurely tanking, 1 = not tanking but higher threat than tank, 0 = not tanking and lower threat than tank)
  1535.  
  1536. self.aggroGlowUpper:Hide()
  1537. self.aggroGlowLower:Hide()
  1538. --self:SetAlpha (1)
  1539.  
  1540. if (IsPlayerEffectivelyTank()) then --true or
  1541. --se o jogador é TANK
  1542.  
  1543. if (not isTanking) then
  1544. if (UnitAffectingCombat (self.displayedUnit)) then
  1545. --não há aggro neste mob mas ele esta participando do combate
  1546. Plater.ForceChangeHealthBarColor (self.healthBar, unpack (Plater.db.profile.tank.colors.noaggro))
  1547. if (self.PlateFrame [MEMBER_NOCOMBAT]) then
  1548. self.PlateFrame [MEMBER_NOCOMBAT] = nil
  1549. Plater.CheckRange (self.PlateFrame, true)
  1550. end
  1551. else
  1552. --não ha aggro e ele não esta participando do combate
  1553. if (self [MEMBER_REACTION] == 4) then
  1554. --o mob é um npc neutro, apenas colorir com a cor neutra
  1555. set_aggro_color (self.healthBar, 1, 1, 0)
  1556. else
  1557. set_aggro_color (self.healthBar, unpack (Plater.db.profile.tank.colors.nocombat))
  1558. end
  1559.  
  1560. if (Plater.db.profile.not_affecting_combat_enabled) then --not self.PlateFrame [MEMBER_NOCOMBAT] and
  1561. self.PlateFrame [MEMBER_NOCOMBAT] = true
  1562. self:SetAlpha (Plater.db.profile.not_affecting_combat_alpha)
  1563. end
  1564. end
  1565. else
  1566. --o jogador esta tankando e:
  1567. if (threatStatus == 3) then --esta tankando com segurança
  1568. set_aggro_color (self.healthBar, unpack (Plater.db.profile.tank.colors.aggro))
  1569. elseif (threatStatus == 2) then --esta tankando sem segurança
  1570. set_aggro_color (self.healthBar, unpack (Plater.db.profile.tank.colors.pulling))
  1571. self.aggroGlowUpper:Show()
  1572. self.aggroGlowLower:Show()
  1573. else --não esta tankando
  1574. set_aggro_color (self.healthBar, unpack (Plater.db.profile.tank.colors.noaggro))
  1575. end
  1576. if (self.PlateFrame [MEMBER_NOCOMBAT]) then
  1577. self.PlateFrame [MEMBER_NOCOMBAT] = nil
  1578. Plater.CheckRange (self.PlateFrame, true)
  1579. end
  1580. end
  1581. else
  1582. --o player é DPS
  1583.  
  1584. if (isTanking) then
  1585. --o jogador esta tankando como dps
  1586. set_aggro_color (self.healthBar, unpack (Plater.db.profile.dps.colors.aggro))
  1587. if (not self:GetParent().playerHasAggro) then
  1588. self:GetParent().PlayAggroFlash()
  1589. end
  1590. self:GetParent().playerHasAggro = true
  1591.  
  1592. if (self.PlateFrame [MEMBER_NOCOMBAT]) then
  1593. self.PlateFrame [MEMBER_NOCOMBAT] = nil
  1594. Plater.CheckRange (self.PlateFrame, true)
  1595. end
  1596. else
  1597. if (threatStatus == nil) then
  1598. self:GetParent().playerHasAggro = false
  1599.  
  1600. if (UnitAffectingCombat (self.displayedUnit)) then
  1601. set_aggro_color (self.healthBar, unpack (Plater.db.profile.dps.colors.noaggro))
  1602. self:GetParent().playerHasAggro = false
  1603.  
  1604. if (self.PlateFrame [MEMBER_NOCOMBAT]) then
  1605. self.PlateFrame [MEMBER_NOCOMBAT] = nil
  1606. Plater.CheckRange (self.PlateFrame, true)
  1607. end
  1608. else
  1609. --não ha aggro e ele não esta participando do combate
  1610. if (self [MEMBER_REACTION] == 4) then
  1611. --o mob é um npc neutro, apenas colorir com a cor neutra
  1612. set_aggro_color (self.healthBar, 1, 1, 0)
  1613. else
  1614. set_aggro_color (self.healthBar, unpack (Plater.db.profile.tank.colors.nocombat))
  1615. end
  1616.  
  1617. if (Plater.db.profile.not_affecting_combat_enabled) then --not self.PlateFrame [MEMBER_NOCOMBAT] and
  1618. self.PlateFrame [MEMBER_NOCOMBAT] = true
  1619. self:SetAlpha (Plater.db.profile.not_affecting_combat_alpha)
  1620. end
  1621. end
  1622. else
  1623. if (threatStatus == 3) then --o jogador esta tankando como dps
  1624. set_aggro_color (self.healthBar, unpack (Plater.db.profile.dps.colors.aggro))
  1625. if (not self:GetParent().playerHasAggro) then
  1626. self:GetParent().PlayAggroFlash()
  1627. end
  1628. self:GetParent().playerHasAggro = true
  1629. elseif (threatStatus == 2) then --esta tankando com pouco aggro
  1630. set_aggro_color (self.healthBar, unpack (Plater.db.profile.dps.colors.aggro))
  1631. self:GetParent().playerHasAggro = true
  1632. elseif (threatStatus == 1) then --esta quase puxando o aggro
  1633. set_aggro_color (self.healthBar, unpack (Plater.db.profile.dps.colors.pulling))
  1634. self:GetParent().playerHasAggro = false
  1635. self.aggroGlowUpper:Show()
  1636. self.aggroGlowLower:Show()
  1637. elseif (threatStatus == 0) then --não esta tankando
  1638. set_aggro_color (self.healthBar, unpack (Plater.db.profile.dps.colors.noaggro))
  1639. self:GetParent().playerHasAggro = false
  1640. end
  1641.  
  1642. if (self.PlateFrame [MEMBER_NOCOMBAT]) then
  1643. self.PlateFrame [MEMBER_NOCOMBAT] = nil
  1644. Plater.CheckRange (self.PlateFrame, true)
  1645. end
  1646. end
  1647. end
  1648. end
  1649. end
  1650.  
  1651.  
  1652.  
  1653. local auraWatch = function (ticker)
  1654. ticker.cooldown.Timer:SetText (floor (ticker.expireTime-GetTime()))
  1655. end
  1656. local BUFF_MAX_DISPLAY = BUFF_MAX_DISPLAY
  1657. local CooldownFrame_Set = CooldownFrame_Set
  1658.  
  1659. local AddAura = function (self, i, name, rank, texture, count, debuffType, duration, expirationTime, caster, canStealOrPurge, nameplateShowPersonal, spellId, isBuff)
  1660. if (not self.buffList[i]) then
  1661. local f = CreateFrame ("Frame", self:GetParent():GetName() .. "Buff" .. i, self, "NameplateBuffButtonTemplate")
  1662. self.buffList[i] = f
  1663. f:SetMouseClickEnabled(false)
  1664. f:SetBackdrop ({edgeFile = [[Interface\Buttons\WHITE8X8]], edgeSize = 1})
  1665. local timer = f.Cooldown:CreateFontString (nil, "overlay", "NumberFontNormal")
  1666. f.Cooldown.Timer = timer
  1667. timer:SetPoint ("center")
  1668.  
  1669. local auraWidth = Plater.db.profile.aura_width
  1670. local auraHeight = Plater.db.profile.aura_height
  1671. f:SetSize (auraWidth, auraHeight)
  1672. f.Icon:SetSize (auraWidth-2, auraHeight-2)
  1673. end
  1674.  
  1675. local buff = self.buffList [i]
  1676. buff:SetID (i)
  1677. buff.name = name
  1678. buff.spellId = spellId
  1679. buff.layoutIndex = i
  1680. buff.Icon:SetTexture(texture)
  1681. if (count > 1) then
  1682. buff.CountFrame.Count:SetText (count)
  1683. buff.CountFrame.Count:Show()
  1684. else
  1685. buff.CountFrame.Count:Hide()
  1686. end
  1687.  
  1688. if (isBuff) then
  1689. buff:SetBackdropBorderColor (1, 1, 0, 1)
  1690. else
  1691. buff:SetBackdropBorderColor (0, 0, 0, 0)
  1692. end
  1693.  
  1694. if (buff.Cooldown.TimerTicker and not buff.Cooldown.TimerTicker._cancelled) then
  1695. buff.Cooldown.TimerTicker:Cancel()
  1696. end
  1697.  
  1698. CooldownFrame_Set (buff.Cooldown, expirationTime - duration, duration, duration > 0, true)
  1699.  
  1700. if (Plater.db.profile.aura_timer) then
  1701. local timeLeft = expirationTime - GetTime()
  1702. local ticker = C_Timer.NewTicker (.33, auraWatch, timeLeft*3)
  1703. ticker.expireTime = expirationTime
  1704. ticker.cooldown = buff.Cooldown
  1705. buff.Cooldown.Timer:Show()
  1706. buff.Cooldown.TimerTicker = ticker
  1707. auraWatch (ticker)
  1708. else
  1709. buff.Cooldown.Timer:Hide()
  1710. end
  1711.  
  1712. buff:Show()
  1713. return buff
  1714. end
  1715.  
  1716. local hide_non_used_auraFrames = function (self, auraIndex)
  1717. for i = auraIndex, #self do
  1718. self[i]:Hide()
  1719. end
  1720. end
  1721.  
  1722. function Plater.UpdateAuras_Manual (self, unit)
  1723. local auraIndex = 1
  1724. --> buffs
  1725. for i = 1, #BUFF_CACHE do
  1726. local name, rank, texture, count, debuffType, duration, expirationTime, caster, canStealOrPurge, nameplateShowPersonal, spellId = UnitAura (unit, BUFF_CACHE [i]) --, nil, "HELPFUL"
  1727. if (name) then
  1728. AddAura (self, auraIndex, name, rank, texture, count, debuffType, duration, expirationTime, caster, canStealOrPurge, nameplateShowPersonal, spellId, true)
  1729. auraIndex = auraIndex + 1
  1730. end
  1731. end
  1732. --> debuffs
  1733. for i = 1, #DEBUFF_CACHE do
  1734. local name, rank, texture, count, debuffType, duration, expirationTime, caster, canStealOrPurge, nameplateShowPersonal, spellId = UnitAura (unit, DEBUFF_CACHE [i], nil, "HARMFUL|PLAYER")
  1735. if (name) then
  1736. AddAura (self, auraIndex, name, rank, texture, count, debuffType, duration, expirationTime, caster, canStealOrPurge, nameplateShowPersonal, spellId)
  1737. auraIndex = auraIndex + 1
  1738. end
  1739. end
  1740. --> esconde os frames não usados
  1741. hide_non_used_auraFrames (self.buffList, auraIndex)
  1742. end
  1743.  
  1744. function Plater.UpdateAuras_Automatic (self, unit)
  1745. local auraIndex = 1
  1746.  
  1747. --> debuff colocado pelo jogador
  1748. for i = 1, BUFF_MAX_DISPLAY do
  1749. local name, rank, texture, count, debuffType, duration, expirationTime, caster, canStealOrPurge, nameplateShowPersonal, spellId = UnitDebuff (unit, i, "HARMFUL|PLAYER")
  1750. if (not name) then
  1751. break
  1752. elseif (not DB_DEBUFF_BANNED [spellId] and not DB_BUFF_BANNED [spellId]) then
  1753. AddAura (self, auraIndex, name, rank, texture, count, debuffType, duration, expirationTime, caster, canStealOrPurge, nameplateShowPersonal, spellId)
  1754. auraIndex = auraIndex + 1
  1755. end
  1756. end
  1757. --> esconde os frames não usados
  1758. hide_non_used_auraFrames (self.buffList, auraIndex)
  1759. end
  1760. function Plater.UpdateAuras_Self_Automatic (self)
  1761. local auraIndex = 1
  1762.  
  1763. --> buffs do jogador
  1764. for i = 1, BUFF_MAX_DISPLAY do
  1765. local name, rank, texture, count, debuffType, duration, expirationTime, caster, canStealOrPurge, nameplateShowPersonal, spellId = UnitBuff ("player", i, nil, "PLAYER")
  1766. if (not name) then
  1767. break
  1768. elseif (not DB_DEBUFF_BANNED [spellId] and not DB_BUFF_BANNED [spellId]) then
  1769. AddAura (self, auraIndex, name, rank, texture, count, debuffType, duration, expirationTime, caster, canStealOrPurge, nameplateShowPersonal, spellId)
  1770. auraIndex = auraIndex + 1
  1771. end
  1772. end
  1773. --> esconde os frames não usados
  1774. hide_non_used_auraFrames (self.buffList, auraIndex)
  1775. end
  1776.  
  1777. -- ~ontick ~onupdate ~tick ~õnupdate
  1778. local EventTickFunction = function (tickFrame, deltaTime)
  1779.  
  1780. tickFrame.ThrottleUpdate = tickFrame.ThrottleUpdate - deltaTime
  1781. local unitFrame = tickFrame.UnitFrame
  1782.  
  1783. if (tickFrame.ThrottleUpdate < 0) then
  1784. --crowd control
  1785. if (unitFrame.hasCC) then
  1786. local name, rank, texture, count, debuffType, duration, expirationTime, caster, _, nameplateShowPersonal, spellId, _, _, _, nameplateShowAll = UnitDebuff (unitFrame.unit, unitFrame.hasCC)
  1787. if (expirationTime and duration) then
  1788. unitFrame.ExtraIcon1Timer:SetText (floor (expirationTime - GetTime()))
  1789. end
  1790. end
  1791.  
  1792. --range
  1793. Plater.CheckRange (tickFrame.PlateFrame)
  1794.  
  1795. --auras
  1796. if (DB_AURA_ENABLED) then
  1797. tickFrame.BuffFrame:UpdateAnchor()
  1798. if (DB_TRACK_METHOD == 0x1) then --automático
  1799. if (tickFrame.actorType == ACTORTYPE_PLAYER) then
  1800. Plater.UpdateAuras_Self_Automatic (tickFrame.BuffFrame)
  1801. else
  1802. Plater.UpdateAuras_Automatic (tickFrame.BuffFrame, tickFrame.unit)
  1803. end
  1804. else
  1805. Plater.UpdateAuras_Manual (tickFrame.BuffFrame, tickFrame.unit)
  1806. end
  1807. tickFrame.BuffFrame.unit = tickFrame.unit
  1808. tickFrame.BuffFrame:Layout()
  1809. tickFrame.BuffFrame:SetAlpha (DB_AURA_ALPHA)
  1810. end
  1811.  
  1812. --aggro
  1813. if (CAN_CHECK_AGGRO and InCombatLockdown()) then
  1814. if (tickFrame.PlateFrame [MEMBER_REACTION] <= 4 and not IsTapDenied (unitFrame)) then
  1815. --é um inimigo ou neutro
  1816. Plater.UpdateAggroPlates (unitFrame)
  1817. else
  1818. --o proprio jogo seta a cor da barra aqui
  1819. end
  1820.  
  1821. if (DB_PLATE_CONFIG [tickFrame.actorType].percent_text_enabled) then
  1822. Plater.UpdateLifePercentText (tickFrame.HealthBar.lifePercent, unitFrame.unit, DB_PLATE_CONFIG [tickFrame.actorType].percent_show_health)
  1823. end
  1824. else
  1825. --nao esta em combate, verifica se a porcetagem esta para mostrar fora de combate
  1826. if (DB_PLATE_CONFIG [tickFrame.actorType].percent_text_enabled and DB_PLATE_CONFIG [tickFrame.actorType].percent_text_ooc) then
  1827. Plater.UpdateLifePercentText (tickFrame.HealthBar.lifePercent, unitFrame.unit, DB_PLATE_CONFIG [tickFrame.actorType].percent_show_health)
  1828. tickFrame.HealthBar.lifePercent:Show()
  1829. end
  1830. end
  1831.  
  1832. tickFrame.ThrottleUpdate = DB_TICK_THROTTLE
  1833. end
  1834. end
  1835.  
  1836. --hooksecurefunc ("CompactUnitFrame_OnEvent", function (self, ...)
  1837.  
  1838. --end)
  1839. --considerSelectionInCombatAsHostile option
  1840. --UNIT_THREAT_LIST_UPDATE
  1841.  
  1842. function Plater.UpdateAllNameplateColors()
  1843. for _, plateFrame in ipairs (Plater.GetAllShownPlates()) do
  1844. CompactUnitFrame_UpdateHealthColor (plateFrame.UnitFrame)
  1845. end
  1846. end
  1847.  
  1848. function Plater.SetPlateBackground (plateFrame)
  1849. plateFrame:SetBackdrop ({bgFile = "Interface\\Tooltips\\UI-Tooltip-Background", tile = true, tileSize = 16, edgeFile = [[Interface\Buttons\WHITE8X8]], edgeSize = 1})
  1850. plateFrame:SetBackdropColor (0, 0, 0, 0.5)
  1851. plateFrame:SetBackdropBorderColor (0, 0, 0, 1)
  1852. end
  1853.  
  1854. local shutdown_platesize_debug = function (timer)
  1855. for _, plateFrame in ipairs (Plater.GetAllShownPlates()) do
  1856. if (Plater.db.profile.click_space_always_show) then
  1857. Plater.SetPlateBackground (plateFrame)
  1858. else
  1859. plateFrame:SetBackdrop (nil)
  1860. end
  1861. end
  1862. end
  1863.  
  1864. local re_UpdatePlateClickSpace = function()
  1865. Plater.UpdatePlateClickSpace()
  1866. end
  1867.  
  1868. function Plater.UpdatePlateClickSpace (plateFrame, needReorder, isDebug, isConceal)
  1869. if (plateFrame) then
  1870. --if (isConceal) then
  1871. -- if (Plater.CanChangePlateSize()) then
  1872.  
  1873. -- end
  1874. -- return
  1875. --end
  1876. if (Plater.db.profile.click_space_always_show) then
  1877. Plater.SetPlateBackground (plateFrame)
  1878. else
  1879. plateFrame:SetBackdrop (nil)
  1880. end
  1881. end
  1882.  
  1883. if (not plateFrame) then
  1884. if (not Plater.CanChangePlateSize()) then
  1885. return C_Timer.After (1, re_UpdatePlateClickSpace)
  1886. end
  1887. for _, plateFrame in ipairs (Plater.GetAllShownPlates()) do
  1888. Plater.UpdatePlateClickSpace (plateFrame, true, isDebug)
  1889. end
  1890. return
  1891. end
  1892.  
  1893. local width, height = Plater.db.profile.click_space[1], Plater.db.profile.click_space[2]
  1894. if (Plater.CanChangePlateSize()) then
  1895. --ajusta o tamanho de uma unica barra
  1896. plateFrame:SetSize (width, height)
  1897. if (needReorder) then
  1898. Plater.UpdatePlateFrame (plateFrame, plateFrame.actorType)
  1899. end
  1900. if (isDebug and not Plater.db.profile.click_space_always_show) then
  1901. plateFrame:SetBackdrop ({bgFile = "Interface\\Tooltips\\UI-Tooltip-Background", tile = true, tileSize = 16, edgeFile = [[Interface\Buttons\WHITE8X8]], edgeSize = 1})
  1902. if (Plater.PlateSizeDebugTimer and not Plater.PlateSizeDebugTimer._cancelled) then
  1903. Plater.PlateSizeDebugTimer:Cancel()
  1904. end
  1905. Plater.PlateSizeDebugTimer = C_Timer.NewTimer (3, shutdown_platesize_debug)
  1906. end
  1907. end
  1908. end
  1909.  
  1910. function Plater.UpdateAllPlates (forceUpdate, justAdded)
  1911. for _, plateFrame in ipairs (Plater.GetAllShownPlates()) do
  1912. Plater.UpdatePlateFrame (plateFrame, nil, forceUpdate, justAdded)
  1913. end
  1914. end
  1915.  
  1916. function Plater.GetAllShownPlates()
  1917. return C_NamePlate.GetNamePlates()
  1918. end
  1919.  
  1920. -- ~events
  1921. function Plater:PLAYER_SPECIALIZATION_CHANGED()
  1922. Plater.GetSpellForRangeCheck()
  1923. end
  1924.  
  1925. function Plater.UpdateAuraCache()
  1926. if (DB_TRACKING_DEBUFFLIST) then
  1927. wipe (DEBUFF_CACHE)
  1928. for i = 1, #DB_TRACKING_DEBUFFLIST do
  1929. local spellName = GetSpellInfo (DB_TRACKING_DEBUFFLIST [i])
  1930. if (spellName) then
  1931. DEBUFF_CACHE [#DEBUFF_CACHE+1] = spellName
  1932. else
  1933. DEBUFF_CACHE [#DEBUFF_CACHE+1] = DB_TRACKING_DEBUFFLIST [i]
  1934. end
  1935. end
  1936. end
  1937. if (DB_TRACKING_BUFFLIST) then
  1938. wipe (BUFF_CACHE)
  1939. for i = 1, #DB_TRACKING_BUFFLIST do
  1940. local spellName = GetSpellInfo (DB_TRACKING_BUFFLIST [i])
  1941. if (spellName) then
  1942. BUFF_CACHE [#BUFF_CACHE+1] = spellName
  1943. else
  1944. BUFF_CACHE [#BUFF_CACHE+1] = DB_TRACKING_BUFFLIST [i]
  1945. end
  1946. end
  1947. end
  1948. end
  1949.  
  1950. function Plater:PLAYER_REGEN_DISABLED()
  1951. if (IsResting()) then
  1952. CAN_CHECK_AGGRO = false
  1953. else
  1954. CAN_CHECK_AGGRO = true
  1955. end
  1956.  
  1957. Plater.RegenIsDisabled = true
  1958.  
  1959. Plater.UpdateAuraCache()
  1960.  
  1961. C_Timer.After (0.5, Plater.UpdateAllPlates)
  1962. Plater.CombatTime = GetTime()
  1963. end
  1964. function Plater:PLAYER_REGEN_ENABLED()
  1965. CAN_CHECK_AGGRO = true
  1966.  
  1967. Plater.RegenIsDisabled = false
  1968.  
  1969. for _, plateFrame in ipairs (Plater.GetAllShownPlates()) do
  1970. plateFrame [MEMBER_NOCOMBAT] = nil
  1971. end
  1972.  
  1973. C_Timer.After (0.5, Plater.UpdateAllPlates)
  1974. Plater.UpdateAllNameplateColors()
  1975. end
  1976.  
  1977. function Plater.FRIENDLIST_UPDATE()
  1978. wipe (Plater.FriendsCache)
  1979. for i = 1, GetNumFriends() do
  1980. local toonName, level, class, area, connected, status, note = GetFriendInfo (i)
  1981. if (connected and toonName) then
  1982. Plater.FriendsCache [toonName] = true
  1983. end
  1984. end
  1985. for i = 1, BNGetNumFriends() do
  1986. local presenceID, presenceName, battleTag, isBattleTagPresence, toonName, toonID, client, isOnline, lastOnline, isAFK, isDND, messageText, noteText, isRIDFriend, broadcastTime, canSoR = BNGetFriendInfo (i)
  1987. if (isOnline and toonName) then
  1988. Plater.FriendsCache [toonName] = true
  1989. end
  1990. end
  1991. Plater.UpdateAllPlates()
  1992. end
  1993.  
  1994. function Plater:QUEST_ACCEPTED()
  1995. Plater.QuestLogUpdated()
  1996. end
  1997. function Plater:QUEST_ACCEPT_CONFIRM()
  1998. Plater.QuestLogUpdated()
  1999. end
  2000. function Plater:QUEST_COMPLETE()
  2001. Plater.QuestLogUpdated()
  2002. end
  2003. function Plater:QUEST_POI_UPDATE()
  2004. Plater.QuestLogUpdated()
  2005. end
  2006. function Plater:QUEST_QUERY_COMPLETE()
  2007. Plater.QuestLogUpdated()
  2008. end
  2009. function Plater:QUEST_DETAIL()
  2010. Plater.QuestLogUpdated()
  2011. end
  2012. function Plater:QUEST_FINISHED()
  2013. Plater.QuestLogUpdated()
  2014. end
  2015. function Plater:QUEST_GREETING()
  2016. Plater.QuestLogUpdated()
  2017. end
  2018. function Plater:QUEST_LOG_UPDATE()
  2019. Plater.QuestLogUpdated()
  2020. end
  2021. function Plater:UNIT_QUEST_LOG_CHANGED()
  2022. Plater.QuestLogUpdated()
  2023. end
  2024.  
  2025. function Plater:PLAYER_TARGET_CHANGED()
  2026. Plater.OnPlayerTargetChanged()
  2027. end
  2028.  
  2029. local wait_for_leave_combat = function()
  2030. Plater:ZONE_CHANGED_NEW_AREA()
  2031. end
  2032. function Plater:ZONE_CHANGED_NEW_AREA()
  2033. if (InCombatLockdown()) then
  2034. C_Timer.After (1, wait_for_leave_combat)
  2035. return
  2036. end
  2037.  
  2038. local pvpType, isFFA, faction = GetZonePVPInfo()
  2039. Plater.zonePvpType = pvpType
  2040.  
  2041. local name, instanceType, difficultyID, difficultyName, maxPlayers, dynamicDifficulty, isDynamic, instanceMapID, instanceGroupSize = GetInstanceInfo()
  2042. Plater.zoneInstanceType = instanceType
  2043. Plater.UpdateAllPlates()
  2044. end
  2045.  
  2046. function Plater:ZONE_CHANGED_INDOORS()
  2047. return Plater:ZONE_CHANGED_NEW_AREA()
  2048. end
  2049.  
  2050. function Plater:ZONE_CHANGED()
  2051. return Plater:ZONE_CHANGED_NEW_AREA()
  2052. end
  2053.  
  2054. function Plater:PLAYER_ENTERING_WORLD()
  2055. C_Timer.After (1, Plater.ZONE_CHANGED_NEW_AREA)
  2056. C_Timer.After (1, Plater.FRIENDLIST_UPDATE)
  2057. Plater.PlayerGuildName = GetGuildInfo ("player")
  2058. if (not Plater.PlayerGuildName or Plater.PlayerGuildName == "") then
  2059. Plater.PlayerGuildName = "ThePlayerHasNoGuildName/30Char"
  2060. end
  2061.  
  2062. local pvpType, isFFA, faction = GetZonePVPInfo()
  2063. Plater.zonePvpType = pvpType
  2064.  
  2065. local name, instanceType, difficultyID, difficultyName, maxPlayers, dynamicDifficulty, isDynamic, instanceMapID, instanceGroupSize = GetInstanceInfo()
  2066. Plater.zoneInstanceType = instanceType
  2067.  
  2068. end
  2069. Plater:RegisterEvent ("PLAYER_ENTERING_WORLD")
  2070.  
  2071. function Plater.OnPlayerTargetChanged()
  2072. for index, plateFrame in ipairs (Plater.GetAllShownPlates()) do
  2073. Plater.UpdateTarget (plateFrame)
  2074. end
  2075. end
  2076. -- ~target
  2077. function Plater.UpdateTarget (plateFrame)
  2078. if (UnitIsUnit (plateFrame [MEMBER_UNITID], "target") and Plater.db.profile.target_highlight) then
  2079. plateFrame.TargetNeonUp:Show()
  2080. plateFrame.TargetNeonDown:Show()
  2081. plateFrame [MEMBER_TARGET] = true
  2082. Plater.UpdateTargetPoints (plateFrame)
  2083. Plater.UpdateTargetTexture (plateFrame)
  2084.  
  2085. --o target nunca tem obscuração
  2086. --tocar a animação se necessário
  2087. plateFrame.Obscured:Hide()
  2088. else
  2089. plateFrame.TargetNeonUp:Hide()
  2090. plateFrame.TargetNeonDown:Hide()
  2091. plateFrame [MEMBER_TARGET] = nil
  2092.  
  2093. if (DB_TARGET_SHADY_ENABLED and (not DB_TARGET_SHADY_COMBATONLY or Plater.RegenIsDisabled)) then
  2094. if (not plateFrame.Obscured:IsShown()) then
  2095. --tocar a animação de fade in
  2096. --botar a texture de obscure
  2097. end
  2098. plateFrame.Obscured:Show()
  2099. plateFrame.Obscured:SetAlpha (DB_TARGET_SHADY_ALPHA)
  2100. else
  2101. plateFrame.Obscured:Hide()
  2102. end
  2103. end
  2104. Plater.CheckRange (plateFrame, true)
  2105. end
  2106.  
  2107. function Plater.UpdateTargetPoints (plateFrame)
  2108. local healthBar = plateFrame.UnitFrame.healthBar
  2109. local width = healthBar:GetWidth()
  2110. local x = width/14
  2111. local alpha = Plater.db.profile.target_highlight_alpha
  2112. plateFrame.TargetNeonUp:SetAlpha (alpha)
  2113. plateFrame.TargetNeonUp:SetPoint ("topleft", healthBar, "bottomleft", -x, 0)
  2114. plateFrame.TargetNeonUp:SetPoint ("topright", healthBar, "bottomright", x, 0)
  2115. plateFrame.TargetNeonDown:SetAlpha (alpha)
  2116. plateFrame.TargetNeonDown:SetPoint ("bottomleft", healthBar, "topleft", -x, 0)
  2117. plateFrame.TargetNeonDown:SetPoint ("bottomright", healthBar, "topright", x, 0)
  2118. end
  2119.  
  2120. function Plater.UpdateTargetTexture (plateFrame)
  2121. preset = TargetIndicators [Plater.db.profile.target_indicator]
  2122.  
  2123. local width, height = preset.width, preset.height
  2124. local x, y = preset.x, preset.y
  2125. local desaturated = preset.desaturated
  2126. local coords = preset.coords
  2127. local path = preset.path
  2128.  
  2129. if (#coords == 4) then
  2130. for i = 1, 4 do
  2131. local texture = Plater.TargetTextures4Sides [i]
  2132. texture:Show()
  2133. texture:SetParent (plateFrame.UnitFrame.healthBar)
  2134. texture:SetTexture (path)
  2135. texture:SetTexCoord (unpack (coords [i]))
  2136. texture:SetSize (width, height)
  2137. texture:SetDesaturated (desaturated)
  2138. if (i == 1) then
  2139. texture:SetPoint ("topleft", -x, y)
  2140. elseif (i == 2) then
  2141. texture:SetPoint ("bottomleft", -x, -y)
  2142. elseif (i == 3) then
  2143. texture:SetPoint ("bottomright", x, -y)
  2144. elseif (i == 4) then
  2145. texture:SetPoint ("topright", x, y)
  2146. end
  2147. end
  2148. for i = 1, 2 do
  2149. Plater.TargetTextures2Sides [i]:Hide()
  2150. end
  2151. else
  2152. for i = 1, 2 do
  2153. local texture = Plater.TargetTextures2Sides [i]
  2154. texture:Show()
  2155. texture:SetParent (plateFrame.UnitFrame.healthBar)
  2156. texture:SetTexture (path)
  2157. texture:SetTexCoord (unpack (coords [i]))
  2158. texture:SetSize (width, height)
  2159. texture:SetDesaturated (desaturated)
  2160. if (i == 1) then
  2161. texture:SetPoint ("left", -x, y)
  2162. elseif (i == 2) then
  2163. texture:SetPoint ("right", x, -y)
  2164. end
  2165. end
  2166. for i = 1, 4 do
  2167. Plater.TargetTextures4Sides [i]:Hide()
  2168. end
  2169. end
  2170. end
  2171.  
  2172. function Plater.CreateHealthFlashFrame (plateFrame)
  2173. local f_anim = CreateFrame ("frame", nil, plateFrame.UnitFrame.healthBar)
  2174. f_anim:SetFrameLevel (plateFrame.UnitFrame.healthBar:GetFrameLevel()-1)
  2175. f_anim:SetPoint ("topleft", plateFrame.UnitFrame.healthBar, "topleft", -2, 2)
  2176. f_anim:SetPoint ("bottomright", plateFrame.UnitFrame.healthBar, "bottomright", 2, -2)
  2177. plateFrame.UnitFrame.healthBar.canHealthFlash = true
  2178.  
  2179. local t = f_anim:CreateTexture (nil, "artwork")
  2180. t:SetColorTexture (1, 1, 1, 1)
  2181. t:SetAllPoints()
  2182. t:SetBlendMode ("ADD")
  2183.  
  2184. local animation = t:CreateAnimationGroup()
  2185. local anim1 = animation:CreateAnimation ("Alpha")
  2186. local anim2 = animation:CreateAnimation ("Alpha")
  2187. local anim3 = animation:CreateAnimation ("Alpha")
  2188. anim1:SetOrder (1)
  2189. anim1:SetFromAlpha (0)
  2190. anim1:SetToAlpha (1)
  2191. anim1:SetDuration (0.1)
  2192. anim2:SetOrder (2)
  2193. anim2:SetFromAlpha (1)
  2194. anim2:SetToAlpha (0)
  2195. anim2:SetDuration (0.1)
  2196. anim3:SetOrder (3)
  2197. anim3:SetFromAlpha (0)
  2198. anim3:SetToAlpha (1)
  2199. anim3:SetDuration (0.1)
  2200.  
  2201. animation:SetScript ("OnFinished", function (self)
  2202. f_anim:Hide()
  2203. end)
  2204. animation:SetScript ("OnPlay", function (self)
  2205. f_anim:Show()
  2206. end)
  2207.  
  2208. local do_flash_anim = function()
  2209. if (not plateFrame.UnitFrame.healthBar.canHealthFlash) then
  2210. return
  2211. end
  2212. plateFrame.UnitFrame.healthBar.canHealthFlash = false
  2213. f_anim:Show()
  2214. animation:Play()
  2215. end
  2216.  
  2217. f_anim:Hide()
  2218. plateFrame.UnitFrame.healthBar.PlayHealthFlash = do_flash_anim
  2219. end
  2220.  
  2221. function Plater.CreateAggroFlashFrame (plateFrame)
  2222.  
  2223. --local f_anim = CreateFrame ("frame", nil, plateFrame.UnitFrame.healthBar)
  2224. local f_anim = CreateFrame ("frame", nil, plateFrame)
  2225. f_anim:SetFrameLevel (plateFrame.UnitFrame.healthBar:GetFrameLevel()+3)
  2226. f_anim:SetPoint ("topleft", plateFrame.UnitFrame.healthBar, "topleft")
  2227. f_anim:SetPoint ("bottomright", plateFrame.UnitFrame.healthBar, "bottomright")
  2228.  
  2229. local t = f_anim:CreateTexture (nil, "artwork")
  2230. --t:SetTexCoord (0, 0.78125, 0, 0.66796875)
  2231. --t:SetTexture ([[Interface\AchievementFrame\UI-Achievement-Alert-Glow]])
  2232. t:SetColorTexture (1, 1, 1, 1)
  2233. t:SetAllPoints()
  2234. t:SetBlendMode ("ADD")
  2235. local s = f_anim:CreateFontString (nil, "overlay", "GameFontNormal")
  2236. s:SetText ("-AGGRO-")
  2237. s:SetTextColor (.70, .70, .70)
  2238. s:SetPoint ("center", t, "center")
  2239.  
  2240. local animation = t:CreateAnimationGroup()
  2241. local anim1 = animation:CreateAnimation ("Alpha")
  2242. local anim2 = animation:CreateAnimation ("Alpha")
  2243. anim1:SetOrder (1)
  2244. anim1:SetFromAlpha (0)
  2245. anim1:SetToAlpha (1)
  2246. anim1:SetDuration (0.2)
  2247. anim2:SetOrder (2)
  2248. anim2:SetFromAlpha (1)
  2249. anim2:SetToAlpha (0)
  2250. anim2:SetDuration (0.2)
  2251.  
  2252. animation:SetScript ("OnFinished", function (self)
  2253. f_anim:Hide()
  2254. end)
  2255. animation:SetScript ("OnPlay", function (self)
  2256. f_anim:Show()
  2257. end)
  2258.  
  2259. local do_flash_anim = function()
  2260. if (Plater.CombatTime+5 > GetTime()) then
  2261. return
  2262. end
  2263. f_anim:Show()
  2264. animation:Play()
  2265. end
  2266.  
  2267. f_anim:Hide()
  2268. plateFrame.PlayAggroFlash = do_flash_anim
  2269. end
  2270.  
  2271. function Plater.CanChangePlateSize()
  2272. return not InCombatLockdown()
  2273. end
  2274.  
  2275. local default_level_color = {r = 1.0, g = 0.82, b = 0.0}
  2276. local get_level_color = function (unitId, unitLevel)
  2277. if (UnitCanAttack ("player", unitId)) then
  2278. local playerLevel = UnitLevel ("player")
  2279. local color = GetRelativeDifficultyColor (playerLevel, unitLevel)
  2280. return color
  2281. end
  2282. return default_level_color
  2283. end
  2284.  
  2285. function Plater.UpdateLevelTextAndColor (plateFrame, unitId)
  2286. local level = UnitLevel (unitId)
  2287. if (not level) then
  2288. plateFrame:SetText ("")
  2289. elseif (level == -1) then
  2290. plateFrame:SetText ("??")
  2291. else
  2292. plateFrame:SetText (level)
  2293. end
  2294.  
  2295. local color = get_level_color (unitId, level)
  2296. plateFrame:SetTextColor (color.r, color.g, color.b)
  2297. end
  2298. local f = Plater.AllFrameNames or Plater.GlobalNames
  2299. local anchor_functions = {
  2300. function (widget, config)--1
  2301. widget:ClearAllPoints()
  2302. widget:SetPoint ("bottomleft", widget:GetParent(), "topleft", config.x, config.y)
  2303. end,
  2304. function (widget, config)--2
  2305. widget:ClearAllPoints()
  2306. widget:SetPoint ("right", widget:GetParent(), "left", config.x, config.y)
  2307. end,
  2308. function (widget, config)--3
  2309. widget:ClearAllPoints()
  2310. widget:SetPoint ("topleft", widget:GetParent(), "bottomleft", config.x, config.y)
  2311. end,
  2312. function (widget, config)--4
  2313. widget:ClearAllPoints()
  2314. widget:SetPoint ("top", widget:GetParent(), "bottom", config.x, config.y)
  2315. end,
  2316. function (widget, config)--5
  2317. widget:ClearAllPoints()
  2318. widget:SetPoint ("topright", widget:GetParent(), "bottomright", config.x, config.y)
  2319. end,
  2320. function (widget, config)--6
  2321. widget:ClearAllPoints()
  2322. widget:SetPoint ("left", widget:GetParent(), "right", config.x, config.y)
  2323. end,
  2324. function (widget, config)--7
  2325. widget:ClearAllPoints()
  2326. widget:SetPoint ("bottomright", widget:GetParent(), "topright", config.x, config.y)
  2327. end,
  2328. function (widget, config)--8
  2329. widget:ClearAllPoints()
  2330. widget:SetPoint ("bottom", widget:GetParent(), "top", config.x, config.y)
  2331. end,
  2332. function (widget, config)--9
  2333. widget:ClearAllPoints()
  2334. widget:SetPoint ("center", widget:GetParent(), "center", config.x, config.y)
  2335. end,
  2336. function (widget, config)--10
  2337. widget:ClearAllPoints()
  2338. widget:SetPoint ("left", widget:GetParent(), "left", config.x, config.y)
  2339. end,
  2340. function (widget, config)--11
  2341. widget:ClearAllPoints()
  2342. widget:SetPoint ("right", widget:GetParent(), "right", config.x, config.y)
  2343. end,
  2344. function (widget, config)--12
  2345. widget:ClearAllPoints()
  2346. widget:SetPoint ("top", widget:GetParent(), "top", config.x, config.y)
  2347. end,
  2348. function (widget, config)--13
  2349. widget:ClearAllPoints()
  2350. widget:SetPoint ("bottom", widget:GetParent(), "bottom", config.x, config.y)
  2351. end
  2352. }
  2353.  
  2354. function Plater.SetAnchor (widget, config)
  2355. anchor_functions [config.side] (widget, config)
  2356. end
  2357.  
  2358. --PlaterScanTooltip:SetOwner (WorldFrame, "ANCHOR_NONE")
  2359. local GameTooltipFrame = CreateFrame ("GameTooltip", "PlaterScanTooltip", nil, "GameTooltipTemplate")
  2360. local GameTooltipFrameTextLeft2 = _G ["PlaterScanTooltipTextLeft2"]
  2361. function Plater.GetActorSubName (plateFrame)
  2362. GameTooltipFrame:SetOwner (WorldFrame, "ANCHOR_NONE")
  2363. GameTooltipFrame:SetHyperlink ("unit:" .. (plateFrame [MEMBER_GUID] or ''))
  2364. return GameTooltipFrameTextLeft2:GetText()
  2365. end
  2366.  
  2367. local GameTooltipScanQuest = CreateFrame ("GameTooltip", "PlaterScanQuestTooltip", nil, "GameTooltipTemplate")
  2368. local ScanQuestTextCache = {}
  2369. for i = 1, 8 do
  2370. ScanQuestTextCache [i] = _G ["PlaterScanQuestTooltipTextLeft" .. i]
  2371. end
  2372.  
  2373. function Plater.IsQuestObjective (plateFrame)
  2374. if (not plateFrame [MEMBER_GUID]) then
  2375. return
  2376. end
  2377. GameTooltipScanQuest:SetOwner (WorldFrame, "ANCHOR_NONE")
  2378. GameTooltipScanQuest:SetHyperlink ("unit:" .. plateFrame [MEMBER_GUID])
  2379.  
  2380. for i = 1, 8 do
  2381. local text = ScanQuestTextCache [i]:GetText()
  2382. if (Plater.QuestCache [text]) then
  2383. --este npc percente a uma quest
  2384. if (not IsInGroup() and i < 8) then
  2385. --verifica se já fechou a quantidade necessária pra esse npc
  2386. local nextLineText = ScanQuestTextCache [i+1]:GetText()
  2387. if (nextLineText) then
  2388. local p1, p2 = nextLineText:match ("(%d%d)/(%d%d)") --^ -
  2389. if (not p1) then
  2390. p1, p2 = nextLineText:match ("(%d)/(%d%d)")
  2391. if (not p1) then
  2392. p1, p2 = nextLineText:match ("(%d)/(%d)")
  2393. end
  2394. end
  2395. if (p1 and p2 and p1 == p2) then
  2396. return
  2397. end
  2398. end
  2399. end
  2400.  
  2401. plateFrame [MEMBER_QUEST] = true
  2402. return true
  2403. end
  2404. end
  2405. end
  2406.  
  2407. local update_quest_cache = function()
  2408. wipe (Plater.QuestCache)
  2409. local numEntries, numQuests = GetNumQuestLogEntries()
  2410. for questId = 1, numEntries do
  2411. local title, level, suggestedGroup, isHeader, isCollapsed, isComplete, frequency, questId, startEvent, displayQuestID, isOnMap, hasLocalPOI, isTask, isStory = GetQuestLogTitle (questId)
  2412. if (type (questId) == "number" and questId > 0) then -- and not isComplete
  2413. Plater.QuestCache [title] = true
  2414. end
  2415. end
  2416.  
  2417. local mapId = GetCurrentMapAreaID()
  2418. local worldQuests = C_TaskQuest.GetQuestsForPlayerByMapID (mapId)
  2419. if (type (worldQuests) == "table") then
  2420. for i, questTable in ipairs (worldQuests) do
  2421. local x, y, floor, numObjectives, questId, inProgress = questTable.x, questTable.y, questTable.floor, questTable.numObjectives, questTable.questId, questTable.inProgress
  2422. if (type (questId) == "number" and questId > 0) then
  2423. local questName = C_TaskQuest.GetQuestInfoByQuestID (questId)
  2424. if (questName) then
  2425. Plater.QuestCache [questName] = true
  2426. end
  2427. end
  2428. end
  2429. end
  2430.  
  2431. Plater.UpdateAllPlates()
  2432. end
  2433.  
  2434. function Plater.QuestLogUpdated()
  2435. if (Plater.UpdateQuestCacheThrottle and not Plater.UpdateQuestCacheThrottle._cancelled) then
  2436. Plater.UpdateQuestCacheThrottle:Cancel()
  2437. end
  2438. Plater.UpdateQuestCacheThrottle = C_Timer.NewTimer (2, update_quest_cache)
  2439. end
  2440.  
  2441. function Plater.FormatTextForFriend (plateFrame, actorNameString, playerName, plateConfigs)
  2442. if (GetGuildInfo (plateFrame.UnitFrame.unit) == Plater.PlayerGuildName) then
  2443. --DF:SetFontColor (actorNameString, "lime")
  2444. DF:SetFontColor (actorNameString, "chartreuse")
  2445. DF:SetFontOutline (actorNameString, false)
  2446. end
  2447. end
  2448.  
  2449. -- ~updatetext
  2450. function Plater.UpdatePlateText (plateFrame, plateConfigs)
  2451.  
  2452. local spellnameString = plateFrame.UnitFrame.castBar.Text
  2453. local spellPercentString = plateFrame.UnitFrame.castBar.percentText
  2454. local nameString = plateFrame.UnitFrame.healthBar.actorName
  2455. local levelString = plateFrame.UnitFrame.healthBar.actorLevel
  2456. local lifeString = plateFrame.UnitFrame.healthBar.lifePercent
  2457.  
  2458. if (plateFrame.isSelf) then
  2459. --se a barra for do proprio jogador não tem porque setar o nome
  2460. nameString:SetText ("")
  2461.  
  2462. elseif (plateFrame.onlyShowThePlayerName) then
  2463.  
  2464. local playerName = plateFrame [MEMBER_NAME]
  2465. --local textString = plateFrame.actorNameSolo
  2466. local textString = plateFrame.actorSubTitleSolo
  2467.  
  2468. textString:Show()
  2469. Plater.UpdateUnitName (plateFrame, textString)
  2470.  
  2471. DF:SetFontSize (textString, plateConfigs.actorname_text_size)
  2472. DF:SetFontFace (textString, plateConfigs.actorname_text_font)
  2473. DF:SetFontOutline (textString, plateConfigs.actorname_text_shadow)
  2474. Plater.FormatTextForFriend (plateFrame, textString, playerName, plateConfigs)
  2475.  
  2476. if (Plater.FriendsCache [playerName]) then
  2477. DF:SetFontColor (textString, "aqua")
  2478. DF:SetFontOutline (textString, false)
  2479. plateFrame.isFriend = true
  2480. else
  2481. DF:SetFontColor (textString, plateConfigs.actorname_text_color)
  2482. plateFrame.isFriend = nil
  2483. end
  2484.  
  2485. else
  2486. --pega o nome do actor
  2487. local playerName = plateFrame.UnitFrame.name:GetText()
  2488.  
  2489. --atualiza o nome do jogador
  2490. DF:SetFontSize (nameString, plateConfigs.actorname_text_size)
  2491. DF:SetFontFace (nameString, plateConfigs.actorname_text_font)
  2492. DF:SetFontOutline (nameString, plateConfigs.actorname_text_shadow)
  2493. Plater.FormatTextForFriend (plateFrame, nameString, playerName, plateConfigs)
  2494.  
  2495. if (Plater.FriendsCache [playerName]) then
  2496. DF:SetFontColor (nameString, "aqua")
  2497. DF:SetFontOutline (nameString, false)
  2498. plateFrame.isFriend = true
  2499. else
  2500. --DF:SetFontColor (nameString, plateConfigs.actorname_text_color)
  2501. --if (plateFrame.actorType == ACTORTYPE_ENEMY_NPC or plateFrame.actorType == ACTORTYPE_ENEMY_PLAYER) then
  2502. --if (plateFrame.actorType ~= ACTORTYPE_FRIENDLY_NPC) then
  2503. DF:SetFontColor (nameString, plateConfigs.actorname_text_color)
  2504. --else
  2505. -- DF:SetFontColor (nameString, "white")
  2506. --end
  2507. plateFrame.isFriend = nil
  2508. end
  2509.  
  2510. Plater.SetAnchor (nameString, plateConfigs.actorname_text_anchor) --manda a tabela com .anchor .x e .y
  2511.  
  2512. Plater.UpdateUnitName (plateFrame)
  2513.  
  2514. --seta o nome na linha secundária
  2515. if (plateFrame.shouldShowNpcNameAndTitle) then
  2516.  
  2517. --> mostra todos os npcs
  2518. if (plateConfigs.all_names) then
  2519. --nome
  2520. plateFrame.actorNameSolo:Show()
  2521. --plateFrame.actorNameSolo:SetText (UnitName (plateFrame [MEMBER_UNITID]))
  2522. Plater.UpdateUnitName (plateFrame, plateFrame.actorNameSolo)
  2523.  
  2524. plateFrame.actorNameSolo:SetTextColor (unpack (plateConfigs.big_actorname_text_color))
  2525. DF:SetFontSize (plateFrame.actorNameSolo, plateConfigs.big_actorname_text_size)
  2526. DF:SetFontFace (plateFrame.actorNameSolo, plateConfigs.big_actorname_text_font)
  2527. DF:SetFontOutline (plateFrame.actorNameSolo, plateConfigs.big_actorname_text_shadow)
  2528. --profissão
  2529. local subTitle = Plater.GetActorSubName (plateFrame)
  2530. if (subTitle and subTitle ~= "" and not subTitle:match ("%d")) then
  2531. plateFrame.actorSubTitleSolo:Show()
  2532. plateFrame.actorSubTitleSolo:SetText ("<" .. subTitle .. ">")
  2533. plateFrame.actorSubTitleSolo:ClearAllPoints()
  2534. plateFrame.actorSubTitleSolo:SetPoint ("top", plateFrame.actorNameSolo, "bottom", 0, -2)
  2535.  
  2536. plateFrame.actorSubTitleSolo:SetTextColor (unpack (plateConfigs.big_actortitle_text_color))
  2537. DF:SetFontSize (plateFrame.actorSubTitleSolo, plateConfigs.big_actortitle_text_size)
  2538. DF:SetFontFace (plateFrame.actorSubTitleSolo, plateConfigs.big_actortitle_text_font)
  2539. DF:SetFontOutline (plateFrame.actorSubTitleSolo, plateConfigs.big_actortitle_text_shadow)
  2540. end
  2541. else
  2542. --faz o scan no tooltip para saber se é um npc relevante
  2543. local subTitle = Plater.GetActorSubName (plateFrame)
  2544. if (subTitle and subTitle ~= "" and not Plater.IsIgnored (plateFrame, true)) then
  2545. if (not subTitle:match ("%d")) then
  2546. --profession
  2547.  
  2548. -- DB_PLATE_CONFIG [actorType].relevant_and_proffesions
  2549. -- DB_PLATE_CONFIG [actorType].only_relevant
  2550.  
  2551. plateFrame.actorSubTitleSolo:Show()
  2552. plateFrame.actorSubTitleSolo:SetText ("<" .. subTitle .. ">")
  2553. --plateFrame.actorSubTitleSolo:SetText (subTitle)
  2554. plateFrame.actorSubTitleSolo:ClearAllPoints()
  2555. plateFrame.actorSubTitleSolo:SetPoint ("top", plateFrame.actorNameSolo, "bottom", 0, -2)
  2556.  
  2557. plateFrame.actorSubTitleSolo:SetTextColor (unpack (plateConfigs.big_actortitle_text_color))
  2558. DF:SetFontSize (plateFrame.actorSubTitleSolo, plateConfigs.big_actortitle_text_size)
  2559. DF:SetFontFace (plateFrame.actorSubTitleSolo, plateConfigs.big_actortitle_text_font)
  2560. DF:SetFontOutline (plateFrame.actorSubTitleSolo, plateConfigs.big_actortitle_text_shadow)
  2561.  
  2562. ---
  2563. --npc name
  2564. plateFrame.actorNameSolo:Show()
  2565. --plateFrame.actorNameSolo:SetText (UnitName (plateFrame [MEMBER_UNITID]))
  2566. Plater.UpdateUnitName (plateFrame, plateFrame.actorNameSolo)
  2567.  
  2568. plateFrame.actorNameSolo:SetTextColor (unpack (plateConfigs.big_actorname_text_color))
  2569. DF:SetFontSize (plateFrame.actorNameSolo, plateConfigs.big_actorname_text_size)
  2570. DF:SetFontFace (plateFrame.actorNameSolo, plateConfigs.big_actorname_text_font)
  2571. DF:SetFontOutline (plateFrame.actorNameSolo, plateConfigs.big_actorname_text_shadow)
  2572. end
  2573. end
  2574. end
  2575. elseif (plateFrame.shouldShowNpcTitle) then
  2576. local subTitle = Plater.GetActorSubName (plateFrame)
  2577. if (subTitle and subTitle ~= "" and not subTitle:match ("%d") and not Plater.IsIgnored (plateFrame, true)) then
  2578. plateFrame.actorSubTitleSolo:Show()
  2579. plateFrame.actorNameSolo:SetText ("")
  2580. plateFrame.actorSubTitleSolo:SetText (subTitle)
  2581. plateFrame.actorSubTitleSolo:ClearAllPoints()
  2582. plateFrame.actorSubTitleSolo:SetPoint ("top", plateFrame.actorNameSolo, "bottom", 0, 3)
  2583.  
  2584. plateFrame.actorSubTitleSolo:SetTextColor (unpack (plateConfigs.big_actortitle_text_color))
  2585. DF:SetFontSize (plateFrame.actorSubTitleSolo, plateConfigs.big_actortitle_text_size)
  2586. DF:SetFontFace (plateFrame.actorSubTitleSolo, plateConfigs.big_actortitle_text_font)
  2587. DF:SetFontOutline (plateFrame.actorSubTitleSolo, plateConfigs.big_actortitle_text_shadow)
  2588. end
  2589. elseif (plateFrame.shouldShowNpcTitleWithBrackets) then
  2590. local subTitle = Plater.GetActorSubName (plateFrame)
  2591. if (subTitle and subTitle ~= "" and not subTitle:match ("%d")) then
  2592. plateFrame.actorSubTitleSolo:Show()
  2593. plateFrame.actorNameSolo:SetText ("")
  2594. plateFrame.actorSubTitleSolo:SetText ("<" .. subTitle .. ">")
  2595. plateFrame.actorSubTitleSolo:ClearAllPoints()
  2596. plateFrame.actorSubTitleSolo:SetPoint ("top", plateFrame.actorNameSolo, "bottom", 0, 3)
  2597.  
  2598. plateFrame.actorSubTitleSolo:SetTextColor (unpack (plateConfigs.big_actortitle_text_color))
  2599. DF:SetFontSize (plateFrame.actorSubTitleSolo, plateConfigs.big_actortitle_text_size)
  2600. DF:SetFontFace (plateFrame.actorSubTitleSolo, plateConfigs.big_actortitle_text_font)
  2601. DF:SetFontOutline (plateFrame.actorSubTitleSolo, plateConfigs.big_actortitle_text_shadow)
  2602. end
  2603. end
  2604.  
  2605. end
  2606.  
  2607. --atualiza o texto da cast bar
  2608. DF:SetFontColor (spellnameString, plateConfigs.spellname_text_color)
  2609. DF:SetFontSize (spellnameString, plateConfigs.spellname_text_size)
  2610. DF:SetFontOutline (spellnameString, plateConfigs.spellname_text_shadow)
  2611. DF:SetFontFace (spellnameString, plateConfigs.spellname_text_font)
  2612.  
  2613. --atualiza o texto da porcentagem do cast
  2614. if (plateConfigs.spellpercent_text_enabled) then
  2615. spellPercentString:Show()
  2616. DF:SetFontColor (spellPercentString, plateConfigs.spellpercent_text_color)
  2617. DF:SetFontSize (spellPercentString, plateConfigs.spellpercent_text_size)
  2618. DF:SetFontOutline (spellPercentString, plateConfigs.spellpercent_text_shadow)
  2619. DF:SetFontFace (spellPercentString, plateConfigs.spellpercent_text_font)
  2620. Plater.SetAnchor (spellPercentString, plateConfigs.spellpercent_text_anchor)
  2621. else
  2622. spellPercentString:Hide()
  2623. end
  2624.  
  2625. Plater.SetAnchor (spellnameString, plateConfigs.spellname_text_anchor)
  2626.  
  2627. --atualiza o texto do level ??
  2628. if (plateConfigs.level_text_enabled) then
  2629. levelString:Show()
  2630. DF:SetFontSize (levelString, plateConfigs.level_text_size)
  2631. DF:SetFontFace (levelString, plateConfigs.level_text_font)
  2632. DF:SetFontOutline (levelString, plateConfigs.level_text_shadow)
  2633. Plater.SetAnchor (levelString, plateConfigs.level_text_anchor)
  2634. Plater.UpdateLevelTextAndColor (levelString, plateFrame.namePlateUnitToken)
  2635. levelString:SetAlpha (plateConfigs.level_text_alpha)
  2636. else
  2637. levelString:Hide()
  2638. end
  2639.  
  2640. --atualiza o texto da porcentagem da vida
  2641. if (plateConfigs.percent_text_enabled) then
  2642. lifeString:Show()
  2643. --apenas mostrar durante o combate
  2644. if (InCombatLockdown()) then
  2645. lifeString:Show()
  2646. else
  2647. lifeString:Hide()
  2648. end
  2649. DF:SetFontSize (lifeString, plateConfigs.percent_text_size)
  2650. DF:SetFontFace (lifeString, plateConfigs.percent_text_font)
  2651. DF:SetFontOutline (lifeString, plateConfigs.percent_text_shadow)
  2652. DF:SetFontColor (lifeString, plateConfigs.percent_text_color)
  2653. Plater.SetAnchor (lifeString, plateConfigs.percent_text_anchor)
  2654. lifeString:SetAlpha (plateConfigs.percent_text_alpha)
  2655. Plater.UpdateLifePercentText (lifeString, plateFrame.namePlateUnitToken, plateConfigs.percent_show_health)
  2656. else
  2657. lifeString:Hide()
  2658. end
  2659.  
  2660. --atualiza o texto da porcentagem da mana
  2661. if (plateFrame.isSelf) then
  2662. if (plateConfigs.power_percent_text_enabled) then
  2663. local powerString = ClassNameplateManaBarFrame.powerPercent
  2664. DF:SetFontSize (powerString, plateConfigs.power_percent_text_size)
  2665. DF:SetFontFace (powerString, plateConfigs.power_percent_text_font)
  2666. DF:SetFontOutline (powerString, plateConfigs.power_percent_text_shadow)
  2667. DF:SetFontColor (powerString, plateConfigs.power_percent_text_color)
  2668. Plater.SetAnchor (powerString, plateConfigs.power_percent_text_anchor)
  2669. powerString:SetAlpha (plateConfigs.power_percent_text_alpha)
  2670. powerString:Show()
  2671. else
  2672. ClassNameplateManaBarFrame.powerPercent:Hide()
  2673. end
  2674. end
  2675. end
  2676.  
  2677. function Plater.UpdateLifePercentText (lifeString, unitId, showHealthAmount)
  2678. local currentHealth, maxHealth = UnitHealth (unitId), UnitHealthMax (unitId)
  2679. --lifeString:SetText (string.format ("%.2f", currentHealth / maxHealth * 100) .. "%")
  2680. if (showHealthAmount) then
  2681. --percent_show_health
  2682. lifeString:SetText (DF.FormatNumber (currentHealth) .. " (" .. floor (currentHealth / maxHealth * 100) .. "%)")
  2683. else
  2684. lifeString:SetText (floor (currentHealth / maxHealth * 100) .. "%")
  2685. end
  2686. end
  2687.  
  2688. -- ~raidmarker ~raidtarget
  2689. function Plater.UpdateRaidMarker()
  2690. if (InCombatLockdown()) then
  2691. if (not Plater.db.profile.indicator_extra_raidmark) then
  2692. return
  2693. end
  2694. for _, plateFrame in ipairs (Plater.GetAllShownPlates()) do
  2695. if (plateFrame.UnitFrame.RaidTargetFrame.RaidTargetIcon:IsShown()) then
  2696. plateFrame.RaidTarget:Show()
  2697. plateFrame.RaidTarget:SetTexture (plateFrame.UnitFrame.RaidTargetFrame.RaidTargetIcon:GetTexture())
  2698. plateFrame.RaidTarget:SetTexCoord (plateFrame.UnitFrame.RaidTargetFrame.RaidTargetIcon:GetTexCoord())
  2699. local height = plateFrame.UnitFrame.healthBar:GetHeight() - 2
  2700. plateFrame.RaidTarget:SetSize (height, height)
  2701. plateFrame.RaidTarget:SetAlpha (.4)
  2702. end
  2703. end
  2704. else
  2705. for _, plateFrame in ipairs (Plater.GetAllShownPlates()) do
  2706. plateFrame.RaidTarget:Hide()
  2707. end
  2708. end
  2709. end
  2710.  
  2711. local change_height_up = function (self, deltaTime)
  2712. local increment = deltaTime * DB_ANIMATION_HEIGHT_SPEED * self.ToIncreace
  2713. local size = self:GetHeight() + increment
  2714. if (size >= self.TargetHeight) then
  2715. self:SetHeight (self.TargetHeight)
  2716. self:SetScript ("OnUpdate", nil)
  2717. else
  2718. self:SetHeight (size)
  2719. end
  2720. end
  2721. local change_height_down = function (self, deltaTime)
  2722. local decrease = deltaTime * DB_ANIMATION_HEIGHT_SPEED * self.ToDecrease
  2723. local size = self:GetHeight() - decrease
  2724. if (size <= self.TargetHeight) then
  2725. self:SetHeight (self.TargetHeight)
  2726. self:SetScript ("OnUpdate", nil)
  2727. else
  2728. self:SetHeight (size)
  2729. end
  2730. end
  2731.  
  2732. function Plater.UpdatePlateSize (plateFrame, justAdded)
  2733. if (not plateFrame.actorType) then
  2734. return
  2735. end
  2736.  
  2737. local actorType = plateFrame.actorType
  2738. local order = plateFrame.order
  2739.  
  2740. local plateConfigs = DB_PLATE_CONFIG [actorType]
  2741. local plateWidth = plateFrame:GetWidth()
  2742.  
  2743. local unitFrame = plateFrame.UnitFrame
  2744. local healthFrame = unitFrame.healthBar
  2745. local castFrame = unitFrame.castBar
  2746. local buffFrame = unitFrame.BuffFrame
  2747. local nameFrame = unitFrame.healthBar.actorName
  2748.  
  2749. local isMinus = Plater.ShouldForceSmallBar (plateFrame)
  2750. local isInCombat = InCombatLockdown()
  2751.  
  2752. --sempre usar barras grandes quando estiver em pvp
  2753. if (plateFrame.actorType == ACTORTYPE_ENEMY_PLAYER) then
  2754. if ((Plater.zoneInstanceType == "pvp" or Plater.zoneInstanceType == "arena") and DB_PLATE_CONFIG.player.pvp_always_incombat) then
  2755. isInCombat = true
  2756. end
  2757. end
  2758.  
  2759. if (order == 1) then
  2760. --debuff, health, castbar
  2761.  
  2762. local castKey, heathKey, textKey = Plater.GetHashKey (isInCombat)
  2763. local SizeOf_healthBar_Width = plateConfigs [heathKey][1]
  2764. local SizeOf_castBar_Width = plateConfigs [castKey][1]
  2765. local SizeOf_healthBar_Height = plateConfigs [heathKey][2]
  2766. local SizeOf_castBar_Height = plateConfigs [castKey][2]
  2767. local SizeOf_text = plateConfigs [textKey]
  2768.  
  2769. local height_offset = 0
  2770.  
  2771. --pegar o tamanho da barra de debuff para colocar a cast bar em cima dela
  2772. local buffFrameSize = Plater.db.profile.aura_height
  2773.  
  2774. local scalarValue = SizeOf_castBar_Width > plateWidth and -((SizeOf_castBar_Width - plateWidth) / 2) or ((plateWidth - SizeOf_castBar_Width) / 2)
  2775. if (isMinus) then
  2776. scalarValue = scalarValue + (SizeOf_castBar_Width/5)
  2777. end
  2778. castFrame:SetPoint ("BOTTOMLEFT", unitFrame, "BOTTOMLEFT", scalarValue, buffFrameSize + SizeOf_healthBar_Height + 2 + height_offset);
  2779. castFrame:SetPoint ("BOTTOMRIGHT", unitFrame, "BOTTOMRIGHT", -scalarValue, buffFrameSize + SizeOf_healthBar_Height + 2 + height_offset);
  2780. castFrame:SetHeight (SizeOf_castBar_Height)
  2781. castFrame.Icon:SetSize (SizeOf_castBar_Height, SizeOf_castBar_Height)
  2782. castFrame.BorderShield:SetSize (SizeOf_castBar_Height*1.4, SizeOf_castBar_Height*1.4)
  2783.  
  2784. local scalarValue
  2785. if (Plater.zonePvpType ~= "sanctuary") then
  2786. scalarValue = SizeOf_healthBar_Width > SizeOf_castBar_Width and -((SizeOf_healthBar_Width - SizeOf_castBar_Width) / 2) or ((SizeOf_castBar_Width - SizeOf_healthBar_Width) / 2)
  2787. else
  2788. --scalarValue = 80 > SizeOf_castBar_Width and -((80 - SizeOf_castBar_Width) / 2) or ((SizeOf_castBar_Width - 80) / 2)
  2789. scalarValue = SizeOf_healthBar_Width > SizeOf_castBar_Width and -((SizeOf_healthBar_Width - SizeOf_castBar_Width) / 2) or ((SizeOf_castBar_Width - SizeOf_healthBar_Width) / 2)
  2790. end
  2791.  
  2792. healthFrame:ClearAllPoints()
  2793. healthFrame:SetPoint ("BOTTOMLEFT", castFrame, "TOPLEFT", scalarValue, (-SizeOf_healthBar_Height) + (-SizeOf_castBar_Height) - 4);
  2794. healthFrame:SetPoint ("BOTTOMRIGHT", castFrame, "TOPRIGHT", -scalarValue, (-SizeOf_healthBar_Height) + (-SizeOf_castBar_Height) - 4);
  2795.  
  2796. local targetHeight = SizeOf_healthBar_Height / (isMinus and 2 or 1)
  2797. local currentHeight = healthFrame:GetHeight()
  2798.  
  2799. if (justAdded or not DB_ANIMATION_HEIGHT) then
  2800. healthFrame:SetHeight (targetHeight)
  2801. else
  2802. if (currentHeight < targetHeight) then
  2803. if (not healthFrame.IsIncreasingHeight) then
  2804. healthFrame.IsDecreasingHeight = nil
  2805. healthFrame.TargetHeight = targetHeight
  2806. healthFrame.ToIncreace = targetHeight - currentHeight
  2807. healthFrame:SetScript ("OnUpdate", change_height_up)
  2808. end
  2809. elseif (currentHeight > targetHeight) then
  2810. if (not healthFrame.IsDecreasingHeight) then
  2811. healthFrame.IsIncreasingHeight = nil
  2812. healthFrame.TargetHeight = targetHeight
  2813. healthFrame.ToDecrease = currentHeight - targetHeight
  2814. healthFrame:SetScript ("OnUpdate", change_height_down)
  2815. end
  2816. end
  2817. end
  2818.  
  2819. buffFrame.Point1 = "top"
  2820. buffFrame.Point2 = "bottom"
  2821. buffFrame.Anchor = healthFrame
  2822. buffFrame.X = DB_AURA_X_OFFSET
  2823. buffFrame.Y = -11 + plateConfigs.buff_frame_y_offset + DB_AURA_Y_OFFSET
  2824. buffFrame:SetPoint (buffFrame.Point1, buffFrame.Anchor, buffFrame.Point2, buffFrame.X, buffFrame.Y)
  2825.  
  2826. --player
  2827. if (plateFrame.isSelf) then
  2828. Plater.UpdateManaAndResourcesBar()
  2829. healthFrame.barTexture:SetVertexColor (DF:ParseColors ("lightgreen"))
  2830. end
  2831.  
  2832. elseif (order == 2) then
  2833. --health, buffs, castbar
  2834.  
  2835. local castKey, heathKey, textKey = Plater.GetHashKey (isInCombat)
  2836. local SizeOf_healthBar_Width = plateConfigs [heathKey][1]
  2837. local SizeOf_castBar_Width = plateConfigs [castKey][1]
  2838. local SizeOf_healthBar_Height = plateConfigs [heathKey][2]
  2839. local SizeOf_castBar_Height = plateConfigs [castKey][2]
  2840. local SizeOf_text = plateConfigs [textKey]
  2841.  
  2842. local height_offset = 0
  2843.  
  2844. --pegar o tamanho da barra de debuff para colocar a cast bar em cima dela
  2845. local buffFrameSize = Plater.db.profile.aura_height
  2846.  
  2847. local scalarValue = SizeOf_castBar_Width > plateWidth and -((SizeOf_castBar_Width - plateWidth) / 2) or ((plateWidth - SizeOf_castBar_Width) / 2)
  2848. if (isMinus) then
  2849. scalarValue = scalarValue + (SizeOf_castBar_Width/5)
  2850. end
  2851. castFrame:SetPoint ("BOTTOMLEFT", unitFrame, "BOTTOMLEFT", scalarValue, buffFrameSize + SizeOf_healthBar_Height + 2 + height_offset);
  2852. castFrame:SetPoint ("BOTTOMRIGHT", unitFrame, "BOTTOMRIGHT", -scalarValue, buffFrameSize + SizeOf_healthBar_Height + 2 + height_offset);
  2853. castFrame:SetHeight (SizeOf_castBar_Height)
  2854. castFrame.Icon:SetSize (SizeOf_castBar_Height, SizeOf_castBar_Height)
  2855. castFrame.BorderShield:SetSize (SizeOf_castBar_Height*1.4, SizeOf_castBar_Height*1.4)
  2856.  
  2857. local scalarValue
  2858. if (Plater.zonePvpType ~= "sanctuary") then
  2859. scalarValue = SizeOf_healthBar_Width > SizeOf_castBar_Width and -((SizeOf_healthBar_Width - SizeOf_castBar_Width) / 2) or ((SizeOf_castBar_Width - SizeOf_healthBar_Width) / 2)
  2860. else
  2861. scalarValue = 70 > SizeOf_castBar_Width and -((70 - SizeOf_castBar_Width) / 2) or ((SizeOf_castBar_Width - 70) / 2)
  2862. end
  2863.  
  2864. -- local isMinus
  2865. -- if (UnitClassification (plateFrame.namePlateUnitToken) == "minus" or Plater.petCache [UnitGUID (plateFrame [MEMBER_UNITID])]) then
  2866. -- scalarValue = scalarValue + (SizeOf_healthBar_Width/4)
  2867. -- isMinus = true
  2868. -- end
  2869.  
  2870. healthFrame:ClearAllPoints()
  2871. healthFrame:SetPoint ("BOTTOMLEFT", castFrame, "TOPLEFT", scalarValue, (-SizeOf_healthBar_Height) + (-SizeOf_castBar_Height) + (-buffFrameSize) - 4);
  2872. healthFrame:SetPoint ("BOTTOMRIGHT", castFrame, "TOPRIGHT", -scalarValue, (-SizeOf_healthBar_Height) + (-SizeOf_castBar_Height) + (-buffFrameSize) - 4);
  2873.  
  2874. local targetHeight = SizeOf_healthBar_Height / (isMinus and 2 or 1)
  2875. local currentHeight = healthFrame:GetHeight()
  2876.  
  2877. if (justAdded or not DB_ANIMATION_HEIGHT) then
  2878. healthFrame:SetHeight (targetHeight)
  2879. else
  2880. if (currentHeight < targetHeight) then
  2881. if (not healthFrame.IsIncreasingHeight) then
  2882. healthFrame.IsDecreasingHeight = nil
  2883. healthFrame.TargetHeight = targetHeight
  2884. healthFrame.ToIncreace = targetHeight - currentHeight
  2885. healthFrame:SetScript ("OnUpdate", change_height_up)
  2886. end
  2887. elseif (currentHeight > targetHeight) then
  2888. if (not healthFrame.IsDecreasingHeight) then
  2889. healthFrame.IsIncreasingHeight = nil
  2890. healthFrame.TargetHeight = targetHeight
  2891. healthFrame.ToDecrease = currentHeight - targetHeight
  2892. healthFrame:SetScript ("OnUpdate", change_height_down)
  2893. end
  2894. end
  2895. end
  2896.  
  2897. buffFrame.Point1 = "top"
  2898. buffFrame.Point2 = "bottom"
  2899. buffFrame.Anchor = castFrame
  2900. buffFrame.X = DB_AURA_X_OFFSET
  2901. buffFrame.Y = -1 + plateConfigs.buff_frame_y_offset + DB_AURA_Y_OFFSET
  2902. buffFrame:SetPoint (buffFrame.Point1, buffFrame.Anchor, buffFrame.Point2, buffFrame.X, buffFrame.Y)
  2903.  
  2904. --player
  2905. if (plateFrame.isSelf) then
  2906. Plater.UpdateManaAndResourcesBar()
  2907. healthFrame.barTexture:SetVertexColor (DF:ParseColors ("lightgreen"))
  2908. end
  2909.  
  2910. elseif (order == 3) then --~order
  2911. --castbar, health, buffs
  2912.  
  2913. local castKey, heathKey, textKey = Plater.GetHashKey (isInCombat)
  2914. local SizeOf_healthBar_Width = plateConfigs [heathKey][1]
  2915. local SizeOf_castBar_Width = plateConfigs [castKey][1]
  2916. local SizeOf_healthBar_Height = plateConfigs [heathKey][2]
  2917. local SizeOf_castBar_Height = plateConfigs [castKey][2]
  2918. local SizeOf_text = plateConfigs [textKey]
  2919.  
  2920. local height_offset = 0
  2921.  
  2922. local buffFrameSize = Plater.db.profile.aura_height
  2923. local scalarValue = SizeOf_castBar_Width > plateWidth and -((SizeOf_castBar_Width - plateWidth) / 2) or ((plateWidth - SizeOf_castBar_Width) / 2)
  2924.  
  2925. if (isMinus) then
  2926. scalarValue = scalarValue + (SizeOf_castBar_Width/5)
  2927. end
  2928.  
  2929. castFrame:SetPoint ("BOTTOMLEFT", unitFrame, "BOTTOMLEFT", scalarValue, height_offset) ---SizeOf_healthBar_Height + (-SizeOf_castBar_Height + 2)
  2930. castFrame:SetPoint ("BOTTOMRIGHT", unitFrame, "BOTTOMRIGHT", -scalarValue, height_offset)
  2931. castFrame:SetHeight (SizeOf_castBar_Height)
  2932. castFrame.Icon:SetSize (SizeOf_castBar_Height, SizeOf_castBar_Height)
  2933. castFrame.BorderShield:SetSize (SizeOf_castBar_Height*1.4, SizeOf_castBar_Height*1.4)
  2934.  
  2935. local scalarValue
  2936. local passouPor = 0
  2937. if (Plater.zonePvpType ~= "sanctuary" or plateFrame [MEMBER_REACTION] == 4) then
  2938. scalarValue = SizeOf_healthBar_Width > SizeOf_castBar_Width and -((SizeOf_healthBar_Width - SizeOf_castBar_Width) / 2) or ((SizeOf_castBar_Width - SizeOf_healthBar_Width) / 2)
  2939. passouPor = 1
  2940. else
  2941. if (plateFrame.isSelf) then
  2942. scalarValue = SizeOf_healthBar_Width > SizeOf_castBar_Width and -((SizeOf_healthBar_Width - SizeOf_castBar_Width) / 2) or ((SizeOf_castBar_Width - SizeOf_healthBar_Width) / 2)
  2943. passouPor = 2
  2944. else
  2945. scalarValue = 70 > SizeOf_castBar_Width and -((70 - SizeOf_castBar_Width) / 2) or ((SizeOf_castBar_Width - 70) / 2)
  2946. passouPor = 3
  2947. end
  2948. end
  2949.  
  2950. --health
  2951. healthFrame:ClearAllPoints()
  2952. healthFrame:SetPoint ("BOTTOMLEFT", castFrame, "TOPLEFT", scalarValue, 1)
  2953. healthFrame:SetPoint ("BOTTOMRIGHT", castFrame, "TOPRIGHT", -scalarValue, 1)
  2954.  
  2955. local targetHeight = SizeOf_healthBar_Height / (isMinus and 2 or 1)
  2956. local currentHeight = healthFrame:GetHeight()
  2957.  
  2958. if (justAdded or not DB_ANIMATION_HEIGHT) then
  2959. healthFrame:SetHeight (targetHeight)
  2960. else
  2961. if (currentHeight < targetHeight) then
  2962. if (not healthFrame.IsIncreasingHeight) then
  2963. healthFrame.IsDecreasingHeight = nil
  2964. healthFrame.TargetHeight = targetHeight
  2965. healthFrame.ToIncreace = targetHeight - currentHeight
  2966. healthFrame:SetScript ("OnUpdate", change_height_up)
  2967. end
  2968. elseif (currentHeight > targetHeight) then
  2969. if (not healthFrame.IsDecreasingHeight) then
  2970. healthFrame.IsIncreasingHeight = nil
  2971. healthFrame.TargetHeight = targetHeight
  2972. healthFrame.ToDecrease = currentHeight - targetHeight
  2973. healthFrame:SetScript ("OnUpdate", change_height_down)
  2974. end
  2975. end
  2976. end
  2977.  
  2978. --buff
  2979. buffFrame.Point1 = "bottom"
  2980. buffFrame.Point2 = "top"
  2981. buffFrame.Anchor = healthFrame
  2982. buffFrame.X = DB_AURA_X_OFFSET
  2983. buffFrame.Y = (buffFrameSize / 3) + 1 + plateConfigs.buff_frame_y_offset + DB_AURA_Y_OFFSET
  2984. buffFrame:SetPoint (buffFrame.Point1, buffFrame.Anchor, buffFrame.Point2, buffFrame.X, buffFrame.Y)
  2985.  
  2986. --player
  2987. if (plateFrame.isSelf) then
  2988. Plater.UpdateManaAndResourcesBar()
  2989. healthFrame.barTexture:SetVertexColor (DF:ParseColors ("lightgreen"))
  2990. end
  2991. end
  2992. end
  2993.  
  2994. function Plater.UpdateManaAndResourcesBar()
  2995. local profile = Plater.db.profile
  2996. local manaConfig = profile.plate_config [ACTORTYPE_PLAYER].mana
  2997. local locClass, class = UnitClass ("player")
  2998. local width, height = manaConfig[1], manaConfig[2]
  2999.  
  3000. --mana and power
  3001. ClassNameplateManaBarFrame:SetSize (width, height)
  3002.  
  3003. local anchorFrame
  3004. if (GetCVar (CVAR_RESOURCEONTARGET) == "1") then
  3005. anchorFrame = C_NamePlate.GetNamePlateForUnit ("target")
  3006. else
  3007. anchorFrame = ClassNameplateManaBarFrame
  3008. end
  3009.  
  3010. if (not anchorFrame) then
  3011. return
  3012. end
  3013.  
  3014. --chi windwalker
  3015. if (class == "MONK") then
  3016. ClassNameplateBrewmasterBarFrame:SetSize (width, height-2)
  3017. ClassNameplateBarWindwalkerMonkFrame:ClearAllPoints()
  3018. ClassNameplateBarWindwalkerMonkFrame:SetPoint ("topleft", anchorFrame, "bottomleft")
  3019. ClassNameplateBarWindwalkerMonkFrame:SetPoint ("topright", anchorFrame, "bottomright")
  3020. --ClassNameplateBarWindwalkerMonkFrame:SetSize (width, height-2)
  3021. local f = ClassNameplateBarWindwalkerMonkFrame
  3022. local scale = profile.resources.MONK.chi_scale
  3023. for i = 1, 5 do
  3024. local chi = f ["Chi" .. i]
  3025. chi:SetScale (scale)
  3026. local width = chi:GetWidth()
  3027. chi:ClearAllPoints()
  3028. chi:SetPoint ("center", (i-3)*width, 0)
  3029. end
  3030.  
  3031. --arcane charge
  3032. elseif (class == "MAGE") then
  3033. local f = ClassNameplateBarMageFrame
  3034. f:ClearAllPoints()
  3035. f:SetPoint ("topleft", anchorFrame, "bottomleft")
  3036. f:SetPoint ("topright", anchorFrame, "bottomright")
  3037.  
  3038. local scale = profile.resources.MAGE.arcane_charge_scale
  3039. for i = 1, 4 do
  3040. local charge = f ["Charge" .. i]
  3041. charge:SetScale (scale)
  3042. local width = charge:GetWidth()
  3043. charge:ClearAllPoints()
  3044. charge:SetPoint ("center", (i-2.5)*width, 0)
  3045. end
  3046.  
  3047. --dk runes
  3048. elseif (class == "DEATHKNIGHT") then
  3049. local f = DeathKnightResourceOverlayFrame
  3050. f:ClearAllPoints()
  3051. f:SetPoint ("topleft", anchorFrame, "bottomleft")
  3052. f:SetPoint ("topright", anchorFrame, "bottomright")
  3053.  
  3054. local scale = profile.resources.DEATHKNIGHT.rune_scale
  3055. for i = 1, 6 do
  3056. local charge = f ["Rune" .. i]
  3057. charge:SetScale (scale)
  3058. local width = charge:GetWidth()
  3059. charge:ClearAllPoints()
  3060. charge:SetPoint ("center", (i-3.5)*width, 0)
  3061. end
  3062.  
  3063. --paladin holy power
  3064. elseif (class == "PALADIN") then
  3065. local f = ClassNameplateBarPaladinFrame
  3066. f:ClearAllPoints()
  3067. f:SetPoint ("topleft", anchorFrame, "bottomleft")
  3068. f:SetPoint ("topright", anchorFrame, "bottomright")
  3069.  
  3070. local scale = profile.resources.PALADIN.holypower_scale
  3071. for i = 1, 5 do
  3072. local charge = f ["Rune" .. i]
  3073. charge:SetScale (scale)
  3074. local width = charge:GetWidth()
  3075. charge:ClearAllPoints()
  3076. charge:SetPoint ("center", (i-3)*width, 0)
  3077. end
  3078.  
  3079. elseif (class == "ROGUE" or class == "DRUID") then
  3080. local f = ClassNameplateBarRogueDruidFrame
  3081. f:ClearAllPoints()
  3082. f:SetPoint ("topleft", anchorFrame, "bottomleft")
  3083. f:SetPoint ("topright", anchorFrame, "bottomright")
  3084.  
  3085. local scale
  3086. if (class == "ROGUE") then
  3087. scale = profile.resources.ROGUE.combopoint_scale
  3088. elseif (class == "DRUID") then
  3089. scale = profile.resources.DRUID.combopoint_scale
  3090. end
  3091.  
  3092. for i = 1, 5 do
  3093. local charge = f ["Combo" .. i]
  3094. charge:SetScale (scale)
  3095. local width = charge:GetWidth()
  3096. charge:ClearAllPoints()
  3097. charge:SetPoint ("center", (i-3)*width, 0)
  3098. end
  3099. for i = 6, 8 do
  3100. local charge = f ["Combo" .. i]
  3101. charge:SetScale (scale)
  3102. local width = charge:GetWidth()
  3103. local height = charge:GetWidth()
  3104. charge:ClearAllPoints()
  3105. charge:SetPoint ("center", (i-2)*width, -(height/2)-3)
  3106. end
  3107.  
  3108. --warlock soul shards
  3109. elseif (class == "WARLOCK") then
  3110. local f = ClassNameplateBarWarlockFrame
  3111. f:ClearAllPoints()
  3112. f:SetPoint ("topleft", anchorFrame, "bottomleft")
  3113. f:SetPoint ("topright", anchorFrame, "bottomright")
  3114.  
  3115. local scale = profile.resources.WARLOCK.soulshard_scale
  3116. for i = 1, 5 do
  3117. local charge = f ["Shard" .. i]
  3118. charge:SetScale (scale)
  3119. local width = charge:GetWidth()
  3120. charge:ClearAllPoints()
  3121. charge:SetPoint ("center", (i-3)*width, 0)
  3122. end
  3123.  
  3124. end
  3125.  
  3126. end
  3127.  
  3128. function Plater.ShouldForceSmallBar (plateFrame)
  3129. if (UnitClassification (plateFrame [MEMBER_UNITID]) == "minus") then
  3130. return true
  3131. elseif (Plater.petCache [plateFrame [MEMBER_GUID]]) then
  3132. return true
  3133. end
  3134. end
  3135.  
  3136.  
  3137.  
  3138. function Plater.ForceChangeHealthBarColor (healthBar, r, g, b)
  3139. if (r ~= healthBar.r or g ~= healthBar.g or b ~= healthBar.b) then
  3140. healthBar.r, healthBar.g, healthBar.b = r, g, b
  3141. healthBar.barTexture:SetVertexColor (r, g, b)
  3142. end
  3143. end
  3144.  
  3145. -- ~detector
  3146. function Plater.CheckForDetectors (plateFrame)
  3147. local name, rank, texture, count, debuffType, duration, expirationTime, caster, _, nameplateShowPersonal, spellId, _, _, _, nameplateShowAll = UnitAura (plateFrame [MEMBER_UNITID], FILTER_BUFF_DETECTION)
  3148. if (name) then
  3149. plateFrame.Top3DFrame:Show()
  3150. plateFrame.Top3DFrame:SetModel ("Spells\\Blackfuse_LaserTurret_GroundBurn_State_Base")
  3151. else
  3152. local name, rank, texture, count, debuffType, duration, expirationTime, caster, _, nameplateShowPersonal, spellId, _, _, _, nameplateShowAll = UnitAura (plateFrame [MEMBER_UNITID], FILTER_BUFF_DETECTION2)
  3153. if (name) then
  3154. plateFrame.Top3DFrame:Show()
  3155. plateFrame.Top3DFrame:SetModel ("Spells\\Blackfuse_LaserTurret_GroundBurn_State_Base")
  3156. end
  3157. end
  3158. end
  3159.  
  3160. -- ~update
  3161. function Plater.UpdatePlateFrame (plateFrame, actorType, forceUpdate, justAdded)
  3162. actorType = actorType or plateFrame.actorType
  3163.  
  3164. local order = DB_PLATE_CONFIG [actorType].plate_order
  3165.  
  3166. local unitFrame = plateFrame.UnitFrame --setallpoints
  3167. local healthFrame = unitFrame.healthBar
  3168. local castFrame = unitFrame.castBar
  3169. local buffFrame = unitFrame.BuffFrame
  3170. local nameFrame = unitFrame.healthBar.actorName
  3171.  
  3172. --unitFrame:SetScale (2)
  3173.  
  3174. plateFrame.actorType = actorType
  3175. plateFrame.order = order
  3176. plateFrame.shouldShowNpcNameAndTitle = false
  3177. plateFrame.shouldShowNpcTitleWithBrackets = false
  3178. plateFrame.shouldShowNpcTitle = false
  3179. plateFrame.onlyShowThePlayerName = false
  3180.  
  3181. healthFrame.BorderIsAggroIndicator = nil
  3182.  
  3183. local wasQuestPlate = plateFrame [MEMBER_QUEST]
  3184. plateFrame [MEMBER_QUEST] = false
  3185.  
  3186. plateFrame.actorNameSolo:Hide()
  3187. plateFrame.actorSubTitleSolo:Hide()
  3188. plateFrame.Top3DFrame:Hide()
  3189. plateFrame.RaidTarget:Hide()
  3190.  
  3191. --remove a alpha colocada pelo aggro
  3192. --unitFrame:SetAlpha (1)
  3193.  
  3194. --remove o glow posto pelo aggro
  3195. unitFrame.aggroGlowUpper:Hide()
  3196. unitFrame.aggroGlowLower:Hide()
  3197.  
  3198. --a plate esta desativada?
  3199. if (not Plater.CanShowPlateFor (actorType)) then
  3200. if (InCombatLockdown()) then
  3201. healthFrame:Hide()
  3202. buffFrame:Hide()
  3203. nameFrame:Hide()
  3204. else
  3205. plateFrame:Hide()
  3206. end
  3207.  
  3208. --a plate é de um NPC inimigo e estamos dentro de um santuário?
  3209. elseif (plateFrame [MEMBER_REACTION] < 4 and Plater.zonePvpType == "sanctuary") then
  3210. if (InCombatLockdown()) then
  3211. healthFrame:Hide()
  3212. buffFrame:Hide()
  3213. nameFrame:Hide()
  3214. else
  3215. plateFrame:Hide()
  3216. end
  3217. else
  3218.  
  3219. --se for um npc inimigo, ver se faz parte de alguma quest
  3220. if (actorType == ACTORTYPE_ENEMY_NPC and DB_PLATE_CONFIG [actorType].quest_enabled) then --actorType == ACTORTYPE_FRIENDLY_NPC or
  3221. local isQuestMob = Plater.IsQuestObjective (plateFrame)
  3222. if (isQuestMob and not IsTapDenied (plateFrame.UnitFrame)) then
  3223. if (plateFrame [MEMBER_REACTION] == UNITREACTION_NEUTRAL) then
  3224. Plater.ForceChangeHealthBarColor (healthFrame, unpack (DB_PLATE_CONFIG [actorType].quest_color_neutral))
  3225. plateFrame [MEMBER_QUEST] = true
  3226. else
  3227. Plater.ForceChangeHealthBarColor (healthFrame, unpack (DB_PLATE_CONFIG [actorType].quest_color_enemy))
  3228. plateFrame [MEMBER_QUEST] = true
  3229. end
  3230. else
  3231. if (wasQuestPlate) then
  3232. CompactUnitFrame_UpdateHealthColor (unitFrame)
  3233. end
  3234. end
  3235. else
  3236. if (wasQuestPlate) then
  3237. CompactUnitFrame_UpdateHealthColor (unitFrame)
  3238. end
  3239. end
  3240.  
  3241. --se a plate for de npc amigo
  3242. if (actorType == ACTORTYPE_FRIENDLY_NPC) then
  3243.  
  3244. if (DB_PLATE_CONFIG [actorType].quest_enabled and Plater.IsQuestObjective (plateFrame)) then
  3245. Plater.ForceChangeHealthBarColor (healthFrame, unpack (DB_PLATE_CONFIG [actorType].quest_color))
  3246.  
  3247. if (not plateFrame:IsShown() and not InCombatLockdown()) then
  3248. plateFrame:Show()
  3249. end
  3250. healthFrame:Show()
  3251. buffFrame:Show()
  3252. nameFrame:Show()
  3253.  
  3254. plateFrame [MEMBER_QUEST] = true
  3255.  
  3256. --plateFrame.shouldShowNpcNameAndTitle = true
  3257.  
  3258. --mostrar nomes de todos os npcs sem as barras de vida
  3259. elseif (DB_PLATE_CONFIG [actorType].only_names or DB_PLATE_CONFIG [actorType].all_names) then
  3260. if (not plateFrame:IsShown() and not InCombatLockdown()) then
  3261. plateFrame:Show()
  3262. end
  3263. healthFrame:Hide()
  3264. buffFrame:Hide()
  3265. nameFrame:Hide()
  3266. plateFrame.shouldShowNpcNameAndTitle = true
  3267.  
  3268. --mostrar apenas plates para npcs relevantes / verifica se possui relevância ativa
  3269. elseif (DB_PLATE_CONFIG [actorType].only_relevant) then
  3270. --a relevancia esta ativada
  3271.  
  3272. --se não tem um tipo ou o tipo esta desligado
  3273. if (not plateFrame [MEMBER_NPCTYPE] or not DB_PLATE_CONFIG [actorType].filter [plateFrame [MEMBER_NPCTYPE]]) then
  3274. --if (InCombatLockdown()) then
  3275. healthFrame:Hide()
  3276. buffFrame:Hide()
  3277. nameFrame:Hide()
  3278. --else
  3279. -- plateFrame:Hide()
  3280. --end
  3281.  
  3282. --verifica se pode mostrar o nome dos npcs que não possuem relevancia
  3283. if (DB_PLATE_CONFIG [actorType].relevant_and_proffesions) then
  3284. --plateFrame.shouldShowNpcNameAndTitle = true
  3285. plateFrame.shouldShowNpcTitle = true
  3286. end
  3287. else
  3288. --o npc possui um tipo e pode ser mostrado
  3289. healthFrame:Show()
  3290. buffFrame:Show()
  3291. nameFrame:Show()
  3292. if (not plateFrame:IsShown() and not InCombatLockdown()) then
  3293. plateFrame:Show()
  3294. end
  3295. plateFrame.shouldShowNpcTitleWithBrackets = true
  3296. end
  3297. else
  3298. healthFrame:Show()
  3299. buffFrame:Show()
  3300. nameFrame:Show()
  3301. if (not plateFrame:IsShown() and not InCombatLockdown()) then
  3302. plateFrame:Show()
  3303. end
  3304. end
  3305.  
  3306. --suramar detectors
  3307. Plater.CheckForDetectors (plateFrame)
  3308.  
  3309. elseif (actorType == ACTORTYPE_FRIENDLY_PLAYER) then
  3310. if (DB_PLATE_CONFIG [actorType].only_damaged) then
  3311. if (UnitHealth (plateFrame [MEMBER_UNITID]) < UnitHealthMax (plateFrame [MEMBER_UNITID])) then
  3312. healthFrame:Show()
  3313. buffFrame:Show()
  3314. nameFrame:Show()
  3315. if (not plateFrame:IsShown() and not InCombatLockdown()) then
  3316. plateFrame:Show()
  3317. end
  3318. else
  3319. healthFrame:Hide()
  3320. buffFrame:Hide()
  3321. nameFrame:Hide()
  3322. if (DB_PLATE_CONFIG [actorType].only_thename) then
  3323. plateFrame.onlyShowThePlayerName = true
  3324. end
  3325. end
  3326. elseif (DB_PLATE_CONFIG [actorType].only_thename) then
  3327. healthFrame:Hide()
  3328. buffFrame:Hide()
  3329. nameFrame:Hide()
  3330. plateFrame.onlyShowThePlayerName = true
  3331. else
  3332. healthFrame:Show()
  3333. buffFrame:Show()
  3334. nameFrame:Show()
  3335. if (not plateFrame:IsShown() and not InCombatLockdown()) then
  3336. plateFrame:Show()
  3337. end
  3338. end
  3339. else
  3340. --tudo okey, podemos mostrar a barra
  3341. healthFrame:Show()
  3342. buffFrame:Show()
  3343. nameFrame:Show()
  3344. if (not plateFrame:IsShown() and not InCombatLockdown()) then
  3345. plateFrame:Show()
  3346. end
  3347.  
  3348. --se for um jogador da facção rival, verificar se pode mostrar a cor da classe ou é uma cor fixa
  3349. if (actorType == ACTORTYPE_ENEMY_PLAYER) then
  3350. if (not DB_PLATE_CONFIG [actorType].use_playerclass_color) then
  3351. Plater.ForceChangeHealthBarColor (healthFrame, unpack (DB_PLATE_CONFIG [actorType].fixed_class_color))
  3352. elseif (forceUpdate) then
  3353. CompactUnitFrame_UpdateHealthColor (unitFrame)
  3354. end
  3355. end
  3356.  
  3357. --suramar detectors
  3358. Plater.CheckForDetectors (plateFrame)
  3359. end
  3360. end
  3361.  
  3362. buffFrame:ClearAllPoints()
  3363. nameFrame:ClearAllPoints()
  3364.  
  3365. --ajusta a cast bar
  3366. castFrame:SetStatusBarTexture (DB_TEXTURE_CASTBAR)
  3367. castFrame.background:SetTexture (DB_TEXTURE_CASTBAR_BG)
  3368. castFrame.background:SetVertexColor (unpack (Plater.db.profile.cast_statusbar_bgcolor))
  3369. castFrame.Flash:SetTexture (DB_TEXTURE_CASTBAR)
  3370. castFrame.Icon:SetTexCoord (0.078125, 0.921875, 0.078125, 0.921875)
  3371. --ajusta a health bar
  3372. healthFrame.barTexture:SetTexture (DB_TEXTURE_HEALTHBAR)
  3373. healthFrame.background:SetTexture (DB_TEXTURE_HEALTHBAR_BG)
  3374. healthFrame.background:SetVertexColor (unpack (Plater.db.profile.health_statusbar_bgcolor))
  3375.  
  3376. if (unitFrame.selectionHighlight:IsShown()) then
  3377. local targetedOverlayTexture = LibSharedMedia:Fetch ("statusbar", Plater.db.profile.health_selection_overlay)
  3378. unitFrame.selectionHighlight:SetTexture (targetedOverlayTexture)
  3379. unitFrame.healthBar.background:SetAlpha (Plater.db.profile.health_statusbar_bgalpha_selected)
  3380. else
  3381. unitFrame.healthBar.background:SetAlpha (1)
  3382. end
  3383.  
  3384. --Plater.GetNpcFactionColor (plateFrame)
  3385. Plater.UpdatePlateBorders (plateFrame)
  3386. Plater.UpdatePlateSize (plateFrame, justAdded)
  3387. Plater.UpdatePlateText (plateFrame, DB_PLATE_CONFIG [actorType])
  3388. Plater.UpdateRaidMarker()
  3389. Plater.UpdateIndicators (plateFrame, actorType)
  3390. Plater.UpdateBuffContainer (plateFrame)
  3391. Plater.UpdateTarget (plateFrame)
  3392. Plater.UpdatePlateBorderThickness (plateFrame)
  3393. end
  3394.  
  3395. -- ~indicators
  3396. function Plater.UpdateIndicators (plateFrame, actorType)
  3397. --limpa os indicadores
  3398. Plater.ClearIndicators (plateFrame)
  3399. local config = Plater.db.profile
  3400.  
  3401. if (actorType == ACTORTYPE_ENEMY_PLAYER) then
  3402. if (config.indicator_faction) then
  3403. Plater.AddIndicator (plateFrame, UnitFactionGroup (plateFrame [MEMBER_UNITID]))
  3404. end
  3405. if (config.indicator_enemyclass) then
  3406. Plater.AddIndicator (plateFrame, "classicon")
  3407. end
  3408.  
  3409. elseif (actorType == ACTORTYPE_ENEMY_NPC) then -- or actorType == ACTORTYPE_FRIENDLY_NPC
  3410. --verifica quest e elite npc
  3411. local isQuestBoss = UnitIsQuestBoss (plateFrame.namePlateUnitToken) --true false
  3412. local unitClassification = UnitClassification (plateFrame.namePlateUnitToken) --elite minus normal rare rareelite worldboss
  3413. if (Plater.petCache [UnitGUID (plateFrame [MEMBER_UNITID])]) then
  3414. Plater.AddIndicator (plateFrame, "pet")
  3415. end
  3416. if (unitClassification == "worldboss") then
  3417. Plater.AddIndicator (plateFrame, "worldboss")
  3418. elseif (unitClassification == "rareelite" and (config.indicator_rare or config.indicator_elite)) then
  3419. Plater.AddIndicator (plateFrame, "elite")
  3420. Plater.AddIndicator (plateFrame, "rare")
  3421. else
  3422. if (unitClassification == "elite" and config.indicator_elite) then
  3423. Plater.AddIndicator (plateFrame, "elite")
  3424. end
  3425. if (unitClassification == "rare" and config.indicator_rare) then
  3426. Plater.AddIndicator (plateFrame, "rare")
  3427. end
  3428. end
  3429.  
  3430. if (isQuestBoss and config.indicator_quest) then
  3431. Plater.AddIndicator (plateFrame, "quest")
  3432. end
  3433.  
  3434. elseif (actorType == ACTORTYPE_FRIENDLY_NPC) then
  3435. if (plateFrame [MEMBER_QUEST]) then
  3436. Plater.AddIndicator (plateFrame, "quest")
  3437. end
  3438. end
  3439.  
  3440. if (plateFrame [MEMBER_NPCTYPE]) then
  3441. local iconTexture, L, R, T, B = Plater.GetNpcTypeIcon (plateFrame [MEMBER_NPCTYPE])
  3442. plateFrame.UnitFrame.ExtraIconFrame:SetIcon (iconTexture, false, 12, 12, L, R, T, B)
  3443. else
  3444. if (not plateFrame.UnitFrame.hasCC) then
  3445. plateFrame.UnitFrame.ExtraIconFrame:Hide()
  3446. end
  3447. end
  3448. end
  3449.  
  3450. function Plater.AddIndicator (plateFrame, indicator)
  3451. local thisIndicator = plateFrame.IconIndicators [plateFrame.IconIndicators.Next]
  3452. if (not thisIndicator) then
  3453. local newIndicator = plateFrame.UnitFrame.healthBar:CreateTexture (nil, "overlay")
  3454. newIndicator:SetSize (10, 10)
  3455. tinsert (plateFrame.IconIndicators, newIndicator)
  3456. thisIndicator = newIndicator
  3457. end
  3458.  
  3459. thisIndicator:Show()
  3460. thisIndicator:SetTexCoord (0, 1, 0, 1)
  3461. thisIndicator:SetVertexColor (1, 1, 1)
  3462. thisIndicator:SetDesaturated (false)
  3463. thisIndicator:SetSize (10, 10)
  3464.  
  3465. --esconde o icone default do jogo
  3466. plateFrame.UnitFrame.ClassificationFrame:Hide()
  3467.  
  3468. -- ~icons
  3469. if (indicator == "pet") then
  3470. thisIndicator:SetTexture ([[Interface\AddOns\Plater\images\peticon]])
  3471. elseif (indicator == "Horde") then
  3472. thisIndicator:SetTexture ([[Interface\PVPFrame\PVP-Currency-Horde]])
  3473. thisIndicator:SetSize (12, 12)
  3474. -- thisIndicator:SetTexCoord (661/1024, 701/1024, 317/512, 368/512)
  3475. elseif (indicator == "Alliance") then
  3476. --thisIndicator:SetTexture ([[Interface\PVPFrame\PVP-Conquest-Misc]])
  3477. --thisIndicator:SetTexCoord (719/1024, 758/1024, 316/512, 365/512)
  3478. thisIndicator:SetTexture ([[Interface\PVPFrame\PVP-Currency-Alliance]])
  3479. thisIndicator:SetTexCoord (4/32, 29/32, 2/32, 30/32)
  3480. thisIndicator:SetSize (12, 12)
  3481. elseif (indicator == "elite") then
  3482. thisIndicator:SetTexture ([[Interface\GLUES\CharacterSelect\Glues-AddOn-Icons]])
  3483. --thisIndicator:SetTexture ([[Interface\Scenarios\SCENARIOSPARTS]])
  3484. thisIndicator:SetTexCoord (0.75, 1, 0, 1)
  3485. --thisIndicator:SetTexCoord (1/512, 47/512, 418/512, 460/512)
  3486. thisIndicator:SetVertexColor (1, .8, 0)
  3487. thisIndicator:SetSize (12, 12)
  3488.  
  3489. elseif (indicator == "rare") then
  3490. thisIndicator:SetTexture ([[Interface\GLUES\CharacterSelect\Glues-AddOn-Icons]])
  3491. thisIndicator:SetTexCoord (0.75, 1, 0, 1)
  3492. thisIndicator:SetSize (12, 12)
  3493. thisIndicator:SetDesaturated (true)
  3494.  
  3495. elseif (indicator == "quest") then
  3496. thisIndicator:SetTexture ([[Interface\TARGETINGFRAME\PortraitQuestBadge]])
  3497. thisIndicator:SetTexCoord (2/32, 26/32, 1/32, 31/32)
  3498.  
  3499. elseif (indicator == "classicon") then
  3500. local _, class = UnitClass (plateFrame [MEMBER_UNITID])
  3501. if (class) then
  3502. thisIndicator:SetTexture ([[Interface\GLUES\CHARACTERCREATE\UI-CharacterCreate-Classes]])
  3503. thisIndicator:SetTexCoord (unpack (CLASS_ICON_TCOORDS [class]))
  3504. end
  3505.  
  3506. elseif (indicator == "worldboss") then
  3507. thisIndicator:SetTexture ([[Interface\Scenarios\ScenarioIcon-Boss]])
  3508. end
  3509.  
  3510. if (plateFrame.IconIndicators.Next == 1) then
  3511. Plater.SetAnchor (thisIndicator, Plater.db.profile.indicator_anchor)
  3512. else
  3513. local attachTo = plateFrame.IconIndicators [plateFrame.IconIndicators.Next - 1]
  3514. --se for menor que 4 ele deve crescer para o lado da esquerda, nos outros casos vai para a direita
  3515. if (Plater.db.profile.indicator_anchor.side < 4) then
  3516. thisIndicator:SetPoint ("right", attachTo, "left", -2, 0)
  3517. else
  3518. thisIndicator:SetPoint ("left", attachTo, "right", 1, 0)
  3519. end
  3520. end
  3521.  
  3522. plateFrame.IconIndicators.Next = plateFrame.IconIndicators.Next + 1
  3523. end
  3524.  
  3525. function Plater.ClearIndicators (plateFrame)
  3526. for _, indicator in ipairs (plateFrame.IconIndicators) do
  3527. indicator:Hide()
  3528. indicator:ClearAllPoints()
  3529. end
  3530. plateFrame.IconIndicators.Next = 1
  3531. end
  3532.  
  3533. function Plater.ForceChangeBorderColor (self, r, g, b) --self = healthBar
  3534. for index, texture in ipairs (self.border.Textures) do
  3535. texture:SetVertexColor (r, g, b, 1)
  3536. end
  3537. self.BorderIsAggroIndicator = true
  3538. end
  3539. -- ~border
  3540. function Plater.UpdatePlateBorders (plateFrame)
  3541. --bordas
  3542. if (not plateFrame) then
  3543. for _, plateFrame in ipairs (Plater.GetAllShownPlates()) do
  3544. Plater.UpdatePlateBorders (plateFrame)
  3545. end
  3546. return
  3547. end
  3548. if (plateFrame.UnitFrame.healthBar.BorderIsAggroIndicator) then
  3549. return
  3550. end
  3551. for index, texture in ipairs (plateFrame.UnitFrame.healthBar.border.Textures) do
  3552. texture:SetVertexColor (DB_BORDER_COLOR_R, DB_BORDER_COLOR_G, DB_BORDER_COLOR_B, DB_BORDER_COLOR_A)
  3553. end
  3554.  
  3555. --Plater.UpdatePlateBorderThickness (plateFrame)
  3556. end
  3557.  
  3558. function Plater.UpdatePlateBorderThickness (plateFrame)
  3559. if (not plateFrame) then
  3560. for _, plateFrame in ipairs (Plater.GetAllShownPlates()) do
  3561. Plater.UpdatePlateBorderThickness (plateFrame)
  3562. end
  3563. return
  3564. end
  3565.  
  3566. local textures = plateFrame.UnitFrame.healthBar.border.Textures
  3567.  
  3568. -- 9 a 12 nunca são escondias
  3569. if (DB_BORDER_THICKNESS == 1) then
  3570. --hida de 1 a 8
  3571. for i = 1, 8 do
  3572. textures [i]:Hide()
  3573. end
  3574.  
  3575. elseif (DB_BORDER_THICKNESS == 2) then
  3576. --hida de 1 a 4
  3577. for i = 1, 4 do --in #plateFrame.UnitFrame.healthBar.border.Textures
  3578. textures [i]:Hide()
  3579. end
  3580. for i = 5, 8 do
  3581. textures [i]:Show()
  3582. end
  3583.  
  3584. elseif (DB_BORDER_THICKNESS == 3) then
  3585. --mostra de 1 a 8
  3586. for i = 1, 8 do
  3587. textures [i]:Show()
  3588. end
  3589. end
  3590. end
  3591.  
  3592. function Plater.GetPlateAlpha (plateFrame)
  3593. if (UnitIsUnit (plateFrame [MEMBER_UNITID], "target")) then
  3594. return 1
  3595. else
  3596. return 0.9
  3597. end
  3598. end
  3599.  
  3600. -- ~range
  3601. function Plater.CheckRange (plateFrame, onAdded)
  3602. if (plateFrame [MEMBER_NOCOMBAT]) then
  3603. return
  3604. end
  3605.  
  3606. if (plateFrame [MEMBER_REACTION] >= 5) then
  3607. plateFrame.UnitFrame:SetAlpha (1)
  3608. plateFrame [MEMBER_ALPHA] = 1
  3609. plateFrame [MEMBER_RANGE] = true
  3610. return
  3611. end
  3612.  
  3613. if (onAdded) then
  3614. if (IsSpellInRange (Plater.SpellForRangeCheck, plateFrame [MEMBER_UNITID]) == 1) then
  3615. plateFrame.FadedIn = true
  3616. local alpha = Plater.GetPlateAlpha (plateFrame)
  3617. plateFrame.UnitFrame:SetAlpha (alpha)
  3618. plateFrame [MEMBER_ALPHA] = alpha
  3619. plateFrame [MEMBER_RANGE] = true
  3620. else
  3621. plateFrame.FadedIn = nil
  3622. local alpha = Plater.db.profile.range_check_alpha
  3623. plateFrame.UnitFrame:SetAlpha (alpha)
  3624. plateFrame [MEMBER_ALPHA] = alpha
  3625. plateFrame [MEMBER_RANGE] = false
  3626. end
  3627. return
  3628. end
  3629.  
  3630. --dummies nao efatam o combate e não tem aggro
  3631. --as plates deles vao ficar sem alpha
  3632.  
  3633. if (IsSpellInRange (Plater.SpellForRangeCheck, plateFrame [MEMBER_UNITID]) == 1) then
  3634. if (not plateFrame.FadedIn and not plateFrame.UnitFrame.FadeIn.playing) then
  3635. plateFrame:RangeFadeIn()
  3636. end
  3637. else
  3638. if (plateFrame.FadedIn and not plateFrame.UnitFrame.FadeOut.playing) then
  3639. plateFrame:RangeFadeOut()
  3640. end
  3641. end
  3642. end
  3643. local on_fade_in_play = function (animation)
  3644. animation.playing = true
  3645. end
  3646. local on_fade_out_play = function (animation)
  3647. animation.playing = true
  3648. end
  3649. local on_fade_in_finished = function (animation)
  3650. animation.playing = nil
  3651. animation:GetParent():GetParent().FadedIn = true
  3652. animation:GetParent():SetAlpha (1)
  3653. animation:GetParent():GetParent() [MEMBER_ALPHA] = 1
  3654. end
  3655. local on_fade_out_finished = function (animation)
  3656. animation.playing = nil
  3657. animation:GetParent():GetParent().FadedIn = false
  3658. local alpha = Plater.db.profile.range_check_alpha
  3659. animation:GetParent():SetAlpha (alpha)
  3660. animation:GetParent():GetParent() [MEMBER_ALPHA] = alpha
  3661. end
  3662. local plate_fade_in = function (plateFrame)
  3663. plateFrame.UnitFrame.FadeIn.Animation:SetFromAlpha (plateFrame.UnitFrame:GetAlpha())
  3664. plateFrame.UnitFrame.FadeIn.Animation:SetToAlpha (1)
  3665. plateFrame.UnitFrame.FadeIn:Play()
  3666. end
  3667. local plate_fade_out = function (plateFrame)
  3668. plateFrame.UnitFrame.FadeOut.Animation:SetFromAlpha (plateFrame.UnitFrame:GetAlpha())
  3669. plateFrame.UnitFrame.FadeOut.Animation:SetToAlpha (Plater.db.profile.range_check_alpha)
  3670. plateFrame.UnitFrame.FadeOut:Play()
  3671. end
  3672. local create_alpha_animations = function (plateFrame)
  3673. local unitFrame = plateFrame.UnitFrame
  3674.  
  3675. unitFrame.FadeIn = plateFrame.UnitFrame:CreateAnimationGroup()
  3676. unitFrame.FadeOut = plateFrame.UnitFrame:CreateAnimationGroup()
  3677.  
  3678. unitFrame.FadeIn:SetScript ("OnPlay", on_fade_in_play)
  3679. unitFrame.FadeOut:SetScript ("OnPlay", on_fade_out_play)
  3680. unitFrame.FadeIn:SetScript ("OnFinished", on_fade_in_finished)
  3681. unitFrame.FadeOut:SetScript ("OnFinished", on_fade_out_finished)
  3682.  
  3683. unitFrame.FadeIn.Animation = unitFrame.FadeIn:CreateAnimation ("Alpha")
  3684. unitFrame.FadeOut.Animation = unitFrame.FadeOut:CreateAnimation ("Alpha")
  3685.  
  3686. unitFrame.FadeIn.Animation:SetOrder (1)
  3687. unitFrame.FadeOut.Animation:SetOrder (1)
  3688. unitFrame.FadeIn.Animation:SetDuration (0.2)
  3689. unitFrame.FadeOut.Animation:SetDuration (0.2)
  3690.  
  3691. plateFrame.RangeFadeIn = plate_fade_in
  3692. plateFrame.RangeFadeOut = plate_fade_out
  3693.  
  3694. plateFrame.FadedIn = true
  3695. end
  3696.  
  3697. local ExtraIconFrame_SetIcon = function (self, icon, isCC, w, h, L, R, T, B)
  3698. self.Icon:SetTexture (icon)
  3699. if (isCC) then
  3700. self:SetBackdropBorderColor (0.78431, 0.27059, 0.98039)
  3701. end
  3702. self:Show()
  3703.  
  3704. self:SetSize (w and w+2 or 17, h and h+2 or 17)
  3705. self.Icon:SetSize (w or 16, h or 16)
  3706. self.Icon:SetTexCoord (L or 0, R or 1, T or 0, B or 1)
  3707. end
  3708.  
  3709. Plater ["NAME_PLATE_CREATED"] = function (self, event, plateFrame) -- ~created
  3710. --isto é uma nameplate
  3711. plateFrame.UnitFrame.PlateFrame = plateFrame
  3712. plateFrame.isNamePlate = true
  3713. plateFrame.UnitFrame.isNamePlate = true
  3714. plateFrame.UnitFrame.BuffFrame.amtDebuffs = 0
  3715. plateFrame.UnitFrame.healthBar.border.plateFrame = plateFrame
  3716. local healthBar = plateFrame.UnitFrame.healthBar
  3717. plateFrame.NameAnchor = 0
  3718.  
  3719. --highlight para o mouse over
  3720. local mouseHighlight = healthBar:CreateTexture (nil, "overlay")
  3721. mouseHighlight:SetDrawLayer ("overlay", 7)
  3722. mouseHighlight:SetAllPoints()
  3723. mouseHighlight:SetTexture ([[Interface\ACHIEVEMENTFRAME\UI-Achievement-Alert-Glow]])
  3724. mouseHighlight:SetTexCoord (50/512, 300/512, 60/256, 100/256)
  3725. mouseHighlight:SetAlpha (.3)
  3726. mouseHighlight:Hide()
  3727.  
  3728. local TargetNeonUp = healthBar:CreateTexture (nil, "overlay")
  3729. TargetNeonUp:SetDrawLayer ("overlay", 7)
  3730. TargetNeonUp:SetPoint ("topleft", healthBar, "bottomleft")
  3731. TargetNeonUp:SetPoint ("topright", healthBar, "bottomright")
  3732. TargetNeonUp:SetTexture ([[Interface\BUTTONS\UI-Panel-Button-Glow]])
  3733. TargetNeonUp:SetTexCoord (1/128, 95/128, 30/64, 38/64)
  3734. TargetNeonUp:SetDesaturated (true)
  3735. TargetNeonUp:SetBlendMode ("ADD")
  3736. TargetNeonUp:SetHeight (8)
  3737. TargetNeonUp:Hide()
  3738. plateFrame.TargetNeonUp = TargetNeonUp
  3739.  
  3740. local TargetNeonDown = healthBar:CreateTexture (nil, "overlay")
  3741. TargetNeonDown:SetDrawLayer ("overlay", 7)
  3742. TargetNeonDown:SetPoint ("bottomleft", healthBar, "topleft")
  3743. TargetNeonDown:SetPoint ("bottomright", healthBar, "topright")
  3744. TargetNeonDown:SetTexture ([[Interface\BUTTONS\UI-Panel-Button-Glow]])
  3745. TargetNeonDown:SetTexCoord (1/128, 95/128, 38/64, 30/64) --0, 95/128
  3746. TargetNeonDown:SetDesaturated (true)
  3747. TargetNeonDown:SetBlendMode ("ADD")
  3748. TargetNeonDown:SetHeight (8)
  3749. TargetNeonDown:Hide()
  3750. plateFrame.TargetNeonDown = TargetNeonDown
  3751.  
  3752. --[[
  3753. -- plateFrame:SetAttribute ("_onenter", "")
  3754. -- plateFrame:SetAttribute ("unit", plateFrame [MEMBER_UNITID])
  3755. -- plateFrame:SetAttribute ("unit", plateFrame [MEMBER_UNITID])
  3756. -- plateFrame:SetAttribute ("_onenter", "")
  3757.  
  3758. plateFrame:SetScript ("OnEnter", function (self)
  3759. if (Plater.db.profile.hover_highlight) then
  3760. mouseHighlight:Show()
  3761. mouseHighlight:SetAlpha (Plater.db.profile.hover_highlight_alpha)
  3762.  
  3763. end
  3764. end)
  3765. plateFrame:SetScript ("OnLeave", function (self)
  3766. mouseHighlight:Hide()
  3767. end)
  3768. --]]
  3769.  
  3770. local raidTarget = healthBar:CreateTexture (nil, "overlay")
  3771. raidTarget:SetPoint ("right", -2, 0)
  3772. plateFrame.RaidTarget = raidTarget
  3773.  
  3774. plateFrame [MEMBER_ALPHA] = 1
  3775.  
  3776. create_alpha_animations (plateFrame)
  3777.  
  3778. local onTickFrame = CreateFrame ("frame", nil, plateFrame)
  3779. plateFrame.OnTickFrame = onTickFrame
  3780. onTickFrame.unit = plateFrame [MEMBER_UNITID]
  3781. onTickFrame.HealthBar = healthBar
  3782. onTickFrame.PlateFrame = plateFrame
  3783. onTickFrame.UnitFrame = plateFrame.UnitFrame
  3784. onTickFrame.BuffFrame = plateFrame.UnitFrame.BuffFrame
  3785.  
  3786. local onNextTickUpdate = CreateFrame ("frame", nil, plateFrame)
  3787. plateFrame.OnNextTickUpdate = onNextTickUpdate
  3788. onNextTickUpdate.unit = plateFrame [MEMBER_UNITID]
  3789. onNextTickUpdate.HealthBar = healthBar
  3790. onNextTickUpdate.PlateFrame = plateFrame
  3791. onNextTickUpdate.UnitFrame = plateFrame.UnitFrame
  3792. onNextTickUpdate.BuffFrame = plateFrame.UnitFrame.BuffFrame
  3793. plateFrame.TickUpdate = Plater.TickUpdate
  3794.  
  3795. --nome customizado
  3796. local actorName = healthBar:CreateFontString (nil, "artwork", "GameFontNormal")
  3797. healthBar.actorName = actorName
  3798. plateFrame.actorName = actorName --shortcut
  3799.  
  3800. --nomes extras e sub titulo
  3801. local actorNameSolo = plateFrame:CreateFontString (nil, "artwork", "GameFontNormal")
  3802. plateFrame.actorNameSolo = actorNameSolo
  3803. plateFrame.actorNameSolo:SetPoint ("center", plateFrame, "center")
  3804. plateFrame.actorNameSolo:Hide()
  3805. local actorSubTitleSolo = plateFrame:CreateFontString (nil, "artwork", "GameFontNormal")
  3806. plateFrame.actorSubTitleSolo = actorSubTitleSolo
  3807. plateFrame.actorSubTitleSolo:SetPoint ("top", actorNameSolo, "bottom", 0, -2)
  3808. plateFrame.actorSubTitleSolo:Hide()
  3809.  
  3810. plateFrame.UnitFrame.name:ClearAllPoints()
  3811. plateFrame.UnitFrame.name:SetPoint ("bottom", healthBar.actorName, "bottom")
  3812.  
  3813. --level customizado
  3814. local actorLevel = healthBar:CreateFontString (nil, "overlay", "GameFontNormal")
  3815. healthBar.actorLevel = actorLevel
  3816. --porcentagem de vida
  3817.  
  3818. local lifePercent = healthBar:CreateFontString (nil, "overlay", "GameFontNormal")
  3819. healthBar.lifePercent = lifePercent
  3820.  
  3821. local obscuredTexture = healthBar:CreateTexture (nil, "overlay")
  3822. obscuredTexture:SetAllPoints()
  3823. obscuredTexture:SetTexture ("Interface\\Tooltips\\UI-Tooltip-Background")
  3824. obscuredTexture:SetVertexColor (0, 0, 0, 1)
  3825. plateFrame.Obscured = obscuredTexture
  3826.  
  3827. --icone extra, usado para ccs e para mostrar o tipo do npc
  3828. local ExtraIconFrame = CreateFrame ("frame", nil, healthBar)
  3829. ExtraIconFrame:SetPoint ("left", plateFrame.UnitFrame.healthBar, "right", 2, 0)
  3830. ExtraIconFrame:SetSize (18, 18)
  3831. ExtraIconFrame:SetBackdrop ({edgeFile = [[Interface\Buttons\WHITE8X8]], edgeSize = 1})
  3832. ExtraIconFrame:SetBackdropBorderColor (0, 0, 0, 0)
  3833. ExtraIconFrame:EnableMouse (false)
  3834. ExtraIconFrame:Hide()
  3835. ExtraIconFrame.SetIcon = ExtraIconFrame_SetIcon
  3836. plateFrame.UnitFrame.ExtraIconFrame = ExtraIconFrame
  3837.  
  3838. local ExtraIcon1 = ExtraIconFrame:CreateTexture (nil, "artwork")
  3839. ExtraIcon1:SetPoint ("center")
  3840. ExtraIcon1:SetSize (16, 16)
  3841. ExtraIconFrame.Icon = ExtraIcon1
  3842. plateFrame.UnitFrame.ExtraIcon1 = ExtraIcon1
  3843.  
  3844. local ExtraIcon1Timer = ExtraIconFrame:CreateFontString (nil, "overlay", "GameFontNormal")
  3845. ExtraIcon1Timer:SetPoint ("center")
  3846. ExtraIconFrame.Timer = ExtraIcon1Timer
  3847. DF:SetFontColor (ExtraIcon1Timer, "white")
  3848. plateFrame.UnitFrame.ExtraIcon1Timer = ExtraIcon1Timer
  3849.  
  3850. --icone três dimensões
  3851. plateFrame.Top3DFrame = CreateFrame ("playermodel", plateFrame:GetName() .. "3DFrame", plateFrame, "ModelWithControlsTemplate")
  3852. plateFrame.Top3DFrame:SetPoint ("bottom", plateFrame, "top", 0, -100)
  3853. plateFrame.Top3DFrame:SetSize (200, 250)
  3854. plateFrame.Top3DFrame:EnableMouse (false)
  3855. plateFrame.Top3DFrame:EnableMouseWheel (false)
  3856. plateFrame.Top3DFrame:Hide()
  3857.  
  3858. --fundo da castbar
  3859. local extraBackground = plateFrame.UnitFrame.castBar:CreateTexture (nil, "background")
  3860. extraBackground:SetAllPoints()
  3861. extraBackground:SetColorTexture (0, 0, 0, 1)
  3862. plateFrame.UnitFrame.castBar.extraBackground = extraBackground
  3863. extraBackground:SetDrawLayer ("background", -3)
  3864. extraBackground:Hide()
  3865.  
  3866. --porcentagem da cast bar
  3867. local percentText = plateFrame.UnitFrame.castBar:CreateFontString (nil, "background", "GameFontNormal")
  3868. percentText:SetPoint ("right", plateFrame.UnitFrame.castBar, "right")
  3869. plateFrame.UnitFrame.castBar.percentText = percentText
  3870.  
  3871. --icone de não interrompível
  3872. plateFrame.UnitFrame.castBar.BorderShield:SetTexture ([[Interface\ACHIEVEMENTFRAME\UI-Achievement-Progressive-IconBorder]])
  3873. plateFrame.UnitFrame.castBar.BorderShield:SetTexCoord (5/64, 37/64, 1/64, 36/64)
  3874. plateFrame.UnitFrame.castBar.isNamePlate = true
  3875. plateFrame.UnitFrame.castBar.ThrottleUpdate = 0
  3876.  
  3877. --icones indicadores
  3878. plateFrame.IconIndicators = {}
  3879.  
  3880. --nome que vem com o frame
  3881. plateFrame.UnitFrame.name:ClearAllPoints()
  3882. plateFrame.UnitFrame.name:SetPoint ("top", plateFrame.UnitFrame.healthBar, "bottom", 0, 0)
  3883. plateFrame.UnitFrame.name:SetPoint ("center", plateFrame.UnitFrame.healthBar, "center")
  3884.  
  3885. --flash de aggro
  3886. Plater.CreateAggroFlashFrame (plateFrame)
  3887. plateFrame.playerHasAggro = false
  3888.  
  3889. --aviso de aggro baixo
  3890. plateFrame.UnitFrame.aggroGlowUpper = plateFrame:CreateTexture (nil, "background", -4)
  3891. plateFrame.UnitFrame.aggroGlowUpper:SetPoint ("bottomleft", plateFrame.UnitFrame.healthBar, "topleft", -3, 0)
  3892. plateFrame.UnitFrame.aggroGlowUpper:SetPoint ("bottomright", plateFrame.UnitFrame.healthBar, "topright", 3, 0)
  3893. plateFrame.UnitFrame.aggroGlowUpper:SetTexture ([[Interface\BUTTONS\UI-Panel-Button-Glow]])
  3894. plateFrame.UnitFrame.aggroGlowUpper:SetTexCoord (0, 95/128, 0, 9/64)
  3895. plateFrame.UnitFrame.aggroGlowUpper:SetBlendMode ("ADD")
  3896. plateFrame.UnitFrame.aggroGlowUpper:SetHeight (4)
  3897. plateFrame.UnitFrame.aggroGlowUpper:Hide()
  3898.  
  3899. plateFrame.UnitFrame.aggroGlowLower = plateFrame:CreateTexture (nil, "background", -4)
  3900. plateFrame.UnitFrame.aggroGlowLower:SetPoint ("topleft", plateFrame.UnitFrame.healthBar, "bottomleft", -3, 0)
  3901. plateFrame.UnitFrame.aggroGlowLower:SetPoint ("topright", plateFrame.UnitFrame.healthBar, "bottomright", 3, 0)
  3902. plateFrame.UnitFrame.aggroGlowLower:SetTexture ([[Interface\BUTTONS\UI-Panel-Button-Glow]])
  3903. plateFrame.UnitFrame.aggroGlowLower:SetTexCoord (0, 95/128, 30/64, 38/64)
  3904. plateFrame.UnitFrame.aggroGlowLower:SetBlendMode ("ADD")
  3905. plateFrame.UnitFrame.aggroGlowLower:SetHeight (4)
  3906. plateFrame.UnitFrame.aggroGlowLower:Hide()
  3907.  
  3908. end
  3909.  
  3910. function Plater.CanShowPlateFor (actorType)
  3911. return DB_PLATE_CONFIG [actorType].enabled
  3912. end
  3913.  
  3914. Plater ["NAME_PLATE_UNIT_ADDED"] = function (self, event, unitBarId) -- ~added ãdded
  3915. --pega a nameplate deste jogador
  3916.  
  3917. local plateFrame = C_NamePlate.GetNamePlateForUnit (unitBarId)
  3918.  
  3919. --use our own classification icons
  3920. plateFrame.UnitFrame.ClassificationFrame:Hide()
  3921.  
  3922. plateFrame [MEMBER_NOCOMBAT] = nil
  3923. plateFrame [MEMBER_GUID] = UnitGUID (unitBarId) or ""
  3924. plateFrame.isSelf = nil
  3925. Plater.CheckForNpcType (plateFrame)
  3926.  
  3927. plateFrame [MEMBER_NAME] = UnitName (unitBarId)
  3928.  
  3929. Plater.UpdatePlateClickSpace (plateFrame)
  3930.  
  3931. local reaction = UnitReaction (unitBarId, "player")
  3932. plateFrame [MEMBER_REACTION] = reaction
  3933. plateFrame.UnitFrame [MEMBER_REACTION] = reaction
  3934. local actorType
  3935.  
  3936. if (plateFrame.UnitFrame.unit) then
  3937. if (UnitIsUnit (unitBarId, "player")) then
  3938. plateFrame.isSelf = true
  3939. actorType = ACTORTYPE_PLAYER
  3940. plateFrame.NameAnchor = 0
  3941.  
  3942. Plater.UpdatePlateFrame (plateFrame, ACTORTYPE_PLAYER, nil, true)
  3943. else
  3944. if (UnitIsPlayer (unitBarId)) then
  3945. --é um jogador, determinar se é um inimigo ou aliado
  3946. if (reaction >= UNITREACTION_FRIENDLY) then
  3947. plateFrame.NameAnchor = DB_NAME_PLAYERFRIENDLY_ANCHOR
  3948. Plater.UpdatePlateFrame (plateFrame, ACTORTYPE_FRIENDLY_PLAYER, nil, true)
  3949. actorType = ACTORTYPE_FRIENDLY_PLAYER
  3950. if (DB_CASTBAR_HIDE_FRIENDLY) then
  3951. CastingBarFrame_SetUnit (plateFrame.UnitFrame.castBar, nil, nil, nil)
  3952. end
  3953. else
  3954. plateFrame.NameAnchor = DB_NAME_PLAYERENEMY_ANCHOR
  3955. Plater.UpdatePlateFrame (plateFrame, ACTORTYPE_ENEMY_PLAYER, nil, true)
  3956. actorType = ACTORTYPE_ENEMY_PLAYER
  3957. if (DB_CASTBAR_HIDE_ENEMIES) then
  3958. CastingBarFrame_SetUnit (plateFrame.UnitFrame.castBar, nil, nil, nil)
  3959. end
  3960. end
  3961. else
  3962. --é um npc
  3963. if (reaction >= UNITREACTION_FRIENDLY) then
  3964. plateFrame.NameAnchor = DB_NAME_NPCFRIENDLY_ANCHOR
  3965. Plater.UpdatePlateFrame (plateFrame, ACTORTYPE_FRIENDLY_NPC, nil, true)
  3966. actorType = ACTORTYPE_FRIENDLY_NPC
  3967. if (DB_CASTBAR_HIDE_FRIENDLY) then
  3968. CastingBarFrame_SetUnit (plateFrame.UnitFrame.castBar, nil, nil, nil)
  3969. end
  3970. else
  3971. --inclui npcs que são neutros
  3972. plateFrame.NameAnchor = DB_NAME_NPCENEMY_ANCHOR
  3973. Plater.UpdatePlateFrame (plateFrame, ACTORTYPE_ENEMY_NPC, nil, true)
  3974. actorType = ACTORTYPE_ENEMY_NPC
  3975. if (DB_CASTBAR_HIDE_ENEMIES) then
  3976. CastingBarFrame_SetUnit (plateFrame.UnitFrame.castBar, nil, nil, nil)
  3977. end
  3978. end
  3979. end
  3980. end
  3981. end
  3982.  
  3983. --icone da cast bar
  3984. plateFrame.UnitFrame.castBar.Icon:ClearAllPoints()
  3985. plateFrame.UnitFrame.castBar.Icon:SetPoint ("left", plateFrame.UnitFrame.castBar, "left", 0, 0)
  3986. plateFrame.UnitFrame.castBar.BorderShield:ClearAllPoints()
  3987. plateFrame.UnitFrame.castBar.BorderShield:SetPoint ("left", plateFrame.UnitFrame.castBar, "left", 0, 0)
  3988.  
  3989. --esconde os glow de aggro
  3990. plateFrame.UnitFrame.aggroGlowUpper:Hide()
  3991. plateFrame.UnitFrame.aggroGlowLower:Hide()
  3992.  
  3993. --tick
  3994. plateFrame.OnTickFrame.ThrottleUpdate = DB_TICK_THROTTLE
  3995. plateFrame.OnTickFrame.actorType = actorType
  3996. plateFrame.OnTickFrame.unit = plateFrame [MEMBER_UNITID]
  3997. plateFrame.OnTickFrame:SetScript ("OnUpdate", EventTickFunction)
  3998. EventTickFunction (plateFrame.OnTickFrame, 10)
  3999.  
  4000. --one tick update
  4001. plateFrame.OnNextTickUpdate.actorType = actorType
  4002. plateFrame.OnNextTickUpdate.unit = plateFrame [MEMBER_UNITID]
  4003.  
  4004. --range
  4005. Plater.CheckRange (plateFrame, true)
  4006. end
  4007.  
  4008. function Plater.UpdateUseClassColors()
  4009. if (Plater.db.profile.use_playerclass_color) then
  4010. Plater.InjectOnDefaultOptions (CNP_Name, Plater.DriverConfigType ["FRIENDLY"], Plater.DriverConfigMembers ["UseClassColors"], true)
  4011. else
  4012. Plater.InjectOnDefaultOptions (CNP_Name, Plater.DriverConfigType ["FRIENDLY"], Plater.DriverConfigMembers ["UseClassColors"], false)
  4013. end
  4014. for index, plateFrame in ipairs (Plater.GetAllShownPlates()) do
  4015. Plater.Execute (CUF_Name, Plater.DriverFuncNames ["OnChangeHealthConfig"], plateFrame.UnitFrame)
  4016. end
  4017. end
  4018.  
  4019. function Plater.UpdateUseCastBar()
  4020. Plater.InjectOnDefaultOptions (CNP_Name, Plater.DriverConfigType ["ENEMY"], Plater.DriverConfigMembers ["HideCastBar"], Plater.db.profile.hide_enemy_castbars)
  4021. Plater.InjectOnDefaultOptions (CNP_Name, Plater.DriverConfigType ["FRIENDLY"], Plater.DriverConfigMembers ["HideCastBar"], Plater.db.profile.hide_friendly_castbars)
  4022. Plater.RefreshDBUpvalues()
  4023. end
  4024.  
  4025. local CullingUnderCombat = function()
  4026. return Plater.UpdateCullingDistance()
  4027. end
  4028. function Plater.UpdateCullingDistance()
  4029. if (InCombatLockdown()) then
  4030. return C_Timer.After (1, CullingUnderCombat)
  4031. end
  4032. local distance = Plater.db.profile.culling_distance
  4033. --SetCVar (CVAR_CULLINGDISTANCE, distance)
  4034. end
  4035.  
  4036. Plater ["NAME_PLATE_UNIT_REMOVED"] = function (self, event, unitBarId)
  4037. local plateFrame = C_NamePlate.GetNamePlateForUnit (unitBarId)
  4038. plateFrame.OnTickFrame:SetScript ("OnUpdate", nil)
  4039. plateFrame [MEMBER_QUEST] = false
  4040. local healthFrame = plateFrame.UnitFrame.healthBar
  4041. if (healthFrame:GetScript ("OnUpdate")) then
  4042. healthFrame:SetScript ("OnUpdate", nil)
  4043. healthFrame.IsIncreasingHeight = nil
  4044. healthFrame.IsDecreasingHeight = nil
  4045. healthFrame:SetHeight (healthFrame.TargetHeight)
  4046. end
  4047. end
  4048.  
  4049. local petCache = {}
  4050. Plater.petCache = petCache
  4051.  
  4052. local CL_Parser = CreateFrame ("frame", nil, UIParent)
  4053. local CL_Func = function (self, event, time, token, hidding, sourceGUID, sourceName, sourceFlag, sourceFlag2, targetGUID, targetName, targetFlag, targetFlag2, ...)
  4054. if (sourceFlag and CompareBit (sourceFlag, 0x00003000) ~= 0) then
  4055. petCache [sourceGUID] = time
  4056. elseif (targetFlag and CompareBit (targetFlag, 0x00003000) ~= 0) then
  4057. petCache [targetGUID] = time
  4058. end
  4059.  
  4060. if (token == "SPELL_INTERRUPT") then
  4061. for _, plateFrame in ipairs (Plater.GetAllShownPlates()) do
  4062. if (plateFrame.UnitFrame.castBar:IsShown()) then
  4063. if (plateFrame.UnitFrame.castBar.Text:GetText() == INTERRUPTED) then
  4064. if (plateFrame [MEMBER_GUID] == targetGUID) then
  4065. plateFrame.UnitFrame.castBar.Text:SetText (INTERRUPTED .. " [" .. Plater.SetTextColorByClass (sourceName, sourceName) .. "]")
  4066. end
  4067. end
  4068. end
  4069. end
  4070. end
  4071. end
  4072. CL_Parser:SetScript ("OnEvent", CL_Func)
  4073. CL_Parser:RegisterEvent ("COMBAT_LOG_EVENT_UNFILTERED")
  4074.  
  4075. C_Timer.NewTicker (180, function()
  4076. local now = time()
  4077. for guid, time in pairs (petCache) do
  4078. if (time+180 < now) then
  4079. petCache [guid] = nil
  4080. end
  4081. end
  4082. end)
  4083.  
  4084. function Plater.ShutdownInterfaceOptionsPanel()
  4085. local frames = {
  4086. InterfaceOptionsNamesPanelUnitNameplates,
  4087. InterfaceOptionsNamesPanelUnitNameplatesFriendsText,
  4088. InterfaceOptionsNamesPanelUnitNameplatesEnemies,
  4089. InterfaceOptionsNamesPanelUnitNameplatesPersonalResource,
  4090. InterfaceOptionsNamesPanelUnitNameplatesPersonalResourceOnEnemy,
  4091. InterfaceOptionsNamesPanelUnitNameplatesMakeLarger,
  4092. InterfaceOptionsNamesPanelUnitNameplatesShowAll,
  4093. InterfaceOptionsNamesPanelUnitNameplatesAggroFlash,
  4094. InterfaceOptionsNamesPanelUnitNameplatesFriendlyMinions,
  4095. InterfaceOptionsNamesPanelUnitNameplatesEnemyMinions,
  4096. InterfaceOptionsNamesPanelUnitNameplatesEnemyMinus,
  4097. InterfaceOptionsNamesPanelUnitNameplatesMotionDropDown,
  4098. }
  4099.  
  4100. for _, frame in ipairs (frames) do
  4101. frame:Hide()
  4102. end
  4103.  
  4104. InterfaceOptionsNamesPanelUnitNameplatesMakeLarger.setFunc = function() end
  4105.  
  4106. local f = CreateFrame ("frame", nil, InterfaceOptionsNamesPanel)
  4107. f:SetSize (300, 200)
  4108. f:SetPoint ("topleft", InterfaceOptionsNamesPanel, "topleft", 10, -240)
  4109.  
  4110. local open_options = function()
  4111. InterfaceOptionsFrame:Hide()
  4112. --GameMenuFrame:Hide()
  4113. Plater.OpenOptionsPanel()
  4114. end
  4115.  
  4116. local Button = DF:CreateButton (f, open_options, 100, 20, "", -1, nil, nil, nil, nil, nil, DF:GetTemplate ("button", "OPTIONS_BUTTON_TEMPLATE"))
  4117. Button:SetPoint ("topleft", f, "topleft", 10, 0)
  4118. Button:SetText ("Open Plater Options")
  4119. Button:SetIcon ([[Interface\BUTTONS\UI-OptionsButton]], 18, 18, "overlay", {0, 1, 0, 1})
  4120.  
  4121. local Label = DF:CreateLabel (f, "Where are the Nameplate options?\n- Open Plater options, they are at the top left.")
  4122. Label:SetPoint ("bottomleft", Button, "topleft", 0, 2)
  4123. end
  4124.  
  4125. --elseof
  4126. local run_SetCVarsOnFirstRun = function()
  4127. Plater.SetCVarsOnFirstRun()
  4128. end
  4129. function Plater.SetCVarsOnFirstRun()
  4130.  
  4131. if (InCombatLockdown()) then
  4132. C_Timer.After (1, run_SetCVarsOnFirstRun)
  4133. return
  4134. end
  4135.  
  4136. SetCVar (CVAR_SHOWPERSONAL, CVAR_DISABLED)
  4137. SetCVar (CVAR_RESOURCEONTARGET, CVAR_DISABLED)
  4138. SetCVar (CVAR_SHOWALL, CVAR_ENABLED)
  4139. SetCVar (CVAR_AGGROFLASH, CVAR_ENABLED)
  4140. SetCVar (CVAR_ENEMY_MINIONS, CVAR_ENABLED)
  4141. SetCVar (CVAR_ENEMY_MINUS, CVAR_ENABLED)
  4142. SetCVar (CVAR_PLATEMOTION, CVAR_ENABLED)
  4143. SetCVar (CVAR_FRIENDLY_ALL, CVAR_ENABLED)
  4144. SetCVar (CVAR_FRIENDLY_GUARDIAN, CVAR_DISABLED)
  4145. SetCVar (CVAR_FRIENDLY_PETS, CVAR_DISABLED)
  4146. SetCVar (CVAR_FRIENDLY_TOTEMS, CVAR_DISABLED)
  4147. SetCVar (CVAR_FRIENDLY_MINIONS, CVAR_DISABLED)
  4148. SetCVar (CVAR_CLASSCOLOR, CVAR_ENABLED)
  4149.  
  4150. SetCVar (CVAR_SHOWPERSONAL, CVAR_DISABLED)
  4151. SetCVar (CVAR_CEILING, 0.025)
  4152.  
  4153. --SetCVar (CVAR_SCALE_HORIZONTAL, "1.4")
  4154. SetCVar (CVAR_SCALE_HORIZONTAL, CVAR_ENABLED)
  4155. --SetCVar (CVAR_SCALE_VERTICAL, "2.7")
  4156. SetCVar (CVAR_SCALE_VERTICAL, CVAR_ENABLED)
  4157.  
  4158. InterfaceOptionsNamesPanelUnitNameplatesMakeLarger:Click()
  4159. InterfaceOptionsNamesPanelUnitNameplatesPersonalResource:Click()
  4160. InterfaceOptionsNamesPanelUnitNameplatesPersonalResource:Click()
  4161.  
  4162. Plater.ShutdownInterfaceOptionsPanel()
  4163.  
  4164. PlaterDBChr.first_run [UnitGUID ("player")] = true
  4165.  
  4166. SetCVar (CVAR_CULLINGDISTANCE, 100)
  4167.  
  4168. C_Timer.After (2, function()
  4169. SetCVar (CVAR_SHOWPERSONAL, CVAR_ENABLED)
  4170. end)
  4171. end
  4172.  
  4173. function Plater:PLAYER_LOGOUT()
  4174. --be safe, don't break shit
  4175. --SetCVar (CVAR_CULLINGDISTANCE, 60)
  4176. end
  4177.  
  4178. function Plater.OpenFeedbackWindow()
  4179. if (not Plater.report_window) then
  4180. local w = CreateFrame ("frame", "PlaterBugReportWindow", UIParent)
  4181. w:SetFrameStrata ("TOOLTIP")
  4182. w:SetSize (300, 50)
  4183. w:SetPoint ("center", UIParent, "center")
  4184. tinsert (UISpecialFrames, "PlaterBugReportWindow")
  4185. Plater.report_window = w
  4186.  
  4187. local editbox = DF:CreateTextEntry (w, function()end, 280, 20)
  4188. w.editbox = editbox
  4189. editbox:SetPoint ("center", w, "center")
  4190. editbox:SetAutoFocus (false)
  4191.  
  4192. editbox:SetHook ("OnEditFocusGained", function()
  4193. editbox.text = "http://us.battle.net/wow/en/forum/topic/20744134351#1"
  4194. editbox:HighlightText()
  4195. end)
  4196. editbox:SetHook ("OnEditFocusLost", function()
  4197. w:Hide()
  4198. end)
  4199. editbox:SetHook ("OnChar", function()
  4200. editbox.text = "http://us.battle.net/wow/en/forum/topic/20744134351#1"
  4201. editbox:HighlightText()
  4202. end)
  4203. editbox.text = "http://us.battle.net/wow/en/forum/topic/20744134351#1"
  4204.  
  4205. function Plater:ReportWindowSetFocus()
  4206. if (PlaterBugReportWindow:IsShown()) then
  4207. PlaterBugReportWindow:Show()
  4208. PlaterBugReportWindow.editbox:SetFocus()
  4209. PlaterBugReportWindow.editbox:HighlightText()
  4210. end
  4211. end
  4212. end
  4213.  
  4214. PlaterBugReportWindow:Show()
  4215. C_Timer.After (1, Plater.ReportWindowSetFocus)
  4216. end
  4217.  
  4218.  
  4219. SLASH_PLATER1 = "/plater"
  4220. SLASH_PLATER2 = "/nameplate"
  4221. SLASH_PLATER3 = "/nameplates"
  4222.  
  4223. local function distance (x1,y1,x2,y2)
  4224. local _,TLx,TLy,BRx,BRy = GetCurrentMapZone()
  4225. local cx = TLx-BRx -- width of zone in yards
  4226. local cy = TLy-BRy -- height of zone in yards
  4227. if cx~=0 and cy~=0 then
  4228. return math.sqrt( ((x1-x2)*cx)^2 + ((y1-y2)*cy)^2 )
  4229. end
  4230. end
  4231.  
  4232. -- ~cvar
  4233. local cvarDiagList = {
  4234. "nameplateMaxDistance",
  4235. "nameplateOtherTopInset",
  4236. "nameplateOtherAtBase",
  4237. "nameplateMinAlpha",
  4238. "nameplateMinAlphaDistance",
  4239. "nameplateShowAll",
  4240. "nameplateShowEnemies",
  4241. "nameplateShowEnemyMinions",
  4242. "nameplateShowEnemyMinus",
  4243. "nameplateShowFriends",
  4244. "nameplateShowFriendlyGuardians",
  4245. "nameplateShowFriendlyPets",
  4246. "nameplateShowFriendlyTotems",
  4247. "nameplateShowFriendlyMinions",
  4248. "NamePlateHorizontalScale",
  4249. "NamePlateVerticalScale",
  4250. }
  4251. function SlashCmdList.PLATER (msg, editbox)
  4252. if (msg == "dignostico" or msg == "diag" or msg == "debug") then
  4253.  
  4254. print ("Plater Diagnostic:")
  4255. for i = 1, #cvarDiagList do
  4256. local cvar = cvarDiagList [i]
  4257. print ("|cFFC0C0C0" .. cvar, "|r->", GetCVar (cvar))
  4258. end
  4259.  
  4260. local alphaPlateFrame = "there's no nameplate in the screen"
  4261. local alphaUnitFrame = ""
  4262. local alphaHealthFrame = ""
  4263. local testPlate
  4264.  
  4265. for _, plateFrame in ipairs (Plater.GetAllShownPlates()) do
  4266. if (plateFrame [MEMBER_REACTION] < 4) then
  4267. testPlate = plateFrame
  4268. alphaPlateFrame = plateFrame:GetAlpha()
  4269. alphaUnitFrame = plateFrame.UnitFrame:GetAlpha()
  4270. alphaHealthFrame = plateFrame.UnitFrame.healthBar:GetAlpha()
  4271. break
  4272. end
  4273. end
  4274.  
  4275. print ("|cFFC0C0C0Alpha|r", "->", alphaPlateFrame, "-", alphaUnitFrame, "-", alphaHealthFrame)
  4276.  
  4277. if (testPlate) then
  4278. local w, h = testPlate:GetSize()
  4279. print ("|cFFC0C0C0Size|r", "->", w, h, "-", testPlate.UnitFrame.healthBar:GetSize())
  4280.  
  4281. local point1, anchorFrame, point2, x, y = testPlate:GetPoint (1)
  4282. print ("|cFFC0C0C0Point|r", "->", point1, anchorFrame:GetName(), point2, x, y)
  4283.  
  4284. local plateIsShown = testPlate:IsShown() and "yes" or "no"
  4285. local unitFrameIsShown = testPlate.UnitFrame:IsShown() and "yes" or "no"
  4286. local healthBarIsShown = testPlate.UnitFrame.healthBar:IsShown() and "yes" or "no"
  4287. print ("|cFFC0C0C0ShownStatus|r", "->", plateIsShown, "-", unitFrameIsShown, "-", healthBarIsShown)
  4288. else
  4289. print ("|cFFC0C0C0Size|r", "-> there's no nameplate in the screen")
  4290. print ("|cFFC0C0C0Point|r", "-> there's no nameplate in the screen")
  4291. print ("|cFFC0C0C0ShownStatus|r", "-> there's no nameplate in the screen")
  4292. end
  4293.  
  4294. return
  4295. end
  4296. Plater.OpenOptionsPanel()
  4297. end
  4298. local ignored_npcs = {
  4299. [90336] = true, --azurewing whelping - Azsuna
  4300. [88782] = true, --nar'thalas nightwatcher - Azsuna
  4301. [89634] = true, --nar'thalas citizen - Azsuna
  4302. [111625] = true, --warden trainee - Azsuna
  4303. }
  4304. local ignored_npcs_when_profession = {
  4305. [32751] = true, --warp huntress pet - Dalaran
  4306. [110571] = 1, --delas mooonfang - Dalaran
  4307. [113199] = true, --delas's pet - Dalaran
  4308. [110018] = 1, --gazrix gearlock - Dalaran
  4309. [107622] = true, --glutonia - Dalaran
  4310. [106263] = 1, --earthen ring shaman - Dalaran
  4311. [106262] = 1, --earthen ring shaman - Dalaran
  4312. [97141] = true, --koraud - Dalaran
  4313. -- [] = true, --
  4314. }
  4315.  
  4316. --nome das facções em legion
  4317. local faction_coord_mul = (10^3)
  4318. local legion_factions = { --localize-me
  4319. "Court of Farondis",
  4320. "Dreamweavers",
  4321. "HighmountainTribe",
  4322. "The Nightfallen",
  4323. "The Wardens",
  4324. "Valarjar",
  4325. }
  4326. local factions_index = {
  4327. ["Court of Farondis"] = 1,
  4328. ["Dreamweavers"] = 2,
  4329. ["HighmountainTribe"] = 3,
  4330. ["The Nightfallen"] = 4,
  4331. ["The Wardens"] = 5,
  4332. ["Valarjar"] = 6,
  4333. }
  4334. --armazena as facções ignoradas
  4335. local ignored_factions = {}
  4336. local faction_distance = 5000
  4337. --coords x y or multiplier
  4338. local faction_coords1 = {{.083, .101}, {.116, .067}, {.086, .097}, {.114}} -- .099
  4339. local faction_coords2 = {{.110, .097}, {.109, .101}, {.112, .108}, {.097, .116}, {.101}} --.105
  4340. local faction_coords3 = {{.077, .105}, {.110, .065}, {.108, .112}, {.104, .097}}
  4341. local faction_coords4 = {{.068, .105}, {.115, .116}, {.097, .110}, {.099, .101}}
  4342. --local faction_coords5 = {} --the wardens TODO
  4343. --local faction_coords6 = {} --suramar faction TODO
  4344. --npc types
  4345. local npc_types = {
  4346. [100468] = 7,
  4347. [110971] = 7,
  4348. [112007] = 12,
  4349. [96978] = 2,
  4350. [96803] = 12,
  4351. [96819] = 5,
  4352. [93520] = 25,
  4353. [111418] = 7,
  4354. [95688] = 7,
  4355. [96979] = 2,
  4356. [97011] = 2,
  4357. [111323] = 7,
  4358. [96804] = 12,
  4359. [96565] = 7,
  4360. [97856] = 3,
  4361. [99912] = 12,
  4362. [98972] = 7,
  4363. [100550] = 7,
  4364. [92183] = 29,
  4365. [111324] = 2,
  4366. [96805] = 12,
  4367. [96821] = 5,
  4368. [97857] = 3,
  4369. [93538] = 22,
  4370. [111420] = 7,
  4371. [110974] = 2,
  4372. [106655] = 29,
  4373. [98017] = 28,
  4374. [93188] = 24,
  4375. [108504] = 4,
  4376. [96806] = 4,
  4377. [112632] = 12,
  4378. [97858] = 2,
  4379. [93539] = 25,
  4380. [93826] = 1,
  4381. [93189] = 24,
  4382. [93460] = 4,
  4383. [98066] = 7,
  4384. [108537] = 2,
  4385. [96823] = 5,
  4386. [93524] = 27,
  4387. [107326] = 9,
  4388. [108888] = 7,
  4389. [92839] = 2,
  4390. [98720] = 32,
  4391. [96999] = 3,
  4392. [108506] = 2,
  4393. [92457] = 33,
  4394. [96808] = 12,
  4395. [108554] = 4,
  4396. [97860] = 7,
  4397. [93541] = 32,
  4398. [94099] = 4,
  4399. [93940] = 7,
  4400. [92936] = 12,
  4401. [92458] = 33,
  4402. [96809] = 12,
  4403. [108555] = 12,
  4404. [93526] = 34,
  4405. [93542] = 27,
  4406. [100459] = 7,
  4407. [94100] = 2,
  4408. [93447] = 7,
  4409. [96778] = 2,
  4410. [92459] = 31,
  4411. [108556] = 12,
  4412. [97862] = 8,
  4413. [91535] = 2,
  4414. [96779] = 2,
  4415. [92460] = 31,
  4416. [93528] = 21,
  4417. [93544] = 30,
  4418. [98931] = 26,
  4419. [98724] = 9,
  4420. [92684] = 4,
  4421. [88110] = 7,
  4422. [96796] = 4,
  4423. [93529] = 21,
  4424. [98948] = 26,
  4425. [107379] = 1,
  4426. [97004] = 3,
  4427. [96781] = 10,
  4428. [96813] = 7,
  4429. [108559] = 4,
  4430. [99905] = 2,
  4431. [106902] = 1,
  4432. [96479] = 9,
  4433. [93945] = 2,
  4434. [97786] = 4,
  4435. [96782] = 12,
  4436. [108560] = 2,
  4437. [93531] = 28,
  4438. [111675] = 7,
  4439. [96822] = 5,
  4440. [98966] = 7,
  4441. [98161] = 7,
  4442. [97876] = 2,
  4443. [93527] = 34,
  4444. [96990] = 12,
  4445. [93691] = 24,
  4446. [98105] = 7,
  4447. [96980] = 2,
  4448. [96799] = 4,
  4449. [93464] = 2,
  4450. [98106] = 4,
  4451. [97867] = 3,
  4452. [92456] = 33,
  4453. [92464] = 31,
  4454. [92560] = 7,
  4455. [103796] = 4,
  4456. [93532] = 30,
  4457. [79858] = 9,
  4458. [94973] = 7,
  4459. [96975] = 2,
  4460. [108534] = 12,
  4461. [97007] = 2,
  4462. [97865] = 2,
  4463. [92194] = 25,
  4464. [96807] = 4,
  4465. [93523] = 26,
  4466. [97852] = 4,
  4467. [97868] = 7,
  4468. [95844] = 20,
  4469. [95118] = 4,
  4470. [96507] = 8,
  4471. [98124] = 7,
  4472. [93530] = 28,
  4473. [96784] = 12,
  4474. [112866] = 7,
  4475. [96976] = 2,
  4476. [92195] = 30,
  4477. [93522] = 26,
  4478. [89640] = 2,
  4479. [96785] = 12,
  4480. [96801] = 2,
  4481. [96817] = 5,
  4482. [111627] = 2,
  4483. [97869] = 2,
  4484. [93521] = 26,
  4485. [110531] = 3,
  4486. [92242] = 29,
  4487. [99867] = 11,
  4488. [89639] = 4,
  4489. [90639] = 7,
  4490. [93525] = 27,
  4491. [96977] = 2,
  4492. [90638] = 2,
  4493. [92184] = 29,
  4494. [100559] = 7,
  4495. [111327] = 7,
  4496. [96802] = 12,
  4497. [96818] = 5,
  4498. [111624] = 7,
  4499. [97870] = 7,
  4500. [92245] = 2,
  4501. [108553] = 3,
  4502. }
  4503.  
  4504. function Plater.IsIgnored (plateFrame, onlyProfession)
  4505. if (onlyProfession) then
  4506. local npcId = plateFrame [MEMBER_NPCID]
  4507. if (not npcId) then
  4508. return
  4509. end
  4510. if (ignored_npcs_when_profession [npcId]) then
  4511. return true
  4512. end
  4513. end
  4514. end
  4515.  
  4516. function Plater.CheckForNpcType (plateFrame)
  4517. --limpa o tipo do npc
  4518. plateFrame [MEMBER_NPCTYPE] = nil
  4519. plateFrame [MEMBER_NPCID] = nil
  4520.  
  4521. local npcId = plateFrame [MEMBER_GUID]
  4522. if (npcId and npcId ~= "") then
  4523. npcId = select (6, strsplit ("-", npcId))
  4524. if (npcId) then
  4525. npcId = tonumber (npcId)
  4526. else
  4527. return
  4528. end
  4529. else
  4530. return
  4531. end
  4532. if (not npcId) then
  4533. return
  4534. end
  4535.  
  4536. plateFrame [MEMBER_NPCID] = npcId
  4537.  
  4538. local typeId = npc_types [npcId]
  4539. if (typeId) then
  4540. plateFrame [MEMBER_NPCTYPE] = typeId
  4541. else
  4542. return
  4543. end
  4544. end
  4545. --area da facção no mapa
  4546. local factioncoords = function (self)
  4547. if (not InCombatLockdown()) then
  4548. local locs_list = {{}, {}}
  4549. for faction_index, locs in ipairs (faction_coords1) do
  4550. for coord_index, coord in ipairs (locs) do
  4551. tinsert (locs_list[1], coord * faction_coord_mul)
  4552. end
  4553. end
  4554. for faction_index, locs in ipairs (faction_coords2) do
  4555. for coord_index, coord in ipairs (locs) do
  4556. tinsert (locs_list[2], coord * faction_coord_mul)
  4557. end
  4558. end
  4559. for faction_index, locs in ipairs (faction_coords3) do
  4560. for coord_index, coord in ipairs (locs) do
  4561. tinsert (locs_list[2], coord * faction_coord_mul)
  4562. end
  4563. end
  4564. for faction_index, locs in ipairs (faction_coords4) do
  4565. for coord_index, coord in ipairs (locs) do
  4566. tinsert (locs_list[2], coord * faction_coord_mul)
  4567. end
  4568. end
  4569. local faction_by_distance = Plater.db.profile.faction_check_type or 0
  4570. local faction_distance = faction_by_distance and Plater.db.profile.faction_hub_distance_to or 0
  4571. local cds = f[faction_by_distance][char] or {} --hold the coords
  4572. if (Plater.CanLoadFactionStrings) then
  4573. Plater.FactionIndex = {}
  4574. --azsuna, val'sharah, highmountain, stormheim, suramar, broken shore
  4575. for i = 1, 6 do
  4576. local area, area2 = 0, 0
  4577. for index, length in ipairs (locs_list[1]) do area = area + length*faction_coord_mul end
  4578. for index, length in ipairs (locs_list[2]) do area2 = area2 + length*faction_coord_mul end
  4579. local coords = f[cds (unpack (locs_list[1]))]
  4580. Plater.FactionIndex [i] = {coords (cds (unpack (locs_list[2])), area-area2/#locs_list)}
  4581. end
  4582. function Plater.IsInFactionZone (plateFrame)
  4583. local x, y = GetPlayerMapPosition()
  4584. for factionIndex, coords in ipairs (Plater.FactionIndex) do
  4585. if (x > coords[1] and y > coords[2] and x < coords[3] and y < coords[4]) then
  4586. return true
  4587. end
  4588. end
  4589. end
  4590. else
  4591. function Plater.IsInFactionZone()
  4592. return false
  4593. end
  4594. wipe (legion_factions)
  4595. wipe (factions_index)
  4596. end
  4597. else
  4598. Plater.GetFactionNpcLocs()
  4599. end
  4600. end
  4601.  
  4602. local factionNpcs = {
  4603. [92342] = 1,
  4604. [98867] = 1,
  4605. [90639] = 2,
  4606. [93639] = 2,
  4607. [93638] = 3,
  4608. [96541] = 3,
  4609. [91251] = 3,
  4610. [91111] = 3,
  4611. [98521] = 3,
  4612. [100001] = 3,
  4613. [91114] = 4,
  4614. [99854] = 4,
  4615. [111327] = 5,
  4616. [101845] = 5,
  4617. }
  4618. local factionColor = {.2, 1, .2, 1}
  4619. function Plater.GetNpcFactionColor (plateFrame)
  4620. local unit = plateFrame [MEMBER_UNITID]
  4621. local guid = UnitGUID (unit)
  4622. if (guid) then
  4623. local npcID = select (6, strsplit ("-", guid))
  4624. npcID = tonumber (npcID)
  4625. if (npcID) then
  4626. local hasFaction = factionNpcs [npcID]
  4627. if (hasFaction) then
  4628. Plater.ForceChangeHealthBarColor (plateFrame.UnitFrame.healthBar, unpack (factionColor))
  4629. return true
  4630. end
  4631. end
  4632. end
  4633. end
  4634. function Plater.GetFactionNpcLocs()
  4635. local timer = C_Timer.NewTimer (1, factioncoords)
  4636. end
  4637.  
  4638. function Plater.SetTextColorByClass (unit, text)
  4639. local _, class = UnitClass (unit)
  4640. if (class) then
  4641. local color = RAID_CLASS_COLORS [class]
  4642. if (color) then
  4643. text = "|c" .. color.colorStr .. DF:RemoveRealName (text) .. "|r"
  4644. end
  4645. end
  4646. return text
  4647. end
  4648.  
  4649. Plater.SpecList = {
  4650. ["DEMONHUNTER"] = {
  4651. [577] = true,
  4652. [581] = true,
  4653. },
  4654. ["DEATHKNIGHT"] = {
  4655. [250] = true,
  4656. [251] = true,
  4657. [252] = true,
  4658. },
  4659. ["WARRIOR"] = {
  4660. [71] = true,
  4661. [72] = true,
  4662. [73] = true,
  4663. },
  4664. ["MAGE"] = {
  4665. [62] = true,
  4666. [63] = true,
  4667. [64] = true,
  4668. },
  4669. ["ROGUE"] = {
  4670. [259] = true,
  4671. [260] = true,
  4672. [261] = true,
  4673. },
  4674. ["DRUID"] = {
  4675. [102] = true,
  4676. [103] = true,
  4677. [104] = true,
  4678. [105] = true,
  4679. },
  4680. ["HUNTER"] = {
  4681. [253] = true,
  4682. [254] = true,
  4683. [255] = true,
  4684. },
  4685. ["SHAMAN"] = {
  4686. [262] = true,
  4687. [263] = true,
  4688. [264] = true,
  4689. },
  4690. ["PRIEST"] = {
  4691. [256] = true,
  4692. [257] = true,
  4693. [258] = true,
  4694. },
  4695. ["WARLOCK"] = {
  4696. [265] = true,
  4697. [266] = true,
  4698. [267] = true,
  4699. },
  4700. ["PALADIN"] = {
  4701. [65] = true,
  4702. [66] = true,
  4703. [70] = true,
  4704. },
  4705. ["MONK"] = {
  4706. [268] = true,
  4707. [269] = true,
  4708. [270] = true,
  4709. },
  4710. }
  4711.  
  4712. local re_GetSpellForRangeCheck = function()
  4713. Plater.GetSpellForRangeCheck()
  4714. end
  4715. function Plater.GetSpellForRangeCheck()
  4716. local specIndex = GetSpecialization()
  4717. if (specIndex) then
  4718. local specID = GetSpecializationInfo (specIndex)
  4719. if (specID and specID ~= 0) then
  4720. Plater.SpellForRangeCheck = PlaterDBChr.spellRangeCheck [specID]
  4721. else
  4722. C_Timer.After (5, re_GetSpellForRangeCheck)
  4723. end
  4724. else
  4725. C_Timer.After (5, re_GetSpellForRangeCheck)
  4726. end
  4727. end
  4728.  
  4729. Plater.DefaultSpellRangeList = {
  4730. [577] = 198013, --> havoc demon hunter - Eye-Beam
  4731. [581] = 185245, --> vengeance demon hunter - Torment
  4732.  
  4733. [250] = 56222, --> blood dk - dark command
  4734. [251] = 56222, --> frost dk - dark command
  4735. [252] = 56222, --> unholy dk - dark command
  4736.  
  4737. [102] = 164815, --> druid balance - Sunfire
  4738. [103] = 6795, --> druid feral - Growl
  4739. [104] = 6795, --> druid guardian - Growl
  4740. [105] = 5176, --> druid resto - Solar Wrath
  4741.  
  4742. [253] = 193455, --> hunter bm - Cobra Shot
  4743. [254] = 19434, --> hunter marks - Aimed Shot
  4744. [255] = 190925, --> hunter survivor - Harpoon
  4745.  
  4746. [62] = 227170, --> mage arcane - arcane blast
  4747. [63] = 133, --> mage fire - fireball
  4748. [64] = 228597, --> mage frost - frostbolt
  4749.  
  4750. [268] = 115546 , --> monk bm - Provoke
  4751. [269] = 115546, --> monk ww - Provoke
  4752. [270] = 115546, --> monk mw - Provoke
  4753.  
  4754. [65] = 62124, --> paladin holy - Hand of Reckoning
  4755. [66] = 62124, --> paladin protect - Hand of Reckoning
  4756. [70] = 62124, --> paladin ret - Hand of Reckoning
  4757.  
  4758. [256] = 585, --> priest disc - Smite
  4759. [257] = 585, --> priest holy - Smite
  4760. [258] = 8092, --> priest shadow - Mind Blast
  4761.  
  4762. [259] = 185565, --> rogue assassination - Poisoned Knife
  4763. [260] = 185763, --> rogue combat - Pistol Shot
  4764. [261] = 36554, --> rogue sub - Shadowstep
  4765.  
  4766. [262] = 403, --> shaman elemental - Lightning Bolt
  4767. [263] = 51514, --> shamel enhancement - Hex
  4768. [264] = 403, --> shaman resto - Lightning Bolt
  4769.  
  4770. [265] = 980, --> warlock aff - Agony
  4771. [266] = 686, --> warlock demo - Shadow Bolt
  4772. [267] = 116858, --> warlock destro - Chaos Bolt
  4773.  
  4774. [71] = 100, --> warrior arms - Charge --132337 on beta
  4775. [72] = 100, --> warrior fury - Charge
  4776. [73] = 355, --> warrior protect - Taunt
  4777. }
  4778.  
  4779. function Plater.GetNpcTypeIcon (npcType)
  4780. if (npcType == 1) then --important npc
  4781. return [[Interface\MINIMAP\ObjectIconsAtlas]], 205/512, 236/512, 137/512, 160/512
  4782. elseif (npcType == 2) then --repair
  4783. return [[Interface\MINIMAP\ObjectIconsAtlas]], 106/512, 132/512, 273/512, 302/512
  4784. elseif (npcType == 3) then --merchant
  4785. return [[Interface\GossipFrame\BankerGossipIcon]], 0, 1, 0, 1
  4786. elseif (npcType == 4) then --innkeeper
  4787. return [[Interface\MINIMAP\ObjectIconsAtlas]], 36/512, 66/512, 442/512, 472/512
  4788. elseif (npcType == 5) then --banker
  4789. return [[Interface\GossipFrame\BankerGossipIcon]], 2/16, 1, 0, 1
  4790. elseif (npcType == 6) then --autioneer
  4791. return [[Interface\GossipFrame\auctioneerGossipIcon]], 0, 1, 0, 1
  4792. elseif (npcType == 7) then --flyght master
  4793. return [[Interface\GossipFrame\TaxiGossipIcon]], 0, 1, 0, 1
  4794. elseif (npcType == 8) then --stable master
  4795. return [[Interface\MINIMAP\ObjectIconsAtlas]], 104/512, 135/512, 442/512, 473/512
  4796. elseif (npcType == 9) then --pet master
  4797. return [[Interface\MINIMAP\ObjectIconsAtlas]], 172/512, 201/512, 273/512, 301/512
  4798. elseif (npcType == 10) then --barber
  4799. return [[]], 0
  4800. elseif (npcType == 11) then --transmogrifier
  4801. return [[Interface\BUTTONS\UI-GroupLoot-DE-Up]], 0, 1, 0, 1
  4802. elseif (npcType == 12) then --food and drink
  4803. return [[Interface\MINIMAP\ObjectIconsAtlas]], 35/512, 66/512, 341/512, 371/512
  4804. elseif (npcType == 20) then --fishing
  4805. return [[Interface\Garrison\MobileAppIcons]], 0, 127/1024, 779/1024, 910/1024
  4806. elseif (npcType == 21) then --first aid
  4807. return [[Interface\Garrison\MobileAppIcons]], 0, 130/1024, 650/1024, 779/1024
  4808. elseif (npcType == 22) then --archaeology
  4809. return [[Interface\Garrison\MobileAppIcons]], 130/1024, 260/1024, 0, 130/1024
  4810. elseif (npcType == 23) then --cooking
  4811. return [[Interface\Garrison\MobileAppIcons]], 0, 130/1024, 260/1024, 390/1024
  4812. elseif (npcType == 24) then --mining
  4813. return [[Interface\Garrison\MobileAppIcons]], 130/1024, 260/1024, 780/1024, 910/1024
  4814. elseif (npcType == 25) then --engineering
  4815. return [[Interface\Garrison\MobileAppIcons]], 0, 130/1024, 520/1024, 650/1024
  4816. elseif (npcType == 26) then --leatherworking
  4817. return [[Interface\Garrison\MobileAppIcons]], 520/1024, 650/1024, 130/1024, 260/1024
  4818. elseif (npcType == 27) then --tailor
  4819. return [[Interface\Garrison\MobileAppIcons]], 780/1024, 910/1024, 260/1024, 390/1024
  4820. elseif (npcType == 28) then --enchanting
  4821. return [[Interface\Garrison\MobileAppIcons]], 0, 130/1024, 390/1024, 520/1024
  4822. elseif (npcType == 29) then --blacksmith
  4823. return [[Interface\Garrison\MobileAppIcons]], 260/1024, 390/1024, 0, 130/1024
  4824. elseif (npcType == 30) then --inscription
  4825. return [[Interface\Garrison\MobileAppIcons]], 260/1024, 390/1024, 130/1024, 260/1024
  4826. elseif (npcType == 31) then --herbalism
  4827. return [[Interface\Garrison\MobileAppIcons]], 130/1024, 260/1024, 130/1024, 260/1024
  4828. elseif (npcType == 32) then --skinning
  4829. return [[Interface\Garrison\MobileAppIcons]], 650/1024, 780/1024, 260/1024, 390/1024
  4830. elseif (npcType == 33) then --alchemy
  4831. return [[Interface\Garrison\MobileAppIcons]], 0, 125/1024, 0, 130/1024
  4832. elseif (npcType == 34) then --jewelcraft
  4833. return [[Interface\Garrison\MobileAppIcons]], 395/1024, 515/1024, 130/1024, 260/1024
  4834. end
  4835. end
  4836.  
  4837. -- ~options
  4838. function Plater.OpenOptionsPanel()
  4839.  
  4840. if (PlaterOptionsPanelFrame) then
  4841. return PlaterOptionsPanelFrame:Show()
  4842. end
  4843.  
  4844. --pega os templates dos os widgets
  4845. local options_text_template = DF:GetTemplate ("font", "OPTIONS_FONT_TEMPLATE")
  4846. local options_dropdown_template = DF:GetTemplate ("dropdown", "OPTIONS_DROPDOWN_TEMPLATE")
  4847. local options_switch_template = DF:GetTemplate ("switch", "OPTIONS_CHECKBOX_TEMPLATE")
  4848. local options_slider_template = DF:GetTemplate ("slider", "OPTIONS_SLIDER_TEMPLATE")
  4849. local options_button_template = DF:GetTemplate ("button", "OPTIONS_BUTTON_TEMPLATE")
  4850.  
  4851. -- local f = CreateFrame ("frame", "PlaterOptionsPanel", UIParent)
  4852. Plater.db.profile.OptionsPanelDB = Plater.db.profile.OptionsPanelDB or {}
  4853.  
  4854. --controi o menu principal
  4855. --local f = DF:Create1PxPanel (UIParent, 900, 600, "Plater Options", "PlaterOptionsPanel", Plater.db.profile.OptionsPanelDB)
  4856. local f = DF:CreateSimplePanel (UIParent, 1100, 610, "Plater Options", "PlaterOptionsPanelFrame", {UseScaleBar = true}, Plater.db.profile.OptionsPanelDB)
  4857. --f:SetPoint ("center", UIParent, "center", 0, 0)
  4858. local profile = Plater.db.profile
  4859.  
  4860. local frame_options = {
  4861. y_offset = 0,
  4862. button_width = 105,
  4863. button_height = 20,
  4864. button_x = 230,
  4865. button_y = -32,
  4866. button_text_size = 10,
  4867. }
  4868.  
  4869. -- mainFrame é um frame vazio para sustentrar todos os demais frames, este frame sempre será mostrado
  4870. local mainFrame = DF:CreateTabContainer (f, "Plater Options", "PlaterOptionsPanelContainer", {
  4871. {name = "FrontPage", title = "Main Menu"},
  4872. {name = "PersonalBar", title = "Personal Bar"},
  4873. {name = "FriendlyPlayer", title = "Friendly Player"},
  4874. {name = "EnemyPlayer", title = "Enemy Player"},
  4875. {name = "FriendlyNpc", title = "Friendly Npc"},
  4876. {name = "EnemyNpc", title = "Enemy Npc"},
  4877. {name = "DebuffConfig", title = "Config Debuffs"},
  4878. {name = "ProfileManagement", title = "Profiles"},
  4879. },
  4880. frame_options)
  4881.  
  4882. local frontPageFrame = mainFrame.AllFrames [1]
  4883. local personalPlayerFrame = mainFrame.AllFrames [2]
  4884. local friendlyPCsFrame = mainFrame.AllFrames [3]
  4885. local friendlyNPCsFrame = mainFrame.AllFrames [5]
  4886. local enemyPCsFrame = mainFrame.AllFrames [4]
  4887. local enemyNPCsFrame = mainFrame.AllFrames [6]
  4888. local auraFilterFrame = mainFrame.AllFrames [7]
  4889. local profilesFrame = mainFrame.AllFrames [8]
  4890.  
  4891. local generalOptionsAnchor = CreateFrame ("frame", "$parentOptionsAnchor", frontPageFrame)
  4892. generalOptionsAnchor:SetSize (1, 1)
  4893. generalOptionsAnchor:SetPoint ("topleft", frontPageFrame, "topleft", 10, -290)
  4894.  
  4895. f.AllMenuFrames = {}
  4896. for _, frame in ipairs (mainFrame.AllFrames) do
  4897. tinsert (f.AllMenuFrames, frame)
  4898. end
  4899. tinsert (f.AllMenuFrames, generalOptionsAnchor)
  4900.  
  4901. --> on profile change
  4902. function f.RefreshOptionsFrame()
  4903. for _, frame in ipairs (f.AllMenuFrames) do
  4904. if (frame.RefreshOptions) then
  4905. frame:RefreshOptions()
  4906. end
  4907. end
  4908. end
  4909.  
  4910. local startX, startY, heightSize = 10, -110, 630
  4911. local mainStartX, mainStartY, mainHeightSize = 10, -280, 800
  4912.  
  4913. --mostra o painel de profiles no menu de interface
  4914. profilesFrame:SetScript ("OnShow", function()
  4915. Plater:OpenInterfaceProfile()
  4916. f:Hide()
  4917. C_Timer.After (.5, function()
  4918. mainFrame:SetIndex (1)
  4919. mainFrame:SelectIndex (_, 1)
  4920. end)
  4921. end)
  4922.  
  4923. --cria o botão de configurar a relevancia para os friendly npcs
  4924. local relevancePanel = CreateFrame ("frame", nil, friendlyNPCsFrame)
  4925. relevancePanel:SetSize (860, 500)
  4926. relevancePanel:SetBackdrop ({bgFile = [[Interface\FrameGeneral\UI-Background-Marble]], tile = true, tileSize = 16, edgeFile = [[Interface\Buttons\WHITE8X8]], edgeSize = 1})
  4927. relevancePanel:SetBackdropColor (0, 0, 0, 0.9)
  4928. relevancePanel:SetBackdropBorderColor (0, 0, 0, 1)
  4929. relevancePanel:SetFrameLevel (friendlyNPCsFrame:GetFrameLevel()+5)
  4930. relevancePanel:EnableMouse (true)
  4931.  
  4932. do
  4933. local options = {
  4934. [1] = "important npc",
  4935. [2] = "repair",
  4936. [3] = "merchant",
  4937. [4] = "innkeeper",
  4938. [5] = "banker",
  4939. [6] = "autioneer",
  4940. [7] = "flyght master",
  4941. [8] = "stable master",
  4942. [9] = "pet master",
  4943. [10] = "barber",
  4944. [11] = "transmogrifier",
  4945. [12] = "food and drink",
  4946. [20] = "fishing trainer",
  4947. [21] = "first aid trainer",
  4948. [22] = "archaeology trainer",
  4949. [23] = "cooking trainer",
  4950. [24] = "mining trainer",
  4951. [25] = "engineering trainer",
  4952. [26] = "leatherworking trainer",
  4953. [27] = "tailor trainer",
  4954. [28] = "enchanting trainer",
  4955. [29] = "blacksmith trainer",
  4956. [30] = "inscription trainer",
  4957. [31] = "herbalism trainer",
  4958. [32] = "skinning trainer",
  4959. [33] = "alchemy trainer",
  4960. [34] = "jewelcrafting trainer",
  4961. }
  4962.  
  4963. local reorder = {}
  4964. for id, textType in pairs (options) do
  4965. tinsert (reorder, {id, textType})
  4966. end
  4967. sort (reorder, function (a, b) return a[2] < b[2] end)
  4968.  
  4969. local change_relevance = function (_, id, state)
  4970. DB_PLATE_CONFIG [ACTORTYPE_FRIENDLY_NPC].filter [id] = state
  4971. Plater.UpdateAllPlates()
  4972. end
  4973.  
  4974. local x, y = 10, -10
  4975. for i, t in ipairs (reorder) do
  4976. local id, textType = unpack (t)
  4977.  
  4978. local checkbox, label = DF:CreateSwitch (relevancePanel, change_relevance, DB_PLATE_CONFIG [ACTORTYPE_FRIENDLY_NPC].filter [id], _, _, _, _, "relevantCheckbox" .. id, _, _, _, _, "", DF:GetTemplate ("switch", "OPTIONS_CHECKBOX_BRIGHT_TEMPLATE"), options_text_template)
  4979. checkbox:SetAsCheckBox()
  4980. checkbox:SetPoint ("topleft", relevancePanel, "topleft", x, y)
  4981. checkbox:SetFixedParameter (id)
  4982. local stringRelevant = DF:CreateLabel (checkbox, textType, 10, "orange", nil, "relevantString" .. id, nil, "overlay")
  4983. stringRelevant:SetPoint ("left", checkbox, "right", 2, 0)
  4984.  
  4985. y = y - 20
  4986.  
  4987. if (y < -480) then
  4988. y = -10
  4989. x = x + 180
  4990. end
  4991. end
  4992.  
  4993. end
  4994.  
  4995. relevancePanel:Hide()
  4996.  
  4997. local open_friendlynpc_relevance_panel = function()
  4998. relevancePanel:SetShown (not relevancePanel:IsShown())
  4999. end
  5000. local relevanceButton = DF:CreateButton (friendlyNPCsFrame, open_friendlynpc_relevance_panel, 200, 20, "Config Relevance", nil, nil, nil, nil, nil, nil, DF:GetTemplate ("button", "OPTIONS_BUTTON_TEMPLATE"))
  5001. relevanceButton:SetPoint ("topleft", friendlyNPCsFrame, "topleft", 237, -30)
  5002.  
  5003. relevancePanel:SetPoint ("topleft", relevanceButton.widget, "bottomleft", 0, -35)
  5004.  
  5005. -------------------------
  5006. -- funções gerais dos dropdowns
  5007. local textures = LibSharedMedia:HashTable ("statusbar")
  5008.  
  5009. --anchor table
  5010. local anchor_names = {"Top Left", "Left", "Bottom Left", "Bottom", "Bottom Right", "Right", "Top Right", "Top", "Center", "Inner Left", "Inner Right", "Inner Top", "Inner Bottom"}
  5011. local build_anchor_side_table = function (actorType, member)
  5012. local t = {}
  5013. for i = 1, 13 do
  5014. tinsert (t, {
  5015. label = anchor_names[i],
  5016. value = i,
  5017. onclick = function (_, _, value)
  5018. if (actorType) then
  5019. Plater.db.profile.plate_config [actorType][member].side = value
  5020. Plater.RefreshDBUpvalues()
  5021.  
  5022. Plater.UpdateAllPlates()
  5023. Plater.UpdateAllNames()
  5024. else
  5025. Plater.db.profile [member].side = value
  5026. Plater.RefreshDBUpvalues()
  5027. Plater.UpdateAllPlates()
  5028. Plater.UpdateAllNames()
  5029. end
  5030. end
  5031. })
  5032. end
  5033. return t
  5034. end
  5035. --
  5036. local health_bar_texture_selected = function (self, capsule, value)
  5037. Plater.db.profile.health_statusbar_texture = value
  5038. Plater.RefreshDBUpvalues()
  5039. Plater.UpdateAllPlates()
  5040. end
  5041. local health_bar_texture_options = {}
  5042. for name, texturePath in pairs (textures) do
  5043. health_bar_texture_options [#health_bar_texture_options + 1] = {value = name, label = name, statusbar = texturePath, onclick = health_bar_texture_selected}
  5044. end
  5045. sort (health_bar_texture_options, function (t1, t2) return t1.label < t2.label end)
  5046. --
  5047. local health_bar_bgtexture_selected = function (self, capsule, value)
  5048. Plater.db.profile.health_statusbar_bgtexture = value
  5049. Plater.RefreshDBUpvalues()
  5050. Plater.UpdateAllPlates()
  5051. end
  5052. local health_bar_bgtexture_options = {}
  5053. for name, texturePath in pairs (textures) do
  5054. health_bar_bgtexture_options [#health_bar_bgtexture_options + 1] = {value = name, label = name, statusbar = texturePath, onclick = health_bar_bgtexture_selected}
  5055. end
  5056. sort (health_bar_bgtexture_options, function (t1, t2) return t1.label < t2.label end)
  5057. --
  5058. local cast_bar_texture_selected = function (self, capsule, value)
  5059. Plater.db.profile.cast_statusbar_texture = value
  5060. Plater.RefreshDBUpvalues()
  5061. Plater.UpdateAllPlates()
  5062. end
  5063. local cast_bar_texture_options = {}
  5064. for name, texturePath in pairs (textures) do
  5065. cast_bar_texture_options [#cast_bar_texture_options + 1] = {value = name, label = name, statusbar = texturePath, onclick = cast_bar_texture_selected}
  5066. end
  5067. sort (cast_bar_texture_options, function (t1, t2) return t1.label < t2.label end)
  5068. --
  5069. local cast_bar_bgtexture_selected = function (self, capsule, value)
  5070. Plater.db.profile.cast_statusbar_bgtexture = value
  5071. Plater.RefreshDBUpvalues()
  5072. Plater.UpdateAllPlates()
  5073. end
  5074. local cast_bar_bgtexture_options = {}
  5075. for name, texturePath in pairs (textures) do
  5076. cast_bar_bgtexture_options [#cast_bar_bgtexture_options + 1] = {value = name, label = name, statusbar = texturePath, onclick = cast_bar_bgtexture_selected}
  5077. end
  5078. sort (cast_bar_bgtexture_options, function (t1, t2) return t1.label < t2.label end)
  5079. --
  5080. local health_selection_overlay_selected = function (self, capsule, value)
  5081. Plater.db.profile.health_selection_overlay = value
  5082. Plater.UpdateAllPlates()
  5083. end
  5084. local health_selection_overlay_options = {}
  5085. for name, texturePath in pairs (textures) do
  5086. health_selection_overlay_options [#health_selection_overlay_options + 1] = {value = name, label = name, statusbar = texturePath, onclick = health_selection_overlay_selected}
  5087. end
  5088. sort (health_selection_overlay_options, function (t1, t2) return t1.label < t2.label end)
  5089. --
  5090.  
  5091.  
  5092. -------------------------------------------------------------------------------
  5093. --opções do painel de interface da blizzard
  5094.  
  5095.  
  5096. function Plater.ChangeNameplateAnchor (_, _, value)
  5097. if (value == 0) then
  5098. SetCVar (CVAR_ANCHOR, CVAR_ANCHOR_HEAD)
  5099. elseif (value == 1) then
  5100. SetCVar (CVAR_ANCHOR, CVAR_ANCHOR_BOTH)
  5101. elseif (value == 2) then
  5102. SetCVar (CVAR_ANCHOR, CVAR_ANCHOR_FEET)
  5103. end
  5104. end
  5105. local nameplate_anchor_options = {
  5106. {label = "Head", value = 0, onclick = Plater.ChangeNameplateAnchor, desc = "All nameplates are placed above the character."},
  5107. {label = "Head/Feet", value = 1, onclick = Plater.ChangeNameplateAnchor, desc = "Friendly and neutral has the nameplate on their head, enemies below the feet."},
  5108. {label = "Feet", value = 2, onclick = Plater.ChangeNameplateAnchor, desc = "All nameplates are placed below the character."},
  5109. }
  5110.  
  5111. local interface_options = {
  5112.  
  5113. --{type = "label", get = function() return "Interface Options:" end, text_template = DF:GetTemplate ("font", "ORANGE_FONT_TEMPLATE")},
  5114.  
  5115. {
  5116. type = "toggle",
  5117. get = function() return GetCVar (CVAR_SHOWPERSONAL) == CVAR_ENABLED end,
  5118. set = function (self, fixedparam, value)
  5119. if (not InCombatLockdown()) then
  5120. SetCVar (CVAR_SHOWPERSONAL, math.abs (tonumber (GetCVar (CVAR_SHOWPERSONAL))-1))
  5121. else
  5122. Plater:Msg ("you are in combat.")
  5123. self:SetValue (GetCVar (CVAR_SHOWPERSONAL) == CVAR_ENABLED)
  5124. end
  5125. end,
  5126. name = "Personal Health and Mana Bars",
  5127. desc = "Shows a mini health and mana bars under your character.",
  5128. nocombat = true,
  5129. },
  5130. {
  5131. type = "toggle",
  5132. get = function() return GetCVar (CVAR_RESOURCEONTARGET) == CVAR_ENABLED end,
  5133. set = function (self, fixedparam, value)
  5134. if (not InCombatLockdown()) then
  5135. SetCVar (CVAR_RESOURCEONTARGET, math.abs (tonumber (GetCVar (CVAR_RESOURCEONTARGET))-1))
  5136. else
  5137. Plater:Msg ("you are in combat.")
  5138. self:SetValue (GetCVar (CVAR_RESOURCEONTARGET) == CVAR_ENABLED)
  5139. end
  5140. end,
  5141. name = "Show Resources on Target",
  5142. desc = "Shows your resource such as combo points above your current target.\n\n'Personal Health and Mana Bars' has to be enabled",
  5143. nocombat = true,
  5144. },
  5145. {
  5146. type = "toggle",
  5147. get = function() return GetCVar (CVAR_SHOWALL) == CVAR_ENABLED end,
  5148. set = function (self, fixedparam, value)
  5149. if (not InCombatLockdown()) then
  5150. SetCVar (CVAR_SHOWALL, math.abs (tonumber (GetCVar (CVAR_SHOWALL))-1))
  5151. else
  5152. Plater:Msg ("you are in combat.")
  5153. self:SetValue (GetCVar (CVAR_SHOWALL) == CVAR_ENABLED)
  5154. end
  5155. end,
  5156. name = "Always Show Nameplates",
  5157. desc = "Show nameplates for all units near you. If disabled on show relevant units when you are in combat.",
  5158. nocombat = true,
  5159. },
  5160. {
  5161. type = "toggle",
  5162. get = function() return GetCVar (CVAR_PLATEMOTION) == CVAR_ENABLED end,
  5163. set = function (self, fixedparam, value)
  5164. if (not InCombatLockdown()) then
  5165. SetCVar (CVAR_PLATEMOTION, math.abs (tonumber (GetCVar (CVAR_PLATEMOTION))-1))
  5166. else
  5167. Plater:Msg ("you are in combat.")
  5168. self:SetValue (GetCVar (CVAR_PLATEMOTION) == CVAR_ENABLED)
  5169. end
  5170. end,
  5171. name = "Stacking Nameplates",
  5172. desc = "Nameplates won't overlap each other.",
  5173. nocombat = true,
  5174. },
  5175.  
  5176. {
  5177. type = "toggle",
  5178. get = function() return GetCVar (CVAR_ENEMY_MINIONS) == CVAR_ENABLED end,
  5179. set = function (self, fixedparam, value)
  5180. if (not InCombatLockdown()) then
  5181. SetCVar (CVAR_ENEMY_MINIONS, math.abs (tonumber (GetCVar (CVAR_ENEMY_MINIONS))-1))
  5182. else
  5183. Plater:Msg ("you are in combat.")
  5184. self:SetValue (GetCVar (CVAR_ENEMY_MINIONS) == CVAR_ENABLED)
  5185. end
  5186. end,
  5187. name = "Enemy Units (" .. (GetBindingKey ("NAMEPLATES") or "") .. "): Minions",
  5188. desc = "Show nameplate for enemy pets, totems and guardians.",
  5189. nocombat = true,
  5190. },
  5191. {
  5192. type = "toggle",
  5193. get = function() return GetCVar (CVAR_ENEMY_MINUS) == CVAR_ENABLED end,
  5194. set = function (self, fixedparam, value)
  5195. if (not InCombatLockdown()) then
  5196. SetCVar (CVAR_ENEMY_MINUS, math.abs (tonumber (GetCVar (CVAR_ENEMY_MINUS))-1))
  5197. else
  5198. Plater:Msg ("you are in combat.")
  5199. self:SetValue (GetCVar (CVAR_ENEMY_MINUS) == CVAR_ENABLED)
  5200. end
  5201. end,
  5202. name = "Enemy Units (V): Minor",
  5203. desc = "Show nameplate for minor enemies.",
  5204. nocombat = true,
  5205. },
  5206. {
  5207. type = "toggle",
  5208. get = function() return GetCVar (CVAR_FRIENDLY_GUARDIAN) == CVAR_ENABLED end,
  5209. set = function (self, fixedparam, value)
  5210. if (not InCombatLockdown()) then
  5211. SetCVar (CVAR_FRIENDLY_GUARDIAN, math.abs (tonumber (GetCVar (CVAR_FRIENDLY_GUARDIAN))-1))
  5212. SetCVar (CVAR_FRIENDLY_PETS, GetCVar (CVAR_FRIENDLY_GUARDIAN))
  5213. SetCVar (CVAR_FRIENDLY_TOTEMS, GetCVar (CVAR_FRIENDLY_GUARDIAN))
  5214. SetCVar (CVAR_FRIENDLY_MINIONS, GetCVar (CVAR_FRIENDLY_GUARDIAN))
  5215. else
  5216. Plater:Msg ("you are in combat.")
  5217. self:SetValue (GetCVar (CVAR_FRIENDLY_GUARDIAN) == CVAR_ENABLED)
  5218. end
  5219. end,
  5220. name = "Friendly Units (" .. (GetBindingKey ("FRIENDNAMEPLATES") or "") .. "): Minions",
  5221. desc = "Show nameplate for friendly pets, totems and guardians.\n\nAlso check the Enabled box below Friendly Npc Config.",
  5222. nocombat = true,
  5223. },
  5224.  
  5225.  
  5226. {
  5227. type = "range",
  5228. get = function() return tonumber (GetCVar (CVAR_CULLINGDISTANCE)) end,
  5229. set = function (self, fixedparam, value)
  5230. if (not InCombatLockdown()) then
  5231. SetCVar (CVAR_CULLINGDISTANCE, value)
  5232. else
  5233. Plater:Msg ("you are in combat.")
  5234. end
  5235. end,
  5236. min = 1,
  5237. max = 100,
  5238. step = 1,
  5239. name = "View Distance",
  5240. desc = "How far you can see nameplates (in yards).\n\n|cFFFFFFFFDefault: 60|r",
  5241. nocombat = true,
  5242. },
  5243. {
  5244. type = "range",
  5245. get = function() return tonumber (GetCVar (CVAR_CEILING)) end,
  5246. set = function (self, fixedparam, value)
  5247. if (not InCombatLockdown()) then
  5248. if (value == 0) then
  5249. SetCVar (CVAR_CEILING, -1)
  5250. else
  5251. SetCVar (CVAR_CEILING, value)
  5252. end
  5253. else
  5254. Plater:Msg ("you are in combat.")
  5255. end
  5256. end,
  5257. min = 0.000,
  5258. max = 0.1,
  5259. step = 0.005,
  5260. thumbscale = 1.7,
  5261. usedecimals = true,
  5262. name = "Top Clamp Size",
  5263. desc = "Top margin, space where nameplates can't pass through and 'get trapped in the screen'.\n\n|cFFFFFFFFDefault: 0.065|r\n\n|cFFFFFF00Important|r: setting to 0 disables this feature.",
  5264. nocombat = true,
  5265. },
  5266. {
  5267. type = "select",
  5268. get = function() return tonumber (GetCVar (CVAR_ANCHOR)) end,
  5269. values = function() return nameplate_anchor_options end,
  5270. name = "Anchor Point",
  5271. desc = "Where the nameplate is anchored to.\n\n|cFFFFFFFFDefault: Head|r",
  5272. nocombat = true,
  5273. },
  5274. {
  5275. type = "range",
  5276. get = function() return tonumber (GetCVar (CVAR_MOVEMENT_SPEED)) end,
  5277. set = function (self, fixedparam, value)
  5278. if (not InCombatLockdown()) then
  5279. SetCVar (CVAR_MOVEMENT_SPEED, value)
  5280. else
  5281. Plater:Msg ("you are in combat.")
  5282. end
  5283. end,
  5284. min = 0.001,
  5285. max = 0.2,
  5286. step = 0.005,
  5287. thumbscale = 1.7,
  5288. usedecimals = true,
  5289. name = "Moviment Speed",
  5290. desc = "How fast the nameplate moves (when stacking is enabled).\n\n|cFFFFFFFFDefault: 0.025|r",
  5291. nocombat = true,
  5292. },
  5293. {
  5294. type = "range",
  5295. get = function() return tonumber (GetCVar ("nameplateOverlapV")) end,
  5296. set = function (self, fixedparam, value)
  5297. if (not InCombatLockdown()) then
  5298. SetCVar ("nameplateOverlapV", value)
  5299. else
  5300. Plater:Msg ("you are in combat.")
  5301. end
  5302. end,
  5303. min = 0.2,
  5304. max = 1.6,
  5305. step = 0.1,
  5306. thumbscale = 1.7,
  5307. usedecimals = true,
  5308. name = "Vertical Padding",
  5309. desc = "Verticaly distance factor between each nameplate (when stacking is enabled).\n\n|cFFFFFFFFDefault: 1.10|r",
  5310. nocombat = true,
  5311. },
  5312. {
  5313. type = "range",
  5314. get = function() return tonumber (GetCVar ("nameplateMinScale")) end,
  5315. set = function (self, fixedparam, value)
  5316. if (not InCombatLockdown()) then
  5317. SetCVar ("nameplateMinScale", value)
  5318. else
  5319. Plater:Msg ("you are in combat.")
  5320. end
  5321. end,
  5322. min = 0.5,
  5323. max = 1,
  5324. step = 0.1,
  5325. thumbscale = 1.7,
  5326. usedecimals = true,
  5327. name = "Distance Scale",
  5328. desc = "Scale applied when the nameplate is far away from the camera.\n\n|cFFFFFF00Important|r: is the distance from the camera and |cFFFF4444not|r the distance from your character.\n\n|cFFFFFFFFDefault: 0.8|r",
  5329. nocombat = true,
  5330. },
  5331. {
  5332. type = "range",
  5333. get = function() return tonumber (GetCVar ("nameplateSelectedScale")) end,
  5334. set = function (self, fixedparam, value)
  5335. if (not InCombatLockdown()) then
  5336. SetCVar ("nameplateSelectedScale", value)
  5337. else
  5338. Plater:Msg ("you are in combat.")
  5339. end
  5340. end,
  5341. min = 0.75,
  5342. max = 1.75,
  5343. step = 0.1,
  5344. thumbscale = 1.7,
  5345. usedecimals = true,
  5346. name = "Selected Scale",
  5347. desc = "The nameplate size for the current target is multiplied by this value.\n\n|cFFFFFFFFDefault: 1|r",
  5348. nocombat = true,
  5349. },
  5350. {
  5351. type = "range",
  5352. get = function() return tonumber (GetCVar ("nameplateGlobalScale")) end,
  5353. set = function (self, fixedparam, value)
  5354. if (not InCombatLockdown()) then
  5355. SetCVar ("nameplateGlobalScale", value)
  5356. else
  5357. Plater:Msg ("you are in combat.")
  5358. end
  5359. end,
  5360. min = 0.75,
  5361. max = 2,
  5362. step = 0.1,
  5363. thumbscale = 1.7,
  5364. usedecimals = true,
  5365. name = "Global Scale",
  5366. desc = "Scale all nameplates.\n\n|cFFFFFFFFDefault: 1|r",
  5367. nocombat = true,
  5368. },
  5369.  
  5370. }
  5371.  
  5372. local interface_title = Plater:CreateLabel (frontPageFrame, "Interface Options (from the client):", Plater:GetTemplate ("font", "ORANGE_FONT_TEMPLATE"))
  5373. interface_title:SetPoint (startX, startY)
  5374.  
  5375. local in_combat_background = Plater:CreateImage (frontPageFrame)
  5376. in_combat_background:SetColorTexture (.6, 0, 0, .1)
  5377. in_combat_background:SetPoint ("topleft", interface_title, "bottomleft", 0, -2)
  5378. in_combat_background:SetPoint ("bottomright", frontPageFrame, "bottomright", -10, 320)
  5379. in_combat_background:Hide()
  5380.  
  5381. local in_combat_label = Plater:CreateLabel (frontPageFrame, "you are in combat", 24, "silver")
  5382. in_combat_label:SetPoint ("right", in_combat_background, "right", -10, 0)
  5383. in_combat_label:Hide()
  5384.  
  5385. frontPageFrame:RegisterEvent ("PLAYER_REGEN_DISABLED")
  5386. frontPageFrame:RegisterEvent ("PLAYER_REGEN_ENABLED")
  5387. frontPageFrame:SetScript ("OnEvent", function (self, event)
  5388. if (event == "PLAYER_REGEN_DISABLED") then
  5389. in_combat_background:Show()
  5390. in_combat_label:Show()
  5391. elseif (event == "PLAYER_REGEN_ENABLED") then
  5392. in_combat_background:Hide()
  5393. in_combat_label:Hide()
  5394. end
  5395. end)
  5396.  
  5397. DF:BuildMenu (frontPageFrame, interface_options, startX, startY-20, 300 + 60, true, options_text_template, options_dropdown_template, options_switch_template, true, options_slider_template, options_button_template)
  5398.  
  5399. -------------------------------------------------------------------------------
  5400. -- painel para configurar debuffs e buffs
  5401.  
  5402. local debuff_options = {
  5403. {type = "label", get = function() return "General Settings:" end, text_template = DF:GetTemplate ("font", "ORANGE_FONT_TEMPLATE")},
  5404.  
  5405. {
  5406. type = "toggle",
  5407. get = function() return Plater.db.profile.aura_enabled end,
  5408. set = function (self, fixedparam, value)
  5409. Plater.db.profile.aura_enabled = value
  5410. Plater.RefreshDBUpvalues()
  5411. Plater.UpdateAllPlates()
  5412.  
  5413. if (not value) then
  5414. for _, plateFrame in ipairs (Plater.GetAllShownPlates()) do
  5415. for _, frame in ipairs (plateFrame.UnitFrame.BuffFrame.buffList) do
  5416. frame:Hide()
  5417. end
  5418. end
  5419. end
  5420. end,
  5421. name = "Enabled",
  5422. desc = "Enabled",
  5423. },
  5424. {
  5425. type = "toggle",
  5426. get = function() return Plater.db.profile.aura_timer end,
  5427. set = function (self, fixedparam, value)
  5428. Plater.db.profile.aura_timer = value
  5429. Plater.RefreshAuras()
  5430. Plater.UpdateAllPlates()
  5431. end,
  5432. name = "Show Timer",
  5433. desc = "Time left on buff or debuff.",
  5434. },
  5435. {
  5436. type = "range",
  5437. get = function() return Plater.db.profile.aura_width end,
  5438. set = function (self, fixedparam, value)
  5439. Plater.db.profile.aura_width = value
  5440. Plater.RefreshAuras()
  5441. Plater.UpdateAllPlates()
  5442. end,
  5443. min = 8,
  5444. max = 40,
  5445. step = 1,
  5446. name = "Width",
  5447. desc = "Debuff's icon width.",
  5448. },
  5449. {
  5450. type = "range",
  5451. get = function() return Plater.db.profile.aura_height end,
  5452. set = function (self, fixedparam, value)
  5453. Plater.db.profile.aura_height = value
  5454. Plater.RefreshAuras()
  5455. Plater.UpdateAllPlates()
  5456. end,
  5457. min = 8,
  5458. max = 40,
  5459. step = 1,
  5460. name = "Height",
  5461. desc = "Debuff's icon height.",
  5462. },
  5463. {
  5464. type = "toggle",
  5465. get = function() return Plater.db.profile.debuff_show_cc end,
  5466. set = function (self, fixedparam, value)
  5467. Plater.db.profile.debuff_show_cc = value
  5468. Plater.UpdateAllPlates()
  5469. end,
  5470. name = "Crowd Control Icon",
  5471. desc = "When the actor has a crowd control spell (such as Polymorph).",
  5472. },
  5473. {type = "blank"},
  5474. {
  5475. type = "range",
  5476. get = function() return Plater.db.profile.aura_alpha end,
  5477. set = function (self, fixedparam, value)
  5478. Plater.db.profile.aura_alpha = value
  5479. Plater.RefreshDBUpvalues()
  5480. end,
  5481. min = 0,
  5482. max = 1,
  5483. step = 0.01,
  5484. usedecimals = true,
  5485. name = "Alpha",
  5486. desc = "Alpha",
  5487. },
  5488. {
  5489. type = "range",
  5490. get = function() return Plater.db.profile.aura_x_offset end,
  5491. set = function (self, fixedparam, value)
  5492. Plater.db.profile.aura_x_offset = value
  5493. Plater.RefreshDBUpvalues()
  5494. Plater.UpdateAllPlates()
  5495. end,
  5496. min = -100,
  5497. max = 100,
  5498. step = 1,
  5499. name = "X Offset",
  5500. desc = "X Offset",
  5501. },
  5502. {
  5503. type = "range",
  5504. get = function() return Plater.db.profile.aura_y_offset end,
  5505. set = function (self, fixedparam, value)
  5506. Plater.db.profile.aura_y_offset = value
  5507. Plater.RefreshDBUpvalues()
  5508. Plater.UpdateAllPlates()
  5509. end,
  5510. min = -100,
  5511. max = 100,
  5512. step = 1,
  5513. name = "Y Offset",
  5514. desc = "Y Offset",
  5515. },
  5516.  
  5517. }
  5518.  
  5519. DF:BuildMenu (auraFilterFrame, debuff_options, startX, startY, 300, true, options_text_template, options_dropdown_template, options_switch_template, true, options_slider_template, options_button_template)
  5520.  
  5521. -- ~aura ~buff ~debuff
  5522.  
  5523. local aura_options = {
  5524. height = 280,
  5525. row_height = 16,
  5526. width = 200,
  5527. }
  5528.  
  5529. local method_change_callback = function()
  5530. Plater.RefreshDBUpvalues()
  5531. end
  5532. local auraConfigPanel = DF:CreateAuraConfigPanel (auraFilterFrame, "$parentAuraConfig", Plater.db.profile, method_change_callback, aura_options)
  5533. auraConfigPanel:SetPoint ("topleft", auraFilterFrame, "topleft", 10, -235)
  5534. auraConfigPanel:SetSize (600, 600)
  5535. auraConfigPanel:Show()
  5536. auraFilterFrame.auraConfigPanel = auraConfigPanel
  5537.  
  5538.  
  5539. -------------------------------------------------------------------------------
  5540. -- opções para a barra do player ~player
  5541.  
  5542. local on_select_player_percent_text_font = function (_, _, value)
  5543. Plater.db.profile.plate_config.player.percent_text_font = value
  5544. Plater.UpdateAllPlates()
  5545. end
  5546.  
  5547. local on_select_player_power_percent_text_font = function (_, _, value)
  5548. Plater.db.profile.plate_config.player.power_percent_text_font = value
  5549. Plater.UpdateAllPlates()
  5550. end
  5551.  
  5552. local id, name, description, iconWindWalker = GetSpecializationInfoByID (269)
  5553. local id, name, description, iconArcane = GetSpecializationInfoByID (62)
  5554. local id, name, description, iconRune = GetSpecializationInfoByID (250)
  5555. local id, name, description, iconHolyPower = GetSpecializationInfoByID (66)
  5556. local id, name, description, iconRogueCB = GetSpecializationInfoByID (261)
  5557. local id, name, description, iconDruidCB = GetSpecializationInfoByID (103)
  5558. local id, name, description, iconSoulShard = GetSpecializationInfoByID (267)
  5559.  
  5560. local locClass = UnitClass ("player")
  5561.  
  5562. local options_personal = {
  5563. --life size
  5564. {type = "label", get = function() return "Health Bar Size:" end, text_template = DF:GetTemplate ("font", "ORANGE_FONT_TEMPLATE")},
  5565. {
  5566. type = "range",
  5567. get = function() return Plater.db.profile.plate_config.player.health[1] end,
  5568. set = function (self, fixedparam, value)
  5569. Plater.db.profile.plate_config.player.health[1] = value
  5570. Plater.db.profile.plate_config.player.health_incombat[1] = value
  5571. Plater.UpdateAllPlates (nil, true)
  5572. Plater.UpdateSelfPlate()
  5573. end,
  5574. min = 50,
  5575. max = 300,
  5576. step = 1,
  5577. name = "Width",
  5578. desc = "Width of the health bar.",
  5579. },
  5580. {
  5581. type = "range",
  5582. get = function() return Plater.db.profile.plate_config.player.health[2] end,
  5583. set = function (self, fixedparam, value)
  5584. Plater.db.profile.plate_config.player.health[2] = value
  5585. Plater.db.profile.plate_config.player.health_incombat[2] = value
  5586. Plater.UpdateAllPlates (nil, true)
  5587. Plater.UpdateSelfPlate()
  5588. end,
  5589. min = 1,
  5590. max = 100,
  5591. step = 1,
  5592. name = "Height",
  5593. desc = "Height of the health bar.",
  5594. },
  5595.  
  5596. --mana size
  5597. {type = "blank"},
  5598. {type = "label", get = function() return "Power Bar Size:" end, text_template = DF:GetTemplate ("font", "ORANGE_FONT_TEMPLATE")},
  5599. {
  5600. type = "range",
  5601. get = function() return Plater.db.profile.plate_config.player.mana[1] end,
  5602. set = function (self, fixedparam, value)
  5603. Plater.db.profile.plate_config.player.mana[1] = value
  5604. Plater.db.profile.plate_config.player.mana_incombat[1] = value
  5605. Plater.UpdateAllPlates()
  5606. Plater.UpdateSelfPlate()
  5607. end,
  5608. min = 50,
  5609. max = 300,
  5610. step = 1,
  5611. name = "Width",
  5612. desc = "Width of the power bar.",
  5613. },
  5614. {
  5615. type = "range",
  5616. get = function() return Plater.db.profile.plate_config.player.mana[2] end,
  5617. set = function (self, fixedparam, value)
  5618. Plater.db.profile.plate_config.player.mana[2] = value
  5619. Plater.db.profile.plate_config.player.mana_incombat[2] = value
  5620. Plater.UpdateAllPlates()
  5621. Plater.UpdateSelfPlate()
  5622. end,
  5623. min = 1,
  5624. max = 100,
  5625. step = 1,
  5626. name = "Height",
  5627. desc = "Height of the power bar.",
  5628. },
  5629. {type = "blank"},
  5630. {type = "label", get = function() return "Personal Bar Location:" end, text_template = DF:GetTemplate ("font", "ORANGE_FONT_TEMPLATE")},
  5631. {
  5632. type = "range",
  5633. get = function() return tonumber (GetCVar ("nameplateSelfBottomInset")*100) end,
  5634. set = function (self, fixedparam, value)
  5635. --Plater.db.profile.plate_config.player.y_position_offset = value
  5636.  
  5637. if (InCombatLockdown()) then
  5638. Plater:Msg ("you are in combat.")
  5639. self:SetValue (tonumber (GetCVar ("nameplateSelfBottomInset")*100))
  5640. return
  5641. end
  5642.  
  5643. SetCVar ("nameplateSelfBottomInset", value / 100)
  5644. SetCVar ("nameplateSelfTopInset", abs (value - 99) / 100)
  5645.  
  5646. if (not Plater.PersonalAdjustLocation) then
  5647. Plater.PersonalAdjustLocation = CreateFrame ("frame", "PlaterPersonalBarLocation", UIParent)
  5648. local frame = Plater.PersonalAdjustLocation
  5649. frame:SetWidth (GetScreenWidth())
  5650. frame:SetHeight (20)
  5651. frame.Texture = frame:CreateTexture (nil, "background")
  5652. frame.Texture:SetTexture ([[Interface\AddOns\Plater\images\bar4_vidro]], true)
  5653. frame.Texture:SetAllPoints()
  5654. frame.Shadow = frame:CreateTexture (nil, "border")
  5655. frame.Shadow:SetTexture ([[Interface\ACHIEVEMENTFRAME\UI-Achievement-RecentHeader]], true)
  5656. frame.Shadow:SetPoint ("center")
  5657. frame.Shadow:SetSize (256, 18)
  5658. frame.Shadow:SetTexCoord (0, 1, 0, 22/32)
  5659. frame.Shadow:SetVertexColor (0, 0, 0, 1)
  5660. frame.Text = frame:CreateFontString (nil, "artwork", "GameFontNormal")
  5661. frame.Text:SetText ("Plater: Personal Bar Position")
  5662. frame.Text:SetPoint ("center")
  5663.  
  5664. frame.HideAnimation = DF:CreateAnimationHub (frame, nil, function() frame:Hide() end)
  5665. DF:CreateAnimation (frame.HideAnimation, "Alpha", 1, 1, 1, 0)
  5666.  
  5667. frame.CancelFunction = function()
  5668. frame.HideAnimation:Play()
  5669. end
  5670. end
  5671.  
  5672. if (Plater.PersonalAdjustLocation.HideAnimation:IsPlaying()) then
  5673. Plater.PersonalAdjustLocation.HideAnimation:Stop()
  5674. Plater.PersonalAdjustLocation:SetAlpha (1)
  5675. end
  5676. Plater.PersonalAdjustLocation:Show()
  5677.  
  5678. local percentValue = GetScreenHeight()/100
  5679. Plater.PersonalAdjustLocation:SetPoint ("bottom", UIParent, "bottom", 0, percentValue * value)
  5680.  
  5681. if (Plater.PersonalAdjustLocation.Timer) then
  5682. Plater.PersonalAdjustLocation.Timer:Cancel()
  5683. end
  5684. Plater.PersonalAdjustLocation.Timer = C_Timer.NewTimer (3, Plater.PersonalAdjustLocation.CancelFunction)
  5685.  
  5686. Plater.UpdateAllPlates()
  5687. Plater.UpdateSelfPlate()
  5688. end,
  5689. min = 2,
  5690. max = 98,
  5691. step = 1,
  5692. nocombat = true,
  5693. name = "Screen Position",
  5694. desc = "Adjust the positioning on the Y axis.",
  5695. },
  5696.  
  5697. {type = "breakline"},
  5698.  
  5699. --percent text
  5700. {type = "label", get = function() return "Health Percent Text:" end, text_template = DF:GetTemplate ("font", "ORANGE_FONT_TEMPLATE")},
  5701. --enabled
  5702. {
  5703. type = "toggle",
  5704. get = function() return Plater.db.profile.plate_config.player.percent_text_enabled end,
  5705. set = function (self, fixedparam, value)
  5706. Plater.db.profile.plate_config.player.percent_text_enabled = value
  5707. Plater.UpdateAllPlates()
  5708. end,
  5709. name = "Enabled",
  5710. desc = "Show the percent text.",
  5711. },
  5712. --percent text size
  5713. {
  5714. type = "range",
  5715. get = function() return Plater.db.profile.plate_config.player.percent_text_size end,
  5716. set = function (self, fixedparam, value)
  5717. Plater.db.profile.plate_config.player.percent_text_size = value
  5718. Plater.UpdateAllPlates()
  5719. end,
  5720. min = 6,
  5721. max = 99,
  5722. step = 1,
  5723. name = "Size",
  5724. desc = "Size of the text.",
  5725. },
  5726. --percent text font
  5727. {
  5728. type = "select",
  5729. get = function() return Plater.db.profile.plate_config.player.percent_text_font end,
  5730. values = function() return DF:BuildDropDownFontList (on_select_player_percent_text_font) end,
  5731. name = "Font",
  5732. desc = "Font of the text.",
  5733. },
  5734. --percent text shadow
  5735. {
  5736. type = "toggle",
  5737. get = function() return Plater.db.profile.plate_config.player.percent_text_shadow end,
  5738. set = function (self, fixedparam, value)
  5739. Plater.db.profile.plate_config.player.percent_text_shadow = value
  5740. Plater.UpdateAllPlates()
  5741. end,
  5742. name = "Shadow",
  5743. desc = "If the text has a black outline.",
  5744. },
  5745. --pecent text color
  5746. {
  5747. type = "color",
  5748. get = function()
  5749. local color = Plater.db.profile.plate_config.player.percent_text_color
  5750. return {color[1], color[2], color[3], color[4]}
  5751. end,
  5752. set = function (self, r, g, b, a)
  5753. local color = Plater.db.profile.plate_config.player.percent_text_color
  5754. color[1], color[2], color[3], color[4] = r, g, b, a
  5755. Plater.UpdateAllPlates()
  5756. end,
  5757. name = "Color",
  5758. desc = "The color of the text.",
  5759. },
  5760. --percent text alpha
  5761. {
  5762. type = "range",
  5763. get = function() return Plater.db.profile.plate_config.player.percent_text_alpha end,
  5764. set = function (self, fixedparam, value)
  5765. Plater.db.profile.plate_config.player.percent_text_alpha = value
  5766. Plater.UpdateAllPlates()
  5767. end,
  5768. min = 0,
  5769. max = 1,
  5770. step = 0.1,
  5771. name = "Alpha",
  5772. desc = "Set the transparency of the text.",
  5773. usedecimals = true,
  5774. },
  5775. --percent anchor
  5776. {
  5777. type = "select",
  5778. get = function() return Plater.db.profile.plate_config.player.percent_text_anchor.side end,
  5779. values = function() return build_anchor_side_table ("player", "percent_text_anchor") end,
  5780. name = "Anchor",
  5781. desc = "Which side of the nameplate this widget is attach to.",
  5782. },
  5783. --percent anchor x offset
  5784. {
  5785. type = "range",
  5786. get = function() return Plater.db.profile.plate_config.player.percent_text_anchor.x end,
  5787. set = function (self, fixedparam, value)
  5788. Plater.db.profile.plate_config.player.percent_text_anchor.x = value
  5789. Plater.UpdateAllPlates()
  5790. end,
  5791. min = -20,
  5792. max = 20,
  5793. step = 1,
  5794. name = "X Offset",
  5795. desc = "Slightly move the text horizontally.",
  5796. },
  5797. --percent anchor x offset
  5798. {
  5799. type = "range",
  5800. get = function() return Plater.db.profile.plate_config.player.percent_text_anchor.y end,
  5801. set = function (self, fixedparam, value)
  5802. Plater.db.profile.plate_config.player.percent_text_anchor.y = value
  5803. Plater.UpdateAllPlates()
  5804. end,
  5805. min = -20,
  5806. max = 20,
  5807. step = 1,
  5808. name = "Y Offset",
  5809. desc = "Slightly move the text vertically.",
  5810. },
  5811.  
  5812. {type = "blank"},
  5813. {type = "label", get = function() return "Power Percent Text:" end, text_template = DF:GetTemplate ("font", "ORANGE_FONT_TEMPLATE")},
  5814. --enabled
  5815. {
  5816. type = "toggle",
  5817. get = function() return Plater.db.profile.plate_config.player.power_percent_text_enabled end,
  5818. set = function (self, fixedparam, value)
  5819. Plater.db.profile.plate_config.player.power_percent_text_enabled = value
  5820. Plater.UpdateAllPlates()
  5821. end,
  5822. name = "Enabled",
  5823. desc = "Show the percent text.",
  5824. },
  5825. --percent text size
  5826. {
  5827. type = "range",
  5828. get = function() return Plater.db.profile.plate_config.player.power_percent_text_size end,
  5829. set = function (self, fixedparam, value)
  5830. Plater.db.profile.plate_config.player.power_percent_text_size = value
  5831. Plater.UpdateAllPlates()
  5832. end,
  5833. min = 6,
  5834. max = 99,
  5835. step = 1,
  5836. name = "Size",
  5837. desc = "Size of the text.",
  5838. },
  5839. --percent text font
  5840. {
  5841. type = "select",
  5842. get = function() return Plater.db.profile.plate_config.player.power_percent_text_font end,
  5843. values = function() return DF:BuildDropDownFontList (on_select_player_power_percent_text_font) end,
  5844. name = "Font",
  5845. desc = "Font of the text.",
  5846. },
  5847. --percent text shadow
  5848. {
  5849. type = "toggle",
  5850. get = function() return Plater.db.profile.plate_config.player.power_percent_text_shadow end,
  5851. set = function (self, fixedparam, value)
  5852. Plater.db.profile.plate_config.player.power_percent_text_shadow = value
  5853. Plater.UpdateAllPlates()
  5854. end,
  5855. name = "Shadow",
  5856. desc = "If the text has a black outline.",
  5857. },
  5858. --pecent text color
  5859. {
  5860. type = "color",
  5861. get = function()
  5862. local color = Plater.db.profile.plate_config.player.power_percent_text_color
  5863. return {color[1], color[2], color[3], color[4]}
  5864. end,
  5865. set = function (self, r, g, b, a)
  5866. local color = Plater.db.profile.plate_config.player.power_percent_text_color
  5867. color[1], color[2], color[3], color[4] = r, g, b, a
  5868. Plater.UpdateAllPlates()
  5869. end,
  5870. name = "Color",
  5871. desc = "The color of the text.",
  5872. },
  5873. --percent text alpha
  5874. {
  5875. type = "range",
  5876. get = function() return Plater.db.profile.plate_config.player.power_percent_text_alpha end,
  5877. set = function (self, fixedparam, value)
  5878. Plater.db.profile.plate_config.player.power_percent_text_alpha = value
  5879. Plater.UpdateAllPlates()
  5880. end,
  5881. min = 0,
  5882. max = 1,
  5883. step = 0.1,
  5884. name = "Alpha",
  5885. desc = "Set the transparency of the text.",
  5886. usedecimals = true,
  5887. },
  5888. --percent anchor
  5889. {
  5890. type = "select",
  5891. get = function() return Plater.db.profile.plate_config.player.power_percent_text_anchor.side end,
  5892. values = function() return build_anchor_side_table ("player", "power_percent_text_anchor") end,
  5893. name = "Anchor",
  5894. desc = "Which side of the nameplate this widget is attach to.",
  5895. },
  5896. --percent anchor x offset
  5897. {
  5898. type = "range",
  5899. get = function() return Plater.db.profile.plate_config.player.power_percent_text_anchor.x end,
  5900. set = function (self, fixedparam, value)
  5901. Plater.db.profile.plate_config.player.power_percent_text_anchor.x = value
  5902. Plater.UpdateAllPlates()
  5903. end,
  5904. min = -20,
  5905. max = 20,
  5906. step = 1,
  5907. name = "X Offset",
  5908. desc = "Slightly move the text horizontally.",
  5909. },
  5910. --percent anchor x offset
  5911. {
  5912. type = "range",
  5913. get = function() return Plater.db.profile.plate_config.player.power_percent_text_anchor.y end,
  5914. set = function (self, fixedparam, value)
  5915. Plater.db.profile.plate_config.player.power_percent_text_anchor.y = value
  5916. Plater.UpdateAllPlates()
  5917. end,
  5918. min = -20,
  5919. max = 20,
  5920. step = 1,
  5921. name = "Y Offset",
  5922. desc = "Slightly move the text vertically.",
  5923. },
  5924.  
  5925. {type = "breakline"},
  5926.  
  5927. --class resources
  5928. {type = "label", get = function() return "Resources:" end, text_template = DF:GetTemplate ("font", "ORANGE_FONT_TEMPLATE")},
  5929. --monk WW chi bar
  5930. {
  5931. type = "range",
  5932. get = function() return Plater.db.profile.resources.MONK.chi_scale end,
  5933. set = function (self, fixedparam, value)
  5934. Plater.db.profile.resources.MONK.chi_scale = value
  5935. Plater.UpdateAllPlates()
  5936. end,
  5937. min = 0.65,
  5938. max = 3,
  5939. step = 0.01,
  5940. usedecimals = true,
  5941. name = "|T"..iconWindWalker..":0|t Chi Scale",
  5942. desc = "Adjust the scale of this resource.",
  5943. },
  5944. --mage arcane charge
  5945. {
  5946. type = "range",
  5947. get = function() return Plater.db.profile.resources.MAGE.arcane_charge_scale end,
  5948. set = function (self, fixedparam, value)
  5949. Plater.db.profile.resources.MAGE.arcane_charge_scale = value
  5950. Plater.UpdateAllPlates()
  5951. end,
  5952. min = 0.65,
  5953. max = 3,
  5954. step = 0.01,
  5955. usedecimals = true,
  5956. name = "|T" .. iconArcane .. ":0|t Arcane Charge Scale",
  5957. desc = "Adjust the scale of this resource.",
  5958. },
  5959. --dk rune
  5960. {
  5961. type = "range",
  5962. get = function() return Plater.db.profile.resources.DEATHKNIGHT.rune_scale end,
  5963. set = function (self, fixedparam, value)
  5964. Plater.db.profile.resources.DEATHKNIGHT.rune_scale = value
  5965. Plater.UpdateAllPlates()
  5966. end,
  5967. min = 0.65,
  5968. max = 3,
  5969. step = 0.01,
  5970. usedecimals = true,
  5971. name = "|T" .. iconRune .. ":0|t Rune Scale",
  5972. desc = "Adjust the scale of this resource.",
  5973. },
  5974. --paladin holy power
  5975. {
  5976. type = "range",
  5977. get = function() return Plater.db.profile.resources.PALADIN.holypower_scale end,
  5978. set = function (self, fixedparam, value)
  5979. Plater.db.profile.resources.PALADIN.holypower_scale = value
  5980. Plater.UpdateAllPlates()
  5981. end,
  5982. min = 0.65,
  5983. max = 3,
  5984. step = 0.01,
  5985. usedecimals = true,
  5986. name = "|T" .. iconHolyPower .. ":0|t Holy Power Scale",
  5987. desc = "Adjust the scale of this resource.",
  5988. },
  5989. --rogue combo point
  5990. {
  5991. type = "range",
  5992. get = function() return Plater.db.profile.resources.ROGUE.combopoint_scale end,
  5993. set = function (self, fixedparam, value)
  5994. Plater.db.profile.resources.ROGUE.combopoint_scale = value
  5995. Plater.UpdateAllPlates()
  5996. end,
  5997. min = 0.65,
  5998. max = 3,
  5999. step = 0.01,
  6000. usedecimals = true,
  6001. name = "|T" .. iconRogueCB .. ":0|t Combo Point Scale",
  6002. desc = "Adjust the scale of this resource.",
  6003. },
  6004. --druid feral combo point
  6005. {
  6006. type = "range",
  6007. get = function() return Plater.db.profile.resources.DRUID.combopoint_scale end,
  6008. set = function (self, fixedparam, value)
  6009. Plater.db.profile.resources.DRUID.combopoint_scale = value
  6010. Plater.UpdateAllPlates()
  6011. end,
  6012. min = 0.65,
  6013. max = 3,
  6014. step = 0.01,
  6015. usedecimals = true,
  6016. name = "|T" .. iconDruidCB .. ":0|t Combo Point Scale",
  6017. desc = "Adjust the scale of this resource.",
  6018. },
  6019. --warlock shard
  6020. {
  6021. type = "range",
  6022. get = function() return Plater.db.profile.resources.WARLOCK.soulshard_scale end,
  6023. set = function (self, fixedparam, value)
  6024. Plater.db.profile.resources.WARLOCK.soulshard_scale = value
  6025. Plater.UpdateAllPlates()
  6026. end,
  6027. min = 0.65,
  6028. max = 3,
  6029. step = 0.01,
  6030. usedecimals = true,
  6031. name = "|T" .. iconSoulShard .. ":0|t Soul Shard Scale",
  6032. desc = "Adjust the scale of this resource.",
  6033. },
  6034.  
  6035. }
  6036.  
  6037. DF:BuildMenu (personalPlayerFrame, options_personal, startX, startY, heightSize, true, options_text_template, options_dropdown_template, options_switch_template, true, options_slider_template, options_button_template)
  6038.  
  6039.  
  6040. -------------------------------------------------------------------------------
  6041. --coloca as opções gerais no main menu logo abaixo dos 4 botões
  6042. --OPÇÕES NO PAINEL PRINCIPAL
  6043.  
  6044. function Plater.ChangeNpcRelavance (_, _, value)
  6045. if (value == 1) then
  6046. Plater.db.profile.plate_config [ACTORTYPE_FRIENDLY_NPC].only_relevant = true
  6047. Plater.db.profile.plate_config [ACTORTYPE_FRIENDLY_NPC].relevant_and_proffesions = false
  6048. Plater.db.profile.plate_config [ACTORTYPE_FRIENDLY_NPC].only_names = false
  6049. Plater.db.profile.plate_config [ACTORTYPE_FRIENDLY_NPC].all_names = false
  6050. elseif (value == 2) then
  6051. Plater.db.profile.plate_config [ACTORTYPE_FRIENDLY_NPC].only_relevant = true
  6052. Plater.db.profile.plate_config [ACTORTYPE_FRIENDLY_NPC].relevant_and_proffesions = true
  6053. Plater.db.profile.plate_config [ACTORTYPE_FRIENDLY_NPC].only_names = false
  6054. Plater.db.profile.plate_config [ACTORTYPE_FRIENDLY_NPC].all_names = false
  6055. elseif (value == 3) then
  6056. Plater.db.profile.plate_config [ACTORTYPE_FRIENDLY_NPC].only_relevant = false
  6057. Plater.db.profile.plate_config [ACTORTYPE_FRIENDLY_NPC].relevant_and_proffesions = false
  6058. Plater.db.profile.plate_config [ACTORTYPE_FRIENDLY_NPC].only_names = true
  6059. Plater.db.profile.plate_config [ACTORTYPE_FRIENDLY_NPC].all_names = false
  6060. elseif (value == 4) then
  6061. Plater.db.profile.plate_config [ACTORTYPE_FRIENDLY_NPC].only_relevant = false
  6062. Plater.db.profile.plate_config [ACTORTYPE_FRIENDLY_NPC].relevant_and_proffesions = false
  6063. Plater.db.profile.plate_config [ACTORTYPE_FRIENDLY_NPC].only_names = false
  6064. Plater.db.profile.plate_config [ACTORTYPE_FRIENDLY_NPC].all_names = true
  6065. end
  6066.  
  6067. Plater.db.profile.plate_config [ACTORTYPE_FRIENDLY_NPC].relevance_state = value
  6068.  
  6069. Plater.UpdateAllPlates()
  6070. end
  6071. local relevance_options = {
  6072. {label = "Only Relevant", value = 1, onclick = Plater.ChangeNpcRelavance},
  6073. {label = "Relevant + Professions", value = 2, onclick = Plater.ChangeNpcRelavance},
  6074. {label = "All Professions", value = 3, onclick = Plater.ChangeNpcRelavance},
  6075. {label = "All Npcs", value = 4, onclick = Plater.ChangeNpcRelavance},
  6076. }
  6077.  
  6078. local on_select_target_indicator = function (_, _, indicator)
  6079. Plater.db.profile.target_indicator = indicator
  6080. Plater.OnPlayerTargetChanged()
  6081. end
  6082. local indicator_table = {}
  6083. for name, indicatoirTable in pairs (TargetIndicators) do
  6084. tinsert (indicator_table, {label = name, value = name, onclick = on_select_target_indicator, icon = indicatoirTable.path, texcoord = indicatoirTable.coords[1]})
  6085. end
  6086. local build_target_indicator_table = function()
  6087. return indicator_table
  6088. end
  6089.  
  6090. --menu 1 ~general ~geral
  6091. local options_table1 = {
  6092.  
  6093. {type = "label", get = function() return "General Appearance:" end, text_template = DF:GetTemplate ("font", "ORANGE_FONT_TEMPLATE")},
  6094. {
  6095. type = "select",
  6096. get = function() return Plater.db.profile.health_statusbar_texture end,
  6097. values = function() return health_bar_texture_options end,
  6098. name = "Health Bar Texture",
  6099. desc = "Texture used on the health bar",
  6100. },
  6101. {
  6102. type = "select",
  6103. get = function() return Plater.db.profile.health_statusbar_bgtexture end,
  6104. values = function() return health_bar_bgtexture_options end,
  6105. name = "Health Bar Background Texture",
  6106. desc = "Texture used on the health bar background",
  6107. },
  6108. {
  6109. type = "color",
  6110. get = function()
  6111. local color = Plater.db.profile.health_statusbar_bgcolor
  6112. return {color[1], color[2], color[3], color[4]}
  6113. end,
  6114. set = function (self, r, g, b, a)
  6115. local color = Plater.db.profile.health_statusbar_bgcolor
  6116. color[1], color[2], color[3], color[4] = r, g, b, a
  6117. Plater.UpdateAllPlates()
  6118. end,
  6119. name = "Health Bar Background Color",
  6120. desc = "Color used to paint the health bar background.",
  6121. },
  6122. {
  6123. type = "select",
  6124. get = function() return Plater.db.profile.health_selection_overlay end,
  6125. values = function() return health_selection_overlay_options end,
  6126. name = "Target Overlay Texture",
  6127. desc = "Used above the health bar when it is the current target.",
  6128. },
  6129. {
  6130. type = "select",
  6131. get = function() return Plater.db.profile.cast_statusbar_texture end,
  6132. values = function() return cast_bar_texture_options end,
  6133. name = "Cast Bar Texture",
  6134. desc = "Texture used on the cast bar",
  6135. },
  6136. {
  6137. type = "select",
  6138. get = function() return Plater.db.profile.cast_statusbar_bgtexture end,
  6139. values = function() return cast_bar_bgtexture_options end,
  6140. name = "Cast Bar Background Texture",
  6141. desc = "Texture used on the cast bar background.",
  6142. },
  6143.  
  6144. {
  6145. type = "color",
  6146. get = function()
  6147. local color = Plater.db.profile.cast_statusbar_color
  6148. return {color[1], color[2], color[3], color[4]}
  6149. end,
  6150. set = function (self, r, g, b, a)
  6151. local color = Plater.db.profile.cast_statusbar_color
  6152. color[1], color[2], color[3], color[4] = r, g, b, a
  6153. end,
  6154. name = "Cast Bar Color",
  6155. desc = "Cast Bar Color",
  6156. },
  6157. {
  6158. type = "color",
  6159. get = function()
  6160. local color = Plater.db.profile.cast_statusbar_color_nointerrupt
  6161. return {color[1], color[2], color[3], color[4]}
  6162. end,
  6163. set = function (self, r, g, b, a)
  6164. local color = Plater.db.profile.cast_statusbar_color_nointerrupt
  6165. color[1], color[2], color[3], color[4] = r, g, b, a
  6166. end,
  6167. name = "Cast Bar Color No Interrupt",
  6168. desc = "Cast Bar Color No Interrupt",
  6169. },
  6170.  
  6171. {
  6172. type = "color",
  6173. get = function()
  6174. local color = Plater.db.profile.cast_statusbar_bgcolor
  6175. return {color[1], color[2], color[3], color[4]}
  6176. end,
  6177. set = function (self, r, g, b, a)
  6178. local color = Plater.db.profile.cast_statusbar_bgcolor
  6179. color[1], color[2], color[3], color[4] = r, g, b, a
  6180. Plater.UpdateAllPlates()
  6181. end,
  6182. name = "Cast Bar Background Color",
  6183. desc = "Color used to paint the cast bar background.",
  6184. },
  6185. --[[
  6186. {
  6187. type = "toggle",
  6188. get = function() return Plater.db.profile.hover_highlight end,
  6189. set = function (self, fixedparam, value)
  6190. Plater.db.profile.hover_highlight = value
  6191. Plater.UpdateAllPlates()
  6192. end,
  6193. name = "Highlight",
  6194. desc = "Highlight effect when hovering over a nameplate.",
  6195. },
  6196. {
  6197. type = "range",
  6198. get = function() return Plater.db.profile.hover_highlight_alpha end,
  6199. set = function (self, fixedparam, value)
  6200. Plater.db.profile.hover_highlight_alpha = value
  6201. end,
  6202. min = 0,
  6203. max = 1,
  6204. step = 0.1,
  6205. name = "Highlight Alpha",
  6206. desc = "Highlight Alpha.",
  6207. usedecimals = true,
  6208. },
  6209. --]]
  6210.  
  6211. --{type = "blank"},
  6212. --{type = "label", get = function() return "Border Settings:" end, text_template = DF:GetTemplate ("font", "ORANGE_FONT_TEMPLATE")},
  6213. {
  6214. type = "color",
  6215. get = function()
  6216. local color = Plater.db.profile.border_color
  6217. return {color[1], color[2], color[3], color[4]}
  6218. end,
  6219. set = function (self, r, g, b, a)
  6220. local color = Plater.db.profile.border_color
  6221. color[1], color[2], color[3], color[4] = r, g, b, a
  6222. Plater.UpdatePlateBorders()
  6223. end,
  6224. name = "Border Color",
  6225. desc = "Color of the plate border.",
  6226. },
  6227. {
  6228. type = "range",
  6229. get = function() return Plater.db.profile.border_thickness end,
  6230. set = function (self, fixedparam, value)
  6231. Plater.db.profile.border_thickness = value
  6232. Plater.UpdatePlateBorderThickness()
  6233. Plater.RefreshDBUpvalues()
  6234. end,
  6235. min = 1,
  6236. max = 3,
  6237. step = 1,
  6238. name = "Border Thickness",
  6239. desc = "How thick the border should be.",
  6240. },
  6241.  
  6242. {type = "blank"},
  6243. --{type = "label", get = function() return "Cast Bars:" end, text_template = DF:GetTemplate ("font", "ORANGE_FONT_TEMPLATE")},
  6244. {
  6245. type = "toggle",
  6246. get = function() return Plater.db.profile.hide_enemy_castbars end,
  6247. set = function (self, fixedparam, value)
  6248. Plater.db.profile.hide_enemy_castbars = value
  6249. Plater.UpdateUseCastBar()
  6250. end,
  6251. name = "Hide Enemy Cast Bar",
  6252. desc = "Hide Enemy Cast Bar",
  6253. },
  6254. {
  6255. type = "toggle",
  6256. get = function() return Plater.db.profile.hide_friendly_castbars end,
  6257. set = function (self, fixedparam, value)
  6258. Plater.db.profile.hide_friendly_castbars = value
  6259. Plater.UpdateUseCastBar()
  6260. end,
  6261. name = "Hide Friendly Cast Bar",
  6262. desc = "Hide Friendly Cast Bar",
  6263. },
  6264.  
  6265. {type = "breakline"},
  6266.  
  6267. {type = "label", get = function() return "Plate Color by Aggro:" end, text_template = DF:GetTemplate ("font", "ORANGE_FONT_TEMPLATE")},
  6268. {
  6269. type = "color",
  6270. get = function()
  6271. local color = Plater.db.profile.tank.colors.aggro
  6272. return {color[1], color[2], color[3], color[4]}
  6273. end,
  6274. set = function (self, r, g, b, a)
  6275. local color = Plater.db.profile.tank.colors.aggro
  6276. color[1], color[2], color[3], color[4] = r, g, b, a
  6277. end,
  6278. name = "[tank] Aggro",
  6279. desc = "When you are a Tank and have aggro.",
  6280. },
  6281. {
  6282. type = "color",
  6283. get = function()
  6284. local color = Plater.db.profile.tank.colors.noaggro
  6285. return {color[1], color[2], color[3], color[4]}
  6286. end,
  6287. set = function (self, r, g, b, a)
  6288. local color = Plater.db.profile.tank.colors.noaggro
  6289. color[1], color[2], color[3], color[4] = r, g, b, a
  6290. end,
  6291. name = "[tank] No Aggro",
  6292. desc = "When you are the tank and the mob isn't attacking you.",
  6293. },
  6294. {
  6295. type = "color",
  6296. get = function()
  6297. local color = Plater.db.profile.tank.colors.pulling
  6298. return {color[1], color[2], color[3], color[4]}
  6299. end,
  6300. set = function (self, r, g, b, a)
  6301. local color = Plater.db.profile.tank.colors.pulling
  6302. color[1], color[2], color[3], color[4] = r, g, b, a
  6303. end,
  6304. name = "[tank] High Threat",
  6305. desc = "When you are near to pull the aggro from the other tank or group member.",
  6306. },
  6307. {
  6308. type = "color",
  6309. get = function()
  6310. local color = Plater.db.profile.tank.colors.nocombat
  6311. return {color[1], color[2], color[3], color[4]}
  6312. end,
  6313. set = function (self, r, g, b, a)
  6314. local color = Plater.db.profile.tank.colors.nocombat
  6315. color[1], color[2], color[3], color[4] = r, g, b, a
  6316. end,
  6317. name = "[tank] Not in Combat",
  6318. desc = "When you are in combat and the enemy isn't in combat with you or with a member of your group.",
  6319. },
  6320.  
  6321. {type = "blank"},
  6322. -- {type = "label", get = function() return "Plate Color As a Dps:" end, text_template = DF:GetTemplate ("font", "ORANGE_FONT_TEMPLATE")},
  6323. {
  6324. type = "color",
  6325. get = function()
  6326. local color = Plater.db.profile.dps.colors.aggro
  6327. return {color[1], color[2], color[3], color[4]}
  6328. end,
  6329. set = function (self, r, g, b, a)
  6330. local color = Plater.db.profile.dps.colors.aggro
  6331. color[1], color[2], color[3], color[4] = r, g, b, a
  6332. end,
  6333. name = "[dps] Aggro",
  6334. desc = "The name plate is painted with this color when you are a Dps (or healer) and have aggro.",
  6335. },
  6336. {
  6337. type = "color",
  6338. get = function()
  6339. local color = Plater.db.profile.dps.colors.noaggro
  6340. return {color[1], color[2], color[3], color[4]}
  6341. end,
  6342. set = function (self, r, g, b, a)
  6343. local color = Plater.db.profile.dps.colors.noaggro
  6344. color[1], color[2], color[3], color[4] = r, g, b, a
  6345. end,
  6346. name = "[dps] No Aggro",
  6347. desc = "When you are a dps (or healer) and the mob isn't attacking you.",
  6348. },
  6349. {
  6350. type = "color",
  6351. get = function()
  6352. local color = Plater.db.profile.dps.colors.pulling
  6353. return {color[1], color[2], color[3], color[4]}
  6354. end,
  6355. set = function (self, r, g, b, a)
  6356. local color = Plater.db.profile.dps.colors.pulling
  6357. color[1], color[2], color[3], color[4] = r, g, b, a
  6358. end,
  6359. name = "[dps] High Threat",
  6360. desc = "When you are neat to pull the aggro.",
  6361. },
  6362.  
  6363. {type = "blank"},
  6364. {type = "label", get = function() return "Aggro Modifies:" end, text_template = DF:GetTemplate ("font", "ORANGE_FONT_TEMPLATE")},
  6365.  
  6366. {
  6367. type = "toggle",
  6368. get = function() return Plater.db.profile.aggro_modifies.health_bar_color end,
  6369. set = function (self, fixedparam, value)
  6370. Plater.db.profile.aggro_modifies.health_bar_color = value
  6371. Plater.RefreshDBUpvalues()
  6372. Plater.UpdateAllPlates()
  6373. if (not value) then
  6374. for _, plateFrame in ipairs (Plater.GetAllShownPlates()) do
  6375. CompactUnitFrame_UpdateHealthColor (plateFrame.UnitFrame)
  6376. end
  6377. end
  6378. end,
  6379. name = "Health Bar Color",
  6380. desc = "Health Bar Color",
  6381. },
  6382. {
  6383. type = "toggle",
  6384. get = function() return Plater.db.profile.aggro_modifies.border_color end,
  6385. set = function (self, fixedparam, value)
  6386. Plater.db.profile.aggro_modifies.border_color = value
  6387. Plater.RefreshDBUpvalues()
  6388. Plater.UpdateAllPlates()
  6389. end,
  6390. name = "Border Color",
  6391. desc = "Border Color",
  6392. },
  6393. {
  6394. type = "toggle",
  6395. get = function() return Plater.db.profile.aggro_modifies.actor_name_color end,
  6396. set = function (self, fixedparam, value)
  6397. Plater.db.profile.aggro_modifies.actor_name_color = value
  6398. Plater.RefreshDBUpvalues()
  6399. Plater.UpdateAllPlates()
  6400. end,
  6401. name = "Name Color",
  6402. desc = "Name Color",
  6403. },
  6404.  
  6405. {type = "breakline"},
  6406. {type = "label", get = function() return "Icon Indicators:" end, text_template = DF:GetTemplate ("font", "ORANGE_FONT_TEMPLATE")},
  6407.  
  6408. {
  6409. type = "toggle",
  6410. get = function() return Plater.db.profile.indicator_faction end,
  6411. set = function (self, fixedparam, value)
  6412. Plater.db.profile.indicator_faction = value
  6413. Plater.UpdateAllPlates()
  6414. end,
  6415. name = "Enemy Faction Icon",
  6416. desc = "Show horde or alliance icon.",
  6417. },
  6418. {
  6419. type = "toggle",
  6420. get = function() return Plater.db.profile.indicator_elite end,
  6421. set = function (self, fixedparam, value)
  6422. Plater.db.profile.indicator_elite = value
  6423. Plater.UpdateAllPlates()
  6424. end,
  6425. name = "Elite Icon",
  6426. desc = "Show when the actor is elite.",
  6427. },
  6428. {
  6429. type = "toggle",
  6430. get = function() return Plater.db.profile.indicator_rare end,
  6431. set = function (self, fixedparam, value)
  6432. Plater.db.profile.indicator_rare = value
  6433. Plater.UpdateAllPlates()
  6434. end,
  6435. name = "Rare Icon",
  6436. desc = "Show when the actor is rare.",
  6437. },
  6438. {
  6439. type = "toggle",
  6440. get = function() return Plater.db.profile.indicator_quest end,
  6441. set = function (self, fixedparam, value)
  6442. Plater.db.profile.indicator_quest = value
  6443. Plater.UpdateAllPlates()
  6444. end,
  6445. name = "Quest Icon",
  6446. desc = "Show when the actor is a boss for a quest.",
  6447. },
  6448. {
  6449. type = "toggle",
  6450. get = function() return Plater.db.profile.indicator_enemyclass end,
  6451. set = function (self, fixedparam, value)
  6452. Plater.db.profile.indicator_enemyclass = value
  6453. Plater.UpdateAllPlates()
  6454. end,
  6455. name = "Enemy Class",
  6456. desc = "Enemy player class icon.",
  6457. },
  6458.  
  6459. --indicator icon anchor
  6460. {
  6461. type = "select",
  6462. get = function() return Plater.db.profile.indicator_anchor.side end,
  6463. values = function() return build_anchor_side_table (nil, "indicator_anchor") end,
  6464. name = "Anchor",
  6465. desc = "Which side of the nameplate this widget is attach to.",
  6466. },
  6467. --indicator icon anchor x offset
  6468. {
  6469. type = "range",
  6470. get = function() return Plater.db.profile.indicator_anchor.x end,
  6471. set = function (self, fixedparam, value)
  6472. Plater.db.profile.indicator_anchor.x = value
  6473. Plater.UpdateAllPlates()
  6474. end,
  6475. min = -20,
  6476. max = 20,
  6477. step = 1,
  6478. name = "X Offset",
  6479. desc = "Slightly move horizontally.",
  6480. },
  6481. --indicator icon anchor y offset
  6482. {
  6483. type = "range",
  6484. get = function() return Plater.db.profile.indicator_anchor.y end,
  6485. set = function (self, fixedparam, value)
  6486. Plater.db.profile.indicator_anchor.y = value
  6487. Plater.UpdateAllPlates()
  6488. end,
  6489. min = -20,
  6490. max = 20,
  6491. step = 1,
  6492. name = "Y Offset",
  6493. desc = "Slightly move vertically.",
  6494. },
  6495.  
  6496. {
  6497. type = "toggle",
  6498. get = function() return Plater.db.profile.indicator_extra_raidmark end,
  6499. set = function (self, fixedparam, value)
  6500. Plater.db.profile.indicator_extra_raidmark = value
  6501. Plater.UpdateAllPlates()
  6502. Plater.UpdateRaidMarker()
  6503. end,
  6504. name = "Extra Raid Mark",
  6505. desc = "Places an extra raid mark icon inside the health bar.",
  6506. },
  6507.  
  6508. {type = "blank"},
  6509. {type = "label", get = function() return "Box Selection Space:" end, text_template = DF:GetTemplate ("font", "ORANGE_FONT_TEMPLATE")},
  6510. {
  6511. type = "range",
  6512. get = function() return Plater.db.profile.click_space[1] end,
  6513. set = function (self, fixedparam, value)
  6514. Plater.db.profile.click_space[1] = value
  6515. Plater.UpdatePlateClickSpace (nil, nil, true)
  6516. end,
  6517. min = 50,
  6518. max = 300,
  6519. step = 1,
  6520. name = "Width",
  6521. nocombat = true,
  6522. desc = "How large are area which accepts mouse clicks to select the target",
  6523. },
  6524. {
  6525. type = "range",
  6526. get = function() return Plater.db.profile.click_space[2] end,
  6527. set = function (self, fixedparam, value)
  6528. Plater.db.profile.click_space[2] = value
  6529. Plater.UpdatePlateClickSpace (nil, nil, true)
  6530. end,
  6531. min = 1,
  6532. max = 100,
  6533. step = 1,
  6534. name = "Height",
  6535. nocombat = true,
  6536. desc = "The height of the are area which accepts mouse clicks to select the target",
  6537. },
  6538. {
  6539. type = "toggle",
  6540. get = function() return Plater.db.profile.click_space_always_show end,
  6541. set = function (self, fixedparam, value)
  6542. Plater.db.profile.click_space_always_show = value
  6543. Plater.UpdatePlateClickSpace (nil, nil, true)
  6544. end,
  6545. nocombat = true,
  6546. name = "Always Show Background",
  6547. desc = "Enable a background showing the area of the clicable area.",
  6548. },
  6549.  
  6550. {type = "breakline"},
  6551. {type = "label", get = function() return "Target:" end, text_template = DF:GetTemplate ("font", "ORANGE_FONT_TEMPLATE")},
  6552. --target alpha
  6553. {
  6554. type = "toggle",
  6555. get = function() return Plater.db.profile.target_shady_enabled end,
  6556. set = function (self, fixedparam, value)
  6557. Plater.db.profile.target_shady_enabled = value
  6558. Plater.RefreshDBUpvalues()
  6559. Plater.OnPlayerTargetChanged()
  6560. --update
  6561. end,
  6562. name = "Use Target Shading",
  6563. desc = "Apply a layer of shadow above the nameplate when the unit is in range but isn't your current target.",
  6564. },
  6565. {
  6566. type = "toggle",
  6567. get = function() return Plater.db.profile.target_shady_combat_only end,
  6568. set = function (self, fixedparam, value)
  6569. Plater.db.profile.target_shady_combat_only = value
  6570. Plater.RefreshDBUpvalues()
  6571. Plater.OnPlayerTargetChanged()
  6572. --update
  6573. end,
  6574. name = "Target Shading Only in Combat",
  6575. desc = "Apply target shading only when in combat.",
  6576. },
  6577. {
  6578. type = "range",
  6579. get = function() return Plater.db.profile.target_shady_alpha end,
  6580. set = function (self, fixedparam, value)
  6581. Plater.db.profile.target_shady_alpha = value
  6582. Plater.RefreshDBUpvalues()
  6583. Plater.OnPlayerTargetChanged()
  6584. --update
  6585. end,
  6586. min = 0,
  6587. max = 1,
  6588. step = 0.1,
  6589. name = "Target Shading Amount",
  6590. desc = "Amount of shade to apply.",
  6591. usedecimals = true,
  6592. },
  6593. {
  6594. type = "toggle",
  6595. get = function() return Plater.db.profile.target_highlight end,
  6596. set = function (self, fixedparam, value)
  6597. Plater.db.profile.target_highlight = value
  6598. Plater.UpdateAllPlates()
  6599. end,
  6600. name = "Target Highlight",
  6601. desc = "Highlight effect on the nameplate of your current target.",
  6602. },
  6603. {
  6604. type = "range",
  6605. get = function() return Plater.db.profile.target_highlight_alpha end,
  6606. set = function (self, fixedparam, value)
  6607. Plater.db.profile.target_highlight_alpha = value
  6608. Plater.OnPlayerTargetChanged()
  6609. end,
  6610. min = 0,
  6611. max = 1,
  6612. step = 0.1,
  6613. name = "Target Highlight Alpha",
  6614. desc = "Target Highlight Alpha.",
  6615. usedecimals = true,
  6616. },
  6617.  
  6618. {
  6619. type = "select",
  6620. get = function() return Plater.db.profile.target_indicator end,
  6621. values = function() return build_target_indicator_table() end,
  6622. name = "Target Indicator",
  6623. desc = "Target Indicator",
  6624. },
  6625.  
  6626. {type = "blank"},
  6627. {type = "label", get = function() return "Alpha Control:" end, text_template = DF:GetTemplate ("font", "ORANGE_FONT_TEMPLATE")},
  6628.  
  6629. --alpha and range check
  6630. {
  6631. type = "toggle",
  6632. get = function() return Plater.db.profile.not_affecting_combat_enabled end,
  6633. set = function (self, fixedparam, value)
  6634. Plater.db.profile.not_affecting_combat_enabled = value
  6635. end,
  6636. name = "Use No Combat Alpha",
  6637. desc = "Changes the nameplate alpha when you are in combat and the unit isn't.\n\n|cFFFFFF00Important|r: If the unit isn't in combat, it overrides the alpha from the range check.",
  6638. },
  6639. {
  6640. type = "range",
  6641. get = function() return Plater.db.profile.not_affecting_combat_alpha end,
  6642. set = function (self, fixedparam, value)
  6643. Plater.db.profile.not_affecting_combat_alpha = value
  6644. end,
  6645. min = 0,
  6646. max = 1,
  6647. step = 0.1,
  6648. name = "No Combat Alpha",
  6649. desc = "Amount of transparency to apply for 'No Combat' feature.",
  6650. usedecimals = true,
  6651. },
  6652. {
  6653. type = "range",
  6654. get = function() return Plater.db.profile.range_check_alpha end,
  6655. set = function (self, fixedparam, value)
  6656. Plater.db.profile.range_check_alpha = value
  6657. end,
  6658. min = 0,
  6659. max = 1,
  6660. step = 0.1,
  6661. name = "Range Check Alpha",
  6662. desc = "Amount of transparency to apply when the unit is out of range.",
  6663. usedecimals = true,
  6664. },
  6665. }
  6666.  
  6667. --tinsert (options_table1, {type = "blank"})
  6668. --tinsert (options_table1, {type = "label", get = function() return "Spells for Range Check" end, text_template = DF:GetTemplate ("font", "ORANGE_FONT_TEMPLATE")})
  6669.  
  6670. local spells = {}
  6671. local offset
  6672. for i = 2, GetNumSpellTabs() do
  6673. local name, texture, offset, numEntries, isGuild, offspecID = GetSpellTabInfo (i)
  6674. local tabEnd = offset + numEntries
  6675. offset = offset + 1
  6676. for j = offset, tabEnd - 1 do
  6677. local spellType, spellID = GetSpellBookItemInfo (j, "player")
  6678. if (spellType == "SPELL") then
  6679. tinsert (spells, spellID)
  6680. end
  6681. end
  6682. end
  6683.  
  6684. local playerSpecs = Plater.SpecList [select (2, UnitClass ("player"))]
  6685. local i = 1
  6686. for specID, _ in pairs (playerSpecs) do
  6687. local spec_id, spec_name, spec_description, spec_icon, spec_background, spec_role, spec_class = GetSpecializationInfoByID (specID)
  6688. tinsert (options_table1, {
  6689. type = "select",
  6690. get = function() return PlaterDBChr.spellRangeCheck [specID] end,
  6691. values = function()
  6692. local onSelectFunc = function (_, _, spellName)
  6693. PlaterDBChr.spellRangeCheck [specID] = spellName
  6694. Plater.GetSpellForRangeCheck()
  6695. end
  6696. local t = {}
  6697. for _, spellID in ipairs (spells) do
  6698. local spellName, _, spellIcon = GetSpellInfo (spellID)
  6699. tinsert (t, {label = spellName, icon = spellIcon, onclick = onSelectFunc, value = spellName})
  6700. end
  6701. return t
  6702. end,
  6703. name = "Range Check |T" .. spec_icon .. ":16:16|t " .. spec_name,
  6704. desc = "Spell to range check on this specializartion.",
  6705. })
  6706. i = i + 1
  6707. end
  6708.  
  6709. DF:BuildMenu (generalOptionsAnchor, options_table1, 0, 0, mainHeightSize + 20, true, options_text_template, options_dropdown_template, options_switch_template, true, options_slider_template, options_button_template)
  6710.  
  6711. ------------------------------------------------
  6712. --order functions
  6713.  
  6714. local on_select_friendlyplayer_order = function (_, _, value)
  6715. Plater.db.profile.plate_config.friendlyplayer.order = value
  6716. Plater.UpdateAllPlates()
  6717. end
  6718. local on_select_friendlynpc_order = function (_, _, value)
  6719. Plater.db.profile.plate_config.friendlynpc.order = value
  6720. Plater.UpdateAllPlates()
  6721. end
  6722. local on_select_enemyplayer_order = function (_, _, value)
  6723. Plater.db.profile.plate_config.enemyplayer.order = value
  6724. Plater.UpdateAllPlates()
  6725. end
  6726. local on_select_enemynpc_order = function (_, _, value)
  6727. Plater.db.profile.plate_config.enemynpc.order = value
  6728. Plater.UpdateAllPlates()
  6729. end
  6730.  
  6731. --anchor table
  6732. local order_names = {"Debuffs, Health Bar, Cast Bar", "Health Bar, Debuffs, Cast Bar", "Cast Bar, Health Bar, Debuffs"}
  6733. local build_order_options = function (actorType)
  6734. local t = {}
  6735. for i = 1, 3 do
  6736. tinsert (t, {
  6737. label = order_names[i],
  6738. value = i,
  6739. onclick = function (_, _, value)
  6740. Plater.db.profile.plate_config [actorType].plate_order = value
  6741. Plater.UpdateAllPlates()
  6742. end
  6743. })
  6744. end
  6745. return t
  6746. end
  6747.  
  6748. ------------------------------------------------
  6749. --FriendlyPC painel de opções ~friendly ~friendlynpc
  6750.  
  6751. local on_select_friendly_playername_font = function (_, _, value)
  6752. Plater.db.profile.plate_config.friendlyplayer.actorname_text_font = value
  6753. Plater.UpdateAllPlates()
  6754. end
  6755. local on_select_friendly_playercastname_font = function (_, _, value)
  6756. Plater.db.profile.plate_config.friendlyplayer.spellname_text_font = value
  6757. Plater.UpdateAllPlates()
  6758. end
  6759. local on_select_friendlyplayer_level_text_font = function (_, _, value)
  6760. Plater.db.profile.plate_config.friendlyplayer.level_text_font = value
  6761. Plater.UpdateAllPlates()
  6762. end
  6763. local on_select_friendlyplayer_percent_text_font = function (_, _, value)
  6764. Plater.db.profile.plate_config.friendlyplayer.percent_text_font = value
  6765. Plater.UpdateAllPlates()
  6766. end
  6767. local on_select_friendlyplayer_spellpercent_text_font = function (_, _, value)
  6768. Plater.db.profile.plate_config.friendlyplayer.spellpercent_text_font = value
  6769. Plater.UpdateAllPlates()
  6770. end
  6771.  
  6772. local options_table3 = {
  6773. --health bar size out of combat
  6774. {type = "label", get = function() return "Health Bar Size out of Combat:" end, text_template = DF:GetTemplate ("font", "ORANGE_FONT_TEMPLATE")},
  6775. {
  6776. type = "range",
  6777. get = function() return Plater.db.profile.plate_config.friendlyplayer.health[1] end,
  6778. set = function (self, fixedparam, value)
  6779. Plater.db.profile.plate_config.friendlyplayer.health[1] = value
  6780. Plater.UpdateAllPlates (nil, true)
  6781. end,
  6782. min = 50,
  6783. max = 300,
  6784. step = 1,
  6785. name = "Width",
  6786. desc = "Width of the health bar when out of combat.",
  6787. },
  6788. {
  6789. type = "range",
  6790. get = function() return Plater.db.profile.plate_config.friendlyplayer.health[2] end,
  6791. set = function (self, fixedparam, value)
  6792. Plater.db.profile.plate_config.friendlyplayer.health[2] = value
  6793. Plater.UpdateAllPlates (nil, true)
  6794. end,
  6795. min = 1,
  6796. max = 100,
  6797. step = 1,
  6798. name = "Height",
  6799. desc = "Height of the health bar when out of combat.",
  6800. },
  6801.  
  6802. --health bar size in combat
  6803. {type = "label", get = function() return "Health Bar Size in Combat:" end, text_template = DF:GetTemplate ("font", "ORANGE_FONT_TEMPLATE")},
  6804. {
  6805. type = "range",
  6806. get = function() return Plater.db.profile.plate_config.friendlyplayer.health_incombat[1] end,
  6807. set = function (self, fixedparam, value)
  6808. Plater.db.profile.plate_config.friendlyplayer.health_incombat[1] = value
  6809. Plater.UpdateAllPlates (nil, true)
  6810. end,
  6811. min = 50,
  6812. max = 300,
  6813. step = 1,
  6814. name = "Width",
  6815. desc = "Width of the health bar when in combat.",
  6816. },
  6817. {
  6818. type = "range",
  6819. get = function() return Plater.db.profile.plate_config.friendlyplayer.health_incombat[2] end,
  6820. set = function (self, fixedparam, value)
  6821. Plater.db.profile.plate_config.friendlyplayer.health_incombat[2] = value
  6822. Plater.UpdateAllPlates (nil, true)
  6823. end,
  6824. min = 1,
  6825. max = 100,
  6826. step = 1,
  6827. name = "Height",
  6828. desc = "Height of the health bar when in combat.",
  6829. },
  6830.  
  6831. {type = "blank"},
  6832.  
  6833. --cast bar size out of combat
  6834. {type = "label", get = function() return "Cast Bar Size out of Combat:" end, text_template = DF:GetTemplate ("font", "ORANGE_FONT_TEMPLATE")},
  6835. {
  6836. type = "range",
  6837. get = function() return Plater.db.profile.plate_config.friendlyplayer.cast[1] end,
  6838. set = function (self, fixedparam, value)
  6839. Plater.db.profile.plate_config.friendlyplayer.cast[1] = value
  6840. Plater.UpdateAllPlates()
  6841. end,
  6842. min = 50,
  6843. max = 300,
  6844. step = 1,
  6845. name = "Width",
  6846. desc = "Width of the cast bar when out of combat.",
  6847. },
  6848. {
  6849. type = "range",
  6850. get = function() return Plater.db.profile.plate_config.friendlyplayer.cast[2] end,
  6851. set = function (self, fixedparam, value)
  6852. Plater.db.profile.plate_config.friendlyplayer.cast[2] = value
  6853. Plater.UpdateAllPlates()
  6854. end,
  6855. min = 1,
  6856. max = 100,
  6857. step = 1,
  6858. name = "Height",
  6859. desc = "Height of the cast bar when out of combat.",
  6860. },
  6861. --cast bar size out of combat
  6862. {type = "label", get = function() return "Cast Bar Size in Combat:" end, text_template = DF:GetTemplate ("font", "ORANGE_FONT_TEMPLATE")},
  6863. {
  6864. type = "range",
  6865. get = function() return Plater.db.profile.plate_config.friendlyplayer.cast_incombat[1] end,
  6866. set = function (self, fixedparam, value)
  6867. Plater.db.profile.plate_config.friendlyplayer.cast_incombat[1] = value
  6868. Plater.UpdateAllPlates()
  6869. end,
  6870. min = 50,
  6871. max = 300,
  6872. step = 1,
  6873. name = "Width",
  6874. desc = "Width of the cast bar when in combat.",
  6875. },
  6876. {
  6877. type = "range",
  6878. get = function() return Plater.db.profile.plate_config.friendlyplayer.cast_incombat[2] end,
  6879. set = function (self, fixedparam, value)
  6880. Plater.db.profile.plate_config.friendlyplayer.cast_incombat[2] = value
  6881. Plater.UpdateAllPlates()
  6882. end,
  6883. min = 1,
  6884. max = 100,
  6885. step = 1,
  6886. name = "Height",
  6887. desc = "Height of the cast bar when in combat.",
  6888. },
  6889.  
  6890. {type = "blank"},
  6891. --player name size
  6892. {type = "label", get = function() return "Player Name Text:" end, text_template = DF:GetTemplate ("font", "ORANGE_FONT_TEMPLATE")},
  6893. {
  6894. type = "range",
  6895. get = function() return Plater.db.profile.plate_config.friendlyplayer.actorname_text_size end,
  6896. set = function (self, fixedparam, value)
  6897. Plater.db.profile.plate_config.friendlyplayer.actorname_text_size = value
  6898. Plater.db.profile.plate_config.friendlyplayer.actorname_text_spacing = value-1
  6899. Plater.UpdateAllPlates()
  6900. end,
  6901. min = 6,
  6902. max = 99,
  6903. step = 1,
  6904. name = "Size",
  6905. desc = "Size of the text.",
  6906. },
  6907. --player name font
  6908. {
  6909. type = "select",
  6910. get = function() return Plater.db.profile.plate_config.friendlyplayer.actorname_text_font end,
  6911. values = function() return DF:BuildDropDownFontList (on_select_friendly_playername_font) end,
  6912. name = "Font",
  6913. desc = "Font of the text.",
  6914. },
  6915. --player name color
  6916. {
  6917. type = "color",
  6918. get = function()
  6919. local color = Plater.db.profile.plate_config.friendlyplayer.actorname_text_color
  6920. return {color[1], color[2], color[3], color[4]}
  6921. end,
  6922. set = function (self, r, g, b, a)
  6923. local color = Plater.db.profile.plate_config.friendlyplayer.actorname_text_color
  6924. color[1], color[2], color[3], color[4] = r, g, b, a
  6925. Plater.UpdateAllPlates()
  6926. end,
  6927. name = "Color",
  6928. desc = "The color of the text.",
  6929. },
  6930. --player name shadow
  6931. {
  6932. type = "toggle",
  6933. get = function() return Plater.db.profile.plate_config.friendlyplayer.actorname_text_shadow end,
  6934. set = function (self, fixedparam, value)
  6935. Plater.db.profile.plate_config.friendlyplayer.actorname_text_shadow = value
  6936. Plater.UpdateAllPlates()
  6937. end,
  6938. name = "Shadow",
  6939. desc = "If the text has a black outline.",
  6940. },
  6941.  
  6942. --npc name anchor
  6943. {
  6944. type = "select",
  6945. get = function() return Plater.db.profile.plate_config.friendlyplayer.actorname_text_anchor.side end,
  6946. values = function() return build_anchor_side_table ("friendlyplayer", "actorname_text_anchor") end,
  6947. name = "Anchor",
  6948. desc = "Which side of the nameplate this widget is attach to.",
  6949. },
  6950. --npc name anchor x offset
  6951. {
  6952. type = "range",
  6953. get = function() return Plater.db.profile.plate_config.friendlyplayer.actorname_text_anchor.x end,
  6954. set = function (self, fixedparam, value)
  6955. Plater.db.profile.plate_config.friendlyplayer.actorname_text_anchor.x = value
  6956. Plater.UpdateAllPlates()
  6957. end,
  6958. min = -20,
  6959. max = 20,
  6960. step = 1,
  6961. name = "X Offset",
  6962. desc = "Slightly move the text horizontally.",
  6963. },
  6964. --npc name anchor x offset
  6965. {
  6966. type = "range",
  6967. get = function() return Plater.db.profile.plate_config.friendlyplayer.actorname_text_anchor.y end,
  6968. set = function (self, fixedparam, value)
  6969. Plater.db.profile.plate_config.friendlyplayer.actorname_text_anchor.y = value
  6970. Plater.UpdateAllPlates()
  6971. end,
  6972. min = -20,
  6973. max = 20,
  6974. step = 1,
  6975. name = "Y Offset",
  6976. desc = "Slightly move the text vertically.",
  6977. },
  6978.  
  6979. --cast text size
  6980. {type = "breakline"},
  6981.  
  6982. --cast text size
  6983. {type = "label", get = function() return "Spell Name Text:" end, text_template = DF:GetTemplate ("font", "ORANGE_FONT_TEMPLATE")},
  6984. {
  6985. type = "range",
  6986. get = function() return Plater.db.profile.plate_config.friendlyplayer.spellname_text_size end,
  6987. set = function (self, fixedparam, value)
  6988. Plater.db.profile.plate_config.friendlyplayer.spellname_text_size = value
  6989. Plater.UpdateAllPlates()
  6990. end,
  6991. min = 6,
  6992. max = 99,
  6993. step = 1,
  6994. name = "Size",
  6995. desc = "Size of the text.",
  6996. },
  6997. --cast text font
  6998. {
  6999. type = "select",
  7000. get = function() return Plater.db.profile.plate_config.friendlyplayer.spellname_text_font end,
  7001. values = function() return DF:BuildDropDownFontList (on_select_friendly_playercastname_font) end,
  7002. name = "Font",
  7003. desc = "Font of the text.",
  7004. },
  7005. --cast text color
  7006. {
  7007. type = "color",
  7008. get = function()
  7009. local color = Plater.db.profile.plate_config.friendlyplayer.spellname_text_color
  7010. return {color[1], color[2], color[3], color[4]}
  7011. end,
  7012. set = function (self, r, g, b, a)
  7013. local color = Plater.db.profile.plate_config.friendlyplayer.spellname_text_color
  7014. color[1], color[2], color[3], color[4] = r, g, b, a
  7015. Plater.UpdateAllPlates()
  7016. end,
  7017. name = "Color",
  7018. desc = "The color of the text.",
  7019. },
  7020. --cast text shadow
  7021. {
  7022. type = "toggle",
  7023. get = function() return Plater.db.profile.plate_config.friendlyplayer.spellname_text_shadow end,
  7024. set = function (self, fixedparam, value)
  7025. Plater.db.profile.plate_config.friendlyplayer.spellname_text_shadow = value
  7026. Plater.UpdateAllPlates()
  7027. end,
  7028. name = "Shadow",
  7029. desc = "If the text has a black outline.",
  7030. },
  7031.  
  7032. --level text settings
  7033. {type = "blank"},
  7034. {type = "label", get = function() return "Level Text:" end, text_template = DF:GetTemplate ("font", "ORANGE_FONT_TEMPLATE")},
  7035. --level enabled
  7036. {
  7037. type = "toggle",
  7038. get = function() return Plater.db.profile.plate_config.friendlyplayer.level_text_enabled end,
  7039. set = function (self, fixedparam, value)
  7040. Plater.db.profile.plate_config.friendlyplayer.level_text_enabled = value
  7041. Plater.UpdateAllPlates()
  7042. end,
  7043. name = "Enabled",
  7044. desc = "Check this box to show the level of the actor.",
  7045. },
  7046. --level text size
  7047. {
  7048. type = "range",
  7049. get = function() return Plater.db.profile.plate_config.friendlyplayer.level_text_size end,
  7050. set = function (self, fixedparam, value)
  7051. Plater.db.profile.plate_config.friendlyplayer.level_text_size = value
  7052. Plater.UpdateAllPlates()
  7053. end,
  7054. min = 6,
  7055. max = 99,
  7056. step = 1,
  7057. name = "Size",
  7058. desc = "Size of the text.",
  7059. },
  7060. --level text font
  7061. {
  7062. type = "select",
  7063. get = function() return Plater.db.profile.plate_config.friendlyplayer.level_text_font end,
  7064. values = function() return DF:BuildDropDownFontList (on_select_friendlyplayer_level_text_font) end,
  7065. name = "Font",
  7066. desc = "Font of the text.",
  7067. },
  7068. --level text shadow
  7069. {
  7070. type = "toggle",
  7071. get = function() return Plater.db.profile.plate_config.friendlyplayer.level_text_shadow end,
  7072. set = function (self, fixedparam, value)
  7073. Plater.db.profile.plate_config.friendlyplayer.level_text_shadow = value
  7074. Plater.UpdateAllPlates()
  7075. end,
  7076. name = "Shadow",
  7077. desc = "If the text has a black outline.",
  7078. },
  7079. --level text alpha
  7080. {
  7081. type = "range",
  7082. get = function() return Plater.db.profile.plate_config.friendlyplayer.level_text_alpha end,
  7083. set = function (self, fixedparam, value)
  7084. Plater.db.profile.plate_config.friendlyplayer.level_text_alpha = value
  7085. Plater.UpdateAllPlates()
  7086. end,
  7087. min = 0,
  7088. max = 1,
  7089. step = 0.1,
  7090. name = "Alpha",
  7091. desc = "Set the transparency of the text.",
  7092. usedecimals = true,
  7093. },
  7094. --level anchor
  7095. {
  7096. type = "select",
  7097. get = function() return Plater.db.profile.plate_config.friendlyplayer.level_text_anchor.side end,
  7098. values = function() return build_anchor_side_table ("friendlyplayer", "level_text_anchor") end,
  7099. name = "Anchor",
  7100. desc = "Which side of the nameplate this widget is attach to.",
  7101. },
  7102. --level anchor x offset
  7103. {
  7104. type = "range",
  7105. get = function() return Plater.db.profile.plate_config.friendlyplayer.level_text_anchor.x end,
  7106. set = function (self, fixedparam, value)
  7107. Plater.db.profile.plate_config.friendlyplayer.level_text_anchor.x = value
  7108. Plater.UpdateAllPlates()
  7109. end,
  7110. min = -20,
  7111. max = 20,
  7112. step = 1,
  7113. name = "X Offset",
  7114. desc = "Slightly move the text horizontally.",
  7115. },
  7116. --level anchor x offset
  7117. {
  7118. type = "range",
  7119. get = function() return Plater.db.profile.plate_config.friendlyplayer.level_text_anchor.y end,
  7120. set = function (self, fixedparam, value)
  7121. Plater.db.profile.plate_config.friendlyplayer.level_text_anchor.y = value
  7122. Plater.UpdateAllPlates()
  7123. end,
  7124. min = -20,
  7125. max = 20,
  7126. step = 1,
  7127. name = "Y Offset",
  7128. desc = "Slightly move the text vertically.",
  7129. },
  7130.  
  7131. {type = "blank"},
  7132. {type = "label", get = function() return "Plate Order:" end, text_template = DF:GetTemplate ("font", "ORANGE_FONT_TEMPLATE")},
  7133. --plate order
  7134. {
  7135. type = "select",
  7136. get = function() return Plater.db.profile.plate_config.friendlyplayer.plate_order end,
  7137. values = function() return build_order_options ("friendlyplayer") end,
  7138. name = "Order",
  7139. desc = "How the health, cast and buff bars are ordered.\n\nFrom bottom (near the character head) to top.",
  7140. },
  7141.  
  7142. {type = "blank"},
  7143. {type = "label", get = function() return "Buff Frame:" end, text_template = DF:GetTemplate ("font", "ORANGE_FONT_TEMPLATE")},
  7144. --y offset
  7145. {
  7146. type = "range",
  7147. get = function() return Plater.db.profile.plate_config.friendlyplayer.buff_frame_y_offset end,
  7148. set = function (self, fixedparam, value)
  7149. Plater.db.profile.plate_config.friendlyplayer.buff_frame_y_offset = value
  7150. Plater.UpdateAllPlates()
  7151. end,
  7152. min = -64,
  7153. max = 64,
  7154. step = 1,
  7155. name = "Y Offset",
  7156. desc = "Adjusts the position on the Y axis.",
  7157. },
  7158.  
  7159. {type = "breakline"},
  7160.  
  7161. --percent text
  7162. {type = "label", get = function() return "Health Percent Text:" end, text_template = DF:GetTemplate ("font", "ORANGE_FONT_TEMPLATE")},
  7163. --enabled
  7164. {
  7165. type = "toggle",
  7166. get = function() return Plater.db.profile.plate_config.friendlyplayer.percent_text_enabled end,
  7167. set = function (self, fixedparam, value)
  7168. Plater.db.profile.plate_config.friendlyplayer.percent_text_enabled = value
  7169. Plater.UpdateAllPlates()
  7170. end,
  7171. name = "Enabled",
  7172. desc = "Show the percent text.",
  7173. },
  7174. --out of combat
  7175. {
  7176. type = "toggle",
  7177. get = function() return Plater.db.profile.plate_config.friendlyplayer.percent_text_ooc end,
  7178. set = function (self, fixedparam, value)
  7179. Plater.db.profile.plate_config.friendlyplayer.percent_text_ooc = value
  7180.  
  7181. Plater.UpdateAllPlates()
  7182. end,
  7183. name = "Out of Combat",
  7184. desc = "Show the percent even when isn't in combat.",
  7185. },
  7186. --percent text size
  7187. {
  7188. type = "range",
  7189. get = function() return Plater.db.profile.plate_config.friendlyplayer.percent_text_size end,
  7190. set = function (self, fixedparam, value)
  7191. Plater.db.profile.plate_config.friendlyplayer.percent_text_size = value
  7192. Plater.UpdateAllPlates()
  7193. end,
  7194. min = 6,
  7195. max = 99,
  7196. step = 1,
  7197. name = "Size",
  7198. desc = "Size of the text.",
  7199. },
  7200. --percent text font
  7201. {
  7202. type = "select",
  7203. get = function() return Plater.db.profile.plate_config.friendlyplayer.percent_text_font end,
  7204. values = function() return DF:BuildDropDownFontList (on_select_friendlyplayer_percent_text_font) end,
  7205. name = "Font",
  7206. desc = "Font of the text.",
  7207. },
  7208. --percent text shadow
  7209. {
  7210. type = "toggle",
  7211. get = function() return Plater.db.profile.plate_config.friendlyplayer.percent_text_shadow end,
  7212. set = function (self, fixedparam, value)
  7213. Plater.db.profile.plate_config.friendlyplayer.percent_text_shadow = value
  7214. Plater.UpdateAllPlates()
  7215. end,
  7216. name = "Shadow",
  7217. desc = "If the text has a black outline.",
  7218. },
  7219. --pecent text color
  7220. {
  7221. type = "color",
  7222. get = function()
  7223. local color = Plater.db.profile.plate_config.friendlyplayer.percent_text_color
  7224. return {color[1], color[2], color[3], color[4]}
  7225. end,
  7226. set = function (self, r, g, b, a)
  7227. local color = Plater.db.profile.plate_config.friendlyplayer.percent_text_color
  7228. color[1], color[2], color[3], color[4] = r, g, b, a
  7229. Plater.UpdateAllPlates()
  7230. end,
  7231. name = "Color",
  7232. desc = "The color of the text.",
  7233. },
  7234. --percent text alpha
  7235. {
  7236. type = "range",
  7237. get = function() return Plater.db.profile.plate_config.friendlyplayer.percent_text_alpha end,
  7238. set = function (self, fixedparam, value)
  7239. Plater.db.profile.plate_config.friendlyplayer.percent_text_alpha = value
  7240. Plater.UpdateAllPlates()
  7241. end,
  7242. min = 0,
  7243. max = 1,
  7244. step = 0.1,
  7245. name = "Alpha",
  7246. desc = "Set the transparency of the text.",
  7247. usedecimals = true,
  7248. },
  7249. --percent anchor
  7250. {
  7251. type = "select",
  7252. get = function() return Plater.db.profile.plate_config.friendlyplayer.percent_text_anchor.side end,
  7253. values = function() return build_anchor_side_table ("friendlyplayer", "percent_text_anchor") end,
  7254. name = "Anchor",
  7255. desc = "Which side of the nameplate this widget is attach to.",
  7256. },
  7257. --percent anchor x offset
  7258. {
  7259. type = "range",
  7260. get = function() return Plater.db.profile.plate_config.friendlyplayer.percent_text_anchor.x end,
  7261. set = function (self, fixedparam, value)
  7262. Plater.db.profile.plate_config.friendlyplayer.percent_text_anchor.x = value
  7263. Plater.UpdateAllPlates()
  7264. end,
  7265. min = -20,
  7266. max = 20,
  7267. step = 1,
  7268. name = "X Offset",
  7269. desc = "Slightly move the text horizontally.",
  7270. },
  7271. --percent anchor x offset
  7272. {
  7273. type = "range",
  7274. get = function() return Plater.db.profile.plate_config.friendlyplayer.percent_text_anchor.y end,
  7275. set = function (self, fixedparam, value)
  7276. Plater.db.profile.plate_config.friendlyplayer.percent_text_anchor.y = value
  7277. Plater.UpdateAllPlates()
  7278. end,
  7279. min = -20,
  7280. max = 20,
  7281. step = 1,
  7282. name = "Y Offset",
  7283. desc = "Slightly move the text vertically.",
  7284. },
  7285.  
  7286. {type = "blank"},
  7287. {type = "label", get = function() return "Cast Time Text:" end, text_template = DF:GetTemplate ("font", "ORANGE_FONT_TEMPLATE")},
  7288. {
  7289. type = "toggle",
  7290. get = function() return Plater.db.profile.plate_config.friendlyplayer.spellpercent_text_enabled end,
  7291. set = function (self, fixedparam, value)
  7292. Plater.db.profile.plate_config.friendlyplayer.spellpercent_text_enabled = value
  7293. Plater.UpdateAllPlates()
  7294. end,
  7295. name = "Enabled",
  7296. desc = "Show the cast time progress.",
  7297. },
  7298. --cast time text
  7299. {
  7300. type = "range",
  7301. get = function() return Plater.db.profile.plate_config.friendlyplayer.spellpercent_text_size end,
  7302. set = function (self, fixedparam, value)
  7303. Plater.db.profile.plate_config.friendlyplayer.spellpercent_text_size = value
  7304. Plater.UpdateAllPlates()
  7305. end,
  7306. min = 6,
  7307. max = 99,
  7308. step = 1,
  7309. name = "Size",
  7310. desc = "Size of the text.",
  7311. },
  7312. --cast time text font
  7313. {
  7314. type = "select",
  7315. get = function() return Plater.db.profile.plate_config.friendlyplayer.spellpercent_text_font end,
  7316. values = function() return DF:BuildDropDownFontList (on_select_friendlyplayer_spellpercent_text_font) end,
  7317. name = "Font",
  7318. desc = "Font of the text.",
  7319. },
  7320. --cast time text shadow
  7321. {
  7322. type = "toggle",
  7323. get = function() return Plater.db.profile.plate_config.friendlyplayer.spellpercent_text_shadow end,
  7324. set = function (self, fixedparam, value)
  7325. Plater.db.profile.plate_config.friendlyplayer.spellpercent_text_shadow = value
  7326. Plater.UpdateAllPlates()
  7327. end,
  7328. name = "Shadow",
  7329. desc = "If the text has a black outline.",
  7330. },
  7331. --cast time text color
  7332. {
  7333. type = "color",
  7334. get = function()
  7335. local color = Plater.db.profile.plate_config.friendlyplayer.spellpercent_text_color
  7336. return {color[1], color[2], color[3], color[4]}
  7337. end,
  7338. set = function (self, r, g, b, a)
  7339. local color = Plater.db.profile.plate_config.friendlyplayer.spellpercent_text_color
  7340. color[1], color[2], color[3], color[4] = r, g, b, a
  7341. Plater.UpdateAllPlates()
  7342. end,
  7343. name = "Color",
  7344. desc = "The color of the text.",
  7345. },
  7346.  
  7347. --cast time anchor
  7348. {
  7349. type = "select",
  7350. get = function() return Plater.db.profile.plate_config.friendlyplayer.spellpercent_text_anchor.side end,
  7351. values = function() return build_anchor_side_table ("friendlyplayer", "spellpercent_text_anchor") end,
  7352. name = "Anchor",
  7353. desc = "Which side of the nameplate this widget is attach to.",
  7354. },
  7355. --cast time anchor x offset
  7356. {
  7357. type = "range",
  7358. get = function() return Plater.db.profile.plate_config.friendlyplayer.spellpercent_text_anchor.x end,
  7359. set = function (self, fixedparam, value)
  7360. Plater.db.profile.plate_config.friendlyplayer.spellpercent_text_anchor.x = value
  7361. Plater.UpdateAllPlates()
  7362. end,
  7363. min = -20,
  7364. max = 20,
  7365. step = 1,
  7366. name = "X Offset",
  7367. desc = "Slightly move the text horizontally.",
  7368. },
  7369. --cast time anchor x offset
  7370. {
  7371. type = "range",
  7372. get = function() return Plater.db.profile.plate_config.friendlyplayer.spellpercent_text_anchor.y end,
  7373. set = function (self, fixedparam, value)
  7374. Plater.db.profile.plate_config.friendlyplayer.spellpercent_text_anchor.y = value
  7375. Plater.UpdateAllPlates()
  7376. end,
  7377. min = -20,
  7378. max = 20,
  7379. step = 1,
  7380. name = "Y Offset",
  7381. desc = "Slightly move the text vertically.",
  7382. },
  7383.  
  7384. {type = "breakline"},
  7385. {type = "label", get = function() return "General Settings:" end, text_template = DF:GetTemplate ("font", "ORANGE_FONT_TEMPLATE")},
  7386. {
  7387. type = "toggle",
  7388. get = function() return Plater.db.profile.use_playerclass_color end,
  7389. set = function (self, fixedparam, value)
  7390. Plater.db.profile.use_playerclass_color = value
  7391. Plater.UpdateUseClassColors()
  7392. end,
  7393. name = "Use Class Colors",
  7394. desc = "Player name plates uses the player class color",
  7395. },
  7396. {
  7397. type = "toggle",
  7398. get = function() return Plater.db.profile.plate_config [ACTORTYPE_FRIENDLY_PLAYER].only_damaged end,
  7399. set = function (self, fixedparam, value)
  7400. Plater.db.profile.plate_config [ACTORTYPE_FRIENDLY_PLAYER].only_damaged = value
  7401. Plater.UpdateAllPlates()
  7402. end,
  7403. name = "Only Damaged Players",
  7404. desc = "Hide the health bar when a friendly character has full health.",
  7405. },
  7406. {
  7407. type = "toggle",
  7408. get = function() return Plater.db.profile.plate_config [ACTORTYPE_FRIENDLY_PLAYER].only_thename end,
  7409. set = function (self, fixedparam, value)
  7410. Plater.db.profile.plate_config [ACTORTYPE_FRIENDLY_PLAYER].only_thename = value
  7411. Plater.UpdateAllPlates()
  7412. end,
  7413. name = "Only Show The Name",
  7414. desc = "Hide the health bar, only show the character name.",
  7415. },
  7416.  
  7417.  
  7418.  
  7419. }
  7420. DF:BuildMenu (friendlyPCsFrame, options_table3, startX, startY, heightSize, true, options_text_template, options_dropdown_template, options_switch_template, true, options_slider_template, options_button_template)
  7421.  
  7422. --------------------------------
  7423. --Enemy Player painel de opções ~enemy
  7424.  
  7425. local on_select_enemy_playername_font = function (_, _, value)
  7426. Plater.db.profile.plate_config.enemyplayer.actorname_text_font = value
  7427. Plater.UpdateAllPlates()
  7428. end
  7429. local on_select_enemy_playercastname_font = function (_, _, value)
  7430. Plater.db.profile.plate_config.enemyplayer.spellname_text_font = value
  7431. Plater.UpdateAllPlates()
  7432. end
  7433.  
  7434. local on_select_enemyplayer_level_text_font = function (_, _, value)
  7435. Plater.db.profile.plate_config.enemyplayer.level_text_font = value
  7436. Plater.UpdateAllPlates()
  7437. end
  7438. local on_select_enemyplayer_percent_text_font = function (_, _, value)
  7439. Plater.db.profile.plate_config.enemyplayer.percent_text_font = value
  7440. Plater.UpdateAllPlates()
  7441. end
  7442.  
  7443. local on_select_enemyplayer_spellpercent_text_font = function (_, _, value)
  7444. Plater.db.profile.plate_config.enemyplayer.spellpercent_text_font = value
  7445. Plater.UpdateAllPlates()
  7446. end
  7447.  
  7448. local options_table4 = {
  7449. --health bar size out of combat
  7450. {type = "label", get = function() return "Health Bar Size out of Combat:" end, text_template = DF:GetTemplate ("font", "ORANGE_FONT_TEMPLATE")},
  7451. {
  7452. type = "range",
  7453. get = function() return Plater.db.profile.plate_config.enemyplayer.health[1] end,
  7454. set = function (self, fixedparam, value)
  7455. Plater.db.profile.plate_config.enemyplayer.health[1] = value
  7456. Plater.UpdateAllPlates (nil, true)
  7457. end,
  7458. min = 50,
  7459. max = 300,
  7460. step = 1,
  7461. name = "Width",
  7462. desc = "Width of the health bar when out of combat.",
  7463. },
  7464. {
  7465. type = "range",
  7466. get = function() return Plater.db.profile.plate_config.enemyplayer.health[2] end,
  7467. set = function (self, fixedparam, value)
  7468. Plater.db.profile.plate_config.enemyplayer.health[2] = value
  7469. Plater.UpdateAllPlates (nil, true)
  7470. end,
  7471. min = 1,
  7472. max = 100,
  7473. step = 1,
  7474. name = "Height",
  7475. desc = "Height of the health bar when out of combat.",
  7476. },
  7477.  
  7478. --health bar size in combat
  7479. {type = "label", get = function() return "Health Bar Size in Combat:" end, text_template = DF:GetTemplate ("font", "ORANGE_FONT_TEMPLATE")},
  7480. {
  7481. type = "range",
  7482. get = function() return Plater.db.profile.plate_config.enemyplayer.health_incombat[1] end,
  7483. set = function (self, fixedparam, value)
  7484. Plater.db.profile.plate_config.enemyplayer.health_incombat[1] = value
  7485. Plater.UpdateAllPlates (nil, true)
  7486. end,
  7487. min = 50,
  7488. max = 300,
  7489. step = 1,
  7490. name = "Width",
  7491. desc = "Width of the health bar when in combat.",
  7492. },
  7493. {
  7494. type = "range",
  7495. get = function() return Plater.db.profile.plate_config.enemyplayer.health_incombat[2] end,
  7496. set = function (self, fixedparam, value)
  7497. Plater.db.profile.plate_config.enemyplayer.health_incombat[2] = value
  7498. Plater.UpdateAllPlates (nil, true)
  7499. end,
  7500. min = 1,
  7501. max = 100,
  7502. step = 1,
  7503. name = "Height",
  7504. desc = "Height of the health bar when in combat.",
  7505. },
  7506. {type = "blank"},
  7507. --cast bar size out of combat
  7508. {type = "label", get = function() return "Cast Bar Size out of Combat:" end, text_template = DF:GetTemplate ("font", "ORANGE_FONT_TEMPLATE")},
  7509. {
  7510. type = "range",
  7511. get = function() return Plater.db.profile.plate_config.enemyplayer.cast[1] end,
  7512. set = function (self, fixedparam, value)
  7513. Plater.db.profile.plate_config.enemyplayer.cast[1] = value
  7514. Plater.UpdateAllPlates()
  7515. end,
  7516. min = 50,
  7517. max = 300,
  7518. step = 1,
  7519. name = "Width",
  7520. desc = "Width of the cast bar when out of combat.",
  7521. },
  7522. {
  7523. type = "range",
  7524. get = function() return Plater.db.profile.plate_config.enemyplayer.cast[2] end,
  7525. set = function (self, fixedparam, value)
  7526. Plater.db.profile.plate_config.enemyplayer.cast[2] = value
  7527. Plater.UpdateAllPlates()
  7528. end,
  7529. min = 1,
  7530. max = 100,
  7531. step = 1,
  7532. name = "Height",
  7533. desc = "Height of the cast bar when out of combat.",
  7534. },
  7535. --cast bar size out of combat
  7536. {type = "label", get = function() return "Cast Bar Size in Combat:" end, text_template = DF:GetTemplate ("font", "ORANGE_FONT_TEMPLATE")},
  7537. {
  7538. type = "range",
  7539. get = function() return Plater.db.profile.plate_config.enemyplayer.cast_incombat[1] end,
  7540. set = function (self, fixedparam, value)
  7541. Plater.db.profile.plate_config.enemyplayer.cast_incombat[1] = value
  7542. Plater.UpdateAllPlates()
  7543. end,
  7544. min = 50,
  7545. max = 300,
  7546. step = 1,
  7547. name = "Width",
  7548. desc = "Width of the cast bar when in combat.",
  7549. },
  7550. {
  7551. type = "range",
  7552. get = function() return Plater.db.profile.plate_config.enemyplayer.cast_incombat[2] end,
  7553. set = function (self, fixedparam, value)
  7554. Plater.db.profile.plate_config.enemyplayer.cast_incombat[2] = value
  7555. Plater.UpdateAllPlates()
  7556. end,
  7557. min = 1,
  7558. max = 100,
  7559. step = 1,
  7560. name = "Height",
  7561. desc = "Height of the cast bar when in combat.",
  7562. },
  7563.  
  7564. --player name size
  7565. {type = "blank"},
  7566. {type = "label", get = function() return "Player Name Text:" end, text_template = DF:GetTemplate ("font", "ORANGE_FONT_TEMPLATE")},
  7567. {
  7568. type = "range",
  7569. get = function() return Plater.db.profile.plate_config.enemyplayer.actorname_text_size end,
  7570. set = function (self, fixedparam, value)
  7571. Plater.db.profile.plate_config.enemyplayer.actorname_text_size = value
  7572. Plater.db.profile.plate_config.enemyplayer.actorname_text_spacing = value-1
  7573. Plater.UpdateAllPlates()
  7574. end,
  7575. min = 6,
  7576. max = 99,
  7577. step = 1,
  7578. name = "Size",
  7579. desc = "Size of the text.",
  7580. },
  7581.  
  7582. --player name font
  7583. {
  7584. type = "select",
  7585. get = function() return Plater.db.profile.plate_config.enemyplayer.actorname_text_font end,
  7586. values = function() return DF:BuildDropDownFontList (on_select_enemy_playername_font) end,
  7587. name = "Font",
  7588. desc = "Font of the text.",
  7589. },
  7590. --player name color
  7591. {
  7592. type = "color",
  7593. get = function()
  7594. local color = Plater.db.profile.plate_config.enemyplayer.actorname_text_color
  7595. return {color[1], color[2], color[3], color[4]}
  7596. end,
  7597. set = function (self, r, g, b, a)
  7598. local color = Plater.db.profile.plate_config.enemyplayer.actorname_text_color
  7599. color[1], color[2], color[3], color[4] = r, g, b, a
  7600. Plater.UpdateAllPlates()
  7601. end,
  7602. name = "Color",
  7603. desc = "The color of the text.",
  7604. },
  7605. --player name shadow
  7606. {
  7607. type = "toggle",
  7608. get = function() return Plater.db.profile.plate_config.enemyplayer.actorname_text_shadow end,
  7609. set = function (self, fixedparam, value)
  7610. Plater.db.profile.plate_config.enemyplayer.actorname_text_shadow = value
  7611. Plater.UpdateAllPlates()
  7612. end,
  7613. name = "Shadow",
  7614. desc = "If the text has a black outline.",
  7615. },
  7616.  
  7617. --npc name anchor
  7618. {
  7619. type = "select",
  7620. get = function() return Plater.db.profile.plate_config.enemyplayer.actorname_text_anchor.side end,
  7621. values = function() return build_anchor_side_table ("enemyplayer", "actorname_text_anchor") end,
  7622. name = "Anchor",
  7623. desc = "Which side of the nameplate this widget is attach to.",
  7624. },
  7625. --npc name anchor x offset
  7626. {
  7627. type = "range",
  7628. get = function() return Plater.db.profile.plate_config.enemyplayer.actorname_text_anchor.x end,
  7629. set = function (self, fixedparam, value)
  7630. Plater.db.profile.plate_config.enemyplayer.actorname_text_anchor.x = value
  7631. Plater.UpdateAllPlates()
  7632. end,
  7633. min = -20,
  7634. max = 20,
  7635. step = 1,
  7636. name = "X Offset",
  7637. desc = "Slightly move the text horizontally.",
  7638. },
  7639. --npc name anchor x offset
  7640. {
  7641. type = "range",
  7642. get = function() return Plater.db.profile.plate_config.enemyplayer.actorname_text_anchor.y end,
  7643. set = function (self, fixedparam, value)
  7644. Plater.db.profile.plate_config.enemyplayer.actorname_text_anchor.y = value
  7645. Plater.UpdateAllPlates()
  7646. end,
  7647. min = -20,
  7648. max = 20,
  7649. step = 1,
  7650. name = "Y Offset",
  7651. desc = "Slightly move the text vertically.",
  7652. },
  7653.  
  7654. {type = "breakline"},
  7655.  
  7656. --cast text size
  7657. {type = "label", get = function() return "Spell Name Text:" end, text_template = DF:GetTemplate ("font", "ORANGE_FONT_TEMPLATE")},
  7658. {
  7659. type = "range",
  7660. get = function() return Plater.db.profile.plate_config.enemyplayer.spellname_text_size end,
  7661. set = function (self, fixedparam, value)
  7662. Plater.db.profile.plate_config.enemyplayer.spellname_text_size = value
  7663. Plater.UpdateAllPlates()
  7664. end,
  7665. min = 6,
  7666. max = 99,
  7667. step = 1,
  7668. name = "Size",
  7669. desc = "Size of the text.",
  7670. },
  7671. --cast text font
  7672. {
  7673. type = "select",
  7674. get = function() return Plater.db.profile.plate_config.enemyplayer.spellname_text_font end,
  7675. values = function() return DF:BuildDropDownFontList (on_select_enemy_playercastname_font) end,
  7676. name = "Font",
  7677. desc = "Font of the text.",
  7678. },
  7679. --cast text color
  7680. {
  7681. type = "color",
  7682. get = function()
  7683. local color = Plater.db.profile.plate_config.enemyplayer.spellname_text_color
  7684. return {color[1], color[2], color[3], color[4]}
  7685. end,
  7686. set = function (self, r, g, b, a)
  7687. local color = Plater.db.profile.plate_config.enemyplayer.spellname_text_color
  7688. color[1], color[2], color[3], color[4] = r, g, b, a
  7689. Plater.UpdateAllPlates()
  7690. end,
  7691. name = "Color",
  7692. desc = "The color of the text.",
  7693. },
  7694. --cast text shadow
  7695. {
  7696. type = "toggle",
  7697. get = function() return Plater.db.profile.plate_config.enemyplayer.spellname_text_shadow end,
  7698. set = function (self, fixedparam, value)
  7699. Plater.db.profile.plate_config.enemyplayer.spellname_text_shadow = value
  7700. Plater.UpdateAllPlates()
  7701. end,
  7702. name = "Shadow",
  7703. desc = "If the text has a black outline.",
  7704. },
  7705.  
  7706. --level text settings
  7707. {type = "blank"},
  7708. {type = "label", get = function() return "Level Text:" end, text_template = DF:GetTemplate ("font", "ORANGE_FONT_TEMPLATE")},
  7709. --level enabled
  7710. {
  7711. type = "toggle",
  7712. get = function() return Plater.db.profile.plate_config.enemyplayer.level_text_enabled end,
  7713. set = function (self, fixedparam, value)
  7714. Plater.db.profile.plate_config.enemyplayer.level_text_enabled = value
  7715. Plater.UpdateAllPlates()
  7716. end,
  7717. name = "Enabled",
  7718. desc = "Check this box to show the level of the actor.",
  7719. },
  7720. --level text size
  7721. {
  7722. type = "range",
  7723. get = function() return Plater.db.profile.plate_config.enemyplayer.level_text_size end,
  7724. set = function (self, fixedparam, value)
  7725. Plater.db.profile.plate_config.enemyplayer.level_text_size = value
  7726. Plater.UpdateAllPlates()
  7727. end,
  7728. min = 6,
  7729. max = 99,
  7730. step = 1,
  7731. name = "Size",
  7732. desc = "Size of the text.",
  7733. },
  7734. --level text font
  7735. {
  7736. type = "select",
  7737. get = function() return Plater.db.profile.plate_config.enemyplayer.level_text_font end,
  7738. values = function() return DF:BuildDropDownFontList (on_select_enemyplayer_level_text_font) end,
  7739. name = "Font",
  7740. desc = "Font of the text.",
  7741. },
  7742. --level text shadow
  7743. {
  7744. type = "toggle",
  7745. get = function() return Plater.db.profile.plate_config.enemyplayer.level_text_shadow end,
  7746. set = function (self, fixedparam, value)
  7747. Plater.db.profile.plate_config.enemyplayer.level_text_shadow = value
  7748. Plater.UpdateAllPlates()
  7749. end,
  7750. name = "Shadow",
  7751. desc = "If the text has a black outline.",
  7752. },
  7753. --level text alpha
  7754. {
  7755. type = "range",
  7756. get = function() return Plater.db.profile.plate_config.enemyplayer.level_text_alpha end,
  7757. set = function (self, fixedparam, value)
  7758. Plater.db.profile.plate_config.enemyplayer.level_text_alpha = value
  7759. Plater.UpdateAllPlates()
  7760. end,
  7761. min = 0,
  7762. max = 1,
  7763. step = 0.1,
  7764. name = "Alpha",
  7765. desc = "Set the transparency of the text.",
  7766. usedecimals = true,
  7767. },
  7768. --level anchor
  7769. {
  7770. type = "select",
  7771. get = function() return Plater.db.profile.plate_config.enemyplayer.level_text_anchor.side end,
  7772. values = function() return build_anchor_side_table ("enemyplayer", "level_text_anchor") end,
  7773. name = "Anchor",
  7774. desc = "Which side of the nameplate this widget is attach to.",
  7775. },
  7776. --level anchor x offset
  7777. {
  7778. type = "range",
  7779. get = function() return Plater.db.profile.plate_config.enemyplayer.level_text_anchor.x end,
  7780. set = function (self, fixedparam, value)
  7781. Plater.db.profile.plate_config.enemyplayer.level_text_anchor.x = value
  7782. Plater.UpdateAllPlates()
  7783. end,
  7784. min = -20,
  7785. max = 20,
  7786. step = 1,
  7787. name = "X Offset",
  7788. desc = "Slightly move the text horizontally.",
  7789. },
  7790. --level anchor x offset
  7791. {
  7792. type = "range",
  7793. get = function() return Plater.db.profile.plate_config.enemyplayer.level_text_anchor.y end,
  7794. set = function (self, fixedparam, value)
  7795. Plater.db.profile.plate_config.enemyplayer.level_text_anchor.y = value
  7796. Plater.UpdateAllPlates()
  7797. end,
  7798. min = -20,
  7799. max = 20,
  7800. step = 1,
  7801. name = "Y Offset",
  7802. desc = "Slightly move the text vertically.",
  7803. },
  7804.  
  7805. --plate order
  7806. {type = "blank"},
  7807. {type = "label", get = function() return "Plate Order:" end, text_template = DF:GetTemplate ("font", "ORANGE_FONT_TEMPLATE")},
  7808. {
  7809. type = "select",
  7810. get = function() return Plater.db.profile.plate_config.enemyplayer.plate_order end,
  7811. values = function() return build_order_options ("enemyplayer") end,
  7812. name = "Order",
  7813. desc = "How the health, cast and buff bars are ordered.\n\nFrom bottom (near the character head) to top.",
  7814. },
  7815.  
  7816. {type = "blank"},
  7817. {type = "label", get = function() return "Debuff Frame:" end, text_template = DF:GetTemplate ("font", "ORANGE_FONT_TEMPLATE")},
  7818. --y offset
  7819. {
  7820. type = "range",
  7821. get = function() return Plater.db.profile.plate_config.enemyplayer.buff_frame_y_offset end,
  7822. set = function (self, fixedparam, value)
  7823. Plater.db.profile.plate_config.enemyplayer.buff_frame_y_offset = value
  7824. Plater.UpdateAllPlates()
  7825. end,
  7826. min = -64,
  7827. max = 64,
  7828. step = 1,
  7829. name = "Y Offset",
  7830. desc = "Adjusts the position on the Y axis.",
  7831. },
  7832.  
  7833. {type = "breakline"},
  7834.  
  7835. --percent text
  7836. {type = "label", get = function() return "Health Percent Text:" end, text_template = DF:GetTemplate ("font", "ORANGE_FONT_TEMPLATE")},
  7837. --enabled
  7838. {
  7839. type = "toggle",
  7840. get = function() return Plater.db.profile.plate_config.enemyplayer.percent_text_enabled end,
  7841. set = function (self, fixedparam, value)
  7842. Plater.db.profile.plate_config.enemyplayer.percent_text_enabled = value
  7843. Plater.UpdateAllPlates()
  7844. end,
  7845. name = "Enabled",
  7846. desc = "Show the percent text.",
  7847. },
  7848. --out of combat
  7849. {
  7850. type = "toggle",
  7851. get = function() return Plater.db.profile.plate_config.friendlyplayer.percent_text_ooc end,
  7852. set = function (self, fixedparam, value)
  7853. Plater.db.profile.plate_config.friendlyplayer.percent_text_ooc = value
  7854.  
  7855. Plater.UpdateAllPlates()
  7856. end,
  7857. name = "Out of Combat",
  7858. desc = "Show the percent even when isn't in combat.",
  7859. },
  7860. --percent text size
  7861. {
  7862. type = "range",
  7863. get = function() return Plater.db.profile.plate_config.enemyplayer.percent_text_size end,
  7864. set = function (self, fixedparam, value)
  7865. Plater.db.profile.plate_config.enemyplayer.percent_text_size = value
  7866. Plater.UpdateAllPlates()
  7867. end,
  7868. min = 6,
  7869. max = 99,
  7870. step = 1,
  7871. name = "Size",
  7872. desc = "Size of the text.",
  7873. },
  7874. --percent text font
  7875. {
  7876. type = "select",
  7877. get = function() return Plater.db.profile.plate_config.enemyplayer.percent_text_font end,
  7878. values = function() return DF:BuildDropDownFontList (on_select_enemyplayer_percent_text_font) end,
  7879. name = "Font",
  7880. desc = "Font of the text.",
  7881. },
  7882. --percent text shadow
  7883. {
  7884. type = "toggle",
  7885. get = function() return Plater.db.profile.plate_config.enemyplayer.percent_text_shadow end,
  7886. set = function (self, fixedparam, value)
  7887. Plater.db.profile.plate_config.enemyplayer.percent_text_shadow = value
  7888. Plater.UpdateAllPlates()
  7889. end,
  7890. name = "Shadow",
  7891. desc = "If the text has a black outline.",
  7892. },
  7893. --pecent text color
  7894. {
  7895. type = "color",
  7896. get = function()
  7897. local color = Plater.db.profile.plate_config.enemyplayer.percent_text_color
  7898. return {color[1], color[2], color[3], color[4]}
  7899. end,
  7900. set = function (self, r, g, b, a)
  7901. local color = Plater.db.profile.plate_config.enemyplayer.percent_text_color
  7902. color[1], color[2], color[3], color[4] = r, g, b, a
  7903. Plater.UpdateAllPlates()
  7904. end,
  7905. name = "Color",
  7906. desc = "The color of the text.",
  7907. },
  7908. --percent text alpha
  7909. {
  7910. type = "range",
  7911. get = function() return Plater.db.profile.plate_config.enemyplayer.percent_text_alpha end,
  7912. set = function (self, fixedparam, value)
  7913. Plater.db.profile.plate_config.enemyplayer.percent_text_alpha = value
  7914. Plater.UpdateAllPlates()
  7915. end,
  7916. min = 0,
  7917. max = 1,
  7918. step = 0.1,
  7919. name = "Alpha",
  7920. desc = "Set the transparency of the text.",
  7921. usedecimals = true,
  7922. },
  7923. --percent anchor
  7924. {
  7925. type = "select",
  7926. get = function() return Plater.db.profile.plate_config.enemyplayer.percent_text_anchor.side end,
  7927. values = function() return build_anchor_side_table ("enemyplayer", "percent_text_anchor") end,
  7928. name = "Anchor",
  7929. desc = "Which side of the nameplate this widget is attach to.",
  7930. },
  7931. --percent anchor x offset
  7932. {
  7933. type = "range",
  7934. get = function() return Plater.db.profile.plate_config.enemyplayer.percent_text_anchor.x end,
  7935. set = function (self, fixedparam, value)
  7936. Plater.db.profile.plate_config.enemyplayer.percent_text_anchor.x = value
  7937. Plater.UpdateAllPlates()
  7938. end,
  7939. min = -20,
  7940. max = 20,
  7941. step = 1,
  7942. name = "X Offset",
  7943. desc = "Slightly move the text horizontally.",
  7944. },
  7945. --percent anchor x offset
  7946. {
  7947. type = "range",
  7948. get = function() return Plater.db.profile.plate_config.enemyplayer.percent_text_anchor.y end,
  7949. set = function (self, fixedparam, value)
  7950. Plater.db.profile.plate_config.enemyplayer.percent_text_anchor.y = value
  7951. Plater.UpdateAllPlates()
  7952. end,
  7953. min = -20,
  7954. max = 20,
  7955. step = 1,
  7956. name = "Y Offset",
  7957. desc = "Slightly move the text vertically.",
  7958. },
  7959.  
  7960. {type = "blank"},
  7961. {type = "label", get = function() return "Cast Time Text:" end, text_template = DF:GetTemplate ("font", "ORANGE_FONT_TEMPLATE")},
  7962. {
  7963. type = "toggle",
  7964. get = function() return Plater.db.profile.plate_config.enemyplayer.spellpercent_text_enabled end,
  7965. set = function (self, fixedparam, value)
  7966. Plater.db.profile.plate_config.enemyplayer.spellpercent_text_enabled = value
  7967. Plater.UpdateAllPlates()
  7968. end,
  7969. name = "Enabled",
  7970. desc = "Show the cast time progress.",
  7971. },
  7972. --cast time text
  7973. {
  7974. type = "range",
  7975. get = function() return Plater.db.profile.plate_config.enemyplayer.spellpercent_text_size end,
  7976. set = function (self, fixedparam, value)
  7977. Plater.db.profile.plate_config.enemyplayer.spellpercent_text_size = value
  7978. Plater.UpdateAllPlates()
  7979. end,
  7980. min = 6,
  7981. max = 99,
  7982. step = 1,
  7983. name = "Size",
  7984. desc = "Size of the text.",
  7985. },
  7986. --cast time text font
  7987. {
  7988. type = "select",
  7989. get = function() return Plater.db.profile.plate_config.enemyplayer.spellpercent_text_font end,
  7990. values = function() return DF:BuildDropDownFontList (on_select_enemyplayer_spellpercent_text_font) end,
  7991. name = "Font",
  7992. desc = "Font of the text.",
  7993. },
  7994. --cast time text shadow
  7995. {
  7996. type = "toggle",
  7997. get = function() return Plater.db.profile.plate_config.enemyplayer.spellpercent_text_shadow end,
  7998. set = function (self, fixedparam, value)
  7999. Plater.db.profile.plate_config.enemyplayer.spellpercent_text_shadow = value
  8000. Plater.UpdateAllPlates()
  8001. end,
  8002. name = "Shadow",
  8003. desc = "If the text has a black outline.",
  8004. },
  8005. --cast time text color
  8006. {
  8007. type = "color",
  8008. get = function()
  8009. local color = Plater.db.profile.plate_config.enemyplayer.spellpercent_text_color
  8010. return {color[1], color[2], color[3], color[4]}
  8011. end,
  8012. set = function (self, r, g, b, a)
  8013. local color = Plater.db.profile.plate_config.enemyplayer.spellpercent_text_color
  8014. color[1], color[2], color[3], color[4] = r, g, b, a
  8015. Plater.UpdateAllPlates()
  8016. end,
  8017. name = "Color",
  8018. desc = "The color of the text.",
  8019. },
  8020.  
  8021. --cast time anchor
  8022. {
  8023. type = "select",
  8024. get = function() return Plater.db.profile.plate_config.enemyplayer.spellpercent_text_anchor.side end,
  8025. values = function() return build_anchor_side_table ("enemyplayer", "spellpercent_text_anchor") end,
  8026. name = "Anchor",
  8027. desc = "Which side of the nameplate this widget is attach to.",
  8028. },
  8029. --cast time anchor x offset
  8030. {
  8031. type = "range",
  8032. get = function() return Plater.db.profile.plate_config.enemyplayer.spellpercent_text_anchor.x end,
  8033. set = function (self, fixedparam, value)
  8034. Plater.db.profile.plate_config.enemyplayer.spellpercent_text_anchor.x = value
  8035. Plater.UpdateAllPlates()
  8036. end,
  8037. min = -20,
  8038. max = 20,
  8039. step = 1,
  8040. name = "X Offset",
  8041. desc = "Slightly move the text horizontally.",
  8042. },
  8043. --cast time anchor x offset
  8044. {
  8045. type = "range",
  8046. get = function() return Plater.db.profile.plate_config.enemyplayer.spellpercent_text_anchor.y end,
  8047. set = function (self, fixedparam, value)
  8048. Plater.db.profile.plate_config.enemyplayer.spellpercent_text_anchor.y = value
  8049. Plater.UpdateAllPlates()
  8050. end,
  8051. min = -20,
  8052. max = 20,
  8053. step = 1,
  8054. name = "Y Offset",
  8055. desc = "Slightly move the text vertically.",
  8056. },
  8057.  
  8058. {type = "breakline"},
  8059. {type = "label", get = function() return "General Settings:" end, text_template = DF:GetTemplate ("font", "ORANGE_FONT_TEMPLATE")},
  8060. {
  8061. type = "toggle",
  8062. get = function() return Plater.db.profile.plate_config.enemyplayer.use_playerclass_color end,
  8063. set = function (self, fixedparam, value)
  8064. Plater.db.profile.plate_config.enemyplayer.use_playerclass_color = value
  8065. Plater.UpdateAllPlates (true)
  8066. end,
  8067. name = "Use Class Colors",
  8068. desc = "Player name plates uses the player class color",
  8069. },
  8070. {
  8071. type = "color",
  8072. get = function()
  8073. local color = Plater.db.profile.plate_config.enemyplayer.fixed_class_color
  8074. return {color[1], color[2], color[3], color[4]}
  8075. end,
  8076. set = function (self, r, g, b, a)
  8077. local color = Plater.db.profile.plate_config.enemyplayer.fixed_class_color
  8078. color[1], color[2], color[3], color[4] = r, g, b, a
  8079. Plater.UpdateAllPlates()
  8080. end,
  8081. name = "Fixed Class Color",
  8082. desc = "Use this color when not using class colors.",
  8083. },
  8084.  
  8085. }
  8086. DF:BuildMenu (enemyPCsFrame, options_table4, startX, startY, heightSize, true, options_text_template, options_dropdown_template, options_switch_template, true, options_slider_template, options_button_template)
  8087.  
  8088. -----------------------------------------------
  8089. --Friendly NPC painel de opções ~friendly
  8090.  
  8091. local on_select_friendly_npcname_font = function (_, _, value)
  8092. Plater.db.profile.plate_config.friendlynpc.actorname_text_font = value
  8093. Plater.UpdateAllPlates()
  8094. end
  8095. local on_select_friendly_npccastname_font = function (_, _, value)
  8096. Plater.db.profile.plate_config.friendlynpc.spellname_text_font = value
  8097. Plater.UpdateAllPlates()
  8098. end
  8099.  
  8100. local on_select_friendlynpc_level_text_font = function (_, _, value)
  8101. Plater.db.profile.plate_config.friendlynpc.level_text_font = value
  8102. Plater.UpdateAllPlates()
  8103. end
  8104. local on_select_friendlynpc_percent_text_font = function (_, _, value)
  8105. Plater.db.profile.plate_config.friendlynpc.percent_text_font = value
  8106. Plater.UpdateAllPlates()
  8107. end
  8108. local on_select_friendlynpc_titletext_text_font = function (_, _, value)
  8109. Plater.db.profile.plate_config.friendlynpc.big_actortitle_text_font = value
  8110. Plater.UpdateAllPlates()
  8111. end
  8112. local on_select_friendlynpc_bignametext_text_font = function (_, _, value)
  8113. Plater.db.profile.plate_config.friendlynpc.big_actorname_text_font = value
  8114. Plater.UpdateAllPlates()
  8115. end
  8116.  
  8117. local on_select_friendlynpc_spellpercent_text_font = function (_, _, value)
  8118. Plater.db.profile.plate_config.friendlynpc.spellpercent_text_font = value
  8119. Plater.UpdateAllPlates()
  8120. end
  8121.  
  8122. --menu 2
  8123. local friendly_npc_options_table = {
  8124.  
  8125. --health bar size out of combat
  8126. {type = "label", get = function() return "Health Bar Size out of Combat:" end, text_template = DF:GetTemplate ("font", "ORANGE_FONT_TEMPLATE")},
  8127. {
  8128. type = "range",
  8129. get = function() return Plater.db.profile.plate_config.friendlynpc.health[1] end,
  8130. set = function (self, fixedparam, value)
  8131. Plater.db.profile.plate_config.friendlynpc.health[1] = value
  8132. Plater.UpdateAllPlates (nil, true)
  8133. end,
  8134. min = 50,
  8135. max = 300,
  8136. step = 1,
  8137. name = "Width",
  8138. desc = "Width of the health bar when out of combat.",
  8139. },
  8140. {
  8141. type = "range",
  8142. get = function() return Plater.db.profile.plate_config.friendlynpc.health[2] end,
  8143. set = function (self, fixedparam, value)
  8144. Plater.db.profile.plate_config.friendlynpc.health[2] = value
  8145. Plater.UpdateAllPlates (nil, true)
  8146. end,
  8147. min = 1,
  8148. max = 100,
  8149. step = 1,
  8150. name = "Height",
  8151. desc = "Height of the health bar when out of combat.",
  8152. },
  8153.  
  8154. --health bar size in combat
  8155. {type = "label", get = function() return "Health Bar Size in Combat:" end, text_template = DF:GetTemplate ("font", "ORANGE_FONT_TEMPLATE")},
  8156. {
  8157. type = "range",
  8158. get = function() return Plater.db.profile.plate_config.friendlynpc.health_incombat[1] end,
  8159. set = function (self, fixedparam, value)
  8160. Plater.db.profile.plate_config.friendlynpc.health_incombat[1] = value
  8161. Plater.UpdateAllPlates (nil, true)
  8162. end,
  8163. min = 50,
  8164. max = 300,
  8165. step = 1,
  8166. name = "Width",
  8167. desc = "Width of the health bar when in combat.",
  8168. },
  8169. {
  8170. type = "range",
  8171. get = function() return Plater.db.profile.plate_config.friendlynpc.health_incombat[2] end,
  8172. set = function (self, fixedparam, value)
  8173. Plater.db.profile.plate_config.friendlynpc.health_incombat[2] = value
  8174. Plater.UpdateAllPlates (nil, true)
  8175. end,
  8176. min = 1,
  8177. max = 100,
  8178. step = 1,
  8179. name = "Height",
  8180. desc = "Height of the health bar when in combat.",
  8181. },
  8182. {type = "blank"},
  8183. --cast bar size out of combat
  8184. {type = "label", get = function() return "Cast Bar Size out of Combat:" end, text_template = DF:GetTemplate ("font", "ORANGE_FONT_TEMPLATE")},
  8185. {
  8186. type = "range",
  8187. get = function() return Plater.db.profile.plate_config.friendlynpc.cast[1] end,
  8188. set = function (self, fixedparam, value)
  8189. Plater.db.profile.plate_config.friendlynpc.cast[1] = value
  8190. Plater.UpdateAllPlates()
  8191. end,
  8192. min = 50,
  8193. max = 300,
  8194. step = 1,
  8195. name = "Width",
  8196. desc = "Width of the cast bar when out of combat.",
  8197. },
  8198. {
  8199. type = "range",
  8200. get = function() return Plater.db.profile.plate_config.friendlynpc.cast[2] end,
  8201. set = function (self, fixedparam, value)
  8202. Plater.db.profile.plate_config.friendlynpc.cast[2] = value
  8203. Plater.UpdateAllPlates()
  8204. end,
  8205. min = 1,
  8206. max = 100,
  8207. step = 1,
  8208. name = "Height",
  8209. desc = "Height of the cast bar when out of combat.",
  8210. },
  8211. --cast bar size out of combat
  8212. {type = "label", get = function() return "Cast Bar Size in Combat:" end, text_template = DF:GetTemplate ("font", "ORANGE_FONT_TEMPLATE")},
  8213. {
  8214. type = "range",
  8215. get = function() return Plater.db.profile.plate_config.friendlynpc.cast_incombat[1] end,
  8216. set = function (self, fixedparam, value)
  8217. Plater.db.profile.plate_config.friendlynpc.cast_incombat[1] = value
  8218. Plater.UpdateAllPlates()
  8219. end,
  8220. min = 50,
  8221. max = 300,
  8222. step = 1,
  8223. name = "Width",
  8224. desc = "Width of the cast bar when in combat.",
  8225. },
  8226. {
  8227. type = "range",
  8228. get = function() return Plater.db.profile.plate_config.friendlynpc.cast_incombat[2] end,
  8229. set = function (self, fixedparam, value)
  8230. Plater.db.profile.plate_config.friendlynpc.cast_incombat[2] = value
  8231. Plater.UpdateAllPlates()
  8232. end,
  8233. min = 1,
  8234. max = 100,
  8235. step = 1,
  8236. name = "Height",
  8237. desc = "Height of the cast bar when in combat.",
  8238. },
  8239.  
  8240. --player name size
  8241. {type = "blank"},
  8242. {type = "label", get = function() return "Npc Name Text:" end, text_template = DF:GetTemplate ("font", "ORANGE_FONT_TEMPLATE")},
  8243. {
  8244. type = "range",
  8245. get = function() return Plater.db.profile.plate_config.friendlynpc.actorname_text_size end,
  8246. set = function (self, fixedparam, value)
  8247. Plater.db.profile.plate_config.friendlynpc.actorname_text_size = value
  8248. Plater.db.profile.plate_config.friendlynpc.actorname_text_spacing = value-1
  8249. Plater.UpdateAllPlates()
  8250. end,
  8251. min = 6,
  8252. max = 99,
  8253. step = 1,
  8254. name = "Size",
  8255. desc = "Size of the text.",
  8256. },
  8257. --player name font
  8258. {
  8259. type = "select",
  8260. get = function() return Plater.db.profile.plate_config.friendlynpc.actorname_text_font end,
  8261. values = function() return DF:BuildDropDownFontList (on_select_enemy_npcname_font) end,
  8262. name = "Font",
  8263. desc = "Font of the text.",
  8264. },
  8265. --player name color
  8266. {
  8267. type = "color",
  8268. get = function()
  8269. local color = Plater.db.profile.plate_config.friendlynpc.actorname_text_color
  8270. return {color[1], color[2], color[3], color[4]}
  8271. end,
  8272. set = function (self, r, g, b, a)
  8273. local color = Plater.db.profile.plate_config.friendlynpc.actorname_text_color
  8274. color[1], color[2], color[3], color[4] = r, g, b, a
  8275. Plater.UpdateAllPlates()
  8276. end,
  8277. name = "Color",
  8278. desc = "The color of the text.",
  8279. },
  8280. --player name shadow
  8281. {
  8282. type = "toggle",
  8283. get = function() return Plater.db.profile.plate_config.friendlynpc.actorname_text_shadow end,
  8284. set = function (self, fixedparam, value)
  8285. Plater.db.profile.plate_config.friendlynpc.actorname_text_shadow = value
  8286. Plater.UpdateAllPlates()
  8287. end,
  8288. name = "Shadow",
  8289. desc = "If the text has a black outline.",
  8290. },
  8291.  
  8292. --npc name anchor
  8293. {
  8294. type = "select",
  8295. get = function() return Plater.db.profile.plate_config.friendlynpc.actorname_text_anchor.side end,
  8296. values = function() return build_anchor_side_table ("friendlynpc", "actorname_text_anchor") end,
  8297. name = "Anchor",
  8298. desc = "Which side of the nameplate this widget is attach to.",
  8299. },
  8300. --npc name anchor x offset
  8301. {
  8302. type = "range",
  8303. get = function() return Plater.db.profile.plate_config.friendlynpc.actorname_text_anchor.x end,
  8304. set = function (self, fixedparam, value)
  8305. Plater.db.profile.plate_config.friendlynpc.actorname_text_anchor.x = value
  8306. Plater.UpdateAllPlates()
  8307. end,
  8308. min = -20,
  8309. max = 20,
  8310. step = 1,
  8311. name = "X Offset",
  8312. desc = "Slightly move the text horizontally.",
  8313. },
  8314. --npc name anchor x offset
  8315. {
  8316. type = "range",
  8317. get = function() return Plater.db.profile.plate_config.friendlynpc.actorname_text_anchor.y end,
  8318. set = function (self, fixedparam, value)
  8319. Plater.db.profile.plate_config.friendlynpc.actorname_text_anchor.y = value
  8320. Plater.UpdateAllPlates()
  8321. end,
  8322. min = -20,
  8323. max = 20,
  8324. step = 1,
  8325. name = "Y Offset",
  8326. desc = "Slightly move the text vertically.",
  8327. },
  8328.  
  8329. {type = "breakline"},
  8330.  
  8331. --cast text size
  8332. {type = "label", get = function() return "Spell Name Text:" end, text_template = DF:GetTemplate ("font", "ORANGE_FONT_TEMPLATE")},
  8333. {
  8334. type = "range",
  8335. get = function() return Plater.db.profile.plate_config.friendlynpc.spellname_text_size end,
  8336. set = function (self, fixedparam, value)
  8337. Plater.db.profile.plate_config.friendlynpc.spellname_text_size = value
  8338. Plater.UpdateAllPlates()
  8339. end,
  8340. min = 6,
  8341. max = 99,
  8342. step = 1,
  8343. name = "Size",
  8344. desc = "Size of the text.",
  8345. },
  8346. --cast text font
  8347. {
  8348. type = "select",
  8349. get = function() return Plater.db.profile.plate_config.friendlynpc.spellname_text_font end,
  8350. values = function() return DF:BuildDropDownFontList (on_select_enemy_npccastname_font) end,
  8351. name = "Font",
  8352. desc = "Font of the text.",
  8353. },
  8354. --cast text color
  8355. {
  8356. type = "color",
  8357. get = function()
  8358. local color = Plater.db.profile.plate_config.friendlynpc.spellname_text_color
  8359. return {color[1], color[2], color[3], color[4]}
  8360. end,
  8361. set = function (self, r, g, b, a)
  8362. local color = Plater.db.profile.plate_config.friendlynpc.spellname_text_color
  8363. color[1], color[2], color[3], color[4] = r, g, b, a
  8364. Plater.UpdateAllPlates()
  8365. end,
  8366. name = "Color",
  8367. desc = "The color of the text.",
  8368. },
  8369. --cast text shadow
  8370. {
  8371. type = "toggle",
  8372. get = function() return Plater.db.profile.plate_config.friendlynpc.spellname_text_shadow end,
  8373. set = function (self, fixedparam, value)
  8374. Plater.db.profile.plate_config.friendlynpc.spellname_text_shadow = value
  8375. Plater.UpdateAllPlates()
  8376. end,
  8377. name = "Shadow",
  8378. desc = "If the text has a black outline.",
  8379. },
  8380.  
  8381. --level text settings
  8382. {type = "blank"},
  8383. {type = "label", get = function() return "Level Text:" end, text_template = DF:GetTemplate ("font", "ORANGE_FONT_TEMPLATE")},
  8384. --level enabled
  8385. {
  8386. type = "toggle",
  8387. get = function() return Plater.db.profile.plate_config.friendlynpc.level_text_enabled end,
  8388. set = function (self, fixedparam, value)
  8389. Plater.db.profile.plate_config.friendlynpc.level_text_enabled = value
  8390. Plater.UpdateAllPlates()
  8391. end,
  8392. name = "Enabled",
  8393. desc = "Check this box to show the level of the actor.",
  8394. },
  8395. --level text size
  8396. {
  8397. type = "range",
  8398. get = function() return Plater.db.profile.plate_config.friendlynpc.level_text_size end,
  8399. set = function (self, fixedparam, value)
  8400. Plater.db.profile.plate_config.friendlynpc.level_text_size = value
  8401. Plater.UpdateAllPlates()
  8402. end,
  8403. min = 6,
  8404. max = 99,
  8405. step = 1,
  8406. name = "Size",
  8407. desc = "Size of the text.",
  8408. },
  8409. --level text font
  8410. {
  8411. type = "select",
  8412. get = function() return Plater.db.profile.plate_config.friendlynpc.level_text_font end,
  8413. values = function() return DF:BuildDropDownFontList (on_select_friendlynpc_level_text_font) end,
  8414. name = "Font",
  8415. desc = "Font of the text.",
  8416. },
  8417. --level text shadow
  8418. {
  8419. type = "toggle",
  8420. get = function() return Plater.db.profile.plate_config.friendlynpc.level_text_shadow end,
  8421. set = function (self, fixedparam, value)
  8422. Plater.db.profile.plate_config.friendlynpc.level_text_shadow = value
  8423. Plater.UpdateAllPlates()
  8424. end,
  8425. name = "Shadow",
  8426. desc = "If the text has a black outline.",
  8427. },
  8428. --level text alpha
  8429. {
  8430. type = "range",
  8431. get = function() return Plater.db.profile.plate_config.friendlynpc.level_text_alpha end,
  8432. set = function (self, fixedparam, value)
  8433. Plater.db.profile.plate_config.friendlynpc.level_text_alpha = value
  8434. Plater.UpdateAllPlates()
  8435. end,
  8436. min = 0,
  8437. max = 1,
  8438. step = 0.1,
  8439. name = "Alpha",
  8440. desc = "Set the transparency of the text.",
  8441. usedecimals = true,
  8442. },
  8443. --level anchor
  8444. {
  8445. type = "select",
  8446. get = function() return Plater.db.profile.plate_config.friendlynpc.level_text_anchor.side end,
  8447. values = function() return build_anchor_side_table ("friendlynpc", "level_text_anchor") end,
  8448. name = "Anchor",
  8449. desc = "Which side of the nameplate this widget is attach to.",
  8450. },
  8451. --level anchor x offset
  8452. {
  8453. type = "range",
  8454. get = function() return Plater.db.profile.plate_config.friendlynpc.level_text_anchor.x end,
  8455. set = function (self, fixedparam, value)
  8456. Plater.db.profile.plate_config.friendlynpc.level_text_anchor.x = value
  8457. Plater.UpdateAllPlates()
  8458. end,
  8459. min = -20,
  8460. max = 20,
  8461. step = 1,
  8462. name = "X Offset",
  8463. desc = "Slightly move the text horizontally.",
  8464. },
  8465. --level anchor x offset
  8466. {
  8467. type = "range",
  8468. get = function() return Plater.db.profile.plate_config.friendlynpc.level_text_anchor.y end,
  8469. set = function (self, fixedparam, value)
  8470. Plater.db.profile.plate_config.friendlynpc.level_text_anchor.y = value
  8471. Plater.UpdateAllPlates()
  8472. end,
  8473. min = -20,
  8474. max = 20,
  8475. step = 1,
  8476. name = "Y Offset",
  8477. desc = "Slightly move the text vertically.",
  8478. },
  8479.  
  8480. --plate order
  8481. {type = "blank"},
  8482. {type = "label", get = function() return "Plate Order:" end, text_template = DF:GetTemplate ("font", "ORANGE_FONT_TEMPLATE")},
  8483. {
  8484. type = "select",
  8485. get = function() return Plater.db.profile.plate_config.friendlynpc.plate_order end,
  8486. values = function() return build_order_options ("friendlynpc") end,
  8487. name = "Order",
  8488. desc = "How the health, cast and buff bars are ordered.\n\nFrom bottom (near the character head) to top.",
  8489. },
  8490.  
  8491. {type = "blank"},
  8492. {type = "label", get = function() return "Buff Frame:" end, text_template = DF:GetTemplate ("font", "ORANGE_FONT_TEMPLATE")},
  8493. --y offset
  8494. {
  8495. type = "range",
  8496. get = function() return Plater.db.profile.plate_config.friendlynpc.buff_frame_y_offset end,
  8497. set = function (self, fixedparam, value)
  8498. Plater.db.profile.plate_config.friendlynpc.buff_frame_y_offset = value
  8499. Plater.UpdateAllPlates()
  8500. end,
  8501. min = -64,
  8502. max = 64,
  8503. step = 1,
  8504. name = "Y Offset",
  8505. desc = "Adjusts the position on the Y axis.",
  8506. },
  8507.  
  8508. {type = "breakline"},
  8509.  
  8510. --percent text
  8511. {type = "label", get = function() return "Health Percent Text:" end, text_template = DF:GetTemplate ("font", "ORANGE_FONT_TEMPLATE")},
  8512. --enabled
  8513. {
  8514. type = "toggle",
  8515. get = function() return Plater.db.profile.plate_config.friendlynpc.percent_text_enabled end,
  8516. set = function (self, fixedparam, value)
  8517. Plater.db.profile.plate_config.friendlynpc.percent_text_enabled = value
  8518. Plater.UpdateAllPlates()
  8519. end,
  8520. name = "Enabled",
  8521. desc = "Show the percent text.",
  8522. },
  8523. --out of combat
  8524. {
  8525. type = "toggle",
  8526. get = function() return Plater.db.profile.plate_config.friendlyplayer.percent_text_ooc end,
  8527. set = function (self, fixedparam, value)
  8528. Plater.db.profile.plate_config.friendlyplayer.percent_text_ooc = value
  8529.  
  8530. Plater.UpdateAllPlates()
  8531. end,
  8532. name = "Out of Combat",
  8533. desc = "Show the percent even when isn't in combat.",
  8534. },
  8535. --percent text size
  8536. {
  8537. type = "range",
  8538. get = function() return Plater.db.profile.plate_config.friendlynpc.percent_text_size end,
  8539. set = function (self, fixedparam, value)
  8540. Plater.db.profile.plate_config.friendlynpc.percent_text_size = value
  8541. Plater.UpdateAllPlates()
  8542. end,
  8543. min = 6,
  8544. max = 99,
  8545. step = 1,
  8546. name = "Size",
  8547. desc = "Size of the text.",
  8548. },
  8549. --percent text font
  8550. {
  8551. type = "select",
  8552. get = function() return Plater.db.profile.plate_config.friendlynpc.percent_text_font end,
  8553. values = function() return DF:BuildDropDownFontList (on_select_friendlynpc_percent_text_font) end,
  8554. name = "Font",
  8555. desc = "Font of the text.",
  8556. },
  8557. --percent text shadow
  8558. {
  8559. type = "toggle",
  8560. get = function() return Plater.db.profile.plate_config.friendlynpc.percent_text_shadow end,
  8561. set = function (self, fixedparam, value)
  8562. Plater.db.profile.plate_config.friendlynpc.percent_text_shadow = value
  8563. Plater.UpdateAllPlates()
  8564. end,
  8565. name = "Shadow",
  8566. desc = "If the text has a black outline.",
  8567. },
  8568. --pecent text color
  8569. {
  8570. type = "color",
  8571. get = function()
  8572. local color = Plater.db.profile.plate_config.friendlynpc.percent_text_color
  8573. return {color[1], color[2], color[3], color[4]}
  8574. end,
  8575. set = function (self, r, g, b, a)
  8576. local color = Plater.db.profile.plate_config.friendlynpc.percent_text_color
  8577. color[1], color[2], color[3], color[4] = r, g, b, a
  8578. Plater.UpdateAllPlates()
  8579. end,
  8580. name = "Color",
  8581. desc = "The color of the text.",
  8582. },
  8583. --percent text alpha
  8584. {
  8585. type = "range",
  8586. get = function() return Plater.db.profile.plate_config.friendlynpc.percent_text_alpha end,
  8587. set = function (self, fixedparam, value)
  8588. Plater.db.profile.plate_config.friendlynpc.percent_text_alpha = value
  8589. Plater.UpdateAllPlates()
  8590. end,
  8591. min = 0,
  8592. max = 1,
  8593. step = 0.1,
  8594. name = "Alpha",
  8595. desc = "Set the transparency of the text.",
  8596. usedecimals = true,
  8597. },
  8598. --percent anchor
  8599. {
  8600. type = "select",
  8601. get = function() return Plater.db.profile.plate_config.friendlynpc.percent_text_anchor.side end,
  8602. values = function() return build_anchor_side_table ("friendlynpc", "percent_text_anchor") end,
  8603. name = "Anchor",
  8604. desc = "Which side of the nameplate this widget is attach to.",
  8605. },
  8606. --percent anchor x offset
  8607. {
  8608. type = "range",
  8609. get = function() return Plater.db.profile.plate_config.friendlynpc.percent_text_anchor.x end,
  8610. set = function (self, fixedparam, value)
  8611. Plater.db.profile.plate_config.friendlynpc.percent_text_anchor.x = value
  8612. Plater.UpdateAllPlates()
  8613. end,
  8614. min = -20,
  8615. max = 20,
  8616. step = 1,
  8617. name = "X Offset",
  8618. desc = "Slightly move the text horizontally.",
  8619. },
  8620. --percent anchor x offset
  8621. {
  8622. type = "range",
  8623. get = function() return Plater.db.profile.plate_config.friendlynpc.percent_text_anchor.y end,
  8624. set = function (self, fixedparam, value)
  8625. Plater.db.profile.plate_config.friendlynpc.percent_text_anchor.y = value
  8626. Plater.UpdateAllPlates()
  8627. end,
  8628. min = -20,
  8629. max = 20,
  8630. step = 1,
  8631. name = "Y Offset",
  8632. desc = "Slightly move the text vertically.",
  8633. },
  8634.  
  8635. {type = "blank"},
  8636. {type = "label", get = function() return "Quest Color:" end, text_template = DF:GetTemplate ("font", "ORANGE_FONT_TEMPLATE")},
  8637. --enabled
  8638. {
  8639. type = "toggle",
  8640. get = function() return Plater.db.profile.plate_config.friendlynpc.quest_enabled end,
  8641. set = function (self, fixedparam, value)
  8642. Plater.db.profile.plate_config.friendlynpc.quest_enabled = value
  8643. Plater.UpdateAllPlates()
  8644. end,
  8645. name = "Enabled",
  8646. desc = "Nameplates for objectives mobs, now have a new color.",
  8647. },
  8648. {
  8649. type = "color",
  8650. get = function()
  8651. local color = Plater.db.profile.plate_config.friendlynpc.quest_color
  8652. return {color[1], color[2], color[3], color[4]}
  8653. end,
  8654. set = function (self, r, g, b, a)
  8655. local color = Plater.db.profile.plate_config.friendlynpc.quest_color
  8656. color[1], color[2], color[3], color[4] = r, g, b, a
  8657. Plater.UpdateAllPlates()
  8658. end,
  8659. name = "Friendly Npc",
  8660. desc = "Nameplate has this color when a friendly mob is a quest objective.",
  8661. },
  8662.  
  8663. {type = "blank"},
  8664. {type = "label", get = function() return "Profession Text:" end, text_template = DF:GetTemplate ("font", "ORANGE_FONT_TEMPLATE")},
  8665.  
  8666. --profession text size
  8667. {
  8668. type = "range",
  8669. get = function() return Plater.db.profile.plate_config.friendlynpc.big_actortitle_text_size end,
  8670. set = function (self, fixedparam, value)
  8671. Plater.db.profile.plate_config.friendlynpc.big_actortitle_text_size = value
  8672. Plater.UpdateAllPlates()
  8673. end,
  8674. min = 6,
  8675. max = 99,
  8676. step = 1,
  8677. name = "Size",
  8678. desc = "Size of the text.",
  8679. },
  8680. --profession text font
  8681. {
  8682. type = "select",
  8683. get = function() return Plater.db.profile.plate_config.friendlynpc.big_actortitle_text_font end,
  8684. values = function() return DF:BuildDropDownFontList (on_select_friendlynpc_titletext_text_font) end,
  8685. name = "Font",
  8686. desc = "Font of the text.",
  8687. },
  8688. --profession text shadow
  8689. {
  8690. type = "toggle",
  8691. get = function() return Plater.db.profile.plate_config.friendlynpc.big_actortitle_text_shadow end,
  8692. set = function (self, fixedparam, value)
  8693. Plater.db.profile.plate_config.friendlynpc.big_actortitle_text_shadow = value
  8694. Plater.UpdateAllPlates()
  8695. end,
  8696. name = "Shadow",
  8697. desc = "If the text has a black outline.",
  8698. },
  8699. --profession text color
  8700. {
  8701. type = "color",
  8702. get = function()
  8703. local color = Plater.db.profile.plate_config.friendlynpc.big_actortitle_text_color
  8704. return {color[1], color[2], color[3], color[4]}
  8705. end,
  8706. set = function (self, r, g, b, a)
  8707. local color = Plater.db.profile.plate_config.friendlynpc.big_actortitle_text_color
  8708. color[1], color[2], color[3], color[4] = r, g, b, a
  8709. Plater.UpdateAllPlates()
  8710. end,
  8711. name = "Color",
  8712. desc = "The color of the text.",
  8713. },
  8714.  
  8715. {type = "breakline"},
  8716.  
  8717. {type = "label", get = function() return "General Settings:" end, text_template = DF:GetTemplate ("font", "ORANGE_FONT_TEMPLATE")},
  8718. {
  8719. type = "toggle",
  8720. get = function() return Plater.CanShowPlateFor (ACTORTYPE_FRIENDLY_NPC) end,
  8721. set = function (self, fixedparam, value)
  8722. Plater.SetShowActorType (ACTORTYPE_FRIENDLY_NPC, value)
  8723. Plater.UpdateAllPlates()
  8724. end,
  8725. name = "Show Friendly Npc",
  8726. desc = "Show nameplate for friendly npcs.\n\n|cFFFFFF00Important|r: This option is dependent on the client`s nameplate state (on/off).\n\n|cFFFFFF00Important|r: when disabled but enabled on the client through (" .. (GetBindingKey ("FRIENDNAMEPLATES") or "") .. ") the healthbar isn't visible but the nameplate is still clickable.",
  8727. },
  8728. {
  8729. type = "select",
  8730. get = function() return Plater.db.profile.plate_config [ACTORTYPE_FRIENDLY_NPC].relevance_state end,
  8731. values = function() return relevance_options end,
  8732. name = "Friendly Npc Relevance",
  8733. desc = "Modify the way friendly npcs are shown.\n\n|cFFFFFF00Important|r: This option is dependent on the client`s nameplate state (on/off).",
  8734. },
  8735.  
  8736. {type = "blank"},
  8737.  
  8738. {type = "label", get = function() return "Npc Name Text When no Health Bar Shown:" end, text_template = DF:GetTemplate ("font", "ORANGE_FONT_TEMPLATE")},
  8739.  
  8740. --profession text size
  8741. {
  8742. type = "range",
  8743. get = function() return Plater.db.profile.plate_config.friendlynpc.big_actorname_text_size end,
  8744. set = function (self, fixedparam, value)
  8745. Plater.db.profile.plate_config.friendlynpc.big_actorname_text_size = value
  8746. Plater.UpdateAllPlates()
  8747. end,
  8748. min = 6,
  8749. max = 99,
  8750. step = 1,
  8751. name = "Size",
  8752. desc = "Size of the text.",
  8753. },
  8754. --profession text font
  8755. {
  8756. type = "select",
  8757. get = function() return Plater.db.profile.plate_config.friendlynpc.big_actorname_text_font end,
  8758. values = function() return DF:BuildDropDownFontList (on_select_friendlynpc_bignametext_text_font) end,
  8759. name = "Font",
  8760. desc = "Font of the text.",
  8761. },
  8762. --profession text shadow
  8763. {
  8764. type = "toggle",
  8765. get = function() return Plater.db.profile.plate_config.friendlynpc.big_actorname_text_shadow end,
  8766. set = function (self, fixedparam, value)
  8767. Plater.db.profile.plate_config.friendlynpc.big_actorname_text_shadow = value
  8768. Plater.UpdateAllPlates()
  8769. end,
  8770. name = "Shadow",
  8771. desc = "If the text has a black outline.",
  8772. },
  8773. --profession text color
  8774. {
  8775. type = "color",
  8776. get = function()
  8777. local color = Plater.db.profile.plate_config.friendlynpc.big_actorname_text_color
  8778. return {color[1], color[2], color[3], color[4]}
  8779. end,
  8780. set = function (self, r, g, b, a)
  8781. local color = Plater.db.profile.plate_config.friendlynpc.big_actorname_text_color
  8782. color[1], color[2], color[3], color[4] = r, g, b, a
  8783. Plater.UpdateAllPlates()
  8784. end,
  8785. name = "Color",
  8786. desc = "The color of the text.",
  8787. },
  8788.  
  8789. {type = "blank"},
  8790. {type = "label", get = function() return "Cast Time Text:" end, text_template = DF:GetTemplate ("font", "ORANGE_FONT_TEMPLATE")},
  8791. {
  8792. type = "toggle",
  8793. get = function() return Plater.db.profile.plate_config.friendlynpc.spellpercent_text_enabled end,
  8794. set = function (self, fixedparam, value)
  8795. Plater.db.profile.plate_config.friendlynpc.spellpercent_text_enabled = value
  8796. Plater.UpdateAllPlates()
  8797. end,
  8798. name = "Enabled",
  8799. desc = "Show the cast time progress.",
  8800. },
  8801. --cast time text
  8802. {
  8803. type = "range",
  8804. get = function() return Plater.db.profile.plate_config.friendlynpc.spellpercent_text_size end,
  8805. set = function (self, fixedparam, value)
  8806. Plater.db.profile.plate_config.friendlynpc.spellpercent_text_size = value
  8807. Plater.UpdateAllPlates()
  8808. end,
  8809. min = 6,
  8810. max = 99,
  8811. step = 1,
  8812. name = "Size",
  8813. desc = "Size of the text.",
  8814. },
  8815. --cast time text font
  8816. {
  8817. type = "select",
  8818. get = function() return Plater.db.profile.plate_config.friendlynpc.spellpercent_text_font end,
  8819. values = function() return DF:BuildDropDownFontList (on_select_friendlynpc_spellpercent_text_font) end,
  8820. name = "Font",
  8821. desc = "Font of the text.",
  8822. },
  8823. --cast time text shadow
  8824. {
  8825. type = "toggle",
  8826. get = function() return Plater.db.profile.plate_config.friendlynpc.spellpercent_text_shadow end,
  8827. set = function (self, fixedparam, value)
  8828. Plater.db.profile.plate_config.friendlynpc.spellpercent_text_shadow = value
  8829. Plater.UpdateAllPlates()
  8830. end,
  8831. name = "Shadow",
  8832. desc = "If the text has a black outline.",
  8833. },
  8834. --cast time text color
  8835. {
  8836. type = "color",
  8837. get = function()
  8838. local color = Plater.db.profile.plate_config.friendlynpc.spellpercent_text_color
  8839. return {color[1], color[2], color[3], color[4]}
  8840. end,
  8841. set = function (self, r, g, b, a)
  8842. local color = Plater.db.profile.plate_config.friendlynpc.spellpercent_text_color
  8843. color[1], color[2], color[3], color[4] = r, g, b, a
  8844. Plater.UpdateAllPlates()
  8845. end,
  8846. name = "Color",
  8847. desc = "The color of the text.",
  8848. },
  8849.  
  8850. --cast time anchor
  8851. {
  8852. type = "select",
  8853. get = function() return Plater.db.profile.plate_config.friendlynpc.spellpercent_text_anchor.side end,
  8854. values = function() return build_anchor_side_table ("friendlynpc", "spellpercent_text_anchor") end,
  8855. name = "Anchor",
  8856. desc = "Which side of the nameplate this widget is attach to.",
  8857. },
  8858. --cast time anchor x offset
  8859. {
  8860. type = "range",
  8861. get = function() return Plater.db.profile.plate_config.friendlynpc.spellpercent_text_anchor.x end,
  8862. set = function (self, fixedparam, value)
  8863. Plater.db.profile.plate_config.friendlynpc.spellpercent_text_anchor.x = value
  8864. Plater.UpdateAllPlates()
  8865. end,
  8866. min = -20,
  8867. max = 20,
  8868. step = 1,
  8869. name = "X Offset",
  8870. desc = "Slightly move the text horizontally.",
  8871. },
  8872. --cast time anchor x offset
  8873. {
  8874. type = "range",
  8875. get = function() return Plater.db.profile.plate_config.friendlynpc.spellpercent_text_anchor.y end,
  8876. set = function (self, fixedparam, value)
  8877. Plater.db.profile.plate_config.friendlynpc.spellpercent_text_anchor.y = value
  8878. Plater.UpdateAllPlates()
  8879. end,
  8880. min = -20,
  8881. max = 20,
  8882. step = 1,
  8883. name = "Y Offset",
  8884. desc = "Slightly move the text vertically.",
  8885. },
  8886.  
  8887. }
  8888. DF:BuildMenu (friendlyNPCsFrame, friendly_npc_options_table, startX, startY, heightSize, true, options_text_template, options_dropdown_template, options_switch_template, true, options_slider_template, options_button_template)
  8889.  
  8890. -----------------------------------------------
  8891. --Enemy NPC painel de opções ~enemy
  8892.  
  8893. local on_select_enemy_npcname_font = function (_, _, value)
  8894. Plater.db.profile.plate_config.enemynpc.actorname_text_font = value
  8895. Plater.UpdateAllPlates()
  8896. end
  8897. local on_select_enemy_npccastname_font = function (_, _, value)
  8898. Plater.db.profile.plate_config.enemynpc.spellname_text_font = value
  8899. Plater.UpdateAllPlates()
  8900. end
  8901. local on_select_enemy_level_text_font = function (_, _, value)
  8902. Plater.db.profile.plate_config.enemynpc.level_text_font = value
  8903. Plater.UpdateAllPlates()
  8904. end
  8905. local on_select_enemy_percent_text_font = function (_, _, value)
  8906. Plater.db.profile.plate_config.enemynpc.percent_text_font = value
  8907. Plater.UpdateAllPlates()
  8908. end
  8909.  
  8910. local on_select_enemy_spellpercent_text_font = function (_, _, value)
  8911. Plater.db.profile.plate_config.enemynpc.spellpercent_text_font = value
  8912. Plater.UpdateAllPlates()
  8913. end
  8914.  
  8915. --menu 2 --enemy npc
  8916. local options_table2 = {
  8917. --health bar size out of combat
  8918. {type = "label", get = function() return "Health Bar Size out of Combat:" end, text_template = DF:GetTemplate ("font", "ORANGE_FONT_TEMPLATE")},
  8919. {
  8920. type = "range",
  8921. get = function() return Plater.db.profile.plate_config.enemynpc.health[1] end,
  8922. set = function (self, fixedparam, value)
  8923. Plater.db.profile.plate_config.enemynpc.health[1] = value
  8924. Plater.UpdateAllPlates (nil, true)
  8925. end,
  8926. min = 50,
  8927. max = 300,
  8928. step = 1,
  8929. name = "Width",
  8930. desc = "Width of the health bar when out of combat.",
  8931. },
  8932. {
  8933. type = "range",
  8934. get = function() return Plater.db.profile.plate_config.enemynpc.health[2] end,
  8935. set = function (self, fixedparam, value)
  8936. Plater.db.profile.plate_config.enemynpc.health[2] = value
  8937. Plater.UpdateAllPlates (nil, true)
  8938. end,
  8939. min = 1,
  8940. max = 100,
  8941. step = 1,
  8942. name = "Height",
  8943. desc = "Height of the health bar when out of combat.",
  8944. },
  8945.  
  8946. --health bar size in combat
  8947. {type = "label", get = function() return "Health Bar Size in Combat:" end, text_template = DF:GetTemplate ("font", "ORANGE_FONT_TEMPLATE")},
  8948. {
  8949. type = "range",
  8950. get = function() return Plater.db.profile.plate_config.enemynpc.health_incombat[1] end,
  8951. set = function (self, fixedparam, value)
  8952. Plater.db.profile.plate_config.enemynpc.health_incombat[1] = value
  8953. Plater.UpdateAllPlates (nil, true)
  8954. end,
  8955. min = 50,
  8956. max = 300,
  8957. step = 1,
  8958. name = "Width",
  8959. desc = "Width of the health bar when in combat.",
  8960. },
  8961. {
  8962. type = "range",
  8963. get = function() return Plater.db.profile.plate_config.enemynpc.health_incombat[2] end,
  8964. set = function (self, fixedparam, value)
  8965. Plater.db.profile.plate_config.enemynpc.health_incombat[2] = value
  8966. Plater.UpdateAllPlates (nil, true)
  8967. end,
  8968. min = 1,
  8969. max = 100,
  8970. step = 1,
  8971. name = "Height",
  8972. desc = "Height of the health bar when in combat.",
  8973. },
  8974. {type = "blank"},
  8975. --cast bar size out of combat
  8976. {type = "label", get = function() return "Cast Bar Size out of Combat:" end, text_template = DF:GetTemplate ("font", "ORANGE_FONT_TEMPLATE")},
  8977. {
  8978. type = "range",
  8979. get = function() return Plater.db.profile.plate_config.enemynpc.cast[1] end,
  8980. set = function (self, fixedparam, value)
  8981. Plater.db.profile.plate_config.enemynpc.cast[1] = value
  8982. Plater.UpdateAllPlates()
  8983. end,
  8984. min = 50,
  8985. max = 300,
  8986. step = 1,
  8987. name = "Width",
  8988. desc = "Width of the cast bar when out of combat.",
  8989. },
  8990. {
  8991. type = "range",
  8992. get = function() return Plater.db.profile.plate_config.enemynpc.cast[2] end,
  8993. set = function (self, fixedparam, value)
  8994. Plater.db.profile.plate_config.enemynpc.cast[2] = value
  8995. Plater.UpdateAllPlates()
  8996. end,
  8997. min = 1,
  8998. max = 100,
  8999. step = 1,
  9000. name = "Height",
  9001. desc = "Height of the cast bar when out of combat.",
  9002. },
  9003. --cast bar size out of combat
  9004. {type = "label", get = function() return "Cast Bar Size in Combat:" end, text_template = DF:GetTemplate ("font", "ORANGE_FONT_TEMPLATE")},
  9005. {
  9006. type = "range",
  9007. get = function() return Plater.db.profile.plate_config.enemynpc.cast_incombat[1] end,
  9008. set = function (self, fixedparam, value)
  9009. Plater.db.profile.plate_config.enemynpc.cast_incombat[1] = value
  9010. Plater.UpdateAllPlates()
  9011. end,
  9012. min = 50,
  9013. max = 300,
  9014. step = 1,
  9015. name = "Width",
  9016. desc = "Width of the cast bar when in combat.",
  9017. },
  9018. {
  9019. type = "range",
  9020. get = function() return Plater.db.profile.plate_config.enemynpc.cast_incombat[2] end,
  9021. set = function (self, fixedparam, value)
  9022. Plater.db.profile.plate_config.enemynpc.cast_incombat[2] = value
  9023. Plater.UpdateAllPlates()
  9024. end,
  9025. min = 1,
  9026. max = 100,
  9027. step = 1,
  9028. name = "Height",
  9029. desc = "Height of the cast bar when in combat.",
  9030. },
  9031. {type = "blank"},
  9032. --player name size
  9033. {type = "label", get = function() return "Npc Name Text:" end, text_template = DF:GetTemplate ("font", "ORANGE_FONT_TEMPLATE")},
  9034. {
  9035. type = "range",
  9036. get = function() return Plater.db.profile.plate_config.enemynpc.actorname_text_size end,
  9037. set = function (self, fixedparam, value)
  9038. Plater.db.profile.plate_config.enemynpc.actorname_text_size = value
  9039. Plater.db.profile.plate_config.enemynpc.actorname_text_spacing = value-1
  9040. Plater.UpdateAllPlates()
  9041. end,
  9042. min = 6,
  9043. max = 99,
  9044. step = 1,
  9045. name = "Size",
  9046. desc = "Size of the text.",
  9047. },
  9048. --player name font
  9049. {
  9050. type = "select",
  9051. get = function() return Plater.db.profile.plate_config.enemynpc.actorname_text_font end,
  9052. values = function() return DF:BuildDropDownFontList (on_select_enemy_npcname_font) end,
  9053. name = "Font",
  9054. desc = "Font of the text.",
  9055. },
  9056. --player name color
  9057. {
  9058. type = "color",
  9059. get = function()
  9060. local color = Plater.db.profile.plate_config.enemynpc.actorname_text_color
  9061. return {color[1], color[2], color[3], color[4]}
  9062. end,
  9063. set = function (self, r, g, b, a)
  9064. local color = Plater.db.profile.plate_config.enemynpc.actorname_text_color
  9065. color[1], color[2], color[3], color[4] = r, g, b, a
  9066. Plater.UpdateAllPlates()
  9067. end,
  9068. name = "Color",
  9069. desc = "The color of the text.",
  9070. },
  9071. --player name shadow
  9072. {
  9073. type = "toggle",
  9074. get = function() return Plater.db.profile.plate_config.enemynpc.actorname_text_shadow end,
  9075. set = function (self, fixedparam, value)
  9076. Plater.db.profile.plate_config.enemynpc.actorname_text_shadow = value
  9077. Plater.UpdateAllPlates()
  9078. end,
  9079. name = "Shadow",
  9080. desc = "If the text has a black outline.",
  9081. },
  9082.  
  9083. --npc name anchor
  9084. {
  9085. type = "select",
  9086. get = function() return Plater.db.profile.plate_config.enemynpc.actorname_text_anchor.side end,
  9087. values = function() return build_anchor_side_table ("enemynpc", "actorname_text_anchor") end,
  9088. name = "Anchor",
  9089. desc = "Which side of the nameplate this widget is attach to.",
  9090. },
  9091. --npc name anchor x offset
  9092. {
  9093. type = "range",
  9094. get = function() return Plater.db.profile.plate_config.enemynpc.actorname_text_anchor.x end,
  9095. set = function (self, fixedparam, value)
  9096. Plater.db.profile.plate_config.enemynpc.actorname_text_anchor.x = value
  9097. Plater.UpdateAllPlates()
  9098. end,
  9099. min = -20,
  9100. max = 20,
  9101. step = 1,
  9102. name = "X Offset",
  9103. desc = "Slightly move the text horizontally.",
  9104. },
  9105. --npc name anchor x offset
  9106. {
  9107. type = "range",
  9108. get = function() return Plater.db.profile.plate_config.enemynpc.actorname_text_anchor.y end,
  9109. set = function (self, fixedparam, value)
  9110. Plater.db.profile.plate_config.enemynpc.actorname_text_anchor.y = value
  9111. Plater.UpdateAllPlates()
  9112. end,
  9113. min = -20,
  9114. max = 20,
  9115. step = 1,
  9116. name = "Y Offset",
  9117. desc = "Slightly move the text vertically.",
  9118. },
  9119.  
  9120. {type = "breakline"},
  9121.  
  9122. --cast text size
  9123. {type = "label", get = function() return "Spell Name Text:" end, text_template = DF:GetTemplate ("font", "ORANGE_FONT_TEMPLATE")},
  9124. {
  9125. type = "range",
  9126. get = function() return Plater.db.profile.plate_config.enemynpc.spellname_text_size end,
  9127. set = function (self, fixedparam, value)
  9128. Plater.db.profile.plate_config.enemynpc.spellname_text_size = value
  9129. Plater.UpdateAllPlates()
  9130. end,
  9131. min = 6,
  9132. max = 99,
  9133. step = 1,
  9134. name = "Size",
  9135. desc = "Size of the text.",
  9136. },
  9137. --cast text font
  9138. {
  9139. type = "select",
  9140. get = function() return Plater.db.profile.plate_config.enemynpc.spellname_text_font end,
  9141. values = function() return DF:BuildDropDownFontList (on_select_enemy_npccastname_font) end,
  9142. name = "Font",
  9143. desc = "Font of the text.",
  9144. },
  9145. --cast text color
  9146. {
  9147. type = "color",
  9148. get = function()
  9149. local color = Plater.db.profile.plate_config.enemynpc.spellname_text_color
  9150. return {color[1], color[2], color[3], color[4]}
  9151. end,
  9152. set = function (self, r, g, b, a)
  9153. local color = Plater.db.profile.plate_config.enemynpc.spellname_text_color
  9154. color[1], color[2], color[3], color[4] = r, g, b, a
  9155. Plater.UpdateAllPlates()
  9156. end,
  9157. name = "Color",
  9158. desc = "The color of the text.",
  9159. },
  9160. --cast text shadow
  9161. {
  9162. type = "toggle",
  9163. get = function() return Plater.db.profile.plate_config.enemynpc.spellname_text_shadow end,
  9164. set = function (self, fixedparam, value)
  9165. Plater.db.profile.plate_config.enemynpc.spellname_text_shadow = value
  9166. Plater.UpdateAllPlates()
  9167. end,
  9168. name = "Shadow",
  9169. desc = "If the text has a black outline.",
  9170. },
  9171.  
  9172. --level text settings
  9173. {type = "blank"},
  9174. {type = "label", get = function() return "Level Text:" end, text_template = DF:GetTemplate ("font", "ORANGE_FONT_TEMPLATE")},
  9175. --level enabled
  9176. {
  9177. type = "toggle",
  9178. get = function() return Plater.db.profile.plate_config.enemynpc.level_text_enabled end,
  9179. set = function (self, fixedparam, value)
  9180. Plater.db.profile.plate_config.enemynpc.level_text_enabled = value
  9181. Plater.UpdateAllPlates()
  9182. end,
  9183. name = "Enabled",
  9184. desc = "Check this box to show the level of the actor.",
  9185. },
  9186. --level text size
  9187. {
  9188. type = "range",
  9189. get = function() return Plater.db.profile.plate_config.enemynpc.level_text_size end,
  9190. set = function (self, fixedparam, value)
  9191. Plater.db.profile.plate_config.enemynpc.level_text_size = value
  9192. Plater.UpdateAllPlates()
  9193. end,
  9194. min = 6,
  9195. max = 99,
  9196. step = 1,
  9197. name = "Size",
  9198. desc = "Size of the text.",
  9199. },
  9200. --level text font
  9201. {
  9202. type = "select",
  9203. get = function() return Plater.db.profile.plate_config.enemynpc.level_text_font end,
  9204. values = function() return DF:BuildDropDownFontList (on_select_enemy_level_text_font) end,
  9205. name = "Font",
  9206. desc = "Font of the text.",
  9207. },
  9208. --level text shadow
  9209. {
  9210. type = "toggle",
  9211. get = function() return Plater.db.profile.plate_config.enemynpc.level_text_shadow end,
  9212. set = function (self, fixedparam, value)
  9213. Plater.db.profile.plate_config.enemynpc.level_text_shadow = value
  9214. Plater.UpdateAllPlates()
  9215. end,
  9216. name = "Shadow",
  9217. desc = "If the text has a black outline.",
  9218. },
  9219. --level text alpha
  9220. {
  9221. type = "range",
  9222. get = function() return Plater.db.profile.plate_config.enemynpc.level_text_alpha end,
  9223. set = function (self, fixedparam, value)
  9224. Plater.db.profile.plate_config.enemynpc.level_text_alpha = value
  9225. Plater.UpdateAllPlates()
  9226. end,
  9227. min = 0,
  9228. max = 1,
  9229. step = 0.1,
  9230. name = "Alpha",
  9231. desc = "Set the transparency of the text.",
  9232. usedecimals = true,
  9233. },
  9234. --level anchor
  9235. {
  9236. type = "select",
  9237. get = function() return Plater.db.profile.plate_config.enemynpc.level_text_anchor.side end,
  9238. values = function() return build_anchor_side_table ("enemynpc", "level_text_anchor") end,
  9239. name = "Anchor",
  9240. desc = "Which side of the nameplate this widget is attach to.",
  9241. },
  9242. --level anchor x offset
  9243. {
  9244. type = "range",
  9245. get = function() return Plater.db.profile.plate_config.enemynpc.level_text_anchor.x end,
  9246. set = function (self, fixedparam, value)
  9247. Plater.db.profile.plate_config.enemynpc.level_text_anchor.x = value
  9248. Plater.UpdateAllPlates()
  9249. end,
  9250. min = -20,
  9251. max = 20,
  9252. step = 1,
  9253. name = "X Offset",
  9254. desc = "Slightly move the text horizontally.",
  9255. },
  9256. --level anchor x offset
  9257. {
  9258. type = "range",
  9259. get = function() return Plater.db.profile.plate_config.enemynpc.level_text_anchor.y end,
  9260. set = function (self, fixedparam, value)
  9261. Plater.db.profile.plate_config.enemynpc.level_text_anchor.y = value
  9262. Plater.UpdateAllPlates()
  9263. end,
  9264. min = -20,
  9265. max = 20,
  9266. step = 1,
  9267. name = "Y Offset",
  9268. desc = "Slightly move the text vertically.",
  9269. },
  9270.  
  9271. --plate order
  9272. {type = "blank"},
  9273. {type = "label", get = function() return "Plate Order:" end, text_template = DF:GetTemplate ("font", "ORANGE_FONT_TEMPLATE")},
  9274. {
  9275. type = "select",
  9276. get = function() return Plater.db.profile.plate_config.enemynpc.plate_order end,
  9277. values = function() return build_order_options ("enemynpc") end,
  9278. name = "Order",
  9279. desc = "How the health, cast and buff bars are ordered.\n\nFrom bottom (near the character head) to top.",
  9280. },
  9281.  
  9282. {type = "blank"},
  9283. {type = "label", get = function() return "Debuff Frame:" end, text_template = DF:GetTemplate ("font", "ORANGE_FONT_TEMPLATE")},
  9284. --y offset
  9285. {
  9286. type = "range",
  9287. get = function() return Plater.db.profile.plate_config.enemynpc.buff_frame_y_offset end,
  9288. set = function (self, fixedparam, value)
  9289. Plater.db.profile.plate_config.enemynpc.buff_frame_y_offset = value
  9290. Plater.UpdateAllPlates()
  9291. end,
  9292. min = -64,
  9293. max = 64,
  9294. step = 1,
  9295. name = "Y Offset",
  9296. desc = "Adjusts the position on the Y axis.",
  9297. },
  9298.  
  9299. {type = "breakline"},
  9300.  
  9301. --percent text
  9302. {type = "label", get = function() return "Health Percent Text:" end, text_template = DF:GetTemplate ("font", "ORANGE_FONT_TEMPLATE")},
  9303. --enabled
  9304. {
  9305. type = "toggle",
  9306. get = function() return Plater.db.profile.plate_config.enemynpc.percent_text_enabled end,
  9307. set = function (self, fixedparam, value)
  9308. Plater.db.profile.plate_config.enemynpc.percent_text_enabled = value
  9309. Plater.UpdateAllPlates()
  9310. end,
  9311. name = "Enabled",
  9312. desc = "Show the percent text.",
  9313. },
  9314. --out of combat
  9315. {
  9316. type = "toggle",
  9317. get = function() return Plater.db.profile.plate_config.enemynpc.percent_text_ooc end,
  9318. set = function (self, fixedparam, value)
  9319. Plater.db.profile.plate_config.enemynpc.percent_text_ooc = value
  9320.  
  9321. Plater.UpdateAllPlates()
  9322. end,
  9323. name = "Out of Combat",
  9324. desc = "Show the percent even when isn't in combat.",
  9325. },
  9326. --percent text size
  9327. {
  9328. type = "range",
  9329. get = function() return Plater.db.profile.plate_config.enemynpc.percent_text_size end,
  9330. set = function (self, fixedparam, value)
  9331. Plater.db.profile.plate_config.enemynpc.percent_text_size = value
  9332. Plater.UpdateAllPlates()
  9333. end,
  9334. min = 6,
  9335. max = 99,
  9336. step = 1,
  9337. name = "Size",
  9338. desc = "Size of the text.",
  9339. },
  9340. --percent text font
  9341. {
  9342. type = "select",
  9343. get = function() return Plater.db.profile.plate_config.enemynpc.percent_text_font end,
  9344. values = function() return DF:BuildDropDownFontList (on_select_enemy_percent_text_font) end,
  9345. name = "Font",
  9346. desc = "Font of the text.",
  9347. },
  9348. --percent text shadow
  9349. {
  9350. type = "toggle",
  9351. get = function() return Plater.db.profile.plate_config.enemynpc.percent_text_shadow end,
  9352. set = function (self, fixedparam, value)
  9353. Plater.db.profile.plate_config.enemynpc.percent_text_shadow = value
  9354. Plater.UpdateAllPlates()
  9355. end,
  9356. name = "Shadow",
  9357. desc = "If the text has a black outline.",
  9358. },
  9359. --pecent text color
  9360. {
  9361. type = "color",
  9362. get = function()
  9363. local color = Plater.db.profile.plate_config.enemynpc.percent_text_color
  9364. return {color[1], color[2], color[3], color[4]}
  9365. end,
  9366. set = function (self, r, g, b, a)
  9367. local color = Plater.db.profile.plate_config.enemynpc.percent_text_color
  9368. color[1], color[2], color[3], color[4] = r, g, b, a
  9369. Plater.UpdateAllPlates()
  9370. end,
  9371. name = "Color",
  9372. desc = "The color of the text.",
  9373. },
  9374. --percent text alpha
  9375. {
  9376. type = "range",
  9377. get = function() return Plater.db.profile.plate_config.enemynpc.percent_text_alpha end,
  9378. set = function (self, fixedparam, value)
  9379. Plater.db.profile.plate_config.enemynpc.percent_text_alpha = value
  9380. Plater.UpdateAllPlates()
  9381. end,
  9382. min = 0,
  9383. max = 1,
  9384. step = 0.1,
  9385. name = "Alpha",
  9386. desc = "Set the transparency of the text.",
  9387. usedecimals = true,
  9388. },
  9389. --percent anchor
  9390. {
  9391. type = "select",
  9392. get = function() return Plater.db.profile.plate_config.enemynpc.percent_text_anchor.side end,
  9393. values = function() return build_anchor_side_table ("enemynpc", "percent_text_anchor") end,
  9394. name = "Anchor",
  9395. desc = "Which side of the nameplate this widget is attach to.",
  9396. },
  9397. --percent anchor x offset
  9398. {
  9399. type = "range",
  9400. get = function() return Plater.db.profile.plate_config.enemynpc.percent_text_anchor.x end,
  9401. set = function (self, fixedparam, value)
  9402. Plater.db.profile.plate_config.enemynpc.percent_text_anchor.x = value
  9403. Plater.UpdateAllPlates()
  9404. end,
  9405. min = -20,
  9406. max = 20,
  9407. step = 1,
  9408. name = "X Offset",
  9409. desc = "Slightly move the text horizontally.",
  9410. },
  9411. --percent anchor x offset
  9412. {
  9413. type = "range",
  9414. get = function() return Plater.db.profile.plate_config.enemynpc.percent_text_anchor.y end,
  9415. set = function (self, fixedparam, value)
  9416. Plater.db.profile.plate_config.enemynpc.percent_text_anchor.y = value
  9417. Plater.UpdateAllPlates()
  9418. end,
  9419. min = -20,
  9420. max = 20,
  9421. step = 1,
  9422. name = "Y Offset",
  9423. desc = "Slightly move the text vertically.",
  9424. },
  9425. --health amount
  9426. {
  9427. type = "toggle",
  9428. get = function() return Plater.db.profile.plate_config.enemynpc.percent_show_health end,
  9429. set = function (self, fixedparam, value)
  9430. Plater.db.profile.plate_config.enemynpc.percent_show_health = value
  9431. Plater.UpdateAllPlates()
  9432. end,
  9433. name = "Show Health Amount",
  9434. desc = "Show Health Amount",
  9435. },
  9436.  
  9437. {type = "blank"},
  9438. {type = "label", get = function() return "Cast Time Text:" end, text_template = DF:GetTemplate ("font", "ORANGE_FONT_TEMPLATE")},
  9439. {
  9440. type = "toggle",
  9441. get = function() return Plater.db.profile.plate_config.enemynpc.spellpercent_text_enabled end,
  9442. set = function (self, fixedparam, value)
  9443. Plater.db.profile.plate_config.enemynpc.spellpercent_text_enabled = value
  9444. Plater.UpdateAllPlates()
  9445. end,
  9446. name = "Enabled",
  9447. desc = "Show the cast time progress.",
  9448. },
  9449. --cast time text
  9450. {
  9451. type = "range",
  9452. get = function() return Plater.db.profile.plate_config.enemynpc.spellpercent_text_size end,
  9453. set = function (self, fixedparam, value)
  9454. Plater.db.profile.plate_config.enemynpc.spellpercent_text_size = value
  9455. Plater.UpdateAllPlates()
  9456. end,
  9457. min = 6,
  9458. max = 99,
  9459. step = 1,
  9460. name = "Size",
  9461. desc = "Size of the text.",
  9462. },
  9463. --cast time text font
  9464. {
  9465. type = "select",
  9466. get = function() return Plater.db.profile.plate_config.enemynpc.spellpercent_text_font end,
  9467. values = function() return DF:BuildDropDownFontList (on_select_enemy_spellpercent_text_font) end,
  9468. name = "Font",
  9469. desc = "Font of the text.",
  9470. },
  9471. --cast time text shadow
  9472. {
  9473. type = "toggle",
  9474. get = function() return Plater.db.profile.plate_config.enemynpc.spellpercent_text_shadow end,
  9475. set = function (self, fixedparam, value)
  9476. Plater.db.profile.plate_config.enemynpc.spellpercent_text_shadow = value
  9477. Plater.UpdateAllPlates()
  9478. end,
  9479. name = "Shadow",
  9480. desc = "If the text has a black outline.",
  9481. },
  9482. --cast time text color
  9483. {
  9484. type = "color",
  9485. get = function()
  9486. local color = Plater.db.profile.plate_config.enemynpc.spellpercent_text_color
  9487. return {color[1], color[2], color[3], color[4]}
  9488. end,
  9489. set = function (self, r, g, b, a)
  9490. local color = Plater.db.profile.plate_config.enemynpc.spellpercent_text_color
  9491. color[1], color[2], color[3], color[4] = r, g, b, a
  9492. Plater.UpdateAllPlates()
  9493. end,
  9494. name = "Color",
  9495. desc = "The color of the text.",
  9496. },
  9497.  
  9498. --cast time anchor
  9499. {
  9500. type = "select",
  9501. get = function() return Plater.db.profile.plate_config.enemynpc.spellpercent_text_anchor.side end,
  9502. values = function() return build_anchor_side_table ("enemynpc", "spellpercent_text_anchor") end,
  9503. name = "Anchor",
  9504. desc = "Which side of the nameplate this widget is attach to.",
  9505. },
  9506. --cast time anchor x offset
  9507. {
  9508. type = "range",
  9509. get = function() return Plater.db.profile.plate_config.enemynpc.spellpercent_text_anchor.x end,
  9510. set = function (self, fixedparam, value)
  9511. Plater.db.profile.plate_config.enemynpc.spellpercent_text_anchor.x = value
  9512. Plater.UpdateAllPlates()
  9513. end,
  9514. min = -20,
  9515. max = 20,
  9516. step = 1,
  9517. name = "X Offset",
  9518. desc = "Slightly move the text horizontally.",
  9519. },
  9520. --cast time anchor x offset
  9521. {
  9522. type = "range",
  9523. get = function() return Plater.db.profile.plate_config.enemynpc.spellpercent_text_anchor.y end,
  9524. set = function (self, fixedparam, value)
  9525. Plater.db.profile.plate_config.enemynpc.spellpercent_text_anchor.y = value
  9526. Plater.UpdateAllPlates()
  9527. end,
  9528. min = -20,
  9529. max = 20,
  9530. step = 1,
  9531. name = "Y Offset",
  9532. desc = "Slightly move the text vertically.",
  9533. },
  9534.  
  9535. {type = "breakline"},
  9536.  
  9537. {type = "label", get = function() return "Quest Color:" end, text_template = DF:GetTemplate ("font", "ORANGE_FONT_TEMPLATE")},
  9538. --enabled
  9539. {
  9540. type = "toggle",
  9541. get = function() return Plater.db.profile.plate_config.enemynpc.quest_enabled end,
  9542. set = function (self, fixedparam, value)
  9543. Plater.db.profile.plate_config.enemynpc.quest_enabled = value
  9544. Plater.UpdateAllPlates()
  9545. end,
  9546. name = "Enabled",
  9547. desc = "Nameplates for objectives mobs, now have a new color.",
  9548. },
  9549. {
  9550. type = "color",
  9551. get = function()
  9552. local color = Plater.db.profile.plate_config.enemynpc.quest_color_enemy
  9553. return {color[1], color[2], color[3], color[4]}
  9554. end,
  9555. set = function (self, r, g, b, a)
  9556. local color = Plater.db.profile.plate_config.enemynpc.quest_color_enemy
  9557. color[1], color[2], color[3], color[4] = r, g, b, a
  9558. Plater.UpdateAllPlates()
  9559. end,
  9560. name = "Hostile Npc",
  9561. desc = "Nameplate has this color when a hostile mob is a quest objective.",
  9562. },
  9563. {
  9564. type = "color",
  9565. get = function()
  9566. local color = Plater.db.profile.plate_config.enemynpc.quest_color_neutral
  9567. return {color[1], color[2], color[3], color[4]}
  9568. end,
  9569. set = function (self, r, g, b, a)
  9570. local color = Plater.db.profile.plate_config.enemynpc.quest_color_neutral
  9571. color[1], color[2], color[3], color[4] = r, g, b, a
  9572. Plater.UpdateAllPlates()
  9573. end,
  9574. name = "Neutral Npc",
  9575. desc = "Nameplate has this color when a neutral mob is a quest objective.",
  9576. },
  9577. }
  9578. DF:BuildMenu (enemyNPCsFrame, options_table2, startX, startY, heightSize, true, options_text_template, options_dropdown_template, options_switch_template, true, options_slider_template, options_button_template)
  9579.  
  9580. end
  9581.  
  9582. --update class color
  9583. function Plater.UpdateUnitColor (self, unit)
  9584.  
  9585. end
  9586.  
  9587.  
  9588. --[[
  9589. {
  9590. type = "toggle",
  9591. get = function() return Plater.CanShowPlateFor (ACTORTYPE_FRIENDLY_PLAYER) end,
  9592. set = function (self, fixedparam, value)
  9593. Plater.SetShowActorType (ACTORTYPE_FRIENDLY_PLAYER, value)
  9594. Plater.UpdateAllPlates()
  9595. end,
  9596. name = "Friendly Players",
  9597. desc = "Show nameplate for friendly players.\n\n|cFFFFFF00Important|r: This option is dependent on the client`s nameplate state (on/off).\n\n|cFFFFFF00Important|r: when disabled but enabled on the client through (" .. (GetBindingKey ("FRIENDNAMEPLATES") or "") .. ") the healthbar isn't visible but the nameplate is still clickable.",
  9598. },
  9599. {
  9600. type = "toggle",
  9601. get = function() return Plater.CanShowPlateFor (ACTORTYPE_ENEMY_PLAYER) end,
  9602. set = function (self, fixedparam, value)
  9603. Plater.SetShowActorType (ACTORTYPE_ENEMY_PLAYER, value)
  9604. Plater.UpdateAllPlates()
  9605. end,
  9606. name = "Enemy Players",
  9607. desc = "Show nameplate for enemy players.\n\n|cFFFFFF00Important|r: This option is dependent on the client`s nameplate state (on/off).\n\n|cFFFFFF00Important|r: when disabled but enabled on the client through (" .. (GetBindingKey ("NAMEPLATES") or "") .. ") the healthbar isn't visible but the nameplate is still clickable.",
  9608. },
  9609. --]]
  9610. --[[
  9611. {
  9612. type = "toggle",
  9613. get = function() return Plater.CanShowPlateFor (ACTORTYPE_ENEMY_NPC) end,
  9614. set = function (self, fixedparam, value)
  9615. Plater.SetShowActorType (ACTORTYPE_ENEMY_NPC, value)
  9616. Plater.UpdateAllPlates()
  9617. end,
  9618. name = "Enemy Npc",
  9619. desc = "Show nameplate for enemy npcs.\n\n|cFFFFFF00Important|r: This option is dependent on the client`s nameplate state (on/off).\n\n|cFFFFFF00Important|r: when disabled but enabled on the client through (" .. (GetBindingKey ("NAMEPLATES") or "") .. ") the healthbar isn't visible but the nameplate is still clickable.",
  9620. },
  9621. --]]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement