From ecd64d20a65a5b228f47d81ec96ddc4171fbb7eb Mon Sep 17 00:00:00 2001 From: Meta Vens Date: Sun, 14 Jun 2026 03:52:20 +0100 Subject: [PATCH] Use typed commodity categories in trade rows --- .voidbot/state/aetheria.cc | Bin 61123 -> 61161 bytes Aetheria.State.Import/Program.cs | 19 +++++++ .../AetheriaRuntimeCatalogSnapshotMapper.cs | 4 +- Aetheria.State.Verify/Program.cs | 13 +++++ .../Documents/AetheriaItemDefinition.cs | 6 ++ Assets/Scripts/UI/Menu/TradeMenu.cs | 52 +++++++++++------- GameData/aetheria-world.cc | Bin 30132 -> 30542 bytes ...fa831c114bded61755656ce143acff8498.msgpack | 2 +- ...6bcb5217c5fee889541667442528a98491.msgpack | 4 +- ...a275af9147897cd1f60b23a18cc48b7fee.msgpack | 4 +- ...3921217d7ba077f48246e0b33fc1493431.msgpack | 4 +- ...3fbff428c15ab389a42d0d2aa0e75980fd.msgpack | 2 +- ...6b93b4259541f580967a52464d9686f3aa.msgpack | 4 +- ...fdee0c7ff471c8bb4b4e0b2067eb36da09.msgpack | 4 +- ...cc1c87e1e40afcab2bb8dd8f889fe0918b.msgpack | 2 +- ...1ac1edd3dffac04996b12d9f9d0e8304f1.msgpack | 2 +- ...1368ec2948a11425e377fa92a71d575637.msgpack | 4 +- ...8858c36442af01034165db67b886e94ce3.msgpack | 4 +- ...2cd5bdbf86136a558044079cba7a029ac8.msgpack | 4 +- ...6ba52bd445978bb0cb399047cf64aa722f.msgpack | 4 +- ...3e8ff05893f872c2437a5621f2a2eec71b.msgpack | 4 +- ...9bb06b3f45a746ac5f7739b1cbd896443f.msgpack | 4 +- ...07d0fb3e1d5d58fbc176520a100614f404.msgpack | 2 +- ...48df04cfa2250b7101fc00f9c6f2c1317c.msgpack | 4 +- ...06e97680a29efe7d1436947e3a8eba4c95.msgpack | 4 +- ...2ccd793983d2af31967b7d70a977fd2e02.msgpack | 4 +- ...f91cb8ca685ea96318a795771ae6d911eb.msgpack | 4 +- ...db27aa2b805705e823bed4877c4623cf88.msgpack | 4 +- ...5eead201bac20496fa5a2649e4b1522a37.msgpack | 4 +- ...fa0290206edd7b2e0dc08b0f9842dea0f2.msgpack | 4 +- ...dd6eeb3d8311f3753af60c2b5596719b15.msgpack | 4 +- ...d7e3a5d8fa1509efb8a9249d0e48891299.msgpack | 2 +- ...c76a739617023ffa2c2aeb091cf5580b7d.msgpack | 2 +- ...f5bd89832b6e55959ea4902bfa15bc8117.msgpack | 4 +- ...d52fa612f479ccbad76307db432c0b6147.msgpack | 2 +- ...268eff507c40681c6b1955fa786f99066c.msgpack | 2 +- ...ad0cb1b8ec9229ee0525bb8571edb6ea32.msgpack | 4 +- ...1b5d1ba2d39f2014715b235086b087f9b7.msgpack | 2 +- ...616a532f076ae0a66f2257f9c7899100a9.msgpack | 4 +- ...ae26acc72f64a9ca536b895d59a8675c66.msgpack | 4 +- ...44c85439d1f3caa1caaf24beb34e7d8d50.msgpack | 2 +- ...9500e6c9192f76c38393eb84bee3345ee0.msgpack | 4 +- ...dd6ef83562c3b82a0e03c21a37c241f5b8.msgpack | 4 +- ...5cdcddbcded4980427149dc10ba9eb08a1.msgpack | 2 +- ...baf1c52a76a0e7adce5acb06a2d7f5bd79.msgpack | 4 +- ...79872da971faf89ceef4c395a64f1b5e88.msgpack | 4 +- ...60257125aef40381db5877aa16c02b39e4.msgpack | 4 +- ...ea1ff3e3f204925bb28ccb1d45d2b3d732.msgpack | 4 +- ...786b7af0cd4f808a703d5f242c9b0fd372.msgpack | 2 +- ...05ae7658005ee7019c3810650baf8e6c4f.msgpack | 4 +- ...d65f26dcd9e6b2bc9ef89cb16dd16e4b07.msgpack | 4 +- ...4187f90237d4386c76e3b847376b466dd3.msgpack | 4 +- ...042b3f00710055061bb4b6d9b2306d14c3.msgpack | 2 +- ...36ce1066ae558fc09801457a30674f515b.msgpack | 4 +- ...e298fc6ceb8352b047986733e405d6006b.msgpack | 4 +- ...7cb628668b9e3842a59c0e2dd106a820bb.msgpack | 4 +- ...b30b7614eb776ee14b16bed525675b67b8.msgpack | 4 +- ...6321b14e59b2b62a7e914e74771273097a.msgpack | 4 +- ...d39c7f7412772d7ad9adc1f1db3f39cc10.msgpack | 4 +- ...e152a6e77f714229898548c45b02cc72d6.msgpack | 4 +- ...0ecea7ff27435bd9e9d534bcb0c1b892ef.msgpack | 4 +- ...daf7ada6d75ceaa0a07f1e0dc46d65003f.msgpack | 4 +- ...25c2c88303bdbc1a54a178c895086e6c55.msgpack | 4 +- ...320b70986559345e184297437f13bcae7d.msgpack | 4 +- ...1f7c425775d76ba34c55a9ae879e27b3d8.msgpack | 2 +- ...8181b2c9794fa3a70f803c67de8d0dcff0.msgpack | 4 +- ...918704bf6ad447ce7a4733664d3888359d.msgpack | 4 +- ...9358f522e1794e5a675f77b06e99ee061e.msgpack | 2 +- ...fd4bd127dae7ce9a1cc25669b23daffd1b.msgpack | 2 +- ...72d6a82431bf8c842bc57b1c7f3bae4876.msgpack | 4 +- ...78de0d154287774728c30a461ed0d9e334.msgpack | 4 +- ...5a77b77ba285ba04fa6e1c678d86988867.msgpack | 4 +- ...cb33184e1aade105b24afaba265b148ce4.msgpack | 4 +- ...92a3874ff91d1e08024120231bb836c2bb.msgpack | 4 +- ...30a284a5876d9f55597d457cebba6a2226.msgpack | 4 +- ...04c4d886f2bf72ae35b733603966e28d61.msgpack | 4 +- ...a65e76836067e0661b91eb2fa4cc5c2b3f.msgpack | 4 +- ...6550ff7ce20b046a653debb4e7bc10e047.msgpack | 2 +- ...2888041296cc8e256b3774e29b1b969c4b.msgpack | 4 +- ...d247ef4aa34cfbe648b0b1587836dc48cb.msgpack | 2 +- ...eb069ff9e1ed707a2590cedcffc835ac23.msgpack | 4 +- ...199f861a6986234742cd7d603c9d8cbe86.msgpack | 4 +- ...699d5fc930104242470efeddc8f9500222.msgpack | 4 +- ...ef7f34c156794d697606252db56928e23b.msgpack | 4 +- ...d30298201bd0eced6bfa9c3b7e01d9448c.msgpack | 4 +- ...946ba31ec32b37bfe4b0829825c4e85029.msgpack | 2 +- ...cb793e7bcf5f7afa2c328d12d6561d0f1e.msgpack | 4 +- ...56919b8dd915d9fef8f2361b77d9bf6b99.msgpack | 4 +- ...386b0b8e8f80cfe0ad311061b682ecff95.msgpack | 4 +- ...1c82be1f818ee634833d6e3e637e694344.msgpack | 4 +- ...4f2a1a72a54f72c42a4e4c1d0f231586ba.msgpack | 4 +- ...34144722b989cf3cf2f03431cabc1f3929.msgpack | 4 +- ...a34a37e5fcb7892a29eb02cf5da1c338de.msgpack | 4 +- ...c97b1604f21df8132d6305f350e80ba5b7.msgpack | 4 +- ...98c89c7c57fff60a2c357887e8dc400dc3.msgpack | 2 +- ...c595e7f3aea98935f9e9a6aafdf8b4d9d2.msgpack | 4 +- ...1539aa45529f4c740066eb5301ed36edfd.msgpack | 4 +- ...2e4971d71ab5b8b38ac0c89c3f9a764764.msgpack | 2 +- ...cc7b2c41fe7e5fcc138566aa65f6a2b10b.msgpack | 2 +- ...79e8b3e7a51e9d5145e08f639a88de38be.msgpack | 4 +- ...cb2be74c711de0d5b22f9160aba0ee7ee9.msgpack | 2 +- ...65d32cdc881f54a82297e048ac6adff8ff.msgpack | 4 +- ...0336d40c18572d3f6ed6318a4008af5a89.msgpack | 4 +- ...fcd8fa1e9858c270d58ccf5d2170a3842c.msgpack | 4 +- ...d2064953cbde740647c3a820bacf9c27c3.msgpack | 4 +- ...33d98be75491a3b1b3af0d080505b31b21.msgpack | 4 +- ...76f8e8486ae0dd84c256d8c672c54837ec.msgpack | 4 +- ...7dd3b2bd29116afbf8857d8b5afdc85c8f.msgpack | 4 +- ...26af1122625e375d29d192aacad668e2a7.msgpack | 4 +- ...0d87791a49bb911b2e7ab294e1303e180c.msgpack | 4 +- ...85198b8b38c36fc5417df965fe098c7523.msgpack | 4 +- ...fdf046f5a7951655cf83dc22938e7563b2.msgpack | 4 +- ...f4651415e50cce4eb13240370a1394b928.msgpack | 4 +- ...52a044e5c42314b43945ded225f3009bf9.msgpack | 4 +- ...b76604f01f891d11f6bc9c079621d2b45c.msgpack | 4 +- ...dd6056bad45424aaadc0ed86534053fd43.msgpack | 2 +- ...6a84bb1ad648c6e3f72452f8ee47f98cb5.msgpack | 4 +- ...28230b2636da2c91d4e12ec6c804c8a04a.msgpack | 4 +- ...480afdb5047dee177edeac207ce337e083.msgpack | 4 +- ...7f81911af70edf42cb5275ce8f96dee707.msgpack | 2 +- ...07128f325b6f8981e61bf216400dd09f8e.msgpack | 4 +- ...f4dc349da455027ef5db10f14d88553894.msgpack | 4 +- ...1ade7f7e67031a1f69bec307690212bb53.msgpack | 4 +- ...3ff4da3985d54c314bcaf6ceca29a0d80e.msgpack | 4 +- ...1b1a624f836079caf3f9c892cbc94d0aae.msgpack | 4 +- ...01600dd1985f3e1ddeeb16b10593afc5ab.msgpack | 2 +- ...08e1a83f1dc14096339f67d56c0e0869ff.msgpack | 4 +- ...06d60f0e24b919fdf36a025cfddee87011.msgpack | 4 +- ...0f1c261fbbb7f1961d8acd057a3b287e38.msgpack | 4 +- ...5b07b6b9ec7bba75debf9915460dbe3e1a.msgpack | 4 +- ...2762b088b45c2b873b2816cc7dd4e7672c.msgpack | 4 +- ...e79aecf53d9558fd48290599da73065788.msgpack | 4 +- ...3dd2a11f08fa54e6ffc699ee7ff032399d.msgpack | 2 +- ...36c731b877c242d1dd966801858145a431.msgpack | 4 +- ...8668f9d2c05806983d89a8e9227a63871e.msgpack | 4 +- ...e2540502e68596a3603f76389e57028805.msgpack | 4 +- ...9ab8ab7bd5c5792eaffa4226a6c04eb105.msgpack | 4 +- ...b464103bd76e410747a9c9b7ff24e3c4e1.msgpack | 4 +- ...5ee0f0a8c3001293f5702aa2424e24427e.msgpack | 2 +- ...731eadcb421407c89d781610905a20f024.msgpack | 2 +- ...4a3699e1985d69a91cf8dcb7f4c66bddf5.msgpack | 4 +- ...25da6d94408d6a3d1d9118f6ee39b59f6b.msgpack | 4 +- ...27c780283d518bb03ec1796d41885bd88a.msgpack | 4 +- ...0f473896745b146e5990046afe53ac54b8.msgpack | 2 +- ...e9c2093d642b67286400600a6215e90683.msgpack | 4 +- ...08270dbd928b514d6de583f46201acc8e6.msgpack | 2 +- ...8f723d3a0a7f48de7e52fe545a530c2559.msgpack | 4 +- ...3f7d34327c64a8a33c3dfb1809131717a1.msgpack | 4 +- ...42f2cef8f92eb11513d698d60a8ad234c4.msgpack | 4 +- ...d4f7d77f094191b2e9d7590b6795950780.msgpack | 4 +- ...c4bd13b358f1ffb0937b14289d35ab2d53.msgpack | 4 +- ...6b87f1ba0566a44f3d381b757edb40d25d.msgpack | 4 +- ...e4f0b2d619dceb69ec354fe56f99488b42.msgpack | 2 +- ...beb23a1fa47461adda98ef10295021480f.msgpack | 4 +- ...d3f4d154424deaf2f21dd15d213684d46f.msgpack | 4 +- ...8da4a63ef12a1dc5126b11ebba43840395.msgpack | 2 +- .../Runtime/AetheriaRuntimeCatalogSnapshot.cs | 8 ++- .../Runtime/AetheriaRuntimeCatalogStore.cs | 8 ++- docs/aetheria-perfect-machine-map.md | 15 +++-- 159 files changed, 356 insertions(+), 297 deletions(-) diff --git a/.voidbot/state/aetheria.cc b/.voidbot/state/aetheria.cc index a2436357d044d3647bc7f2bfc27b2374f7be51fb..1fe5d7288a4cb9190a215716a8f2ee0a79164c17 100644 GIT binary patch delta 1080 zcma)6Jxmlq6!z{=KqG}l4;wOpL@~l4$d7@(PD1*-QCFS&Sqwob8Rlh z(uz!DYy4}B!E8rojEUN4ftX9gLMgPvP8;Lfy=50;W4G_ko9}(!eDCecjl%bh!ph@( z``Ga0$Vlmw*(!9KSNXeplX&#x!gB7A5rtc6W<1VxwDshkg~!@XgqP0GOKQVKaD8G4 z#}PKu0a1Qg2Obblf&y1l&4f!_Q766vMWQ2{SX5Ikszi#qDm}6|Wlrmye7jFp16MpL>X@nq96*3?$b+EW1g+r94WxT2MKZG3 zHYP$iEdy5rLZ+$B^AasNIZ@R*i3nx2BbncFH>ugEK%-bTU3>Zit*1mN)!@va`qC2(uEM8j-p_a`-C&$2)rg(Qn3=zf@`NO1sL>^c z9}+4YtoUUu!F|V7F~_nW5C^Opb(w{Nbxj~SDuF2QC=vhyH^K6wdqXy8$~eIY1-e2< zUJ$Rb(=<_cQGShirROwmHj8#JeD;X;@&#Y}2%WL73%N*CP59grEHN8g3+AArKJ6-o({H-= zEn(3z={?gvnF-4XoC)J+G;D2k{!&t zg!h{JJ3CV(^S*GTBZk+$Ecv5QG*>roZ?F4A`~wJoZocSD IQ=n5aP|ii(87fKgoI=1YTu5Qv%_f`Q}|5bT|)o#~{fd+hGnxH-6Z z6Fi8_U+@Dw341XYC5Vt?AP|X|Q}iH26#N6$%b+N0Keh`Ww+nAy<-10P zua^b~hK8=qKhK?rKjojckl~>eQHA9;GMXX>J9=|Z8vPxY8uxBa$tp^#bZv%76hLoo zYnMIEUGPu^Xmt&wT7t-+0b2{v1wRr30%jJ?z)MFk9(>6i`>%{fqeL}6y4hD((m`1A zQG&}&C|He4514FrDuPWyS#@6-1Q#{0QkPkug$Pw9B5GVw8d6S%FH?RIFbIjJgTzFm zOmY&`5{#PJNF%5!YU)-`nPyQRb-+lY>mgX>c>+z5(ksN)2NP;;5tzHc9F$J2NF?1R zOGq0zN)Qbf9d5XiX5h6&nY^}EZ>6qXahUcLRJcu3gUB+=Nk1^h!O*hA2xB=>Cb@}j zz=xaw^26{T67-ust0jq=cqQGlf@M|%E-h(H+Gi#<3pq3)a!0EGbVMWqZ05MkGDwi~ zqKV*xh=&2qm%5@8rMJ%nPqowAd9*BSMs5UyB WqL02kZX@aWHhRCWcDA6arTM?JyLc`D diff --git a/Aetheria.State.Import/Program.cs b/Aetheria.State.Import/Program.cs index d1a088e27..3f798a676 100644 --- a/Aetheria.State.Import/Program.cs +++ b/Aetheria.State.Import/Program.cs @@ -233,6 +233,23 @@ internal static class LegacyCatalogReader "Clockwise" ]); private static readonly Dictionary HullTypes = CreateEnumMap(["Ship", "Station", "Turret"]); + private static readonly Dictionary SimpleCommodityCategories = CreateEnumMap([ + "Minerals", + "Metals", + "Alloys", + "Compounds", + "Organics", + "Ammo", + "Consumer" + ]); + private static readonly Dictionary CompoundCommodityCategories = CreateEnumMap([ + "Wearables", + "Consumables", + "Luxuries", + "Tools", + "Manufacturing", + "Assemblies" + ]); private static readonly Dictionary WeaponRanges = CreateEnumMap(["Melee", "Short", "Medium", "Long"]); private static readonly Dictionary WeaponCalibers = CreateEnumMap(["Small", "Medium", "Large", "ExtraLarge"]); private static readonly Dictionary WeaponTypes = CreateEnumMap([ @@ -395,6 +412,8 @@ internal static class LegacyCatalogReader MaximumTemperature = unionKey is 2 or 3 or 29 or 30 or 31 ? GetDouble(payload, 14) : 0, ThermalPerformanceCurveKeys = unionKey is 2 or 3 or 29 or 30 or 31 ? ReadCurveKeys(payload, 17) : [], HullPrefab = unionKey == 3 ? GetString(payload, 24) : "", + SimpleCommodityCategory = unionKey == 0 ? GetEnumName(payload, 10, SimpleCommodityCategories) : "", + CompoundCommodityCategory = unionKey == 1 ? GetEnumName(payload, 11, CompoundCommodityCategories) : "", WeaponRange = unionKey == 31 ? GetEnumName(payload, 24, WeaponRanges) : "", WeaponCaliber = unionKey == 31 ? GetEnumName(payload, 25, WeaponCalibers) : "", WeaponType = unionKey == 31 ? GetEnumName(payload, 26, WeaponTypes) : "", diff --git a/Aetheria.State.Unity/AetheriaRuntimeCatalogSnapshotMapper.cs b/Aetheria.State.Unity/AetheriaRuntimeCatalogSnapshotMapper.cs index 8871a393d..74e40280a 100644 --- a/Aetheria.State.Unity/AetheriaRuntimeCatalogSnapshotMapper.cs +++ b/Aetheria.State.Unity/AetheriaRuntimeCatalogSnapshotMapper.cs @@ -47,7 +47,9 @@ internal static class AetheriaRuntimeCatalogSnapshotMapper item.MinimumTemperature, item.MaximumTemperature, item.ThermalPerformanceCurveKeys.Select(FromState).ToArray(), - item.HullPrefab); + item.HullPrefab, + item.SimpleCommodityCategory, + item.CompoundCommodityCategory); } private static AetheriaRuntimeShapeCell FromState(AetheriaShapeCell cell) diff --git a/Aetheria.State.Verify/Program.cs b/Aetheria.State.Verify/Program.cs index 20cfd1178..78a53bcfc 100644 --- a/Aetheria.State.Verify/Program.cs +++ b/Aetheria.State.Verify/Program.cs @@ -63,6 +63,8 @@ var behaviorLegacyRefCount = items var hardpointItems = items.Count(item => !string.IsNullOrWhiteSpace(item.HardpointType)); var hullItems = items.Count(item => !string.IsNullOrWhiteSpace(item.HullType)); var hullPrefabItems = items.Count(item => !string.IsNullOrWhiteSpace(item.HullPrefab)); +var simpleCommodityCategoryItems = items.Count(item => !string.IsNullOrWhiteSpace(item.SimpleCommodityCategory)); +var compoundCommodityCategoryItems = items.Count(item => !string.IsNullOrWhiteSpace(item.CompoundCommodityCategory)); var weaponItems = items.Count(item => !string.IsNullOrWhiteSpace(item.WeaponType) && !string.IsNullOrWhiteSpace(item.WeaponRange) && @@ -234,6 +236,16 @@ if (hullPrefabItems != hullItems) throw new InvalidOperationException($"Typed hull prefab import mismatch: hulls={hullItems}, prefabs={hullPrefabItems}."); } +if (simpleCommodityCategoryItems == 0) +{ + throw new InvalidOperationException("Typed simple commodity category import produced no categories."); +} + +if (compoundCommodityCategoryItems == 0) +{ + throw new InvalidOperationException("Typed compound commodity category import produced no categories."); +} + if (weaponItems == 0) { throw new InvalidOperationException("Typed item definitions did not import any weapon facets."); @@ -340,6 +352,7 @@ Console.WriteLine($"Interior masks/hardpoint hosts/hardpoints: {interiorShapeIte Console.WriteLine($"Behavior payload items/payloads/fields/legacy refs: {behaviorPayloadItems}/{behaviorPayloadCount}/{behaviorFieldCount}/{behaviorLegacyRefCount}"); Console.WriteLine($"Behavior/hardpoint/hull/weapon items: {behaviorItems}/{hardpointItems}/{hullItems}/{weaponItems}"); Console.WriteLine($"Hull prefab items: {hullPrefabItems}"); +Console.WriteLine($"Simple/compound commodity category items: {simpleCommodityCategoryItems}/{compoundCommodityCategoryItems}"); Console.WriteLine($"Durable hull/weapon items: {durableMaxDurabilityItems}/{maxDurabilityItems.Length}"); Console.WriteLine($"Thermal range/curve items: {importedThermalRangeItems}/{importedThermalCurveItems}"); Console.WriteLine($"Typed catalog trade items: {tradeItems.Length}"); diff --git a/Aetheria.State/Documents/AetheriaItemDefinition.cs b/Aetheria.State/Documents/AetheriaItemDefinition.cs index 9d3644af1..b77e21afc 100644 --- a/Aetheria.State/Documents/AetheriaItemDefinition.cs +++ b/Aetheria.State/Documents/AetheriaItemDefinition.cs @@ -120,6 +120,12 @@ public sealed class AetheriaItemDefinition [Key(35)] public string HullPrefab { get; set; } = ""; + + [Key(36)] + public string SimpleCommodityCategory { get; set; } = ""; + + [Key(37)] + public string CompoundCommodityCategory { get; set; } = ""; } [MessagePackObject] diff --git a/Assets/Scripts/UI/Menu/TradeMenu.cs b/Assets/Scripts/UI/Menu/TradeMenu.cs index de673679a..5a642e07d 100644 --- a/Assets/Scripts/UI/Menu/TradeMenu.cs +++ b/Assets/Scripts/UI/Menu/TradeMenu.cs @@ -198,26 +198,22 @@ public class TradeMenu : MonoBehaviour columns.Add(("Type", 2, x => () => { - if (x.TypedItem != null && x.TypedItem.Category == "SimpleCommodityData" && x.LegacyData is SimpleCommodityData s) - return Enum.GetName(typeof(SimpleCommodityCategory), s.Category); - if (x.TypedItem != null && x.TypedItem.Category == "CompoundCommodityData" && x.LegacyData is CompoundCommodityData c) - return Enum.GetName(typeof(CompoundCommodityCategory), c.Category); + if (x.TryGetTypedSimpleCommodityCategory(out _)) + return x.TypedItem.SimpleCommodityCategory; + if (x.TryGetTypedCompoundCommodityCategory(out _)) + return x.TypedItem.CompoundCommodityCategory; if (x.TryGetTypedHardpoint(out var hardpointType)) return Enum.GetName(typeof(HardpointType), hardpointType); - if (x.TypedItem == null && x.LegacyData is SimpleCommodityData legacySimple) return Enum.GetName(typeof(SimpleCommodityCategory), legacySimple.Category); - if(x.TypedItem == null && x.LegacyData is CompoundCommodityData legacyCompound) return Enum.GetName(typeof(CompoundCommodityCategory), legacyCompound.Category); return "None"; }, x => { - if (x.TypedItem != null && x.TypedItem.Category == "SimpleCommodityData" && x.LegacyData is SimpleCommodityData s) - return (int) s.Category; + if (x.TryGetTypedSimpleCommodityCategory(out var simpleCategory)) + return (int)simpleCategory; var offset = Enum.GetValues(typeof(SimpleCommodityCategory)).Length; - if(x.TypedItem != null && x.TypedItem.Category == "CompoundCommodityData" && x.LegacyData is CompoundCommodityData c) - return (int) c.Category + offset; + if(x.TryGetTypedCompoundCommodityCategory(out var compoundCategory)) + return (int)compoundCategory + offset; offset += Enum.GetValues(typeof(CompoundCommodityCategory)).Length; if (x.TryGetTypedHardpoint(out var hardpointType)) return (int) hardpointType + offset; - if (x.TypedItem == null && x.LegacyData is SimpleCommodityData legacySimple) return (int) legacySimple.Category; - if(x.TypedItem == null && x.LegacyData is CompoundCommodityData legacyCompound) return (int) legacyCompound.Category + Enum.GetValues(typeof(SimpleCommodityCategory)).Length; return 0; })); columns.Add(("Mass", 1, @@ -245,10 +241,10 @@ public class TradeMenu : MonoBehaviour MaximumSizeFilter.Height.text.Length > 0 && i.ShapeHeight > int.Parse(MaximumSizeFilter.Height.text))); if(_commodityFilter.filter != null) - items = items.Where(i => i.LegacyData is SimpleCommodityData s && s.Category == _commodityFilter.type); + items = items.Where(i => i.TryGetTypedSimpleCommodityCategory(out var category) && category == _commodityFilter.type); if(_compoundCommodityFilter.filter != null) - items = items.Where(i => i.LegacyData is CompoundCommodityData c && c.Category == _compoundCommodityFilter.type); + items = items.Where(i => i.TryGetTypedCompoundCommodityCategory(out var category) && category == _compoundCommodityFilter.type); if (_hardpointFilter.filter != null) items = items.Where(i => i.TryGetTypedHardpoint(out var hardpointType) && hardpointType == _hardpointFilter.type); @@ -428,11 +424,11 @@ public class TradeMenu : MonoBehaviour public EquippableItemData LegacyEquippableData => LegacyData as EquippableItemData; - public Guid LegacyId => Item?.Data?.ItemId ?? LegacyData.ID; + public Guid LegacyId => Item?.Data?.ItemId ?? Guid.Empty; - public string Name => !string.IsNullOrWhiteSpace(TypedItem?.Name) ? TypedItem.Name : LegacyData.Name; + public string Name => !string.IsNullOrWhiteSpace(TypedItem?.Name) ? TypedItem.Name : "Unknown Item"; - public float Mass => TypedItem != null ? (float)TypedItem.Mass : LegacyData.Mass; + public float Mass => TypedItem != null ? (float)TypedItem.Mass : 0f; public int Price { @@ -441,15 +437,29 @@ public class TradeMenu : MonoBehaviour if (Item is CraftedItemInstance craftedItemInstance) return _itemManager.GetPrice(craftedItemInstance); - return TypedItem != null ? TypedItem.Price : LegacyData.Price; + return TypedItem != null ? TypedItem.Price : 0; } } - public int ShapeWidth => TypedItem != null && TypedItem.ShapeWidth > 0 ? TypedItem.ShapeWidth : LegacyData.Shape.Width; + public int ShapeWidth => TypedItem != null && TypedItem.ShapeWidth > 0 ? TypedItem.ShapeWidth : 0; - public int ShapeHeight => TypedItem != null && TypedItem.ShapeHeight > 0 ? TypedItem.ShapeHeight : LegacyData.Shape.Height; + public int ShapeHeight => TypedItem != null && TypedItem.ShapeHeight > 0 ? TypedItem.ShapeHeight : 0; - public bool IsHull => TypedItem != null ? !string.IsNullOrWhiteSpace(TypedItem.HullType) : LegacyData is HullData; + public bool IsHull => !string.IsNullOrWhiteSpace(TypedItem?.HullType); + + public bool TryGetTypedSimpleCommodityCategory(out SimpleCommodityCategory category) + { + category = SimpleCommodityCategory.Minerals; + return !string.IsNullOrWhiteSpace(TypedItem?.SimpleCommodityCategory) && + Enum.TryParse(TypedItem.SimpleCommodityCategory, true, out category); + } + + public bool TryGetTypedCompoundCommodityCategory(out CompoundCommodityCategory category) + { + category = CompoundCommodityCategory.Wearables; + return !string.IsNullOrWhiteSpace(TypedItem?.CompoundCommodityCategory) && + Enum.TryParse(TypedItem.CompoundCommodityCategory, true, out category); + } public bool TryGetTypedHardpoint(out HardpointType hardpointType) { diff --git a/GameData/aetheria-world.cc b/GameData/aetheria-world.cc index 064fa5147db20f5f14a469f25b9abe05338278e6..c91e0747830d62b0e3745b8a0d797a41529e32b3 100644 GIT binary patch delta 368 zcmbu4JxT*X7(h*-g#`Q|%dSD2pjNuf?)-ihqAqv=4x z>}+g3fOvyI^a!T1h^6&=#d}Ya&il0UxE~)OIhlFMGl2pmS|u}L5|t)idhfM!0wo7! ztYMDGbKoAV(9)L@z_U=rhXr7kS;fB@k$#d57AwJc|+|DMz*5C!QgCIHJ4P>RaLv;)oqw07ol0&+T{9I znZc&M9=Um`7gkTZ#eW|^7k1mV^nP)Dy!|{MlcxRXb-eTPw_rxX^t{`?@vq|_V9s}1 delta 244 zcmbu(v28*z5CBjpXpm5Ey)G6iA- zB*X}02ijM?-+TXj>z}6eI}>O2$wkJX(u((p5Hs6GvShCggCLTV98_B{4W}SPR{5V; zsjTbyXA}&WjYiA@1kiYcF|<~|A|wQZ-jHEKWFi72(daZLi%c$42$$-wtiHx&TfcSH b_)wMIX0&)QcI{2N thermalPerformanceCurveKeys, - string hullPrefab) + string hullPrefab, + string simpleCommodityCategory, + string compoundCommodityCategory) { LegacyId = legacyId; Name = name; @@ -157,6 +159,8 @@ namespace GameCult.Aetheria.State.Unity MaximumTemperature = maximumTemperature; ThermalPerformanceCurveKeys = thermalPerformanceCurveKeys; HullPrefab = hullPrefab; + SimpleCommodityCategory = simpleCommodityCategory; + CompoundCommodityCategory = compoundCommodityCategory; } public string LegacyId { get; } @@ -191,6 +195,8 @@ namespace GameCult.Aetheria.State.Unity public double MaximumTemperature { get; } public IReadOnlyList ThermalPerformanceCurveKeys { get; } public string HullPrefab { get; } + public string SimpleCommodityCategory { get; } + public string CompoundCommodityCategory { get; } } public sealed class AetheriaRuntimeCurveKey diff --git a/Packages/org.gamecult.aetheria.state/Runtime/AetheriaRuntimeCatalogStore.cs b/Packages/org.gamecult.aetheria.state/Runtime/AetheriaRuntimeCatalogStore.cs index 9431691eb..fbddf745a 100644 --- a/Packages/org.gamecult.aetheria.state/Runtime/AetheriaRuntimeCatalogStore.cs +++ b/Packages/org.gamecult.aetheria.state/Runtime/AetheriaRuntimeCatalogStore.cs @@ -199,7 +199,9 @@ namespace GameCult.Aetheria.State.Unity var maximumTemperature = ReadFieldDouble(ref reader, fields, 33); var thermalPerformanceCurveKeys = ReadFieldCurveKeys(ref reader, fields, 34); var hullPrefab = ReadFieldString(ref reader, fields, 35); - SkipRemaining(ref reader, fields, 36); + var simpleCommodityCategory = ReadFieldString(ref reader, fields, 36); + var compoundCommodityCategory = ReadFieldString(ref reader, fields, 37); + SkipRemaining(ref reader, fields, 38); return new AetheriaRuntimeCatalogItem( legacyId, @@ -233,7 +235,9 @@ namespace GameCult.Aetheria.State.Unity minimumTemperature, maximumTemperature, thermalPerformanceCurveKeys, - hullPrefab); + hullPrefab, + simpleCommodityCategory, + compoundCommodityCategory); } private static AetheriaRuntimeCorporation ReadCorporation(byte[] payload) diff --git a/docs/aetheria-perfect-machine-map.md b/docs/aetheria-perfect-machine-map.md index d9ab1a4ef..e5464957a 100644 --- a/docs/aetheria-perfect-machine-map.md +++ b/docs/aetheria-perfect-machine-map.md @@ -154,10 +154,10 @@ legacy catalog cache, and legacy UI paths should be migration-only or deleted. turned typed trade rows back into legacy `ItemData` objects. That hydration now comes from typed state, not `AetherDB.msgpack`. The surviving trade menu wraps rows in a typed `TradeRow`: name, mass, price, size, hardpoint type, - hull ownership, and behavior-kind filters read typed catalog rows before any - legacy projection is hydrated. Legacy `ItemData` hydration is lazy and bounded - to commodity subtype filters/type labels, behavior reflection columns, missing - typed-row fallback, and buy actions. The sector properties UI also resolves + commodity subtype, hull ownership, and behavior-kind filters read typed + catalog rows before any legacy projection is hydrated. Legacy `ItemData` + hydration is lazy and bounded to behavior reflection columns and buy actions. + The sector properties UI also resolves station/turret/ship counts only through typed hull classifications from the runtime catalog; missing typed hull rows no longer fall back to legacy `HullData`. Loot pickup presentation now uses typed catalog category/name rows to choose weapon-vs-gear @@ -638,10 +638,9 @@ First Aetheria surfaces to publish: - Done: move surviving trade menu size, hardpoint, and behavior filters onto typed catalog row prefilters before row-level `ItemData` hydration. - Done: move trade menu row presentation for name, mass, price, size, - hardpoint type, hull-owned counts, and behavior-kind filtering onto typed - `TradeRow` fields; legacy `ItemData` hydration is lazy and bounded to - commodity subtype detail, behavior reflection columns, missing typed rows, - and buy mechanics. + hardpoint type, commodity subtype, hull-owned counts, and behavior-kind + filtering onto typed `TradeRow` fields; legacy `ItemData` hydration is + lazy and bounded to behavior reflection columns and buy mechanics. - Done: move action-bar consumable drop binding onto typed catalog rows; legacy `ConsumableItemData` resolution is lazy and bounded to activation and active-duration fill until typed consumable effect execution exists.