From 09429b45d17cd69f65faf69b238d78d59add2ac8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Piotr=20Korg=C3=B3l?= Date: Fri, 4 Oct 2019 18:09:19 +0200 Subject: [PATCH] Make /adminify admin-only and /waypoint free --- common/src/comp/stats.rs | 8 ++++---- common/src/sys/stats.rs | 2 +- server/src/cmd.rs | 4 ++-- server/src/lib.rs | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/common/src/comp/stats.rs b/common/src/comp/stats.rs index ee73c880bb..bc1a9de487 100644 --- a/common/src/comp/stats.rs +++ b/common/src/comp/stats.rs @@ -12,7 +12,6 @@ pub enum HealthSource { Command, LevelUp, Item, - Creation, Unknown, } #[derive(Clone, Copy, Debug, Serialize, Deserialize)] @@ -168,9 +167,10 @@ impl Stats { self.is_dead = false; } - // TODO: Delet this once stat points will be a thing - pub fn level_hp_bonus(&mut self, level: u32) { - self.health.set_maximum((10 * level) / 2); + // TODO: Delete this once stat points will be a thing + pub fn update_hp_bonus(&mut self, level: u32) { + self.health + .set_maximum(self.health.maximum() + (10 * level) / 2); } } diff --git a/common/src/sys/stats.rs b/common/src/sys/stats.rs index 5746777ef0..5355cc5120 100644 --- a/common/src/sys/stats.rs +++ b/common/src/sys/stats.rs @@ -43,7 +43,7 @@ impl<'a> System<'a> for Sys { stat.exp.change_by(-(stat.exp.maximum() as i64)); stat.exp.change_maximum_by(25); stat.level.change_by(1); - stat.health.set_maximum(stat.health.maximum() + 10); + stat.update_hp_bonus(stat.level.level()); stat.health .set_to(stat.health.maximum(), HealthSource::LevelUp) } diff --git a/server/src/cmd.rs b/server/src/cmd.rs index 67cd0dd9f8..ac97be1292 100644 --- a/server/src/cmd.rs +++ b/server/src/cmd.rs @@ -196,14 +196,14 @@ lazy_static! { "waypoint", "{}", "/waypoint : Set your waypoint to your current position", - true, + false, handle_waypoint, ), ChatCommand::new( "adminify", "{}", "/adminify : Temporarily gives a player admin permissions or removes them", - false, // TODO: NO + true, handle_adminify, ), ChatCommand::new( diff --git a/server/src/lib.rs b/server/src/lib.rs index d662bb786e..6d15e42789 100644 --- a/server/src/lib.rs +++ b/server/src/lib.rs @@ -563,7 +563,7 @@ impl Server { // TODO: Remove this and implement scaling or level depending on stuff like species instead stats.level.set_level(rand::thread_rng().gen_range(1, 20)); if stats.level.level() > 1 { - stats.level_hp_bonus(stats.level.level()); + stats.update_hp_bonus(stats.level.level()); } if npc.boss {