当前位置: 首页>>代码示例>>C#>>正文


C# ClientMessage.PopWiredUInt32方法代码示例

本文整理汇总了C#中Snowlight.Communication.ClientMessage.PopWiredUInt32方法的典型用法代码示例。如果您正苦于以下问题:C# ClientMessage.PopWiredUInt32方法的具体用法?C# ClientMessage.PopWiredUInt32怎么用?C# ClientMessage.PopWiredUInt32使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Snowlight.Communication.ClientMessage的用法示例。


在下文中一共展示了ClientMessage.PopWiredUInt32方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: DeleteSticky

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

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

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

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

            if (Instance.TakeItem(Item.Id))
            {
                Instance.RegenerateRelativeHeightmap();

                using (SqlDatabaseClient MySqlClient = SqlDatabaseManager.GetClient())
                {
                    Item.RemovePermanently(MySqlClient);
                }
            }
        }
开发者ID:habb0,项目名称:Snowlight,代码行数:26,代码来源:RoomItemHandler.cs

示例2: 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

示例3: GetRoomInfo

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

            RoomInfo Info = RoomInfoLoader.GetRoomInfo(Message.PopWiredUInt32());

            if (Info == null)
            {
                Session.SendData(NotificationMessageComposer.Compose("Could not retrieve room information."));
                return;
            }

            Session.SendData(ModerationRoomInfoComposer.Compose(Info, RoomManager.GetInstanceByRoomId(Info.Id)));
        }
开发者ID:fuding,项目名称:Snowlight,代码行数:17,代码来源:ModerationHandler.cs

示例4: OnFriendRequestAccept

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

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

            List<Session> SessionsToUpdate = new List<Session>() { Session };

            for (int i = 0; i < Amount; i++)
            {
                uint RequestId = Message.PopWiredUInt32();

                using (SqlDatabaseClient MySqlClient = SqlDatabaseManager.GetClient())
                {
                    MySqlClient.SetParameter("user1", Session.CharacterId);
                    MySqlClient.SetParameter("user2", RequestId);
                    MySqlClient.SetParameter("confirmed", 1);
                    int Affected = MySqlClient.ExecuteNonQuery("UPDATE messenger_friendships SET confirmed = @confirmed WHERE user_1_id = @user1 AND user_2_id = @user2 LIMIT 1");

                    if (Affected > 0)
                    {
                        MySqlClient.SetParameter("user1", RequestId);
                        MySqlClient.SetParameter("user2", Session.CharacterId);
                        MySqlClient.SetParameter("confirmed", 1);
                        MySqlClient.ExecuteNonQuery("INSERT INTO messenger_friendships (user_1_id,user_2_id,confirmed) VALUES (@user1,@user2,@confirmed)");

                        Session.MessengerFriendCache.AddToCache(RequestId);

                        Session TargetSession = SessionManager.GetSessionByCharacterId(RequestId);

                        if (TargetSession != null)
                        {
                            TargetSession.MessengerFriendCache.AddToCache(Session.CharacterId);
                            SessionsToUpdate.Add(TargetSession);
                        }
                    }
                }
            }

            for (int i = 0; i < 2; i++)
            {
                foreach (Session SessionToUpdate in SessionsToUpdate)
                {
                    ForceMessengerUpdateForSession(SessionToUpdate);
                }
            }
        }
开发者ID:DaimOwns,项目名称:Snowlight,代码行数:51,代码来源:MessengerHandler.cs

示例5: 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

