Skip to content

Commit ad741ff

Browse files
Copilottinymins
andauthored
fix: 自动后置新物品功能需要限制在普通背包 (#98)
* Fix: skip new-item-to-bottom processing for special packages like NEARLY_DYING_PACKAGE Co-authored-by: tinymins <1808990+tinymins@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: tinymins <1808990+tinymins@users.noreply.github.com>
1 parent cf0714d commit ad741ff

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

MY_BagEx/src/MY_BagEx_BagNewItem.lua

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,19 @@ function D.CreateBagItemCache()
9595
end
9696

9797
function D.OnBagItemUpdate(dwBox, dwX)
98+
-- Only process items in regular package boxes, skip special packages (e.g., NEARLY_DYING_PACKAGE)
99+
local aPackageBoxList = X.GetInventoryBoxList(X.CONSTANT.INVENTORY_TYPE.PACKAGE)
100+
local bInPackage = false
101+
for _, dwIterBox in ipairs(aPackageBoxList) do
102+
if dwIterBox == dwBox then
103+
bInPackage = true
104+
break
105+
end
106+
end
107+
if not bInPackage then
108+
D.CreateBagItemCache() -- still refresh cache to keep it in sync
109+
return
110+
end
98111
local me = X.GetClientPlayer()
99112
local kItem = X.GetInventoryItem(me, dwBox, dwX)
100113
if kItem then

0 commit comments

Comments
 (0)