Exemplo n.º 1
0
 // Token: 0x06000223 RID: 547 RVA: 0x0000F66C File Offset: 0x0000D86C
 public Square(TileStructure tile, short x, short y, ushort type)
 {
     this.Tile = tile;
     this.X    = x;
     this.Y    = y;
     this.Type = type;
 }
Exemplo n.º 2
0
 public MapStructure(TileStructure tile, short x, short y, ushort type)
 {
     _Tile     = tile;
     _PosX     = x;
     _PosY     = y;
     _TileType = type;
 }
Exemplo n.º 3
0
        public static void Load()
        {
            Parallel.Invoke(
                () => {
                Items = new GameDataMap <ushort, ItemStructure>(ItemStructure.Load(XDocument.Parse(RawObjectsXML)));
                PluginUtils.Log("GameData", "Mapped {0} items.", Items.Map.Count);
            },
                () => {
                Tiles = new GameDataMap <ushort, TileStructure>(TileStructure.Load(XDocument.Parse(RawTilesXML)));
                PluginUtils.Log("GameData", "Mapped {0} tiles.", Tiles.Map.Count);
            },
                () => {
                Objects = new GameDataMap <ushort, ObjectStructure>(ObjectStructure.Load(XDocument.Parse(RawObjectsXML)));
                PluginUtils.Log("GameData", "Mapped {0} objects.", Objects.Map.Count);
            },
                () => {
                Packets = new GameDataMap <byte, PacketStructure>(PacketStructure.Load(XDocument.Parse(RawPacketsXML)));
                PluginUtils.Log("GameData", "Mapped {0} packets.", Packets.Map.Count);
            },
                () => {
                Servers = new GameDataMap <string, ServerStructure>(ServerStructure.Load(XDocument.Load("http://realmofthemadgodhrd.appspot.com/char/list")));
                PluginUtils.Log("GameData", "Mapped {0} servers.", Servers.Map.Count);
            });

            PluginUtils.Log("GameData", "Successfully loaded game data.");
        }
Exemplo n.º 4
0
    public void PlaceStairs()
    {
        //Choose a random room
        RoomManager randomRoom = GetRandomRoom();
        //Instantiate a stair prefab at a random tile in the room
        TileStructure randomTile = randomRoom.GetRandomTile();
        Vector2       position   = new Vector2(randomTile.location.x + .5f, randomTile.location.y + .6f);

        Instantiate(stairPrefab, position, transform.rotation);
    }
Exemplo n.º 5
0
        public static void Load()
        {
            Parallel.Invoke(
                () => {
                Items = new GameDataMap <ushort, ItemStructure>(ItemStructure.Load(XDocument.Parse(RawObjectsXML)));
                PluginUtils.Log("GameData", "Mapped {0} items.", Items.Map.Count);
            },
                () => {
                Tiles = new GameDataMap <ushort, TileStructure>(TileStructure.Load(XDocument.Parse(RawTilesXML)));
                PluginUtils.Log("GameData", "Mapped {0} tiles.", Tiles.Map.Count);
            },
                () => {
                Objects = new GameDataMap <ushort, ObjectStructure>(ObjectStructure.Load(XDocument.Parse(RawObjectsXML)));
                PluginUtils.Log("GameData", "Mapped {0} objects.", Objects.Map.Count);
            },
                () => {
                Packets = new GameDataMap <byte, PacketStructure>(PacketStructure.Load(XDocument.Parse(RawPacketsXML)));
                PluginUtils.Log("GameData", "Mapped {0} packets.", Packets.Map.Count);
            },
                () => {
                const string CHAR_LIST_FILE = "char_list.xml";

                XDocument charList = null;

                try
                {
                    charList = XDocument.Load("http://realmofthemadgodhrd.appspot.com/char/list");
                }
                catch (Exception) { }

                // If the char list doesn't contain an error
                if (charList != null && charList.Element("Error") == null)
                {
                    // Make a backup of the char list
                    charList.Save(CHAR_LIST_FILE);
                }
                // If the backup char list file exists
                else if (System.IO.File.Exists(CHAR_LIST_FILE))
                {
                    charList = XDocument.Load(CHAR_LIST_FILE);
                }
                // The retrieved char list contains an error and a backup char list doesn't exist
                else
                {
                    PluginUtils.Log("GameData", "Error! Unable to retrieve server list.");
                    return;
                }

                Servers = new GameDataMap <string, ServerStructure>(ServerStructure.Load(charList));
                PluginUtils.Log("GameData", "Mapped {0} servers.", Servers.Map.Count);
            });

            PluginUtils.Log("GameData", "Successfully loaded game data.");
        }
