36 Bot(asio::io_context& io, asio::ssl::context& tls, uint32_t seed,
bool udp,
37 const Content& content, std::optional<Side> side = std::nullopt);
42 void Start(
const asio::ip::tcp::resolver::results_type& server,
43 const std::string& token);
48 const std::optional<protocol::Move>&
move()
const {
return move_; }
53 const std::vector<int64_t>&
newest()
const {
return newest_; }
56 void Greet(
const std::string& token,
const std::string& host,
57 std::error_code error);
60 void ReceiveOverUdp();
61 void Receive(std::string_view bytes);
64 void Send(
const protocol::Input& input);
68 void Write(std::string frame);
70 void WanderIn(std::chrono::milliseconds wait);
74 asio::ip::udp::socket udp_socket_;
75 asio::steady_timer timer_;
76 asio::steady_timer hello_timer_;
77 asio::steady_timer tick_timer_;
82 std::array<char, 65536> buffer_;
83 std::array<char, 2048> datagram_;
85 std::vector<int64_t> newest_;
86 bool udp_worlds_ =
false;
88 std::deque<std::string> outbox_;
90 protocol::Input keys_;
91 bool connected_ =
false;
95 std::optional<Trip> trip_;
98 uint32_t hunting_ = 0;
100 std::optional<protocol::Npc> storyteller_;
102 bool asking_ =
false;
104 std::vector<uint32_t> skills_;
111 bool can_respawn_ =
false;
113 bool stepping_out_ =
false;
115 bool asked_in_ =
false;
116 protocol::Inventory bag_;
118 std::chrono::steady_clock::time_point drank_;
122 protocol::Quests quests_;
124 std::optional<Errand> errand_;
125 std::optional<protocol::Move> move_;
128 std::optional<Side> side_;
129 protocol::Guild guild_;
130 std::size_t recruit_ = 0;
133 std::optional<std::chrono::steady_clock::time_point> joined_;
134 bool charged_ =
false;
138 uint32_t faction_ = 0;
Bot(asio::io_context &io, asio::ssl::context &tls, uint32_t seed, bool udp, const Content &content, std::optional< Side > side=std::nullopt)