示例6: OnInvite

        private static void OnInvite(Session Session, ClientMessage Message)
        {
            int Count = Message.PopWiredInt32();
            List<uint> Targets = new List<uint>();

            for (int i = 0; (i < Count && i < 50); i++)
            {
                Targets.Add(Message.PopWiredUInt32());
            }

            string MessageText = UserInputFilter.FilterString(Message.PopString());

            if (MessageText.Length > 121)
            {
                MessageText = MessageText.Substring(0, 121);
            }

            List<Session> Users = new List<Session>();

            foreach (uint UserId in Targets)
            {
                if (!Session.MessengerFriendCache.Friends.Contains(UserId))
                {
                    continue;
                }

                Session TargetSession = SessionManager.GetSessionByCharacterId(UserId);

                if (TargetSession == null)
                {
                    continue;
                }

                Users.Add(TargetSession);

                TargetSession.SendData(MessengerImInviteComposer.Compose(Session.CharacterId, Wordfilter.Filter(MessageText)));
            }

            using (SqlDatabaseClient MySqlClient = SqlDatabaseManager.GetClient())
            {
                String to = "";
                foreach (Session User in Users)
                {
                    to += User.CharacterInfo.Username + " [" + User.CharacterId + "], ";
                }
                to = to.Substring(0, to.Length - 2);
                ModerationLogs.LogChatMessage(MySqlClient, Session.CharacterId, 0, "(INVITATION to " + to + ") " + MessageText);
            }
        }
开发者ID:DaimOwns,项目名称:Snowlight,代码行数:49,代码来源:MessengerHandler.cs

示例7: GetSongData

        private static void GetSongData(Session Session, ClientMessage Message)
        {
            int Amount = Message.PopWiredInt32();
            List<SongData> Songs = new List<SongData>();

            for (int i = 0; i < Amount; i++)
            {
                SongData Song = GetSong(Message.PopWiredUInt32());

                if (Song == null)
                {
                    continue;
                }

                Songs.Add(Song);
            }

            Session.SendData(SongDataComposer.Compose(Songs));
        }
开发者ID:habb0,项目名称:Snowlight,代码行数:19,代码来源:SongManager.cs

示例8: GetUserInfo

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

            CharacterInfo Info = null;

            using (SqlDatabaseClient MySqlClient = SqlDatabaseManager.GetClient())
            {
                 Info = CharacterInfoLoader.GetCharacterInfo(MySqlClient, Message.PopWiredUInt32());
            }

            if (Info == null)
            {
                Session.SendData(NotificationMessageComposer.Compose("Could not retrieve user information."));
                return;
            }

            Session.SendData(ModerationUserInfoComposer.Compose(Info, SessionManager.GetSessionByCharacterId(Info.Id)));
        }
开发者ID:fuding,项目名称:Snowlight,代码行数:22,代码来源:ModerationHandler.cs

示例9: KickUser

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

            uint UserId = Message.PopWiredUInt32();
            string MessageText = Message.PopString();

            Session TargetSession = SessionManager.GetSessionByCharacterId(UserId);

            if (TargetSession == null || TargetSession.HasRight("moderation_tool"))
            {
                Session.SendData(NotificationMessageComposer.Compose("That user is not online or cannot be kicked at this point in time."));
                return;
            }

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

            if (Instance == null)
            {
                Session.SendData(NotificationMessageComposer.Compose("That user is not currently in any room."));
                return;
            }

            TargetSession.CharacterInfo.ModerationCautions++;
            Instance.SoftKickUser(TargetSession.CharacterId, true, false, true);
            TargetSession.SendData(NotificationMessageComposer.Compose("A moderator has kicked you from the room for the following reason:\n\n" + MessageText));

            using (SqlDatabaseClient MySqlClient = SqlDatabaseManager.GetClient())
            {
                ModerationLogs.LogModerationAction(MySqlClient, Session, "Kicked user from room",
                    "User '" + TargetSession.CharacterInfo.Username + "' (ID " + TargetSession.CharacterId + ") from '" +
                    Instance.Info.Name + "' (ID " + Instance.RoomId + "): '" + MessageText + "'.");
            }
        }
开发者ID:fuding,项目名称:Snowlight,代码行数:37,代码来源:ModerationHandler.cs

