Vyroba pro crafta verze 3.1.
Nově vyrábí všechny suroviny, které potřebuje na výrobek (jen na něj musíte mít script)
standardní podoba výrobního scriptu - aneb jak si snadno napsat další výrobní scripty (pokud jste měli moji předchozí verzi stačí jen upravit):
napsal jsem scripty pro výrobu loďě, krabice kegů a univerzal animal box se všemi podscripty, zbytek si najdete v seznamu commandů
Kód: Vybrat vše
using System;
using System.Collections.Generic;
using System.Text;
using Phoenix;
using Phoenix.WorldData;
namespace Phoenix.Scripts.Raziel
{
public class Vyroba
{
UOItem baglsurky;
UOItem baglvyrobky;
bool bratsurky = true;
Graphic gdrevo = new Graphic(0x1BDD);
UOColor cdrevo = new UOColor(0x0000);
public class Surka
{
public Graphic graphic;
public UOColor color;
public int pocetNeeded;
public string command;
public Surka(string com, Graphic g, UOColor c, int p)
{
command = com;
graphic = g;
color = c;
pocetNeeded = p;//pocet surek které chci vycraftit
}
}
[Command]
public void uabox(int vyrobpocet)
{
vyrob(vyrobpocet, new Graphic(0x09A8), new UOColor(0x0000),
new List<Surka>() {
new Surka("abox", new Graphic(0x09A8), new UOColor(0x051E), 1),
new Surka("", gdrevo, cdrevo, 5),
new Surka("", new Graphic(0x11FA), new UOColor(0x0000), 5)},
"Tinkering", "Containers", "Containers", "Univerzal Animal Box");
}
[Command]
public void abox(int vyrobpocet)
{
vyrob(vyrobpocet, new Graphic(0x09A8), new UOColor(0x051E),
new List<Surka>() {
new Surka("goldbox", new Graphic(0x09A8), new UOColor(0x0000), 1),
new Surka("", gdrevo, cdrevo, 5),
new Surka("", new Graphic(0x11FA), new UOColor(0x0000), 5)},
"Tinkering", "Containers", "Containers", "Animal Box");
}
[Command]
public void goldbox(int vyrobpocet)
{
vyrob(vyrobpocet, new Graphic(0x09A8), new UOColor(0x0000),
new List<Surka>() {
new Surka("", new Graphic(0x1BE9), new UOColor(0x0000), 5),
new Surka("", gdrevo, cdrevo, 5)},
"Tinkering", "Containers", "Containers", "Golden Box (N)");
}
[Command]
public void ship(int vyrobpocet)
{
vyrob(vyrobpocet, new Graphic(0x14F1), new UOColor(0x0000), new List<Surka>(){
new Surka("boards", new Graphic(0x1BD7), new UOColor(0x0000), 250),
new Surka("nails", new Graphic(0x102E), new UOColor(0x0000), 35), new Surka("hinges", new Graphic(0x1055),
new UOColor(0x0000), 20), new Surka("", new Graphic(0x175D), new UOColor(0x0000), 20),
new Surka("", gdrevo, cdrevo, 30)}, "Carpentry", "Deeds to Ships", "Deeds to Ships", "Deed to a Small Ship");
}
[Command]
public void boxkeg(int vyrobpocet)
{
vyrob(vyrobpocet, new Graphic(0x185E), new UOColor(0x07E0), new List<Surka>() { new Surka("keg",
new Graphic(0x1843), new UOColor(0x0000), 20) }, "Carpentry", "Miscellaneous", "Miscellaneous", "Krabice kadi");
}
[Command]
public void keg(int vyrobpocet)
{
UO.Print("poustim keg");
vyrob(vyrobpocet, new Graphic(0x1843), new UOColor(0x0000), new List<Surka>(){new Surka("",
new Graphic(0x1BEF), new UOColor(0x06D6), 1), new Surka("forma", new Graphic(0x0E7F), new UOColor(0x0909), 1),
new Surka("", gdrevo, cdrevo, 2), new Surka("", new Graphic(0x19B9), new UOColor(0x0000), 2)},
"Tinkering", "Containers", "Containers", "Kad na potiony");
UO.Print("koncim keg");
}
[Command]
public void forma(int vyrobpocet)
{
UO.Print("poustim forma");
vyrob(vyrobpocet, new Graphic(0x0E7F), new UOColor(0x0909), new List<Surka>() { new Surka("staves",
new Graphic(0x1EB1), new UOColor(0x0000), 2), new Surka("lid", new Graphic(0x1DB8), new UOColor(0x0000), 2) },
"Carpentry", "Containers & Cont. parts", "Containers & Cont. parts", "Forma na lahve");
UO.Print("koncim forma");
}
[Command]
public void lid(int vyrobpocet)
{
UO.Print("poustim lid");
vyrob(vyrobpocet, new Graphic(0x1DB8), new UOColor(0x0000), new List<Surka>() { new Surka("boards",
new Graphic(0x1BD7), new UOColor(0x0000), 2) },
"Carpentry", "Containers & Cont. parts", "Containers & Cont. parts", "Barrel Lid");
UO.Print("koncim lid");
}
[Command]
public void staves(int vyrobpocet)
{
UO.Print("poustim staves");
vyrob(vyrobpocet, new Graphic(0x1EB1), new UOColor(0x0000), new List<Surka>() {
new Surka("", gdrevo, cdrevo, 3) },
"Carpentry", "Containers & Cont. parts", "Containers & Cont. parts", "Barrel Staves");
UO.Print("koncim staves");
}
[Command]
public void boards(int vyrobpocet)
{
UO.Print("poustim boards");
vyrob(vyrobpocet, new Graphic(0x1BD7), new UOColor(0x0000), new List<Surka>() {
new Surka("", gdrevo, cdrevo, 2) }, "Carpentry", "Miscellaneous", "Miscellaneous", "Boards");
UO.Print("koncim boards");
}
[Command]
public void vyrob(int minpocet, Graphic ghotovy, UOColor chotovy, List<Surka> surky, String menu1, String menu2,
String menu3, String menu4)
{
vyrob(minpocet, ghotovy, chotovy, surky, menu1, menu2, menu3, menu4, null, null);
}
[Command]
public void vyrob(int vyrobpocet, Graphic ghotovy, UOColor chotovy, List<Surka> surky, String menu1, String menu2,
String menu3, String menu4, String menu5, String menu6)
{
UOItem vyrobek;
bool presouvatvyrobky = true;
if (vyrobpocet == 0) //jen hlavni
{
UO.Print("Vyber bagl se surovinama");
baglsurky = new UOItem(UIManager.TargetObject());
if (baglsurky == null || (!baglsurky.Exist))
bratsurky = false;
else
{
baglsurky.Use();
while (!baglsurky.Opened)
UO.Wait(500);
}
UO.Print("Vyber bagl kam davat hotove vyrobky");
baglvyrobky = new UOItem(UIManager.TargetObject());
if (baglvyrobky == null || (!baglvyrobky.Exist))
presouvatvyrobky = false;
}
UO.Print("chci vyrobit celkem: " + vyrobpocet + " itemu: " + (menu4 == null ? menu2 : menu4) + (menu6 == null ? "" : " " + menu6));
while (true)
{
UO.DeleteJournal();
foreach (Surka surka in surky)
{
if (bratsurky && Count(surka.graphic, surka.color) < surka.pocetNeeded)
{
if (!seberdalsisurky(surka.command, surka.graphic, surka.color, surka.pocetNeeded))
{
return;
}
}
}
UO.Print("craftim: " + (menu4 == null ? menu2 : menu4) + (menu6 == null ? "" : " " + menu6));
UO.DeleteJournal();
switch (menu1)
{
case "Carpentry":
if (!seberdalsisurky("", gdrevo, cdrevo, 2))
{
return;
}
UO.UseType(0x1034);
break;
case "Tinkering":
if (UO.Count(0x1BEF, 0x0000) < 2 && !seberdalsisurky("", 0x1BEF, 0x0000, 2))
{
return;
}
UO.UseType(0x1EBC); break;
case "Cloth":
if (UO.Count(0x175D, 0x0000) < 2 && !seberdalsisurky("", 0x175D, 0x0000, 2))
{
return;
}
UO.UseType(0x0F9D); UO.WaitTargetType(0x175D, 0x0000); break;
case "Leather":
if (UO.Count(0x1078, 0x0000) < 2 && !seberdalsisurky("", 0x1078, 0x0000, 2))
{
return;
}
UO.UseType(0x0F9D); UO.WaitTargetType(0x1078, 0x0000); break;
case "Blacksmithing":
if (UO.Count(0x1BEF, 0x0000) < 2 && !seberdalsisurky("", 0x1BEF, 0x0000, 2))
{
return;
}
UO.UseType(0x1BEF);
break;
case "Bowcraft":
if (UO.Count(gdrevo, cdrevo) < 2 && !seberdalsisurky("", gdrevo, cdrevo, 2))
{
return;
}
UO.UseType(0x0F51); UO.WaitTargetType(gdrevo, cdrevo); break;
default: UO.Print("nezname menu1"); break;
}
UO.WaitMenu(menu1, menu2);
if (menu3 != null)
{
UO.WaitMenu(menu3, menu4);
}
if (menu5 != null)
{
UO.WaitMenu(menu5, menu6);
}
while (!UO.InJournal("Tinkering failed") && !UO.InJournal("You fail")
&& !UO.InJournal("You have failed") && !UO.InJournal("You put"))
{
UO.Wait(300);
}
if (UO.InJournal("You put") && vyrobpocet > 0)
{
if (Count(ghotovy, chotovy) >= vyrobpocet)
{
UO.Print("mam vyrobeno dost" + menu4 + menu6 == null ? "" : " " + menu6);
return;
}
else
{
UO.Print("jeste nemam dost " + Count(ghotovy, chotovy));
}
}
if (UO.InJournal("You put") && presouvatvyrobky && vyrobpocet == 0)//nepresouvat suby
{
vyrobek = UO.FindType("vyrobek", ghotovy, chotovy, Aliases.Backpack);
Serial container = vyrobek.Container;
UO.MoveItem(vyrobek.Serial, 0, baglvyrobky.Serial);
while (vyrobek.Container == container)
UO.Wait(100);
}
}
}
private int Count(Graphic g, UOColor c)
{
if (g == 0x19B9)
return UO.Count(g, c) + UO.Count(0x19BA, c) + UO.Count(0x19B7, c) + UO.Count(0x19B8, c);
else
return UO.Count(g, c);
}
public bool seberdalsisurky(string command, Graphic g, UOColor c, int kolik)
{
UO.Print("shanim surku " + (command != "" ? command : "zakladni"));
int pocet = Count(g, c);
UOItem surka = UO.FindType("surka", g, c, baglsurky.Serial);
while (pocet < kolik)
{
surka = UO.FindType("surka", g, c, baglsurky.Serial);
if (surka.Amount == 0)
{
if (command == "")
{
UO.Print("Dosly surky zakladni: " + g + " " + c);
return false;
}
pocet = Count(g, c);
UO.RunCmd(command, kolik);
if (Count(g, c) < kolik)
{
UO.Print("surka vyrobena malo " + UO.Count(g, c) + " je treba " + kolik);
return false;
}
return true;
}
if (surka.Amount == 1)
UO.MoveItem(surka.Serial, 1, Aliases.Backpack);
else
{
if (kolik == 1)
kolik = 2;
UO.MoveItem(surka.Serial, (ushort)kolik, Aliases.Backpack);
}
UO.Wait(500);
while (Count(g, c) == pocet)
UO.Wait(500);
pocet = Count(g, c);
if (pocet == kolik)
break;
}
UO.Print("sebrana/vyrobena surka " + (command != "" ? command : "zakladni"));
return true;
}
[Command]
public void hinges(int vyrobpocet)
{
vyrob(vyrobpocet, new Graphic(0x1055), new UOColor(0x0000), new List<Surka>() { new Surka("",
new Graphic(0x1BEF), new UOColor(0x0000), 1) }, "Tinkering", "Parts", "Parts", "Hinge");
}
[Command]
public void nails(int vyrobpocet)
{
vyrob(vyrobpocet, new Graphic(0x102E), new UOColor(0x0000), new List<Surka>() { new Surka("",
new Graphic(0x1BEF), new UOColor(0x0000), 1) }, "Tinkering", "Parts", "Parts", "Nails");
}
[Command]
public void cdagger(int vyrobpocet)
{
vyrob(vyrobpocet, new Graphic(0x0F51), new UOColor(0x08A1), new List<Surka>() { new Surka("",
new Graphic(0x1BEF), new UOColor(0x07D1), 2) }, "Blacksmithing", "Verite Weapons",
"Verite Weapons", "Verite Swords & Blades", "Verite Swords & Blades", "Verite Dagger");
}
[Command]
public void versekacek(int vyrobpocet)
{
vyrob(vyrobpocet, new Graphic(0x0000), new UOColor(0x08A1), new List<Surka>() { new Surka("",
new Graphic(0x1BEF), new UOColor(0x07D1), 2) }, "Blacksmithing", "Verite Weapons",
"Verite Weapons", "Verite Swords & Blades", "Verite Swords & Blades", "Verite Cleaver");
}
[Command]
public void verkryss(int vyrobpocet)
{
vyrob(vyrobpocet, new Graphic(0x0000), new UOColor(0x08A1), new List<Surka>() { new Surka("",
new Graphic(0x1BEF), new UOColor(0x07D1), 10) }, "Blacksmithing", "Verite Weapons",
"Verite Weapons", "Verite Swords & Blades", "Verite Swords & Blades", "Verite Kryss");
}
[Command]
public void verhala(int vyrobpocet)
{
vyrob(vyrobpocet, new Graphic(0x0000), new UOColor(0x08A1), new List<Surka>() {
new Surka("", new Graphic(0x1BEF), new UOColor(0x07D1), 16) }, "Blacksmithing", "Verite Weapons",
"Verite Weapons", "Verite Pole Arms", "Verite Pole Arms", "Verite Halberd");
}
[Command]
public void pickaxe(int vyrobpocet)
{
vyrob(vyrobpocet, new Graphic(0x0E85), new UOColor(0x0000), new List<Surka>() { new Surka("",
new Graphic(0x1BEF), new UOColor(0x0000), 2),
new Surka("", gdrevo, cdrevo, 4) }, "Blacksmithing", "Tools", "Tools", "Pick axe");
}
[Command]
public void sekera(int vyrobpocet)
{
vyrob(vyrobpocet, new Graphic(0x0F43), new UOColor(0x0000), new List<Surka>() { new Surka("",
new Graphic(0x1BEF), new UOColor(0x0000), 2),
new Surka("", gdrevo, cdrevo, 4) }, "Blacksmithing", "Tools", "Tools", "Hatchet");
}
[Command]
public void panvicka(int vyrobpocet)
{
vyrob(vyrobpocet, new Graphic(0x0000), new UOColor(0x0000), new List<Surka>() { new Surka("",
new Graphic(0x1BEF), new UOColor(0x0000), 10) }, "Blacksmithing", "Tools", "Tools", "Panvicka");
}
[Command]
public void vlasec(int vyrobpocet)
{
vyrob(vyrobpocet, new Graphic(0x0FA0), new UOColor(0x02B3), new List<Surka>() { new Surka("ironstring",
new Graphic(0x1420), new UOColor(0x0000), 2), new Surka("", new Graphic(0x0FA0), new UOColor(0x0000), 4) },
"Tinkering", "Wires", "Wires", "Vlasec");
}
[Command]
public void velkaspulkadratu(int vyrobpocet)
{
vyrob(vyrobpocet, new Graphic(0x1420), new UOColor(0x0B49), new List<Surka>() { new Surka("spulkadratu",
new Graphic(0x1420), new UOColor(0x08B0), 10) }, "Blacksmithing", "Tools", "Tools", "Velka Spulka dratu");
}
[Command]
public void spulkadratu(int vyrobpocet)
{
vyrob(vyrobpocet, new Graphic(0x1420), new UOColor(0x08B0), new List<Surka>() { new Surka("ironstring",
new Graphic(0x1420), new UOColor(0x0000), 25) }, "Blacksmithing", "Tools", "Tools", "Spulka dratu");
}
[Command]
public void ironstring(int vyrobpocet)
{
vyrob(vyrobpocet, new Graphic(0x1420), new UOColor(0x0000), new List<Surka>() { new Surka("ironwire",
new Graphic(0x1876), new UOColor(0x0000), 1) }, "Tinkering", "Wires", "Wires", "Iron String");
}
[Command]
public void ironwire(int vyrobpocet)
{
vyrob(vyrobpocet, new Graphic(0x1876), new UOColor(0x0000), new List<Surka>() { new Surka("",
new Graphic(0x1BEF), new UOColor(0x0000), 1) }, "Tinkering", "Wires", "Wires", "Iron Wire");
}
[Command]
public void copperwire(int vyrobpocet)
{
vyrob(vyrobpocet, new Graphic(0x1879), new UOColor(0x0000), new List<Surka>() { new Surka("copperstring",
new Graphic(0x1BE3), new UOColor(0x0000), 1) }, "Tinkering", "Wires", "Wires", "Copper Wire");
}
[Command]
public void silverwire(int vyrobpocet)
{
vyrob(vyrobpocet, new Graphic(0x1877), new UOColor(0x0000), new List<Surka>() { new Surka("",
new Graphic(0x1BF5), new UOColor(0x0000), 1) }, "Tinkering", "Wires", "Wires", "Silver Wire");
}
[Command]
public void goldwire(int vyrobpocet)
{
vyrob(vyrobpocet, new Graphic(0x1878), new UOColor(0x0000), new List<Surka>() { new Surka("",
new Graphic(0x1BE9), new UOColor(0x0000), 1) }, "Tinkering", "Wires", "Wires", "Gold Wire");
}
[Command]
public void shaft(int vyrobpocet)
{
vyrob(vyrobpocet, new Graphic(0x1BD6), new UOColor(0x0742), new List<Surka>() { new Surka("",
gdrevo, cdrevo, 1) }, "Bowcraft", "Shafts", null, null);
}
[Command]
public void golem(int vyrobpocet)
{
vyrob(vyrobpocet, new Graphic(0x2610), new UOColor(0x0000), new List<Surka>() {
new Surka("surky nevim uz", new Graphic(0x1878), new UOColor(0x0000), 10) },
"Tinkering", "Special Items", "Special Items", "Forma na golema");
}
[Command]
public void tailoring()
{
UO.Print("Vyber bagl s latkou");
baglsurky = new UOItem(UIManager.TargetObject());
baglvyrobky = null;
UO.Print("Vyber bagl kam davat bandy");
UOItem baglbandy = new UOItem(UIManager.TargetObject());
UOItem surka;
while (((UO.Count(0x175D) >= 2) || (UO.FindType("latka", 0x175D, 0x0000, baglsurky.Serial).Amount > 2))
&& (World.Player.Skills["Tailoring"].RealValue < 1000))
{
vyrob(1, new Graphic(0x153F), new UOColor(0x0000), new List<Surka>() { new Surka("",
0x175D, 0x0000, 2) }, "Cloth", "Headwear", "Headwear", "Bandana");
if (UO.Count(0x153F, 0x0000) > 0)
{
UO.DeleteJournal();
UO.UseType(0x0F9E);
UO.WaitTargetType(0x153F, 0x0000);
UO.Wait(500);
while (!UO.InJournal("You put"))
{
UO.Wait(100);
}
if (UO.FindType("bandy", 0x0E21, 0x0000, Aliases.Backpack).Amount > 10)
{
surka = UO.FindType("bandy", 0x0E21, 0x0000, Aliases.Backpack);
Serial container = surka.Container;
UO.MoveItem(surka.Serial, 0, baglbandy.Serial);
while (surka.Container == container)
UO.Wait(100);
}
}
}
UO.Print("Konec scriptu tailoring!");
}
[Command]
public void bowcraft()
{
UO.Print("Vyber bagl s surkama");
baglsurky = new UOItem(UIManager.TargetObject());
baglvyrobky = null;
UO.Print("Vyber bagl kam davat sipy");
UOItem baglsipy = new UOItem(UIManager.TargetObject());
UOItem surka;
while ((UO.FindType("log", 0x1BDD, 0x0000, baglsurky.Serial).Amount > 0 ||
UO.FindType("shaft", 0x1BD4, 0x0000, baglsurky.Serial).Amount > 0) &&
(World.Player.Skills["Bowcraft/Fletching"].RealValue < 1000))
{
UO.DeleteJournal();
if (UO.Count(0x1BDD) == 0)
{
surka = UO.FindType("log", 0x1BDD, 0x0000, baglsurky.Serial);
if (surka != null && surka.Exist)
{
UO.MoveItem(surka.Serial, 2, Aliases.Backpack, 100, 100);
UO.Wait(100);
while (UO.FindType("log", 0x1BDD, 0x0000, Aliases.Backpack).Amount == 0)
UO.Wait(100);
UO.MoveItem(surka.Serial, 1, Aliases.Backpack, 50, 50);
UO.Wait(100);
while (surka.Amount > 1)
UO.Wait(100);
}
}
if (UO.Count(0x1BDD) > 0)
{
vyrob(1, new Graphic(0x1BD6), new UOColor(0x0742), new List<Surka>() { new Surka("",
gdrevo, cdrevo, 1) }, "Bowcraft", "Shafts", null, null);
if (UO.Count(0x1BD6, 0x0742) > 0)
{
UO.DeleteJournal();
UO.UseType(0x1BD6);
UO.Wait(500);
while (!UO.InJournal("You put"))
{
UO.Wait(100);
}
surka = UO.FindType("Unfinished_Shafts", 0x1BD4, 0x0000, Aliases.Backpack);
if (surka != null && surka.Exist)
{
UO.MoveItem(surka.Serial, 0, baglsurky.Serial);
UO.Wait(100);
while (UO.Count(0x1BD4) > 0)
{
UO.Wait(100);
}
}
}
}
if (World.Player.Skills["Bowcraft/Fletching"].RealValue >= 178 &&
UO.FindType("feathers", 0x1BD1, 0x0000, baglsurky.Serial).Amount > 0 &&
UO.FindType("shaft", 0x1BD4, 0x0000, baglsurky.Serial).Amount > 0)
{
if (UO.Count(0x1BD4) == 0)
{
surka = UO.FindType("shaft", 0x1BD4, 0x0000, baglsurky.Serial);
if (surka != null && surka.Exist)
{
UO.MoveItem(surka.Serial, 1, Aliases.Backpack);
UO.Wait(100);
while (UO.FindType("shaft", 0x1BD4, 0x0000, Aliases.Backpack).Amount == 0)
{
UO.Wait(100);
}
}
}
if (UO.Count(0x1BD1) == 0)
{
surka = UO.FindType("feathers", 0x1BD1, 0x0000, baglsurky.Serial);
if (surka != null && surka.Exist)
{
UO.MoveItem(surka.Serial, 100, Aliases.Backpack);
UO.Wait(100);
while (UO.FindType("feathers", 0x1BD4, 0x0000, Aliases.Backpack).Amount == 0)
UO.Wait(100);
}
}
UO.DeleteJournal();
UO.UseType(0x1BD4);
UO.WaitMenu("Select arrow type", "Crossbow bolts");
UO.Wait(500);
while (!UO.InJournal("You fail") && !UO.InJournal("You put"))
{
UO.Wait(100);
}
if (UO.InJournal("You put") && UO.Count(0x1BFB) > 100)
{
UO.DeleteJournal();
surka = UO.FindType("arrows", 0x1BFB, 0x0000, Aliases.Backpack);
Serial container = surka.Container;
UO.MoveItem(surka.Serial, 0, baglsipy.Serial);
UO.Wait(100);
while (surka.Container == container)
UO.Wait(100);
}
}
}
UO.Print("Konec scriptu bowcraft!");
}
[Command]
public void blacksmithing()
{
UO.Print("Vyber bagl s ironem");
baglsurky = new UOItem(UIManager.TargetObject());
baglvyrobky = null;
while (((UO.FindType("iron", 0x1BEF, 0x0000, baglsurky.Serial).Amount > 2))
&& (World.Player.Skills["Blacksmithing"].RealValue < 1000))
{
vyrob(1, new Graphic(0x0F51), new UOColor(0x0000), new List<Surka>() { new Surka("",
new Graphic(0x1BEF), new UOColor(0x0000), 2) }, "Blacksmithing", "Iron Weapons",
"Iron Weapons", "Swords & Blades", "Iron Swords & Blades", "Dagger");
if (UO.Count(0x0F51, 0x0000) >= 10)
{
UO.UseType(0x0FB1, 0x0161);
UO.Wait(500);
}
}
UO.Print("Konec scriptu blacksmithing!");
}
}
}