-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathWalking_Color.scar
679 lines (625 loc) · 25.3 KB
/
Walking_Color.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
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
{==============================================================================\
| MSI Group Scripting Include |
| Walking_Color.scar |
|==============================================================================|
| For all the walking functions that are color based. |
| |
| * procedure MSI_Flag(); * by marpis |
| * procedure MSI_SortColors(); * by Blumblebee |
| * function MSI_FindMMLocation(): Boolean; * by marpis |
| * function MSI_AutoColorMM(): Integer; * by Blumblebee |
| * function MSI_AutoColor(): Integer; * by Coh3n |
| * function MSI_CreateWalkTPA(): TPointArray * by Blumblebee |
| * function MSI_WalkTPAPoint(): Boolean; * by Blumblebee |
| * function MSI_CreateColorBox(): TBox; * by Blumblebee |
| * function MSI_FindColorInBox(): Boolean; * by Blumblebee |
| * function MSI_WC_VEPoints(): TPoint; * by The MSI Team |
| * function MSI_CreateWalkIndex(): TPoint; * by The MSI Team |
| * function MSI_WalkToColorIndex(): Boolean; * by Coh3n |
| * function MSI_CreateWalkFailsafe(): Boolean; * by Blumblebee & NCDS |
| * function MSI_LoadColorPath(): TIntegerArray; * by The MSI Team |
| * function MSI_ColorWalk(): Boolean; * by Coh3n |
\_____________________________________________________________________________}
{******************************************************************************}
{ procedure MSI_Flag; }
{ By: marpis }
{ Date: 10 June 2010 }
{ Description: Flag wait }
{******************************************************************************}
procedure MSI_Flag;
begin
if WaitFunc(@IsMoving, 1, 2500 + random(200)) then
while (IsMoving) do //edited to not use Flag incase it's off the minimap if the player has to walk aroung an obstacle
begin
Wait(RandomRange(50, 100));
MSI_AntiBan(1, 10);
end;
end;
{******************************************************************************}
{ procedure MSI_SortColors(var Colors: tIntegerArray; col: Integer); }
{ By: Blumblebee }
{ Date: 10 June 2010 }
{ Description: Sorts an array of colors }
{******************************************************************************}
procedure MSI_SortColors(var Colors: tIntegerArray; col: Integer);
var
tempB: tIntegerArray;
Tol: ShortInt;
I: Integer;L: LongInt;
begin
tempB := Colors;
SetArrayLength(Colors, 0);
Tol := 0;
while Length(Colors) < (Length(tempB)/2) do
for i := 0 to High(tempB) do
begin
if SimilarColors(tempB[i], col, Tol) then
begin
L := GetArrayLength(Colors);
SetArrayLength(Colors, L+1);
Colors[L] := tempB[i];
end;
if Tol > 10 then Break;
Inc(Tol);
end;
end;
{******************************************************************************}
{ function FindMMLocation(Var X, Y: Integer; Location: TMMLocation): Boolean; }
{ By: marpis }
{ Date: 10 June 2010 }
{ Description: Finds a location in minimap. First tries to find DTM, then }
{ colors, and if still not found it will find it by symbol }
{******************************************************************************}
Function MSI_FindMMLocation(Var X, Y: Integer; Location: TMMLocation): Boolean;
Var
SA, EA, tmp_Ang: Extended;
N, I, II, III, H, HH, Score, Step: Integer;
ATPA: T2DPointArray;
tmp_TPA: TPointArray;
X1, Y1, X2, Y2: Integer;
Begin
If (Not LoggedIn) Then Exit;
X := -1;
Y := -1;
Step := (Location.W * Location.H) / 10;
{ DTM Search }
If (Location.DTM > -1) Then
While (N < 10) Do
Begin
If FindDTMRotated(Location.DTM, X, Y, MMX1, MMY1, MMX2, MMY2, SA, EA, 0.02, tmp_Ang) Then
Begin
Result := True;
Exit;
End;
Inc(N);
SA := SA - (N * 0.02);
EA := EA + (N * 0.02);
End;
{ Color search }
If (Length(Location.Colors) <> 0) Then
Begin
H := High(Location.Colors);
SetLength(ATPA, H + 1);
For I := 0 To H Do
Begin
FindColorsSpiralTolerance(MMCX, MMCY, ATPA[I], Location.Colors[I], MMX1, MMY1, MMX2, MMY2, Location.Tolerances[I]);
FilterPointsPie(ATPA[I], 0.0, 360.0, 0.0, 76.0, MMCX, MMCY);
End;
{ Go through every TPA that contains one color. }
For I := 0 To H Do
Begin
HH := High(ATPA[I]);
{ Go through every 10th point in ATPA[I] to avoid lag. }
For II := 0 To HH Do
Begin
If ((II Mod Step) <> 0) Then
Continue;
Score := 0;
X1 := ATPA[I][II].X - (Location.W / 2);
Y1 := ATPA[I][II].Y - (Location.H / 2);
X2 := ATPA[I][II].X + (Location.W / 2);
Y2 := ATPA[I][II].Y + (Location.H / 2);
{ Go through every TPA again, calculating surrounding color counts. }
For III := 0 To H Do
Begin
tmp_TPA := MSI_ReturnPointsInBox(ATPA[III], IntToBox(X1, Y1, X2, Y2));
If (Length(tmp_TPA) >= Location.Counts[III]) Then
Inc(Score);
End;
{ If there are enough points of all colors, the location has been found. }
If (Score = H) Then
Begin
Result := True;
X := (X1 + X2) shr 1;
Y := (Y1 + Y2) shr 1;
Exit;
End;
End;
End;
End;
{ Symbol Search }
If (Location.Symbol <> '') Then
If FindSymbol(X, Y, Location.Symbol) Then
Begin
Result := True;
Exit;
End;
End;
{******************************************************************************}
{ function MSI_AutoColorMM(const color: Integer): Integer; }
{ By: Blumblebee }
{ Date: 10 June 2010 }
{ Description: Autocolors the color 'color' on the minimap }
{******************************************************************************}
function MSI_AutoColorMM(const color: Integer): Integer;
var
TPA: tPointArray;
List: tIntegerArray;
I: Integer;
begin
for i := 0 to 20 do
begin
FindColorsTolerance(TPA, color, MMx1, MMy1, MMx2, MMy2, 5+i);
if Length(TPA) > 0 then Break;
end;
if Length(TPA) <= 0 then Exit;
List := getColors(TPA);
MSI_SortColors(List, color);
if Length(List) <= 0 then Exit;
result := List[0];
end;
{******************************************************************************}
{ function MSI_AutoColor(constSRL, constMSI: Integer): Integer; }
{ By: Coh3n }
{ Date: 10 June 2010 }
{ Description: Returns the correct color on the minimap. the parameters are }
{ for the different constants pertaining to SRL and MSI. }
{ ex. MSI_AutoColor(srl_VarrockRoadCOlor, COLOR_ROAD_VARROCK); }
{******************************************************************************}
function MSI_AutoColor(constSRL, constMSI: Integer): Integer;
var
acRecord: TAutoColorInfo;
begin
if (not LoadAutoColor(constSRL, acRecord)) then
result := MSI_AutoColorMM(constMSI)
else
result := acRecord.color;
end;
{******************************************************************************}
{ function MSI_CreateWalkTPA( ... ): TPointArray; }
{ By: Blumblebee }
{ Date: 10 June 2010 }
{ Description: Creats a TPA of which can be walked to }
{******************************************************************************}
function MSI_CreateWalkTPA(x, y, color, width, height, tolerance: Integer): TpointArray;
var
TPA: tPointArray;
aTPA: t2DPointArray;
i: Integer;
L, P: Integer;
begin
FindColorsSpiralTolerance(x, y, TPA, color, MMx1, MMy1, MMx2, MMy2, tolerance);
aTPA := TPAtoATPAEx(TPA, width, height);
for i := 0 to High(aTPA) do
begin
if Length(aTPA) > 5 then
begin
l := getarraylength(Result);
SetArrayLength(Result, l+1);
Result[l] := MiddleTpa(aTPA[i]);
end;
end;
if Length(result) = 0 then Exit;
for i := 0 to High(Result) do
if rs_OnMiniMap(result[i].x, result[i].y) then Inc(p);
if p = 0 then SetArrayLength(Result, 0);
end;
{******************************************************************************}
{ function MSI_WalkTPAPoint( ... ): Boolean; }
{ By: Blumblebee }
{ Date: 10 June 2010 }
{ Description: Walks to a point on the minimap }
{******************************************************************************}
function MSI_WalkTPAPoint(TPA: tPointArray; sortP: tPoint; flagDist: shortInt): Boolean;
var
i: Integer;
t: LongInt;
begin
t := getSystemTime;
if Length(TPA) <= 0 then Exit;
SortTPAFrom(TPA, sortP);
for i := 0 to High(TPA) do
begin
if rs_OnMiniMap(TPA[i].x, TPA[i].y) then
begin
Mouse(TPA[i].x, TPA[i].y, random(8), random(8), true);
wait(randomRange(1000, 2000));
while not FlagPresent do
begin
wait(250+randomRange(150, 350));
if getSystemTime-t > randomRange(2500, 3750) then
continue;
end;
FFlag(flagDist);
Result := True;
Exit;
end;
end;
end;
{******************************************************************************}
{ function MSI_CreateColorBox(Color: Integer): TBox; }
{ By: Blumblebee }
{ Date: 10 June 2010 }
{ Description: Returns a box around the colors found }
{******************************************************************************}
function MSI_CreateColorBox(Color: Integer): TBox;
var
TPA: tPointArray;
begin
FindColors(TPA, Color, MMx1, MMy1, MMx2, MMy2);
if Length(TPA) <= 0 then Exit;
Result := GetTPABounds(TPA);
end;
{******************************************************************************}
{ function MSI_FindColorInBox(Color: Integer; Box: TBox): Boolean; }
{ By: Blumblebee }
{ Date: 10 June 2010 }
{ Description: Returns true if the color is found in a box }
{******************************************************************************}
function MSI_FindColorInBox(Color: Integer; Box: TBox): Boolean;
var
TPA: tPointArray;
i: Integer;
begin
FindColorsTolerance(TPA, Color, Box.x1-5, Box.y1-5, Box.x2+5, Box.y2+5, 15);
if Length(TPA) <= 0 then Exit;
SortTPAFrom(TPA, Point(687, 50));
for i := 0 to High(TPA) do
begin
if not rs_OnMiniMap(TPA[i].x, TPA[i].y) then continue;
Mouse(TPA[i].x, TPA[i].y, 5, 5, True);
Wait(750+random(450));
if FlagPresent then
begin
FFlag(10);
Result := True;
Exit;
end;
end;
end;
{******************************************************************************}
{ function MSI_WC_VEPoints(index: integer): TPoint; }
{ By: The MSI Team }
{ Date: 10 June 2010 }
{ Description: Returns a point on the minimap depending on the specified }
{ location by 'index' }
{******************************************************************************}
function MSI_WC_VEPoints(index: integer): TPoint;
var
i, Tol: Integer;
aTPA: t2DPointArray;
TPA: tPointArray;
p: tPoint;
RockColor, TreeColor, BC: Integer;
t: LongInt;
begin
Result := Point(-1, -1);
case index of
//road
WALK_WC_VE_TREE_1:
begin
if countColor(RoadColor, MMx1, MMy1, MMx2, MMy2) <= 5 then
RoadColor := MSI_AutoColor(srl_VarrockRoadColor, COLOR_ROAD_VARROCK);
Tol := 2;
for i := 0 to 2 do
begin
FindColorsTolerance(TPA, RoadColor, MMCx, MMy1, MMx2, MMCy, Tol);
if Length(TPA) > 10 then
Break;
if i = 2 then
begin
MSI_Debug('WALK_WC_VE_TREE_1', 'Failed to locate road.', DEBUG_SMALL_DETAILS);
Exit;
end;
Tol := i * 2;
end;
SortTPAFrom(TPA, Point(MMX2, MMY1));
try
t := High(TPA) - randomRange(3, 6);
except
t := High(TPA);
end;
Result := Point(TPA[t].x, TPA[t].y);
end;
//road
WALK_WC_VE_TREE_2:
begin
Tol := 2;
for i := 0 to 2 do
begin
RoadColor := MSI_AutoColor(srl_VarrockRoadColor, COLOR_ROAD_VARROCK);
FindColorsTolerance(TPA, RoadColor, MMCx + 40, MMCY - 40, MMx2, MMCy + 15, Tol);
if Length(TPA) > 10 then
Break;
if i = 2 then
begin
MSI_Debug('WALK_WC_VE_TREE_2', 'Failed to locate road.', DEBUG_SMALL_DETAILS);
Exit;
end;
Tol := i * 2;
end;
SortTPAFrom(TPA, Point(MMCx, MMCy));
i := (High(TPA) - RandomRange(1, 5));
Result := Point(TPA[i].x, TPA[i].y);
end;
//rock
WALK_WC_VE_TREE_3:
begin
RockColor := MSI_AutoColorMM(COLOR_ROCK);
TPA := MSI_CreateWalkTPA(MMcx, MMy1, RockColor, 2, 2, 8);
if length(TPA) <= 0 then Exit;
for i := 0 to High(TPA) do
begin
if TPA[i].y > MMcy then continue;
Result := Point(TPA[i].x, TPA[i].y);
Exit;
end;
end;
//final
WALK_WC_VE_TREE_4:
begin
TreeColor := MSI_AutoColor(srl_TreeColor, COLOR_TREE);
writeLn('Tree AutoColor = '+IntToStr(TreeColor));
FindColorsTolerance(TPA, TreeColor, MMx1, MMy1, MMx2, MMy2, 8);
if Length(TPA) <= 0 then Exit;
aTPA := SplitTPAEx(TPA, 10, 10);
if Length(aTPA) <= 0 then Exit;
SortATPASize(aTPA, true);
p := MiddleTPA(aTPA[0]);
if (p.x < MMcx+20) and (p.y < MMcy) then
Result := Point(p.x, p.y);
end;
//rock
WALK_WC_VE_BANK_1:
begin
RockColor := MSI_AutoColorMM(COLOR_ROCK);
TPA := MSI_CreateWalkTPA(MMcx, MMy2, RockColor, 2, 2, 10);
if Length(TPA) <= 0 then Exit;
SortTPAFrom(TPA, point(700, 150));
for i := 0 to High(TPA) do
begin
if (TPA[i].y < MMcy+ 20) or (TPA[i].x < MMCX) then
continue;
Result := Point(TPA[i].x-5, TPA[i].y);
Exit;
end;
end;
//path
WALK_WC_VE_BANK_2:
begin
RoadColor := MSI_AutoColor(srl_VarrockRoadColor, COLOR_ROAD_VARROCK);
FindColorsTolerance(TPA, RoadColor, MMx1, MMCy + 15, MMx2 - 20, MMy2, 4);
if Length(TPA) <= 0 then
Exit;
SortTPAFrom(TPA, Point(MMCx, MMCy));
for t := 0 to 4 do
begin
i := Length(TPA) - Random(2);
try
if rs_OnMiniMap(TPA[i].x, TPA[i].y) then
BC := 1;
except
Continue;
end;
if BC = 1 then
Break;
end;
if (t = 4) or (BC < 1) then
begin
MSI_Debug('CreatWalkIndex(WALK_WC_VE_BANK_2)', 'Failed to find road on minimap', DEBUG_FUNCTIONS);
Exit;
end;
Result := Point(TPA[i].x, TPA[i].y);
end;
//road
WALK_WC_VE_BANK_3:
begin
RoadColor := MSI_AutoColor(srl_VarrockRoadColor, COLOR_ROAD_VARROCK);
TPA := MSI_CreateWalkTPA(MMx1, MMcy, RoadColor, 3, 3, 8);
if Length(TPA) <= 0 then
Exit;
SortTPAFrom(TPA, point(MMx1-10, MMcy));
for i := 0 to High(TPA) do
begin
if not RS_onMinimap(TPA[i].x, TPA[i].y) then Continue;
Result := Point(TPA[i].x, TPA[i].y);
Exit;
end;
end;
//final
WALK_WC_VE_BANK_4:
begin
for i := 0 to 2 do
begin
BC := MSI_AutoColorMM(COLOR_BANKER);
FindColorsTolerance(TPA, BC, MMx1, MMCy, MMx2, MMy2, 5);
if Length(TPA) > 5 then
Break;
if i = 2 then
begin
MSI_Debug('MSI_CreateWalkTPA(WALK_BANK_Final);', 'Failed to find bankers on MiniMap.', DEBUG_FUNCTIONS);
Exit;
end;
end;
aTPA := TPAToATPAEx(TPA, 25, 5);
SortATPASize(aTPA, True);
i := Length(aTPA[0]);
t := RandomRange(0, i);
Result := Point(aTPA[0][t].x, aTPA[0][t].y - RandomRange(3, 7));
end;
end;
end;
{******************************************************************************}
{ function MSI_CreateWalkIndex(index: Integer): TPoint; }
{ By: RM }
{ Date: 10 June 2010 }
{ Description: Returns a point on the minimap depending on the specified }
{ location by 'index' }
{******************************************************************************}
function MSI_CreateWalkIndex(index: Integer): TPoint;
begin
case index of
WALK_WC_VE_TREE_1..WALK_WC_VE_BANK_4:
Result := MSI_WC_VEPoints(index);
end;
end;
{******************************************************************************}
{ function MSI_WalkToColorIndex(index: Integer): Boolean; }
{ By: Coh3n }
{ Date: 10 June 2010 }
{ Description: Walked to a point specified by 'index' on the minimap }
{******************************************************************************}
function MSI_WalkToColorIndex(index: Integer): Boolean;
var
p: TPoint;
begin
p := MSI_CreateWalkIndex(index);
if (p.x = -1) then
Exit;
if (rs_OnMinimap(p.x, p.y)) then
begin
Mouse(p.x, p.y, 3, 3, True);
MSI_Flag;
Result := True;
end else
MSI_Debug('MSI_WalkToColorIndex', 'Failed to walk to, index: ' +
IntToStr(index) + ' is not on the minimap', DEBUG_SMALL_DETAILS);
end;
{******************************************************************************}
{ function MSI_CreateWalkFailsafe(index: Integer): Boolean; }
{ By: The MSI Team }
{ Date: 10 June 2010 }
{ Description: Uses radial walking if MSI_WalkToColorIndex fails }
{******************************************************************************}
function MSI_CreateWalkFailsafe(index: Integer): Boolean;
begin
if not MSI_WalkToColorIndex(index) then
begin
case index of
WALK_WC_VE_TREE_1:
if not RadialWalkAutoColor(srl_VarrockRoadColor, 45, 90, 55, 4, 4) then
if not RadialWalkAutoColor(srl_RockColor, 45, 90, 70, 4, 4) then
begin
MSI_Debug('MSI_CreateWalkFailsafe', 'Failed to WALK_WC_VE_TREE_1', DEBUG_FUNCTIONS);
Exit;
end;
WALK_WC_VE_TREE_2:
if not RadialWalkAutoColor(srl_VarrockRoadColor, 75, 105, 65, 4, 4) then
if not RadialWalkAutoColor(srl_VarrockRoadColor, 65, 115, 65, 4, 4) then
begin
MSI_Debug('MSI_CreateWalkFailsafe', 'Failed to WALK_WC_VE_TREE_2', DEBUG_FUNCTIONS);
Exit;
end;
WALK_WC_VE_TREE_3:
if not RadialWalkAutoColor(srl_VarrockRoadColor, 0, 35, 65, 2, 1) then
if not RadialWalkAutoColor(srl_VarrockRoadColor, 345, 35, 60, 2, 2) then
if not RadialWalkAutoColor(srl_VarrockRoadColor, 0, 45, 65, 5, 5) then
if not RadialWalkAutoColor(srl_VarrockRoadColor, 60, 110, 70, 5, 5) then
begin
MSI_Debug('MSI_CreateWalkFailsafe', 'Failed to WALK_WC_VE_TREE_3', DEBUG_FUNCTIONS);
Exit;
end;
WALK_WC_VE_TREE_4:
if not RadialWalkAutoColor(srl_TreeColor, 310, 350, 6, 2, 1) then
if not RadialWalkAutoColor(srl_TreeColor, 60, 100, 60, 2, 1) then //for if the player ends up in the museum
begin
MSI_Debug('MSI_CreateWalkFailsafe', 'Failed to WALK_WC_VE_TREE_3', DEBUG_FUNCTIONS);
Exit;
end;
WALK_WC_VE_BANK_1:
if not RadialWalkAutoColor(srl_RockColor, 350, 50, 65, 5, 5) then
begin
MouseBox(631, 114, 667, 130, 1); // random co-ord clicking
Wait(RandomRange(1000, 2000));
MSI_Flag;
end else
begin
MSI_Debug('MSI_CreateWalkFailsafe', 'Failed to WALK_WC_VE_BANK_1', DEBUG_FUNCTIONS);
Exit;
end;
WALK_WC_VE_BANK_2:
if not RadialWalkAutoColor(srl_VarrockRoadColor, 180, 200, 65, 4, 4) then
if not RadialWalkAutoColor(srl_VarrockRoadColor, 170, 220, 65, 4, 4) then
begin
MSI_Debug('MSI_CreateWalkFailsafe', 'Failed to WALK_WC_VE_BANK_2', DEBUG_FUNCTIONS);
Exit;
end;
WALK_WC_VE_BANK_3:
if not RadialWalkAutoColor(srl_VarrockRoadColor, 255, 280, 70, 4, 4) then
if not RadialWalkAutoColor(srl_VarrockRoadColor, 245, 290, 70, 4, 4) then
begin
MSI_Debug('MSI_CreateWalkFailsafe', 'Failed to WALK_WC_VE_BANK_3', DEBUG_FUNCTIONS);
Exit;
end;
WALK_WC_VE_BANK_4:
Exit; // add a DTM of Bankers here.
end;
end;
result := true;
end;
{******************************************************************************}
{ function MSI_LoadColorPath(startLoc, endLoc: Integer): TIntegerArray; }
{ By: The MSI Team }
{ Date: 10 June 2010 }
{ Description: Loads the specified color walking path }
{******************************************************************************}
function MSI_LoadColorPath(startLoc, endLoc: Integer): TIntegerArray;
begin
case startLoc of
LOC_VE_BANK:
case endLoc of
LOC_VE_TREES:
Result := [ WALK_WC_VE_TREE_1, WALK_WC_VE_TREE_2, WALK_WC_VE_TREE_3,
WALK_WC_VE_TREE_4 ];
end;
LOC_VE_TREES:
case endLoc of
LOC_VE_BANK:
Result := [ WALK_WC_VE_BANK_1, WALK_WC_VE_BANK_2, WALK_WC_VE_BANK_3,
WALK_WC_VE_BANK_4 ];
end;
end;
end;
{******************************************************************************}
{ function MSI_ColorWalk(startLoc, endLoc: Integer): Boolean; }
{ By: Coh3n }
{ Date: 10 June 2010 }
{ Description: Walks from startLoc to endLoc }
{******************************************************************************}
function MSI_ColorWalk(startLoc, endLoc: Integer): Boolean;
var
i: Integer;
thePath: TIntegerArray;
begin
if (not LoggedIn) then
Exit;
thePath := MSI_LoadColorPath(startLoc, endLoc);
for i := 0 to High(thePath) do
begin
if (not MSI_CreateWalkFailsafe(thePath[i])) then
begin
MSI_Debug('MSI_ColorWalk', 'Failed to walk to ' + MSI_LocToText(endLoc) + ', index: ' + IntToStr(thePath[i]), DEBUG_SMALL_DETAILS);
ProgressReportArray[CurrentPlayer].FalseReason := 'Failed to walk to ' + MSI_LocToText(endLoc) + ', index: ' + IntToStr(thePath[i]);
Players[CurrentPlayer].Integers[P_LOC] := LOC_LOST;
Exit;
end;
MSI_FindRandoms;
Result := (i = High(thePath));
end;
if (Result) then
begin
MSI_Debug('MSI_ColorWalk', 'Successfully walked to ' + MSI_LocToText(endLoc), DEBUG_SMALL_DETAILS);
Players[CurrentPlayer].Integers[P_LOC] := endLoc;
Wait(RandomRange(750, 1500));
end;
end;