Advertisement
Guest User

UI6playerHUD.lua

a guest
Nov 2nd, 2022
457
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 18.21 KB | Source Code | 0 0
  1. local math_ceil                 = math.ceil
  2. local math_floor                = math.floor
  3. local math_random               = math.random
  4.  
  5. local iconScale                 = 0.5
  6.  
  7. local COMBAT_TITLE              = "UI6: BarHPinCombat"
  8.  
  9. local LEFT_LABEL                = "LT"
  10. local RIGHT_LABEL               = "RT"
  11. local BARNAME                   = "UI6: Bar"
  12.  
  13. local PLAYER_HPFILL             = "UI6: BarHPFill"
  14.  
  15. local OVERHEAD                  = "Overhead"
  16.  
  17. local BAR_WIDTH                 = 128
  18. local BAR_HEIGHT                = 16
  19.  
  20. local PREVIOUS_FRIENDLY_ID      = 1
  21. local PREVIOUS_HOSTILE_ID       = 1
  22.  
  23. local function decimals(number, decimals)
  24.     local power = 10^decimals
  25.     return math_floor(number * power) / power
  26. end
  27.  
  28. --[[
  29. local function GetCareer()
  30.     local type
  31.     local min
  32.     local max
  33.         -- 102 - WL, 27 - SH, 67 - Mag, 23 - Eng
  34.     if GameData.Player.career.id == 102 or GameData.Player.career.id == 27 or GameData.Player.career.id == 67 or GameData.Player.career.id == 23 then
  35.         type    = "pet"
  36.         min     = 0
  37.         max     = 100
  38.         --BO AND SM
  39.     elseif GameData.Player.career.id == 24 or GameData.Player.career.id == 100 then
  40.         type    = "stance"
  41.         min     = 1
  42.         max     = 3
  43.         -- CHOSEN AND KNIGHT
  44.     elseif GameData.Player.career.id == 64 or GameData.Player.career.id == 61 then
  45.         type    = "none"
  46.         min     = 0
  47.         max     = 0
  48.         -- WH AND WE
  49.     elseif GameData.Player.career.id == 60 or GameData.Player.career.id == 105 then
  50.         type    = "combo"
  51.         min     = 1
  52.         max     = 4
  53.         -- BW AND SORC
  54.     elseif GameData.Player.career.id == 62 or GameData.Player.career.id == 107 then
  55.         type    = "combustion"
  56.         min     = 1
  57.         max     = 4
  58.         -- WARRIOR P AND DOK
  59.     elseif GameData.Player.career.id == 63 or GameData.Player.career.id == 106 then
  60.         type    = "prayer"
  61.         min     = 1
  62.         max     = 4
  63.         -- SHAMMY AND AM
  64.     elseif GameData.Player.career.id == 103 or GameData.Player.career.id == 26 then
  65.         type    = "coin"
  66.         min     = 1
  67.         max     = 4
  68.         -- IB AND BG
  69.     elseif GameData.Player.career.id == 20 or GameData.Player.career.id == 104 then
  70.         type    = "hate"
  71.         min     = 1
  72.         max     = 4
  73.         -- ZEALOT AND RP
  74.     elseif GameData.Player.career.id == 22 or GameData.Player.career.id == 66 then
  75.         type    = "dunno"
  76.         min     = 1
  77.         max     = 4
  78.         -- SLAYER AND CHOP CHOPS
  79.     elseif GameData.Player.career.id == 25 or GameData.Player.career.id == 21 then
  80.         type    = "rage"
  81.         min     = 1
  82.         max     = 4
  83.         -- MAU AND SW
  84.     elseif GameData.Player.career.id == 65 or GameData.Player.career.id == 101 then
  85.         type    = "stance"
  86.         min     = 1
  87.         max     = 4
  88.     else
  89.         d("ERROR: what class?")
  90.         return
  91.     end
  92.     max = CareerResourceData:GetMaximum() or nil
  93.     d(max)
  94.     return type, min, max      
  95. end
  96. ]]--
  97.  
  98. function UI6.registerplayerHUD()
  99.     d("REGISTER")
  100.     UI6.drawplayerHUD() -- <-- can't do some of these things while loading
  101.     RegisterEventHandler(SystemData.Events.PLAYER_CUR_HIT_POINTS_UPDATED,           "UI6.updateHP")
  102.     RegisterEventHandler(SystemData.Events.PLAYER_MAX_HIT_POINTS_UPDATED,           "UI6.updateHP")
  103.     RegisterEventHandler(SystemData.Events.PLAYER_DEATH,                            "UI6.updateHP")
  104.     RegisterEventHandler(SystemData.Events.PLAYER_CUR_ACTION_POINTS_UPDATED,        "UI6.updateAP")
  105.     RegisterEventHandler(SystemData.Events.PLAYER_MAX_ACTION_POINTS_UPDATED,        "UI6.updateAP")
  106.     RegisterEventHandler(SystemData.Events.PLAYER_DEATH,                            "UI6.updateAP")
  107.  
  108.     RegisterEventHandler(SystemData.Events.ENTER_WORLD,                             "UI6.drawIcon")
  109.     RegisterEventHandler(SystemData.Events.INTERFACE_RELOADED,                      "UI6.drawIcon")
  110.     RegisterEventHandler(SystemData.Events.PLAYER_TARGET_UPDATED,                   "UI6.targetUpdate")
  111.     if UI6settings["combatIndicator"] == true then
  112.         RegisterEventHandler(SystemData.Events.PLAYER_COMBAT_FLAG_UPDATED,          "UI6.combatSymbol")
  113.     end
  114.     UI6.drawTargetbars()
  115.     if GameData.Player.career.id == 102 or GameData.Player.career.id == 27 or GameData.Player.career.id == 67 or GameData.Player.career.id == 23 then
  116.         UI6.drawPetbar()
  117.         --RegisterEventHandler(SystemData.Events.PLAYER_PET_UPDATED,                    "UI6.updatePetbar")
  118.         --RegisterEventHandler(SystemData.Events.PLAYER_PET_STATE_UPDATED,          "UI6.updatePetbar")
  119.         RegisterEventHandler(SystemData.Events.PLAYER_PET_HEALTH_UPDATED,           "UI6.updatePetbar")
  120.         UI6.updatePetbar()
  121.     end
  122. end
  123.  
  124. function UI6.getHP()
  125.     local cur = GameData.Player.hitPoints.current
  126.     local max = GameData.Player.hitPoints.maximum
  127.     local percent = math_floor((cur / max) * 1000) /10
  128.     return percent
  129. end
  130.  
  131. function UI6.getAP()
  132.     local cur = GameData.Player.actionPoints.current
  133.     local max = GameData.Player.actionPoints.maximum
  134.     local percent = math_floor((cur / max) * 1000) /10
  135.     return percent
  136. end
  137.  
  138. function UI6.updateHP()
  139.     local targetClassification  = "selfHP"
  140.     local targetName            = GameData.Player.name
  141.     local careerId              = GameData.Player.career.id
  142.     local rank                  = GameData.Player.rank
  143.     local targetHP              = UI6.getHP()
  144.     --local targetAP                = UI6.getAP()
  145.     --local guID                    = GameData.Player.worldObjId
  146.     --local isNPC               = false
  147.     local animFlag              = false
  148.     local windowName            = UI6.getWindowName(targetClassification)
  149.  
  150.     local cur = GameData.Player.hitPoints.current
  151.     local text = towstring(decimals(cur, 1))..L" ("..towstring(decimals(targetHP, 1))..L"%)"
  152.     UI6.updateBar(targetHP, windowName, targetClassification, targetName, careerId, animFlag)
  153.     UI6.updateText(text, windowName, targetClassification, targetName, careerId, rank)
  154. end
  155.  
  156. function UI6.updateAP()
  157.     local targetClassification  = "selfAP"
  158.     local targetName            = GameData.Player.name
  159.     local careerId              = GameData.Player.career.id
  160.     local rank                  = GameData.Player.rank
  161.     local targetAP              = UI6.getAP()
  162.     local guID                  = GameData.Player.worldObjId
  163.     local isNPC                 = false
  164.     local animFlag              = false
  165.     local windowName            = UI6.getWindowName(targetClassification)
  166.    
  167.     local cur = GameData.Player.actionPoints.current
  168.     local text = towstring(decimals(cur, 1))..L" ("..towstring(decimals(targetAP, 1))..L"%)"
  169.     UI6.updateBar(targetAP, windowName, targetClassification, targetName, careerId, animFlag)
  170.     UI6.updateText(text, windowName, targetClassification, targetName, careerId, rank)
  171. end
  172.  
  173. function UI6.specialWarning(name, worldObjId)
  174.     --check for a name and trigger a sound/UI element
  175.     local nothing = nil
  176. end
  177.  
  178. function UI6.prevTargetSame(targetClassification, targetId)
  179.     if targetClassification == "selffriendlytarget" then
  180.         if PREVIOUS_FRIENDLY_ID ~= targetId then
  181.             return true
  182.         end
  183.     elseif targetClassification == "selfhostiletarget" then
  184.         if PREVIOUS_HOSTILE_ID ~= targetId then
  185.             return true
  186.         end
  187.     end
  188.     -- oh, it must be you
  189.     return false
  190. end
  191.  
  192. function UI6.setIconAndTint(windowName, careerId)
  193.     local r = UI6.Color(careerId, "icon")
  194.     if r == nil then r = { 135, 135, 135} end  
  195.  
  196.     if careerId == (nil or 0) then
  197.         WindowSetAlpha(windowName.."Icon", 0)
  198.     else
  199.         WindowSetAlpha(windowName.."Icon", 1)
  200.         local tTex, x, y = GetIconData(Icons.GetCareerIconIDFromCareerLine(careerId))
  201.         DynamicImageSetTexture (windowName.."Icon", tTex, x, y)
  202.         WindowSetScale(windowName.."Icon", WindowGetScale(windowName) * iconScale)
  203.     end
  204.  
  205.     WindowSetTintColor(windowName.."Fill", r[1], r[2], r[3])
  206. end
  207.  
  208. function UI6.getWindowName(targetClassification)
  209.     if targetClassification == "selfHP" then
  210.         return BARNAME.."HP"
  211.     elseif targetClassification == "selfAP" then
  212.         return BARNAME.."AP"
  213.     elseif targetClassification == "selfhostiletarget" then
  214.         return BARNAME.."Hostile"
  215.     elseif targetClassification == "selffriendlytarget" then
  216.         return BARNAME.."Friendly"
  217.     end
  218.     d("error: getWindowName()")
  219. end
  220.  
  221. function UI6.windowAnimateAlpha(windowName)
  222.     if WindowGetAlpha(windowName) < 1 then
  223.         WindowSetScale(windowName, 2)
  224.         WindowStartAlphaAnimation(windowName, Window.AnimationType.SINGLE_NO_RESET, 0, 1, 0.2, false, 0, 0)
  225.     end
  226. end
  227.  
  228. function UI6.setPreviousTarget(targetClassification, guID)
  229.     if targetClassification == "selffriendlytarget" then
  230.         PREVIOUS_FRIENDLY_ID = guID
  231.     elseif targetClassification == "selfhostiletarget" then
  232.         PREVIOUS_HOSTILE_ID = guID
  233.     end
  234. end
  235.  
  236. function UI6.targetUpdate(targetClassification, targetId, targetType)
  237.     if (targetClassification ~= "selffriendlytarget" and targetClassification ~= "selfhostiletarget") then return end
  238.  
  239.     if (targetType == SystemData.TargetObjectType.NONE) then
  240.         UI6.destroyWindows()
  241.         PREVIOUS_FRIENDLY_ID    = nil
  242.         PREVIOUS_HOSTILE_ID     = nil
  243.         return
  244.     end
  245.  
  246.     TargetInfo:UpdateFromClient()
  247.     local targetName            = TargetInfo:UnitName(targetClassification)
  248.     local careerId              = TargetInfo:UnitCareer(targetClassification)
  249.     local rank                  = TargetInfo:UnitLevel(targetClassification)
  250.     local targetHP              = TargetInfo:UnitHealth(targetClassification)
  251.     local guID                  = TargetInfo:UnitEntityId(targetClassification)
  252.     local isNPC                 = TargetInfo:UnitIsNPC(targetClassification)
  253.     local animFlag              = UI6.prevTargetSame(targetClassification, targetId)
  254.     local windowName            = UI6.getWindowName(targetClassification)
  255.  
  256.     if targetHP < 100 and WindowGetShowing(windowName.."splitter") == false then
  257.         WindowSetShowing(windowName.."splitter", true)
  258.     end
  259.  
  260.     UI6.setIconAndTint(windowName, careerId)
  261.  
  262.     UI6.windowAnimateAlpha(windowName) -- animate the health bar appearing by fading in over 0.2 seconds
  263.  
  264.     UI6.updateBar(targetHP, windowName, targetClassification, targetName, careerId, animFlag)
  265.     local updateText = targetHP..L"%"
  266.     UI6.updateText(updateText, windowName, targetClassification, targetName, careerId, rank)
  267.  
  268.     if UI6settings["targetOHUD"] == true then
  269.         UI6.updateoverheadBar(targetHP, TARGETSTRING, guID, targetName)
  270.         --complete incorrect atm, do not use
  271.     end
  272.  
  273.     if UI6settings["danger"] == true then
  274.         local dangerScore = UI6.dangerSilentCheck(targetName)
  275.         UI6.drawGlow(windowName, dangerScore)
  276.     end
  277.  
  278.     UI6.setPreviousTarget(targetClassification, guID)
  279. end
  280.  
  281. function UI6.updateBar(targetHP, windowName, targetClassification, targetName, careerId, animFlag)
  282.     --local resize = (cur / max) * HP_BAR_WIDTH
  283.     local THIS_BAR_WIDTH        = BAR_WIDTH
  284.     local THIS_BAR_HEIGHT       = BAR_HEIGHT
  285.  
  286.     local resize = (targetHP / 100) * THIS_BAR_WIDTH
  287.  
  288.     if resize > THIS_BAR_WIDTH then
  289.         resize = THIS_BAR_WIDTH
  290.     elseif resize < 0 then
  291.         resize = 0
  292.     end
  293.  
  294.     WindowSetDimensions(windowName.."Fill", resize, THIS_BAR_HEIGHT)
  295.     if resize == 0 and targetClassification == "selfHP" then
  296.         -- died, you have zero ap now too.
  297.         WindowSetDimensions("UI6: BarAPFill", resize, THIS_BAR_HEIGHT)
  298.     end
  299.  
  300.  
  301.     if animFlag == true then
  302.         WindowSetDimensions(windowName.."anim", resize, THIS_BAR_HEIGHT)
  303.     end
  304.  
  305.     if UI6settings["danger"] == true and targetName ~= nil then
  306.         local dangerScore = UI6.dangerSilentCheck(targetName)
  307.         UI6.drawGlow(windowName, dangerScore)
  308.     end
  309. --[[
  310.     --WindowStartAlphaAnimation("UI6: Bar"..type.."BGFlash", Window.AnimationType.SINGLE, 0.2, 0, .9, false, 0, 0)
  311. ]]--
  312. end
  313.  
  314. function UI6.updateText(targetHP, windowName, targetClassification, targetName, careerId, rank)
  315.     if targetClassification == "selfAP" then
  316.         local text = targetHP
  317.         LabelSetText(windowName.."Text", text)
  318.         LabelSetText(windowName.."TextShadow", text)
  319.         WindowSetScale(windowName.."Text", WindowGetScale(windowName) * iconScale)
  320.         WindowSetScale(windowName.."TextShadow", WindowGetScale(windowName) * iconScale)
  321.     else
  322.         local text = targetName
  323.         LabelSetText(windowName..LEFT_LABEL, text)
  324.         LabelSetText(windowName..LEFT_LABEL.."Shadow", text)
  325.  
  326.         local text = targetHP
  327.         LabelSetText(windowName..RIGHT_LABEL, text)
  328.         LabelSetText(windowName..RIGHT_LABEL.."Shadow", text)
  329.         WindowSetScale(windowName..LEFT_LABEL, WindowGetScale(windowName) * iconScale)
  330.         WindowSetScale(windowName..LEFT_LABEL.."Shadow", WindowGetScale(windowName) * iconScale)
  331.         WindowSetScale(windowName..RIGHT_LABEL, WindowGetScale(windowName) * iconScale)
  332.         WindowSetScale(windowName..RIGHT_LABEL.."Shadow", WindowGetScale(windowName) * iconScale)
  333.     end
  334. end
  335.  
  336. function UI6.combatSymbol(inCombat)
  337.     if inCombat == true then
  338.         WindowStartAlphaAnimation (COMBAT_TITLE, Window.AnimationType.SINGLE_NO_RESET, 0, 0.6, 0.4, true, 0, 0)
  339.     elseif inCombat == false then
  340.         WindowStartAlphaAnimation (COMBAT_TITLE, Window.AnimationType.SINGLE_NO_RESET, 0.6, 0, 0.25, true, 0, 0)       
  341.     end
  342. end
  343.  
  344. function UI6.onRMouseButtonUp()
  345.     if GameData.Player.inCombat == false then
  346.         if SystemData.MouseOverWindow.name == "UI6: BarHP-Button" then
  347.             PlayerMenuWindow.ShowMenu(GameData.Player.name)
  348.         elseif SystemData.MouseOverWindow.name == "UI6: BarFriendly-Button" then
  349.             PlayerMenuWindow.ShowMenu(TargetInfo:UnitName("selffriendlytarget"))
  350.         elseif SystemData.MouseOverWindow.name == "UI6: BarHostile-Button" then
  351.             --PlayerMenuWindow.ShowMenu(TargetInfo:UnitName("selfhostiletarget"))
  352.             --/slit if alive
  353.             --/salute if dead
  354.             local targetHP = TargetInfo:UnitHealth("selfhostiletarget")
  355.             if targetHP == 0 then
  356.                 SendChatText(towstring("/salute"), L"")
  357.             else
  358.                 SendChatText(towstring("/slit"), L"")
  359.             end
  360.         end
  361.     end
  362. end
  363.  
  364. function UI6.onLMouseButtonUp()
  365.     local activeWindow = SystemData.MouseOverWindow.name
  366.     local target
  367.         if activeWindow == "UI6: BarFriendly-Button" then
  368.             target = TargetInfo:UnitName("selffriendlytarget") or nil
  369.         elseif activeWindow == "UI6: BarHP-Button" then
  370.             target = GameData.Player.name
  371.         elseif activeWindow == "UI6: BarHostile-Button" then
  372.             target = TargetInfo:UnitName("selfhostiletarget") or nil
  373.         elseif activeWindow == "UI6: BarPet-Button" then
  374.             target = GameData.Player.Pet.name or nil
  375.         end
  376.     WindowSetGameActionData(activeWindow, GameData.PlayerActions.SET_TARGET, 0, target)
  377. end
  378.  
  379. function UI6.drawPetbar()
  380.     CreateWindowFromTemplate(BARNAME.."Pet", "UI6: BarPet", "Root")
  381.     LayoutEditor.RegisterWindow(BARNAME.."Pet", towstring(BARNAME)..L"Pet", towstring(BARNAME)..L"Pet", false, false, false, nil)
  382.     WindowSetDimensions(BARNAME.."Pet", 128, 16)
  383.     WindowSetAlpha(BARNAME.."Pet", 1)
  384.     WindowSetScale(BARNAME.."Pet", 1.25)
  385.     WindowSetTintColor(BARNAME.."PetFill", barColors["GREEN"][1],barColors["GREEN"][2],barColors["GREEN"][3])
  386.     WindowSetTintColor(BARNAME.."Petanim", barColors["GRAY"][1],barColors["GRAY"][2],barColors["GRAY"][3])
  387.     WindowSetTintColor(BARNAME.."PetBG", barColors["BLACK"][1],barColors["BLACK"][2],barColors["BLACK"][3])
  388. end
  389.  
  390. function UI6.updatePetbar()
  391.     local targetHP = GameData.Player.Pet.healthPercent
  392.     local windowName = BARNAME.."Pet"
  393.     local targetClassification = "selfAP"
  394.     local animFlag = false
  395.     local targetName, careerId, rank = nil
  396.     UI6.updateBar(targetHP, windowName, targetClassification, targetName, careerId, animFlag)
  397.     local updateText = targetHP..L"%"
  398.     UI6.updateText(updateText, windowName, targetClassification, targetName, careerId, rank)
  399. end
  400.  
  401.  
  402.  
  403.  
  404.  
  405.  
  406.  
  407.  
  408.  
  409.  
  410.  
  411.  
  412.  
  413.  
  414.  
  415.  
  416.  
  417.  
  418.  
  419.  
  420.  
  421.  
  422. function UI6.drawMechanic()
  423.     local type, max, min = GetCareer()
  424. end
  425.  
  426. function UI6.destroyWindows()
  427.     WindowSetAlpha(BARNAME.."Friendly", 0)
  428.     LabelSetText(BARNAME.."Friendly"..LEFT_LABEL, L"")
  429.     LabelSetText(BARNAME.."Friendly"..LEFT_LABEL.."Shadow", L"")
  430.     LabelSetText(BARNAME.."Friendly"..RIGHT_LABEL, L"")
  431.     LabelSetText(BARNAME.."Friendly"..RIGHT_LABEL.."Shadow", L"")
  432.     WindowSetAlpha(BARNAME.."Hostile", 0)
  433.     LabelSetText(BARNAME.."Hostile"..LEFT_LABEL, L"")
  434.     LabelSetText(BARNAME.."Hostile"..LEFT_LABEL.."Shadow", L"")
  435.     LabelSetText(BARNAME.."Hostile"..RIGHT_LABEL, L"")
  436.     LabelSetText(BARNAME.."Hostile"..RIGHT_LABEL.."Shadow", L"")
  437.    
  438.     if UI6settings["targetOHUD"] == true then
  439.        
  440.         WindowSetAlpha(BARNAME..OVERHEAD.."Friendly", 0)
  441.         WindowSetAlpha(BARNAME..OVERHEAD.."Hostile", 0)
  442.         DetachWindowFromWorldObject(BARNAME..OVERHEAD.."Friendly", PREVIOUS_FRIENDLY_ID)
  443.         DetachWindowFromWorldObject(BARNAME..OVERHEAD.."Hostile", PREVIOUS_HOSTILE_ID)
  444.        
  445.     end
  446. end
  447.  
  448. function UI6.drawTargetbars()
  449.     CreateWindowFromTemplate(BARNAME.."Friendly", "UI6: BarFriendly", "Root")
  450.     CreateWindowFromTemplate(BARNAME.."Hostile", "UI6: BarHostile", "Root")
  451.     LayoutEditor.RegisterWindow(BARNAME.."Friendly", towstring(BARNAME)..L"Friendly", towstring(BARNAME)..L"Friendly", false, false, false, nil)
  452.     LayoutEditor.RegisterWindow(BARNAME.."Hostile", towstring(BARNAME)..L"Hostile", towstring(BARNAME)..L"Hostile", false, false, false, nil)
  453.     WindowSetDimensions(BARNAME.."Friendly", 128, 16)
  454.     WindowSetDimensions(BARNAME.."Hostile", 128, 16)
  455.     WindowSetAlpha(BARNAME.."Friendly", 0)
  456.     WindowSetAlpha(BARNAME.."Hostile", 0)
  457.     WindowSetScale(BARNAME.."Friendly", 2)
  458.     WindowSetScale(BARNAME.."Hostile", 2)
  459.     WindowSetTintColor(BARNAME.."FriendlyBG", barColors["BLACK"][1],barColors["BLACK"][2],barColors["BLACK"][3])
  460.     WindowSetTintColor(BARNAME.."HostileBG", barColors["BLACK"][1],barColors["BLACK"][2],barColors["BLACK"][3])
  461.     if UI6settings["targetOHUD"] == true then
  462.         CreateWindowFromTemplate(BARNAME..OVERHEAD.."Friendly", BARNAME..OVERHEAD, "Root")
  463.         CreateWindowFromTemplate(BARNAME..OVERHEAD.."Hostile", BARNAME..OVERHEAD, "Root")
  464.         WindowSetAlpha(BARNAME..OVERHEAD.."Friendly", 1)
  465.         WindowSetAlpha(BARNAME..OVERHEAD.."Hostile", 1)
  466.     end
  467. end
  468.  
  469.  
  470. function UI6.drawplayerHUD()
  471.  
  472.     d("DRAW FRAME NOW")
  473.     CreateWindow("UI6: BarHP", true)
  474.     CreateWindow("UI6: BarAP", true)
  475.     WindowSetScale("UI6: BarAP", 2)
  476.     WindowSetScale("UI6: BarHP", 2)
  477.  
  478.     WindowSetTintColor( "UI6: BarHPFill", barColors["GREEN"][1],barColors["GREEN"][2],barColors["GREEN"][3])
  479.     WindowSetTintColor( "UI6: BarHPanim", barColors["GRAY"][1],barColors["GRAY"][2],barColors["GRAY"][3])
  480.     WindowSetTintColor( "UI6: BarHPBG", barColors["BLACK"][1],barColors["BLACK"][2],barColors["BLACK"][3])
  481.     WindowSetTintColor( "UI6: BarAPFill", barColors["GOLD"][1],barColors["GOLD"][2],barColors["GOLD"][3])
  482.     WindowSetTintColor( "UI6: BarAPanim", barColors["GRAY"][1],barColors["GRAY"][2],barColors["GRAY"][3]) -- could use the old color
  483.     WindowSetTintColor( "UI6: BarAPBG", barColors["BLACK"][1],barColors["BLACK"][2],barColors["BLACK"][3])-- and -75
  484.  
  485.     LayoutEditor.RegisterWindow("UI6: BarHP", L"UI6: BarHP", L"UI6: BarHP", false, false, false, nil)
  486.     LayoutEditor.RegisterWindow("UI6: BarAP", L"UI6: BarAP", L"UI6: BarAP", false, false, false, nil)
  487.     WindowSetDimensions("UI6: BarHP", 128, 16)
  488.     WindowSetDimensions("UI6: BarAP", 128, 16)
  489.  
  490.     UI6.updateHP()
  491.     UI6.updateAP()
  492.     --UI6.drawIcon()
  493. end
  494.  
  495.  
  496. function UI6.drawIcon()
  497.     if DoesWindowExist("UI6: BarHPIcon") ~= true then return end
  498.     local tTex, x, y = GetIconData(Icons.GetCareerIconIDFromCareerLine(GameData.Player.career.line))
  499.     GetIconData(Icons.GetCareerIconIDFromCareerLine(GameData.Player.career.line))
  500.     DynamicImageSetTexture ("UI6: BarHPIcon", tTex, x, y)
  501.     WindowSetScale("UI6: BarHPIcon", WindowGetScale("UI6: BarHP") * iconScale)
  502.    
  503.     local r = UI6.Color(GameData.Player.career.line, "icon")
  504.     WindowSetTintColor(PLAYER_HPFILL, r[1], r[2], r[3])
  505.  
  506.     UI6.updateHP()
  507.     UI6.updateAP()
  508. end
  509.  
  510.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement