Struct OverlordState

Source
pub struct OverlordState {
Show 16 fields pub character_state: CharacterState, pub blocked_character_ids: Vec<Uuid>, 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,
}

Fields§

§character_state: CharacterState§blocked_character_ids: Vec<Uuid>§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

Implementations§

Source§

impl OverlordState

Source

pub fn claim_vassal_reward( &mut self, vassal_id: Uuid, claim_time: DateTime<Utc>, ) -> Result<()>

Source

pub fn claim_suzerain_reward(&mut self, claim_time: DateTime<Utc>) -> Result<()>

Source

pub fn compute_description_values_for_ability( &self, ability: &Ability, script_runner: &ScriptRunner<OverlordEvent, OverlordState>, config: &GameConfig, ) -> Vec<f64>

Source

pub fn compute_description_values_for_talent( &self, talent_template: &TalentTemplate, level: i64, script_runner: &ScriptRunner<OverlordEvent, OverlordState>, ) -> Vec<f64>

Source

pub fn compute_description_values_template( &self, ability_template: &AbilityTemplate, script_runner: &ScriptRunner<OverlordEvent, OverlordState>, config: &GameConfig, ) -> Vec<f64>

Source

pub fn compute_afk_reward( &self, game_config: &GameConfig, script_runner: &ScriptRunner<OverlordEvent, OverlordState>, ) -> Vec<BundleElement>

Source

pub fn compute_afk_instant_reward( &self, game_config: &GameConfig, script_runner: &ScriptRunner<OverlordEvent, OverlordState>, ) -> Vec<BundleElement>

Source

pub fn compute_bundle_reward( &self, game_config: &GameConfig, script_runner: &ScriptRunner<OverlordEvent, OverlordState>, bundle_id: BundleId, ) -> Vec<BundleElement>

Source

pub fn calculate_item_power( &self, item: Item, game_config: &GameConfig, script_runner: &ScriptRunner<OverlordEvent, OverlordState>, ) -> Result<i64>

Source

pub fn get_active_fight_player(&self) -> Option<&Entity>

Source

pub fn get_active_fight_player_mut(&mut self) -> Option<&mut Entity>

Trait Implementations§

Source§

impl AsyncEventHandler<OverlordEvent, OverlordState> for OverlordAsyncEventHandler

Source§

fn handle_event( &mut self, event: &OverlordEvent, state: OverlordState, rand_gen: StdRng, current_tick: u64, ) -> EventHandleResult<OverlordEvent, OverlordState>

Source§

fn compute_fields( &self, state: &mut OverlordState, prev_state: &OverlordState, ) -> Vec<OverlordEvent>

Can be used to compute fields that arent stored in database, but computed from stored data. Also can emit events on some logical data changes. This events eventually can change state.
Source§

impl Clone for OverlordState

Source§

fn clone(&self) -> OverlordState

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl CustomType for OverlordState

Source§

