Untitled
Guest 53 1st Dec, 2024
local josefiksProgressUI = setupUI([[
Panel
id: progressBox
font: verdana-11px-rounded
width: 192
height: 70
text-offset: 24 5
text-align: right
margin-bottom: 14
anchors.right: parent.right
anchors.top: parent.top
image-source: /images/ui/miniwindow
image-border: 4
image-border-top: 24
image-border-bottom: 4
padding-top: 2
padding-left: 10
padding-right: 10
MenuLabel
id: playerName
color: white
anchors.top: parent.top
anchors.left: parent.left
anchors.right: parent.right
text-align: center
!text: tr('N/A')
MenuLabel
id: playerLevel
color: #FFD542
margin-top: 10
anchors.top: prev.bottom
anchors.left: parent.left
anchors.right: parent.right
!text: tr('Level: N/A')
MenuLabel
id: playerMagicLevel
color: #6BDCFF
anchors.top: prev.bottom
anchors.left: parent.left
anchors.right: parent.right
!text: tr('Magic Level: N/A')
MenuLabel
id: playerStamina
color: #3498DB
anchors.top: prev.bottom
anchors.left: parent.left
anchors.right: parent.right
!text: tr('Stamina: N/A')
]], modules.game_interface.getMapPanel())
local maxGainsCount = 30
local expGains = {}
local gain = 0
local lastLvl = player:getLevel()
local lastLvlPercent = player:getLevelPercent()
if not storage["lvlPerHour"] then storage["lvlPerHour"] = { value = 0 } end
function initJosefiksProgressUI()
lvlPercent = player:getLevelPercent()
lvlPercentGain = (lvlPercent - lastLvlPercent + 100) % 100
local lvl = player:getLevel()
lvlGain = lvl - lastLvl
gain = lvlPercentGain / 100
if lvlGain > 1 then gain = gain + lvlGain - 1 end
lastLvl = lvl
lastLvlPercent = lvlPercent
table.insert(expGains, 1, gain)
if table.getn(expGains) > maxGainsCount then table.remove(expGains) end
sum = 0
for _, v in pairs(expGains) do sum = sum + v end
levelPerHour = 2 * 60 * sum / table.getn(expGains)
storage["lvlPerHour"].value = levelPerHour
josefiksProgressUI.playerName:setText(player:getName())
josefiksProgressUI.playerLevel:setText(string.format("Level: %i [%i%%][%.2f Lv/H]", lvl, lvlPercent, levelPerHour))
josefiksProgressUI.playerMagicLevel:setText(string.format("Magic Level: %i [%i%%]", player:getMagicLevel(), player:getMagicLevelPercent()))
josefiksProgressUI.playerStamina:setText(string.format("Stamina: %.2d:%.2d [%i%%]", math.floor(player:getStamina() / 60), math.floor(player:getStamina() % 60), math.floor(100 * player:getStamina() / (42 * 60))))
if player:getStamina() / 60 > 40 then
josefiksProgressUI.playerStamina:setColor('#72FF66')
elseif player:getStamina() / 60 < 40 then
josefiksProgressUI.playerStamina:setColor('#FF8C4B')
else
josefiksProgressUI.playerStamina:setColor('#FF4545')
end
end
initJosefiksProgressUI()
macro(3 * 10000, function()
initJosefiksProgressUI()
end)
To share this paste please copy this url and send to your friends
RAW Paste Data