pub struct OverlordState {Show 20 fields
pub character_state: CharacterState,
pub blocked_character_ids: Vec<Uuid>,
pub flip_state: FlipState,
pub active_fight: Option<ActiveFight>,
pub pvp_state: Option<PVPState>,
pub connection_store: HashMap<String, i64>,
pub quest_groups: QuestsGroups,
pub incoming_gifts: Vec<Gift>,
pub incoming_mails: Vec<Mail>,
pub patron: Option<Patron>,
pub referral_daily_reward_claimed: Option<bool>,
pub auto_chest: AutoChest,
pub arena: Arena,
pub dungeons: Dungeons,
pub offers_info: OffersInfo,
pub permissions: Vec<UserPermissions>,
pub party: Party,
pub progress_pass: ProgressPassState,
pub rating_reward_availability: Vec<RatingRewardAvailability>,
pub last_fight_breakdown: Option<FightBreakdown>,
}Fields§
§character_state: CharacterState§blocked_character_ids: Vec<Uuid>§flip_state: FlipStatePersistent global side and gauge shared by every flip equipment slot.
active_fight: Option<ActiveFight>§pvp_state: Option<PVPState>§connection_store: HashMap<String, i64>§quest_groups: QuestsGroups§incoming_gifts: Vec<Gift>§incoming_mails: Vec<Mail>§patron: Option<Patron>§referral_daily_reward_claimed: Option<bool>§auto_chest: AutoChest§arena: Arena§dungeons: Dungeons§offers_info: OffersInfo§permissions: Vec<UserPermissions>§party: Party§progress_pass: ProgressPassState§rating_reward_availability: Vec<RatingRewardAvailability>Authoritative unclaimed Daily/Weekly rating reward flags for every rating type. Hydrated from entitlement storage and changed by server events; the client never derives these flags from local time or rank.
last_fight_breakdown: Option<FightBreakdown>Per-source damage/heal breakdown of the LAST completed fight — campaign
stage, arena match or dungeon run alike. Written once, in
handle_end_fight, and replaced by the next fight’s summary.
A state field rather than an EndFight payload for two reasons: it
survives StateResync (a carried-over one-shot event does not), and the
documented within-tick ordering — the state patch applies on the client
BEFORE that tick’s events reach handlers — means it is already readable
when EndFight arrives, so the existing event doubles as the
“breakdown is ready” signal with no race.
Not persisted: storage hydrates None, like active_fight.
Implementations§
Source§impl OverlordState
impl OverlordState
pub fn claim_vassal_reward( &mut self, vassal_id: Uuid, claim_time: DateTime<Utc>, ) -> Result<()>
pub fn claim_suzerain_reward(&mut self, claim_time: DateTime<Utc>) -> Result<()>
pub fn compute_description_values_for_ability( &self, ability: &Ability, behaviors: &BehaviorRegistry, config: &GameConfig, ) -> Vec<f64>
pub fn compute_description_values_for_talent( &self, talent_template: &TalentTemplate, level: i64, ) -> Vec<f64>
pub fn compute_description_values_template( &self, ability_template: &AbilityTemplate, behaviors: &BehaviorRegistry, config: &GameConfig, ) -> Vec<f64>
pub fn compute_afk_reward( &self, game_config: &GameConfig, behaviors: &BehaviorRegistry, ) -> Vec<BundleElement>
pub fn compute_afk_instant_reward( &self, game_config: &GameConfig, behaviors: &BehaviorRegistry, ) -> Vec<BundleElement>
pub fn compute_bundle_reward( &self, game_config: &GameConfig, behaviors: &BehaviorRegistry, bundle_id: BundleId, ) -> Vec<BundleElement>
pub fn calculate_item_power( &self, item: Item, game_config: &GameConfig, behaviors: &BehaviorRegistry, ) -> Result<i64>
Sourcepub fn calculate_item_power_for_character_state(
character_state: &CharacterState,
item: Item,
game_config: &GameConfig,
behaviors: &BehaviorRegistry,
) -> Result<i64>
pub fn calculate_item_power_for_character_state( character_state: &CharacterState, item: Item, game_config: &GameConfig, behaviors: &BehaviorRegistry, ) -> Result<i64>
Item power against an arbitrary character rather than the local player. Item power is loadout-relative (the marginal power an item adds to a character’s equipped set), so viewing another player’s item — e.g. in their profile — must evaluate it against that player’s own state.
Sourcepub fn calculate_power_with_item_equipped(
&self,
item_id: Uuid,
game_config: &GameConfig,
behaviors: &BehaviorRegistry,
) -> Result<i64>
pub fn calculate_power_with_item_equipped( &self, item_id: Uuid, game_config: &GameConfig, behaviors: &BehaviorRegistry, ) -> Result<i64>
character.power recomputed with inventory item item_id
hypothetically equipped: applies the same is_equipped mutation as
handle_player_equip_item to a copy of the character state and runs the
authoritative full-aggregation power path
(crate::behaviors::power::character_power). The item_power
marginal path is NOT equivalent: it composes attrs from level+items+pets
only (no class/talents/statue, no armor deflation) and drifts from the
authoritative value under the nonlinear power formula.
Evaluating BOTH sides of a gear comparison through this function makes
stale is_equipped flags (an optimistic equip whose patch is still in
flight) cancel out of the difference.
Sourcepub fn calculate_power_with_candidate_equipped(
&self,
candidate: &Item,
game_config: &GameConfig,
behaviors: &BehaviorRegistry,
) -> Result<i64>
pub fn calculate_power_with_candidate_equipped( &self, candidate: &Item, game_config: &GameConfig, behaviors: &BehaviorRegistry, ) -> Result<i64>
Self::calculate_power_with_item_equipped for a candidate that need
not be in the inventory yet — the auto-chest filter ranks freshly
dropped items before they are appended to character_state.inventory,
so it cannot look them up by id.
Sourcepub fn calculate_current_power(
&self,
game_config: &GameConfig,
behaviors: &BehaviorRegistry,
) -> Result<i64>
pub fn calculate_current_power( &self, game_config: &GameConfig, behaviors: &BehaviorRegistry, ) -> Result<i64>
character.power for the loadout exactly as it stands — the baseline
every auto-chest comparison is made against.
Sourcepub fn auto_chest_power_maps(
&self,
candidates: &[Item],
game_config: &GameConfig,
behaviors: &BehaviorRegistry,
) -> Result<(HashMap<Uuid, i64>, HashMap<EquipmentSlotKey, i64>)>
pub fn auto_chest_power_maps( &self, candidates: &[Item], game_config: &GameConfig, behaviors: &BehaviorRegistry, ) -> Result<(HashMap<Uuid, i64>, HashMap<EquipmentSlotKey, i64>)>
The two power maps essences::autochest::filter_items compares.
Both sides are scored as “character power with that item equipped”
through the authoritative aggregation — the SAME comparison the client
makes in IsItemUpgrade and on the gear-compare cards. The marginal
item_power category must not be used here: it composes attrs from
level+items+pets only (no class/talents/statue, no armor deflation) and
power_from_attrs is nonlinear, so the two paths genuinely rank
same-slot items differently — e.g. a +crit_chance item is worth
nothing once class and talents have pushed the clamped crit term to its
cap, which the marginal baseline never sees.
Every occupied slot maps to the same baseline: hypothetically re-equipping an already-equipped item is a no-op, so “power with the equipped item” IS current power. One aggregation covers them all instead of one per equipped item.
Sourcepub fn calculate_equip_power_delta(
&self,
item_id: Uuid,
game_config: &GameConfig,
behaviors: &BehaviorRegistry,
) -> Result<i64>
pub fn calculate_equip_power_delta( &self, item_id: Uuid, game_config: &GameConfig, behaviors: &BehaviorRegistry, ) -> Result<i64>
Predicted character.power change from equipping inventory item
item_id (Self::calculate_power_with_item_equipped minus the stored
authoritative power), so a client-side prediction reconciles exactly
against the server’s recalculated power.
Sourcepub fn calculate_item_power_full(
&self,
item_id: Uuid,
game_config: &GameConfig,
behaviors: &BehaviorRegistry,
) -> Result<i64>
pub fn calculate_item_power_full( &self, item_id: Uuid, game_config: &GameConfig, behaviors: &BehaviorRegistry, ) -> Result<i64>
Full-path item power for inventory item item_id: character.power
with the item equipped minus character.power with the item’s
equipment slot empty, both through the authoritative aggregation
(crate::behaviors::power::character_power). Unlike the marginal
item_power category (level+items+pets only), two of these share the
slot-empty baseline, so their difference equals
Self::calculate_equip_power_delta exactly — gear-compare card
scores stay arithmetically consistent with the displayed delta.
pub fn get_active_fight_player(&self) -> Option<&Entity>
pub fn get_active_fight_player_mut(&mut self) -> Option<&mut Entity>
Trait Implementations§
Source§impl Clone for OverlordState
impl Clone for OverlordState
Source§fn clone(&self) -> OverlordState
fn clone(&self) -> OverlordState
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for OverlordState
impl Debug for OverlordState
Source§impl Default for OverlordState
impl Default for OverlordState
Source§fn default() -> OverlordState
fn default() -> OverlordState
Source§impl<'de> Deserialize<'de> for OverlordState
impl<'de> Deserialize<'de> for OverlordState
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl EventHandler<OverlordEvent, OverlordState> for PureEventHandler
impl EventHandler<OverlordEvent, OverlordState> for PureEventHandler
type Context = ()
async fn create_context_for_batch( &self, _state: &OverlordState, ) -> Result<Self::Context>
Source§async fn handle_event(
&mut self,
_ctx: &Self::Context,
event: &OverlordEvent,
meta: EventMeta,
prev_state: &OverlordState,
state: OverlordState,
) -> Result<EventHandleResult<OverlordEvent, OverlordState>>
async fn handle_event( &mut self, _ctx: &Self::Context, event: &OverlordEvent, meta: EventMeta, prev_state: &OverlordState, state: OverlordState, ) -> Result<EventHandleResult<OverlordEvent, OverlordState>>
prev_state is the System’s state before this event
(same data as state, by reference — avoids an extra clone for the
compute_fields diff). Impls are responsible for:
pure state mutation -> compute_fields fold (diff vs prev_state, runs for
failed results too; prepend emitted events) -> DB persistence /
validation -> analytics deferral.
Err(_) aborts the whole batch (txn rollback). “Soft” failures must be
returned as Ok(EventHandleResult::fail(...)).Source§fn compute_fields(
&self,
state: &mut OverlordState,
prev_state: &OverlordState,
) -> Vec<OverlordEvent>
fn compute_fields( &self, state: &mut OverlordState, prev_state: &OverlordState, ) -> Vec<OverlordEvent>
handle_event and by
System::apply_state_with_compute_fields.Source§fn collect_due_scheduled(&mut self, current_tick: u64) -> Vec<OverlordEvent>
fn collect_due_scheduled(&mut self, current_tick: u64) -> Vec<OverlordEvent>
current_tick.
Drained alongside the delayed/cron plugins on every tick. Lets a
handler own domain scheduling (e.g. the fight clock) so the same
state drives both the live system and standalone simulations.
Deliberately has no default body — every impl must state it explicitly.async fn finalize_state( &self, _ctx: &Self::Context, _state: &mut OverlordState, ) -> Result<()>
Source§async fn persist_in_memory_state(
&self,
_ctx: &Self::Context,
_state: &OverlordState,
) -> Result<()>
async fn persist_in_memory_state( &self, _ctx: &Self::Context, _state: &OverlordState, ) -> Result<()>
§fn event_needs_full_context(&self, _event: &E, _state: &S) -> bool
fn event_needs_full_context(&self, _event: &E, _state: &S) -> bool
event may touch the context’s backing resources
(DB transaction, persistence). Handlers that support pure (DB-less)
contexts override this for events whose handling is pure logic
end-to-end; the default — true for every event — keeps the eager
full-context behavior. state is the System state at dispatch time —
handlers use it for state-dependent persistence (e.g. quest
subscriptions that persist progress on otherwise-pure events).§fn create_pure_context_for_batch(
&self,
state: &S,
) -> impl Future<Output = Result<Self::Context, Error>> + Send
fn create_pure_context_for_batch( &self, state: &S, ) -> impl Future<Output = Result<Self::Context, Error>> + Send
event_needs_full_context == false. Defaults to the full context.§fn context_is_pure(&self, _ctx: &Self::Context) -> bool
fn context_is_pure(&self, _ctx: &Self::Context) -> bool
ctx is a pure (DB-less) context that must be upgraded via
upgrade_context before handling a full-context event.Source§impl From<OverlordState> for JsValuewhere
OverlordState: Serialize,
impl From<OverlordState> for JsValuewhere
OverlordState: Serialize,
Source§fn from(value: OverlordState) -> Self
fn from(value: OverlordState) -> Self
Source§impl IntoWasmAbi for OverlordStatewhere
OverlordState: Serialize,
impl IntoWasmAbi for OverlordStatewhere
OverlordState: Serialize,
Source§impl JsonSchema for OverlordState
impl JsonSchema for OverlordState
Source§fn schema_name() -> String
fn schema_name() -> String
Source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
Source§fn json_schema(generator: &mut SchemaGenerator) -> Schema
fn json_schema(generator: &mut SchemaGenerator) -> Schema
§fn is_referenceable() -> bool
fn is_referenceable() -> bool
$ref keyword. Read moreSource§impl OptionIntoWasmAbi for OverlordStatewhere
OverlordState: Serialize,
impl OptionIntoWasmAbi for OverlordStatewhere
OverlordState: Serialize,
Source§impl PartialEq for OverlordState
impl PartialEq for OverlordState
Source§impl Serialize for OverlordState
impl Serialize for OverlordState
Source§impl State for OverlordState
impl State for OverlordState
Source§fn cmp_db_updated(&self, db_updated: &Self) -> bool
fn cmp_db_updated(&self, db_updated: &Self) -> bool
Compares version from database with local
fn is_ticker_paused(&self) -> bool
Source§impl Tsify for OverlordState
impl Tsify for OverlordState
const DECL: &'static str = "export interface OverlordState {\n character_state: CharacterState;\n blocked_character_ids: Uuid[];\n /**\n * Persistent global side and gauge shared by every flip equipment slot.\n */\n flip_state: FlipState;\n active_fight: ActiveFight | null;\n pvp_state: PVPState | null;\n connection_store: Record<string, number>;\n quest_groups: QuestsGroups;\n incoming_gifts: Gift[];\n incoming_mails: Mail[];\n patron: Patron | null;\n referral_daily_reward_claimed: boolean | null;\n auto_chest: AutoChest;\n arena: Arena;\n dungeons: Dungeons;\n offers_info: OffersInfo;\n permissions: UserPermissions[];\n party: Party;\n progress_pass: ProgressPassState;\n /**\n * Authoritative unclaimed Daily/Weekly rating reward flags for every\n * rating type. Hydrated from entitlement storage and changed by server\n * events; the client never derives these flags from local time or rank.\n */\n rating_reward_availability: RatingRewardAvailability[];\n /**\n * Per-source damage/heal breakdown of the LAST completed fight \u{2014} campaign\n * stage, arena match or dungeon run alike. Written once, in\n * `handle_end_fight`, and replaced by the next fight\\\'s summary.\n *\n * A state field rather than an `EndFight` payload for two reasons: it\n * survives `StateResync` (a carried-over one-shot event does not), and the\n * documented within-tick ordering \u{2014} the state patch applies on the client\n * BEFORE that tick\\\'s events reach handlers \u{2014} means it is already readable\n * when `EndFight` arrives, so the existing event doubles as the\n * \\\"breakdown is ready\\\" signal with no race.\n *\n * Not persisted: storage hydrates `None`, like `active_fight`.\n */\n last_fight_breakdown: FightBreakdown | null;\n}"
const SERIALIZATION_CONFIG: SerializationConfig
type JsType = JsType
fn into_js(&self) -> Result<Self::JsType, Error>where
Self: Serialize,
fn from_js<T>(js: T) -> Result<Self, Error>
Source§impl VectorIntoWasmAbi for OverlordStatewhere
OverlordState: Serialize,
impl VectorIntoWasmAbi for OverlordStatewhere
OverlordState: Serialize,
type Abi = <JsType as VectorIntoWasmAbi>::Abi
fn vector_into_abi(vector: Box<[Self]>) -> Self::Abi
Source§impl WasmDescribeVector for OverlordState
impl WasmDescribeVector for OverlordState
impl Eq for OverlordState
impl StructuralPartialEq for OverlordState
Auto Trait Implementations§
impl Freeze for OverlordState
impl RefUnwindSafe for OverlordState
impl Send for OverlordState
impl Sync for OverlordState
impl Unpin for OverlordState
impl UnwindSafe for OverlordState
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<T> FutureExt for T
impl<T> FutureExt for T
§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> ReturnWasmAbi for Twhere
T: IntoWasmAbi,
impl<T> ReturnWasmAbi for Twhere
T: IntoWasmAbi,
Source§type Abi = <T as IntoWasmAbi>::Abi
type Abi = <T as IntoWasmAbi>::Abi
IntoWasmAbi::AbiSource§fn return_abi(self) -> <T as ReturnWasmAbi>::Abi
fn return_abi(self) -> <T as ReturnWasmAbi>::Abi
IntoWasmAbi::into_abi, except that it may throw and never
return in the case of Err.