102 lines
1.9 KiB
Protocol Buffer
102 lines
1.9 KiB
Protocol Buffer
syntax = "proto3";
|
|
package Generic;
|
|
|
|
|
|
|
|
message Error {
|
|
string description = 1;
|
|
enum Code {
|
|
Unknown = 0;
|
|
BadString = 1;
|
|
TooLarge = 2;
|
|
BadUsername = 3;
|
|
UsernameAlreadyTaken = 4;
|
|
InvalidOpcode = 5;
|
|
AuthenticationRequired = 6;
|
|
IllegalOperation = 7;
|
|
OutOfRange = 8;
|
|
NotYourTurn = 9;
|
|
RoomNotAvailable = 10;
|
|
RoomFull = 11;
|
|
}
|
|
Code code = 2;
|
|
}
|
|
|
|
message SimpleAuth {
|
|
string username = 1;
|
|
}
|
|
|
|
message Operation {
|
|
enum Code {
|
|
Disconnect = 0;
|
|
Error = 1;
|
|
OK = 2;
|
|
SimpleAuth = 3;
|
|
_MinAuth = 4;
|
|
RoomInfoSync = 5;
|
|
PlayfieldSync = 6;
|
|
RobotUpdate = 7;
|
|
YourTurn = 8;
|
|
MakeRoom = 9;
|
|
JoinRoom = 10;
|
|
JoinRandomRoom = 11;
|
|
LeaveRoom = 12;
|
|
UserInfoSync = 13;
|
|
}
|
|
Code code = 1;
|
|
}
|
|
|
|
|
|
message Vector2 {
|
|
float x = 1;
|
|
float y = 2;
|
|
}
|
|
|
|
|
|
message Settings {
|
|
optional uint32 robotsPerClient = 1;
|
|
optional float maxDistancePerTurn = 2;
|
|
optional uint32 maxRobotHealth = 3;
|
|
optional uint32 maxRobotDamage = 4;
|
|
optional uint32 protectCooldown = 5;
|
|
optional uint32 healCooldown = 6;
|
|
optional uint32 healPerTurn = 7;
|
|
optional uint32 maxPlayers = 8;
|
|
}
|
|
|
|
|
|
message UserReference {
|
|
uint64 clientId = 2;
|
|
uint64 userId = 3;
|
|
}
|
|
message PublicUserInfo {
|
|
string name = 1;
|
|
UserReference reference = 2;
|
|
}
|
|
message UserInfo {
|
|
PublicUserInfo publicInfo = 1;
|
|
}
|
|
|
|
message RoomInfo {
|
|
Settings settings = 1;
|
|
repeated PublicUserInfo members = 2;
|
|
}
|
|
|
|
message Robot {
|
|
uint32 id = 1;
|
|
uint32 client = 2;
|
|
Vector2 position = 3;
|
|
enum State {
|
|
Idle = 0;
|
|
Attack = 1;
|
|
Protect = 2;
|
|
Heal = 3;
|
|
Dead = 4;
|
|
}
|
|
State state = 4;
|
|
uint32 health = 5;
|
|
}
|
|
|
|
message PlayfieldSync {
|
|
repeated Robot robots = 1;
|
|
}
|