forked from jewalky/srvmgr
-
Notifications
You must be signed in to change notification settings - Fork 5
/
quests.h
41 lines (31 loc) · 1.52 KB
/
quests.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#pragma once
#include <memory>
#include <string>
#include <unordered_map>
#include "utils.h"
// Settings set by the player.
struct PlayerSettings {
std::string quest_filter;
int quest_mob_count;
std::string player_name; // This is used to reset settings on relogin.
};
// Player settings. Player ID -> settings.
extern std::unordered_map<short, std::unique_ptr<PlayerSettings>> player_settings;
// Initializes `player_settings` by pre-allocating all possible player IDs.
void InitializePlayerSettings();
// Map of "mob type" to normalized mob name. Mob type is: `face << 8 | type_id`.
// This format is used by the "kill N monsters" quests.
extern std::unique_ptr<std::unordered_map<int, std::string>> mob_names;
extern std::unique_ptr<std::unordered_map<int, std::string>> mob_names_raw;
// Normalizes mob name by lowercasing the string and replacing all dashes with underscores.
std::string NormalizeMobName(const char* name);
// Initializes `mob_names`. Defined in `inn.cpp` because it has the necessary structures.
// If `mob_names` are already initialized, does nothing.
void InitializeMobNames();
// Returns the state for "kill N monsters" quests for a given player.
// Returns formatted user-readable strings.
std::vector<std::string> QuestStateNMonsters(void* player);
// Checks player name and the name in the existing player settings. If they are
// different, it means that these settings were created by another player which
// has already left the game, so we reset the settings.
void __stdcall CheckPlayerSettings(T_PLAYER* player);