mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Added command to give yourself skill points.
adjusted social window Changelog
This commit is contained in:
parent
986c05621a
commit
89766b2b34
@ -23,6 +23,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||
- Added an additional Ring loadout slot
|
||||
- The inventory can now be expanded to fill the whole window
|
||||
- Added /dropall admin command (drops all inventory items on the ground)
|
||||
- Skill trees
|
||||
|
||||
### Changed
|
||||
|
||||
@ -38,6 +39,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||
|
||||
- SSAAx4 option
|
||||
- The Stats button and associated screen were removed
|
||||
- Levels
|
||||
|
||||
### Fixed
|
||||
|
||||
|
BIN
assets/voxygen/element/misc_bg/social_bg.png
(Stored with Git LFS)
BIN
assets/voxygen/element/misc_bg/social_bg.png
(Stored with Git LFS)
Binary file not shown.
BIN
assets/voxygen/element/misc_bg/social_frame.png
(Stored with Git LFS)
BIN
assets/voxygen/element/misc_bg/social_frame.png
(Stored with Git LFS)
Binary file not shown.
@ -72,6 +72,7 @@ pub enum ChatCommand {
|
||||
RemoveLights,
|
||||
Say,
|
||||
SetMotd,
|
||||
SkillPoint,
|
||||
Spawn,
|
||||
Sudo,
|
||||
Tell,
|
||||
@ -123,6 +124,7 @@ pub static CHAT_COMMANDS: &[ChatCommand] = &[
|
||||
ChatCommand::RemoveLights,
|
||||
ChatCommand::Say,
|
||||
ChatCommand::SetMotd,
|
||||
ChatCommand::SkillPoint,
|
||||
ChatCommand::Spawn,
|
||||
ChatCommand::Sudo,
|
||||
ChatCommand::Tell,
|
||||
@ -149,6 +151,10 @@ lazy_static! {
|
||||
.iter()
|
||||
.map(|s| s.to_string())
|
||||
.collect();
|
||||
static ref SKILL_TREES: Vec<String> = vec!["general", "sword", "axe", "hammer", "bow", "staff", "sceptre"]
|
||||
.iter()
|
||||
.map(|s| s.to_string())
|
||||
.collect();
|
||||
/// TODO: Make this use hot-reloading
|
||||
static ref ENTITIES: Vec<String> = {
|
||||
let npc_names = &*npc::NPC_NAMES.read();
|
||||
@ -372,6 +378,14 @@ impl ChatCommand {
|
||||
ChatCommand::SetMotd => {
|
||||
cmd(vec![Message(Optional)], "Set the server description", Admin)
|
||||
},
|
||||
ChatCommand::SkillPoint => cmd(
|
||||
vec![
|
||||
Enum("skill tree", SKILL_TREES.clone(), Required),
|
||||
Integer("amount", 1, Optional),
|
||||
],
|
||||
"Give yourself skill points for a particular skill tree",
|
||||
Admin,
|
||||
),
|
||||
ChatCommand::Spawn => cmd(
|
||||
vec![
|
||||
Enum("alignment", ALIGNMENTS.clone(), Required),
|
||||
@ -464,6 +478,7 @@ impl ChatCommand {
|
||||
ChatCommand::RemoveLights => "remove_lights",
|
||||
ChatCommand::Say => "say",
|
||||
ChatCommand::SetMotd => "set_motd",
|
||||
ChatCommand::SkillPoint => "skill_point",
|
||||
ChatCommand::Spawn => "spawn",
|
||||
ChatCommand::Sudo => "sudo",
|
||||
ChatCommand::Tell => "tell",
|
||||
|
@ -112,6 +112,7 @@ fn get_handler(cmd: &ChatCommand) -> CommandHandler {
|
||||
ChatCommand::RemoveLights => handle_remove_lights,
|
||||
ChatCommand::Say => handle_say,
|
||||
ChatCommand::SetMotd => handle_set_motd,
|
||||
ChatCommand::SkillPoint => handle_skill_point,
|
||||
ChatCommand::Spawn => handle_spawn,
|
||||
ChatCommand::Sudo => handle_sudo,
|
||||
ChatCommand::Tell => handle_tell,
|
||||
@ -1987,6 +1988,85 @@ spawn_rate {:?} "#,
|
||||
}
|
||||
}
|
||||
|
||||
fn find_target(
|
||||
ecs: &specs::World,
|
||||
opt_alias: Option<String>,
|
||||
fallback: EcsEntity,
|
||||
) -> Result<EcsEntity, ServerGeneral> {
|
||||
if let Some(alias) = opt_alias {
|
||||
(&ecs.entities(), &ecs.read_storage::<comp::Player>())
|
||||
.join()
|
||||
.find(|(_, player)| player.alias == alias)
|
||||
.map(|(entity, _)| entity)
|
||||
.ok_or_else(|| {
|
||||
ServerGeneral::server_msg(
|
||||
ChatType::CommandError,
|
||||
format!("Player '{}' not found!", alias),
|
||||
)
|
||||
})
|
||||
} else {
|
||||
Ok(fallback)
|
||||
}
|
||||
}
|
||||
|
||||
fn handle_skill_point(
|
||||
server: &mut Server,
|
||||
client: EcsEntity,
|
||||
target: EcsEntity,
|
||||
args: String,
|
||||
action: &ChatCommand,
|
||||
) {
|
||||
let (a_skill_tree, a_sp, a_alias) =
|
||||
scan_fmt_some!(&args, &action.arg_fmt(), String, u16, String);
|
||||
|
||||
if let (Some(skill_tree), Some(sp)) = (a_skill_tree, a_sp) {
|
||||
let target = find_target(&server.state.ecs(), a_alias, target);
|
||||
|
||||
let mut error_msg = None;
|
||||
|
||||
match target {
|
||||
Ok(player) => {
|
||||
if let Some(skill_tree) = parse_skill_tree(&skill_tree) {
|
||||
if let Some(mut stats) = server
|
||||
.state
|
||||
.ecs_mut()
|
||||
.write_storage::<comp::Stats>()
|
||||
.get_mut(player)
|
||||
{
|
||||
stats.skill_set.add_skill_points(skill_tree, sp);
|
||||
} else {
|
||||
error_msg = Some(ServerGeneral::server_msg(
|
||||
ChatType::CommandError,
|
||||
"Player has no stats!",
|
||||
));
|
||||
}
|
||||
}
|
||||
},
|
||||
Err(e) => {
|
||||
error_msg = Some(e);
|
||||
},
|
||||
}
|
||||
|
||||
if let Some(msg) = error_msg {
|
||||
server.notify_client(client, msg);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn parse_skill_tree(skill_tree: &str) -> Option<comp::skills::SkillGroupType> {
|
||||
use comp::{item::tool::ToolKind, skills::SkillGroupType};
|
||||
match skill_tree {
|
||||
"general" => Some(SkillGroupType::General),
|
||||
"sword" => Some(SkillGroupType::Weapon(ToolKind::Sword)),
|
||||
"axe" => Some(SkillGroupType::Weapon(ToolKind::Axe)),
|
||||
"hammer" => Some(SkillGroupType::Weapon(ToolKind::Hammer)),
|
||||
"bow" => Some(SkillGroupType::Weapon(ToolKind::Bow)),
|
||||
"staff" => Some(SkillGroupType::Weapon(ToolKind::Staff)),
|
||||
"sceptre" => Some(SkillGroupType::Weapon(ToolKind::Sceptre)),
|
||||
_ => None,
|
||||
}
|
||||
}
|
||||
|
||||
fn handle_debug(
|
||||
server: &mut Server,
|
||||
client: EcsEntity,
|
||||
|
@ -969,7 +969,7 @@ impl<'a> Widget for Diary<'a> {
|
||||
.with_tooltip(
|
||||
self.tooltip_manager,
|
||||
"Triple Strike Damage",
|
||||
"Increases damage scaling on triple strike",
|
||||
"Increases the damage each successive strike does",
|
||||
&diary_tooltip,
|
||||
TEXT_COLOR,
|
||||
)
|
||||
@ -990,7 +990,7 @@ impl<'a> Widget for Diary<'a> {
|
||||
.with_tooltip(
|
||||
self.tooltip_manager,
|
||||
"Triple Strike Speed",
|
||||
"Increases attack speed scaling on triple strike",
|
||||
"Increases attack speed gained by each successive strike",
|
||||
&diary_tooltip,
|
||||
TEXT_COLOR,
|
||||
)
|
||||
@ -1011,7 +1011,7 @@ impl<'a> Widget for Diary<'a> {
|
||||
.with_tooltip(
|
||||
self.tooltip_manager,
|
||||
"Triple Strike Regen",
|
||||
"Increases enery regen scaling on triple strike",
|
||||
"Increases stamina gain on each successive strike",
|
||||
&diary_tooltip,
|
||||
TEXT_COLOR,
|
||||
)
|
||||
@ -1324,7 +1324,7 @@ impl<'a> Widget for Diary<'a> {
|
||||
.with_tooltip(
|
||||
self.tooltip_manager,
|
||||
"Double Strike Damage",
|
||||
"Increases damage scaling in combo",
|
||||
"Increases the damage dealt in each successive strike",
|
||||
&diary_tooltip,
|
||||
TEXT_COLOR,
|
||||
)
|
||||
@ -1345,7 +1345,7 @@ impl<'a> Widget for Diary<'a> {
|
||||
.with_tooltip(
|
||||
self.tooltip_manager,
|
||||
"Double Strike Speed",
|
||||
"Increases speed scaling in combo",
|
||||
"Increases the attack speed with each successive strike",
|
||||
&diary_tooltip,
|
||||
TEXT_COLOR,
|
||||
)
|
||||
@ -1366,7 +1366,7 @@ impl<'a> Widget for Diary<'a> {
|
||||
.with_tooltip(
|
||||
self.tooltip_manager,
|
||||
"Double Strike Regen",
|
||||
"Increases energy regen scaling in combo",
|
||||
"Increases stamina gain with each successive strike",
|
||||
&diary_tooltip,
|
||||
TEXT_COLOR,
|
||||
)
|
||||
@ -1636,7 +1636,7 @@ impl<'a> Widget for Diary<'a> {
|
||||
.with_tooltip(
|
||||
self.tooltip_manager,
|
||||
"Single Strike Damage",
|
||||
"Increases damage scaling in combo",
|
||||
"Increases the damage with each successive strike",
|
||||
&diary_tooltip,
|
||||
TEXT_COLOR,
|
||||
)
|
||||
@ -1657,7 +1657,7 @@ impl<'a> Widget for Diary<'a> {
|
||||
.with_tooltip(
|
||||
self.tooltip_manager,
|
||||
"Single Strike Speed",
|
||||
"Increases speed scaling in combo",
|
||||
"Increases the attack speed with each successive strike",
|
||||
&diary_tooltip,
|
||||
TEXT_COLOR,
|
||||
)
|
||||
@ -1678,7 +1678,7 @@ impl<'a> Widget for Diary<'a> {
|
||||
.with_tooltip(
|
||||
self.tooltip_manager,
|
||||
"Single Strike Regen",
|
||||
"Increases energy regen scaling in combo",
|
||||
"Increases stamina gain with each successive strike",
|
||||
&diary_tooltip,
|
||||
TEXT_COLOR,
|
||||
)
|
||||
|
@ -303,7 +303,7 @@ impl<'a> Widget for Social<'a> {
|
||||
//
|
||||
if Button::image(self.imgs.nothing)
|
||||
.w_h(133.0, 18.0)
|
||||
.top_left_with_margins_on(state.ids.frame, 52.0, 7.0)
|
||||
.mid_top_with_margin_on(state.ids.frame, 52.0)
|
||||
.label(&self.localized_strings.get("hud.social.name"))
|
||||
.label_font_size(self.fonts.cyri.scale(14))
|
||||
.label_y(conrod_core::position::Relative::Scalar(0.0))
|
||||
@ -317,7 +317,7 @@ impl<'a> Widget for Social<'a> {
|
||||
if Button::image(self.imgs.nothing)
|
||||
.w_h(39.0, 18.0)
|
||||
.right_from(state.ids.name_txt, 2.0)
|
||||
.label(&self.localized_strings.get("hud.social.level"))
|
||||
.label("")
|
||||
.label_font_size(self.fonts.cyri.scale(14))
|
||||
.label_y(conrod_core::position::Relative::Scalar(0.0))
|
||||
.label_font_id(self.fonts.cyri.conrod_id)
|
||||
@ -330,7 +330,7 @@ impl<'a> Widget for Social<'a> {
|
||||
if Button::image(self.imgs.nothing)
|
||||
.w_h(93.0, 18.0)
|
||||
.right_from(state.ids.level_txt, 2.0)
|
||||
.label(&self.localized_strings.get("hud.social.zone"))
|
||||
.label("") // TODO: Enable zone here later
|
||||
.label_font_size(self.fonts.cyri.scale(14))
|
||||
.label_y(conrod_core::position::Relative::Scalar(0.0))
|
||||
.label_font_id(self.fonts.cyri.conrod_id)
|
||||
@ -412,7 +412,7 @@ impl<'a> Widget for Social<'a> {
|
||||
self.imgs.selection
|
||||
});
|
||||
let button = if i == 0 {
|
||||
button.mid_top_with_margin_on(state.ids.names_align, 1.0)
|
||||
button.mid_top_with_margin_on(state.ids.online_align, 1.0)
|
||||
} else {
|
||||
button.down_from(state.ids.player_names[i - 1], 1.0)
|
||||
};
|
||||
@ -422,7 +422,7 @@ impl<'a> Widget for Social<'a> {
|
||||
alias
|
||||
);
|
||||
button
|
||||
.w_h(133.0, 20.0)
|
||||
.w_h(260.0, 20.0)
|
||||
.hover_image(if selected {
|
||||
self.imgs.selection
|
||||
} else {
|
||||
|
Loading…
Reference in New Issue
Block a user