nanoMMO 0.97.8
Building an MMO: The Engineering Series
Loading...
Searching...
No Matches
quests.h
Go to the documentation of this file.
1#ifndef NANOMMO_BOT_QUESTS_H_
2#define NANOMMO_BOT_QUESTS_H_
3
4#include <cstdint>
5#include <optional>
6
7#include "content/content.h"
8#include "protocol/nanommo.pb.h"
9
10namespace nanommo {
11
12/// A trip a bot makes for its quests: to a monster a quest asks for, to hit
13/// it, or to an NPC, to take a quest or turn one in. Or to a herald, to swear
14/// to their faction.
15struct Errand {
16 enum class Kind { kHunt, kTake, kTurnIn, kSwear };
18 float x = 0.0f;
19 float z = 0.0f;
20 /// The monster a hunt goes after, by its id, so that the bot can tell once
21 /// it's dead.
22 uint32_t monster = 0;
23 /// Who to, and which quest, for a quest.
24 protocol::Quest quest;
25 /// The herald to swear at, by the NPC's id, for an oath, or 0 on the way
26 /// to where they stand, before the bot sees them.
27 uint32_t herald = 0;
28};
29
30/// How near a living boss has to be for a bot to join its fight, in metres:
31/// from the middle of its land, the Bone Colossus is.
32inline constexpr float kJoinTheFight = 60.0f;
33
34/// What a bot does next, from what it sees: goes after the nearest boss within
35/// kJoinTheFight, as players flock to one, or else, for its quests, turns in
36/// a quest it's done, if its giver's here, or goes after the nearest monster a
37/// quest it's on asks for, or takes a quest it hasn't done from an NPC here
38/// who gives it. Nothing, if none of them is here.
39std::optional<Errand> NextErrand(const Content& content,
40 const protocol::Quests& quests,
41 const protocol::World& seen, float x, float z);
42
43/// Whether the world shows the monster dead, by its id. One the world doesn't
44/// have isn't, as it may be out of sight.
45bool Dead(const protocol::World& seen, uint32_t monster);
46
47} // namespace nanommo
48
49#endif // NANOMMO_BOT_QUESTS_H_
Definition chat.cc:9
constexpr float kJoinTheFight
Definition quests.h:32
bool Dead(const protocol::World &seen, uint32_t monster)
Definition quests.cc:89
std::optional< Errand > NextErrand(const Content &content, const protocol::Quests &quests, const protocol::World &seen, float x, float z)
Definition quests.cc:30
protocol::Quest quest
Who to, and which quest, for a quest.
Definition quests.h:24
uint32_t herald
Definition quests.h:27
uint32_t monster
Definition quests.h:22