Files
ShaguTweaks-ClassicAPI/mods/turtle-wow.lua
T
OEVGandClaude Opus 5.5 15712e82c7 WorldMap Window: keep the size, drag by the title, OctoBus Transports button; add Loot History
- The map keeps the scale picked with Ctrl+Mousewheel (saved per
  character, .4 to 2). It was reset to .85 on every open and by the
  Turtle WoW maximize wrapper.
- The title bar drags the window: on Turtle the title sits 17 units above
  the frame, so the frame's click area now extends over it.
- With OctoBus loaded, a Transports button left of the Continent dropdown
  runs OctoBus' own toggle. Its window is lifted above the map while both
  are open and restored when the map closes.
- New Loot History module (/loothistory), ported from brues-code/pfUI and
  rebuilt with stock 1.12 widgets, on ClassicAPI's C_LootHistory.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019W3rwusM4i1CYaHQAYixJ7
2026-11-02 04:08:31 +00:00

136 lines
5.3 KiB
Lua

-- Turtle WoW changes parts of the stock 1.12 UI and gameplay APIs.
-- Keep the small compatibility adjustments that ShaguTweaks still needs.
-- Skip module initialization on every other client than TurtleWoW.
if not TargetHPText or not TargetHPPercText then return end
local T = ShaguTweaks.T
local L = ShaguTweaks.L
local module = ShaguTweaks:register({
title = T["Turtle WoW Compatibility"],
description = T["Adds compatibility to Turtle WoW's custom changes."],
expansions = { ["vanilla"] = true },
enabled = true,
})
module.enable = function(self)
-- Minimap Clock owns its tooltip script. Expose only Turtle's time conversion
-- so the clock can consume it dynamically regardless of module enable order.
ShaguTweaks.GetTurtleClockTimes = function()
local zh, zm = GetGameTime()
local sh, sm = zh, zm
SetMapToCurrentZone()
if GetCurrentMapContinent() == 1 then
sh = sh + 12
sh = sh >= 24 and sh - 24 or sh
end
local servertime = string.format("%.2d:%.2d", sh, sm)
local zonetime = string.format("%.2d:%.2d", zh, zm)
return servertime, zonetime
end
-- Turtle changes WorldMapFrame_Maximize. Keep our compatibility wrapper
-- completely out of the way when a dedicated map addon owns the world map.
if not Cartographer and not METAMAP_TITLE then
local HookWorldMapFrame_Maximize = WorldMapFrame_Maximize
WorldMapFrame_Maximize = function()
-- run original function
HookWorldMapFrame_Maximize()
-- Re-apply only when WorldMap Window really initialized.
if ShaguTweaks.WorldMapWindowActive then
WorldMapFrame:SetMovable(true)
WorldMapFrame:EnableMouse(true)
-- Keep the size picked with Ctrl + Mousewheel (saved by WorldMap Window).
WorldMapFrame:SetScale(ShaguTweaks.GetWorldMapScale and ShaguTweaks.GetWorldMapScale() or .85)
WorldMapFrame:ClearAllPoints()
WorldMapFrame:SetPoint("CENTER", UIParent, "CENTER", 0, 30)
WorldMapFrame:SetWidth(WorldMapButton:GetWidth() + 15)
WorldMapFrame:SetHeight(WorldMapButton:GetHeight() + 55)
-- overwrite wrong title position set by turtlewow
WorldMapFrameTitle:SetPoint("TOP", WorldMapFrame, 0, 17)
-- The title now sits above the frame: let the title bar drag it too.
if ShaguTweaks.UpdateWorldMapDragArea then
ShaguTweaks.UpdateWorldMapDragArea()
end
BlackoutWorld:Hide()
end
end
-- Trigger once after every module has handled PLAYER_ENTERING_WORLD. A
-- zero-delay ClassicAPI timer makes the result independent of event order.
local worldmapInit = CreateFrame("Frame")
worldmapInit:RegisterEvent("PLAYER_ENTERING_WORLD")
worldmapInit:SetScript("OnEvent", function()
this:UnregisterAllEvents()
this:Hide()
C_Timer.After(0, function()
WorldMapFrame_Maximize()
end)
end)
end
-- Vendor Values exposes a lazy ClassicAPI-backed SellValueDB compatibility
-- table, so do not allocate a second Turtle-specific static price database.
-- add druids tree of life and fast travel form to autoshift
if ShaguTweaks.dismount then
table.insert(ShaguTweaks.dismount.shapeshifts, "ability_druid_treeoflife")
table.insert(ShaguTweaks.dismount.shapeshifts, "ability_druid_stagform")
end
-- update debuff durations
L["debuffs"]["Hand of Reckoning"] = {[0]=3.0}
L["debuffs"]['Insect Swarm'] = {[0]=18.0}
L["debuffs"]['Moonfire'] = {[1]=9.0,[2]=18.0,[3]=18.0,[4]=18.0,[5]=18.0,[6]=18.0,[7]=18.0,[8]=18.0,[9]=18.0,[10]=18.0,[0]=18.0}
end
-- Turtle WoW specific libdebuff patches. Only Paladins and Warlocks
-- can trigger these cases, so other classes should not parse every spell-damage
-- chat line for strings they can never produce.
local libdebuff = ShaguTweaks.libdebuff
local _, playerClass = UnitClass("player")
if playerClass == "PALADIN" or playerClass == "WARLOCK" then
local libdebuff_twow = CreateFrame("Frame")
libdebuff_twow:RegisterEvent("CHAT_MSG_SPELL_SELF_DAMAGE")
libdebuff_twow:SetScript("OnEvent", function()
-- Break early on invalid data
if not arg1 or not arg2 then return end
-- Holy Strike is a spell, but can refresh paladin judgements
-- Credits to @geojak
if playerClass == "PALADIN" and string.find(arg1, "Holy Strike") then
for seal in ShaguTweaks.L["judgements"] do
local name = UnitName("target")
local level = UnitLevel("target")
if name and libdebuff.objects[name] then
if level and libdebuff.objects[name][level] and libdebuff.objects[name][level][seal] then
libdebuff:AddEffect(name, level, seal)
elseif libdebuff.objects[name][0] and libdebuff.objects[name][0][seal] then
libdebuff:AddEffect(name, 0, seal)
end
end
end
end
-- refresh Immolate duration after cast Conflagrate
if playerClass == "WARLOCK" and string.find(arg1, "Conflagrate") then
local name = UnitName("target")
local level = UnitLevel("target")
if name and level and libdebuff.objects[name] and libdebuff.objects[name][level]
and libdebuff.objects[name][level]["Immolate"]
then
local duration = libdebuff.objects[name][level]["Immolate"].duration
libdebuff:UpdateDuration(name, level, "Immolate", duration - 3)
end
end
end)
end