-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathInventoryHandler.h
80 lines (76 loc) · 2.22 KB
/
InventoryHandler.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
#ifndef INVENTORYHANDLER_H
#define INVENTORYHANDLER_H
#include <QLabel>
#include <QImage>
#include <QWidget>
#include <vector>
#include <QPoint>
#include "LsbObject.h"
#include "ItemGroup.h"
#include "TextureAtlas.h"
#include "LsbReader.h"
#include "ItemLabel.h"
#include "GenStatsReader.h"
class InventoryHandler
{
std::vector<ItemLabel *> itemLabels;
std::vector<LsbObject *>& stats;
std::vector<LsbObject *>& rootTemplates;
std::vector<LsbObject *>& modTemplates;
std::vector<StatsContainer *>& itemStats;
TextureAtlas& iconAtlas;
TextureAtlas& abilityAtlas;
QImage emptySlotImage;
long getItemX(long slotNumber);
long getItemY(long slotNumber);
ItemGroup items;
std::map<std::string, std::string> &nameMappings;
std::map<std::string, LsbObject *> &rootTemplateMap;
std::map<std::string, LsbObject *> &modTemplateMap;
std::vector<short> &randTable;
void buildNameMappings();
long itemsPerRow = 10;
long minSlots = 50;
long maxSlots = 1000000;
long iconSize = 48;
public:
//static const long ICON_SIZE = 48;
void setIconSize(long iconSize) {
this->iconSize = iconSize;
}
long getIconSize() {
return this->iconSize;
}
void setIconsPerRow(long itemsPerRow) {
this->itemsPerRow = itemsPerRow;
}
void setMinSlots(long minSlots) {
this->minSlots = minSlots;
}
long getMinSlots() {
return minSlots;
}
void setMaxSlots(long maxSlots) {
this->maxSlots = maxSlots;
}
long getMaxSlots() {
return maxSlots;
}
long getItemsPerRow() {
return itemsPerRow;
}
ItemGroup *getItems() {
return &items;
}
unsigned long slotAtPoint(const QPoint &pt);
void clearItemLabels() {
this->itemLabels.clear();
}
~InventoryHandler();
InventoryHandler(QImage emptySlotImage, std::vector<LsbObject *>& stats, std::vector<LsbObject *>& rootTemplates,
std::vector<LsbObject *>& modTemplates, TextureAtlas& iconAtlas, TextureAtlas& abilityAtlas, std::vector<StatsContainer *>& itemStats, std::map<std::string, std::string>& nameMappings,
std::map<std::string, LsbObject *> &rootTemplateMap, std::map<std::string, LsbObject *> &modTemplateMap, std::vector<short> &randTable);
void draw(QWidget *parent, QWidget *mainWindow, bool drawBackground);
GameItem *getItemAtPoint(const QPoint& pt);
};
#endif // INVENTORYHANDLER_H