diff --git a/.gitignore b/.gitignore index 0088860804..cff5f6b410 100644 --- a/.gitignore +++ b/.gitignore @@ -5,6 +5,7 @@ target **/*.vi **/*.swp +**/*tags # IntelliJ diff --git a/common/net/src/msg/ecs_packet.rs b/common/net/src/msg/ecs_packet.rs index 7066667fbe..3828b11247 100644 --- a/common/net/src/msg/ecs_packet.rs +++ b/common/net/src/msg/ecs_packet.rs @@ -14,6 +14,7 @@ sum_type! { Player(comp::Player), CanBuild(comp::CanBuild), Stats(comp::Stats), + SkillSet(comp::SkillSet), Buffs(comp::Buffs), Auras(comp::Auras), Energy(comp::Energy), @@ -48,6 +49,7 @@ sum_type! { Player(PhantomData), CanBuild(PhantomData), Stats(PhantomData), + SkillSet(PhantomData), Buffs(PhantomData), Auras(PhantomData), Energy(PhantomData), @@ -82,6 +84,7 @@ impl sync::CompPacket for EcsCompPacket { EcsCompPacket::Player(comp) => sync::handle_insert(comp, entity, world), EcsCompPacket::CanBuild(comp) => sync::handle_insert(comp, entity, world), EcsCompPacket::Stats(comp) => sync::handle_insert(comp, entity, world), + EcsCompPacket::SkillSet(comp) => sync::handle_insert(comp, entity, world), EcsCompPacket::Buffs(comp) => sync::handle_insert(comp, entity, world), EcsCompPacket::Auras(comp) => sync::handle_insert(comp, entity, world), EcsCompPacket::Energy(comp) => sync::handle_insert(comp, entity, world), @@ -120,6 +123,7 @@ impl sync::CompPacket for EcsCompPacket { EcsCompPacket::Player(comp) => sync::handle_modify(comp, entity, world), EcsCompPacket::CanBuild(comp) => sync::handle_modify(comp, entity, world), EcsCompPacket::Stats(comp) => sync::handle_modify(comp, entity, world), + EcsCompPacket::SkillSet(comp) => sync::handle_modify(comp, entity, world), EcsCompPacket::Buffs(comp) => sync::handle_modify(comp, entity, world), EcsCompPacket::Auras(comp) => sync::handle_modify(comp, entity, world), EcsCompPacket::Energy(comp) => sync::handle_modify(comp, entity, world), @@ -158,6 +162,7 @@ impl sync::CompPacket for EcsCompPacket { EcsCompPhantom::Player(_) => sync::handle_remove::(entity, world), EcsCompPhantom::CanBuild(_) => sync::handle_remove::(entity, world), EcsCompPhantom::Stats(_) => sync::handle_remove::(entity, world), + EcsCompPhantom::SkillSet(_) => sync::handle_remove::(entity, world), EcsCompPhantom::Buffs(_) => sync::handle_remove::(entity, world), EcsCompPhantom::Auras(_) => sync::handle_remove::(entity, world), EcsCompPhantom::Energy(_) => sync::handle_remove::(entity, world), diff --git a/common/src/combat.rs b/common/src/combat.rs index 60fda60eb7..6486a40a47 100644 --- a/common/src/combat.rs +++ b/common/src/combat.rs @@ -13,7 +13,7 @@ use crate::{ poise::PoiseChange, skills::SkillGroupKind, Body, Combo, Energy, EnergyChange, EnergySource, Health, HealthChange, HealthSource, - Inventory, Stats, + Inventory, SkillSet, Stats, }, event::ServerEvent, outcome::Outcome, @@ -742,15 +742,15 @@ pub fn weapon_rating(item: &T, msm: &MaterialStatManifest) -> f32 { } } -fn weapon_skills(inventory: &Inventory, stats: &Stats) -> f32 { +fn weapon_skills(inventory: &Inventory, skill_set: &SkillSet) -> f32 { let (mainhand, offhand) = get_weapons(inventory); let mainhand_skills = if let Some(tool) = mainhand { - stats.skill_set.earned_sp(SkillGroupKind::Weapon(tool)) as f32 + skill_set.earned_sp(SkillGroupKind::Weapon(tool)) as f32 } else { 0.0 }; let offhand_skills = if let Some(tool) = offhand { - stats.skill_set.earned_sp(SkillGroupKind::Weapon(tool)) as f32 + skill_set.earned_sp(SkillGroupKind::Weapon(tool)) as f32 } else { 0.0 }; @@ -779,7 +779,7 @@ fn get_weapon_rating(inventory: &Inventory, msm: &MaterialStatManifest) -> f32 { pub fn combat_rating( inventory: &Inventory, health: &Health, - stats: &Stats, + skill_set: &SkillSet, body: Body, msm: &MaterialStatManifest, ) -> f32 { @@ -793,8 +793,8 @@ pub fn combat_rating( // Assumes a standard person has earned 20 skill points in the general skill // tree and 10 skill points for the weapon skill tree - let skills_rating = (stats.skill_set.earned_sp(SkillGroupKind::General) as f32 / 20.0 - + weapon_skills(inventory, stats) / 10.0) + let skills_rating = (skill_set.earned_sp(SkillGroupKind::General) as f32 / 20.0 + + weapon_skills(inventory, skill_set) / 10.0) / 2.0; let weapon_rating = get_weapon_rating(inventory, msm); diff --git a/common/src/comp/skills.rs b/common/src/comp/skills.rs index 7582fddf3a..98ce6469bd 100644 --- a/common/src/comp/skills.rs +++ b/common/src/comp/skills.rs @@ -5,6 +5,8 @@ use crate::{ use hashbrown::{HashMap, HashSet}; use lazy_static::lazy_static; use serde::{Deserialize, Serialize}; +use specs::{Component, DerefFlaggedStorage}; +use specs_idvs::IdvStorage; use std::hash::Hash; use tracing::{trace, warn}; @@ -334,6 +336,10 @@ pub struct SkillSet { pub modify_energy: bool, } +impl Component for SkillSet { + type Storage = DerefFlaggedStorage>; +} + impl Default for SkillSet { /// Instantiate a new skill set with the default skill groups with no /// unlocked skills in them - used when adding a skill set to a new diff --git a/common/src/comp/stats.rs b/common/src/comp/stats.rs index 84893fe7ee..55a49ae343 100644 --- a/common/src/comp/stats.rs +++ b/common/src/comp/stats.rs @@ -1,4 +1,3 @@ -use crate::comp::skills::SkillSet; use serde::{Deserialize, Serialize}; use specs::{Component, DerefFlaggedStorage}; use specs_idvs::IdvStorage; @@ -24,9 +23,6 @@ impl Error for StatChangeError {} #[derive(Clone, Debug, Serialize, Deserialize)] pub struct Stats { pub name: String, - // TODO: Make skillset a separate component, probably too heavy for something that will - // potentially be updated every tick (especially as more buffs are added) - pub skill_set: SkillSet, pub damage_reduction: f32, pub max_health_modifier: f32, } @@ -35,7 +31,6 @@ impl Stats { pub fn new(name: String) -> Self { Self { name, - skill_set: SkillSet::default(), damage_reduction: 0.0, max_health_modifier: 1.0, } @@ -46,7 +41,6 @@ impl Stats { pub fn empty() -> Self { Self { name: "".to_owned(), - skill_set: SkillSet::default(), damage_reduction: 0.0, max_health_modifier: 1.0, } diff --git a/common/src/event.rs b/common/src/event.rs index 20530cab2b..f537e02150 100644 --- a/common/src/event.rs +++ b/common/src/event.rs @@ -104,6 +104,7 @@ pub enum ServerEvent { components: ( comp::Body, comp::Stats, + comp::SkillSet, comp::Inventory, Option, ), @@ -115,6 +116,7 @@ pub enum ServerEvent { CreateNpc { pos: comp::Pos, stats: comp::Stats, + skill_set: comp::SkillSet, health: comp::Health, poise: comp::Poise, loadout: comp::inventory::loadout::Loadout, diff --git a/common/src/states/basic_summon.rs b/common/src/states/basic_summon.rs index 86f3f857fd..7c0a382768 100644 --- a/common/src/states/basic_summon.rs +++ b/common/src/states/basic_summon.rs @@ -86,8 +86,8 @@ impl CharacterBehavior for Data { None, ) .build(); - let mut stats = comp::Stats::new("Summon".to_string()); - stats.skill_set = SkillSetBuilder::build_skillset( + let stats = comp::Stats::new("Summon".to_string()); + let skill_set = SkillSetBuilder::build_skillset( &None, self.static_data.summon_info.skillset_config, ) @@ -97,6 +97,7 @@ impl CharacterBehavior for Data { update.server_events.push_front(ServerEvent::CreateNpc { pos: *data.pos, stats, + skill_set, health: comp::Health::new( body, self.static_data.summon_info.health_scaling, diff --git a/common/src/states/behavior.rs b/common/src/states/behavior.rs index 2c4f4a3ecc..0735b01bad 100644 --- a/common/src/states/behavior.rs +++ b/common/src/states/behavior.rs @@ -2,7 +2,7 @@ use crate::{ comp::{ self, item::MaterialStatManifest, Beam, Body, CharacterState, Combo, ControlAction, Controller, ControllerInputs, Energy, Health, InputAttr, InputKind, Inventory, - InventoryAction, Melee, Ori, PhysicsState, Pos, StateUpdate, Stats, Vel, + InventoryAction, Melee, Ori, PhysicsState, Pos, SkillSet, StateUpdate, Stats, Vel, }, resources::DeltaTime, uid::Uid, @@ -91,6 +91,7 @@ pub struct JoinData<'a> { pub melee_attack: Option<&'a Melee>, pub updater: &'a LazyUpdate, pub stats: &'a Stats, + pub skill_set: &'a SkillSet, pub msm: &'a MaterialStatManifest, pub combo: &'a Combo, pub alignment: Option<&'a comp::Alignment>, @@ -121,6 +122,7 @@ pub struct JoinStruct<'a> { pub melee_attack: Option<&'a Melee>, pub beam: Option<&'a Beam>, pub stat: &'a Stats, + pub skill_set: &'a SkillSet, pub combo: &'a Combo, pub alignment: Option<&'a comp::Alignment>, } @@ -148,6 +150,7 @@ impl<'a> JoinData<'a> { physics: j.physics, melee_attack: j.melee_attack, stats: j.stat, + skill_set: j.skill_set, updater, dt, msm, diff --git a/common/src/states/climb.rs b/common/src/states/climb.rs index ec2ecc717c..4508f01664 100644 --- a/common/src/states/climb.rs +++ b/common/src/states/climb.rs @@ -31,10 +31,10 @@ pub struct Data { impl Data { pub fn create_adjusted_by_skills(join_data: &JoinData) -> Self { let mut data = Data::default(); - if let Ok(Some(level)) = join_data.stats.skill_set.skill_level(Skill::Climb(Cost)) { + if let Ok(Some(level)) = join_data.skill_set.skill_level(Skill::Climb(Cost)) { data.static_data.energy_cost *= 0.8_f32.powi(level.into()); } - if let Ok(Some(level)) = join_data.stats.skill_set.skill_level(Skill::Climb(Speed)) { + if let Ok(Some(level)) = join_data.skill_set.skill_level(Skill::Climb(Speed)) { data.static_data.movement_speed *= 1.2_f32.powi(level.into()); } data diff --git a/common/src/states/utils.rs b/common/src/states/utils.rs index 72d3162524..818fbb53b8 100644 --- a/common/src/states/utils.rs +++ b/common/src/states/utils.rs @@ -302,11 +302,7 @@ pub fn handle_orientation(data: &JoinData, update: &mut StateUpdate, rate: f32) fn swim_move(data: &JoinData, update: &mut StateUpdate, efficiency: f32, depth: f32) { let mut water_accel = BASE_HUMANOID_WATER_ACCEL; let mut water_speed = BASE_HUMANOID_WATER_SPEED; - if let Ok(Some(level)) = data - .stats - .skill_set - .skill_level(Skill::Swim(SwimSkill::Speed)) - { + if let Ok(Some(level)) = data.skill_set.skill_level(Skill::Swim(SwimSkill::Speed)) { water_speed *= 1.4_f32.powi(level.into()); water_accel *= 1.4_f32.powi(level.into()); } @@ -501,8 +497,7 @@ fn handle_ability(data: &JoinData, update: &mut StateUpdate, input: InputKind) { }; let unlocked = |(s, a): (Option, CharacterAbility)| { - s.map_or(true, |s| data.stats.skill_set.has_skill(s)) - .then_some(a) + s.map_or(true, |s| data.skill_set.has_skill(s)).then_some(a) }; if let Some(equip_slot) = equip_slot { @@ -523,7 +518,7 @@ fn handle_ability(data: &JoinData, update: &mut StateUpdate, input: InputKind) { }) .map(|a| { let tool = unwrap_tool_data(data, equip_slot).map(|t| t.kind); - a.adjusted_by_skills(&data.stats.skill_set, tool) + a.adjusted_by_skills(&data.skill_set, tool) }) .filter(|ability| ability.requirements_paid(data, update)) { @@ -570,8 +565,7 @@ pub fn attempt_input(data: &JoinData, update: &mut StateUpdate) { /// attempts to perform their dodge ability pub fn handle_dodge_input(data: &JoinData, update: &mut StateUpdate) { if input_is_pressed(data, InputKind::Roll) && data.body.is_humanoid() { - let ability = - CharacterAbility::default_roll().adjusted_by_skills(&data.stats.skill_set, None); + let ability = CharacterAbility::default_roll().adjusted_by_skills(&data.skill_set, None); if ability.requirements_paid(data, update) { update.character = CharacterState::from(( &ability, diff --git a/common/sys/src/character_behavior.rs b/common/sys/src/character_behavior.rs index d3e8c8c13f..2a16d55dca 100644 --- a/common/sys/src/character_behavior.rs +++ b/common/sys/src/character_behavior.rs @@ -11,7 +11,7 @@ use common::{ slot::{EquipSlot, Slot}, }, Beam, Body, CharacterState, Combo, Controller, Energy, Health, Inventory, Melee, Mounting, - Ori, PhysicsState, Poise, PoiseState, Pos, StateUpdate, Stats, Vel, + Ori, PhysicsState, Poise, PoiseState, Pos, SkillSet, StateUpdate, Stats, Vel, }, event::{EventBus, LocalEvent, ServerEvent}, resources::DeltaTime, @@ -73,6 +73,7 @@ pub struct ReadData<'a> { uids: ReadStorage<'a, Uid>, mountings: ReadStorage<'a, Mounting>, stats: ReadStorage<'a, Stats>, + skill_sets: ReadStorage<'a, SkillSet>, msm: Read<'a, MaterialStatManifest>, combos: ReadStorage<'a, Combo>, alignments: ReadStorage<'a, comp::Alignment>, @@ -134,6 +135,7 @@ impl<'a> System<'a> for Sys { body, physics, stat, + skill_set, combo, ) in ( &read_data.entities, @@ -149,6 +151,7 @@ impl<'a> System<'a> for Sys { &read_data.bodies, &read_data.physics_states, &read_data.stats, + &read_data.skill_sets, &read_data.combos, ) .join() @@ -259,6 +262,7 @@ impl<'a> System<'a> for Sys { melee_attack: read_data.melee_attacks.get(entity), beam: read_data.beams.get(entity), stat: &stat, + skill_set: &skill_set, combo: &combo, alignment: read_data.alignments.get(entity), }; diff --git a/common/sys/src/state.rs b/common/sys/src/state.rs index c30d1046b1..6ab7019f74 100644 --- a/common/sys/src/state.rs +++ b/common/sys/src/state.rs @@ -183,6 +183,7 @@ impl State { ecs.register::(); ecs.register::(); ecs.register::(); + ecs.register::(); ecs.register::(); ecs.register::(); ecs.register::(); diff --git a/common/sys/src/stats.rs b/common/sys/src/stats.rs index 189e8f6cf4..c7da3ffd1a 100644 --- a/common/sys/src/stats.rs +++ b/common/sys/src/stats.rs @@ -3,7 +3,7 @@ use common::{ self, skills::{GeneralSkill, Skill}, Body, CharacterState, Combo, Energy, EnergyChange, EnergySource, Health, Poise, - PoiseChange, PoiseSource, Pos, Stats, + PoiseChange, PoiseSource, Pos, SkillSet, Stats, }, event::{EventBus, ServerEvent}, outcome::Outcome, @@ -40,6 +40,7 @@ impl<'a> System<'a> for Sys { type SystemData = ( ReadData<'a>, WriteStorage<'a, Stats>, + WriteStorage<'a, SkillSet>, WriteStorage<'a, Health>, WriteStorage<'a, Poise>, WriteStorage<'a, Energy>, @@ -55,7 +56,8 @@ impl<'a> System<'a> for Sys { _job: &mut Job, ( read_data, - mut stats, + stats, + mut skill_sets, mut healths, mut poises, mut energies, @@ -79,10 +81,11 @@ impl<'a> System<'a> for Sys { poises.set_event_emission(true); // Update stats - for (entity, uid, mut stats, mut health, pos) in ( + for (entity, uid, stats, mut skill_set, mut health, pos) in ( &read_data.entities, &read_data.uids, - &mut stats.restrict_mut(), + &stats, + &mut skill_sets.restrict_mut(), &mut healths.restrict_mut(), &read_data.positions, ) @@ -102,8 +105,7 @@ impl<'a> System<'a> for Sys { health.is_dead = true; } - - let stat = stats.get_unchecked(); + let stat = stats; let update_max_hp = { let health = health.get_unchecked(); @@ -116,24 +118,24 @@ impl<'a> System<'a> for Sys { health.scale_maximum(stat.max_health_modifier); } - let skills_to_level = stat - .skill_set + let skillset = skill_set.get_unchecked(); + let skills_to_level = skillset .skill_groups .iter() .filter_map(|s_g| { - (s_g.exp >= stat.skill_set.skill_point_cost(s_g.skill_group_kind)) + (s_g.exp >= skillset.skill_point_cost(s_g.skill_group_kind)) .then(|| s_g.skill_group_kind) }) .collect::>(); if !skills_to_level.is_empty() { - let mut stat = stats.get_mut_unchecked(); + let mut skill_set = skill_set.get_mut_unchecked(); for skill_group in skills_to_level { - stat.skill_set.earn_skill_point(skill_group); + skill_set.earn_skill_point(skill_group); outcomes.push(Outcome::SkillPointGain { uid: *uid, skill_tree: skill_group, - total_points: stat.skill_set.earned_sp(skill_group), + total_points: skill_set.earned_sp(skill_group), pos: pos.0, }); } @@ -141,37 +143,35 @@ impl<'a> System<'a> for Sys { } // Apply effects from leveling skills - for (mut stats, mut health, mut energy, body) in ( - &mut stats.restrict_mut(), + for (mut skill_set, mut health, mut energy, body) in ( + &mut skill_sets.restrict_mut(), &mut healths.restrict_mut(), &mut energies.restrict_mut(), &read_data.bodies, ) .join() { - let stat = stats.get_unchecked(); - if stat.skill_set.modify_health { + let skillset = skill_set.get_unchecked(); + if skillset.modify_health { let mut health = health.get_mut_unchecked(); - let health_level = stat - .skill_set + let health_level = skillset .skill_level(Skill::General(GeneralSkill::HealthIncrease)) .unwrap_or(None) .unwrap_or(0); health.update_max_hp(Some(*body), health_level); - let mut stat = stats.get_mut_unchecked(); - stat.skill_set.modify_health = false; + let mut skillset = skill_set.get_mut_unchecked(); + skillset.modify_health = false; } - let stat = stats.get_unchecked(); - if stat.skill_set.modify_energy { + let skillset = skill_set.get_unchecked(); + if skillset.modify_energy { let mut energy = energy.get_mut_unchecked(); - let energy_level = stat - .skill_set + let energy_level = skillset .skill_level(Skill::General(GeneralSkill::EnergyIncrease)) .unwrap_or(None) .unwrap_or(0); energy.update_max_energy(Some(*body), energy_level); - let mut stat = stats.get_mut_unchecked(); - stat.skill_set.modify_energy = false; + let mut skill_set = skill_set.get_mut_unchecked(); + skill_set.modify_energy = false; } } diff --git a/server/src/character_creator.rs b/server/src/character_creator.rs index 64e917b0d5..d967e83447 100644 --- a/server/src/character_creator.rs +++ b/server/src/character_creator.rs @@ -1,5 +1,7 @@ use crate::persistence::character_loader::CharacterLoader; -use common::comp::{inventory::loadout_builder::LoadoutBuilder, Body, Inventory, Item, Stats}; +use common::comp::{ + inventory::loadout_builder::LoadoutBuilder, Body, Inventory, Item, SkillSet, Stats, +}; use specs::{Entity, ReadExpect}; const VALID_STARTER_ITEMS: [&str; 6] = [ @@ -32,6 +34,7 @@ pub fn create_character( } let stats = Stats::new(character_alias.to_string()); + let skill_set = SkillSet::default(); let loadout = LoadoutBuilder::new() .defaults() @@ -56,6 +59,6 @@ pub fn create_character( entity, player_uuid, character_alias, - (body, stats, inventory, waypoint), + (body, stats, skill_set, inventory, waypoint), ); } diff --git a/server/src/cmd.rs b/server/src/cmd.rs index 79f0e4b62d..083b00ba4b 100644 --- a/server/src/cmd.rs +++ b/server/src/cmd.rs @@ -849,9 +849,7 @@ fn handle_spawn( ); let body = body(); - let loadout = LoadoutBuilder::build_loadout(body, None, None, None).build(); - let inventory = Inventory::new_with_loadout(loadout); let mut entity_base = server @@ -859,6 +857,7 @@ fn handle_spawn( .create_npc( pos, comp::Stats::new(get_npc_name(id, npc::BodyType::from_body(body))), + comp::SkillSet::default(), comp::Health::new(body, 1), comp::Poise::new(body), inventory, @@ -951,13 +950,21 @@ fn handle_spawn_training_dummy( let body = comp::Body::Object(comp::object::Body::TrainingDummy); let stats = comp::Stats::new("Training Dummy".to_string()); - + let skill_set = comp::SkillSet::default(); let health = comp::Health::new(body, 0); let poise = comp::Poise::new(body); server .state - .create_npc(pos, stats, health, poise, Inventory::new_empty(), body) + .create_npc( + pos, + stats, + skill_set, + health, + poise, + Inventory::new_empty(), + body, + ) .with(comp::Vel(vel)) .with(comp::MountState::Unmounted) .build(); @@ -2174,13 +2181,13 @@ fn handle_skill_point( .map(|alias| find_alias(server.state.ecs(), &alias).map(|(target, _)| target)) .unwrap_or(Ok(target))?; - if let Some(mut stats) = server + if let Some(mut skill_set) = server .state .ecs_mut() - .write_storage::() + .write_storage::() .get_mut(player) { - stats.skill_set.add_skill_points(skill_tree, sp); + skill_set.add_skill_points(skill_tree, sp); Ok(()) } else { Err("Player has no stats!".into()) diff --git a/server/src/events/entity_creation.rs b/server/src/events/entity_creation.rs index ed9c515d32..284aebb86a 100644 --- a/server/src/events/entity_creation.rs +++ b/server/src/events/entity_creation.rs @@ -8,7 +8,8 @@ use common::{ buff::{BuffCategory, BuffData, BuffKind, BuffSource}, inventory::loadout::Loadout, shockwave, Agent, Alignment, Body, Gravity, Health, HomeChunk, Inventory, Item, ItemDrop, - LightEmitter, Object, Ori, Poise, Pos, Projectile, Scale, Stats, Vel, WaypointArea, + LightEmitter, Object, Ori, Poise, Pos, Projectile, Scale, SkillSet, Stats, Vel, + WaypointArea, }, outcome::Outcome, rtsim::RtSimEntity, @@ -34,6 +35,7 @@ pub fn handle_loaded_character_data( loaded_components: ( comp::Body, comp::Stats, + comp::SkillSet, comp::Inventory, Option, ), @@ -49,6 +51,7 @@ pub fn handle_create_npc( server: &mut Server, pos: Pos, stats: Stats, + skill_set: SkillSet, health: Health, poise: Poise, loadout: Loadout, @@ -64,7 +67,7 @@ pub fn handle_create_npc( let entity = server .state - .create_npc(pos, stats, health, poise, inventory, body) + .create_npc(pos, stats, skill_set, health, poise, inventory, body) .with(scale) .with(alignment); diff --git a/server/src/events/entity_manipulation.rs b/server/src/events/entity_manipulation.rs index b1a1cdac74..abe983b34d 100644 --- a/server/src/events/entity_manipulation.rs +++ b/server/src/events/entity_manipulation.rs @@ -15,7 +15,7 @@ use common::{ chat::{KillSource, KillType}, inventory::item::MaterialStatManifest, object, Alignment, Body, CharacterState, Energy, EnergyChange, Group, Health, HealthChange, - HealthSource, Inventory, Player, Poise, PoiseChange, PoiseSource, Pos, Stats, + HealthSource, Inventory, Player, Poise, PoiseChange, PoiseSource, Pos, SkillSet, Stats, }, event::{EventBus, ServerEvent}, lottery::{LootSpec, Lottery}, @@ -178,7 +178,7 @@ pub fn handle_destroy(server: &mut Server, entity: EcsEntity, cause: HealthSourc // Give EXP to the killer if entity had stats (|| { - let mut stats = state.ecs().write_storage::(); + let mut skill_set = state.ecs().write_storage::(); let healths = state.ecs().read_storage::(); let inventories = state.ecs().read_storage::(); let players = state.ecs().read_storage::(); @@ -193,18 +193,23 @@ pub fn handle_destroy(server: &mut Server, entity: EcsEntity, cause: HealthSourc } else { return; }; - let (entity_stats, entity_health, entity_inventory, entity_body) = if let ( - Some(entity_stats), + let (entity_skill_set, entity_health, entity_inventory, entity_body) = if let ( + Some(entity_skill_set), Some(entity_health), Some(entity_inventory), Some(entity_body), ) = ( - stats.get(entity), + skill_set.get(entity), healths.get(entity), inventories.get(entity), bodies.get(entity), ) { - (entity_stats, entity_health, entity_inventory, entity_body) + ( + entity_skill_set, + entity_health, + entity_inventory, + entity_body, + ) } else { return; }; @@ -228,7 +233,7 @@ pub fn handle_destroy(server: &mut Server, entity: EcsEntity, cause: HealthSourc let mut exp_reward = combat::combat_rating( entity_inventory, entity_health, - entity_stats, + entity_skill_set, *entity_body, &msm, ) * 2.5; @@ -268,24 +273,24 @@ pub fn handle_destroy(server: &mut Server, entity: EcsEntity, cause: HealthSourc // Divides exp reward by square root of number of people in group exp_reward /= (non_pet_group_members_in_range as f32).sqrt(); members_in_range.into_iter().for_each(|(e, uid)| { - if let (Some(inventory), Some(mut stats)) = (inventories.get(e), stats.get_mut(e)) { - handle_exp_gain(exp_reward, inventory, &mut stats, uid, &mut outcomes); + if let (Some(inventory), Some(mut skill_set)) = + (inventories.get(e), skill_set.get_mut(e)) + { + handle_exp_gain(exp_reward, inventory, &mut skill_set, uid, &mut outcomes); } }); } - if let (Some(mut attacker_stats), Some(attacker_uid), Some(attacker_inventory)) = ( - stats.get_mut(attacker), + if let (Some(mut attacker_skill_set), Some(attacker_uid), Some(attacker_inventory)) = ( + skill_set.get_mut(attacker), uids.get(attacker), inventories.get(attacker), ) { - // TODO: Discuss whether we should give EXP by Player - // Killing or not. - // attacker_stats.exp.change_by(exp_reward.ceil() as i64); + // TODO: Discuss whether we should give EXP by Player Killing or not. handle_exp_gain( exp_reward, attacker_inventory, - &mut attacker_stats, + &mut attacker_skill_set, attacker_uid, &mut outcomes, ); @@ -856,7 +861,7 @@ pub fn handle_energy_change(server: &Server, entity: EcsEntity, change: EnergyCh fn handle_exp_gain( exp_reward: f32, inventory: &Inventory, - stats: &mut Stats, + skill_set: &mut SkillSet, uid: &Uid, outcomes: &mut Vec, ) { @@ -864,26 +869,18 @@ fn handle_exp_gain( let mut xp_pools = HashSet::::new(); xp_pools.insert(SkillGroupKind::General); if let Some(w) = main_tool_kind { - if stats - .skill_set - .contains_skill_group(SkillGroupKind::Weapon(w)) - { + if skill_set.contains_skill_group(SkillGroupKind::Weapon(w)) { xp_pools.insert(SkillGroupKind::Weapon(w)); } } if let Some(w) = second_tool_kind { - if stats - .skill_set - .contains_skill_group(SkillGroupKind::Weapon(w)) - { + if skill_set.contains_skill_group(SkillGroupKind::Weapon(w)) { xp_pools.insert(SkillGroupKind::Weapon(w)); } } let num_pools = xp_pools.len() as f32; for pool in xp_pools { - stats - .skill_set - .change_experience(pool, (exp_reward / num_pools).ceil() as i32); + skill_set.change_experience(pool, (exp_reward / num_pools).ceil() as i32); } outcomes.push(Outcome::ExpChange { uid: *uid, diff --git a/server/src/events/mod.rs b/server/src/events/mod.rs index fdc7d9891f..418cdd930d 100644 --- a/server/src/events/mod.rs +++ b/server/src/events/mod.rs @@ -140,6 +140,7 @@ impl Server { ServerEvent::CreateNpc { pos, stats, + skill_set, health, poise, loadout, @@ -154,6 +155,7 @@ impl Server { self, pos, stats, + skill_set, health, poise, loadout, diff --git a/server/src/events/player.rs b/server/src/events/player.rs index 2ccd360bdb..5f4d439c3a 100644 --- a/server/src/events/player.rs +++ b/server/src/events/player.rs @@ -175,9 +175,9 @@ pub fn handle_client_disconnect( // the race condition of their login fetching their old data // and overwriting the data saved here. fn persist_entity(state: &mut State, entity: EcsEntity) -> EcsEntity { - if let (Some(presence), Some(stats), Some(inventory), mut character_updater) = ( + if let (Some(presence), Some(skill_set), Some(inventory), mut character_updater) = ( state.read_storage::().get(entity), - state.read_storage::().get(entity), + state.read_storage::().get(entity), state.read_storage::().get(entity), state.ecs().fetch_mut::(), ) { @@ -191,7 +191,7 @@ fn persist_entity(state: &mut State, entity: EcsEntity) -> EcsEntity { character_updater.add_pending_logout_update( char_id, - (stats.clone(), inventory.clone(), waypoint), + (skill_set.clone(), inventory.clone(), waypoint), ); }, PresenceKind::Spectator => { /* Do nothing, spectators do not need persisting */ }, diff --git a/server/src/persistence/character.rs b/server/src/persistence/character.rs index 32bce7fa79..81e8422657 100644 --- a/server/src/persistence/character.rs +++ b/server/src/persistence/character.rs @@ -15,9 +15,9 @@ use crate::{ convert_body_from_database, convert_body_to_database_json, convert_character_from_database, convert_inventory_from_database_items, convert_items_to_database_items, convert_loadout_from_database_items, - convert_skill_groups_to_database, convert_skills_to_database, - convert_stats_from_database, convert_waypoint_from_database_json, - convert_waypoint_to_database_json, + convert_skill_groups_to_database, convert_skill_set_from_database, + convert_skills_to_database, convert_stats_from_database, + convert_waypoint_from_database_json, convert_waypoint_to_database_json, }, character_loader::{CharacterCreationResult, CharacterDataResult, CharacterListResult}, error::PersistenceError::DatabaseError, @@ -198,7 +198,8 @@ pub fn load_character_data( Ok(( convert_body_from_database(&body_data)?, - convert_stats_from_database(character_data.alias, &skill_data, &skill_group_data), + convert_stats_from_database(character_data.alias), + convert_skill_set_from_database(&skill_data, &skill_group_data), convert_inventory_from_database_items( character_containers.inventory_container_id, &inventory_items, @@ -301,7 +302,7 @@ pub fn create_character( ) -> CharacterCreationResult { check_character_limit(uuid, connection)?; - let (body, stats, inventory, waypoint) = persisted_components; + let (body, _stats, skill_set, inventory, waypoint) = persisted_components; // Fetch new entity IDs for character, inventory and loadout let mut new_entity_ids = get_new_entity_ids(connection, |next_id| next_id + 3)?; @@ -387,8 +388,6 @@ pub fn create_character( ])?; drop(stmt); - let skill_set = stats.skill_set; - let db_skill_groups = convert_skill_groups_to_database(character_id, skill_set.skill_groups); #[rustfmt::skip] @@ -682,7 +681,7 @@ fn get_pseudo_container_id( pub fn update( char_id: CharacterId, - char_stats: comp::Stats, + char_skill_set: comp::SkillSet, inventory: comp::Inventory, char_waypoint: Option, connection: &mut Transaction, @@ -781,8 +780,6 @@ pub fn update( } } - let char_skill_set = char_stats.skill_set; - let db_skill_groups = convert_skill_groups_to_database(char_id, char_skill_set.skill_groups); #[rustfmt::skip] diff --git a/server/src/persistence/character/conversions.rs b/server/src/persistence/character/conversions.rs index 563c9f06ab..4d83b04eb7 100644 --- a/server/src/persistence/character/conversions.rs +++ b/server/src/persistence/character/conversions.rs @@ -428,26 +428,22 @@ pub fn convert_character_from_database(character: &Character) -> common::charact } } -pub fn convert_stats_from_database( - alias: String, - skills: &[Skill], - skill_groups: &[SkillGroup], -) -> common::comp::Stats { +pub fn convert_stats_from_database(alias: String) -> common::comp::Stats { let mut new_stats = common::comp::Stats::empty(); new_stats.name = alias; - /*new_stats.update_max_hp(new_stats.body_type); - new_stats.health.set_to( - new_stats.health.maximum(), - common::comp::HealthSource::Revive, - );*/ - new_stats.skill_set = skills::SkillSet { + new_stats +} + +pub fn convert_skill_set_from_database( + skills: &[Skill], + skill_groups: &[SkillGroup], +) -> common::comp::SkillSet { + skills::SkillSet { skill_groups: convert_skill_groups_from_database(skill_groups), skills: convert_skills_from_database(skills), modify_health: true, modify_energy: true, - }; - - new_stats + } } fn get_item_from_asset(item_definition_id: &str) -> Result { diff --git a/server/src/persistence/character_updater.rs b/server/src/persistence/character_updater.rs index de4a7ed1ef..fb591146b8 100644 --- a/server/src/persistence/character_updater.rs +++ b/server/src/persistence/character_updater.rs @@ -14,7 +14,7 @@ use std::{ }; use tracing::{debug, error, info, trace, warn}; -pub type CharacterUpdateData = (comp::Stats, comp::Inventory, Option); +pub type CharacterUpdateData = (comp::SkillSet, comp::Inventory, Option); pub enum CharacterUpdaterEvent { BatchUpdate(Vec<(CharacterId, CharacterUpdateData)>), @@ -131,17 +131,17 @@ impl CharacterUpdater { updates: impl Iterator< Item = ( CharacterId, - &'a comp::Stats, + &'a comp::SkillSet, &'a comp::Inventory, Option<&'a comp::Waypoint>, ), >, ) { let updates = updates - .map(|(character_id, stats, inventory, waypoint)| { + .map(|(character_id, skill_set, inventory, waypoint)| { ( character_id, - (stats.clone(), inventory.clone(), waypoint.cloned()), + (skill_set.clone(), inventory.clone(), waypoint.cloned()), ) }) .chain(self.pending_logout_updates.drain()) @@ -161,11 +161,16 @@ impl CharacterUpdater { pub fn update( &mut self, character_id: CharacterId, - stats: &comp::Stats, + skill_set: &comp::SkillSet, inventory: &comp::Inventory, waypoint: Option<&comp::Waypoint>, ) { - self.batch_update(std::iter::once((character_id, stats, inventory, waypoint))); + self.batch_update(std::iter::once(( + character_id, + skill_set, + inventory, + waypoint, + ))); } /// Indicates to the batch update thread that a requested disconnection of diff --git a/server/src/persistence/mod.rs b/server/src/persistence/mod.rs index e1addc9c4c..cd3139adb8 100644 --- a/server/src/persistence/mod.rs +++ b/server/src/persistence/mod.rs @@ -22,6 +22,7 @@ use tracing::info; pub type PersistedComponents = ( comp::Body, comp::Stats, + comp::SkillSet, comp::Inventory, Option, ); diff --git a/server/src/rtsim/tick.rs b/server/src/rtsim/tick.rs index fa526e995d..c729445fa9 100644 --- a/server/src/rtsim/tick.rs +++ b/server/src/rtsim/tick.rs @@ -126,6 +126,7 @@ impl<'a> System<'a> for Sys { _ => ServerEvent::CreateNpc { pos: comp::Pos(spawn_pos), stats: comp::Stats::new(entity.get_name()), + skill_set: comp::SkillSet::default(), health: comp::Health::new(body, 10), loadout: match body { comp::Body::Humanoid(_) => entity.get_loadout(), diff --git a/server/src/state_ext.rs b/server/src/state_ext.rs index a83a300436..94ecf14b4f 100644 --- a/server/src/state_ext.rs +++ b/server/src/state_ext.rs @@ -31,10 +31,12 @@ pub trait StateExt { /// Updates a component associated with the entity based on the `Effect` fn apply_effect(&self, entity: EcsEntity, effect: Effect, source: Option); /// Build a non-player character + #[allow(clippy::too_many_arguments)] fn create_npc( &mut self, pos: comp::Pos, stats: comp::Stats, + skill_set: comp::SkillSet, health: comp::Health, poise: comp::Poise, inventory: comp::Inventory, @@ -161,6 +163,7 @@ impl StateExt for State { &mut self, pos: comp::Pos, stats: comp::Stats, + skill_set: comp::SkillSet, health: comp::Health, poise: comp::Poise, inventory: comp::Inventory, @@ -192,13 +195,13 @@ impl StateExt for State { .with(body) .with(comp::Energy::new( body, - stats - .skill_set + skill_set .skill_level(Skill::General(GeneralSkill::EnergyIncrease)) .unwrap_or(None) .unwrap_or(0), )) .with(stats) + .with(skill_set) .with(health) .with(poise) .with(comp::Alignment::Npc) @@ -252,6 +255,7 @@ impl StateExt for State { // recognize a possesed airship; that system should be refactored to use `.maybe()` .with(comp::Energy::new(ship.into(), 0)) .with(comp::Stats::new("Airship".to_string())) + .with(comp::SkillSet::default()) .with(comp::Combo::default()); if mountable { @@ -399,7 +403,7 @@ impl StateExt for State { } fn update_character_data(&mut self, entity: EcsEntity, components: PersistedComponents) { - let (body, stats, inventory, waypoint) = components; + let (body, stats, skill_set, inventory, waypoint) = components; if let Some(player_uid) = self.read_component_copied::(entity) { // Notify clients of a player list update @@ -420,13 +424,11 @@ impl StateExt for State { }); self.write_component_ignore_entity_dead(entity, body); let (health_level, energy_level) = ( - stats - .skill_set + skill_set .skill_level(Skill::General(GeneralSkill::HealthIncrease)) .unwrap_or(None) .unwrap_or(0), - stats - .skill_set + skill_set .skill_level(Skill::General(GeneralSkill::EnergyIncrease)) .unwrap_or(None) .unwrap_or(0), @@ -435,6 +437,7 @@ impl StateExt for State { self.write_component_ignore_entity_dead(entity, comp::Energy::new(body, energy_level)); self.write_component_ignore_entity_dead(entity, comp::Poise::new(body)); self.write_component_ignore_entity_dead(entity, stats); + self.write_component_ignore_entity_dead(entity, skill_set); self.write_component_ignore_entity_dead(entity, inventory); self.write_component_ignore_entity_dead( entity, diff --git a/server/src/sys/agent.rs b/server/src/sys/agent.rs index f5560290ef..2d2e633fa7 100644 --- a/server/src/sys/agent.rs +++ b/server/src/sys/agent.rs @@ -16,7 +16,7 @@ use common::{ skills::{AxeSkill, BowSkill, HammerSkill, Skill, StaffSkill, SwordSkill}, Agent, Alignment, BehaviorCapability, BehaviorState, Body, CharacterState, ControlAction, ControlEvent, Controller, Energy, Health, HealthChange, InputKind, Inventory, - InventoryAction, LightEmitter, MountState, Ori, PhysicsState, Pos, Scale, Stats, + InventoryAction, LightEmitter, MountState, Ori, PhysicsState, Pos, Scale, SkillSet, Stats, UnresolvedChatMsg, Vel, }, effect::{BuffEffect, Effect}, @@ -55,7 +55,7 @@ struct AgentData<'a> { energy: &'a Energy, body: Option<&'a Body>, inventory: &'a Inventory, - stats: &'a Stats, + skill_set: &'a SkillSet, physics_state: &'a PhysicsState, alignment: Option<&'a Alignment>, traversal_config: TraversalConfig, @@ -84,6 +84,7 @@ pub struct ReadData<'a> { healths: ReadStorage<'a, Health>, inventories: ReadStorage<'a, Inventory>, stats: ReadStorage<'a, Stats>, + skill_set: ReadStorage<'a, SkillSet>, physics_states: ReadStorage<'a, PhysicsState>, char_states: ReadStorage<'a, CharacterState>, uids: ReadStorage<'a, Uid>, @@ -147,7 +148,7 @@ impl<'a> System<'a> for Sys { ), read_data.bodies.maybe(), &read_data.inventories, - &read_data.stats, + &read_data.skill_set, &read_data.physics_states, &read_data.uids, &mut agents, @@ -176,7 +177,7 @@ impl<'a> System<'a> for Sys { (pos, vel, ori), body, inventory, - stats, + skill_set, physics_state, uid, agent, @@ -269,7 +270,7 @@ impl<'a> System<'a> for Sys { energy, body, inventory, - stats, + skill_set, physics_state, alignment: alignment.as_ref(), traversal_config, @@ -1621,10 +1622,7 @@ impl<'a> AgentData<'a> { .actions .push(ControlAction::basic_input(InputKind::Secondary)); agent.action_timer += dt.0; - } else if self - .stats - .skill_set - .has_skill(Skill::Axe(AxeSkill::UnlockLeap)) + } else if self.skill_set.has_skill(Skill::Axe(AxeSkill::UnlockLeap)) && self.energy.current() > 800 && thread_rng().gen_bool(0.5) { @@ -1680,7 +1678,6 @@ impl<'a> AgentData<'a> { .push(ControlAction::basic_input(InputKind::Secondary)); agent.action_timer += dt.0; } else if self - .stats .skill_set .has_skill(Skill::Hammer(HammerSkill::UnlockLeap)) && self.energy.current() > 700 @@ -1711,7 +1708,6 @@ impl<'a> AgentData<'a> { controller.inputs.move_dir = bearing.xy().try_normalized().unwrap_or_else(Vec2::zero) * speed; if self - .stats .skill_set .has_skill(Skill::Hammer(HammerSkill::UnlockLeap)) && agent.action_timer > 5.0 @@ -1746,7 +1742,6 @@ impl<'a> AgentData<'a> { if dist_sqrd < min_attack_dist.powi(2) { controller.inputs.move_dir = Vec2::zero(); if self - .stats .skill_set .has_skill(Skill::Sword(SwordSkill::UnlockSpin)) && agent.action_timer < 2.0 @@ -1841,7 +1836,6 @@ impl<'a> AgentData<'a> { .push(ControlAction::basic_input(InputKind::Secondary)); agent.action_timer += dt.0; } else if self - .stats .skill_set .has_skill(Skill::Bow(BowSkill::UnlockRepeater)) && self.energy.current() > 400 @@ -1924,7 +1918,6 @@ impl<'a> AgentData<'a> { agent.action_timer = 0.0; } if self - .stats .skill_set .has_skill(Skill::Staff(StaffSkill::UnlockShockwave)) && self.energy.current() > 800 diff --git a/server/src/sys/msg/in_game.rs b/server/src/sys/msg/in_game.rs index 38f49e1d9d..4e3f191a25 100644 --- a/server/src/sys/msg/in_game.rs +++ b/server/src/sys/msg/in_game.rs @@ -1,6 +1,6 @@ use crate::{client::Client, presence::Presence, Settings}; use common::{ - comp::{CanBuild, ControlEvent, Controller, ForceUpdate, Health, Ori, Pos, Stats, Vel}, + comp::{CanBuild, ControlEvent, Controller, ForceUpdate, Health, Ori, Pos, SkillSet, Vel}, event::{EventBus, ServerEvent}, terrain::TerrainGrid, vol::ReadVol, @@ -21,7 +21,7 @@ impl Sys { terrain: &ReadExpect<'_, TerrainGrid>, can_build: &ReadStorage<'_, CanBuild>, force_updates: &ReadStorage<'_, ForceUpdate>, - stats: &mut WriteStorage<'_, Stats>, + skill_sets: &mut WriteStorage<'_, SkillSet>, healths: &ReadStorage<'_, Health>, block_changes: &mut Write<'_, BlockChange>, positions: &mut WriteStorage<'_, Pos>, @@ -139,19 +139,19 @@ impl Sys { } }, ClientGeneral::UnlockSkill(skill) => { - stats + skill_sets .get_mut(entity) - .map(|mut s| s.skill_set.unlock_skill(skill)); + .map(|mut skill_set| skill_set.unlock_skill(skill)); }, ClientGeneral::RefundSkill(skill) => { - stats + skill_sets .get_mut(entity) - .map(|mut s| s.skill_set.refund_skill(skill)); + .map(|mut skill_set| skill_set.refund_skill(skill)); }, ClientGeneral::UnlockSkillGroup(skill_group_kind) => { - stats + skill_sets .get_mut(entity) - .map(|mut s| s.skill_set.unlock_skill_group(skill_group_kind)); + .map(|mut skill_set| skill_set.unlock_skill_group(skill_group_kind)); }, ClientGeneral::RequestSiteInfo(id) => { server_emitter.emit(ServerEvent::RequestSiteInfo { entity, id }); @@ -173,7 +173,7 @@ impl<'a> System<'a> for Sys { ReadExpect<'a, TerrainGrid>, ReadStorage<'a, CanBuild>, ReadStorage<'a, ForceUpdate>, - WriteStorage<'a, Stats>, + WriteStorage<'a, SkillSet>, ReadStorage<'a, Health>, Write<'a, BlockChange>, WriteStorage<'a, Pos>, @@ -198,7 +198,7 @@ impl<'a> System<'a> for Sys { terrain, can_build, force_updates, - mut stats, + mut skill_sets, healths, mut block_changes, mut positions, @@ -225,7 +225,7 @@ impl<'a> System<'a> for Sys { &terrain, &can_build, &force_updates, - &mut stats, + &mut skill_sets, &healths, &mut block_changes, &mut positions, diff --git a/server/src/sys/persistence.rs b/server/src/sys/persistence.rs index 3ce00e7571..bfac106095 100644 --- a/server/src/sys/persistence.rs +++ b/server/src/sys/persistence.rs @@ -1,5 +1,5 @@ use crate::{persistence::character_updater, presence::Presence, sys::SysScheduler}; -use common::comp::{Inventory, Stats, Waypoint}; +use common::comp::{Inventory, SkillSet, Waypoint}; use common_ecs::{Job, Origin, Phase, System}; use common_net::msg::PresenceKind; use specs::{Join, ReadStorage, Write, WriteExpect}; @@ -11,7 +11,7 @@ impl<'a> System<'a> for Sys { #[allow(clippy::type_complexity)] type SystemData = ( ReadStorage<'a, Presence>, - ReadStorage<'a, Stats>, + ReadStorage<'a, SkillSet>, ReadStorage<'a, Inventory>, ReadStorage<'a, Waypoint>, WriteExpect<'a, character_updater::CharacterUpdater>, @@ -26,7 +26,7 @@ impl<'a> System<'a> for Sys { _job: &mut Job, ( presences, - player_stats, + player_skill_set, player_inventories, player_waypoint, mut updater, @@ -37,14 +37,16 @@ impl<'a> System<'a> for Sys { updater.batch_update( ( &presences, - &player_stats, + &player_skill_set, &player_inventories, player_waypoint.maybe(), ) .join() .filter_map( - |(presence, stats, inventory, waypoint)| match presence.kind { - PresenceKind::Character(id) => Some((id, stats, inventory, waypoint)), + |(presence, skill_set, inventory, waypoint)| match presence.kind { + PresenceKind::Character(id) => { + Some((id, skill_set, inventory, waypoint)) + }, PresenceKind::Spectator => None, }, ), diff --git a/server/src/sys/sentinel.rs b/server/src/sys/sentinel.rs index 4806a27ee9..a7aba73f9a 100644 --- a/server/src/sys/sentinel.rs +++ b/server/src/sys/sentinel.rs @@ -2,7 +2,8 @@ use common::{ comp::{ item::MaterialStatManifest, Auras, BeamSegment, Body, Buffs, CanBuild, CharacterState, Collider, Combo, Energy, Gravity, Group, Health, Inventory, Item, LightEmitter, Mass, - MountState, Mounting, Ori, Player, Poise, Pos, Scale, Shockwave, Stats, Sticky, Vel, + MountState, Mounting, Ori, Player, Poise, Pos, Scale, Shockwave, SkillSet, Stats, Sticky, + Vel, }, uid::Uid, }; @@ -42,6 +43,7 @@ pub struct TrackedComps<'a> { pub body: ReadStorage<'a, Body>, pub player: ReadStorage<'a, Player>, pub stats: ReadStorage<'a, Stats>, + pub skill_set: ReadStorage<'a, SkillSet>, pub buffs: ReadStorage<'a, Buffs>, pub auras: ReadStorage<'a, Auras>, pub energy: ReadStorage<'a, Energy>, @@ -84,6 +86,10 @@ impl<'a> TrackedComps<'a> { .get(entity) .cloned() .map(|c| comps.push(c.into())); + self.skill_set + .get(entity) + .cloned() + .map(|c| comps.push(c.into())); self.buffs .get(entity) .cloned() @@ -179,6 +185,7 @@ pub struct ReadTrackers<'a> { pub body: ReadExpect<'a, UpdateTracker>, pub player: ReadExpect<'a, UpdateTracker>, pub stats: ReadExpect<'a, UpdateTracker>, + pub skill_set: ReadExpect<'a, UpdateTracker>, pub buffs: ReadExpect<'a, UpdateTracker>, pub auras: ReadExpect<'a, UpdateTracker>, pub energy: ReadExpect<'a, UpdateTracker>, @@ -214,6 +221,7 @@ impl<'a> ReadTrackers<'a> { .with_component(&comps.uid, &*self.body, &comps.body, filter) .with_component(&comps.uid, &*self.player, &comps.player, filter) .with_component(&comps.uid, &*self.stats, &comps.stats, filter) + .with_component(&comps.uid, &*self.skill_set, &comps.skill_set, filter) .with_component(&comps.uid, &*self.buffs, &comps.buffs, filter) .with_component(&comps.uid, &*self.auras, &comps.auras, filter) .with_component(&comps.uid, &*self.energy, &comps.energy, filter) @@ -256,6 +264,7 @@ pub struct WriteTrackers<'a> { body: WriteExpect<'a, UpdateTracker>, player: WriteExpect<'a, UpdateTracker>, stats: WriteExpect<'a, UpdateTracker>, + skill_set: WriteExpect<'a, UpdateTracker>, buffs: WriteExpect<'a, UpdateTracker>, auras: WriteExpect<'a, UpdateTracker>, energy: WriteExpect<'a, UpdateTracker>, @@ -285,6 +294,7 @@ fn record_changes(comps: &TrackedComps, trackers: &mut WriteTrackers) { trackers.body.record_changes(&comps.body); trackers.player.record_changes(&comps.player); trackers.stats.record_changes(&comps.stats); + trackers.skill_set.record_changes(&comps.skill_set); trackers.buffs.record_changes(&comps.buffs); trackers.auras.record_changes(&comps.auras); trackers.energy.record_changes(&comps.energy); @@ -329,6 +339,7 @@ fn record_changes(comps: &TrackedComps, trackers: &mut WriteTrackers) { log_counts!(auras, "Auras"); log_counts!(player, "Players"); log_counts!(stats, "Stats"); + log_counts!(skill_set, "SkillSet"); log_counts!(energy, "Energies"); log_counts!(combo, "Combos"); log_vounts!(health, "Healths"); @@ -354,6 +365,7 @@ pub fn register_trackers(world: &mut World) { world.register_tracker::(); world.register_tracker::(); world.register_tracker::(); + world.register_tracker::(); world.register_tracker::(); world.register_tracker::(); world.register_tracker::(); diff --git a/server/src/sys/terrain.rs b/server/src/sys/terrain.rs index 1ed8c054f6..9a43236f29 100644 --- a/server/src/sys/terrain.rs +++ b/server/src/sys/terrain.rs @@ -154,7 +154,7 @@ impl<'a> System<'a> for Sys { let economy = entity.trading_information.as_ref(); let skillset_config = entity.skillset_config; - stats.skill_set = + let skill_set = SkillSetBuilder::build_skillset(&main_tool, skillset_config).build(); let loadout = LoadoutBuilder::build_loadout(body, main_tool, loadout_config, economy).build(); @@ -189,6 +189,7 @@ impl<'a> System<'a> for Sys { server_emitter.emit(ServerEvent::CreateNpc { pos: Pos(entity.pos), stats, + skill_set, health, poise, loadout, diff --git a/voxygen/src/hud/bag.rs b/voxygen/src/hud/bag.rs index a22b2251b5..1ee7ec456c 100644 --- a/voxygen/src/hud/bag.rs +++ b/voxygen/src/hud/bag.rs @@ -20,7 +20,7 @@ use common::{ combat::{combat_rating, Damage}, comp::{ item::{ItemDef, MaterialStatManifest, Quality}, - Body, Energy, Health, Inventory, Poise, Stats, + Body, Energy, Health, Inventory, Poise, SkillSet, Stats, }, }; use conrod_core::{ @@ -473,6 +473,7 @@ pub struct Bag<'a> { pulse: f32, localized_strings: &'a Localization, stats: &'a Stats, + skill_set: &'a SkillSet, health: &'a Health, energy: &'a Energy, show: &'a Show, @@ -494,6 +495,7 @@ impl<'a> Bag<'a> { pulse: f32, localized_strings: &'a Localization, stats: &'a Stats, + skill_set: &'a SkillSet, health: &'a Health, energy: &'a Energy, show: &'a Show, @@ -513,6 +515,7 @@ impl<'a> Bag<'a> { pulse, localized_strings, stats, + skill_set, energy, health, show, @@ -738,8 +741,14 @@ impl<'a> Widget for Bag<'a> { .resize(STATS.len(), &mut ui.widget_id_generator()) }); // Stats - let combat_rating = - combat_rating(inventory, self.health, self.stats, *self.body, &self.msm).min(999.9); + let combat_rating = combat_rating( + inventory, + self.health, + self.skill_set, + *self.body, + &self.msm, + ) + .min(999.9); let indicator_col = cr_color(combat_rating); for i in STATS.iter().copied().enumerate() { let btn = Button::image(match i.1 { diff --git a/voxygen/src/hud/buttons.rs b/voxygen/src/hud/buttons.rs index cd3c0fd20f..dce7b90060 100644 --- a/voxygen/src/hud/buttons.rs +++ b/voxygen/src/hud/buttons.rs @@ -9,7 +9,7 @@ use crate::{ GlobalState, }; use client::Client; -use common::comp::Stats; +use common::comp::{SkillSet, Stats}; use conrod_core::{ widget::{self, Button, Image, Text}, widget_ids, Color, Colorable, Positionable, Sizeable, Widget, WidgetCommon, @@ -59,6 +59,7 @@ pub struct Buttons<'a> { tooltip_manager: &'a mut TooltipManager, localized_strings: &'a Localization, stats: &'a Stats, + skill_set: &'a SkillSet, pulse: f32, } @@ -74,6 +75,7 @@ impl<'a> Buttons<'a> { tooltip_manager: &'a mut TooltipManager, localized_strings: &'a Localization, stats: &'a Stats, + skill_set: &'a SkillSet, pulse: f32, ) -> Self { Self { @@ -87,6 +89,7 @@ impl<'a> Buttons<'a> { tooltip_manager, localized_strings, stats, + skill_set, pulse, } } @@ -335,7 +338,7 @@ impl<'a> Widget for Buttons<'a> { .set(state.ids.map_text, ui); } // Diary - let unspent_sp = self.stats.skill_set.has_available_sp(); + let unspent_sp = self.skill_set.has_available_sp(); if Button::image(if !unspent_sp { self.imgs.spellbook_button } else { diff --git a/voxygen/src/hud/diary.rs b/voxygen/src/hud/diary.rs index 1ac9a256de..8dabc427df 100644 --- a/voxygen/src/hud/diary.rs +++ b/voxygen/src/hud/diary.rs @@ -18,7 +18,7 @@ use client::{self, Client}; use common::comp::{ item::tool::ToolKind, skills::{self, Skill}, - Stats, + SkillSet, }; widget_ids! { @@ -175,8 +175,7 @@ widget_ids! { pub struct Diary<'a> { show: &'a Show, _client: &'a Client, - stats: &'a Stats, - + skill_set: &'a SkillSet, imgs: &'a Imgs, item_imgs: &'a ItemImgs, fonts: &'a Fonts, @@ -198,7 +197,7 @@ impl<'a> Diary<'a> { pub fn new( show: &'a Show, _client: &'a Client, - stats: &'a Stats, + skill_set: &'a SkillSet, imgs: &'a Imgs, item_imgs: &'a ItemImgs, fonts: &'a Fonts, @@ -210,7 +209,7 @@ impl<'a> Diary<'a> { Self { show, _client, - stats, + skill_set, imgs, item_imgs, fonts, @@ -228,15 +227,6 @@ impl<'a> Diary<'a> { } } -/*pub struct State { - ids: Ids, -}*/ - -/*pub enum DiaryTab { - SkillTrees, - Achievements, -}*/ - pub type SelectedSkillTree = skills::SkillGroupKind; const TREES: [&str; 7] = [ @@ -289,8 +279,7 @@ impl<'a> Widget for Diary<'a> { .font_id(self.fonts.cyri.conrod_id) .desc_text_color(TEXT_COLOR); let sel_tab = &self.show.skilltreetab; - let frame_ani = (self.pulse * 4.0/* speed factor */).cos() * 0.5 + 0.8; //Animation timer - // Frame + let frame_ani = (self.pulse * 4.0/* speed factor */).cos() * 0.5 + 0.8; //Animation timer Frame Image::new(self.imgs.diary_bg) .w_h(1202.0, 886.0) .mid_top_with_margin_on(ui.window, 5.0) @@ -353,7 +342,7 @@ impl<'a> Widget for Diary<'a> { }); for i in TREES.iter().copied().enumerate() { let locked = !skill_tree_from_str(i.1) - .map_or(false, |st| self.stats.skill_set.contains_skill_group(st)); + .map_or(false, |st| self.skill_set.contains_skill_group(st)); // Background weapon image let img = Image::new(match i.1 { @@ -392,8 +381,8 @@ impl<'a> Widget for Diary<'a> { .map(|st| { ( st, - self.stats.skill_set.available_sp(st), - self.stats.skill_set.earned_sp(st), + self.skill_set.available_sp(st), + self.skill_set.earned_sp(st), ) }) .map_or(false, |(st, a_pts, e_pts)| { @@ -439,13 +428,13 @@ impl<'a> Widget for Diary<'a> { } } // Exp Bars and Rank Display - let current_exp = self.stats.skill_set.experience(*sel_tab) as f64; - let max_exp = self.stats.skill_set.skill_point_cost(*sel_tab) as f64; + let current_exp = self.skill_set.experience(*sel_tab) as f64; + let max_exp = self.skill_set.skill_point_cost(*sel_tab) as f64; let exp_percentage = current_exp / max_exp; - let rank = self.stats.skill_set.earned_sp(*sel_tab); + let rank = self.skill_set.earned_sp(*sel_tab); let rank_txt = format!("{}", rank); let exp_txt = format!("{}/{}", current_exp, max_exp); - let available_pts = self.stats.skill_set.available_sp(*sel_tab); + let available_pts = self.skill_set.available_sp(*sel_tab); let available_pts_txt = format!("{}", available_pts); Image::new(self.imgs.diary_exp_bg) .w_h(480.0, 76.0) @@ -744,10 +733,10 @@ impl<'a> Widget for Diary<'a> { if create_skill_button( self.imgs.health_plus_skill, state.skills_top_l[0], - &self.stats.skill_set, + &self.skill_set, skill, self.fonts, - &get_skill_label(skill, &self.stats.skill_set), + &get_skill_label(skill, &self.skill_set), ) .with_tooltip( self.tooltip_manager, @@ -755,7 +744,7 @@ impl<'a> Widget for Diary<'a> { &add_sp_cost_tooltip( &self.localized_strings.get("hud.skill.inc_health"), skill, - &self.stats.skill_set, + &self.skill_set, &self.localized_strings, ), &diary_tooltip, @@ -770,10 +759,10 @@ impl<'a> Widget for Diary<'a> { if create_skill_button( self.imgs.stamina_plus_skill, state.skills_top_l[1], - &self.stats.skill_set, + &self.skill_set, skill, self.fonts, - &get_skill_label(skill, &self.stats.skill_set), + &get_skill_label(skill, &self.skill_set), ) .with_tooltip( self.tooltip_manager, @@ -781,7 +770,7 @@ impl<'a> Widget for Diary<'a> { &add_sp_cost_tooltip( &self.localized_strings.get("hud.skill.inc_stam"), skill, - &self.stats.skill_set, + &self.skill_set, &self.localized_strings, ), &diary_tooltip, @@ -797,10 +786,10 @@ impl<'a> Widget for Diary<'a> { if create_skill_button( self.imgs.unlock_sword_skill, state.skills_top_r[0], - &self.stats.skill_set, + &self.skill_set, skill, self.fonts, - &get_skill_label(skill, &self.stats.skill_set), + &get_skill_label(skill, &self.skill_set), ) .with_tooltip( self.tooltip_manager, @@ -808,7 +797,7 @@ impl<'a> Widget for Diary<'a> { &add_sp_cost_tooltip( &self.localized_strings.get("hud.skill.unlck_sword"), skill, - &self.stats.skill_set, + &self.skill_set, &self.localized_strings, ), &diary_tooltip, @@ -823,10 +812,10 @@ impl<'a> Widget for Diary<'a> { if create_skill_button( self.imgs.unlock_axe_skill, state.skills_top_r[1], - &self.stats.skill_set, + &self.skill_set, skill, self.fonts, - &get_skill_label(skill, &self.stats.skill_set), + &get_skill_label(skill, &self.skill_set), ) .with_tooltip( self.tooltip_manager, @@ -834,7 +823,7 @@ impl<'a> Widget for Diary<'a> { &add_sp_cost_tooltip( &self.localized_strings.get("hud.skill.unlck_axe"), skill, - &self.stats.skill_set, + &self.skill_set, &self.localized_strings, ), &diary_tooltip, @@ -849,10 +838,10 @@ impl<'a> Widget for Diary<'a> { if create_skill_button( self.imgs.unlock_hammer_skill, state.skills_top_r[2], - &self.stats.skill_set, + &self.skill_set, skill, self.fonts, - &get_skill_label(skill, &self.stats.skill_set), + &get_skill_label(skill, &self.skill_set), ) .with_tooltip( self.tooltip_manager, @@ -860,7 +849,7 @@ impl<'a> Widget for Diary<'a> { &add_sp_cost_tooltip( &self.localized_strings.get("hud.skill.unlck_hammer"), skill, - &self.stats.skill_set, + &self.skill_set, &self.localized_strings, ), &diary_tooltip, @@ -875,10 +864,10 @@ impl<'a> Widget for Diary<'a> { if create_skill_button( self.imgs.unlock_bow_skill, state.skills_top_r[3], - &self.stats.skill_set, + &self.skill_set, skill, self.fonts, - &get_skill_label(skill, &self.stats.skill_set), + &get_skill_label(skill, &self.skill_set), ) .with_tooltip( self.tooltip_manager, @@ -886,7 +875,7 @@ impl<'a> Widget for Diary<'a> { &add_sp_cost_tooltip( &self.localized_strings.get("hud.skill.unlck_bow"), skill, - &self.stats.skill_set, + &self.skill_set, &self.localized_strings, ), &diary_tooltip, @@ -901,10 +890,10 @@ impl<'a> Widget for Diary<'a> { if create_skill_button( self.imgs.unlock_staff_skill0, state.skills_top_r[4], - &self.stats.skill_set, + &self.skill_set, skill, self.fonts, - &get_skill_label(skill, &self.stats.skill_set), + &get_skill_label(skill, &self.skill_set), ) .with_tooltip( self.tooltip_manager, @@ -912,7 +901,7 @@ impl<'a> Widget for Diary<'a> { &add_sp_cost_tooltip( &self.localized_strings.get("hud.skill.unlck_staff"), skill, - &self.stats.skill_set, + &self.skill_set, &self.localized_strings, ), &diary_tooltip, @@ -927,10 +916,10 @@ impl<'a> Widget for Diary<'a> { if create_skill_button( self.imgs.unlock_sceptre_skill, state.skills_top_r[5], - &self.stats.skill_set, + &self.skill_set, skill, self.fonts, - &get_skill_label(skill, &self.stats.skill_set), + &get_skill_label(skill, &self.skill_set), ) .with_tooltip( self.tooltip_manager, @@ -938,7 +927,7 @@ impl<'a> Widget for Diary<'a> { &add_sp_cost_tooltip( &self.localized_strings.get("hud.skill.unlck_sceptre"), skill, - &self.stats.skill_set, + &self.skill_set, &self.localized_strings, ), &diary_tooltip, @@ -954,10 +943,10 @@ impl<'a> Widget for Diary<'a> { if create_skill_button( self.imgs.skill_dodge_skill, state.skills_bot_l[0], - &self.stats.skill_set, + &self.skill_set, skill, self.fonts, - &get_skill_label(skill, &self.stats.skill_set), + &get_skill_label(skill, &self.skill_set), ) .with_tooltip( self.tooltip_manager, @@ -965,7 +954,7 @@ impl<'a> Widget for Diary<'a> { &add_sp_cost_tooltip( &self.localized_strings.get("hud.skill.dodge"), skill, - &self.stats.skill_set, + &self.skill_set, &self.localized_strings, ), &diary_tooltip, @@ -980,10 +969,10 @@ impl<'a> Widget for Diary<'a> { if create_skill_button( self.imgs.utility_cost_skill, state.skills_bot_l[1], - &self.stats.skill_set, + &self.skill_set, skill, self.fonts, - &get_skill_label(skill, &self.stats.skill_set), + &get_skill_label(skill, &self.skill_set), ) .with_tooltip( self.tooltip_manager, @@ -991,7 +980,7 @@ impl<'a> Widget for Diary<'a> { &add_sp_cost_tooltip( &self.localized_strings.get("hud.skill.roll_stamina"), skill, - &self.stats.skill_set, + &self.skill_set, &self.localized_strings, ), &diary_tooltip, @@ -1006,10 +995,10 @@ impl<'a> Widget for Diary<'a> { if create_skill_button( self.imgs.utility_speed_skill, state.skills_bot_l[2], - &self.stats.skill_set, + &self.skill_set, skill, self.fonts, - &get_skill_label(skill, &self.stats.skill_set), + &get_skill_label(skill, &self.skill_set), ) .with_tooltip( self.tooltip_manager, @@ -1017,7 +1006,7 @@ impl<'a> Widget for Diary<'a> { &add_sp_cost_tooltip( &self.localized_strings.get("hud.skill.roll_speed"), skill, - &self.stats.skill_set, + &self.skill_set, &self.localized_strings, ), &diary_tooltip, @@ -1032,10 +1021,10 @@ impl<'a> Widget for Diary<'a> { if create_skill_button( self.imgs.utility_duration_skill, state.skills_bot_l[3], - &self.stats.skill_set, + &self.skill_set, skill, self.fonts, - &get_skill_label(skill, &self.stats.skill_set), + &get_skill_label(skill, &self.skill_set), ) .with_tooltip( self.tooltip_manager, @@ -1043,7 +1032,7 @@ impl<'a> Widget for Diary<'a> { &add_sp_cost_tooltip( &self.localized_strings.get("hud.skill.roll_dur"), skill, - &self.stats.skill_set, + &self.skill_set, &self.localized_strings, ), &diary_tooltip, @@ -1070,10 +1059,10 @@ impl<'a> Widget for Diary<'a> { if create_skill_button( self.imgs.utility_cost_skill, state.skills_bot_r[1], - &self.stats.skill_set, + &self.skill_set, skill, self.fonts, - &get_skill_label(skill, &self.stats.skill_set), + &get_skill_label(skill, &self.skill_set), ) .with_tooltip( self.tooltip_manager, @@ -1081,7 +1070,7 @@ impl<'a> Widget for Diary<'a> { &add_sp_cost_tooltip( &self.localized_strings.get("hud.skill.climbing_cost"), skill, - &self.stats.skill_set, + &self.skill_set, &self.localized_strings, ), &diary_tooltip, @@ -1096,10 +1085,10 @@ impl<'a> Widget for Diary<'a> { if create_skill_button( self.imgs.utility_speed_skill, state.skills_bot_r[2], - &self.stats.skill_set, + &self.skill_set, skill, self.fonts, - &get_skill_label(skill, &self.stats.skill_set), + &get_skill_label(skill, &self.skill_set), ) .with_tooltip( self.tooltip_manager, @@ -1107,7 +1096,7 @@ impl<'a> Widget for Diary<'a> { &add_sp_cost_tooltip( &self.localized_strings.get("hud.skill.climbing_speed"), skill, - &self.stats.skill_set, + &self.skill_set, &self.localized_strings, ), &diary_tooltip, @@ -1134,10 +1123,10 @@ impl<'a> Widget for Diary<'a> { if create_skill_button( self.imgs.utility_speed_skill, state.skills_bot_r[4], - &self.stats.skill_set, + &self.skill_set, skill, self.fonts, - &get_skill_label(skill, &self.stats.skill_set), + &get_skill_label(skill, &self.skill_set), ) .with_tooltip( self.tooltip_manager, @@ -1145,7 +1134,7 @@ impl<'a> Widget for Diary<'a> { &add_sp_cost_tooltip( &self.localized_strings.get("hud.skill.swim_speed"), skill, - &self.stats.skill_set, + &self.skill_set, &self.localized_strings, ), &diary_tooltip, @@ -1189,10 +1178,10 @@ impl<'a> Widget for Diary<'a> { if create_skill_button( self.imgs.physical_combo_skill, state.skills_top_l[1], - &self.stats.skill_set, + &self.skill_set, skill, self.fonts, - &get_skill_label(skill, &self.stats.skill_set), + &get_skill_label(skill, &self.skill_set), ) .with_tooltip( self.tooltip_manager, @@ -1202,7 +1191,7 @@ impl<'a> Widget for Diary<'a> { &add_sp_cost_tooltip( &self.localized_strings.get("hud.skill.sw_trip_str_combo"), skill, - &self.stats.skill_set, + &self.skill_set, &self.localized_strings, ), &diary_tooltip, @@ -1217,10 +1206,10 @@ impl<'a> Widget for Diary<'a> { if create_skill_button( self.imgs.physical_damage_skill, state.skills_top_l[2], - &self.stats.skill_set, + &self.skill_set, skill, self.fonts, - &get_skill_label(skill, &self.stats.skill_set), + &get_skill_label(skill, &self.skill_set), ) .with_tooltip( self.tooltip_manager, @@ -1230,7 +1219,7 @@ impl<'a> Widget for Diary<'a> { &add_sp_cost_tooltip( &self.localized_strings.get("hud.skill.sw_trip_str_dmg"), skill, - &self.stats.skill_set, + &self.skill_set, &self.localized_strings, ), &diary_tooltip, @@ -1245,10 +1234,10 @@ impl<'a> Widget for Diary<'a> { if create_skill_button( self.imgs.physical_speed_skill, state.skills_top_l[3], - &self.stats.skill_set, + &self.skill_set, skill, self.fonts, - &get_skill_label(skill, &self.stats.skill_set), + &get_skill_label(skill, &self.skill_set), ) .with_tooltip( self.tooltip_manager, @@ -1256,7 +1245,7 @@ impl<'a> Widget for Diary<'a> { &add_sp_cost_tooltip( &self.localized_strings.get("hud.skill.sw_trip_str_sp"), skill, - &self.stats.skill_set, + &self.skill_set, &self.localized_strings, ), &diary_tooltip, @@ -1271,10 +1260,10 @@ impl<'a> Widget for Diary<'a> { if create_skill_button( self.imgs.physical_energy_regen_skill, state.skills_top_l[4], - &self.stats.skill_set, + &self.skill_set, skill, self.fonts, - &get_skill_label(skill, &self.stats.skill_set), + &get_skill_label(skill, &self.skill_set), ) .with_tooltip( self.tooltip_manager, @@ -1284,7 +1273,7 @@ impl<'a> Widget for Diary<'a> { &add_sp_cost_tooltip( &self.localized_strings.get("hud.skill.sw_trip_str_reg"), skill, - &self.stats.skill_set, + &self.skill_set, &self.localized_strings, ), &diary_tooltip, @@ -1311,10 +1300,10 @@ impl<'a> Widget for Diary<'a> { if create_skill_button( self.imgs.physical_damage_skill, state.skills_top_r[1], - &self.stats.skill_set, + &self.skill_set, skill, self.fonts, - &get_skill_label(skill, &self.stats.skill_set), + &get_skill_label(skill, &self.skill_set), ) .with_tooltip( self.tooltip_manager, @@ -1322,7 +1311,7 @@ impl<'a> Widget for Diary<'a> { &add_sp_cost_tooltip( &self.localized_strings.get("hud.skill.sw_dash_dmg"), skill, - &self.stats.skill_set, + &self.skill_set, &self.localized_strings, ), &diary_tooltip, @@ -1337,10 +1326,10 @@ impl<'a> Widget for Diary<'a> { if create_skill_button( self.imgs.physical_energy_drain_skill, state.skills_top_r[2], - &self.stats.skill_set, + &self.skill_set, skill, self.fonts, - &get_skill_label(skill, &self.stats.skill_set), + &get_skill_label(skill, &self.skill_set), ) .with_tooltip( self.tooltip_manager, @@ -1348,7 +1337,7 @@ impl<'a> Widget for Diary<'a> { &add_sp_cost_tooltip( &self.localized_strings.get("hud.skill.sw_dash_drain"), skill, - &self.stats.skill_set, + &self.skill_set, &self.localized_strings, ), &diary_tooltip, @@ -1363,10 +1352,10 @@ impl<'a> Widget for Diary<'a> { if create_skill_button( self.imgs.physical_cost_skill, state.skills_top_r[3], - &self.stats.skill_set, + &self.skill_set, skill, self.fonts, - &get_skill_label(skill, &self.stats.skill_set), + &get_skill_label(skill, &self.skill_set), ) .with_tooltip( self.tooltip_manager, @@ -1374,7 +1363,7 @@ impl<'a> Widget for Diary<'a> { &add_sp_cost_tooltip( &self.localized_strings.get("hud.skill.sw_dash_cost"), skill, - &self.stats.skill_set, + &self.skill_set, &self.localized_strings, ), &diary_tooltip, @@ -1389,10 +1378,10 @@ impl<'a> Widget for Diary<'a> { if create_skill_button( self.imgs.physical_speed_skill, state.skills_top_r[4], - &self.stats.skill_set, + &self.skill_set, skill, self.fonts, - &get_skill_label(skill, &self.stats.skill_set), + &get_skill_label(skill, &self.skill_set), ) .with_tooltip( self.tooltip_manager, @@ -1400,7 +1389,7 @@ impl<'a> Widget for Diary<'a> { &add_sp_cost_tooltip( &self.localized_strings.get("hud.skill.sw_dash_speed"), skill, - &self.stats.skill_set, + &self.skill_set, &self.localized_strings, ), &diary_tooltip, @@ -1415,10 +1404,10 @@ impl<'a> Widget for Diary<'a> { if create_skill_button( self.imgs.physical_infinite_skill, state.skills_top_r[5], - &self.stats.skill_set, + &self.skill_set, skill, self.fonts, - &get_skill_label(skill, &self.stats.skill_set), + &get_skill_label(skill, &self.skill_set), ) .with_tooltip( self.tooltip_manager, @@ -1426,7 +1415,7 @@ impl<'a> Widget for Diary<'a> { &add_sp_cost_tooltip( &self.localized_strings.get("hud.skill.sw_dash_inf"), skill, - &self.stats.skill_set, + &self.skill_set, &self.localized_strings, ), &diary_tooltip, @@ -1441,10 +1430,10 @@ impl<'a> Widget for Diary<'a> { if create_skill_button( self.imgs.physical_amount_skill, state.skills_top_r[6], - &self.stats.skill_set, + &self.skill_set, skill, self.fonts, - &get_skill_label(skill, &self.stats.skill_set), + &get_skill_label(skill, &self.skill_set), ) .with_tooltip( self.tooltip_manager, @@ -1452,7 +1441,7 @@ impl<'a> Widget for Diary<'a> { &add_sp_cost_tooltip( &self.localized_strings.get("hud.skill.sw_dash_scale"), skill, - &self.stats.skill_set, + &self.skill_set, &self.localized_strings, ), &diary_tooltip, @@ -1468,10 +1457,10 @@ impl<'a> Widget for Diary<'a> { if create_skill_button( self.imgs.sword_whirlwind, state.skills_bot_l[0], - &self.stats.skill_set, + &self.skill_set, skill, self.fonts, - &get_skill_label(skill, &self.stats.skill_set), + &get_skill_label(skill, &self.skill_set), ) .with_tooltip( self.tooltip_manager, @@ -1479,7 +1468,7 @@ impl<'a> Widget for Diary<'a> { &add_sp_cost_tooltip( &self.localized_strings.get("hud.skill.sw_spin"), skill, - &self.stats.skill_set, + &self.skill_set, &self.localized_strings, ), &diary_tooltip, @@ -1494,10 +1483,10 @@ impl<'a> Widget for Diary<'a> { if create_skill_button( self.imgs.physical_damage_skill, state.skills_bot_l[1], - &self.stats.skill_set, + &self.skill_set, skill, self.fonts, - &get_skill_label(skill, &self.stats.skill_set), + &get_skill_label(skill, &self.skill_set), ) .with_tooltip( self.tooltip_manager, @@ -1505,7 +1494,7 @@ impl<'a> Widget for Diary<'a> { &add_sp_cost_tooltip( &self.localized_strings.get("hud.skill.sw_spin_dmg"), skill, - &self.stats.skill_set, + &self.skill_set, &self.localized_strings, ), &diary_tooltip, @@ -1520,10 +1509,10 @@ impl<'a> Widget for Diary<'a> { if create_skill_button( self.imgs.physical_damage_skill, state.skills_bot_l[2], - &self.stats.skill_set, + &self.skill_set, skill, self.fonts, - &get_skill_label(skill, &self.stats.skill_set), + &get_skill_label(skill, &self.skill_set), ) .with_tooltip( self.tooltip_manager, @@ -1531,7 +1520,7 @@ impl<'a> Widget for Diary<'a> { &add_sp_cost_tooltip( &self.localized_strings.get("hud.skill.sw_spin_spd"), skill, - &self.stats.skill_set, + &self.skill_set, &self.localized_strings, ), &diary_tooltip, @@ -1546,10 +1535,10 @@ impl<'a> Widget for Diary<'a> { if create_skill_button( self.imgs.physical_cost_skill, state.skills_bot_l[3], - &self.stats.skill_set, + &self.skill_set, skill, self.fonts, - &get_skill_label(skill, &self.stats.skill_set), + &get_skill_label(skill, &self.skill_set), ) .with_tooltip( self.tooltip_manager, @@ -1557,7 +1546,7 @@ impl<'a> Widget for Diary<'a> { &add_sp_cost_tooltip( &self.localized_strings.get("hud.skill.sw_spin_cost"), skill, - &self.stats.skill_set, + &self.skill_set, &self.localized_strings, ), &diary_tooltip, @@ -1572,10 +1561,10 @@ impl<'a> Widget for Diary<'a> { if create_skill_button( self.imgs.physical_amount_skill, state.skills_bot_l[4], - &self.stats.skill_set, + &self.skill_set, skill, self.fonts, - &get_skill_label(skill, &self.stats.skill_set), + &get_skill_label(skill, &self.skill_set), ) .with_tooltip( self.tooltip_manager, @@ -1583,7 +1572,7 @@ impl<'a> Widget for Diary<'a> { &add_sp_cost_tooltip( &self.localized_strings.get("hud.skill.sw_spin_spins"), skill, - &self.stats.skill_set, + &self.skill_set, &self.localized_strings, ), &diary_tooltip, @@ -1599,10 +1588,10 @@ impl<'a> Widget for Diary<'a> { if create_skill_button( self.imgs.physical_damage_skill, state.skills_bot_r[0], - &self.stats.skill_set, + &self.skill_set, skill, self.fonts, - &get_skill_label(skill, &self.stats.skill_set), + &get_skill_label(skill, &self.skill_set), ) .with_tooltip( self.tooltip_manager, @@ -1610,7 +1599,7 @@ impl<'a> Widget for Diary<'a> { &add_sp_cost_tooltip( &self.localized_strings.get("hud.skill.sw_interrupt"), skill, - &self.stats.skill_set, + &self.skill_set, &self.localized_strings, ), &diary_tooltip, @@ -1656,10 +1645,10 @@ impl<'a> Widget for Diary<'a> { if create_skill_button( self.imgs.physical_combo_skill, state.skills_top_l[1], - &self.stats.skill_set, + &self.skill_set, skill, self.fonts, - &get_skill_label(skill, &self.stats.skill_set), + &get_skill_label(skill, &self.skill_set), ) .with_tooltip( self.tooltip_manager, @@ -1671,7 +1660,7 @@ impl<'a> Widget for Diary<'a> { .localized_strings .get("hud.skill.axe_double_strike_combo"), skill, - &self.stats.skill_set, + &self.skill_set, &self.localized_strings, ), &diary_tooltip, @@ -1686,10 +1675,10 @@ impl<'a> Widget for Diary<'a> { if create_skill_button( self.imgs.physical_damage_skill, state.skills_top_l[2], - &self.stats.skill_set, + &self.skill_set, skill, self.fonts, - &get_skill_label(skill, &self.stats.skill_set), + &get_skill_label(skill, &self.skill_set), ) .with_tooltip( self.tooltip_manager, @@ -1701,7 +1690,7 @@ impl<'a> Widget for Diary<'a> { .localized_strings .get("hud.skill.axe_double_strike_damage"), skill, - &self.stats.skill_set, + &self.skill_set, &self.localized_strings, ), &diary_tooltip, @@ -1716,10 +1705,10 @@ impl<'a> Widget for Diary<'a> { if create_skill_button( self.imgs.physical_speed_skill, state.skills_top_l[3], - &self.stats.skill_set, + &self.skill_set, skill, self.fonts, - &get_skill_label(skill, &self.stats.skill_set), + &get_skill_label(skill, &self.skill_set), ) .with_tooltip( self.tooltip_manager, @@ -1731,7 +1720,7 @@ impl<'a> Widget for Diary<'a> { .localized_strings .get("hud.skill.axe_double_strike_speed"), skill, - &self.stats.skill_set, + &self.skill_set, &self.localized_strings, ), &diary_tooltip, @@ -1746,10 +1735,10 @@ impl<'a> Widget for Diary<'a> { if create_skill_button( self.imgs.physical_energy_regen_skill, state.skills_top_l[4], - &self.stats.skill_set, + &self.skill_set, skill, self.fonts, - &get_skill_label(skill, &self.stats.skill_set), + &get_skill_label(skill, &self.skill_set), ) .with_tooltip( self.tooltip_manager, @@ -1761,7 +1750,7 @@ impl<'a> Widget for Diary<'a> { .localized_strings .get("hud.skill.axe_double_strike_regen"), skill, - &self.stats.skill_set, + &self.skill_set, &self.localized_strings, ), &diary_tooltip, @@ -1788,10 +1777,10 @@ impl<'a> Widget for Diary<'a> { if create_skill_button( self.imgs.physical_infinite_skill, state.skills_top_r[1], - &self.stats.skill_set, + &self.skill_set, skill, self.fonts, - &get_skill_label(skill, &self.stats.skill_set), + &get_skill_label(skill, &self.skill_set), ) .with_tooltip( self.tooltip_manager, @@ -1803,7 +1792,7 @@ impl<'a> Widget for Diary<'a> { .localized_strings .get("hud.skill.axe_infinite_axe_spin"), skill, - &self.stats.skill_set, + &self.skill_set, &self.localized_strings, ), &diary_tooltip, @@ -1818,10 +1807,10 @@ impl<'a> Widget for Diary<'a> { if create_skill_button( self.imgs.physical_damage_skill, state.skills_top_r[2], - &self.stats.skill_set, + &self.skill_set, skill, self.fonts, - &get_skill_label(skill, &self.stats.skill_set), + &get_skill_label(skill, &self.skill_set), ) .with_tooltip( self.tooltip_manager, @@ -1831,7 +1820,7 @@ impl<'a> Widget for Diary<'a> { &add_sp_cost_tooltip( &self.localized_strings.get("hud.skill.axe_spin_damage"), skill, - &self.stats.skill_set, + &self.skill_set, &self.localized_strings, ), &diary_tooltip, @@ -1846,10 +1835,10 @@ impl<'a> Widget for Diary<'a> { if create_skill_button( self.imgs.physical_helicopter_skill, state.skills_top_r[3], - &self.stats.skill_set, + &self.skill_set, skill, self.fonts, - &get_skill_label(skill, &self.stats.skill_set), + &get_skill_label(skill, &self.skill_set), ) .with_tooltip( self.tooltip_manager, @@ -1859,7 +1848,7 @@ impl<'a> Widget for Diary<'a> { &add_sp_cost_tooltip( &self.localized_strings.get("hud.skill.axe_spin_helicopter"), skill, - &self.stats.skill_set, + &self.skill_set, &self.localized_strings, ), &diary_tooltip, @@ -1874,10 +1863,10 @@ impl<'a> Widget for Diary<'a> { if create_skill_button( self.imgs.physical_speed_skill, state.skills_top_r[4], - &self.stats.skill_set, + &self.skill_set, skill, self.fonts, - &get_skill_label(skill, &self.stats.skill_set), + &get_skill_label(skill, &self.skill_set), ) .with_tooltip( self.tooltip_manager, @@ -1885,7 +1874,7 @@ impl<'a> Widget for Diary<'a> { &add_sp_cost_tooltip( &self.localized_strings.get("hud.skill.axe_spin_speed"), skill, - &self.stats.skill_set, + &self.skill_set, &self.localized_strings, ), &diary_tooltip, @@ -1900,10 +1889,10 @@ impl<'a> Widget for Diary<'a> { if create_skill_button( self.imgs.physical_cost_skill, state.skills_top_r[5], - &self.stats.skill_set, + &self.skill_set, skill, self.fonts, - &get_skill_label(skill, &self.stats.skill_set), + &get_skill_label(skill, &self.skill_set), ) .with_tooltip( self.tooltip_manager, @@ -1911,7 +1900,7 @@ impl<'a> Widget for Diary<'a> { &add_sp_cost_tooltip( &self.localized_strings.get("hud.skill.axe_spin_cost"), skill, - &self.stats.skill_set, + &self.skill_set, &self.localized_strings, ), &diary_tooltip, @@ -1927,10 +1916,10 @@ impl<'a> Widget for Diary<'a> { if create_skill_button( self.imgs.skill_axe_leap_slash, state.skills_bot_l[0], - &self.stats.skill_set, + &self.skill_set, skill, self.fonts, - &get_skill_label(skill, &self.stats.skill_set), + &get_skill_label(skill, &self.skill_set), ) .with_tooltip( self.tooltip_manager, @@ -1940,7 +1929,7 @@ impl<'a> Widget for Diary<'a> { &add_sp_cost_tooltip( &self.localized_strings.get("hud.skill.axe_unlock_leap"), skill, - &self.stats.skill_set, + &self.skill_set, &self.localized_strings, ), &diary_tooltip, @@ -1955,10 +1944,10 @@ impl<'a> Widget for Diary<'a> { if create_skill_button( self.imgs.physical_damage_skill, state.skills_bot_l[1], - &self.stats.skill_set, + &self.skill_set, skill, self.fonts, - &get_skill_label(skill, &self.stats.skill_set), + &get_skill_label(skill, &self.skill_set), ) .with_tooltip( self.tooltip_manager, @@ -1968,7 +1957,7 @@ impl<'a> Widget for Diary<'a> { &add_sp_cost_tooltip( &self.localized_strings.get("hud.skill.axe_leap_damage"), skill, - &self.stats.skill_set, + &self.skill_set, &self.localized_strings, ), &diary_tooltip, @@ -1983,10 +1972,10 @@ impl<'a> Widget for Diary<'a> { if create_skill_button( self.imgs.physical_knockback_skill, state.skills_bot_l[2], - &self.stats.skill_set, + &self.skill_set, skill, self.fonts, - &get_skill_label(skill, &self.stats.skill_set), + &get_skill_label(skill, &self.skill_set), ) .with_tooltip( self.tooltip_manager, @@ -1996,7 +1985,7 @@ impl<'a> Widget for Diary<'a> { &add_sp_cost_tooltip( &self.localized_strings.get("hud.skill.axe_leap_knockback"), skill, - &self.stats.skill_set, + &self.skill_set, &self.localized_strings, ), &diary_tooltip, @@ -2011,10 +2000,10 @@ impl<'a> Widget for Diary<'a> { if create_skill_button( self.imgs.physical_cost_skill, state.skills_bot_l[3], - &self.stats.skill_set, + &self.skill_set, skill, self.fonts, - &get_skill_label(skill, &self.stats.skill_set), + &get_skill_label(skill, &self.skill_set), ) .with_tooltip( self.tooltip_manager, @@ -2022,7 +2011,7 @@ impl<'a> Widget for Diary<'a> { &add_sp_cost_tooltip( &self.localized_strings.get("hud.skill.axe_leap_cost"), skill, - &self.stats.skill_set, + &self.skill_set, &self.localized_strings, ), &diary_tooltip, @@ -2037,10 +2026,10 @@ impl<'a> Widget for Diary<'a> { if create_skill_button( self.imgs.physical_distance_skill, state.skills_bot_l[4], - &self.stats.skill_set, + &self.skill_set, skill, self.fonts, - &get_skill_label(skill, &self.stats.skill_set), + &get_skill_label(skill, &self.skill_set), ) .with_tooltip( self.tooltip_manager, @@ -2050,7 +2039,7 @@ impl<'a> Widget for Diary<'a> { &add_sp_cost_tooltip( &self.localized_strings.get("hud.skill.axe_leap_distance"), skill, - &self.stats.skill_set, + &self.skill_set, &self.localized_strings, ), &diary_tooltip, @@ -2096,10 +2085,10 @@ impl<'a> Widget for Diary<'a> { if create_skill_button( self.imgs.physical_knockback_skill, state.skills_top_l[1], - &self.stats.skill_set, + &self.skill_set, skill, self.fonts, - &get_skill_label(skill, &self.stats.skill_set), + &get_skill_label(skill, &self.skill_set), ) .with_tooltip( self.tooltip_manager, @@ -2111,7 +2100,7 @@ impl<'a> Widget for Diary<'a> { .localized_strings .get("hud.skill.hmr_single_strike_knockback"), skill, - &self.stats.skill_set, + &self.skill_set, &self.localized_strings, ), &diary_tooltip, @@ -2126,10 +2115,10 @@ impl<'a> Widget for Diary<'a> { if create_skill_button( self.imgs.physical_damage_skill, state.skills_top_l[2], - &self.stats.skill_set, + &self.skill_set, skill, self.fonts, - &get_skill_label(skill, &self.stats.skill_set), + &get_skill_label(skill, &self.skill_set), ) .with_tooltip( self.tooltip_manager, @@ -2141,7 +2130,7 @@ impl<'a> Widget for Diary<'a> { .localized_strings .get("hud.skill.hmr_single_strike_damage"), skill, - &self.stats.skill_set, + &self.skill_set, &self.localized_strings, ), &diary_tooltip, @@ -2156,10 +2145,10 @@ impl<'a> Widget for Diary<'a> { if create_skill_button( self.imgs.physical_speed_skill, state.skills_top_l[3], - &self.stats.skill_set, + &self.skill_set, skill, self.fonts, - &get_skill_label(skill, &self.stats.skill_set), + &get_skill_label(skill, &self.skill_set), ) .with_tooltip( self.tooltip_manager, @@ -2171,7 +2160,7 @@ impl<'a> Widget for Diary<'a> { .localized_strings .get("hud.skill.hmr_single_strike_speed"), skill, - &self.stats.skill_set, + &self.skill_set, &self.localized_strings, ), &diary_tooltip, @@ -2186,10 +2175,10 @@ impl<'a> Widget for Diary<'a> { if create_skill_button( self.imgs.physical_energy_regen_skill, state.skills_top_l[4], - &self.stats.skill_set, + &self.skill_set, skill, self.fonts, - &get_skill_label(skill, &self.stats.skill_set), + &get_skill_label(skill, &self.skill_set), ) .with_tooltip( self.tooltip_manager, @@ -2201,7 +2190,7 @@ impl<'a> Widget for Diary<'a> { .localized_strings .get("hud.skill.hmr_single_strike_regen"), skill, - &self.stats.skill_set, + &self.skill_set, &self.localized_strings, ), &diary_tooltip, @@ -2230,10 +2219,10 @@ impl<'a> Widget for Diary<'a> { if create_skill_button( self.imgs.physical_knockback_skill, state.skills_top_r[1], - &self.stats.skill_set, + &self.skill_set, skill, self.fonts, - &get_skill_label(skill, &self.stats.skill_set), + &get_skill_label(skill, &self.skill_set), ) .with_tooltip( self.tooltip_manager, @@ -2245,7 +2234,7 @@ impl<'a> Widget for Diary<'a> { .localized_strings .get("hud.skill.hmr_charged_melee_knockback"), skill, - &self.stats.skill_set, + &self.skill_set, &self.localized_strings, ), &diary_tooltip, @@ -2260,10 +2249,10 @@ impl<'a> Widget for Diary<'a> { if create_skill_button( self.imgs.physical_damage_skill, state.skills_top_r[2], - &self.stats.skill_set, + &self.skill_set, skill, self.fonts, - &get_skill_label(skill, &self.stats.skill_set), + &get_skill_label(skill, &self.skill_set), ) .with_tooltip( self.tooltip_manager, @@ -2275,7 +2264,7 @@ impl<'a> Widget for Diary<'a> { .localized_strings .get("hud.skill.hmr_charged_melee_damage"), skill, - &self.stats.skill_set, + &self.skill_set, &self.localized_strings, ), &diary_tooltip, @@ -2290,10 +2279,10 @@ impl<'a> Widget for Diary<'a> { if create_skill_button( self.imgs.physical_energy_drain_skill, state.skills_top_r[3], - &self.stats.skill_set, + &self.skill_set, skill, self.fonts, - &get_skill_label(skill, &self.stats.skill_set), + &get_skill_label(skill, &self.skill_set), ) .with_tooltip( self.tooltip_manager, @@ -2305,7 +2294,7 @@ impl<'a> Widget for Diary<'a> { .localized_strings .get("hud.skill.hmr_charged_melee_nrg_drain"), skill, - &self.stats.skill_set, + &self.skill_set, &self.localized_strings, ), &diary_tooltip, @@ -2320,10 +2309,10 @@ impl<'a> Widget for Diary<'a> { if create_skill_button( self.imgs.physical_amount_skill, state.skills_top_r[4], - &self.stats.skill_set, + &self.skill_set, skill, self.fonts, - &get_skill_label(skill, &self.stats.skill_set), + &get_skill_label(skill, &self.skill_set), ) .with_tooltip( self.tooltip_manager, @@ -2333,7 +2322,7 @@ impl<'a> Widget for Diary<'a> { &add_sp_cost_tooltip( &self.localized_strings.get("hud.skill.hmr_charged_rate"), skill, - &self.stats.skill_set, + &self.skill_set, &self.localized_strings, ), &diary_tooltip, @@ -2349,10 +2338,10 @@ impl<'a> Widget for Diary<'a> { if create_skill_button( self.imgs.hammerleap, state.skills_bot_l[0], - &self.stats.skill_set, + &self.skill_set, skill, self.fonts, - &get_skill_label(skill, &self.stats.skill_set), + &get_skill_label(skill, &self.skill_set), ) .with_tooltip( self.tooltip_manager, @@ -2362,7 +2351,7 @@ impl<'a> Widget for Diary<'a> { &add_sp_cost_tooltip( &self.localized_strings.get("hud.skill.hmr_unlock_leap"), skill, - &self.stats.skill_set, + &self.skill_set, &self.localized_strings, ), &diary_tooltip, @@ -2377,10 +2366,10 @@ impl<'a> Widget for Diary<'a> { if create_skill_button( self.imgs.physical_damage_skill, state.skills_bot_l[1], - &self.stats.skill_set, + &self.skill_set, skill, self.fonts, - &get_skill_label(skill, &self.stats.skill_set), + &get_skill_label(skill, &self.skill_set), ) .with_tooltip( self.tooltip_manager, @@ -2390,7 +2379,7 @@ impl<'a> Widget for Diary<'a> { &add_sp_cost_tooltip( &self.localized_strings.get("hud.skill.hmr_leap_damage"), skill, - &self.stats.skill_set, + &self.skill_set, &self.localized_strings, ), &diary_tooltip, @@ -2405,10 +2394,10 @@ impl<'a> Widget for Diary<'a> { if create_skill_button( self.imgs.physical_knockback_skill, state.skills_bot_l[2], - &self.stats.skill_set, + &self.skill_set, skill, self.fonts, - &get_skill_label(skill, &self.stats.skill_set), + &get_skill_label(skill, &self.skill_set), ) .with_tooltip( self.tooltip_manager, @@ -2418,7 +2407,7 @@ impl<'a> Widget for Diary<'a> { &add_sp_cost_tooltip( &self.localized_strings.get("hud.skill.hmr_leap_knockback"), skill, - &self.stats.skill_set, + &self.skill_set, &self.localized_strings, ), &diary_tooltip, @@ -2433,10 +2422,10 @@ impl<'a> Widget for Diary<'a> { if create_skill_button( self.imgs.physical_cost_skill, state.skills_bot_l[3], - &self.stats.skill_set, + &self.skill_set, skill, self.fonts, - &get_skill_label(skill, &self.stats.skill_set), + &get_skill_label(skill, &self.skill_set), ) .with_tooltip( self.tooltip_manager, @@ -2444,7 +2433,7 @@ impl<'a> Widget for Diary<'a> { &add_sp_cost_tooltip( &self.localized_strings.get("hud.skill.hmr_leap_cost"), skill, - &self.stats.skill_set, + &self.skill_set, &self.localized_strings, ), &diary_tooltip, @@ -2459,10 +2448,10 @@ impl<'a> Widget for Diary<'a> { if create_skill_button( self.imgs.physical_distance_skill, state.skills_bot_l[4], - &self.stats.skill_set, + &self.skill_set, skill, self.fonts, - &get_skill_label(skill, &self.stats.skill_set), + &get_skill_label(skill, &self.skill_set), ) .with_tooltip( self.tooltip_manager, @@ -2472,7 +2461,7 @@ impl<'a> Widget for Diary<'a> { &add_sp_cost_tooltip( &self.localized_strings.get("hud.skill.hmr_leap_distance"), skill, - &self.stats.skill_set, + &self.skill_set, &self.localized_strings, ), &diary_tooltip, @@ -2487,10 +2476,10 @@ impl<'a> Widget for Diary<'a> { if create_skill_button( self.imgs.physical_radius_skill, state.skills_bot_l[5], - &self.stats.skill_set, + &self.skill_set, skill, self.fonts, - &get_skill_label(skill, &self.stats.skill_set), + &get_skill_label(skill, &self.skill_set), ) .with_tooltip( self.tooltip_manager, @@ -2500,7 +2489,7 @@ impl<'a> Widget for Diary<'a> { &add_sp_cost_tooltip( &self.localized_strings.get("hud.skill.hmr_leap_radius"), skill, - &self.stats.skill_set, + &self.skill_set, &self.localized_strings, ), &diary_tooltip, @@ -2543,10 +2532,10 @@ impl<'a> Widget for Diary<'a> { if create_skill_button( self.imgs.physical_damage_skill, state.skills_top_l[1], - &self.stats.skill_set, + &self.skill_set, skill, self.fonts, - &get_skill_label(skill, &self.stats.skill_set), + &get_skill_label(skill, &self.skill_set), ) .with_tooltip( self.tooltip_manager, @@ -2554,7 +2543,7 @@ impl<'a> Widget for Diary<'a> { &add_sp_cost_tooltip( &self.localized_strings.get("hud.skill.bow_damage"), skill, - &self.stats.skill_set, + &self.skill_set, &self.localized_strings, ), &diary_tooltip, @@ -2569,10 +2558,10 @@ impl<'a> Widget for Diary<'a> { if create_skill_button( self.imgs.physical_energy_regen_skill, state.skills_top_l[2], - &self.stats.skill_set, + &self.skill_set, skill, self.fonts, - &get_skill_label(skill, &self.stats.skill_set), + &get_skill_label(skill, &self.skill_set), ) .with_tooltip( self.tooltip_manager, @@ -2582,7 +2571,7 @@ impl<'a> Widget for Diary<'a> { &add_sp_cost_tooltip( &self.localized_strings.get("hud.skill.bow_energy_regen"), skill, - &self.stats.skill_set, + &self.skill_set, &self.localized_strings, ), &diary_tooltip, @@ -2609,10 +2598,10 @@ impl<'a> Widget for Diary<'a> { if create_skill_button( self.imgs.physical_damage_skill, state.skills_top_r[1], - &self.stats.skill_set, + &self.skill_set, skill, self.fonts, - &get_skill_label(skill, &self.stats.skill_set), + &get_skill_label(skill, &self.skill_set), ) .with_tooltip( self.tooltip_manager, @@ -2622,7 +2611,7 @@ impl<'a> Widget for Diary<'a> { &add_sp_cost_tooltip( &self.localized_strings.get("hud.skill.bow_charged_damage"), skill, - &self.stats.skill_set, + &self.skill_set, &self.localized_strings, ), &diary_tooltip, @@ -2637,10 +2626,10 @@ impl<'a> Widget for Diary<'a> { if create_skill_button( self.imgs.physical_energy_drain_skill, state.skills_top_r[2], - &self.stats.skill_set, + &self.skill_set, skill, self.fonts, - &get_skill_label(skill, &self.stats.skill_set), + &get_skill_label(skill, &self.skill_set), ) .with_tooltip( self.tooltip_manager, @@ -2650,7 +2639,7 @@ impl<'a> Widget for Diary<'a> { &add_sp_cost_tooltip( &self.localized_strings.get("hud.skill.bow_charged_drain"), skill, - &self.stats.skill_set, + &self.skill_set, &self.localized_strings, ), &diary_tooltip, @@ -2665,10 +2654,10 @@ impl<'a> Widget for Diary<'a> { if create_skill_button( self.imgs.physical_projectile_speed_skill, state.skills_top_r[3], - &self.stats.skill_set, + &self.skill_set, skill, self.fonts, - &get_skill_label(skill, &self.stats.skill_set), + &get_skill_label(skill, &self.skill_set), ) .with_tooltip( self.tooltip_manager, @@ -2680,7 +2669,7 @@ impl<'a> Widget for Diary<'a> { .localized_strings .get("hud.skill.bow_charged_projectile_speed"), skill, - &self.stats.skill_set, + &self.skill_set, &self.localized_strings, ), &diary_tooltip, @@ -2695,10 +2684,10 @@ impl<'a> Widget for Diary<'a> { if create_skill_button( self.imgs.physical_speed_skill, state.skills_top_r[4], - &self.stats.skill_set, + &self.skill_set, skill, self.fonts, - &get_skill_label(skill, &self.stats.skill_set), + &get_skill_label(skill, &self.skill_set), ) .with_tooltip( self.tooltip_manager, @@ -2708,7 +2697,7 @@ impl<'a> Widget for Diary<'a> { &add_sp_cost_tooltip( &self.localized_strings.get("hud.skill.bow_charged_speed"), skill, - &self.stats.skill_set, + &self.skill_set, &self.localized_strings, ), &diary_tooltip, @@ -2723,10 +2712,10 @@ impl<'a> Widget for Diary<'a> { if create_skill_button( self.imgs.physical_speed_skill, state.skills_top_r[5], - &self.stats.skill_set, + &self.skill_set, skill, self.fonts, - &get_skill_label(skill, &self.stats.skill_set), + &get_skill_label(skill, &self.skill_set), ) .with_tooltip( self.tooltip_manager, @@ -2738,7 +2727,7 @@ impl<'a> Widget for Diary<'a> { .localized_strings .get("hud.skill.bow_charged_move_speed"), skill, - &self.stats.skill_set, + &self.skill_set, &self.localized_strings, ), &diary_tooltip, @@ -2753,10 +2742,10 @@ impl<'a> Widget for Diary<'a> { if create_skill_button( self.imgs.physical_knockback_skill, state.skills_top_r[6], - &self.stats.skill_set, + &self.skill_set, skill, self.fonts, - &get_skill_label(skill, &self.stats.skill_set), + &get_skill_label(skill, &self.skill_set), ) .with_tooltip( self.tooltip_manager, @@ -2768,7 +2757,7 @@ impl<'a> Widget for Diary<'a> { .localized_strings .get("hud.skill.bow_charged_knockback"), skill, - &self.stats.skill_set, + &self.skill_set, &self.localized_strings, ), &diary_tooltip, @@ -2784,10 +2773,10 @@ impl<'a> Widget for Diary<'a> { if create_skill_button( self.imgs.skill_bow_jump_burst, state.skills_bot_l[0], - &self.stats.skill_set, + &self.skill_set, skill, self.fonts, - &get_skill_label(skill, &self.stats.skill_set), + &get_skill_label(skill, &self.skill_set), ) .with_tooltip( self.tooltip_manager, @@ -2797,7 +2786,7 @@ impl<'a> Widget for Diary<'a> { &add_sp_cost_tooltip( &self.localized_strings.get("hud.skill.bow_repeater_unlock"), skill, - &self.stats.skill_set, + &self.skill_set, &self.localized_strings, ), &diary_tooltip, @@ -2812,10 +2801,10 @@ impl<'a> Widget for Diary<'a> { if create_skill_button( self.imgs.physical_damage_skill, state.skills_bot_l[1], - &self.stats.skill_set, + &self.skill_set, skill, self.fonts, - &get_skill_label(skill, &self.stats.skill_set), + &get_skill_label(skill, &self.skill_set), ) .with_tooltip( self.tooltip_manager, @@ -2825,7 +2814,7 @@ impl<'a> Widget for Diary<'a> { &add_sp_cost_tooltip( &self.localized_strings.get("hud.skill.bow_repeater_damage"), skill, - &self.stats.skill_set, + &self.skill_set, &self.localized_strings, ), &diary_tooltip, @@ -2840,10 +2829,10 @@ impl<'a> Widget for Diary<'a> { if create_skill_button( self.imgs.physical_helicopter_skill, state.skills_bot_l[2], - &self.stats.skill_set, + &self.skill_set, skill, self.fonts, - &get_skill_label(skill, &self.stats.skill_set), + &get_skill_label(skill, &self.skill_set), ) .with_tooltip( self.tooltip_manager, @@ -2853,7 +2842,7 @@ impl<'a> Widget for Diary<'a> { &add_sp_cost_tooltip( &self.localized_strings.get("hud.skill.bow_repeater_glide"), skill, - &self.stats.skill_set, + &self.skill_set, &self.localized_strings, ), &diary_tooltip, @@ -2868,10 +2857,10 @@ impl<'a> Widget for Diary<'a> { if create_skill_button( self.imgs.physical_cost_skill, state.skills_bot_l[3], - &self.stats.skill_set, + &self.skill_set, skill, self.fonts, - &get_skill_label(skill, &self.stats.skill_set), + &get_skill_label(skill, &self.skill_set), ) .with_tooltip( self.tooltip_manager, @@ -2881,7 +2870,7 @@ impl<'a> Widget for Diary<'a> { &add_sp_cost_tooltip( &self.localized_strings.get("hud.skill.bow_repeater_cost"), skill, - &self.stats.skill_set, + &self.skill_set, &self.localized_strings, ), &diary_tooltip, @@ -2896,10 +2885,10 @@ impl<'a> Widget for Diary<'a> { if create_skill_button( self.imgs.physical_amount_skill, state.skills_bot_l[4], - &self.stats.skill_set, + &self.skill_set, skill, self.fonts, - &get_skill_label(skill, &self.stats.skill_set), + &get_skill_label(skill, &self.skill_set), ) .with_tooltip( self.tooltip_manager, @@ -2909,7 +2898,7 @@ impl<'a> Widget for Diary<'a> { &add_sp_cost_tooltip( &self.localized_strings.get("hud.skill.bow_arrow_count"), skill, - &self.stats.skill_set, + &self.skill_set, &self.localized_strings, ), &diary_tooltip, @@ -2925,10 +2914,10 @@ impl<'a> Widget for Diary<'a> { if create_skill_button( self.imgs.physical_projectile_speed_skill, state.skills_bot_r[0], - &self.stats.skill_set, + &self.skill_set, skill, self.fonts, - &get_skill_label(skill, &self.stats.skill_set), + &get_skill_label(skill, &self.skill_set), ) .with_tooltip( self.tooltip_manager, @@ -2938,7 +2927,7 @@ impl<'a> Widget for Diary<'a> { &add_sp_cost_tooltip( &self.localized_strings.get("hud.skill.bow_projectile_speed"), skill, - &self.stats.skill_set, + &self.skill_set, &self.localized_strings, ), &diary_tooltip, @@ -2982,10 +2971,10 @@ impl<'a> Widget for Diary<'a> { if create_skill_button( self.imgs.magic_explosion_skill, state.skills_top_l[1], - &self.stats.skill_set, + &self.skill_set, skill, self.fonts, - &get_skill_label(skill, &self.stats.skill_set), + &get_skill_label(skill, &self.skill_set), ) .with_tooltip( self.tooltip_manager, @@ -2993,7 +2982,7 @@ impl<'a> Widget for Diary<'a> { &add_sp_cost_tooltip( &self.localized_strings.get("hud.skill.st_explosion"), skill, - &self.stats.skill_set, + &self.skill_set, &self.localized_strings, ), &diary_tooltip, @@ -3008,10 +2997,10 @@ impl<'a> Widget for Diary<'a> { if create_skill_button( self.imgs.magic_damage_skill, state.skills_top_l[2], - &self.stats.skill_set, + &self.skill_set, skill, self.fonts, - &get_skill_label(skill, &self.stats.skill_set), + &get_skill_label(skill, &self.skill_set), ) .with_tooltip( self.tooltip_manager, @@ -3019,7 +3008,7 @@ impl<'a> Widget for Diary<'a> { &add_sp_cost_tooltip( &self.localized_strings.get("hud.skill.st_damage"), skill, - &self.stats.skill_set, + &self.skill_set, &self.localized_strings, ), &diary_tooltip, @@ -3034,10 +3023,10 @@ impl<'a> Widget for Diary<'a> { if create_skill_button( self.imgs.magic_energy_regen_skill, state.skills_top_l[3], - &self.stats.skill_set, + &self.skill_set, skill, self.fonts, - &get_skill_label(skill, &self.stats.skill_set), + &get_skill_label(skill, &self.skill_set), ) .with_tooltip( self.tooltip_manager, @@ -3047,7 +3036,7 @@ impl<'a> Widget for Diary<'a> { &add_sp_cost_tooltip( &self.localized_strings.get("hud.skill.st_stamina_regen"), skill, - &self.stats.skill_set, + &self.skill_set, &self.localized_strings, ), &diary_tooltip, @@ -3062,10 +3051,10 @@ impl<'a> Widget for Diary<'a> { if create_skill_button( self.imgs.magic_radius_skill, state.skills_top_l[4], - &self.stats.skill_set, + &self.skill_set, skill, self.fonts, - &get_skill_label(skill, &self.stats.skill_set), + &get_skill_label(skill, &self.skill_set), ) .with_tooltip( self.tooltip_manager, @@ -3075,7 +3064,7 @@ impl<'a> Widget for Diary<'a> { &add_sp_cost_tooltip( &self.localized_strings.get("hud.skill.st_explosion_radius"), skill, - &self.stats.skill_set, + &self.skill_set, &self.localized_strings, ), &diary_tooltip, @@ -3104,10 +3093,10 @@ impl<'a> Widget for Diary<'a> { if create_skill_button( self.imgs.magic_damage_skill, state.skills_top_r[1], - &self.stats.skill_set, + &self.skill_set, skill, self.fonts, - &get_skill_label(skill, &self.stats.skill_set), + &get_skill_label(skill, &self.skill_set), ) .with_tooltip( self.tooltip_manager, @@ -3119,7 +3108,7 @@ impl<'a> Widget for Diary<'a> { .localized_strings .get("hud.skill.st_flamethrower_damage"), skill, - &self.stats.skill_set, + &self.skill_set, &self.localized_strings, ), &diary_tooltip, @@ -3134,10 +3123,10 @@ impl<'a> Widget for Diary<'a> { if create_skill_button( self.imgs.magic_energy_drain_skill, state.skills_top_r[2], - &self.stats.skill_set, + &self.skill_set, skill, self.fonts, - &get_skill_label(skill, &self.stats.skill_set), + &get_skill_label(skill, &self.skill_set), ) .with_tooltip( self.tooltip_manager, @@ -3147,7 +3136,7 @@ impl<'a> Widget for Diary<'a> { &add_sp_cost_tooltip( &self.localized_strings.get("hud.skill.st_energy_drain"), skill, - &self.stats.skill_set, + &self.skill_set, &self.localized_strings, ), &diary_tooltip, @@ -3162,10 +3151,10 @@ impl<'a> Widget for Diary<'a> { if create_skill_button( self.imgs.magic_radius_skill, state.skills_top_r[3], - &self.stats.skill_set, + &self.skill_set, skill, self.fonts, - &get_skill_label(skill, &self.stats.skill_set), + &get_skill_label(skill, &self.skill_set), ) .with_tooltip( self.tooltip_manager, @@ -3177,7 +3166,7 @@ impl<'a> Widget for Diary<'a> { .localized_strings .get("hud.skill.st_flamethrower_range"), skill, - &self.stats.skill_set, + &self.skill_set, &self.localized_strings, ), &diary_tooltip, @@ -3192,10 +3181,10 @@ impl<'a> Widget for Diary<'a> { if create_skill_button( self.imgs.magic_projectile_speed_skill, state.skills_top_r[4], - &self.stats.skill_set, + &self.skill_set, skill, self.fonts, - &get_skill_label(skill, &self.stats.skill_set), + &get_skill_label(skill, &self.skill_set), ) .with_tooltip( self.tooltip_manager, @@ -3205,7 +3194,7 @@ impl<'a> Widget for Diary<'a> { &add_sp_cost_tooltip( &self.localized_strings.get("hud.skill.st_flame_velocity"), skill, - &self.stats.skill_set, + &self.skill_set, &self.localized_strings, ), &diary_tooltip, @@ -3221,10 +3210,10 @@ impl<'a> Widget for Diary<'a> { if create_skill_button( self.imgs.fire_aoe, state.skills_bot_l[0], - &self.stats.skill_set, + &self.skill_set, skill, self.fonts, - &get_skill_label(skill, &self.stats.skill_set), + &get_skill_label(skill, &self.skill_set), ) .with_tooltip( self.tooltip_manager, @@ -3234,7 +3223,7 @@ impl<'a> Widget for Diary<'a> { &add_sp_cost_tooltip( &self.localized_strings.get("hud.skill.st_shockwave_unlock"), skill, - &self.stats.skill_set, + &self.skill_set, &self.localized_strings, ), &diary_tooltip, @@ -3249,10 +3238,10 @@ impl<'a> Widget for Diary<'a> { if create_skill_button( self.imgs.magic_damage_skill, state.skills_bot_l[1], - &self.stats.skill_set, + &self.skill_set, skill, self.fonts, - &get_skill_label(skill, &self.stats.skill_set), + &get_skill_label(skill, &self.skill_set), ) .with_tooltip( self.tooltip_manager, @@ -3262,7 +3251,7 @@ impl<'a> Widget for Diary<'a> { &add_sp_cost_tooltip( &self.localized_strings.get("hud.skill.st_shockwave_damage"), skill, - &self.stats.skill_set, + &self.skill_set, &self.localized_strings, ), &diary_tooltip, @@ -3277,10 +3266,10 @@ impl<'a> Widget for Diary<'a> { if create_skill_button( self.imgs.magic_knockback_skill, state.skills_bot_l[2], - &self.stats.skill_set, + &self.skill_set, skill, self.fonts, - &get_skill_label(skill, &self.stats.skill_set), + &get_skill_label(skill, &self.skill_set), ) .with_tooltip( self.tooltip_manager, @@ -3292,7 +3281,7 @@ impl<'a> Widget for Diary<'a> { .localized_strings .get("hud.skill.st_shockwave_knockback"), skill, - &self.stats.skill_set, + &self.skill_set, &self.localized_strings, ), &diary_tooltip, @@ -3307,10 +3296,10 @@ impl<'a> Widget for Diary<'a> { if create_skill_button( self.imgs.magic_cost_skill, state.skills_bot_l[3], - &self.stats.skill_set, + &self.skill_set, skill, self.fonts, - &get_skill_label(skill, &self.stats.skill_set), + &get_skill_label(skill, &self.skill_set), ) .with_tooltip( self.tooltip_manager, @@ -3320,7 +3309,7 @@ impl<'a> Widget for Diary<'a> { &add_sp_cost_tooltip( &self.localized_strings.get("hud.skill.st_shockwave_cost"), skill, - &self.stats.skill_set, + &self.skill_set, &self.localized_strings, ), &diary_tooltip, @@ -3335,10 +3324,10 @@ impl<'a> Widget for Diary<'a> { if create_skill_button( self.imgs.magic_radius_skill, state.skills_bot_l[4], - &self.stats.skill_set, + &self.skill_set, skill, self.fonts, - &get_skill_label(skill, &self.stats.skill_set), + &get_skill_label(skill, &self.skill_set), ) .with_tooltip( self.tooltip_manager, @@ -3348,7 +3337,7 @@ impl<'a> Widget for Diary<'a> { &add_sp_cost_tooltip( &self.localized_strings.get("hud.skill.st_shockwave_range"), skill, - &self.stats.skill_set, + &self.skill_set, &self.localized_strings, ), &diary_tooltip, @@ -3392,10 +3381,10 @@ impl<'a> Widget for Diary<'a> { if create_skill_button( self.imgs.magic_damage_skill, state.skills_top_l[1], - &self.stats.skill_set, + &self.skill_set, skill, self.fonts, - &get_skill_label(skill, &self.stats.skill_set), + &get_skill_label(skill, &self.skill_set), ) .with_tooltip( self.tooltip_manager, @@ -3405,7 +3394,7 @@ impl<'a> Widget for Diary<'a> { &add_sp_cost_tooltip( &self.localized_strings.get("hud.skill.sc_lifesteal_damage"), skill, - &self.stats.skill_set, + &self.skill_set, &self.localized_strings, ), &diary_tooltip, @@ -3420,10 +3409,10 @@ impl<'a> Widget for Diary<'a> { if create_skill_button( self.imgs.magic_distance_skill, state.skills_top_l[2], - &self.stats.skill_set, + &self.skill_set, skill, self.fonts, - &get_skill_label(skill, &self.stats.skill_set), + &get_skill_label(skill, &self.skill_set), ) .with_tooltip( self.tooltip_manager, @@ -3433,7 +3422,7 @@ impl<'a> Widget for Diary<'a> { &add_sp_cost_tooltip( &self.localized_strings.get("hud.skill.sc_lifesteal_range"), skill, - &self.stats.skill_set, + &self.skill_set, &self.localized_strings, ), &diary_tooltip, @@ -3448,10 +3437,10 @@ impl<'a> Widget for Diary<'a> { if create_skill_button( self.imgs.magic_lifesteal_skill, state.skills_top_l[3], - &self.stats.skill_set, + &self.skill_set, skill, self.fonts, - &get_skill_label(skill, &self.stats.skill_set), + &get_skill_label(skill, &self.skill_set), ) .with_tooltip( self.tooltip_manager, @@ -3463,7 +3452,7 @@ impl<'a> Widget for Diary<'a> { .localized_strings .get("hud.skill.sc_lifesteal_lifesteal"), skill, - &self.stats.skill_set, + &self.skill_set, &self.localized_strings, ), &diary_tooltip, @@ -3478,10 +3467,10 @@ impl<'a> Widget for Diary<'a> { if create_skill_button( self.imgs.magic_energy_regen_skill, state.skills_top_l[4], - &self.stats.skill_set, + &self.skill_set, skill, self.fonts, - &get_skill_label(skill, &self.stats.skill_set), + &get_skill_label(skill, &self.skill_set), ) .with_tooltip( self.tooltip_manager, @@ -3491,7 +3480,7 @@ impl<'a> Widget for Diary<'a> { &add_sp_cost_tooltip( &self.localized_strings.get("hud.skill.sc_lifesteal_regen"), skill, - &self.stats.skill_set, + &self.skill_set, &self.localized_strings, ), &diary_tooltip, @@ -3518,10 +3507,10 @@ impl<'a> Widget for Diary<'a> { if create_skill_button( self.imgs.heal_heal_skill, state.skills_top_r[1], - &self.stats.skill_set, + &self.skill_set, skill, self.fonts, - &get_skill_label(skill, &self.stats.skill_set), + &get_skill_label(skill, &self.skill_set), ) .with_tooltip( self.tooltip_manager, @@ -3529,7 +3518,7 @@ impl<'a> Widget for Diary<'a> { &add_sp_cost_tooltip( &self.localized_strings.get("hud.skill.sc_heal_heal"), skill, - &self.stats.skill_set, + &self.skill_set, &self.localized_strings, ), &diary_tooltip, @@ -3544,10 +3533,10 @@ impl<'a> Widget for Diary<'a> { if create_skill_button( self.imgs.heal_cost_skill, state.skills_top_r[2], - &self.stats.skill_set, + &self.skill_set, skill, self.fonts, - &get_skill_label(skill, &self.stats.skill_set), + &get_skill_label(skill, &self.skill_set), ) .with_tooltip( self.tooltip_manager, @@ -3555,7 +3544,7 @@ impl<'a> Widget for Diary<'a> { &add_sp_cost_tooltip( &self.localized_strings.get("hud.skill.sc_heal_cost"), skill, - &self.stats.skill_set, + &self.skill_set, &self.localized_strings, ), &diary_tooltip, @@ -3570,10 +3559,10 @@ impl<'a> Widget for Diary<'a> { if create_skill_button( self.imgs.heal_distance_skill, state.skills_top_r[3], - &self.stats.skill_set, + &self.skill_set, skill, self.fonts, - &get_skill_label(skill, &self.stats.skill_set), + &get_skill_label(skill, &self.skill_set), ) .with_tooltip( self.tooltip_manager, @@ -3581,7 +3570,7 @@ impl<'a> Widget for Diary<'a> { &add_sp_cost_tooltip( &self.localized_strings.get("hud.skill.sc_heal_range"), skill, - &self.stats.skill_set, + &self.skill_set, &self.localized_strings, ), &diary_tooltip, @@ -3597,10 +3586,10 @@ impl<'a> Widget for Diary<'a> { if create_skill_button( self.imgs.skill_sceptre_aura, state.skills_bot_l[0], - &self.stats.skill_set, + &self.skill_set, skill, self.fonts, - &get_skill_label(skill, &self.stats.skill_set), + &get_skill_label(skill, &self.skill_set), ) .with_tooltip( self.tooltip_manager, @@ -3610,7 +3599,7 @@ impl<'a> Widget for Diary<'a> { &add_sp_cost_tooltip( &self.localized_strings.get("hud.skill.sc_wardaura_unlock"), skill, - &self.stats.skill_set, + &self.skill_set, &self.localized_strings, ), &diary_tooltip, @@ -3625,10 +3614,10 @@ impl<'a> Widget for Diary<'a> { if create_skill_button( self.imgs.buff_damage_skill, state.skills_bot_l[1], - &self.stats.skill_set, + &self.skill_set, skill, self.fonts, - &get_skill_label(skill, &self.stats.skill_set), + &get_skill_label(skill, &self.skill_set), ) .with_tooltip( self.tooltip_manager, @@ -3638,7 +3627,7 @@ impl<'a> Widget for Diary<'a> { &add_sp_cost_tooltip( &self.localized_strings.get("hud.skill.sc_wardaura_strength"), skill, - &self.stats.skill_set, + &self.skill_set, &self.localized_strings, ), &diary_tooltip, @@ -3653,10 +3642,10 @@ impl<'a> Widget for Diary<'a> { if create_skill_button( self.imgs.buff_duration_skill, state.skills_bot_l[2], - &self.stats.skill_set, + &self.skill_set, skill, self.fonts, - &get_skill_label(skill, &self.stats.skill_set), + &get_skill_label(skill, &self.skill_set), ) .with_tooltip( self.tooltip_manager, @@ -3666,7 +3655,7 @@ impl<'a> Widget for Diary<'a> { &add_sp_cost_tooltip( &self.localized_strings.get("hud.skill.sc_wardaura_duration"), skill, - &self.stats.skill_set, + &self.skill_set, &self.localized_strings, ), &diary_tooltip, @@ -3681,10 +3670,10 @@ impl<'a> Widget for Diary<'a> { if create_skill_button( self.imgs.buff_radius_skill, state.skills_bot_l[3], - &self.stats.skill_set, + &self.skill_set, skill, self.fonts, - &get_skill_label(skill, &self.stats.skill_set), + &get_skill_label(skill, &self.skill_set), ) .with_tooltip( self.tooltip_manager, @@ -3694,7 +3683,7 @@ impl<'a> Widget for Diary<'a> { &add_sp_cost_tooltip( &self.localized_strings.get("hud.skill.sc_wardaura_range"), skill, - &self.stats.skill_set, + &self.skill_set, &self.localized_strings, ), &diary_tooltip, @@ -3709,10 +3698,10 @@ impl<'a> Widget for Diary<'a> { if create_skill_button( self.imgs.buff_cost_skill, state.skills_bot_l[4], - &self.stats.skill_set, + &self.skill_set, skill, self.fonts, - &get_skill_label(skill, &self.stats.skill_set), + &get_skill_label(skill, &self.skill_set), ) .with_tooltip( self.tooltip_manager, @@ -3722,7 +3711,7 @@ impl<'a> Widget for Diary<'a> { &add_sp_cost_tooltip( &self.localized_strings.get("hud.skill.sc_wardaura_cost"), skill, - &self.stats.skill_set, + &self.skill_set, &self.localized_strings, ), &diary_tooltip, diff --git a/voxygen/src/hud/group.rs b/voxygen/src/hud/group.rs index 6eedd7dc94..709c0cac23 100644 --- a/voxygen/src/hud/group.rs +++ b/voxygen/src/hud/group.rs @@ -348,6 +348,7 @@ impl<'a> Widget for Group<'a> { }; let client_state = self.client.state(); let stats = client_state.ecs().read_storage::(); + let skill_sets = client_state.ecs().read_storage::(); let healths = client_state.ecs().read_storage::(); let energy = client_state.ecs().read_storage::(); let buffs = client_state.ecs().read_storage::(); @@ -361,6 +362,7 @@ impl<'a> Widget for Group<'a> { self.show.group = true; let entity = uid_allocator.retrieve_entity_internal(uid.into()); let stats = entity.and_then(|entity| stats.get(entity)); + let skill_set = entity.and_then(|entity| skill_sets.get(entity)); let health = entity.and_then(|entity| healths.get(entity)); let energy = entity.and_then(|entity| energy.get(entity)); let buffs = entity.and_then(|entity| buffs.get(entity)); @@ -368,11 +370,11 @@ impl<'a> Widget for Group<'a> { let is_leader = uid == leader; let body = entity.and_then(|entity| bodies.get(entity)); - if let (Some(stats), Some(inventory), Some(health), Some(body)) = - (stats, inventory, health, body) + if let (Some(stats), Some(skill_set), Some(inventory), Some(health), Some(body)) = + (stats, skill_set, inventory, health, body) { let combat_rating = - combat::combat_rating(inventory, health, stats, *body, &self.msm); + combat::combat_rating(inventory, health, skill_set, *body, &self.msm); let char_name = stats.name.to_string(); let health_perc = health.current() as f64 / health.base_max().max(health.maximum()) as f64; diff --git a/voxygen/src/hud/hotbar.rs b/voxygen/src/hud/hotbar.rs index 38c6b83119..56107833de 100644 --- a/voxygen/src/hud/hotbar.rs +++ b/voxygen/src/hud/hotbar.rs @@ -76,8 +76,11 @@ impl State { use specs::WorldExt; let inventories = client.state().ecs().read_storage::(); let inventory = inventories.get(client.entity()); - let stats = client.state().ecs().read_storage::(); - let stat = stats.get(client.entity()); + let skill_sets = client + .state() + .ecs() + .read_storage::(); + let skill_set = skill_sets.get(client.entity()); let hands = |equip_slot| match inventory.and_then(|i| i.equipped(equip_slot).map(|i| i.kind())) { @@ -91,8 +94,8 @@ impl State { _ => None, }; - let should_be_present = if let (Some(inventory), Some(stat), Some(equip_slot)) = - (inventory, stat, equip_slot) + let should_be_present = if let (Some(inventory), Some(skill_set), Some(equip_slot)) = + (inventory, skill_set, equip_slot) { inventory.equipped(equip_slot).map_or(false, |i| { i.item_config_expect() @@ -100,9 +103,7 @@ impl State { .abilities .get(0) .as_ref() - .map_or(false, |(s, _)| { - s.map_or(true, |s| stat.skill_set.has_skill(s)) - }) + .map_or(false, |(s, _)| s.map_or(true, |s| skill_set.has_skill(s))) }) } else { false @@ -128,9 +129,12 @@ impl State { use specs::WorldExt; let inventories = client.state().ecs().read_storage::(); let inventory = inventories.get(client.entity()); - let stats = client.state().ecs().read_storage::(); - let stat = stats.get(client.entity()); - let should_be_present = if let (Some(inventory), Some(stat)) = (inventory, stat) { + let skill_sets = client + .state() + .ecs() + .read_storage::(); + let skill_set = skill_sets.get(client.entity()); + let should_be_present = if let (Some(inventory), Some(skill_set)) = (inventory, skill_set) { let hands = |equip_slot| match inventory.equipped(equip_slot).map(|i| i.kind()) { Some(ItemKind::Tool(tool)) => Some(tool.hands), _ => None, @@ -154,9 +158,7 @@ impl State { .abilities .get(skill_index) .as_ref() - .map_or(false, |(s, _)| { - s.map_or(true, |s| stat.skill_set.has_skill(s)) - }) + .map_or(false, |(s, _)| s.map_or(true, |s| skill_set.has_skill(s))) }) } else { false diff --git a/voxygen/src/hud/mod.rs b/voxygen/src/hud/mod.rs index 4c68dc1bab..fe4b8db08e 100644 --- a/voxygen/src/hud/mod.rs +++ b/voxygen/src/hud/mod.rs @@ -959,6 +959,7 @@ impl Hud { let ecs = client.state().ecs(); let pos = ecs.read_storage::(); let stats = ecs.read_storage::(); + let skill_sets = ecs.read_storage::(); let healths = ecs.read_storage::(); let buffs = ecs.read_storage::(); let energy = ecs.read_storage::(); @@ -1456,11 +1457,12 @@ impl Hud { let speech_bubbles = &self.speech_bubbles; // Render overhead name tags and health bars - for (pos, info, bubble, _, health, _, height_offset, hpfl, in_group) in ( + for (pos, info, bubble, _, _, health, _, height_offset, hpfl, in_group) in ( &entities, &pos, interpolated.maybe(), &stats, + &skill_sets, healths.maybe(), &buffs, energy.maybe(), @@ -1472,7 +1474,7 @@ impl Hud { ) .join() .filter(|t| { - let health = t.4; + let health = t.5; let entity = t.0; entity != me && !health.map_or(false, |h| h.is_dead) }) @@ -1482,6 +1484,7 @@ impl Hud { pos, interpolated, stats, + skill_set, health, buffs, energy, @@ -1523,7 +1526,7 @@ impl Hud { buffs, energy, combat_rating: health.map_or(0.0, |health| { - combat::combat_rating(inventory, health, stats, *body, &msm) + combat::combat_rating(inventory, health, skill_set, *body, &msm) }), }); let bubble = if dist_sqr < SPEECH_BUBBLE_RANGE.powi(2) { @@ -1538,6 +1541,7 @@ impl Hud { info, bubble, stats, + skill_set, health, buffs, body.height() * scale.map_or(1.0, |s| s.0) + 0.5, @@ -2167,10 +2171,12 @@ impl Hud { // Bag button and nearby icons let ecs = client.state().ecs(); + let entity = client.entity(); let stats = ecs.read_storage::(); + let skill_sets = ecs.read_storage::(); let buffs = ecs.read_storage::(); let msm = ecs.read_resource::(); - if let Some(player_stats) = stats.get(client.entity()) { + if let (Some(player_stats), Some(skill_set)) = (stats.get(entity), skill_sets.get(entity)) { match Buttons::new( client, self.show.bag, @@ -2181,6 +2187,7 @@ impl Hud { tooltip_manager, i18n, &player_stats, + &skill_set, self.pulse, ) .set(self.ids.buttons, ui_widgets) @@ -2342,8 +2349,9 @@ impl Hud { } // Bag contents if self.show.bag { - if let (Some(player_stats), Some(health), Some(energy), Some(body)) = ( + if let (Some(player_stats), Some(skill_set), Some(health), Some(energy), Some(body)) = ( stats.get(client.entity()), + skill_sets.get(client.entity()), healths.get(entity), energies.get(entity), bodies.get(entity), @@ -2360,6 +2368,7 @@ impl Hud { self.pulse, i18n, &player_stats, + &skill_set, &health, &energy, &self.show, @@ -2758,12 +2767,12 @@ impl Hud { // Diary if self.show.diary { let entity = client.entity(); - let stats = ecs.read_storage::(); - if let Some(stats) = stats.get(entity) { + let skill_sets = ecs.read_storage::(); + if let Some(skill_set) = skill_sets.get(entity) { for event in Diary::new( &self.show, client, - &stats, + &skill_set, &self.imgs, &self.item_imgs, &self.fonts,