當前位置: 首頁>>代碼示例>>C#>>正文


C# ClientMessage.PopWiredInt32方法代碼示例

本文整理匯總了C#中Snowlight.Communication.ClientMessage.PopWiredInt32方法的典型用法代碼示例。如果您正苦於以下問題:C# ClientMessage.PopWiredInt32方法的具體用法?C# ClientMessage.PopWiredInt32怎麽用?C# ClientMessage.PopWiredInt32使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Snowlight.Communication.ClientMessage的用法示例。


在下文中一共展示了ClientMessage.PopWiredInt32方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: AlertRoom

        private static void AlertRoom(Session Session, ClientMessage Message)
        {
            if (!Session.HasRight("moderation_tool"))
            {
                return;
            }

            RoomInstance Instance = RoomManager.GetInstanceByRoomId(Session.CurrentRoomId);

            if (Instance == null)
            {
                Session.SendData(NotificationMessageComposer.Compose("Could not send room alert."));
                return;
            }

            int Unknown1 = Message.PopWiredInt32();
            int AlertMode = Message.PopWiredInt32();
            string AlertMessage = Message.PopString();
            bool IsCaution = AlertMode != 3;

            Instance.SendModerationAlert(AlertMessage, IsCaution);

            using (SqlDatabaseClient MySqlClient = SqlDatabaseManager.GetClient())
            {
                ModerationLogs.LogModerationAction(MySqlClient, Session, "Sent room " + (IsCaution ? "caution" : "message"),
                    "Room " + Instance.Info.Name + " (ID " + Instance.RoomId + "): '" + AlertMessage + "'");
            }
        }
開發者ID:fuding,項目名稱:Snowlight,代碼行數:28,代碼來源:ModerationHandler.cs

示例2: ApplyEffect

        private static void ApplyEffect(Session Session, ClientMessage Message)
        {
            int EffectSpriteId = Message.PopWiredInt32();

            if (EffectSpriteId < 0)
            {
                EffectSpriteId = 0;
            }

            RoomInstance Instance = RoomManager.GetInstanceByRoomId(Session.CurrentRoomId);

            if (Instance == null)
            {
                return;
            }

            RoomActor Actor = Instance.GetActorByReferenceId(Session.CharacterId);

            if (Actor == null || (EffectSpriteId != 0 && !Session.AvatarEffectCache.HasEffect(EffectSpriteId, true)))
            {
                return;
            }

            Actor.ApplyEffect(EffectSpriteId);
            Session.CurrentEffect = EffectSpriteId;
        }
開發者ID:habb0,項目名稱:Snowlight,代碼行數:26,代碼來源:Inventory.cs

示例3: SubmitAnswer

        private static void SubmitAnswer(Session Session, ClientMessage Message)
        {
            RoomInstance Instance = RoomManager.GetInstanceByRoomId(Session.CurrentRoomId);

            if (Instance == null)
            {
                return;
            }

            RoomActor Actor = Instance.GetActorByReferenceId(Session.CharacterId);

            if (Actor == null)
            {
                return;
            }

            int AnswerId = Message.PopWiredInt32();

            lock (mInfobusQuestions)
            {
                if (mInfobusQuestions.ContainsKey(Instance.RoomId))
                {
                    mInfobusQuestions[Instance.RoomId].SubmitAnswer(Actor.Id, AnswerId);
                }
            }
        }
開發者ID:habb0,項目名稱:Snowlight,代碼行數:26,代碼來源:InfobusManager.cs

示例4: BanUser

        private static void BanUser(Session Session, ClientMessage Message)
        {
            if (!Session.HasRight("moderation_tool"))
            {
                return;
            }

            uint UserId = Message.PopWiredUInt32();
            string MessageText = Message.PopString();
            double Length = (Message.PopWiredInt32() * 3600);

            Session TargetSession = SessionManager.GetSessionByCharacterId(UserId);

            if (TargetSession == null || TargetSession.HasRight("moderation_tool"))
            {
                Session.SendData(NotificationMessageComposer.Compose("This user is not online or you do not have permission to ban them.\nPlease use housekeeping to ban users that are offline."));
                return;
            }

            SessionManager.StopSession(TargetSession.Id);

            using (SqlDatabaseClient MySqlClient = SqlDatabaseManager.GetClient())
            {
                ModerationBanManager.BanUser(MySqlClient, UserId, MessageText, Session.CharacterId, Length);
                ModerationLogs.LogModerationAction(MySqlClient, Session, "Banned user",
                    "User '" + TargetSession.CharacterInfo.Username + "' (ID " + TargetSession.CharacterId + ") for " +
                    Length + " hours: '" + MessageText + "'");
            }
        }
開發者ID:fuding,項目名稱:Snowlight,代碼行數:29,代碼來源:ModerationHandler.cs

示例5: OnSessionLatencyTest

        private static void OnSessionLatencyTest(Session Session, ClientMessage Message)
        {
            // Sesion timer sends a number to the server and expects it right back.
            // Maybe something to do with latency testing... or a keepalive?
            // Seems like a waste of bandwith since we're using pinging

            Session.SendData(LatencyTestResponseComposer.Compose(Message.PopWiredInt32()));
        }
開發者ID:habb0,項目名稱:Snowlight,代碼行數:8,代碼來源:Global.cs

示例6: ActivateEffect

        private static void ActivateEffect(Session Session, ClientMessage Message)
        {
            AvatarEffect Effect = Session.AvatarEffectCache.GetEffect(Message.PopWiredInt32(), false, true);

            // If we do not have an effect that needs activating OR if we already have an effect
            // of this sort which IS activated, stop.
            if (Effect == null || Session.AvatarEffectCache.HasEffect(Effect.SpriteId, true))
            {
                return;
            }

            Effect.Activate();
            Session.SendData(UserEffectActivatedComposer.Compose(Effect));
        }
開發者ID:habb0,項目名稱:Snowlight,代碼行數:14,代碼來源:Inventory.cs

示例7: OnClientConfig

        private static void OnClientConfig(Session Session, ClientMessage Message)
        {
            int Volume = Message.PopWiredInt32();
            bool Something = Message.PopWiredBoolean();

            if (Volume < 0)
            {
                Volume = 0;
            }

            if (Volume > 100)
            {
                Volume = 100;
            }

            Session.CharacterInfo.ConfigVolume = Volume;
        }
開發者ID:habb0,項目名稱:Snowlight,代碼行數:17,代碼來源:Global.cs

示例8: UpdateMoodlight

        private static void UpdateMoodlight(Session Session, ClientMessage Message)
        {
            RoomInstance Instance = RoomManager.GetInstanceByRoomId(Session.CurrentRoomId);

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

            Item Item = Instance.MoodlightItem;

            if (Item == null)
            {
                return;
            }

            MoodlightData Data = MoodlightData.GenerateFromFlags(Item.Flags);
            int PresetId = Message.PopWiredInt32();
            MoodlightPreset Preset = null;

            if (Data.Presets.ContainsKey(PresetId))
            {
                Preset = Data.Presets[PresetId];
            }

            if (Preset == null)
            {
                return;
            }

            Preset.BackgroundOnly = !Message.PopWiredBoolean();
            Preset.ColorCode = UserInputFilter.FilterString(Message.PopString().Trim());
            Preset.ColorIntensity = Message.PopWiredInt32();

            if (!MoodlightData.IsValidColor(Preset.ColorCode))
            {
                return;
            }

            Item.Flags = Data.ToItemFlagData();
            Item.DisplayFlags = Data.ToDisplayData();

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

            Item.BroadcastStateUpdate(Instance);
        }
開發者ID:habb0,項目名稱:Snowlight,代碼行數:49,代碼來源:RoomItemHandler.cs

示例9: UserDance

        private static void UserDance(Session Session, ClientMessage Message)
        {
            RoomInstance Instance = RoomManager.GetInstanceByRoomId(Session.CurrentRoomId);

            if (Instance == null)
            {
                return;
            }

            RoomActor Actor = Instance.GetActorByReferenceId(Session.CharacterId);

            if (Actor == null || Actor.AvatarEffectId > 0)
            {
                return;
            }

            int DanceId = Message.PopWiredInt32();

            if (DanceId < 0 || DanceId > 4)
            {
                return;
            }

            if (!Session.HasRight("club_regular") && !Session.HasRight("club_vip") && DanceId != 0)
            {
                DanceId = 1;
            }

            Actor.Dance(DanceId);

            QuestManager.ProgressUserQuest(Session, QuestType.SOCIAL_DANCE);
        }
開發者ID:DaimOwns,項目名稱:Snowlight,代碼行數:32,代碼來源:RoomHandler.cs

