Use typed item rows for blueprint pricing
This commit is contained in:
parent
18dc4a61ce
commit
c68dc15c3e
4 changed files with 32 additions and 22 deletions
Binary file not shown.
|
|
@ -199,6 +199,22 @@ public class ItemManager
|
|||
: (int) (GameplaySettings.QualityPriceModifier.Evaluate(item.Quality) * typedItem.Price);
|
||||
}
|
||||
|
||||
public int GetPrice(ItemInstance item)
|
||||
{
|
||||
var typedItem = GetRuntimeItem(item);
|
||||
if (typedItem == null)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
return item switch
|
||||
{
|
||||
CraftedItemInstance crafted => (int)(GameplaySettings.QualityPriceModifier.Evaluate(crafted.Quality) * typedItem.Price),
|
||||
SimpleCommodity commodity => typedItem.Price * commodity.Quantity,
|
||||
_ => typedItem.Price
|
||||
};
|
||||
}
|
||||
|
||||
public SimpleCommodity CreateInstance(SimpleCommodityData item, int count)
|
||||
{
|
||||
if (item != null)
|
||||
|
|
|
|||
|
|
@ -133,9 +133,9 @@ public static class RuntimeEntityBlueprintProjector
|
|||
if(!instantiate)
|
||||
entity.Armor = blueprint.Armor;
|
||||
|
||||
var hullData = itemManager.GetData(entity.Hull);
|
||||
|
||||
foreach(var v in hullData.Shape.Coordinates)
|
||||
var hullShape = itemManager.GetRuntimeShape(entity.Hull);
|
||||
|
||||
foreach(var v in hullShape.Coordinates)
|
||||
entity.HullConductivity[v.x,v.y] = blueprint.Conductivity[v.x,v.y];
|
||||
|
||||
entity.WeaponGroups = blueprint.WeaponGroups.Select(itemIndices =>
|
||||
|
|
@ -186,34 +186,26 @@ public abstract class RuntimeEntityBlueprint
|
|||
{
|
||||
if (_price != 0) return _price;
|
||||
|
||||
var hullData = itemManager.GetData(Hull);
|
||||
_price = hullData.Price;
|
||||
_price = itemManager.GetPrice(Hull);
|
||||
|
||||
foreach (var (_, item) in Equipment)
|
||||
{
|
||||
var itemData = itemManager.GetData(item);
|
||||
_price += itemData.Price;
|
||||
_price += itemManager.GetPrice(item);
|
||||
}
|
||||
foreach (var (_, item) in CargoBays)
|
||||
{
|
||||
var itemData = itemManager.GetData(item);
|
||||
_price += itemData.Price;
|
||||
_price += itemManager.GetPrice(item);
|
||||
}
|
||||
foreach (var (_, item) in DockingBays)
|
||||
{
|
||||
var itemData = itemManager.GetData(item);
|
||||
_price += itemData.Price;
|
||||
_price += itemManager.GetPrice(item);
|
||||
}
|
||||
|
||||
foreach (var t in CargoContents)
|
||||
{
|
||||
foreach (var (_, item) in t)
|
||||
{
|
||||
var itemData = itemManager.GetData(item);
|
||||
if (item is SimpleCommodity s)
|
||||
_price += itemData.Price * s.Quantity;
|
||||
else
|
||||
_price += itemData.Price;
|
||||
_price += itemManager.GetPrice(item);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -221,11 +213,7 @@ public abstract class RuntimeEntityBlueprint
|
|||
{
|
||||
foreach (var (_, item) in t)
|
||||
{
|
||||
var itemData = itemManager.GetData(item);
|
||||
if (item is SimpleCommodity s)
|
||||
_price += itemData.Price * s.Quantity;
|
||||
else
|
||||
_price += itemData.Price;
|
||||
_price += itemManager.GetPrice(item);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -113,7 +113,10 @@ legacy catalog cache, and legacy UI paths should be migration-only or deleted.
|
|||
now queues current-zone/current-entity-collection snapshots through the
|
||||
runtime commit log during run checkpoints; `RuntimeZoneBlueprint` and
|
||||
`RuntimeEntityBlueprint` remain runtime construction/loadout projections
|
||||
rather than durable file formats.
|
||||
rather than durable file formats. Runtime blueprint restore now iterates typed
|
||||
hull shape rows when restoring saved conductivity, and blueprint price
|
||||
aggregation uses typed runtime item prices through `ItemManager` instead of
|
||||
hydrating `HullData.Shape` or `ItemData.Price`.
|
||||
- `Aetheria.State` now defines `AetheriaLoadoutTemplate` as the typed Verse
|
||||
replacement for bespoke `.loadout` files. It stores structured hull,
|
||||
equipment, cargo bay, docking bay, child-entity, assignment, and weapon-group
|
||||
|
|
@ -714,6 +717,9 @@ First Aetheria surfaces to publish:
|
|||
- Done: move `EquippedItem` and `ConsumableItemEffect` behavior construction
|
||||
off `Data.Behaviors` and onto typed runtime behavior payload projection;
|
||||
`BehaviorData` remains only the temporary behavior-class config bridge.
|
||||
- Done: move runtime blueprint price aggregation and conductivity restore
|
||||
geometry onto typed runtime item price and hull shape rows; legacy
|
||||
`ItemData.Price` and `HullData.Shape` no longer own those blueprint paths.
|
||||
- Done: move final `Entity.ItemFits`, `TryFindSpace`, `TryEquip`, and
|
||||
`TryUnequip` gear occupancy/mass deltas onto typed catalog rows for item
|
||||
shape, hull shape/interior, hardpoint masks, cargo/docking category, and
|
||||
|
|
|
|||
Loading…
Reference in a new issue