Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 28 additions & 13 deletions API.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1533,30 +1533,19 @@ do -- Quest
local TextModifier = TextModifier_None;

local function GetModifiedQuestText(method)
local text = GetQuestText(method);
if text then
return TextModifier(text)
end
return TextModifier(GetQuestText(method))
end
API.GetModifiedQuestText = GetModifiedQuestText;

local function GetModifiedGossipText()
local text = GetGossipText();
if text then
return TextModifier(text)
end
return TextModifier(GetGossipText());
end
API.GetModifiedGossipText = GetModifiedGossipText;

local function SetDialogueTextModifier(modifierFunc)
TextModifier = modifierFunc or TextModifier_None;
end
addon.SetDialogueTextModifier = SetDialogueTextModifier;

addon.SetChatTextModifier = function(modifierFunc)
modifierFunc("test");
CallbackRegistry:Trigger("SetChatTextModifier", modifierFunc or TextModifier_None);
end
end


Expand Down Expand Up @@ -2520,7 +2509,33 @@ do -- Tooltip
end
API.GetRewardItemLevelDelta = GetRewardItemLevelDelta;

-- Armor subClassID: 1=Cloth, 2=Leather, 3=Mail, 4=Plate
local CLASS_ARMOR_TYPE = {
WARRIOR = 4, PALADIN = 4, DEATHKNIGHT = 4,
HUNTER = 3, SHAMAN = 3, EVOKER = 3,
ROGUE = 2, MONK = 2, DRUID = 2, DEMONHUNTER = 2,
MAGE = 1, PRIEST = 1, WARLOCK = 1,
};

local function IsEquipmentForPlayerClass(item)
local _, _, _, _, _, classID, subClassID = GetItemInfoInstant(item);
-- For armor pieces with a specific armor type (cloth/leather/mail/plate),
-- reject items that don't match the player's armor proficiency
if classID == 4 and subClassID >= 1 and subClassID <= 4 then
local _, playerClass = UnitClass("player");
local expectedType = playerClass and CLASS_ARMOR_TYPE[playerClass];
if expectedType and subClassID ~= expectedType then
return false
end
end
return true
end
API.IsEquipmentForPlayerClass = IsEquipmentForPlayerClass;

local function IsItemAnUpgrade(newLink)
if not IsEquipmentForPlayerClass(newLink) then
return false, true
end
local delta, isReady = GetMaxEquippedItemLevelDelta(newLink)
return (delta and delta > 0), isReady
end
Expand Down
2 changes: 2 additions & 0 deletions Code/GossipData/ItemData_Container.lua
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ local MiscUsableItem = {
--Some items don't align to the pattern (Flags_0 is 0x0)
[142447] = true, --Torn Sack of Pet Supplies
[184866] = true, --Grummlepouch
[257023] = true, --Preyseeker's Adventurer Chest
[264274] = true, --Fabled Adventurer's Cache
};

function API.IsContainerItem(itemID)
Expand Down
17 changes: 17 additions & 0 deletions Code/Settings/Settings.lua
Original file line number Diff line number Diff line change
Expand Up @@ -493,6 +493,18 @@ local function QuestItemDisplayPosition_Validation()
return f and f:IsUsingCustomPosition()
end

local function QuickSlot_Move_OnClick()
addon.QuickSlotManager:ToggleEditMode();
end

local function QuickSlot_Reset_OnClick()
addon.QuickSlotManager:ResetPosition();
end

local function QuickSlotPosition_Validation()
return addon.QuickSlotManager:IsUsingCustomPosition()
end

