-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathUOItem.h
217 lines (190 loc) · 9.05 KB
/
UOItem.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
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
#ifndef UOITEM_INCLUDED
#define UOITEM_INCLUDED
/*
UOAI - Item Related Stuff
-- Wim Decelle
*/
#include "Features.h"
#include "Tools.h"
#include "COMBase.h"
#pragma pack(push, 1)
typedef struct _ItemOffsetsStruct
{
//15 first offsets are callibrated from the NewItem-packet handler (0x1A packet)
//unsigned int unknown[4];//don't know (yet) , but these are valid offsets (should be 0x8, 0x10, 0x14 and 0x18) //0 and 0x4 are also valid, but those are the vtbl and a 0xFEEDBEEF members and are not callibrated
unsigned int oX;//0x24 -> (unsigned short *)
unsigned int oY;//0x26 -> (unsigned short *)
unsigned int oZ;//0x28 -> (char *)
unsigned int oType;//0x38 -> (unsigned short *)
unsigned int oMultiType;//0x3A -> (unsigned short *)
unsigned int oTypeIncrement;//0x3C -> (unsigned short *)
unsigned int oStackCount;//0x3E -> (unsigend char *)
unsigned int oColor;//0x40 -> (unsigned short * color)
unsigned int oHighlightColor;//0x42 -> (unsigned short * highlight_color)
unsigned int oDirection;//0x72 -> (unsigned char * direction)
unsigned int oID;//0x80 on < v7 clients, 0x88 on >= v7 clients -> (unsigned int * ID)
unsigned int oMultiContents;//0xA0 or 0xA8 -> (MultiContents *)
unsigned int oFlags;//0xA4 or 0xAC -> (unsigned char *)
unsigned int oContents;//0xC0 or 0xC8 -> Item *
unsigned int oItemGump;//0xC4 or 0xCC -> Gump *
//other offsets are callibrated from specific member function's on the Player-Mobile's class as found in it's vTbl.
unsigned int oContentsNext;//pointer to next item in the same container as this item
unsigned int oContentsPrevious;//pointer to previous item in the same container as this item
unsigned int oContainer;//pointer to container item
unsigned int oFirstLayer;//offset of the first layer, each layer is a pointer to an item on that layer or 0
unsigned int oNotoriety;//(dword *)
unsigned int oNextFollower;//(Item *) [experimental: i'm not sure if these are followers, but this is a list of items|mobiles which is accessed when the player's notoriety changes]
//from LastObjectMacroCallibrations
unsigned int oItemID;//identical to oID
unsigned int oItemNext;//Item * Next in main itemlist
//from statusgumpconstructor
unsigned int oMobileStatus;
unsigned int oMobileStatus2;
} _ItemOffsets;
typedef void (__stdcall * pDummy)(void);
typedef struct ItemVtblStruct
{
void (__stdcall * Destructor)(int bDestroy);
pDummy unknowns1[9];
int (__stdcall * IsMobile)(void);
pDummy unknowns2[8];
short (__stdcall * GetZ)(void);
pDummy unknowns3[5];
int (__stdcall * IsMulti)(void);
void (__stdcall * MoveInContainer)(unsigned short x, unsigned short y, short z);
void (__stdcall * Move)(unsigned short x, unsigned short y, short z);
int (__stdcall * unknown4)(void);
int (__stdcall * IsWorn)(void);//is the item on a mobile's layer?
pDummy unkowns5[15];
} ItemVtbl;
typedef struct
{
ItemVtbl * lpVtbl;
unsigned int * ID;
unsigned short * Type;
Point2D * Position;
char * z;
unsigned short * MultiType;
unsigned short * TypeIncrement;
unsigned char * StackCount;
unsigned short * Color;
unsigned short * HighlightColor;
unsigned char * Direction;
unsigned int * MultiContents;
unsigned char * Flags;
unsigned int * Contents;
unsigned int * Gump;
unsigned int * ContentsNext;
unsigned int * ContentsPrevious;
unsigned int * Container;
unsigned int * Layers;
unsigned int * Notoriety;
unsigned int * NextFollower;
unsigned int * Status;
unsigned int * Status2;
unsigned int self;
} ClientItem;
#pragma pack(pop)
#if 0//no support for custom items at this point, so i don't see a reason to allow construction of items
// {2104F772-4791-4d80-B277-D026BEA08363}
DEFINE_GUID(CLSID_Item,
0x2104f772, 0x4791, 0x4d80, 0xb2, 0x77, 0xd0, 0x26, 0xbe, 0xa0, 0x83, 0x63);
#endif
// {FD02A988-A3E2-4ba2-A4E9-DF2CF90B2748}
DEFINE_GUID(IID_IItem,
0xfd02a988, 0xa3e2, 0x4ba2, 0xa4, 0xe9, 0xdf, 0x2c, 0xf9, 0xb, 0x27, 0x48);
// {6913EDB4-C045-4788-AB1E-D18321BB2132}
DEFINE_GUID(CLSID_Mobile,
0x6913edb4, 0xc045, 0x4788, 0xab, 0x1e, 0xd1, 0x83, 0x21, 0xbb, 0x21, 0x32);
// {4B760F4B-FA70-48a9-BAB2-BEB5E00226E2}
DEFINE_GUID(IID_IMobile,
0x4b760f4b, 0xfa70, 0x48a9, 0xba, 0xb2, 0xbe, 0xb5, 0xe0, 0x2, 0x26, 0xe2);
// {1324EE7E-40FE-4db0-87AA-042D5499657E}
DEFINE_GUID(IID_IItemList,
0x1324ee7e, 0x40fe, 0x4db0, 0x87, 0xaa, 0x4, 0x2d, 0x54, 0x99, 0x65, 0x7e);
// {E38878DE-8A6A-48bc-89E8-307E6980021A}
DEFINE_GUID(IID_IContainer,
0xe38878de, 0x8a6a, 0x48bc, 0x89, 0xe8, 0x30, 0x7e, 0x69, 0x80, 0x2, 0x1a);
typedef struct
{
COMObject header;
unsigned int itemid;
} Item;
typedef struct
{
DEFAULT_DISPATCH;
HRESULT (__stdcall *get_Id)(Item * pThis, int * pID);
HRESULT (__stdcall *put_Id)(Item * pThis, int ID);
HRESULT (__stdcall *get_Type)(Item * pThis, int * pType);
HRESULT (__stdcall *put_Type)(Item * pThis, int Type);
HRESULT (__stdcall *get_TypeIncrement)(Item * pThis, int * pTypeIncrement);
HRESULT (__stdcall *put_TypeIncrement)(Item * pThis, int TypeIncrement);
HRESULT (__stdcall *get_Position)(Item * pThis, Point2D * pPos);
HRESULT (__stdcall *put_Position)(Item * pThis, Point2D pos);
HRESULT (__stdcall *get_z)(Item * pThis, int * pPos);
HRESULT (__stdcall *put_z)(Item * pThis, int pos);
HRESULT (__stdcall *get_StackCount)(Item * pThis, int * pCount);
HRESULT (__stdcall *put_StackCount)(Item * pThis, int count);
HRESULT (__stdcall *get_Color)(Item * pThis, int * pColor);
HRESULT (__stdcall *put_Color)(Item * pThis, int color);
HRESULT (__stdcall *get_HighlightColor)(Item * pThis, int * pHighlightColor);
HRESULT (__stdcall *put_HighlightColor)(Item * pThis, int highlightcolor);
HRESULT (__stdcall *get_Direction)(Item * pThis, int * pDirection);
HRESULT (__stdcall *put_Direction)(Item * pThis, int direction);
HRESULT (__stdcall *get_Flags)(Item * pThis, int * pFlags);
HRESULT (__stdcall *put_Flags)(Item * pThis, int Flags);
HRESULT (__stdcall *get_Name)(Item * pThis, BSTR * pName);
HRESULT (__stdcall *put_Name)(Item * pThis, BSTR strName);
HRESULT (__stdcall *get_Properties)(Item * pThis, BSTR * pProperties);
HRESULT (__stdcall *put_Properties)(Item * pThis, BSTR strProperties);
HRESULT (__stdcall *Click)(Item * pThis);
HRESULT (__stdcall *DoubleClick)(Item * pThis);
HRESULT (__stdcall *Drag)(Item * pThis);
HRESULT (__stdcall *IsMobile)(Item * pThis, VARIANT_BOOL * bIsMobile);
HRESULT (__stdcall *IsContainer)(Item * pThis, VARIANT_BOOL * bIsContainer);
HRESULT (__stdcall *IsMulti)(Item * pThis, VARIANT_BOOL * bIsMulti);
} IItem;
HRESULT __stdcall item_get_Id(Item * pThis, int * pID);
HRESULT __stdcall item_put_Id(Item * pThis, int ID);
HRESULT __stdcall item_get_Type(Item * pThis, int * pType);
HRESULT __stdcall item_put_Type(Item * pThis, int Type);
HRESULT __stdcall item_get_TypeIncrement(Item * pThis, int * pTypeIncrement);
HRESULT __stdcall item_put_TypeIncrement(Item * pThis, int TypeIncrement);
HRESULT __stdcall item_get_Position(Item * pThis, Point2D * pPos);
HRESULT __stdcall item_put_Position(Item * pThis, Point2D pos);
HRESULT __stdcall item_get_z(Item * pThis, int * pPos);
HRESULT __stdcall item_put_z(Item * pThis, int pos);
HRESULT __stdcall item_get_StackCount(Item * pThis, int * pCount);
HRESULT __stdcall item_put_StackCount(Item * pThis, int count);
HRESULT __stdcall item_get_Color(Item * pThis, int * pColor);
HRESULT __stdcall item_put_Color(Item * pThis, int color);
HRESULT __stdcall item_get_HighlightColor(Item * pThis, int * pHighlightColor);
HRESULT __stdcall item_put_HighlightColor(Item * pThis, int highlightcolor);
HRESULT __stdcall item_get_Direction(Item * pThis, int * pDirection);
HRESULT __stdcall item_put_Direction(Item * pThis, int direction);
HRESULT __stdcall item_get_Flags(Item * pThis, int * pFlags);
HRESULT __stdcall item_put_Flags(Item * pThis, int Flags);
HRESULT __stdcall item_get_Name(Item * pThis, BSTR * pName);
HRESULT __stdcall item_put_Name(Item * pThis, BSTR strName);
HRESULT __stdcall item_get_Properties(Item * pThis, BSTR * pProperties);
HRESULT __stdcall item_put_Properties(Item * pThis, BSTR strProperties);
HRESULT __stdcall item_Click(Item * pThis);
HRESULT __stdcall item_DoubleClick(Item * pThis);
HRESULT __stdcall item_Drag(Item * pThis);
HRESULT __stdcall item_return_false(Item * pThis, VARIANT_BOOL * bResult);
HRESULT __stdcall item_return_true(Item * pThis, VARIANT_BOOL * bResult);
Item * GetItemByID(unsigned int ID);
Item * GetItemByOffset(unsigned int offset);
ClientItem * item_get_pointers(unsigned int ID);
typedef struct
{
IItem itemmembers;
HRESULT (__stdcall * IsOpen)(Item * pThis, VARIANT_BOOL * bIsOpen);
HRESULT (__stdcall * Open)(Item * pThis, VARIANT_BOOL * bOpened);
HRESULT (__stdcall * Content)(Item * pThis, void ** pContents);
} IContainer;
HRESULT __stdcall container_IsContainer(Item * pThis, VARIANT_BOOL * bIsContainer);
HRESULT __stdcall container_IsOpen(Item * pThis, VARIANT_BOOL * bIsOpen);
HRESULT __stdcall container_Open(Item * pThis, VARIANT_BOOL * bOpened);
HRESULT __stdcall container_Content(Item * pThis, void ** pContents);
#endif