public void Parse(HabboHotel.GameClients.GameClient Session, ClientPacket Packet) { if (!Session.GetHabbo().InRoom) { return; } Room Room = Session.GetHabbo().CurrentRoom; if (Room == null) { return; } String Username = Packet.PopString(); Habbo User = PlusEnvironment.GetHabboByUsername(Username); if (User == null || !Session.GetHabbo().MutedUsers.Contains(User.Id)) { return; } Session.GetHabbo().MutedUsers.Remove(User.Id); Session.SendMessage(new IgnoreStatusComposer(3, Username)); }
public void Execute(GameClients.GameClient Session, Rooms.Room Room, string[] Params) { if (Params.Length == 1) { Session.SendWhisper("Digite o usuário que deseja banir o IP.", 1); return; } Habbo Habbo = PlusEnvironment.GetHabboByUsername(Params[1]); if (Habbo == null) { Session.SendWhisper("Ocorreu um erro ao encontrar esse usuário no banco de dados.", 1); return; } if (Habbo.GetPermissions().HasRight("mod_tool") && !Session.GetHabbo().GetPermissions().HasRight("mod_ban_any")) { Session.SendWhisper("Opa, você não pode proibir esse usuário.", 1); return; } String IPAddress = String.Empty; Double Expire = PlusEnvironment.GetUnixTimestamp() + 78892200; string Username = Habbo.Username; using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor()) { dbClient.RunQuery("UPDATE `user_info` SET `bans` = `bans` + '1' WHERE `user_id` = '" + Habbo.Id + "' LIMIT 1"); dbClient.SetQuery("SELECT `ip_last` FROM `users` WHERE `id` = '" + Habbo.Id + "' LIMIT 1"); IPAddress = dbClient.getString(); } string Reason = null; if (Params.Length >= 3) { Reason = CommandManager.MergeParams(Params, 2); } else { Reason = "Sem razão específica, mas provavelmente fez merda."; } GameClient TargetClient = PlusEnvironment.GetGame().GetClientManager().GetClientByUsername(Username); Session.SendWhisper("Successo, você baniu o usuário '" + Username + "' no ip, '" + Reason + "'!", 1); if (!string.IsNullOrEmpty(IPAddress)) { PlusEnvironment.GetGame().GetModerationManager().BanUser(Session.GetHabbo().Username, ModerationBanType.IP, IPAddress, Reason, Expire); } PlusEnvironment.GetGame().GetModerationManager().BanUser(Session.GetHabbo().Username, ModerationBanType.USERNAME, Habbo.Username, Reason, Expire); if (TargetClient != null) { TargetClient.Disconnect(true); } }
public void Parse(HabboHotel.GameClients.GameClient Session, ClientPacket Packet) { if (!Session.GetHabbo().InRoom) { return; } Room Room = Session.GetHabbo().CurrentRoom; if (Room == null) { return; } String Username = Packet.PopString(); Habbo User = PlusEnvironment.GetHabboByUsername(Username); if (User == null || Session.GetHabbo().MutedUsers.Contains(User.Id) || User.GetPermissions().HasRight("mod_tool")) { return; } Session.GetHabbo().MutedUsers.Add(User.Id); Session.SendMessage(new IgnoreStatusComposer(1, Username)); PlusEnvironment.GetGame().GetAchievementManager().ProgressAchievement(Session, "ACH_SelfModIgnoreSeen", 1); }
public void Execute(GameClient session, Room room, string[] Params) { if (Params.Length == 1) { session.SendWhisper("Please enter the username of the user you'd like to IP ban & account ban."); return; } var habbo = PlusEnvironment.GetHabboByUsername(Params[1]); if (habbo == null) { session.SendWhisper("An error occoured whilst finding that user in the database."); return; } if (habbo.GetPermissions().HasRight("mod_tool") && !session.GetHabbo().GetPermissions().HasRight("mod_ban_any")) { session.SendWhisper("Oops, you cannot ban that user."); return; } var ipAddress = string.Empty; var expire = PlusEnvironment.GetUnixTimestamp() + 78892200; var username = habbo.Username; using (var dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor()) { dbClient.RunQuery("UPDATE `user_info` SET `bans` = `bans` + '1' WHERE `user_id` = '" + habbo.Id + "' LIMIT 1"); dbClient.SetQuery("SELECT `ip_last` FROM `users` WHERE `id` = '" + habbo.Id + "' LIMIT 1"); ipAddress = dbClient.GetString(); } string reason = null; if (Params.Length >= 3) { reason = CommandManager.MergeParams(Params, 2); } else { reason = "No reason specified."; } if (!string.IsNullOrEmpty(ipAddress)) { PlusEnvironment.GetGame().GetModerationManager().BanUser(session.GetHabbo().Username, ModerationBanType.Ip, ipAddress, reason, expire); } PlusEnvironment.GetGame() .GetModerationManager() .BanUser(session.GetHabbo().Username, ModerationBanType.Username, habbo.Username, reason, expire); var targetClient = PlusEnvironment.GetGame().GetClientManager().GetClientByUsername(username); if (targetClient != null) { targetClient.Disconnect(); } session.SendWhisper("Success, you have IP and account banned the user '" + username + "' for '" + reason + "'!"); }
public void Execute(GameClients.GameClient Session, Rooms.Room Room, string[] Params) { if (Params.Length == 1) { Session.SendWhisper("Digite um nome de usuário e um tempo válido em segundos (max 600).", 1); return; } Habbo Habbo = PlusEnvironment.GetHabboByUsername(Params[1]); if (Habbo == null) { Session.SendWhisper("Ocorreu um erro ao encontrar esse usuário no banco de dados.", 1); return; } if (Habbo.GetPermissions().HasRight("mod_tool") && !Session.GetHabbo().GetPermissions().HasRight("mod_mute_any")) { Session.SendWhisper("Opa, você não pode silenciar esse usuário.", 1); return; } if (Habbo.VIPRank > 1) { Session.SendWhisper("Desculpe, você não pode silenciar membros da equipe!", 1); return; } double Time; if (double.TryParse(Params[2], out Time)) { if (Time > 900 && !Session.GetHabbo().GetPermissions().HasRight("mod_mute_limit_override")) { Time = 900; } using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor()) { dbClient.RunQuery("UPDATE `users` SET `time_muted` = '" + Time + "' WHERE `id` = '" + Habbo.Id + "' LIMIT 1"); } if (Habbo.GetClient() != null) { Habbo.TimeMuted = Time; DateTime origin = new DateTime(1970, 1, 1, 0, 0, 0, 0).AddSeconds(PlusEnvironment.GetUnixTimestamp() + Time).ToLocalTime(); Habbo.GetClient().SendNotification("Seu HabboRPG foi silenciado até " + origin.ToString("dd-MM-yyyy H:mm:ss") + ". Para o bem da comunidade, mantenha-se afastado de qualquer spam ou bate-papo negativo. A leitura das Regras e dos Termos do HabboRPG o ajudarão a evitar este problema no futuro."); } Session.SendWhisper("Você silenciou com sucesso " + Habbo.Username + " por " + Time + " segundos.", 1); } else { Session.SendWhisper("Digite um número inteiro válido.", 1); } }
public void Execute(GameClients.GameClient Session, Room Room, string[] Params) { if (Params.Length == 1) { Session.SendWhisper("Please enter a username and a valid time in seconds (max 600, anything over will be set back to 600)."); return; } Habbo Habbo = PlusEnvironment.GetHabboByUsername(Params[1]); if (Habbo == null) { Session.SendWhisper("An error occoured whilst finding that user in the database."); return; } if (Habbo.GetPermissions().HasRight("mod_tool") && !Session.Habbo.GetPermissions().HasRight("mod_mute_any")) { Session.SendWhisper("Oops, you cannot mute that user."); return; } double Time; if (double.TryParse(Params[2], out Time)) { if (Time > 600 && !Session.Habbo.GetPermissions().HasRight("mod_mute_limit_override")) { Time = 600; } using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor()) { dbClient.RunQuery("UPDATE `users` SET `time_muted` = '" + Time + "' WHERE `id` = '" + Habbo.Id + "' LIMIT 1"); } if (Habbo.GetClient() != null) { Habbo.TimeMuted = Time; Habbo.GetClient().SendNotification("You have been muted by a moderator for " + Time + " seconds!"); } Session.SendWhisper("You have successfully muted " + Habbo.Username + " for " + Time + " seconds."); } else { Session.SendWhisper("Please enter a valid integer."); } }
public void Parse(GameClient session, ClientPacket packet) { if (!session.GetHabbo().InRoom) { return; } var room = session.GetHabbo().CurrentRoom; if (room == null) { return; } var username = packet.PopString(); var player = PlusEnvironment.GetHabboByUsername(username); if (player == null || player.GetPermissions().HasRight("mod_tool")) { return; } if (session.GetHabbo().GetIgnores().TryGet(player.Id)) { return; } if (!session.GetHabbo().GetIgnores().TryAdd(player.Id)) { return; } using (var dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor()) { dbClient.SetQuery("INSERT INTO `user_ignores` (`user_id`,`ignore_id`) VALUES(@uid,@ignoreId);"); dbClient.AddParameter("uid", session.GetHabbo().Id); dbClient.AddParameter("ignoreId", player.Id); dbClient.RunQuery(); } session.SendPacket(new IgnoreStatusComposer(1, player.Username)); PlusEnvironment.GetGame().GetAchievementManager().ProgressAchievement(session, "ACH_SelfModIgnoreSeen", 1); }
public void Parse(GameClient session, ClientPacket packet) { if (!session.GetHabbo().InRoom) { return; } Room room = session.GetHabbo().CurrentRoom; if (room == null) { return; } string username = packet.PopString(); Habbo player = PlusEnvironment.GetHabboByUsername(username); if (player == null) { return; } if (!session.GetHabbo().GetIgnores().TryGet(player.Id)) { return; } if (session.GetHabbo().GetIgnores().TryRemove(player.Id)) { using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor()) { dbClient.SetQuery("DELETE FROM `user_ignores` WHERE `user_id` = @uid AND `ignore_id` = @ignoreId"); dbClient.AddParameter("uid", session.GetHabbo().Id); dbClient.AddParameter("ignoreId", player.Id); dbClient.RunQuery(); } session.SendPacket(new IgnoreStatusComposer(3, player.Username)); } }
public void Execute(GameClient Session, Rooms.Room Room, string[] Params) { #region Conditions if (Params.Length == 1) { Session.SendWhisper("Opa, você esqueceu de inserir um nome de usuário!", 1); return; } Habbo Target = PlusEnvironment.GetHabboByUsername(Params[1]); if (Target == null) { Session.SendWhisper("Ocorreu um erro ao tentar encontrar esse usuário, talvez ele esteja offline.", 1); return; } var RoomUser = Session.GetRoomUser(); if (RoomUser == null) { return; } if (!GroupManager.HasJobCommand(Session, "unlaw")) { Session.SendWhisper("Apenas um policial pode usar esse comando!", 1); return; } if (!Session.GetRoleplay().IsWorking) { Session.SendWhisper("Você deve estar trabalhando para usar este comando!", 1); return; } if (!RoleplayManager.WantedList.ContainsKey(Target.Id)) { Session.SendWhisper("Este cidadão não é procurado!", 1); return; } if (Target.GetClient() != null && Target.GetClient().GetRoomUser() != null) { if (Target.GetClient().GetRoomUser().IsAsleep) { Session.SendWhisper("Você não pode retirar alguém da que está ausente!", 1); return; } } #endregion #region Execute Wanted Junk; RoleplayManager.WantedList.TryRemove(Target.Id, out Junk); Session.Shout("*Remove " + Target.Username + " da lista de procurados e limpa seu nome*", 37); if (Target.GetClient() != null) { Target.GetClient().GetRoleplay().IsWanted = false; } #endregion }
public void Parse(GameClient session, ClientPacket packet) { int pageId = packet.PopInt(); int itemId = packet.PopInt(); string data = packet.PopString(); string giftUser = StringCharFilter.Escape(packet.PopString()); string giftMessage = StringCharFilter.Escape(packet.PopString().Replace(Convert.ToChar(5), ' ')); int spriteId = packet.PopInt(); int ribbon = packet.PopInt(); int colour = packet.PopInt(); packet.PopBoolean(); if (PlusEnvironment.GetSettingsManager().TryGetValue("room.item.gifts.enabled") != "1") { session.SendNotification("The hotel managers have disabled gifting"); return; } if (!PlusEnvironment.GetGame().GetCatalog().TryGetPage(pageId, out CatalogPage page)) { return; } if (!page.Enabled || !page.Visible || page.MinimumRank > session.GetHabbo().Rank || page.MinimumVIP > session.GetHabbo().VIPRank&& session.GetHabbo().Rank == 1) { return; } if (!page.Items.TryGetValue(itemId, out CatalogItem item)) { if (page.ItemOffers.ContainsKey(itemId)) { item = page.ItemOffers[itemId]; if (item == null) { return; } } else { return; } } if (!ItemUtility.CanGiftItem(item)) { return; } if (!PlusEnvironment.GetGame().GetItemManager().GetGift(spriteId, out ItemData presentData) || presentData.InteractionType != InteractionType.GIFT) { return; } if (session.GetHabbo().Credits < item.CostCredits) { session.SendPacket(new PresentDeliverErrorMessageComposer(true, false)); return; } if (session.GetHabbo().Duckets < item.CostPixels) { session.SendPacket(new PresentDeliverErrorMessageComposer(false, true)); return; } Habbo habbo = PlusEnvironment.GetHabboByUsername(giftUser); if (habbo == null) { session.SendPacket(new GiftWrappingErrorComposer()); return; } if (!habbo.AllowGifts) { session.SendNotification("Oops, this user doesn't allow gifts to be sent to them!"); return; } if ((DateTime.Now - session.GetHabbo().LastGiftPurchaseTime).TotalSeconds <= 15.0) { session.SendNotification("You're purchasing gifts too fast! Please wait 15 seconds!"); session.GetHabbo().GiftPurchasingWarnings += 1; if (session.GetHabbo().GiftPurchasingWarnings >= 25) { session.GetHabbo().SessionGiftBlocked = true; } return; } if (session.GetHabbo().SessionGiftBlocked) { return; } string ed = giftUser + Convert.ToChar(5) + giftMessage + Convert.ToChar(5) + session.GetHabbo().Id + Convert.ToChar(5) + item.Data.Id + Convert.ToChar(5) + spriteId + Convert.ToChar(5) + ribbon + Convert.ToChar(5) + colour; int newItemId; using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor()) { //Insert the dummy item. dbClient.SetQuery("INSERT INTO `items` (`base_item`,`user_id`,`extra_data`) VALUES (@baseId, @habboId, @extra_data)"); dbClient.AddParameter("baseId", presentData.Id); dbClient.AddParameter("habboId", habbo.Id); dbClient.AddParameter("extra_data", ed); newItemId = Convert.ToInt32(dbClient.InsertQuery()); string itemExtraData = null; switch (item.Data.InteractionType) { case InteractionType.NONE: itemExtraData = ""; break; #region Pet handling case InteractionType.PET: try { string[] bits = data.Split('\n'); string petName = bits[0]; string race = bits[1]; string color = bits[2]; if (PetUtility.CheckPetName(petName)) { return; } if (race.Length > 2) { return; } if (color.Length != 6) { return; } PlusEnvironment.GetGame().GetAchievementManager().ProgressAchievement(session, "ACH_PetLover", 1); } catch { return; } break; #endregion case InteractionType.FLOOR: case InteractionType.WALLPAPER: case InteractionType.LANDSCAPE: double number = 0; try { number = string.IsNullOrEmpty(data) ? 0 : double.Parse(data, PlusEnvironment.CultureInfo); } catch { //ignored } itemExtraData = number.ToString(CultureInfo.CurrentCulture).Replace(',', '.'); break; // maintain extra data // todo: validate case InteractionType.POSTIT: itemExtraData = "FFFF33"; break; case InteractionType.MOODLIGHT: itemExtraData = "1,1,1,#000000,255"; break; case InteractionType.TROPHY: itemExtraData = session.GetHabbo().Username + Convert.ToChar(9) + DateTime.Now.Day + "-" + DateTime.Now.Month + "-" + DateTime.Now.Year + Convert.ToChar(9) + data; break; case InteractionType.MANNEQUIN: itemExtraData = "m" + Convert.ToChar(5) + ".ch-210-1321.lg-285-92" + Convert.ToChar(5) + "Default Mannequin"; break; case InteractionType.BADGE_DISPLAY: if (!session.GetHabbo().GetBadgeComponent().HasBadge(data)) { session.SendPacket(new BroadcastMessageAlertComposer("Oops, it appears that you do not own this badge.")); return; } itemExtraData = data + Convert.ToChar(9) + session.GetHabbo().Username + Convert.ToChar(9) + DateTime.Now.Day + "-" + DateTime.Now.Month + "-" + DateTime.Now.Year; break; default: itemExtraData = data; break; } //Insert the present, forever. dbClient.SetQuery("INSERT INTO `user_presents` (`item_id`,`base_id`,`extra_data`) VALUES (@itemId, @baseId, @extra_data)"); dbClient.AddParameter("itemId", newItemId); dbClient.AddParameter("baseId", item.Data.Id); dbClient.AddParameter("extra_data", string.IsNullOrEmpty(itemExtraData) ? "" : itemExtraData); dbClient.RunQuery(); //Here we're clearing up a record, this is dumb, but okay. dbClient.SetQuery("DELETE FROM `items` WHERE `id` = @deleteId LIMIT 1"); dbClient.AddParameter("deleteId", newItemId); dbClient.RunQuery(); } Item giveItem = ItemFactory.CreateGiftItem(presentData, habbo, ed, ed, newItemId); if (giveItem != null) { GameClient receiver = PlusEnvironment.GetGame().GetClientManager().GetClientByUserId(habbo.Id); if (receiver != null) { receiver.GetHabbo().GetInventoryComponent().TryAddItem(giveItem); receiver.SendPacket(new FurniListNotificationComposer(giveItem.Id, 1)); receiver.SendPacket(new PurchaseOKComposer()); receiver.SendPacket(new FurniListAddComposer(giveItem)); receiver.SendPacket(new FurniListUpdateComposer()); } if (habbo.Id != session.GetHabbo().Id&& !string.IsNullOrWhiteSpace(giftMessage)) { PlusEnvironment.GetGame().GetAchievementManager().ProgressAchievement(session, "ACH_GiftGiver", 1); if (receiver != null) { PlusEnvironment.GetGame().GetAchievementManager().ProgressAchievement(receiver, "ACH_GiftReceiver", 1); } PlusEnvironment.GetGame().GetQuestManager().ProgressUserQuest(session, QuestType.GiftOthers); } } session.SendPacket(new PurchaseOKComposer(item, presentData)); if (item.CostCredits > 0) { session.GetHabbo().Credits -= item.CostCredits; session.SendPacket(new CreditBalanceComposer(session.GetHabbo().Credits)); } if (item.CostPixels > 0) { session.GetHabbo().Duckets -= item.CostPixels; session.SendPacket(new HabboActivityPointNotificationComposer(session.GetHabbo().Duckets, session.GetHabbo().Duckets)); } session.GetHabbo().LastGiftPurchaseTime = DateTime.Now; }
public void Execute(GameClients.GameClient Session, Rooms.Room Room, string[] Params) { if (Params.Length == 1) { Session.SendWhisper("Please enter the username of the user you'd like to IP ban & account ban."); return; } Habbo Habbo = PlusEnvironment.GetHabboByUsername(Params[1]); if (Habbo == null) { Session.SendWhisper("An error occoured whilst finding that user in the database."); return; } if (Habbo.GetPermissions().HasRight("mod_tool") && !Session.GetHabbo().GetPermissions().HasRight("mod_ban_any")) { Session.SendWhisper("Oops, you cannot ban that user."); return; } String IPAddress = String.Empty; Double Expire = PlusEnvironment.GetUnixTimestamp() + 78892200; string Username = Habbo.Username; using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor()) { dbClient.RunQuery("UPDATE `user_info` SET `bans` = `bans` + '1' WHERE `user_id` = '" + Habbo.Id + "' LIMIT 1"); dbClient.SetQuery("SELECT `ip_last` FROM `users` WHERE `id` = '" + Habbo.Id + "' LIMIT 1"); IPAddress = dbClient.GetString(); } string Reason = null; if (Params.Length >= 3) { Reason = CommandManager.MergeParams(Params, 2); } else { Reason = "No reason specified."; } if (!string.IsNullOrEmpty(IPAddress)) { PlusEnvironment.GetGame().GetModerationManager().BanUser(Session.GetHabbo().Username, ModerationBanType.IP, IPAddress, Reason, Expire); } PlusEnvironment.GetGame().GetModerationManager().BanUser(Session.GetHabbo().Username, ModerationBanType.USERNAME, Habbo.Username, Reason, Expire); if (!string.IsNullOrEmpty(Habbo.MachineId)) { PlusEnvironment.GetGame().GetModerationManager().BanUser(Session.GetHabbo().Username, ModerationBanType.MACHINE, Habbo.MachineId, Reason, Expire); } GameClient TargetClient = PlusEnvironment.GetGame().GetClientManager().GetClientByUsername(Username); if (TargetClient != null) { TargetClient.Disconnect(); } Session.SendWhisper("Success, you have machine, IP and account banned the user '" + Username + "' for '" + Reason + "'!"); }
public void Execute(GameClient Session, Room Room, string[] Params) { if (Params.Length == 1) { Session.SendWhisper("Please enter the username of the user you'd like to IP ban & account ban."); return; } Habbo Habbo = PlusEnvironment.GetHabboByUsername(Params[1]); if (Habbo == null) { Session.SendWhisper("An error occoured whilst finding that user in the database."); return; } if (Habbo.GetPermissions().HasRight("mod_soft_ban") && !Session.GetHabbo().GetPermissions().HasRight("mod_ban_any")) { Session.SendWhisper("Oops, you cannot ban that user."); return; } double Expire = 0; string Hours = Params[2]; if (String.IsNullOrEmpty(Hours) || Hours == "perm") { Expire = PlusEnvironment.GetUnixTimestamp() + 78892200; } else { Expire = (PlusEnvironment.GetUnixTimestamp() + (Convert.ToDouble(Hours) * 3600)); } string Reason = null; if (Params.Length >= 4) { Reason = CommandManager.MergeParams(Params, 3); } else { Reason = "No reason specified."; } string Username = Habbo.Username; using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor()) { dbClient.RunQuery("UPDATE `user_info` SET `bans` = `bans` + '1' WHERE `user_id` = '" + Habbo.Id + "' LIMIT 1"); } PlusEnvironment.GetGame().GetModerationManager().BanUser(Session.GetHabbo().Username, ModerationBanType.Username, Habbo.Username, Reason, Expire); GameClient TargetClient = PlusEnvironment.GetGame().GetClientManager().GetClientByUsername(Username); if (TargetClient != null) { TargetClient.Disconnect(); } Session.SendWhisper("Success, you have account banned the user '" + Username + "' for " + Hours + " hour(s) with the reason '" + Reason + "'!"); }
public void Parse(HabboHotel.GameClients.GameClient Session, ClientPacket Packet) { int PageId = Packet.PopInt(); int ItemId = Packet.PopInt(); string Data = Packet.PopString(); string GiftUser = StringCharFilter.Escape(Packet.PopString()); string GiftMessage = StringCharFilter.Escape(Packet.PopString().Replace(Convert.ToChar(5), ' ')); int SpriteId = Packet.PopInt(); int Ribbon = Packet.PopInt(); int Colour = Packet.PopInt(); bool dnow = Packet.PopBoolean(); if (PlusEnvironment.GetSettingsManager().TryGetValue("room.item.gifts.enabled") != "1") { Session.SendNotification("The hotel managers have disabled gifting"); return; } /*if (PlusEnvironment.GetGame().GetCatalog().CatalogFlatOffers.ContainsKey(ItemId) && PageId < 0) * { * PageId = PlusEnvironment.GetGame().GetCatalog().CatalogFlatOffers[ItemId]; * * CatalogPage P = null; * if (!PlusEnvironment.GetGame().GetCatalog().Pages.TryGetValue(PageId, out P)) * PageId = 0; * }*/ CatalogPage Page = null; if (!PlusEnvironment.GetGame().GetCatalog().TryGetPage(PageId, out Page)) { return; } if (!Page.Enabled || !Page.Visible || Page.MinimumRank > Session.GetHabbo().Rank || (Page.MinimumVIP > Session.GetHabbo().VIPRank&& Session.GetHabbo().Rank == 1)) { return; } CatalogItem Item = null; if (!Page.Items.TryGetValue(ItemId, out Item)) { if (Page.ItemOffers.ContainsKey(ItemId)) { Item = (CatalogItem)Page.ItemOffers[ItemId]; if (Item == null) { return; } } else { return; } } if (!ItemUtility.CanGiftItem(Item)) { return; } ItemData PresentData = null; if (!PlusEnvironment.GetGame().GetItemManager().GetGift(SpriteId, out PresentData) || PresentData.InteractionType != InteractionType.GIFT) { return; } if (Session.GetHabbo().Credits < Item.CostCredits) { Session.SendPacket(new PresentDeliverErrorMessageComposer(true, false)); return; } if (Session.GetHabbo().Duckets < Item.CostPixels) { Session.SendPacket(new PresentDeliverErrorMessageComposer(false, true)); return; } Habbo Habbo = PlusEnvironment.GetHabboByUsername(GiftUser); if (Habbo == null) { Session.SendPacket(new GiftWrappingErrorComposer()); return; } if (!Habbo.AllowGifts) { Session.SendNotification("Oops, this user doesn't allow gifts to be sent to them!"); return; } if ((DateTime.Now - Session.GetHabbo().LastGiftPurchaseTime).TotalSeconds <= 15.0) { Session.SendNotification("You're purchasing gifts too fast! Please wait 15 seconds!"); Session.GetHabbo().GiftPurchasingWarnings += 1; if (Session.GetHabbo().GiftPurchasingWarnings >= 25) { Session.GetHabbo().SessionGiftBlocked = true; } return; } if (Session.GetHabbo().SessionGiftBlocked) { return; } string ED = GiftUser + Convert.ToChar(5) + GiftMessage + Convert.ToChar(5) + Session.GetHabbo().Id + Convert.ToChar(5) + Item.Data.Id + Convert.ToChar(5) + SpriteId + Convert.ToChar(5) + Ribbon + Convert.ToChar(5) + Colour; int NewItemId = 0; using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor()) { //Insert the dummy item. dbClient.SetQuery("INSERT INTO `items` (`base_item`,`user_id`,`extra_data`) VALUES (@baseId, @habboId, @extra_data)"); dbClient.AddParameter("baseId", PresentData.Id); dbClient.AddParameter("habboId", Habbo.Id); dbClient.AddParameter("extra_data", ED); NewItemId = Convert.ToInt32(dbClient.InsertQuery()); string ItemExtraData = null; switch (Item.Data.InteractionType) { case InteractionType.NONE: ItemExtraData = ""; break; #region Pet handling case InteractionType.PET: try { string[] Bits = Data.Split('\n'); string PetName = Bits[0]; string Race = Bits[1]; string Color = Bits[2]; int.Parse(Race); // to trigger any possible errors if (PetUtility.CheckPetName(PetName)) { return; } if (Race.Length > 2) { return; } if (Color.Length != 6) { return; } PlusEnvironment.GetGame().GetAchievementManager().ProgressAchievement(Session, "ACH_PetLover", 1); } catch { return; } break; #endregion case InteractionType.FLOOR: case InteractionType.WALLPAPER: case InteractionType.LANDSCAPE: Double Number = 0; try { if (string.IsNullOrEmpty(Data)) { Number = 0; } else { Number = Double.Parse(Data, PlusEnvironment.CultureInfo); } } catch { } ItemExtraData = Number.ToString().Replace(',', '.'); break; // maintain extra data // todo: validate case InteractionType.POSTIT: ItemExtraData = "FFFF33"; break; case InteractionType.MOODLIGHT: ItemExtraData = "1,1,1,#000000,255"; break; case InteractionType.TROPHY: ItemExtraData = Session.GetHabbo().Username + Convert.ToChar(9) + DateTime.Now.Day + "-" + DateTime.Now.Month + "-" + DateTime.Now.Year + Convert.ToChar(9) + Data; break; case InteractionType.MANNEQUIN: ItemExtraData = "m" + Convert.ToChar(5) + ".ch-210-1321.lg-285-92" + Convert.ToChar(5) + "Default Mannequin"; break; case InteractionType.BADGE_DISPLAY: if (!Session.GetHabbo().GetBadgeComponent().HasBadge(Data)) { Session.SendPacket(new BroadcastMessageAlertComposer("Oops, it appears that you do not own this badge.")); return; } ItemExtraData = Data + Convert.ToChar(9) + Session.GetHabbo().Username + Convert.ToChar(9) + DateTime.Now.Day + "-" + DateTime.Now.Month + "-" + DateTime.Now.Year; break; default: ItemExtraData = Data; break; } //Insert the present, forever. dbClient.SetQuery("INSERT INTO `user_presents` (`item_id`,`base_id`,`extra_data`) VALUES (@itemId, @baseId, @extra_data)"); dbClient.AddParameter("itemId", NewItemId); dbClient.AddParameter("baseId", Item.Data.Id); dbClient.AddParameter("extra_data", (string.IsNullOrEmpty(ItemExtraData) ? "" : ItemExtraData)); dbClient.RunQuery(); //Here we're clearing up a record, this is dumb, but okay. dbClient.SetQuery("DELETE FROM `items` WHERE `id` = @deleteId LIMIT 1"); dbClient.AddParameter("deleteId", NewItemId); dbClient.RunQuery(); } Item GiveItem = ItemFactory.CreateGiftItem(PresentData, Habbo, ED, ED, NewItemId, 0, 0); if (GiveItem != null) { GameClient Receiver = PlusEnvironment.GetGame().GetClientManager().GetClientByUserID(Habbo.Id); if (Receiver != null) { Receiver.GetHabbo().GetInventoryComponent().TryAddItem(GiveItem); Receiver.SendPacket(new FurniListNotificationComposer(GiveItem.Id, 1)); Receiver.SendPacket(new PurchaseOKComposer()); Receiver.SendPacket(new FurniListAddComposer(GiveItem)); Receiver.SendPacket(new FurniListUpdateComposer()); } if (Habbo.Id != Session.GetHabbo().Id&& !string.IsNullOrWhiteSpace(GiftMessage)) { PlusEnvironment.GetGame().GetAchievementManager().ProgressAchievement(Session, "ACH_GiftGiver", 1); if (Receiver != null) { PlusEnvironment.GetGame().GetAchievementManager().ProgressAchievement(Receiver, "ACH_GiftReceiver", 1); } PlusEnvironment.GetGame().GetQuestManager().ProgressUserQuest(Session, QuestType.GIFT_OTHERS); } } Session.SendPacket(new PurchaseOKComposer(Item, PresentData)); if (Item.CostCredits > 0) { Session.GetHabbo().Credits -= Item.CostCredits; Session.SendPacket(new CreditBalanceComposer(Session.GetHabbo().Credits)); } if (Item.CostPixels > 0) { Session.GetHabbo().Duckets -= Item.CostPixels; Session.SendPacket(new HabboActivityPointNotificationComposer(Session.GetHabbo().Duckets, Session.GetHabbo().Duckets)); } Session.GetHabbo().LastGiftPurchaseTime = DateTime.Now; }
public void Execute(GameClients.GameClient Session, Rooms.Room Room, string[] Params) { StringBuilder Message = new StringBuilder(); if (Params.Length == 1 || Params.Length > 3) { Session.SendWhisper("Use o comando como: ':checarpergunta (usuário) (pergunta)' ou ':checharpergunta (pergunta)'.", 1); return; } using (var dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor()) { if (Params.Length == 2) { int PollId = 0; if (!int.TryParse(Params[1], out PollId)) { Session.SendWhisper("Use o comando como: ':checarpergunta (usuário) (id)' ou ':checharpergunta (id)'.", 1); return; } var Poll = PlusEnvironment.GetGame().GetPollManager().TryGetPollById(PollId); if (Poll == null) { Session.SendWhisper("A ID da Enquete que você inseriu não corresponde a nenhuma pesquisa!", 1); return; } Message.Append("<----- [" + Poll.Id + "] " + Poll.PollName + " ----->\n\n"); Message.Append("Título da Pergunta: " + Poll.PollInvitation + "\n"); Message.Append("Consiste em: " + Poll.Questions.Count + " perguntas totais\n\n"); Message.Append("Os seguintes usuários responderam a esta pesquisa:\n"); dbClient.SetQuery("SELECT * FROM `user_polls` WHERE `poll_id` = '" + PollId + "'"); DataTable Table = dbClient.getTable(); if (Table == null) { Session.SendMessage(new MOTDNotificationComposer("Ninguém respondeu esta enquete ainda!")); return; } else { List <string> UserNames = new List <string>(); foreach (DataRow Row in Table.Rows) { int UserId = Convert.ToInt32(Row["user_id"]); var User = PlusEnvironment.GetGame().GetCacheManager().GenerateUser(UserId); if (!UserNames.Contains(User.Username)) { UserNames.Add(User.Username); } } foreach (string user in UserNames) { Message.Append(user + "\n"); } Session.SendMessage(new MOTDNotificationComposer(Message.ToString())); } } else { Habbo Target = PlusEnvironment.GetHabboByUsername(Params[1]); if (Target == null) { Session.SendWhisper("Desculpe, mas esse usuário não existe!", 1); return; } int PollId = 0; if (!int.TryParse(Params[2], out PollId)) { Session.SendWhisper("Use o comando como: ':checarpergunta (usuário) (id)' ou ':checharpergunta (id)'.", 1); return; } var Poll = PlusEnvironment.GetGame().GetPollManager().TryGetPollById(PollId); if (Poll == null) { Session.SendWhisper("A ID da Enquete que você inseriu não corresponde a nenhuma pesquisa!", 1); return; } dbClient.SetQuery("SELECT * FROM `user_polls` where `user_id` = '" + Target.Id + "' AND `poll_id` = '" + Poll.Id + "' AND `accepted` = '1'"); DataTable Table = dbClient.getTable(); Dictionary <int, string> AnswerList = new Dictionary <int, string>(); foreach (DataRow row in Table.Rows) { int QuestionId = Convert.ToInt32(row["question_id"]); string Answer = row["answer"].ToString(); if (!AnswerList.ContainsKey(QuestionId)) { AnswerList.Add(QuestionId, Answer); } } if (Table == null) { Session.SendWhisper("Este usuário ainda não respondeu esta enquete!", 1); return; } Message.Append(">----- [" + Poll.Id + "] " + Poll.PollName + " ----->\n\n"); Message.Append("Título da Pergunta: " + Poll.PollInvitation + "\n"); Message.Append("Consiste em: " + Poll.Questions.Count + " perguntas totais\n\n"); foreach (var question in Poll.Questions) { Message.Append("Número da pergunta: " + question.Index + "\n"); Message.Append("Pergunta: " + question.Question + "\n"); if (question.AType == Polls.Enums.PollAnswerType.Text) { Message.Append("Answer Type: Text\n"); if (AnswerList.ContainsKey(question.Index)) { Message.Append("User Answered with: " + AnswerList[question.Index] + "\n\n"); } else { Message.Append("User did NOT answer this question!\n\n"); } } else { Message.Append("Tipo de resposta: seleção\n"); Message.Append("Possível resposta: " + string.Join(",", question.Answers.ToList()) + "\n"); Message.Append("Resposta correta(s): " + string.Join(",", question.CorrectAnswers.ToList()) + "\n"); if (AnswerList.ContainsKey(question.Index)) { Message.Append("Usuário respondeu: " + AnswerList[question.Index] + "\n\n"); } else { Message.Append("O usuário NÃO respondeu esta pergunta!\n\n"); } } } Session.SendMessage(new MOTDNotificationComposer(Message.ToString())); } } }
public void Execute(GameClients.GameClient Session, Rooms.Room Room, string[] Params) { #region Conditions if (Params.Length == 1) { Session.SendWhisper("Comando inválido! Use ':divorciar <usuário>'.", 1); return; } if (Session.GetRoleplay().MarriedTo == 0) { Session.SendWhisper("Você não é casado(a) com ninguém!", 1); return; } GameClient TargetClient = PlusEnvironment.GetGame().GetClientManager().GetClientByUsername(Params[1]); #endregion #region Execute if (TargetClient == null) { using (var dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor()) { var Habbo = PlusEnvironment.GetHabboByUsername(Params[1]); if (Habbo == null) { Session.SendWhisper("Não foi possível encontrar esse usuário! Talvez você tenha digitado o nome errado", 1); return; } dbClient.SetQuery("SELECT `id` FROM `rp_stats` WHERE `id` = '" + Habbo.Id + "' LIMIT 1"); var Row = dbClient.getRow(); if (Row == null) { Session.SendWhisper("Não foi possível encontrar esse usuário! Talvez você tenha digitado o nome errado", 1); return; } int TargetMarriedTo = Convert.ToInt32(Row["id"]); if (Session.GetRoleplay().MarriedTo != TargetMarriedTo) { Session.SendWhisper("Você não é casado(a) com essa pessoa!", 1); return; } else { dbClient.RunQuery("UPDATE `rp_stats` SET `married_to` = '0' WHERE `id` = '" + Habbo.Id + "'"); dbClient.RunQuery("DELETE FROM `user_badges` WHERE `badge_id` = 'WD0' AND `user_id` = '" + Habbo.Id + "'"); dbClient.RunQuery("UPDATE `rp_stats` SET `married_to` = '0' WHERE `id` = '" + Session.GetHabbo().Id + "'"); Session.GetRoleplay().MarriedTo = 0; if (Session.GetHabbo().GetBadgeComponent().HasBadge("WD0")) { Session.GetHabbo().GetBadgeComponent().RemoveBadge("WD0"); } if (PlusEnvironment.GetGame().GetCacheManager().ContainsUser(Session.GetHabbo().Id)) { PlusEnvironment.GetGame().GetCacheManager().TryUpdateUser(Session); } UserCache Junk; if (PlusEnvironment.GetGame().GetCacheManager().ContainsUser(Habbo.Id)) { PlusEnvironment.GetGame().GetCacheManager().TryRemoveUser(Habbo.Id, out Junk); } Session.Shout("*Retira o anel de casamento e joga no chão, anunciando que está se divorciando de " + Habbo.Username + "*", 7); } } } else { if (TargetClient.GetRoleplay().MarriedTo != Session.GetHabbo().Id) { Session.SendWhisper("Você não é casado(a) com essa pessoa!", 1); return; } TargetClient.GetRoleplay().MarriedTo = 0; Session.GetRoleplay().MarriedTo = 0; if (Session.GetHabbo().GetBadgeComponent().HasBadge("WD0")) { Session.GetHabbo().GetBadgeComponent().RemoveBadge("WD0"); } if (TargetClient.GetHabbo().GetBadgeComponent().HasBadge("WD0")) { TargetClient.GetHabbo().GetBadgeComponent().RemoveBadge("WD0"); } if (PlusEnvironment.GetGame().GetCacheManager().ContainsUser(Session.GetHabbo().Id)) { PlusEnvironment.GetGame().GetCacheManager().TryUpdateUser(Session); } if (PlusEnvironment.GetGame().GetCacheManager().ContainsUser(TargetClient.GetHabbo().Id)) { PlusEnvironment.GetGame().GetCacheManager().TryUpdateUser(TargetClient); } Session.Shout("*Retira o anel de casamento e joga no chão, anunciando que está se divorciando de " + TargetClient.GetHabbo().Username + "*", 7); TargetClient.SendNotification(Session.GetHabbo().Username + " acabou de se divorciar de você!"); } #endregion }
public void Parse(HabboHotel.GameClients.GameClient Session, ClientPacket Packet) { int PageId = Packet.PopInt(); int ItemId = Packet.PopInt(); string Data = Packet.PopString(); string GiftUser = StringCharFilter.Escape(Packet.PopString()); string GiftMessage = StringCharFilter.Escape(Packet.PopString().Replace(Convert.ToChar(5), ' ')); int SpriteId = Packet.PopInt(); int Ribbon = Packet.PopInt(); int Colour = Packet.PopInt(); bool dnow = Packet.PopBoolean(); if (PlusEnvironment.GetDBConfig().DBData["gifts_enabled"] != "1") { Session.SendNotification("Os gerentes do hotel desativou esta função!"); return; } /*if (PlusEnvironment.GetGame().GetCatalog().CatalogFlatOffers.ContainsKey(ItemId) && PageId < 0) * { * PageId = PlusEnvironment.GetGame().GetCatalog().CatalogFlatOffers[ItemId]; * * CatalogPage P = null; * if (!PlusEnvironment.GetGame().GetCatalog().Pages.TryGetValue(PageId, out P)) * PageId = 0; * }*/ CatalogPage Page = null; if (!PlusEnvironment.GetGame().GetCatalog().TryGetPage(PageId, out Page)) { return; } if (!Page.Enabled || !Page.Visible || Page.MinimumRank > Session.GetHabbo().Rank || (Page.MinimumVIP > Session.GetHabbo().VIPRank&& Session.GetHabbo().Rank == 1)) { return; } CatalogItem Item = null; if (!Page.Items.TryGetValue(ItemId, out Item)) { if (Page.ItemOffers.ContainsKey(ItemId)) { Item = (CatalogItem)Page.ItemOffers[ItemId]; if (Item == null) { return; } } else { return; } } if (!ItemUtility.CanGiftItem(Item)) { return; } ItemData PresentData = null; if (!PlusEnvironment.GetGame().GetItemManager().GetGift(SpriteId, out PresentData) || PresentData.InteractionType != InteractionType.GIFT) { return; } if (Session.GetHabbo().Credits < Item.CostCredits) { Session.SendMessage(new PresentDeliverErrorMessageComposer(true, false)); return; } if (Session.GetHabbo().Duckets < Item.CostPixels) { Session.SendMessage(new PresentDeliverErrorMessageComposer(false, true)); return; } Habbo Habbo = PlusEnvironment.GetHabboByUsername(GiftUser); if (Habbo == null) { Session.SendMessage(new GiftWrappingErrorComposer()); return; } if (!Habbo.AllowGifts) { Session.SendNotification("Opa, este usuário não permite que os presentes sejam enviados para ele!"); return; } if ((DateTime.Now - Session.GetHabbo().LastGiftPurchaseTime).TotalSeconds <= 15.0) { Session.SendNotification("Você está comprando presentes muito rápido! Aguarde 15 segundos!"); Session.GetHabbo().GiftPurchasingWarnings += 1; if (Session.GetHabbo().GiftPurchasingWarnings >= 25) { Session.GetHabbo().SessionGiftBlocked = true; } return; } if (Session.GetHabbo().SessionGiftBlocked) { return; } string ED = GiftUser + Convert.ToChar(5) + GiftMessage + Convert.ToChar(5) + Session.GetHabbo().Id + Convert.ToChar(5) + Item.Data.Id + Convert.ToChar(5) + SpriteId + Convert.ToChar(5) + Ribbon + Convert.ToChar(5) + Colour; int NewItemId = 0; using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor()) { //Insert the dummy item. dbClient.SetQuery("INSERT INTO `items` (`base_item`,`user_id`,`extra_data`) VALUES ('" + PresentData.Id + "', '" + Habbo.Id + "', @extra_data)"); dbClient.AddParameter("extra_data", ED); NewItemId = Convert.ToInt32(dbClient.InsertQuery()); string ItemExtraData = null; switch (Item.Data.InteractionType) { case InteractionType.NONE: ItemExtraData = ""; break; #region Pet handling case InteractionType.pet0: case InteractionType.pet1: case InteractionType.pet2: case InteractionType.pet3: case InteractionType.pet4: case InteractionType.pet5: case InteractionType.pet6: case InteractionType.pet7: case InteractionType.pet8: case InteractionType.pet9: case InteractionType.pet10: case InteractionType.pet11: case InteractionType.pet12: case InteractionType.pet13: //Caballo case InteractionType.pet14: case InteractionType.pet15: case InteractionType.pet16: //Mascota agregada case InteractionType.pet17: //Mascota agregada case InteractionType.pet18: //Mascota agregada case InteractionType.pet19: //Mascota agregada case InteractionType.pet20: //Mascota agregada case InteractionType.pet21: //Mascota agregada case InteractionType.pet22: //Mascota agregada case InteractionType.pet28: case InteractionType.pet29: case InteractionType.pet30: try { string[] Bits = Data.Split('\n'); string PetName = Bits[0]; string Race = Bits[1]; string Color = Bits[2]; int.Parse(Race); // to trigger any possible errors if (PetUtility.CheckPetName(PetName)) { return; } if (Race.Length > 2) { return; } if (Color.Length != 6) { return; } //PlusEnvironment.GetGame().GetAchievementManager().ProgressAchievement(Session, "ACH_PetLover", 1); } catch { return; } break; #endregion case InteractionType.FLOOR: case InteractionType.WALLPAPER: case InteractionType.LANDSCAPE: Double Number = 0; try { if (string.IsNullOrEmpty(Data)) { Number = 0; } else { Number = Double.Parse(Data, PlusEnvironment.CultureInfo); } } catch { } ItemExtraData = Number.ToString().Replace(',', '.'); break; // maintain extra data // todo: validate case InteractionType.POSTIT: ItemExtraData = "FFFF33"; break; case InteractionType.MOODLIGHT: ItemExtraData = "1,1,1,#000000,255"; break; case InteractionType.TROPHY: ItemExtraData = Session.GetHabbo().Username + Convert.ToChar(9) + DateTime.Now.Day + "-" + DateTime.Now.Month + "-" + DateTime.Now.Year + Convert.ToChar(9) + Data; break; case InteractionType.MANNEQUIN: ItemExtraData = "m" + Convert.ToChar(5) + ".ch-210-1321.lg-285-92" + Convert.ToChar(5) + "Manequim padrão"; break; case InteractionType.BADGE_DISPLAY: if (!Session.GetHabbo().GetBadgeComponent().HasBadge(Data)) { Session.SendMessage(new BroadcastMessageAlertComposer("Opa, parece que você não possui este emblema.")); return; } ItemExtraData = Data + Convert.ToChar(9) + Session.GetHabbo().Username + Convert.ToChar(9) + DateTime.Now.Day + "-" + DateTime.Now.Month + "-" + DateTime.Now.Year; break; default: ItemExtraData = Data; break; } //Insert the present, forever. dbClient.SetQuery("INSERT INTO `user_presents` (`item_id`,`base_id`,`extra_data`) VALUES ('" + NewItemId + "', '" + Item.Data.Id + "', @extra_data)"); dbClient.AddParameter("extra_data", (string.IsNullOrEmpty(ItemExtraData) ? "" : ItemExtraData)); dbClient.RunQuery(); //Here we're clearing up a record, this is dumb, but okay. dbClient.RunQuery("DELETE FROM `items` WHERE `id` = " + NewItemId + " LIMIT 1;"); } Item GiveItem = ItemFactory.CreateGiftItem(PresentData, Habbo, ED, ED, NewItemId, 0, 0); if (GiveItem != null) { GameClient Receiver = PlusEnvironment.GetGame().GetClientManager().GetClientByUserID(Habbo.Id); if (Receiver != null) { Receiver.GetHabbo().GetInventoryComponent().TryAddItem(GiveItem); Receiver.SendMessage(new FurniListNotificationComposer(GiveItem.Id, 1)); Receiver.SendMessage(new PurchaseOKComposer()); Receiver.SendMessage(new FurniListAddComposer(GiveItem)); Receiver.SendMessage(new FurniListUpdateComposer()); } if (Habbo.Id != Session.GetHabbo().Id&& !string.IsNullOrWhiteSpace(GiftMessage)) { //PlusEnvironment.GetGame().GetAchievementManager().ProgressAchievement(Session, "ACH_GiftGiver", 1); //if (Receiver != null) // PlusEnvironment.GetGame().GetAchievementManager().ProgressAchievement(Receiver, "ACH_GiftReceiver", 1); //PlusEnvironment.GetGame().GetQuestManager().ProgressUserQuest(Session, QuestType.GIFT_OTHERS); } } Session.SendMessage(new PurchaseOKComposer(Item, PresentData)); if (Item.CostCredits > 0) { Session.GetHabbo().Credits -= Item.CostCredits; Session.SendMessage(new CreditBalanceComposer(Session.GetHabbo().Credits)); } if (Item.CostPixels > 0) { Session.GetHabbo().Duckets -= Item.CostPixels; Session.SendMessage(new HabboActivityPointNotificationComposer(Session.GetHabbo().Duckets, Session.GetHabbo().Duckets)); } Session.GetHabbo().LastGiftPurchaseTime = DateTime.Now; }
public void Execute(GameClients.GameClient Session, Rooms.Room Room, string[] Params) { if (Params.Length == 1) { Session.SendWhisper("Digite o usuário que deseja banir.", 1); return; } Habbo Habbo = PlusEnvironment.GetHabboByUsername(Params[1]); if (Habbo == null) { Session.SendWhisper("Ocorreu um erro ao encontrar esse usuário no banco de dados.", 1); return; } if (Habbo.GetPermissions().HasRight("mod_soft_ban") && !Session.GetHabbo().GetPermissions().HasRight("mod_ban_any")) { Session.SendWhisper("Opa, você não pode banir esse usuário.", 1); return; } Double Expire = 0; string Minutes = Params[2]; if (Minutes == "perm") { Expire = PlusEnvironment.GetUnixTimestamp() + 78892200; } else { Expire = (PlusEnvironment.GetUnixTimestamp() + (Convert.ToDouble(Minutes) * 60)); } string Reason = null; if (Params.Length >= 4) { Reason = CommandManager.MergeParams(Params, 3); } else { Reason = "Sem razão específica, mas provavelmente fez merda."; } string Username = Habbo.Username; using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor()) { dbClient.RunQuery("UPDATE `user_info` SET `bans` = `bans` + '1' WHERE `user_id` = '" + Habbo.Id + "' LIMIT 1"); } PlusEnvironment.GetGame().GetModerationManager().BanUser(Session.GetHabbo().Username, ModerationBanType.USERNAME, Habbo.Username, Reason, Expire); GameClient TargetClient = PlusEnvironment.GetGame().GetClientManager().GetClientByUsername(Username); if (TargetClient != null) { TargetClient.Disconnect(true); } int Hours = 0; int MinutesLeft = 0; if (Minutes != "perm") { Hours = Convert.ToInt32(Math.Floor(Convert.ToDouble(Minutes) / 60)); MinutesLeft = Convert.ToInt32(Minutes); } if (Hours > 0) { MinutesLeft -= Hours * 60; Session.SendWhisper("Você baniu com sucesso'" + Username + "' por " + Hours + " hora(s) e " + MinutesLeft + " minuto(s) com a razão: '" + Reason + "'!", 1); } else { if (Minutes == "perm") { Session.SendWhisper("Você baniu o usuário '" + Username + "' permanente com a razão '" + Reason + "'!", 1); } else { Session.SendWhisper("Você baniu o usuário '" + Username + "' por " + MinutesLeft + " minuto(s) com a razão '" + Reason + "'!", 1); } } }
public void Execute(GameClients.GameClient Session, Room Room, string[] Params) { if (Params.Length == 1) { Session.SendWhisper("Please enter a username and a valid length in days (min 1 day, max 365 days)."); return; } Habbo Habbo = PlusEnvironment.GetHabboByUsername(Params[1]); if (Habbo == null) { Session.SendWhisper("An error occoured whilst finding that user in the database."); return; } if (Convert.ToDouble(Params[2]) == 0) { using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor()) { dbClient.RunQuery("UPDATE `user_info` SET `trading_locked` = '0' WHERE `user_id` = '" + Habbo.Id + "' LIMIT 1"); } if (Habbo.GetClient() != null) { Habbo.TradingLockExpiry = 0; Habbo.GetClient().SendNotification("Your outstanding trade ban has been removed."); } Session.SendWhisper("You have successfully removed " + Habbo.Username + "'s trade ban."); return; } double Days; if (double.TryParse(Params[2], out Days)) { if (Days < 1) { Days = 1; } if (Days > 365) { Days = 365; } double Length = (PlusEnvironment.GetUnixTimestamp() + (Days * 86400)); using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor()) { dbClient.RunQuery("UPDATE `user_info` SET `trading_locked` = '" + Length + "', `trading_locks_count` = `trading_locks_count` + '1' WHERE `user_id` = '" + Habbo.Id + "' LIMIT 1"); } if (Habbo.GetClient() != null) { Habbo.TradingLockExpiry = Length; Habbo.GetClient().SendNotification("You have been trade banned for " + Days + " day(s)!"); } Session.SendWhisper("You have successfully trade banned " + Habbo.Username + " for " + Days + " day(s)."); } else { Session.SendWhisper("Please enter a valid integer."); } }