Browse Source

andy vs. clippy round 1

pull/47/head
andy 3 years ago
parent
commit
78c0ffda04
  1. 68
      src/entity/item/armor.rs
  2. 44
      src/entity/item/mag.rs
  3. 1
      src/entity/item/mod.rs
  4. 148
      src/entity/item/shield.rs
  5. 165
      src/entity/item/tool.rs
  6. 60
      src/entity/item/unit.rs
  7. 61
      src/entity/item/weapon.rs
  8. 22
      src/ship/items/inventory.rs
  9. 11
      src/ship/items/manager.rs
  10. 5
      src/ship/packet/handler/direct_message.rs
  11. 6
      src/ship/shops/weapon.rs

68
src/entity/item/armor.rs

@ -331,72 +331,6 @@ impl Armor {
}
pub fn is_rare_item(self) -> bool {
match self.armor {
ArmorType::HunterField => true,
ArmorType::RangerField => true,
ArmorType::ForceField => true,
ArmorType::RevivalGarment => true,
ArmorType::SpiritGarment => true,
ArmorType::StinkFrame => true,
ArmorType::DPartsVer101 => true,
ArmorType::DPartsVer210 => true,
ArmorType::ParasiteWearDeRol => true,
ArmorType::ParasiteWearNelgal => true,
ArmorType::ParasiteWearVajulla => true,
ArmorType::SensePlate => true,
ArmorType::GravitonPlate => true,
ArmorType::AttributePlate => true,
ArmorType::FlowensFrame => true,
ArmorType::CustomFrameVerOo => true,
ArmorType::DbsArmor => true,
ArmorType::GuardWave => true,
ArmorType::DfField => true,
ArmorType::LuminousField => true,
ArmorType::ChuChuFever => true,
ArmorType::LoveHeart => true,
ArmorType::FlameGarment => true,
ArmorType::VirusArmorLafuteria => true,
ArmorType::BrightnessCircle => true,
ArmorType::AuraField => true,
ArmorType::ElectroFrame => true,
ArmorType::SacredCloth => true,
ArmorType::SmokingPlate => true,
ArmorType::StarCuirass => true,
ArmorType::BlackHoundCuirass => true,
ArmorType::MorningPrayer => true,
ArmorType::BlackOdoshiDomaru => true,
ArmorType::RedOdoshiDomaru => true,
ArmorType::BlackOdoshiRedNimaidou => true,
ArmorType::BlueOdoshiVioletNimaidou => true,
ArmorType::DirtyLifejacket => true,
ArmorType::KroesSweater => true,
ArmorType::WeddingDress => true,
ArmorType::SonicteamArmor => true,
ArmorType::RedCoat => true,
ArmorType::Thirteen => true,
ArmorType::MotherGarb => true,
ArmorType::MotherGarbPlus => true,
ArmorType::DressPlate => true,
ArmorType::Sweetheart => true,
ArmorType::IgnitionCloak => true,
ArmorType::CongealCloak => true,
ArmorType::TempestCloak => true,
ArmorType::CursedCloak => true,
ArmorType::SelectCloak => true,
ArmorType::SpiritCuirass => true,
ArmorType::RevivalCuriass => true,
ArmorType::AllianceUniform => true,
ArmorType::OfficerUniform => true,
ArmorType::CommanderUniform => true,
ArmorType::CrimsonCoat => true,
ArmorType::InfantryGear => true,
ArmorType::LieutenantGear => true,
ArmorType::InfantryMantle => true,
ArmorType::LieutenantMantle => true,
ArmorType::UnionField => true,
ArmorType::SamuraiArmor => true,
ArmorType::StealthSuit => true,
_ => false,
}
matches!(self.armor, ArmorType::HunterField | ArmorType::RangerField | ArmorType::ForceField | ArmorType::RevivalGarment | ArmorType::SpiritGarment | ArmorType::StinkFrame | ArmorType::DPartsVer101 | ArmorType::DPartsVer210 | ArmorType::ParasiteWearDeRol | ArmorType::ParasiteWearNelgal | ArmorType::ParasiteWearVajulla | ArmorType::SensePlate | ArmorType::GravitonPlate | ArmorType::AttributePlate | ArmorType::FlowensFrame | ArmorType::CustomFrameVerOo | ArmorType::DbsArmor | ArmorType::GuardWave | ArmorType::DfField | ArmorType::LuminousField | ArmorType::ChuChuFever | ArmorType::LoveHeart | ArmorType::FlameGarment | ArmorType::VirusArmorLafuteria | ArmorType::BrightnessCircle | ArmorType::AuraField | ArmorType::ElectroFrame | ArmorType::SacredCloth | ArmorType::SmokingPlate | ArmorType::StarCuirass | ArmorType::BlackHoundCuirass | ArmorType::MorningPrayer | ArmorType::BlackOdoshiDomaru | ArmorType::RedOdoshiDomaru | ArmorType::BlackOdoshiRedNimaidou | ArmorType::BlueOdoshiVioletNimaidou | ArmorType::DirtyLifejacket | ArmorType::KroesSweater | ArmorType::WeddingDress | ArmorType::SonicteamArmor | ArmorType::RedCoat | ArmorType::Thirteen | ArmorType::MotherGarb | ArmorType::MotherGarbPlus | ArmorType::DressPlate | ArmorType::Sweetheart | ArmorType::IgnitionCloak | ArmorType::CongealCloak | ArmorType::TempestCloak | ArmorType::CursedCloak | ArmorType::SelectCloak | ArmorType::SpiritCuirass | ArmorType::RevivalCuriass | ArmorType::AllianceUniform | ArmorType::OfficerUniform | ArmorType::CommanderUniform | ArmorType::CrimsonCoat | ArmorType::InfantryGear | ArmorType::LieutenantGear | ArmorType::InfantryMantle | ArmorType::LieutenantMantle | ArmorType::UnionField | ArmorType::SamuraiArmor | ArmorType::StealthSuit)
}
}

44
src/entity/item/mag.rs

@ -1101,49 +1101,7 @@ impl Mag {
// TODO: is this even needed? mags are not shop sellable...yet
pub fn is_rare_item(self) -> bool {
match self.mag {
MagType::Pitri => true,
MagType::Soniti => true,
MagType::Preta => true,
MagType::Churel => true,
MagType::Robochao => true,
MagType::OpaOpa => true,
MagType::Pian => true,
MagType::Chao => true,
MagType::ChuChu => true,
MagType::KapuKapu => true,
MagType::AngelsWing => true,
MagType::DevilsWing => true,
MagType::Elenor => true,
MagType::MarkIII => true,
MagType::MasterSystem => true,
MagType::Genesis => true,
MagType::SegaSaturn => true,
MagType::Dreamcast => true,
MagType::Hamburger => true,
MagType::PanzersTail => true,
MagType::DevilsTail => true,
MagType::Deva => true,
MagType::Rati => true,
MagType::Savitri => true,
MagType::Rukmin => true,
MagType::Pushan => true,
MagType::Diwari => true,
MagType::Sato => true,
MagType::Bhima => true,
MagType::Nidra => true,
MagType::GeungSi => true,
MagType::Tellusis => true,
MagType::StrikerUnit => true,
MagType::Pioneer => true,
MagType::Puyo => true,
MagType::Moro => true,
MagType::Rappy => true,
MagType::Yahoo => true,
MagType::GaelGiel => true,
MagType::Agastya => true,
_ => false,
}
matches!(self.mag, MagType::Pitri | MagType::Soniti | MagType::Preta | MagType::Churel | MagType::Robochao | MagType::OpaOpa | MagType::Pian | MagType::Chao | MagType::ChuChu | MagType::KapuKapu | MagType::AngelsWing | MagType::DevilsWing | MagType::Elenor | MagType::MarkIII | MagType::MasterSystem | MagType::Genesis | MagType::SegaSaturn | MagType::Dreamcast | MagType::Hamburger | MagType::PanzersTail | MagType::DevilsTail | MagType::Deva | MagType::Rati | MagType::Savitri | MagType::Rukmin | MagType::Pushan | MagType::Diwari | MagType::Sato | MagType::Bhima | MagType::Nidra | MagType::GeungSi | MagType::Tellusis | MagType::StrikerUnit | MagType::Pioneer | MagType::Puyo | MagType::Moro | MagType::Rappy | MagType::Yahoo | MagType::GaelGiel | MagType::Agastya)
}
}

1
src/entity/item/mod.rs

@ -12,7 +12,6 @@ use serde::{Serialize, Deserialize};
use crate::entity::character::CharacterEntityId;
use crate::ship::map::MapArea;
use crate::ship::drops::ItemDropType;
use crate::ship::shops::{ShopItem, ArmorShopItem, ToolShopItem, WeaponShopItem};
#[derive(PartialEq, Copy, Clone, Debug, Hash, Eq, PartialOrd, Ord, Serialize, Deserialize)]
pub struct ItemEntityId(pub u32);

148
src/entity/item/shield.rs

@ -550,152 +550,6 @@ impl Shield {
}
pub fn is_rare_item(self) -> bool {
match self.shield {
ShieldType::InvisibleGuard => true,
ShieldType::SacredGuard => true,
ShieldType::SPartsVer116 => true,
ShieldType::SPartsVer201 => true,
ShieldType::LightRelief => true,
ShieldType::ShieldOfDelsaber => true,
ShieldType::ForceWall => true,
ShieldType::RangerWall => true,
ShieldType::HunterWall => true,
ShieldType::AttributeWall => true,
ShieldType::SecretGear => true,
ShieldType::CombatGear => true,
ShieldType::ProtoRegeneGear => true,
ShieldType::RegenerateGear => true,
ShieldType::RegeneGearAdv => true,
ShieldType::FlowensShield => true,
ShieldType::CustomBarrierVerOo => true,
ShieldType::DbsShield => true,
ShieldType::RedRing => true,
ShieldType::TripolicShield => true,
ShieldType::StandstillShield => true,
ShieldType::SafetyHeart => true,
ShieldType::KasamiBracer => true,
ShieldType::GodsShieldSuzaku => true,
ShieldType::GodsShieldGenbu => true,
ShieldType::GodsShieldByakko => true,
ShieldType::GodsShieldSeiryu => true,
ShieldType::HuntersShell => true,
ShieldType::RicosGlasses => true,
ShieldType::RicosEarring => true,
ShieldType::BlueRing => true,
ShieldType::Barrier2 => true,
ShieldType::SecureFeet => true,
ShieldType::Barrier3 => true,
ShieldType::Barrier4 => true,
ShieldType::Barrier5 => true,
ShieldType::Barrier6 => true,
ShieldType::RestaMerge => true,
ShieldType::AntiMerge => true,
ShieldType::ShiftaMerge => true,
ShieldType::DebandMerge => true,
ShieldType::FoieMerge => true,
ShieldType::GifoieMerge => true,
ShieldType::RafoieMerge => true,
ShieldType::RedMerge => true,
ShieldType::BartaMerge => true,
ShieldType::GibartaMerge => true,
ShieldType::RabartaMerge => true,
ShieldType::BlueMerge => true,
ShieldType::ZondeMerge => true,
ShieldType::GizondeMerge => true,
ShieldType::RazondeMerge => true,
ShieldType::YellowMerge => true,
ShieldType::RecoveryBarrier => true,
ShieldType::AssistBarrier => true,
ShieldType::RedBarrier => true,
ShieldType::BlueBarrier => true,
ShieldType::YellowBarrier => true,
ShieldType::WeaponsGoldShield => true,
ShieldType::BlackGear => true,
ShieldType::WorksGuard => true,
ShieldType::RagolRing => true,
ShieldType::BlueRing2 => true,
ShieldType::BlueRing3 => true,
ShieldType::BlueRing4 => true,
ShieldType::BlueRing5 => true,
ShieldType::BlueRing6 => true,
ShieldType::BlueRing7 => true,
ShieldType::BlueRing8 => true,
ShieldType::BlueRing9 => true,
ShieldType::GreenRing => true,
ShieldType::GreenRing2 => true,
ShieldType::GreenRing3 => true,
ShieldType::GreenRing4 => true,
ShieldType::GreenRing5 => true,
ShieldType::GreenRing6 => true,
ShieldType::GreenRing7 => true,
ShieldType::GreenRing8 => true,
ShieldType::YellowRing => true,
ShieldType::YellowRing2 => true,
ShieldType::YellowRing3 => true,
ShieldType::YellowRing4 => true,
ShieldType::YellowRing5 => true,
ShieldType::YellowRing6 => true,
ShieldType::YellowRing7 => true,
ShieldType::YellowRing8 => true,
ShieldType::PurpleRing => true,
ShieldType::PurpleRing2 => true,
ShieldType::PurpleRing3 => true,
ShieldType::PurpleRing4 => true,
ShieldType::PurpleRing5 => true,
ShieldType::PurpleRing6 => true,
ShieldType::PurpleRing7 => true,
ShieldType::PurpleRing8 => true,
ShieldType::WhiteRing => true,
ShieldType::WhiteRing2 => true,
ShieldType::WhiteRing3 => true,
ShieldType::WhiteRing4 => true,
ShieldType::WhiteRing5 => true,
ShieldType::WhiteRing6 => true,
ShieldType::WhiteRing7 => true,
ShieldType::WhiteRing8 => true,
ShieldType::BlackRing => true,
ShieldType::BlackRing2 => true,
ShieldType::BlackRing3 => true,
ShieldType::BlackRing4 => true,
ShieldType::BlackRing5 => true,
ShieldType::BlackRing6 => true,
ShieldType::BlackRing7 => true,
ShieldType::BlackRing8 => true,
ShieldType::WeaponsSilverShield => true,
ShieldType::WeaponsCopperShield => true,
ShieldType::Gratia => true,
ShieldType::TripolicReflector => true,
ShieldType::StrikerPlus => true,
ShieldType::RegenerateGearBP => true,
ShieldType::Rupika => true,
ShieldType::YataMirror => true,
ShieldType::BunnyEars => true,
ShieldType::CatEars => true,
ShieldType::ThreeSeals => true,
ShieldType::GodsShieldKouryu => true,
ShieldType::DfShield => true,
ShieldType::FromTheDepths => true,
ShieldType::DeRolLeShield => true,
ShieldType::HoneycombReflector => true,
ShieldType::Epsiguard => true,
ShieldType::AngelRing => true,
ShieldType::UnionGuard => true,
ShieldType::UnionGuard2 => true,
ShieldType::UnionGuard3 => true,
ShieldType::UnionGuard4 => true,
ShieldType::StinkShield => true,
ShieldType::Unknownb => true,
ShieldType::Genpei => true,
ShieldType::Genpei2 => true,
ShieldType::Genpei3 => true,
ShieldType::Genpei4 => true,
ShieldType::Genpei5 => true,
ShieldType::Genpei6 => true,
ShieldType::Genpei7 => true,
ShieldType::Genpei8 => true,
ShieldType::Genpei9 => true,
ShieldType::Genpei10 => true,
_ => false,
}
matches!(self.shield, ShieldType::InvisibleGuard | ShieldType::SacredGuard | ShieldType::SPartsVer116 | ShieldType::SPartsVer201 | ShieldType::LightRelief | ShieldType::ShieldOfDelsaber | ShieldType::ForceWall | ShieldType::RangerWall | ShieldType::HunterWall | ShieldType::AttributeWall | ShieldType::SecretGear | ShieldType::CombatGear | ShieldType::ProtoRegeneGear | ShieldType::RegenerateGear | ShieldType::RegeneGearAdv | ShieldType::FlowensShield | ShieldType::CustomBarrierVerOo | ShieldType::DbsShield | ShieldType::RedRing | ShieldType::TripolicShield | ShieldType::StandstillShield | ShieldType::SafetyHeart | ShieldType::KasamiBracer | ShieldType::GodsShieldSuzaku | ShieldType::GodsShieldGenbu | ShieldType::GodsShieldByakko | ShieldType::GodsShieldSeiryu | ShieldType::HuntersShell | ShieldType::RicosGlasses | ShieldType::RicosEarring | ShieldType::BlueRing | ShieldType::Barrier2 | ShieldType::SecureFeet | ShieldType::Barrier3 | ShieldType::Barrier4 | ShieldType::Barrier5 | ShieldType::Barrier6 | ShieldType::RestaMerge | ShieldType::AntiMerge | ShieldType::ShiftaMerge | ShieldType::DebandMerge | ShieldType::FoieMerge | ShieldType::GifoieMerge | ShieldType::RafoieMerge | ShieldType::RedMerge | ShieldType::BartaMerge | ShieldType::GibartaMerge | ShieldType::RabartaMerge | ShieldType::BlueMerge | ShieldType::ZondeMerge | ShieldType::GizondeMerge | ShieldType::RazondeMerge | ShieldType::YellowMerge | ShieldType::RecoveryBarrier | ShieldType::AssistBarrier | ShieldType::RedBarrier | ShieldType::BlueBarrier | ShieldType::YellowBarrier | ShieldType::WeaponsGoldShield | ShieldType::BlackGear | ShieldType::WorksGuard | ShieldType::RagolRing | ShieldType::BlueRing2 | ShieldType::BlueRing3 | ShieldType::BlueRing4 | ShieldType::BlueRing5 | ShieldType::BlueRing6 | ShieldType::BlueRing7 | ShieldType::BlueRing8 | ShieldType::BlueRing9 | ShieldType::GreenRing | ShieldType::GreenRing2 | ShieldType::GreenRing3 | ShieldType::GreenRing4 | ShieldType::GreenRing5 | ShieldType::GreenRing6 | ShieldType::GreenRing7 | ShieldType::GreenRing8 | ShieldType::YellowRing | ShieldType::YellowRing2 | ShieldType::YellowRing3 | ShieldType::YellowRing4 | ShieldType::YellowRing5 | ShieldType::YellowRing6 | ShieldType::YellowRing7 | ShieldType::YellowRing8 | ShieldType::PurpleRing | ShieldType::PurpleRing2 | ShieldType::PurpleRing3 | ShieldType::PurpleRing4 | ShieldType::PurpleRing5 | ShieldType::PurpleRing6 | ShieldType::PurpleRing7 | ShieldType::PurpleRing8 | ShieldType::WhiteRing | ShieldType::WhiteRing2 | ShieldType::WhiteRing3 | ShieldType::WhiteRing4 | ShieldType::WhiteRing5 | ShieldType::WhiteRing6 | ShieldType::WhiteRing7 | ShieldType::WhiteRing8 | ShieldType::BlackRing | ShieldType::BlackRing2 | ShieldType::BlackRing3 | ShieldType::BlackRing4 | ShieldType::BlackRing5 | ShieldType::BlackRing6 | ShieldType::BlackRing7 | ShieldType::BlackRing8 | ShieldType::WeaponsSilverShield | ShieldType::WeaponsCopperShield | ShieldType::Gratia | ShieldType::TripolicReflector | ShieldType::StrikerPlus | ShieldType::RegenerateGearBP | ShieldType::Rupika | ShieldType::YataMirror | ShieldType::BunnyEars | ShieldType::CatEars | ShieldType::ThreeSeals | ShieldType::GodsShieldKouryu | ShieldType::DfShield | ShieldType::FromTheDepths | ShieldType::DeRolLeShield | ShieldType::HoneycombReflector | ShieldType::Epsiguard | ShieldType::AngelRing | ShieldType::UnionGuard | ShieldType::UnionGuard2 | ShieldType::UnionGuard3 | ShieldType::UnionGuard4 | ShieldType::StinkShield | ShieldType::Unknownb | ShieldType::Genpei | ShieldType::Genpei2 | ShieldType::Genpei3 | ShieldType::Genpei4 | ShieldType::Genpei5 | ShieldType::Genpei6 | ShieldType::Genpei7 | ShieldType::Genpei8 | ShieldType::Genpei9 | ShieldType::Genpei10)
}
}

