Skip to content

Commit

Permalink
Merge pull request #10 from Tyrsenus/master
Browse files Browse the repository at this point in the history
Merge updates
  • Loading branch information
eTzmNcbkrng authored Apr 16, 2022
2 parents e18f26c + 6c77f10 commit b4846fd
Show file tree
Hide file tree
Showing 7 changed files with 439 additions and 110 deletions.
49 changes: 47 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,49 @@
# WardrobeTools

This Addon was initialy copied from a forum post [here](http://stormspire.net/general-tradeskillmaster-discussion/18409-mailing-groups-boe-armor-classes-post169681.html#post169681).
The majority was written by Martin Karer and is distributed under his license.
WardrobeTools is a simple World of Warcraft addon that streamlines transmog/appearance mailing and collection between alts. It has two functions:

* **Mailer**: With one click, WardobeTools examines all BOE armor and weapons in your inventory, determines if you have collected the appearance from each, and if not, automatically mails each item to alts that can equip them. This can be done with the "Send Transmogs" button that WardrobeTools adds to the default mailbox UI.

* **AppearanceCollector**: Once your alts have received the mailed items, use **/ac** to display the AppearanceCollector button. Clicking the button will equip an uncollected appearance item from your inventory. Clicking the button again will equip the next uncollected item, and so forth, until all appearances have been collected from items in your inventory. The last click will swap back to your original equipment.

### Simple Setup

* Open WardrobeTools settings from the default mailbox UI, by clicking the [>] button next to "Send Transmogs."
* In this menu, enter the names of your alts that you want to send each armor and weapon type to.
* Then click "Send Transmogs" to mail items.
* Hover on "Send Transmogs" for a preview of which items will be mailed.

The settings are saved separately for each realm and faction.

### New Advanced Feature: TradeSkillMaster Filtering!

WardrobeTools' mailer can now stop items from being mailed, based on values from TradeSkillMaster. (This is an entirely optional feature, WardrobeTools works without TSM too.)

Let’s say you’ve finished running some old dungeons. Your inventory is full of BOEs. Some of these BOEs are appearances you haven't collected. But some of those BOEs are also really valuable! You *could* sift through all of them one by one, send all the "worthless" BOEs to your alts to collect the appearance, and send the valuable BOEs to your auction house alt. That's time consuming. Now WardrobeTools can decide whether to mail or not mail BOEs based on a TSM price source.

For example, if you *don't* want to collect appearances from BOEs with a DMarket value over 1000g, you can specify that in the settings. WardrobeTools will still mail uncollected items to your alts, *unless an item has a DBMarket value over 1000g.* Those items will stay in your inventory. You can then follow up with your normal TSM mailing operation to send the remaining valuable BOEs to your auction house alt. **This is the recommended workflow: run WardrobeTools with TSM filtering first, then run your normal TSM mailing operations.**

### Setting up TSM Filtering

The TSM filter settings are located with the other settings accessible through the mailbox UI:

- **Enable TSM Filtering**: Turns the TSM filter on and off.
- **TSM Price Source**: any valid TradeSkillMaster price source (DBMarket, DBHistorical, etc.) or custom string.
- **Mail only if price source is less than**: WardrobeTools will *not* mail items if the price source is greater than this value. Must be a numeric value, including two silver and two copper digits. (For example, 1000g must be inputted as 10000000). Don't put a "g" or anything on the end.

If these settings aren't valid or TSM isn't installed, WardrobeTools will not send *any* mail until you fix the settings or un-check "Enable TSM filtering."

## **IMPORTANT: TSM filtering only applies to MAILING. AppearanceCollector (/ac) does *not* look at TSM data. If there are valuable uncollected appearances in your inventory, /ac will *not* stop you from equipping them.**

### Do I need TradeSkillMaster to use WardrobeTools?

No. Open WardrobeTools’ settings, and uncheck “Enable TSM filtering.” WardrobeTools will then send items to your specified alts according to the other filters, regardless of value.

### What happened to using mouse scroll with AppearanceCollector?

That was a bit of a risky and hidden feature, which might cause you to accidentally equip transmogs you want to sell (it happened to me, I was unaware scroll wheel did anything until after months of using this addon). I've disabled the mouse scroll, but if you really want, you can re-enable it by un-commenting the two lines in the "BindMouseWheel" function in appearance_collector.lua.

### Addon History

- This Addon was initialy copied from a forum post [here](http://stormspire.net/general-tradeskillmaster-discussion/18409-mailing-groups-boe-armor-classes-post169681.html#post169681).
- The majority was written by Martin Karer/Sezz and is distributed under his license.
6 changes: 3 additions & 3 deletions WardrobeTools/WardrobeTools.toc
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
## Interface: 80000
## Interface: 90100
## Title: WardrobeTools
## Notes: Quickly soulbind items for collecting their appearance and mail them to other characters
## Notes: A simple addon to streamline transmog/appearance collection.
## SavedVariables: WardrobeToolsADB
## SavedVariablesPerCharacter: WardrobeToolsCDB
## Version: 0.9.9
## Version: 1.0.0

## OptionalDeps: sUI
## X-SezzADB: WardrobeToolsADB
Expand Down
65 changes: 34 additions & 31 deletions WardrobeTools/wardrobe/accountwide_outfits.lua
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,9 @@ addon.OnEnable = function(self)

if (not S.InGame) then
self:RegisterEvent("PLAYER_LOGIN");
else
self:SyncOutfits();
--else
--self:SyncOutfits();
--self:SyncOutfits();
end
end

Expand All @@ -73,16 +74,18 @@ addon.SyncOutfits = function(self)

-- fetch outfits from server
local serverOutfits = {};
for _, outfit in pairs(GetOutfits()) do
local appearanceSources, mainHandEnchant, offHandEnchant = GetOutfitSources(outfit.outfitID);
for _, outfit in ipairs(C_TransmogCollection.GetOutfits()) do

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

serverOutfits[outfit.name] = {
id = outfit.outfitID,
icon = outfit.icon,
appearanceSources = appearanceSources,
mainHandEnchant = mainHandEnchant,
offHandEnchant = offHandEnchant,
};

end

-- compare outfits
Expand Down Expand Up @@ -167,7 +170,7 @@ addon.SyncOutfits = function(self)
end

addon.PLAYER_LOGIN = function(self, event)
self:SyncOutfits();
--self:SyncOutfits();
self:UnregisterEvent(event);
end

Expand Down Expand Up @@ -196,29 +199,29 @@ hooksecurefunc(C_TransmogCollection, "DeleteOutfit", function(outfitID)
end
end);

hooksecurefunc(C_TransmogCollection, "SaveOutfit", function(name, appearanceSources, mainHandEnchant, offHandEnchant, icon)
-- We cannot use the passed arguments because they are different to C_TransmogCollection.GetOutfitSources() return values
if (not addon.enabledState or syncing) then return; end

local found = false;
for _, outfit in pairs(GetOutfits()) do
if (outfit.name == name) then
found = true;

local appearanceSources, mainHandEnchant, offHandEnchant = GetOutfitSources(outfit.outfitID);
addon.outfits[name] = {
id = outfit.outfitID,
appearanceSources = appearanceSources,
mainHandEnchant = mainHandEnchant,
offHandEnchant = offHandEnchant,
icon = icon,
modifiedBy = myCharacter,
};
break;
end
end

if (not found) then
addon:PrintError(strformat("Recently saved outfit %s not found on server!", name));
end
end);
-- hooksecurefunc(C_TransmogCollection, "SaveOutfit", function(name, appearanceSources, mainHandEnchant, offHandEnchant, icon)
-- -- We cannot use the passed arguments because they are different to C_TransmogCollection.GetOutfitSources() return values
-- if (not addon.enabledState or syncing) then return; end

-- local found = false;
-- for _, outfit in pairs(GetOutfits()) do
-- if (outfit.name == name) then
-- found = true;

-- local appearanceSources, mainHandEnchant, offHandEnchant = GetOutfitSources(outfit.outfitID);
-- addon.outfits[name] = {
-- id = outfit.outfitID,
-- appearanceSources = appearanceSources,
-- mainHandEnchant = mainHandEnchant,
-- offHandEnchant = offHandEnchant,
-- icon = icon,
-- modifiedBy = myCharacter,
-- };
-- break;
-- end
-- end

-- if (not found) then
-- addon:PrintError(strformat("Recently saved outfit %s not found on server!", name));
-- end
-- end);
7 changes: 4 additions & 3 deletions WardrobeTools/wardrobe/appearance_collector.lua
Original file line number Diff line number Diff line change
Expand Up @@ -277,9 +277,10 @@ addon.OnDisable = function(self)
DeleteAppearanceCollectorEquipmentSet();
end

addon.BindMouseWheel = function(self)
SetOverrideBindingClick(self, true, "MOUSEWHEELUP", self:GetName());
SetOverrideBindingClick(self, true, "MOUSEWHEELDOWN", self:GetName());
addon.BindMouseWheel = function(self)
--SetOverrideBindingClick(self, true, "MOUSEWHEELUP", self:GetName());
--SetOverrideBindingClick(self, true, "MOUSEWHEELDOWN", self:GetName());
return;
end

addon.UnbindMouseWheel = function(self)
Expand Down
31 changes: 27 additions & 4 deletions WardrobeTools/wardrobe/core.lua
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
Returns values:
isTradable (boolean)
--]]

