Kód: Vybrat vše
using System;
using System.Collections.Generic;
using System.Text;
using Phoenix;
using Phoenix.WorldData;
namespace Phoenix.Script {
[RuntimeObject]
public class Mining {
protected int maxWeight = 500;
// vykovapat, brat
protected bool[][] process = {
new bool[] {false, false}, // iron
new bool[] {false, false}, // copper
new bool[] {false, false}, // bronze
new bool[] {false, false}, // silver
new bool[] {true, true}, // shadow
new bool[] {false, false}, // rose
new bool[] {true, true}, // golden
new bool[] {true, true}, // verite
new bool[] {true, true}, // valorite
new bool[] {true, true}, // blood Rock
new bool[] {true, true}, // black Rock
new bool[] {true, true}, // mytheril
new bool[] {true, true}, // star Sapphire
new bool[] {true, true}, // emerald
new bool[] {true, true}, // citrine
new bool[] {true, true}, // amethyst
new bool[] {true, true}, // ruby
new bool[] {true, true} // diamond
};
protected ushort pickaxe = 0x0e85;
protected ushort[] forge = {0x0FB1, 0x0000};
// ------------------------------
protected ushort[] colors = {
0x0000, // iron
0x0289, // copper
0x01BF, // bronze
0x0482, // silver
0x0322, // shadow
0x0665, // rose
0x0160, // golden
0x01CB, // verite
0x0253, // valorite
0x04C2, // blood Rock
0x0455, // black Rock
0x052D, // mytheril
0x0006, // star Sapphire
0x0041, // emerald
0x002C, // citrine
0x0015, // amethyst
0x0027, // ruby
0x03E9 // diamond
};
protected string[] journals = {
"You put the Iron",
"You put the Copper",
"You put the Bronze",
"You put the Silver",
"You put the Shadow",
"You put the Rose",
"You put the Golden",
"You put the Verite",
"You put the Valorite",
"You put the Blood Rock",
"You put the Black Rock",
"You put the Mytheril",
"You put the Star Sapphire",
"You put the Emerald",
"You put the Citrine",
"You put the Amethys",
"You put the Ruby",
"You put the Diamond"
};
protected ushort[] ores = {
0x19B7, // 1
0x19BA, // 2
0x19B8, // 3
0x19B9 // 4
};
public Mining() {
}
[Executable]
public void mine() {
UO.DeleteJournal();
do {
UO.DeleteJournal();
this.doMine();
if (!this.checkWeight()) {
return;
}
} while (!Journal.Contains("xstop") && this.move());
}
public void doMine() {
bool firstMine = true;
bool doMine = true;
bool doThrow = false;
int type = 0;
// -- mining cycle
UO.DeleteJournal();
string[] stopText = {
"There is no ore here to mine.",
"Try mining in rock.",
"xstop"
};
while (!World.Player.Dead && !Journal.Contains(stopText)) {
UO.DeleteJournal();
UO.UseType(this.pickaxe);
UO.WaitTargetTile(World.Player.X, World.Player.Y, World.Player.Z, 1341);
Journal.WaitForText("...akce skoncila");
// -- getting info about mined ore
if (firstMine && Journal.Contains("You put")) {
for (int i = 0; i < this.journals.Length; i++) {
if (Journal.Contains(this.journals[i])) {
firstMine = false;
type = i;
doMine = this.process[i][0];
doThrow = !this.process[i][1];
break;
}
}
}
if (doThrow) {
this.doThrow(type);
}
if (!doMine) {
return;
}
}
}
protected void doThrow(int type) {
for (int i = 0; i < this.ores.Length; i++) {
int count = World.Player.Backpack.AllItems.Count(this.ores[i], this.colors[type]);
if (count > 0) {
//UO.DropHere(count, World.Player.Backpack.AllItems.FindType(this.ores[i], this.colors[type]));
UO.DropHere(0, World.Player.Backpack.AllItems.FindType(this.ores[i], this.colors[type]));
UO.Wait(500);
}
}
}
public bool move() {
int[] start = {World.Player.X, World.Player.Y};
int x = 0;
int y = 0;
x = World.Player.X;
UO.Press(System.Windows.Forms.Keys.Home);
UO.Wait(250);
if (World.Player.X == x) {
UO.Press(System.Windows.Forms.Keys.Home);
}
UO.Wait(250);
if (World.Player.X == x) {
while (x <= World.Player.X) {
UO.Press(System.Windows.Forms.Keys.PageDown);
UO.Wait(250);
if (World.Player.X == x) {
UO.Press(System.Windows.Forms.Keys.PageDown);
}
UO.Wait(250);
x = x + 1;
}
y = World.Player.Y;
UO.Press(System.Windows.Forms.Keys.End);
UO.Wait(250);
if (World.Player.Y == y) {
UO.Press(System.Windows.Forms.Keys.End);
}
UO.Wait(250);
if (World.Player.Y == y) {
while (World.Player.Y != (y+1)) {
UO.Press(System.Windows.Forms.Keys.Home);
UO.Wait(250);
if (World.Player.Y == y) {
UO.Press(System.Windows.Forms.Keys.Home);
}
UO.Wait(250);
UO.Press(System.Windows.Forms.Keys.End);
UO.Wait(250);
if (World.Player.Y == y) {
UO.Press(System.Windows.Forms.Keys.End);
}
UO.Wait(250);
}
}
x = World.Player.X;
while (x <= World.Player.X) {
UO.Press(System.Windows.Forms.Keys.PageDown);
UO.Wait(250);
if (World.Player.X == x) {
UO.Press(System.Windows.Forms.Keys.PageDown);
}
UO.Wait(250);
x = x + 1;
}
}
if (World.Player.X != start[0] || World.Player.Y != start[1]) {
return true;
}
return false;
}
protected bool checkWeight() {
return (World.Player.Weight <= this.maxWeight);
}
[Executable]
public void smelt() {
UOItem forge = World.Ground.FindType(this.forge[0], this.forge[1]);
for (int type = 0; type < this.ores.Length; type++) {
for (int color = 0; color < this.colors.Length; color++) {
if (World.Player.Backpack.AllItems.Count(this.ores[type], this.colors[color]) > 0) {
UO.WaitTargetType(this.ores[type], this.colors[color]);
UO.UseObject(forge);
UO.Wait(1000);
}
}
}
UO.Print("Hotovo!");
}
}
}