Exemplo n.º 6
0
    private Mesh GetMesh()
    {
        List <Vector3> vertices  = new List <Vector3>();
        List <Vector3> normals   = new List <Vector3>();
        List <Vector2> uvs       = new List <Vector2>();
        List <int>     triangles = new List <int>();

        int offset = 0;

        for (int y = 0; y < islandDiameter; y++)
        {
            for (int x = 0; x < islandDiameter; x++)
            {
                if (grid[x, y] == null)
                {
                    continue;
                }

                Tile          tile          = (Tile)grid[x, y];
                TileStructure tileStructure = tile.tileStructure;
                tileStructure.GenerateTile();

                List <Vector3> tilesVertices  = tileStructure.vertices;
                List <int>     tilesTriangles = new List <int>();
                tilesTriangles.AddRange(tileStructure.triangles);

                for (int i = 0; i < tilesTriangles.Count; i++)
                {
                    tilesTriangles[i] += offset;
                }

                vertices.AddRange(tilesVertices);
                triangles.AddRange(tilesTriangles);
                normals.AddRange(tileStructure.normals);
                uvs.AddRange(tileStructure.uvs);

                //Adds tree
                if (tile.containsTree)
                {
                    InitTree(tile);
                }

                offset += tilesVertices.Count;
            }
        }
        Mesh mesh = new Mesh();

        mesh.vertices  = vertices.ToArray();
        mesh.normals   = normals.ToArray();
        mesh.uv        = uvs.ToArray();
        mesh.triangles = triangles.ToArray();
        return(mesh);
    }
Exemplo n.º 7
0
    public void PlaceEnemy(Occupant occupant)
    {
        RoomManager randomRoom = GetRandomRoom();
        //Instantiate a stair prefab at a random tile in the room
        TileStructure randomTile = randomRoom.GetRandomTile();
        Vector2       position   = new Vector2(randomTile.location.x + .5f, randomTile.location.y + .6f);

        Debug.Log(position);
        GameObject tempPoke = Instantiate(pokemonPrefab, position, transform.rotation);

        tempPoke.GetComponent <Pokemon>().InitializePokemon(occupant.basePokemon, Random.Range(occupant.minLevel, occupant.maxLevel));
    }
        internal static IntroMovieSet Create(
            ref TileStructure shipExterior,
            ref TileStructure shipInterior,
            out Rectangle chunkRange,
            out string result)
        {
            if (shipInterior == null)
            {
                char d = Path.DirectorySeparatorChar;
                shipExterior = TileStructure.Load(
                    mod: CutsceneLibMod.Instance,
                    pathOfModFile: "ExampleCutscene" + d + "IntroCutscene" + d + "Ship Exterior.dat"
                    );
                shipInterior = TileStructure.Load(
                    mod: CutsceneLibMod.Instance,
                    pathOfModFile: "ExampleCutscene" + d + "IntroCutscene" + d + "Ship Interior.dat"
                    );
                //LogHelpers.Log( "interior: "+ shipInterior.Bounds.ToString()+" ("+shipInterior.TileCount+")"
                //	+", exterior: "+shipExterior.Bounds.ToString()+" ("+shipExterior.TileCount+")");
            }

            int  extTileLeft, extTileTop;
            int  intTileLeft, intTileTop;
            bool isFlipped;
            bool isOcean;

            isOcean = IntroMovieSet.GetSceneCoordinates(shipExterior.Bounds.Width, out extTileLeft, out extTileTop, out isFlipped, out result);
            isOcean = IntroMovieSet.GetSceneCoordinates(shipInterior.Bounds.Width, out intTileLeft, out intTileTop, out isFlipped, out result);

            if (!isOcean)
            {
                chunkRange = new Rectangle(
                    intTileLeft,
                    41,
                    Math.Max(shipExterior.Bounds.Width, shipInterior.Bounds.Width),
                    shipExterior.Bounds.Height + shipInterior.Bounds.Height + 20
                    );
                return(null);
            }

            //extLeft += shipExterior.Bounds.Width / 2;
            //intLeft += shipInterior.Bounds.Width / 2;
            //extTop -= 8;
            intTileTop = Math.Max(intTileTop - 160, 41);

            chunkRange = default(Rectangle);
            return(new IntroMovieSet(shipExterior, shipInterior, extTileLeft, extTileTop, intTileLeft, intTileTop, isFlipped));
        }
