Stránka 1 z 1

Mining

Napsal: 18 zář 2013 08:40
od Helloween

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!");
        
        }
        
    }
    
}

Re: Mining

Napsal: 20 zář 2013 23:35
od Ján Páleš
ja som sa práve zamiloval! :-D ďakujem VEĽMI pekne! skript funguje bezchybne. ^^

Re: Mining

Napsal: 21 zář 2013 10:39
od Helloween
Ján Páleš píše:ja som sa práve zamiloval! :-D ďakujem VEĽMI pekne! skript funguje bezchybne. ^^
Tak to je super, už ani nevím kde sem ho sebral :wink:

Re: Mining

Napsal: 29 zář 2013 13:52
od Ján Páleš
mno ... :-) dlho som to nemal zapnuté a všimol som si, že vyhadzuje ore akonáhle ho dostane. to mi vadí. :-)

chcel som totiž postavu, ktorá bude vyrábať z iron ore krumpáče (nemal som šťastie zohnať si fools krump, ale to sa časom zmení. ;-) zatiaľ mi aspoň môže bežať mining a s iron ingami potrénujem aj blacksmithing na paladinovi a craftovi)

tiež som si všimol, že až tak veľa ľuďom sa s makrami hrať nechce, tak ak bude niekto rovnaký blázon ako ja, toto som spravil:

našiel som nasledujúci pasáž:

