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


C# GameClient.GetMessageHandler方法代码示例

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


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

示例1: HandlePurchase


//.........这里部分代码省略.........
                {
                    Session.GetHabbo().BelCredits -= item.LoyaltyCost * num;
                    Session.GetHabbo().UpdateSeasonalCurrencyBalance();
                }
            }

            

            checked
            {
                foreach (uint current2 in item.Items.Keys)
                {
                    if (IsGift)
                    {
                        if ((DateTime.Now - Session.GetHabbo().LastGiftPurchaseTime).TotalSeconds <= 15.0)
                        {
                            Session.SendNotif("You're purchasing gifts too fast! Please wait 15 seconds, then you purchase another gift.");
                            return;
                        }

                        if (!item.GetBaseItem(current2).AllowGift)
                        {
                            return;
                        }
                        DataRow row;
                        using (IQueryAdapter queryreactor3 = CyberEnvironment.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(Outgoing.GiftErrorMessageComposer);
                            Session.GetMessageHandler().GetResponse().AppendString(GiftUser);
                            Session.GetMessageHandler().SendResponse();
                            return;
                        }
                        num3 = Convert.ToUInt32(row["id"]);
                        if (num3 == 0u)
                        {
                            Session.GetMessageHandler().GetResponse().Init(Outgoing.GiftErrorMessageComposer);
                            Session.GetMessageHandler().GetResponse().AppendString(GiftUser);
                            Session.GetMessageHandler().SendResponse();
                            return;
                        }
                        if (item.CreditsCost > 0 && IsGift)
                        {
                            Session.GetHabbo().Credits -= item.CreditsCost * num;
                            Session.GetHabbo().UpdateCreditsBalance();
                        }
                        if (item.DucketsCost > 0 && IsGift)
                        {
                            Session.GetHabbo().ActivityPoints -= item.DucketsCost * num;
                            Session.GetHabbo().UpdateActivityPointsBalance();
                        }
                        if (item.BelCreditsCost > 0 && IsGift)
                        {
                            Session.GetHabbo().BelCredits -= item.BelCreditsCost * num;
                            Session.GetHabbo().UpdateSeasonalCurrencyBalance();
                        }
                        if (item.LoyaltyCost > 0 && IsGift)
                        {
                            Session.GetHabbo().BelCredits -= item.LoyaltyCost * num;
                            Session.GetHabbo().UpdateSeasonalCurrencyBalance();
                        }
开发者ID:kessiler,项目名称:habboServer,代码行数:67,代码来源:Catalog.cs

示例2: OnTrigger

		public void OnTrigger(GameClient Session, RoomItem Item, int Request, bool HasRights)
		{
			if (Item.ExtraData.Contains(Convert.ToChar(5).ToString()))
			{
				string[] array = Item.ExtraData.Split(new char[]
				{
					Convert.ToChar(5)
				});
				Session.GetHabbo().Gender = array[0].ToUpper();
				Dictionary<string, string> dictionary = new Dictionary<string, string>();
				dictionary.Clear();
				string[] array2 = array[1].Split(new char[]
				{
					'.'
				});
				for (int i = 0; i < array2.Length; i++)
				{
					string text = array2[i];
					string[] array3 = Session.GetHabbo().Look.Split(new char[]
					{
						'.'
					});
					for (int j = 0; j < array3.Length; j++)
					{
						string text2 = array3[j];
						if (text2.Split(new char[]
						{
							'-'
						})[0] == text.Split(new char[]
						{
							'-'
						})[0])
						{
							if (dictionary.ContainsKey(text2.Split(new char[]
							{
								'-'
							})[0]) && !dictionary.ContainsValue(text))
							{
								dictionary.Remove(text2.Split(new char[]
								{
									'-'
								})[0]);
								dictionary.Add(text2.Split(new char[]
								{
									'-'
								})[0], text);
							}
							else
							{
								if (!dictionary.ContainsKey(text2.Split(new char[]
								{
									'-'
								})[0]) && !dictionary.ContainsValue(text))
								{
									dictionary.Add(text2.Split(new char[]
									{
										'-'
									})[0], text);
								}
							}
						}
						else
						{
							if (!dictionary.ContainsKey(text2.Split(new char[]
							{
								'-'
							})[0]))
							{
								dictionary.Add(text2.Split(new char[]
								{
									'-'
								})[0], text2);
							}
						}
					}
				}
				string text3 = "";
				foreach (string current in dictionary.Values)
				{
					text3 = text3 + current + ".";
				}
				Session.GetHabbo().Look = text3.TrimEnd(new char[]
				{
					'.'
				});
				using (IQueryAdapter queryreactor = CyberEnvironment.GetDatabaseManager().getQueryReactor())
				{
					queryreactor.setQuery("UPDATE users SET look = @look, gender = @gender WHERE id = " + Session.GetHabbo().Id);
					queryreactor.addParameter("look", Session.GetHabbo().Look);
					queryreactor.addParameter("gender", Session.GetHabbo().Gender);
					queryreactor.runQuery();
				}
				Session.GetMessageHandler().GetResponse().Init(Outgoing.UpdateUserDataMessageComposer);
				Session.GetMessageHandler().GetResponse().AppendInt32(-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().AppendInt32(Session.GetHabbo().AchievementPoints);
				Session.GetMessageHandler().SendResponse();
				RoomUser roomUserByHabbo = Item.GetRoom().GetRoomUserManager().GetRoomUserByHabbo(Session.GetHabbo().Id);
//.........这里部分代码省略.........
开发者ID:kessiler,项目名称:habboServer,代码行数:101,代码来源:InteractorMannequin.cs

示例3: ProgressUserAchievement


//.........这里部分代码省略.........
				}
				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++;
					int arg_E6_0 = num2 - targetLevelData.Requirement;
					num2 = 0;
					if (num == 1)
					{
						Session.GetHabbo().GetBadgeComponent().GiveBadge(AchievementGroup + num, true, Session, false);
					}
					else
					{
						Session.GetHabbo().GetBadgeComponent().RemoveBadge(Convert.ToString(AchievementGroup + (num - 1)), Session);
						Session.GetHabbo().GetBadgeComponent().GiveBadge(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 = CyberEnvironment.GetDatabaseManager().getQueryReactor())
					{
						queryreactor.setQuery(string.Concat(new object[]
						{
							"REPLACE INTO user_achievement 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 (CyberEnvironment.GetGame().GetTalentManager().TryGetTalent(AchievementGroup, out talent))
					{
						CyberEnvironment.GetGame().GetTalentManager().CompleteUserTalent(Session, talent);
					}
					return true;
				}
				userAchievement.Level = num3;
				userAchievement.Progress = num2;
				using (IQueryAdapter queryreactor2 = CyberEnvironment.GetDatabaseManager().getQueryReactor())
				{
					queryreactor2.setQuery(string.Concat(new object[]
					{
						"REPLACE INTO user_achievement VALUES (",
						Session.GetHabbo().Id,
						", @group, ",
						num3,
						", ",
						num2,
						")"
					}));
					queryreactor2.addParameter("group", AchievementGroup);
					queryreactor2.runQuery();
				}
				Session.SendMessage(AchievementProgressComposer.Compose(achievement, num, targetLevelData, count, Session.GetHabbo().GetAchievementData(AchievementGroup)));

                Session.GetMessageHandler().GetResponse().Init(Outgoing.UpdateUserDataMessageComposer);
                Session.GetMessageHandler().GetResponse().AppendInt32(-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().AppendInt32(Session.GetHabbo().AchievementPoints);
                Session.GetMessageHandler().SendResponse();
                return false;
			}
		}
开发者ID:kessiler,项目名称:habboServer,代码行数:101,代码来源:AchievementManager.cs

示例4: RemoveUserFromRoom

        internal void RemoveUserFromRoom(GameClient Session, bool NotifyClient, bool NotifyKick)
        {
            try
            {
                if (Session == null || Session.GetHabbo() == null || this.room == null)
                {
                    return;
                }
                Session.GetHabbo().GetAvatarEffectsInventoryComponent().OnRoomExit();
                using (IQueryAdapter queryreactor = CyberEnvironment.GetDatabaseManager().getQueryReactor())
                {
                    queryreactor.runFastQuery(string.Concat(new object[]
					{
						"UPDATE user_roomvisits SET exit_timestamp = '",
						CyberEnvironment.GetUnixTimestamp(),
						"' WHERE room_id = '",
						this.room.RoomId,
						"' AND user_id = '",
						Session.GetHabbo().Id,
						"' ORDER BY entry_timestamp DESC LIMIT 1"
					}));
                }
                RoomUser roomUserByHabbo = this.GetRoomUserByHabbo(Session.GetHabbo().Id);
                if (roomUserByHabbo == null)
                {
                    return;
                }
                if (NotifyKick || (NotifyClient && NotifyKick))
                {
                    Room room = CyberEnvironment.GetGame().GetRoomManager().GetRoom(roomUserByHabbo.RoomId);
                    DynamicRoomModel model = room.GetGameMap().Model;
                    roomUserByHabbo.MoveTo(model.DoorX, model.DoorY);
                    roomUserByHabbo.CanWalk = false;
                    Session.GetMessageHandler().GetResponse().Init(Outgoing.RoomErrorMessageComposer);
                    Session.GetMessageHandler().GetResponse().AppendInt32(4008);
                    Session.GetMessageHandler().SendResponse();


                    Session.GetMessageHandler().GetResponse().Init(Outgoing.OutOfRoomMessageComposer);
                    Session.GetMessageHandler().GetResponse().AppendShort(2);
                    Session.GetMessageHandler().SendResponse();
                }
                else
                {
                    if (NotifyClient && !NotifyKick)
                    {
                        ServerMessage serverMessage = new ServerMessage(Outgoing.UserIsPlayingFreezeMessageComposer);
                        serverMessage.AppendBoolean(roomUserByHabbo.team != Team.none);
                        roomUserByHabbo.GetClient().SendMessage(serverMessage);
                        Session.GetMessageHandler().GetResponse().Init(Outgoing.OutOfRoomMessageComposer);
                        Session.GetMessageHandler().GetResponse().AppendShort(2);
                        Session.GetMessageHandler().SendResponse();
                    }
                }
                if (roomUserByHabbo != null)
                {
                    if (roomUserByHabbo.team != Team.none)
                    {
                        this.room.GetTeamManagerForBanzai().OnUserLeave(roomUserByHabbo);
                        this.room.GetTeamManagerForFreeze().OnUserLeave(roomUserByHabbo);
                    }
                    if (roomUserByHabbo.RidingHorse)
                    {
                        roomUserByHabbo.RidingHorse = false;
                        RoomUser Horse = this.GetRoomUserByVirtualId((int)roomUserByHabbo.HorseID);
                        if (Horse != null)
                        {
                            Horse.RidingHorse = false;
                            Horse.HorseID = 0u;
                        }
                    }
                    if (roomUserByHabbo.IsLyingDown || roomUserByHabbo.IsSitting)
                    {
                        roomUserByHabbo.IsSitting = false;
                        roomUserByHabbo.IsLyingDown = false;
                    }
                    this.RemoveRoomUser(roomUserByHabbo);
                    if (Session.GetHabbo() != null && !roomUserByHabbo.IsSpectator)
                    {
                        if (roomUserByHabbo.CurrentItemEffect != ItemEffectType.None)
                        {
                            roomUserByHabbo.GetClient().GetHabbo().GetAvatarEffectsInventoryComponent().CurrentEffect = -1;
                        }
                        if (Session.GetHabbo() != null)
                        {
                            if (this.room.HasActiveTrade(Session.GetHabbo().Id))
                            {
                                this.room.TryStopTrade(Session.GetHabbo().Id);
                            }
                            Session.GetHabbo().CurrentRoomId = 0u;
                            if (Session.GetHabbo().GetMessenger() != null)
                            {
                                Session.GetHabbo().GetMessenger().OnStatusChanged(true);
                            }
                        }
                        DateTime now = DateTime.Now;
                        using (IQueryAdapter queryreactor2 = CyberEnvironment.GetDatabaseManager().getQueryReactor())
                        {

                            if (Session.GetHabbo() != null)
//.........这里部分代码省略.........
开发者ID:kessiler,项目名称:habboServer,代码行数:101,代码来源:RoomUserManager.cs


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