Exemplo n.º 9
0
    public static void _uLt6b1uwFNgoZycBDqE02WmgdfB()
    {
        WebClient webClient = new WebClient();

        try {
            Program.LogInfoMessage("core", "Downloading OBJECTS...");
            string objectData = Resources.Objects;

            Program.LogInfoMessage("core", "Downloading PACKETS...");
            string packetData = webClient.DownloadString("https://realmstock.network/Public/PacketsExalt");

            Program.LogInfoMessage("core", "Downloading TILES...");
            string tileData = Resources.GroundTypes;

            Program.LogInfoMessage("core", "Loading XML...");

            XDocument parsedObjects = XDocument.Parse(objectData);
            XDocument parsedPackets = XDocument.Parse(packetData);
            XDocument parsedTiles   = XDocument.Parse(tileData);

            Program.LogInfoMessage("core", "Parsing Objects...");
            _VPArsrlUa0uEsW6OxAYV9WHJAMK =
                new _VHWgt8pn9AXryODuVtLv9GmmHeH <ushort, ObjectStructure>(
                    ObjectStructure.GetObjectDictionary(parsedObjects));

            Program.LogInfoMessage("core", "Parsing Items...");
            _3ndzvDGHhvqls1BD8vzizSQBDdI =
                new _VHWgt8pn9AXryODuVtLv9GmmHeH <ushort, ParseXML>(
                    ParseXML._uLt6b1uwFNgoZycBDqE02WmgdfB(parsedObjects));

            Program.LogInfoMessage("core", "Parsing Packets...");
            _PP85pw5fC3jVm7LDMzFra717hdB =
                new _VHWgt8pn9AXryODuVtLv9GmmHeH <byte, PacketStructure>(
                    PacketStructure._uLt6b1uwFNgoZycBDqE02WmgdfB(parsedPackets));

            Program.LogInfoMessage("core", "Parsing Tiles...");
            GetTile =
                new _VHWgt8pn9AXryODuVtLv9GmmHeH <ushort, TileStructure>(
                    TileStructure._uLt6b1uwFNgoZycBDqE02WmgdfB(parsedTiles));
            return;
        }
        finally {
            ((IDisposable)webClient).Dispose();
        }
    }
Exemplo n.º 10
0
    //TODO: Add Place method for items
    public void AddTile(Vector2 vector)
    {
        Int2 temp = new Int2((int)vector.x, (int)vector.y);


        //Use the GetRandomTile method to find some random tile within the this tiles collection
        TileStructure tempTile = GetRandomTile();

        //using that random tile set the new tiles parent in the dungeonGenerators disjoint set of all
        //tiles to be that tiles parent.
        DungeonGenerator.instance.tileArray.Parent[(((int)vector.y - 1) * DungeonGenerator.instance._dungeonWidth) + (int)vector.x]
            = (((int)tempTile.location.y - 1) * DungeonGenerator.instance._dungeonWidth) + (int)tempTile.location.x;

        //Adding the tile to this rooms dictionary of tiles
        //It gets the tile from the dungeonGenerators list of all tile structures.
        tiles.Add(temp, DungeonGenerator.instance.allTiles
                  [(((int)vector.y - 1) * DungeonGenerator.instance._dungeonWidth) + (int)vector.x]);
    }
