forked from kenygia/MooseEdit
-
Notifications
You must be signed in to change notification settings - Fork 0
/
GamePakData.h
131 lines (121 loc) · 4.56 KB
/
GamePakData.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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
#ifndef GAMEPAKDATA_H
#define GAMEPAKDATA_H
#include <string>
#include "TextureAtlas.h"
#include <vector>
#include "LsbObject.h"
#include "GenStatsReader.h"
#include <QImage>
#include <map>
#include <queue>
#include "LsbReader.h"
#include "PakReader.h"
struct GameDataQueueObject {
std::wstring pakFile;
std::string toExtract;
std::wstring extractDir;
int processingType;
};
struct ItemTemplateData {
std::string templateId;
LsbObject *gameObject;
bool isRootTemplate;
};
class ExtractQueueCallback {
public:
virtual void onExtractBegin(std::queue<GameDataQueueObject>& extractQueue) = 0;
virtual void onExtractUpdate(std::queue<GameDataQueueObject>& extractQueue) = 0;
virtual void onExtractEnd() = 0;
};
typedef std::map<std::string, std::vector<ItemTemplateData> > StatTemplateMap;
class GamePakData
{
ExtractQueueCallback *extractQueueCallback = 0;
TextureAtlas iconAtlas;
TextureAtlas abilityAtlas;
TextureAtlas portraitAtlas;
std::vector<LsbObject *> stats;
std::map<std::string, LsbObject *> rootTemplateMap;
std::map<std::string, LsbObject *> modTemplateMap;
std::map<std::string, std::vector<std::string > > rootTemplateMods;
std::vector<LsbObject *> rootTemplates;
std::vector<LsbObject *> modTemplates;
std::vector<StatsContainer *> itemStats;
std::vector<StatsContainer *> itemLinks;
std::vector<StatsContainer *> skillStats;
std::map<std::string, std::string> nameMappings;
StatTemplateMap statToTemplateMap;
QImage inventoryCellImg;
QImage *inventoryCellPtr = 0;
LsbReader lsbReader;
PakReader pakReader;
GenStatsReader genStatsReader;
std::wstring lastPakPath = L"";
void processExtractQueue(std::queue<GameDataQueueObject>& extractQueue);
void addModLookupsToStatTemplateMap();
void addModsToRootModsList();
void addItemLinksToStatTemplateMap(std::vector<StatsContainer *> &itemLinks);
void addTemplatesToStatTemplateMap(std::vector<LsbObject *> &templatesObjects, bool isRootTemplate);
void addTemplateToStatTemplateMap(LsbObject *gameObject, bool isRootTemplate);
void populateRootTemplateMap(std::vector<LsbObject *>& rootTemplates);
void populateModTemplateMap(std::vector<LsbObject *>& modTemplates);
void parsePakFile(std::wstring &pakPath, const char *pakExtractPath, std::wstring &outputDir, int processingType);
void buildNameMappings();
void addRootTemplates(std::vector<LsbObject *>& rootTemplates) {
for (int i=0; i<rootTemplates.size(); ++i) {
this->rootTemplates.push_back(rootTemplates[i]);
}
}
void addModTemplates(std::vector<LsbObject *>& modTemplates) {
for (int i=0; i<modTemplates.size(); ++i) {
this->modTemplates.push_back(modTemplates[i]);
}
}
void addItemStats(std::vector<StatsContainer *>& itemStats) {
for (int i=0; i<itemStats.size(); ++i) {
this->itemStats.push_back(itemStats[i]);
}
}
void addItemLinks(std::vector<StatsContainer *>& itemLinks) {
for (int i=0; i<itemLinks.size(); ++i) {
this->itemLinks.push_back(itemLinks[i]);
}
}
public:
GamePakData();
~GamePakData();
void load(std::wstring gameDataPath);
void registerExtractQueueCallback(ExtractQueueCallback *extractQueueCallback) {
this->extractQueueCallback = extractQueueCallback;
}
QImage *getInventoryCellImg() {
return inventoryCellPtr;
}
std::vector<LsbObject *> &getStats();
void setStats(const std::vector<LsbObject *> &value);
std::vector<LsbObject *> &getRootTemplates();
void setRootTemplates(const std::vector<LsbObject *> &value);
std::vector<LsbObject *> &getModTemplates();
void setModTemplates(const std::vector<LsbObject *> &value);
std::vector<StatsContainer *> &getItemStats();
void setItemStats(const std::vector<StatsContainer *> &value);
std::vector<StatsContainer *> &getItemLinks() ;
void setItemLinks(const std::vector<StatsContainer *> &value);
std::vector<StatsContainer *> &getSkillStats();
void setSkillStats(const std::vector<StatsContainer *> &value);
std::map<std::string, std::string> &getNameMappings();
void setNameMappings(const std::map<std::string, std::string> &value);
TextureAtlas &getIconAtlas();
void setIconAtlas(const TextureAtlas &value);
TextureAtlas &getPortraitAtlas();
void setPortraitAtlas(const TextureAtlas &value);
TextureAtlas &getAbilityAtlas();
void setAbilityAtlas(const TextureAtlas &value);
std::map<std::string, LsbObject *> &getRootTemplateMap();
void setRootTemplateMap(const std::map<std::string, LsbObject *> &value);
std::map<std::string, LsbObject *> &getModTemplateMap();
void setModTemplateMap(const std::map<std::string, LsbObject *> &value);
StatTemplateMap &getStatToTemplateMap();
void setStatToTemplateMap(const StatTemplateMap &value);
};
#endif // GAMEPAKDATA_H