Craftsman's
Datum: 27/07/2011 00:56:15
Staženo: 916x
Popis:
Další výrobky lze navolit. Univerzální train ;-)
Příkazy:
- ,exec craft_wire_iron
- ,exec craft_wire_silver
- ,exec craft_wire_gold
- ,exec craft_strings
- ,exec craftmenstvisro "string name" " ushort itemos_iron" " ushort color_iron" " ushort iron_vyrobek" " uoitem box" " ushort naradi" " string ocet_ironu" " string[] incs"
- ,exec craftmenstvi_v2_sro "string name" " ushort itemos_iron" " ushort color_iron" " ushort iron_vyrobek" " uoitem box" " ushort naradi" " string ocet_ironu" " string[] incs"
- ,smocelskd "uoitem box" " ushort itemos_iron" " ushort color_iron" " string pocet_ironu"
- ,statisticss "int ok" " int fizz" " int uspesnostssa"
- ,waitforjournal "string text"
Kód:
using System;
using System.Collections.Generic;
using System.Text;
using Phoenix;
using Phoenix.WorldData;
using System.Linq;
using Phoenix.Communication;
using Phoenix.Runtime;
using Phoenix.Runtime.Reflection;
namespace Script.crafts_od_smoce
{//by smoce
public class Craftmenstvi
{//by smoce
[Executable]
public static void craft_wire_iron()
{
UO.PrintInformation("ZVOL BOX S MATERIALEM !!!");
UOItem box = new UOItem(UIManager.TargetObject());
UO.Wait(500);
string[] incs = { "Tinkering", "Wires", "Wires", "Iron Wire" };
Craftmenstvisro("Iron Wire", 0x1BEF, 0x0000, 0x1876, box, 0x1EBC, "200", incs);
}
[Executable]
public static void craft_wire_silver()
{
UO.PrintInformation("ZVOL BOX S MATERIALEM !!!");
UOItem box = new UOItem(UIManager.TargetObject());
UO.Wait(500);
string[] incs = { "Tinkering", "Wires", "Wires", "Silver Wire" };
Craftmenstvisro("Silver Wire", 0x1BF5, 0x0000, 0x1877, box, 0x1EBC, "200", incs);
}
[Executable]
public static void craft_wire_gold()
{
UO.PrintInformation("ZVOL BOX S MATERIALEM !!!");
UOItem box = new UOItem(UIManager.TargetObject());
UO.Wait(500);
string[] incs = { "Tinkering", "Wires", "Wires", "Gold Wire" };
Craftmenstvisro("Gold Wire", 0x1BF5, 0x0000 , 0x1878 , box, 0x1EBC, "200", incs);
}
[Executable]
public static void craft_strings()
{
UO.PrintInformation("ZVOL BOX S MATERIALEM !!!");
UOItem box = new UOItem(UIManager.TargetObject());
UO.Wait(500);
string[] incs = { "Tinkering", "Wires", "Wires", "Iron String" };
Craftmenstvi_v2_sro("Iron String", 0x1BE9, 0x0000, 0x1420, box, 0x1EBC, "200", incs);
}
//Unirezalni
[Executable]
public static void Craftmenstvisro(string name, ushort itemos_iron, ushort color_iron, ushort iron_vyrobek, UOItem box, ushort naradi, string ocet_ironu, string[] incs)
{
UO.Print("Zahajeni crafteni - " + name);
UO.Wait(100);
int y = 0;
int ok = 0;
int fizz = 0;
zacateks:
do
{
if (UO.Count(itemos_iron) == 0)
{
box.Use();
UO.PrintInformation("Dosel material. Mrknu do boxu jesteli tam něco neni !");
if (UO.Count(iron_vyrobek) > 0)
{
//// svitky jsou preneseny do boxu - Z
UOItem svitecky = World.Player.Backpack.AllItems.FindType(iron_vyrobek, 0x0000);
UO.MoveItem(svitecky, 0, box);
UO.Wait(1000);
//// svitky jsou preneseny do boxu - K
}
else
{
UO.Print("V baglu nejsou zadne vyrobky berem z boxu jen material");
UO.Wait(100);
}
smocelskd(box, itemos_iron, color_iron, ocet_ironu);
UO.Wait(1000);
}
UO.DeleteJournal();
UO.WaitMenu(incs);
UOItem naradis = World.Player.Backpack.AllItems.FindType(naradi);
naradis.Use();
string[] hlaskys = { "You put", "You fail", "Tinkering failed" };
Journal.WaitForText(true, hlaskys);
if (UO.InJournal("You put"))
{
ok++;
}
else
{
fizz++;
}
y++;
statisticss(ok, fizz, 0);
}
while (UO.Count(0x0E34) >= 1);
goto zacateks;
}
//Unirezalni - KONEC
[Executable]
public static void Craftmenstvi_v2_sro(string name, ushort itemos_iron, ushort color_iron, ushort iron_vyrobek, UOItem box, ushort naradi, string ocet_ironu, string[] incs)
{
UO.Print("Zahajeni crafteni - " + name);
UO.Wait(100);
int y = 0;
int ok = 0;
int fizz = 0;
int soulkamodra = 0;
zacateks:
do
{
if (UO.Count(itemos_iron) == 0)
{
box.Use();
UO.PrintInformation("Dosel material. Mrknu do boxu jesteli tam něco neni !");
if (UO.Count(iron_vyrobek) > 0)
{
//// svitky jsou preneseny do boxu - Z
UOItem svitecky = World.Player.Backpack.AllItems.FindType(iron_vyrobek, 0x0000);
UO.MoveItem(svitecky, 0, box);
UO.Wait(1000);
//// svitky jsou preneseny do boxu - K
}
else
{
UO.Print("V baglu nejsou zadne vyrobky berem z boxu jen material");
UO.Wait(100);
}
smocelskd(box, itemos_iron, color_iron, ocet_ironu);
UO.Wait(1000);
}
UO.DeleteJournal();
UO.WaitMenu(incs);
UOItem naradis = World.Player.Backpack.AllItems.FindType(naradi);
naradis.Use();
string[] hlaskys = { "You put", "You fail", "Tinkering failed" };
Journal.WaitForText(true, hlaskys);
if (UO.InJournal("You put"))
{
ok++;
soulkamodra++;
}
else
{
fizz++;
}
y++;
statisticss(ok, fizz, 0);
if (UO.Count(0x1420, 0x0000) > 26)
{
UO.Print("vyrobku = "+UO.Count(0x1420, 0x0000)+"vytvartim pack");
UO.Wait(100);
smocelskd(box, 0x1BEF, 0x0000, "10");
UO.DeleteJournal();
string[] bec = { "Blacksmithing", "Tools", "Tools", "Spulka dratu" };
UO.WaitMenu(bec);
UOItem naraa = World.Player.Backpack.AllItems.FindType(0x1BEF, 0x0000);
naraa.Use();
string[] hlasks = { "You put", "You fail", "Tinkering failed","You have failed" };
Journal.WaitForText(true, hlasks);
}
UO.Wait(300);
if (UO.Count(0x1420, 0x08B0) > 10)
{
UO.Print("vyrobku = " + UO.Count(0x1420, 0x0000) + "vytvartim velky pack");
UO.Wait(100);
smocelskd(box, 0x1BEF, 0x0000, "10");
UO.DeleteJournal();
string[] bec = { "Blacksmithing", "Tools", "Tools", "Velka spulka dratu" };
UO.WaitMenu(bec);
UOItem naraa = World.Player.Backpack.AllItems.FindType(0x1BEF, 0x0000);
naraa.Use();
string[] hlasks = { "You put", "You fail", "Tinkering failed", "You have failed" };
Journal.WaitForText(true, hlasks);
if (UO.InJournal("You put"))
{
if (UO.Count(0x1420, 0x08B0) > 5)
{
UOItem svia = World.Player.Backpack.AllItems.FindType(0x1420, 0x0B49);
UO.MoveItem(svia, 0, box);
UO.Wait(1000);
}
}
}
UO.Wait(2000);
}
while (UO.Count(0x0E34) >= 1);
goto zacateks;
}
[Command]
public static void smocelskd(UOItem box, ushort itemos_iron, ushort color_iron, string pocet_ironu)
{
UOItem tod = new UOItem(World.Player.Backpack);
foreach (KeyValuePair<Graphic, string> items in new Dictionary<Graphic, string>
{
{itemos_iron , pocet_ironu}
})
MoveItemsd(box, tod, color_iron, items);
}
private static void MoveItemsd(UOItem from, UOItem to, ushort colors, KeyValuePair<Graphic, string> item)
{
if (string.IsNullOrEmpty(item.Value))
return;
int count = ushort.Parse(item.Value) - to.AllItems.Count(item.Key, colors);
if (count > 0)
MoveItem(from.AllItems.FindType(item.Key, colors), count, to);
else if (count < 0)
MoveItem(to.AllItems.FindType(item.Key, colors), count, from);
}
private static void MoveItem(UOItem item, int count, UOItem dest)
{
if (!item.Exist)
return;
ushort tomove = Math.Min((ushort)Math.Abs(count), item.Amount);
using (ItemUpdateEventWaiter ew = new ItemUpdateEventWaiter(item))
{
item.Move(tomove, dest);
if (ew.Wait(5000))
UO.PrintInformation(item.Graphic + " - " + tomove);
UO.Wait(500);
}
}
[Command]
public static void statisticss(int ok, int fizz, int uspesnostssa)
{
if (ok > 0)
{
uspesnostssa = (ok / (ok + fizz)) * 100;
}
else
{
uspesnostssa = 0;
}
UO.Print("Povedene:Nepovedene - " + ok + ":" + fizz);
}
[Command]
public static void WaitForJournal(string text)
{
do
{
UO.Wait(200);
}
while (UO.InJournal(text));
UO.Wait(500);
}
}
}