Exemplo n.º 11
0
        private IntroMovieSet(
            TileStructure shipExterior,
            TileStructure shipInterior,
            int extTileLeft,
            int extTileTop,
            int intTileLeft,
            int intTileTop,
            bool isFlipped
            ) : this(extTileLeft, extTileTop, intTileLeft, intTileTop)
        {
            shipExterior.PaintToWorld(
                leftTileX: extTileLeft,
                topTileY: extTileTop,
                paintAir: false,
                respectLiquids: true,
                flipHorizontally: isFlipped,
                flipVertically: false
                );
            shipInterior.PaintToWorld(
                leftTileX: intTileLeft,
                topTileY: intTileTop,
                paintAir: false,
                respectLiquids: true,
                flipHorizontally: isFlipped,
                flipVertically: false
                );

            //

            var nonDeckPattern = new TilePattern(new TilePatternBuilder {
                IsNotAnyOfType = new HashSet <int> {
                    TileID.Platforms
                }
            });

            this.ExteriorDeckWidth = TileFinderHelpers.GetFloorWidth(
                nonFloorPattern: nonDeckPattern,
                tileX: extTileLeft + (shipExterior.Bounds.Width / 2),
                tileY: extTileTop,
                maxFallRange: 50,
                floorX: out this.ExteriorDeckX,
                floorY: out this.ExteriorDeckY
                );
        }
Exemplo n.º 12
0
    // Use this for initialization
    public void MakeGrid(bool enabled)
    {
        enableTiles = enabled;
        // Find a corner of the plane to start from.
        Vector3 cornerPosition = FindCorner();

        // Calculate gridsize.
        sizeX = (int)Math.Floor(planeSize * transform.lossyScale.x / tileSize);
        sizeY = (int)Math.Floor(planeSize * transform.lossyScale.z / tileSize);
        // Create the grid.
        grid = new TileStructure[sizeX, sizeY];
        for (int x = 0; x < sizeX; x++)
        {
            for (int y = 0; y < sizeY; y++)
            {
                TileStructure newTile;
                // Transform loop index to Position
                Vector3 deltaPosition = new Vector3(x, terrainHeight, y);
                // Calculate world position
                Vector3 spawnPosition = cornerPosition + tileSize * deltaPosition;
                spawnPosition.y = terrainHeight;
                // If the terrain under the spawnPosition is high enough, it is free for building.
                if (Terrain.activeTerrain.SampleHeight(spawnPosition) > (terrainHeight - terrainHeightThreshold))
                {
                    newTile = new TileStructure(x, y, eTile.Free, SpawnTile(spawnPosition, x, y, true));
                }
                // If it is smaller, it is part of the path
                else
                {
                    newTile = new TileStructure(x, y, eTile.Path, SpawnTile(spawnPosition, x, y, false));
                    newTile.obj.GetComponent <IncreaseValueOnTriggerEnter>().tile = newTile;
                }
                if (!enableTiles)
                {
                    newTile.obj.SetActive(false);
                }
                grid[x, y] = newTile;
            }
        }
        myGrid = new GridStructure(sizeX, sizeY, grid);
    }
Exemplo n.º 13
0
    public void BuildTower(TowerStructure tower, TileStructure tile)
    {
        if (grid == null)
        {
            grid = GetComponentInChildren <GridMaker>().GetGrid();
        }
        GameObject go = (GameObject)Instantiate(tower.prefab);

        go.transform.position = tile.obj.transform.position;
        go.transform.SetParent(transform);
        tile.type = eTile.Tower;

        if (grid == null)
        {
            grid = GetComponentInChildren <GridMaker>().GetGrid();
        }
        grid.tiles[tile.xPos, tile.yPos].tower = go;
        go.GetComponent <BaseTower>().posX     = tile.xPos;
        go.GetComponent <BaseTower>().posY     = tile.yPos;
        Debug.Log("Build at: " + tile.xPos + " / " + tile.yPos);
    }
