Updated Common Item data proto
This commit is contained in:
@@ -304,10 +304,10 @@ pub(crate) async fn handle_select_char_req(
|
|||||||
// Build the character inventory list
|
// Build the character inventory list
|
||||||
for item in items {
|
for item in items {
|
||||||
if item.slot < MAX_VISIBLE_ITEMS as i32 {
|
if item.slot < MAX_VISIBLE_ITEMS as i32 {
|
||||||
let slot = convert_type_to_body_part(item.item_type) as isize - 2;
|
let slot = convert_type_to_body_part(item.header.unwrap().r#type) as isize - 2;
|
||||||
if slot >= 0 {
|
if slot >= 0 {
|
||||||
equipped_item_list[slot as usize] = EquippedItem {
|
equipped_item_list[slot as usize] = EquippedItem {
|
||||||
id: item.item_id as u16,
|
id: item.header.unwrap().id as u16,
|
||||||
gem_opt: item.gem_option as u16,
|
gem_opt: item.gem_option as u16,
|
||||||
socket: item.socket as i8,
|
socket: item.socket as i8,
|
||||||
grade: item.grade as u8,
|
grade: item.grade as u8,
|
||||||
@@ -317,9 +317,9 @@ pub(crate) async fn handle_select_char_req(
|
|||||||
|
|
||||||
inventory[item.slot as usize] = srv_inventory_data::Item {
|
inventory[item.slot as usize] = srv_inventory_data::Item {
|
||||||
header: srv_inventory_data::Header {
|
header: srv_inventory_data::Header {
|
||||||
type_: item.item_type as u8,
|
type_: item.header.unwrap().r#type as u8,
|
||||||
id: item.item_id as u16,
|
id: item.header.unwrap().id as u16,
|
||||||
is_created: item.is_created as u8,
|
is_created: item.header.unwrap().is_created as u8,
|
||||||
},
|
},
|
||||||
data: srv_inventory_data::Data {
|
data: srv_inventory_data::Data {
|
||||||
gem_opt: item.gem_option as u16,
|
gem_opt: item.gem_option as u16,
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ use crate::packet::Packet;
|
|||||||
use crate::packet_type::PacketType;
|
use crate::packet_type::PacketType;
|
||||||
use std::error::Error;
|
use std::error::Error;
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
|
use std::time::Instant;
|
||||||
use tokio::io::{AsyncReadExt, ReadHalf};
|
use tokio::io::{AsyncReadExt, ReadHalf};
|
||||||
use tokio::net::TcpStream;
|
use tokio::net::TcpStream;
|
||||||
use tokio::sync::Mutex;
|
use tokio::sync::Mutex;
|
||||||
@@ -42,8 +43,8 @@ impl PacketRouter {
|
|||||||
|
|
||||||
PACKETS_RECEIVED.inc();
|
PACKETS_RECEIVED.inc();
|
||||||
|
|
||||||
let timer = PACKET_PROCESSING_TIME.start_timer();
|
|
||||||
// Process the packet
|
// Process the packet
|
||||||
|
let start = Instant::now();
|
||||||
match Packet::from_raw(&buffer[..packet_size]) {
|
match Packet::from_raw(&buffer[..packet_size]) {
|
||||||
Ok(packet) => {
|
Ok(packet) => {
|
||||||
debug!("Parsed Packet: {:?}", packet);
|
debug!("Parsed Packet: {:?}", packet);
|
||||||
@@ -51,7 +52,8 @@ impl PacketRouter {
|
|||||||
}
|
}
|
||||||
Err(e) => warn!("Failed to parse packet: {}", e),
|
Err(e) => warn!("Failed to parse packet: {}", e),
|
||||||
}
|
}
|
||||||
timer.stop_and_record();
|
let duration = start.elapsed();
|
||||||
|
PACKET_PROCESSING_TIME.observe(duration.as_secs_f64());
|
||||||
|
|
||||||
pool.release(buffer).await;
|
pool.release(buffer).await;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -41,18 +41,22 @@ message EquippedItem {
|
|||||||
int32 slot = 5;
|
int32 slot = 5;
|
||||||
}
|
}
|
||||||
|
|
||||||
message Item {
|
message ItemHeader {
|
||||||
int32 item_id = 1;
|
int32 type_ = 1;
|
||||||
int32 item_type = 2;
|
int32 id = 2;
|
||||||
int32 is_created = 3;
|
int32 is_created = 3;
|
||||||
int32 gem_option = 4;
|
}
|
||||||
float durability = 5;
|
|
||||||
float life = 6;
|
message Item {
|
||||||
int32 socket = 7;
|
ItemHeader header = 1;
|
||||||
int32 is_appraised = 8;
|
int32 gem_option = 2;
|
||||||
int32 grade = 9;
|
float durability = 3;
|
||||||
int32 count = 10;
|
float life = 4;
|
||||||
int32 slot = 11;
|
int32 socket = 5;
|
||||||
|
int32 is_appraised = 6;
|
||||||
|
int32 grade = 7;
|
||||||
|
int32 count = 8;
|
||||||
|
int32 slot = 9;
|
||||||
}
|
}
|
||||||
|
|
||||||
message Location {
|
message Location {
|
||||||
|
|||||||
Reference in New Issue
Block a user