Skip to content

Commit

Permalink
Merge pull request #14 from fubaWoW/master
Browse files Browse the repository at this point in the history
Update for Dragonflight
  • Loading branch information
eTzmNcbkrng authored Jan 31, 2023
2 parents ea25396 + 3cb4990 commit 5732438
Show file tree
Hide file tree
Showing 10 changed files with 185 additions and 117 deletions.
4 changes: 2 additions & 2 deletions WardrobeTools/WardrobeTools.toc
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
## Interface: 90100
## Interface: 100005
## Title: WardrobeTools
## Notes: A simple addon to streamline transmog/appearance collection.
## SavedVariables: WardrobeToolsADB
## SavedVariablesPerCharacter: WardrobeToolsCDB
## Version: 1.0.0
## Version: 1.0.2

## OptionalDeps: sUI
## X-SezzADB: WardrobeToolsADB
Expand Down
2 changes: 1 addition & 1 deletion WardrobeTools/loader.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@

<!-- Wardrobe Module -->
<Include file="wardrobe\load_wardrobe.xml" />
</Ui>
</Ui>
17 changes: 9 additions & 8 deletions WardrobeTools/sUI.lua
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
--[[
--[[
Martin Karer / Sezz, 2008-2016
sUI Methods
Expand Down Expand Up @@ -103,7 +103,7 @@ end
-- UI
-----------------------------------------------------------------------------

S.UIParent = CreateFrame("Frame", "SezzUIParent", UIParent);
S.UIParent = CreateFrame("Frame", "SezzUIParent", UIParent, BackdropTemplateMixin and "BackdropTemplate");
S.UIParent:SetAllPoints(UIParent);

S.Scale = function(self, i)
Expand Down Expand Up @@ -199,7 +199,7 @@ local initializeSavedVariables = function(self, tableName)
DB[self.debugName] = {};
end
end

return DB;
end

Expand Down Expand Up @@ -228,7 +228,7 @@ local moduleSettingsLoadUser = function(self, includeAccountDB)

-- apply metatable
setmetatable(self.DB, {
__index = function(t, k)
__index = function(t, k)
return rawget(t, k) or C.modules[self.debugName][k];
end
});
Expand All @@ -255,7 +255,7 @@ end
local moduleSetEnabledState = function(self, state)
if (self.enabledState ~= state) then
self.enabledState = state;

if (state and self.OnEnable) then
self:OnEnable();
elseif (not state and self.OnDisable) then
Expand Down Expand Up @@ -402,7 +402,7 @@ S.UIParent:RegisterEvent("ADDON_LOADED", function(self, event, loadedAddonName)
if (tableCDB and not _G[tableCDB]) then
_G[tableCDB] = {};
end

-- Initializate modules
for moduleName, module in pairs(S.modules) do
if (module.OnInitialize and not module.__OnInitializeCalled) then
Expand Down Expand Up @@ -430,7 +430,8 @@ S.UIParent:RegisterEvent("PLAYER_LOGIN", HandleLevelUp);
-----------------------------------------------------------------------------

-- Hidden Tooltip for Scanning (Credits: tekkub)
local tt = CreateFrame("GameTooltip", "SezzUIScanningTooltip");
--local tt = CreateFrame("GameTooltip", "SezzUIScanningTooltip");
local tt = CreateFrame("GameTooltip", "SezzUIScanningTooltip", UIParent, "GameTooltipTemplate");
tt:SetOwner(WorldFrame, "ANCHOR_NONE");

local lcache, rcache = {}, {};
Expand Down Expand Up @@ -532,4 +533,4 @@ function S:Clone(t)

setmetatable(res, mt);
return res;
end
end
8 changes: 4 additions & 4 deletions WardrobeTools/wardrobe/accountwide_outfits.lua
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
--[[
--[[
Martin Karer / Sezz, 2016
Syncs outfits between all characters of the same class
Expand Down Expand Up @@ -65,7 +65,7 @@ end

local myCharacter = S.myName.."-"..S.myRealm;
local now = time(); -- load timestamp is fine, we don't need exact values
local deletedOutfit = { deletedAt = now };
local deletedOutfit = { deletedAt = now };

local syncing = false;

Expand All @@ -75,7 +75,7 @@ addon.SyncOutfits = function(self)
-- fetch outfits from server
local serverOutfits = {};
for _, outfit in ipairs(C_TransmogCollection.GetOutfits()) do

local appearanceSources, mainHandEnchant, offHandEnchant = C_TransmogCollection.GetOutfitSources(outfit);

serverOutfits[outfit.name] = {
Expand Down Expand Up @@ -224,4 +224,4 @@ end);
-- if (not found) then
-- addon:PrintError(strformat("Recently saved outfit %s not found on server!", name));
-- end
-- end);
-- end);
17 changes: 10 additions & 7 deletions WardrobeTools/wardrobe/appearance_collector.lua
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
--[[
--[[
Martin Karer / Sezz, 2016-2017
Wardrobe appearance collector for BoE items
Known issues:
- The API sometimes doesn't seem to know whether an appearance is collected or not, nothing I can do about that.
--]]

local addonName, ns = ...;
Expand All @@ -25,7 +25,10 @@ local addon = S:CreateModule("AppearanceCollector", "SezzUIAppearanceCollector",
local strlower, select, tonumber, strfind = string.lower, select, tonumber, string.find;

-- WoW API/Constants
local GetContainerNumSlots, GetContainerItemID, GetContainerItemLink, InCombatLockdown, SetOverrideBindingClick, ClearOverrideBindings, GetItemInfo = GetContainerNumSlots, GetContainerItemID, GetContainerItemLink, InCombatLockdown, SetOverrideBindingClick, ClearOverrideBindings, GetItemInfo;
local GetContainerItemID = GetContainerItemID or (C_Container and C_Container.GetContainerItemID)
local GetContainerItemLink = GetContainerItemLink or (C_Container and C_Container.GetContainerItemLink)
local GetContainerNumSlots = GetContainerNumSlots or (C_Container and C_Container.GetContainerNumSlots)
local InCombatLockdown, SetOverrideBindingClick, ClearOverrideBindings, GetItemInfo = InCombatLockdown, SetOverrideBindingClick, ClearOverrideBindings, GetItemInfo;
local SaveEquipmentSet, DeleteEquipmentSet, CreateEquipmentSet, UseEquipmentSet = C_EquipmentSet.SaveEquipmentSet, C_EquipmentSet.DeleteEquipmentSet, C_EquipmentSet.CreateEquipmentSet, C_EquipmentSet.UseEquipmentSet;
local LE_ITEM_CLASS_ARMOR, LE_ITEM_CLASS_WEAPON = LE_ITEM_CLASS_ARMOR, LE_ITEM_CLASS_WEAPON;
local GameTooltip_Hide = GameTooltip_Hide;
Expand Down Expand Up @@ -198,10 +201,10 @@ addon.OnEnable = function(self)
-- Create button
if (not self:GetAttribute("type")) then
self:SetPoint(self.DB.anchor, self.DB.x, self.DB.y);
self:SetSize(64, 64);
self:SetSize(48, 48);
self:SetScript("OnEnter", ShowTooltip);
self:SetScript("OnLeave", GameTooltip_Hide);
self:RegisterForClicks("LeftButtonUp", "RightButtonUp");
self:RegisterForClicks("LeftButtonUp", "RightButtonUp", "LeftButtonDown", "RightButtonDown");
self:SetMovable(true);
self:RegisterForDrag("LeftButton");
self:EnableMouse(true);
Expand Down Expand Up @@ -277,7 +280,7 @@ addon.OnDisable = function(self)
DeleteAppearanceCollectorEquipmentSet();
end

addon.BindMouseWheel = function(self)
addon.BindMouseWheel = function(self)
--SetOverrideBindingClick(self, true, "MOUSEWHEELUP", self:GetName());
--SetOverrideBindingClick(self, true, "MOUSEWHEELDOWN", self:GetName());
return;
Expand Down Expand Up @@ -332,4 +335,4 @@ S:RegisterSlashCommand("AC", "/ac", function(args)
else
addon:Toggle();
end
end);
end);
46 changes: 29 additions & 17 deletions WardrobeTools/wardrobe/core.lua
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
--[[
--[[
Martin Karer / Sezz, 2016
PlayerHasTransmog(itemID|itemLink[, checkSource, forceRefresh])
Returns if the player has collected the item apperance,
Use ItemIsValidTransmogrifySource first to check if the item appearance can be used for transmogging or pass checkSource as 2nd optional argument.
Set forceRefresh to true if you are also calling this on TRANSMOG_COLLECTION_UPDATED!
Return values:
hasTransmog (boolean)
hasTransmogSource (boolean) - due to Blizzard's limitations this only works for items the player can equip it
Expand Down Expand Up @@ -39,7 +39,7 @@
Returns values:
isTradable (boolean)
--]]

Expand All @@ -59,9 +59,21 @@ if (addonName == "WardrobeTools" and SezzUI) then return; end
local strmatch, tonumber, select = string.match, tonumber, select;

-- WoW API/Constants
local IsDressableItem, GetItemInfo = IsDressableItem, GetItemInfo;
local TRANSMOGRIFY_TOOLTIP_APPEARANCE_UNKNOWN, TRANSMOGRIFY_TOOLTIP_APPEARANCE_KNOWN, TRANSMOGRIFY_TOOLTIP_ITEM_UNKNOWN_APPEARANCE_KNOWN = TRANSMOGRIFY_TOOLTIP_APPEARANCE_UNKNOWN, TRANSMOGRIFY_TOOLTIP_APPEARANCE_KNOWN, TRANSMOGRIFY_TOOLTIP_ITEM_UNKNOWN_APPEARANCE_KNOWN;
local LE_ITEM_CLASS_ARMOR, LE_ITEM_ARMOR_CLOTH, LE_ITEM_ARMOR_LEATHER, LE_ITEM_ARMOR_MAIL, LE_ITEM_ARMOR_PLATE, LE_ITEM_CLASS_WEAPON, LE_ITEM_ARMOR_COSMETIC = LE_ITEM_CLASS_ARMOR, LE_ITEM_ARMOR_CLOTH, LE_ITEM_ARMOR_LEATHER, LE_ITEM_ARMOR_MAIL, LE_ITEM_ARMOR_PLATE, LE_ITEM_CLASS_WEAPON, LE_ITEM_ARMOR_COSMETIC;
local IsDressableItem = IsDressableItem or C_Item.IsDressableItemByID
local GetItemInfo = GetItemInfo;
local TRANSMOGRIFY_TOOLTIP_APPEARANCE_UNKNOWN = TRANSMOGRIFY_TOOLTIP_APPEARANCE_UNKNOWN
local TRANSMOGRIFY_TOOLTIP_APPEARANCE_KNOWN = TRANSMOGRIFY_TOOLTIP_APPEARANCE_KNOWN
local TRANSMOGRIFY_TOOLTIP_ITEM_UNKNOWN_APPEARANCE_KNOWN = TRANSMOGRIFY_TOOLTIP_ITEM_UNKNOWN_APPEARANCE_KNOWN
-- Armor
local LE_ITEM_CLASS_ARMOR = LE_ITEM_CLASS_ARMOR or Enum.ItemClass.Armor or 4
local LE_ITEM_ARMOR_CLOTH = LE_ITEM_ARMOR_CLOTH or Enum.ItemArmorSubclass.Cloth or 1
local LE_ITEM_ARMOR_LEATHER = LE_ITEM_ARMOR_LEATHER or Enum.ItemArmorSubclass.Leather or 2
local LE_ITEM_ARMOR_MAIL = LE_ITEM_ARMOR_MAIL or Enum.ItemArmorSubclass.Mail or 3
local LE_ITEM_ARMOR_PLATE = LE_ITEM_ARMOR_PLATE or Enum.ItemArmorSubclass.Plate or 4
local LE_ITEM_ARMOR_COSMETIC = LE_ITEM_ARMOR_COSMETIC or Enum.ItemArmorSubclass.Cosmetic or 5

-- Weapons
local LE_ITEM_CLASS_WEAPON = LE_ITEM_CLASS_WEAPON or Enum.ItemClass.Weapon or 2

-----------------------------------------------------------------------------

Expand Down Expand Up @@ -111,7 +123,7 @@ local equipSlotIDs = {
local PlayerHasApperanceSource = function(item)
-- Only works if C_TransmogCollection.GetShowMissingSourceInItemTooltips() is true!
tooltip:SetHyperlink(item);

for i = tooltip:NumLines(), 1, -1 do
local text = tooltip.L[i];
if (text) then
Expand Down Expand Up @@ -151,22 +163,22 @@ local PlayerHasTransmog = function(item, checkSource, forceRefresh)
model:TryOn(item,slot);

--local appearanceSourceID = model:GetSlotTransmogSources(equipSlotIDs[equipSlot]);

-- Credit to TorelTwiddler (CanIMogIt)

local transmogInfo = model:GetItemTransmogInfo(equipSlotIDs[equipSlot]);
if transmogInfo and
if transmogInfo and
transmogInfo.appearanceID ~= nil and
transmogInfo.appearanceID ~= 0 then
-- Yes, that's right, we are setting `appearanceID` to the `sourceID`. Blizzard messed
-- up the DressUpModel functions, so _they_ don't even know what they do anymore.
-- The `appearanceID` field from `DressUpModel:GetItemTransmogInfo` is actually its
-- source ID, not it's appearance ID.
appearanceSourceID = transmogInfo.appearanceID
appearanceSourceID = transmogInfo.appearanceID
end

--

if (appearanceSourceID == 0 and (equipSlotIDs[equipSlot] == 16 or equipSlotIDs[equipSlot] == 17)) then
-- Even though the model is undressed it sometimes puts weapons into the offhand slot instead of the mainhand slot,
-- especially when equipping 2 similar items (like two Baleful weapons with different attributes)
Expand Down Expand Up @@ -251,10 +263,10 @@ local ItemIsValidTransmogrifySource = function(itemLink)

local isDressable = IsDressableItem(itemID);
-- message(itemID)

-- local _, _, canBeSource, noSourceReason = C_Transmog.GetItemInfo(itemID);
local _, _, canBeSource, noSourceReason = select(1, C_Transmog.CanTransmogItem(itemID))

if (not isDressable or not canBeSource) then return false, noSourceReason; end

if (equipSlot == "INVTYPE_NECK" or equipSlot == "INVTYPE_FINGER" or equipSlot == "INVTYPE_TRINKET") then return false; end
Expand Down Expand Up @@ -360,4 +372,4 @@ local IsItemTradable = function(itemLink, allowBoA)
end

S.IsBagItemTradable = IsBagItemTradable;
S.IsItemTradable = IsItemTradable;
S.IsItemTradable = IsItemTradable;
2 changes: 1 addition & 1 deletion WardrobeTools/wardrobe/dressingroom.lua
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,4 @@ local buttonTarget = CreateFrame("Button", nil, DressUpFrame, "UIPanelButtonTemp
buttonTarget:SetPoint("LEFT", buttonUndress, "RIGHT", 0, 0);
buttonTarget:SetSize(80, 22);
buttonTarget:SetText("Target");
buttonTarget:SetScript("OnClick", modelSwap);
buttonTarget:SetScript("OnClick", modelSwap);
2 changes: 1 addition & 1 deletion WardrobeTools/wardrobe/load_wardrobe.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@
<Script file="tooltip.lua" />
<Script file="accountwide_outfits.lua" />
<Script file="dressingroom.lua" />
</Ui>
</Ui>
Loading

0 comments on commit 5732438

Please sign in to comment.