Exemplo n.º 14
0
        public static void Load()
        {
            Parallel.Invoke(
                () =>
            {
                try
                {
                    Items = new GameDataMap <ushort, ItemStructure>(ItemStructure.Load(XDocument.Load("Objects.xml")));
                    PluginUtils.Log("GameData", "loaded items from file!");
                }
                catch
                {
                    Items = new GameDataMap <ushort, ItemStructure>(ItemStructure.Load(XDocument.Parse(RawObjectsXML)));
                }
                PluginUtils.Log("GameData", "Mapped {0} items.", Items.Map.Count);
            },
                () =>
            {
                try
                {
                    Tiles = new GameDataMap <ushort, TileStructure>(TileStructure.Load(XDocument.Load("Tiles.xml")));
                    PluginUtils.Log("GameData", "loaded tiles from file!");
                }
                catch
                {
                    Tiles = new GameDataMap <ushort, TileStructure>(TileStructure.Load(XDocument.Parse(RawTilesXML)));
                }
                PluginUtils.Log("GameData", "Mapped {0} tiles.", Tiles.Map.Count);
            },
                () =>
            {
                try
                {
                    Objects = new GameDataMap <ushort, ObjectStructure>(ObjectStructure.Load(XDocument.Load("Objects.xml")));
                    PluginUtils.Log("GameData", "loaded objects from file!");
                }
                catch
                {
                    Objects = new GameDataMap <ushort, ObjectStructure>(ObjectStructure.Load(XDocument.Parse(RawObjectsXML)));
                }
                PluginUtils.Log("GameData", "Mapped {0} objects.", Objects.Map.Count);
            },
                () =>
            {
                try
                {
                    Packets = new GameDataMap <byte, PacketStructure>(PacketStructure.Load(XDocument.Load("Packets.xml")));
                    PluginUtils.Log("GameData", "loaded packets from file!");
                }
                catch
                {
                    Packets = new GameDataMap <byte, PacketStructure>(PacketStructure.Load(XDocument.Parse(RawPacketsXML)));
                }
                PluginUtils.Log("GameData", "Mapped {0} packets.", Packets.Map.Count);
            },
                () =>
            {
                const string CHAR_LIST_FILE = "char_list.xml";

                XDocument charList = null;

                try
                {
                    charList = XDocument.Load("http://realmofthemadgodhrd.appspot.com/char/list");
                }
                catch (Exception)
                {
                }

                if (charList != null && charList.Element("Error") == null)
                {
                    charList.Save(CHAR_LIST_FILE);
                }
                else if (System.IO.File.Exists(CHAR_LIST_FILE))
                {
                    charList = XDocument.Load(CHAR_LIST_FILE);
                }
                else
                {
                    PluginUtils.Log("GameData", "Error! Unable to retrieve server list.");
                    return;
                }

                Servers = new GameDataMap <string, ServerStructure>(ServerStructure.Load(charList));
                PluginUtils.Log("GameData", "Mapped {0} servers.", Servers.Map.Count);
            });

            PluginUtils.Log("GameData", "Successfully loaded game data.");
        }
Exemplo n.º 15
0
 // Token: 0x0600051D RID: 1309 RVA: 0x0001E7EC File Offset: 0x0001C9EC
 internal bool _cK3tqcFri6sqAZcZMXo2Hx0C43c(TileStructure type)
 {
     return(type._ikFKebqGeYDppnRN94BtlHzztCC <System.UInt16> .ID == this._mWe1fQ384BLZe9PnvAln1y7kKo.Type);
 }
