Zappy GUI
C++ graphic client: renderer, camera, network
Loading...
Searching...
No Matches
Event.hpp
Go to the documentation of this file.
1#pragma once
2
3#include <cstdint>
4#include <string>
5#include <variant>
6#include <vector>
7
8#include "Orientation.hpp"
9#include "Resources.hpp"
10
11// See doc for all Events at @file:G-YEP-400_zappy_GUI_protocol.pdf
12
13// msz X Y
14struct MapSize {
15 int width;
16 int height;
17};
18
19// bct X Y q0 q1 q2 q3 q4 q5 q6
21 int x;
22 int y;
24};
25
26// tna N
27struct TeamName {
28 std::string name;
29};
30
31// pnw #n X Y O L N
32struct PlayerNew {
33 int id;
34 int x;
35 int y;
37 int level;
38 std::string team;
39};
40
41// ppo #n X Y O
48
49// plv #n L
51 int id;
52 int level;
53};
54
55// pin #n X Y q0 q1 q2 q3 q4 q5 q6
57 int id;
58 int x;
59 int y;
61};
62
63// pex #n
65 int id;
66};
67
68// pbc #n M
70 int id;
71 std::string message;
72};
73
74// pic X Y L #n #n ...
76 int x;
77 int y;
78 int level;
79 std::vector<int> playerIds;
80};
81
82// pie X Y R
84 int x;
85 int y;
86 bool success;
87};
88
89// pfk #n
90struct PlayerFork {
91 int id;
92};
93
94// pdr #n i
99
100// pgt #n i
105
106// pdi #n
108 int id;
109};
110
111// enw #e #n X Y
112struct EggNew {
113 int eggId;
115 int x;
116 int y;
117};
118
119// ebo #e
120struct EggHatch {
121 int id;
122};
123
124// edi #e
125struct EggDeath {
126 int id;
127};
128
129// sgt T
130struct TimeUnit {
132};
133
134// sst T
137};
138
139// seg N
140struct GameEnd {
141 std::string winningTeam;
142};
143
144// gwt <team> <seconds> <ticks>: authoritative time the winning team took to win,
145// snapshotted server-side at the game-over tick. Sent once, right after seg.
147 std::string team;
149 int64_t ticks;
150};
151
152// smg M
154 std::string message;
155};
156
157// suc
159
160// sbp
162
163// stu x x (this is a custom event, not part of the official protocol, representing the server
164// uptime in seconds, and the number of ticks since the server started)
169
170// sse #e N X Y (this is a custom event, not part of the official protocol, representing an egg
171// spawned by the server)
173 int eggId;
174 std::string team;
175 int x;
176 int y;
177};
178
183using Event =
std::variant< MapSize, TileContent, TeamName, PlayerNew, PlayerPosition, PlayerLevel, PlayerInventory, PlayerExpulsion, PlayerBroadcast, IncantationStart, IncantationEnd, PlayerFork, PlayerResourceDrop, PlayerResourceTake, PlayerDeath, EggNew, EggHatch, EggDeath, TimeUnit, TimeUnitChange, GameEnd, ServerMessage, UnknownCommand, BadParameters, ServerUptime, ServerSpawnedEgg, WinDuration > Event
Represents an event received from the server. Is a variant of all possible events,...
Definition Event.hpp:188
Orientation
int id
Definition Event.hpp:126
int id
Definition Event.hpp:121
int x
Definition Event.hpp:115
int playerId
Definition Event.hpp:114
int y
Definition Event.hpp:116
int eggId
Definition Event.hpp:113
std::string winningTeam
Definition Event.hpp:141
std::vector< int > playerIds
Definition Event.hpp:79
int height
Definition Event.hpp:16
int width
Definition Event.hpp:15
std::string message
Definition Event.hpp:71
Resources inventory
Definition Event.hpp:60
int level
Definition Event.hpp:52
int x
Definition Event.hpp:34
int y
Definition Event.hpp:35
int id
Definition Event.hpp:33
Orientation orientation
Definition Event.hpp:36
std::string team
Definition Event.hpp:38
int level
Definition Event.hpp:37
Orientation orientation
Definition Event.hpp:46
std::string message
Definition Event.hpp:154
std::string team
Definition Event.hpp:174
int tickCount
Definition Event.hpp:167
int uptimeSeconds
Definition Event.hpp:166
std::string name
Definition Event.hpp:28
Resources resources
Definition Event.hpp:23
int timeUnit
Definition Event.hpp:131
int64_t ticks
Definition Event.hpp:149
std::string team
Definition Event.hpp:147
int seconds
Definition Event.hpp:148