27 const std::string& teamName)
81 const std::vector<int>& participantIds)
ResourceType
Enumerate the different types of resources in the game.
Owns every client socket and runs the poll() loop.
void send(int connectionId, const std::string &msg)
Queue msg to be sent to a client (flushed during poll()).
void addGui(int connectionId)
void onIncantationStart(int x, int y, int level, const std::vector< int > &participantIds) override
Incantation began on a tile. participantIds = players involved. -> pic.
void onInitialEggSpawned(int eggId, const std::string &teamName, int x, int y) override
An initial team egg placed at game start (custom). -> sse.
void onPlayerAdded(int playerId, int x, int y, Orientation orientation, int level, const std::string &teamName) override
Player spawned (egg hatched or initial connection). -> pnw.
void broadcast(const std::string &msg)
std::vector< int > _guiIds
void onEggLaid(int eggId, int playerId, int x, int y) override
A player laid an egg via Fork. -> enw.
void onEggHatched(int eggId) override
An egg hatched into a connectable slot. -> ebo.
void onGameEnd(const std::string &winningTeam) override
A team won (6 players at max level). -> seg.
void onPlayerEjected(int playerId) override
Player got pushed off its tile by an eject. -> pex.
void onPlayerMoved(int playerId, int nx, int ny, Orientation newOrientation) override
Player changed tile and/or facing. -> ppo.
void onPlayerRemoved(int playerId) override
Player left (death or disconnect). -> pdi.
void onResourceTaken(int playerId, ResourceType resourceType, int tileX, int tileY, Resources resources) override
Player picked a resource up off the tile. -> pgt (+ bct/pin)
void onBroadcast(int playerId, const std::string &message) override
Player shouted a broadcast message. -> pbc.
void onResourceDropped(int playerId, ResourceType resourceType, int tileX, int tileY, Resources resources) override
Player dropped a resource onto the tile. -> pdr (+ bct/pin)
void onEggDied(int eggId) override
An egg was destroyed (e.g. crushed by an eject). -> edi.
void onPlayerLevelUp(int playerId, int newLevel) override
Player reached a new level. -> plv.
void onPlayerInventoryChanged(int playerId, int x, int y, Resources inventory) override
Player's carried resources changed. -> pin.
void onTileChanged(int x, int y, Resources resources) override
A tile's resource contents changed (e.g. respawn). -> bct.
GuiNotifier(ClientManager &clients)
void onIncantationEnd(int x, int y, bool success) override
Incantation finished, success = leveled up or not. -> pie.
void send(int connectionId, const std::string &msg)
void removeGui(int connectionId)
Represents the resources available in the game, including food and various minerals.
std::string pdr(int id, int resourceIndex)
Player drops resource resourceIndex (0..6). Wire: pdr #N i\n
std::string pin(int id, int x, int y, const Resources &r)
Player inventory. Wire: pin #N X Y q q q q q q q\n
std::string seg(const std::string &team)
End of game, team won. Wire: seg NAME\n
std::string pex(int id)
Player expelled (got ejected). Wire: pex #N\n
std::string edi(int eggId)
Egg died. Wire: edi #E\n
std::string ebo(int eggId)
Egg hatched, player connects from it. Wire: ebo #E\n
std::string bct(int x, int y, const Resources &r)
Tile content (resources on it). Wire: bct X Y q q q q q q q\n
std::string sse(int eggId, const std::string &teamName, int x, int y)
std::string pgt(int id, int resourceIndex)
Player takes resource resourceIndex (0..6). Wire: pgt #N i\n
std::string pfk(int id)
Player lays an egg (fork). Wire: pfk #N\n
std::string pie(int x, int y, bool success)
std::string pbc(int id, const std::string &msg)
Player broadcast. Wire: pbc #N MESSAGE\n
std::string ppo(int id, int x, int y, Orientation o)
Player position. Wire: ppo #N X Y O\n
std::string pnw(int id, int x, int y, Orientation o, int level, const std::string &team)
New player connected. Wire: pnw #N X Y O L NAME\n (L = level)
std::string pdi(int id)
Player death. Wire: pdi #N\n
std::string enw(int eggId, int playerId, int x, int y)
Egg laid by a player. Wire: enw #E #N X Y\n (E = egg, N = parent)
std::string plv(int id, int level)
Player level. Wire: plv #N L\n
std::string pic(int x, int y, int level, const std::vector< int > &ids)