-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtob.proto
More file actions
158 lines (135 loc) · 3.07 KB
/
tob.proto
File metadata and controls
158 lines (135 loc) · 3.07 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
syntax = "proto3";
package tob;
message Empty {}
enum EventTopic {
SERVER_EVENT = 0;
PLAYER_EVENT = 1;
MONSTER_EVENT = 2;
}
enum ServerEventType {
SERVER_CHANGE = 0;
SERVER_YIELD = 1;
}
message ServerChangeEvent {
string previous = 1; // previous server id
string current = 2; // current server id
}
message ServerEvent {
string id = 1;
ServerEventType type = 2;
}
enum PlayerEventType {
PLAYER_ENTER = 0;
PLAYER_EXIT = 1;
PLAYER_MOVE = 2; // Indicate the player is moving
PLAYER_CAST = 3;
PLAYER_DAMAGED = 4;
PLAYER_DIE = 5;
PLAYER_JUMP = 6;
PLAYER_CROUCH = 7;
PLAYER_POSITION = 8; // Update the player position
PLAYER_EQUIPPED = 9;
PLAYER_ANIMATION = 10;
}
message Vector {
float x = 1;
float y = 2;
float z = 3;
}
message Quad {
float a = 1;
float b = 2;
float c = 3;
float d = 4;
}
message PlayerMoveEvent {
Vector target = 1;
Quad direction = 2;
}
message PlayerCastEvent {
string id = 1;
string targetId = 2;
Vector targetPosition = 3;
}
enum Gender {
MALE = 0;
FEMALE = 1;
}
message PlayerAppearance {
string name = 1;
Gender gender = 2;
int32 hairColor = 3;
}
message PlayerEquiped {
string weapon = 1;
string head = 2;
string chest = 3;
string legs = 4;
string shoes = 5;
string shield = 6;
}
message PlayerAnimationEvent {
repeated int32 stateHash = 1;
repeated float normalizedTime = 2;
repeated int32 intParams = 3;
repeated float floatParams = 4;
repeated bool boolParams = 5;
}
message PlayerEvent {
string id = 1;
PlayerEventType type = 2;
PlayerMoveEvent move = 3;
Vector position = 4;
PlayerCastEvent cast = 5;
float damage = 6;
PlayerAppearance appearance = 7;
PlayerEquiped equiped = 8;
PlayerAnimationEvent animation = 9;
}
enum MonsterEventType {
MONSTER_SPAWN = 0;
MONSTER_MOVE = 1;
MONSTER_ATTACK = 2;
MONSTER_DIE = 3;
MONSTER_DESTROY = 4;
MONSTER_LOOT = 5;
MONSTER_LOOT_RESULT = 6;
MONSTER_BACK = 7; // Monster goes back to its original position
}
message MonsterSpawnEvent {
string id = 1;
int32 demonType = 2;
int32 demonSkin = 3;
int32 weaponType = 4;
Vector position = 5;
}
message MonsterMoveEvent {
Vector position = 1;
Vector target = 2;
}
message MonsterLootEvent {
string playerId = 1;
string itemId = 2; // item type id
string monsterId = 3;
}
message MonsterDieEvent {
repeated int32 items = 1;
}
message MonsterEvent {
string id = 1;
MonsterEventType type = 2;
MonsterSpawnEvent spawn = 3;
MonsterLootEvent loot = 4;
MonsterMoveEvent move = 5;
MonsterDieEvent die = 6;
}
message Event {
EventTopic topic = 1;
ServerEvent s = 2;
PlayerEvent p = 3;
MonsterEvent m = 4;
}
service ToB {
rpc Subscribe(Empty) returns (stream Event);
rpc Publish(stream Event) returns (Empty);
}