use crate::entity::item::ItemEntityId;
use serde::{Serialize, Deserialize};

#[derive(Debug, Copy, Clone)]
pub enum ItemParseError {
    InvalidWeaponBytes,
    InvalidWeaponType,
    InvalidWeaponGrind,
    InvalidWeaponSpecial,
    InvalidWeaponAttribute,
}

#[derive(Debug, Copy, Clone, PartialEq, Hash, Eq, Ord, PartialOrd, Serialize, Deserialize)]
pub enum Attribute {
    Native = 1,
    ABeast,
    Machine,
    Dark,
    Hit
}

impl Attribute {
    pub fn from(data: u8) -> Option<Attribute> {
        match data {
            1 => Some(Attribute::Native),
            2 => Some(Attribute::ABeast),
            3 => Some(Attribute::Machine),
            4 => Some(Attribute::Dark),
            5 => Some(Attribute::Hit),
            _ => None,
        }
    }
}

#[derive(Debug, Copy, Clone, PartialEq, Serialize, Deserialize)]
pub struct WeaponAttribute {
    pub attr: Attribute,
    pub value: i8,
}

impl WeaponAttribute {
    pub fn value(&self) -> [u8; 2] {
        [self.attr as u8, self.value as u8]
    }
}


#[derive(Debug, Copy, Clone, PartialEq, Serialize, Deserialize)]
pub enum WeaponSpecial {
    Draw = 1,
    Drain,
    Fill,
    Gush,
    Heart,
    Mind,
    Soul,
    Geist,
    Masters,
    Lords,
    Kings,
    Charge,
    Spirit,
    Berserk,
    Ice,
    Frost,
    Freeze,
    Blizzard,
    Bind,
    Hold,
    Seize,
    Arrest,
    Heat,
    Fire,
    Flame,
    Burning,
    Shock,
    Thunder,
    Storm,
    Tempest,
    Dim,
    Shadow,
    Dark,
    Hell,
    Panic,
    Riot,
    Havoc,
    Chaos,
    Devils,
    Demons,
}

impl WeaponSpecial {
    pub fn value(&self) -> u8 {
        *self as u8
    }

    pub fn from(data: u8) -> Option<WeaponSpecial> {
        match data {
            1 =>  Some(WeaponSpecial::Draw),
            2 =>  Some(WeaponSpecial::Drain),
            3 =>  Some(WeaponSpecial::Fill),
            4 =>  Some(WeaponSpecial::Gush),
            5 =>  Some(WeaponSpecial::Heart),
            6 =>  Some(WeaponSpecial::Mind),
            7 =>  Some(WeaponSpecial::Soul),
            8 =>  Some(WeaponSpecial::Geist),
            9 =>  Some(WeaponSpecial::Masters),
            10 => Some(WeaponSpecial::Lords),
            11 => Some(WeaponSpecial::Kings),
            12 => Some(WeaponSpecial::Charge),
            13 => Some(WeaponSpecial::Spirit),
            14 => Some(WeaponSpecial::Berserk),
            15 => Some(WeaponSpecial::Ice),
            16 => Some(WeaponSpecial::Frost),
            17 => Some(WeaponSpecial::Freeze),
            18 => Some(WeaponSpecial::Blizzard),
            19 => Some(WeaponSpecial::Bind),
            20 => Some(WeaponSpecial::Hold),
            21 => Some(WeaponSpecial::Seize),
            22 => Some(WeaponSpecial::Arrest),
            23 => Some(WeaponSpecial::Heat),
            24 => Some(WeaponSpecial::Fire),
            25 => Some(WeaponSpecial::Flame),
            26 => Some(WeaponSpecial::Burning),
            27 => Some(WeaponSpecial::Shock),
            28 => Some(WeaponSpecial::Thunder),
            29 => Some(WeaponSpecial::Storm),
            30 => Some(WeaponSpecial::Tempest),
            31 => Some(WeaponSpecial::Dim),
            32 => Some(WeaponSpecial::Shadow),
            33 => Some(WeaponSpecial::Dark),
            34 => Some(WeaponSpecial::Hell),
            35 => Some(WeaponSpecial::Panic),
            36 => Some(WeaponSpecial::Riot),
            37 => Some(WeaponSpecial::Havoc),
            38 => Some(WeaponSpecial::Chaos),
            39 => Some(WeaponSpecial::Devils),
            40 => Some(WeaponSpecial::Demons),
            _ => None,
        }
    }
}

#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash, Serialize, Deserialize, enum_utils::FromStr, derive_more::Display)]
pub enum WeaponType {
    Saber,
    Brand,
    Buster,
    Pallasch,
    Gladius,
    DbsSaber,
    Kaladbolg,
    Durandal,
    Galatine,
    Sword,
    Gigush,
    Breaker,
    Claymore,
    Calibur,
    FlowensSword,
    LastSurvivor,
    DragonSlayer,
    Dagger,
    Knife,
    Blade,
    Edge,
    Ripper,
    BladeDance,
    BloodyArt,
    CrossScar,
    ZeroDivide,
    TwoKamui,
    Partisan,
    Halbert,
    Glaive,
    Berdys,
    Gungnir,
    Brionac,
    Vjaya,
    GaeBolg,
    AsteronBelt,
    Slicer,
    Spinner,
    Cutter,
    Sawcer,
    Diska,
    SlicerOfAssassin,
    DiskaOfLiberator,
    DiskaOfBraveman,
    Izmaela,
    Handgun,
    Autogun,
    Lockgun,
    Railgun,
    Raygun,
    Varista,
    CustomRayVerOo,
    Bravace,
    TensionBlaster,
    Rifle,
    Sniper,
    Blaster,
    Beam,
    Laser,
    Visk235W,
    WalsMk2,
    Justy23St,
    Rianov303snr,
    Rianov303snr1,
    Rianov303snr2,
    Rianov303snr3,
    Rianov303snr4,
    Rianov303snr5,
    Mechgun,
    Assault,
    Repeater,
    Gatling,
    Vulcan,
    MA60Vise,
    HS25Justice,
    LK14Combat,
    Shot,
    Spread,
    Cannon,
    Launcher,
    Arms,
    CrushBullet,
    MeteorSmash,
    FinalImpact,
    Cane,
    Stick,
    Mace,
    Club,
    ClubOfLaconium,
    MaceOfAdaman,
    ClubOfZumiuran,
    Lollipop,
    Rod,
    Pole,
    Pillar,
    Striker,
    BattleVerge,
    BraveHammer,
    AliveAqhu,
    Valkyrie,
    Wand,
    Staff,
    Baton,
    Scepter,
    FireScepterAgni,
    IceStaffDagon,
    StormWandIndra,
    EarthWandBrownie,
    PhotonClaw,
    SilenceClaw,
    NeisClaw,
    PhoenixClaw,
    DoubleSaber,
    StagCutlery,
    TwinBrand,
    BraveKnuckle,
    AngryFist,
    GodHand,
    SonicKnuckle,
    Login,
    Orotiagito,
    Agito1975,
    Agito1983,
    Agito2001,
    Agito1991,
    Agito1977,
    Agito1980,
    Raikiri,
    SoulEater,
    SoulBanish,
    SpreadNeedle,
    HolyRay,
    InfernoBazooka,
    RamblingMay,
    LK38Combat,
    FlameVisit,
    BurningVisit,
    AkikosFryingPan,
    SorcerersCane,
    SBeatsBlade,
    PArmssBlade,
    DelsabersBuster,
    BringersRifle,
    EggBlaster,
    PsychoWand,
    HeavenPunisher,
    LavisCannon,
    VictorAxe,
    LaconiumAxe,
    ChainSawd,
    Caduceus,
    MercuriusRod,
    StingTip,
    MagicalPiece,
    TechnicalCrozier,
    SuppressedGun,
    AncientSaber,
    HarisenBattleFan,
    Yamigarasu,
    AkikosWok,
    ToyHammer,
    Elysion,
    RedSaber,
    MeteorCudgel,
    MonkeyKingBar,
    BlackKingBar,
    DoubleCannon,
    Girasole,
    HugeBattleFan,
    TsumikiriJSword,
    SealedJSword,
    RedSword,
    CrazyTune,
    TwinChakram,
    WokOfAkikosShop,
    LavisBlade,
    RedDagger,
    MadamsParasol,
    MadamsUmbrella,
    ImperialPick,
    Berdysh,
    RedPartisan,
    FlightCutter,
    FlightFan,
    RedSlicer,
    HandgunGuld,
    MasterRaven,
    HandgunMilla,
    LastSwan,
    RedHandgun,
    FrozenShooter,
    SnowQueen,
    AntiAndroidRifle,
    RocketPunch,
    SambaMaracas,
    TwinPsychogun,
    DrillLauncher,
    GuldMilla,
    DualBird,
    RedMechgun,
    BelraCannon,
    PanzerFaust,
    IronFaust,
    SummitMoon,
    Windmill,
    EvilCurst,
    FlowerCane,
    HildebearsCane,
    HildebluesCane,
    RabbitWand,
    PlantainLeaf,
    Fatsia,
    DemonicFork,
    StrikerOfChao,
    Broom,
    ProphetsOfMotav,
    TheSighOfAGod,
    TwinkleStar,
    PlantainFan,
    TwinBlaze,
    MarinasBag,
    DragonsClaw,
    PanthersClaw,
    SRedsBlade,
    PlantainHugeFan,
    ChameleonScythe,
    Yasminkov3000R,
    AnoRifle,
    BaranzLauncher,
    BranchOfPakupaku,
    HeartOfPoumn,
    Yasminkov2000H,
    Yasminkov7000V,
    Yasminkov9000M,
    MaserBeam,
    PowerMaser,
    GameMagazne,
    Login2,
    FlowerBouquet,
    Musashi,
    Yamato,
    Asuka,
    SangeYasha,
    Sange,
    Yasha,
    Kamui,
    PhotonLauncher,
    GuiltyLight,
    RedScorpio,
    PhononMaser,
    Talis,
    Mahu,
    Hitogata,
    DancingHitogata,
    Kunai,
    Nug2000Bazooka,
    SBerillsHands0,
    SBerillsHands1,
    FlowensSword3060,
    FlowensSword3064,
    FlowensSword3067,
    FlowensSword3073,
    FlowensSword3077,
    FlowensSword3082,
    FlowensSword3083,
    FlowensSword3084,
    FlowensSword3079,
    DbsSaber3062,
    DbsSaber3067,
    DbsSaber3069Chris,
    DbsSaber3064,
    DbsSaber3069Torato,
    DbsSaber3073,
    DbsSaber3070,
    DbsSaber3075,
    DbsSaber3077,
    GiGueBazooka,
    Guardianna,
    ViridiaCard,
    GreenillCard,
    SkylyCard,
    BluefullCard,
    PurplenumCard,
    PinkalCard,
    RedriaCard,
    OranCard,
    YellowbozeCard,
    WhitillCard,
    MorningGlory,
    PartisanOfLightning,
    GalWind,
    Zanba,
    RikasClaw,
    AngelHarp,
    DemolitionComet,
    NeisClaw2,
    RainbowBaton,
    DarkFlow,
    DarkMeteor,
    DarkBridge,
    GAssassinsSabers,
    RappysFan,
    BoomasClaw,
    GoboomasClaw,
    GigoboomasClaw,
    RubyBullet,
    AmoreRose,
    SlicerOfFanatic,
    LameDArgent,
    Excalibur,
    RageDeFeu,
    RageDeFeu2,
    RageDeFeu3,
    RageDeFeu4,
    DaisyChain,
    OphelieSeize,
    MilleMarteaux,
    LeCogneur,
    CommanderBlade,
    Vivienne,
    Kusanagi,
    SacredDuster,
    Guren,
    Shouren,
    Jizai,
    Flamberge,
    Yunchang,
    SnakeSpire,
    FlapjackFlapper,
    Getsugasan,
    Maguwa,
    HeavenStriker,
    CannonRouge,
    MeteorRouge,
    Solferino,
    Clio,
    SirenGlassHammer,
    GlideDivine,
    Shichishito,
    Murasame,
    DaylightScar,
    Decalog,
    FifthAnnivBlade,
    TyrellsParasol,
    AkikosCleaver,
    Tanegashima,
    TreeClippers,
    NiceShot,
    Unknown3,
    Unknown4,
    AnoBazooka,
    Synthesizer,
    BambooSpear,
    KaneiTsuho,
    Jitte,
    ButterflyNet,
    Syringe,
    Battledore,
    Racket,
    Hammer,
    GreatBouquet,
    TypesaSaber,
    TypeslSaber,
    TypeslSlicer,
    TypeslClaw,
    TypeslKatana,
    TypejsSaber,
    TypejsSlicer,
    TypejsJSword,
    TypeswSword,
    TypeswSlicer,
    TypeswJSword,
    TyperoSword,
    TyperoHalbert,
    TyperoRod,
    TypeblBlade,
    TypeknBlade,
    TypeknClaw,
    TypehaHalbert,
    TypehaRod,
    TypedsDSaber,
    TypedsRod,
    Typeds,
    TypeclClaw,
    TypessSw,
    TypeguHand,
    TypeguMechgun,
    TyperiRifle,
    TypemeMechgun,
    TypeshShot,
    TypewaWand,
}

