jake
5 years ago
7 changed files with 164 additions and 12 deletions
-
7src/entity/item/mod.rs
-
64src/ship/items.rs
-
33src/ship/packet/builder/message.rs
-
1src/ship/packet/builder/mod.rs
-
62src/ship/packet/handler/direct_message.rs
-
2src/ship/packet/handler/message.rs
-
7src/ship/ship.rs
@ -0,0 +1,33 @@ |
|||||
|
use std::collections::HashMap;
|
||||
|
use libpso::packet::ship::*;
|
||||
|
use libpso::packet::messages::*;
|
||||
|
use crate::common::serverstate::ClientId;
|
||||
|
use crate::common::leveltable::CharacterLevelTable;
|
||||
|
use crate::ship::ship::{SendShipPacket, ShipError, ClientState, Clients};
|
||||
|
use crate::ship::character::{CharacterBytesBuilder, FullCharacterBytesBuilder};
|
||||
|
use crate::ship::location::{ClientLocation, LobbyId, AreaClient, ClientLocationError};
|
||||
|
use crate::entity::character::CharacterEntity;
|
||||
|
use crate::ship::items::{ActiveInventory, ActiveItemOnFloor};
|
||||
|
use crate::ship::packet::builder::{player_header, player_info};
|
||||
|
use std::convert::TryInto;
|
||||
|
use libpso::character::character::{Inventory, InventoryItem};
|
||||
|
use libpso::utf8_to_utf16_array;
|
||||
|
|
||||
|
|
||||
|
pub fn item_drop(client: u8, target: u8, item_drop: &ActiveItemOnFloor) -> Result<ItemDrop, ShipError> {
|
||||
|
let item_bytes = item_drop.item.as_client_bytes();
|
||||
|
Ok(ItemDrop {
|
||||
|
client: client,
|
||||
|
target: target,
|
||||
|
area: item_drop.map_area.area_value(),
|
||||
|
variety: 0,
|
||||
|
unknown: 0,
|
||||
|
x: item_drop.x,
|
||||
|
z: item_drop.z,
|
||||
|
y: item_drop.y,
|
||||
|
item_bytes: item_bytes[0..12].try_into()?,
|
||||
|
item_id: item_drop.item.id.0,
|
||||
|
item_bytes2: item_bytes[12..16].try_into()?,
|
||||
|
unknown2: 0,
|
||||
|
})
|
||||
|
}
|
Write
Preview
Loading…
Cancel
Save
Reference in new issue