Struct OverlordAsyncEventHandler

Source
pub struct OverlordAsyncEventHandler { /* private fields */ }

Implementations§

Source§

impl OverlordAsyncEventHandler

Source

pub fn handle_equip_ability( &self, slot_id: u64, ability_id: AbilityId, current_tick: u64, state: OverlordState, ) -> EventHandleResult<OverlordEvent, OverlordState>

Source

pub fn handle_unequip_ability( &self, slot_id: AbilitySlotId, state: OverlordState, ) -> EventHandleResult<OverlordEvent, OverlordState>

Source

pub fn handle_equip_abilities( &self, equipped_abilities: EquippedAbilities, current_tick: u64, state: OverlordState, ) -> EventHandleResult<OverlordEvent, OverlordState>

Source

pub fn make_cast_effect_action( &self, entity_id: EntityId, effect_id: EffectId, ) -> EntityAction

Source

pub fn make_start_cast_ability_action( &self, by_entity_id: EntityId, ability_id: AbilityId, ) -> EntityAction

Source§

impl OverlordAsyncEventHandler

Source§

impl OverlordAsyncEventHandler

Source§

impl OverlordAsyncEventHandler

Source

pub fn is_battle_active(&self, state: &OverlordState) -> bool

Source

pub fn handle_prepare_fight( &mut self, prepare_fight_type: PrepareFightType, rand_gen: StdRng, state: OverlordState, ) -> EventHandleResult<OverlordEvent, OverlordState>

Source

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

Source

pub fn get_prepare_fight_delay( &self, is_win: bool, chapter: &Chapter, state: &OverlordState, ) -> u64

Source

pub fn get_end_fight_delay(&self, fight_id: FightTemplateId) -> u64

Source

pub fn handle_afk_rewards_gating_unlocked( &self, state: OverlordState, ) -> EventHandleResult<OverlordEvent, OverlordState>

Source

pub fn handle_end_fight( &self, fight_id: Uuid, is_win: bool, pvp_state: &Option<PVPState>, state: OverlordState, ) -> EventHandleResult<OverlordEvent, OverlordState>

Source§

impl OverlordAsyncEventHandler

Source

pub fn handle_run_cheat( &mut self, cheat: &Cheat, current_tick: u64, rand_gen: StdRng, state: OverlordState, ) -> EventHandleResult<OverlordEvent, OverlordState>

Source§

impl OverlordAsyncEventHandler

Source

pub fn handle_spawn_entity( &self, id: EntityId, entity_template_id: EntityTemplateId, position: Coordinates, team: EntityTeam, has_big_hp_bar: bool, entity_attributes: EntityAttributes, current_tick: u64, state: OverlordState, ) -> EventHandleResult<OverlordEvent, OverlordState>

Source

pub fn handle_start_move( &self, entity_id: Uuid, to: Coordinates, duration_ticks: u64, state: OverlordState, ) -> EventHandleResult<OverlordEvent, OverlordState>

Source

pub fn handle_end_move( &self, entity_id: Uuid, state: OverlordState, ) -> EventHandleResult<OverlordEvent, OverlordState>

Source

pub fn handle_entity_incr_attribute( &mut self, entity_id: Uuid, attribute: &str, delta: i64, state: OverlordState, ) -> EventHandleResult<OverlordEvent, OverlordState>

Source

pub fn handle_entity_apply_effect( &mut self, entity_id: Uuid, effect_id: Uuid, current_tick: u64, state: OverlordState, ) -> EventHandleResult<OverlordEvent, OverlordState>

Source

pub fn handle_cast_effect( &mut self, entity_id: Uuid, effect_id: Uuid, caller_event: Option<Box<OverlordEvent>>, rand_gen: StdRng, current_tick: u64, state: OverlordState, ) -> EventHandleResult<OverlordEvent, OverlordState>

Source

pub fn handle_start_cast_ability( &mut self, event: OverlordEvent, by_entity_id: Uuid, ability_id: AbilityId, rand_gen: StdRng, current_tick: u64, state: OverlordState, ) -> EventHandleResult<OverlordEvent, OverlordState>

