Skip to content

Commit

Permalink
Last new slash command
Browse files Browse the repository at this point in the history
  • Loading branch information
Ghostopheles committed Sep 4, 2023
1 parent 23e45e5 commit 84df4b8
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 8 deletions.
5 changes: 3 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@
* `PreviewCustomizationChoice` allows you to view a customization choice using a ChrCustomizationOptionID and a ChrCustomizationChoiceID
* `SetDressState` allows you to manually toggle your character's dress state using 1 or 0
* If the console is not enabled, you can enable it with `/console enable` or by launching your game with the `-console` flag
* Added a new slash command `/dm appearanceinfo` to return some transmog data from an AppearanceID
* Added a command `/dm tryonitem` to try on an item by itemID. Note that item IDs can have multiple appearances, so this might not be 100% what you're expecting.
* Added a new slash command `/dm appearanceinfo` to return some transmog data from an itemAppearanceID
* Added a command `/dm appearancemods` to return all itemModifiedAppearanceIDs for a given itemAppearanceID
* Added a command `/dm tryonitem` to try on an item by itemID. Note that item IDs can have multiple appearances, so this might not be 100% what you're expecting

##### Fixed
* Fixed an infinite loop in the `/dm quest` command
Expand Down
53 changes: 47 additions & 6 deletions Datamine/Modules/TransmogData.lua
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,46 @@ end;
Datamine.Transmog = {};

local LinkPrefix = "transmogData";
local TryOnPrefix = "tryOn";

function Datamine.Transmog.HandleLink(pattern)
local prefix, itemModifiedAppearanceID = strsplit(Datamine.Links.SEPARATOR, pattern);
if prefix == "tryOn" then
Datamine.ModelView:Show({itemModifiedAppearanceID})
return;
end
end

function Datamine.Transmog:GetItemIDLink(itemID)
local pattern = LinkPrefix .. Datamine.Links.SEPARATOR .. itemID;
return Datamine.Links.GenerateLinkWithCallback(pattern, itemID, Datamine.Item.HandleLink);
end

function Datamine.Transmog:GetAppearanceSourceInfo(appearanceID)
local sourceInfo = C_TransmogCollection.GetSourceInfo(appearanceID)
function Datamine.Transmog:GetTryOnLink(itemModifiedAppearanceID)
local pattern = TryOnPrefix .. Datamine.Links.SEPARATOR .. itemModifiedAppearanceID;
return Datamine.Links.GenerateLinkWithCallback(pattern, "Try On", Datamine.Transmog.HandleLink);
end

function Datamine.Transmog:GetModifiedAppearanceIDsFromAppearanceID(appearanceID)
local itemModifiedAppearanceIDs = C_TransmogCollection.GetAllAppearanceSources(appearanceID);

if not itemModifiedAppearanceIDs or #itemModifiedAppearanceIDs < 1 then
Print("No ItemModifiedAppearances found for ItemAppearance " .. appearanceID .. ".");
return;
end

local outputTable = {}

for i, v in ipairs(itemModifiedAppearanceIDs) do
local tryOnLink = self:GetTryOnLink(v);
outputTable[i] = v .. " " .. tryOnLink;
end

Dump("ItemModifiedAppearances for ItemAppearance " .. appearanceID .. " >>", outputTable);
end

function Datamine.Transmog:GetAppearanceSourceInfo(itemModifiedAppearanceID)
local sourceInfo = C_TransmogCollection.GetSourceInfo(itemModifiedAppearanceID)
sourceInfo.categoryID = Datamine.GetEnumValueName(Enum.TransmogCollectionType, sourceInfo.categoryID);
local _, _, _, itemEquipLoc, _ = GetItemInfoInstant(sourceInfo.itemID);
local outputTable = {};
Expand Down Expand Up @@ -74,12 +106,21 @@ function Datamine.Transmog:GetAppearanceSourceInfo(appearanceID)
outputTable.CategoryID = sourceInfo.categoryID;
outputTable.ItemModID = sourceInfo.itemModID;

Dump("Appearance " .. appearanceID .. " >> ", outputTable);
Dump("Appearance " .. itemModifiedAppearanceID .. " >> ", outputTable);

return true;
end

local helpMessage = "Retrieve source info for an appearanceID.";
local helpString = Datamine.Slash.GenerateHelpStringWithArgs("<appearanceID>", helpMessage);
do
local helpMessage = "Retrieve source info for an itemModifiedAppearanceID.";
local helpString = Datamine.Slash.GenerateHelpStringWithArgs("<itemModifiedAppearanceID>", helpMessage);

Datamine.Slash:RegisterCommand("appearanceinfo", function(itemModifiedAppearanceID) Datamine.Transmog:GetAppearanceSourceInfo(itemModifiedAppearanceID) end, helpString, moduleName);
end

do
local helpMessage = "Retrieve itemModifiedAppearanceIDs for a given itemAppearanceID.";
local helpString = Datamine.Slash.GenerateHelpStringWithArgs("<itemAppearanceID>", helpMessage);

Datamine.Slash:RegisterCommand("appearanceinfo", function(appearanceID) Datamine.Transmog:GetAppearanceSourceInfo(appearanceID) end, helpString, moduleName);
Datamine.Slash:RegisterCommand("appearancemods", function(appearanceID) Datamine.Transmog:GetModifiedAppearanceIDsFromAppearanceID(appearanceID) end, helpString, moduleName);
end

0 comments on commit 84df4b8

Please sign in to comment.