pub struct MarketSystem<H: MarketHook> { /* private fields */ }Expand description
Market system (orchestrates market updates)
This system coordinates between service (pure logic), state (mutable data), and hooks (game-specific customization).
Implementations§
Source§impl<H: MarketHook> MarketSystem<H>
impl<H: MarketHook> MarketSystem<H>
Sourcepub async fn update_prices(
&self,
state: &mut MarketState,
config: &MarketConfig,
) -> Vec<PriceChange>
pub async fn update_prices( &self, state: &mut MarketState, config: &MarketConfig, ) -> Vec<PriceChange>
Sourcepub async fn apply_event(
&self,
event: MarketEvent,
state: &mut MarketState,
config: &MarketConfig,
)
pub async fn apply_event( &self, event: MarketEvent, state: &mut MarketState, config: &MarketConfig, )
Apply a market event
§Arguments
event- Market event to applystate- Mutable market stateconfig- Market configuration
Sourcepub fn get_items_by_trend(
state: &MarketState,
trend: MarketTrend,
) -> Vec<ItemId> ⓘ
pub fn get_items_by_trend( state: &MarketState, trend: MarketTrend, ) -> Vec<ItemId> ⓘ
Sourcepub fn set_demand_supply(
state: &mut MarketState,
item_id: &ItemId,
demand: Option<f32>,
supply: Option<f32>,
)
pub fn set_demand_supply( state: &mut MarketState, item_id: &ItemId, demand: Option<f32>, supply: Option<f32>, )
Manually set demand/supply for an item
§Arguments
state- Mutable market stateitem_id- Item to updatedemand- New demand value (None = unchanged)supply- New supply value (None = unchanged)
Sourcepub fn get_market_summary(state: &MarketState) -> (f32, usize, usize)
pub fn get_market_summary(state: &MarketState) -> (f32, usize, usize)
Auto Trait Implementations§
impl<H> Freeze for MarketSystem<H>where
H: Freeze,
impl<H> RefUnwindSafe for MarketSystem<H>where
H: RefUnwindSafe,
impl<H> Send for MarketSystem<H>
impl<H> Sync for MarketSystem<H>
impl<H> Unpin for MarketSystem<H>where
H: Unpin,
impl<H> UnsafeUnpin for MarketSystem<H>where
H: UnsafeUnpin,
impl<H> UnwindSafe for MarketSystem<H>where
H: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<T> Component for T
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more