aboutsummaryrefslogtreecommitdiff
path: root/NorthstarDedicatedTest/modmanager.h
blob: 3249228375a66e1e5085cea8df7f55c311035041 (plain)
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
#pragma once
#include <string>
#include <vector>

class ModConVar
{
	std::string Name;
	std::string DefaultValue;
	std::string HelpString;
	int Flags;
};

class ModScriptCallback
{
	std::string HookedCodeCallback;

	// called before the codecallback is executed
	std::string BeforeCallback;
	// called after the codecallback has finished executing
	std::string AfterCallback;
};

class ModScript
{
	std::string Path;
	std::string ScriptsRsonSide;

	std::vector<ModScriptCallback*> Callbacks;
};

class Mod
{
public:
	// mod.json stuff:

	// the mod's name
	std::string Name;
	// the mod's description
	std::string Description;
	// the mod's version, should be in semver
	std::string Version;
	// a download link to the mod, for clients that try to join without the mod
	std::string DownloadLink;

	// whether clients need the mod to join servers running this mod
	bool RequiredOnClient = true;

	// custom scripts used by the mod
	std::vector<ModScript*> Scripts;
	// convars created by the mod
	std::vector<ModConVar*> ConVars;

	// other files:

	std::vector<std::string> Vpks;
	//std::vector<ModKeyValues*> KeyValues;
};

class ModManager
{
private:
	std::vector<Mod*> loadedMods;

public:
	ModManager();
	void LoadMods();

	std::vector<Mod*> GetMods();
	std::vector<Mod*> GetClientMods();
	std::vector<std::string> GetModVpks();
	std::vector<std::string> GetModOverridePaths();
};

void InitialiseModManager(HMODULE baseAddress);

extern ModManager* g_ModManager;