示例10: SetBadgeOrder

        private static void SetBadgeOrder(Session Session, ClientMessage Message)
        {
            int i = 0;
            Dictionary<int, Badge> NewSettings = new Dictionary<int, Badge>();

            while (Message.RemainingLength > 0)
            {
                if (i > 5)
                {
                    continue;
                }

                int SlotId = Message.PopWiredInt32();
                string BadgeCode = Message.PopString();
                Badge BadgeRef = RightsManager.GetBadgeByCode(BadgeCode);

                if (BadgeRef == null || !Session.BadgeCache.ContainsCode(BadgeCode) || SlotId >= 6 ||
                    SlotId <= 0 || NewSettings.ContainsKey(SlotId))
                {
                    continue;
                }

                NewSettings.Add(SlotId, BadgeRef);

                i++;
            }

            using (SqlDatabaseClient MySqlClient = SqlDatabaseManager.GetClient())
            {
                Session.BadgeCache.UpdateBadgeOrder(MySqlClient, NewSettings);
            }

            RoomInstance Instance = RoomManager.GetInstanceByRoomId(Session.CurrentRoomId);

            if (Instance == null)
            {
                return;
            }

            Instance.BroadcastMessage(RoomUserBadgesComposer.Compose(Session.CharacterId, Session.BadgeCache.EquippedBadges));
            QuestManager.ProgressUserQuest(Session, QuestType.PROFILE_BADGE);
        }
開發者ID:habb0,項目名稱:Snowlight,代碼行數:42,代碼來源:Inventory.cs

示例11: RemoveFromPlaylist

        private static void RemoveFromPlaylist(Session Session, ClientMessage Message)
        {
            RoomInstance Instance = RoomManager.GetInstanceByRoomId(Session.CurrentRoomId);

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

            Item TakenItem = Instance.MusicController.RemoveDisk(Message.PopWiredInt32());
            // playlist will skip to the next item automatically if it has to

            if (TakenItem == null)
            {
                return;
            }

            Session.InventoryCache.Add(TakenItem);

            using (SqlDatabaseClient MySqlClient = SqlDatabaseManager.GetClient())
            {
                TakenItem.MoveToUserInventory(MySqlClient, Session.CharacterId);
            }

            Session.SendData(InventoryItemAddedComposer.Compose(TakenItem));
            Session.SendData(JukeboxDisksComposer.Compose(Session));
            Session.SendData(JukeboxPlaylistComposer.Compose(Instance.MusicController.PlaylistCapacity,
                Instance.MusicController.Playlist.Values.ToList()));
        }
開發者ID:habb0,項目名稱:Snowlight,代碼行數:29,代碼來源:SongManager.cs

示例12: GetRoomChatlog

        private static void GetRoomChatlog(Session Session, ClientMessage Message)
        {
            if (!Session.HasRight("chatlogs"))
            {
                Session.SendData(NotificationMessageComposer.Compose("You are not allowed to use this!"));
                return;
            }

            int Unknown1 = Message.PopWiredInt32();
            uint RoomId = Message.PopWiredUInt32();

            RoomInfo Info = RoomInfoLoader.GetRoomInfo(RoomId);

            if (Info == null)
            {
                Session.SendData(NotificationMessageComposer.Compose("Room not found; could not load chatlogs."));
                return;
            }

            Session.SendData(ModerationRoomChatlogsComposer.Compose(Info, ModerationLogs.GetLogsForRoom(RoomId,
                (UnixTimestamp.GetCurrent() - 3600), UnixTimestamp.GetCurrent())));
        }
開發者ID:fuding,項目名稱:Snowlight,代碼行數:22,代碼來源:ModerationHandler.cs

示例13: OnFriendRemove

        private static void OnFriendRemove(Session Session, ClientMessage Message)
        {
            int Amount = Message.PopWiredInt32();

            // Precaution: limit queries to 50
            if (Amount > 50)
            {
                Amount = 50;
            }

            List<MessengerUpdate> LocalUpdates = new List<MessengerUpdate>();

            using (SqlDatabaseClient MySqlClient = SqlDatabaseManager.GetClient())
            {
                for (int i = 0; i < Amount; i++)
                {
                    uint FriendId = Message.PopWiredUInt32();

                    if (DestroyFriendship(MySqlClient, Session.CharacterId, FriendId))
                    {
                        Session.MessengerFriendCache.RemoveFromCache(FriendId);
                        LocalUpdates.Add(new MessengerUpdate(-1, CharacterInfoLoader.GenerateNullCharacter(FriendId)));

                        Session TargetSession = SessionManager.GetSessionByCharacterId(FriendId); ;

                        if (TargetSession != null)
                        {
                            TargetSession.MessengerFriendCache.RemoveFromCache(Session.CharacterId);
                            TargetSession.SendData(MessengerUpdateListComposer.Compose(new List<MessengerUpdate>() { new MessengerUpdate(-1, CharacterInfoLoader.GenerateNullCharacter(Session.CharacterId)) }));
                        }
                    }
                }
            }

            Session.SendData(MessengerUpdateListComposer.Compose(LocalUpdates));
        }
開發者ID:DaimOwns,項目名稱:Snowlight,代碼行數:36,代碼來源:MessengerHandler.cs

