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


C# ClientMessage.PopString方法代码示例

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


在下文中一共展示了ClientMessage.PopString方法的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:DaimOwns,项目名称:ProRP,代码行数:28,代码来源:ModerationHandler.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:DaimOwns,项目名称:ProRP,代码行数:29,代码来源:ModerationHandler.cs

示例3: SsoLogin

        private static void SsoLogin(Session Session, ClientMessage Message)
        {
            if (Session.Authenticated)
            {
                return;
            }

            string Ticket = UserInputFilter.FilterString(Message.PopString());
            Session.TryAuthenticate(Ticket, Session.RemoteAddress.ToString());
        }
开发者ID:DaimOwns,项目名称:ProRP,代码行数:10,代码来源:Handshake.cs

示例4: OnUserAgent

        private static void OnUserAgent(Session Session, ClientMessage Message)
        {
            string UserAgent = Message.PopString();

            if (UserAgent.Length > 2000)
            {
                UserAgent = UserAgent.Substring(0, 2000);
            }

            Session.UserAgent = UserAgent;
        }
开发者ID:BjkGkh,项目名称:BobbaRP,代码行数:11,代码来源:Global.cs

示例5: SetFigure

        private static void SetFigure(Session Session, ClientMessage Message)
        {
            // todo: verify data(!!!!)

            string NewGender = Message.PopString().ToLower();
            string NewFigure = UserInputFilter.FilterString(Message.PopString());

            if (NewGender != "m" && NewGender != "f")
            {
                NewGender = "m";
            }

            if (NewFigure.Length == 0 || (NewFigure == Session.CharacterInfo.Figure))
            {
                return;
            }

            using (SqlDatabaseClient MySqlClient = SqlDatabaseManager.GetClient())
            {
                Session.CharacterInfo.UpdateFigure(MySqlClient, NewGender, NewFigure);
                AchievementManager.ProgressUserAchievement(MySqlClient, Session, "ACH_AvatarLooks", 1);
            }

            QuestManager.ProgressUserQuest(Session, QuestType.PROFILE_CHANGE_LOOK);

            Session.SendInfoUpdate();
        }
开发者ID:DaimOwns,项目名称:ProRP,代码行数:27,代码来源:Inventory.cs

示例6: GetPopularRooms

        private static void GetPopularRooms(Session Session, ClientMessage Message)
        {
            if (Session.HasRight("hotel_admin"))
            {
                ServerMessage Response = TryGetResponseFromCache(0, Message);

                if (Response != null)
                {
                    Session.SendData(Response);
                    return;
                }

                int Category = -1;
                int.TryParse(Message.PopString(), out Category);

                IEnumerable<RoomInstance> Rooms =
                    (from RoomInstance in RoomManager.RoomInstances
                     where RoomInstance.Value.Info.Type == RoomType.Flat &&
                        RoomInstance.Value.CachedNavigatorUserCount > 0 &&
                        (Category == -1 || RoomInstance.Value.Info.CategoryId == Category)
                     orderby RoomInstance.Value.CachedNavigatorUserCount descending
                     select RoomInstance.Value).Take(50);

                Response = NavigatorRoomListComposer.Compose(Category, 1, string.Empty, Rooms.ToList());
                AddToCacheIfNeeded(0, Message, Response);
                Session.SendData(Response);
            }
        }
开发者ID:BjkGkh,项目名称:BobbaRP,代码行数:28,代码来源:Navigator.cs

示例7: 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:DaimOwns,项目名称:ProRP,代码行数:49,代码来源:RoomItemHandler.cs

