示例#1
0
        private static void MoveWallItem(Session Session, ClientMessage Message)
        {
            RoomInstance Instance = RoomManager.GetInstanceByRoomId(Session.CurrentRoomId);

            if (Instance == null || !Instance.CheckUserRights(Session))
            {
                return;
            }

            Item Item = Instance.GetItem(Message.PopWiredUInt32());

            if (Item == null || Item.Definition.Type != ItemType.WallItem)
            {
                return;
            }

            string RawPlacementData = Message.PopString();
            string WallPos          = Instance.SetWallItem(Session, RawPlacementData, Item);

            if (WallPos.Length > 0)
            {
                Item.MoveToRoom(null, Instance.RoomId, new Vector3(0, 0, 0), 0, WallPos);
                RoomManager.MarkWriteback(Item, false);

                Instance.BroadcastMessage(RoomWallItemMovedComposer.Compose(Item));

                ItemEventDispatcher.InvokeItemEventHandler(Session, Item, Instance, ItemEventType.Moved);
            }
        }
示例#2
0
        private static void SaveSticky(Session Session, ClientMessage Message)
        {
            RoomInstance Instance = RoomManager.GetInstanceByRoomId(Session.CurrentRoomId);

            if (Instance == null)
            {
                return;
            }

            Item Item = Instance.GetItem(Message.PopWiredUInt32());

            if (Item == null || Item.Definition.Behavior != ItemBehavior.StickyNote)
            {
                return;
            }

            StickieEditingRights Rights = Instance.GetStickieEditingRights(Session, Item);

            if (Rights == StickieEditingRights.ReadOnly)
            {
                return;
            }

            string RawData = Message.PopString();

            string[] Bits = RawData.Split(' ');

            if (Bits.Length < 2)
            {
                return;
            }

            string Color = Bits[0].ToUpper().Trim();
            string Text  = UserInputFilter.FilterString(RawData.Substring(Color.Length + 1, RawData.Length - (Color.Length + 1))).Trim();

            if (Color != "FFFF33" && Color != "FF9CFF" && Color != "9CCEFF" && Color != "9CFF9C" || Text.Length > 391)
            {
                return;
            }

            Item.Flags        = RawData;
            Item.DisplayFlags = Color;

            if (Rights == StickieEditingRights.GuestEdit)
            {
                Item.Flags += "\n-----\n" + Session.CharacterInfo.Username + "\n" + DateTime.Now.ToShortDateString() + " " + DateTime.Now.ToShortTimeString();
            }

            Instance.RevokeTemporaryStickieRights(Item.Id);

            using (SqlDatabaseClient MySqlClient = SqlDatabaseManager.GetClient())
            {
                Item.SynchronizeDatabase(MySqlClient, true);
            }

            Instance.BroadcastMessage(RoomWallItemMovedComposer.Compose(Item));
        }
示例#3
0
 public void BroadcastStateUpdate(RoomInstance Instance)
 {
     if (mCachedDefinition.Type == ItemType.FloorItem)
     {
         Instance.BroadcastMessage(RoomFloorItemUpdateFlagsComposer.Compose(mId, mDisplayFlags));
     }
     else if (mCachedDefinition.Type == ItemType.WallItem)
     {
         Instance.BroadcastMessage(RoomWallItemMovedComposer.Compose(this));
     }
 }