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


C# GameClient.GetConnection方法代码示例

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


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

示例1: Handle

		public void Handle(GameClient Session, ClientMessage Event)
		{
            if (Session != null && Session.GetConnection() != null)
            {
                byte[] end = Essential.GetGame().GetNavigator().SerializeNavigator(Session, int.Parse(Event.PopFixedString()));
                Session.GetConnection().SendData(end);
            }
		}
开发者ID:RootkitR,项目名称:Essential-5.1,代码行数:8,代码来源:PopularRoomsSearchMessageEvent.cs

示例2: method_1

		public void method_1(GameClient Session)
		{
			foreach (ModerationBan current in this.Bans)
			{
				if (!current.Expired)
				{
                    if (Session != null && Session.GetHabbo() != null && current.Type == ModerationBanType.IP && Session.GetConnection().String_0 == current.Variable)
					{
						throw new ModerationBanException(current.ReasonMessage);
					}
					if (Session != null && Session.GetHabbo() != null && (current.Type == ModerationBanType.USERNAME && Session.GetHabbo().Username.ToLower() == current.Variable.ToLower()))
					{
						throw new ModerationBanException(current.ReasonMessage);
					}
				}
			}
		}
开发者ID:RootkitR,项目名称:Essential-5.1,代码行数:17,代码来源:ModerationBanManager.cs

示例3: BanUser

		public void BanUser(GameClient Session, string string_0, double length, string reason, bool banIp)
		{
			if (!Session.GetHabbo().IsJuniori)
			{
				ModerationBanType enum4_ = ModerationBanType.USERNAME;
				string text = Session.GetHabbo().Username;
				string object_ = "user";

				double timestamp = Essential.GetUnixTimestamp() + length;

				if (banIp)
				{
					enum4_ = ModerationBanType.IP;

					if (!ServerConfiguration.IPLastBan)
                        text = Session.GetConnection().String_0;
					else
					{
						using (DatabaseClient dbClient = Essential.GetDatabase().GetClient())
						{
							text = dbClient.ReadString("SELECT ip_last FROM users WHERE Id = " + Session.GetHabbo().Id + " LIMIT 1;");
						}
					}
					object_ = "ip";
				}

				this.Bans.Add(new ModerationBan(enum4_, text, reason, timestamp));

				using (DatabaseClient dbClient = Essential.GetDatabase().GetClient())
				{
					dbClient.AddParamWithValue("rawvar", object_);
					dbClient.AddParamWithValue("var", text);
					dbClient.AddParamWithValue("reason", reason);
					dbClient.AddParamWithValue("mod", string_0);

					dbClient.ExecuteQuery(string.Concat(new object[]
					{
						"INSERT INTO bans (bantype,value,reason,expire,added_by,added_date,appeal_state) VALUES (@rawvar,@var,@reason,'",
						timestamp,
						"',@mod,'",
						DateTime.Now.ToLongDateString(),
						"', '1')"
					}));
                    dbClient.ExecuteQuery(string.Concat(new object[]
					{
						"INSERT INTO banlog (bantype,value,reason,expire,added_by,added_date,appeal_state) VALUES (@rawvar,@var,@reason,'",
						timestamp,
						"',@mod,'",
						DateTime.Now.ToLongDateString(),
						"', '1')"
					}));
                    
				}

				if (banIp)
				{
					DataTable dataTable = null;

					using (DatabaseClient dbClient = Essential.GetDatabase().GetClient())
					{
						dbClient.AddParamWithValue("var", text);
						dataTable = dbClient.ReadDataTable("SELECT Id FROM users WHERE ip_last = @var");
					}

                    if (dataTable != null)
                    {
                        IEnumerator enumerator = dataTable.Rows.GetEnumerator();
                        try
                        {
                            while (enumerator.MoveNext())
                            {
                                DataRow dataRow = (DataRow)enumerator.Current;
                                using (DatabaseClient @class = Essential.GetDatabase().GetClient())
                                {
                                    @class.ExecuteQuery("UPDATE user_info SET bans = bans + 1 WHERE user_id = '" + (uint)dataRow["Id"] + "' LIMIT 1");
                                }
                            }
                        }
                        finally
                        {
                            IDisposable disposable = enumerator as IDisposable;
                            if (disposable != null)
                            {
                                disposable.Dispose();
                            }
                        }
                    }
				}

				using (DatabaseClient dbClient = Essential.GetDatabase().GetClient())
				{
					dbClient.ExecuteQuery("UPDATE user_info SET bans = bans + 1 WHERE user_id = '" + Session.GetHabbo().Id + "' LIMIT 1");
				}
				
				Session.NotifyBan(reason);
				Session.Disconnect("Banned!");
			}
		}
开发者ID:RootkitR,项目名称:Essential-5.1,代码行数:98,代码来源:ModerationBanManager.cs

示例4: ShowPoll

        public static void ShowPoll(GameClient Session, int PollId, string PollDetails)
        {
            Thread.Sleep(10000);

            if (Session.GetConnection() != null)
            {
                if (Session.GetHabbo().InRoom)
                {
                    Room Room = Session.GetHabbo().CurrentRoom;
                    if (Room == null)
                    {
                        return;
                    }
                    ServerMessage NewPoll = new ServerMessage(Outgoing.NewPoll); // Updated
                    NewPoll.AppendInt32(PollId);
                    NewPoll.AppendStringWithBreak(PollDetails);
                    Session.SendMessage(NewPoll);
                }
            }
        }
开发者ID:RootkitR,项目名称:Essential-5.1,代码行数:20,代码来源:Room.cs

示例5: Handle

		public void Handle(GameClient Session, ClientMessage Event)
		{
			Session.GetConnection().SendData(Essential.GetGame().GetNavigator().SerializeNavigator(Session, -2));
		}
开发者ID:RootkitR,项目名称:Essential-5.1,代码行数:4,代码来源:RoomsWithHighestScoreSearchMessageEvent.cs

示例6: method_16

		public void method_16(GameClient Session, uint uint_0, string string_0, bool bool_0)
		{
			GameClient @class = Essential.GetGame().GetClientManager().GetClient(uint_0);
			if (@class != null && @class.GetHabbo().Id != Session.GetHabbo().Id)
			{
				if (bool_0 && @class.GetHabbo().Rank >= Session.GetHabbo().Rank)
				{
					Session.SendNotification(EssentialEnvironment.GetExternalText("mod_error_permission_caution"));
					//bool_0 = false;
                    return;
                }
				@class.SendNotification(string_0, 0);
				//if (bool_0)
				//{
					using (DatabaseClient class2 = Essential.GetDatabase().GetClient())
					{
                        try
                        {
                            class2.AddParamWithValue("description", string_0);
                            class2.AddParamWithValue("timestamp", (int)Essential.GetUnixTimestamp());
                            class2.ExecuteQuery("INSERT INTO hp_verwarnungen (user_id,title,beschreibung,timestamp,endtimestamp_verwarnung,mod_id,mod_ip) VALUES (" + uint_0 + ",'Mod-Tool',@description,@timestamp,'0'," + Session.GetHabbo().Id + ",'" + Session.GetConnection().LocalEndPoint.ToString().Split(':')[0] + "')");
                            class2.ExecuteQuery("UPDATE user_info SET cautions = cautions + 1 WHERE user_id = '" + uint_0 + "' LIMIT 1");
                        }catch(Exception ex)
                        {
                            Console.WriteLine(ex.ToString());
                        }
                    }
				//}
			}
		}
开发者ID:RootkitR,项目名称:Essential-5.1,代码行数:30,代码来源:ModerationTool.cs


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