fn build(builder: TypeBuilder<'_, Self>)

Builds the custom type for use with the [Engine]. Read more
Source§

impl Debug for OverlordState

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for OverlordState

Source§

fn default() -> OverlordState

Returns the “default value” for a type. Read more
Source§

impl<'de> Deserialize<'de> for OverlordState

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl From<OverlordState> for JsValue

Source§

fn from(value: OverlordState) -> Self

Converts to this type from the input type.
Source§

impl IntoWasmAbi for OverlordState

Source§

type Abi = <JsType as IntoWasmAbi>::Abi

The Wasm ABI type that this converts into when crossing the ABI boundary.
Source§

fn into_abi(self) -> Self::Abi

Convert self into Self::Abi so that it can be sent across the wasm ABI boundary.
Source§

impl JsonSchema for OverlordState

Source§

fn schema_name() -> String

The name of the generated JSON Schema. Read more
Source§

fn schema_id() -> Cow<'static, str>

Returns a string that uniquely identifies the schema produced by this type. Read more
Source§

fn json_schema(generator: &mut SchemaGenerator) -> Schema

Generates a JSON Schema for this type. Read more
§

fn is_referenceable() -> bool

Whether JSON Schemas generated for this type should be re-used where possible using the $ref keyword. Read more
Source§

impl OptionIntoWasmAbi for OverlordState

Source§

fn none() -> Self::Abi

Returns an ABI instance indicating “none”, which JS will interpret as the None branch of this option. Read more
Source§

impl PartialEq for OverlordState

Source§

fn eq(&self, other: &OverlordState) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Serialize for OverlordState

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl State for OverlordState

Source§

fn cmp_db_updated(&self, db_updated: &Self) -> bool

Compares version from database with local

Source§

fn register_rhai_type(engine: &mut Engine)

Source§

fn is_ticker_paused(&self) -> bool

Source§

impl SyncEventHandler<OverlordEvent, OverlordState> for NoopSyncEventHandler

Source§

type Context = ()

Source§

fn handles_event(&self, _event: &OverlordEvent) -> bool

Returns true if this event should be handled by the sync handler (requires DB context).
Source§

async fn create_context_for_batch( &self, _state: &OverlordState, ) -> Result<Self::Context>

Source§

async fn handle_event( &self, _context: &Self::Context, _event: &OverlordEvent, _meta: SyncEventMeta, state: OverlordState, ) -> Result<EventHandleResult<OverlordEvent, OverlordState>>

Source§

async fn handle_side_effect_event( &self, _context: &Self::Context, _event: &OverlordEvent, _output_events: &[OverlordEvent], _new_state: &OverlordState, ) -> Result<()>

Source§

async fn finalize_state( &self, _context: &Self::Context, _state: &mut OverlordState, ) -> Result<()>

Source§

async fn persist_in_memory_state( &self, _context: &Self::Context, _state: &OverlordState, ) -> Result<()>

Persist in-memory state to DB context before commit. Called by flush_state to save changes accumulated without DB context (e.g. fight ticks).
Source§

impl Tsify for OverlordState

Source§

const DECL: &'static str = "export interface OverlordState {\n character_state: CharacterState;\n blocked_character_ids: Uuid[];\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}"

Source§

const SERIALIZATION_CONFIG: SerializationConfig

Source§

type JsType = JsType

§

fn into_js(&self) -> Result<Self::JsType, Error>
where Self: Serialize,

§

fn from_js<T>(js: T) -> Result<Self, Error>
where T: Into<JsValue>, Self: DeserializeOwned,

Source§

impl VectorIntoWasmAbi for OverlordState

Source§

type Abi = <JsType as VectorIntoWasmAbi>::Abi

Source§

fn vector_into_abi(vector: Box<[Self]>) -> Self::Abi

Source§

impl WasmDescribe for OverlordState

Source§

impl WasmDescribeVector for OverlordState

Source§

impl Eq for OverlordState

Source§

impl StructuralPartialEq for OverlordState

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> FutureExt for T

§

fn with_context(self, otel_cx: Context) -> WithContext<Self>

Attaches the provided Context to this type, returning a WithContext wrapper. Read more
§

fn with_current_context(self) -> WithContext<Self>

Attaches the current Context to this type, returning a WithContext wrapper. Read more
§

impl<T> FutureExt for T

§

fn with_context(self, otel_cx: Context) -> WithContext<Self>

Attaches the provided Context to this type, returning a WithContext wrapper. Read more
§

fn with_current_context(self) -> WithContext<Self>

Attaches the current Context to this type, returning a WithContext wrapper. Read more
§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

§

impl<T> IntoRequest<T> for T

§

fn into_request(self) -> Request<T>

Wrap the input message T in a tonic::Request
§

impl<L> LayerExt<L> for L

§

fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>
where L: Layer<S>,

Applies the layer to a service and wraps it in [Layered].
§

impl<T> PolicyExt for T
where T: ?Sized,

§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] only if self and other return Action::Follow. Read more
§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] if either self or other returns Action::Follow. Read more
Source§

impl<T> ReturnWasmAbi for T
where T: IntoWasmAbi,

Source§

type Abi = <T as IntoWasmAbi>::Abi

Same as IntoWasmAbi::Abi
Source§

fn return_abi(self) -> <T as ReturnWasmAbi>::Abi

Same as IntoWasmAbi::into_abi, except that it may throw and never return in the case of Err.
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> Serialize for T
where T: Serialize + ?Sized,

Source§

fn erased_serialize(&self, serializer: &mut dyn Serializer) -> Result<(), Error>

Source§

fn do_erased_serialize( &self, serializer: &mut dyn Serializer, ) -> Result<(), ErrorImpl>

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<S, T> Upcast<T> for S
where T: UpcastFrom<S> + ?Sized, S: ?Sized,

Source§

fn upcast(&self) -> &T
where Self: ErasableGeneric, T: ErasableGeneric<Repr = Self::Repr>,

Perform a zero-cost type-safe upcast to a wider ref type within the Wasm bindgen generics type system. Read more
Source§

fn upcast_into(self) -> T
where Self: Sized + ErasableGeneric, T: ErasableGeneric<Repr = Self::Repr>,

Perform a zero-cost type-safe upcast to a wider type within the Wasm bindgen generics type system. Read more
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

impl<T> Allocation for T
where T: RefUnwindSafe + Send + Sync,

Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,