protected void doThrow(int type) {

for (int i = 0; i < this.ores.Length; i++) {
int count = World.Player.Backpack.AllItems.Count(this.ores, this.colors[type]);
if (count > 0) {
//UO.DropHere(count, World.Player.Backpack.AllItems.FindType(this.ores, this.colors[type]));
UO.DropHere(0, World.Player.Backpack.AllItems.FindType(this.ores, this.colors[type]));
UO.Wait(500);

zmenil som ju nasledovne:
protected void doThrow(int type) {

for (int i = 0; i < this.ores.Length; i++) {
int count = World.Player.Backpack.AllItems.Count(this.ores[0x0000], this.colors[0x0000]);
if (count > 100) {
//UO.DropHere(count, World.Player.Backpack.AllItems.FindType(this.ores, this.colors[type]));
UO.DropHere(100, World.Player.Backpack.AllItems.FindType(this.ores, this.colors[type]));
UO.Wait(500);


0x0000 je iron ore. ak chcete ťažiť aj niečo iné, nechajte riadok začínajúci na int count nezmenený. (pre istotu)

ak som niekde spravil chybu, neváhajte ma opraviť. v skriptách som lamka. :-)

P. S. fungovať to bude až keď reštartujete phoenixa. ;-) podľa milovaného supporťáckeho "have you tried turning it off and on again?"

Re: Mining

Napsal: 29 zář 2013 21:26
od Polarka
no ono na zaciatku mas taketo volaco:

// 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
.....

takze staci zmenit false na true alebo naopak u coho len chces a mas to...

Cize ak chces iron, zmen to na > new bool[] {true, true}, // iron
No a u ostatnych podobne :)

Re: Mining

Napsal: 30 zář 2013 11:46
od Ján Páleš
ono to som spravil ako prvé. ;-D všetko som nahodil na "true". makro išlo, ale rovnako ako predtým. ale zase je pravda, že som to nereštartoval keď som tieto hodnoty zmenil. :-D

Re: Mining

Napsal: 30 zář 2013 13:16
od Helloween
Ján Páleš píše:ono to som spravil ako prvé. ;-D všetko som nahodil na "true". makro išlo, ale rovnako ako predtým. ale zase je pravda, že som to nereštartoval keď som tieto hodnoty zmenil. :-D
Musíš dat compile to by stačit mělo...mě to jede v pohodě.

Re: Mining

Napsal: 02 říj 2013 11:42
od Ján Páleš
Helloween ja som nikdy netvrdil, že ten skript nejde. iba že sa mi nepáčilo že nezbieral (v pôvodnej podobe) iron. ;-) ináč šlape ako hodinky!

Re: Mining

Napsal: 26 bře 2014 16:52
od Redrif
Ahoj, neviete preco mi ten mining skript nefunguje? Nahodil som ho a ked chcem kompilovat vypise mi nasledovnu spravu : 'Phoenix.UO' does not contain a definition for 'Press' ... Skusal som googlit a nic som nenasiel, tak sa pytam tu. Za odpoved vopred dakujem :-)

Edit: Ok, musel som updatnut phoenix asi som mal hodne stary z doby 5 p.n.l.

Re: Mining

Napsal: 28 pro 2015 14:19
od Dudek
Nechcete k tomu nekdo pridat jeste druhej script pro druhou postavu, aby mi to nosila z dolu domu? :D

Re: Mining

Napsal: 29 pro 2015 02:43
od Bakly
Dudek píše:Nechcete k tomu nekdo pridat jeste druhej script pro druhou postavu, aby mi to nosila z dolu domu? :D
napiš estel

Re: Mining

Napsal: 11 kvě 2019 18:07
od Rod Sacketts II
Mining na zbirani materialu
,mining
-> vyzadovan target1 a target2, prazdne pytliky aspon rozdilne barvy
DOTAZ jakym smerem kopat jestli na west-zapad nebo east-vychod... v kopani se stridaji oba smery

,PohybPytliku - tento script prohodi ore mezi pytliky

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 Kopani {
    
      int smer = 0;
      int n = 0;
      int nn = 0;
      int presun = 0;
      
        protected int maxWeight = 500;
      
      private Serial Pytel1;
        private Serial Pytel2;
    
        // vykovapat, brat
        protected bool[][] process = {
            new bool[] {false, false}, // iron
            new bool[] {false, false}, // copper
            new bool[] {true, true}, // bronze
            new bool[] {true, true}, // silver
            new bool[] {true, true}, // shadow
            new bool[] {true, true}, // 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[] {false, true}, // star Sapphire
            new bool[] {false, true}, // emerald
            new bool[] {true, true}, // citrine
            new bool[] {true, true}, // amethyst
            new bool[] {false, true}, // ruby
            new bool[] {true, true}  // diamond
        };
      
      protected bool[] DoPytliku = {
			true, // iron
            true, // copper
            true, // bronze
            true, // silver
            true, // shadow
            true, // rose
            true, // golden
            true, // verite
            true, // valorite
            true, // blood Rock
            false, // black Rock
            false, // mytheril
            true, // star Sapphire
            true, // emerald
            false, // citrine
            true, // amethyst
            true, // ruby
            false  // 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 Kopani() {
        
        }
		
		[Command]
        public void PytlickyZadavam() {
        
         UO.Print("Zamer Prvni pytlik");
            Pytel1 = UIManager.TargetObject();
         UO.Wait(500);
         UO.Print("Zamer Druhy pytlik");
            Pytel2 = UIManager.TargetObject();
         UO.Wait(500);
		}
		
        
        [Command]
        public void Mining() {
        
         UO.Print("Zamer Prvni pytlik");
            Pytel1 = UIManager.TargetObject();
         UO.Wait(500);
         UO.Print("Zamer Druhy pytlik");
            Pytel2 = UIManager.TargetObject();
         UO.Wait(500);
         
            UO.DeleteJournal();
         UO.PrintInformation("Rekni jestli ches prvne kopat na ZAPAD nebo na VYCHOD...");
         UO.Wait(100);
         UO.DeleteJournal();
         UO.Wait(100);
         while ((!UO.InJournal("Vychod")) && (!UO.InJournal("East")) && (!UO.InJournal("Zapad")) && (!UO.InJournal("West"))) 
         {
                UO.Wait(100);
            }
         if ((UO.InJournal("Vychod")) && (!UO.InJournal("East")) && (!UO.InJournal("Moskva")) && (!UO.InJournal("Rusko")) && (!UO.InJournal("Peking")) && (!UO.InJournal("Cina")))
         {
                smer = 2;
            }
         else if  ((UO.InJournal("Zapad")) && (!UO.InJournal("West")) && (!UO.InJournal("New Yourk")) && (!UO.InJournal("USA")) && (!UO.InJournal("Amerika")) && (!UO.InJournal("Anglie")) && (!UO.InJournal("Londyn")) && (!UO.InJournal("Nemecko")) && (!UO.InJournal("Berlin")))
         {
                smer = 1;
            }
         
         UO.DeleteJournal();
            do {
            
                UO.DeleteJournal();
            
                this.Seknuti();
                
                if (!this.checkWeight()) {
                    return;
                }
            
            } while (!Journal.Contains("xstop") && (this.move(presun)));
        
        }
        
        public void Seknuti() {
        
            bool firstMine = true;
            bool Seknuti = true;
            bool doThrow = false;
         bool Ulozit = 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);
                
            
            UOItem krumpac = World.Player.Layers[Layer.RightHand];
            
            if (krumpac.Graphic == pickaxe && krumpac.Color == 0x0481)
            {
               while (!UO.InJournal("There is no") && !UO.InJournal("You put|You loosen") && !UO.InJournal("Try mining") && !UO.InJournal("You destroy"))
               {
                  UO.Wait(500);
               }   
               UO.Wait(1000);
            }
            else
            {
               while (!UO.InJournal("There is no") && !UO.InJournal("You put|You loosen") && !UO.InJournal("Try mining") && !UO.InJournal("You destroy"))
               {
                  UO.Wait(500);
               }   
               UO.Wait(1000);
               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;
                            Seknuti = this.process[i][0];
                            doThrow = !this.process[i][1];
                     
                     if ((DoPytliku[i]) ==  true) {
                        presun = i;
                        Ulozit = this.DoPytliku[presun];
                     
                     }
                     
                            break;
                        }
                    }
                }
                
            if (Ulozit)
            {
               this.Ulozit(presun);
            }
            else if ((!Ulozit) && (doThrow)) {
                    this.doThrow(type);
                }

            if (!Seknuti) {
                    return;
                }
            
                if ((doThrow) && (Journal.Contains("There is no ore here to mine."))) {
                    this.doThrow(type);
                }
            smelting();
            
            
            }
        
        }
        
        protected void doThrow(int type) {
            
             for (int m = 0; m < this.ores.Length; m++) {
            for (int i = 0; i < colors.Length; i++) {
               if (i == type) {
               while (UO.Count(ores[m], colors[i]) >= 1) {
                  UOItem ruda = World.Player.Backpack.AllItems.FindType(ores[m], colors[type]);
                    

                  if (ruda.Exist)
                  {
                     UO.DropHere(0, World.Player.Backpack.AllItems.FindType(this.ores[m], this.colors[type]));
                     UO.Wait(500);
                  }
               }
               }
                }
            }
            
        }
        
      public bool move(int presun) 
      {
         if (smer == 1)
         {
            moveSW(presun);
            return true;
         }
         else if (smer == 2)
         {
            moveSE(presun);
            return true;
         }
         else
            return false;
      }
      
      protected bool Ulozit(int presun) 
      {
         UOItem pytlicekprvy=new UOItem(Pytel1);
         UOItem pytlicekdruhy=new UOItem(Pytel2);

            for (int m = 0; m < this.ores.Length; m++) {

            for (int i = 0; i < colors.Length; i++) {

               if (presun == i) {
                  while (UO.Count(ores[m], colors[i]) >= 1) {
                  
                     if (World.Player.Backpack.AllItems.Count(pytlicekprvy.Graphic, pytlicekprvy.Color) >= 1)
                     {
                        if (World.Player.Backpack.AllItems.Count(pytlicekdruhy.Graphic, pytlicekdruhy.Color) >= 1)
                        {
                           UO.DropHere(0, World.Player.Backpack.AllItems.FindType(pytlicekdruhy.Graphic, pytlicekdruhy.Color));
                           UO.Wait(250);
                        }
                        UO.MoveItem(World.Player.Backpack.AllItems.FindType(this.ores[m], this.colors[i]), 0, Pytel2);
                        UO.Wait(250);
                     }
                     else if (World.Player.Backpack.AllItems.Count(pytlicekdruhy.Graphic, pytlicekdruhy.Color) >= 1)
                     {
                        if (World.Player.Backpack.AllItems.Count(pytlicekprvy.Graphic, pytlicekprvy.Color) >= 1)
                        {
                           UO.DropHere(0, World.Player.Backpack.AllItems.FindType(pytlicekprvy.Graphic, pytlicekprvy.Color));
                           UO.Wait(250);
                        }
                        UO.MoveItem(World.Player.Backpack.AllItems.FindType(this.ores[m], this.colors[i]), 0, Pytel1);
                        UO.Wait(250);
                     }
                  }
               }

            }

            }
            return true;
        }
      
     public void moveSW(int presun) 
		{

			UO.Wait(250);

				if ((!MoveW()) && (x == World.Player.X))
				{
					UO.Wait(250);
					while ((!MoveS()) && (y == World.Player.Y))
					{
						UO.Wait(250);
						while ((!MoveE()) && (x == World.Player.X))
						{
							UO.Wait(250);
							while ((MoveN()) && (y != World.Player.Y))
							{
								 UO.Wait(250);
								PosunPytliku(presun);
								UO.Wait(250);
								UO.Wait(250);
								while ((MoveW()) && (x != World.Player.X))
								{
									 UO.Wait(250);
									PosunPytliku(presun);
									UO.Wait(250);
									if ((MoveS()) && (y != World.Player.Y))
									{
										 UO.Wait(250);
										PosunPytliku(presun);
										UO.Wait(250);
										return;
									}
								}
							}
						}
						 UO.Wait(250);
						PosunPytliku(presun);
						UO.Wait(250);
						
					}
					UO.Wait(250);
					PosunPytliku(presun);
					UO.Wait(250);
					while ((MoveW()) && (x != World.Player.X))
					{
						 UO.Wait(250);
						PosunPytliku(presun);
						UO.Wait(250);
						UO.Wait(250);
						if ((MoveN()) && (y != World.Player.Y))
						{
							 UO.Wait(250);
							PosunPytliku(presun);
							UO.Wait(250);
							return;
						}
					}
					smer = 2;
				}
				else
				{
					 UO.Wait(250);
					PosunPytliku(presun);
					UO.Wait(250);
				}
		}
		public void moveSE(int presun) 
		{
			UO.Wait(250);
			if ((!MoveE()) && (x == World.Player.X))
			{
					UO.Wait(250);
					while ((!MoveS()) && (y == World.Player.Y))
					{
						UO.Wait(250);
						while ((!MoveW()) && (x == World.Player.X))
						{
							UO.Wait(250);
							while ((MoveN()) && (y != World.Player.Y))
							{
								UO.Wait(250);
								PosunPytliku(presun);
								UO.Wait(250);
								while ((MoveE()) && (x != World.Player.X))
								{
									UO.Wait(250);
									PosunPytliku(presun);
									UO.Wait(250);
									UO.Wait(250);
									if ((MoveS()) && (y != World.Player.Y))
									{
										UO.Wait(250);
										PosunPytliku(presun);
										UO.Wait(250);
										return;
									}
								}
							}
						}
						UO.Wait(250);
						PosunPytliku(presun);
						UO.Wait(250);
					}
					UO.Wait(250);
					PosunPytliku(presun);
					UO.Wait(250);
					while ((MoveE()) && (x != World.Player.X))
					{
						UO.Wait(250);
						PosunPytliku(presun);
						UO.Wait(250);
						UO.Wait(250);
						if ((MoveN()) && (y != World.Player.Y))
						{
							UO.Wait(250);
							PosunPytliku(presun);
							UO.Wait(250);
							return;
						}
						
					}
					smer = 1;
			
			}
			else
			{
				UO.Wait(250);
				PosunPytliku(presun);
				UO.Wait(250);
			}
			
        }
      
        protected bool checkWeight() {
            return (World.Player.Weight <= this.maxWeight);
        }
        
            int x = 0;
            int y = 0;
      
      [Command]
        public void PosunPytliku(int presun)
        {
         UOItem pytlicekprvy=new UOItem(Pytel1);
         UOItem pytlicekdruhy=new UOItem(Pytel2);

         if (World.Player.Backpack.AllItems.Count(pytlicekprvy.Graphic, pytlicekprvy.Color) >= 1)
         {
            UO.DropHere(0, World.Player.Backpack.AllItems.FindType(pytlicekprvy.Graphic, pytlicekprvy.Color));
            UO.Wait(250);
            pytlicekprvy.Use();
            UO.Wait(250);
            pytlicekdruhy.Use();
            UO.Wait(250);
            this.z2do1(presun);
            UO.Wait(250);
            pytlicekdruhy.Move(1, Aliases.Backpack);
         }
         else if (World.Player.Backpack.AllItems.Count(pytlicekdruhy.Graphic, pytlicekdruhy.Color) >= 1)
         {
            UO.DropHere(0, World.Player.Backpack.AllItems.FindType(pytlicekdruhy.Graphic, pytlicekdruhy.Color));
            UO.Wait(250);
            pytlicekdruhy.Use();         
            UO.Wait(250);
            pytlicekprvy.Use();
            UO.Wait(250);
            this.z1do2(presun);
            UO.Wait(250);
            pytlicekprvy.Move(1, Aliases.Backpack);
         }
         else
         {
                     UO.Print("Chyba pytlu");
         }
      }
      
