-
Notifications
You must be signed in to change notification settings - Fork 4
/
formatfile.h
116 lines (93 loc) · 2.22 KB
/
formatfile.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
#ifndef FORMATFILE_H
#define FORMATFILE_H
#include <QVector>
#include <QMap>
#include "tibiafile.h"
#define BASE_FORMAT_KEY -1
class PropertyValue
{
public:
PropertyValue( void ) {
size = 0;
name = QString();
tooltip = QString();
};
~PropertyValue( void ) {};
quint8 size;
QString name;
QString tooltip;
};
typedef QVector<PropertyValue> PropertyValueVector;
class FormatProperty
{
public:
FormatProperty( void ) {
header = 0xFF;
base = 0xFF;
name = QString();
tooltip = QString();
};
~FormatProperty( void ) {};
quint8 header;
quint8 base;
QString name;
QString tooltip;
PropertyValueVector propertyValues;
};
typedef QVector<FormatProperty> FormatPropertyVector;
class ItemFormat
{
public:
ItemFormat( void ) {
name = QString();
redirect = 0;
version = 0;
ZDivFactor = true;
valid = false;
};
~ItemFormat( void ) {};
bool isValid( void ) const {
return valid;
};
quint8 getBase( quint8 header );
quint8 getHeader( quint8 base );
FormatProperty getPropertyByBase( quint8 base ) const;
FormatProperty getPropertyByHeader( quint8 header ) const;
QString name;
qint32 version;
qint32 redirect;
bool ZDivFactor;
bool valid;
FormatPropertyVector properties;
};
typedef QMap<qint32, ItemFormat> FormatMap;
class FormatFile : public TibiaFile
{
Q_OBJECT
public:
FormatFile( QObject *parent );
virtual ~FormatFile( void );
virtual bool isLoaded( void ) const {
return _loaded;
};
virtual void unload( void );
virtual bool load( const QString& );
virtual bool save( const QString& ) {
return false;
};
virtual bool idle( const QString&, bool ) {
return false;
};
ItemFormat getFormatByName( const QString& version ) const;
ItemFormat getFormatByClient( qint32 version ) const;
inline FormatMap::const_iterator getFormatsIteratorBegin() const {
return formats.begin();
}
inline FormatMap::const_iterator getFormatsIteratorEnd() const {
return formats.end();
}
private:
FormatMap formats;
bool _loaded;
};
#endif // FORMATFILE_H