From dddb47a38567ae58046ad40033a5d5bc6a41356a Mon Sep 17 00:00:00 2001 From: Snowram Date: Sat, 3 Jul 2021 03:27:20 +0200 Subject: [PATCH] Makes dungeons start at level 1 visually --- CHANGELOG.md | 1 + .../element/ui/map/buttons/dungeon_hover.png | 4 +- assets/voxygen/element/ui/map/icons/dif_3.png | 4 +- assets/voxygen/element/ui/map/icons/dif_4.png | 4 +- assets/voxygen/element/ui/map/icons/dif_5.png | 4 +- .../element/ui/map/icons/dif_unknown.png | 3 + voxygen/src/hud/img_ids.rs | 1 + voxygen/src/hud/map.rs | 68 ++++++++++--------- voxygen/src/hud/minimap.rs | 29 ++++---- 9 files changed, 65 insertions(+), 53 deletions(-) create mode 100644 assets/voxygen/element/ui/map/icons/dif_unknown.png diff --git a/CHANGELOG.md b/CHANGELOG.md index 29efb0ee00..1bca9a3765 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -50,6 +50,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Usage of "stamina" replaced with "energy" - Glider dimensions now depend on character height - Glider dimensions somewhat increased overall +- Dungeon difficulty level starts at 1 instead of 0 ### Removed diff --git a/assets/voxygen/element/ui/map/buttons/dungeon_hover.png b/assets/voxygen/element/ui/map/buttons/dungeon_hover.png index 538853936d..480ac2a0ae 100644 --- a/assets/voxygen/element/ui/map/buttons/dungeon_hover.png +++ b/assets/voxygen/element/ui/map/buttons/dungeon_hover.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:076043e069acf0350db3cf3e7a48eb5432ac0eb932298518e71133676bc18637 -size 142 +oid sha256:ffe704cb645b9b0db11b84094b8f9ee11e04793e2fc716f4208371c5e93e57d5 +size 140 diff --git a/assets/voxygen/element/ui/map/icons/dif_3.png b/assets/voxygen/element/ui/map/icons/dif_3.png index 7693512c70..b88f520bdb 100644 --- a/assets/voxygen/element/ui/map/icons/dif_3.png +++ b/assets/voxygen/element/ui/map/icons/dif_3.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:68bfc4b33e4ca4c3144054d4df585187a92ee618f5e485c1c818b0f5f140a581 -size 82 +oid sha256:bf21e452bffcdec7c74d59e86189f61e678a83e64800c76556216e25ef5cf35b +size 91 diff --git a/assets/voxygen/element/ui/map/icons/dif_4.png b/assets/voxygen/element/ui/map/icons/dif_4.png index 2aaba70368..317a36fa0c 100644 --- a/assets/voxygen/element/ui/map/icons/dif_4.png +++ b/assets/voxygen/element/ui/map/icons/dif_4.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:b7fbd97ef333a1837cad086d1ec1bbf24570b4fd2db516b0c85d322e2839b4dd -size 83 +oid sha256:0710afbbe2b4f333ba9a1e268af6da940b79b887a089b6258978571e2e26e59b +size 98 diff --git a/assets/voxygen/element/ui/map/icons/dif_5.png b/assets/voxygen/element/ui/map/icons/dif_5.png index f1a1cd22de..cd194e84f6 100644 --- a/assets/voxygen/element/ui/map/icons/dif_5.png +++ b/assets/voxygen/element/ui/map/icons/dif_5.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:ea721c094f259fd9581030d25f7a80e2dbda65f0e9488c6f2d9ac1b64fc1e966 -size 83 +oid sha256:9c11a3e00c8f1ba1481e86d7df65f9d3a5cbf2b5366dab9b623605872a9e77f9 +size 95 diff --git a/assets/voxygen/element/ui/map/icons/dif_unknown.png b/assets/voxygen/element/ui/map/icons/dif_unknown.png new file mode 100644 index 0000000000..233c0b91b3 --- /dev/null +++ b/assets/voxygen/element/ui/map/icons/dif_unknown.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e58b9fb6b567a0c7d3f938d266ef13df642fbf8133c327aacabd18b7051ca896 +size 95 diff --git a/voxygen/src/hud/img_ids.rs b/voxygen/src/hud/img_ids.rs index ba0badbcbe..0db29cd2e8 100644 --- a/voxygen/src/hud/img_ids.rs +++ b/voxygen/src/hud/img_ids.rs @@ -384,6 +384,7 @@ image_ids! { map_dif_4: "voxygen.element.ui.map.icons.dif_4", map_dif_5: "voxygen.element.ui.map.icons.dif_5", map_dif_6: "voxygen.element.ui.map.icons.dif_6", + map_dif_unknown: "voxygen.element.ui.map.icons.dif_unknown", mmap_site_town: "voxygen.element.ui.map.buttons.town", mmap_site_town_hover: "voxygen.element.ui.map.buttons.town_hover", mmap_site_town_bg: "voxygen.element.ui.map.buttons.town_bg", diff --git a/voxygen/src/hud/map.rs b/voxygen/src/hud/map.rs index 9039add9b4..8db489b8ff 100644 --- a/voxygen/src/hud/map.rs +++ b/voxygen/src/hud/map.rs @@ -787,15 +787,15 @@ impl<'a> Widget for Map<'a> { SiteKind::Tree => i18n.get("hud.map.tree"), }); let (difficulty, desc) = match &site.kind { - SiteKind::Town => (0, i18n.get("hud.map.town").to_string()), + SiteKind::Town => (None, i18n.get("hud.map.town").to_string()), SiteKind::Dungeon { difficulty } => ( - *difficulty, + Some(*difficulty), i18n.get("hud.map.difficulty_dungeon") - .replace("{difficulty}", difficulty.to_string().as_str()), + .replace("{difficulty}", (difficulty + 1).to_string().as_str()), ), - SiteKind::Castle => (0, i18n.get("hud.map.castle").to_string()), - SiteKind::Cave => (0, i18n.get("hud.map.cave").to_string()), - SiteKind::Tree => (0, i18n.get("hud.map.tree").to_string()), + SiteKind::Castle => (None, i18n.get("hud.map.castle").to_string()), + SiteKind::Cave => (None, i18n.get("hud.map.cave").to_string()), + SiteKind::Tree => (None, i18n.get("hud.map.tree").to_string()), }; let desc = desc + &get_site_economy(site_rich); let site_btn = Button::image(match &site.kind { @@ -828,12 +828,12 @@ impl<'a> Widget for Map<'a> { SiteKind::Town => TEXT_COLOR, SiteKind::Castle => TEXT_COLOR, SiteKind::Dungeon { .. } => match difficulty { - 0 => QUALITY_LOW, - 1 => QUALITY_COMMON, - 2 => QUALITY_MODERATE, - 3 => QUALITY_HIGH, - 4 => QUALITY_EPIC, - 5 => QUALITY_DEBUG, + Some(0) => QUALITY_LOW, + Some(1) => QUALITY_COMMON, + Some(2) => QUALITY_MODERATE, + Some(3) => QUALITY_HIGH, + Some(4) => QUALITY_EPIC, + Some(5) => QUALITY_DEBUG, _ => TEXT_COLOR, }, SiteKind::Cave => TEXT_COLOR, @@ -859,34 +859,40 @@ impl<'a> Widget for Map<'a> { // Difficulty from 0-6 // 0 = towns and places without a difficulty level if show_difficulty { - let size = 1.8; // Size factor for difficulty indicators + let rsize = zoom * 1.8; // Size factor for difficulty indicators let dif_img = Image::new(match difficulty { - 1 => self.imgs.map_dif_1, - 2 => self.imgs.map_dif_2, - 3 => self.imgs.map_dif_3, - 4 => self.imgs.map_dif_4, - 5 => self.imgs.map_dif_6, - _ => self.imgs.nothing, + Some(0) => self.imgs.map_dif_1, + Some(1) => self.imgs.map_dif_2, + Some(2) => self.imgs.map_dif_3, + Some(3) => self.imgs.map_dif_4, + Some(4) => self.imgs.map_dif_5, + Some(5) => self.imgs.map_dif_6, + Some(_) => self.imgs.map_dif_unknown, + None => self.imgs.nothing, }) .mid_top_with_margin_on(state.ids.mmap_site_icons[i], match difficulty { - 5 => -2.0 * zoom * size, - _ => -1.0 * zoom * size, + Some(0 | 1) => -1.0 * rsize, + Some(_) => -2.0 * rsize, + _ => -1.0 * rsize, }) .w(match difficulty { - 5 => 2.0 * zoom * size, - _ => 1.0 * zoom * size * difficulty as f64, + Some(0) => 1.0 * rsize, + Some(1 | 2 | 5) => 2.0 * rsize, + Some(_) => 3.0 * rsize, + _ => 1.0 * rsize, }) .h(match difficulty { - 5 => 2.0 * size * zoom, - _ => 1.0 * zoom * size, + Some(0 | 1) => 1.0 * rsize, + Some(_) => 2.0 * rsize, + _ => 1.0 * rsize, }) .color(Some(match difficulty { - 0 => QUALITY_LOW, - 1 => QUALITY_COMMON, - 2 => QUALITY_MODERATE, - 3 => QUALITY_HIGH, - 4 => QUALITY_EPIC, - 5 => QUALITY_DEBUG, + Some(0) => QUALITY_LOW, + Some(1) => QUALITY_COMMON, + Some(2) => QUALITY_MODERATE, + Some(3) => QUALITY_HIGH, + Some(4) => QUALITY_EPIC, + Some(5) => QUALITY_DEBUG, _ => TEXT_COLOR, })); match &site.kind { diff --git a/voxygen/src/hud/minimap.rs b/voxygen/src/hud/minimap.rs index 754d3cbf3a..47f89059e0 100644 --- a/voxygen/src/hud/minimap.rs +++ b/voxygen/src/hud/minimap.rs @@ -688,6 +688,13 @@ impl<'a> Widget for MiniMap<'a> { Some(rpos) => rpos, None => continue, }; + let difficulty = match &site.kind { + SiteKind::Town => None, + SiteKind::Dungeon { difficulty } => Some(*difficulty), + SiteKind::Castle => None, + SiteKind::Cave => None, + SiteKind::Tree => None, + }; Image::new(match &site.kind { SiteKind::Town => self.imgs.mmap_site_town_bg, @@ -702,20 +709,14 @@ impl<'a> Widget for MiniMap<'a> { position::Relative::Scalar(rpos.y as f64), ) .w_h(20.0, 20.0) - .color(Some(match &site.kind { - SiteKind::Town => Color::Rgba(1.0, 1.0, 1.0, 0.0), - SiteKind::Castle => Color::Rgba(1.0, 1.0, 1.0, 0.0), - SiteKind::Dungeon { difficulty } => match difficulty { - 0 => QUALITY_LOW, - 1 => QUALITY_COMMON, - 2 => QUALITY_MODERATE, - 3 => QUALITY_HIGH, - 4 => QUALITY_EPIC, - 5 => QUALITY_DEBUG, - _ => Color::Rgba(1.0, 1.0, 1.0, 0.0), - }, - SiteKind::Cave => Color::Rgba(1.0, 1.0, 1.0, 0.0), - SiteKind::Tree => Color::Rgba(1.0, 1.0, 1.0, 0.0), + .color(Some(match difficulty { + Some(0) => QUALITY_LOW, + Some(1) => QUALITY_COMMON, + Some(2) => QUALITY_MODERATE, + Some(3) => QUALITY_HIGH, + Some(4) => QUALITY_EPIC, + Some(5) => QUALITY_DEBUG, + _ => Color::Rgba(1.0, 1.0, 1.0, 0.0), })) .set(state.ids.mmap_site_icons_bgs[i], ui); Image::new(match &site.kind {