165
src/entity/item/tool.rs

@ -682,172 +682,11 @@ impl Tool {
}
pub fn is_rare_item(self) -> bool {
match self.tool {
ToolType::CellOfMag502 => true,
ToolType::CellOfMag213 => true,
ToolType::PartsOfRobochao => true,
ToolType::HeartOfOpaOpa => true,
ToolType::HeartOfPian => true,
ToolType::HeartOfChao => true,
ToolType::SorcerersRightArm => true,
ToolType::SBeatsArms => true,
ToolType::PArmsArms => true,
ToolType::DelsabersRightArm => true,
ToolType::BringersRightArm => true,
ToolType::DelsabersLeftArm => true,
ToolType::SRedsArms => true,
ToolType::DragonsClaw => true,
ToolType::HildebearsHead => true,
ToolType::HildebluesHead => true,
ToolType::PartsOfBaranz => true,
ToolType::BelrasRightArm => true,
ToolType::GiGuesBody => true,
ToolType::SinowBerillsArms => true,
ToolType::GrassAssassinsArms => true,
ToolType::BoomasRightArm => true,
ToolType::GoboomasRightArm => true,
ToolType::GigoboomasRightArm => true,
ToolType::GalGryphonsWing => true,
ToolType::RappysWing => true,
ToolType::CladdingOfEpsilon => true,
ToolType::DeRolLeShell => true,
ToolType::BerillPhoton => true,
ToolType::ParasiticGeneFlow => true,
ToolType::MagicStoneIritista => true,
ToolType::BlueBlackStone => true,
ToolType::Syncesta => true,
ToolType::MagicWater => true,
ToolType::ParasiticCellTypeD => true,
ToolType::MagicRockHeartKey => true,
ToolType::MagicRockMoola => true,
ToolType::StarAmplifier => true,
ToolType::BookOfHitogata => true,
ToolType::HeartOfChuChu => true,
ToolType::PartsOfEggBlaster => true,
ToolType::HeartOfAngel => true,
ToolType::HeartOfDevil => true,
ToolType::KitOfHamburger => true,
ToolType::PanthersSpirit => true,
ToolType::KitOfMark3 => true,
ToolType::KitOfMasterSystem => true,
ToolType::KitOfGenesis => true,
ToolType::KitOfSegaSaturn => true,
ToolType::KitOfDreamcast => true,
ToolType::AmplifierOfResta => true,
ToolType::AmplifierOfAnti => true,
ToolType::AmplifierOfShifta => true,
ToolType::AmplifierOfDeband => true,
ToolType::AmplifierOfFoie => true,
ToolType::AmplifierOfGifoie => true,
ToolType::AmplifierOfRafoie => true,
ToolType::AmplifierOfBarta => true,
ToolType::AmplifierOfGibarta => true,
ToolType::AmplifierOfRabarta => true,
ToolType::AmplifierOfZonde => true,
ToolType::AmplifierOfGizonde => true,
ToolType::AmplifierOfRazonde => true,
ToolType::AmplifierOfRed => true,
ToolType::AmplifierOfBlue => true,
ToolType::AmplifierOfYellow => true,
ToolType::HeartOfKapuKapu => true,
ToolType::PhotonBooster => true,
ToolType::Addslot => true,
ToolType::PhotonDrop => true,
ToolType::PhotonSphere => true,
ToolType::PhotonCrystal => true,
ToolType::SecretTicket => true,
ToolType::PhotonTicket => true,
ToolType::BookOfKatana1 => true,
ToolType::BookOfKatana2 => true,
ToolType::BookOfKatana3 => true,
ToolType::WeaponsBronzeBadge => true,
ToolType::WeaponsSilverBadge => true,
ToolType::WeaponsGoldBadge => true,
ToolType::WeaponsCrystalBadge => true,
ToolType::WeaponsSteelBadge => true,
ToolType::WeaponsAluminumBadge => true,
ToolType::WeaponsLeatherBadge => true,
ToolType::WeaponsBoneBadge => true,
ToolType::LetterOfAppreciation => true,
ToolType::ItemTicket => true,
ToolType::ValentinesChocolate => true,
ToolType::NewYearsCard => true,
ToolType::ChristmasCard => true,
ToolType::BirthdayCard => true,
ToolType::ProofOfSonicTeam => true,
ToolType::SpecialEventTicket => true,
ToolType::FlowerBouquet => true,
ToolType::Cake => true,
ToolType::Accessories => true,
ToolType::MrNakasBusinessCard => true,
ToolType::Present => true,
ToolType::Chocolate => true,
ToolType::Candy => true,
ToolType::Cake2 => true,
ToolType::WeaponsSilverBadge2 => true,
ToolType::WeaponsGoldBadge2 => true,
ToolType::WeaponsCrystalBadge2 => true,
ToolType::WeaponsSteelBadge2 => true,
ToolType::WeaponsAluminumBadge2 => true,
ToolType::WeaponsLeatherBadge2 => true,
ToolType::WeaponsBoneBadge2 => true,
ToolType::Bouquet => true,
ToolType::Decoction => true,
ToolType::ChristmasPresent => true,
ToolType::EasterEgg => true,
ToolType::JackOLantern => true,
ToolType::DiskVol1WeddingMarch => true,
ToolType::DiskVol2DayLight => true,
ToolType::DiskVol3BurningRangers => true,
ToolType::DiskVol4OpenYourHeart => true,
ToolType::DiskVol5LiveLearn => true,
ToolType::DiskVol6Nights => true,
ToolType::DiskVol7EndingThemePianoVer => true,
ToolType::DiskVol8HeartToHeart => true,
ToolType::DiskVol9StrangeBlue => true,
ToolType::DiskVol10ReunionSystem => true,
ToolType::DiskVol11Pinnacles => true,
ToolType::DiskVol12FightInsideTheSpaceship => true,
ToolType::HuntersReport => true,
ToolType::HuntersReport2 => true,
ToolType::HuntersReport3 => true,
ToolType::HuntersReport4 => true,
ToolType::HuntersReport5 => true,
ToolType::Tablet => true,
ToolType::Unknown2 => true,
ToolType::DragonScale => true,
ToolType::HeavenStrikerCoat => true,
ToolType::PioneerParts => true,
ToolType::AmitiesMemo => true,
ToolType::HeartOfMorolian => true,
ToolType::RappysBeak => true,
ToolType::YahoosEngine => true,
ToolType::DPhotonCore => true,
ToolType::LibertaKit => true,
ToolType::CellOfMag0503 => true,
ToolType::CellOfMag0504 => true,
ToolType::CellOfMag0505 => true,
ToolType::CellOfMag0506 => true,
ToolType::CellOfMag0507 => true,
ToolType::TeamPoints500 => true,
ToolType::TeamPoints1000 => true,
ToolType::TeamPoints5000 => true,
ToolType::TeamPoints10000 => true,
_ => false,
}
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 {
match self.tool {
ToolType::PowerMaterial => true,
ToolType::MindMaterial => true,
ToolType::EvadeMaterial => true,
ToolType::HpMaterial => true,
ToolType::TpMaterial => true,
ToolType::DefMaterial => true,
ToolType::LuckMaterial => true,
_ => false,
}
matches!(self.tool, ToolType::PowerMaterial | ToolType::MindMaterial | ToolType::EvadeMaterial | ToolType::HpMaterial | ToolType::TpMaterial | ToolType::DefMaterial | ToolType::LuckMaterial)
}
}

