Skip to content

Commit

Permalink
Add Pawn upgrade support and fix a few errors / messages
Browse files Browse the repository at this point in the history
  • Loading branch information
Caerdon committed Nov 21, 2022
1 parent 4841e2d commit c4c7ccc
Show file tree
Hide file tree
Showing 9 changed files with 97 additions and 24 deletions.
48 changes: 33 additions & 15 deletions CaerdonItem.lua
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,7 @@ function CaerdonItemMixin:GetCaerdonItemType()
caerdonType = CaerdonItemType.Toy
elseif isConduit then
caerdonType = CaerdonItemType.Conduit
elseif linkType == "battlepet" then
elseif linkType == "battlepet" then
caerdonType = CaerdonItemType.BattlePet
elseif linkType == "quest" then
caerdonType = CaerdonItemType.Quest
Expand Down Expand Up @@ -415,12 +415,18 @@ function CaerdonItemMixin:GetCaerdonItemType()
elseif typeID == Enum.ItemClass.Profession then
caerdonType = CaerdonItemType.Profession
else
print("Unknown item type " .. tostring(typeID) .. ", " .. tostring(linkType) .. " (unknown): " .. itemLink)
print("Caerdon: Unknown item type " .. tostring(typeID) .. ", " .. tostring(linkType) .. " (unknown): " .. itemLink)
end
elseif linkType == "achievement" then
caerdonType = CaerdonItemType.Unhandled
elseif linkType == "journal" then
caerdonType = CaerdonItemType.Unhandled
elseif linkType == "keystone" then
caerdonType = CaerdonItemType.Unhandled
elseif linkType == "spell" then
caerdonType = CaerdonItemType.Unhandled
else
print("Unknown type " .. tostring(typeID) .. ", " .. tostring(linkType) .. " (unknown): " .. itemLink)
print("Caerdon: Unknown type " .. tostring(typeID) .. ", " .. tostring(linkType) .. " (unknown): " .. itemLink)
end

