Created
July 31, 2018 01:42
-
-
Save simarsenault/139819c1d337ecc1368761fae3a6dce6 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using ScriptSDK.Engines; | |
using ScriptSDK.Mobiles; | |
using StealthAPI; | |
using System.Collections.Generic; | |
namespace ScriptSDK.SantiagoUO.Utilities | |
{ | |
public class UltimaTileReader | |
{ | |
public static List<StaticItemRealXY> GetLumberSpots(int distance) | |
{ | |
// Don't forget to TileReader.Initialize(); somewhere before | |
var tiles = new List<StaticItemRealXY>(); | |
var playerLocation = PlayerMobile.GetPlayer().Location; | |
for (var x = playerLocation.X - distance; x <= playerLocation.X + distance; x++) | |
{ | |
for (var y = playerLocation.Y - distance; y <= playerLocation.Y + distance; y++) | |
{ | |
foreach (var tile in Ultima.Map.Felucca.Tiles.GetStaticTiles(x, y)) | |
{ | |
ushort fixedTileId = (ushort) (tile.ID - 16385); // TODO: but whyyyyy? | |
if (TileReader.TreeTiles.Contains(fixedTileId)) | |
tiles.Add(new StaticItemRealXY { Tile = fixedTileId, X = (ushort) x, Y = (ushort) y, Z = (byte) tile.Z, Color = (ushort) tile.Hue }); | |
} | |
} | |
} | |
return tiles; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment