oops forgot mags
This commit is contained in:
parent
fc84db5393
commit
e774b9c950
@ -358,9 +358,7 @@ fn main() {
|
|||||||
).await.unwrap();
|
).await.unwrap();
|
||||||
let item13 = entity_gateway.create_item(
|
let item13 = entity_gateway.create_item(
|
||||||
NewItemEntity {
|
NewItemEntity {
|
||||||
item: ItemDetail::Mag(
|
item: item::ItemDetail::Mag(item::mag::Mag::wrapped_baby_mag(5)),
|
||||||
item::mag::Mag::baby_mag(5)
|
|
||||||
),
|
|
||||||
location: ItemLocation::Inventory {
|
location: ItemLocation::Inventory {
|
||||||
character_id: character.id,
|
character_id: character.id,
|
||||||
}
|
}
|
||||||
|
@ -493,6 +493,14 @@ impl EntityGateway for PostgresGateway {
|
|||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async fn add_mag_modifier(&mut self, item_id: &ItemEntityId, modifier: mag::MagModifier) -> Result<(), GatewayError> {
|
||||||
|
sqlx::query("insert into mag_modifier (mag, modifier) values ($1, $2);")
|
||||||
|
.bind(item_id.0)
|
||||||
|
.bind(sqlx::types::Json(modifier))
|
||||||
|
.execute(&self.pool).await?;
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
async fn get_items_by_character(&self, char_id: &CharacterEntityId) -> Result<Vec<ItemEntity>, GatewayError> {
|
async fn get_items_by_character(&self, char_id: &CharacterEntityId) -> Result<Vec<ItemEntity>, GatewayError> {
|
||||||
let q = r#"select * from (
|
let q = r#"select * from (
|
||||||
|
@ -509,7 +509,7 @@ impl MagAttributeOrdering {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone, PartialEq)]
|
#[derive(Debug, Clone, PartialEq, Serialize)]
|
||||||
pub enum MagModifier {
|
pub enum MagModifier {
|
||||||
FeedMag{
|
FeedMag{
|
||||||
food: ItemEntityId,
|
food: ItemEntityId,
|
||||||
@ -568,6 +568,24 @@ impl Mag {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn wrapped_baby_mag(skin: u16) -> Mag {
|
||||||
|
Mag {
|
||||||
|
mag: MagType::Mag,
|
||||||
|
def: 500,
|
||||||
|
pow: 0,
|
||||||
|
dex: 0,
|
||||||
|
mnd: 0,
|
||||||
|
synchro: 20,
|
||||||
|
iq: 0,
|
||||||
|
photon_blast: [None; 3],
|
||||||
|
color: (skin % 18) as u8,
|
||||||
|
//modifiers: Vec::new(),
|
||||||
|
class: CharacterClass::HUmar,
|
||||||
|
id: SectionID::Viridia,
|
||||||
|
wrapping: WrappingPaper::from((skin % 10) as u8),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
pub fn as_bytes(&self) -> [u8; 16] {
|
pub fn as_bytes(&self) -> [u8; 16] {
|
||||||
let mut result = [0; 16];
|
let mut result = [0; 16];
|
||||||
result[0..3].copy_from_slice(&self.mag.value());
|
result[0..3].copy_from_slice(&self.mag.value());
|
||||||
@ -1117,7 +1135,7 @@ impl Mag {
|
|||||||
match modifier {
|
match modifier {
|
||||||
MagModifier::WrapPresent => {self.wrapping = WrappingPaper::from(self.color % 10)}, // prevents mag color from crashing wrapping papers
|
MagModifier::WrapPresent => {self.wrapping = WrappingPaper::from(self.color % 10)}, // prevents mag color from crashing wrapping papers
|
||||||
MagModifier::UnwrapPresent => {self.wrapping = None},
|
MagModifier::UnwrapPresent => {self.wrapping = None},
|
||||||
_ => {}, // TODO: do mags use any other modifiers?
|
_ => {}, // TODO: other modifiers are already handled elsewhere. do they need to be moved here?
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user