Advertisement
Guest User

cursor fix

a guest
Oct 27th, 2016
115
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 19.46 KB | None | 0 0
  1. I combined a lot of the comments to get things working better. However, the preview graphic in the config page is still broken. Perhaps some of these changes can be integrated into the next release if they work for most people.
  2.  
  3. Instructions:
  4. Locate and open _Cursor.lua in NotePad, then copy and paste the code below, replacing everything currently in that file. Save the file, then run WoW or do /reload if it is currently running.
  5.  
  6. --DJU: Sep 14, 2016 - Fixed scale/offset bug.
  7. -- - Fixed "GetModel is nil" bug.
  8. -- - Hid the cursor during mouse look (while right mouse button held).
  9. -- - Note: The preview graphic on the configuration page is still broken.
  10. -- (Search for "DJU" to see all my changes.)
  11.  
  12. -------------------------------------------------------------------------------
  13. -- Localized Lua globals.
  14. -------------------------------------------------------------------------------
  15. local _G = getfenv(0)
  16.  
  17. -- Functions
  18. local next = _G.next
  19. local pairs = _G.pairs
  20. local tonumber = _G.tonumber
  21. local type = _G.type
  22.  
  23. -- Libraries
  24. local table = _G.table
  25.  
  26. -------------------------------------------------------------------------------
  27. -- AddOn namespace.
  28. -------------------------------------------------------------------------------
  29. local FOLDER_NAME = ...
  30. local Version = GetAddOnMetadata(FOLDER_NAME, "Version"):match("^([%d.]+)")
  31. _CursorOptions = nil
  32. _CursorOptionsCharacter = {
  33. Cursors = {},
  34. Version = Version
  35. }
  36.  
  37. local L = _CursorLocalization
  38. local _Cursor = CreateFrame("Frame", "_Cursor")
  39.  
  40. -------------------------------------------------------------------------------
  41. -- Variables
  42. -------------------------------------------------------------------------------
  43. local ActiveModels = {}
  44. local InactiveModels = {}
  45.  
  46. -------------------------------------------------------------------------------
  47. -- Constants
  48. -------------------------------------------------------------------------------
  49. _Cursor.DefaultModelSet = L.SETS["Energy beam"]
  50. _Cursor.DefaultType = ""
  51. _Cursor.DefaultValue = "spells\\errorcube" -- Used when cursor preset not found
  52. _Cursor.ScaleDefault = 0.01 -- Baseline scaling factor applied before presets and custom scales
  53.  
  54. -- Set strings formatted as follows:
  55. -- "Name|[Enabled]|Strata|[Type]|Value[|Scale][|Facing][|X][|Y]"
  56. _Cursor.DefaultSets = {
  57. [L.SETS["Energy beam"]] = {
  58. -- Energy/lightning trail
  59. L.CURSORS["Layer 1"] .. "|1|TOOLTIP|Trail|Electric, blue",
  60. L.CURSORS["Layer 2"] .. "|1|FULLSCREEN_DIALOG|Particle|Fire, blue",
  61. L.CURSORS["Layer 3"] .. "||FULLSCREEN_DIALOG"
  62. },
  63. [L.SETS["Shadow trail"]] = {
  64. -- Cloudy shadow trail
  65. L.CURSORS["Layer 1"] .. "|1|TOOLTIP|Trail|Shadow|0.5",
  66. L.CURSORS["Layer 2"] .. "|1|FULLSCREEN_DIALOG|Particle|Shadow cloud",
  67. L.CURSORS["Layer 3"] .. "||FULLSCREEN_DIALOG",
  68. },
  69. [L.SETS["Face Melter (Warning, bright!)"]] = {
  70. -- Large red blowtorch
  71. L.CURSORS["Laser"] .. "|1|LOW||spells\\cthuneeyeattack|1.5|.4|32|13",
  72. L.CURSORS["Heat"] .. "|1|BACKGROUND||spells\\deathanddecay_area_base",
  73. L.CURSORS["Smoke"] .. "|1|BACKGROUND||spells\\sandvortex_state_base",
  74. }
  75. }
  76.  
  77. -- Preset strings formatted as follows:
  78. -- "Path[|Scale][|Facing][|X][|Y]"
  79. _Cursor.Presets = {
  80. ["Glow"] = {
  81. ["Burning cloud, blue"] = "spells\\manafunnel_impact_chest|||4|-6",
  82. ["Burning cloud, green"] = "spells\\lifetap_state_chest|||4|-6",
  83. ["Burning cloud, purple"] = "spells\\soulfunnel_impact_chest|1|0|4|-6",
  84. ["Burning cloud, red"] = "spells\\healrag_state_chest|||4|-6",
  85. ["Cloud, black & blue"] = "spells\\enchantments\\soulfrostglow_high|4||8|-7",
  86. ["Cloud, blue"] = "spells\\enchantments\\spellsurgeglow_high|6||10|-8",
  87. ["Cloud, bright purple"] = "spells\\gouge_precast_state_hand|2.4||11|-9",
  88. ["Cloud, corruption"] = "spells\\seedofcorruption_state|.9||9|-8",
  89. ["Cloud, dark blue"] = "spells\\summon_precast_hand|2.7||9|-8",
  90. ["Cloud, executioner"] = "spells\\enchantments\\disintigrateglow_high|4||8|-7",
  91. ["Cloud, fire"] = "spells\\enchantments\\sunfireglow_high|5||10|-8",
  92. ["Cloud, frost"] = "spells\\icyenchant_high|8||8|-8",
  93. ["Ring, bloodlust"] = "spells\\bloodlust_state_hand|2.6||9|-8",
  94. ["Ring, bones"] = "spells\\bonearmor_state_chest|.8||12|-9",
  95. ["Ring, holy"] = "spells\\holy_precast_high_base|.8||9|-9",
  96. ["Ring, pulse blue"] = "spells\\brillianceaura|.8||8|-8",
  97. ["Ring, frost"] = "spells\\ice_precast_high_hand|1.9||11|-9",
  98. ["Ring, vengeance"] = "spells\\vengeance_state_hand|2||9|-8",
  99. ["Simple, black"] = "spells\\shadowmissile|2||5|-6",
  100. ["Simple, green"] = "spells\\nature_precast_chest|||8|-8",
  101. ["Simple, white"] = "spells\\enchantments\\whiteflame_low|4|5.3|10|-8",
  102. ["Weather, lightning"] = "spells\\goblin_weather_machine_lightning|1.3||10|-11",
  103. ["Weather, sun"] = "spells\\goblin_weather_machine_sunny|1.5|2.1|11|-9",
  104. ["Weather, snow"] = "spells\\goblin_weather_machine_snow|1.5|2.1|11|-9",
  105. ["Weather, cloudy"] = "spells\\goblin_weather_machine_cloudy|1.5|2.1|11|-9",
  106. },
  107. ["Particle"] = {
  108. ["Dust, arcane"] = "spells\\arcane_form_precast|1.1|.7|9|-11",
  109. ["Dust, embers"] = "spells\\fire_form_precast|1.1|.7|9|-11",
  110. ["Dust, holy"] = "spells\\holy_form_precast|1.1|.7|9|-11",
  111. ["Dust, ice shards"] = "spells\\frost_form_precast|1.1|.7|9|-11",
  112. ["Dust, shadow"] = "spells\\shadow_form_precast|1.1|.7|9|-11",
  113. ["Fire"] = "spells\\demolisher_missile||2.2|11|-11",
  114. ["Fire, blue"] = "spells\\fire_blue_precast_uber_hand|||6|-8",
  115. ["Fire, fel"] = "spells\\fel_fire_precast_hand|||6|-8",
  116. ["Fire, orange"] = "spells\\fire_precast_uber_hand|1.5||4|-6",
  117. ["Fire, periodic red & blue"] = "spells\\incinerate_impact_base|.8||11|-10",
  118. ["Fire, wavy purple"] = "spells\\incinerateblue_low_base|.25|2.3|11|-10",
  119. ["Frost"] = "spells\\ice_precast_low_hand|2.5||8|-7",
  120. ["Lava burst"] = "spells\\shaman_lavaburst_missile|.8||9|-7",
  121. ["Leaves"] = "spells\\nature_form_precast|2.5|1|13|-11",
  122. ["Periodic glint"] = "spells\\enchantments\\sparkle_a|4",
  123. ["Plague cloud"] = "spells\\forsakencatapult_missile|1.5|2.3|10|-10",
  124. ["Shadow cloud"] = "spells\\cripple_state_chest|.5||8|-8",
  125. ["Spark, small white"] = "spells\\dispel_low_recursive|4",
  126. ["Spark, small blue"] = "spells\\detectmagic_recursive|4",
  127. ["Sparks, periodic healing"] = "spells\\lifebloom_state|||8|-8",
  128. ["Sparks, red"] = "spells\\immolationtrap_recursive|4",
  129. },
  130. ["Trail"] = {
  131. ["Blue"] = "spells\\beartrap|.9||5|-6",
  132. ["Electric, blue long"] = "spells\\lightningboltivus_missile|.1||4|-6",
  133. ["Electric, blue"] = "spells\\lightning_precast_low_hand|||4|-6",
  134. ["Electric, green"] = "spells\\lightning_fel_precast_low_hand|||4|-6",
  135. ["Electric, yellow"] = "spells\\wrath_precast_hand|1.5||4|-6",
  136. ["First-aid"] = "spells\\firstaid_hand|2||4|-6",
  137. ["Freedom"] = "spells\\blessingoffreedom_state|.4||8|-8",
  138. ["Ghost"] = "spells\\zig_missile|.7|1|8|-5",
  139. ["Holy bright"] = "spells\\holy_missile_uber|.9||11|-9",
  140. ["Long blue & holy glow"] = "spells\\alliancectfflag_spell|.9|2.3|1|-2",
  141. ["Shadow"] = "spells\\shadow_precast_uber_hand|||4|-6",
  142. ["Souls, small"] = "spells\\soulshatter_missile|1.7||5|-6",
  143. ["Souls"] = "spells\\wellofsouls_base|.5||9|-8",
  144. ["Sparkling, blue"] = "spells\\intervenetrail||2.4|7|-7",
  145. ["Sparkling, light green"] = "spells\\sprint_impact_chest|1.3|.8|3|-4",
  146. ["Sparkling, red"] = "spells\\chargetrail||2.4",
  147. ["Sparkling, white"] = "spells\\ribbontrail",
  148. ["Swirling, black"] = "spells\\shadow_impactdd_med_base|.5||5|-6",
  149. ["Swirling, blood"] = "spells\\bloodbolt_chest|.5||5|-6",
  150. ["Swirling, blue"] = "spells\\banish_chest_blue|.5||11|-9",
  151. ["Swirling, holy"] = "spells\\holy_precast_uber_hand|||5|-6",
  152. ["Swirling, nature"] = "spells\\rejuvenation_impact_base|.35||5|-6",
  153. ["Swirling, poison"] = "spells\\banish_chest|.5||11|-9",
  154. ["Swirling, purple"] = "spells\\banish_chest_purple|.5||11|-9",
  155. ["Swirling, shadow"] = "spells\\banish_chest_dark|.5||11|-9",
  156. ["Swirling, white"] = "spells\\banish_chest_white|.5||11|-9",
  157. ["Swirling, yellow"] = "spells\\banish_chest_yellow|.5||11|-9",
  158. },
  159. ["Breath"] = {
  160. ["Arcane"] = "spells\\dragonbreath_arcane|.25|5.4",
  161. ["Fire. blue"] = "spells\\dragonbreath_frost|.25|5.4",
  162. ["Fire, fel"] = "spells\\fel_flamebreath|.5|5.5",
  163. ["Fire, purple"] = "spells\\dragonbreath_shadow|.25|5.4",
  164. ["Fire, red"] = "spells\\dragonbreath_fire|.25|5.4",
  165. ["Frost"] = "spells\\flamebreath_blue|.5|5.5",
  166. ["Frostfire"] = "spells\\flamebreathmff|.5|5.5",
  167. ["Smoke"] = "spells\\corrosivesandbreath|.5|5.5",
  168. }
  169. }
  170.  
  171. -------------------------------------------------------------------------------
  172. -- Helpers
  173. -------------------------------------------------------------------------------
  174. local AddHideCondition, RemoveHideCondition
  175. do
  176. local ActiveHideConditions = {}
  177.  
  178. function AddHideCondition(conditionName)
  179. if not ActiveHideConditions[conditionName] then
  180. ActiveHideConditions[conditionName] = true
  181. _Cursor:Hide()
  182. end
  183. end
  184.  
  185. function RemoveHideCondition(conditionName)
  186. if ActiveHideConditions[conditionName] then
  187. ActiveHideConditions[conditionName] = nil
  188.  
  189. if next(ActiveHideConditions) == nil then
  190. _Cursor:Show()
  191. end
  192. end
  193. end
  194. end
  195.  
  196. local function DisableModel(model)
  197. if not ActiveModels[model] then
  198. return
  199. end
  200. ActiveModels[model] = nil
  201. InactiveModels[model] = true
  202.  
  203. model.X = nil
  204. model.Y = nil
  205. model:Hide()
  206. model:ClearModel()
  207. end
  208.  
  209. local function EnableModel(model, cursorData)
  210. if ActiveModels[model] then
  211. DisableModel(model)
  212. end
  213. InactiveModels[model] = nil
  214. ActiveModels[model] = cursorData
  215.  
  216. local cursor = ActiveModels[model]
  217. local scale = (cursor.Scale or 1.0) * _Cursor.ScaleDefault
  218. local facing = cursor.Facing or 0
  219.  
  220. model.X = cursor.X or 0
  221. model.Y = cursor.Y or 0
  222.  
  223. if #cursor.Type == 0 then -- Custom
  224. model:SetModel(cursor.Value .. ".mdx")
  225. else
  226. local presetType = _Cursor.Presets[cursor.Type]
  227.  
  228. if not presetType or not presetType[cursor.Value] then
  229. cursor.Type = _Cursor.DefaultType
  230. cursor.Value = _Cursor.DefaultValue
  231. presetType = _Cursor.Presets[cursor.Type]
  232. end
  233.  
  234. local path, scalePreset, facingPreset, x, y = ("|"):split(presetType[cursor.Value])
  235. model:SetModel(path .. ".mdx")
  236. model.X = model.X + (tonumber(x) or 0)
  237. model.Y = model.Y + (tonumber(y) or 0)
  238.  
  239. scale = scale * (tonumber(scalePreset) or 1.0)
  240. facing = facing + (tonumber(facingPreset) or 0)
  241. end
  242.  
  243. model:SetModelScale(scale)
  244. model:SetFacing(facing)
  245. model:SetFrameStrata(cursor.Strata)
  246. model:Show()
  247. end
  248.  
  249. -------------------------------------------------------------------------------
  250. -- Events
  251. -------------------------------------------------------------------------------
  252. _Cursor:RegisterEvent("ADDON_LOADED")
  253. _Cursor:RegisterEvent("CINEMATIC_START")
  254. _Cursor:RegisterEvent("CINEMATIC_STOP")
  255. _Cursor:RegisterEvent("SCREENSHOT_FAILED")
  256. _Cursor:RegisterEvent("SCREENSHOT_SUCCEEDED")
  257.  
  258. function _Cursor:SCREENSHOT_FAILED()
  259. RemoveHideCondition("Screenshot")
  260. end
  261.  
  262. _Cursor.SCREENSHOT_SUCCEEDED = _Cursor.SCREENSHOT_FAILED
  263.  
  264. function _Cursor:CINEMATIC_START()
  265. AddHideCondition("Cinematic")
  266. end
  267.  
  268. function _Cursor:CINEMATIC_STOP()
  269. RemoveHideCondition("Cinematic")
  270. end
  271.  
  272. do
  273. local function VersionCompare(Version1, Version2) -- Compares delimited version strings
  274. if Version1 == Version2 then
  275. return 0
  276. end
  277.  
  278. Version1 = {
  279. ("."):split(Version1 or "")
  280. }
  281.  
  282. Version2 = {
  283. ("."):split(Version2 or "")
  284. }
  285.  
  286. for index, Sub1 in ipairs(Version1) do
  287. local Sub2 = Version2[index]
  288. if not Sub2 or Sub1 > Sub2 then
  289. return 1
  290. elseif Sub1 < Sub2 then
  291. return -1
  292. end
  293. end
  294. return #Version1 - #Version2
  295. end
  296.  
  297. function _Cursor:ADDON_LOADED(_, addonName)
  298. if addonName:lower() ~= FOLDER_NAME:lower() then
  299. return
  300. end
  301.  
  302. _Cursor:UnregisterEvent("ADDON_LOADED")
  303. _Cursor.ADDON_LOADED = nil
  304.  
  305. if not _CursorOptions then
  306. _CursorOptions = {
  307. Sets = CopyTable(_Cursor.DefaultSets)
  308. }
  309. end
  310.  
  311. if _CursorOptions.Version ~= Version then
  312. if VersionCompare(_CursorOptions.Version, "3.1.0.2") < 0 then -- 3.1.0.2: Updated the Face Melter preset
  313. local Name = L.SETS["Face Melter (Warning, bright!)"]
  314.  
  315. if _CursorOptions.Sets[Name] then
  316. _CursorOptions.Sets[Name] = CopyTable(_Cursor.DefaultSets[Name])
  317. end
  318. end
  319.  
  320. _CursorOptions.Version = Version
  321. end
  322.  
  323. _CursorOptionsCharacter.Version = Version
  324.  
  325. if not _CursorOptionsCharacter.Cursors[1] then
  326. _Cursor.LoadSet(_Cursor.DefaultSets[_Cursor.DefaultModelSet])
  327. else
  328. _Cursor:UpdateModels()
  329.  
  330. if _Cursor.Options then
  331. _Cursor.Options.Update()
  332. end
  333. end
  334. end
  335. end
  336.  
  337. -------------------------------------------------------------------------------
  338. -- Hooks.
  339. -------------------------------------------------------------------------------
  340. -- Hide during screenshots
  341. _G.hooksecurefunc("Screenshot", function()
  342. AddHideCondition("Screenshot")
  343. end)
  344.  
  345. -- Hide while FMV movies play
  346. _G.MovieFrame:HookScript("OnShow", function()
  347. AddHideCondition("Movie") -- FMV movie sequence, like the Wrathgate cinematic
  348. end)
  349.  
  350. _G.MovieFrame:HookScript("OnHide", function()
  351. RemoveHideCondition("Movie")
  352. end)
  353.  
  354. -- Hook camera movement to hide cursor effects
  355. --_G.hooksecurefunc("CameraOrSelectOrMoveStart", function()
  356. -- AddHideCondition("Camera")
  357. --end)
  358. --
  359. --_G.hooksecurefunc("CameraOrSelectOrMoveStop", function()
  360. -- RemoveHideCondition("Camera")
  361. --end)
  362.  
  363. -------------------------------------------------------------------------------
  364. -- Scripts.
  365. -------------------------------------------------------------------------------
  366.  
  367. --DJU uncommented:
  368. do
  369. local UPDATE_INTERVAL = 0.250 --DJU changed (was 1)
  370.  
  371. local TotalElapsed = 0
  372. local IsMouselooking = _G.IsMouselooking
  373.  
  374. _G.CreateFrame("Frame"):SetScript("OnUpdate", function(self, elapsed)
  375. TotalElapsed = TotalElapsed + elapsed
  376.  
  377. if TotalElapsed >= UPDATE_INTERVAL then
  378. TotalElapsed = 0
  379.  
  380. if IsMouselooking() then
  381. AddHideCondition("Mouselook")
  382. else
  383. RemoveHideCondition("Mouselook")
  384. end
  385. end
  386. end)
  387. end
  388. --DJU^
  389.  
  390. _Cursor:SetScript("OnEvent", function(self, eventName, ...)
  391. return self[eventName](self, eventName, ...)
  392. end)
  393.  
  394. _Cursor:SetScript("OnShow", function()
  395. for model in pairs(ActiveModels) do
  396. if model.GetModel then --DJU added.
  397. local path = model:GetModel() -- Returns model table if unset
  398.  
  399. if type(path) == "string" then
  400. model:SetModel(path)
  401. end
  402. end --DJU added.
  403. end
  404. end)
  405.  
  406. --[[DJU removed:
  407. do
  408. local GetCursorPosition = _G.GetCursorPosition
  409. -- local hypotenuse = (_G.GetScreenWidth() ^ 2 + _G.GetScreenHeight() ^ 2) ^ 0.5 * _G.UIParent:GetEffectiveScale()
  410. local hypotenuse = (_G.GetScreenWidth() ^ 0.5 + _G.GetScreenHeight() ^ 0.5) * _G.UIParent:GetEffectiveScale()
  411. local previousX, previousY
  412.  
  413. _Cursor:SetScript("OnUpdate", function(self, elapsed)
  414. local cursorX, cursorY = GetCursorPosition()
  415.  
  416. if cursorX == previousX and cursorY == previousY then
  417. return
  418. end
  419.  
  420. for model in pairs(ActiveModels) do
  421. model:SetPosition((cursorX + model.X) / hypotenuse, (cursorY + model.Y) / hypotenuse, 0)
  422. end
  423.  
  424. previousX = cursorX
  425. previousY = cursorY
  426. end)
  427. end
  428. ]]
  429.  
  430. --DJU added (from blog posts):
  431. do
  432. local GetCursorPosition = _G.GetCursorPosition
  433.  
  434. --This is the maximum position that the cursor can have in the vertical dimension.
  435. local cursorYRange = 768
  436. --This is the maximum position that the effect can have in the vertical dimension.
  437. local effectYRange = 60
  438. --"scale" allows us to convert between the cursor space and the effect space.
  439. local scale = cursorYRange / effectYRange
  440. local previousX, previousY
  441.  
  442. _Cursor:SetScript("OnUpdate", function(self, elapsed)
  443. local cursorX, cursorY = GetCursorPosition()
  444. if cursorX == previousX and cursorY == previousY then
  445. return
  446. end
  447.  
  448. for model in pairs(ActiveModels) do
  449. -- ...Even the offsets are offset?
  450. local offsetX = model.X - 6 -- DJU changed (was 11).
  451. local offsetY = model.Y + 6 -- DJU changed (was 9).
  452.  
  453. --Getting the effect size and removing the default that was applied earlier.
  454. --This makes it so that changing the size of the effect doesn't shift it.
  455. local cursorScale = model:GetModelScale() / _Cursor.ScaleDefault
  456.  
  457. --Converting the cursor position into effect space.
  458. local posX = (cursorX + offsetX) / scale / cursorScale
  459. local posY = (cursorY + offsetY) / scale / cursorScale
  460. model:SetPosition(posX, posY, 0)
  461. end
  462.  
  463. previousX = cursorX
  464. previousY = cursorY
  465. end)
  466. end
  467. --DJU^
  468.  
  469.  
  470. --[[****************************************************************************
  471. * Function: _Cursor.LoadSet *
  472. * Description: Unpacks a set into the current settings. *
  473. ****************************************************************************]]
  474. do
  475. local tempCursors = {}
  476.  
  477. function _Cursor.LoadSet(set)
  478. local cursors = _CursorOptionsCharacter.Cursors
  479.  
  480. -- Unload tables
  481. for index = 1, #cursors do
  482. local cursor = cursors[index]
  483. cursors[index] = nil
  484. tempCursors[cursor] = true
  485. end
  486.  
  487. -- Unpack new data
  488. for index = 1, #set do
  489. local cursorData = set[index]
  490. local cursor = next(tempCursors) or {}
  491. tempCursors[cursor] = nil
  492.  
  493. cursor.Name, cursor.Enabled, cursor.Strata, cursor.Type, cursor.Value, cursor.Scale, cursor.Facing, cursor.X, cursor.Y = ("|"):split(cursorData)
  494. cursor.Enabled = #cursor.Enabled > 0
  495. cursor.Type = cursor.Type or ""
  496. cursor.Value = cursor.Value or ""
  497. cursor.Scale = tonumber(cursor.Scale)
  498. cursor.Facing = tonumber(cursor.Facing)
  499. cursor.X = tonumber(cursor.X)
  500. cursor.Y = tonumber(cursor.Y)
  501. cursors[index] = cursor
  502. end
  503.  
  504. _Cursor:UpdateModels()
  505.  
  506. if _Cursor.Options then
  507. _Cursor.Options.Update()
  508. end
  509. end
  510. end
  511.  
  512. --[[****************************************************************************
  513. * Function: _Cursor.SaveSet *
  514. * Description: Packs a set from the current settings. *
  515. ****************************************************************************]]
  516. function _Cursor.SaveSet(set)
  517. table.wipe(set)
  518.  
  519. local cursors = _CursorOptionsCharacter.Cursors
  520. for index = 1, #cursors do
  521. local cursorData = cursors[index]
  522.  
  523. set[index] = ("|"):join(cursorData.Name, cursorData.Enabled and 1 or "",
  524. cursorData.Strata, cursorData.Type, cursorData.Value, cursorData.Scale or "",
  525. cursorData.Facing or "", cursorData.X or "", cursorData.Y or ""):gsub("|+$", "")
  526. end
  527. end
  528.  
  529. do
  530. local ModelStrataLevels = {
  531. BACKGROUND = 0,
  532. LOW = 0,
  533. MEDIUM = 0,
  534. HIGH = 0,
  535. DIALOG = 0,
  536. FULLSCREEN = 0,
  537. FULLSCREEN_DIALOG = 0,
  538. TOOLTIP = 0
  539. }
  540.  
  541. function _Cursor:UpdateModels()
  542. for Model in pairs(ActiveModels) do
  543. DisableModel(Model)
  544. end
  545.  
  546. for strataName in pairs(ModelStrataLevels) do
  547. ModelStrataLevels[strataName] = 0
  548. end
  549. local cursors = _CursorOptionsCharacter.Cursors
  550.  
  551. for index = 1, #cursors do
  552. local cursorData = cursors[index]
  553.  
  554. if cursorData.Enabled then
  555. local model = next(InactiveModels)
  556.  
  557. if not model then
  558. model = _G.CreateFrame("Model", "CursorModel" .. index, self)
  559. model:SetAllPoints(nil) -- Fullscreen
  560. model:Hide()
  561. -- model:SetLight(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1) -- Allows trails like warriors' intervene to work
  562. end
  563. EnableModel(model, cursorData)
  564.  
  565. local strataLevel = ModelStrataLevels[cursorData.Strata] + 1
  566. ModelStrataLevels[cursorData.Strata] = strataLevel
  567. model:SetFrameLevel(strataLevel)
  568. end
  569. end
  570. end
  571. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement