本文整理汇总了C#中Butterfly.HabboHotel.GameClients.GameClient.GetConnection方法的典型用法代码示例。如果您正苦于以下问题:C# GameClient.GetConnection方法的具体用法?C# GameClient.GetConnection怎么用?C# GameClient.GetConnection使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Butterfly.HabboHotel.GameClients.GameClient
的用法示例。
在下文中一共展示了GameClient.GetConnection方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: BanUser
// PENDING REWRITE
internal void BanUser(GameClient Client, string Moderator, Double LengthSeconds, string Reason, Boolean IpBan)
{
ModerationBanType Type = ModerationBanType.USERNAME;
string Var = Client.GetHabbo().Username;
string RawVar = "user";
Double Expire = ButterflyEnvironment.GetUnixTimestamp() + LengthSeconds;
if (Reason == null)
{
Reason = "The moderator didn't specify a reason";
}
if (IpBan)
{
Type = ModerationBanType.IP;
Var = Client.GetConnection().getIp();
RawVar = "ip";
}
ModerationBan ban = new ModerationBan(Type, Var, Reason, Expire);
if (ban.Type == ModerationBanType.IP)
{
if (bannedIPs.ContainsKey(Var))
bannedIPs[Var] = ban;
else
bannedIPs.Add(Var, ban);
}
else
{
if (bannedUsernames.ContainsKey(Var))
bannedUsernames[Var] = ban;
else
bannedUsernames.Add(Var, ban);
}
using (IQueryAdapter dbClient = ButterflyEnvironment.GetDatabaseManager().getQueryreactor())
{
dbClient.setQuery("INSERT INTO bans (bantype,value,reason,expire,added_by,added_date) VALUES (@rawvar,@var,@reason,'" + Expire + "',@mod,'" + DateTime.Now.ToLongDateString() + "')");
dbClient.addParameter("rawvar", RawVar);
dbClient.addParameter("var", Var);
dbClient.addParameter("reason", Reason);
dbClient.addParameter("mod", Moderator);
dbClient.runQuery();
}
if (IpBan)
{
DataTable UsersAffected = null;
using (IQueryAdapter dbClient = ButterflyEnvironment.GetDatabaseManager().getQueryreactor())
{
dbClient.setQuery("SELECT id FROM users WHERE ip_last = @var");
dbClient.addParameter("var", Var);
UsersAffected = dbClient.getTable();
}
if (UsersAffected != null)
{
using (IQueryAdapter dbClient = ButterflyEnvironment.GetDatabaseManager().getQueryreactor())
{
foreach (DataRow Row in UsersAffected.Rows)
{
dbClient.runFastQuery("UPDATE user_info SET bans = bans + 1 WHERE user_id = " + Convert.ToUInt32(Row["id"]));
}
}
}
BanUser(Client, Moderator, LengthSeconds, Reason, false);
}
else
{
using (IQueryAdapter dbClient = ButterflyEnvironment.GetDatabaseManager().getQueryreactor())
{
dbClient.runFastQuery("UPDATE user_info SET bans = bans + 1 WHERE user_id = " + Client.GetHabbo().Id);
}
Client.SendBanMessage(LanguageLocale.GetValue("moderation.banned") + " " + Reason);
Client.Disconnect();
}
}