Skip to content

Commit

Permalink
Adding furniture crafting
Browse files Browse the repository at this point in the history
Initial version
 - Recipe tree
 - Selected recipe label
 - Search field, with some optimization
 - toggles to select which recipe list you look at
 - Beta warning
 - Crafts the furniture
 - Craft queue has two template types now
 - item craft cost now formatted
 - Mailing and to chat features for furniture
 - Crafting house port, added a bunch of guild houses to it
 - When porting to a craft house, will display a greeting
 - Furniture beta warning
 - Currently does not show favourites list on furniture screen (todo)
 - Added a variable to the localization to allow localizations to change width of the mat scroll
 - Maze ports to feedback window
 - Mails now properly separate by the set name, if there are multiple sets in the same mail
 - Recipes in the tree are coloured by quality
 - Tooltip when hovering over recipe
 - Recipe list allows you to close all categories
 - Searching by text will search by 'starts with' if it is less than two letters, and a full search if more than two letters
  • Loading branch information
Dolgubon committed Jan 15, 2024
1 parent f0578dd commit a9192b2
Show file tree
Hide file tree
Showing 12 changed files with 871 additions and 41 deletions.
87 changes: 82 additions & 5 deletions Crafter.lua
Original file line number Diff line number Diff line change
Expand Up @@ -398,6 +398,7 @@ local function addToQueue(requestTable, craftMultiplier )
if returnedTable then
addRequirements(returnedTable, true)
end
requestTableCopy.typeId = 1
if requestTableCopy then
queue[#queue+1] = requestTableCopy
end
Expand Down Expand Up @@ -589,7 +590,18 @@ function GetEnchantQuality(itemLink)
return 0
end

local recipeItemTypes=
{
[ITEMTYPE_DRINK] = 1, [ITEMTYPE_FOOD] = 1, [ITEMTYPE_FURNISHING] = 1
}

local function verifyLinkIsValid(link)
local itemType = GetItemLinkItemType(link)
if recipeItemTypes[itemType] then
if GetRecipeInfoFromItemId(GetItemLinkItemId(link)) then
return true
end
end
local _,_,_,_,_,setIndex=GetItemLinkSetInfo(link)
if setIndex > 0 and not LibLazyCrafting.GetSetIndexes()[setIndex] then
return false
Expand All @@ -607,6 +619,12 @@ local function addByItemLinkToQueue(itemLink)
if not verifyLinkIsValid(itemLink) then
return
end
local itemType = GetItemLinkItemType(itemLink)
if recipeItemTypes[itemType] then
if GetRecipeInfoFromItemId(GetItemLinkItemId(itemLink)) then
return DolgubonSetCrafter.addFurnitureByLink(itemLink)
end
end

local requestTable = {}

Expand Down Expand Up @@ -709,9 +727,64 @@ function DolgubonSetCrafter.compileMatRequirements()
end
end

function DolgubonSetCrafter.craft()
function DolgubonSetCrafter.addFurniture()
if DolgubonSetCrafter.selectedFurniture ~= "" then
requestTableCopy = {}
requestTableCopy["Reference"] = DolgubonSetCrafter.savedvars.counter
DolgubonSetCrafter.savedvars.counter = DolgubonSetCrafter.savedvars.counter + 1
local requestParameters =
{
DolgubonSetCrafter.selectedFurniture, 1, DolgubonSetCrafter:GetAutocraft(), requestTableCopy["Reference"]
}
local returnedTable = LazyCrafter:CraftProvisioningItemByResultItemId(unpack(requestParameters))
requestTableCopy["CraftRequestTable"] = requestParameters
requestTableCopy["Link"] = DolgubonSetCrafter.selectedFurnitureLink
if returnedTable then
addRequirements(returnedTable, true)
end
local _,_,_,_,_,_, station = GetRecipeInfo(DolgubonSetCrafter.selectedRecipeListIndex, DolgubonSetCrafter.selectedRecipeIndex)

DolgubonSetCrafter.compileMatRequirements()
requestTableCopy["Quantity"] = {1, "1x"}
requestTableCopy["Quality"] = DolgubonSetCrafter.quality[GetItemLinkQuality(DolgubonSetCrafter.selectedFurnitureLink)]
requestTableCopy["Name"] = {GetItemLinkName(DolgubonSetCrafter.selectedFurnitureLink), GetItemLinkName(DolgubonSetCrafter.selectedFurnitureLink)}
requestTableCopy["Station"] = {station, GetCraftingSkillName(station)}
requestTableCopy.typeId = 2
queue[#queue+1] = requestTableCopy
end
end

function DolgubonSetCrafter.addFurnitureByLink(itemLink)
requestTableCopy = {}
requestTableCopy["Reference"] = DolgubonSetCrafter.savedvars.counter
DolgubonSetCrafter.savedvars.counter = DolgubonSetCrafter.savedvars.counter + 1
local requestParameters =
{
GetItemLinkItemId(itemLink), 1, DolgubonSetCrafter:GetAutocraft(), requestTableCopy["Reference"]
}
local returnedTable = LazyCrafter:CraftProvisioningItemByResultItemId(unpack(requestParameters))
requestTableCopy["CraftRequestTable"] = requestParameters
requestTableCopy["Link"] = itemLink
if returnedTable then
addRequirements(returnedTable, true)
end
local _, recipeListIndex, recipeList = GetRecipeInfoFromItemId(GetItemLinkItemId(link))
local _,_,_,_,_,_, station = GetRecipeInfo(recipeListIndex, recipeList)

requestTableCopy["Quantity"] = {1, "1x"}
requestTableCopy["Quality"] = DolgubonSetCrafter.quality[GetItemLinkQuality(itemLink)]
requestTableCopy["Name"] = {GetItemLinkName(itemLink), GetItemLinkName(itemLink)}
requestTableCopy["Station"] = {station, GetCraftingSkillName(station)}
requestTableCopy.typeId = 2
queue[#queue+1] = requestTableCopy
DolgubonSetCrafter.updateList()
end

function DolgubonSetCrafter.craft()
if (DolgubonSetCrafter.isCurrentlyInFurniture()) then
DolgubonSetCrafter.addFurniture()
else
DolgubonSetCrafter.compileMatRequirements()
end
DolgubonSetCrafter.updateList()
end

Expand Down Expand Up @@ -785,10 +858,14 @@ function DolgubonSetCrafter.initializeFunctions.initializeCrafting()
DolgubonSetCrafter.LazyCrafter = LazyCrafter
for k, v in pairs(queue) do
if not v.doNotKeep then
if v.typeId == 1 then
local returnedTable = LazyCrafter:CraftSmithingItemByLevel(unpack(v["CraftRequestTable"]))
addRequirements(returnedTable, true)
if pcall(function()applyValidityFunctions(v)end) then else d("Request could not be displayed. However, you should still be able to craft it.") end
elseif v.typeId == 2 then
local returnedTable = LazyCrafter:CraftProvisioningItemByResultItemId(unpack(v["CraftRequestTable"]))

local returnedTable = LazyCrafter:CraftSmithingItemByLevel(unpack(v["CraftRequestTable"]))
addRequirements(returnedTable, true)
if pcall(function()applyValidityFunctions(v)end) then else d("Request could not be displayed. However, you should still be able to craft it.") end
end
else
table.remove(queue, k)
end
Expand Down
10 changes: 4 additions & 6 deletions DolgubonsLazySetCrafter.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
; States and/or other countries. All rights reserved.
; You can read the full terms at https://account.elderscrollsonline.com/add-on-terms

## Title: Dolgubon's Lazy Set Crafter v2.8.5
## Title: Dolgubon's Lazy Set Crafter v2.8.7
## APIVersion: 101040
## Author: Dolgubon
## Version: 2.8.5
## Version: 2.8.7
## SavedVariables: dolgubonslazysetcraftersavedvars
## DependsOn: LibLazyCrafting>=3086 LibAddonMenu-2.0 LibStub
## OptionalDependsOn: pChat LibFeedback LibCustomMenu LibPrice
Expand All @@ -16,10 +16,6 @@

; LibCustomTitles
Libs\LibCustomTitles\LibCustomTitles.lua

libs\LibPrice\LibPrice.lua
libs\LibPrice\LibPrice_Internal.lua

; Feedback library
libs\LibFeedback\feedback.lua

Expand All @@ -45,6 +41,8 @@ SetupScrollLists.lua
; Fully sets up the UI
SetCrafterUI.lua

FurnitureUI.lua

; This file handles all the LLC crafting interaction
Crafter.lua

Expand Down
Loading

0 comments on commit a9192b2

Please sign in to comment.