impl WeaponType {
    pub fn value(&self) -> [u8; 3] {
        match self {
            WeaponType::Saber => [0x00, 0x01, 0x00],
            WeaponType::Brand => [0x00, 0x01, 0x01],
            WeaponType::Buster => [0x00, 0x01, 0x02],
            WeaponType::Pallasch => [0x00, 0x01, 0x03],
            WeaponType::Gladius => [0x00, 0x01, 0x04],
            WeaponType::DbsSaber => [0x00, 0x01, 0x05],
            WeaponType::Kaladbolg => [0x00, 0x01, 0x06],
            WeaponType::Durandal => [0x00, 0x01, 0x07],
            WeaponType::Galatine => [0x00, 0x01, 0x08],
            WeaponType::Sword => [0x00, 0x02, 0x00],
            WeaponType::Gigush => [0x00, 0x02, 0x01],
            WeaponType::Breaker => [0x00, 0x02, 0x02],
            WeaponType::Claymore => [0x00, 0x02, 0x03],
            WeaponType::Calibur => [0x00, 0x02, 0x04],
            WeaponType::FlowensSword => [0x00, 0x02, 0x05],
            WeaponType::LastSurvivor => [0x00, 0x02, 0x06],
            WeaponType::DragonSlayer => [0x00, 0x02, 0x07],
            WeaponType::Dagger => [0x00, 0x03, 0x00],
            WeaponType::Knife => [0x00, 0x03, 0x01],
            WeaponType::Blade => [0x00, 0x03, 0x02],
            WeaponType::Edge => [0x00, 0x03, 0x03],
            WeaponType::Ripper => [0x00, 0x03, 0x04],
            WeaponType::BladeDance => [0x00, 0x03, 0x05],
            WeaponType::BloodyArt => [0x00, 0x03, 0x06],
            WeaponType::CrossScar => [0x00, 0x03, 0x07],
            WeaponType::ZeroDivide => [0x00, 0x03, 0x08],
            WeaponType::TwoKamui => [0x00, 0x03, 0x09],
            WeaponType::Partisan => [0x00, 0x04, 0x00],
            WeaponType::Halbert => [0x00, 0x04, 0x01],
            WeaponType::Glaive => [0x00, 0x04, 0x02],
            WeaponType::Berdys => [0x00, 0x04, 0x03],
            WeaponType::Gungnir => [0x00, 0x04, 0x04],
            WeaponType::Brionac => [0x00, 0x04, 0x05],
            WeaponType::Vjaya => [0x00, 0x04, 0x06],
            WeaponType::GaeBolg => [0x00, 0x04, 0x07],
            WeaponType::AsteronBelt => [0x00, 0x04, 0x08],
            WeaponType::Slicer => [0x00, 0x05, 0x00],
            WeaponType::Spinner => [0x00, 0x05, 0x01],
            WeaponType::Cutter => [0x00, 0x05, 0x02],
            WeaponType::Sawcer => [0x00, 0x05, 0x03],
            WeaponType::Diska => [0x00, 0x05, 0x04],
            WeaponType::SlicerOfAssassin => [0x00, 0x05, 0x05],
            WeaponType::DiskaOfLiberator => [0x00, 0x05, 0x06],
            WeaponType::DiskaOfBraveman => [0x00, 0x05, 0x07],
            WeaponType::Izmaela => [0x00, 0x05, 0x08],
            WeaponType::Handgun => [0x00, 0x06, 0x00],
            WeaponType::Autogun => [0x00, 0x06, 0x01],
            WeaponType::Lockgun => [0x00, 0x06, 0x02],
            WeaponType::Railgun => [0x00, 0x06, 0x03],
            WeaponType::Raygun => [0x00, 0x06, 0x04],
            WeaponType::Varista => [0x00, 0x06, 0x05],
            WeaponType::CustomRayVerOo => [0x00, 0x06, 0x06],
            WeaponType::Bravace => [0x00, 0x06, 0x07],
            WeaponType::TensionBlaster => [0x00, 0x06, 0x08],
            WeaponType::Rifle => [0x00, 0x07, 0x00],
            WeaponType::Sniper => [0x00, 0x07, 0x01],
            WeaponType::Blaster => [0x00, 0x07, 0x02],
            WeaponType::Beam => [0x00, 0x07, 0x03],
            WeaponType::Laser => [0x00, 0x07, 0x04],
            WeaponType::Visk235W => [0x00, 0x07, 0x05],
            WeaponType::WalsMk2 => [0x00, 0x07, 0x06],
            WeaponType::Justy23St => [0x00, 0x07, 0x07],
            WeaponType::Rianov303snr => [0x00, 0x07, 0x08],
            WeaponType::Rianov303snr1 => [0x00, 0x07, 0x09],
            WeaponType::Rianov303snr2 => [0x00, 0x07, 0x0A],
            WeaponType::Rianov303snr3 => [0x00, 0x07, 0x0B],
            WeaponType::Rianov303snr4 => [0x00, 0x07, 0x0C],
            WeaponType::Rianov303snr5 => [0x00, 0x07, 0x0D],
            WeaponType::Mechgun => [0x00, 0x08, 0x00],
            WeaponType::Assault => [0x00, 0x08, 0x01],
            WeaponType::Repeater => [0x00, 0x08, 0x02],
            WeaponType::Gatling => [0x00, 0x08, 0x03],
            WeaponType::Vulcan => [0x00, 0x08, 0x04],
            WeaponType::MA60Vise => [0x00, 0x08, 0x05],
            WeaponType::HS25Justice => [0x00, 0x08, 0x06],
            WeaponType::LK14Combat => [0x00, 0x08, 0x07],
            WeaponType::Shot => [0x00, 0x09, 0x00],
            WeaponType::Spread => [0x00, 0x09, 0x01],
            WeaponType::Cannon => [0x00, 0x09, 0x02],
            WeaponType::Launcher => [0x00, 0x09, 0x03],
            WeaponType::Arms => [0x00, 0x09, 0x04],
            WeaponType::CrushBullet => [0x00, 0x09, 0x05],
            WeaponType::MeteorSmash => [0x00, 0x09, 0x06],
            WeaponType::FinalImpact => [0x00, 0x09, 0x07],
            WeaponType::Cane => [0x00, 0x0A, 0x00],
            WeaponType::Stick => [0x00, 0x0A, 0x01],
            WeaponType::Mace => [0x00, 0x0A, 0x02],
            WeaponType::Club => [0x00, 0x0A, 0x03],
            WeaponType::ClubOfLaconium => [0x00, 0x0A, 0x04],
            WeaponType::MaceOfAdaman => [0x00, 0x0A, 0x05],
            WeaponType::ClubOfZumiuran => [0x00, 0x0A, 0x06],
            WeaponType::Lollipop => [0x00, 0x0A, 0x07],
            WeaponType::Rod => [0x00, 0x0B, 0x00],
            WeaponType::Pole => [0x00, 0x0B, 0x01],
            WeaponType::Pillar => [0x00, 0x0B, 0x02],
            WeaponType::Striker => [0x00, 0x0B, 0x03],
            WeaponType::BattleVerge => [0x00, 0x0B, 0x04],
            WeaponType::BraveHammer => [0x00, 0x0B, 0x05],
            WeaponType::AliveAqhu => [0x00, 0x0B, 0x06],
            WeaponType::Valkyrie => [0x00, 0x0B, 0x07],
            WeaponType::Wand => [0x00, 0x0C, 0x00],
            WeaponType::Staff => [0x00, 0x0C, 0x01],
            WeaponType::Baton => [0x00, 0x0C, 0x02],
            WeaponType::Scepter => [0x00, 0x0C, 0x03],
            WeaponType::FireScepterAgni => [0x00, 0x0C, 0x04],
            WeaponType::IceStaffDagon => [0x00, 0x0C, 0x05],
            WeaponType::StormWandIndra => [0x00, 0x0C, 0x06],
            WeaponType::EarthWandBrownie => [0x00, 0x0C, 0x07],
            WeaponType::PhotonClaw => [0x00, 0x0D, 0x00],
            WeaponType::SilenceClaw => [0x00, 0x0D, 0x01],
            WeaponType::NeisClaw => [0x00, 0x0D, 0x02],
            WeaponType::PhoenixClaw => [0x00, 0x0D, 0x03],
            WeaponType::DoubleSaber => [0x00, 0x0E, 0x00],
            WeaponType::StagCutlery => [0x00, 0x0E, 0x01],
            WeaponType::TwinBrand => [0x00, 0x0E, 0x02],
            WeaponType::BraveKnuckle => [0x00, 0x0F, 0x00],
            WeaponType::AngryFist => [0x00, 0x0F, 0x01],
            WeaponType::GodHand => [0x00, 0x0F, 0x02],
            WeaponType::SonicKnuckle => [0x00, 0x0F, 0x03],
            WeaponType::Login => [0x00, 0x0F, 0x04],
            WeaponType::Orotiagito => [0x00, 0x10, 0x00],
            WeaponType::Agito1975 => [0x00, 0x10, 0x01],
            WeaponType::Agito1983 => [0x00, 0x10, 0x02],
            WeaponType::Agito2001 => [0x00, 0x10, 0x03],
            WeaponType::Agito1991 => [0x00, 0x10, 0x04],
            WeaponType::Agito1977 => [0x00, 0x10, 0x05],
            WeaponType::Agito1980 => [0x00, 0x10, 0x06],
            WeaponType::Raikiri => [0x00, 0x10, 0x07],
            WeaponType::SoulEater => [0x00, 0x11, 0x00],
            WeaponType::SoulBanish => [0x00, 0x11, 0x01],
            WeaponType::SpreadNeedle => [0x00, 0x12, 0x00],
            WeaponType::HolyRay => [0x00, 0x13, 0x00],
            WeaponType::InfernoBazooka => [0x00, 0x14, 0x00],
            WeaponType::RamblingMay => [0x00, 0x14, 0x01],
            WeaponType::LK38Combat => [0x00, 0x14, 0x02],
            WeaponType::FlameVisit => [0x00, 0x15, 0x00],
            WeaponType::BurningVisit => [0x00, 0x15, 0x01],
            WeaponType::AkikosFryingPan => [0x00, 0x16, 0x00],
            WeaponType::SorcerersCane => [0x00, 0x17, 0x00],
            WeaponType::SBeatsBlade => [0x00, 0x18, 0x00],
            WeaponType::PArmssBlade => [0x00, 0x19, 0x00],
            WeaponType::DelsabersBuster => [0x00, 0x1A, 0x00],
            WeaponType::BringersRifle => [0x00, 0x1B, 0x00],
            WeaponType::EggBlaster => [0x00, 0x1C, 0x00],
            WeaponType::PsychoWand => [0x00, 0x1D, 0x00],
            WeaponType::HeavenPunisher => [0x00, 0x1E, 0x00],
            WeaponType::LavisCannon => [0x00, 0x1F, 0x00],
            WeaponType::VictorAxe => [0x00, 0x20, 0x00],
            WeaponType::LaconiumAxe => [0x00, 0x20, 0x01],
            WeaponType::ChainSawd => [0x00, 0x21, 0x00],
            WeaponType::Caduceus => [0x00, 0x22, 0x00],
            WeaponType::MercuriusRod => [0x00, 0x22, 0x01],
            WeaponType::StingTip => [0x00, 0x23, 0x00],
            WeaponType::MagicalPiece => [0x00, 0x24, 0x00],
            WeaponType::TechnicalCrozier => [0x00, 0x25, 0x00],
            WeaponType::SuppressedGun => [0x00, 0x26, 0x00],
            WeaponType::AncientSaber => [0x00, 0x27, 0x00],
            WeaponType::HarisenBattleFan => [0x00, 0x28, 0x00],
            WeaponType::Yamigarasu => [0x00, 0x29, 0x00],
            WeaponType::AkikosWok => [0x00, 0x2A, 0x00],
            WeaponType::ToyHammer => [0x00, 0x2B, 0x00],
            WeaponType::Elysion => [0x00, 0x2C, 0x00],
            WeaponType::RedSaber => [0x00, 0x2D, 0x00],
            WeaponType::MeteorCudgel => [0x00, 0x2E, 0x00],
            WeaponType::MonkeyKingBar => [0x00, 0x2F, 0x00],
            WeaponType::BlackKingBar => [0x00, 0x2F, 0x01],
            WeaponType::DoubleCannon => [0x00, 0x30, 0x00],
            WeaponType::Girasole => [0x00, 0x30, 0x01],
            WeaponType::HugeBattleFan => [0x00, 0x31, 0x00],
            WeaponType::TsumikiriJSword => [0x00, 0x32, 0x00],
            WeaponType::SealedJSword => [0x00, 0x33, 0x00],
            WeaponType::RedSword => [0x00, 0x34, 0x00],
            WeaponType::CrazyTune => [0x00, 0x35, 0x00],
            WeaponType::TwinChakram => [0x00, 0x36, 0x00],
            WeaponType::WokOfAkikosShop => [0x00, 0x37, 0x00],
            WeaponType::LavisBlade => [0x00, 0x38, 0x00],
            WeaponType::RedDagger => [0x00, 0x39, 0x00],
            WeaponType::MadamsParasol => [0x00, 0x3A, 0x00],
            WeaponType::MadamsUmbrella => [0x00, 0x3B, 0x00],
            WeaponType::ImperialPick => [0x00, 0x3C, 0x00],
            WeaponType::Berdysh => [0x00, 0x3D, 0x00],
            WeaponType::RedPartisan => [0x00, 0x3E, 0x00],
            WeaponType::FlightCutter => [0x00, 0x3F, 0x00],
            WeaponType::FlightFan => [0x00, 0x40, 0x00],
            WeaponType::RedSlicer => [0x00, 0x41, 0x00],
            WeaponType::HandgunGuld => [0x00, 0x42, 0x00],
            WeaponType::MasterRaven => [0x00, 0x42, 0x01],
            WeaponType::HandgunMilla => [0x00, 0x43, 0x00],
            WeaponType::LastSwan => [0x00, 0x43, 0x01],
            WeaponType::RedHandgun => [0x00, 0x44, 0x00],
            WeaponType::FrozenShooter => [0x00, 0x45, 0x00],
            WeaponType::SnowQueen => [0x00, 0x45, 0x01],
            WeaponType::AntiAndroidRifle => [0x00, 0x46, 0x00],
            WeaponType::RocketPunch => [0x00, 0x47, 0x00],
            WeaponType::SambaMaracas => [0x00, 0x48, 0x00],
            WeaponType::TwinPsychogun => [0x00, 0x49, 0x00],
            WeaponType::DrillLauncher => [0x00, 0x4A, 0x00],
            WeaponType::GuldMilla => [0x00, 0x4B, 0x00],
            WeaponType::DualBird => [0x00, 0x4B, 0x01],
            WeaponType::RedMechgun => [0x00, 0x4C, 0x00],
            WeaponType::BelraCannon => [0x00, 0x4D, 0x00],
            WeaponType::PanzerFaust => [0x00, 0x4E, 0x00],
            WeaponType::IronFaust => [0x00, 0x4E, 0x01],
            WeaponType::SummitMoon => [0x00, 0x4F, 0x00],
            WeaponType::Windmill => [0x00, 0x50, 0x00],
            WeaponType::EvilCurst => [0x00, 0x51, 0x00],
            WeaponType::FlowerCane => [0x00, 0x52, 0x00],
            WeaponType::HildebearsCane => [0x00, 0x53, 0x00],
            WeaponType::HildebluesCane => [0x00, 0x54, 0x00],
            WeaponType::RabbitWand => [0x00, 0x55, 0x00],
            WeaponType::PlantainLeaf => [0x00, 0x56, 0x00],
            WeaponType::Fatsia => [0x00, 0x56, 0x01],
            WeaponType::DemonicFork => [0x00, 0x57, 0x00],
            WeaponType::StrikerOfChao => [0x00, 0x58, 0x00],
            WeaponType::Broom => [0x00, 0x59, 0x00],
            WeaponType::ProphetsOfMotav => [0x00, 0x5A, 0x00],
            WeaponType::TheSighOfAGod => [0x00, 0x5B, 0x00],
            WeaponType::TwinkleStar => [0x00, 0x5C, 0x00],
            WeaponType::PlantainFan => [0x00, 0x5D, 0x00],
            WeaponType::TwinBlaze => [0x00, 0x5E, 0x00],
            WeaponType::MarinasBag => [0x00, 0x5F, 0x00],
            WeaponType::DragonsClaw => [0x00, 0x60, 0x00],
            WeaponType::PanthersClaw => [0x00, 0x61, 0x00],
            WeaponType::SRedsBlade => [0x00, 0x62, 0x00],
            WeaponType::PlantainHugeFan => [0x00, 0x63, 0x00],
            WeaponType::ChameleonScythe => [0x00, 0x64, 0x00],
            WeaponType::Yasminkov3000R => [0x00, 0x65, 0x00],
            WeaponType::AnoRifle => [0x00, 0x66, 0x00],
            WeaponType::BaranzLauncher => [0x00, 0x67, 0x00],
            WeaponType::BranchOfPakupaku => [0x00, 0x68, 0x00],
            WeaponType::HeartOfPoumn => [0x00, 0x69, 0x00],
            WeaponType::Yasminkov2000H => [0x00, 0x6A, 0x00],
            WeaponType::Yasminkov7000V => [0x00, 0x6B, 0x00],
            WeaponType::Yasminkov9000M => [0x00, 0x6C, 0x00],
            WeaponType::MaserBeam => [0x00, 0x6D, 0x00],
            WeaponType::PowerMaser => [0x00, 0x6D, 0x01],
            WeaponType::GameMagazne => [0x00, 0x6E, 0x00],
            WeaponType::Login2 => [0x00, 0x6E, 0x01],
            WeaponType::FlowerBouquet => [0x00, 0x6F, 0x00],
            WeaponType::Musashi => [0x00, 0x89, 0x00],
            WeaponType::Yamato => [0x00, 0x89, 0x01],
            WeaponType::Asuka => [0x00, 0x89, 0x02],
            WeaponType::SangeYasha => [0x00, 0x89, 0x03],
            WeaponType::Sange => [0x00, 0x8A, 0x00],
            WeaponType::Yasha => [0x00, 0x8A, 0x01],
            WeaponType::Kamui => [0x00, 0x8A, 0x02],
            WeaponType::PhotonLauncher => [0x00, 0x8B, 0x00],
            WeaponType::GuiltyLight => [0x00, 0x8B, 0x01],
            WeaponType::RedScorpio => [0x00, 0x8B, 0x02],
            WeaponType::PhononMaser => [0x00, 0x8B, 0x03],
            WeaponType::Talis => [0x00, 0x8C, 0x00],
            WeaponType::Mahu => [0x00, 0x8C, 0x01],
            WeaponType::Hitogata => [0x00, 0x8C, 0x02],
            WeaponType::DancingHitogata => [0x00, 0x8C, 0x03],
            WeaponType::Kunai => [0x00, 0x8C, 0x04],
            WeaponType::Nug2000Bazooka => [0x00, 0x8D, 0x00],
            WeaponType::SBerillsHands0 => [0x00, 0x8E, 0x00],
            WeaponType::SBerillsHands1 => [0x00, 0x8E, 0x01],
            WeaponType::FlowensSword3060 => [0x00, 0x8F, 0x00],
            WeaponType::FlowensSword3064 => [0x00, 0x8F, 0x01],
            WeaponType::FlowensSword3067 => [0x00, 0x8F, 0x02],
            WeaponType::FlowensSword3073 => [0x00, 0x8F, 0x03],
            WeaponType::FlowensSword3077 => [0x00, 0x8F, 0x04],
            WeaponType::FlowensSword3082 => [0x00, 0x8F, 0x05],
            WeaponType::FlowensSword3083 => [0x00, 0x8F, 0x06],
            WeaponType::FlowensSword3084 => [0x00, 0x8F, 0x07],
            WeaponType::FlowensSword3079 => [0x00, 0x8F, 0x08],
            WeaponType::DbsSaber3062 => [0x00, 0x90, 0x00],
            WeaponType::DbsSaber3067 => [0x00, 0x90, 0x01],
            WeaponType::DbsSaber3069Chris => [0x00, 0x90, 0x02],
            WeaponType::DbsSaber3064 => [0x00, 0x90, 0x03],
            WeaponType::DbsSaber3069Torato => [0x00, 0x90, 0x04],
            WeaponType::DbsSaber3073 => [0x00, 0x90, 0x05],
            WeaponType::DbsSaber3070 => [0x00, 0x90, 0x06],
            WeaponType::DbsSaber3075 => [0x00, 0x90, 0x07],
            WeaponType::DbsSaber3077 => [0x00, 0x90, 0x08],
            WeaponType::GiGueBazooka => [0x00, 0x91, 0x00],
            WeaponType::Guardianna => [0x00, 0x92, 0x00],
            WeaponType::ViridiaCard => [0x00, 0x93, 0x00],
            WeaponType::GreenillCard => [0x00, 0x93, 0x01],
            WeaponType::SkylyCard => [0x00, 0x93, 0x02],
            WeaponType::BluefullCard => [0x00, 0x93, 0x03],
            WeaponType::PurplenumCard => [0x00, 0x93, 0x04],
            WeaponType::PinkalCard => [0x00, 0x93, 0x05],
            WeaponType::RedriaCard => [0x00, 0x93, 0x06],
            WeaponType::OranCard => [0x00, 0x93, 0x07],
            WeaponType::YellowbozeCard => [0x00, 0x93, 0x08],
            WeaponType::WhitillCard => [0x00, 0x93, 0x09],
            WeaponType::MorningGlory => [0x00, 0x94, 0x00],
            WeaponType::PartisanOfLightning => [0x00, 0x95, 0x00],
            WeaponType::GalWind => [0x00, 0x96, 0x00],
            WeaponType::Zanba => [0x00, 0x97, 0x00],
            WeaponType::RikasClaw => [0x00, 0x98, 0x00],
            WeaponType::AngelHarp => [0x00, 0x99, 0x00],
            WeaponType::DemolitionComet => [0x00, 0x9A, 0x00],
            WeaponType::NeisClaw2 => [0x00, 0x9B, 0x00],
            WeaponType::RainbowBaton => [0x00, 0x9C, 0x00],
            WeaponType::DarkFlow => [0x00, 0x9D, 0x00],
            WeaponType::DarkMeteor => [0x00, 0x9E, 0x00],
            WeaponType::DarkBridge => [0x00, 0x9F, 0x00],
            WeaponType::GAssassinsSabers => [0x00, 0xA0, 0x00],
            WeaponType::RappysFan => [0x00, 0xA1, 0x00],
            WeaponType::BoomasClaw => [0x00, 0xA2, 0x00],
            WeaponType::GoboomasClaw => [0x00, 0xA2, 0x01],
            WeaponType::GigoboomasClaw => [0x00, 0xA2, 0x02],
            WeaponType::RubyBullet => [0x00, 0xA3, 0x00],
            WeaponType::AmoreRose => [0x00, 0xA4, 0x00],
            WeaponType::SlicerOfFanatic => [0x00, 0xAA, 0x00],
            WeaponType::LameDArgent => [0x00, 0xAB, 0x00],
            WeaponType::Excalibur => [0x00, 0xAC, 0x00],
            WeaponType::RageDeFeu => [0x00, 0xAD, 0x00],
            WeaponType::RageDeFeu2 => [0x00, 0xAD, 0x01],
            WeaponType::RageDeFeu3 => [0x00, 0xAD, 0x02],
            WeaponType::RageDeFeu4 => [0x00, 0xAD, 0x03],
            WeaponType::DaisyChain => [0x00, 0xAE, 0x00],
            WeaponType::OphelieSeize => [0x00, 0xAF, 0x00],
            WeaponType::MilleMarteaux => [0x00, 0xB0, 0x00],
            WeaponType::LeCogneur => [0x00, 0xB1, 0x00],
            WeaponType::CommanderBlade => [0x00, 0xB2, 0x00],
            WeaponType::Vivienne => [0x00, 0xB3, 0x00],
            WeaponType::Kusanagi => [0x00, 0xB4, 0x00],
            WeaponType::SacredDuster => [0x00, 0xB5, 0x00],
            WeaponType::Guren => [0x00, 0xB6, 0x00],
            WeaponType::Shouren => [0x00, 0xB7, 0x00],
            WeaponType::Jizai => [0x00, 0xB8, 0x00],
            WeaponType::Flamberge => [0x00, 0xB9, 0x00],
            WeaponType::Yunchang => [0x00, 0xBA, 0x00],
            WeaponType::SnakeSpire => [0x00, 0xBB, 0x00],
            WeaponType::FlapjackFlapper => [0x00, 0xBC, 0x00],
            WeaponType::Getsugasan => [0x00, 0xBD, 0x00],
            WeaponType::Maguwa => [0x00, 0xBE, 0x00],
            WeaponType::HeavenStriker => [0x00, 0xBF, 0x00],
            WeaponType::CannonRouge => [0x00, 0xC0, 0x00],
            WeaponType::MeteorRouge => [0x00, 0xC1, 0x00],
            WeaponType::Solferino => [0x00, 0xC2, 0x00],
            WeaponType::Clio => [0x00, 0xC3, 0x00],
            WeaponType::SirenGlassHammer => [0x00, 0xC4, 0x00],
            WeaponType::GlideDivine => [0x00, 0xC5, 0x00],
            WeaponType::Shichishito => [0x00, 0xC6, 0x00],
            WeaponType::Murasame => [0x00, 0xC7, 0x00],
            WeaponType::DaylightScar => [0x00, 0xC8, 0x00],
            WeaponType::Decalog => [0x00, 0xC9, 0x00],
            WeaponType::FifthAnnivBlade => [0x00, 0xCA, 0x00],
            WeaponType::TyrellsParasol => [0x00, 0xCB, 0x00],
            WeaponType::AkikosCleaver => [0x00, 0xCC, 0x00],
            WeaponType::Tanegashima => [0x00, 0xCD, 0x00],
            WeaponType::TreeClippers => [0x00, 0xCE, 0x00],
            WeaponType::NiceShot => [0x00, 0xCF, 0x00],
            WeaponType::Unknown3 => [0x00, 0xD0, 0x00],
            WeaponType::Unknown4 => [0x00, 0xD1, 0x00],
            WeaponType::AnoBazooka => [0x00, 0xD2, 0x00],
            WeaponType::Synthesizer => [0x00, 0xD3, 0x00],
            WeaponType::BambooSpear => [0x00, 0xD4, 0x00],
            WeaponType::KaneiTsuho => [0x00, 0xD5, 0x00],
            WeaponType::Jitte => [0x00, 0xD6, 0x00],
            WeaponType::ButterflyNet => [0x00, 0xD7, 0x00],
            WeaponType::Syringe => [0x00, 0xD8, 0x00],
            WeaponType::Battledore => [0x00, 0xD9, 0x00],
            WeaponType::Racket => [0x00, 0xDA, 0x00],
            WeaponType::Hammer => [0x00, 0xDB, 0x00],
            WeaponType::GreatBouquet => [0x00, 0xDC, 0x00],
            WeaponType::TypesaSaber => [0x00, 0xDD, 0x00],
            WeaponType::TypeslSaber => [0x00, 0xDE, 0x00],
            WeaponType::TypeslSlicer => [0x00, 0xDE, 0x01],
            WeaponType::TypeslClaw => [0x00, 0xDE, 0x02],
            WeaponType::TypeslKatana => [0x00, 0xDE, 0x03],
            WeaponType::TypejsSaber => [0x00, 0xDF, 0x00],
            WeaponType::TypejsSlicer => [0x00, 0xDF, 0x01],
            WeaponType::TypejsJSword => [0x00, 0xDF, 0x02],
            WeaponType::TypeswSword => [0x00, 0xE0, 0x00],
            WeaponType::TypeswSlicer => [0x00, 0xE0, 0x01],
            WeaponType::TypeswJSword => [0x00, 0xE0, 0x02],
            WeaponType::TyperoSword => [0x00, 0xE1, 0x00],
            WeaponType::TyperoHalbert => [0x00, 0xE1, 0x01],
            WeaponType::TyperoRod => [0x00, 0xE1, 0x02],
            WeaponType::TypeblBlade => [0x00, 0xE2, 0x00],
            WeaponType::TypeknBlade => [0x00, 0xE3, 0x00],
            WeaponType::TypeknClaw => [0x00, 0xE3, 0x01],
            WeaponType::TypehaHalbert => [0x00, 0xE4, 0x00],
            WeaponType::TypehaRod => [0x00, 0xE4, 0x01],
            WeaponType::TypedsDSaber => [0x00, 0xE5, 0x00],
            WeaponType::TypedsRod => [0x00, 0xE5, 0x01],
            WeaponType::Typeds => [0x00, 0xE5, 0x02],
            WeaponType::TypeclClaw => [0x00, 0xE6, 0x00],
            WeaponType::TypessSw => [0x00, 0xE7, 0x00],
            WeaponType::TypeguHand => [0x00, 0xE8, 0x00],
            WeaponType::TypeguMechgun => [0x00, 0xE8, 0x01],
            WeaponType::TyperiRifle => [0x00, 0xE9, 0x00],
            WeaponType::TypemeMechgun => [0x00, 0xEA, 0x00],
            WeaponType::TypeshShot => [0x00, 0xEB, 0x00],
            WeaponType::TypewaWand => [0x00, 0xEC, 0x00],
        }
    }

