-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathItem.h
131 lines (110 loc) · 3.46 KB
/
Item.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
#pragma once
#include <QObject>
#include <QByteArray>
#include "Helper.h"
#include <QList>
#include <QMetaProperty>
class Item : public QObject
{
Q_OBJECT
QDataStream *m_DataStream;
private:
public:
Item(QDataStream &ItemData, int inventoryId = 0, int x = 0, int y = 0);
~Item() {}
public:
// 基础信息
int m_inventoryId;
int m_x;
int m_y;
QJsonObject m_BaseItemType;
QJsonObject m_Components;
QJsonObject m_Base;
// Stack
QJsonObject m_Stack;
// quint16 m_stackSize;
// SkillGem
QJsonObject m_SkillGem;
// quint32 m_Experience; // 宝石经验
// Sockets
QJsonObject m_Sockets;
// quint8 m_socketNumber; // 插槽数量
// QList<quint8> m_sockets; // 插槽信息
// QList<Item *> m_socketedItems; // 插槽物品数组
// QList<quint8> m_socketLinks; // 插槽链接信息
// Mods
QJsonObject m_Mods;
// quint8 m_level; // 装备等级
// bool m_identified; // 是否鉴定
// quint8 m_frameType; // 装备颜色
// QJsonArray m_implicitMods; // 固定的词缀
// QJsonArray m_explicitMods; // 基础词缀
// QJsonArray m_enchantMods; // 附魔词缀(涂油-花园)
// QJsonArray m_craftedMods; // 手工附魔词缀(工艺台)
// Quality
QJsonObject m_Quality;
// Armour
QJsonObject m_Armour;
quint8 m_armourQuality;
QJsonObject m_ArmourType; // 防具基础属性
// Weapon
QJsonObject m_Weapon;
QJsonObject m_WeaponType; // 武器基础属性
// AttributeRequirements
QJsonObject m_AttributeRequirements;
QJsonObject m_Charges;
QJsonObject m_HeistBlueprint;
QJsonObject m_Map;
QJsonObject m_HeistContract;
QJsonObject m_HeistEquipment;
QJsonObject m_Usable;
QJsonObject m_Flask;
QJsonObject m_LocalStats;
QJsonObject m_Shield;
QJsonObject m_Quest;
QJsonObject toJson()
{
QJsonObject JsonObject;
JsonObject.insert("Components", m_Components);
JsonObject.insert("BaseItemType", m_BaseItemType);
return JsonObject;
}
public:
//解包组件
Q_INVOKABLE QJsonObject *Base();
Q_INVOKABLE QJsonObject *Mods();
Q_INVOKABLE QJsonObject *HeistEquipment() { return &m_HeistEquipment; };
Q_INVOKABLE QJsonObject *Usable() { return &m_Usable; };
Q_INVOKABLE QJsonObject *Flask() { return &m_Flask; };
Q_INVOKABLE QJsonObject *Stack();
Q_INVOKABLE QJsonObject *HeistContract();
Q_INVOKABLE QJsonObject *Map();
Q_INVOKABLE QJsonObject *HeistBlueprint();
Q_INVOKABLE QJsonObject *Quality();
Q_INVOKABLE QJsonObject *LocalStats() { return &m_LocalStats; };
Q_INVOKABLE QJsonObject *Shield() { return &m_Shield; };
Q_INVOKABLE QJsonObject *Armour();
Q_INVOKABLE QJsonObject *Weapon();
Q_INVOKABLE QJsonObject *AttributeRequirements();
Q_INVOKABLE QJsonObject *Charges();
Q_INVOKABLE QJsonObject *Sockets();
Q_INVOKABLE QJsonObject *SkillGem();
Q_INVOKABLE QJsonObject *Quest() { return &m_Quest; }
//
void AlternateQualityTypes();
QJsonObject fs_ItemTypeRegister_Mods();
void HeistJobs();
template <typename T>
T readData()
{
QByteArray data(sizeof(T), 0);
m_DataStream->readRawData(data.data(), sizeof(T));
return *(T *)data.data();
}
QByteArray readData(quint64 size)
{
QByteArray data(size, 0);
m_DataStream->readRawData(data.data(), size);
return data;
}
};