60
src/entity/item/unit.rs

@ -386,64 +386,6 @@ impl Unit {
}
pub fn is_rare_item(self) -> bool {
match self.unit {
UnitType::GodPower => true,
UnitType::GodMind => true,
UnitType::GodArm => true,
UnitType::GodLegs => true,
UnitType::GodHp => true,
UnitType::GodTp => true,
UnitType::GodBody => true,
UnitType::GodLuck => true,
UnitType::HeroAbility => true,
UnitType::GodAbility => true,
UnitType::AllResist => true,
UnitType::SuperResist => true,
UnitType::PerfectResist => true,
UnitType::HpRevival => true,
UnitType::TpRevival => true,
UnitType::PbAmplifier => true,
UnitType::PbGenerate => true,
UnitType::PbCreate => true,
UnitType::DevilTechnique => true,
UnitType::GodTechnique => true,
UnitType::DevilBattle => true,
UnitType::GodBattle => true,
UnitType::CurePoison => true,
UnitType::CureParalysis => true,
UnitType::CureSlow => true,
UnitType::CureConfuse => true,
UnitType::CureFreeze => true,
UnitType::CureShock => true,
UnitType::YasakaniMagatama => true,
UnitType::V101 => true,
UnitType::V501 => true,
UnitType::V502 => true,
UnitType::V801 => true,
UnitType::Limiter => true,
UnitType::Adept => true,
UnitType::SwordsmanLore => true,
UnitType::ProofOfSwordSaint => true,
UnitType::Smartlink => true,
UnitType::DivineProtection => true,
UnitType::HeavenlyBattle => true,
UnitType::HeavenlyPower => true,
UnitType::HeavenlyMind => true,
UnitType::HeavenlyArms => true,
UnitType::HeavenlyLegs => true,
UnitType::HeavenlyBody => true,
UnitType::HeavenlyLuck => true,
UnitType::HeavenlyAbility => true,
UnitType::CenturionAbility => true,
UnitType::FriendRing => true,
UnitType::HeavenlyHp => true,
UnitType::HeavenlyTp => true,
UnitType::HeavenlyResist => true,
UnitType::HeavenlyTechnique => true,
UnitType::HpRessurection => true,
UnitType::TpRessurection => true,
UnitType::PbIncrease => true,
_ => false,
}
matches!(self.unit, UnitType::GodPower | UnitType::GodMind | UnitType::GodArm | UnitType::GodLegs | UnitType::GodHp | UnitType::GodTp | UnitType::GodBody | UnitType::GodLuck | UnitType::HeroAbility | UnitType::GodAbility | UnitType::AllResist | UnitType::SuperResist | UnitType::PerfectResist | UnitType::HpRevival | UnitType::TpRevival | UnitType::PbAmplifier | UnitType::PbGenerate | UnitType::PbCreate | UnitType::DevilTechnique | UnitType::GodTechnique | UnitType::DevilBattle | UnitType::GodBattle | UnitType::CurePoison | UnitType::CureParalysis | UnitType::CureSlow | UnitType::CureConfuse | UnitType::CureFreeze | UnitType::CureShock | UnitType::YasakaniMagatama | UnitType::V101 | UnitType::V501 | UnitType::V502 | UnitType::V801 | UnitType::Limiter | UnitType::Adept | UnitType::SwordsmanLore | UnitType::ProofOfSwordSaint | UnitType::Smartlink | UnitType::DivineProtection | UnitType::HeavenlyBattle | UnitType::HeavenlyPower | UnitType::HeavenlyMind | UnitType::HeavenlyArms | UnitType::HeavenlyLegs | UnitType::HeavenlyBody | UnitType::HeavenlyLuck | UnitType::HeavenlyAbility | UnitType::CenturionAbility | UnitType::FriendRing | UnitType::HeavenlyHp | UnitType::HeavenlyTp | UnitType::HeavenlyResist | UnitType::HeavenlyTechnique | UnitType::HpRessurection | UnitType::TpRessurection | UnitType::PbIncrease)
}
}

