version string trailing zeros
This commit is contained in:
parent
2720e25cea
commit
cb6de72b93
@ -17,7 +17,7 @@ local IsActiveBattlefieldArena = IsActiveBattlefieldArena
|
|||||||
local IsInInstance = IsInInstance
|
local IsInInstance = IsInInstance
|
||||||
local GetNumArenaOpponents = GetNumArenaOpponents
|
local GetNumArenaOpponents = GetNumArenaOpponents
|
||||||
local RELEASE_TYPES = { alpha = "Alpha", beta = "Beta", release = "Release"}
|
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 VERSION_REGEX = PREFIX .. "(%d+%.%d+)%-(%a)"
|
||||||
local LibStub = LibStub
|
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 Gladdy = LibStub:NewLibrary(MAJOR, MINOR)
|
||||||
local L
|
local L
|
||||||
Gladdy.version_major_num = 2
|
Gladdy.version_major_num = 2
|
||||||
Gladdy.version_minor_num = 0.10
|
Gladdy.version_minor_num = 0.10
|
||||||
Gladdy.version_num = Gladdy.version_major_num + Gladdy.version_minor_num
|
Gladdy.version_num = Gladdy.version_major_num + Gladdy.version_minor_num
|
||||||
Gladdy.version_releaseType = RELEASE_TYPES.release
|
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.VERSION_REGEX = VERSION_REGEX
|
||||||
|
|
||||||
Gladdy.debug = false
|
Gladdy.debug = false
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
local tonumber, tostring = tonumber, tostring
|
local tonumber, tostring, str_format = tonumber, tostring, string.format
|
||||||
|
|
||||||
local UnitName = UnitName
|
local UnitName = UnitName
|
||||||
local IsInGroup, IsInRaid = IsInGroup, IsInRaid
|
local IsInGroup, IsInRaid = IsInGroup, IsInRaid
|
||||||
@ -24,11 +24,11 @@ end
|
|||||||
function VersionCheck:JOINED_ARENA()
|
function VersionCheck:JOINED_ARENA()
|
||||||
self:RegisterComm("GladdyVCheck", VersionCheck.OnCommReceived)
|
self:RegisterComm("GladdyVCheck", VersionCheck.OnCommReceived)
|
||||||
if IsInRaid(LE_PARTY_CATEGORY_HOME) then
|
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
|
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
|
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
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -41,9 +41,9 @@ end
|
|||||||
|
|
||||||
function VersionCheck.OnCommReceived(prefix, message, distribution, sender)
|
function VersionCheck.OnCommReceived(prefix, message, distribution, sender)
|
||||||
if sender ~= VersionCheck.playerName then
|
if sender ~= VersionCheck.playerName then
|
||||||
local addonVersion = Gladdy.version_num
|
local addonVersion = str_format("%.2f", Gladdy.version_num)
|
||||||
message = tonumber(message)
|
local message_num = tonumber(message) or 0
|
||||||
if message and message <= Gladdy.version_num then
|
if message and message_num <= Gladdy.version_num then
|
||||||
--Gladdy:Print("Version", "\"".. addonVersion.."\"", "is up to date")
|
--Gladdy:Print("Version", "\"".. addonVersion.."\"", "is up to date")
|
||||||
else
|
else
|
||||||
Gladdy:Warn("Current version", "\"".. addonVersion.."\"", "is outdated. Most recent version is", "\"".. message.."\"")
|
Gladdy:Warn("Current version", "\"".. addonVersion.."\"", "is outdated. Most recent version is", "\"".. message.."\"")
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
local type, pairs, tinsert, tsort = type, pairs, table.insert, table.sort
|
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 ceil, floor = ceil, floor
|
||||||
local ReloadUI = ReloadUI
|
local ReloadUI = ReloadUI
|
||||||
|
|
||||||
@ -31,7 +31,7 @@ function Gladdy:FormatTimer(fontString, timeLeft, milibreakpoint, showSeconds)
|
|||||||
else
|
else
|
||||||
if time >= 60 then
|
if time >= 60 then
|
||||||
if showSeconds 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
|
else
|
||||||
fontString:SetText(ceil(ceil(time / 60)) .. "m")
|
fontString:SetText(ceil(ceil(time / 60)) .. "m")
|
||||||
end
|
end
|
||||||
@ -279,7 +279,7 @@ function Gladdy:SetupOptions()
|
|||||||
order = 5,
|
order = 5,
|
||||||
width = 1,
|
width = 1,
|
||||||
type = "description",
|
type = "description",
|
||||||
name = " Gladdy v" .. Gladdy.version_num .. "-" .. Gladdy.version_releaseType
|
name = " " .. Gladdy.version
|
||||||
},
|
},
|
||||||
general = {
|
general = {
|
||||||
type = "group",
|
type = "group",
|
||||||
|
Loading…
Reference in New Issue
Block a user