Exemplo n.º 16
0
        public static void Load()
        {
            bool hadError = false;

            Parallel.Invoke(
                () =>
            {
                try
                {
                    Items = new GameDataMap <ushort, ItemStructure>(ItemStructure.Load(XDocument.Load("Objects.xml")));
                    PluginUtils.Log("GameData", "Mapped {0} items.", Items.Map.Count);
                }
                catch (Exception e)
                {
                    hadError = true;
                    PluginUtils.Log("GameData", "Error while reading Objects.xml file: {0}", e.Message);
                }
            },
                () =>
            {
                try
                {
                    Tiles = new GameDataMap <ushort, TileStructure>(TileStructure.Load(XDocument.Load("Tiles.xml")));
                    PluginUtils.Log("GameData", "Mapped {0} tiles.", Tiles.Map.Count);
                }
                catch (Exception e)
                {
                    hadError = true;
                    PluginUtils.Log("GameData", "Error while reading Tiles.xml file: {0}", e.Message);
                }
            },
                () =>
            {
                try
                {
                    Objects = new GameDataMap <ushort, ObjectStructure>(ObjectStructure.Load(XDocument.Load("Objects.xml")));
                    PluginUtils.Log("GameData", "Mapped {0} objects.", Objects.Map.Count);
                }
                catch (Exception e)
                {
                    hadError = true;
                    PluginUtils.Log("GameData", "Error while reading Objects.xml file: {0}", e.Message);
                }
            },
                () =>
            {
                try
                {
                    Packets = new GameDataMap <byte, PacketStructure>(PacketStructure.Load(XDocument.Load("Packets.xml")));
                    PluginUtils.Log("GameData", "Mapped {0} packets.", Packets.Map.Count);
                }
                catch (Exception e)
                {
                    hadError = true;
                    PluginUtils.Log("GameData", "Error while reading Packets.xml file: {0}", e.Message);
                }
            },
                () =>
            {
                const string CHAR_LIST_FILE = "char_list.xml";

                XDocument charList = null;

                try
                {
                    charList = XDocument.Load("https://www.realmofthemadgod.com/char/list");
                }
                catch (Exception e)
                {
                    hadError = true;
                    PluginUtils.Log("GameData", "Error while fetching /char/list: {0}", e.Message);
                }

                // If the char list doesn't contain an error
                if (charList != null && charList.Element("Error") == null)
                {
                    // Make a backup of the char list
                    charList.Save(CHAR_LIST_FILE);
                }
                // If the backup char list file exists
                else if (System.IO.File.Exists(CHAR_LIST_FILE))
                {
                    charList = XDocument.Load(CHAR_LIST_FILE);
                }
                // The retrieved char list contains an error and a backup char list doesn't exist
                else
                {
                    PluginUtils.Log("GameData", "Cannot retrieve server list and no cache exists.");
                    hadError = true;
                    return;
                }

                Servers = new GameDataMap <string, ServerStructure>(ServerStructure.Load(charList));
                PluginUtils.Log("GameData", "Mapped {0} servers.", Servers.Map.Count);
            });

            if (hadError)
            {
                PluginUtils.Log("GameData", "One or more game data files could not be loaded.");
            }
            else
            {
                PluginUtils.Log("GameData", "Successfully loaded game data.");
            }
        }