示例8: SaveBranding

        private static void SaveBranding(Session Session, ClientMessage Message)
        {
            uint ItemId = Message.PopWiredUInt32();
            uint Data = Message.PopWiredUInt32();

            string Brand = Message.PopString();
            string Brand2 = Message.PopString();
            string Brand3 = Message.PopString();
            string Brand4 = Message.PopString();
            string Brand5 = Message.PopString();
            string Brand6 = Message.PopString();
            string Brand7 = Message.PopString();
            string Brand8 = Message.PopString();
            string Brand9 = Message.PopString();
            string Brand10 = Message.PopString();
            string BrandData = Brand + "=" + Brand2 + Convert.ToChar(9) + Brand3 + "=" + Brand4 + Convert.ToChar(9) + Brand5 + "=" + Brand6 + Convert.ToChar(9) + Brand7 + "=" + Brand8 + Convert.ToChar(9) + Brand9 + "=" + Brand10 + Convert.ToChar(9) + "state=0";

            RoomInstance Instance = RoomManager.GetInstanceByRoomId(Session.CurrentRoomId);
            Item Item = Instance.GetItem(ItemId);

            Item.Flags = BrandData;
            Item.DisplayFlags = BrandData;
            RoomManager.MarkWriteback(Item, true);

            Item.BroadcastStateUpdate(Instance);

            Instance.RegenerateRelativeHeightmap();
        }
开发者ID:DaimOwns,项目名称:ProRP,代码行数:28,代码来源:RoomItemHandler.cs

示例9: 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:DaimOwns,项目名称:ProRP,代码行数:29,代码来源:RoomItemHandler.cs

示例10: OnSendIm

        private static void OnSendIm(Session Session, ClientMessage Message)
        {
            uint UserId = Message.PopWiredUInt32();
            string Text = UserInputFilter.FilterString(Message.PopString()).Trim();

            if (UserId <= 0 || Text.Length < 1)
            {
                return;
            }

            if (Session.CharacterInfo.IsMuted)
            {
                Session.SendData(MessengerImErrorComposer.Compose(4, UserId));
                return;
            }

            if (!Session.MessengerFriendCache.Friends.Contains(UserId))
            {
                Session.SendData(MessengerImErrorComposer.Compose(6, UserId));
                return;
            }

            Session TargetSession = SessionManager.GetSessionByCharacterId(UserId);

            if (TargetSession == null)
            {
                Session.SendData(MessengerImErrorComposer.Compose(5, UserId));
                return;
            }

            if (TargetSession.CharacterInfo.IsMuted)
            {
                Session.SendData(MessengerImErrorComposer.Compose(3, UserId));
                return;
            }

            TargetSession.SendData(MessengerImMessageComposer.Compose(Session.CharacterId, Text));
            if (Text == ":restart")
            {
                if (!Session.HasRight("hotel_admin"))
                {
                }
                else
                {

                    string reason = "[SYS] Forced update";
                    SessionManager.BroadcastPacket(NotificationMessageComposer.Compose("The server is restarting for an update! \nPlease log back in when you logout.\n\nUpdates don't take long at RealityRP.\n\nReason for Update:\n" + reason));
                    System.Threading.Thread.Sleep(15000);
                    if (System.Diagnostics.Process.GetCurrentProcess().ProcessName + ".exe" == "Reality.exe")
                    {
                        Process.Start(Environment.CurrentDirectory + "\\Reality1.exe", "\"delay 4000\"");
                    }
                    else
                    {
                        Process.Start(Environment.CurrentDirectory + "\\Reality.exe", "\"delay 4000\"");
                    }
                    Program.Stop();
                    Program.Stop();
                }
            }
        }
开发者ID:DaimOwns,项目名称:ProRP,代码行数:61,代码来源:MessengerHandler.cs

示例11: OnMessengerSearch

        private static void OnMessengerSearch(Session Session, ClientMessage Message)
        {
            string SearchQuery = UserInputFilter.FilterString(Message.PopString().Replace('%', ' '));

            if (SearchQuery.Length < 1)
            {
                return;
            }

            List<CharacterInfo> Results = new List<CharacterInfo>();

            using (SqlDatabaseClient MySqlClient = SqlDatabaseManager.GetClient())
            {
                MySqlClient.SetParameter("query", SearchQuery + "%");
                DataTable Table = MySqlClient.ExecuteQueryTable("SELECT id FROM characters WHERE username LIKE @query LIMIT 50");

                foreach (DataRow Row in Table.Rows)
                {
                    Results.Add(CharacterInfoLoader.GetCharacterInfo(MySqlClient, (uint)Row["id"]));
                }
            }

            ReadOnlyCollection<uint> CurrentFriends = Session.MessengerFriendCache.Friends;
            List<CharacterInfo> Friends = new List<CharacterInfo>();
            List<CharacterInfo> NonFriends = new List<CharacterInfo>();

            foreach (CharacterInfo Info in Results)
            {
                if (CurrentFriends.Contains(Info.Id))
                {
                    Friends.Add(Info);
                    continue;
                }

                NonFriends.Add(Info);
            }

            Session.SendData(MessengerSearchResultsComposer.Compose(Friends, NonFriends));
        }
