pub struct Quest {Show 16 fields
pub id: QuestId,
pub name: String,
pub description: String,
pub giver_id: Option<u64>,
pub state: QuestState,
pub objectives: Vec<QuestObjective>,
pub reward: QuestReward,
pub level_requirement: u32,
pub chain_id: Option<u64>,
pub chain_position: u32,
pub time_limit_secs: Option<f32>,
pub time_elapsed: f32,
pub repeatable: bool,
pub times_completed: u32,
pub category: QuestCategory,
pub priority: QuestPriority,
}Fields§
§id: QuestId§name: String§description: String§giver_id: Option<u64>§state: QuestState§objectives: Vec<QuestObjective>§reward: QuestReward§level_requirement: u32§chain_id: Option<u64>§chain_position: u32§time_limit_secs: Option<f32>§time_elapsed: f32§repeatable: bool§times_completed: u32§category: QuestCategory§priority: QuestPriorityImplementations§
Source§impl Quest
impl Quest
pub fn new(id: QuestId, name: impl Into<String>, reward: QuestReward) -> Self
pub fn with_description(self, desc: impl Into<String>) -> Self
pub fn with_giver(self, npc_id: u64) -> Self
pub fn add_objective(self, obj: QuestObjective) -> Self
pub fn with_level_req(self, level: u32) -> Self
pub fn with_time_limit(self, secs: f32) -> Self
pub fn repeatable(self) -> Self
pub fn with_category(self, cat: QuestCategory) -> Self
pub fn with_priority(self, p: QuestPriority) -> Self
pub fn activate(&mut self)
pub fn all_objectives_complete(&self) -> bool
pub fn tick(&mut self, dt: f32) -> bool
pub fn time_remaining(&self) -> Option<f32>
pub fn update_objective(&mut self, obj_idx: usize, delta: u32) -> bool
pub fn is_active(&self) -> bool
pub fn is_done(&self) -> bool
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Quest
impl RefUnwindSafe for Quest
impl Send for Quest
impl Sync for Quest
impl Unpin for Quest
impl UnsafeUnpin for Quest
impl UnwindSafe for Quest
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.