    pub fn parse_type(data: [u8; 3]) -> Result<WeaponType, ItemParseError> {
        match data {
            [0x00, 0x01, 0x00] => Ok(WeaponType::Saber),
            [0x00, 0x01, 0x01] => Ok(WeaponType::Brand),
            [0x00, 0x01, 0x02] => Ok(WeaponType::Buster),
            [0x00, 0x01, 0x03] => Ok(WeaponType::Pallasch),
            [0x00, 0x01, 0x04] => Ok(WeaponType::Gladius),
            [0x00, 0x01, 0x05] => Ok(WeaponType::DbsSaber),
            [0x00, 0x01, 0x06] => Ok(WeaponType::Kaladbolg),
            [0x00, 0x01, 0x07] => Ok(WeaponType::Durandal),
            [0x00, 0x01, 0x08] => Ok(WeaponType::Galatine),
            [0x00, 0x02, 0x00] => Ok(WeaponType::Sword),
            [0x00, 0x02, 0x01] => Ok(WeaponType::Gigush),
            [0x00, 0x02, 0x02] => Ok(WeaponType::Breaker),
            [0x00, 0x02, 0x03] => Ok(WeaponType::Claymore),
            [0x00, 0x02, 0x04] => Ok(WeaponType::Calibur),
            [0x00, 0x02, 0x05] => Ok(WeaponType::FlowensSword),
            [0x00, 0x02, 0x06] => Ok(WeaponType::LastSurvivor),
            [0x00, 0x02, 0x07] => Ok(WeaponType::DragonSlayer),
            [0x00, 0x03, 0x00] => Ok(WeaponType::Dagger),
            [0x00, 0x03, 0x01] => Ok(WeaponType::Knife),
            [0x00, 0x03, 0x02] => Ok(WeaponType::Blade),
            [0x00, 0x03, 0x03] => Ok(WeaponType::Edge),
            [0x00, 0x03, 0x04] => Ok(WeaponType::Ripper),
            [0x00, 0x03, 0x05] => Ok(WeaponType::BladeDance),
            [0x00, 0x03, 0x06] => Ok(WeaponType::BloodyArt),
            [0x00, 0x03, 0x07] => Ok(WeaponType::CrossScar),
            [0x00, 0x03, 0x08] => Ok(WeaponType::ZeroDivide),
            [0x00, 0x03, 0x09] => Ok(WeaponType::TwoKamui),
            [0x00, 0x04, 0x00] => Ok(WeaponType::Partisan),
            [0x00, 0x04, 0x01] => Ok(WeaponType::Halbert),
            [0x00, 0x04, 0x02] => Ok(WeaponType::Glaive),
            [0x00, 0x04, 0x03] => Ok(WeaponType::Berdys),
            [0x00, 0x04, 0x04] => Ok(WeaponType::Gungnir),
            [0x00, 0x04, 0x05] => Ok(WeaponType::Brionac),
            [0x00, 0x04, 0x06] => Ok(WeaponType::Vjaya),
            [0x00, 0x04, 0x07] => Ok(WeaponType::GaeBolg),
            [0x00, 0x04, 0x08] => Ok(WeaponType::AsteronBelt),
            [0x00, 0x05, 0x00] => Ok(WeaponType::Slicer),
            [0x00, 0x05, 0x01] => Ok(WeaponType::Spinner),
            [0x00, 0x05, 0x02] => Ok(WeaponType::Cutter),
            [0x00, 0x05, 0x03] => Ok(WeaponType::Sawcer),
            [0x00, 0x05, 0x04] => Ok(WeaponType::Diska),
            [0x00, 0x05, 0x05] => Ok(WeaponType::SlicerOfAssassin),
            [0x00, 0x05, 0x06] => Ok(WeaponType::DiskaOfLiberator),
            [0x00, 0x05, 0x07] => Ok(WeaponType::DiskaOfBraveman),
            [0x00, 0x05, 0x08] => Ok(WeaponType::Izmaela),
            [0x00, 0x06, 0x00] => Ok(WeaponType::Handgun),
            [0x00, 0x06, 0x01] => Ok(WeaponType::Autogun),
            [0x00, 0x06, 0x02] => Ok(WeaponType::Lockgun),
            [0x00, 0x06, 0x03] => Ok(WeaponType::Railgun),
            [0x00, 0x06, 0x04] => Ok(WeaponType::Raygun),
            [0x00, 0x06, 0x05] => Ok(WeaponType::Varista),
            [0x00, 0x06, 0x06] => Ok(WeaponType::CustomRayVerOo),
            [0x00, 0x06, 0x07] => Ok(WeaponType::Bravace),
            [0x00, 0x06, 0x08] => Ok(WeaponType::TensionBlaster),
            [0x00, 0x07, 0x00] => Ok(WeaponType::Rifle),
            [0x00, 0x07, 0x01] => Ok(WeaponType::Sniper),
            [0x00, 0x07, 0x02] => Ok(WeaponType::Blaster),
            [0x00, 0x07, 0x03] => Ok(WeaponType::Beam),
            [0x00, 0x07, 0x04] => Ok(WeaponType::Laser),
            [0x00, 0x07, 0x05] => Ok(WeaponType::Visk235W),
            [0x00, 0x07, 0x06] => Ok(WeaponType::WalsMk2),
            [0x00, 0x07, 0x07] => Ok(WeaponType::Justy23St),
            [0x00, 0x07, 0x08] => Ok(WeaponType::Rianov303snr),
            [0x00, 0x07, 0x09] => Ok(WeaponType::Rianov303snr1),
            [0x00, 0x07, 0x0A] => Ok(WeaponType::Rianov303snr2),
            [0x00, 0x07, 0x0B] => Ok(WeaponType::Rianov303snr3),
            [0x00, 0x07, 0x0C] => Ok(WeaponType::Rianov303snr4),
            [0x00, 0x07, 0x0D] => Ok(WeaponType::Rianov303snr5),
            [0x00, 0x08, 0x00] => Ok(WeaponType::Mechgun),
            [0x00, 0x08, 0x01] => Ok(WeaponType::Assault),
            [0x00, 0x08, 0x02] => Ok(WeaponType::Repeater),
            [0x00, 0x08, 0x03] => Ok(WeaponType::Gatling),
            [0x00, 0x08, 0x04] => Ok(WeaponType::Vulcan),
            [0x00, 0x08, 0x05] => Ok(WeaponType::MA60Vise),
            [0x00, 0x08, 0x06] => Ok(WeaponType::HS25Justice),
            [0x00, 0x08, 0x07] => Ok(WeaponType::LK14Combat),
            [0x00, 0x09, 0x00] => Ok(WeaponType::Shot),
            [0x00, 0x09, 0x01] => Ok(WeaponType::Spread),
            [0x00, 0x09, 0x02] => Ok(WeaponType::Cannon),
            [0x00, 0x09, 0x03] => Ok(WeaponType::Launcher),
            [0x00, 0x09, 0x04] => Ok(WeaponType::Arms),
            [0x00, 0x09, 0x05] => Ok(WeaponType::CrushBullet),
            [0x00, 0x09, 0x06] => Ok(WeaponType::MeteorSmash),
            [0x00, 0x09, 0x07] => Ok(WeaponType::FinalImpact),
            [0x00, 0x0A, 0x00] => Ok(WeaponType::Cane),
            [0x00, 0x0A, 0x01] => Ok(WeaponType::Stick),
            [0x00, 0x0A, 0x02] => Ok(WeaponType::Mace),
            [0x00, 0x0A, 0x03] => Ok(WeaponType::Club),
            [0x00, 0x0A, 0x04] => Ok(WeaponType::ClubOfLaconium),
            [0x00, 0x0A, 0x05] => Ok(WeaponType::MaceOfAdaman),
            [0x00, 0x0A, 0x06] => Ok(WeaponType::ClubOfZumiuran),
            [0x00, 0x0A, 0x07] => Ok(WeaponType::Lollipop),
            [0x00, 0x0B, 0x00] => Ok(WeaponType::Rod),
            [0x00, 0x0B, 0x01] => Ok(WeaponType::Pole),
            [0x00, 0x0B, 0x02] => Ok(WeaponType::Pillar),
            [0x00, 0x0B, 0x03] => Ok(WeaponType::Striker),
            [0x00, 0x0B, 0x04] => Ok(WeaponType::BattleVerge),
            [0x00, 0x0B, 0x05] => Ok(WeaponType::BraveHammer),
            [0x00, 0x0B, 0x06] => Ok(WeaponType::AliveAqhu),
            [0x00, 0x0B, 0x07] => Ok(WeaponType::Valkyrie),
            [0x00, 0x0C, 0x00] => Ok(WeaponType::Wand),
            [0x00, 0x0C, 0x01] => Ok(WeaponType::Staff),
            [0x00, 0x0C, 0x02] => Ok(WeaponType::Baton),
            [0x00, 0x0C, 0x03] => Ok(WeaponType::Scepter),
            [0x00, 0x0C, 0x04] => Ok(WeaponType::FireScepterAgni),
            [0x00, 0x0C, 0x05] => Ok(WeaponType::IceStaffDagon),
            [0x00, 0x0C, 0x06] => Ok(WeaponType::StormWandIndra),
            [0x00, 0x0C, 0x07] => Ok(WeaponType::EarthWandBrownie),
            [0x00, 0x0D, 0x00] => Ok(WeaponType::PhotonClaw),
            [0x00, 0x0D, 0x01] => Ok(WeaponType::SilenceClaw),
            [0x00, 0x0D, 0x02] => Ok(WeaponType::NeisClaw),
            [0x00, 0x0D, 0x03] => Ok(WeaponType::PhoenixClaw),
            [0x00, 0x0E, 0x00] => Ok(WeaponType::DoubleSaber),
            [0x00, 0x0E, 0x01] => Ok(WeaponType::StagCutlery),
            [0x00, 0x0E, 0x02] => Ok(WeaponType::TwinBrand),
            [0x00, 0x0F, 0x00] => Ok(WeaponType::BraveKnuckle),
            [0x00, 0x0F, 0x01] => Ok(WeaponType::AngryFist),
            [0x00, 0x0F, 0x02] => Ok(WeaponType::GodHand),
            [0x00, 0x0F, 0x03] => Ok(WeaponType::SonicKnuckle),
            [0x00, 0x0F, 0x04] => Ok(WeaponType::Login),
            [0x00, 0x10, 0x00] => Ok(WeaponType::Orotiagito),
            [0x00, 0x10, 0x01] => Ok(WeaponType::Agito1975),
            [0x00, 0x10, 0x02] => Ok(WeaponType::Agito1983),
            [0x00, 0x10, 0x03] => Ok(WeaponType::Agito2001),
            [0x00, 0x10, 0x04] => Ok(WeaponType::Agito1991),
            [0x00, 0x10, 0x05] => Ok(WeaponType::Agito1977),
            [0x00, 0x10, 0x06] => Ok(WeaponType::Agito1980),
            [0x00, 0x10, 0x07] => Ok(WeaponType::Raikiri),
            [0x00, 0x11, 0x00] => Ok(WeaponType::SoulEater),
            [0x00, 0x11, 0x01] => Ok(WeaponType::SoulBanish),
            [0x00, 0x12, 0x00] => Ok(WeaponType::SpreadNeedle),
            [0x00, 0x13, 0x00] => Ok(WeaponType::HolyRay),
            [0x00, 0x14, 0x00] => Ok(WeaponType::InfernoBazooka),
            [0x00, 0x14, 0x01] => Ok(WeaponType::RamblingMay),
            [0x00, 0x14, 0x02] => Ok(WeaponType::LK38Combat),
            [0x00, 0x15, 0x00] => Ok(WeaponType::FlameVisit),
            [0x00, 0x15, 0x01] => Ok(WeaponType::BurningVisit),
            [0x00, 0x16, 0x00] => Ok(WeaponType::AkikosFryingPan),
            [0x00, 0x17, 0x00] => Ok(WeaponType::SorcerersCane),
            [0x00, 0x18, 0x00] => Ok(WeaponType::SBeatsBlade),
            [0x00, 0x19, 0x00] => Ok(WeaponType::PArmssBlade),
            [0x00, 0x1A, 0x00] => Ok(WeaponType::DelsabersBuster),
            [0x00, 0x1B, 0x00] => Ok(WeaponType::BringersRifle),
            [0x00, 0x1C, 0x00] => Ok(WeaponType::EggBlaster),
            [0x00, 0x1D, 0x00] => Ok(WeaponType::PsychoWand),
            [0x00, 0x1E, 0x00] => Ok(WeaponType::HeavenPunisher),
            [0x00, 0x1F, 0x00] => Ok(WeaponType::LavisCannon),
            [0x00, 0x20, 0x00] => Ok(WeaponType::VictorAxe),
            [0x00, 0x20, 0x01] => Ok(WeaponType::LaconiumAxe),
            [0x00, 0x21, 0x00] => Ok(WeaponType::ChainSawd),
            [0x00, 0x22, 0x00] => Ok(WeaponType::Caduceus),
            [0x00, 0x22, 0x01] => Ok(WeaponType::MercuriusRod),
            [0x00, 0x23, 0x00] => Ok(WeaponType::StingTip),
            [0x00, 0x24, 0x00] => Ok(WeaponType::MagicalPiece),
            [0x00, 0x25, 0x00] => Ok(WeaponType::TechnicalCrozier),
            [0x00, 0x26, 0x00] => Ok(WeaponType::SuppressedGun),
            [0x00, 0x27, 0x00] => Ok(WeaponType::AncientSaber),
            [0x00, 0x28, 0x00] => Ok(WeaponType::HarisenBattleFan),
            [0x00, 0x29, 0x00] => Ok(WeaponType::Yamigarasu),
            [0x00, 0x2A, 0x00] => Ok(WeaponType::AkikosWok),
            [0x00, 0x2B, 0x00] => Ok(WeaponType::ToyHammer),
            [0x00, 0x2C, 0x00] => Ok(WeaponType::Elysion),
            [0x00, 0x2D, 0x00] => Ok(WeaponType::RedSaber),
            [0x00, 0x2E, 0x00] => Ok(WeaponType::MeteorCudgel),
            [0x00, 0x2F, 0x00] => Ok(WeaponType::MonkeyKingBar),
            [0x00, 0x2F, 0x01] => Ok(WeaponType::BlackKingBar),
            [0x00, 0x30, 0x00] => Ok(WeaponType::DoubleCannon),
            [0x00, 0x30, 0x01] => Ok(WeaponType::Girasole),
            [0x00, 0x31, 0x00] => Ok(WeaponType::HugeBattleFan),
            [0x00, 0x32, 0x00] => Ok(WeaponType::TsumikiriJSword),
            [0x00, 0x33, 0x00] => Ok(WeaponType::SealedJSword),
            [0x00, 0x34, 0x00] => Ok(WeaponType::RedSword),
            [0x00, 0x35, 0x00] => Ok(WeaponType::CrazyTune),
            [0x00, 0x36, 0x00] => Ok(WeaponType::TwinChakram),
            [0x00, 0x37, 0x00] => Ok(WeaponType::WokOfAkikosShop),
            [0x00, 0x38, 0x00] => Ok(WeaponType::LavisBlade),
            [0x00, 0x39, 0x00] => Ok(WeaponType::RedDagger),
            [0x00, 0x3A, 0x00] => Ok(WeaponType::MadamsParasol),
            [0x00, 0x3B, 0x00] => Ok(WeaponType::MadamsUmbrella),
            [0x00, 0x3C, 0x00] => Ok(WeaponType::ImperialPick),
            [0x00, 0x3D, 0x00] => Ok(WeaponType::Berdysh),
            [0x00, 0x3E, 0x00] => Ok(WeaponType::RedPartisan),
            [0x00, 0x3F, 0x00] => Ok(WeaponType::FlightCutter),
            [0x00, 0x40, 0x00] => Ok(WeaponType::FlightFan),
            [0x00, 0x41, 0x00] => Ok(WeaponType::RedSlicer),
            [0x00, 0x42, 0x00] => Ok(WeaponType::HandgunGuld),
            [0x00, 0x42, 0x01] => Ok(WeaponType::MasterRaven),
            [0x00, 0x43, 0x00] => Ok(WeaponType::HandgunMilla),
            [0x00, 0x43, 0x01] => Ok(WeaponType::LastSwan),
            [0x00, 0x44, 0x00] => Ok(WeaponType::RedHandgun),
            [0x00, 0x45, 0x00] => Ok(WeaponType::FrozenShooter),
            [0x00, 0x45, 0x01] => Ok(WeaponType::SnowQueen),
            [0x00, 0x46, 0x00] => Ok(WeaponType::AntiAndroidRifle),
            [0x00, 0x47, 0x00] => Ok(WeaponType::RocketPunch),
            [0x00, 0x48, 0x00] => Ok(WeaponType::SambaMaracas),
            [0x00, 0x49, 0x00] => Ok(WeaponType::TwinPsychogun),
            [0x00, 0x4A, 0x00] => Ok(WeaponType::DrillLauncher),
            [0x00, 0x4B, 0x00] => Ok(WeaponType::GuldMilla),
            [0x00, 0x4B, 0x01] => Ok(WeaponType::DualBird),
            [0x00, 0x4C, 0x00] => Ok(WeaponType::RedMechgun),
            [0x00, 0x4D, 0x00] => Ok(WeaponType::BelraCannon),
            [0x00, 0x4E, 0x00] => Ok(WeaponType::PanzerFaust),
            [0x00, 0x4E, 0x01] => Ok(WeaponType::IronFaust),
            [0x00, 0x4F, 0x00] => Ok(WeaponType::SummitMoon),
            [0x00, 0x50, 0x00] => Ok(WeaponType::Windmill),
            [0x00, 0x51, 0x00] => Ok(WeaponType::EvilCurst),
            [0x00, 0x52, 0x00] => Ok(WeaponType::FlowerCane),
            [0x00, 0x53, 0x00] => Ok(WeaponType::HildebearsCane),
            [0x00, 0x54, 0x00] => Ok(WeaponType::HildebluesCane),
            [0x00, 0x55, 0x00] => Ok(WeaponType::RabbitWand),
            [0x00, 0x56, 0x00] => Ok(WeaponType::PlantainLeaf),
            [0x00, 0x56, 0x01] => Ok(WeaponType::Fatsia),
            [0x00, 0x57, 0x00] => Ok(WeaponType::DemonicFork),
            [0x00, 0x58, 0x00] => Ok(WeaponType::StrikerOfChao),
            [0x00, 0x59, 0x00] => Ok(WeaponType::Broom),
            [0x00, 0x5A, 0x00] => Ok(WeaponType::ProphetsOfMotav),
            [0x00, 0x5B, 0x00] => Ok(WeaponType::TheSighOfAGod),
            [0x00, 0x5C, 0x00] => Ok(WeaponType::TwinkleStar),
            [0x00, 0x5D, 0x00] => Ok(WeaponType::PlantainFan),
            [0x00, 0x5E, 0x00] => Ok(WeaponType::TwinBlaze),
            [0x00, 0x5F, 0x00] => Ok(WeaponType::MarinasBag),
            [0x00, 0x60, 0x00] => Ok(WeaponType::DragonsClaw),
            [0x00, 0x61, 0x00] => Ok(WeaponType::PanthersClaw),
            [0x00, 0x62, 0x00] => Ok(WeaponType::SRedsBlade),
            [0x00, 0x63, 0x00] => Ok(WeaponType::PlantainHugeFan),
            [0x00, 0x64, 0x00] => Ok(WeaponType::ChameleonScythe),
            [0x00, 0x65, 0x00] => Ok(WeaponType::Yasminkov3000R),
            [0x00, 0x66, 0x00] => Ok(WeaponType::AnoRifle),
            [0x00, 0x67, 0x00] => Ok(WeaponType::BaranzLauncher),
            [0x00, 0x68, 0x00] => Ok(WeaponType::BranchOfPakupaku),
            [0x00, 0x69, 0x00] => Ok(WeaponType::HeartOfPoumn),
            [0x00, 0x6A, 0x00] => Ok(WeaponType::Yasminkov2000H),
            [0x00, 0x6B, 0x00] => Ok(WeaponType::Yasminkov7000V),
            [0x00, 0x6C, 0x00] => Ok(WeaponType::Yasminkov9000M),
            [0x00, 0x6D, 0x00] => Ok(WeaponType::MaserBeam),
            [0x00, 0x6D, 0x01] => Ok(WeaponType::PowerMaser),
            [0x00, 0x6E, 0x00] => Ok(WeaponType::GameMagazne),
            [0x00, 0x6E, 0x01] => Ok(WeaponType::Login2),
            [0x00, 0x6F, 0x00] => Ok(WeaponType::FlowerBouquet),
            [0x00, 0x89, 0x00] => Ok(WeaponType::Musashi),
            [0x00, 0x89, 0x01] => Ok(WeaponType::Yamato),
            [0x00, 0x89, 0x02] => Ok(WeaponType::Asuka),
            [0x00, 0x89, 0x03] => Ok(WeaponType::SangeYasha),
            [0x00, 0x8A, 0x00] => Ok(WeaponType::Sange),
            [0x00, 0x8A, 0x01] => Ok(WeaponType::Yasha),
            [0x00, 0x8A, 0x02] => Ok(WeaponType::Kamui),
            [0x00, 0x8B, 0x00] => Ok(WeaponType::PhotonLauncher),
            [0x00, 0x8B, 0x01] => Ok(WeaponType::GuiltyLight),
            [0x00, 0x8B, 0x02] => Ok(WeaponType::RedScorpio),
            [0x00, 0x8B, 0x03] => Ok(WeaponType::PhononMaser),
            [0x00, 0x8C, 0x00] => Ok(WeaponType::Talis),
            [0x00, 0x8C, 0x01] => Ok(WeaponType::Mahu),
            [0x00, 0x8C, 0x02] => Ok(WeaponType::Hitogata),
            [0x00, 0x8C, 0x03] => Ok(WeaponType::DancingHitogata),
            [0x00, 0x8C, 0x04] => Ok(WeaponType::Kunai),
            [0x00, 0x8D, 0x00] => Ok(WeaponType::Nug2000Bazooka),
            [0x00, 0x8E, 0x00] => Ok(WeaponType::SBerillsHands0),
            [0x00, 0x8E, 0x01] => Ok(WeaponType::SBerillsHands1),
            [0x00, 0x8F, 0x00] => Ok(WeaponType::FlowensSword3060),
            [0x00, 0x8F, 0x01] => Ok(WeaponType::FlowensSword3064),
            [0x00, 0x8F, 0x02] => Ok(WeaponType::FlowensSword3067),
            [0x00, 0x8F, 0x03] => Ok(WeaponType::FlowensSword3073),
            [0x00, 0x8F, 0x04] => Ok(WeaponType::FlowensSword3077),
            [0x00, 0x8F, 0x05] => Ok(WeaponType::FlowensSword3082),
            [0x00, 0x8F, 0x06] => Ok(WeaponType::FlowensSword3083),
            [0x00, 0x8F, 0x07] => Ok(WeaponType::FlowensSword3084),
            [0x00, 0x8F, 0x08] => Ok(WeaponType::FlowensSword3079),
            [0x00, 0x90, 0x00] => Ok(WeaponType::DbsSaber3062),
            [0x00, 0x90, 0x01] => Ok(WeaponType::DbsSaber3067),
            [0x00, 0x90, 0x02] => Ok(WeaponType::DbsSaber3069Chris),
            [0x00, 0x90, 0x03] => Ok(WeaponType::DbsSaber3064),
            [0x00, 0x90, 0x04] => Ok(WeaponType::DbsSaber3069Torato),
            [0x00, 0x90, 0x05] => Ok(WeaponType::DbsSaber3073),
            [0x00, 0x90, 0x06] => Ok(WeaponType::DbsSaber3070),
            [0x00, 0x90, 0x07] => Ok(WeaponType::DbsSaber3075),
            [0x00, 0x90, 0x08] => Ok(WeaponType::DbsSaber3077),
            [0x00, 0x91, 0x00] => Ok(WeaponType::GiGueBazooka),
            [0x00, 0x92, 0x00] => Ok(WeaponType::Guardianna),
            [0x00, 0x93, 0x00] => Ok(WeaponType::ViridiaCard),
            [0x00, 0x93, 0x01] => Ok(WeaponType::GreenillCard),
            [0x00, 0x93, 0x02] => Ok(WeaponType::SkylyCard),
            [0x00, 0x93, 0x03] => Ok(WeaponType::BluefullCard),
            [0x00, 0x93, 0x04] => Ok(WeaponType::PurplenumCard),
            [0x00, 0x93, 0x05] => Ok(WeaponType::PinkalCard),
            [0x00, 0x93, 0x06] => Ok(WeaponType::RedriaCard),
            [0x00, 0x93, 0x07] => Ok(WeaponType::OranCard),
            [0x00, 0x93, 0x08] => Ok(WeaponType::YellowbozeCard),
            [0x00, 0x93, 0x09] => Ok(WeaponType::WhitillCard),
            [0x00, 0x94, 0x00] => Ok(WeaponType::MorningGlory),
            [0x00, 0x95, 0x00] => Ok(WeaponType::PartisanOfLightning),
            [0x00, 0x96, 0x00] => Ok(WeaponType::GalWind),
            [0x00, 0x97, 0x00] => Ok(WeaponType::Zanba),
            [0x00, 0x98, 0x00] => Ok(WeaponType::RikasClaw),
            [0x00, 0x99, 0x00] => Ok(WeaponType::AngelHarp),
            [0x00, 0x9A, 0x00] => Ok(WeaponType::DemolitionComet),
            [0x00, 0x9B, 0x00] => Ok(WeaponType::NeisClaw2),
            [0x00, 0x9C, 0x00] => Ok(WeaponType::RainbowBaton),
            [0x00, 0x9D, 0x00] => Ok(WeaponType::DarkFlow),
            [0x00, 0x9E, 0x00] => Ok(WeaponType::DarkMeteor),
            [0x00, 0x9F, 0x00] => Ok(WeaponType::DarkBridge),
            [0x00, 0xA0, 0x00] => Ok(WeaponType::GAssassinsSabers),
            [0x00, 0xA1, 0x00] => Ok(WeaponType::RappysFan),
            [0x00, 0xA2, 0x00] => Ok(WeaponType::BoomasClaw),
            [0x00, 0xA2, 0x01] => Ok(WeaponType::GoboomasClaw),
            [0x00, 0xA2, 0x02] => Ok(WeaponType::GigoboomasClaw),
            [0x00, 0xA3, 0x00] => Ok(WeaponType::RubyBullet),
            [0x00, 0xA4, 0x00] => Ok(WeaponType::AmoreRose),
            [0x00, 0xAA, 0x00] => Ok(WeaponType::SlicerOfFanatic),
            [0x00, 0xAB, 0x00] => Ok(WeaponType::LameDArgent),
            [0x00, 0xAC, 0x00] => Ok(WeaponType::Excalibur),
            [0x00, 0xAD, 0x00] => Ok(WeaponType::RageDeFeu),
            [0x00, 0xAD, 0x01] => Ok(WeaponType::RageDeFeu2),
            [0x00, 0xAD, 0x02] => Ok(WeaponType::RageDeFeu3),
            [0x00, 0xAD, 0x03] => Ok(WeaponType::RageDeFeu4),
            [0x00, 0xAE, 0x00] => Ok(WeaponType::DaisyChain),
            [0x00, 0xAF, 0x00] => Ok(WeaponType::OphelieSeize),
            [0x00, 0xB0, 0x00] => Ok(WeaponType::MilleMarteaux),
            [0x00, 0xB1, 0x00] => Ok(WeaponType::LeCogneur),
            [0x00, 0xB2, 0x00] => Ok(WeaponType::CommanderBlade),
            [0x00, 0xB3, 0x00] => Ok(WeaponType::Vivienne),
            [0x00, 0xB4, 0x00] => Ok(WeaponType::Kusanagi),
            [0x00, 0xB5, 0x00] => Ok(WeaponType::SacredDuster),
            [0x00, 0xB6, 0x00] => Ok(WeaponType::Guren),
            [0x00, 0xB7, 0x00] => Ok(WeaponType::Shouren),
            [0x00, 0xB8, 0x00] => Ok(WeaponType::Jizai),
            [0x00, 0xB9, 0x00] => Ok(WeaponType::Flamberge),
            [0x00, 0xBA, 0x00] => Ok(WeaponType::Yunchang),
            [0x00, 0xBB, 0x00] => Ok(WeaponType::SnakeSpire),
            [0x00, 0xBC, 0x00] => Ok(WeaponType::FlapjackFlapper),
            [0x00, 0xBD, 0x00] => Ok(WeaponType::Getsugasan),
            [0x00, 0xBE, 0x00] => Ok(WeaponType::Maguwa),
            [0x00, 0xBF, 0x00] => Ok(WeaponType::HeavenStriker),
            [0x00, 0xC0, 0x00] => Ok(WeaponType::CannonRouge),
            [0x00, 0xC1, 0x00] => Ok(WeaponType::MeteorRouge),
            [0x00, 0xC2, 0x00] => Ok(WeaponType::Solferino),
            [0x00, 0xC3, 0x00] => Ok(WeaponType::Clio),
            [0x00, 0xC4, 0x00] => Ok(WeaponType::SirenGlassHammer),
            [0x00, 0xC5, 0x00] => Ok(WeaponType::GlideDivine),
            [0x00, 0xC6, 0x00] => Ok(WeaponType::Shichishito),
            [0x00, 0xC7, 0x00] => Ok(WeaponType::Murasame),
            [0x00, 0xC8, 0x00] => Ok(WeaponType::DaylightScar),
            [0x00, 0xC9, 0x00] => Ok(WeaponType::Decalog),
            [0x00, 0xCA, 0x00] => Ok(WeaponType::FifthAnnivBlade),
            [0x00, 0xCB, 0x00] => Ok(WeaponType::TyrellsParasol),
            [0x00, 0xCC, 0x00] => Ok(WeaponType::AkikosCleaver),
            [0x00, 0xCD, 0x00] => Ok(WeaponType::Tanegashima),
            [0x00, 0xCE, 0x00] => Ok(WeaponType::TreeClippers),
            [0x00, 0xCF, 0x00] => Ok(WeaponType::NiceShot),
            [0x00, 0xD0, 0x00] => Ok(WeaponType::Unknown3),
            [0x00, 0xD1, 0x00] => Ok(WeaponType::Unknown4),
            [0x00, 0xD2, 0x00] => Ok(WeaponType::AnoBazooka),
            [0x00, 0xD3, 0x00] => Ok(WeaponType::Synthesizer),
            [0x00, 0xD4, 0x00] => Ok(WeaponType::BambooSpear),
            [0x00, 0xD5, 0x00] => Ok(WeaponType::KaneiTsuho),
            [0x00, 0xD6, 0x00] => Ok(WeaponType::Jitte),
            [0x00, 0xD7, 0x00] => Ok(WeaponType::ButterflyNet),
            [0x00, 0xD8, 0x00] => Ok(WeaponType::Syringe),
            [0x00, 0xD9, 0x00] => Ok(WeaponType::Battledore),
            [0x00, 0xDA, 0x00] => Ok(WeaponType::Racket),
            [0x00, 0xDB, 0x00] => Ok(WeaponType::Hammer),
            [0x00, 0xDC, 0x00] => Ok(WeaponType::GreatBouquet),
            [0x00, 0xDD, 0x00] => Ok(WeaponType::TypesaSaber),
            [0x00, 0xDE, 0x00] => Ok(WeaponType::TypeslSaber),
            [0x00, 0xDE, 0x01] => Ok(WeaponType::TypeslSlicer),
            [0x00, 0xDE, 0x02] => Ok(WeaponType::TypeslClaw),
            [0x00, 0xDE, 0x03] => Ok(WeaponType::TypeslKatana),
            [0x00, 0xDF, 0x00] => Ok(WeaponType::TypejsSaber),
            [0x00, 0xDF, 0x01] => Ok(WeaponType::TypejsSlicer),
            [0x00, 0xDF, 0x02] => Ok(WeaponType::TypejsJSword),
            [0x00, 0xE0, 0x00] => Ok(WeaponType::TypeswSword),
            [0x00, 0xE0, 0x01] => Ok(WeaponType::TypeswSlicer),
            [0x00, 0xE0, 0x02] => Ok(WeaponType::TypeswJSword),
            [0x00, 0xE1, 0x00] => Ok(WeaponType::TyperoSword),
            [0x00, 0xE1, 0x01] => Ok(WeaponType::TyperoHalbert),
            [0x00, 0xE1, 0x02] => Ok(WeaponType::TyperoRod),
            [0x00, 0xE2, 0x00] => Ok(WeaponType::TypeblBlade),
            [0x00, 0xE3, 0x00] => Ok(WeaponType::TypeknBlade),
            [0x00, 0xE3, 0x01] => Ok(WeaponType::TypeknClaw),
            [0x00, 0xE4, 0x00] => Ok(WeaponType::TypehaHalbert),
            [0x00, 0xE4, 0x01] => Ok(WeaponType::TypehaRod),
            [0x00, 0xE5, 0x00] => Ok(WeaponType::TypedsDSaber),
            [0x00, 0xE5, 0x01] => Ok(WeaponType::TypedsRod),
            [0x00, 0xE5, 0x02] => Ok(WeaponType::Typeds),
            [0x00, 0xE6, 0x00] => Ok(WeaponType::TypeclClaw),
            [0x00, 0xE7, 0x00] => Ok(WeaponType::TypessSw),
            [0x00, 0xE8, 0x00] => Ok(WeaponType::TypeguHand),
            [0x00, 0xE8, 0x01] => Ok(WeaponType::TypeguMechgun),
            [0x00, 0xE9, 0x00] => Ok(WeaponType::TyperiRifle),
            [0x00, 0xEA, 0x00] => Ok(WeaponType::TypemeMechgun),
            [0x00, 0xEB, 0x00] => Ok(WeaponType::TypeshShot),
            [0x00, 0xEC, 0x00] => Ok(WeaponType::TypewaWand),
           _ => Err(ItemParseError::InvalidWeaponType),
        }
    }
}


