diff --git a/CHANGELOG.md b/CHANGELOG.md index e9c3409292..fcc83751c0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -49,6 +49,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Loading-Screen tips - Feeding animation for some animals - Power stat to weapons which affects weapon damage +- Add detection of entities under the cursor +- Functional group-system with exp-sharing and disabled damage to group members + ### Changed @@ -80,6 +83,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Fixed window resizing on Mac OS X. - Dehardcoded many item variants - Tooltips avoid the mouse better and disappear when hovered +- Improved social window functions and visuals ### Removed diff --git a/Cargo.lock b/Cargo.lock index 709ab9ea4b..bb5d2f2430 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -219,6 +219,16 @@ dependencies = [ "winapi 0.3.8", ] +[[package]] +name = "auth-common" +version = "0.1.0" +source = "git+https://gitlab.com/veloren/auth.git?rev=223a4097f7ebc8d451936dccb5e6517194bbf086#223a4097f7ebc8d451936dccb5e6517194bbf086" +dependencies = [ + "rand 0.7.3", + "serde", + "uuid", +] + [[package]] name = "auth-common" version = "0.1.0" @@ -229,12 +239,26 @@ dependencies = [ "uuid", ] +[[package]] +name = "authc" +version = "1.0.0" +source = "git+https://gitlab.com/veloren/auth.git?rev=223a4097f7ebc8d451936dccb5e6517194bbf086#223a4097f7ebc8d451936dccb5e6517194bbf086" +dependencies = [ + "auth-common 0.1.0 (git+https://gitlab.com/veloren/auth.git?rev=223a4097f7ebc8d451936dccb5e6517194bbf086)", + "fxhash", + "hex", + "rust-argon2 0.8.2", + "serde_json", + "ureq", + "uuid", +] + [[package]] name = "authc" version = "1.0.0" source = "git+https://gitlab.com/veloren/auth.git?rev=b943c85e4a38f5ec60cd18c34c73097640162bfe#b943c85e4a38f5ec60cd18c34c73097640162bfe" dependencies = [ - "auth-common", + "auth-common 0.1.0 (git+https://gitlab.com/veloren/auth.git?rev=b943c85e4a38f5ec60cd18c34c73097640162bfe)", "fxhash", "hex", "rust-argon2 0.8.2", @@ -4601,7 +4625,7 @@ dependencies = [ name = "veloren-client" version = "0.6.0" dependencies = [ - "authc", + "authc 1.0.0 (git+https://gitlab.com/veloren/auth.git?rev=b943c85e4a38f5ec60cd18c34c73097640162bfe)", "byteorder 1.3.4", "futures-executor", "futures-timer", @@ -4622,7 +4646,7 @@ name = "veloren-common" version = "0.6.0" dependencies = [ "arraygen", - "authc", + "authc 1.0.0 (git+https://gitlab.com/veloren/auth.git?rev=223a4097f7ebc8d451936dccb5e6517194bbf086)", "criterion", "crossbeam", "dot_vox", @@ -4650,7 +4674,7 @@ dependencies = [ name = "veloren-server" version = "0.6.0" dependencies = [ - "authc", + "authc 1.0.0 (git+https://gitlab.com/veloren/auth.git?rev=b943c85e4a38f5ec60cd18c34c73097640162bfe)", "chrono", "crossbeam", "diesel", diff --git a/assets/common/loot_table.ron b/assets/common/loot_table.ron index 0b00677652..59b741a6dc 100644 --- a/assets/common/loot_table.ron +++ b/assets/common/loot_table.ron @@ -88,7 +88,7 @@ (0.50, "common.items.weapons.staff.starter_staff"), (0.35, "common.items.weapons.staff.bone_staff"), (0.15, "common.items.weapons.staff.amethyst_staff"), - (0.01, "common.items.weapons.staff.cultist_staff"), + //(0.01, "common.items.weapons.staff.cultist_staff"), // hammers (0.05, "common.items.weapons.hammer.starter_hammer"), (0.05, "common.items.weapons.hammer.wood_hammer-0"), diff --git a/assets/voxygen/i18n/de_DE.ron b/assets/voxygen/i18n/de_DE.ron index de6f9305bb..a0aa8387b7 100644 --- a/assets/voxygen/i18n/de_DE.ron +++ b/assets/voxygen/i18n/de_DE.ron @@ -68,6 +68,7 @@ VoxygenLocalization( "common.none": "Kein", "common.error": "Fehler", "common.fatal_error": "Fataler Fehler", + "common.decline": "Ablehnen", /// End Common section // Message when connection to the server is lost @@ -306,7 +307,7 @@ magischen Gegenstände ergattern?"#, "hud.settings.unbound": "-", "hud.settings.reset_keybinds": "Auf Standard zurücksetzen", - "hud.social": "Sozial", + "hud.social": "Andere Spieler ", "hud.social.online": "Online", "hud.social.friends": "Freunde", "hud.social.not_yet_available": "Noch nicht verfügbar", @@ -314,6 +315,21 @@ magischen Gegenstände ergattern?"#, "hud.social.play_online_fmt": "{nb_player} Spieler online", "hud.spell": "Zauber", + + "hud.social.name" : "Name", + "hud.social.level" : "Lvl", + "hud.social.zone" : "Gebiet", + + "hud.group": "Gruppe", + "hud.group.invite": "Einladen", + "hud.group.leave": "Verlassen", + "hud.group.add_friend": "Freund hinzufügen", + "hud.group.assign_leader": "Anführer", + "hud.group.kick": "Entfernen", + "hud.group.invite_to_join": "{name} hat euch zu seiner Gruppe eingeladen!", + "hud.group.dead" : "Tot", + "hud.group.out_of_range": "Außer Reichweite", + "hud.group.link_group": "Gruppen verbinden", "hud.crafting": "Herstellen", "hud.crafting.recipes": "Rezepte", @@ -376,6 +392,8 @@ magischen Gegenstände ergattern?"#, "gameinput.freelook": "Freie Sicht", "gameinput.autowalk": "Automatisch Laufen", "gameinput.dance": "Tanzen", + "gameinput.declinegroupinvite": "Ablehnen", + "gameinput.acceptgroupinvite": "Annehmen", /// End GameInput section diff --git a/assets/voxygen/i18n/en.ron b/assets/voxygen/i18n/en.ron index 302d545d7c..a5164163cb 100644 --- a/assets/voxygen/i18n/en.ron +++ b/assets/voxygen/i18n/en.ron @@ -71,6 +71,7 @@ VoxygenLocalization( "common.none": "None", "common.error": "Error", "common.fatal_error": "Fatal Error", + "common.you": "You", // Message when connection to the server is lost "common.connection_lost": r#"Connection lost! @@ -307,7 +308,7 @@ magically infused items?"#, "hud.settings.unbound": "None", "hud.settings.reset_keybinds": "Reset to Defaults", - "hud.social": "Social", + "hud.social": "Other Players", "hud.social.online": "Online:", "hud.social.friends": "Friends", "hud.social.not_yet_available": "Not yet available", @@ -325,13 +326,16 @@ magically infused items?"#, "hud.crafting.tool_cata": "Requires:", "hud.group": "Group", - "hud.group.invite_to_join": "{name} invited you to their group.", + "hud.group.invite_to_join": "{name} invited you to their group!", "hud.group.invite": "Invite", "hud.group.kick": "Kick", "hud.group.assign_leader": "Assign Leader", "hud.group.leave": "Leave Group", "hud.group.dead" : "Dead", "hud.group.out_of_range": "Out of range", + "hud.group.add_friend": "Add to Friends", + "hud.group.link_group": "Link Groups", + "hud.group.in_menu": "In Menu", "hud.spell": "Spells", @@ -453,7 +457,8 @@ Protection "Press 'F1' to see all default keybindings.", "You can type /say or /s to only chat with players directly around you.", "You can type /region or /r to only chat with players a couple of hundred blocks around you.", - "To send private message type /tell followed by a player name and your message.", + "You can type /group or /g to only chat with players in your current group.", + "To send private messages type /tell followed by a player name and your message.", "NPCs with the same level can have a different difficulty.", "Look at the ground for food, chests and other loot!", "Inventory filled with food? Try crafting better food from it!", @@ -464,7 +469,8 @@ Protection "Press 'J' to dance. Party!", "Press 'L-Shift' to open your Glider and conquer the skies.", "Veloren is still in Pre-Alpha. We do our best to improve it every day!", - "If you want to join the Dev-Team or just have a chat with us join our Discord-Server.", + "If you want to join the Dev-Team or just have a chat with us join our Discord-Server.", + "You can toggle showing your amount of health on the healthbar in the settings.", ], "npc.speech.villager_under_attack": [ "Help, I'm under attack!", diff --git a/assets/voxygen/voxel/weapon/staff/firestaff_cultist.vox b/assets/voxygen/voxel/weapon/staff/firestaff_cultist.vox index 6957a98086..2c27ee0143 100644 --- a/assets/voxygen/voxel/weapon/staff/firestaff_cultist.vox +++ b/assets/voxygen/voxel/weapon/staff/firestaff_cultist.vox @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:be510819e70d99ad4cb773de9a3cc8d343fc2d17236803e959b186a00020bd90 -size 27910 +oid sha256:39641c0dc427c30ac328101e3cbf7074e133d004a57ef964810b71d43779ddb8 +size 1464 diff --git a/client/src/lib.rs b/client/src/lib.rs index 1f459ed113..ee8d99224f 100644 --- a/client/src/lib.rs +++ b/client/src/lib.rs @@ -17,8 +17,8 @@ use byteorder::{ByteOrder, LittleEndian}; use common::{ character::CharacterItem, comp::{ - self, ControlAction, ControlEvent, Controller, ControllerInputs, GroupManip, - InventoryManip, InventoryUpdateEvent, group, + self, group, ControlAction, ControlEvent, Controller, ControllerInputs, GroupManip, + InventoryManip, InventoryUpdateEvent, }, msg::{ validate_chat_msg, ChatMsgValidationError, ClientMsg, ClientState, Notification, @@ -434,7 +434,9 @@ impl Client { pub fn group_invite(&self) -> Option { self.group_invite } - pub fn group_info(&self) -> Option<(String, Uid)> { self.group_leader.map(|l| ("TODO".into(), l)) } + pub fn group_info(&self) -> Option<(String, Uid)> { + self.group_leader.map(|l| ("Group".into(), l)) // TODO + } pub fn group_members(&self) -> &HashMap { &self.group_members } diff --git a/common/Cargo.toml b/common/Cargo.toml index 528fd962be..92d63c8045 100644 --- a/common/Cargo.toml +++ b/common/Cargo.toml @@ -29,7 +29,7 @@ crossbeam = "0.7" notify = "5.0.0-pre.3" indexmap = "1.3.0" sum_type = "0.2.0" -authc = { git = "https://gitlab.com/veloren/auth.git", rev = "223a4097f7ebc8d451936dccb5e6517194bbf086" } +authc = { git = "https://gitlab.com/veloren/auth.git", rev = "b943c85e4a38f5ec60cd18c34c73097640162bfe" } slab = "0.4.2" [dev-dependencies] diff --git a/common/src/comp/group.rs b/common/src/comp/group.rs index 2fcc570467..9c38f3d74f 100644 --- a/common/src/comp/group.rs +++ b/common/src/comp/group.rs @@ -137,7 +137,7 @@ impl GroupManager { fn create_group(&mut self, leader: specs::Entity) -> Group { Group(self.groups.insert(GroupInfo { leader, - name: "Flames".into(), + name: "Group".into(), }) as u32) } diff --git a/voxygen/src/hud/bag.rs b/voxygen/src/hud/bag.rs index 0af0b8b244..992232de94 100644 --- a/voxygen/src/hud/bag.rs +++ b/voxygen/src/hud/bag.rs @@ -229,7 +229,7 @@ impl<'a> Widget for Bag<'a> { ) .mid_top_with_margin_on(state.ids.bg_frame, 9.0) .font_id(self.fonts.cyri.conrod_id) - .font_size(self.fonts.cyri.scale(22)) + .font_size(self.fonts.cyri.scale(20)) .color(Color::Rgba(0.0, 0.0, 0.0, 1.0)) .set(state.ids.inventory_title_bg, ui); Text::new( @@ -240,7 +240,7 @@ impl<'a> Widget for Bag<'a> { ) .top_left_with_margins_on(state.ids.inventory_title_bg, 2.0, 2.0) .font_id(self.fonts.cyri.conrod_id) - .font_size(self.fonts.cyri.scale(22)) + .font_size(self.fonts.cyri.scale(20)) .color(TEXT_COLOR) .set(state.ids.inventory_title, ui); // Scrollbar-BG diff --git a/voxygen/src/hud/crafting.rs b/voxygen/src/hud/crafting.rs index 19fff3dfa6..99c706a5dc 100644 --- a/voxygen/src/hud/crafting.rs +++ b/voxygen/src/hud/crafting.rs @@ -117,23 +117,6 @@ impl<'a> Widget for Crafting<'a> { ) }); } - /*if state.ids.recipe_img_frame.len() < self.client.recipe_book().iter().len() { - state.update(|state| { - state.ids.recipe_img_frame.resize( - self.client.recipe_book().iter().len(), - &mut ui.widget_id_generator(), - ) - }); - } - if state.ids.recipe_img.len() < self.client.recipe_book().iter().len() { - state.update(|state| { - state.ids.recipe_img.resize( - self.client.recipe_book().iter().len(), - &mut ui.widget_id_generator(), - ) - }); - }*/ - let ids = &state.ids; let mut events = Vec::new(); @@ -186,7 +169,7 @@ impl<'a> Widget for Crafting<'a> { Text::new(&self.localized_strings.get("hud.crafting")) .mid_top_with_margin_on(ids.window_frame, 9.0) .font_id(self.fonts.cyri.conrod_id) - .font_size(self.fonts.cyri.scale(22)) + .font_size(self.fonts.cyri.scale(20)) .color(TEXT_COLOR) .set(ids.title_main, ui); diff --git a/voxygen/src/hud/group.rs b/voxygen/src/hud/group.rs index 1596b0120a..c39dbb9301 100644 --- a/voxygen/src/hud/group.rs +++ b/voxygen/src/hud/group.rs @@ -205,7 +205,7 @@ impl<'a> Widget for Group<'a> { // broken if self.show.group_menu || open_invite.is_some() { // Frame - Rectangle::fill_with([220.0, 230.0], color::Color::Rgba(0.0, 0.0, 0.0, 0.8)) + Rectangle::fill_with([220.0, 165.0], color::Color::Rgba(0.0, 0.0, 0.0, 0.8)) .bottom_left_with_margins_on(ui.window, 220.0, 10.0) .set(state.ids.bg, ui); } @@ -358,15 +358,17 @@ impl<'a> Widget for Group<'a> { // Health Text let txt = format!( "{}/{}", - stats.health.current() as u32, - stats.health.maximum() as u32, + stats.health.current() / 10 as u32, + stats.health.maximum() / 10 as u32, ); + // Change font size depending on health amount let font_size = match stats.health.maximum() { 0..=999 => 14, 1000..=9999 => 13, 10000..=99999 => 12, _ => 11, }; + // Change text offset depending on health amount let txt_offset = match stats.health.maximum() { 0..=999 => 4.0, 1000..=9999 => 4.5, @@ -458,16 +460,17 @@ impl<'a> Widget for Group<'a> { .color(TEXT_COLOR) .set(state.ids.title, ui); if Button::image(self.imgs.button) - .w_h(90.0, 22.0) - .top_right_with_margins_on(state.ids.bg, 30.0, 5.0) - .hover_image(self.imgs.button) - .press_image(self.imgs.button) - .label("Add to Friends") - .label_color(TEXT_COLOR_GREY) // Change this when the friendslist is working - .label_font_id(self.fonts.cyri.conrod_id) - .label_font_size(self.fonts.cyri.scale(10)) - .set(state.ids.btn_friend, ui) - .was_clicked() + .w_h(90.0, 22.0) + .top_right_with_margins_on(state.ids.bg, 30.0, 5.0) + .hover_image(self.imgs.button) // Change this when the friendslist is working + .press_image(self.imgs.button) // Change this when the friendslist is working + .label_color(TEXT_COLOR_GREY) // Change this when the friendslist is working + .image_color (TEXT_COLOR_GREY) // Change this when the friendslist is working + .label(&self.localized_strings.get("hud.group.add_friend")) + .label_font_id(self.fonts.cyri.conrod_id) + .label_font_size(self.fonts.cyri.scale(10)) + .set(state.ids.btn_friend, ui) + .was_clicked() {}; if Button::image(self.imgs.button) .w_h(90.0, 22.0) @@ -482,6 +485,7 @@ impl<'a> Widget for Group<'a> { .was_clicked() { self.show.group_menu = false; + self.show.group = !self.show.group; events.push(Event::LeaveGroup); }; // Group leader functions @@ -514,8 +518,11 @@ impl<'a> Widget for Group<'a> { .mid_bottom_with_margin_on(state.ids.btn_leader, -27.0) .hover_image(self.imgs.button) .press_image(self.imgs.button) - .label("Link Group") // TODO: Localize - .label_color(TEXT_COLOR_GREY) // Change this when the linking is working + .label(&self.localized_strings.get("hud.group.link_group")) + .hover_image(self.imgs.button) // Change this when the friendslist is working + .press_image(self.imgs.button) // Change this when the friendslist is working + .label_color(TEXT_COLOR_GREY) // Change this when the friendslist is working + .image_color (TEXT_COLOR_GREY) // Change this when the friendslist is working .label_font_id(self.fonts.cyri.conrod_id) .label_font_size(self.fonts.cyri.scale(10)) .set(state.ids.btn_link, ui) @@ -557,7 +564,7 @@ impl<'a> Widget for Group<'a> { }) } // Scrollable area for group member names - Rectangle::fill_with([110.0, 192.0], color::TRANSPARENT) + Rectangle::fill_with([110.0, 135.0], color::TRANSPARENT) .top_left_with_margins_on(state.ids.bg, 30.0, 5.0) .scroll_kids() .scroll_kids_vertically() @@ -582,7 +589,7 @@ impl<'a> Widget for Group<'a> { if i == 0 { w.top_left_with_margins_on(state.ids.scroll_area, 5.0, 0.0) } else { - w.down_from(state.ids.members[i - 1], 10.0) + w.down_from(state.ids.members[i - 1], 5.0) } }) .hover_image(self.imgs.selection_hover) diff --git a/voxygen/src/hud/mod.rs b/voxygen/src/hud/mod.rs index 4099b17186..fdb13ab68a 100644 --- a/voxygen/src/hud/mod.rs +++ b/voxygen/src/hud/mod.rs @@ -409,7 +409,6 @@ impl Show { fn social(&mut self, open: bool) { if !self.esc_menu { self.social = open; - self.crafting = false; self.spell = false; self.want_grab = !open; } @@ -509,7 +508,7 @@ impl Show { } fn toggle_social(&mut self) { - self.social = !self.social; + self.social(!self.social); self.spell = false; } @@ -1925,22 +1924,25 @@ impl Hud { // Social Window if self.show.social { let ecs = client.state().ecs(); - let stats = ecs.read_storage::(); + let _stats = ecs.read_storage::(); let me = client.entity(); - if let Some(stats) = stats.get(me) { + if let Some(_stats) = stats.get(me) { for event in Social::new( &self.show, client, &self.imgs, &self.fonts, &self.voxygen_i18n, - &stats, + //&stats, info.selected_entity, ) .set(self.ids.social_window, ui_widgets) { match event { - social::Event::Close => self.show.social(false), + social::Event::Close => { + self.show.social(false); + self.force_ungrab = true; + }, social::Event::ChangeSocialTab(social_tab) => { self.show.open_social_tab(social_tab) }, @@ -1950,7 +1952,6 @@ impl Hud { } } // Group Window - for event in Group::new( &mut self.show, client, diff --git a/voxygen/src/hud/settings_window.rs b/voxygen/src/hud/settings_window.rs index 9c92324eb3..06c1b24e94 100644 --- a/voxygen/src/hud/settings_window.rs +++ b/voxygen/src/hud/settings_window.rs @@ -1190,6 +1190,10 @@ impl<'a> Widget for SettingsWindow<'a> { .color(TEXT_COLOR) .set(state.ids.chat_char_name_text, ui); + // Show account name in chat + + // Show account names in social window + // Language select drop down Text::new(&self.localized_strings.get("common.languages")) .down_from(state.ids.chat_char_name_button, 20.0) diff --git a/voxygen/src/hud/social.rs b/voxygen/src/hud/social.rs index 65c7982594..b340db8440 100644 --- a/voxygen/src/hud/social.rs +++ b/voxygen/src/hud/social.rs @@ -2,7 +2,7 @@ use super::{img_ids::Imgs, Show, TEXT_COLOR, TEXT_COLOR_3, UI_HIGHLIGHT_0, UI_MA use crate::{i18n::VoxygenLocalization, ui::fonts::ConrodVoxygenFonts}; use client::{self, Client}; -use common::{comp::Stats, sync::Uid}; +use common::sync::Uid; use conrod_core::{ color, widget::{self, Button, Image, Rectangle, Scrollbar, Text}, @@ -14,6 +14,7 @@ widget_ids! { pub struct Ids { frame, close, + title_align, title, bg, icon, @@ -62,8 +63,7 @@ pub struct Social<'a> { imgs: &'a Imgs, fonts: &'a ConrodVoxygenFonts, localized_strings: &'a std::sync::Arc, - stats: &'a Stats, - + //stats: &'a Stats, selected_entity: Option<(specs::Entity, Instant)>, #[conrod(common_builder)] @@ -77,7 +77,7 @@ impl<'a> Social<'a> { imgs: &'a Imgs, fonts: &'a ConrodVoxygenFonts, localized_strings: &'a std::sync::Arc, - stats: &'a Stats, + //stats: &'a Stats, selected_entity: Option<(specs::Entity, Instant)>, ) -> Self { Self { @@ -86,7 +86,7 @@ impl<'a> Social<'a> { imgs, fonts, localized_strings, - stats, + //stats, selected_entity, common: widget::CommonBuilder::default(), } @@ -120,7 +120,11 @@ impl<'a> Widget for Social<'a> { let mut events = Vec::new(); // Window frame and BG - let pos = if self.show.group { 180.0 } else { 25.0 }; + let pos = if self.show.group || self.show.group_menu { + 200.0 + } else { + 25.0 + }; // TODO: Different window visuals depending on the selected tab let window_bg = match &self.show.social_tab { SocialTab::Online => self.imgs.social_bg_on, @@ -133,7 +137,7 @@ impl<'a> Widget for Social<'a> { SocialTab::Faction => self.imgs.social_frame_fact, }; Image::new(window_bg) - .top_left_with_margins_on(ui.window, 200.0, pos) + .bottom_left_with_margins_on(ui.window, 308.0, pos) .color(Some(UI_MAIN)) .w_h(280.0, 460.0) .set(state.ids.bg, ui); @@ -160,10 +164,13 @@ impl<'a> Widget for Social<'a> { } // Title + Rectangle::fill_with([212.0, 42.0], color::TRANSPARENT) + .top_left_with_margins_on(state.ids.frame, 2.0, 44.0) + .set(state.ids.title_align, ui); Text::new(&self.localized_strings.get("hud.social")) - .mid_top_with_margin_on(state.ids.frame, 9.0) + .middle_of(state.ids.title_align) .font_id(self.fonts.cyri.conrod_id) - .font_size(self.fonts.cyri.scale(22)) + .font_size(self.fonts.cyri.scale(20)) .color(TEXT_COLOR) .set(state.ids.title, ui); @@ -186,7 +193,7 @@ impl<'a> Widget for Social<'a> { SocialTab::Online => UI_MAIN, _ => Color::Rgba(1.0, 1.0, 1.0, 0.6), }) - .top_right_with_margins_on(state.ids.frame, 50.0, -28.0) + .top_right_with_margins_on(state.ids.frame, 50.0, -27.0) .set(state.ids.online_tab, ui) .was_clicked() { @@ -322,7 +329,7 @@ impl<'a> Widget for Social<'a> { .font_size(self.fonts.cyri.scale(14)) .color(TEXT_COLOR) .set(state.ids.online_txt, ui); - Text::new(&count.to_string()) + Text::new(&(count - 1).to_string()) .right_from(state.ids.online_txt, 5.0) .font_id(self.fonts.cyri.conrod_id) .font_size(self.fonts.cyri.scale(14)) @@ -356,24 +363,33 @@ impl<'a> Widget for Social<'a> { for (i, (&uid, player_info)) in players.filter(|(uid, _)| Some(**uid) != my_uid).enumerate() { + let hide_username = true; + let zone = "Wilderness"; // TODO Add real zone let selected = state.selected_uid.map_or(false, |u| u.0 == uid); let alias = &player_info.player_alias; - let name = match &player_info.character { - Some(character) => format!("{} ", &character.name), - None => "".to_string(), // character select or spectating + let name_text = match &player_info.character { + Some(character) => { + if Some(uid) == my_uid { + format!( + "{} ({})", + &self.localized_strings.get("hud.common.you"), + &character.name + ) + } else if hide_username { + character.name.clone() + } else { + format!("[{}] {}", alias, &character.name) + } + }, + None => alias.clone(), // character select or spectating }; let level = match &player_info.character { Some(character) => format!("{} ", &character.level), - None => "".to_string(), // character select or spectating + None => "".to_string(), // character select or spectating }; - let setting = true; // TODO Remove this - let zone = "Wilderness"; // TODO: Add real zone - let name_text = if name == self.stats.name { - format!("You ({})", name) // TODO: Locale - } else if setting { - format!("{}", name) - } else { - format!("[{}] {}", alias, name) + let zone_name = match &player_info.character { + None => self.localized_strings.get("hud.group.in_menu").to_string(), /* character select or spectating */ + _ => format!("{} ", &zone), }; // Player name widgets let button = Button::image(if !selected { @@ -417,9 +433,9 @@ impl<'a> Widget for Social<'a> { .color(TEXT_COLOR) .set(state.ids.player_levels[i], ui); let zone_txt = if i == 0 { - Text::new(&zone).mid_top_with_margin_on(state.ids.zones_align, 2.0) + Text::new(&zone_name).mid_top_with_margin_on(state.ids.zones_align, 2.0) } else { - Text::new(&zone).down_from(state.ids.player_zones[i - 1], 2.0) + Text::new(&zone_name).down_from(state.ids.player_zones[i - 1], 2.0) }; zone_txt .font_size(self.fonts.cyri.scale(14)) @@ -494,190 +510,7 @@ impl<'a> Widget for Social<'a> { }); } } - } // End of Online Tab - - // Alignment - /* - // Online Tab - - // Contents - - if let SocialTab::Online = self.show.social_tab { - // Players list - // TODO: this list changes infrequently enough that it should not have to be - // recreated every frame - let players = self.client.player_list.iter().filter(|(_, p)| p.is_online); - let count = players.clone().count(); - if state.ids.player_names.len() < count { - state.update(|s| { - s.ids - .player_names - .resize(count, &mut ui.widget_id_generator()) - }) - } - Text::new( - &self - .localized_strings - .get("hud.social.play_online_fmt") - .replace("{nb_player}", &format!("{:?}", count)), - ) - .top_left_with_margins_on(state.ids.content_align, -2.0, 7.0) - .font_size(self.fonts.cyri.scale(14)) - .font_id(self.fonts.cyri.conrod_id) - .color(TEXT_COLOR) - .set(state.ids.online_title, ui); - - // Clear selected player if an entity was selected - if state - .selected_uid - .zip(self.selected_entity) - // Compare instants - .map_or(false, |(u, e)| u.1 < e.1) - { - state.update(|s| s.selected_uid = None); - } - - for (i, (&uid, player_info)) in players.enumerate() { - let selected = state.selected_uid.map_or(false, |u| u.0 == uid); - let alias = &player_info.player_alias; - let character_name_level = match &player_info.character { - Some(character) => format!("{} Lvl {}", &character.name, &character.level), - None => "".to_string(), // character select or spectating - }; - let text = if selected { - format!("-> [{}] {}", alias, character_name_level) - } else { - format!("[{}] {}", alias, character_name_level) - }; - Text::new(&text) - .down(3.0) - .font_size(self.fonts.cyri.scale(15)) - .font_id(self.fonts.cyri.conrod_id) - .color(TEXT_COLOR) - .set(state.ids.player_names[i], ui); - // Check for click - if ui - .widget_input(state.ids.player_names[i]) - .clicks() - .left() - .next() - .is_some() - { - state.update(|s| s.selected_uid = Some((uid, Instant::now()))); - } - } - - // Invite Button - if self - .client - .group_info() - .map_or(true, |(_, l_uid)| self.client.uid() == Some(l_uid)) - { - let selected = state.selected_uid.map(|s| s.0).or_else(|| { - self.selected_entity - .and_then(|s| self.client.state().read_component_copied(s.0)) - }); - - if Button::image(self.imgs.button) - .down(3.0) - .w_h(150.0, 30.0) - .hover_image(self.imgs.button_hover) - .press_image(self.imgs.button_press) - .label(&self.localized_strings.get("hud.group.invite")) - .label_y(conrod_core::position::Relative::Scalar(3.0)) - .label_color(if selected.is_some() { - TEXT_COLOR - } else { - TEXT_COLOR_3 - }) - .label_font_size(self.fonts.cyri.scale(15)) - .label_font_id(self.fonts.cyri.conrod_id) - .set(state.ids.invite_button, ui) - .was_clicked() - { - if let Some(uid) = selected { - events.push(Event::Invite(uid)); - state.update(|s| { - s.selected_uid = None; - }); - } - } - } - } - - // Friends Tab - - if Button::image(if let SocialTab::Friends = self.show.social_tab { - self.imgs.social_button_pressed - } else { - self.imgs.social_button - }) - .w_h(30.0 * 4.0, 12.0 * 4.0) - .hover_image(if let SocialTab::Friends = self.show.social_tab { - self.imgs.social_button_pressed - } else { - self.imgs.social_button - }) - .press_image(if let SocialTab::Friends = self.show.social_tab { - self.imgs.social_button_pressed - } else { - self.imgs.social_button - }) - .right_from(state.ids.online_tab, 0.0) - .label(&self.localized_strings.get("hud.social.friends")) - .label_font_size(self.fonts.cyri.scale(14)) - .label_font_id(self.fonts.cyri.conrod_id) - .parent(state.ids.frame) - .color(UI_MAIN) - .label_color(TEXT_COLOR_3) - .set(state.ids.friends_tab, ui) - .was_clicked() - { - events.push(Event::ChangeSocialTab(SocialTab::Friends)); - } - - // Contents - - if let SocialTab::Friends = self.show.social_tab { - Text::new(&self.localized_strings.get("hud.social.not_yet_available")) - .middle_of(state.ids.content_align) - .font_size(self.fonts.cyri.scale(18)) - .font_id(self.fonts.cyri.conrod_id) - .color(TEXT_COLOR_3) - .set(state.ids.friends_test, ui); - } - - // Faction Tab - let button_img = if let SocialTab::Faction = self.show.social_tab { - self.imgs.social_button_pressed - } else { - self.imgs.social_button - }; - if Button::image(button_img) - .w_h(30.0 * 4.0, 12.0 * 4.0) - .right_from(state.ids.friends_tab, 0.0) - .label(&self.localized_strings.get("hud.social.faction")) - .parent(state.ids.frame) - .label_font_size(self.fonts.cyri.scale(14)) - .label_font_id(self.fonts.cyri.conrod_id) - .color(UI_MAIN) - .label_color(TEXT_COLOR_3) - .set(state.ids.faction_tab, ui) - .was_clicked() - { - events.push(Event::ChangeSocialTab(SocialTab::Faction)); - } - - // Contents - - if let SocialTab::Faction = self.show.social_tab { - Text::new(&self.localized_strings.get("hud.social.not_yet_available")) - .middle_of(state.ids.content_align) - .font_size(self.fonts.cyri.scale(18)) - .font_id(self.fonts.cyri.conrod_id) - .color(TEXT_COLOR_3) - .set(state.ids.faction_test, ui); - }*/ + } // End of Online Tab events } diff --git a/world/src/site/dungeon/mod.rs b/world/src/site/dungeon/mod.rs index 34d6a0aebf..10cecd7807 100644 --- a/world/src/site/dungeon/mod.rs +++ b/world/src/site/dungeon/mod.rs @@ -522,7 +522,7 @@ impl Floor { "common.items.armor.shoulder.cultist_shoulder_purple", ), 8 => comp::Item::expect_from_asset( - "common.items.weapons.sword.greatsword_2h_fine-0", + "common.items.weapons.staff.cultist_staff", ), 9 => comp::Item::expect_from_asset( "common.items.weapons.sword.greatsword_2h_fine-1",