local function RPAddOn_Validation()
return addon.GetInstalledRPAddOnName() ~= nil
end
Expand Down Expand Up @@ -711,6 +723,11 @@ local Schematic = { --Scheme

{type = "Subheader", name = L["Quest"]},
{type = "Checkbox", name = L["Valuable Reward Popup"], description = L["Valuable Reward Popup Desc"], dbKey = "QuickSlotQuestReward", preview = "QuickSlotQuestReward", ratio = 2},
{type = "Checkbox", name = L["Always-On Loot Popup"], description = L["Always-On Loot Popup Desc"], dbKey = "QuickSlotAlwaysOn", requiredParentValueAnd = {QuickSlotQuestReward = true}},
{type = "Checkbox", name = L["Upgrades And Containers Only"], description = L["Upgrades And Containers Only Desc"], dbKey = "QuickSlotPriorityOnly", requiredParentValueAnd = {QuickSlotQuestReward = true, QuickSlotAlwaysOn = true}},
{type = "Checkbox", name = L["Include Collectibles"], description = L["Include Collectibles Desc"], dbKey = "QuickSlotCollectibleHighPriority", requiredParentValueAnd = {QuickSlotQuestReward = true, QuickSlotAlwaysOn = true}},
{type = "Custom", name = L["Move Position"], icon = "Settings-Move.png", onClickFunc = QuickSlot_Move_OnClick, requiredParentValueAnd = {QuickSlotQuestReward = true}},
{type = "Custom", name = L["Reset Position"], icon = "Settings-Reset.png", validationFunc = QuickSlotPosition_Validation, onClickFunc = QuickSlot_Reset_OnClick, requireSameParentValue = true},
{type = "Checkbox", name = L["Auto Complete Quest"], description = L["Auto Complete Quest Desc"], dbKey = "AutoCompleteQuest", preview = "QuestAutoComplete", ratio = 2},
{type = "Checkbox", name = L["Press Key To Use Item"], tooltip = UseItemHotkey_Tooltip, dbKey = "QuickSlotUseHotkey", requiredParentValueOr = {QuickSlotQuestReward = true, AutoCompleteQuest = true}, branchLevel = 0},

Expand Down
1 change: 1 addition & 0 deletions Code/SupportedAddOns/SupportedAddOns.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
<Script file="Wholly.lua"/>
<Script file="Roleplay.lua"/>
<Script file="Pawn.lua"/>
<Script file="Zygor.lua"/>
<Script file="InteractiveWormholes.lua"/>
<Script file="Rematch.lua"/>
<Script file="BtWQuests.lua"/>
Expand Down
154 changes: 154 additions & 0 deletions Code/SupportedAddOns/Zygor.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,154 @@
-- Zygor Guides Item Score Integration
local _, addon = ...
local API = addon.API;


do
local ADDON_NAME = "ZygorGuidesViewer";

local requiredMethods = {
"ZGV";
};

local function OnAddOnLoaded()
local ZGV = _G.ZGV;
if not (ZGV and ZGV.ItemScore and ZGV.ItemScore.Upgrades) then return end;

local ItemScore = ZGV.ItemScore;
local Upgrades = ItemScore.Upgrades;
local tooltip = addon.SharedTooltip;
local floor = math.floor;

local function get_change(old, new)
if old and old > 0 then
return floor(((new * 100 / old) - 100) * 100) / 100
else
return 100
end
end

-- Override upgrade detection for reward item arrows
API.IsItemAnUpgrade_External = function(itemLink)
if not ItemScore.ActiveRuleSet then
return API.IsItemAnUpgrade(itemLink)
end
local isUpgrade, slot, change, score, comment = Upgrades:IsUpgrade(itemLink);
if comment == "not scored" or comment == "no link" then
-- For unscored trinkets, fall back to ilvl-based comparison.
-- Zygor does not score trinkets, but ilvl is a useful proxy.
-- This does not imply full stat/effect evaluation.
local itemDetails = ItemScore:GetItemDetails(itemLink, "temporary");
if itemDetails and itemDetails.type == "INVTYPE_TRINKET" then
return API.IsItemAnUpgrade(itemLink)
end
return nil, false
end
return isUpgrade, true
end

-- Append a single slot's upgrade/downgrade line to the tooltip.
local function addSlotLine(self, slotLabel, futurePrefix, stripped, equipped, score)
if equipped and (equipped.score or score) then
if stripped ~= equipped.itemlink then
local change;
if equipped.score and ItemScore:IsValidItem(equipped.itemlink) then
change = get_change(equipped.artifactscore or equipped.score, score);
else
change = 100;
end
local pct = (change > 999) and "999+" or tostring(change);
if change > 0 then
self:AddLeftLine(" " .. slotLabel .. futurePrefix .. "Upgrade: +" .. pct .. "%", 0, 1, 0, false, nil, 2);
elseif change < 0 then
self:AddLeftLine(" " .. slotLabel .. futurePrefix .. "Downgrade: " .. pct .. "%", 1, 0, 0, false, nil, 2);
else
self:AddLeftLine(" " .. slotLabel .. "No change", 0.6, 0.6, 0.6, false, nil, 2);
end
else
self:AddLeftLine(" " .. slotLabel .. "Equipped", 0.6, 0.6, 0.6, false, nil, 2);
end
elseif (score or 0) > 0 then
self:AddLeftLine(" " .. slotLabel .. futurePrefix .. "Upgrade: +100%", 0, 1, 0, false, nil, 2);
end
end

-- Add Zygor score info to reward item tooltip
function tooltip:ProcessItemExternal(itemLink)
if not ItemScore.ActiveRuleSet then return end;

local item = ItemScore:GetItemDetails(itemLink, "temporary");
if not item then return end;
if item.type == "INVTYPE_NON_EQUIP_IGNORE" then return end;

local score, success = ItemScore:GetItemScore(item.itemlink);
if not success then return end;

local valid, validfuture, final = ItemScore:IsValidItem(item.itemlink, "future");
if not final then return end;

local spec = ItemScore.ActiveRuleSet.specname;
local specText = spec and (" (" .. spec .. ")") or "";

self:AddBlankLine();
self:AddLeftLine("Zygor ItemScore" .. specText .. ":", 254/255, 97/255, 0, true);

if valid or validfuture then
local futurePrefix = (not valid and validfuture) and "Future " or "";
local slot_1, slot_2 = item.slot, item.slot_2;
local hasTwoSlots = slot_2 ~= nil;
local stripped = item.itemlink;

addSlotLine(self,
hasTwoSlots and "Slot 1: " or "",
futurePrefix, stripped,
slot_1 and Upgrades.EquippedItems[slot_1],
score);

if hasTwoSlots then
addSlotLine(self,
"Slot 2: ",
futurePrefix, stripped,
Upgrades.EquippedItems[slot_2],
score);
end
else
if item.type == "INVTYPE_TRINKET" then
-- Zygor does not score trinkets; fall back to item level comparison.
-- This does not imply full stat/effect evaluation.
local newIlvl = API.GetItemLevel(itemLink);
if newIlvl and newIlvl > 0 then
self:AddLeftLine(" Trinket comparison (item level):", 0.6, 0.6, 0.6, true, nil, 2);
for i, slotID in ipairs({13, 14}) do
local label = " Trinket " .. i .. ": ";
local equippedLink = GetInventoryItemLink("player", slotID);
if equippedLink then
local equippedIlvl = API.GetItemLevel(equippedLink);
if equippedIlvl and equippedIlvl > 0 then
local delta = newIlvl - equippedIlvl;
if delta > 0 then
self:AddLeftLine(label .. "Upgrade: +" .. delta .. " ilvl", 0, 1, 0, false, nil, 2);
elseif delta < 0 then
self:AddLeftLine(label .. "Downgrade: " .. delta .. " ilvl", 1, 0, 0, false, nil, 2);
else
self:AddLeftLine(label .. "No change", 0.6, 0.6, 0.6, false, nil, 2);
end
end
else
self:AddLeftLine(label .. "Upgrade: empty slot", 0, 1, 0, false, nil, 2);
end
end
else
self:AddLeftLine(" Trinkets are not part of the scoring system.", 0.6, 0.6, 0.6, true, nil, 2);
end
else
local specName = ItemScore.playerspecName or (ItemScore.ActiveRuleSet and ItemScore.ActiveRuleSet.specname) or "current spec";
self:AddLeftLine(" Not valid for " .. specName, 1, 0, 0, false, nil, 2);
end
end

self:Show();
end
end

addon.AddSupportedAddOn(ADDON_NAME, OnAddOnLoaded, requiredMethods);
end
8 changes: 8 additions & 0 deletions Code/Widget/WidgetManager.lua
Original file line number Diff line number Diff line change
Expand Up @@ -583,6 +583,14 @@ do --Change Main Anchor Position
Text:SetShadowColor(1, 1, 1, 0.5);
Text:SetShadowOffset(2, -2);
Text:SetText(L["Popup Position"]);

self.tooltipText = L["Drag To Move"].."\n"..L["Right Click To Dismiss"];
self:SetScript("OnEnter", function(s)
TooltipFrame.ShowWidgetTooltip(s);
end);
self:SetScript("OnLeave", function()
TooltipFrame.HideTooltip();
end);
end

function AnchorPosition:OnMouseUp(button)
Expand Down
Loading