nanoMMO 0.97.8
Building an MMO: The Engineering Series
Loading...
Searching...
No Matches
content.h
Go to the documentation of this file.
1#ifndef NANOMMO_CONTENT_CONTENT_H_
2#define NANOMMO_CONTENT_CONTENT_H_
3
4#include <cstdint>
5#include <map>
6#include <string>
7
8#include "absl/status/statusor.h"
9#include "content/factions.h"
10#include "content/figures.h"
11#include "content/items.h"
12#include "content/monsters.h"
13#include "content/npcs.h"
14#include "content/quests.h"
15#include "content/recipes.h"
16#include "content/rig.h"
17#include "content/skills.h"
18
19namespace nanommo {
20
21/// What the game is made of, which the world servers and the clients both
22/// read from the content folder.
23struct Content {
24 /// By id.
25 std::map<uint32_t, factions::Faction> factions;
26 figures::Figures figures;
30 /// By id.
31 std::map<uint32_t, quests::Quest> quests;
32 /// By id.
33 std::map<uint32_t, recipes::Recipe> recipes;
34 /// The skeleton every person is built on, and how it moves.
35 rig::Rig rig;
37};
38
39/// Reads each file in the folder, or says which file is wrong, and where.
40absl::StatusOr<Content> ReadContent(const std::string& folder);
41
42/// What the whole folder can tell is wrong, and no single file can: a monster
43/// that drops an item the items file doesn't have, a trainer that teaches a
44/// skill the skills file doesn't have, a quest whose giver, monster or prize
45/// isn't in its file, a recipe that takes or makes an item that isn't, or more
46/// of one than go in a slot, a part of a figure or of an item on a joint the
47/// rig doesn't have, or a faction whose herald isn't in the NPCs file.
48absl::Status CheckContent(const Content& content);
49
50/// A fingerprint of what the clients read, so that a client can tell whether
51/// a world has its content. What only the server reads, such as a weapon's
52/// damage, stays out, so that changing it doesn't need a new client.
53uint64_t ClientHash(const Content& content);
54
55} // namespace nanommo
56
57#endif // NANOMMO_CONTENT_CONTENT_H_
Definition chat.cc:9
uint64_t ClientHash(const Content &content)
Definition content.cc:232
absl::Status CheckContent(const Content &content)
Definition content.cc:103
absl::StatusOr< Content > ReadContent(const std::string &folder)
Reads each file in the folder, or says which file is wrong, and where.
Definition content.cc:64
ItemTable items
Definition content.h:27
std::map< uint32_t, factions::Faction > factions
By id.
Definition content.h:25
MonsterTable monsters
Definition content.h:28
SkillTable skills
Definition content.h:36
figures::Figures figures
Definition content.h:26
std::map< uint32_t, quests::Quest > quests
By id.
Definition content.h:31
std::map< uint32_t, recipes::Recipe > recipes
By id.
Definition content.h:33
rig::Rig rig
The skeleton every person is built on, and how it moves.
Definition content.h:35
NpcTable npcs
Definition content.h:29
The items in the items file, by id.
Definition items.h:18
The kinds of monster, by id, and where they spawn.
Definition monsters.h:17
The kinds of NPC, by id, and where each NPC stands.
Definition npcs.h:20