public bool Command(ThePalaceEntities dbContext, UInt32 UserID, UInt32 TargetID, params string[] args)
        {
            var sessionState = UserID != 0xFFFFFFFF ? SessionManager.sessionStates[UserID] : null;
            var roomID       = (args.Length > 0 ? args[0].TryParse <Int16>() : null) ?? sessionState?.RoomID ?? 0;

            if (roomID > 0)
            {
                var roomUsers = SessionManager.sessionStates.Values
                                .Where(s => s.RoomID == roomID)
                                .ToList();
                var room = dbContext.GetRoom(roomID);

                if (!room.NotFound)
                {
                    room.Delete(dbContext);
                }

                var sendBusinesses = new List <ISendBusiness>
                {
                    new MSG_ROOMDESC(),
                    new MSG_USERLIST(),
                    new MSG_ROOMDESCEND(),
                };
                var userNew = new MSG_USERNEW();

                foreach (var roomUser in roomUsers)
                {
                    roomID = dbContext.FindRoomID(0, roomUser.Authorized);
                    room   = dbContext.GetRoom(roomID);

                    if (!room.NotFound)
                    {
                        roomUser.RoomID = room.ID;

                        foreach (var sendBusiness in sendBusinesses)
                        {
                            sendBusiness.Send(dbContext, new Message
                            {
                                sessionState = roomUser,
                            });
                        }

                        userNew.SendToRoomID(dbContext, new Message
                        {
                            sessionState = roomUser,
                        });
                    }
                }

                Logger.Log(MessageTypes.Info, $"CMD_DELETEROOM[{sessionState?.AuthUserID ?? -1}]: {room.Name}");
            }

            return(true);
        }
Example #2
0
        public void Receive(ThePalaceEntities dbContext, object message)
        {
            var sessionState  = ((Message)message).sessionState;
            var protocol      = ((Message)message).protocol;
            var inboundPacket = (Protocols.MSG_DOORLOCK)protocol;

            if (inboundPacket.roomID == sessionState.RoomID)
            {
                var room = dbContext.GetRoom(sessionState.RoomID);

                if (!room.NotFound)
                {
                    var hotspotType = room.Hotspots
                                      .Where(s => s.id == inboundPacket.spotID)
                                      .Select(s => (short)s.type)
                                      .FirstOrDefault();

                    if (hotspotType == (short)HotspotTypes.HS_Bolt)
                    {
                        room.Flags |= (int)RoomFlags.RF_Closed;

                        SessionManager.SendToRoomID(sessionState.RoomID, 0, inboundPacket, EventTypes.MSG_DOORLOCK, (Int32)sessionState.UserID);
                    }
                    else
                    {
                        var outboundPacket = new Protocols.MSG_XTALK
                        {
                            text = "The door you are attempting to lock is not a deadbolt!",
                        };

                        sessionState.Send(outboundPacket, EventTypes.MSG_XTALK, 0);
                    }
                }
            }
        }
Example #3
0
        public void Receive(ThePalaceEntities dbContext, object message)
        {
            var sessionState  = ((Message)message).sessionState;
            var protocol      = ((Message)message).protocol;
            var inboundPacket = (Protocols.MSG_SPOTMOVE)protocol;

            if (sessionState.RoomID == inboundPacket.roomID)
            {
                var room = dbContext.GetRoom(sessionState.RoomID);

                if (!room.NotFound)
                {
                    foreach (var spot in room.Hotspots)
                    {
                        if (spot.id == inboundPacket.spotID)
                        {
                            spot.loc = inboundPacket.pos;

                            break;
                        }
                    }

                    room.HasUnsavedAuthorChanges = true;
                    room.HasUnsavedChanges       = true;

                    ServerState.FlushRooms(dbContext);

                    SessionManager.SendToRoomID(sessionState.RoomID, sessionState.UserID, inboundPacket, EventTypes.MSG_SPOTMOVE, 0);
                }
            }
        }