开发者ID:DaimOwns,项目名称:ProRP,代码行数:39,代码来源:MessengerHandler.cs

示例12: 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);
            }

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

                Session TargetSession = SessionManager.GetSessionByCharacterId(UserId);

                if (TargetSession == null)
                {
                    continue;
                }

                TargetSession.SendData(MessengerImInviteComposer.Compose(Session.CharacterId, MessageText));
            }
        }
开发者ID:DaimOwns,项目名称:ProRP,代码行数:34,代码来源:MessengerHandler.cs

示例13: OnFriendRequest

        private static void OnFriendRequest(Session Session, ClientMessage Message)
        {
            string RequestName = UserInputFilter.FilterString(Message.PopString());
            uint TargetId = CharacterResolverCache.GetUidFromName(RequestName);

            if (TargetId < 1 || TargetId == Session.CharacterId)
            {
                return;
            }

            CharacterInfo TargetUserInfo = null;

            using (SqlDatabaseClient MySqlClient = SqlDatabaseManager.GetClient())
            {
                TargetUserInfo = CharacterInfoLoader.GetCharacterInfo(MySqlClient, TargetId);

                if (!TargetUserInfo.PrivacyAcceptFriends)
                {
                    Session.SendData(MessengerErrorEvent.Compose(39, 3));
                    return;
                }

                if (FriendshipExists(MySqlClient, Session.CharacterId, TargetUserInfo.Id, false))
                {
                    return;
                }

                CreateFriendship(MySqlClient, Session.CharacterId, TargetUserInfo.Id, false);
            }

            Session NotifySession = SessionManager.GetSessionByCharacterId(TargetUserInfo.Id);

            if (NotifySession != null)
            {
                NotifySession.SendData(MessengerRequestNoficiationComposer.Compose(Session.CharacterId, Session.CharacterInfo.Username));
            }

            QuestManager.ProgressUserQuest(Session, QuestType.SOCIAL_FRIEND);
        }
开发者ID:DaimOwns,项目名称:ProRP,代码行数:39,代码来源:MessengerHandler.cs

示例14: SetFigure

        private static void SetFigure(Session Session, ClientMessage Message)
        {
            // todo: verify data(!!!!)
            if (Session.CurrentRoomId == 3)
            {
                string NewGender = Message.PopString().ToLower();
                string NewFigure = UserInputFilter.FilterString(Message.PopString());

                if (NewGender != "m" && NewGender != "f")
                {
                    NewGender = "m";
                }

                if (NewFigure.Length == 0 || (NewFigure == Session.CharacterInfo.Figure))
                {
                    return;
                }

                else
                {
                    using (SqlDatabaseClient MySqlClient = SqlDatabaseManager.GetClient())
                    {
                        Session.CharacterInfo.UpdateFigure(MySqlClient, NewGender, NewFigure);
                        AchievementManager.ProgressUserAchievement(MySqlClient, Session, "ACH_AvatarLooks", 1);
                        int newamount = Session.CharacterInfo.CreditsBalance - 4;

                    }

                    QuestManager.ProgressUserQuest(Session, QuestType.PROFILE_CHANGE_LOOK);
                    RoomInstance Instance = RoomManager.GetInstanceByRoomId(Session.CurrentRoomId);
                    RoomActor Actor = (Instance == null ? null : Instance.GetActorByReferenceId(Session.CharacterId));
                    Session.SendData(UserInfoUpdateComposer.Compose(Actor.Id, Actor.Figure, Session.CharacterInfo.Gender, Session.CharacterInfo.Motto, Session.CharacterInfo.Score));
                    Instance.BroadcastMessage(UserInfoUpdateComposer.Compose(Actor.Id, Actor.Figure, Session.CharacterInfo.Gender, Session.CharacterInfo.Motto, Session.CharacterInfo.Score));
                    Session.SendInfoUpdate();
                    Instance.BroadcastMessage(RoomChatComposer.Compose(Actor.Id, "*Freshens up their looks*", 0, ChatType.Shout));
                }
            }
            else
            {
                RoomInstance Instance = RoomManager.GetInstanceByRoomId(Session.CurrentRoomId);
                RoomActor Actor = (Instance == null ? null : Instance.GetActorByReferenceId(Session.CharacterId));

                Session.SendData(RoomChatComposer.Compose(Actor.Id, "You must be in Fitted Clothing [3] to buy clothes!", 0, ChatType.Whisper));
            }
        }
