Struct ScriptRunner

Source
pub struct ScriptRunner<E: Event + EventRhaiEnum, S: State> { /* private fields */ }

Implementations§

Source§

impl<E: Event + EventRhaiEnum, S: State> ScriptRunner<E, S>

Source

pub fn new(game_config: &GameConfig) -> Self

Source

pub fn compile_script_public(&self, script: &str) -> Result<AST>

Source

pub fn build_type<T: CustomType>(&mut self)

Source

pub fn register_module(&mut self, name: &str, script: &str)

Source

pub fn run_test( &mut self, scope_setter: impl FnOnce(ScriptScope<'_, E>) -> ScriptScope<'_, E>, script: &str, ) -> Vec<ScriptTestReport>

Source

pub fn run_event( &self, scope_setter: impl FnOnce(ScriptScope<'_, E>) -> ScriptScope<'_, E>, state: &S, script: &str, ) -> Result<Vec<E>, Box<dyn Error>>

Run a script and get resulting events

Source

pub fn run_conditional_progress( &self, scope_setter: impl FnOnce(ScriptScope<'_, E>) -> ScriptScope<'_, E>, script: &str, ) -> ConditionalProgress

Source

pub fn run_currencies_calculate( &self, scope_setter: impl FnOnce(ScriptScope<'_, E>) -> ScriptScope<'_, E>, script: &str, ) -> Vec<ESCurrencyUnit>

Source

pub fn run_ability_shards_calculate( &self, scope_setter: impl FnOnce(ScriptScope<'_, E>) -> ScriptScope<'_, E>, script: &str, ) -> Vec<AbilityShard>

Source

pub fn run_description_values_calculate( &self, scope_setter: impl FnOnce(ScriptScope<'_, E>) -> ScriptScope<'_, E>, script: &str, ability_level: i64, ) -> Vec<f64>

Source

pub fn run_talent_description_values_calculate( &self, scope_setter: impl FnOnce(ScriptScope<'_, E>) -> ScriptScope<'_, E>, script: &str, talent_level: i64, ) -> Vec<f64>

Source

pub fn run_abilities_ids_script( &self, scope_setter: impl FnOnce(ScriptScope<'_, E>) -> ScriptScope<'_, E>, script: &str, ) -> Vec<Uuid>

Source

pub fn run_item_ids_script( &self, scope_setter: impl FnOnce(ScriptScope<'_, E>) -> ScriptScope<'_, E>, script: &str, ) -> Vec<Uuid>

Source

pub fn run_start_cast_ability( &self, scope_setter: impl FnOnce(ScriptScope<'_, E>) -> ScriptScope<'_, E>, state: S, script: &str, ) -> Result<Vec<StartCastAbilityResult>>

Source

pub fn run_start_cast_projectile( &self, scope_setter: impl FnOnce(ScriptScope<'_, E>) -> ScriptScope<'_, E>, script: &str, ) -> Result<StartCastProjectileResult>

Source

pub fn run_expression<T: Clone + Send + Sync + 'static>( &self, scope_setter: impl FnOnce(ScriptScope<'_, E>) -> ScriptScope<'_, E>, script: &str, ) -> Result<T>

Source

pub fn run_party_power_adjust( &self, player_character_state: &CharacterState, party_character_state: &CharacterState, script: &str, ) -> Result<i64>

Source

pub fn calculate_character_power( &self, character_state: &CharacterState, game_config: &GameConfig, ) -> Result<i64>

Source

pub fn calculate_bot_power( &self, bot: &Bot, game_config: &GameConfig, ) -> Result<i64>

Source

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

Source

pub fn generate_opponent( &self, scope_setter: impl FnOnce(ScriptScope<'_, E>) -> ScriptScope<'_, E>, character_state: &CharacterState, expected_rating: i64, script: &str, ) -> Result<OpponentGenerationResult>

Source

pub fn generate_test_player( &self, character_state: &CharacterState, script: &str, ) -> Result<TestPlayerResult>

Source

pub fn run_entity_attributes_calculate( &self, scope_setter: impl FnOnce(ScriptScope<'_, E>) -> ScriptScope<'_, E>, script: &str, ) -> AttributeDeltas

Source

pub fn try_get_item_template_id( &self, character_state: &CharacterState, game_config: &GameConfig, ) -> Result<Option<Uuid>>

Trait Implementations§

Source§

impl<E: Debug + Event + EventRhaiEnum, S: Debug + State> Debug for ScriptRunner<E, S>

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<E, S> !Freeze for ScriptRunner<E, S>

§

impl<E, S> !RefUnwindSafe for ScriptRunner<E, S>

§

impl<E, S> Send for ScriptRunner<E, S>

§

impl<E, S> Sync for ScriptRunner<E, S>

§

impl<E, S> Unpin for ScriptRunner<E, S>
where E: Unpin, S: Unpin,

§

impl<E, S> !UnwindSafe for ScriptRunner<E, S>

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