Example #4
0
        public void Receive(ThePalaceEntities dbContext, object message)
        {
            var sessionState  = ((Message)message).sessionState;
            var protocol      = ((Message)message).protocol;
            var inboundPacket = (Protocols.MSG_ROOMINFO)protocol;

            if (sessionState.RoomID == inboundPacket.room.roomID)
            {
                var room = dbContext.GetRoom(sessionState.RoomID);

                if (!room.NotFound)
                {
                    room.Name    = inboundPacket.room.roomName;
                    room.Flags   = inboundPacket.room.roomFlags;
                    room.Picture = inboundPacket.room.roomPicture;
                    room.Artist  = inboundPacket.room.roomArtist;
                    room.FacesID = inboundPacket.room.facesID;

                    //room.HasUnsavedAuthorChanges = true;
                    room.HasUnsavedChanges = true;

                    ServerState.FlushRooms(dbContext);

                    SessionManager.SendToRoomID(sessionState.RoomID, 0, room, EventTypes.MSG_ROOMSETDESC, 0);
                }
            }
        }
Example #5
0
        public void Receive(ThePalaceEntities dbContext, object message)
        {
            var sessionState = ((Message)message).sessionState;
            var room         = dbContext.GetRoom(sessionState.RoomID);

            if (!room.NotFound)
            {
                var hq = (short)(room.Width / 4);
                var vq = (short)(room.Height / 4);

                room.Hotspots.Add(new HotspotRec
                {
                    id  = (short)(room.Hotspots.Count > 0 ? (room.Hotspots.Max(h => h.id) + 1) : 1),
                    loc = new Point
                    {
                        h = 0,
                        v = 0,
                    },
                    Vortexes = new List <Point>
                    {
                        new Point
                        {
                            h = (short)(hq * 1),
                            v = (short)(vq * 1),
                        },
                        new Point
                        {
                            h = (short)(hq * 3),
                            v = (short)(vq * 1),
                        },
                        new Point
                        {
                            h = (short)(hq * 3),
                            v = (short)(vq * 3),
                        },
                        new Point
                        {
                            h = (short)(hq * 1),
                            v = (short)(vq * 3),
                        },
                    },
                });
                room.HasUnsavedAuthorChanges = true;
                room.HasUnsavedChanges       = true;

                ServerState.FlushRooms(dbContext);

                SessionManager.SendToRoomID(sessionState.RoomID, 0, room, EventTypes.MSG_ROOMSETDESC, 0);
            }
        }
Example #6
0
        public void Send(ThePalaceEntities dbContext, object message)
        {
            var sessionState = ((Message)message).sessionState;

            // Send Room 'room'
            var room = dbContext.GetRoom(sessionState.RoomID);

            if (room.NotFound)
            {
                sessionState.Send(null, EventTypes.MSG_NAVERROR, (Int32)NavErrors.SE_RoomUnknown);
            }
            else
            {
                sessionState.Send(room, EventTypes.MSG_ROOMDESC, 0);
            }
        }
Example #7
0
        public void Receive(ThePalaceEntities dbContext, object message)
        {
            var sessionState  = ((Message)message).sessionState;
            var protocol      = ((Message)message).protocol;
            var inboundPacket = (Protocols.MSG_ROOMSETDESC)protocol;
            var room          = dbContext.GetRoom(sessionState.RoomID);

            if (!room.NotFound)
            {
                if (room.ID != inboundPacket.room.ID)
                {
                    inboundPacket.room.ID = room.ID;
                }

                ServerState.roomsCache[room.ID] = inboundPacket.room;
            }

            SessionManager.SendToRoomID(sessionState.RoomID, 0, inboundPacket.room, EventTypes.MSG_ROOMSETDESC, 0);
        }
        public void Receive(ThePalaceEntities dbContext, object message)
        {
            var sessionState  = ((Message)message).sessionState;
            var protocol      = ((Message)message).protocol;
            var inboundPacket = (Protocols.MSG_SPOTINFO)protocol;

            if (sessionState.RoomID == inboundPacket.roomID)
            {
                var room = dbContext.GetRoom(sessionState.RoomID);

                if (!room.NotFound)
                {
                    foreach (var spot in room.Hotspots)
                    {
                        if (spot.id == inboundPacket.spot.id)
                        {
                            spot.name     = inboundPacket.spot.name;
                            spot.type     = inboundPacket.spot.type;
                            spot.state    = inboundPacket.spot.state;
                            spot.states   = inboundPacket.spot.states;
                            spot.script   = inboundPacket.spot.script;
                            spot.dest     = inboundPacket.spot.dest;
                            spot.flags    = inboundPacket.spot.flags;
                            spot.Vortexes = inboundPacket.spot.Vortexes;

                            if (inboundPacket.pictureList != null)
                            {
                                room.Pictures = inboundPacket.pictureList;
                            }

                            break;
                        }
                    }

                    room.HasUnsavedAuthorChanges = true;
                    room.HasUnsavedChanges       = true;

                    ServerState.FlushRooms(dbContext);

                    SessionManager.SendToRoomID(sessionState.RoomID, sessionState.UserID, room, EventTypes.MSG_ROOMSETDESC, 0);
                }
            }
        }
