CLASS SUBASEOBJECT unit SUBaseObject interface uses SuBaseProperty SUB

  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
218
219
220
221
222
223
224
225
226
227
228
229
230
//******************************************************************************
// CLASS SUBASEOBJECT
//******************************************************************************
unit SUBaseObject;
interface
uses
SuBaseProperty, SUBaseContextMenu;
Type
PBaseObject = class
private
m_Serial : Cardinal;
m_Properties : PBaseProperty;
m_ContextMenu : PBaseContextMenu;
function SinGetX: Integer;
function SinGetY: Integer;
function SinGetZ: ShortInt;
function SinGetName: String;
function SinGetRawName: String;
function SinGetToolTip: String;
function SinGetAmount: Integer;
function SinGetDirection: Byte;
function SinGetDistance: Integer;
function SinGetExistence: Boolean;
function SinGetLayer: Byte;
function SinGetMovable: Boolean;
function SinGetObjectType: Word;
function SinGetParent: PBaseObject;
function SinGetPrice: Integer;
function SinGetContextMenu : PBaseContextMenu;
function SinGetColor: Word;
public
Constructor Create(Aowner:Cardinal); virtual;
class function CreateObject(AOwner:Cardinal):PBaseObject; virtual;
procedure RequestStats(); virtual;
function Click():Boolean; virtual;
function DoubleClick():Boolean; virtual;
procedure Ignore(); virtual;
procedure Unignore(); virtual;
procedure Update(); virtual;
property Serial : Cardinal read m_Serial;
property X : Integer read SinGetX;
property Y : Integer read SinGetY;
property Z : ShortInt read SinGetZ;
property Name : String read SinGetName;
property RawName : String read SinGetRawName;
property Properties : PBaseProperty read m_Properties;
property Tooltip : String read SinGetToolTip;
property ObjectType : Word read SinGetObjectType;
property Amount : Integer read SinGetAmount;
property Valid : Boolean read SinGetExistence;
property Price : Integer read SinGetPrice;
property Direction : Byte read SinGetDirection;
property Distance : Integer read SinGetDistance;
property Movable : Boolean read SinGetMovable;
property Parent : PBaseObject read SinGetParent;
property Layer : Byte read SinGetLayer;
property ContextMenu: PBaseContextMenu read SinGetContextMenu;
property Color : Word read SinGetColor;
protected
function GetProperties: PBaseProperty; virtual;
function GetName : String; virtual;
function GetRawName : String; virtual;
function GetContextMenu : PBaseContextMenu; virtual;
end;
implementation
uses
SUStealth;
{ PBaseObject }
function PBaseObject.Click: Boolean;
begin
Result := Valid;
if(Result)then Script.ClickOnObject(Serial);//Virtual
end;
constructor PBaseObject.Create(Aowner: Cardinal);
begin
m_Serial := Aowner;
Update;
end;
class function PBaseObject.CreateObject(AOwner: Cardinal): PBaseObject;
begin
Result := PBaseObject.CreateObject(AOwner);
end;
function PBaseObject.DoubleClick: Boolean;
begin
Result := Valid;
if(Result)then Script.UseObject(Serial);//Virtual
end;
function PBaseObject.GetContextMenu: PBaseContextMenu;
begin
Result := PBaseContextMenu.Create(Serial);
end;
function PBaseObject.GetName: String;
begin
Result := TUOObject.GetName(Serial);
end;
function PBaseObject.GetProperties: PBaseProperty;
begin
Result := PBaseProperty.CreateObject(Serial);
end;
function PBaseObject.GetRawName: String;
begin
Result := TUOObject.GetAltName(Serial);
end;
procedure PBaseObject.Ignore;
begin
Script.FindEngine.Ignore(Serial);
end;
procedure PBaseObject.RequestStats;
begin
TUOObject.RequestStats(Serial);
end;
function PBaseObject.SinGetAmount: Integer;
begin
Result := TUOObject.GetQuantity(Serial);
end;
function PBaseObject.SinGetColor: Word;
begin
Result := TUOObject.GetColor(Serial);
end;
function PBaseObject.SinGetContextMenu: PBaseContextMenu;
begin
Result := GetContextMenu;
end;
function PBaseObject.SinGetDirection: Byte;
begin
Result := TUOObject.GetDirection(Serial);
end;
function PBaseObject.SinGetDistance: Integer;
begin
Result := TUOObject.GetDistance(Serial);
end;
function PBaseObject.SinGetExistence: Boolean;
begin
Result := TUOObject.IsObjectExists(Serial);
end;
function PBaseObject.SinGetLayer: Byte;
begin
Result := TUOObject.GetLayer(Serial);
end;
function PBaseObject.SinGetMovable: Boolean;
begin
Result := TUOObject.IsMovable(Serial);
end;
function PBaseObject.SinGetName: String;
begin
Result := GetName;
end;
function PBaseObject.SinGetObjectType: Word;
begin
Result := TUOObject.GetType(Serial);
end;
function PBaseObject.SinGetParent: PBaseObject;
begin
Result := PBaseObject.CreateObject(TUOObject.GetParent(Serial));
end;
function PBaseObject.SinGetPrice: Integer;
begin
Result := TUOObject.GetPrice(Serial);
end;
function PBaseObject.SinGetRawName: String;
begin
Result := GetRawName;
end;
function PBaseObject.SinGetToolTip: String;
begin
Result := TUOObject.GetTooltip(Serial);
end;
function PBaseObject.SinGetX: Integer;
begin
Result := TUOObject.GetX(Serial);
end;
function PBaseObject.SinGetY: Integer;
begin
Result := TUOObject.GetY(Serial);
end;
function PBaseObject.SinGetZ: ShortInt;
begin
Result := TUOObject.GetZ(Serial);
end;
procedure PBaseObject.Unignore;
begin
Script.FindEngine.IgnoreRemove(Serial);
end;
procedure PBaseObject.Update;
begin
m_Properties := GetProperties;
m_ContextMenu := GetContextMenu;
end;
end.