Make /adminify admin-only and /waypoint free

This commit is contained in:
Piotr Korgól 2019-10-04 18:09:19 +02:00
parent 9e10c8b700
commit 09429b45d1
4 changed files with 8 additions and 8 deletions

View File

@ -12,7 +12,6 @@ pub enum HealthSource {
Command, Command,
LevelUp, LevelUp,
Item, Item,
Creation,
Unknown, Unknown,
} }
#[derive(Clone, Copy, Debug, Serialize, Deserialize)] #[derive(Clone, Copy, Debug, Serialize, Deserialize)]
@ -168,9 +167,10 @@ impl Stats {
self.is_dead = false; self.is_dead = false;
} }
// TODO: Delet this once stat points will be a thing // TODO: Delete this once stat points will be a thing
pub fn level_hp_bonus(&mut self, level: u32) { pub fn update_hp_bonus(&mut self, level: u32) {
self.health.set_maximum((10 * level) / 2); self.health
.set_maximum(self.health.maximum() + (10 * level) / 2);
} }
} }

View File

@ -43,7 +43,7 @@ impl<'a> System<'a> for Sys {
stat.exp.change_by(-(stat.exp.maximum() as i64)); stat.exp.change_by(-(stat.exp.maximum() as i64));
stat.exp.change_maximum_by(25); stat.exp.change_maximum_by(25);
stat.level.change_by(1); stat.level.change_by(1);
stat.health.set_maximum(stat.health.maximum() + 10); stat.update_hp_bonus(stat.level.level());
stat.health stat.health
.set_to(stat.health.maximum(), HealthSource::LevelUp) .set_to(stat.health.maximum(), HealthSource::LevelUp)
} }

View File

@ -196,14 +196,14 @@ lazy_static! {
"waypoint", "waypoint",
"{}", "{}",
"/waypoint : Set your waypoint to your current position", "/waypoint : Set your waypoint to your current position",
true, false,
handle_waypoint, handle_waypoint,
), ),
ChatCommand::new( ChatCommand::new(
"adminify", "adminify",
"{}", "{}",
"/adminify <playername> : Temporarily gives a player admin permissions or removes them", "/adminify <playername> : Temporarily gives a player admin permissions or removes them",
false, // TODO: NO true,
handle_adminify, handle_adminify,
), ),
ChatCommand::new( ChatCommand::new(

View File

@ -563,7 +563,7 @@ impl Server {
// TODO: Remove this and implement scaling or level depending on stuff like species instead // 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)); stats.level.set_level(rand::thread_rng().gen_range(1, 20));
if stats.level.level() > 1 { if stats.level.level() > 1 {
stats.level_hp_bonus(stats.level.level()); stats.update_hp_bonus(stats.level.level());
} }
if npc.boss { if npc.boss {