Untitled
unknown
plain_text
7 months ago
11 kB
3
Indexable
Never
using System; using System.Collections.Generic; using System.Runtime.CompilerServices; using BasicTypes; using cheats; using Project_Bepinex; using UnityEngine; namespace hawpath { // Token: 0x0200000B RID: 11 [NullableContext(1)] [Nullable(0)] public class findpath { // Token: 0x06000024 RID: 36 RVA: 0x00002E4C File Offset: 0x0000104C public static bool[,] GetMap() { bool[,] array = new bool[Main.world.worldSizeX, Main.world.worldSizeY]; for (int i = 0; i < Main.world.worldSizeY; i++) { for (int j = 0; j < Main.world.worldSizeX; j++) { array[j, i] = false; } } return array; } // Token: 0x06000025 RID: 37 RVA: 0x00002EA8 File Offset: 0x000010A8 public static bool IsTileWalkable(int x, int y, Vector2i cpos, bool diag = false, bool isnether = false) { Vector2i vector2i; vector2i..ctor(Main.world.playerStartPosition.x, Main.world.playerStartPosition.y - 1); Main.world.GetBlockType(new Vector2i(cpos.x, cpos.y)); World.BlockType blockType = Main.world.GetBlockType(new Vector2i(x, y)); if (vector2i.x == x && vector2i.y == y) { blockType = 16; } if (vector2i.x == x && vector2i.y == y) { blockType = 16; } bool result; if (!Main.world.IsMapPointInWorld(new Vector2i(x, y))) { result = false; } else { if (ConfigData.IsBlockPlatform(blockType) && cpos.y <= y) { return true; } if (blockType == 1384 && cpos.y <= y) { return true; } if (blockType == 1373 && cpos.y <= y) { return true; } if ((blockType == 110 || blockType == 4103) && cpos.y <= y) { return true; } if (blockType == 110 || blockType == 4103) { result = true; } else if (!isnether && diag && ConfigData.IsBlockInstakill(blockType)) { result = true; } else if (!ControllerHelper.worldController.world.IsMapPointInWorld(new Vector2i(x, y))) { result = false; } else if (blockType == 656 || blockType == 3648 || blockType == 956) { result = true; } else { if (ConfigData.IsAnyDoor(blockType) && ControllerHelper.worldController.DoesPlayerHaveRightToGoDoorForCollider(new Vector2i(x, y))) { return true; } if (ConfigData.IsBlockDisappearingBlock(blockType) && Main.world.GetWorldItemData(new Vector2i(x, y)).GetAsBSON()["isOpen"].boolValue) { return true; } if (ConfigData.IsBlockBattleBarrier(blockType) && Main.world.GetWorldItemData(new Vector2i(x, y)).GetAsBSON()["isOpen"].boolValue) { return true; } result = (blockType == 1420 || blockType == 4286 || blockType == 4366 || blockType == 4372 || !ConfigData.doesBlockHaveCollider[blockType]); } } return result; } // Token: 0x06000026 RID: 38 RVA: 0x000030FC File Offset: 0x000012FC public static bool Itest(int x, int y) { World.BlockType blockType = Main.world.GetBlockType(new Vector2i(x, y)); return blockType != 3993 && blockType != 3990 && blockType != 3988 && blockType != 3; } // Token: 0x06000027 RID: 39 RVA: 0x00003140 File Offset: 0x00001340 public static List<findpath.PNode> FindPath(Vector2i _from, Vector2i _to, bool[,] map) { Queue<findpath.PNode> queue = new Queue<findpath.PNode>(); bool[,] array = new bool[Main.world.worldSizeX, Main.world.worldSizeY]; findpath.PNode pnode = new findpath.PNode(_from.x, _from.y, null); queue.Enqueue(pnode); array[_from.x, _from.y] = true; while (queue.Count > 0) { findpath.PNode pnode2 = queue.Dequeue(); if (pnode2.x == _to.x && pnode2.y == _to.y) { List<findpath.PNode> list = new List<findpath.PNode>(); while (pnode2 != pnode) { list.Add(pnode2); pnode2 = pnode2.parent; } list.Add(pnode); list.Reverse(); return list; } int[] array2 = new int[] { -1, 1, 0, 0, -1, 1, 1, -1 }; int[] array3 = new int[] { 0, 0, -1, 1, 1, -1, 1, -1 }; for (int i = 0; i < 8; i++) { int num = pnode2.x + array2[i]; int num2 = pnode2.y + array3[i]; if (Math.Abs(array2[i]) == 1 && Math.Abs(array3[i]) == 1) { if (num >= 0 && num < Main.world.worldSizeX && num2 >= 0 && num2 < Main.world.worldSizeY && findpath.IsTileWalkable(num, num2, Globals.Vectors.CurrentPosition, true, false) && !array[num, num2] && (findpath.IsTileWalkable(pnode2.x, pnode2.y + array3[i], Globals.Vectors.CurrentPosition, false, false) || findpath.IsTileWalkable(pnode2.x + array2[i], pnode2.y, Globals.Vectors.CurrentPosition, false, false))) { queue.Enqueue(new findpath.PNode(num, num2, pnode2)); array[num, num2] = true; Globals.Vectors.CurrentPosition = new Vector2i(num, num2); } } else if (num >= 0 && num < Main.world.worldSizeX && num2 >= 0 && num2 < Main.world.worldSizeY && findpath.IsTileWalkable(num, num2, Globals.Vectors.CurrentPosition, false, false) && !array[num, num2]) { queue.Enqueue(new findpath.PNode(num, num2, pnode2)); array[num, num2] = true; Globals.Vectors.CurrentPosition = new Vector2i(num, num2); } } } return new List<findpath.PNode>(); } // Token: 0x06000028 RID: 40 RVA: 0x000033B4 File Offset: 0x000015B4 public static List<findpath.PNode> FindPathnether(Vector2i _from, Vector2i _to, bool[,] map) { Queue<findpath.PNode> queue = new Queue<findpath.PNode>(); bool[,] array = new bool[Main.world.worldSizeX, Main.world.worldSizeY]; findpath.PNode pnode = new findpath.PNode(_from.x, _from.y, null); queue.Enqueue(pnode); array[_from.x, _from.y] = true; while (queue.Count > 0) { findpath.PNode pnode2 = queue.Dequeue(); if (pnode2.x == _to.x && pnode2.y == _to.y) { List<findpath.PNode> list = new List<findpath.PNode>(); while (pnode2 != pnode) { list.Add(pnode2); pnode2 = pnode2.parent; } list.Add(pnode); list.Reverse(); return list; } int[] array2 = new int[4]; array2[0] = -1; array2[1] = 1; int[] array3 = array2; int[] array4 = new int[] { 0, 0, -1, 1 }; for (int i = 0; i < 4; i++) { int num = pnode2.x + array3[i]; int num2 = pnode2.y + array4[i]; if (num >= 0 && num < Main.world.worldSizeX && num2 >= 0 && num2 < Main.world.worldSizeY && findpath.IsTileWalkable(num, num2, Globals.Vectors.CurrentPosition, false, true) && !array[num, num2]) { queue.Enqueue(new findpath.PNode(num, num2, pnode2)); array[num, num2] = true; Globals.Vectors.CurrentPosition = new Vector2i(num, num2); } } } return new List<findpath.PNode>(); } // Token: 0x06000029 RID: 41 RVA: 0x00003540 File Offset: 0x00001740 public static List<findpath.PNode> FindPathFly(Vector2i _from, Vector2i _to) { Queue<findpath.PNode> queue = new Queue<findpath.PNode>(); bool[,] array = new bool[Main.world.worldSizeX, Main.world.worldSizeY]; findpath.PNode pnode = new findpath.PNode(_from.x, _from.y, null); queue.Enqueue(pnode); array[_from.x, _from.y] = true; while (queue.Count > 0) { findpath.PNode pnode2 = queue.Dequeue(); if (pnode2.x == _to.x && pnode2.y == _to.y) { List<findpath.PNode> list = new List<findpath.PNode>(); while (pnode2 != pnode) { list.Add(pnode2); pnode2 = pnode2.parent; } list.Add(pnode); list.Reverse(); return list; } int[] array2 = new int[4]; array2[0] = -1; array2[1] = 1; int[] array3 = array2; int[] array4 = new int[] { 0, 0, -1, 1 }; for (int i = 0; i < 4; i++) { int num = pnode2.x + array3[i]; int num2 = pnode2.y + array4[i]; if (num >= 0 && num < Main.world.worldSizeX && num2 >= 0 && num2 < Main.world.worldSizeY && findpath.IsTileWalkable(num, num2, Globals.Vectors.CurrentPosition, false, true) && !array[num, num2]) { queue.Enqueue(new findpath.PNode(num, num2, pnode2)); array[num, num2] = true; Globals.Vectors.CurrentPosition = new Vector2i(num, num2); } } } return new List<findpath.PNode>(); } // Token: 0x0600002A RID: 42 RVA: 0x000036CC File Offset: 0x000018CC public static List<findpath.PNode> FindPathThroughBlocks(Vector2i _from, Vector2i _to) { Queue<findpath.PNode> queue = new Queue<findpath.PNode>(); bool[,] array = new bool[Main.world.worldSizeX, Main.world.worldSizeY]; findpath.PNode pnode = new findpath.PNode(_from.x, _from.y, null); queue.Enqueue(pnode); array[_from.x, _from.y] = true; while (queue.Count > 0) { findpath.PNode pnode2 = queue.Dequeue(); if (pnode2.x == _to.x && pnode2.y == _to.y) { List<findpath.PNode> list = new List<findpath.PNode>(); while (pnode2 != pnode) { list.Add(pnode2); pnode2 = pnode2.parent; } list.Add(pnode); list.Reverse(); return list; } int[] array2 = new int[4]; array2[0] = -1; array2[1] = 1; int[] array3 = array2; int[] array4 = new int[] { 0, 0, -1, 1 }; for (int i = 0; i < 4; i++) { int num = pnode2.x + array3[i]; int num2 = pnode2.y + array4[i]; if (num >= 0 && num < Main.world.worldSizeX && num2 >= 0 && num2 < Main.world.worldSizeY && findpath.Itest(num, num2) && !array[num, num2]) { queue.Enqueue(new findpath.PNode(num, num2, pnode2)); array[num, num2] = true; Globals.Vectors.CurrentPosition = new Vector2i(num, num2); } } } return new List<findpath.PNode>(); } // Token: 0x04000012 RID: 18 private int[,] gridmap = new int[100, 100]; // Token: 0x04000013 RID: 19 public static bool playaudio2; // Token: 0x02000015 RID: 21 [Nullable(0)] public class PNode { // Token: 0x06000052 RID: 82 RVA: 0x00008F0F File Offset: 0x0000710F public PNode(int xx, int yy, findpath.PNode parent = null) { this.x = xx; this.y = yy; this.parent = parent; } // Token: 0x06000053 RID: 83 RVA: 0x00008F2C File Offset: 0x0000712C public override string ToString() { DefaultInterpolatedStringHandler defaultInterpolatedStringHandler = new DefaultInterpolatedStringHandler(2, 2); defaultInterpolatedStringHandler.AppendFormatted<int>(this.x); defaultInterpolatedStringHandler.AppendLiteral(", "); defaultInterpolatedStringHandler.AppendFormatted<int>(this.y); return defaultInterpolatedStringHandler.ToStringAndClear(); } // Token: 0x06000054 RID: 84 RVA: 0x00008F6F File Offset: 0x0000716F public Vector2 ToVector2() { return ControllerHelper.worldController.ConvertMapPointToWorldPoint(new Vector2i(this.x, this.y)); } // Token: 0x040000D0 RID: 208 public int x; // Token: 0x040000D1 RID: 209 public int y; // Token: 0x040000D2 RID: 210 public findpath.PNode parent; } } }
Leave a Comment