public static bool IsTree(ushort g, out int index) { if (ProfileManager.Current != null && !ProfileManager.Current.TreeToStumps) { index = 0; return(false); } STATIC_TILES_FILTER_FLAGS flag = _filteredTiles[g]; if ((flag & STATIC_TILES_FILTER_FLAGS.STFF_STUMP) != 0) { if ((flag & STATIC_TILES_FILTER_FLAGS.STFF_STUMP_HATCHED) != 0) { index = 0; } else { index = 1; } return(true); } index = 0; return(false); }
public static bool IsTree(ushort g, out int index) { STATIC_TILES_FILTER_FLAGS flag = _filteredTiles[g]; if ((flag & STATIC_TILES_FILTER_FLAGS.STFF_STUMP) != 0) { if ((flag & STATIC_TILES_FILTER_FLAGS.STFF_STUMP_HATCHED) != 0) { index = 0; } else { index = 1; } return(true); } index = 0; return(false); }
public static void Load() { string path = Path.Combine(CUOEnviroment.ExecutablePath, "Data", "Client"); if (!Directory.Exists(path)) { Directory.CreateDirectory(path); } string cave = Path.Combine(path, "cave.txt"); string vegetation = Path.Combine(path, "vegetation.txt"); string trees = Path.Combine(path, "tree.txt"); if (!File.Exists(cave)) { using (StreamWriter writer = new StreamWriter(cave)) { for (int i = 0x053B; i < 0x0553 + 1; i++) { if (i != 0x0550) { writer.WriteLine(i); } } } } if (!File.Exists(vegetation)) { using (StreamWriter writer = new StreamWriter(vegetation)) { ushort[] vegetationTiles = { 0x0D45, 0x0D46, 0x0D47, 0x0D48, 0x0D49, 0x0D4A, 0x0D4B, 0x0D4C, 0x0D4D, 0x0D4E, 0x0D4F, 0x0D50, 0x0D51, 0x0D52, 0x0D53, 0x0D54, 0x0D5C, 0x0D5D, 0x0D5E, 0x0D5F, 0x0D60, 0x0D61, 0x0D62, 0x0D63, 0x0D64, 0x0D65, 0x0D66, 0x0D67, 0x0D68, 0x0D69, 0x0D6D, 0x0D73, 0x0D74, 0x0D75, 0x0D76, 0x0D77, 0x0D78, 0x0D79, 0x0D7A, 0x0D7B, 0x0D7C, 0x0D7D, 0x0D7E, 0x0D7F, 0x0D80, 0x0D83, 0x0D87, 0x0D88, 0x0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TileDataLoader.Instance.StaticData[g].IsImpassable) { continue; } writer.WriteLine(g); } } } if (!File.Exists(trees)) { using (StreamWriter writer = new StreamWriter(trees)) using (StreamWriter writerveg = new StreamWriter(vegetation, true)) { ushort[] treeTiles = { 0x0CCA, 0x0CCB, 0x0CCC, 0x0CCD, 0x0CD0, 0x0CD3, 0x0CD6, 0x0CD8, 0x0CDA, 0x0CDD, 0x0CE0, 0x0CE3, 0x0CE6, 0x0D41, 0x0D42, 0x0D43, 0x0D44, 0x0D57, 0x0D58, 0x0D59, 0x0D5A, 0x0D5B, 0x0D6E, 0x0D6F, 0x0D70, 0x0D71, 0x0D72, 0x0D84, 0x0D85, 0x0D86, 0x0D94, 0x0D98, 0x0D9C, 0x0DA0, 0x0DA4, 0x0DA8, 0x0C9E, 0x0CA8, 0x0CAA, 0x0CAB, 0x0CC9, 0x0CF8, 0x0CFB, 0x0CFE, 0x0D01, 0x12B6, 0x12B7, 0x12B8, 0x12B9, 0x12BA, 0x12BB, 0x12BC, 0x12BD }; for (int i = 0; i < treeTiles.Length; i++) { ushort graphic = treeTiles[i]; byte flag = 1; switch (graphic) { case 0x0C9E: case 0x0CA8: case 0x0CAA: case 0x0CAB: case 0x0CC9: case 0x0CF8: case 0x0CFB: case 0x0CFE: case 0x0D01: case 0x12B6: case 0x12B7: case 0x12B8: case 0x12B9: case 0x12BA: case 0x12BB: flag = 0; break; } if (!TileDataLoader.Instance.StaticData[graphic].IsImpassable) { writerveg.WriteLine(graphic); } else { writer.WriteLine($"{graphic}={flag}"); } } } } TextFileParser caveParser = new TextFileParser (File.ReadAllText(cave), new[] { ' ', '\t', ',' }, new[] { '#', ';' }, new[] { '"', '"' }); while (!caveParser.IsEOF()) { List <string> ss = caveParser.ReadTokens(); if (ss != null && ss.Count != 0) { if (ushort.TryParse(ss[0], out ushort graphic)) { _filteredTiles[graphic] |= STATIC_TILES_FILTER_FLAGS.STFF_CAVE; CaveTiles.Add(graphic); } } } TextFileParser stumpsParser = new TextFileParser (File.ReadAllText(trees), new[] { ' ', '\t', ',', '=' }, new[] { '#', ';' }, new[] { '"', '"' }); while (!stumpsParser.IsEOF()) { List <string> ss = stumpsParser.ReadTokens(); if (ss != null && ss.Count >= 2) { STATIC_TILES_FILTER_FLAGS flag = STATIC_TILES_FILTER_FLAGS.STFF_STUMP; if (byte.TryParse(ss[1], out byte f) && f != 0) { flag |= STATIC_TILES_FILTER_FLAGS.STFF_STUMP_HATCHED; } if (ushort.TryParse(ss[0], out ushort graphic)) { _filteredTiles[graphic] |= flag; TreeTiles.Add(graphic); } } } TextFileParser vegetationParser = new TextFileParser (File.ReadAllText(vegetation), new[] { ' ', '\t', ',' }, new[] { '#', ';' }, new[] { '"', '"' }); while (!vegetationParser.IsEOF()) { List <string> ss = vegetationParser.ReadTokens(); if (ss != null && ss.Count != 0) { if (ushort.TryParse(ss[0], out ushort graphic)) { _filteredTiles[graphic] |= STATIC_TILES_FILTER_FLAGS.STFF_VEGETATION; } } } }