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,
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);
}
}

View File

@ -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)
}

View File

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

View File

@ -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 {