Example #9
0
        public void Receive(ThePalaceEntities dbContext, object message)
        {
            var sessionState  = ((Message)message).sessionState;
            var protocol      = ((Message)message).protocol;
            var inboundPacket = (Protocols.MSG_SPOTDEL)protocol;
            var room          = dbContext.GetRoom(sessionState.RoomID);

            if (!room.NotFound)
            {
                room.Hotspots = room.Hotspots
                                .Where(m => m.id != inboundPacket.spotID)
                                .ToList();

                room.HasUnsavedAuthorChanges = true;
                room.HasUnsavedChanges       = true;

                ServerState.FlushRooms(dbContext);

                SessionManager.SendToRoomID(sessionState.RoomID, 0, room, EventTypes.MSG_ROOMSETDESC, 0);
            }
        }
Example #10
0
        public void Receive(ThePalaceEntities dbContext, object message)
        {
            var sessionState  = ((Message)message).sessionState;
            var protocol      = ((Message)message).protocol;
            var inboundPacket = (Protocols.MSG_PROPMOVE)protocol;;
            var room          = dbContext.GetRoom(sessionState.RoomID);

            if (!room.NotFound)
            {
                if ((room.Flags & (int)RoomFlags.RF_NoLooseProps) != 0)
                {
                    room.LooseProps.Clear();

                    var xtalk = new Protocols.MSG_XTALK
                    {
                        text = "Loose props are disabled in this room.",
                    };

                    SessionManager.Send(sessionState, xtalk, EventTypes.MSG_XTALK, 0);

                    return;
                }

                if (inboundPacket.pos.h < 0 || inboundPacket.pos.v < 0)
                {
                    return;
                }
                else if (inboundPacket.pos.h > room.Width || inboundPacket.pos.v > room.Height)
                {
                    return;
                }
                else if (inboundPacket.propNum >= 0 && inboundPacket.propNum < room.LooseProps.Count)
                {
                    room.LooseProps[inboundPacket.propNum].loc = inboundPacket.pos;
                    room.HasUnsavedChanges = true;

                    SessionManager.SendToRoomID(sessionState.RoomID, 0, inboundPacket, EventTypes.MSG_PROPMOVE, 0);
                }
            }
        }
Example #11
0
        public void Receive(ThePalaceEntities dbContext, object message)
        {
            var sessionState  = ((Message)message).sessionState;
            var protocol      = ((Message)message).protocol;
            var room          = dbContext.GetRoom(sessionState.RoomID);
            var inboundPacket = (Protocols.MSG_PROPNEW)protocol;

            if (!room.NotFound)
            {
                if ((room.Flags & (int)RoomFlags.RF_NoLooseProps) != 0)
                {
                    room.LooseProps.Clear();

                    var xtalk = new Protocols.MSG_XTALK
                    {
                        text = "Loose props are disabled in this room.",
                    };

                    SessionManager.Send(sessionState, xtalk, EventTypes.MSG_XTALK, 0);

                    return;
                }

                room.LooseProps.Add(new LoosePropRec
                {
                    propSpec = inboundPacket.propSpec,
                    loc      = inboundPacket.loc,
                    flags    = 0,
                });

                room.HasUnsavedChanges = true;
            }

            AssetLoader.CheckAssets(sessionState, inboundPacket.propSpec);

            SessionManager.SendToRoomID(sessionState.RoomID, 0, inboundPacket, EventTypes.MSG_PROPNEW, 0);
        }
Example #12
0
        public void Receive(ThePalaceEntities dbContext, object message)
        {
            var sessionState  = ((Message)message).sessionState;
            var protocol      = ((Message)message).protocol;
            var inboundPacket = (Protocols.MSG_SPOTSTATE)protocol;

            if (sessionState.RoomID == inboundPacket.roomID)
            {
                var room = dbContext.GetRoom(sessionState.RoomID);

                if (!room.NotFound)
                {
                    var spot = (HotspotRec)null;

                    for (var j = 0; j < room.Hotspots.Count; j++)
                    {
                        if (room.Hotspots[j].id == inboundPacket.spotID)
                        {
                            spot = room.Hotspots[j];

                            break;
                        }
                    }

                    if (spot != null)
                    {
                        spot.state = inboundPacket.state;
                        room.HasUnsavedAuthorChanges = true;
                        room.HasUnsavedChanges       = true;

                        ServerState.FlushRooms(dbContext);

                        SessionManager.SendToRoomID(sessionState.RoomID, 0, inboundPacket, EventTypes.MSG_SPOTSTATE, 0);
                    }
                }
            }
        }
