Updated rewrite with previous loot all fix

This commit is contained in:
Pao
2023-03-07 19:38:22 +01:00
parent cb388b803f
commit fd18ffb35f
2 changed files with 29 additions and 0 deletions

View File

@@ -289,3 +289,13 @@ TOC_Common.FindItemInWornItems = function(player, checkString)
return nil return nil
end end
TOC_Common.FindModItem = function(inventory)
for _, partName in pairs(TOC_Common.GetPartNames()) do
if inventory:contains("TOC.Amputation_" .. partName) then
return true
end
end
return false
end

View File

@@ -247,3 +247,22 @@ function ISClothingExtraAction:isValid()
return baseCheck return baseCheck
end end
-- Manages the Loot All button to prevent stuff like picking up the amputation items
local og_ISInventoryPagePrerender = ISInventoryPage.prerender
function ISInventoryPage:prerender()
-- Check if there is any amputated limb here. if there is, just fail and maybe notify the player
og_ISInventoryPagePrerender(self)
if TOC_Common.FindModItem(self.inventory) then
self.canLootAll = false
else
self.canLootAll = true
end
end
local og_ISInventoryPageLootAll = ISInventoryPage.lootAll
function ISInventoryPage:lootAll()
if self.canLootAll then
og_ISInventoryPageLootAll(self)
end
end