-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathItemInfo.scar
547 lines (486 loc) · 19.2 KB
/
ItemInfo.scar
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
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
{==============================================================================\
| MSI Group Scripting Include |
| ItemInfo.scar |
|==============================================================================|
| Used to store and load all information on items and objects |
| |
| * function MSI_GetDTMInfo(): TIntegerArray; * by The MSI Team |
| * function MSI_GetItemColor(): Integer; * by The MSI Team |
| * function MSI_LoadDTM(): Integer; * by Coh3n |
| * function MSI_GetItem(): Boolean; * by Coh3n and Naum |
| * procedure MSI_LoadItems; * by Naum |
| * procedure MSI_LoadItemRange; * by Naum edited by RM |
| * procedure MSI_FreeItemEx; * by Naum |
| * procedure MSI_FreeItemArray; * by Naum |
| * procedure MSI_FreeItems; * by Naum |
| * procedure MSI_FreeItemRange; * by Naum edited by RM |
\_____________________________________________________________________________}
{******************************************************************************}
{ function MSI_GetDTMPoints(which: Integer): TPointArray; }
{ By: The MSI Team }
{ Date: 10 June 2010 }
{ Description: Gets the coodinates for the DTM points }
{******************************************************************************}
function MSI_GetDTMPoints(which: Integer): TPointArray;
begin
case which of
HATCHET_BRONZE..HATCHET_RUNE:
Result := [
Point(586, 243), // Main Point
Point(587, 249),
Point(574, 261),
Point(575, 248),
Point(587, 240)
];
LOGS_NORMAL..LOGS_YEW:
Result := [
Point(623, 291), // Main Point
Point(624, 279),
Point(635, 296),
Point(614, 299),
Point(609, 289)
];
else
MSI_Debug('MSI_GetDTMInfo', 'Invalid item constant!', DEBUG_FUNCTIONS);
end;
end;
{******************************************************************************}
{ function MSI_GetItemColor(which: Integer): Integer; }
{ By: The MSI Team }
{ Date: 10 June 2010 }
{ Description: Loads the item's (which) color - used for DTMs }
{******************************************************************************}
function MSI_GetItemColor(which: Integer): Integer;
begin
case which of
HATCHET_BRONZE: Result := 1649466;
HATCHET_IRON: Result := 3618618;
HATCHET_STEEL: Result := 5855581;
HATCHET_MITHRIL: Result := 4599598;
HATCHET_ADAMANT: Result := 3291698;
HATCHET_RUNE: Result := 4932921;
LOGS_NORMAL: Result := 2704989;
LOGS_OAK: Result := 3760771;
LOGS_WILLOW: Result := 1325634;
LOGS_MAPLE: Result := 800853;
LOGS_YEW: Result := 668228;
else
MSI_Debug('MSI_LoadItemColor', 'Invalid item constant!', DEBUG_FUNCTIONS);
end;
end;
{******************************************************************************}
{ function MSI_LoadDTM(which: Integer): Integer; }
{ By: Coh3n and Ejjman1 }
{ Date: 10 June 2010 }
{ Description: Loads the DTM specified by 'which' }
{******************************************************************************}
function MSI_LoadDTM(which: Integer): Integer;
var
dtmMainPoint: TDTMPointDef;
dtmSubPoints: Array [0..4] of TDTMPointDef;
TempTDTM: TDTM;
pts: TPointArray;
clr, i: Integer;
begin
pts := MSI_GetDTMPoints(which);
clr := MSI_GetItemColor(which);
with dtmMainPoint do
begin
x := pts[DTM_POINT_1].x;
y := pts[DTM_POINT_1].y;
AreaSize := 0;
AreaShape := 0;
Color := clr;
Tolerance := DTM_TOLERANCE;
end;
for i := 0 to High(dtmSubPoints) do
with dtmSubPoints[i] do
begin
AreaSize := 0;
AreaShape := 0;
if (i > 0) then
begin
Color := SRL_OUTLINE_BLACK;
Tolerance := 0;
end else begin
Color := clr;
Tolerance := DTM_TOLERANCE;
end;
end;
dtmSubPoints[0].x := pts[DTM_POINT_1].x;
dtmSubPoints[0].y := pts[DTM_POINT_1].y;
dtmSubPoints[1].x := pts[DTM_POINT_2].x;
dtmSubPoints[1].y := pts[DTM_POINT_2].y;
dtmSubPoints[2].x := pts[DTM_POINT_3].x;
dtmSubPoints[2].y := pts[DTM_POINT_3].y;
dtmSubPoints[3].x := pts[DTM_POINT_4].x;
dtmSubPoints[3].y := pts[DTM_POINT_4].y;
dtmSubPoints[4].x := pts[DTM_POINT_5].x;
dtmSubPoints[4].y := pts[DTM_POINT_5].y;
TempTDTM.MainPoint := dtmMainPoint;
TempTDTM.SubPoints := dtmSubPoints;
Result := AddDTM(TempTDTM);
end;
{******************************************************************************}
{ Function MSI_GetItem(ID : Integer) : Boolean; }
{ By: Coh3n and Naum }
{ Date: 10 June 2010 }
{ Description: Gets the TItem record for a certain item defined by 'ID' }
{******************************************************************************}
Function MSI_GetItem(ID : Integer) : Boolean;
Begin
if (IsItemLoaded[ID]) then
Exit
else
IsItemLoaded[ID] := True;
Case ID Of
{
//Pickaxe's
PICKAXE_BRONZE : //Coh3n
with MSI_Item[PICKAXE_BRONZE] do
begin
Name := 'Bronze Pickaxe';
UpText := ['onze pic'];
ItemP := Point(0, 0);
Colors := [3100779, 4024716, 3430775];
Tol := 10;
Stackable := False;
DTM := DTMFromString('78DA6354656160D8CBC8800C4E4C0B67E007D' +
'230514645A09AFDA86A18189820723035624035FB08A85106AAD9' +
'45408D3E50CD01026AD408AB0100EDC50741');
BMP := BitmapFromString(4, 5, 'beNrTlMgO0O/Ptgu' +
'wUYpwUgMiIHdPT9CJaeHRLuqFoYblkSZ9WXa+VopW2pI2ulKOhjJA' +
'hr6yiIm6uDkAMJYQhg==');
end;
PICKAXE_IRON : //Coh3n
with MSI_Item[PICKAXE_IRON] do
begin
Name := 'Iron Pickaxe';
UpText := ['on picka'];
ItemP := Point(0, 0);
Colors := [12500679, 11711162];
Tol := 5;
Stackable := False;
DTM := DTMFromString('78DA63F4676160D8CBC8800C6E5EB8C0C00FA' +
'441A2FF8180D11BA8663FAA1A0606263009136574C03407438D2F' +
'50CD2E026AA2806A0E12501340580D00D5350CFF');
BMP := BitmapFromString(4, 5, 'beNqLjMzPzpo1eXK' +
'AjVKEk1p8dHRxXt7pw4duXriQHB9fXVbWWF0NkvXxAUqlJiZmp6fb' +
'WFkBuWHBQbEAKO0ZXg==');
end;
PICKAXE_STEEL : //Coh3n
with MSI_Item[PICKAXE_STEEL] do
begin
Name := 'Steel Pickaxe';
UpText := ['eel pick'];
ItemP := Point(0, 0);
Tol := 5;
Colors := [13684953, 12764107];
Stackable := False;
DTM := DTMFromString('78DA63CC616260B8C580026E5EB8C0C00FA41' +
'981F83F1030A603D5DC6640034C609211CA638CC53407434D3690' +
'7F9D809A7220FF1E0135B984D5000072E10E48');
BMP := BitmapFromString(4, 5, 'beNozNy/MyenraA+' +
'wUYpwUosIDSktKNi1adPxfftSExOL8/Kqy8omdnf7ennZWFnZ29i4' +
'ODpamZsbGRiYm5paAQDj0hYh');
end;
PICKAXE_MITHRIL : //Coh3n
with MSI_Item[PICKAXE_MITHRIL] do
begin
Name := 'Mithril Pickaxe';
UpText := ['thril pi'];
ItemP := Point(0, 0);
Colors := [12878722, 12024441];
Tol := 5;
Stackable := False;
DTM := DTMFromString('78DA635CCCC2C0B09791011934351F61E007D' +
'23051C6F940350750D530303041E4606AA6609A83A1661150CD2E' +
'026AD601D51C24A006E4E643F8D500006EC40A4D');
BMP := BitmapFromString(4, 5, 'beNrTd3NxiYiN7Qm' +
'wUYpwUtPWcbS1Dais2t7UfMTExMXJKczVLTokJFdN3UpP383IyNvU' +
'NEBWVgfIBarUAwAohhCm');
end;
PICKAXE_ADAMANT :
with MSI_Item[PICKAXE_ADAMANT] do
begin
Name := 'Adamant Pickaxe';
UpText := ['amant pi'];
ItemP := Point(0, 0);
Colors := [10467487, 9809301];
Tol := 5;
Stackable := False;
DTM := DTMFromString('78DA635465616078C8C8800CE6EF98CFC00FA' +
'461A28C8A40358F51D530303041E4606AC430CDC150A30254738F' +
'801A7DA09A2704D4A801D53CC5AF060084FD085B');
BMP := BitmapFromString(4, 5, 'beNqzMvKL9itqKQ6' +
'wUYpwUtM10XUNcJ26dur8HfOtXKydfZ3dg9xDk8M09DVNbEzM7M2A' +
'gnLKctpG2gbmBkYAQW8RIg==');
end;
PICKAXE_RUNE : //Coh3n
with MSI_Item[PICKAXE_RUNE] do
begin
Name := 'Rune Pickaxe';
UpText := ['ne picka'];
ItemP := Point(0, 0);
Colors := [12889986, 12035193];
Tol := 5;
Stackable := False;
DTM := DTMFromString('78DA63F467616078C8C8800C9AD61F61E007D' +
'23051466FA09A27A86A181898207230350E98E660A8F103AAB947' +
'404D1450CD53026A0208AB0100004C0959');
BMP := BitmapFromString(4, 5, 'beNpz9XYKCIut7Qm' +
'wUYpwUjNzdLP2j6hcsr1p/RFjV1/70HinyGT/7HI9CxtrD197nyCg' +
'YiVNHQMre6BKSwBlwhLp')
end;
}
//Hatchet's (Axes)
HATCHET_BRONZE : //Coh3n
with MSI_Item[HATCHET_BRONZE] do
begin
Name := 'Bronze Hatchet';
UpText := ['onze hat'];
ItemP := Point(0, 0);
Colors := [1649466, 1583415, 1715516];
Tol := 3;
Stackable := False;
DTM := MSI_LoadDTM(HATCHET_BRONZE);
BMP := BitmapFromString(5, 5, 'beNoT5LbXl7bRlbL' +
'SlgSiMEEeCAOIzDUlgFwgicw1UhWFsIEoRJBbX1kEzg4BAL4aC8A=' + '');
end;
HATCHET_IRON : //Coh3n
with MSI_Item[HATCHET_IRON] do
begin
Name := 'Iron Hatchet';
UpText := ['on hatch'];
ItemP := Point(0, 0);
Colors := [3618618, 3815996];
Tol := 4;
Stackable := False;
DTM := MSI_LoadDTM(HATCHET_IRON);
BMP := BitmapFromString(5, 5, 'beNoT5Ha0t7O3sbG' +
'xsgKiMEEeCAOIrMzNgVwgicw1MTKCsIEoRJDbyMAAzg4BAEz1D2E=' + '');
end;
HATCHET_STEEL : //Coh3n
with MSI_Item[HATCHET_STEEL] do
begin
Name := 'Steel Hatchet';
UpText := ['eel hatc'];
ItemP := Point(0, 0);
Colors := [5855581, 6118753, 6513511];
Tol := 5;
Stackable := False;
DTM := MSI_LoadDTM(HATCHET_STEEL);
BMP := BitmapFromString(5, 5, 'beNoT5E5PTk6Oj0+' +
'MjY2Pjg4T5AEyINzYyEggNzo8HCIF4YYFB0HYQPEQQe4AHx8gG4iA' +
'7BAAfpcXBA==');
end;
HATCHET_MITHRIL : //Coh3n
with MSI_Item[HATCHET_MITHRIL] do
begin
Name := 'Mithril Hatchet';
UpText := ['thril ha'];
ItemP := Point(0, 0);
Colors := [4599598, 4468013];
Tol := 3;
Stackable := False;
DTM := MSI_LoadDTM(HATCHET_MITHRIL);
BMP := BitmapFromString(5, 5, 'beNoT5DY28TUy8jY' +
'w8NTTdwsT5AEyIGxdXRcgF0gic7W07CFsIAoR5FZTt4KzQwAvWg6p' + '');
end;
HATCHET_ADAMANT : //Coh3n
with MSI_Item[HATCHET_ADAMANT] do
begin
Name := 'Adamant Hatchet';
UpText := ['amant ha'];
ItemP := Point(0, 0);
Colors := [3291698, 3423284];
Tol := 4;
Stackable := False;
DTM := MSI_LoadDTM(HATCHET_ADAMANT);
BMP := BitmapFromString(5, 5, 'beNoT5LZwtDCzNzO' +
'xMQGiMEEeCAOIjKyMgFwgiczVNdGFsIEoRJBb20gbzg4BACsqDo4=' + '');
end;
HATCHET_RUNE : //Coh3n
with MSI_Item[HATCHET_RUNE] do
begin
Name := 'Rune Hatchet';
UpText := ['ne hatch'];
ItemP := Point(0, 0);
Colors := [4932921, 5261885];
Tol := 5;
Stackable := False;
DTM := MSI_LoadDTM(HATCHET_RUNE);
BMP := BitmapFromString(5, 5, 'beNoT5Lb3CbL1CrD' +
'28LV09Q4T5AEyIGxzZ08gF0gic03sXSBsIAoR5DawsoezQwCfzRF3' + '');
end;
LOGS_NORMAL: //Coh3n
with MSI_Item[LOGS_NORMAL] do
begin
Name := 'Normal logs';
UpText := ['Logs'];
ItemP := Point(0, 0);
Colors := [2704989];
Tol := 5;
Stackable := False;
DTM := MSI_LoadDTM(LOGS_NORMAL);
BMP := BitmapFromString(4, 4, 'beNqzlmrOtASiBA+tWDdNCDvU' +
'WgrIhbOTPLUhbBAXAHeGD5I=');
end;
LOGS_OAK: //Coh3n
with MSI_Item[LOGS_OAK] do
begin
Name := 'Oak logs';
UpText := ['logs'];
ItemP := Point(0, 0);
Colors := [4425336];
Tol := 5;
Stackable := False;
DTM := MSI_LoadDTM(LOGS_OAK);
BMP := BitmapFromString(4, 4, 'beNqzlmrOtASiBA+tWDdNCDvU' +
'WgrIhbOTPLUhbBAXAHeGD5I=');
end;
LOGS_WILLOW: //Coh3n
With MSI_Item[LOGS_WILLOW] Do
Begin
Name := 'Willow logs';
UpText := ['llow log'];
ItemP := Point(0, 0);
Colors := [2509137];
Tol := 6;
Stackable := False;
DTM := MSI_LoadDTM(LOGS_WILLOW);
BMP := BitmapFromString(3, 3, 'beNrTE3C0FAEie3NhG1' +
'MhS2MhcwNBQ21+Ez0BEwBASQRu');
End;
LOGS_MAPLE: //Coh3n
With MSI_Item[LOGS_MAPLE] Do
Begin
Name := 'Maple logs';
UpText := ['ple logs'];
ItemP := Point(0, 0);
Colors := [800853];
Tol := 5;
Stackable := False;
DTM := MSI_LoadDTM(LOGS_MAPLE);
BMP := BitmapFromString(4, 1, 'beNoz4Y604g235Aky4wkAA' + 'A8mAmA=');
End;
LOGS_YEW: //Coh3n
With MSI_Item[LOGS_YEW] Do
Begin
Name := 'Yew logs';
UpText := ['ew l'];
ItemP := Point(0, 0);
Colors := [668228];
Tol := 5;
Stackable := False;
DTM := MSI_LoadDTM(LOGS_YEW);
BMP := BitmapFromString(4, 1, 'beNqz4PY2ByE/C24/AA4sAj0' + '=');
End;
End;
Result := (Length(MSI_Item[ID].Name) > 0);
End;
{******************************************************************************}
{ Procedure MSI_LoadItems(IDs : TIntegerArray); }
{ By: Naum }
{ Date: 10 June 2010 }
{ Description: Gets the TItem records for all items in the array }
{******************************************************************************}
Procedure MSI_LoadItems(IDs : TIntegerArray);
Var I : Integer;
Begin
For I := 0 To High(IDs) Do
MSI_GetItem(IDs[I]);
End;
{******************************************************************************}
{ Procedure MSI_LoadItemRange(StartID, EndID : Integer); }
{ By: Naum edited by RM }
{ Date: 10 June 2010 }
{ Description: Gets the TItem records for all items in the range }
{******************************************************************************}
Procedure MSI_LoadItemRange(StartID, EndID : Integer);
Var I : Integer;
Begin
If (StartID > EndID) Then
Begin
MSI_Debug('MSI_LoadTItemRange', 'StartID is greater than EndID!', Debug_FORCE);
I := EndID;
EndID := StartID;
StartID := I;
I := 0;
End;
For I := StartID To EndID Do
MSI_GetItem(I);
End;
{******************************************************************************}
{ Procedure MSI_FreeItemEx(Which : Integer); }
{ By: Naum }
{ Date: 10 June 2010 }
{ Description: Frees the TItem record for the item 'which' }
{******************************************************************************}
Procedure MSI_FreeItemEx(Which : Integer);
Begin
if (not IsItemLoaded[which]) then
Exit;
Try
FreeBitmap(MSI_Item[Which].BMP);
FreeDTM(MSI_Item[Which].DTM);
IsItemLoaded[which] := False;
With MSI_Item[Which] Do
Begin
Name := '';
UpText := [''];
ItemP := Point(0, 0);
Colors := [0];
DTM := -1;
BMP := -1;
End;
Except End;
End;
{******************************************************************************}
{ Procedure MSI_FreeItemArray(TIArray : TIntegerArray); }
{ By: Naum }
{ Date: 10 June 2010 }
{ Description: Frees the TItem records for all items in the array }
{******************************************************************************}
Procedure MSI_FreeItemArray(TIArray : TIntegerArray);
var
I, Lo, Hi: Integer;
begin
Lo := Low(TIArray);
Hi := High(TIArray);
for I := Lo to Hi do
MSI_FreeItemEx(I);
end;
{******************************************************************************}
{ Procedure MSI_FreeItems; }
{ By: Naum }
{ Date: 10 June 2010 }
{ Description: Frees all loaded Items }
{******************************************************************************}
Procedure MSI_FreeItems;
var i : Integer;
begin
for i := 0 to (MSI_ITEM_COUNT - 1) do
MSI_FreeItemEx(i);
end;
{******************************************************************************}
{ Procedure MSI_FreeItemRange(StartID, EndID: Integer); }
{ By: Naum edited by RM }
{ Date: 10 June 2010 }
{ Description: Frees the TItem records for all items in the range }
{******************************************************************************}
Procedure MSI_FreeItemRange(StartID, EndID: Integer);
Var
I : Integer;
Begin
If (StartID > EndID) Then
Begin
MSI_Debug('MSI_FreeTItemRange', 'StartID is greater than EndID!', Debug_FORCE);
I := EndID;
EndID := StartID;
StartID := I;
I := 0;
End;
For I := StartID To EndID Do
MSI_FreeItemEx(I);
End;