- 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

@@ -2,9 +2,11 @@ syntax = "proto3";
package auth;
import "common.proto";
service AuthService {
rpc Login(LoginRequest) returns (LoginResponse);
rpc Logout(LogoutRequest) returns (Empty);
rpc Logout(LogoutRequest) returns (common.Empty);
rpc ValidateToken(ValidateTokenRequest) returns (ValidateTokenResponse);
rpc ValidateSession(ValidateSessionRequest) returns (ValidateSessionResponse);
rpc RefreshSession(ValidateSessionRequest) returns (ValidateSessionResponse);
@@ -74,5 +76,3 @@ message ResetPasswordRequest {
message ResetPasswordResponse {
string message = 1;
}
message Empty {}

View File

@@ -73,10 +73,11 @@ message Character {
}
message CharacterFull {
string character_id = 1; // Unique ID for the character
string name = 2; // Name of the character
Location position = 3; // Character's position
Looks looks = 4; // Character's Looks
Stats stats = 5; // Character's stats
repeated Item items = 6; // Character inventory
string character_id = 1; // Unique ID for the character
string name = 2; // Name of the character
Location position = 3; // Character's position
Looks looks = 4; // Character's Looks
Stats stats = 5; // Character's stats
repeated int32 skills = 6; // Character's skills
repeated Item items = 7; // Character inventory
}

View File

@@ -53,12 +53,11 @@ message Character {
string name = 3;
string inventory = 6;
string stats = 7;
string looks = 8;
string position = 9;
string created_at = 10;
string updated_at = 11;
string deleted_at = 12;
bool is_active = 13;
string skills = 8;
string looks = 9;
string position = 10;
string created_at = 11;
string updated_at = 12;
string deleted_at = 13;
bool is_active = 14;
}
message Empty {}

25
proto/chat.proto Normal file
View File

@@ -0,0 +1,25 @@
syntax = "proto3";
package chat;
import "common.proto";
service ChatService {
rpc SendMessage(ChatMessage) returns (common.Empty);
}
enum MessageType {
MESSAGE_TYPE_UNSPECIFIED = 0;
MESSAGE_TYPE_NORMAL = 1;
MESSAGE_TYPE_SHOUT = 2;
MESSAGE_TYPE_PARTY = 3;
MESSAGE_TYPE_WHISPER = 4;
MESSAGE_TYPE_CLAN = 5;
MESSAGE_TYPE_ALLIED = 6;
}
message ChatMessage {
MessageType type = 1;
string message = 2;
string target = 3;
}

5
proto/common.proto Normal file
View File

@@ -0,0 +1,5 @@
syntax = "proto3";
package common;
message Empty {}

View File

@@ -2,11 +2,13 @@ syntax = "proto3";
package session_service_api;
import "common.proto";
service SessionService {
rpc CreateSession (CreateSessionRequest) returns (SessionResponse);
rpc GetSession (GetSessionRequest) returns (SessionResponse);
rpc RefreshSession (GetSessionRequest) returns (SessionResponse);
rpc DeleteSession (DeleteSessionRequest) returns (Empty);
rpc DeleteSession (DeleteSessionRequest) returns (common.Empty);
}
message CreateSessionRequest {
@@ -34,4 +36,3 @@ message SessionResponse {
string ip_address = 6;
}
message Empty {}

View File

@@ -1,17 +1,67 @@
syntax = "proto3";
package character;
package world;
service CharacterService {
service WorldService {
rpc GetCharacter(CharacterRequest) returns (CharacterResponse);
rpc ChangeMap(ChangeMapRequest) returns (ChangeMapResponse);
rpc MoveCharacter(CharacterMoveRequest) returns (CharacterMoveResponse);
}
message CharacterRequest {
string token = 1;
string user_id = 2;
string char_id = 3;
string session_id = 4;
}
message CharacterResponse {
int32 count = 1;
}
message CharacterMoveRequest {
string session_id = 1;
uint32 target_id = 2;
float x = 3;
float y = 4;
float z = 5;
}
message CharacterMoveResponse {
int32 id = 1;
int32 target_id = 2;
int32 distance = 3;
float x = 4;
float y = 5;
float z = 6;
}
message ChangeMapRequest {
int32 id = 1;
float x = 2;
float y = 3;
}
message ChangeMapResponse {
int32 id = 1;
int32 map_id = 2;
float x = 3;
float y = 4;
int32 move_mode = 5;
int32 ride_mode = 6;
}
message AttackRequest {
string session_id = 1;
uint32 target_id = 2;
}
message ObjectHpRequest {
string session_id = 1;
uint32 target_id = 2;
}
message ObjectHpResponse {
uint32 target_id = 1;
int32 hp = 2;
}