61
src/entity/item/weapon.rs

@ -1587,66 +1587,7 @@ impl Weapon {
// TODO: invert this? ie: handgun, saber, dagger etc. => false, _ => true?
pub fn is_rare_item(self) -> bool {
match self.weapon {
WeaponType::Saber => false,
WeaponType::Brand => false,
WeaponType::Buster => false,
WeaponType::Pallasch => false,
WeaponType::Gladius => false,
WeaponType::Sword => false,
WeaponType::Gigush => false,
WeaponType::Breaker => false,
WeaponType::Claymore => false,
WeaponType::Calibur => false,
WeaponType::Dagger => false,
WeaponType::Knife => false,
WeaponType::Blade => false,
WeaponType::Edge => false,
WeaponType::Ripper => false,
WeaponType::Partisan => false,
WeaponType::Halbert => false,
WeaponType::Glaive => false,
WeaponType::Berdys => false,
WeaponType::Gungnir => false,
WeaponType::Slicer => false,
WeaponType::Spinner => false,
WeaponType::Cutter => false,
WeaponType::Sawcer => false,
WeaponType::Diska => false,
WeaponType::Handgun => false,
WeaponType::Autogun => false,
WeaponType::Lockgun => false,
WeaponType::Railgun => false,
WeaponType::Raygun => false,
WeaponType::Rifle => false,
WeaponType::Sniper => false,
WeaponType::Blaster => false,
WeaponType::Beam => false,
WeaponType::Laser => false,
WeaponType::Mechgun => false,
WeaponType::Assault => false,
WeaponType::Repeater => false,
WeaponType::Gatling => false,
WeaponType::Vulcan => false,
WeaponType::Shot => false,
WeaponType::Spread => false,
WeaponType::Cannon => false,
WeaponType::Launcher => false,
WeaponType::Arms => false,
WeaponType::Cane => false,
WeaponType::Stick => false,
WeaponType::Mace => false,
WeaponType::Club => false,
WeaponType::Rod => false,
WeaponType::Pole => false,
WeaponType::Pillar => false,
WeaponType::Striker => false,
WeaponType::Wand => false,
WeaponType::Staff => false,
WeaponType::Baton => false,
WeaponType::Scepter => false,
_ => true,
}
!matches!(self.weapon, WeaponType::Saber | WeaponType::Brand | WeaponType::Buster | WeaponType::Pallasch | WeaponType::Gladius | WeaponType::Sword | WeaponType::Gigush | WeaponType::Breaker | WeaponType::Claymore | WeaponType::Calibur | WeaponType::Dagger | WeaponType::Knife | WeaponType::Blade | WeaponType::Edge | WeaponType::Ripper | WeaponType::Partisan | WeaponType::Halbert | WeaponType::Glaive | WeaponType::Berdys | WeaponType::Gungnir | WeaponType::Slicer | WeaponType::Spinner | WeaponType::Cutter | WeaponType::Sawcer | WeaponType::Diska | WeaponType::Handgun | WeaponType::Autogun | WeaponType::Lockgun | WeaponType::Railgun | WeaponType::Raygun | WeaponType::Rifle | WeaponType::Sniper | WeaponType::Blaster | WeaponType::Beam | WeaponType::Laser | WeaponType::Mechgun | WeaponType::Assault | WeaponType::Repeater | WeaponType::Gatling | WeaponType::Vulcan | WeaponType::Shot | WeaponType::Spread | WeaponType::Cannon | WeaponType::Launcher | WeaponType::Arms | WeaponType::Cane | WeaponType::Stick | WeaponType::Mace | WeaponType::Club | WeaponType::Rod | WeaponType::Pole | WeaponType::Pillar | WeaponType::Striker | WeaponType::Wand | WeaponType::Staff | WeaponType::Baton | WeaponType::Scepter)
}
}

