Skip to content

Commit

Permalink
Clean up extra event parameters
Browse files Browse the repository at this point in the history
Enchanting can now craft more than 6 items at a time
Blackwood sets
Home Station Marker integration fixes
  • Loading branch information
Dolgubon committed Jul 11, 2021
1 parent 11c2583 commit 275a627
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 23 deletions.
4 changes: 2 additions & 2 deletions Alchemy.lua
Original file line number Diff line number Diff line change
Expand Up @@ -130,9 +130,9 @@ local function LLC_AlchemyCraftInteraction(station, earliest, addon , position)
currentCraftAttempt.prevSlots = LibLazyCrafting.backpackInventory()
end

local function LLC_AlchemyCraftingComplete(event, station, lastCheck)
local function LLC_AlchemyCraftingComplete(station, lastCheck)
dbug("EVENT:CraftComplete")
LibLazyCrafting.stackableCraftingComplete(event, station, lastCheck, CRAFTING_TYPE_ALCHEMY, currentCraftAttempt)
LibLazyCrafting.stackableCraftingComplete(station, lastCheck, CRAFTING_TYPE_ALCHEMY, currentCraftAttempt)

end

Expand Down
10 changes: 5 additions & 5 deletions Enchanting.lua
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,8 @@ local function LLC_EnchantingCraftinteraction(station, earliest, addon, position
select(2,findItemLocationById(earliest["aspectItemID"])),
earliest["quantity"]
}
local maxCraftable = math.min(earliest["quantity"] or 1, GetMaxIterationsPossibleForEnchantingItem(unpack(locations)))
local max = GetMaxIterationsPossibleForEnchantingItem(unpack(locations))
local maxCraftable = math.min(earliest["quantity"] or 1, max )
locations[7] = maxCraftable
if locations[1] and locations[3] and locations[5] and maxCraftable>0 then
dbug("CALL:ZOEnchantCraft")
Expand Down Expand Up @@ -464,7 +465,7 @@ local function wasItemMade(bag, slot)
return GetItemLinkName(GetItemLink(BAG_BACKPACK, slot,0)) == GetItemLinkName(currentCraftAttempt.link)
and GetItemLinkQuality(GetItemLink(BAG_BACKPACK, slot,0)) == GetItemLinkQuality(currentCraftAttempt.link)
end
local function handleEnchantComplete(event, station, slot)
local function handleEnchantComplete(station, slot)
-- We found it!
dbug("ACTION:RemoveQueueItem")
local removedTable = craftingQueue[currentCraftAttempt.Requester][CRAFTING_TYPE_ENCHANTING][currentCraftAttempt.position]
Expand All @@ -479,7 +480,6 @@ local function handleEnchantComplete(event, station, slot)
removedTable.quantity = removedTable.quantity - 1
currentCraftAttempt.quantity = currentCraftAttempt.quantity - 1
end
-- d(removedTable)
if removedTable.dualEnchantingSmithing then
removedTable.glyphInfo= removedTable.glyphInfo or {}
table.insert(removedTable.glyphInfo,
Expand Down Expand Up @@ -509,7 +509,7 @@ local function handleEnchantComplete(event, station, slot)
return removedTable
end

local function LLC_EnchantingCraftingComplete(event, station, lastCheck)
local function LLC_EnchantingCraftingComplete(station, lastCheck)
if currentCraftAttempt.allRunesKnown==false then -- User didn't know all the glyphs, so we get the item link *now* since now they know them
-- Hopefully they have more than one
currentCraftAttempt.link = GetEnchantingResultingItemLink(unpack(currentCraftAttempt.locations))
Expand All @@ -520,7 +520,7 @@ local function LLC_EnchantingCraftingComplete(event, station, lastCheck)
local found = false
local removedTable
while slot ~= nil do
removedTable = handleEnchantComplete(event, station, slot)
removedTable = handleEnchantComplete(station, slot)
bag, slot = LibLazyCrafting.findNextSlotIndex(wasItemMade, slot+1)
found = true
end
Expand Down
14 changes: 8 additions & 6 deletions LibLazyCrafting.lua
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ end

-- Initialize libraries
local libLoaded
local LIB_NAME, VERSION = "LibLazyCrafting", 3.07
local LIB_NAME, VERSION = "LibLazyCrafting", 3.074
local LibLazyCrafting, oldminor
if LibStub then
LibLazyCrafting, oldminor = LibStub:NewLibrary(LIB_NAME, VERSION)
Expand Down Expand Up @@ -180,8 +180,9 @@ LibLazyCrafting.craftResultFunctions = craftResultFunctions
--- GENERAL HELPER FUNCTIONS

function LibLazyCrafting.AddHomeMarker(setId, station)
-- d("Add " .. tostring(setId) .." : " .. station)
if HomeStationMarker then
if setIndex == INDEX_NO_SET then
if setId == LibLazyCrafting.INDEX_NO_SET then
HomeStationMarker.AddMarker(nil, station)
else
HomeStationMarker.AddMarker(setId, station)
Expand All @@ -190,8 +191,9 @@ function LibLazyCrafting.AddHomeMarker(setId, station)
end

function LibLazyCrafting.DeleteHomeMarker(setId, station)
-- d("Delete " .. tostring(setId) .." : " .. station)
if HomeStationMarker then
if setIndex == INDEX_NO_SET then
if setId == LibLazyCrafting.INDEX_NO_SET then
HomeStationMarker.DeleteMarker(nil, station)
else
HomeStationMarker.DeleteMarker(setId, station)
Expand Down Expand Up @@ -294,7 +296,7 @@ local function tableClear(t)
end
-- Common code called by Alchemy and Provisioning crafting complete handlers.

function LibLazyCrafting.stackableCraftingComplete(event, station, lastCheck, craftingType, currentCraftAttempt)
function LibLazyCrafting.stackableCraftingComplete(station, lastCheck, craftingType, currentCraftAttempt)
dbug("EVENT:CraftComplete")
if not (currentCraftAttempt and currentCraftAttempt.addon) then return end
local currSlots = LibLazyCrafting.backpackInventory()
Expand Down Expand Up @@ -322,15 +324,15 @@ function LibLazyCrafting.stackableCraftingComplete(event, station, lastCheck, cr
local earliest = craftingQueue[currentCraftAttempt.addon][craftingType][currentCraftAttempt.position]
earliest.timesToMake = earliest.timesToMake - 1
currentCraftAttempt.timesToMake = earliest.timesToMake
if GetCraftingInteractionType()==0 then zo_callLater(function() LibLazyCrafting.stackableCraftingComplete(event, station, true, craftingType, currentCraftAttempt) end,100) end
if GetCraftingInteractionType()==0 then zo_callLater(function() LibLazyCrafting.stackableCraftingComplete( station, true, craftingType, currentCraftAttempt) end,100) end
end
elseif lastCheck then
-- give up on finding it.
tableClear(currentCraftAttempt)
else
-- further search
-- search again later
if GetCraftingInteractionType()==0 then zo_callLater(function() LibLazyCrafting.stackableCraftingComplete(event, station, true, craftingType, currentCraftAttempt) end,100) end
if GetCraftingInteractionType()==0 then zo_callLater(function() LibLazyCrafting.stackableCraftingComplete( station, true, craftingType, currentCraftAttempt) end,100) end
end
end

Expand Down
4 changes: 2 additions & 2 deletions LibLazyCrafting.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
; You can read the full terms at https://account.elderscrollsonline.com/add-on-terms

## APIVersion: 100035
## Title: LibLazyCrafting v3.07
## Version: 3.07
## Title: LibLazyCrafting v3.074
## Version: 3.074
## Author: Dolgubon
## Contributors: ziggr
## OptionalDependsOn: pChat LibStub HomeStationMarker
Expand Down
4 changes: 2 additions & 2 deletions Provisioning.lua
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,8 @@ local function LLC_ProvisioningCraftInteraction(station, earliest, addon , posit
currentCraftAttempt.prevSlots = LibLazyCrafting.backpackInventory()
end

local function LLC_ProvisioningCraftingComplete(event, station, lastCheck)
LibLazyCrafting.stackableCraftingComplete(event, station, lastCheck, CRAFTING_TYPE_PROVISIONING, currentCraftAttempt)
local function LLC_ProvisioningCraftingComplete(station, lastCheck)
LibLazyCrafting.stackableCraftingComplete(station, lastCheck, CRAFTING_TYPE_PROVISIONING, currentCraftAttempt)
end

local function LLC_ProvisioningIsItemCraftable(self, station, request)
Expand Down
17 changes: 11 additions & 6 deletions Smithing.lua
Original file line number Diff line number Diff line change
Expand Up @@ -985,7 +985,7 @@ local function smithingCompleteNewItemHandler(station, bag, slot)
currentCraftAttempt.smithingQuantity = currentCraftAttempt.smithingQuantity - 1
end
if currentCraftAttempt.quality>1 then
--d("Improving #".. tostring(currentCraftAttempt.reference))
-- d("Improving #".. tostring(currentCraftAttempt.reference))

if removedRequest.dualEnchantingSmithing then
table.insert(removedRequest.equipInfo,
Expand All @@ -1009,6 +1009,8 @@ local function smithingCompleteNewItemHandler(station, bag, slot)
local copiedTable = LibLazyCrafting.tableShallowCopy(removedRequest)
copiedTable.slot = slot
copiedTable.smithingQuantity = 1
LibLazyCrafting.DeleteHomeMarker(removedRequest.setIndex, station)
LibLazyCrafting.AddHomeMarker(INDEX_NO_SET, station)
LibLazyCrafting.SendCraftEvent(LLC_INITIAL_CRAFT_SUCCESS, station, currentCraftAttempt.Requester, copiedTable)
else
removedRequest.bag = BAG_BACKPACK
Expand Down Expand Up @@ -1205,7 +1207,10 @@ local setInfo =
{{168747 , 168767, [6] = 168754, [7] =168782 },9,isSwapped=true}, -- 541 Aetherial Ascension
{{168373 , 168393, [6] = 168380, [7] =168408 },6,isSwapped=true}, -- 540 Legacy of Karth
{{167999 , 168019, [6] = 168006, [7] =168034 },3,isSwapped=true}, -- 539 Red Eagle's Fury

{{172455 , 172475, [6] = 172462, [7] =172490 },3,isSwapped=true}, -- 582 Hist Whisperer's Song
{{172829 , 172849, [6] = 172836, [7] =172864 },7,isSwapped=true}, -- 583 Heartland Conquerer
{{173203 , 173223, [6] = 173210, [7] =173238 },5,isSwapped=true}, -- 584 Diamond's Victory

}

SetIndexes = {}
Expand Down Expand Up @@ -1497,7 +1502,7 @@ local function internalScrapeSetItemItemIds()
local estimatedTime = math.floor((20000*apiVersionDifference+200000)/300*25/1000)+3
zo_callLater(function()
CHAT_SYSTEM:AddMessage("LibLazyCrafting: Beginning scrape of set items. Estimated time: "..estimatedTime.."s")
CHAT_SYSTEM:AddMessage("This is a once per major game update scan. Please wait until it it is complete.")end
CHAT_SYSTEM:AddMessage("This is a (usually) once per major game update scan. Please wait until it it is complete.")end
, 25)

local craftedItemIds = LibLazyCraftingSavedVars.SetIds or {}
Expand Down Expand Up @@ -1879,9 +1884,9 @@ local function initializeSetInfo()
end
local vars = LibLazyCraftingSavedVars
-- Last condition is bc I forgot to actually add them before the patch increase :(
if not vars.SetIds or not vars.lastScrapedAPIVersion or vars.lastScrapedAPIVersion<GetAPIVersion() or LibLazyCraftingSavedVars.SetIds[540] == nil then
if LibLazyCraftingSavedVars.SetIds and LibLazyCraftingSavedVars.SetIds[540] == nil then
d("LibLazyCrafting: Usually this scraping only runs once per major game patch, but this re-run is required to fix a bug from a previous LLC version.")
if not vars.SetIds or not vars.lastScrapedAPIVersion or vars.lastScrapedAPIVersion<GetAPIVersion() or LibLazyCraftingSavedVars.SetIds[584] == nil then
if LibLazyCraftingSavedVars.SetIds and LibLazyCraftingSavedVars.SetIds[584] == nil then
d("LibLazyCrafting: Usually this scraping only runs once per major game patch, but this re-run is required to add the new sets from Blackwood.")
end
internalScrapeSetItemItemIds()
end
Expand Down

0 comments on commit 275a627

Please sign in to comment.