inventory system messages to config

This commit is contained in:
Llywelwyn 2023-08-23 02:31:23 +01:00
parent 306c1e4d53
commit 76c74df028
6 changed files with 20 additions and 13 deletions

View file

@ -22,3 +22,10 @@ pub const MAGICMAP_CURSED: &str = "... but forget where you last were";
pub const NUTRITION: &str = "You eat the";
pub const NUTRITION_CURSED: &str = "Blech! Rotten";
pub const NUTRITION_BLESSED: &str = "Delicious";
pub const LEVELUP_PLAYER: &str = "Welcome to experience level";
pub const YOU_PICKUP_ITEM: &str = "You pick up the";
pub const YOU_DROP_ITEM: &str = "You drop the";
pub const YOU_EQUIP_ITEM: &str = "You equip the";
pub const YOU_REMOVE_ITEM: &str = "You unequip your";
pub const YOU_REMOVE_ITEM_CURSED: &str = "You can't remove the";

View file

@ -11,6 +11,7 @@ use crate::{
Pools,
};
use crate::config::visuals::{ DEFAULT_PARTICLE_LIFETIME, LONG_PARTICLE_LIFETIME };
use crate::config::messages::LEVELUP_PLAYER;
use rltk::prelude::*;
use specs::prelude::*;
@ -161,12 +162,7 @@ pub fn entity_death(ecs: &mut World, effect: &EffectSpawner, target: Entity) {
// If it was the PLAYER that levelled up:
if ecs.read_storage::<Player>().get(source).is_some() {
gamelog::record_event("player_level", 1);
gamelog::Logger
::new()
.append("Welcome to experience level")
.append_n(source_pools.level)
.append("!")
.log();
gamelog::Logger::new().append(LEVELUP_PLAYER).append_n(source_pools.level).append("!").log();
let player_pos = ecs.fetch::<Point>();
let map = ecs.fetch_mut::<Map>();
for i in 0..5 {

View file

@ -13,6 +13,7 @@ use crate::{
WantsToPickupItem,
};
use specs::prelude::*;
use crate::config::messages;
pub struct ItemCollectionSystem {}
@ -57,7 +58,7 @@ impl<'a> System<'a> for ItemCollectionSystem {
if pickup.collected_by == *player_entity {
gamelog::Logger
::new()
.append("You pick up the")
.append(messages::YOU_PICKUP_ITEM)
.item_name_n(
format!(
"{}",

View file

@ -13,6 +13,7 @@ use crate::{
WantsToDropItem,
};
use specs::prelude::*;
use crate::config::messages;
pub struct ItemDropSystem {}
@ -65,7 +66,7 @@ impl<'a> System<'a> for ItemDropSystem {
if entity == *player_entity {
gamelog::Logger
::new()
.append("You drop the")
.append(messages::YOU_DROP_ITEM)
.item_name_n(
format!(
"{}",

View file

@ -16,6 +16,7 @@ use crate::{
BUC,
};
use specs::prelude::*;
use crate::config::messages;
pub struct ItemEquipSystem {}
@ -71,7 +72,7 @@ impl<'a> System<'a> for ItemEquipSystem {
if beatitude.buc == BUC::Cursed {
can_equip = false;
logger = logger
.append("You can't remove the")
.append(messages::YOU_REMOVE_ITEM_CURSED)
.colour(item_colour(item_entity, &beatitudes))
.append_n(
obfuscate_name(
@ -103,7 +104,7 @@ impl<'a> System<'a> for ItemEquipSystem {
backpack.insert(*item, InBackpack { owner: target }).expect("Unable to insert backpack");
if target == *player_entity {
logger = logger
.append("You remove your")
.append(messages::YOU_REMOVE_ITEM)
.colour(item_colour(*item, &beatitudes))
.append_n(
obfuscate_name(*item, &names, &magic_items, &obfuscated_names, &beatitudes, &dm, None).0
@ -120,7 +121,7 @@ impl<'a> System<'a> for ItemEquipSystem {
backpack.remove(wants_to_use_item.item);
if target == *player_entity {
logger = logger
.append("You equip the")
.append(messages::YOU_EQUIP_ITEM)
.colour(item_colour(wants_to_use_item.item, &beatitudes))
.append_n(
obfuscate_name(

View file

@ -13,6 +13,7 @@ use crate::{
};
use rltk::prelude::*;
use specs::prelude::*;
use crate::config::messages;
pub struct ItemRemoveSystem {}
@ -53,7 +54,7 @@ impl<'a> System<'a> for ItemRemoveSystem {
can_remove = false;
gamelog::Logger
::new()
.append("You can't remove the")
.append(messages::YOU_REMOVE_ITEM_CURSED)
.colour(item_colour(to_remove.item, &beatitudes))
.append_n(
obfuscate_name(
@ -80,7 +81,7 @@ impl<'a> System<'a> for ItemRemoveSystem {
if entity == *player_entity {
gamelog::Logger
::new()
.append("You unequip the")
.append(messages::YOU_REMOVE_ITEM)
.colour(item_colour(to_remove.item, &beatitudes))
.append_n(
obfuscate_name(