[Command]
        public void PohybPytliku()
        {
         UOItem pytlicekprvy=new UOItem(Pytel1);
         UOItem pytlicekdruhy=new UOItem(Pytel2);

         if (World.Player.Backpack.AllItems.Count(pytlicekprvy.Graphic, pytlicekprvy.Color) >= 1)
         {
            UO.DropHere(0, World.Player.Backpack.AllItems.FindType(pytlicekprvy.Graphic, pytlicekprvy.Color));
            UO.Wait(250);
            pytlicekprvy.Use();
            UO.Wait(250);
            pytlicekdruhy.Use();
            UO.Wait(250);
            this.z2do1(presun);
            UO.Wait(250);
            pytlicekdruhy.Move(1, Aliases.Backpack);
         }
         else if (World.Player.Backpack.AllItems.Count(pytlicekdruhy.Graphic, pytlicekdruhy.Color) >= 1)
         {
            UO.DropHere(0, World.Player.Backpack.AllItems.FindType(pytlicekdruhy.Graphic, pytlicekdruhy.Color));
            UO.Wait(250);
            pytlicekdruhy.Use();         
            UO.Wait(250);
            pytlicekprvy.Use();
            UO.Wait(250);
            this.z1do2(presun);
            UO.Wait(250);
            pytlicekprvy.Move(1, Aliases.Backpack);
         }
         else
         {
                     UO.Print("Chyba pytlu");
         }
      }


        protected bool MoveW()
        {

            x = World.Player.X;
            

            UO.Press(System.Windows.Forms.Keys.Home);
            UO.Wait(500);

           
            if (World.Player.X == x) {
                UO.Press(System.Windows.Forms.Keys.Home);
            
            }
         UO.Wait(500);
         if (World.Player.X == x) {
                UO.Press(System.Windows.Forms.Keys.Home);
            }
         
         UO.Wait(500);
            if (World.Player.X == x) {
               return false;
            }
         

            return true;
        }
      

        protected bool MoveS()
        {
         

         y = World.Player.Y;
         
         UO.Press(System.Windows.Forms.Keys.End);
            UO.Wait(500);

                    
            if (World.Player.Y == y)
         {
                UO.Press(System.Windows.Forms.Keys.End);
            UO.Wait(500);
         }
         
            if (World.Player.Y == y) {
                    UO.Press(System.Windows.Forms.Keys.End);
                }

            UO.Wait(500);
            if (World.Player.Y == y) {
               return false;
            }
            
            
            return true;
        }
        
       
        protected bool MoveE()
        {

         x = World.Player.X;
         
            UO.Press(System.Windows.Forms.Keys.PageDown);
            UO.Wait(500);

                    
            if (World.Player.X == x){
                UO.Press(System.Windows.Forms.Keys.PageDown);
            UO.Wait(500);
            }
         
            if (World.Player.X == x) {
                        UO.Press(System.Windows.Forms.Keys.PageDown);
                    }
         
            UO.Wait(500);
            if (World.Player.X == x)  {
               return false;
            }
            return true;
        }
        
        
        protected bool MoveN()
        {

         y = World.Player.Y;
      
            UO.Press(System.Windows.Forms.Keys.PageUp);
            UO.Wait(500);
;
                    
            if (World.Player.Y == y)  {
                UO.Press(System.Windows.Forms.Keys.PageUp);

            UO.Wait(500);
            }
         
            if (World.Player.Y == y) {
                    UO.Press(System.Windows.Forms.Keys.PageUp);
                }
         
            UO.Wait(500);
            if (World.Player.Y == y) {
               return false;
            }
            return true;
        }
      
      protected void z1do2(int presun) 
      {
         UOItem pytlicek=new UOItem(Pytel1);
         do
         {
            nn = 0;
            
            for (int m = 0; m < ores.Length; m++) {
               for (int i = 0; i < colors.Length; i++) {
                  if (presun == i) {
                     int count = World.Player.Backpack.AllItems.Count(this.ores[m], this.colors[i]);
                     if (count > 0) 
                     {

                        UO.MoveItem(World.Player.Backpack.AllItems.FindType(this.ores[m], this.colors[i]), 0, Pytel2);
                        UO.Wait(500);
                     }
                  }
                  do
                  {
                     n = 0;
                     UOItem ruda = pytlicek.AllItems.FindType(ores[m], colors[i]);
                    
                     if (ruda.Exist)
                     {
                        UO.MoveItem(ruda, 80, Pytel2);
                        UO.Wait(500);
                        n = 1;
                        nn = 1;
                     }
                  } while (n == 1);
               }
            }

         } while (nn == 1);
         
        }
      
      protected void z2do1(int presun) 
      {
            UOItem pytlicek=new UOItem(Pytel2);
         do
         {   
            nn = 0;

            for (int m = 0; m < ores.Length; m++) {
               for (int i = 0; i < colors.Length; i++) {
                  if (presun == i) {

                     int count = World.Player.Backpack.AllItems.Count(this.ores[m], this.colors[i]);
                     if (count > 0) 
                     {

                        UO.MoveItem(World.Player.Backpack.AllItems.FindType(this.ores[m], this.colors[i]), 0, Pytel1);
                        UO.Wait(500);
                     }
                  }
                  do
                  {
                     n = 0;
                     UOItem ruda = pytlicek.AllItems.FindType(ores[m], colors[i]);
                    
                     if (ruda.Exist)
                     {
                        UO.MoveItem(ruda, 80, Pytel1);
                        UO.Wait(500);
                        n = 1;
                        nn = 1;
                     }
                  } while (n == 1);

               }
            }
            } while (nn == 1);
         
        }
        
      [Executable]
        public void smelting() {
        
      
         UO.Wait(250);
            UOItem forge = World.Ground.FindType(this.forge[0], this.forge[1]);
         if (World.Ground.FindType(this.forge[0], this.forge[1]).Exist && World.Ground.FindType(this.forge[0], this.forge[1]).Distance < 1)
         {
         
            for (int i = 0; i < this.ores.Length; i++) {
               for (int m = 0; m < this.colors.Length; m++) {
                
                  if (World.Player.Backpack.AllItems.Count(this.ores[i], this.colors[m]) > 0) {
                     UO.WaitTargetType(this.ores[i], this.colors[m]);
                     UO.UseObject(forge);
                     UO.Print("Roztaveno!");
                     UO.Wait(1000);
                  }
               }
            }
         }
         UO.Wait(250);
        }
    }
}

Re: Mining

Napsal: 13 čer 2019 10:57
od krysakrys
Skvely skript. Trochu jsem si ho vylepsil a dela presne to co je potreba.
Portovani, presun veci a podobne veci jsou samozdrejme mozne, pokud by mel nekdo zajem o plnou automatizaci, tak staci vychazet z tohoto skriptu a sehnat si skript na portovani knizkama a dat to dohromady :)