#[derive(Debug, Copy, Clone, PartialEq, Serialize, Deserialize)]
pub enum TekSpecialModifier {
    Plus,
    Neutral,
    Minus,
}

#[derive(Debug, Copy, Clone, PartialEq, Serialize, Deserialize)]
pub enum TekPercentModifier {
    PlusPlus,
    Plus,
    Neutral,
    Minus,
    MinusMinus,
}

#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub enum WeaponModifier {
    AddPercents {
        attr: WeaponAttribute,
        pds: Vec<ItemEntityId>,
    },
    AddGrind {
        amount: u32,
        grinder: ItemEntityId,
    },
    Tekked {
        special: TekSpecialModifier,
        percents: TekPercentModifier,
    },
}

#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct Weapon {
    pub weapon: WeaponType,
    pub special: Option<WeaponSpecial>,
    pub grind: u8,
    pub attrs: [Option<WeaponAttribute>; 3],
    pub tekked: bool,
    pub modifiers: Vec<WeaponModifier>
}


impl Weapon {
    pub fn new(wep: WeaponType) -> Weapon {
        Weapon {
            weapon: wep,
            special: None,
            grind: 0,
            attrs: [None; 3],
            tekked: true,
            modifiers: Vec::new(),
        }
    }

    pub fn as_bytes(&self) -> [u8; 16] {
        let mut result = [0u8; 16];
        result[0..3].copy_from_slice(&self.weapon.value());
        result[3] = self.grind;
        result[4] = self.special.map(|s| s.value()).unwrap_or(0);
        
        if self.tekked == false {
            result[4] += 0x80
        };

        result[6..8].copy_from_slice(&self.attrs[0].map(|s| s.value()).unwrap_or([0,0])); 
        result[8..10].copy_from_slice(&self.attrs[1].map(|s| s.value()).unwrap_or([0,0])); 
        result[10..12].copy_from_slice(&self.attrs[2].map(|s| s.value()).unwrap_or([0,0])); 

        result
    }