22
src/ship/items/inventory.rs

@ -1,9 +1,9 @@
use std::cmp::Ordering;
use thiserror::Error;
use libpso::character::character;//::InventoryItem;
use libpso::character::character;
use crate::entity::character::CharacterEntityId;
use crate::entity::item::{ItemEntityId, ItemDetail, ItemEntity, ItemType, ItemLocation, InventoryEntity, InventoryItemEntity, EquippedEntity};
use crate::entity::item::tool::{Tool, ToolType};
use crate::entity::item::tool::Tool;
use crate::entity::item::mag::Mag;
use crate::entity::item::weapon::Weapon;
use crate::ship::items::{ClientItemId, BankItem, BankItemHandle};
@ -235,46 +235,46 @@ impl InventoryItem {
return Some(10u32)
}
// other item factors?
return Some((WeaponShopItem::weapon_from_item(w).price() / 8) as u32)
Some((WeaponShopItem::weapon_from_item(w).price() / 8) as u32)
},
ItemDetail::Armor(a) => {
if a.is_rare_item() {
return Some(10u32)
}
return Some((ArmorShopItem::armor_from_item(a).price() / 8) as u32)
Some((ArmorShopItem::armor_from_item(a).price() / 8) as u32)
},
ItemDetail::Shield(s) => {
if s.is_rare_item() {
return Some(10u32)
}
return Some((ArmorShopItem::shield_from_item(s).price() / 8) as u32)
Some((ArmorShopItem::shield_from_item(s).price() / 8) as u32)
},
ItemDetail::Unit(u) => {
if u.is_rare_item() {
return Some(10u32)
}
return Some((ArmorShopItem::unit_from_item(u).price() / 8) as u32)
Some((ArmorShopItem::unit_from_item(u).price() / 8) as u32)
},
ItemDetail::Tool(t) => {
if t.is_rare_item() { // TODO: photon drop/sphere etc
return Some(10u32)
}
return Some((ToolShopItem::tool_from_item(t).price() / 8) as u32)
Some((ToolShopItem::tool_from_item(t).price() / 8) as u32)
},
ItemDetail::TechniqueDisk(d) => { // TODO: are all techs the same?
return Some((ToolShopItem::tech_from_item(d).price() / 8) as u32)
Some((ToolShopItem::tech_from_item(d).price() / 8) as u32)
},
ItemDetail::Mag(_m) => { //TODO: error. mags are not sellable
return None
None
},
ItemDetail::ESWeapon(_e) => {
return Some(10u32) // TODO: check price
Some(10u32) // TODO: check price
},
}
},
// the number of stacked items sold is handled by the caller. this is just the price of 1
InventoryItem::Stacked(stacked_item) => {
return Some((ToolShopItem::tool_from_item(&stacked_item.tool).price() / 8) as u32)
Some((ToolShopItem::tool_from_item(&stacked_item.tool).price() / 8) as u32)
},
}
}