开发者ID:BjkGkh,项目名称:BobbaRP,代码行数:45,代码来源:Inventory.cs

示例15: HandleSave

        public void HandleSave(Session Session, ClientMessage Message)
        {
            uint ItemId = Message.PopWiredUInt32();

            if (!mInstance.CheckUserRights(Session) || !mWired.ContainsKey(ItemId))
            {
                return;
            }

            Item item = mInstance.GetItem(ItemId);

            if (item == null)
            {
                return;
            }

            WiredData data = mWired[ItemId];

            String Data1 = "";
            int Data2 = 0;
            int Data3 = 0;
            int Data4 = 0;
            int Time = 0;
            String Data5 = "";

            Message.PopWiredInt32();
            Data2 = Message.PopWiredInt32();

            Boolean Simple = true;

            if (item.Definition.Behavior == ItemBehavior.WiredEffect)
            {
                switch (WiredTypesUtil.EffectFromInt(item.Definition.BehaviorData))
                {
                    case WiredEffectTypes.match_to_sshot:
                    case WiredEffectTypes.move_rotate:
                    case WiredEffectTypes.teleport_to:
                    case WiredEffectTypes.toggle_state:
                        Simple = false;
                        break;
                }
            }

            if (item.Definition.Behavior == ItemBehavior.WiredTrigger)
            {
                switch (WiredTypesUtil.TriggerFromInt(item.Definition.BehaviorData))
                {
                    case WiredTriggerTypes.state_changed:
                    case WiredTriggerTypes.walks_off_furni:
                    case WiredTriggerTypes.walks_on_furni:
                        Simple = false;
                        break;
                    case WiredTriggerTypes.periodically:
                        item.RequestUpdate(Data2);
                        break;
                }
            }

            if (!Simple)
            {
                Data3 = Message.PopWiredInt32();

                if (item.Definition.Behavior == ItemBehavior.WiredEffect && WiredTypesUtil.EffectFromInt(item.Definition.BehaviorData) == WiredEffectTypes.match_to_sshot)
                {
                    Data4 = Message.PopWiredInt32();
                }

                Message.PopString();
                int c = Message.PopWiredInt32();
                for (int i = 0; i < c; i++)
                {
                    uint tmp = Message.PopWiredUInt32();
                    if (mInstance.GetItem(tmp) == null)
                    {
                        continue;
                    }
                    if (tmp != 0)
                    {
                        Data1 += "" + tmp.ToString() + "|";
                    }
                }

                Time = Message.PopWiredInt32();
            }
            else
            {
                Data1 = Message.PopString();
                Data3 = Message.PopWiredInt32();
            }

            if (item.Definition.Behavior == ItemBehavior.WiredEffect)
            {
                switch (WiredTypesUtil.EffectFromInt(item.Definition.BehaviorData))
                {
                    case WiredEffectTypes.match_to_sshot:
                        String[] Selected = Data1.Split('|');

                        foreach (String ItemIdS in Selected)
                        {
                            uint SelectedItemId;
//.........这里部分代码省略.........
开发者ID:DaimOwns,项目名称:ProRP,代码行数:101,代码来源:WiredManager.cs


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