Various fixes and added professions/class trainers

This commit is contained in:
User
2026-09-04 17:55:10 -05:00
parent 3dfaee29ab
commit c3cf320b01
18 changed files with 938 additions and 56 deletions
+75 -3
View File
@@ -10,6 +10,7 @@ local function IsPermanentRole(role)
or role=="mailbox" or role=="battlemaster" or role=="innkeeper"
or role=="meetingStone" or role=="repair" or role=="spiritHealer"
or role=="stableMaster" or role=="vendor" or role=="rareMob"
or role=="classTrainer" or role=="professionTrainer"
end
local function IsSpecialQuestNode(node)
@@ -44,6 +45,8 @@ local function IsRoleEnabled(role)
if role=="spiritHealer" then return settings:Get("showMapSpiritHealer") and true or false end
if role=="stableMaster" then return settings:Get("showMapStableMaster") and true or false end
if role=="vendor" then return settings:Get("showMapVendor") and true or false end
if role=="classTrainer" then return settings:Get("showMapClassTrainer") and true or false end
if role=="professionTrainer" then return settings:Get("showMapProfessionTrainer") and true or false end
if role=="rareMob" then return settings:Get("showMapRareMonsters") and true or false end
if not settings:Get("enableMapIcons") then return false end
@@ -106,6 +109,43 @@ local TEX_SPIRITHEALER=ICON_ROOT.."spirithealer"
local TEX_STABLEMASTER=ICON_ROOT.."stablemaster"
local TEX_VENDOR=ICON_ROOT.."vendor"
local TEX_RARE=ICON_ROOT.."rares"
-- Class/profession trainers share two ringed icon atlases (from the Trainer
-- addon, see References/Trainer). Each name maps to a {left,right,top,bottom}
-- sub-rectangle inside its atlas, so trainer pins set both the atlas texture and
-- these texture coordinates instead of a dedicated single-icon file.
local TEX_CLASSTRAINER=ICON_ROOT.."Ringed-Classes"
local TEX_PROFESSIONTRAINER=ICON_ROOT.."Ringed-Professions"
-- {left,right,top,bottom} atlas coordinates, copied from References/Trainer
-- (TrainerLegacy.lua) and keyed by the lower-case class/profession names used by
-- the meta-turtle ["trainers"]/["professions"] tables.
local CLASS_TRAINER_COORDS={
["warrior"]={0,0.25,0,0.25}, ["mage"]={0.25,0.5,0,0.25}, ["rogue"]={0.495,0.745,0,0.25},
["druid"]={0.75,1,0,0.25}, ["hunter"]={0,0.25,0.25,0.5}, ["shaman"]={0.25,0.5,0.25,0.5},
["priest"]={0.5,0.75,0.25,0.5}, ["warlock"]={0.75,1,0.25,0.5}, ["paladin"]={0,0.25,0.5,0.75},
}
local PROFESSION_TRAINER_COORDS={
["riding"]={0,0.25,0,0.25}, ["cooking"]={0.25,0.5,0,0.25}, ["skinning"]={0.5,0.75,0,0.25},
["firstaid"]={0.75,1,0,0.25}, ["alchemy"]={0,0.25,0.25,0.5}, ["blacksmithing"]={0.25,0.5,0.25,0.5},
["engineering"]={0.5,0.75,0.25,0.5}, ["enchanting"]={0.75,1,0.25,0.5}, ["fishing"]={0,0.25,0.5,0.75},
["herbalism"]={0.25,0.5,0.5,0.75}, ["leatherworking"]={0.5,0.75,0.5,0.75}, ["mining"]={0.75,1,0.5,0.75},
["tailoring"]={0,0.25,0.75,1}, ["weapon"]={0.25,0.5,0.75,1}, ["jewelcrafting"]={0.5,0.75,0.75,1},
}
-- Returns left,right,top,bottom texture coordinates for a node. Trainer pins
-- carve their icon out of an atlas; every other node uses the full texture.
-- Recycled pins therefore always get their coordinates reset to the full 0..1
-- rectangle when they are reused for a non-trainer role.
local function TexCoordForNode(node)
if node and node.role=="classTrainer" then
local c=CLASS_TRAINER_COORDS[node.trainerKey or ""]
if c then return c[1],c[2],c[3],c[4] end
elseif node and node.role=="professionTrainer" then
local c=PROFESSION_TRAINER_COORDS[node.trainerKey or ""]
if c then return c[1],c[2],c[3],c[4] end
end
return 0,1,0,1
end
-- Turtle deliberately keeps full quest XP through 25 levels above the quest
-- (Tortoise src/game/QuestDef.cpp). The server file is XP logic rather than a
@@ -141,6 +181,8 @@ local function TextureForNode(node)
if node.role=="spiritHealer" then return TEX_SPIRITHEALER end
if node.role=="stableMaster" then return TEX_STABLEMASTER end
if node.role=="vendor" then return TEX_VENDOR end
if node.role=="classTrainer" then return TEX_CLASSTRAINER end
if node.role=="professionTrainer" then return TEX_PROFESSIONTRAINER end
if node.role=="rareMob" then return TEX_RARE end
if node.role=="itemStart" then
-- Presentation priority: PvP > Repeatable > Event > Turtle low-level gray > Normal.
@@ -223,9 +265,13 @@ local function ApplyVisualRole(pin,node)
pin.repeatable=node.repeatable and true or false
pin.sourceKind=node.sourceKind
pin.sourceID=node.sourceID
pin.trainerKey=node.trainerKey
pin.displayName=node.sourceName or pin.displayName or "Quest source"
pin.iconScaleKey=node.iconScaleKey or ScaleKeyForRole(node.role)
pin.texture:SetTexture(TextureForNode(node))
-- Trainer pins crop their icon from a shared atlas; reset to the full
-- rectangle for every other (recycled) role.
if pin.texture.SetTexCoord then pin.texture:SetTexCoord(TexCoordForNode(node)) end
pin.texture:SetDrawLayer("OVERLAY",DrawSublevelForRole(node.role))
-- Miscellaneous/rare markers stay below quest pins so an overlapping
-- quest objective, starter or turn-in remains visible and clickable.
@@ -245,6 +291,10 @@ function M:GetTextureForNode(node)
return TextureForNode(node)
end
function M:GetTexCoordForNode(node)
return TexCoordForNode(node)
end
function M:IsGrayAvailableQuest(node)
return IsGrayAvailableQuest(node)
end
@@ -276,7 +326,8 @@ function M:GetPinScale(pin)
if pin and (pin.role=="auctioneer" or pin.role=="banker" or pin.role=="flightMaster" or
pin.role=="mailbox" or pin.role=="battlemaster" or pin.role=="innkeeper" or
pin.role=="meetingStone" or pin.role=="repair" or pin.role=="spiritHealer" or
pin.role=="stableMaster" or pin.role=="vendor") then
pin.role=="stableMaster" or pin.role=="vendor" or
pin.role=="classTrainer" or pin.role=="professionTrainer") then
return 0.9
end
return 1
@@ -398,8 +449,25 @@ local function AttachWorldMapPinInput(pin)
if not pin then return end
pin:EnableMouse(true)
pin:RegisterForClicks("LeftButtonUp")
pin:SetScript("OnEnter",function() QuestieOcto.Tooltips:Show(this) end)
pin:SetScript("OnLeave",function() QuestieOcto.Tooltips:Hide(this) end)
pin:SetScript("OnEnter",function()
QuestieOcto.Tooltips:Show(this)
-- Hovering an objective pin drives the same dim/glow highlight as hovering
-- the quest header in the tracker: this quest's objectives stay bright and
-- glow while everything else fades. Only objective roles trigger it so
-- pickup/turn-in markers keep the normal hover behavior.
if QuestieOcto.MapHighlight and this.questID
and QuestieOcto.Visuals and QuestieOcto.Visuals:IsObjectiveRole(this.role) then
this.highlightArmed=true
QuestieOcto.MapHighlight:Set(this.questID)
end
end)
pin:SetScript("OnLeave",function()
QuestieOcto.Tooltips:Hide(this)
if this.highlightArmed and QuestieOcto.MapHighlight then
this.highlightArmed=nil
QuestieOcto.MapHighlight:Clear()
end
end)
-- Full Node objective dots re-roll their quest color on click; otherwise a
-- continent-map marker still behaves as a zone-entry target.
pin:SetScript("OnClick",function()
@@ -674,6 +742,9 @@ function M:RenderItemStartArea(area,generation,continentZoneMapID)
pin.displayName=area.displayName
pin.clusterCount=area.n
pin.texture:SetTexture(TextureForNode({role="itemStart",questID=area.questID,event=pin.event,pvp=pin.pvp,repeatable=pin.repeatable}))
-- Item-start-area pins use the full texture (defensive reset in case this
-- frame was ever recycled from an atlas-cropped trainer pin).
if pin.texture.SetTexCoord then pin.texture:SetTexCoord(0,1,0,1) end
pin.texture:SetDrawLayer("OVERLAY",5)
if QuestieOcto.Visuals then
QuestieOcto.Visuals:ApplyPin(pin,{role="itemStart",questID=area.questID,pvp=pin.pvp,repeatable=pin.repeatable},false,1)
@@ -1217,6 +1288,7 @@ function M:OnSettingChanged(key,value)
key=="showMapFlightMaster" or key=="showMapMailbox" or
key=="showMapBattlemaster" or key=="showMapInnkeeper" or key=="showMapMeetingStone" or
key=="showMapRepair" or key=="showMapSpiritHealer" or key=="showMapStableMaster" or key=="showMapVendor" or
key=="showMapClassTrainer" or key=="showMapProfessionTrainer" or
key=="showMapRareMonsters" then
self:RequestSync(true)
end