11
src/ship/items/manager.rs

@ -1,5 +1,5 @@
use crate::ship::items::ClientItemId;
use std::collections::{HashMap, BTreeMap};
use std::collections::HashMap;
use std::cmp::Ordering;
use thiserror::Error;
use crate::entity::gateway::EntityGateway;
@ -876,7 +876,7 @@ impl ItemManager {
},
}
entity_gateway.set_character_inventory(&character.id, &inventory.as_inventory_entity(&character.id)).await?;
entity_gateway.save_character(&character).await?;
entity_gateway.save_character(character).await?;
} else {
return Err(ItemManagerError::WalletFull.into());
}
@ -947,10 +947,9 @@ impl ItemManager {
.ok_or(ItemManagerError::WrongItemType(item_id))?;
let entity_id = individual.entity_id;
let mut weapon = individual
let mut weapon = *individual
.weapon()
.ok_or(ItemManagerError::WrongItemType(item_id))?
.clone();
.ok_or(ItemManagerError::WrongItemType(item_id))?;
weapon.apply_modifier(&tek);
entity_gateway.add_weapon_modifier(&entity_id, tek).await?;
@ -958,7 +957,7 @@ impl ItemManager {
inventory.add_item(InventoryItem::Individual(IndividualInventoryItem {
entity_id,
item_id,
item: ItemDetail::Weapon(weapon.clone()),
item: ItemDetail::Weapon(weapon),
}))?;
entity_gateway.set_character_inventory(&character.id, &inventory.as_inventory_entity(&character.id)).await?;

5
src/ship/packet/handler/direct_message.rs

@ -436,11 +436,10 @@ where
let inventory = item_manager.get_character_inventory(&client.character)?;
let item = inventory.get_item_by_id(ClientItemId(tek_request.item_id))
.ok_or(ItemManagerError::WrongItemType(ClientItemId(tek_request.item_id)))?;
let mut weapon = item.individual()
let mut weapon = *item.individual()
.ok_or(ItemManagerError::WrongItemType(ClientItemId(tek_request.item_id)))?
.weapon()
.ok_or(ItemManagerError::WrongItemType(ClientItemId(tek_request.item_id)))?
.clone();
.ok_or(ItemManagerError::WrongItemType(ClientItemId(tek_request.item_id)))?;
weapon.apply_modifier(&item::weapon::WeaponModifier::Tekked {
special: special_mod,

6
src/ship/shops/weapon.rs

@ -522,9 +522,9 @@ impl<R: Rng + SeedableRng> WeaponShop<R> {
};
WeaponShopItem {
weapon: weapon,
grind: grind,
special: special,
weapon,
grind,
special,
attributes: [attr1, attr2, None],
}
}

Loading…
Cancel
Save