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


C# GameClient.GetMessageHandler方法代码示例

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


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

示例1: RemoveUserFromRoom

        /// <summary>
        /// Removes the user from room.
        /// </summary>
        /// <param name="session">The session.</param>
        /// <param name="notifyClient">if set to <c>true</c> [notify client].</param>
        /// <param name="notifyKick">if set to <c>true</c> [notify kick].</param>
        internal void RemoveUserFromRoom(GameClient session, bool notifyClient, bool notifyKick)
        {
            try
            {
                if (session == null || session.GetHabbo() == null || UserRoom == null)
                    return;
                var userId = session.GetHabbo().Id;

                session.GetHabbo().GetAvatarEffectsInventoryComponent().OnRoomExit();

                var roomUserByHabbo = GetRoomUserByHabbo(userId);
                if (roomUserByHabbo == null)
                    return;
                if (notifyKick)
                {
                    var room = AzureEmulator.GetGame().GetRoomManager().GetRoom(roomUserByHabbo.RoomId);
                    var model = room.GetGameMap().Model;
                    roomUserByHabbo.MoveTo(model.DoorX, model.DoorY);
                    roomUserByHabbo.CanWalk = false;
                    session.GetMessageHandler()
                        .GetResponse()
                        .Init(LibraryParser.OutgoingRequest("RoomErrorMessageComposer"));
                    session.GetMessageHandler().GetResponse().AppendInteger(4008);
                    session.GetMessageHandler().SendResponse();

                    session.GetMessageHandler()
                        .GetResponse()
                        .Init(LibraryParser.OutgoingRequest("OutOfRoomMessageComposer"));
                    session.GetMessageHandler().GetResponse().AppendShort(2);
                    session.GetMessageHandler().SendResponse();
                }
                else if (notifyClient)
                {
                    var serverMessage =
                        new ServerMessage(LibraryParser.OutgoingRequest("UserIsPlayingFreezeMessageComposer"));
                    serverMessage.AppendBool(roomUserByHabbo.Team != Team.none);
                    roomUserByHabbo.GetClient().SendMessage(serverMessage);
                    session.GetMessageHandler()
                        .GetResponse()
                        .Init(LibraryParser.OutgoingRequest("OutOfRoomMessageComposer"));
                    session.GetMessageHandler().GetResponse().AppendShort(2);
                    session.GetMessageHandler().SendResponse();
                }
                if (roomUserByHabbo.Team != Team.none)
                {
                    UserRoom.GetTeamManagerForBanzai().OnUserLeave(roomUserByHabbo);
                    UserRoom.GetTeamManagerForFreeze().OnUserLeave(roomUserByHabbo);
                }
                if (roomUserByHabbo.RidingHorse)
                {
                    roomUserByHabbo.RidingHorse = false;
                    var horse = GetRoomUserByVirtualId((int)roomUserByHabbo.HorseId);
                    if (horse != null)
                    {
                        horse.RidingHorse = false;
                        horse.HorseId = 0u;
                    }
                }
                if (roomUserByHabbo.IsLyingDown || roomUserByHabbo.IsSitting)
                {
                    roomUserByHabbo.IsSitting = false;
                    roomUserByHabbo.IsLyingDown = false;
                }
                RemoveRoomUser(roomUserByHabbo);
                if (session.GetHabbo() != null && !roomUserByHabbo.IsSpectator)
                {
                    if (roomUserByHabbo.CurrentItemEffect != ItemEffectType.None)
                        roomUserByHabbo.GetClient().GetHabbo().GetAvatarEffectsInventoryComponent().CurrentEffect = -1;
                    if (session.GetHabbo() != null)
                    {
                        if (UserRoom.HasActiveTrade(session.GetHabbo().Id))
                            UserRoom.TryStopTrade(session.GetHabbo().Id);
                        session.GetHabbo().CurrentRoomId = 0;
                        if (session.GetHabbo().GetMessenger() != null)
                            session.GetHabbo().GetMessenger().OnStatusChanged(true);
                    }

                    using (var queryreactor2 = AzureEmulator.GetDatabaseManager().GetQueryReactor())
                        if (session.GetHabbo() != null)
                            queryreactor2.RunFastQuery(string.Concat("UPDATE users_rooms_visits SET exit_timestamp = '", AzureEmulator.GetUnixTimeStamp(), "' WHERE room_id = '", UserRoom.RoomId, "' AND user_id = '", userId, "' ORDER BY exit_timestamp DESC LIMIT 1"));
                }
                UsersByUserId.Remove(roomUserByHabbo.UserId);
                if (session.GetHabbo() != null)
                    UsersByUserName.Remove(session.GetHabbo().UserName.ToLower());
                roomUserByHabbo.Dispose();
            }
            catch (Exception ex)
            {
                Logging.LogCriticalException(string.Format("Error during removing user from room:{0}", ex));
            }
        }
