diff --git a/Commands.txt b/Commands.txt
index 7670629..594d574 100644
--- a/Commands.txt
+++ b/Commands.txt
@@ -3,7 +3,7 @@
--------------------------------------------------------------------------------
The latest version of this document can be found online at:
-https://github.com/wow-addon/FarmIt2/blobl/master/Commands.txt
+https://github.com/wow-addon/FarmIt2/blob/master/Commands.txt
A general user guide can be found at:
https://github.com/wow-addon/FarmIt2/blob/master/UserGuide.txt
diff --git a/FarmIt2_Button.lua b/FarmIt2_Button.lua
index b239898..6258e3e 100644
--- a/FarmIt2_Button.lua
+++ b/FarmIt2_Button.lua
@@ -24,7 +24,7 @@
function FI_Tooltip( self )
-- allow user to disable item slot tooltips
if (FI_SV_CONFIG.Tooltips.button == false) then return; end
-
+
-- get the button id
local bid = FI_FrameToID( self:GetName() );
@@ -33,7 +33,7 @@ function FI_Tooltip( self )
-- db queries
local button = FI_DB.select(FI_SVPC_DATA.Buttons, {id = bid}, true);
local bar = FI_DB.select(FI_SVPC_DATA.Groups, {id = button.group}, true);
-
+
-- determine where to attach the tooltip
local anchor,x,y;
if (bar.grow == "U") then
@@ -49,18 +49,18 @@ function FI_Tooltip( self )
anchor = "ANCHOR_RIGHT";
x,y = 8,0;
end
-
+
GameTooltip:SetOwner(self, anchor, x,y);
-
+
-- BUILD TOOLTIP
if button.item then
local spacer = ": ";
-
+
-- extra item info
- local sName, sLink, iQuality, iLevel, iMinLevel, sType, sSubType, iStackSize = GetItemInfo(button.item);
+ local sName, sLink, iQuality, iLevel, iMinLevel, sType, sSubType, iStackSize = C_Item.GetItemInfo(button.item);
if sLink then
GameTooltip:SetHyperlink(sLink);
-
+
-- check for iTip
if C_AddOns.IsAddOnLoaded("iTip") then
-- let iTip do this part (prevents duplicate info)
@@ -75,17 +75,17 @@ function FI_Tooltip( self )
GameTooltip:AddLine("(error)");
GameTooltip:AddLine(FI_LABELS[3]..spacer..button.item, 1,1,1);
end
-
+
-- FarmIt info
GameTooltip:AddLine("\n|cFF33CCFF"..FI_LABELS[4]..spacer..button.id, 1,1,1);
-
+
local counts = FI_LABELS[5]..spacer..button.count;
if iStackSize and (iStackSize > 1) then
local stacks = LIB.round((button.count/iStackSize),2);
counts = counts.." ("..stacks.." "..FI_LABELS[6]..")";
end
GameTooltip:AddLine(counts, 1,1,1);
-
+
if (button.objective > 0) then
GameTooltip:AddLine(FI_LABELS[7]..spacer..button.objective, 1,1,1);
end
@@ -93,9 +93,9 @@ function FI_Tooltip( self )
if (button.objective > 0) then
GameTooltip:AddLine(FI_LABELS[9]..spacer..strupper(tostring(button.success)));
end
-
+
GameTooltip:AddLine("_________________________________\n", 0.33,0.33,0.33);
-
+
-- show button help text
local help_text = {
"|cFF00FF00Click|r to select/move an item.",
@@ -111,7 +111,7 @@ function FI_Tooltip( self )
GameTooltip:AddLine(help_text[4], 1,1,1);
GameTooltip:AddLine(help_text[5], 1,1,1);
GameTooltip:AddLine(help_text[6], 1,1,1);
-
+
-- all done!
GameTooltip:Show();
end
@@ -145,41 +145,41 @@ end
-- added in v2.0 beta2
function FI_Move_Item( bid1, bid2 )
FI_MOVING = true;
-
+
local source = FI_DB.select(FI_SVPC_DATA.Buttons, {id = bid1}, true);
local target = FI_DB.select(FI_SVPC_DATA.Buttons, {id = bid2}, true);
-
+
-- move the selected button data
if FI_SV_CONFIG.debug then print("FI_Move_Item: Moving ItemID "..source.item); end
FI_DB.copy(FI_SVPC_DATA.Buttons, {id = source.id}, {id = target.id}); --preserves the primary key ("id" field)
-- make sure the destination button keeps its *group* id
FI_DB.update(FI_SVPC_DATA.Buttons, {id = target.id}, {group = target.group}); --do NOT update variable!
-
+
-- load new button data in destination (target) slot
FI_Set_Button(target.id);
-
+
-- clear original (source) button
FI_Clear_Button(source.id);
-
+
-- swapping contents with a populated button?
if target.item then
if FI_SV_CONFIG.debug then print("FI_Move_Item: Swapping places with ItemID "..target.item); end
-
+
-- get table index of source button
local index = FI_DB.find(FI_SVPC_DATA.Buttons, {id = source.id}, true);
-
+
-- copy target button data over source button
FI_SVPC_DATA.Buttons[index] = LIB.table.copy(target);
-- keep the original IDs so things dont get all discombobulated (technical term)
FI_SVPC_DATA.Buttons[index]["id"] = source.id;
FI_SVPC_DATA.Buttons[index]["group"] = source.group;
-
+
-- load button data
FI_Set_Button(source.id);
end
-
+
FI_Deselect();
-
+
FI_MOVING = false;
end
@@ -189,9 +189,9 @@ end
function FI_Click( self, click, down )
local f_name = self:GetName();
if FI_SV_CONFIG.debug then print("You CLICKED the "..click.." ("..tostring(down)..") on frame: "..f_name); end
-
+
local button = FI_DB.select(FI_SVPC_DATA.Buttons, {id = FI_FrameToID(f_name)}, true);
-
+
if CursorHasItem() then
------------------------------------------------------------
-- NEW ITEM
@@ -205,22 +205,22 @@ function FI_Click( self, click, down )
-- clear item from cursor
ClearCursor();
end
-
+
elseif (click == "LeftButton") then
if _G["FI_Button_Edit_Item"] then _G["FI_Button_Edit_Item"]:Hide(); end
-
+
if IsShiftKeyDown() then
------------------------------------------------------------
-- INCLUDE BANK
------------------------------------------------------------
FI_Toggle_Bank(button.id);
-
+
elseif IsControlKeyDown() then
------------------------------------------------------------
-- SET OBJECTIVE
------------------------------------------------------------
FI_Edit_Objective(button.id);
-
+
elseif FI_SELECTED then
------------------------------------------------------------
-- MOVE
@@ -231,14 +231,14 @@ function FI_Click( self, click, down )
else
FI_Move_Item(FI_SELECTED, button.id);
end
-
+
elseif button.item then
------------------------------------------------------------
-- SELECT ITEM
------------------------------------------------------------
FI_Select(button.id);
end
-
+
elseif (click == "RightButton") then
if IsShiftKeyDown() then
------------------------------------------------------------
@@ -248,13 +248,13 @@ function FI_Click( self, click, down )
FI_Clear_Button(button.id);
PlaySound(798); -- gsTitleOptionOK
end
-
+
elseif IsControlKeyDown() then
------------------------------------------------------------
-- MANUAL ITEM ENTRY
------------------------------------------------------------
FI_Edit_Item(self, button);
-
+
else
------------------------------------------------------------
-- USE ITEM
@@ -263,9 +263,9 @@ function FI_Click( self, click, down )
-- See FarmIt2_Button.xml, FI_FRAMES.Button, and FI_Set_Button
if button.item then
-- make sure we actually have the item in our inventory
- if GetItemSpell(button.item) and (GetItemCount(button.item) > 0) then
+ if C_Item.GetItemSpell(button.item) and (C_Item.GetItemCount(button.item) > 0) then
-- inform user that Right-Click action was received
- local itemName, itemLink = GetItemInfo(button.item);
+ local itemName, itemLink = C_Item.GetItemInfo(button.item);
if itemLink then
FI_Message("Using "..itemLink);
end
@@ -284,45 +284,45 @@ end
function FI_Update_Button( bid, db_record )
local button;
-
+
-- streamline button data access when we are doing a global update
if db_record then
button = db_record;
else
button = FI_DB.select(FI_SVPC_DATA.Buttons, {id = bid}, true);
end
-
+
if button.item then
if FI_SV_CONFIG.debug and (FI_LOADING == false) and false then
print("Update running... ButtonID: "..button.id..", ItemID: "..button.item..", Count: "..button.count); --debug
end
local f_name = "FI_Button_"..button.id;
-
+
--------------------------------------------------------------------------------
-- CHECK FOR FAILED SERVER QUERIES
--------------------------------------------------------------------------------
-- attempt to fix missing icons
if not _G[f_name.."_Icon"]:GetTexture() then
if FI_SV_CONFIG.debug then print("Update found a missing texture on BID "..button.id); end
-
- _G[f_name.."_Icon"]:SetTexture( GetItemIcon(button.item) );
+
+ _G[f_name.."_Icon"]:SetTexture( C_Item.GetItemIconByID(button.item) );
end
-
+
-- make sure secure template action has been set
if not _G[f_name]:GetAttribute("macrotext") then
if FI_SV_CONFIG.debug then print("Update found missing macrotext on BID "..button.id); end
-
- local itemName = GetItemInfo(button.item);
+
+ local itemName = C_Item.GetItemInfo(button.item);
if itemName then
_G[f_name]:SetAttribute("macrotext", "/use "..itemName);
end
end
-
+
--------------------------------------------------------------------------------
-- GET CURRENT ITEM COUNT
--------------------------------------------------------------------------------
- local newcount = GetItemCount(button.item, button.bank);
-
+ local newcount = C_Item.GetItemCount(button.item, button.bank, nil, button.materialsBank , button.warHoundsBank);
+
-- try to be smart about only running interface and data changes when we need to
if FI_LOADING or FI_MOVING or (newcount ~= button.count) then
--------------------------------------------------------------------------------
@@ -333,16 +333,16 @@ function FI_Update_Button( bid, db_record )
["lastcount"] = button.count,
}
button = FI_DB.update(FI_SVPC_DATA.Buttons, {id = button.id}, query);
-
+
-- update graphical counter
_G[f_name.."_Count"]:SetText( LIB.ShortNum(button.count,1,4) );
-
+
--------------------------------------------------------------------------------
-- PROGRESS TRACKING
--------------------------------------------------------------------------------
FI_Progress(button);
end
-
+
else
-- no item, clear the count
_G["FI_Button_"..button.id.."_Count"]:SetText("");
@@ -351,7 +351,7 @@ end
function FI_Set_Button( bid, newItem )
local button;
-
+
-- update itemID before setting button elements
if newItem then
FI_Clear_Button(bid);
@@ -359,24 +359,24 @@ function FI_Set_Button( bid, newItem )
else
button = FI_DB.select(FI_SVPC_DATA.Buttons, {id = bid}, true);
end
-
+
if button.item then
local f_name = "FI_Button_"..button.id;
-- set icon
- _G[f_name.."_Icon"]:SetTexture( GetItemIcon(button.item) ); --if this fails, FI_Update_Button should fix it
+ _G[f_name.."_Icon"]:SetTexture( C_Item.GetItemIconByID(button.item) ); --if this fails, FI_Update_Button should fix it
-- bank inclusion indicator
if button.bank then
_G[f_name.."_Bank"]:Show();
end
-
+
-- set secure template action
- local itemName, itemLink = GetItemInfo(button.item); --if this fails, FI_Update_Button should fix it
+ local itemName, itemLink = C_Item.GetItemInfo(button.item); --if this fails, FI_Update_Button should fix it
if itemName then
_G[f_name]:SetAttribute("macrotext", "/use "..itemName);
end
-
+
-- handle objective
if (button.objective == 0) or CursorHasItem() then
-- no objective -OR- we are in the middle of placing a new item
@@ -389,20 +389,20 @@ function FI_Set_Button( bid, newItem )
precision = 1;
end
_G[f_name.."_Objective"]:SetText(LIB.ShortNum(button.objective,precision,4));
-
+
local color;
if (button.count < button.objective) then
color = FI_SV_CONFIG.Colors.objective;
else
color = FI_SV_CONFIG.Colors.success;
end
-
+
_G[f_name.."_Objective"]:SetVertexColor(color[1], color[2], color[3]);
_G[f_name.."_Objective"]:Show();
end
-
+
FI_Update_Button(nil, button);
-
+
if FI_SV_CONFIG.debug then
if itemLink then
print( "FI_Set_Button: Button ID "..button.id.." set to "..itemLink ); --debug
@@ -415,7 +415,7 @@ end
function FI_Clear_Button( bid )
local button = FI_DB.select(FI_SVPC_DATA.Buttons, {id = bid}, true);
-
+
if button then
-- reset button data
local i = FI_DB.find(FI_SVPC_DATA.Buttons, {id = button.id}, true);
@@ -425,15 +425,15 @@ function FI_Clear_Button( bid )
FI_SVPC_DATA.Buttons[i]["group"] = button.group;
FI_Clear_Objective(button.id);
-
+
if _G["FI_Button_Edit_Item"] then _G["FI_Button_Edit_Item"]:Hide(); end
-
+
-- reset graphical elements
local f_name = "FI_Button_"..button.id;
_G[f_name.."_Icon"]:SetTexture("");
_G[f_name.."_Count"]:SetText("");
_G[f_name.."_Bank"]:Hide();
-
+
-- clear secure template action
_G[f_name]:SetAttribute("macrotext", nil);
elseif FI_SV_CONFIG.debug then
@@ -447,12 +447,12 @@ end
function FI_Edit_Item( self, button )
local f_name = self:GetName();
local eb_name = "FI_Button_Edit_Item";
-
+
-- hide objective editboxes
for i,b in ipairs(FI_SVPC_DATA.Buttons) do
_G["FI_Button_"..b.id.."_Edit"]:Hide();
end
-
+
-- create item editbox if it doesn't exist yet
if not _G[eb_name] then
local f = CreateFrame("EditBox", eb_name, _G["FI_PARENT"], "FI_TPL_Editbox");
@@ -471,18 +471,18 @@ function FI_Edit_Item( self, button )
f:SetAutoFocus(true);
f:SetHistoryLines(10);
end
-
+
-- adjust anchoring as needed
_G[eb_name]:SetParent(self);
_G[eb_name]:SetPoint("TOP", self, "BOTTOM", 0, 0);
-
+
-- populate editbox
if button.item and (button.item > 0) then
_G[eb_name]:SetNumber(button.item);
else
_G[eb_name]:SetNumber(0);
end
-
+
_G[eb_name]:Show();
_G[eb_name]:HighlightText();
end
@@ -490,14 +490,14 @@ end
function FI_Set_Item( editbox )
local parent = editbox:GetParent();
local bid = FI_FrameToID( parent:GetName() );
-
+
-- get input
local itemID = editbox:GetNumber();
if itemID and (itemID > 0) then
-- process item id
FI_Set_Button(bid, itemID);
end
-
+
editbox:Hide();
end
@@ -509,27 +509,44 @@ function FI_Tooltip_Edit_Item( self )
end
--------------------------------------------------------------------------------
--- BANK INVENTORY
+-- BANK INVENTORY | WarHoundsBank | Material Bank
--------------------------------------------------------------------------------
function FI_Toggle_Bank( bid )
local button = FI_DB.select(FI_SVPC_DATA.Buttons, {id = bid}, true);
local f_name = "FI_Button_"..button.id;
-
+
if button.item then
-- change setting
- button = FI_DB.update(FI_SVPC_DATA.Buttons, {id = button.id}, {bank = LIB.toggle(button.bank)});
-
+ button = FI_DB.update(FI_SVPC_DATA.Buttons, {id = button.id}, {
+ bank = LIB.toggle(button.bank),
+ warHoundsBank = LIB.toggle(button.warHoundsBank),
+ materialsBank = LIB.toggle(button.materialsBank)
+ });
+
-- bank indicator
if button.bank then
_G[f_name.."_Bank"]:Show();
else
_G[f_name.."_Bank"]:Hide();
end
-
+
+ -- WarHoundsBank indicator
+ if button.warHoundsBank then
+ _G[f_name.."_WarHoundsBank"]:Show();
+ else
+ _G[f_name.."_WarHoundsBank"]:Hide();
+ end
+
+ if button.materialsBank then
+ _G[f_name.."_MaterialsBank"]:Show();
+ else
+ _G[f_name.."_MaterialsBank"]:Hide();
+ end
+
-- refresh item count
FI_Update_Button(button.id);
-
+
PlaySound(6145); -- TalentScreenClose
- FI_Message("Button ID "..button.id..": Include Bank = "..strupper(tostring(button.bank)));
+ FI_Message("Button ID "..button.id..":\n Include |cFFFFFF00Bank|r = "..strupper(tostring(button.bank))..", \n Include |cFFFFFF00Warband Bank|r = "..strupper(tostring(button.warHoundsBank))..", \n Include |cFFFFFF00Material Bank|r = "..strupper(tostring(button.materialsBank)));
end
end
diff --git a/FarmIt2_Button.xml b/FarmIt2_Button.xml
index fcf3bf7..89a7366 100644
--- a/FarmIt2_Button.xml
+++ b/FarmIt2_Button.xml
@@ -66,7 +66,33 @@ xsi:schemaLocation="http://www.blizzard.com/wow/ui/ ..\..\FrameXML\UI.xsd">
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+