compat(lua50): replace % modulo operator with math.mod shim

Lua 5.0 (Vanilla 1.12) has no % operator outside string formatting; it is a
parse error. Route the 9 arithmetic modulo sites through the existing math.mod
shim (Compat/Compat.lua) so the addon parses on 5.0 through Retail.

Sites: QuestieDB daily/weekly flag tests, QuestieEvent DMF cycle math,
QuestieLearner GUID/flag math, QuestiePlayer race/class flag tests.
This commit is contained in:
Xurkon
2026-06-12 18:35:31 -05:00
parent 76d4e6e4c8
commit 9dce126735
4 changed files with 9 additions and 9 deletions
+2 -2
View File
@@ -3348,7 +3348,7 @@ local function GetIdAndTypeFromGUID(guid)
if t then
local low32 = tonumber(string.sub(guid, 11, 18), 16)
if low32 then
local nid = low32 % 8388608
local nid = math.mod(low32, 8388608)
if nid > 0 then return nid, t end
end
end
@@ -3460,7 +3460,7 @@ end
local function NpcFlagsHasQuestGiver(flags)
if not flags then return false end
-- bitwise AND for Lua 5.1 (no bit library guaranteed)
return math.floor(flags / NPC_FLAG_QUESTGIVER) % 2 == 1
return math.mod(math.floor(flags / NPC_FLAG_QUESTGIVER), 2) == 1
end
function QuestieLearner:OnMouseoverUnit()
+2 -2
View File
@@ -100,13 +100,13 @@ end
---@return boolean
function QuestiePlayer.HasRequiredRace(requiredRaces)
-- test a bit flag: (value % (2*flag) >= flag)
return (not requiredRaces) or (requiredRaces == 0) or ((requiredRaces % playerRaceFlagX2) >= playerRaceFlag)
return (not requiredRaces) or (requiredRaces == 0) or (math.mod(requiredRaces, playerRaceFlagX2) >= playerRaceFlag)
end
---@return boolean
function QuestiePlayer.HasRequiredClass(requiredClasses)
-- test a bit flag: (value % (2*flag) >= flag)
return (not requiredClasses) or (requiredClasses == 0) or ((requiredClasses % playerClassFlagX2) >= playerClassFlag)
return (not requiredClasses) or (requiredClasses == 0) or (math.mod(requiredClasses, playerClassFlagX2) >= playerClassFlag)
end
function QuestiePlayer:GetCurrentZoneId()