示例10: PlacePet

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

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

            Pet Pet = Session.PetInventoryCache.GetPet(Message.PopWiredUInt32());

            if (Pet == null)
            {
                return;
            }

            Vector2 DesiredPosition = new Vector2(Message.PopWiredInt32(), Message.PopWiredInt32());

            if (!Instance.IsValidPosition(DesiredPosition))
            {
                return;
            }

            Bot BotDefinition = BotManager.GetHandlerDefinitionForPetType(Pet.Type);

            if (BotDefinition == null)
            {
                Session.SendData(NotificationMessageComposer.Compose("This pet cannot be placed right now. Please try again later."));
                return;
            }

            if (!Instance.CanPlacePet(Instance.CheckUserRights(Session, true)))
            {
                Session.SendData(RoomItemPlacementErrorComposer.Compose(RoomItemPlacementErrorCode.PetLimitReached));
                return;
            }

            Vector3 Position = new Vector3(DesiredPosition.X, DesiredPosition.Y, Instance.GetUserStepHeight(DesiredPosition));

            Pet.MoveToRoom(Instance.RoomId, Position);
            Instance.AddBotToRoom(BotManager.CreateNewInstance(BotDefinition, Instance.RoomId, Position, Pet));

            using (SqlDatabaseClient MySqlClient = SqlDatabaseManager.GetClient())
            {
                Pet.SynchronizeDatabase(MySqlClient);
            }

            Session.SendData(InventoryPetRemovedComposer.Compose(Pet.Id));
        }
开发者ID:habb0,项目名称:Snowlight,代码行数:49,代码来源:RoomItemHandler.cs

示例11: RespectPet

        private static void RespectPet(Session Session, ClientMessage Message)
        {
            if (Session.CharacterInfo.RespectCreditPets <= 0)
            {
                return;
            }

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

            if (Instance == null)
            {
                return;
            }

            RoomActor Actor = Instance.GetActorByReferenceId(Message.PopWiredUInt32(), RoomActorType.AiBot);

            if (Actor == null)
            {
                return;
            }

            Pet PetData = ((Bot)Actor.ReferenceObject).PetData;

            if (PetData == null)
            {
                return;
            }

            Session.CharacterInfo.RespectCreditPets = 500;/*--;*/
            PetData.Score++;

            using (SqlDatabaseClient MySqlClient = SqlDatabaseManager.GetClient())
            {
                Session.CharacterInfo.SynchronizeRespectData(MySqlClient);
                PetData.SynchronizeDatabase(MySqlClient);
            }

            Instance.BroadcastMessage(RoomPetUpdateComposer.Compose(Actor.ReferenceId, PetData));
        }
开发者ID:habb0,项目名称:Snowlight,代码行数:39,代码来源:RoomItemHandler.cs

示例12: OpenSticky

        private static void OpenSticky(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;
            }

            Session.SendData(StickyDataComposer.Compose(Item));
        }
开发者ID:habb0,项目名称:Snowlight,代码行数:18,代码来源:RoomItemHandler.cs

