From 336501316212022ba772e2e59a2e6e2a23dac1a8 Mon Sep 17 00:00:00 2001 From: James Whitehead II Date: Fri, 15 Aug 2008 07:17:26 +0000 Subject: [PATCH] Pass the item slot to the weight function and fix an error when opening interface options instead of using /dress config --- DressToKill.lua | 5 +++-- DressToKillOptions.lua | 2 ++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/DressToKill.lua b/DressToKill.lua index 3219f61..e88124d 100644 --- a/DressToKill.lua +++ b/DressToKill.lua @@ -130,7 +130,7 @@ local function scanFunction(weightFunction) local equipped = DressToKill:EquipItem(slotId, mask, stash) if equipped then local link = GetInventoryItemLink("player", slotId) - local score = weightFunction(link) + local score = weightFunction(link, slotId) if score >= maxScore then maxScore = score winner = mask @@ -247,7 +247,8 @@ SlashCmdList["DRESSTOKILL"] = function(msg, editbox) -- Compile the function local source = DressToKill.profile.weightFuncs[weightName].handler - local weightFunction,err = loadstring("return function (link) " .. source .. " end") + local newsrc = string.format("return function (link, slot) %s end", source) + local weightFunction,err = loadstring(newsrc) if not weightFunction then print("Failed to compile weight function: " .. tostring(err)) diff --git a/DressToKillOptions.lua b/DressToKillOptions.lua index 9d0134e..9cb198c 100644 --- a/DressToKillOptions.lua +++ b/DressToKillOptions.lua @@ -4,6 +4,8 @@ local frame = CreateFrame("Frame", "DressToKillOptionsFrame", UIParent) frame.name = L["Dress to Kill"] frame:Hide() frame:SetScript("OnShow", function(frame) + -- Initialize the system + DressToKill:Initialize() local title = frame:CreateFontString(nil, "OVERLAY", "GameFontNormalLarge") title:SetPoint("TOPLEFT", frame, "TOPLEFT", 15, -15) title:SetPoint("BOTTOMRIGHT", frame, "TOPRIGHT", 10, -45) -- 1.7.9.5