26 void onLineReceived(
int connectionId,
const std::string& line)
override;
27 void onLineSent(
int connectionId,
const std::string& line)
override;
31 const std::string& teamName)
override;
36 void onBroadcast(
int playerId,
const std::string& message)
override;
41 void onEggLaid(
int eggId,
int playerId,
int x,
int y)
override;
46 const std::vector<int>& participantIds)
override;
49 void onGameEnd(
const std::string& winningTeam)
override;
ResourceType
Enumerate the different types of resources in the game.
Observer hooks for raw socket events (Observer pattern).
Observer hooks for game-state changes (Observer pattern).
Bridges the Observer hooks to the Logger.
void onGameEnd(const std::string &winningTeam) override
A team won (6 players at max level). -> seg.
void onPlayerInventoryChanged(int playerId, int x, int y, Resources inventory) override
Player's carried resources changed. -> pin.
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 onPlayerEjected(int playerId) override
Player got pushed off its tile by an eject. -> pex.
void onLineSent(int connectionId, const std::string &line) override
One line was queued to be sent to the client.
void onEggLaid(int eggId, int playerId, int x, int y) override
A player laid an egg via Fork. -> enw.
void onClientConnected(int connectionId) override
A new client socket was accepted (assigned connectionId).
void onPlayerMoved(int playerId, int nx, int ny, Orientation newOrientation) override
Player changed tile and/or facing. -> ppo.
void onBroadcast(int playerId, const std::string &message) override
Player shouted a broadcast message. -> pbc.
void onClientDisconnected(int connectionId) override
A client socket closed or errored.
void onInitialEggSpawned(int eggId, const std::string &teamName, int x, int y) override
An initial team egg placed at game start (custom). -> sse.
void onIncantationStart(int x, int y, int level, const std::vector< int > &participantIds) override
Incantation began on a tile. participantIds = players involved. -> pic.
void onPlayerRemoved(int playerId) override
Player left (death or disconnect). -> pdi.
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 onTileChanged(int x, int y, Resources resources) override
A tile's resource contents changed (e.g. respawn). -> bct.
void onEggHatched(int eggId) override
An egg hatched into a connectable slot. -> ebo.
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 onIncantationEnd(int x, int y, bool success) override
Incantation finished, success = leveled up or not. -> pie.
void onLineReceived(int connectionId, const std::string &line) override
One complete ' '-terminated line arrived from the client.
Logging facade: formats [time] [LEVEL] [component] message, filters by level, and forwards to a singl...
Represents the resources available in the game, including food and various minerals.