- update: proto files to move common stuff into common proto files

- update: made changes for new proto paths
- add: skills to character table
- add: load and send skills to client from db
- add: chat proto
This commit is contained in:
2025-02-27 22:11:17 -05:00
parent 292a298205
commit a9a6c52b00
21 changed files with 141 additions and 30 deletions

View File

@@ -1,5 +1,6 @@
use crate::auth::auth_service_client::AuthServiceClient;
use crate::auth::{Empty, LoginRequest, LoginResponse, LogoutRequest, ValidateSessionRequest, ValidateSessionResponse, ValidateTokenRequest, ValidateTokenResponse};
use crate::auth::{LoginRequest, LoginResponse, LogoutRequest, ValidateSessionRequest, ValidateSessionResponse, ValidateTokenRequest, ValidateTokenResponse};
use crate::common::{Empty};
use tonic::transport::Channel;
#[derive(Clone, Debug)]

View File

@@ -189,10 +189,17 @@ pub(crate) async fn handle_select_char_req(stream: &mut TcpStream, packet: Packe
let looks = character.looks.unwrap();
let position = character.position.unwrap();
let stats = character.stats.unwrap();
let skills = character.skills;
let items = character.items;
let mut equipped_item_list: [EquippedItem; (MAX_VISIBLE_ITEMS as usize)] = core::array::from_fn(|i| EquippedItem::default());
let mut inventory: [srv_inventory_data::Item; (MAX_ITEMS as usize)] = core::array::from_fn(|i| srv_inventory_data::Item::default());
let mut skill_list: [u16; (MAX_SKILL_COUNT as usize)] = core::array::from_fn(|i| {
if i < skills.len() {
return skills[i] as u16;
}
0
});
for item in items {
if item.slot < MAX_VISIBLE_ITEMS as i32 {
let slot = convert_slot(item.slot) as usize;
@@ -265,7 +272,7 @@ pub(crate) async fn handle_select_char_req(stream: &mut TcpStream, packet: Packe
effects: effect_list,
pat_hp: stats.pat_hp as u16,
pat_cooldown_time: stats.pat_cooldown_time as u32,
skills: [0u16; (MAX_SKILL_COUNT as usize)],
skills: skill_list,
hotbar: hotbar_list,
tag: user_id as u32,
name: request.name,

View File

@@ -37,6 +37,9 @@ mod character_client;
mod connection_state;
mod connection_service;
pub mod common {
tonic::include_proto!("common");
}
pub mod auth {
tonic::include_proto!("auth"); // Path matches the package name in auth.proto
}