开发者ID:BjkGkh,项目名称:Azure2,代码行数:97,代码来源:RoomUserManager.cs

示例2: ProgressUserAchievement

        /// <summary>
        /// Progresses the user achievement.
        /// </summary>
        /// <param name="Session">The session.</param>
        /// <param name="AchievementGroup">The achievement group.</param>
        /// <param name="ProgressAmount">The progress amount.</param>
        /// <param name="FromZero">if set to <c>true</c> [from zero].</param>
        /// <returns><c>true</c> if XXXX, <c>false</c> otherwise.</returns>
        internal bool ProgressUserAchievement(GameClient Session, string AchievementGroup, int ProgressAmount, bool FromZero = false)
        {
            if (!Achievements.ContainsKey(AchievementGroup) || Session == null)
                return false;
            Achievement achievement = null;
            achievement = Achievements[AchievementGroup];
            UserAchievement userAchievement = Session.GetHabbo().GetAchievementData(AchievementGroup);
            if (userAchievement == null)
            {
                userAchievement = new UserAchievement(AchievementGroup, 0, 0);
                Session.GetHabbo().Achievements.Add(AchievementGroup, userAchievement);
            }
            int count = achievement.Levels.Count;
            if (userAchievement != null && userAchievement.Level == count)
                return false;

            {
                int num = (userAchievement != null) ? (userAchievement.Level + 1) : 1;
                if (num > count)
                    num = count;
                AchievementLevel targetLevelData = achievement.Levels[num];
                int num2 = 0;
                if (FromZero)
                    num2 = ProgressAmount;
                else
                    num2 = ((userAchievement != null) ? (userAchievement.Progress + ProgressAmount) : ProgressAmount);
                int num3 = (userAchievement != null) ? userAchievement.Level : 0;
                int num4 = num3 + 1;
                if (num4 > count)
                    num4 = count;
                if (num2 >= targetLevelData.Requirement)
                {
                    num3++;
                    num4++;
                    num2 = 0;
                    if (num == 1)
                        Session.GetHabbo().GetBadgeComponent().GiveBadge(string.Format("{0}{1}", AchievementGroup, num), true, Session, false);
                    else
                    {
                        Session.GetHabbo().GetBadgeComponent().RemoveBadge(Convert.ToString(string.Format("{0}{1}", AchievementGroup, num - 1)), Session);
                        Session.GetHabbo().GetBadgeComponent().GiveBadge(string.Format("{0}{1}", AchievementGroup, num), true, Session, false);
                    }
                    if (num4 > count)
                        num4 = count;
                    Session.GetHabbo().ActivityPoints += targetLevelData.RewardPixels;
                    Session.GetHabbo().NotifyNewPixels(targetLevelData.RewardPixels);
                    Session.GetHabbo().UpdateActivityPointsBalance();
                    Session.SendMessage(AchievementUnlockedComposer.Compose(achievement, num, targetLevelData.RewardPoints, targetLevelData.RewardPixels));
                    using (IQueryAdapter queryReactor = AzureEmulator.GetDatabaseManager().GetQueryReactor())
                    {
                        queryReactor.SetQuery(string.Concat("REPLACE INTO users_achievements VALUES (", Session.GetHabbo().Id, ", @group, ", num3, ", ", num2, ")"));
                        queryReactor.AddParameter("group", AchievementGroup);
                        queryReactor.RunQuery();
                    }
                    userAchievement.Level = num3;
                    userAchievement.Progress = num2;
                    Session.GetHabbo().AchievementPoints += targetLevelData.RewardPoints;
                    Session.GetHabbo().NotifyNewPixels(targetLevelData.RewardPixels);
                    Session.GetHabbo().ActivityPoints += targetLevelData.RewardPixels;
                    Session.GetHabbo().UpdateActivityPointsBalance();
                    Session.SendMessage(AchievementScoreUpdateComposer.Compose(Session.GetHabbo().AchievementPoints));
                    AchievementLevel targetLevelData2 = achievement.Levels[num4];
                    Session.SendMessage(AchievementProgressComposer.Compose(achievement, num4, targetLevelData2, count, Session.GetHabbo().GetAchievementData(AchievementGroup)));
                    Talent talent = null;
                    if (AzureEmulator.GetGame().GetTalentManager().TryGetTalent(AchievementGroup, out talent))
                        AzureEmulator.GetGame().GetTalentManager().CompleteUserTalent(Session, talent);
                    return true;
                }
                userAchievement.Level = num3;
                userAchievement.Progress = num2;
                using (IQueryAdapter queryreactor2 = AzureEmulator.GetDatabaseManager().GetQueryReactor())
                {
                    queryreactor2.SetQuery(string.Concat("REPLACE INTO users_achievements VALUES (", Session.GetHabbo().Id, ", @group, ", num3, ", ", num2, ")"));
                    queryreactor2.AddParameter("group", AchievementGroup);
                    queryreactor2.RunQuery();
                }

                if (Session == null || Session.GetHabbo() == null) return false;
                Session.SendMessage(AchievementProgressComposer.Compose(achievement, num, targetLevelData, count, Session.GetHabbo().GetAchievementData(AchievementGroup)));
                Session.GetMessageHandler().GetResponse().Init(LibraryParser.OutgoingRequest("UpdateUserDataMessageComposer"));
                Session.GetMessageHandler().GetResponse().AppendInteger(-1);
                Session.GetMessageHandler().GetResponse().AppendString(Session.GetHabbo().Look);
                Session.GetMessageHandler().GetResponse().AppendString(Session.GetHabbo().Gender.ToLower());
                Session.GetMessageHandler().GetResponse().AppendString(Session.GetHabbo().Motto);
                Session.GetMessageHandler().GetResponse().AppendInteger(Session.GetHabbo().AchievementPoints);
                Session.GetMessageHandler().SendResponse();
                return false;
            }
        }
