Exemplo n.º 1
0
        public void OpenBoard(int index)
        {
            if (this.ParentBoard != null)
            {
                this.ParentBoard.EntitiesToRemove.Add(this);
                this.ParentBoard.SaveToFile(this.ParentBoard.BoardNum);
            }
            var n = NoxicoGame.Me;

            this.ParentBoard = n.GetBoard(index);
            n.CurrentBoard   = this.ParentBoard;
            this.ParentBoard.Entities.Add(this);
            ParentBoard.CheckCombatStart();
            ParentBoard.CheckCombatFinish();
            ParentBoard.UpdateLightmap(this, true);
            ParentBoard.Redraw();
            ParentBoard.PlayMusic();
            NoxicoGame.Immediate = true;

            if (ParentBoard.BoardType == BoardType.Town)
            {
                var boardName = ParentBoard.Name;
                var known     = NoxicoGame.TravelTargets.ContainsValue(boardName);
                if (!known)
                {
                    NoxicoGame.TravelTargets.Add(index, boardName);
                    Program.WriteLine("Registered {0} as a fast-travel target.", boardName);
                }
            }

            this.ParentBoard.AimCamera(XPosition, YPosition);

            if (this.DijkstraMap != null)
            {
                this.DijkstraMap.UpdateWalls(ParentBoard, !Character.IsSlime);
                this.DijkstraMap.Update();
            }
            if (this.AutoTravelMap == null)
            {
                this.AutoTravelMap = new Dijkstra(this.ParentBoard);
                this.AutoTravelMap.Hotspots.Add(new Point(this.XPosition, this.YPosition));
            }
            this.AutoTravelMap.UpdateWalls(ParentBoard, !Character.IsSlime);
        }