示例14: SetIcon

        private static void SetIcon(Session Session, ClientMessage Message)
        {
            RoomInstance Instance = RoomManager.GetInstanceByRoomId(Session.CurrentRoomId);

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

            int Junk = Message.PopWiredInt32();
            int Background = Message.PopWiredInt32();

            if (Background < 1 || Background > 24)
            {
                Background = 1;
            }

            int Foreground = Message.PopWiredInt32();

            if (Foreground < 0 || Foreground > 11)
            {
                Foreground = 0;
            }

            int ObjectCount = Message.PopWiredInt32();

            Dictionary<int, int> Objects = new Dictionary<int, int>();

            for (int i = 0; (i < ObjectCount && i < 10); i++)
            {
                int Position = Message.PopWiredInt32();
                int Item = Message.PopWiredInt32();

                if (Position < 0 || Position > 10 || Item < 1 || Item > 27 || Objects.ContainsKey(Position))
                {
                    continue;
                }

                Objects.Add(Position, Item);
            }

            Instance.Info.UpdateIcon(Background, Foreground, Objects);
            Session.SendData(RoomUpdatedNotification3Composer.Compose(Instance.RoomId));
            Instance.BroadcastMessage(RoomUpdatedNotification2Composer.Compose(Instance.RoomId));
        }
開發者ID:DaimOwns,項目名稱:Snowlight,代碼行數:45,代碼來源:RoomHandler.cs

示例15: EditRoom

        private static void EditRoom(Session Session, ClientMessage Message)
        {
            RoomInstance Instance = RoomManager.GetInstanceByRoomId(Session.CurrentRoomId);

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

            // [email protected]'s [email protected] is where I handle business. [email protected]@[email protected]@IbuttsechsAAAA

            uint Id = Message.PopWiredUInt32();

            if (Id != Instance.RoomId)
            {
                return;
            }

            string Name = UserInputFilter.FilterString(Message.PopString()).Trim();
            string Description = UserInputFilter.FilterString(Message.PopString()).Trim();
            RoomAccessType AccessType = (RoomAccessType)Message.PopWiredInt32();
            string Password = UserInputFilter.FilterString(Message.PopString()).Trim();
            int UserLimit = Message.PopWiredInt32();
            int CategoryId = Message.PopWiredInt32();
            int TagCount = Message.PopWiredInt32();

            List<string> Tags = new List<string>();

            for (int i = 0; (i < TagCount && i < 2); i++)
            {
                string Tag = UserInputFilter.FilterString(Message.PopString()).Trim().ToLower();

                if (Tag.Length > 32)
                {
                    Tag = Tag.Substring(0, 32);
                }

                if (Tag.Length > 0 && !Tags.Contains(Tag))
                {
                    Tags.Add(Tag);
                }
            }

            bool AllowPets = (Message.ReadBytes(1)[0] == 65);
            bool AllowPetEating = (Message.ReadBytes(1)[0] == 65);
            bool AllowBlocking = (Message.ReadBytes(1)[0] == 65);
            bool HideWalls = (Message.ReadBytes(1)[0] == 65);
            int WallThickness = Message.PopWiredInt32();
            int FloorThickness = Message.PopWiredInt32();

            if (WallThickness < -2 || WallThickness > 1)
            {
                WallThickness = 0;
            }

            if (FloorThickness < -2 || FloorThickness > 1)
            {
                FloorThickness = 0;
            }

            if (HideWalls && !Session.HasRight("club_vip"))
            {
                HideWalls = false;
            }

            if (Name.Length > 60) // was 25
            {
                Name = Name.Substring(0, 60);
            }

            if (Description.Length > 128)
            {
                Description = Description.Substring(0, 128);
            }

            if (Password.Length > 64)
            {
                Password = Password.Substring(0, 64);
            }

            if (UserLimit > Instance.Model.MaxUsers)
            {
                UserLimit = Instance.Model.MaxUsers;
            }

            if (Name.Length == 0)
            {
                Name = "Room";
            }

            if (AccessType == RoomAccessType.PasswordProtected && Password.Length == 0)
            {
                AccessType = RoomAccessType.Open;
            }

            Instance.Info.EditRoom(Name, Description, AccessType, Password, UserLimit, CategoryId, Tags, AllowPets,
                AllowPetEating, AllowBlocking, HideWalls, WallThickness, FloorThickness);

            Session.SendData(RoomUpdatedNotification1Composer.Compose(Instance.RoomId));
            Instance.BroadcastMessage(RoomUpdatedNotification2Composer.Compose(Instance.RoomId));
//.........這裏部分代碼省略.........
開發者ID:DaimOwns,項目名稱:Snowlight,代碼行數:101,代碼來源:RoomHandler.cs


注:本文中的Snowlight.Communication.ClientMessage.PopWiredInt32方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。