Source

pub fn handle_cast_ability( &mut self, event: OverlordEvent, by_entity_id: Uuid, to_entity_id: Uuid, ability_id: AbilityId, rand_gen: StdRng, current_tick: u64, state: OverlordState, ) -> EventHandleResult<OverlordEvent, OverlordState>

Source

pub fn handle_start_cast_projectile( &mut self, event: OverlordEvent, by_entity_id: Uuid, to_entity_id: Uuid, projectile_id: Uuid, level: i64, current_tick: u64, state: OverlordState, ) -> EventHandleResult<OverlordEvent, OverlordState>

Source

pub fn handle_cast_projectile( &mut self, event: OverlordEvent, by_entity_id: Uuid, to_entity_id: Uuid, projectile_id: Uuid, level: i64, projectile_data: &CustomEventData, rand_gen: StdRng, current_tick: u64, state: OverlordState, ) -> EventHandleResult<OverlordEvent, OverlordState>

Source

pub fn handle_player_death( &self, state: OverlordState, ) -> EventHandleResult<OverlordEvent, OverlordState>

Source

pub fn handle_entity_death( &self, entity_id: Uuid, reward: Vec<CurrencyUnit>, rand_gen: StdRng, state: OverlordState, ) -> EventHandleResult<OverlordEvent, OverlordState>

Source

pub fn handle_heal( &self, entity_id: Uuid, heal: u64, state: OverlordState, ) -> EventHandleResult<OverlordEvent, OverlordState>

Source

pub fn handle_damage( &self, entity_id: Uuid, damage: u64, current_tick: u64, rand_gen: StdRng, state: OverlordState, ) -> EventHandleResult<OverlordEvent, OverlordState>

Source

pub fn handle_fight_progress( &self, current_tick: u64, state: OverlordState, ) -> EventHandleResult<OverlordEvent, OverlordState>

Source

pub fn handle_set_max_hp( &mut self, entity_id: EntityId, new_max_hp: u64, new_hp: u64, state: OverlordState, ) -> EventHandleResult<OverlordEvent, OverlordState>

Source§

impl OverlordAsyncEventHandler

Source§

impl OverlordAsyncEventHandler

Source

pub fn new(game_config: SharedGameConfig, frontend: bool) -> Self

Source§

impl OverlordAsyncEventHandler

Source

pub fn compute_character_level( &self, state: &mut OverlordState, ) -> Vec<OverlordEvent>

Source

pub fn get_quest_progress( &self, character_state: &CharacterState, active_fight: &Option<ActiveFight>, quest: &QuestInstance, script: &str, trigger_event: OverlordEvent, ) -> Result<i64>

Source

pub fn currency_increase( currencies: &[CurrencyUnit], currency_source: CurrencySource, ) -> EventPluginized<OverlordEvent, OverlordState>

Creates a CurrencyIncrease event. The actual state mutation happens when the event is processed by the handler — callers don’t need to mutate state manually.

Source

pub fn currency_decrease( state: &OverlordState, currencies: &[CurrencyUnit], currency_consumer: CurrencyConsumer, ) -> Option<EventPluginized<OverlordEvent, OverlordState>>

Creates a CurrencyDecrease event after validating sufficient balance. Returns None if the player doesn’t have enough currency. The actual state mutation happens when the event is processed by the handler.

Source

pub fn process_currency( &self, raw_item: &BundleRawStep, script_runner: &ScriptRunner<OverlordEvent, OverlordState>, ) -> BundleElement

Source

pub fn process_ability( &self, raw_item: &BundleRawStep, script_runner: &ScriptRunner<OverlordEvent, OverlordState>, config: &GameConfig, ) -> BundleElement

Source

pub fn process_item( &self, raw_item: &BundleRawStep, character_level: i64, script_runner: &ScriptRunner<OverlordEvent, OverlordState>, config: &GameConfig, ) -> Result<BundleElement>

Source§

