diff --git a/Data/News.lua b/Data/News.lua index 25ab2b4f..1f0ce6e4 100644 --- a/Data/News.lua +++ b/Data/News.lua @@ -3,6 +3,8 @@ local CraftSim = select(2, ...) CraftSim.NEWS = {} +local print = CraftSim.UTIL:SetDebugPrint(CraftSim.CONST.DEBUG_IDS.NEWS) + ---@param itemMap table function CraftSim.NEWS:GET_NEWS(itemMap) -- minimize names to make manual formatting easier :p @@ -123,11 +125,19 @@ function CraftSim.NEWS:GetChecksum(newsText) local checksum = 0 local checkSumBitSize = 256 + -- replace each itemLink with a generic string so there are no differences between characters in the checksum + -- for _, item in pairs(itemMap) do + -- end + newsText = string.gsub(newsText, "|cff%x+|Hitem:.+|h|r", "[LINK]") + -- Iterate through each character in the string for i = 1, #newsText do checksum = (checksum + string.byte(newsText, i)) % checkSumBitSize end + -- print("replacing links in newstext:") + -- print(newsText) + return checksum end @@ -155,6 +165,7 @@ function CraftSim.NEWS:ShowNews(force) return end + print("showing news, old / new cs: " .. tostring(CraftSimOptions.newsChecksum) .. "/" .. tostring(newChecksum)) CraftSimOptions.newsChecksum = newChecksum local infoFrame = CraftSim.GGUI:GetFrame(CraftSim.MAIN.FRAMES, CraftSim.CONST.FRAMES.INFO) diff --git a/Util/Const.lua b/Util/Const.lua index 64b5abfd..a3e254d0 100644 --- a/Util/Const.lua +++ b/Util/Const.lua @@ -165,6 +165,7 @@ CraftSim.CONST.DEBUG_IDS = { PRICE_APIS = "PRICE_APIS", CONTROL_PANEL = "CONTROL_PANEL", CRAFTQ = "CRAFTQ", + NEWS = "NEWS", } CraftSim.CONST.ERROR = {