示例13: PlaceItem

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

            if (Instance == null)
            {
                return;
            }

            uint ItemId = 0;
            string[] Data = null;

            if (Message.Id == OpcodesIn.ROOM_ITEM_PLACE_STICKY)
            {
                ItemId = Message.PopWiredUInt32();

                string RawData = Message.PopString();
                string[] TmpData = RawData.Split(' ');

                Data = new string[TmpData.Length + 1];
                Data[0] = string.Empty;
                Data[1] = TmpData[0];
                Data[2] = TmpData[1];
                Data[3] = TmpData[2];
            }
            else
            {
                string RawData = Message.PopString();
                Data = RawData.Split(' ');

                uint.TryParse(Data[0], out ItemId);
            }

            Item Item = Session.InventoryCache.GetItem(ItemId);

            if (Item == null)
            {
                return;
            }

            bool HasPlacementRights = Instance.CheckUserRights(Session);
            bool IsPlacingGuestStickie = false;

            if (Item.Definition.Behavior == ItemBehavior.StickyNote && !HasPlacementRights &&
                Instance.GuestsCanPlaceStickies)
            {
                IsPlacingGuestStickie = true;
            }
            else if (!HasPlacementRights)
            {
                Session.SendData(RoomItemPlacementErrorComposer.Compose(RoomItemPlacementErrorCode.InsufficientRights));
                return;
            }

            if (Item.PendingExpiration && Item.ExpireTimeLeft <= 0)
            {
                using (SqlDatabaseClient MySqlClient = SqlDatabaseManager.GetClient())
                {
                    Item.RemovePermanently(MySqlClient);
                }

                Session.InventoryCache.RemoveItem(Item.Id);
                Session.SendData(InventoryItemRemovedComposer.Compose(Item.Id));
                return;
            }

            switch (Item.Definition.Type)
            {
                default:
                case ItemType.FloorItem:

                    if (Data.Length != 4)
                    {
                        return;
                    }

                    int X = 0;
                    int Y = 0;
                    int Rotation = 0;

                    int.TryParse(Data[1], out X);
                    int.TryParse(Data[2], out Y);
                    int.TryParse(Data[3], out Rotation);

                    Vector3 FinalizedPosition = Instance.SetFloorItem(Session, Item, new Vector2(X, Y), Rotation);

                    if (FinalizedPosition != null)
                    {
                        using (SqlDatabaseClient MySqlClient = SqlDatabaseManager.GetClient())
                        {
                            Item.MoveToRoom(MySqlClient, Instance.RoomId, FinalizedPosition, Rotation);
                        }

                        Instance.RegenerateRelativeHeightmap();

                        Session.InventoryCache.RemoveItem(Item.Id);
                        Session.SendData(InventoryItemRemovedComposer.Compose(Item.Id));

                        ItemEventDispatcher.InvokeItemEventHandler(Session, Item, Instance, ItemEventType.Placed);

//.........这里部分代码省略.........
开发者ID:habb0,项目名称:Snowlight,代码行数:101,代码来源:RoomItemHandler.cs

示例14: MoveWallItem

        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);
            }
        }
开发者ID:habb0,项目名称:Snowlight,代码行数:29,代码来源:RoomItemHandler.cs

示例15: MoveFloorItem

        private static void MoveFloorItem(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.FloorItem)
            {
                return;
            }

            Vector2 NewPosition = new Vector2(Message.PopWiredInt32(), Message.PopWiredInt32());
            int NewRotation = Message.PopWiredInt32();

            bool IsRotationOnly = (Item.RoomId == Instance.RoomId && Item.RoomPosition.X == NewPosition.X &&
                    Item.RoomPosition.Y == NewPosition.Y && NewRotation != Item.RoomRotation);

            Vector3 FinalizedPosition = Instance.SetFloorItem(Session, Item, NewPosition, NewRotation);

            if (FinalizedPosition != null)
            {
                Item.MoveToRoom(null, Instance.RoomId, FinalizedPosition, NewRotation, string.Empty);
                RoomManager.MarkWriteback(Item, false);

                Instance.RegenerateRelativeHeightmap();
                Instance.BroadcastMessage(RoomItemUpdatedComposer.Compose(Item));

                ItemEventDispatcher.InvokeItemEventHandler(Session, Item, Instance, ItemEventType.Moved,
                    IsRotationOnly ? 1 : 0);

                QuestManager.ProgressUserQuest(Session, IsRotationOnly ? QuestType.FURNI_ROTATE : QuestType.FURNI_MOVE);

                if (FinalizedPosition.Z > Instance.Model.Heightmap.FloorHeight[FinalizedPosition.X, FinalizedPosition.Y])
                {
                    QuestManager.ProgressUserQuest(Session, QuestType.FURNI_STACK);
                }
            }
        }
开发者ID:habb0,项目名称:Snowlight,代码行数:43,代码来源:RoomItemHandler.cs


注:本文中的Snowlight.Communication.ClientMessage.PopWiredUInt32方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。