Browse Source

initial present stuff

presents
andy 4 years ago
parent
commit
a77b9874ff
  1. 7
      src/bin/main.rs
  2. 3
      src/entity/gateway/postgres/models.rs
  3. 26
      src/entity/item/weapon.rs
  4. 1
      src/login/character.rs
  5. 5
      src/ship/drops/generic_weapon.rs
  6. 1
      src/ship/drops/rare_drop_table.rs
  7. 1
      src/ship/shops/weapon.rs

7
src/bin/main.rs

@ -84,6 +84,7 @@ fn main() {
special: None, special: None,
attrs: [None, None, None], attrs: [None, None, None],
tekked: true, tekked: true,
wrapping: None,
} }
), ),
location: item::ItemLocation::Bank { location: item::ItemLocation::Bank {
@ -119,6 +120,7 @@ fn main() {
Some(item::weapon::WeaponAttribute{attr: item::weapon::Attribute::Dark, value: 30}), Some(item::weapon::WeaponAttribute{attr: item::weapon::Attribute::Dark, value: 30}),
None,], None,],
tekked: false, tekked: false,
wrapping: Some(item::weapon::WrappingPaper::Black_Yellow),
} }
), ),
location: ItemLocation::Inventory { location: ItemLocation::Inventory {
@ -136,6 +138,7 @@ fn main() {
Some(item::weapon::WeaponAttribute{attr: item::weapon::Attribute::Dark, value: 30}), Some(item::weapon::WeaponAttribute{attr: item::weapon::Attribute::Dark, value: 30}),
None,], None,],
tekked: true, tekked: true,
wrapping: None,
} }
), ),
location: ItemLocation::Inventory { location: ItemLocation::Inventory {
@ -153,6 +156,7 @@ fn main() {
Some(item::weapon::WeaponAttribute{attr: item::weapon::Attribute::Dark, value: 100}), Some(item::weapon::WeaponAttribute{attr: item::weapon::Attribute::Dark, value: 100}),
None,], None,],
tekked: true, tekked: true,
wrapping: None,
} }
), ),
location: ItemLocation::Inventory { location: ItemLocation::Inventory {
@ -170,6 +174,7 @@ fn main() {
Some(item::weapon::WeaponAttribute{attr: item::weapon::Attribute::Dark, value: 100}), Some(item::weapon::WeaponAttribute{attr: item::weapon::Attribute::Dark, value: 100}),
None,], None,],
tekked: true, tekked: true,
wrapping: None,
} }
), ),
location: ItemLocation::Inventory { location: ItemLocation::Inventory {
@ -187,6 +192,7 @@ fn main() {
Some(item::weapon::WeaponAttribute{attr: item::weapon::Attribute::Dark, value: 100}), Some(item::weapon::WeaponAttribute{attr: item::weapon::Attribute::Dark, value: 100}),
Some(item::weapon::WeaponAttribute{attr: item::weapon::Attribute::Native, value: 100}),], Some(item::weapon::WeaponAttribute{attr: item::weapon::Attribute::Native, value: 100}),],
tekked: true, tekked: true,
wrapping: None,
} }
), ),
location: ItemLocation::Inventory { location: ItemLocation::Inventory {
@ -251,6 +257,7 @@ fn main() {
Some(item::weapon::WeaponAttribute{attr: item::weapon::Attribute::Dark, value: 80}), Some(item::weapon::WeaponAttribute{attr: item::weapon::Attribute::Dark, value: 80}),
None,], None,],
tekked: false, tekked: false,
wrapping: None,
} }
), ),
location: ItemLocation::Bank { location: ItemLocation::Bank {

3
src/entity/gateway/postgres/models.rs

@ -286,6 +286,7 @@ pub struct PgWeapon {
grind: u8, grind: u8,
attrs: HashMap<weapon::Attribute, i8>, attrs: HashMap<weapon::Attribute, i8>,
tekked: bool, tekked: bool,
wrapping: Option<weapon::WrappingPaper>,
} }
impl From<weapon::Weapon> for PgWeapon { impl From<weapon::Weapon> for PgWeapon {
@ -296,6 +297,7 @@ impl From<weapon::Weapon> for PgWeapon {
grind: other.grind, grind: other.grind,
attrs: other.attrs.iter().flatten().map(|attr| (attr.attr, attr.value)).collect(), attrs: other.attrs.iter().flatten().map(|attr| (attr.attr, attr.value)).collect(),
tekked: other.tekked, tekked: other.tekked,
wrapping: other.wrapping,
} }
} }
} }
@ -316,6 +318,7 @@ impl Into<weapon::Weapon> for PgWeapon {
grind: self.grind, grind: self.grind,
attrs: attrs, attrs: attrs,
tekked: self.tekked, tekked: self.tekked,
wrapping: self.wrapping,
} }
} }
} }

26
src/entity/item/weapon.rs

