--[[-------------------------------------------------------------------------- TurboPlates — Maniax 3.3.5a compatibility. Upstream: https://github.com/esurm/TurboPlates (MIT, by surm), written for 3.3.5a with the Project Ascension API. This client has most of that API but not all of it, and this file closes the difference. WHAT IS *NOT* HERE PixelUtil, EventRegistry, C_NamePlateManager, C_QuestLog.GetUnitQuestInfo, C_Hook:RegisterBucket and GetCreatureIDFromGUID are all provided by !Maniax335Compat instead, deliberately. They are shared globals, and several add-ons in this pack ship their own partial versions behind "if not X then" guards - whichever loads first wins, complete or not. TidyPlates_ThreatPlates defines a PixelUtil with SetPoint, SetWidth, SetHeight and SetSize but NOT GetNearestPixelSize, which TurboPlates calls twenty times, and "TidyPlates_ThreatPlates" sorts before "TurboPlates". Left alone, the partial one wins and this add-on breaks on a method that was never missing in the first place. !Maniax335Compat's folder starts with "!" so it loads before everything and claims those globals complete. Do not re-add them here. WHAT *IS* HERE: SetAtlas. Texture:SetAtlas is a Legion method that resolves a name to a rectangle in a packed sheet. This client has no atlas system at all - zero hits for SetAtlas in realm.dll or Wow.exe - so there is nothing to resolve against and no sheet to read from. It is handled here rather than in the compat add-on because the fix is a method on a widget, and adding one means patching a shared widget metatable. Frame types share one metatable on 3.3.5a: doing that reaches every texture in the game, and the last time this pack tried it, it broke Escape and Jump for players. Twice. So the call sites are rewritten to go through the helper below instead, which is a local change with no reach. Unmapped atlases hide the region rather than showing something wrong. A texture path the client does not have renders as a solid green block, which reads as a bug; an absent decoration reads as a decoration that is absent. ----------------------------------------------------------------------------]] local ATLAS = { -- Every replacement below was confirmed present in this client's archives -- before being used here, for the green-block reason above. ["questlog-icon-checkmark-yellow-2x"] = "Interface/RaidFrame/ReadyCheck-Ready", ["questnormal"] = "Interface/GossipFrame/AvailableQuestIcon", ["questturnin"] = "Interface/GossipFrame/ActiveQuestIcon", ["questlegendary"] = "Interface/GossipFrame/AvailableQuestIcon", ["questdaily"] = "Interface/GossipFrame/AvailableQuestIcon", -- "renown-rocket" has no 3.3.5a equivalent. INV_Misc_Rocket_01 is NOT in -- this client - checked - so the minimap button simply gets no icon rather -- than a green square. } -- TurboPlates_SetAtlas(region, atlasName, useAtlasSize) -- -- Global on purpose: the call sites live across several files and this is -- simpler to audit than an upvalue threaded through each of them. Named with -- the add-on prefix so it cannot collide. function TurboPlates_SetAtlas(region, atlasName, useAtlasSize) if not region or not region.SetTexture then return end -- If a real atlas system ever appears - the client gaining one, or another -- add-on providing it - defer to it rather than second-guessing. if region.SetAtlas then local ok = pcall(region.SetAtlas, region, atlasName, useAtlasSize) if ok then return end end local path = atlasName and ATLAS[atlasName] if path then pcall(region.SetTexture, region, path) -- An atlas carries its own texcoords; a plain file does not, so any -- previously set ones have to be cleared or the replacement is cropped. if region.SetTexCoord then pcall(region.SetTexCoord, region, 0, 1, 0, 1) end if region.Show then pcall(region.Show, region) end else pcall(region.SetTexture, region, nil) if region.Hide then pcall(region.Hide, region) end end end