-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathEasyFindZoneConnections.h
98 lines (71 loc) · 2.48 KB
/
EasyFindZoneConnections.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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
#pragma once
#include "EasyFind.h"
#pragma warning( push )
#pragma warning( disable:4996 )
#include <yaml-cpp/yaml.h>
#pragma warning( pop )
#include <string>
// Information parsed from YAML
struct ParsedTranslocatorDestination
{
std::string keyword;
EQZoneIndex zoneId = 0; // numeric zone id
int zoneIdentifier = 0;
};
struct ParsedFindableLocation
{
std::string typeString;
LocationType type; // interpreted type
std::optional<glm::vec3> location;
std::string name;
EQZoneIndex zoneId = 0; // numeric zone id
int zoneIdentifier = 0;
int switchId = -1; // switch num, or -1 if not set
std::string switchName; // switch name, or "none"
std::string luaScript;
std::string luaScriptFile;
bool replace = true;
bool remove = false;
std::vector<ParsedTranslocatorDestination> translocatorDestinations;
EQExpansionOwned requiredExpansions = (EQExpansionOwned)0;
int requiredAchievement = 0;
std::string requiredAchievementName;
bool IsZoneConnection() const;
bool CheckRequirements() const; // returns true if requirements are met.
};
using ParsedFindableLocationsMap = std::map<std::string, std::vector<ParsedFindableLocation>, ci_less>;
//----------------------------------------------------------------------------
struct EZZoneData
{
EQZoneIndex zoneId;
// our custom list of findable locations
std::vector<ParsedFindableLocation> findableLocations;
// list of removed connections
std::vector<int> removedConnections;
};
using FindableLocationsMap = std::map<std::string, EZZoneData, ci_less>;
class ZoneConnections
{
public:
ZoneConnections(const std::string& configDirectory);
~ZoneConnections();
const std::string& GetConfigDir() const { return m_easyfindDir; }
void Load(std::string_view customFile = {});
void LoadOverride(std::string_view customFile);
void LoadFindableLocations();
void ReloadFindableLocations(std::string_view customFile = {});
void CreateFindableLocations(FindableLocations& findableLocations, std::string_view shortName);
bool MigrateIniData();
const EZZoneData& GetZoneData(EQZoneIndex zoneId) const;
void Pulse();
private:
std::string m_easyfindDir;
YAML::Node m_zoneConnectionsConfig;
YAML::Node m_zoneConnectionsOverrideConfig;
bool m_transferTypesLoaded = false;
bool m_zoneDataLoaded = false;
// Loaded findable locations
FindableLocationsMap m_findableLocations;
void LoadFindableLocations_Internal(YAML::Node zoneConnectionsConfig);
};
extern ZoneConnections* g_zoneConnections;