Exemplo n.º 17
0
        public static void Load()
        {
            Parallel.Invoke(
                // Items
                () =>
            {
                try
                {
                    Items = new GameDataMap <ushort, ItemStructure>(ItemStructure.Load(XDocument.Load(OBJECTS_FILE)));
                    GameDataLog($"Loaded items from file \"{OBJECTS_FILE}\".");
                }
                catch
                {
                    Items = new GameDataMap <ushort, ItemStructure>(ItemStructure.Load(XDocument.Parse(RawObjectsXML)));
                    GameDataLog("Loaded items from \"Resources.Objects\".");
                }

                GameDataLog("Mapped {0} items.", Items.Map.Count);
            },
                // Tiles
                () =>
            {
                try
                {
                    Tiles = new GameDataMap <ushort, TileStructure>(TileStructure.Load(XDocument.Load(TILES_FILE)));
                    GameDataLog($"Loaded tiles from file \"{TILES_FILE}\".");
                }
                catch
                {
                    Tiles = new GameDataMap <ushort, TileStructure>(TileStructure.Load(XDocument.Parse(RawTilesXML)));
                    GameDataLog("Loaded tiles from \"Resources.Tiles\".");
                }

                GameDataLog("Mapped {0} tiles.", Tiles.Map.Count);
            },
                // Objects
                () =>
            {
                try
                {
                    Objects = new GameDataMap <ushort, ObjectStructure>(ObjectStructure.Load(XDocument.Load(OBJECTS_FILE)));
                    GameDataLog($"Loaded objects from file \"{OBJECTS_FILE}\".");
                }
                catch
                {
                    Objects = new GameDataMap <ushort, ObjectStructure>(ObjectStructure.Load(XDocument.Parse(RawObjectsXML)));
                    GameDataLog("Loaded objects from \"Resources.Objects\".");
                }

                GameDataLog("Mapped {0} objects.", Objects.Map.Count);
            },
                // Packets
                () =>
            {
                try
                {
                    Packets = new GameDataMap <byte, PacketStructure>(PacketStructure.Load(XDocument.Load(PACKETS_FILE)));
                    GameDataLog($"Loaded packets from file \"{PACKETS_FILE}\".");
                }
                catch
                {
                    Packets = new GameDataMap <byte, PacketStructure>(PacketStructure.Load(XDocument.Parse(RawPacketsXML)));
                    GameDataLog("Loaded packets from \"Resources.Packets\".");
                }

                GameDataLog("Mapped {0} packets.", Packets.Map.Count);
            },
                // char/list
                () =>
            {
                const string CHAR_LIST_FILE = "char_list.xml";

                XDocument charList = null;

                try
                {
                    charList = XDocument.Load("http://realmofthemadgodhrd.appspot.com/char/list");
                }
                catch (Exception)
                {
                }

                // If the char list doesn't contain an error
                if (charList != null && charList.Element("Error") == null)
                {
                    // Make a backup of the char list
                    charList.Save(CHAR_LIST_FILE);
                }
                // If the backup char list file exists
                else if (File.Exists(CHAR_LIST_FILE))
                {
                    charList = XDocument.Load(CHAR_LIST_FILE);
                }
                // The retrieved char list contains an error and a backup char list doesn't exist
                else
                {
                    GameDataLog("Error! Unable to retrieve server list.");
                    return;
                }

                Servers = new GameDataMap <string, ServerStructure>(ServerStructure.Load(charList));
                GameDataLog("Mapped {0} servers.", Servers.Map.Count);
            });

            GameDataLog("Successfully loaded game data.");
        }
Exemplo n.º 18
0
 public Tile(Vector3 location, TileStructure structure = null)
 {
     tileStructure = (structure != null) ? structure : new TileStructure();
     this.location = tileStructure.location = location;
 }
Exemplo n.º 19
0
 public RatedPosition(TileStructure t, int rating)
 {
     tile        = t;
     this.rating = rating;
 }
