public EditableRDungeonFloor()
 {
     GroundTile = new Tile();
     HallTile = new Tile();
     WaterTile = new Tile();
     WallTile = new Tile();
     SpecialTiles = new List<EditableRDungeonTrap>();
     Weather = new List<Enums.Weather>();
     Npcs = new List<MapNpcSettings>();
     Items = new List<EditableRDungeonItem>();
     Chambers = new List<EditableRDungeonChamber>();
 }
Beispiel #2
0
 public Map(string mapID)
 {
     MapID = mapID;
     Tile = new Tile[20, 15];
     OriginalTiles = new Maps.Tile[20, 15];
     Npc = new List<MapNpcSettings>();
     MapItems = new MapItem[MaxInfo.MaxMapItems];
     MapNpcs = new MapNpc[MaxInfo.MAX_MAP_NPCS];
     Loaded = false;
     for (int i = 0; i < MaxInfo.MAX_MAP_NPCS; i++) {
         MapNpcs[i] = new MapNpc();
     }
     for (int i = 0; i < MaxInfo.MaxMapItems; i++) {
         MapItems[i] = new MapItem();
     }
 }
        public static bool CanMove(Enums.Direction dirToTest)
        {
            Maps.Map         map    = Maps.MapHelper.ActiveMap;
            Players.MyPlayer player = Players.PlayerManager.MyPlayer;

            Enums.Direction dir = player.Direction;
            int             x, y;

            //Make sure they aren't asleep, or frozen
            if (player.StatusAilment == Enums.StatusAilment.Freeze || player.StatusAilment == Enums.StatusAilment.Sleep)
            {
                return(false);
            }

            // Make sure they aren't trying to move when they are already moving
            if (player.MovementSpeed != Enums.MovementSpeed.Standing || Globals.GettingMap)
            {
                return(false);
            }



            player.Direction = dirToTest;

            //make sure they aren't exceeding speed limit
            if (player.SpeedLimit == Enums.MovementSpeed.Standing && map.Tile[player.Location.X, player.Location.Y].Type != Enums.TileType.Slippery)
            {
                Messenger.SendPlayerDir();
                return(false);
            }



            //test against post-attack cooldown
            if (!(Players.PlayerManager.MyPlayer.PauseTimer < Globals.Tick))
            {
                Messenger.SendPlayerDir();
                return(false);
            }

            x = player.Location.X;
            y = player.Location.Y;



            switch (dirToTest)
            {
            case Enums.Direction.Up:
                x = player.Location.X;
                y = player.Location.Y - 1;

                player.Direction = Enums.Direction.Up;
                if (y < 0)
                {
                    if (map.Up > 0 && Windows.WindowSwitcher.GameWindow.inMapEditor == false)
                    {
                        if (Logic.Graphics.Renderers.Maps.SeamlessWorldHelper.IsMapSeamless(Enums.MapID.Up))
                        {
                            return(true);
                        }
                        else
                        {
                            Messenger.SendPlayerRequestNewMap(false);
                            Globals.GettingMap = true;
                            return(false);
                        }
                    }
                    else
                    {
                        return(false);
                    }
                }
                break;

            case Enums.Direction.Down:
                x = player.Location.X;
                y = player.Location.Y + 1;

                if (y > map.MaxY)
                {
                    if (map.Down > 0 && Windows.WindowSwitcher.GameWindow.inMapEditor == false)
                    {
                        if (Logic.Graphics.Renderers.Maps.SeamlessWorldHelper.IsMapSeamless(Enums.MapID.Down))
                        {
                            return(true);
                        }
                        else
                        {
                            Messenger.SendPlayerRequestNewMap(false);
                            Globals.GettingMap = true;
                            return(false);
                        }
                    }
                    else
                    {
                        return(false);
                    }
                }
                break;

            case Enums.Direction.Left:
                x = player.Location.X - 1;
                y = player.Location.Y;

                if (x < 0)
                {
                    if (map.Left > 0 && Windows.WindowSwitcher.GameWindow.inMapEditor == false)
                    {
                        if (Logic.Graphics.Renderers.Maps.SeamlessWorldHelper.IsMapSeamless(Enums.MapID.Left))
                        {
                            return(true);
                        }
                        else
                        {
                            Messenger.SendPlayerRequestNewMap(false);
                            Globals.GettingMap = true;
                            return(false);
                        }
                    }
                    else
                    {
                        return(false);
                    }
                }
                break;

            case Enums.Direction.Right:
                x = player.Location.X + 1;
                y = player.Location.Y;

                if (x > map.MaxX)
                {
                    if (map.Right > 0 && Windows.WindowSwitcher.GameWindow.inMapEditor == false)
                    {
                        if (Logic.Graphics.Renderers.Maps.SeamlessWorldHelper.IsMapSeamless(Enums.MapID.Right))
                        {
                            return(true);
                        }
                        else
                        {
                            Messenger.SendPlayerRequestNewMap(false);
                            Globals.GettingMap = true;
                            return(false);
                        }
                    }
                    else
                    {
                        return(false);
                    }
                }
                break;
            }

            if (x < 0 || x > map.MaxX || y < 0 || y > map.MaxY)
            {
                return(false);
            }

            Maps.Tile tile = map.Tile[x, y];

            switch (tile.Type)
            {
            case Enums.TileType.Blocked:
            case Enums.TileType.Sign:
            case Enums.TileType.ScriptedSign:
                if (dir != dirToTest)
                {
                    Messenger.SendPlayerDir();
                }
                return(false);

            case Enums.TileType.Warp: {
                if (Windows.WindowSwitcher.GameWindow.inMapEditor)
                {
                    if (dir != dirToTest)
                    {
                        Messenger.SendPlayerDir();
                    }
                    return(false);
                }
            }
            break;

            case Enums.TileType.LevelBlock:
                if (player.Level > tile.Data1)
                {
                    return(true);
                }
                else
                {
                    if (dir != dirToTest)
                    {
                        Messenger.SendPlayerDir();
                    }
                    return(false);
                }

            case Enums.TileType.Story:
                Messenger.SendPacket(TcpPacket.CreatePacket("isstory", x.ToString(), y.ToString()));
                if (dir != dirToTest)
                {
                    Messenger.SendPlayerDir();
                }
                return(true);

            case Enums.TileType.SpriteBlock:
                if (tile.Data1 == 1)
                {
                    if (player.Sprite == tile.Data2 || player.Sprite == tile.Data3)
                    {
                        return(true);
                    }
                    else
                    {
                        if (dir != dirToTest)
                        {
                            Messenger.SendPlayerDir();
                        }
                        return(false);
                    }
                }
                else if (tile.Data1 == 2)
                {
                    if (player.Sprite != tile.Data2 || player.Sprite != tile.Data3)
                    {
                        return(true);
                    }
                    else
                    {
                        if (dir != dirToTest)
                        {
                            Messenger.SendPlayerDir();
                        }
                        return(false);
                    }
                }
                else
                {
                    if (dir != dirToTest)
                    {
                        Messenger.SendPlayerDir();
                    }
                    return(false);
                }

            case Enums.TileType.MobileBlock: {
                int mobilityList = tile.Data1;
                for (int i = 0; i < 16; i++)
                {
                    if (mobilityList % 2 == 1 && !player.Mobility[i])
                    {
                        if (dir != dirToTest)
                        {
                            Messenger.SendPlayerDir();
                        }
                        return(false);
                    }
                    mobilityList /= 2;
                }
                // use mobility
                return(true);
            }

            //if (tile.Data1 == player.GetActiveRecruit().Class) {
            //    return true;
            //} else if (tile.Data2 == player.GetActiveRecruit().Class) {
            //    return true;
            //} else if (tile.Data3 == player.GetActiveRecruit().Class) {
            //    return true;
            //} else {
            //    if (dir != dirToTest) {
            //        Tcp.Messenger.SendPlayerDir();
            //    }
            //    return false;
            //}
            case Enums.TileType.Key:
            case Enums.TileType.Door:
                if (tile.DoorOpen == false)
                {
                    if (dir != dirToTest)
                    {
                        Messenger.SendPlayerDir();
                    }
                    return(false);
                }
                break;

            case Enums.TileType.LinkShop:
            case Enums.TileType.Assembly:
            case Enums.TileType.Guild:
            case Enums.TileType.Bank:
            case Enums.TileType.Shop:
                //player.MovementLocked = true;
                return(true);
            }

            foreach (IPlayer playerToTest in PlayerManager.Players.GetAllPlayers())
            {
                if (playerToTest.MapID == map.MapID && playerToTest.ScreenActive)
                {
                    if (playerToTest.Location.X == x && playerToTest.Location.Y == y)
                    {
                        if (player.Solid == true)
                        {
                            if (dir != dirToTest)
                            {
                                Messenger.SendPlayerDir();
                            }
                            return(false);
                        }
                    }
                }
            }

            for (int i = 0; i < MaxInfo.MAX_MAP_NPCS; i++)
            {
                if (map.MapNpcs[i].Num > 0 && map.MapNpcs[i].ScreenActive)
                {
                    if (map.MapNpcs[i].Location.X == x && map.MapNpcs[i].Location.Y == y)
                    {
                        if (dir != dirToTest)
                        {
                            Messenger.SendPlayerDir();
                        }
                        return(false);
                    }
                }
            }

            if (dir != dirToTest)
            {
                Messenger.SendPlayerDir();
            }
            return(true);
        }
        public static bool CheckLocked(Enums.Direction dirToTest)
        {
            Maps.Map         map    = Maps.MapHelper.ActiveMap;
            Players.MyPlayer player = Players.PlayerManager.MyPlayer;

            Enums.Direction dir = player.Direction;
            int             x = 0, y = 0;



            switch (dirToTest)
            {
            case Enums.Direction.Up:
                x = player.Location.X;
                y = player.Location.Y - 1;

                break;

            case Enums.Direction.Down:
                x = player.Location.X;
                y = player.Location.Y + 1;


                break;

            case Enums.Direction.Left:
                x = player.Location.X - 1;
                y = player.Location.Y;

                break;

            case Enums.Direction.Right:
                x = player.Location.X + 1;
                y = player.Location.Y;

                break;
            }

            if (x < 0 || x > map.MaxX || y < 0 || y > map.MaxY)
            {
                return(false);
            }

            Maps.Tile tile = map.Tile[x, y];

            switch (tile.Type)
            {
            case Enums.TileType.Story:
            case Enums.TileType.LinkShop:
            case Enums.TileType.Assembly:
            case Enums.TileType.Guild:
            case Enums.TileType.Bank:
            case Enums.TileType.Shop:
            case Enums.TileType.MissionBoard:
            case Enums.TileType.RDungeonGoal:
            case Enums.TileType.Evolution:
            case Enums.TileType.SpriteChange:
            case Enums.TileType.Warp:
            case Enums.TileType.Scripted:

                return(true);
            }

            return(false);
        }