Example #13
0
        public void Receive(ThePalaceEntities dbContext, object message)
        {
            var sessionState = ((Message)message).sessionState;
            var maxRoomId    = dbContext.Rooms
                               .Select(r => r.RoomId)
                               .Max();
            var maxOrderId = dbContext.Rooms
                             .Select(r => r.OrderID)
                             .Max();

            maxRoomId++;
            maxOrderId++;

            var newRoom = new Rooms
            {
                RoomId       = maxRoomId,
                Name         = $"New Room {maxRoomId}",
                CreateDate   = DateTime.UtcNow,
                OrderID      = maxOrderId,
                MaxOccupancy = 0,
                Flags        = 0,
            };

            dbContext.Rooms.Add(newRoom);

            var newRoomData = new RoomData
            {
                RoomId      = maxRoomId,
                FacesId     = 0,
                Password    = null,
                PictureName = "clouds.png",
                ArtistName  = sessionState.Name,
            };

            dbContext.RoomData.Add(newRoomData);

            dbContext.SaveChanges();

            Logger.Log(MessageTypes.Info, $"MSG_ROOMNEW[{sessionState.AuthUserID}]: {newRoom.Name}");

            var room = dbContext.GetRoom(maxRoomId);

            if (!room.NotFound)
            {
                sessionState.RoomID = room.ID;

                var sendBusinesses = new List <ISendBusiness>
                {
                    new MSG_ROOMDESC(),
                    new MSG_USERLIST(),
                    new MSG_ROOMDESCEND(),
                };

                foreach (var sendBusiness in sendBusinesses)
                {
                    sendBusiness.Send(dbContext, message);
                }

                new MSG_USERNEW().SendToRoomID(dbContext, message);
            }
        }
Example #14
0
        public static Int16 FindRoomID(this ThePalaceEntities dbContext, Int16 roomID = (Int16)0, bool isAuthorized = false)
        {
            var maxRoomOccupancy = ConfigManager.GetValue <int>("MaxRoomOccupancy", 45);
            var entryRoomIDKeys  = ServerState.entryRoomIDs.ToArray();
            var roomCacheKeys    = ServerState.roomsCache.Keys.ToArray();
            var fullRoomIDs      = new List <Int16>();

            var roomIDs = dbContext.Rooms.AsNoTracking()
                          .OrderBy(r => r.OrderID)
                          .Select(r => r.RoomId)
                          .ToList();

            Func <bool> findRoom = () =>
            {
                if (roomID != 0)
                {
                    var roomCount = isAuthorized ? 0 : SessionManager.GetRoomUserCount(roomID);

                    try
                    {
                        if (
                            isAuthorized ||
                            (entryRoomIDKeys.Contains(roomID) && !roomCacheKeys.Contains(roomID)) ||
                            (roomCacheKeys.Contains(roomID) && ServerState.roomsCache[roomID].MaxOccupancy == 0 && roomCount < maxRoomOccupancy) ||
                            (roomCacheKeys.Contains(roomID) && (ServerState.roomsCache[roomID].MaxOccupancy > 0) && roomCount < ServerState.roomsCache[roomID].MaxOccupancy))
                        {
                            return(true);
                        }
                    }
                    catch (Exception ex)
                    {
                        ex.DebugLog();
                    }

                    fullRoomIDs.Add(roomID);
                }

                return(false);
            };

            if (roomID > 0)
            {
                if (findRoom())
                {
                    return(roomID);
                }
            }

            while (true)
            {
                entryRoomIDKeys = ServerState.entryRoomIDs
                                  .Where(r => !fullRoomIDs.Contains(r))
                                  .ToArray();
                roomCacheKeys = ServerState.roomsCache.Keys
                                .Where(r => !fullRoomIDs.Contains(r))
                                .ToArray();

                if (entryRoomIDKeys.Length > 0)
                {
                    roomID = entryRoomIDKeys[RndGenerator.NextSecure((uint)entryRoomIDKeys.Length)];

                    if (findRoom())
                    {
                        return(roomID);
                    }
                }
                else if (roomCacheKeys.Length > 0)
                {
                    roomID = roomCacheKeys[RndGenerator.NextSecure((uint)roomCacheKeys.Length)];

                    if (findRoom())
                    {
                        return(roomID);
                    }
                }
                else
                {
                    roomID = roomIDs
                             .Where(ID => !fullRoomIDs.Contains(ID))
                             .FirstOrDefault();

                    if (roomID == 0)
                    {
                        break;
                    }
                    else
                    {
                        var room = dbContext.GetRoom(roomID);
                        if (!room.NotFound)
                        {
                            if (findRoom())
                            {
                                return(roomID);
                            }
                        }
                    }
                }
            }

            return(0);
        }
