Updated Common Item data proto

This commit is contained in:
2025-06-10 14:24:56 -04:00
parent 6f18b53913
commit 87b233d366
3 changed files with 24 additions and 18 deletions

View File

@@ -304,10 +304,10 @@ pub(crate) async fn handle_select_char_req(
// Build the character inventory list
for item in items {
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 {
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,
socket: item.socket as i8,
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 {
header: srv_inventory_data::Header {
type_: item.item_type as u8,
id: item.item_id as u16,
is_created: item.is_created as u8,
type_: item.header.unwrap().r#type as u8,
id: item.header.unwrap().id as u16,
is_created: item.header.unwrap().is_created as u8,
},
data: srv_inventory_data::Data {
gem_opt: item.gem_option as u16,

View File

@@ -8,6 +8,7 @@ use crate::packet::Packet;
use crate::packet_type::PacketType;
use std::error::Error;
use std::sync::Arc;
use std::time::Instant;
use tokio::io::{AsyncReadExt, ReadHalf};
use tokio::net::TcpStream;
use tokio::sync::Mutex;
@@ -42,8 +43,8 @@ impl PacketRouter {
PACKETS_RECEIVED.inc();
let timer = PACKET_PROCESSING_TIME.start_timer();
// Process the packet
let start = Instant::now();
match Packet::from_raw(&buffer[..packet_size]) {
Ok(packet) => {
debug!("Parsed Packet: {:?}", packet);
@@ -51,7 +52,8 @@ impl PacketRouter {
}
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;
}

View File

@@ -41,18 +41,22 @@ message EquippedItem {
int32 slot = 5;
}
message Item {
int32 item_id = 1;
int32 item_type = 2;
message ItemHeader {
int32 type_ = 1;
int32 id = 2;
int32 is_created = 3;
int32 gem_option = 4;
float durability = 5;
float life = 6;
int32 socket = 7;
int32 is_appraised = 8;
int32 grade = 9;
int32 count = 10;
int32 slot = 11;
}
message Item {
ItemHeader header = 1;
int32 gem_option = 2;
float durability = 3;
float life = 4;
int32 socket = 5;
int32 is_appraised = 6;
int32 grade = 7;
int32 count = 8;
int32 slot = 9;
}
message Location {