开发者ID:BjkGkh,项目名称:Azure2,代码行数:97,代码来源:AchievementManager.cs

示例3: Execute

 public override void Execute(GameClient session, string[] pms)
 {
     session.GetMessageHandler().Sit();
 }
开发者ID:BjkGkh,项目名称:Azure2,代码行数:4,代码来源:Sit.cs

示例4: HandlePurchase


//.........这里部分代码省略.........
                    session.GetHabbo().Credits -= (int)item.CreditsCost * totalPrice;
                    session.GetHabbo().UpdateCreditsBalance();
                }
                if (item.DucketsCost > 0 && !isGift)
                {
                    session.GetHabbo().ActivityPoints -= (int)item.DucketsCost * totalPrice;
                    session.GetHabbo().UpdateActivityPointsBalance();
                }
                if (item.DiamondsCost > 0 && !isGift)
                {
                    session.GetHabbo().Diamonds -= (int)item.DiamondsCost * totalPrice;
                    session.GetHabbo().UpdateSeasonalCurrencyBalance();
                }
            }
            foreach (var baseItem in item.Items.Keys)
            {
                if (isGift)
                {
                    if ((DateTime.Now - session.GetHabbo().LastGiftPurchaseTime).TotalSeconds <= 15.0)
                    {
                        session.SendNotif(TextManager.GetText("user_send_gift"));
                        return;
                    }
                    if (!baseItem.AllowGift) return;
                    DataRow row;
                    using (var queryreactor3 = AzureEmulator.GetDatabaseManager().GetQueryReactor())
                    {
                        queryreactor3.SetQuery("SELECT id FROM users WHERE username = @gift_user");
                        queryreactor3.AddParameter("gift_user", giftUser);
                        row = queryreactor3.GetRow();
                    }
                    if (row == null)
                    {
                        session.GetMessageHandler()
                            .GetResponse()
                            .Init(LibraryParser.OutgoingRequest("GiftErrorMessageComposer"));
                        session.GetMessageHandler().GetResponse().AppendString(giftUser);
                        session.GetMessageHandler().SendResponse();
                        return;
                    }
                    toUserId = Convert.ToUInt32(row["id"]);
                    if (toUserId == 0u)
                    {
                        session.GetMessageHandler()
                            .GetResponse()
                            .Init(LibraryParser.OutgoingRequest("GiftErrorMessageComposer"));
                        session.GetMessageHandler().GetResponse().AppendString(giftUser);
                        session.GetMessageHandler().SendResponse();
                        return;
                    }
                    if (item.CreditsCost > 0 && isGift)
                    {
                        session.GetHabbo().Credits -= (int)item.CreditsCost * totalPrice;
                        session.GetHabbo().UpdateCreditsBalance();
                    }
                    if (item.DucketsCost > 0 && isGift)
                    {
                        session.GetHabbo().ActivityPoints -= (int)item.DucketsCost * totalPrice;
                        session.GetHabbo().UpdateActivityPointsBalance();
                    }
                    if (item.DiamondsCost > 0 && isGift)
                    {
                        session.GetHabbo().Diamonds -= (int)item.DiamondsCost * totalPrice;
                        session.GetHabbo().UpdateSeasonalCurrencyBalance();
                    }
                }
开发者ID:BjkGkh,项目名称:Azure2,代码行数:67,代码来源:Catalog.cs

示例5: DeliverItems


//.........这里部分代码省略.........
                                    session.GetHabbo().GetInventoryComponent().AddPet(generatedPet);
                                    list.Add(session.GetHabbo().GetInventoryComponent().AddNewItem(0, 1534, "0", 0, true, false, 0, 0, string.Empty));
                                    break;
                                }
                            default:
                                switch (interactionType)
                                {
                                    case Interaction.MusicDisc:
                                        goto IL_1067;
                                    case Interaction.PuzzleBox:
                                        goto IL_10C3;
                                    case Interaction.RoomBg:
                                        goto IL_FF7;
                                    default:
                                        switch (interactionType)
                                        {
                                            case Interaction.GuildItem:
                                            case Interaction.GuildGate:
                                            case Interaction.GroupForumTerminal:
                                                list.Add(session.GetHabbo()
                                                    .GetInventoryComponent()
                                                    .AddNewItem(0u, item.ItemId, "0", Convert.ToInt32(extraData),
                                                        true, false, 0, 0, string.Empty));
                                                break;

                                            case Interaction.GuildForum:
                                                int groupId;
                                                int.TryParse(extraData, out groupId);
                                                var group = AzureEmulator.GetGame().GetGroupManager().GetGroup(groupId);
                                                if (group != null)
                                                {
                                                    if (group.CreatorId == session.GetHabbo().Id)
                                                    {
                                                        session.GetMessageHandler().GetResponse().Init(LibraryParser.OutgoingRequest("SuperNotificationMessageComposer"));
                                                        session.GetMessageHandler()
                                                            .GetResponse()
                                                            .AppendString("forums.delivered");
                                                        session.GetMessageHandler().GetResponse().AppendInteger(2);
                                                        session.GetMessageHandler()
                                                            .GetResponse()
                                                            .AppendString("groupId");
                                                        session.GetMessageHandler()
                                                            .GetResponse()
                                                            .AppendString(extraData);
                                                        session.GetMessageHandler()
                                                            .GetResponse()
                                                            .AppendString("groupName");
                                                        session.GetMessageHandler()
                                                            .GetResponse()
                                                            .AppendString(group.Name);
                                                        session.GetMessageHandler().SendResponse();
                                                        if (!group.HasForum)
                                                        {
                                                            group.HasForum = true;
                                                            group.UpdateForum();
                                                        }
                                                    }
                                                    else
                                                    {
                                                        session.SendNotif(TextManager.GetText("user_group_owner_error"));
                                                    }
                                                }
                                                list.Add(session.GetHabbo().GetInventoryComponent().AddNewItem(0u, item.ItemId, "0", Convert.ToInt32(extraData), true, false, 0, 0, string.Empty));
                                                break;

                                            default:
开发者ID:BjkGkh,项目名称:Azure2,代码行数:67,代码来源:Catalog.cs

示例6: OnTrigger

 public void OnTrigger(GameClient session, RoomItem item, int request, bool hasRights)
 {
     if (!item.ExtraData.Contains(Convert.ToChar(5).ToString()))
     {
         return;
     }
     string[] array = item.ExtraData.Split(Convert.ToChar(5));
     session.GetHabbo().Gender = array[0].ToUpper();
     var dictionary = new Dictionary<string, string>();
     dictionary.Clear();
     string[] array2 = array[1].Split('.');
     foreach (string text in array2)
     {
         string[] array3 = session.GetHabbo().Look.Split('.');
         foreach (string text2 in array3)
         {
             if (text2.Split('-')[0] == text.Split('-')[0])
             {
                 if (dictionary.ContainsKey(text2.Split('-')[0]) && !dictionary.ContainsValue(text))
                 {
                     dictionary.Remove(text2.Split('-')[0]);
                     dictionary.Add(text2.Split('-')[0], text);
                 }
                 else
                 {
                     if (!dictionary.ContainsKey(text2.Split('-')[0]) && !dictionary.ContainsValue(text))
                     {
                         dictionary.Add(text2.Split('-')[0], text);
                     }
                 }
             }
             else
             {
                 if (!dictionary.ContainsKey(text2.Split('-')[0]))
                 {
                     dictionary.Add(text2.Split('-')[0], text2);
                 }
             }
         }
     }
     string text3 = dictionary.Values.Aggregate("", (current1, current) => string.Format("{0}{1}.", current1, current));
     session.GetHabbo().Look = text3.TrimEnd('.');
     using (IQueryAdapter queryReactor = AzureEmulator.GetDatabaseManager().GetQueryReactor())
     {
         queryReactor.SetQuery(string.Format("UPDATE users SET look = @look, gender = @gender WHERE id = {0}", session.GetHabbo().Id));
         queryReactor.AddParameter("look", session.GetHabbo().Look);
         queryReactor.AddParameter("gender", session.GetHabbo().Gender);
         queryReactor.RunQuery();
     }
     session.GetMessageHandler().GetResponse().Init(LibraryParser.OutgoingRequest("UpdateUserDataMessageComposer"));
     session.GetMessageHandler().GetResponse().AppendInteger(-1);
     session.GetMessageHandler().GetResponse().AppendString(session.GetHabbo().Look);
     session.GetMessageHandler().GetResponse().AppendString(session.GetHabbo().Gender.ToLower());
     session.GetMessageHandler().GetResponse().AppendString(session.GetHabbo().Motto);
     session.GetMessageHandler().GetResponse().AppendInteger(session.GetHabbo().AchievementPoints);
     session.GetMessageHandler().SendResponse();
     RoomUser roomUserByHabbo = item.GetRoom().GetRoomUserManager().GetRoomUserByHabbo(session.GetHabbo().Id);
     var serverMessage = new ServerMessage(LibraryParser.OutgoingRequest("UpdateUserDataMessageComposer"));
     serverMessage.AppendInteger(roomUserByHabbo.VirtualId);
     serverMessage.AppendString(session.GetHabbo().Look);
     serverMessage.AppendString(session.GetHabbo().Gender.ToLower());
     serverMessage.AppendString(session.GetHabbo().Motto);
     serverMessage.AppendInteger(session.GetHabbo().AchievementPoints);
     session.GetHabbo().CurrentRoom.SendMessage(serverMessage);
 }
开发者ID:BjkGkh,项目名称:Azure2,代码行数:65,代码来源:InteractorMannequin.cs


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