Updated rewrite with previous loot all fix
This commit is contained in:
@@ -288,4 +288,14 @@ TOC_Common.FindItemInWornItems = function(player, checkString)
|
||||
|
||||
return nil
|
||||
|
||||
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
|
||||
@@ -246,4 +246,23 @@ function ISClothingExtraAction:isValid()
|
||||
end
|
||||
|
||||
return baseCheck
|
||||
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
|
||||
Reference in New Issue
Block a user