Example #15
0
        public void Receive(ThePalaceEntities dbContext, object message)
        {
            var sessionState = ((Message)message).sessionState;
            var protocol     = ((Message)message).protocol;

            if (!sessionState.Authorized)
            {
                if ((sessionState.userFlags & (int)UserFlags.U_Pin) != 0)
                {
                    return;
                }
            }

            var maxRoomOccupancy = ConfigManager.GetValue <int>("MaxRoomOccupancy", 45);
            var inboundPacket    = (Protocols.MSG_ROOMGOTO)protocol;
            var destRoom         = dbContext.GetRoom(inboundPacket.dest);

            if (destRoom.NotFound)
            {
                new MSG_NAVERROR
                {
                    reason = NavErrors.SE_RoomUnknown,
                }.Send(dbContext, message);

                return;
            }
            else if (!sessionState.Authorized)
            {
                var destRoomUserCount = SessionManager.GetRoomUserCount(inboundPacket.dest);

                if ((destRoom.Flags & (int)RoomFlags.RF_WizardsOnly) != 0 || (destRoom.Flags & (int)RoomFlags.RF_Closed) != 0)
                {
                    new MSG_NAVERROR
                    {
                        reason = NavErrors.SE_RoomClosed,
                    }.Send(dbContext, message);

                    return;
                }
                else if ((destRoom.MaxOccupancy > 0 && destRoomUserCount >= destRoom.MaxOccupancy) || (destRoom.MaxOccupancy == 0 && destRoomUserCount >= maxRoomOccupancy))
                {
                    new MSG_NAVERROR
                    {
                        reason = NavErrors.SE_RoomFull,
                    }.Send(dbContext, message);

                    return;
                }
            }

            var nbrUsers    = SessionManager.GetRoomUserCount(sessionState.RoomID, sessionState.UserID);
            var currentRoom = dbContext.GetRoom(sessionState.RoomID);

            if (nbrUsers > 0)
            {
                new MSG_USEREXIT().SendToRoomID(dbContext, message);
            }
            else if (!currentRoom.NotFound)
            {
                currentRoom.Flags &= ~(int)RoomFlags.RF_Closed;
            }

            sessionState.RoomID = inboundPacket.dest;

            if (!sessionState.Authorized)
            {
                var spots = destRoom.Hotspots
                            .Where(s => (s.flags & (int)(HotspotFlags.HS_LandingPad)) != 0)
                            .ToList();
                if (spots.Any())
                {
                    var offset   = (Int32)RndGenerator.NextSecure((UInt32)spots.Count);
                    var vortexes = new List <Point>();
                    var spot     = spots
                                   .Skip(offset)
                                   .Take(1)
                                   .FirstOrDefault();
                    var minH = (Int16)(spot.loc.h + spot.Vortexes[0].h);
                    var maxH = (Int16)(spot.loc.h + spot.Vortexes[0].h);
                    var minV = (Int16)(spot.loc.v + spot.Vortexes[0].v);
                    var maxV = (Int16)(spot.loc.v + spot.Vortexes[0].v);

                    foreach (var vortex in spot.Vortexes)
                    {
                        var p = new Point
                        {
                            h = (Int16)(spot.loc.h + vortex.h),
                            v = (Int16)(spot.loc.v + vortex.v),
                        };

                        vortexes.Add(p);

                        if (p.h < minH)
                        {
                            minH = p.h;
                        }
                        if (p.h > maxH)
                        {
                            maxH = p.h;
                        }
                        if (p.v < minV)
                        {
                            minV = p.v;
                        }
                        if (p.v > maxV)
                        {
                            maxV = p.v;
                        }
                    }

                    do
                    {
                        sessionState.details.roomPos.h = (Int16)RndGenerator.NextSecure((UInt32)minH, (UInt32)maxH);
                        sessionState.details.roomPos.v = (Int16)RndGenerator.NextSecure((UInt32)minV, (UInt32)maxV);

                        if (vortexes.PointInPolygon(sessionState.details.roomPos))
                        {
                            break;
                        }
                    } while (true);
                }
                else
                {
                    sessionState.details.roomPos.h = (Int16)RndGenerator.NextSecure((UInt32)destRoom.Width);
                    sessionState.details.roomPos.v = (Int16)RndGenerator.NextSecure((UInt32)destRoom.Height);
                }
            }
            else
            {
                sessionState.details.roomPos.h = (Int16)RndGenerator.NextSecure((UInt32)destRoom.Width);
                sessionState.details.roomPos.v = (Int16)RndGenerator.NextSecure((UInt32)destRoom.Height);
            }

            var sendBusinesses = new List <ISendBusiness>
            {
                new MSG_ROOMDESC(),
                new MSG_USERLIST(),
                new MSG_ROOMDESCEND(),
            };

            foreach (var sendBusiness in sendBusinesses)
            {
                sendBusiness.Send(dbContext, message);
            }

            new MSG_USERNEW().SendToRoomID(dbContext, message);
        }
