From 738fa00eca5c1b6aa7e771ae2a2cf5a2562c718a Mon Sep 17 00:00:00 2001 From: Meta Vens Date: Sat, 13 Jun 2026 23:36:21 +0100 Subject: [PATCH] Prefilter trade rows with typed catalog --- .voidbot/state/aetheria.cc | Bin 53501 -> 53618 bytes Aetheria.State/README.md | 3 ++ Assets/Scripts/UI/Menu/TradeMenu.cs | 44 +++++++++++++++++++++++++++ docs/aetheria-perfect-machine-map.md | 11 +++++-- 4 files changed, 56 insertions(+), 2 deletions(-) diff --git a/.voidbot/state/aetheria.cc b/.voidbot/state/aetheria.cc index a2fc461ff4f9c64758144605065550c151a361aa..5482f7a46bd0767a135c50bd9522f8eb72c97324 100644 GIT binary patch delta 951 zcmZ8gy-yTD6qmaT0c{jxkSNJ3j5NoI2Pa};afw1m0F_{a)v){Sc3^jAGc$YV(hv(; zBW`Qsi65~*$yFK?gNaz!*jSMGPhfB2+r8bpgl_ij%5To5W)BU=x1&_tIkX$Rhi%HRwk3mKw&g@Fx?(2e0s6aG0`v$%RSU7l8?znmVk(r5fMh z^pz1!saVW)Ga`#jusW*J9GaLD#IU4?w-YEbyrdH z+LE3pZEix+v=$qZwJ(At-M|yN2wExw8yM0tVH<=%Ud7F#uys981fu;GY<-&zOhDe5 z*m)pZtbh#FjtpEI@Ubs78OJ@}#cR~nmjP+*wWk=cE)_vjS)s?ch*jHM`z{NK6}rTo zixa6OX_5e){V6 znX5~S%qJ{MDk9LCnU2Jc^XXtk$9q=_O{q58qaP-6(b1x)VoW<1RMP?NLpKP>S}#{@CD9x)e7mtGkBPiQh>?~w$C@d_D zg=~zC4d5fOK+IOCiN*wM?F`Yv#!d??O-%e}Zx=)C=6`?RH{Y+t!k>l0%Cpv;z16ej zp7`hb!Fa9pUNMbIr~1qB=6YAG3b*sjnf^4>-gc<<{fFdO+v?-aYom%fDm26mg&-#K zVSZ)rcnw@S!<8n?1vVWJsb-0K5W1%+4LkHAvLHg4aAKcO%0a~Vk?8V@5KDd;kkV9LWX06OD7;WK?W3? z_PMd01jETtYcK;!8m)u?o#y}BeF_|v!a#P;V38ssIO6(!W>bMI%Qx2Vu5UZj87vw8Jxpz5oJ2UKh(1>puB?5z&30b zk*v{S%9=EZV2BGe+zPqI!^^mSpJdo?`CZawYy$IFLnsy{A(rKU{m4XDZdq?YrV=U2SEp;~(Ww SwI_M-@pG}Gd9SZpo%##=@;d7P diff --git a/Aetheria.State/README.md b/Aetheria.State/README.md index a4eb3e353..6b395fa4d 100644 --- a/Aetheria.State/README.md +++ b/Aetheria.State/README.md @@ -76,6 +76,9 @@ not catalog entry access. Loadout generation now applies typed catalog prefilters for item category, hardpoint type, shape fit, hull type, and behavior kind before hydrating legacy `ItemData` projections for final simulation compatibility. +The surviving trade menu also applies typed catalog prefilters for row size, +hardpoint type, and behavior kind before hydrating `ItemData` projections for +legacy commodity filters, columns, and buy actions. Surviving item catalog Unity DTOs inherit `RuntimeItemProjectionEntry`; the old `RuntimeCatalogEntry` base name no longer appears in live source. Temporary faction/corporation projections and zone body/orbit DTOs keep local GUID fields diff --git a/Assets/Scripts/UI/Menu/TradeMenu.cs b/Assets/Scripts/UI/Menu/TradeMenu.cs index 8212f200d..42d72343d 100644 --- a/Assets/Scripts/UI/Menu/TradeMenu.cs +++ b/Assets/Scripts/UI/Menu/TradeMenu.cs @@ -4,6 +4,7 @@ using System.Collections.Generic; using System.Linq; using System.Reflection; using System.Runtime.Remoting.Contexts; +using GameCult.Aetheria.State.Unity; using TMPro; using UnityEngine; using UnityEngine.UI; @@ -222,6 +223,7 @@ public class TradeMenu : MonoBehaviour data => data.Shape.Width*data.Shape.Height)); var items = Inventory.Cargo.Keys + .Where(PassesTypedTradeFilters) .Select(ii=>(ii, GameManager.ItemManager.GetData(ii))); if (MinimumSizeFilter.gameObject.activeSelf) @@ -355,6 +357,48 @@ public class TradeMenu : MonoBehaviour } })); } + + private bool PassesTypedTradeFilters(ItemInstance item) + { + var typedItem = FindTypedTradeItem(item); + if (typedItem == null) + { + return true; + } + + if (MinimumSizeFilter.gameObject.activeSelf && + (MinimumSizeFilter.Width.text.Length > 0 && typedItem.ShapeWidth < int.Parse(MinimumSizeFilter.Width.text) || + MinimumSizeFilter.Height.text.Length > 0 && typedItem.ShapeHeight < int.Parse(MinimumSizeFilter.Height.text))) + { + return false; + } + + if (MaximumSizeFilter.gameObject.activeSelf && + (MaximumSizeFilter.Width.text.Length > 0 && typedItem.ShapeWidth > int.Parse(MaximumSizeFilter.Width.text) || + MaximumSizeFilter.Height.text.Length > 0 && typedItem.ShapeHeight > int.Parse(MaximumSizeFilter.Height.text))) + { + return false; + } + + if (_hardpointFilter.filter != null && + !string.Equals(typedItem.HardpointType, _hardpointFilter.type.ToString(), StringComparison.Ordinal)) + { + return false; + } + + return _behaviorFilters.All(filter => + typedItem.BehaviorKinds.Contains(filter.type.Name, StringComparer.Ordinal)); + } + + private static AetheriaRuntimeCatalogItem FindTypedTradeItem(ItemInstance item) + { + if (item?.Data == null || item.Data.ItemId == Guid.Empty) + { + return null; + } + + return ActionGameManager.RuntimeCatalog?.FindItemByLegacyId(item.Data.ItemId.ToString("D")); + } private void UpdateCreditsLabel() { diff --git a/docs/aetheria-perfect-machine-map.md b/docs/aetheria-perfect-machine-map.md index c207a93df..08e780ee0 100644 --- a/docs/aetheria-perfect-machine-map.md +++ b/docs/aetheria-perfect-machine-map.md @@ -127,7 +127,10 @@ legacy catalog cache, and legacy UI paths should be migration-only or deleted. prefilters now run against typed catalog rows before any DTO projection is hydrated. The unused `TradeMenuDebug` script has been deleted instead of preserving an old uGUI debug path that turned typed trade rows back into legacy `ItemData` objects. That hydration - now comes from typed state, not `AetherDB.msgpack`. + now comes from typed state, not `AetherDB.msgpack`. The surviving trade menu + applies typed row prefilters for size, hardpoint type, and behavior kind before + hydrating `ItemData` projections for legacy commodity filters, columns, and + buy actions. - `Galaxy` generation no longer accepts a runtime item catalog reader or `ItemManager`. Sector and tutorial generation receive the package-owned typed runtime catalog. `Galaxy` projects typed corporation v2 records into temporary legacy @@ -396,7 +399,9 @@ legacy catalog cache, and legacy UI paths should be migration-only or deleted. remaining runtime single-ID item projection bridge, but typed catalog rows own the loadout candidate prefilters for hull type, shape, category, hardpoint type, and behavior kind before that bridge is invoked. The old trade debug UI - and console `give` command have been deleted. No live caller can enumerate + and console `give` command have been deleted. The surviving trade menu also + uses typed catalog rows for first-pass size, hardpoint, and behavior filters + before hydrating row projections. No live caller can enumerate legacy catalog entries or request catalog-shaped single entries through `ItemManager`. - Inputs: Unity gameplay code, legacy catalog files, typed state documents, and @@ -570,6 +575,8 @@ First Aetheria surfaces to publish: typed catalog rows before hydrating `HullData`/`BehaviorData` projections. - Done: delete unused `TradeMenuDebug`; the old debug uGUI trade path no longer hydrates typed trade rows back into legacy `ItemData` objects. + - Done: move surviving trade menu size, hardpoint, and behavior filters onto + typed catalog row prefilters before row-level `ItemData` hydration. - Done: delete the console `give` command instead of preserving a debug operator path that hydrated typed item rows back into legacy item DTOs. - Done: delete `ItemManager.GetCatalogEntries` after all live callers