You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

853 lines
36 KiB

use serde::{Serialize, Deserialize};
#[derive(Debug, Copy, Clone)]
pub enum ItemParseError {
InvalidToolBytes,
InvalidToolType,
}
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq, Serialize, Deserialize, enum_utils::FromStr, derive_more::Display, strum_macros::EnumIter)]
pub enum ToolType {
Monomate,
Dimate,
Trimate,
Monofluid,
Difluid,
Trifluid,
SolAtomizer,
MoonAtomizer,
StarAtomizer,
Antidote,
Antiparalysis,
Telepipe,
TrapVision,
ScapeDoll,
Monogrinder,
Digrinder,
Trigrinder,
PowerMaterial,
MindMaterial,
EvadeMaterial,
HpMaterial,
TpMaterial,
DefMaterial,
LuckMaterial,
CellOfMag502,
CellOfMag213,
PartsOfRobochao,
HeartOfOpaOpa,
HeartOfPian,
HeartOfChao,
SorcerersRightArm,
SBeatsArms,
PArmsArms,
DelsabersRightArm,
BringersRightArm,
DelsabersLeftArm,
SRedsArms,
DragonsClaw,
HildebearsHead,
HildebluesHead,
PartsOfBaranz,
BelrasRightArm,
GiGuesBody,
SinowBerillsArms,
GrassAssassinsArms,
BoomasRightArm,
GoboomasRightArm,
GigoboomasRightArm,
GalGryphonsWing,
RappysWing,
CladdingOfEpsilon,
DeRolLeShell,
BerillPhoton,
ParasiticGeneFlow,
MagicStoneIritista,
BlueBlackStone,
Syncesta,
MagicWater,
ParasiticCellTypeD,
MagicRockHeartKey,
MagicRockMoola,
StarAmplifier,
BookOfHitogata,
HeartOfChuChu,
PartsOfEggBlaster,
HeartOfAngel,
HeartOfDevil,
KitOfHamburger,
PanthersSpirit,
KitOfMark3,
KitOfMasterSystem,
KitOfGenesis,
KitOfSegaSaturn,
KitOfDreamcast,
AmplifierOfResta,
AmplifierOfAnti,
AmplifierOfShifta,
AmplifierOfDeband,
AmplifierOfFoie,
AmplifierOfGifoie,
AmplifierOfRafoie,
AmplifierOfBarta,
AmplifierOfGibarta,
AmplifierOfRabarta,
AmplifierOfZonde,
AmplifierOfGizonde,
AmplifierOfRazonde,
AmplifierOfRed,
AmplifierOfBlue,
AmplifierOfYellow,
HeartOfKapuKapu,
PhotonBooster,
Addslot,
PhotonDrop,
PhotonSphere,
PhotonCrystal,
SecretTicket,
PhotonTicket,
BookOfKatana1,
BookOfKatana2,
BookOfKatana3,
WeaponsBronzeBadge,
WeaponsSilverBadge,
WeaponsGoldBadge,
WeaponsCrystalBadge,
WeaponsSteelBadge,
WeaponsAluminumBadge,
WeaponsLeatherBadge,
WeaponsBoneBadge,
LetterOfAppreciation,
ItemTicket,
ValentinesChocolate,
NewYearsCard,
ChristmasCard,
BirthdayCard,
ProofOfSonicTeam,
SpecialEventTicket,
FlowerBouquet,
Cake,
Accessories,
MrNakasBusinessCard,
Present,
Chocolate,
Candy,
Cake2,
WeaponsSilverBadge2,
WeaponsGoldBadge2,
WeaponsCrystalBadge2,
WeaponsSteelBadge2,
WeaponsAluminumBadge2,
WeaponsLeatherBadge2,
WeaponsBoneBadge2,
Bouquet,
Decoction,
ChristmasPresent,
EasterEgg,
JackOLantern,
DiskVol1WeddingMarch,
DiskVol2DayLight,
DiskVol3BurningRangers,
DiskVol4OpenYourHeart,
DiskVol5LiveLearn,
DiskVol6Nights,
DiskVol7EndingThemePianoVer,
DiskVol8HeartToHeart,
DiskVol9StrangeBlue,
DiskVol10ReunionSystem,
DiskVol11Pinnacles,
DiskVol12FightInsideTheSpaceship,
HuntersReport,
HuntersReport2,
HuntersReport3,
HuntersReport4,
HuntersReport5,
Tablet,
Unknown2,
DragonScale,
HeavenStrikerCoat,
PioneerParts,
AmitiesMemo,
HeartOfMorolian,
RappysBeak,
YahoosEngine,
DPhotonCore,
LibertaKit,
CellOfMag0503,
CellOfMag0504,
CellOfMag0505,
CellOfMag0506,
CellOfMag0507,
TeamPoints500,
TeamPoints1000,
TeamPoints5000,
TeamPoints10000,
}
impl ToolType {
pub fn is_stackable(&self) -> bool {
matches!(self, ToolType::Monomate |
ToolType::Dimate |
ToolType::Trimate |
ToolType::Monofluid |
ToolType::Difluid |
ToolType::Trifluid |
ToolType::SolAtomizer |
ToolType::MoonAtomizer |
ToolType::StarAtomizer |
ToolType::Antidote |
ToolType::Antiparalysis |
ToolType::Telepipe |
ToolType::TrapVision |
ToolType::Monogrinder |
ToolType::Digrinder |
ToolType::Trigrinder |
ToolType::PowerMaterial |
ToolType::MindMaterial |
ToolType::EvadeMaterial |
ToolType::HpMaterial |
ToolType::TpMaterial |
ToolType::DefMaterial |
ToolType::LuckMaterial |
ToolType::Addslot |
ToolType::PhotonDrop |
ToolType::PhotonSphere |
ToolType::PhotonCrystal)
}
pub fn max_stack(&self) -> usize {
match self {
ToolType::Monomate => 10,
ToolType::Dimate => 10,
ToolType::Trimate => 10,
ToolType::Monofluid => 10,
ToolType::Difluid => 10,
ToolType::Trifluid => 10,
ToolType::SolAtomizer => 10,
ToolType::MoonAtomizer => 10,
ToolType::StarAtomizer => 10,
ToolType::Antidote => 10,
ToolType::Antiparalysis => 10,
ToolType::Telepipe => 10,
ToolType::TrapVision => 10,
ToolType::Monogrinder => 99,
ToolType::Digrinder => 99,
ToolType::Trigrinder => 99,
ToolType::PowerMaterial => 99,
ToolType::MindMaterial => 99,
ToolType::EvadeMaterial => 99,
ToolType::HpMaterial => 99,
ToolType::TpMaterial => 99,
ToolType::DefMaterial => 99,
ToolType::LuckMaterial => 99,
ToolType::Addslot => 99,
ToolType::PhotonDrop => 99,
ToolType::PhotonSphere => 99,
ToolType::PhotonCrystal => 99,
_ => 1,
}
}
pub fn is_mag_cell(&self) -> bool {
matches!(self, ToolType::CellOfMag502 |
ToolType::CellOfMag213 |
ToolType::PartsOfRobochao |
ToolType::HeartOfOpaOpa |
ToolType::HeartOfPian |
ToolType::HeartOfChao |
ToolType::HeartOfAngel |
ToolType::HeartOfDevil |
ToolType::KitOfHamburger |
ToolType::PanthersSpirit |
ToolType::KitOfMark3 |
ToolType::KitOfMasterSystem |
ToolType::KitOfGenesis |
ToolType::KitOfSegaSaturn |
ToolType::KitOfDreamcast |
ToolType::Tablet |
ToolType::DragonScale |
ToolType::HeavenStrikerCoat |
ToolType::PioneerParts |
ToolType::AmitiesMemo |
ToolType::HeartOfMorolian |
ToolType::RappysBeak |
ToolType::YahoosEngine |
ToolType::DPhotonCore |
ToolType::LibertaKit |
ToolType::CellOfMag0503 |
ToolType::CellOfMag0504 |
ToolType::CellOfMag0505 |
ToolType::CellOfMag0506 |
ToolType::CellOfMag0507)
}
pub fn value(&self) -> [u8; 3] {
match self {
ToolType::Monomate => [0x03, 0x00, 0x00],
ToolType::Dimate => [0x03, 0x00, 0x01],
ToolType::Trimate => [0x03, 0x00, 0x02],
ToolType::Monofluid => [0x03, 0x01, 0x00],
ToolType::Difluid => [0x03, 0x01, 0x01],
ToolType::Trifluid => [0x03, 0x01, 0x02],
ToolType::SolAtomizer => [0x03, 0x03, 0x00],
ToolType::MoonAtomizer => [0x03, 0x04, 0x00],
ToolType::StarAtomizer => [0x03, 0x05, 0x00],
ToolType::Antidote => [0x03, 0x06, 0x00],
ToolType::Antiparalysis => [0x03, 0x06, 0x01],
ToolType::Telepipe => [0x03, 0x07, 0x00],
ToolType::TrapVision => [0x03, 0x08, 0x00],
ToolType::ScapeDoll => [0x03, 0x09, 0x00],
ToolType::Monogrinder => [0x03, 0x0A, 0x00],
ToolType::Digrinder => [0x03, 0x0A, 0x01],
ToolType::Trigrinder => [0x03, 0x0A, 0x02],
ToolType::PowerMaterial => [0x03, 0x0B, 0x00],
ToolType::MindMaterial => [0x03, 0x0B, 0x01],
ToolType::EvadeMaterial => [0x03, 0x0B, 0x02],
ToolType::HpMaterial => [0x03, 0x0B, 0x03],
ToolType::TpMaterial => [0x03, 0x0B, 0x04],
ToolType::DefMaterial => [0x03, 0x0B, 0x05],
ToolType::LuckMaterial => [0x03, 0x0B, 0x06],
ToolType::CellOfMag502 => [0x03, 0x0C, 0x00],
ToolType::CellOfMag213 => [0x03, 0x0C, 0x01],
ToolType::PartsOfRobochao => [0x03, 0x0C, 0x02],
ToolType::HeartOfOpaOpa => [0x03, 0x0C, 0x03],
ToolType::HeartOfPian => [0x03, 0x0C, 0x04],
ToolType::HeartOfChao => [0x03, 0x0C, 0x05],
ToolType::SorcerersRightArm => [0x03, 0x0D, 0x00],
ToolType::SBeatsArms => [0x03, 0x0D, 0x01],
ToolType::PArmsArms => [0x03, 0x0D, 0x02],
ToolType::DelsabersRightArm => [0x03, 0x0D, 0x03],
ToolType::BringersRightArm => [0x03, 0x0D, 0x04],
ToolType::DelsabersLeftArm => [0x03, 0x0D, 0x05],
ToolType::SRedsArms => [0x03, 0x0D, 0x06],
ToolType::DragonsClaw => [0x03, 0x0D, 0x07],
ToolType::HildebearsHead => [0x03, 0x0D, 0x08],
ToolType::HildebluesHead => [0x03, 0x0D, 0x09],
ToolType::PartsOfBaranz => [0x03, 0x0D, 0x0A],
ToolType::BelrasRightArm => [0x03, 0x0D, 0x0B],
ToolType::GiGuesBody => [0x03, 0x0D, 0x0C],
ToolType::SinowBerillsArms => [0x03, 0x0D, 0x0D],
ToolType::GrassAssassinsArms => [0x03, 0x0D, 0x0E],
ToolType::BoomasRightArm => [0x03, 0x0D, 0x0F],
ToolType::GoboomasRightArm => [0x03, 0x0D, 0x10],
ToolType::GigoboomasRightArm => [0x03, 0x0D, 0x11],
ToolType::GalGryphonsWing => [0x03, 0x0D, 0x12],
ToolType::RappysWing => [0x03, 0x0D, 0x13],
ToolType::CladdingOfEpsilon => [0x03, 0x0D, 0x14],
ToolType::DeRolLeShell => [0x03, 0x0D, 0x15],
ToolType::BerillPhoton => [0x03, 0x0E, 0x00],
ToolType::ParasiticGeneFlow => [0x03, 0x0E, 0x01],
ToolType::MagicStoneIritista => [0x03, 0x0E, 0x02],
ToolType::BlueBlackStone => [0x03, 0x0E, 0x03],
ToolType::Syncesta => [0x03, 0x0E, 0x04],
ToolType::MagicWater => [0x03, 0x0E, 0x05],
ToolType::ParasiticCellTypeD => [0x03, 0x0E, 0x06],
ToolType::MagicRockHeartKey => [0x03, 0x0E, 0x07],
ToolType::MagicRockMoola => [0x03, 0x0E, 0x08],
ToolType::StarAmplifier => [0x03, 0x0E, 0x09],
ToolType::BookOfHitogata => [0x03, 0x0E, 0x0A],
ToolType::HeartOfChuChu => [0x03, 0x0E, 0x0B],
ToolType::PartsOfEggBlaster => [0x03, 0x0E, 0x0C],
ToolType::HeartOfAngel => [0x03, 0x0E, 0x0D],
ToolType::HeartOfDevil => [0x03, 0x0E, 0x0E],
ToolType::KitOfHamburger => [0x03, 0x0E, 0x0F],
ToolType::PanthersSpirit => [0x03, 0x0E, 0x10],
ToolType::KitOfMark3 => [0x03, 0x0E, 0x11],
ToolType::KitOfMasterSystem => [0x03, 0x0E, 0x12],
ToolType::KitOfGenesis => [0x03, 0x0E, 0x13],
ToolType::KitOfSegaSaturn => [0x03, 0x0E, 0x14],
ToolType::KitOfDreamcast => [0x03, 0x0E, 0x15],
ToolType::AmplifierOfResta => [0x03, 0x0E, 0x16],
ToolType::AmplifierOfAnti => [0x03, 0x0E, 0x17],
ToolType::AmplifierOfShifta => [0x03, 0x0E, 0x18],
ToolType::AmplifierOfDeband => [0x03, 0x0E, 0x19],
ToolType::AmplifierOfFoie => [0x03, 0x0E, 0x1A],
ToolType::AmplifierOfGifoie => [0x03, 0x0E, 0x1B],
ToolType::AmplifierOfRafoie => [0x03, 0x0E, 0x1C],
ToolType::AmplifierOfBarta => [0x03, 0x0E, 0x1D],
ToolType::AmplifierOfGibarta => [0x03, 0x0E, 0x1E],
ToolType::AmplifierOfRabarta => [0x03, 0x0E, 0x1F],
ToolType::AmplifierOfZonde => [0x03, 0x0E, 0x20],
ToolType::AmplifierOfGizonde => [0x03, 0x0E, 0x21],
ToolType::AmplifierOfRazonde => [0x03, 0x0E, 0x22],
ToolType::AmplifierOfRed => [0x03, 0x0E, 0x23],
ToolType::AmplifierOfBlue => [0x03, 0x0E, 0x24],
ToolType::AmplifierOfYellow => [0x03, 0x0E, 0x25],
ToolType::HeartOfKapuKapu => [0x03, 0x0E, 0x26],
ToolType::PhotonBooster => [0x03, 0x0E, 0x27],
ToolType::Addslot => [0x03, 0x0F, 0x00],
ToolType::PhotonDrop => [0x03, 0x10, 0x00],
ToolType::PhotonSphere => [0x03, 0x10, 0x01],
ToolType::PhotonCrystal => [0x03, 0x10, 0x02],
ToolType::SecretTicket => [0x03, 0x10, 0x03],
ToolType::PhotonTicket => [0x03, 0x10, 0x04],
ToolType::BookOfKatana1 => [0x03, 0x11, 0x00],
ToolType::BookOfKatana2 => [0x03, 0x11, 0x01],
ToolType::BookOfKatana3 => [0x03, 0x11, 0x02],
ToolType::WeaponsBronzeBadge => [0x03, 0x12, 0x00],
ToolType::WeaponsSilverBadge => [0x03, 0x12, 0x01],
ToolType::WeaponsGoldBadge => [0x03, 0x12, 0x02],
ToolType::WeaponsCrystalBadge => [0x03, 0x12, 0x03],
ToolType::WeaponsSteelBadge => [0x03, 0x12, 0x04],
ToolType::WeaponsAluminumBadge => [0x03, 0x12, 0x05],
ToolType::WeaponsLeatherBadge => [0x03, 0x12, 0x06],
ToolType::WeaponsBoneBadge => [0x03, 0x12, 0x07],
ToolType::LetterOfAppreciation => [0x03, 0x12, 0x08],
ToolType::ItemTicket => [0x03, 0x12, 0x09],
ToolType::ValentinesChocolate => [0x03, 0x12, 0x0A],
ToolType::NewYearsCard => [0x03, 0x12, 0x0B],
ToolType::ChristmasCard => [0x03, 0x12, 0x0C],
ToolType::BirthdayCard => [0x03, 0x12, 0x0D],
ToolType::ProofOfSonicTeam => [0x03, 0x12, 0x0E],
ToolType::SpecialEventTicket => [0x03, 0x12, 0x0F],
ToolType::FlowerBouquet => [0x03, 0x12, 0x10],
ToolType::Cake => [0x03, 0x12, 0x11],
ToolType::Accessories => [0x03, 0x12, 0x12],
ToolType::MrNakasBusinessCard => [0x03, 0x12, 0x13],
ToolType::Present => [0x03, 0x13, 0x00],
ToolType::Chocolate => [0x03, 0x14, 0x00],
ToolType::Candy => [0x03, 0x14, 0x01],
ToolType::Cake2 => [0x03, 0x14, 0x02],
ToolType::WeaponsSilverBadge2 => [0x03, 0x14, 0x03],
ToolType::WeaponsGoldBadge2 => [0x03, 0x14, 0x04],
ToolType::WeaponsCrystalBadge2 => [0x03, 0x14, 0x05],
ToolType::WeaponsSteelBadge2 => [0x03, 0x14, 0x06],
ToolType::WeaponsAluminumBadge2 => [0x03, 0x14, 0x07],
ToolType::WeaponsLeatherBadge2 => [0x03, 0x14, 0x08],
ToolType::WeaponsBoneBadge2 => [0x03, 0x14, 0x09],
ToolType::Bouquet => [0x03, 0x14, 0x0A],
ToolType::Decoction => [0x03, 0x14, 0x0B],
ToolType::ChristmasPresent => [0x03, 0x15, 0x00],
ToolType::EasterEgg => [0x03, 0x15, 0x01],
ToolType::JackOLantern => [0x03, 0x15, 0x02],
ToolType::DiskVol1WeddingMarch => [0x03, 0x16, 0x00],
ToolType::DiskVol2DayLight => [0x03, 0x16, 0x01],
ToolType::DiskVol3BurningRangers => [0x03, 0x16, 0x02],
ToolType::DiskVol4OpenYourHeart => [0x03, 0x16, 0x03],
ToolType::DiskVol5LiveLearn => [0x03, 0x16, 0x04],
ToolType::DiskVol6Nights => [0x03, 0x16, 0x05],
ToolType::DiskVol7EndingThemePianoVer => [0x03, 0x16, 0x06],
ToolType::DiskVol8HeartToHeart => [0x03, 0x16, 0x07],
ToolType::DiskVol9StrangeBlue => [0x03, 0x16, 0x08],
ToolType::DiskVol10ReunionSystem => [0x03, 0x16, 0x09],
ToolType::DiskVol11Pinnacles => [0x03, 0x16, 0x0A],
ToolType::DiskVol12FightInsideTheSpaceship => [0x03, 0x16, 0x0B],
ToolType::HuntersReport => [0x03, 0x17, 0x00],
ToolType::HuntersReport2 => [0x03, 0x17, 0x01],
ToolType::HuntersReport3 => [0x03, 0x17, 0x02],
ToolType::HuntersReport4 => [0x03, 0x17, 0x03],
ToolType::HuntersReport5 => [0x03, 0x17, 0x04],
ToolType::Tablet => [0x03, 0x18, 0x00],
ToolType::Unknown2 => [0x03, 0x18, 0x01],
ToolType::DragonScale => [0x03, 0x18, 0x02],
ToolType::HeavenStrikerCoat => [0x03, 0x18, 0x03],
ToolType::PioneerParts => [0x03, 0x18, 0x04],
ToolType::AmitiesMemo => [0x03, 0x18, 0x05],
ToolType::HeartOfMorolian => [0x03, 0x18, 0x06],
ToolType::RappysBeak => [0x03, 0x18, 0x07],
ToolType::YahoosEngine => [0x03, 0x18, 0x08],
ToolType::DPhotonCore => [0x03, 0x18, 0x09],
ToolType::LibertaKit => [0x03, 0x18, 0x0A],
ToolType::CellOfMag0503 => [0x03, 0x18, 0x0B],
ToolType::CellOfMag0504 => [0x03, 0x18, 0x0C],
ToolType::CellOfMag0505 => [0x03, 0x18, 0x0D],
ToolType::CellOfMag0506 => [0x03, 0x18, 0x0E],
ToolType::CellOfMag0507 => [0x03, 0x18, 0x0F],
ToolType::TeamPoints500 => [0x03, 0x19, 0x00],
ToolType::TeamPoints1000 => [0x03, 0x19, 0x01],
ToolType::TeamPoints5000 => [0x03, 0x19, 0x02],
ToolType::TeamPoints10000 => [0x03, 0x19, 0x03],
}
}
pub fn parse_type(data: [u8; 3]) -> Result<ToolType, ItemParseError> {
match data {
[0x03, 0x00, 0x00] => Ok(ToolType::Monomate),
[0x03, 0x00, 0x01] => Ok(ToolType::Dimate),
[0x03, 0x00, 0x02] => Ok(ToolType::Trimate),
[0x03, 0x01, 0x00] => Ok(ToolType::Monofluid),
[0x03, 0x01, 0x01] => Ok(ToolType::Difluid),
[0x03, 0x01, 0x02] => Ok(ToolType::Trifluid),
[0x03, 0x03, 0x00] => Ok(ToolType::SolAtomizer),
[0x03, 0x04, 0x00] => Ok(ToolType::MoonAtomizer),
[0x03, 0x05, 0x00] => Ok(ToolType::StarAtomizer),
[0x03, 0x06, 0x00] => Ok(ToolType::Antidote),
[0x03, 0x06, 0x01] => Ok(ToolType::Antiparalysis),
[0x03, 0x07, 0x00] => Ok(ToolType::Telepipe),
[0x03, 0x08, 0x00] => Ok(ToolType::TrapVision),
[0x03, 0x09, 0x00] => Ok(ToolType::ScapeDoll),
[0x03, 0x0A, 0x00] => Ok(ToolType::Monogrinder),
[0x03, 0x0A, 0x01] => Ok(ToolType::Digrinder),
[0x03, 0x0A, 0x02] => Ok(ToolType::Trigrinder),
[0x03, 0x0B, 0x00] => Ok(ToolType::PowerMaterial),
[0x03, 0x0B, 0x01] => Ok(ToolType::MindMaterial),
[0x03, 0x0B, 0x02] => Ok(ToolType::EvadeMaterial),
[0x03, 0x0B, 0x03] => Ok(ToolType::HpMaterial),
[0x03, 0x0B, 0x04] => Ok(ToolType::TpMaterial),
[0x03, 0x0B, 0x05] => Ok(ToolType::DefMaterial),
[0x03, 0x0B, 0x06] => Ok(ToolType::LuckMaterial),
[0x03, 0x0C, 0x00] => Ok(ToolType::CellOfMag502),
[0x03, 0x0C, 0x01] => Ok(ToolType::CellOfMag213),
[0x03, 0x0C, 0x02] => Ok(ToolType::PartsOfRobochao),
[0x03, 0x0C, 0x03] => Ok(ToolType::HeartOfOpaOpa),
[0x03, 0x0C, 0x04] => Ok(ToolType::HeartOfPian),
[0x03, 0x0C, 0x05] => Ok(ToolType::HeartOfChao),
[0x03, 0x0D, 0x00] => Ok(ToolType::SorcerersRightArm),
[0x03, 0x0D, 0x01] => Ok(ToolType::SBeatsArms),
[0x03, 0x0D, 0x02] => Ok(ToolType::PArmsArms),
[0x03, 0x0D, 0x03] => Ok(ToolType::DelsabersRightArm),
[0x03, 0x0D, 0x04] => Ok(ToolType::BringersRightArm),
[0x03, 0x0D, 0x05] => Ok(ToolType::DelsabersLeftArm),
[0x03, 0x0D, 0x06] => Ok(ToolType::SRedsArms),
[0x03, 0x0D, 0x07] => Ok(ToolType::DragonsClaw),
[0x03, 0x0D, 0x08] => Ok(ToolType::HildebearsHead),
[0x03, 0x0D, 0x09] => Ok(ToolType::HildebluesHead),
[0x03, 0x0D, 0x0A] => Ok(ToolType::PartsOfBaranz),
[0x03, 0x0D, 0x0B] => Ok(ToolType::BelrasRightArm),
[0x03, 0x0D, 0x0C] => Ok(ToolType::GiGuesBody),
[0x03, 0x0D, 0x0D] => Ok(ToolType::SinowBerillsArms),
[0x03, 0x0D, 0x0E] => Ok(ToolType::GrassAssassinsArms),
[0x03, 0x0D, 0x0F] => Ok(ToolType::BoomasRightArm),
[0x03, 0x0D, 0x10] => Ok(ToolType::GoboomasRightArm),
[0x03, 0x0D, 0x11] => Ok(ToolType::GigoboomasRightArm),
[0x03, 0x0D, 0x12] => Ok(ToolType::GalGryphonsWing),
[0x03, 0x0D, 0x13] => Ok(ToolType::RappysWing),
[0x03, 0x0D, 0x14] => Ok(ToolType::CladdingOfEpsilon),
[0x03, 0x0D, 0x15] => Ok(ToolType::DeRolLeShell),
[0x03, 0x0E, 0x00] => Ok(ToolType::BerillPhoton),
[0x03, 0x0E, 0x01] => Ok(ToolType::ParasiticGeneFlow),
[0x03, 0x0E, 0x02] => Ok(ToolType::MagicStoneIritista),
[0x03, 0x0E, 0x03] => Ok(ToolType::BlueBlackStone),
[0x03, 0x0E, 0x04] => Ok(ToolType::Syncesta),
[0x03, 0x0E, 0x05] => Ok(ToolType::MagicWater),
[0x03, 0x0E, 0x06] => Ok(ToolType::ParasiticCellTypeD),
[0x03, 0x0E, 0x07] => Ok(ToolType::MagicRockHeartKey),
[0x03, 0x0E, 0x08] => Ok(ToolType::MagicRockMoola),
[0x03, 0x0E, 0x09] => Ok(ToolType::StarAmplifier),
[0x03, 0x0E, 0x0A] => Ok(ToolType::BookOfHitogata),
[0x03, 0x0E, 0x0B] => Ok(ToolType::HeartOfChuChu),
[0x03, 0x0E, 0x0C] => Ok(ToolType::PartsOfEggBlaster),
[0x03, 0x0E, 0x0D] => Ok(ToolType::HeartOfAngel),
[0x03, 0x0E, 0x0E] => Ok(ToolType::HeartOfDevil),
[0x03, 0x0E, 0x0F] => Ok(ToolType::KitOfHamburger),
[0x03, 0x0E, 0x10] => Ok(ToolType::PanthersSpirit),
[0x03, 0x0E, 0x11] => Ok(ToolType::KitOfMark3),
[0x03, 0x0E, 0x12] => Ok(ToolType::KitOfMasterSystem),
[0x03, 0x0E, 0x13] => Ok(ToolType::KitOfGenesis),
[0x03, 0x0E, 0x14] => Ok(ToolType::KitOfSegaSaturn),
[0x03, 0x0E, 0x15] => Ok(ToolType::KitOfDreamcast),
[0x03, 0x0E, 0x16] => Ok(ToolType::AmplifierOfResta),
[0x03, 0x0E, 0x17] => Ok(ToolType::AmplifierOfAnti),
[0x03, 0x0E, 0x18] => Ok(ToolType::AmplifierOfShifta),
[0x03, 0x0E, 0x19] => Ok(ToolType::AmplifierOfDeband),
[0x03, 0x0E, 0x1A] => Ok(ToolType::AmplifierOfFoie),
[0x03, 0x0E, 0x1B] => Ok(ToolType::AmplifierOfGifoie),
[0x03, 0x0E, 0x1C] => Ok(ToolType::AmplifierOfRafoie),
[0x03, 0x0E, 0x1D] => Ok(ToolType::AmplifierOfBarta),
[0x03, 0x0E, 0x1E] => Ok(ToolType::AmplifierOfGibarta),
[0x03, 0x0E, 0x1F] => Ok(ToolType::AmplifierOfRabarta),
[0x03, 0x0E, 0x20] => Ok(ToolType::AmplifierOfZonde),
[0x03, 0x0E, 0x21] => Ok(ToolType::AmplifierOfGizonde),
[0x03, 0x0E, 0x22] => Ok(ToolType::AmplifierOfRazonde),
[0x03, 0x0E, 0x23] => Ok(ToolType::AmplifierOfRed),
[0x03, 0x0E, 0x24] => Ok(ToolType::AmplifierOfBlue),
[0x03, 0x0E, 0x25] => Ok(ToolType::AmplifierOfYellow),
[0x03, 0x0E, 0x26] => Ok(ToolType::HeartOfKapuKapu),
[0x03, 0x0E, 0x27] => Ok(ToolType::PhotonBooster),
[0x03, 0x0F, 0x00] => Ok(ToolType::Addslot),
[0x03, 0x10, 0x00] => Ok(ToolType::PhotonDrop),
[0x03, 0x10, 0x01] => Ok(ToolType::PhotonSphere),
[0x03, 0x10, 0x02] => Ok(ToolType::PhotonCrystal),
[0x03, 0x10, 0x03] => Ok(ToolType::SecretTicket),
[0x03, 0x10, 0x04] => Ok(ToolType::PhotonTicket),
[0x03, 0x11, 0x00] => Ok(ToolType::BookOfKatana1),
[0x03, 0x11, 0x01] => Ok(ToolType::BookOfKatana2),
[0x03, 0x11, 0x02] => Ok(ToolType::BookOfKatana3),
[0x03, 0x12, 0x00] => Ok(ToolType::WeaponsBronzeBadge),
[0x03, 0x12, 0x01] => Ok(ToolType::WeaponsSilverBadge),
[0x03, 0x12, 0x02] => Ok(ToolType::WeaponsGoldBadge),
[0x03, 0x12, 0x03] => Ok(ToolType::WeaponsCrystalBadge),
[0x03, 0x12, 0x04] => Ok(ToolType::WeaponsSteelBadge),
[0x03, 0x12, 0x05] => Ok(ToolType::WeaponsAluminumBadge),
[0x03, 0x12, 0x06] => Ok(ToolType::WeaponsLeatherBadge),
[0x03, 0x12, 0x07] => Ok(ToolType::WeaponsBoneBadge),
[0x03, 0x12, 0x08] => Ok(ToolType::LetterOfAppreciation),
[0x03, 0x12, 0x09] => Ok(ToolType::ItemTicket),
[0x03, 0x12, 0x0A] => Ok(ToolType::ValentinesChocolate),
[0x03, 0x12, 0x0B] => Ok(ToolType::NewYearsCard),
[0x03, 0x12, 0x0C] => Ok(ToolType::ChristmasCard),
[0x03, 0x12, 0x0D] => Ok(ToolType::BirthdayCard),
[0x03, 0x12, 0x0E] => Ok(ToolType::ProofOfSonicTeam),
[0x03, 0x12, 0x0F] => Ok(ToolType::SpecialEventTicket),
[0x03, 0x12, 0x10] => Ok(ToolType::FlowerBouquet),
[0x03, 0x12, 0x11] => Ok(ToolType::Cake),
[0x03, 0x12, 0x12] => Ok(ToolType::Accessories),
[0x03, 0x12, 0x13] => Ok(ToolType::MrNakasBusinessCard),
[0x03, 0x13, 0x00] => Ok(ToolType::Present),
[0x03, 0x14, 0x00] => Ok(ToolType::Chocolate),
[0x03, 0x14, 0x01] => Ok(ToolType::Candy),
[0x03, 0x14, 0x02] => Ok(ToolType::Cake2),
[0x03, 0x14, 0x03] => Ok(ToolType::WeaponsSilverBadge2),
[0x03, 0x14, 0x04] => Ok(ToolType::WeaponsGoldBadge2),
[0x03, 0x14, 0x05] => Ok(ToolType::WeaponsCrystalBadge2),
[0x03, 0x14, 0x06] => Ok(ToolType::WeaponsSteelBadge2),
[0x03, 0x14, 0x07] => Ok(ToolType::WeaponsAluminumBadge2),
[0x03, 0x14, 0x08] => Ok(ToolType::WeaponsLeatherBadge2),
[0x03, 0x14, 0x09] => Ok(ToolType::WeaponsBoneBadge2),
[0x03, 0x14, 0x0A] => Ok(ToolType::Bouquet),
[0x03, 0x14, 0x0B] => Ok(ToolType::Decoction),
[0x03, 0x15, 0x00] => Ok(ToolType::ChristmasPresent),
[0x03, 0x15, 0x01] => Ok(ToolType::EasterEgg),
[0x03, 0x15, 0x02] => Ok(ToolType::JackOLantern),
[0x03, 0x16, 0x00] => Ok(ToolType::DiskVol1WeddingMarch),
[0x03, 0x16, 0x01] => Ok(ToolType::DiskVol2DayLight),
[0x03, 0x16, 0x02] => Ok(ToolType::DiskVol3BurningRangers),
[0x03, 0x16, 0x03] => Ok(ToolType::DiskVol4OpenYourHeart),
[0x03, 0x16, 0x04] => Ok(ToolType::DiskVol5LiveLearn),
[0x03, 0x16, 0x05] => Ok(ToolType::DiskVol6Nights),
[0x03, 0x16, 0x06] => Ok(ToolType::DiskVol7EndingThemePianoVer),
[0x03, 0x16, 0x07] => Ok(ToolType::DiskVol8HeartToHeart),
[0x03, 0x16, 0x08] => Ok(ToolType::DiskVol9StrangeBlue),
[0x03, 0x16, 0x09] => Ok(ToolType::DiskVol10ReunionSystem),
[0x03, 0x16, 0x0A] => Ok(ToolType::DiskVol11Pinnacles),
[0x03, 0x16, 0x0B] => Ok(ToolType::DiskVol12FightInsideTheSpaceship),
[0x03, 0x17, 0x00] => Ok(ToolType::HuntersReport),
[0x03, 0x17, 0x01] => Ok(ToolType::HuntersReport2),
[0x03, 0x17, 0x02] => Ok(ToolType::HuntersReport3),
[0x03, 0x17, 0x03] => Ok(ToolType::HuntersReport4),
[0x03, 0x17, 0x04] => Ok(ToolType::HuntersReport5),
[0x03, 0x18, 0x00] => Ok(ToolType::Tablet),
[0x03, 0x18, 0x01] => Ok(ToolType::Unknown2),
[0x03, 0x18, 0x02] => Ok(ToolType::DragonScale),
[0x03, 0x18, 0x03] => Ok(ToolType::HeavenStrikerCoat),
[0x03, 0x18, 0x04] => Ok(ToolType::PioneerParts),
[0x03, 0x18, 0x05] => Ok(ToolType::AmitiesMemo),
[0x03, 0x18, 0x06] => Ok(ToolType::HeartOfMorolian),
[0x03, 0x18, 0x07] => Ok(ToolType::RappysBeak),
[0x03, 0x18, 0x08] => Ok(ToolType::YahoosEngine),
[0x03, 0x18, 0x09] => Ok(ToolType::DPhotonCore),
[0x03, 0x18, 0x0A] => Ok(ToolType::LibertaKit),
[0x03, 0x18, 0x0B] => Ok(ToolType::CellOfMag0503),
[0x03, 0x18, 0x0C] => Ok(ToolType::CellOfMag0504),
[0x03, 0x18, 0x0D] => Ok(ToolType::CellOfMag0505),
[0x03, 0x18, 0x0E] => Ok(ToolType::CellOfMag0506),
[0x03, 0x18, 0x0F] => Ok(ToolType::CellOfMag0507),
[0x03, 0x19, 0x00] => Ok(ToolType::TeamPoints500),
[0x03, 0x19, 0x01] => Ok(ToolType::TeamPoints1000),
[0x03, 0x19, 0x02] => Ok(ToolType::TeamPoints5000),
[0x03, 0x19, 0x03] => Ok(ToolType::TeamPoints10000),
_ => Err(ItemParseError::InvalidToolType),
}
}
}
#[derive(Copy, Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct Tool {
pub tool: ToolType,
}
impl Tool {
pub fn as_individual_bytes(&self) -> [u8; 16] {
let mut result = [0; 16];
result[0..3].copy_from_slice(&self.tool.value());
result
}
pub fn as_stacked_bytes(&self, len: usize) -> [u8; 16] {
let mut result = [0; 16];
result[0..3].copy_from_slice(&self.tool.value());
result[5] = len as u8;
result
}
pub fn from_bytes(data: [u8; 16]) -> Result<Tool, ItemParseError> {
let t = ToolType::parse_type([data[0], data[1], data[2]]);
if let Ok(t) = t {
Ok(Tool {
tool: t,
})
}
else {
Err(ItemParseError::InvalidToolBytes) // TODO: error handling if wrong bytes are given
}
}
pub fn is_stackable(&self) -> bool {
self.tool.is_stackable()
}
pub fn max_stack(&self) -> usize {
self.tool.max_stack()
}
pub fn is_rare_item(self) -> bool {
matches!(
self.tool,
ToolType::CellOfMag502
| ToolType::CellOfMag213
| ToolType::PartsOfRobochao
| ToolType::HeartOfOpaOpa
| ToolType::HeartOfPian
| ToolType::HeartOfChao
| ToolType::SorcerersRightArm
| ToolType::SBeatsArms
| ToolType::PArmsArms
| ToolType::DelsabersRightArm
| ToolType::BringersRightArm
| ToolType::DelsabersLeftArm
| ToolType::SRedsArms
| ToolType::DragonsClaw
| ToolType::HildebearsHead
| ToolType::HildebluesHead
| ToolType::PartsOfBaranz
| ToolType::BelrasRightArm
| ToolType::GiGuesBody
| ToolType::SinowBerillsArms
| ToolType::GrassAssassinsArms
| ToolType::BoomasRightArm
| ToolType::GoboomasRightArm
| ToolType::GigoboomasRightArm
| ToolType::GalGryphonsWing
| ToolType::RappysWing
| ToolType::CladdingOfEpsilon
| ToolType::DeRolLeShell
| ToolType::BerillPhoton
| ToolType::ParasiticGeneFlow
| ToolType::MagicStoneIritista
| ToolType::BlueBlackStone
| ToolType::Syncesta
| ToolType::MagicWater
| ToolType::ParasiticCellTypeD
| ToolType::MagicRockHeartKey
| ToolType::MagicRockMoola
| ToolType::StarAmplifier
| ToolType::BookOfHitogata
| ToolType::HeartOfChuChu
| ToolType::PartsOfEggBlaster
| ToolType::HeartOfAngel
| ToolType::HeartOfDevil
| ToolType::KitOfHamburger
| ToolType::PanthersSpirit
| ToolType::KitOfMark3
| ToolType::KitOfMasterSystem
| ToolType::KitOfGenesis
| ToolType::KitOfSegaSaturn
| ToolType::KitOfDreamcast
| ToolType::AmplifierOfResta
| ToolType::AmplifierOfAnti
| ToolType::AmplifierOfShifta
| ToolType::AmplifierOfDeband
| ToolType::AmplifierOfFoie
| ToolType::AmplifierOfGifoie
| ToolType::AmplifierOfRafoie
| ToolType::AmplifierOfBarta
| ToolType::AmplifierOfGibarta
| ToolType::AmplifierOfRabarta
| ToolType::AmplifierOfZonde
| ToolType::AmplifierOfGizonde
| ToolType::AmplifierOfRazonde
| ToolType::AmplifierOfRed
| ToolType::AmplifierOfBlue
| ToolType::AmplifierOfYellow
| ToolType::HeartOfKapuKapu
| ToolType::PhotonBooster
| ToolType::Addslot
| ToolType::PhotonDrop
| ToolType::PhotonSphere
| ToolType::PhotonCrystal
| ToolType::SecretTicket
| ToolType::PhotonTicket
| ToolType::BookOfKatana1
| ToolType::BookOfKatana2
| ToolType::BookOfKatana3
| ToolType::WeaponsBronzeBadge
| ToolType::WeaponsSilverBadge
| ToolType::WeaponsGoldBadge
| ToolType::WeaponsCrystalBadge
| ToolType::WeaponsSteelBadge
| ToolType::WeaponsAluminumBadge
| ToolType::WeaponsLeatherBadge
| ToolType::WeaponsBoneBadge
| ToolType::LetterOfAppreciation
| ToolType::ItemTicket
| ToolType::ValentinesChocolate
| ToolType::NewYearsCard
| ToolType::ChristmasCard
| ToolType::BirthdayCard
| ToolType::ProofOfSonicTeam
| ToolType::SpecialEventTicket
| ToolType::FlowerBouquet
| ToolType::Cake
| ToolType::Accessories
| ToolType::MrNakasBusinessCard
| ToolType::Present
| ToolType::Chocolate
| ToolType::Candy
| ToolType::Cake2
| ToolType::WeaponsSilverBadge2
| ToolType::WeaponsGoldBadge2
| ToolType::WeaponsCrystalBadge2
| ToolType::WeaponsSteelBadge2
| ToolType::WeaponsAluminumBadge2
| ToolType::WeaponsLeatherBadge2
| ToolType::WeaponsBoneBadge2
| ToolType::Bouquet
| ToolType::Decoction
| ToolType::ChristmasPresent
| ToolType::EasterEgg
| ToolType::JackOLantern
| ToolType::DiskVol1WeddingMarch
| ToolType::DiskVol2DayLight
| ToolType::DiskVol3BurningRangers
| ToolType::DiskVol4OpenYourHeart
| ToolType::DiskVol5LiveLearn
| ToolType::DiskVol6Nights
| ToolType::DiskVol7EndingThemePianoVer
| ToolType::DiskVol8HeartToHeart
| ToolType::DiskVol9StrangeBlue
| ToolType::DiskVol10ReunionSystem
| ToolType::DiskVol11Pinnacles
| ToolType::DiskVol12FightInsideTheSpaceship
| ToolType::HuntersReport
| ToolType::HuntersReport2
| ToolType::HuntersReport3
| ToolType::HuntersReport4
| ToolType::HuntersReport5
| ToolType::Tablet
| ToolType::Unknown2
| ToolType::DragonScale
| ToolType::HeavenStrikerCoat
| ToolType::PioneerParts
| ToolType::AmitiesMemo
| ToolType::HeartOfMorolian
| ToolType::RappysBeak
| ToolType::YahoosEngine
| ToolType::DPhotonCore
| ToolType::LibertaKit
| ToolType::CellOfMag0503
| ToolType::CellOfMag0504
| ToolType::CellOfMag0505
| ToolType::CellOfMag0506
| ToolType::CellOfMag0507
| ToolType::TeamPoints500
| ToolType::TeamPoints1000
| ToolType::TeamPoints5000
| ToolType::TeamPoints10000
)
}
// TODO: do we actually need this function?
pub fn is_material(self) -> bool {
matches!(
self.tool,
ToolType::PowerMaterial
| ToolType::MindMaterial
| ToolType::EvadeMaterial
| ToolType::HpMaterial
| ToolType::TpMaterial
| ToolType::DefMaterial
| ToolType::LuckMaterial
)
}
}