示例#1
0
文件: Lumber.cs 项目: DarkLotus/UOnet
 private bool ChopLocation(Tile tile)
 {
     //Logger.I("Chopping Location: " + tile.x + " / " + tile.y);
     var next = false;
     int cnt = 0;
     while(!next && cnt < 25)
     {
         cnt++;
         var axe = UOD.FindItem(Items.Hatchet).FirstOrDefault();
         if (!CheckWhileLJ())
             return false;
         UOD.UseObject(axe);
         UOD.Target(5000);
         UOD.LTargetX = tile.x;
         UOD.LTargetY = tile.y;
         UOD.LTargetZ = tile.Z;
         UOD.LTargetTile = tile.Type;
         UOD.LTargetKind = 3;
         UOD.ClearJournal();
         UOD.EventMacro(22, 0);
         Thread.Sleep(1500);
         for (int i = 0; i < 25; i++)
         {
             if (UOD.InJournal(new string[] { "decide not to" }) != null)
             {
                 Thread.Sleep(5000);
             }
             if (UOD.InJournal(new string[] { "you hack at", "you put",}) != null)
                 break;
             if (UOD.InJournal(new string[] { "nothing here", "far away", "immune", "line of", "reach this" }) != null)
             {
                 next = true;
                 break;
             }
             Thread.Sleep(300);
         }
     }
     return true;
 }
示例#2
0
        private void MineLocation(Tile tile)
        {
            bool mining = true;
            while(mining)
            {
                UOD.LTargetX = tile.x;
                UOD.LTargetY = tile.y;
                UOD.LTargetZ = tile.Z;
                UOD.LTargetTile = tile.Type;
                UOD.LTargetKind = 3;

                if (!CheckMiningStatus())
                    return;
                var tool = UOD.FindItem(Items.PickAxe).First();
                if (tool == null)
                    return;
                UOD.LObjectID = tool.ID;
                UOD.EventMacro(17, 0);
                UOD.Target(5000);
                UOD.ClearJournal();
                UOD.EventMacro(22, 0);
                Thread.Sleep(500);
                for (int i = 0; i < 25; i++)
                {
                    if (UOD.InJournal(new string[] { "you loosen some", "you put" }) != null)
                        break;
                    if (UOD.InJournal(new string[] { "nothing here", "far away", "immune", "line of", "try mining", "that is too", "cannot mine" }) != null)
                    {
                        mining = false;
                        break;
                    }

                    Thread.Sleep(300);
                }
            }
        }