-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6ec2f70
commit aeb85f6
Showing
6 changed files
with
115 additions
and
71 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,3 +11,4 @@ pub mod spike; | |
pub mod wand; | ||
pub mod wearable_gem; | ||
pub mod melee_weapon; | ||
pub mod boots; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
use crate::conversion::item_subtype; | ||
use crate::model::{Item, ItemType}; | ||
use crate::model::item_subtype::{BootsSubType, ItemSubType}; | ||
|
||
pub fn boots(item: &Item) -> String { | ||
match item_subtype::from_i64(ItemType::Boots, item.subval) { | ||
Some(item_subtype) => match item_subtype { | ||
ItemSubType::Boots(boots_subtype) => match boots_subtype { | ||
BootsSubType::SoftLeatherShoes => "soft leather shoes", | ||
BootsSubType::SoftLeatherBoots => "soft leather boots", | ||
BootsSubType::HardLeatherBoots => "hard leather boots", | ||
BootsSubType::Sandals => "sandals", | ||
BootsSubType::ChainBoots => "chain boots", | ||
BootsSubType::LightPlatedBoots => "light plated boots", | ||
BootsSubType::SharkskinBoots => "sharkskin boots", | ||
BootsSubType::DemonhideBoots => "demonhide boots", | ||
BootsSubType::WyrmhideBoot => "wyrmhide boots", | ||
} | ||
_ => "alien boots", | ||
} | ||
Check warning Code scanning / clippy this match can be collapsed into the outer match Warning
this match can be collapsed into the outer match
|
||
None => "alien boots", | ||
}.to_string() | ||
} | ||
|
||
#[cfg(test)] | ||
mod tests { | ||
use crate::data::item_name::generate; | ||
use crate::generate_item; | ||
use crate::generate_item::template::{BootsTemplate, MiscUsableTemplate}; | ||
|
||
#[test] | ||
fn test_names() { | ||
for (template, expected_name) in [ | ||
(Box::new(BootsTemplate::SoftLeatherShoes), "soft leather shoes"), | ||
(Box::new(BootsTemplate::SoftLeatherBoots), "soft leather boots"), | ||
(Box::new(BootsTemplate::HardLeatherBoots), "hard leather boots"), | ||
(Box::new(BootsTemplate::Sandals), "sandals"), | ||
(Box::new(BootsTemplate::ChainBoots), "chain boots"), | ||
(Box::new(BootsTemplate::LightPlatedBoots), "light plated boots"), | ||
(Box::new(BootsTemplate::SharkskinBoots), "sharkskin boots"), | ||
(Box::new(BootsTemplate::DemonhideBoots), "demonhide boots"), | ||
(Box::new(BootsTemplate::WyrmhideBoot), "wyrmhide boots"), | ||
] { | ||
let item = generate_item::generate(template, 0); | ||
assert_eq!(generate(&item), expected_name); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.