impl OverlordAsyncEventHandler

Source§

impl OverlordAsyncEventHandler

Source§

impl OverlordAsyncEventHandler

Source

pub fn handle_equip_pet( &self, slot_id: u64, pet_id: PetId, current_tick: u64, state: OverlordState, ) -> EventHandleResult<OverlordEvent, OverlordState>

Source

pub fn build_pet_combat_state( &self, state: &OverlordState, ) -> (Option<ActivePetAbility>, Option<PetId>)

Source

pub fn handle_unequip_pet( &self, slot_id: PetSlotId, current_tick: u64, state: OverlordState, ) -> EventHandleResult<OverlordEvent, OverlordState>

Source

pub fn handle_equip_pets( &self, equipped_pets: EquippedPets, current_tick: u64, state: OverlordState, ) -> EventHandleResult<OverlordEvent, OverlordState>

Source§

impl OverlordAsyncEventHandler

Source§

impl OverlordAsyncEventHandler

Source§

impl OverlordAsyncEventHandler

Source

pub fn handle_claim_talent_research( &self, state: OverlordState, ) -> EventHandleResult<OverlordEvent, OverlordState>

Apply completed talent: increment level and clear upgrade timer fields.

Source§

impl OverlordAsyncEventHandler

Source

pub fn handle_new_task( &self, new_task: VassalTask, state: OverlordState, ) -> EventHandleResult<OverlordEvent, OverlordState>

Source

pub fn handle_give_resist_task( &self, new_task: VassalTask, state: OverlordState, ) -> EventHandleResult<OverlordEvent, OverlordState>

Source

pub fn handle_accept_task( &self, task_id: Uuid, is_good: bool, state: OverlordState, ) -> EventHandleResult<OverlordEvent, OverlordState>

Source

pub fn handle_task_accepted( &self, task_id: Uuid, started_good: bool, started_at: DateTime<Utc>, finish_at: DateTime<Utc>, state: OverlordState, ) -> EventHandleResult<OverlordEvent, OverlordState>

Source

pub fn handle_resist_task_accepted( &self, resist_task: VassalTask, state: OverlordState, ) -> EventHandleResult<OverlordEvent, OverlordState>

Source

pub fn handle_hit_hands( &self, task_id: Uuid, state: OverlordState, ) -> EventHandleResult<OverlordEvent, OverlordState>

Source

pub fn handle_catch_resist_task( &self, task_id: Uuid, state: OverlordState, ) -> EventHandleResult<OverlordEvent, OverlordState>

Source

pub fn handle_hands_hitted( &self, task_id: Uuid, state: OverlordState, ) -> EventHandleResult<OverlordEvent, OverlordState>

Source

pub fn handle_resist_task_catched( &self, task_id: Uuid, state: OverlordState, ) -> EventHandleResult<OverlordEvent, OverlordState>

Source

pub fn handle_finish_task( &self, task_id: Uuid, state: OverlordState, ) -> EventHandleResult<OverlordEvent, OverlordState>

Source

pub fn handle_resist_task_finished( &self, task_id: Uuid, state: OverlordState, ) -> EventHandleResult<OverlordEvent, OverlordState>

Source

pub fn handle_claim_task_reward( &self, task_id: Uuid, state: OverlordState, ) -> EventHandleResult<OverlordEvent, OverlordState>

Source

pub fn handle_claim_resist_task_reward( &self, task_id: Uuid, state: OverlordState, ) -> EventHandleResult<OverlordEvent, OverlordState>

Source

pub fn handle_new_suzerain( &self, new_suzerain: Option<Suzerain>, state: OverlordState, ) -> EventHandleResult<OverlordEvent, OverlordState>

Source

pub fn handle_remove_vassal( &self, vassal_id: Uuid, state: OverlordState, ) -> EventHandleResult<OverlordEvent, OverlordState>

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 Debug for OverlordAsyncEventHandler

Source§

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

Formats the value using the given formatter. Read more

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> 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> Same for T

Source§

type Output = T

Should always be Self
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