nanoMMO 0.97.8
Building an MMO: The Engineering Series
Loading...
Searching...
No Matches
trainer_window.h
Go to the documentation of this file.
1#ifndef NANOMMO_CLIENT_TRAINER_WINDOW_H_
2#define NANOMMO_CLIENT_TRAINER_WINDOW_H_
3
4#include <cstdint>
5#include <optional>
6#include <string>
7#include <utility>
8#include <vector>
9
10#include "client/animator.h"
11#include "content/skills.h"
12#include "protocol/nanommo.pb.h"
13
14namespace nanommo {
15
16/// A window with the skills a trainer teaches, which opens when the player
17/// clicks the trainer.
19 public:
20 explicit TrainerWindow(SkillTable skills) : skills_(std::move(skills)) {}
21
22 void Open(uint32_t npc, std::string name, std::vector<uint32_t> teaches);
23
24 bool open() const { return npc_.has_value(); }
25 void Close() { npc_.reset(); }
26
27 /// Draws the window, while it's open: each skill, with a button to learn
28 /// it, once the player has reached its level. Returns the skill the player
29 /// asks for.
30 std::optional<protocol::Learn> Build(const std::vector<Figure>& figures,
31 const protocol::World& world);
32
33 private:
34 SkillTable skills_;
35 std::optional<uint32_t> npc_;
36 std::string name_;
37 std::vector<uint32_t> teaches_;
38};
39
40} // namespace nanommo
41
42#endif // NANOMMO_CLIENT_TRAINER_WINDOW_H_
std::optional< protocol::Learn > Build(const std::vector< Figure > &figures, const protocol::World &world)
TrainerWindow(SkillTable skills)
void Open(uint32_t npc, std::string name, std::vector< uint32_t > teaches)
Definition chat.cc:9