1
Fork 0
mirror of https://github.com/redstrate/Physis.git synced 2025-04-19 17:36:50 +00:00

Differentiate between left and right ring slots

Credit to LouisBrunner for pointing this out.
This commit is contained in:
Joshua Goins 2025-03-08 09:10:51 -05:00
parent c9018336c8
commit 8d6f3a45b3

View file

@ -21,10 +21,12 @@ pub enum Slot {
Earring,
/// The neck slot. Shorthand is "nek".
Neck,
/// The ring slot. Shorthand is "rir".
Rings,
/// The wrists slot. Shorthand is "wrs".
Wrists,
/// The right ring slot. Shorthand is "ril".
RingLeft,
/// The left ring slot. Shorthand is "rir".
RingRight,
}
/// Returns the shorthand abbreviation of `slot`. For example, Body's shorthand is "top".
@ -37,8 +39,9 @@ pub fn get_slot_abbreviation(slot: Slot) -> &'static str {
Slot::Body => "top",
Slot::Earring => "ear",
Slot::Neck => "nek",
Slot::Rings => "rir",
Slot::Wrists => "wrs",
Slot::RingLeft => "ril",
Slot::RingRight => "rir",
}
}
@ -47,14 +50,15 @@ pub fn get_slot_abbreviation(slot: Slot) -> &'static str {
pub fn get_slot_from_id(id: i32) -> Option<Slot> {
match id {
3 => Some(Slot::Head),
4 => Some(Slot::Body),
5 => Some(Slot::Hands),
7 => Some(Slot::Legs),
8 => Some(Slot::Feet),
4 => Some(Slot::Body),
9 => Some(Slot::Earring),
10 => Some(Slot::Neck),
12 => Some(Slot::Rings),
11 => Some(Slot::Wrists),
12 => Some(Slot::RingLeft),
13 => Some(Slot::RingRight),
_ => None,
}
}
@ -70,8 +74,9 @@ pub fn get_slot_from_abbreviation(abrev: &str) -> Option<Slot> {
"top" => Some(Slot::Body),
"ear" => Some(Slot::Earring),
"nek" => Some(Slot::Neck),
"rir" => Some(Slot::Rings),
"wrs" => Some(Slot::Wrists),
"ril" => Some(Slot::RingLeft),
"rir" => Some(Slot::RingRight),
_ => None,
}
}