    // TODO: error handling
    pub fn from_bytes(data: [u8; 16]) -> Result<Weapon, ItemParseError> {
        let w = WeaponType::parse_type([data[0], data[1], data[2]]); 
        if w.is_ok() {
            let mut s = None;
            let mut t = true;
            let g = data[3];
        
            if data[4] >= 0x81 && data[4] <= 0xA8 {
                s = WeaponSpecial::from(data[4] - 0x80);
                t = false;
            }
            else if data[4] >= 0x01 && data[4] <= 0x28 {
                s = WeaponSpecial::from(data[4]);
                t = true;
            }
            // else {
            //     return Err(ItemParseError::InvalidSpecial)
            // }

            let mut a = [
                None,
                None,
                None
            ];

            for i in 0..3 {
                if data[2 * (3 + i)] >= 1 && data[2 * (3 + i)] <= 5 {
                    a[i] = Some(WeaponAttribute{
                        attr: Attribute::from(data[2 * (3 + i)]).unwrap(),
                        value: data[2 * (3 + i) + 1] as i8,
                    });
                } else {
                    a[i] = None;
                    // return Err(ItemParseError::InvalidAttribute)
                }
            }

            Ok(Weapon {
                weapon: w.unwrap(),
                special: s,
                grind: g,
                attrs:[
                    a[0], 
                    a[1], 
                    a[2], 
                    ],
                tekked: t,
                modifiers: Vec::new(),
            })
        }
        else {
            Err(ItemParseError::InvalidWeaponBytes) // TODO: error handling if wrong bytes are given
        }
    }
}