This commit is contained in:
parent
03aa41ef6a
commit
1adf933060
@ -264,6 +264,35 @@ pub struct CharacterMaterials {
|
||||
pub tp: u32,
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
pub enum PlayerTraps {
|
||||
FireTrap,
|
||||
FreezeTrap,
|
||||
SlowTrap,
|
||||
ConfuseTrap,
|
||||
}
|
||||
|
||||
impl PlayerTraps {
|
||||
fn from(id: u16) -> PlayerTraps {
|
||||
match id {
|
||||
0 => PlayerTraps::FireTrap,
|
||||
1 => PlayerTraps::FreezeTrap,
|
||||
2 => PlayerTraps::SlowTrap,
|
||||
3 => PlayerTraps::ConfuseTrap,
|
||||
_ => panic!(),
|
||||
}
|
||||
}
|
||||
|
||||
fn into(self) -> u16 {
|
||||
match self {
|
||||
PlayerTraps::FireTrap => 0,
|
||||
PlayerTraps::FreezeTrap => 1,
|
||||
PlayerTraps::SlowTrap => 2,
|
||||
PlayerTraps::ConfuseTrap => 3,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
|
||||
pub struct CharacterEntityId(pub u32);
|
||||
|
||||
|
@ -8,6 +8,7 @@ use crate::ship::ship::{SendShipPacket, ShipError, Rooms, Clients, ItemDropLocat
|
||||
use crate::ship::location::{ClientLocation, ClientLocationError};
|
||||
use crate::ship::items::{ItemManager, ClientItemId, InventoryItem};
|
||||
use crate::ship::packet::builder;
|
||||
use crate::entity::character::{PlayerTraps};
|
||||
|
||||
pub async fn request_exp<EG: EntityGateway>(id: ClientId,
|
||||
request_exp: &RequestExp,
|
||||
@ -364,3 +365,28 @@ where
|
||||
item_manager.player_sorts_items(entity_gateway, &client.character, pkt.item_ids).await?;
|
||||
Ok(Box::new(None.into_iter())) // Do clients care about the order of other clients items?
|
||||
}
|
||||
|
||||
/*
|
||||
// 0 - dt
|
||||
// 1 - ft
|
||||
// 3 - ct
|
||||
// TODO: 2 - st? (requires bmode?)
|
||||
// TODO: do we need to do anything with this packet other than log it and fwd it?
|
||||
// TODO: do we need to track trap counts in EG?
|
||||
|
||||
pub fn player_trap_set(id: ClientId,
|
||||
pkt: &PlayerTrapSet,
|
||||
clients: &Clients)
|
||||
-> Result<Box<dyn Iterator<Item = (ClientId, SendShipPacket)> + Send>, anyhow::Error>
|
||||
{
|
||||
let client = clients.get(&id).ok_or(ShipError::ClientNotFound(id))?;
|
||||
match PlayerTraps::from(pkt.trap_type) {
|
||||
PlayerTraps::FireTrap => {},
|
||||
PlayerTraps::FreezeTrap => {},
|
||||
PlayerTraps::SlowTrap => {},
|
||||
PlayerTraps::ConfuseTrap {},
|
||||
_ => {}, // uhoh
|
||||
}
|
||||
|
||||
}
|
||||
*/
|
Loading…
x
Reference in New Issue
Block a user