@ -1454,7 +1454,7 @@ pub enum WeaponModifier {
}, },
} }
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[derive(Debug, Clone, Copy, PartialEq, Serialize, Deserialize)]
pub enum WrappingPaper { pub enum WrappingPaper {
White_Pink, // 0 White_Pink, // 0
Yellow_Blue, Yellow_Blue,
@ -1499,8 +1499,7 @@ pub struct Weapon {
pub grind: u8, pub grind: u8,
pub attrs: [Option<WeaponAttribute>; 3], pub attrs: [Option<WeaponAttribute>; 3],
pub tekked: bool, pub tekked: bool,
pub modifiers: Vec<WeaponModifier>,
pub wrapped: Option<WrappingPaper>,
pub wrapping: Option<WrappingPaper>,
} }
@ -1512,8 +1511,7 @@ impl Weapon {
grind: 0, grind: 0,
attrs: [None; 3], attrs: [None; 3],
tekked: true, tekked: true,
modifiers: Vec::new(),
wrapped: None,
wrapping: None,
} }
} }
@ -1568,9 +1566,9 @@ impl Weapon {
result[3] = self.grind; result[3] = self.grind;
result[4] = self.special.map(|s| s.value()).unwrap_or(0); result[4] = self.special.map(|s| s.value()).unwrap_or(0);
if self.wrapped.is_some() {
if self.wrapping.is_some() {
result[4] += 0x40; result[4] += 0x40;
result[5] = self.wrapped.unwrap().value();
result[5] = self.wrapping.unwrap().value();
}; };
if self.tekked == false { if self.tekked == false {
@ -1590,16 +1588,21 @@ impl Weapon {
if w.is_ok() { if w.is_ok() {
let mut s = None; let mut s = None;
let mut t = true; let mut t = true;
let mut p = None; // wrapping paper
let g = data[3]; let g = data[3];
if data[4] >= 0x81 && data[4] <= 0xA8 {
if data[4] & 0x80 == 0x80 {
s = WeaponSpecial::from(data[4] - 0x80); s = WeaponSpecial::from(data[4] - 0x80);
t = false; t = false;
} }
else if data[4] >= 0x01 && data[4] <= 0x28 {
s = WeaponSpecial::from(data[4]);
t = true;
if data[4] & 0x40 == 0x40 {
p = WrappingPaper::from(data[5]);
} }
// else if data[4] >= 0x01 && data[4] <= 0x28 {
// s = WeaponSpecial::from(data[4]);
// t = true;
// }
// else { // else {
// return Err(ItemParseError::InvalidSpecial) // return Err(ItemParseError::InvalidSpecial)
// } // }
@ -1632,6 +1635,7 @@ impl Weapon {
a[2], a[2],
], ],
tekked: t, tekked: t,
wrapping: p,
}) })
} }
else { else {

1
src/login/character.rs

@ -220,6 +220,7 @@ async fn new_character<EG: EntityGateway>(entity_gateway: &mut EG, user: &UserAc
special: None, special: None,
attrs: [None; 3], attrs: [None; 3],
tekked: true, tekked: true,
wrapping: None,
}), }),
location: ItemLocation::Inventory { location: ItemLocation::Inventory {
character_id: character.id, character_id: character.id,

5
src/ship/drops/generic_weapon.rs

@ -503,6 +503,7 @@ impl GenericWeaponTable {
grind: weapon_grind as u8, grind: weapon_grind as u8,
attrs: weapon_attributes, attrs: weapon_attributes,
tekked: weapon_special.is_none(), tekked: weapon_special.is_none(),
wrapping: None,
})) }))
} }
} }
@ -524,6 +525,7 @@ mod test {
grind: 0, grind: 0,
attrs: [None, None, None], attrs: [None, None, None],
tekked: true, tekked: true,
wrapping: None,
}))); })));
let gwt = GenericWeaponTable::new(Episode::One, Difficulty::Hard, SectionID::Skyly); let gwt = GenericWeaponTable::new(Episode::One, Difficulty::Hard, SectionID::Skyly);
@ -533,6 +535,7 @@ mod test {
grind: 2, grind: 2,
attrs: [None, None, None], attrs: [None, None, None],
tekked: true, tekked: true,
wrapping: None,
}))); })));
let gwt = GenericWeaponTable::new(Episode::One, Difficulty::VeryHard, SectionID::Skyly); let gwt = GenericWeaponTable::new(Episode::One, Difficulty::VeryHard, SectionID::Skyly);
@ -542,6 +545,7 @@ mod test {
grind: 0, grind: 0,
attrs: [None, None, None], attrs: [None, None, None],
tekked: false, tekked: false,
wrapping: None,
}))); })));
let gwt = GenericWeaponTable::new(Episode::One, Difficulty::Ultimate, SectionID::Skyly); let gwt = GenericWeaponTable::new(Episode::One, Difficulty::Ultimate, SectionID::Skyly);
@ -551,6 +555,7 @@ mod test {
grind: 0, grind: 0,
attrs: [Some(WeaponAttribute {attr: Attribute::ABeast, value: 30}), Some(WeaponAttribute {attr: Attribute::Dark, value: 30}), None], attrs: [Some(WeaponAttribute {attr: Attribute::ABeast, value: 30}), Some(WeaponAttribute {attr: Attribute::Dark, value: 30}), None],
tekked: true, tekked: true,
wrapping: None,
}))); })));
} }
} }

1
src/ship/drops/rare_drop_table.rs

@ -104,6 +104,7 @@ impl RareDropTable {
grind: 0, grind: 0,
attrs: self.attribute_table.generate_rare_attributes(map_area, rng), attrs: self.attribute_table.generate_rare_attributes(map_area, rng),
tekked: false, tekked: false,
wrapping: None,
}) })
}, },

1
src/ship/shops/weapon.rs

@ -142,6 +142,7 @@ impl ShopItem for WeaponShopItem {
grind: self.grind as u8, grind: self.grind as u8,
attrs: [self.attributes[0], self.attributes[1], None], attrs: [self.attributes[0], self.attributes[1], None],
tekked: true, tekked: true,
wrapping: None,
} }
) )
} }

Loading…
Cancel
Save