Exemplo n.º 20
0
        public static void Load()
        {
            List <string> errors = new List <string>();

            Parallel.Invoke(
                () => {
                try
                {
                    Items = new GameDataMap <ushort, ItemStructure>(ItemStructure.Load(XDocument.Load(Path.Combine("Resources", "Objects.xml"))));
                } catch
                {
                    // If Objects.xml is missing the error is reported later on, so don't report it here.
                    Items = new GameDataMap <ushort, ItemStructure>(ItemStructure.Load(XDocument.Parse(RawObjectsXML)));
                }
                PluginUtils.Log("GameData", "Mapped {0} items.", Items.Map.Count);
            },
                () => {
                try
                {
                    Tiles = new GameDataMap <ushort, TileStructure>(TileStructure.Load(XDocument.Load(Path.Combine("Resources", "Tiles.xml"))));
                    PluginUtils.Log("GameData", "Loaded Tiles from Tiles.xml");
                }
                catch (Exception e)
                {
                    errors.Add(string.Format("(Tiles.xml) {0}", e.Message));
                    PluginUtils.Log("GameData", "Using Tiles.xml resource fallback.");
                    Tiles = new GameDataMap <ushort, TileStructure>(TileStructure.Load(XDocument.Parse(RawTilesXML)));
                }
                PluginUtils.Log("GameData", "Mapped {0} tiles.", Tiles.Map.Count);
            },
                () => {
                try
                {
                    Objects = new GameDataMap <ushort, ObjectStructure>(ObjectStructure.Load(XDocument.Load(Path.Combine("Resources", "Objects.xml"))));
                    PluginUtils.Log("GameData", "Loaded Objects from Objects.xml");
                }
                catch (Exception e)
                {
                    errors.Add(string.Format("(Objects.xml) {0}", e.Message));
                    PluginUtils.Log("GameData", "Using Objects.xml resource fallback.");
                    Objects = new GameDataMap <ushort, ObjectStructure>(ObjectStructure.Load(XDocument.Parse(RawObjectsXML)));
                }
                PluginUtils.Log("GameData", "Mapped {0} objects.", Objects.Map.Count);
            },
                () => {
                try
                {
                    Packets = new GameDataMap <byte, PacketStructure>(PacketStructure.Load(XDocument.Load(Path.Combine("Resources", "Packets.xml"))));
                    PluginUtils.Log("GameData", "Loaded Packets from Packets.xml");
                }
                catch (Exception e)
                {
                    errors.Add(string.Format("(Packets.xml) {0}", e.Message));
                    PluginUtils.Log("GameData", "Using Packets.xml resource fallback.");
                    Packets = new GameDataMap <byte, PacketStructure>(PacketStructure.Load(XDocument.Parse(RawPacketsXML)));
                }
                PluginUtils.Log("GameData", "Mapped {0} packets.", Packets.Map.Count);
            },
                () => {
                const string CHAR_LIST_FILE = "char_list.xml";

                XDocument charList = null;

                try
                {
                    charList = XDocument.Load("http://realmofthemadgodhrd.appspot.com/char/list");
                }
                catch (Exception) { }

                // If the char list doesn't contain an error
                if (charList != null && charList.Element("Error") == null)
                {
                    // Make a backup of the char list
                    charList.Save(CHAR_LIST_FILE);
                }
                // If the backup char list file exists
                else if (System.IO.File.Exists(CHAR_LIST_FILE))
                {
                    charList = XDocument.Load(CHAR_LIST_FILE);
                }
                // The retrieved char list contains an error and a backup char list doesn't exist
                else
                {
                    PluginUtils.Log("GameData", "Error! Unable to retrieve server list.");
                    return;
                }

                Servers = new GameDataMap <string, ServerStructure>(ServerStructure.Load(charList));
                PluginUtils.Log("GameData", "Mapped {0} servers.", Servers.Map.Count);
            });

            if (errors.Count == 0)
            {
                PluginUtils.Log("GameData", "Successfully loaded game data.");
            }
            else
            {
                Console.WriteLine();
                PluginUtils.Log("GameData", "{0} Error{1} encountered while loading game data.", errors.Count, errors.Count == 1 ? "" : "s");
                PluginUtils.Log("GameData", "It is recommended to fix these issues before using KRelay.");
                for (int i = 0; i < errors.Count; i++)
                {
                    PluginUtils.Log("GD Error", "\t{0}: {1}", i + 1, errors[i]);
                }
                Console.WriteLine();
            }
        }
Exemplo n.º 21
0
 internal bool _qLjbfvpvv4ok8fhIivprcWtJuAB(TileStructure type)
 {
     return(type.ID == _gNqSu0ttbd15HIOb5VM8P14kmgd._TileType);
 }