self.caerdonItemType = caerdonType
Expand Down Expand Up @@ -573,25 +579,25 @@ function CaerdonItemMixin:GetTooltipData(data)
tooltipData.foundRedRequirements = true
end
elseif line.type == Enum.TooltipDataLineType.Blank then
-- elseif args.type == Enum.TooltipDataLineType.UnitName then
elseif line.type == Enum.TooltipDataLineType.UnitName then
elseif line.type == Enum.TooltipDataLineType.GemSocket then
elseif line.type == Enum.TooltipDataLineType.AzeriteEssenceSlot then
-- elseif line.type == Enum.TooltipDataLineType.AzeriteEssencePower then
elseif line.type == Enum.TooltipDataLineType.AzeriteEssencePower then
-- elseif line.type == Enum.TooltipDataLineType.LearnableSpell then
-- elseif line.type == Enum.TooltipDataLineType.UnitThreat then
-- elseif line.type == Enum.TooltipDataLineType.QuestObjective then
-- elseif line.type == Enum.TooltipDataLineType.AzeriteItemPowerDescription then
-- elseif line.type == Enum.TooltipDataLineType.RuneforgeLegendaryPowerDescription then
elseif line.type == Enum.TooltipDataLineType.UnitThreat then
elseif line.type == Enum.TooltipDataLineType.QuestObjective then
elseif line.type == Enum.TooltipDataLineType.AzeriteItemPowerDescription then
elseif line.type == Enum.TooltipDataLineType.RuneforgeLegendaryPowerDescription then
elseif line.type == Enum.TooltipDataLineType.SellPrice then
elseif line.type == Enum.TooltipDataLineType.ProfessionCraftingQuality then
-- elseif line.type == Enum.TooltipDataLineType.SpellName then
elseif line.type == Enum.TooltipDataLineType.SpellName then
elseif line.type == Enum.TooltipDataLineType.CurrencyTotal then
-- elseif line.type == Enum.TooltipDataLineType.UnitOwner then
-- elseif line.type == Enum.TooltipDataLineType.QuestTitle then
-- elseif line.type == Enum.TooltipDataLineType.QuestPlayer then
elseif line.type == Enum.TooltipDataLineType.UnitOwner then
elseif line.type == Enum.TooltipDataLineType.QuestTitle then
elseif line.type == Enum.TooltipDataLineType.QuestPlayer then
elseif line.type == Enum.TooltipDataLineType.NestedBlock then
else
print("TOOLTIP PROCESSING NEEDED: " .. self:GetItemLink() .. ", type: " .. tostring(line.type))
print("Caerdon: TOOLTIP PROCESSING NEEDED: " .. self:GetItemLink() .. ", type: " .. tostring(line.type))
-- DevTools_Dump(line)
end
end
Expand Down Expand Up @@ -854,7 +860,7 @@ function CaerdonItemMixin:GetCaerdonStatus(feature, locationInfo) -- TODO: Need
if bindingResult.needsItem then
local conduitInfo = itemData:GetConduitInfo()
if conduitInfo.isUpgrade then
mogStatus = "upgrade"
mogStatus = "upgradeNonEquipment"
else
mogStatus = "own"
end
Expand Down Expand Up @@ -910,6 +916,12 @@ function CaerdonItemMixin:GetCaerdonStatus(feature, locationInfo) -- TODO: Need
else
mogStatus = "collected"
end
elseif transmogInfo.isUpgrade then
if transmogInfo.hasMetRequirements then
mogStatus = "upgrade"
else
mogStatus = "upgradeLowSkill"
end
else
if transmogInfo.hasMetRequirements then
mogStatus = "collected"
Expand All @@ -918,6 +930,12 @@ function CaerdonItemMixin:GetCaerdonStatus(feature, locationInfo) -- TODO: Need
-- mogStatus = "lowSkill"
end
end
elseif transmogInfo.isUpgrade then
if transmogInfo.hasMetRequirements then
mogStatus = "upgrade"
else
mogStatus = "upgradeLowSkill"
end
else
if not transmogInfo.hasMetRequirements then
mogStatus = "lowSkill"
Expand Down
32 changes: 30 additions & 2 deletions CaerdonWardrobe.lua
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ function CaerdonWardrobeMixin:SetItemButtonStatus(originalButton, item, feature,
button.isWaitingIcon = true
end
else
if status == "readyToCombine" or status == "own" or status == "ownPlus" or status == "otherSpec" or status == "otherSpecPlus" or status == "refundable" or status == "openable" or status == "locked" or status == "upgrade" or status == "readyToCombine" then
if status == "readyToCombine" or status == "own" or status == "ownPlus" or status == "otherSpec" or status == "otherSpecPlus" or status == "refundable" or status == "openable" or status == "locked" or status == "upgradeNonEquipment" or status == "readyToCombine" then
showAnim = true

if mogAnim and button.isWaitingIcon then
Expand Down Expand Up @@ -333,10 +333,38 @@ function CaerdonWardrobeMixin:SetItemButtonStatus(originalButton, item, feature,
-- mogStatus:SetTexture("Interface\\QUESTFRAME\\SkillUp-BG")
-- mogStatus:SetTexture("Interface\\DialogFrame\\UI-Dialog-Icon-AlertNew")
-- mogStatus:SetTexture("Interface\\Buttons\\JumpUpArrow")
elseif status == "upgrade" then
elseif status == "upgradeNonEquipment" then
isProminent = false
iconBackgroundAdjustment = 4
mogStatusBackground:SetTexCoord((512-46-31)/512, (512-31)/512, 5/512, (5+46)/512)
mogStatusBackground:SetTexture("Interface\\HUD\\UIUnitFrameBoss2x")
mogStatusBackground:SetVertexColor(0, 1, 1)

mogStatus:SetTexCoord(-1/32, 33/32, -1/32, 33/32)
mogStatus:SetTexture("Interface\\Buttons\\JumpUpArrow")
elseif status == "upgrade" then
isProminent = false
if displayInfo and displayInfo.upgradeIcon.shouldShow then
iconBackgroundAdjustment = 4
mogStatusBackground:SetTexCoord((512-46-31)/512, (512-31)/512, 5/512, (5+46)/512)
mogStatusBackground:SetTexture("Interface\\HUD\\UIUnitFrameBoss2x")
mogStatusBackground:SetVertexColor(0, 1, 1)

mogStatus:SetTexCoord(-1/32, 33/32, -1/32, 33/32)
mogStatus:SetTexture("Interface\\Buttons\\JumpUpArrow")
end
elseif status == "upgradeLowSkill" then
isProminent = false
if displayInfo and displayInfo.upgradeIcon.shouldShow then
iconBackgroundAdjustment = 4
mogStatusBackground:SetTexCoord((512-46-31)/512, (512-31)/512, 5/512, (5+46)/512)
mogStatusBackground:SetTexture("Interface\\HUD\\UIUnitFrameBoss2x")
mogStatusBackground:SetVertexColor(0.4, 1, 0)

mogStatus:SetTexCoord(-1/32, 33/32, -1/32, 33/32)
mogStatus:SetTexture("Interface\\Buttons\\JumpUpArrow")
mogStatus:SetVertexColor(0.4, 1, 0)
end
elseif status == "locked" then
isProminent = true
mogStatus:SetTexCoord(16/64, 48/64, 16/64, 48/64)
Expand Down
4 changes: 2 additions & 2 deletions CaerdonWardrobe.toc
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
## Title: Caerdon Wardrobe
## Notes: Shows BOE / BOA, openable, and unlearned pets, toys, mounts and wardrobe indicator on bank / bag / auction / merchant / guild bank / loot frame / loot roll / encounter journal slots
## Author: Caerdon
## Version: v3.2.4
## Version: v3.3.0
## SavedVariables: CaerdonWardrobeConfig
## OptionalDeps: WagoAnalytics, WoWUnit, AdiBags, AngrierWorldQuests, ArkInventory, Bagnon, BaudBag, cargBags_Nivaya, Combuctor, ElvUI, Inventorian, KkthnxUI, Sorted, VenturePlan, WorldQuestsList, WorldQuestTab, WorldQuestTracker, ZygorGuidesViewer
## OptionalDeps: WagoAnalytics, WoWUnit, AdiBags, AngrierWorldQuests, ArkInventory, Bagnon, BaudBag, cargBags_Nivaya, Combuctor, ElvUI, Inventorian, KkthnxUI, Pawn, Sorted, VenturePlan, WorldQuestsList, WorldQuestTab, WorldQuestTracker, ZygorGuidesViewer

libs\libs.xml
libs\WagoAnalytics\Shim.lua
Expand Down
4 changes: 4 additions & 0 deletions FeatureMixin.lua
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,15 @@ end
function CaerdonWardrobeFeatureMixin:GetDisplayInfoInternal(button, item, feature, locationInfo, options, mogStatus, bindingStatus)
-- TODO: Temporary for merging - revisit after pushing everything into Mixins
local showBindingStatus = not item:HasItemLocationBankOrBags() or CaerdonWardrobeConfig.Binding.ShowStatus.BankAndBags
local showUpgradeIcon = not item:HasItemLocationBankOrBags() or CaerdonWardrobeConfig.Icon.ShowUpgrades.BankAndBags
local showOwnIcon = not item:HasItemLocationBankOrBags() or CaerdonWardrobeConfig.Icon.ShowLearnable.BankAndBags
local showOtherIcon = not item:HasItemLocationBankOrBags() or CaerdonWardrobeConfig.Icon.ShowLearnableByOther.BankAndBags
local showSellableIcon = not item:HasItemLocationBankOrBags() or CaerdonWardrobeConfig.Icon.ShowSellable.BankAndBags

local displayInfo = {
upgradeIcon = {
shouldShow = showUpgradeIcon
},
bindingStatus = {
shouldShow = showBindingStatus -- true
},
Expand Down
2 changes: 2 additions & 0 deletions config/BankAndBags.lua
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ function CaerdonWardrobeConfigBankAndBagsMixin:Register()
showLearnableByOther = { key = "showLearnableByOther", text = "Show items learnable for a different toon", tooltip = "Highlights items that can be learned and used for transmog but not by your current toon.", configSection="Icon", configSubsection="ShowLearnableByOther", configValue="BankAndBags" },
showSellable = { key = "showSellable", text = "Show items that can probably be sold", tooltip = "Highlights items that are bound to you but not usable and can probably be sold.", configSection="Icon", configSubsection="ShowSellable", configValue="BankAndBags" },
showBindingText = { key = "showBindingText", text = "Show binding text", tooltip = "Show binding text on items based on General configuration.", configSection="Binding", configSubsection="ShowStatus", configValue="BankAndBags" },
shownPawnUpgrade = { key = "showPawnUpgrade", text = "Show if Pawn identifies as an upgrade", tooltip = "Show upgrade arrow on items (requires Pawn addon).", configSection="Icon", configSubsection="ShowUpgrades", configValue="BankAndBags" },
}

self:ConfigureSection(self:GetTitle(), "BankAndBagsSection")
Expand All @@ -23,6 +24,7 @@ function CaerdonWardrobeConfigBankAndBagsMixin:Register()
self:ConfigureCheckboxNew(self.options["showLearnableByOther"])
self:ConfigureCheckboxNew(self.options["showSellable"])
self:ConfigureCheckboxNew(self.options["showBindingText"])
self:ConfigureCheckboxNew(self.options["shownPawnUpgrade"])
end

SettingsRegistrar:AddRegistrant(function () CaerdonWardrobeConfigBankAndBagsMixin:Register() end)
6 changes: 5 additions & 1 deletion config/Config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ end

function NS:GetDefaultConfig()
return {
Version = 21,
Version = 22,

Debug = {
Enabled = false
Expand All @@ -84,6 +84,10 @@ function NS:GetDefaultConfig()
SameLookDifferentLevel = true
},

ShowUpgrades = {
BankAndBags = true
},

ShowLearnableByOther = {
BankAndBags = true,
GuildBank = true,
Expand Down
16 changes: 12 additions & 4 deletions features/Tooltip.lua
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,11 @@ function TooltipMixin:OnProcessInfo(tooltip, tooltipInfo)
local itemLink = GetLootSlotLink(slot);
local item = CaerdonItem:CreateFromItemLink(itemLink)
Tooltip:ProcessTooltip(tooltip, item)
elseif tooltipInfo.getterName == "GetLootRollItem" then
local rollID = unpack(tooltipInfo.getterArgs)
local itemLink = GetLootRollItemLink(rollID)
local item = CaerdonItem:CreateFromItemLink(itemLink)
Tooltip:ProcessTooltip(tooltip, item)
elseif tooltipInfo.getterName == "GetMerchantCostItem" then
local slot, costIndex = unpack(tooltipInfo.getterArgs)
local itemTexture, itemValue, itemLink, currencyName = GetMerchantItemCostItem(slot, costIndex);
Expand Down Expand Up @@ -355,10 +360,11 @@ function TooltipMixin:OnProcessInfo(tooltip, tooltipInfo)
local tooltipData = tooltip:GetTooltipData();
if tooltipData then
if tooltipData.type == Enum.TooltipDataType.Item then
print("MISSING HANDLER FOR " .. tooltipInfo.getterName)
print("Caerdon: MISSING HANDLER FOR " .. tooltipInfo.getterName)
local item = CaerdonItem:CreateFromItemID(tooltipData.id)
Tooltip:ProcessTooltip(tooltip, item)
elseif tooltipData.type == Enum.TooltipDataType.Achievement then
elseif tooltipData.type == Enum.TooltipDataType.EnhancedConduit then
elseif tooltipData.type == Enum.TooltipDataType.EquipmentSet then
elseif tooltipData.type == Enum.TooltipDataType.Spell then
elseif tooltipData.type == Enum.TooltipDataType.Unit then
Expand All @@ -369,7 +375,7 @@ function TooltipMixin:OnProcessInfo(tooltip, tooltipInfo)
elseif tooltipData.type == Enum.TooltipDataType.MinimapMouseover then
elseif tooltipData.type == Enum.TooltipDataType.QuestPartyProgress then
else
print("MISSING HANDLER FOR " .. tooltipInfo.getterName .. ", type: " .. tostring(tooltipData.type))
print("Caerdon: MISSING HANDLER FOR " .. tooltipInfo.getterName .. ", type: " .. tostring(tooltipData.type))
end
end
end
Expand All @@ -378,8 +384,10 @@ end
function TooltipMixin:OnEmbeddedItemTooltipSetItemByQuestReward(tooltip, questLogIndex, questID, rewardType, showCollectionText)
rewardType = rewardType or "reward";
local itemLink = GetQuestLogItemLink(rewardType, questLogIndex, questID)
local item = CaerdonItem:CreateFromItemLink(itemLink)
Tooltip:ProcessTooltip(tooltip.Tooltip, item, true)
if itemLink then
local item = CaerdonItem:CreateFromItemLink(itemLink)
Tooltip:ProcessTooltip(tooltip.Tooltip, item, true)
end
end

-- function TooltipMixin:OnTooltipSetItem(tooltip)
Expand Down
7 changes: 7 additions & 0 deletions types/EquipmentMixin.lua
Original file line number Diff line number Diff line change
Expand Up @@ -361,7 +361,14 @@ function CaerdonEquipmentMixin:GetTransmogInfo()
end
end

local isUpgrade = nil

if PawnShouldItemLinkHaveUpgradeArrow then
isUpgrade = PawnShouldItemLinkHaveUpgradeArrow(item:GetItemLink(), false)
end

return {
isUpgrade = isUpgrade,
isTransmog = isTransmog,
isBindOnPickup = isBindOnPickup,
appearanceID = appearanceID,
Expand Down
2 changes: 2 additions & 0 deletions types/QuestMixin.lua
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ function CaerdonQuestMixin:LoadQuestRewardData(callbackFunction)
-- TODO: Temp... pulls out quality info to allow extract link to work - may need to consolidate and use elsewhere or figure out if there's a new way to parse.
local tempLink = self.item:GetItemLink():gsub(" |A:.*|a]", "]")
local linkType, linkOptions, name = LinkUtil.ExtractLink(tempLink);
if not linkOptions then return end

local questID = strsplit(":", linkOptions);

local numQuestRewards
Expand Down

0 comments on commit c4c7ccc

Please sign in to comment.