Пример #1
0
        public void Receive(ThePalaceEntities dbContext, object message)
        {
            var sessionState  = ((Message)message).sessionState;
            var protocol      = ((Message)message).protocol;
            var inboundPacket = (Protocols.MSG_USERPROP)protocol;

            if (!sessionState.Authorized)
            {
                if ((sessionState.userFlags & (int)(UserFlags.U_PropGag | UserFlags.U_Pin)) != 0)
                {
                    inboundPacket.nbrProps = 0;
                    inboundPacket.propSpec = null;

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

                    return;
                }
            }

            sessionState.details.nbrProps = inboundPacket.nbrProps;
            sessionState.details.propSpec = inboundPacket.propSpec;

            AssetLoader.CheckAssets(sessionState, inboundPacket.propSpec);

            SessionManager.SendToRoomID(sessionState.RoomID, 0, inboundPacket, EventTypes.MSG_USERPROP, (Int32)sessionState.UserID);
        }
Пример #2
0
        public void Receive(ThePalaceEntities dbContext, object message)
        {
            var sessionState  = ((Message)message).sessionState;
            var protocol      = ((Message)message).protocol;
            var header        = ((Message)message).header;
            var inboundPacket = (Protocols.MSG_USERDESC)protocol;
            var user          = dbContext.UserData
                                .Where(u => u.UserId == sessionState.UserID)
                                .FirstOrDefault();

            user.FaceNbr  = inboundPacket.faceNbr;
            user.ColorNbr = inboundPacket.colorNbr;

            dbContext.SaveChanges();

            if (!sessionState.Authorized)
            {
                if ((sessionState.userFlags & (int)(UserFlags.U_PropGag | UserFlags.U_Pin)) != 0)
                {
                    sessionState.details.faceNbr  = inboundPacket.faceNbr;
                    sessionState.details.colorNbr = inboundPacket.colorNbr;


                    sessionState.details.nbrProps = 0;
                    sessionState.details.propSpec = null;

                    return;
                }
            }

            sessionState.details.faceNbr  = inboundPacket.faceNbr;
            sessionState.details.colorNbr = inboundPacket.colorNbr;
            sessionState.details.nbrProps = (Int16)inboundPacket.nbrProps;
            sessionState.details.propSpec = inboundPacket.propSpec;

            AssetLoader.CheckAssets(sessionState, inboundPacket.propSpec);

            SessionManager.SendToRoomID(sessionState.RoomID, 0, inboundPacket, (EventTypes)Enum.Parse(typeof(EventTypes), header.eventType), header.refNum);
        }
Пример #3
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);
        }