1#ifndef NANOMMO_CLIENT_LOCAL_CONNECTION_H_
2#define NANOMMO_CLIENT_LOCAL_CONNECTION_H_
14#include "protocol/nanommo.pb.h"
30 void Send(
const protocol::Input& input)
override;
32 const protocol::World&
world()
const override {
return shown_; }
33 const std::deque<protocol::Chat>&
chat()
const override {
return chat_; }
34 int64_t
whole()
const override {
return parts_.whole(); }
35 const std::optional<protocol::Move>&
move()
const override {
return move_; }
36 const protocol::Inventory&
inventory()
const override {
return inventory_; }
37 const protocol::Quests&
quests()
const override {
return quests_; }
38 const protocol::Guild&
guild()
const override {
return guild_; }
39 const protocol::Trade&
trade()
const override {
return trade_; }
40 const protocol::Duel&
duel()
const override {
return duel_; }
41 std::vector<protocol::Event>
TakeEvents()
override;
42 std::optional<protocol::GuildInvite>
TakeInvite()
override;
47 void Notify(
const std::string& text,
48 protocol::Channel channel = protocol::CHANNEL_WORLD);
50 void Notify(
const protocol::Message& message,
51 protocol::Channel channel = protocol::CHANNEL_WORLD);
52 void Say(
const std::string& name,
const std::string& text,
53 protocol::Channel channel = protocol::CHANNEL_WORLD);
55 void Add(protocol::Chat line);
57 static constexpr uint32_t kYou = 1;
58 static constexpr uint32_t kSeed = 1;
59 static constexpr int kLand = 0;
61 std::shared_ptr<const Content> content_;
65 std::chrono::steady_clock::time_point next_tick_;
67 bool in_gate_ =
false;
69 protocol::World shown_;
70 std::deque<protocol::Chat> chat_;
71 std::optional<protocol::Move> move_;
72 protocol::Inventory inventory_;
73 protocol::Quests quests_;
74 protocol::Guild guild_;
75 protocol::Trade trade_;
77 std::vector<protocol::Event> events_;
const std::optional< protocol::Move > & move() const override
Where the world's instance told us to go, once it hands its players over.
int64_t whole() const override
const std::deque< protocol::Chat > & chat() const override
The newest lines said in the world, oldest first.
std::optional< protocol::GuildInvite > TakeInvite() override
The guild that asked us to join since the last time, once.
const protocol::Guild & guild() const override
Our guild, with no name for none.
bool connected() const override
void Send(const protocol::Input &input) override
const protocol::Duel & duel() const override
Our duel, the same.
std::vector< protocol::Event > TakeEvents() override
const protocol::Inventory & inventory() const override
What we carry and wear, as the world last sent it.
const protocol::Quests & quests() const override
const protocol::Trade & trade() const override
Our trade, with nobody in it for none.
const protocol::World & world() const override
void Poll() override
Takes in what's arrived, without waiting.
LocalConnection(const Content &content, std::string name)
std::map< Cell, std::vector< uint32_t > > Cells
The ids of what's in each cell.