Added Bag feature to colorize recipe parts that are fulfilled by bag content
Improved bag of crafting calculator code quality a bit
This commit is contained in:
1 parent
87a786ea1e
commit
6cb646ef34
3 files changed
+52
-35
No files matched your search
+12
-2
@@ -852,7 +852,7 @@ end
|
||||
-- Result: "3{{Crafting1}}2{{Crafting2}}3{{Crafting3}}"
|
||||
local emptyPickupTable = {}
|
||||
for i=1,29 do emptyPickupTable[i] = 0 end
|
||||
function EID:tableToCraftingIconsMerged(craftTable)
|
||||
function EID:tableToCraftingIconsMerged(craftTable, indicateCompleteContent)
|
||||
local sortedList = {table.unpack(craftTable)}
|
||||
local filteredList = {table.unpack(emptyPickupTable)}
|
||||
for _,nr in ipairs(sortedList) do
|
||||
@@ -861,12 +861,22 @@ function EID:tableToCraftingIconsMerged(craftTable)
|
||||
local iconString = ""
|
||||
for nr,count in ipairs(filteredList) do
|
||||
if (count > 0) then
|
||||
iconString = iconString..count.."{{Crafting"..nr.."}}"
|
||||
local completedColoring = indicateCompleteContent and EID:bagContaingsItem(nr, count) and "{{ColorBagComplete}}" or ""
|
||||
iconString = iconString..completedColoring..count.."{{Crafting"..nr.."}}{{CR}}"
|
||||
end
|
||||
end
|
||||
return iconString
|
||||
end
|
||||
|
||||
function EID:bagContaingsItem(itemID, itemCount)
|
||||
local foundCount = 0
|
||||
for _, bagItem in ipairs(EID.BagItems) do
|
||||
if bagItem == itemID then
|
||||
foundCount = foundCount + 1
|
||||
end
|
||||
end
|
||||
return foundCount == itemCount
|
||||
end
|
||||
|
||||
function EID:handleHUDElement(hudElement)
|
||||
local alteredHudElement = {}
|
||||
|
||||
Reference in new issue
Block a user