version string trailing zeros

This commit is contained in:
Sumsebrum 2022-03-26 00:11:34 +01:00
parent 2720e25cea
commit cb6de72b93
3 changed files with 13 additions and 13 deletions

View File

@ -17,7 +17,7 @@ local IsActiveBattlefieldArena = IsActiveBattlefieldArena
local IsInInstance = IsInInstance
local GetNumArenaOpponents = GetNumArenaOpponents
local RELEASE_TYPES = { alpha = "Alpha", beta = "Beta", release = "Release"}
local PREFIX = "TBC-Classic_v"
local PREFIX = "Gladdy v"
local VERSION_REGEX = PREFIX .. "(%d+%.%d+)%-(%a)"
local LibStub = LibStub
@ -27,14 +27,14 @@ local LibStub = LibStub
---------------------------
local MAJOR, MINOR = "Gladdy", 5
local MAJOR, MINOR = "Gladdy", 6
local Gladdy = LibStub:NewLibrary(MAJOR, MINOR)
local L
Gladdy.version_major_num = 2
Gladdy.version_minor_num = 0.10
Gladdy.version_num = Gladdy.version_major_num + Gladdy.version_minor_num
Gladdy.version_releaseType = RELEASE_TYPES.release
Gladdy.version = PREFIX .. Gladdy.version_num .. "-" .. Gladdy.version_releaseType
Gladdy.version = PREFIX .. string.format("%.2f", Gladdy.version_num) .. "-" .. Gladdy.version_releaseType
Gladdy.VERSION_REGEX = VERSION_REGEX
Gladdy.debug = false

View File

@ -1,4 +1,4 @@
local tonumber, tostring = tonumber, tostring
local tonumber, tostring, str_format = tonumber, tostring, string.format
local UnitName = UnitName
local IsInGroup, IsInRaid = IsInGroup, IsInRaid
@ -24,11 +24,11 @@ end
function VersionCheck:JOINED_ARENA()
self:RegisterComm("GladdyVCheck", VersionCheck.OnCommReceived)
if IsInRaid(LE_PARTY_CATEGORY_HOME) then
self:SendCommMessage("GladdyVCheck", tostring(Gladdy.version_num), "RAID", self.playerName)
self:SendCommMessage("GladdyVCheck", str_format("%.2f", Gladdy.version_num), "RAID", self.playerName)
elseif IsInGroup(LE_PARTY_CATEGORY_INSTANCE) or IsInRaid(LE_PARTY_CATEGORY_INSTANCE) then
self:SendCommMessage("GladdyVCheck", tostring(Gladdy.version_num), "INSTANCE_CHAT", self.playerName)
self:SendCommMessage("GladdyVCheck", str_format("%.2f", Gladdy.version_num), "INSTANCE_CHAT", self.playerName)
elseif IsInGroup(LE_PARTY_CATEGORY_HOME) then
self:SendCommMessage("GladdyVCheck", tostring(Gladdy.version_num), "PARTY", self.playerName)
self:SendCommMessage("GladdyVCheck", str_format("%.2f", Gladdy.version_num), "PARTY", self.playerName)
end
end
@ -41,9 +41,9 @@ end
function VersionCheck.OnCommReceived(prefix, message, distribution, sender)
if sender ~= VersionCheck.playerName then
local addonVersion = Gladdy.version_num
message = tonumber(message)
if message and message <= Gladdy.version_num then
local addonVersion = str_format("%.2f", Gladdy.version_num)
local message_num = tonumber(message) or 0
if message and message_num <= Gladdy.version_num then
--Gladdy:Print("Version", "\"".. addonVersion.."\"", "is up to date")
else
Gladdy:Warn("Current version", "\"".. addonVersion.."\"", "is outdated. Most recent version is", "\"".. message.."\"")

View File

@ -1,5 +1,5 @@
local type, pairs, tinsert, tsort = type, pairs, table.insert, table.sort
local tostring, str_match, tonumber, string_format = tostring, string.match, tonumber, string.format
local tostring, str_match, tonumber, str_format = tostring, string.match, tonumber, string.format
local ceil, floor = ceil, floor
local ReloadUI = ReloadUI
@ -31,7 +31,7 @@ function Gladdy:FormatTimer(fontString, timeLeft, milibreakpoint, showSeconds)
else
if time >= 60 then
if showSeconds then
fontString:SetText(floor(timeLeft / 60) .. ":" .. string_format("%02.f", floor(timeLeft - floor(timeLeft / 60) * 60)))
fontString:SetText(floor(timeLeft / 60) .. ":" .. str_format("%02.f", floor(timeLeft - floor(timeLeft / 60) * 60)))
else
fontString:SetText(ceil(ceil(time / 60)) .. "m")
end
@ -279,7 +279,7 @@ function Gladdy:SetupOptions()
order = 5,
width = 1,
type = "description",
name = " Gladdy v" .. Gladdy.version_num .. "-" .. Gladdy.version_releaseType
name = " " .. Gladdy.version
},
general = {
type = "group",