Example #16
0
        public void Receive(ThePalaceEntities dbContext, object message)
        {
            var sessionState  = ((Message)message).sessionState;
            var protocol      = ((Message)message).protocol;
            var inboundPacket = (Protocols.MSG_USERMOVE)protocol;
            var room          = dbContext.GetRoom(sessionState.RoomID);

            if (!room.NotFound)
            {
                if (inboundPacket.pos.h < 0 || inboundPacket.pos.v < 0)
                {
                    inboundPacket.pos = sessionState.details.roomPos;

                    SessionManager.Send(sessionState, inboundPacket, EventTypes.MSG_USERMOVE, (Int32)sessionState.UserID);

                    return;
                }
                else if (inboundPacket.pos.h > room.Width || inboundPacket.pos.v > room.Height)
                {
                    inboundPacket.pos = sessionState.details.roomPos;

                    SessionManager.Send(sessionState, inboundPacket, EventTypes.MSG_USERMOVE, (Int32)sessionState.UserID);

                    return;
                }

                if (!sessionState.Authorized)
                {
                    if ((sessionState.userFlags & (int)UserFlags.U_Pin) != 0)
                    {
                        inboundPacket.pos = sessionState.details.roomPos;

                        SessionManager.Send(sessionState, inboundPacket, EventTypes.MSG_USERMOVE, (Int32)sessionState.UserID);

                        return;
                    }

                    var spots = room.Hotspots
                                .Where(s => (s.flags & (int)(HotspotFlags.HS_Forbidden | HotspotFlags.HS_Mandatory)) != 0)
                                .ToList();

                    if (spots.Any())
                    {
                        var valid = (bool?)null;

                        foreach (var spot in spots)
                        {
                            var vortexes = new List <Point>();

                            foreach (var vortex in spot.Vortexes)
                            {
                                vortexes.Add(new Point
                                {
                                    h = (Int16)(spot.loc.h + vortex.h),
                                    v = (Int16)(spot.loc.v + vortex.v),
                                });
                            }

                            if (vortexes.PointInPolygon(inboundPacket.pos))
                            {
                                if ((spot.flags & (int)HotspotFlags.HS_Mandatory) != 0)
                                {
                                    valid = true;

                                    break;
                                }
                                else if ((spot.flags & (int)HotspotFlags.HS_Forbidden) != 0)
                                {
                                    valid = false;

                                    break;
                                }
                            }
                            else if ((spot.flags & (int)HotspotFlags.HS_Mandatory) != 0 && !valid.HasValue)
                            {
                                valid = false;
                            }
                        }

                        if (valid.HasValue && valid.Value == false)
                        {
                            inboundPacket.pos = sessionState.details.roomPos;

                            SessionManager.Send(sessionState, inboundPacket, EventTypes.MSG_USERMOVE, (Int32)sessionState.UserID);

                            return;
                        }
                    }
                }

                sessionState.details.roomPos = inboundPacket.pos;

                SessionManager.SendToRoomID(sessionState.RoomID, sessionState.UserID, inboundPacket, EventTypes.MSG_USERMOVE, (Int32)sessionState.UserID);
            }
        }