Beispiel #5
0
 public object Clone()
 {
     Tile tile = new Tile();
     tile.Ground = Ground;
     tile.GroundAnim = GroundAnim;
     tile.Mask = Mask;
     tile.Anim = Anim;
     tile.Mask2 = Mask2;
     tile.M2Anim = M2Anim;
     tile.Fringe = Fringe;
     tile.FAnim = FAnim;
     tile.Fringe2 = Fringe2;
     tile.F2Anim = F2Anim;
     tile.Type = Type;
     tile.Data1 = Data1;
     tile.Data2 = Data2;
     tile.Data3 = Data3;
     tile.String1 = String1;
     tile.String2 = String2;
     tile.String3 = String3;
     tile.RDungeonMapValue = RDungeonMapValue;
     tile.GroundSet = GroundSet;
     tile.GroundAnimSet = GroundAnimSet;
     tile.MaskSet = MaskSet;
     tile.AnimSet = AnimSet;
     tile.Mask2Set = Mask2Set;
     tile.M2AnimSet = M2AnimSet;
     tile.FringeSet = FringeSet;
     tile.FAnimSet = FAnimSet;
     tile.Fringe2Set = Fringe2Set;
     tile.F2AnimSet = F2AnimSet;
     return tile;
 }
 public EditableRDungeonTrap()
 {
     SpecialTile = new Tile();
 }