Мининг для шардов на RunUO PROGRAM TestMining CONST tMinerTool 0F39 Че

  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
// Мининг для шардов на RunUO.
PROGRAM TestMining;
CONST
tMinerTool = $0F39; //Чем копать (тип инструмента): $0F39 - Shovel. $0E86 - Pickaxe.
Procedure MiningHere();
Var
msgMine_WhereDig, msgMine_Sucs, msgMine_Fail, msgMine_NoMetal,
msgMine_FarAway, msgMine_CantThere, msgMine_CantThat, msgMine_Target,
msgMine_YouMoved, msgMine_PackFull, msgMine_WormTool, msgMine_Riding,
msgMine_Polymorphed, msgMine_ExtractStone, oreAndStone_DoubleHarvest,
sand_NoResources, sand_Fail, sand_Sucs, sand_PackFull,
msgMine_END, msgMine_ALL : String;
MountainTiles, SandTiles, CaveTiles: array of Word;
idMinerTool: Cardinal;
startTime: TDateTime;
MapCell: TMapCell;
StaticCell: TStaticCell;
T, X, Y: Word;
Z: ShortInt;
i, j, ix, iy: Integer;
isMountain: Boolean;
Begin
// СООБЩЕНИЯ ВО ВРЕМЯ ДОБЫЧИ РУДЫ:
msgMine_WhereDig := 'Where do you wish to dig?';
msgMine_Sucs := 'You dig some'; //You dig some ... ore and put it in your backpack.
msgMine_Fail := 'You loosen some rocks but fail to find any useable ore.';
msgMine_NoMetal := 'There is no metal here to mine.';
msgMine_FarAway := 'That is too far away.';
msgMine_CantThere := 'You can''t mine there.';
msgMine_CantThat := 'You can''t mine that.';
msgMine_Target := 'Target cannot be seen.';
msgMine_YouMoved := 'You have moved too far away to continue mining.';
msgMine_PackFull := 'Your backpack is full, so the ore you mined is lost.';
msgMine_WormTool := 'You have worn out your tool!';
msgMine_Riding := 'You can''t mine while riding.';
msgMine_Polymorphed := 'You can''t mine while polymorphed.';
msgMine_ExtractStone := 'You carefully extract some workable stone from the ore vein!';
oreAndStone_DoubleHarvest := 'Someone has gotten to the metal before you.';
sand_Fail := 'You dig for a while but fail to find any of sufficient quality for glassblowing.';
sand_Sucs := 'You carefully dig up sand of sufficient quality for glassblowing.';
sand_NoResources := 'There is no sand here to mine.';
sand_PackFull := 'Your backpack can''t hold the sand, and it is lost!';
// Сообщения при которых завершается добыча:
msgMine_END := msgMine_NoMetal + '|' + msgMine_FarAway + '|' +
msgMine_CantThere + '|' + msgMine_CantThat + '|' +
msgMine_Target + '|' + msgMine_YouMoved + '|' +
sand_NoResources + '|' + msgMine_PackFull + '|' + sand_PackFull;
// Все сообшения:
msgMine_ALL := msgMine_END + '|' + msgMine_Sucs + '|' + msgMine_Fail + '|' +
sand_Fail + '|' + sand_Sucs + '|' + msgMine_ExtractStone;
// ТАЙЛЫ В КОТОРЫХ МОЖНО ВЕСТИ ДОБЫЧУ (из исходников RunUO):
MountainTiles :=
[
220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 236, 237, 238,
239, 240, 241, 242, 243, 244, 245, 246, 247, 252, 253, 254, 255, 256, 257,
258, 259, 260, 261, 262, 263, 268, 269, 270, 271, 272, 273, 274, 275, 276,
277, 278, 279, 286, 287, 288, 289, 290, 291, 292, 293, 294, 296, 296, 297,
321, 322, 323, 324, 467, 468, 469, 470, 471, 472, 473, 474, 476, 477, 478,
479, 480, 481, 482, 483, 484, 485, 486, 487, 492, 493, 494, 495, 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, 581, 582, 583, 584, 585, 586, 587, 588, 589, 590,
591, 592, 593, 594, 595, 596, 597, 598, 599, 600, 601, 610, 611, 612, 613,
1010, 1741, 1742, 1743, 1744, 1745, 1746, 1747, 1748, 1749, 1750, 1751,
1752, 1753, 1754, 1755, 1756, 1757, 1771, 1772, 1773, 1774, 1775, 1776,
1777, 1778, 1779, 1780, 1781, 1782, 1783, 1784, 1785, 1786, 1787, 1788,
1789, 1790, 1801, 1802, 1803, 1804, 1805, 1806, 1807, 1808, 1809, 1811,
1812, 1813, 1814, 1815, 1816, 1817, 1818, 1819, 1820, 1821, 1822, 1823,
1824, 1831, 1832, 1833, 1834, 1835, 1836, 1837, 1838, 1839, 1840, 1841,
1842, 1843, 1844, 1845, 1846, 1847, 1848, 1849, 1850, 1851, 1852, 1853,
1854, 1861, 1862, 1863, 1864, 1865, 1866, 1867, 1868, 1869, 1870, 1871,
1872, 1873, 1874, 1875, 1876, 1877, 1878, 1879, 1880, 1881, 1882, 1883,
1884, 1981, 1982, 1983, 1984, 1985, 1986, 1987, 1988, 1989, 1990, 1991,
1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003,
2004, 2028, 2029, 2030, 2031, 2032, 2033, 2100, 2101, 2102, 2103, 2104,
2105, 17723, 17724, 17725, 17726, 17727, 17728, 17729, 17730, 17731, 17732,
17733, 17734, 17735, 17736, 17737, 17738, 17739, 17740, 17741, 17742, 17743
];
SandTiles :=
[
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, 68, 69, 70, 71, 72, 73, 74, 75,
286, 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300,
301, 402, 424, 425, 426, 427, 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, 642, 643, 644, 645, 650, 651, 652, 653, 654, 655, 656, 657, 821, 822,
823, 824, 825, 826, 827, 828, 833, 834, 835, 836, 845, 846, 847, 848, 849,
850, 851, 852, 857, 858, 859, 860, 951, 952, 953, 954, 955, 956, 957, 958,
967, 968, 969, 970,
1447, 1448, 1449, 1450, 1451, 1452, 1453, 1454, 1455, 1456, 1457, 1458, 1611,
1612, 1613, 1614, 1615, 1616, 1617, 1618, 1623, 1624, 1625, 1626, 1635, 1636,
1637, 1638, 1639, 1640, 1641, 1642, 1647, 1648, 1649, 1650
];
CaveTiles :=
[
1339, 1340, 1341, 1342, 1343, 1344, 1345, 1346, 1347, 1348, 1349,
1350, 1351, 1352, 1353, 1354, 1355, 1356, 1357, 1358, 1359
];
if TargetPresent then CancelTarget else CancelWaitTarget;
T := 0;
X := GetX(self);
Y := GetY(self);
Z := GetZ(self);
isMountain := TRUE;
// Ищим горы и кочки в радиусе 1 тайл:
for ix := (X - 1) to (X + 1) do
begin
for iy := (Y - 1) to (Y + 1) do
begin
MapCell := GetMapCell(ix, iy, WorldNum);
for i := 0 to (Length(MountainTiles) - 1) do
if (MapCell.Tile = MountainTiles[i]) and (abs(Z - MapCell.Z) < 15) then
begin
AddToSystemJournal('-- MOUNTAIN --');
T := MapCell.Tile;
X := ix;
Y := iy;
Z := MapCell.Z;
BREAK;
end;
if T > 0 then BREAK;
end;
if T > 0 then BREAK;
end;
// Ищим под ногами песок:
if T = 0 then
begin
MapCell := GetMapCell(X, Y, WorldNum);
for i := 0 to (Length(SandTiles) - 1) do
if (MapCell.Tile = SandTiles[i]) and (abs(Z - MapCell.Z) < 15) then
begin
AddToSystemJournal('-- SAND --');
isMountain := TRUE;
T := MapCell.Tile;
Z := MapCell.Z;
BREAK;
end;
end;
// Ищим под ногами пол шахты:
if T = 0 then
begin
isMountain := FALSE;
StaticCell := ReadStaticsXY(X, Y, WorldNum);
if StaticCell.StaticCount > 0 then
begin
for i := 0 to (StaticCell.StaticCount - 1) do
begin
for j := 0 to (Length(CaveTiles) - 1) do
begin
if StaticCell.Statics[i].Tile = CaveTiles[j] then
begin
AddToSystemJournal('---- CAVE ----');
T := StaticCell.Statics[i].Tile;
BREAK;
end;
end;
if T > 0 then BREAK;
end;
end;
end;
AddToSystemJournal('-- Tile = ' + IntToStr(T) + ' X = ' + IntToStr(ix) + ' Y = ' + IntToStr(iy) + ' Z = ' + IntToStr(Z));
if T = 0 then
begin
AddToSystemJournal('-- Здесь нельзя добывать.');
ClientPrint('ЗДЕСЬ НЕЛЬЗЯ ДОБЫВАТЬ.');
EXIT;
end;
repeat
idMinerTool := FindType(tMinerTool, Backpack);
if idMinerTool = $0 then
begin
AddToSystemJournal('-- Нет инструментов для добычи!');
ClientPrint('НЕТ ИСТРУМЕНТА ДЛЯ ДОБЫЧИ.');
EXIT;
end;
//if TargetPresent then CancelTarget else CancelWaitTarget;
Wait(100);
startTime := Now;
if isMountain = TRUE then
WaitTargetXYZ(X, Y, Z) //Горы, кочки и песок.
else
WaitTargetTile(T, X, Y, Z); //Шахта.
UseObject(idMinerTool);
repeat
wait(100);
until Dead or not Connected or (InJournalBetweenTimes(msgMine_ALL,startTime,Now) <> -1);
until Dead or not Connected or (InJournalBetweenTimes(msgMine_END,startTime,Now) <> -1);
End;
BEGIN
MiningHere();
END.