diff options
Diffstat (limited to 'src/statistics')
| -rw-r--r-- | src/statistics/boon.rs | 16 | ||||
| -rw-r--r-- | src/statistics/damage.rs | 4 | ||||
| -rw-r--r-- | src/statistics/gamedata.rs | 16 | ||||
| -rw-r--r-- | src/statistics/trackers.rs | 4 | 
4 files changed, 24 insertions, 16 deletions
| diff --git a/src/statistics/boon.rs b/src/statistics/boon.rs index 0aa5ab2..196bd1d 100644 --- a/src/statistics/boon.rs +++ b/src/statistics/boon.rs @@ -161,6 +161,14 @@ impl BoonQueue {          self.backlog = 0;      } +    /// Cleanse a single stack +    pub fn drop_single(&mut self) { +        if self.is_empty() { +            return; +        } +        self.queue.pop(); +    } +      /// Checks if any stacks are left.      pub fn is_empty(&self) -> bool {          self.queue.is_empty() @@ -247,7 +255,7 @@ impl Mul<u64> for Stacks {  #[derive(Clone, Default)]  pub struct BoonLog {      // Keep a separate RecordFunc for each boon. -    inner: FnvHashMap<u16, RecordFunc<u64, (), Stacks>>, +    inner: FnvHashMap<u32, RecordFunc<u64, (), Stacks>>,  }  impl BoonLog { @@ -257,7 +265,7 @@ impl BoonLog {      }      /// Add an event to the boon log. -    pub fn log(&mut self, time: u64, boon_id: u16, stacks: u32) { +    pub fn log(&mut self, time: u64, boon_id: u32, stacks: u32) {          let func = self.inner.entry(boon_id).or_insert_with(Default::default);          let current = func.tally();          if current.0 == stacks as i32 { @@ -272,7 +280,7 @@ impl BoonLog {      /// * `a` - Start time point.      /// * `b` - End time point.      /// * `boon_id` - ID of the boon that you want to get the average for. -    pub fn average_stacks(&self, a: u64, b: u64, boon_id: u16) -> f32 { +    pub fn average_stacks(&self, a: u64, b: u64, boon_id: u32) -> f32 {          assert!(b >= a, "timespan is negative?!");          let func = if let Some(f) = self.inner.get(&boon_id) {              f @@ -287,7 +295,7 @@ impl BoonLog {      ///      /// * `x` - Time point.      /// * `boon_id` - ID of the boon that you want to get. -    pub fn stacks_at(&self, x: u64, boon_id: u16) -> u32 { +    pub fn stacks_at(&self, x: u64, boon_id: u32) -> u32 {          self.inner              .get(&boon_id)              .map(|f| f.get(&x)) diff --git a/src/statistics/damage.rs b/src/statistics/damage.rs index 0fcbf9b..0c26a9b 100644 --- a/src/statistics/damage.rs +++ b/src/statistics/damage.rs @@ -14,7 +14,7 @@ pub struct Meta {      pub source: u64,      pub target: u64,      pub kind: DamageType, -    pub skill: u16, +    pub skill: u32,  }  /// A small wrapper that wraps a damage number. @@ -54,7 +54,7 @@ impl DamageLog {          source: u64,          target: u64,          kind: DamageType, -        skill: u16, +        skill: u32,          value: u64,      ) {          self.inner.insert( diff --git a/src/statistics/gamedata.rs b/src/statistics/gamedata.rs index 6f370d0..faa8cb3 100644 --- a/src/statistics/gamedata.rs +++ b/src/statistics/gamedata.rs @@ -35,7 +35,7 @@ pub const XERA_PHASE2_ID: u16 = 0x3F9E;  /// * maximum number of stacks  /// * boon type (intensity or duration)  #[derive(Debug, Clone, PartialEq, Eq)] -pub struct Boon(pub u16, pub &'static str, pub u32, pub BoonType); +pub struct Boon(pub u32, pub &'static str, pub u32, pub BoonType);  impl Boon {      pub fn create_queue(&self) -> BoonQueue { @@ -83,7 +83,7 @@ pub static BOONS: &[Boon] = &[      Boon(738, "Vulnerability", 25, BoonType::Intensity),  ]; -pub fn get_boon(boon_id: u16) -> Option<&'static Boon> { +pub fn get_boon(boon_id: u32) -> Option<&'static Boon> {      BOONS.iter().find(|b| b.0 == boon_id)  } @@ -91,19 +91,19 @@ pub fn get_boon(boon_id: u16) -> Option<&'static Boon> {  #[derive(Debug, Clone, PartialEq, Eq, Hash)]  pub enum Trigger {      /// Triggers when the given boon is applied to the player. -    BoonPlayer(u16), +    BoonPlayer(u32),      /// Triggers when the given boon is applied to the boss. -    BoonBoss(u16), +    BoonBoss(u32),      /// Triggers when the given skill is used by a player. -    SkillByPlayer(u16), +    SkillByPlayer(u32),      /// Triggers when the given skill is used on a player. -    SkillOnPlayer(u16), +    SkillOnPlayer(u32),      /// Triggers when the given boon is stripped from an enemy. -    BoonStripped(u16), +    BoonStripped(u32),      /// Triggers when the given entity spawned.      Spawn(u16),      /// Triggers when the boss finishes channeling the given skill. -    ChannelComplete(u16), +    ChannelComplete(u32),  }  /// Struct describing a boss mechanic. diff --git a/src/statistics/trackers.rs b/src/statistics/trackers.rs index 66a7bf8..98915d2 100644 --- a/src/statistics/trackers.rs +++ b/src/statistics/trackers.rs @@ -230,7 +230,7 @@ impl Tracker for CombatTimeTracker {  /// boons defined in `evtclib::statistics::gamedata::BOONS`.  pub struct BoonTracker {      boon_logs: FnvHashMap<u64, BoonLog>, -    boon_queues: FnvHashMap<u64, FnvHashMap<u16, BoonQueue>>, +    boon_queues: FnvHashMap<u64, FnvHashMap<u32, BoonQueue>>,      last_time: u64,  } @@ -284,7 +284,7 @@ impl BoonTracker {      ///      /// * `agent_addr` - The address of the agent.      /// * `buff_id` - The buff (or condition) id. -    fn get_queue(&mut self, agent_addr: u64, buff_id: u16) -> Option<&mut BoonQueue> { +    fn get_queue(&mut self, agent_addr: u64, buff_id: u32) -> Option<&mut BoonQueue> {          use std::collections::hash_map::Entry;          let entry = self              .boon_queues | 