Expand Down Expand Up @@ -125,6 +126,7 @@ local PlayerHasApperanceSource = function(item)
return false;
end


local PlayerHasTransmog = function(item, checkSource, forceRefresh)
if (not item or (checkSource and not S.ItemIsValidTransmogrifySource(item))) then return; end
model:SetUnit("player");
Expand All @@ -146,9 +148,25 @@ local PlayerHasTransmog = function(item, checkSource, forceRefresh)
local itemID = type(item) == "string" and tonumber(strmatch(item, "item:(%d+)")) or item;
isCollected = C_TransmogCollection.PlayerHasTransmog(itemID);
else
model:TryOn(item);

local appearanceSourceID = model:GetSlotTransmogSources(equipSlotIDs[equipSlot]);
model:TryOn(item,slot);

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

-- Credit to TorelTwiddler (CanIMogIt)

local transmogInfo = model:GetItemTransmogInfo(equipSlotIDs[equipSlot]);
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
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 @@ -219,6 +237,7 @@ local PlayerHasTransmog = function(item, checkSource, forceRefresh)
return isCollected, isCollectedSource;
end


S.PlayerHasTransmog = PlayerHasTransmog;

-----------------------------------------------------------------------------
Expand All @@ -231,7 +250,11 @@ local ItemIsValidTransmogrifySource = function(itemLink)
if (itemClassID == LE_ITEM_CLASS_ARMOR and itemSubClassID == LE_ITEM_ARMOR_COSMETIC) then return true; end -- C_Transmog.GetItemInfo() doesn't like cosmetic armor

local isDressable = IsDressableItem(itemID);
local _, _, canBeSource, noSourceReason = C_Transmog.GetItemInfo(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
Loading

0 comments on commit b4846fd

Please sign in to comment.