public void MineCave() { var tiles = UltimaTileReader.GetMineSpots(playerMobile.Location.X, playerMobile.Location.Y); var forges = ObjectsFinder.Find <Item>(EasyUOItem.FORGE, 18); while (tiles.Count > 0) { Data.Point3D playerLocation = playerMobile.Location; var nearestMineableTile = tiles.FindAll(tile => Math.Sqrt(Math.Pow((tile.X - playerLocation.X), 2) + Math.Pow((tile.Y - playerLocation.Y), 2)) != 0).OrderBy(tile => Math.Sqrt(Math.Pow((tile.X - playerLocation.X), 2) + Math.Pow((tile.Y - playerLocation.Y), 2))).First(); movingHelper.newMoveXY(nearestMineableTile.X, nearestMineableTile.Y, true, 0, true); var mineableTilesAroundPlayer = tiles.FindAll(tile => Math.Sqrt(Math.Pow((tile.X - nearestMineableTile.X), 2) + Math.Pow((tile.Y - nearestMineableTile.Y), 2)) == 1); if (mineableTilesAroundPlayer.Count == 0) { tiles.Remove(nearestMineableTile); continue; } while (mineableTilesAroundPlayer.Count > 0) { var mineableTile = mineableTilesAroundPlayer[0]; var pickaxe = ObjectsFinder.FindInBackpackOrPaperdoll <Item>(EasyUOItem.PICKAXES); if (pickaxe.Count == 0) { Bank(new Data.Point2D(playerMobile.Location.X, playerMobile.Location.Y)); continue; } if (MineTile(pickaxe.First(), mineableTile) == MineTileResult.DONE) { mineableTilesAroundPlayer.Remove(mineableTile); tiles.Remove(mineableTile); } if (playerMobile.Weight >= smeltWeight) { Smelt(forges); if (playerMobile.Weight >= bankWeight) { Bank(new Data.Point2D(playerMobile.Location.X, playerMobile.Location.Y)); } } } } }
public void Start() { var tiles = UltimaTileReader.GetLumberSpots(TILE_SCAN_DISTANCE); while (tiles.Count > 0) { Data.Point3D playerLocation = PlayerMobile.GetPlayer().Location; var nearestTreeTile = tiles.OrderBy(tile => Math.Sqrt(Math.Pow((tile.X - playerLocation.X), 2) + Math.Pow((tile.Y - playerLocation.Y), 2))).First(); MovingHelper.GetMovingHelper().newMoveXY(nearestTreeTile.X, nearestTreeTile.Y, true, 1, true); var hatchet = ObjectsFinder.FindInBackpackOrPaperdoll <Item>(EasyUOItem.HATCHETS); if (hatchet.Count == 0) { return; } if (ChopTree(hatchet.First(), nearestTreeTile) == ChopTreeResult.DONE) { tiles.Remove(nearestTreeTile); } } }