internal GenericBot(int VirtualId, int BotId, AIType Type, bool IsBartender) { int num = 7; using (IQueryAdapter queryreactor = CyberEnvironment.GetDatabaseManager().getQueryReactor()) { queryreactor.setQuery("SELECT speaking_interval from bots WHERE id = " + BotId); num = queryreactor.getInteger(); queryreactor.setQuery("SELECT automatic_chat from bots WHERE id = " + BotId); this.canSpeak = Convert.ToBoolean(queryreactor.getString()); queryreactor.setQuery("SELECT mix_phrases from bots WHERE id = " + BotId); this.MixPhrases = Convert.ToBoolean(queryreactor.getString()); } this.SpeechTimer = num * 1000; this.moveTimer = 0; this.virtualId = VirtualId; this.IsBartender = IsBartender; if (SpeechTimer < 2000) { SpeechTimer = 2000; } if (canSpeak || MixPhrases) { this.chatTimer = new Timer(new TimerCallback(ChatTimerTick), null, SpeechTimer, SpeechTimer); } }
public static bool CheckUserForDupe(GameClient Session) { string timestampnew2 = DateTime.Today.ToString("MM/dd"); string IPAddress = string.Empty; string GetRewardStamp = string.Empty; using (IQueryAdapter dbClient = GetDatabaseManager().GetQueryReactor()) { dbClient.SetQuery("SELECT `dailyGift` FROM `users` WHERE `id` = @id LIMIT 1"); dbClient.AddParameter("id", Session.GetHabbo().Id); timestampnew2 = dbClient.getString(); dbClient.SetQuery("SELECT `ip_last` FROM `users` WHERE `id` = @id LIMIT 1"); dbClient.AddParameter("id", Session.GetHabbo().Id); IPAddress = dbClient.getString(); dbClient.SetQuery("SELECT `ip_last`,`dailyGift` FROM `users` WHERE `ip_last` = @ip AND `dailyGift` = @time LIMIT 1"); dbClient.AddParameter("time", timestampnew2); dbClient.AddParameter("ip", IPAddress); GetRewardStamp = dbClient.getString(); } if (GetRewardStamp.Length != 0) { return(false); } return(true); }
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); } }
/// <summary> /// Obtiene el nombre de usuario mediante el Id de usuario. /// </summary> /// <param name="userId">Id del usuario.</param> /// <returns></returns> internal static string getUsernameById(uint userId) { if (usernameById.ContainsKey(userId)) { return(usernameById[userId]); } string username = ""; GameClient client = OtanixEnvironment.GetGame().GetClientManager().GetClientByUserID(userId); if (client != null && client.GetHabbo() != null) { username = client.GetHabbo().Username; } else { using (IQueryAdapter dbClient = OtanixEnvironment.GetDatabaseManager().getQueryreactor()) { dbClient.setQuery("SELECT username FROM users WHERE id = " + userId); username = dbClient.getString(); } } if (username != "") { if (!usernameById.ContainsKey(userId)) { usernameById.Add(userId, username); } } return(username); }
public void Execute(GameClients.GameClient Session, Rooms.Room Room, string[] Params) { if (Params.Length == 1) { Session.SendWhisper("Por favor, introduzca el nombre de usuario del usuario."); return; } Habbo Habbo = CloudServer.GetHabboByUsername(Params[1]); if (Habbo == null) { Session.SendWhisper("Se produjo un error mientras que la búsqueda de usuario en la base de datos."); return; } if (Habbo.GetPermissions().HasRight("mod_soft_ban") && !Session.GetHabbo().GetPermissions().HasRight("mod_ban_any")) { Session.SendWhisper("Vaya, no se puede desbanear este usuario."); return; } string Username = Habbo.Username; string IPAddress = ""; using (IQueryAdapter dbClient = CloudServer.GetDatabaseManager().GetQueryReactor()) { dbClient.SetQuery("SELECT `ip_last` FROM `users` WHERE `id` = '" + Habbo.Id + "' LIMIT 1"); IPAddress = dbClient.getString(); dbClient.runFastQuery("DELETE FROM `bans` WHERE `value` = '" + Habbo.Username + "' or `value` = '" + IPAddress + "' LIMIT 1"); } Session.SendWhisper("Éxito, usted desbaneo a '" + Username + "'!"); }
public static bool CheckDupeUsers(GameClient User1, GameClient User2 = null) { String User1IP = String.Empty; string FirstUser = User1.GetHabbo().Username; using (IQueryAdapter dbClient = GetDatabaseManager().GetQueryReactor()) { dbClient.SetQuery("SELECT `ip_last` FROM `users` WHERE `id` = '" + User1.GetHabbo().Id + "' LIMIT 1"); User1IP = dbClient.getString(); } String User2IP = String.Empty; string SecondUser = User2.GetHabbo().Username; using (IQueryAdapter dbClient = GetDatabaseManager().GetQueryReactor()) { dbClient.SetQuery("SELECT `ip_last` FROM `users` WHERE `id` = '" + User2.GetHabbo().Id + "' LIMIT 1"); User2IP = dbClient.getString(); } if (User1IP != User2IP) { return(false); } return(true); }
public static string GetUsernameById(int UserId) { string Name = "Unknown User"; GameClient Client = GetGame().GetClientManager().GetClientByUserID(UserId); if (Client != null && Client.GetHabbo() != null) { return(Client.GetHabbo().Username); } UserCache User = HabboEnvironment.GetGame().GetCacheManager().GenerateUser(UserId); if (User != null) { return(User.Username); } using (IQueryAdapter dbClient = HabboEnvironment.GetDatabaseManager().GetQueryReactor()) { dbClient.SetQuery("SELECT `username` FROM `users` WHERE id = @id LIMIT 1"); dbClient.AddParameter("id", UserId); Name = dbClient.getString(); } if (string.IsNullOrEmpty(Name)) { Name = "Unknown User"; } return(Name); }
internal int GetMessageCountForThread(uint Id) { using (IQueryAdapter queryreactor = CyberEnvironment.GetDatabaseManager().getQueryReactor()) { queryreactor.setQuery("SELECT COUNT(*) FROM group_forum_posts WHERE parent_id = @id"); queryreactor.addParameter("id", Id); return(int.Parse(queryreactor.getString())); } }
public static int GetHopperId(int NextRoom) { using (IQueryAdapter dbClient = RocketEmulador.GetDatabaseManager().GetQueryReactor()) { dbClient.SetQuery("SELECT hopper_id FROM items_hopper WHERE room_id = @room LIMIT 1"); dbClient.AddParameter("room", NextRoom); string Row = dbClient.getString(); if (Row == null) { return(0); } return(Convert.ToInt32(Row)); } }
public void Execute(GameClients.GameClient Session, Rooms.Room Room, string[] Params) { if (ExtraSettings.STAFF_EFFECT_ENABLED_ROOM) { if (Session.GetHabbo().isLoggedIn&& Session.GetHabbo().Rank > Convert.ToInt32(BiosEmuThiago.GetConfig().data["MineRankStaff"])) { } else { Session.SendWhisper("Você precisa estar logado como staff para usar este comando."); return; } } if (Params.Length == 1) { Session.SendWhisper("Digite o nome de usuário do usuário."); return; } Habbo Habbo = BiosEmuThiago.GetHabboByUsername(Params[1]); if (Habbo == null) { Session.SendWhisper("Ocorreu um erro ao procurar o usuário no banco de dados."); return; } if (Habbo.GetPermissions().HasRight("mod_soft_ban") && !Session.GetHabbo().GetPermissions().HasRight("mod_ban_any")) { Session.SendWhisper("Ops, você não pode desbanir esse usuário."); return; } string Username = Habbo.Username; string IPAddress = ""; using (IQueryAdapter dbClient = BiosEmuThiago.GetDatabaseManager().GetQueryReactor()) { dbClient.SetQuery("SELECT `ip_last` FROM `users` WHERE `id` = '" + Habbo.Id + "' LIMIT 1"); IPAddress = dbClient.getString(); dbClient.runFastQuery("DELETE FROM `bans` WHERE `value` = '" + Habbo.Username + "' or `value` = '" + IPAddress + "' LIMIT 1"); } Session.SendWhisper("Sucesso, você desbaniu o usuário(a) '" + Username + "'!"); }
internal string GetNameById(uint Id) { GameClient clientByUserID = this.GetClientByUserID(Id); if (clientByUserID != null) { return(clientByUserID.GetHabbo().Username); } string @string; using (IQueryAdapter queryreactor = CyberEnvironment.GetDatabaseManager().getQueryReactor()) { queryreactor.setQuery("SELECT username FROM users WHERE id = " + Id); @string = queryreactor.getString(); } return(@string); }
public bool TryExecute(string[] parameters) { int userId = 0; if (!int.TryParse(parameters[0].ToString(), out userId)) { return(false); } GameClient client = CloudServer.GetGame().GetClientManager().GetClientByUserID(userId); if (client == null || client.GetHabbo() == null) { return(false); } using (IQueryAdapter dbClient = CloudServer.GetDatabaseManager().GetQueryReactor()) { dbClient.SetQuery("SELECT `motto` FROM `users` WHERE `id` = @userID LIMIT 1"); dbClient.AddParameter("userID", userId); client.GetHabbo().Motto = dbClient.getString(); } // If we're in a room, we cannot really send the packets, so flag this as completed successfully, since we already updated it. if (!client.GetHabbo().InRoom) { return(true); } else { //We are in a room, let's try to run the packets. Room Room = client.GetHabbo().CurrentRoom; if (Room != null) { RoomUser User = Room.GetRoomUserManager().GetRoomUserByHabbo(client.GetHabbo().Id); if (User != null) { Room.SendMessage(new UserChangeComposer(User, false)); return(true); } } } return(false); }
internal string GetNameById(uint Id) { GameClient client = GetClientByUserID(Id); if (client != null) { return(client.GetHabbo().Username); } string username; using (IQueryAdapter dbClient = ButterflyEnvironment.GetDatabaseManager().getQueryreactor()) { dbClient.setQuery("SELECT username FROM users WHERE id = " + Id); username = dbClient.getString(); } return(username); }
public string GetNameById(int Id) { GameClient Client = GetClientByUserID(Id); if (Client != null) { return(Client.GetHabbo().Username); } string Username; using (IQueryAdapter DbClient = ProjectHub.GetDatabaseManager().GetQueryReactor()) { DbClient.SetQuery("SELECT username FROM " + ProjectHub.DbPrefix + "users WHERE id = @id LIMIT 1"); DbClient.AddParameter("id", Id); Username = DbClient.getString(); } return(Username); }
internal static uint GetHopperId(uint NextRoom) { uint result; using (IQueryAdapter queryreactor = CyberEnvironment.GetDatabaseManager().getQueryReactor()) { queryreactor.setQuery("SELECT hopper_id FROM items_hopper WHERE room_id = @room LIMIT 1"); queryreactor.addParameter("room", NextRoom); string @string = queryreactor.getString(); if (@string == null) { result = 0u; } else { result = Convert.ToUInt32(@string); } } return(result); }
public string GetNameById(int Id) { GameClient client = GetClientByUserID(Id); if (client != null) { return(client.GetHabbo().Username); } string username; using (IQueryAdapter dbClient = NeonEnvironment.GetDatabaseManager().GetQueryReactor()) { dbClient.SetQuery("SELECT username FROM users WHERE id = @id LIMIT 1"); dbClient.AddParameter("id", Id); username = dbClient.getString(); } return(username); }
internal void BanUser(GameClient Client, string Moderator, double LengthSeconds, string Reason, bool IpBan, bool Machine) { ModerationBanType type = ModerationBanType.USERNAME; string text = Client.GetHabbo().Username; string query = "user"; double num = (double)CyberEnvironment.GetUnixTimestamp() + LengthSeconds; if (IpBan) { type = ModerationBanType.IP; using (IQueryAdapter queryreactor = CyberEnvironment.GetDatabaseManager().getQueryReactor()) { queryreactor.setQuery("SELECT ip_last FROM users WHERE username='******' LIMIT 1"); text = queryreactor.getString(); } query = "ip"; } if (Machine) { type = ModerationBanType.MACHINE; query = "machine"; text = Client.MachineId; } ModerationBan moderationBan = new ModerationBan(type, text, Reason, num); if (moderationBan.Type == ModerationBanType.IP) { if (this.bannedIPs.Contains(text)) { this.bannedIPs[text] = moderationBan; } else { this.bannedIPs.Add(text, moderationBan); } } else { if (moderationBan.Type == ModerationBanType.MACHINE) { if (this.bannedMachines.ContainsKey(text)) { this.bannedMachines[text] = moderationBan; } else { this.bannedMachines.Add(text, moderationBan); } } else { if (this.bannedUsernames.Contains(text)) { this.bannedUsernames[text] = moderationBan; } else { this.bannedUsernames.Add(text, moderationBan); } } } using (IQueryAdapter queryreactor2 = CyberEnvironment.GetDatabaseManager().getQueryReactor()) { queryreactor2.setQuery(string.Concat(new object[] { "INSERT INTO bans (bantype,value,reason,expire,added_by,added_date) VALUES (@rawvar,@var,@reason,'", num, "',@mod,'", DateTime.Now.ToLongDateString(), "')" })); queryreactor2.addParameter("rawvar", query); queryreactor2.addParameter("var", text); queryreactor2.addParameter("reason", Reason); queryreactor2.addParameter("mod", Moderator); queryreactor2.runQuery(); } if (IpBan) { DataTable dataTable = null; using (IQueryAdapter queryreactor3 = CyberEnvironment.GetDatabaseManager().getQueryReactor()) { queryreactor3.setQuery("SELECT id FROM users WHERE ip_last = @var"); queryreactor3.addParameter("var", text); dataTable = queryreactor3.getTable(); } if (dataTable != null) { using (IQueryAdapter queryreactor4 = CyberEnvironment.GetDatabaseManager().getQueryReactor()) { foreach (DataRow dataRow in dataTable.Rows) { queryreactor4.runFastQuery("UPDATE user_info SET bans = bans + 1 WHERE user_id = " + Convert.ToUInt32(dataRow["id"])); } } } this.BanUser(Client, Moderator, LengthSeconds, Reason, false, false); return; } using (IQueryAdapter queryreactor5 = CyberEnvironment.GetDatabaseManager().getQueryReactor()) { queryreactor5.runFastQuery("UPDATE user_info SET bans = bans + 1 WHERE user_id = " + Client.GetHabbo().Id); } Client.Disconnect(); }
public void processCommand(String data) { GameClient Client = null; String header = data.Split(Convert.ToChar(1))[0]; String param = data.Split(Convert.ToChar(1))[1]; string[] Params = param.ToString().Split(':'); switch (header.ToLower()) { #region User Related #region :reload_credits <UserID> case "reload_credits": { int UserId = Convert.ToInt32(Params[0]); Client = RavenEnvironment.GetGame().GetClientManager().GetClientByUserID(UserId); if (Client == null || Client.GetHabbo() == null) { break; } int Credits = 0; using (IQueryAdapter dbClient = RavenEnvironment.GetDatabaseManager().GetQueryReactor()) { dbClient.SetQuery("SELECT `credits` FROM `users` WHERE `id` = @id LIMIT 1"); dbClient.AddParameter("id", UserId); Credits = dbClient.getInteger(); } Client.GetHabbo().Credits = Credits; Client.SendMessage(new CreditBalanceComposer(Client.GetHabbo().Credits)); break; } #endregion #region :reload_pixels <UserID> case "reload_pixels": { int UserId = Convert.ToInt32(Params[0]); Client = RavenEnvironment.GetGame().GetClientManager().GetClientByUserID(UserId); if (Client == null || Client.GetHabbo() == null) { break; } int Pixels = 0; using (IQueryAdapter dbClient = RavenEnvironment.GetDatabaseManager().GetQueryReactor()) { dbClient.SetQuery("SELECT `activity_points` FROM `users` WHERE `id` = @id LIMIT 1"); dbClient.AddParameter("id", UserId); Pixels = dbClient.getInteger(); } Client.GetHabbo().Duckets = Pixels; Client.SendMessage(new HabboActivityPointNotificationComposer(Client.GetHabbo().Duckets, Pixels)); break; } #endregion #region :reload_diamonds <UserID> case "reload_diamonds": { int UserId = Convert.ToInt32(Params[0]); Client = RavenEnvironment.GetGame().GetClientManager().GetClientByUserID(UserId); if (Client == null || Client.GetHabbo() == null) { break; } int Diamonds = 0; using (IQueryAdapter dbClient = RavenEnvironment.GetDatabaseManager().GetQueryReactor()) { dbClient.SetQuery("SELECT `vip_points` FROM `users` WHERE `id` = @id LIMIT 1"); dbClient.AddParameter("id", UserId); Diamonds = dbClient.getInteger(); } Client.GetHabbo().Diamonds = Diamonds; Client.SendMessage(new HabboActivityPointNotificationComposer(Diamonds, 0, 5)); break; } #endregion #region :reload_gotw <UserID> case "reload_gotw": { int UserId = Convert.ToInt32(Params[0]); Client = RavenEnvironment.GetGame().GetClientManager().GetClientByUserID(UserId); if (Client == null || Client.GetHabbo() == null) { break; } int GOTWPoints = 0; using (IQueryAdapter dbClient = RavenEnvironment.GetDatabaseManager().GetQueryReactor()) { dbClient.SetQuery("SELECT `gotw_points` FROM `users` WHERE `id` = @id LIMIT 1"); dbClient.AddParameter("id", UserId); GOTWPoints = dbClient.getInteger(); } Client.GetHabbo().GOTWPoints = GOTWPoints; Client.SendMessage(new HabboActivityPointNotificationComposer(GOTWPoints, 0, 103)); break; } #endregion #region :reload_user_rank userID case "reload_user_rank": { int UserId = Convert.ToInt32(Params[0]); Client = RavenEnvironment.GetGame().GetClientManager().GetClientByUserID(UserId); if (Client == null || Client.GetHabbo() == null) { break; } using (IQueryAdapter dbClient = RavenEnvironment.GetDatabaseManager().GetQueryReactor()) { dbClient.SetQuery("SELECT `rank` FROM `users` WHERE `id` = @userID LIMIT 1"); dbClient.AddParameter("userID", UserId); Client.GetHabbo().Rank = dbClient.getInteger(); } break; } #endregion #region :reload_user_vip userID case "reload_user_vip": { int UserId = Convert.ToInt32(Params[0]); Client = RavenEnvironment.GetGame().GetClientManager().GetClientByUserID(UserId); if (Client == null || Client.GetHabbo() == null) { break; } using (IQueryAdapter dbClient = RavenEnvironment.GetDatabaseManager().GetQueryReactor()) { dbClient.SetQuery("SELECT `rank_vip` FROM `users` WHERE `id` = @userID LIMIT 1"); dbClient.AddParameter("userID", UserId); Client.GetHabbo().VIPRank = dbClient.getInteger(); } break; } #endregion #region :reload_motto userID case "reload_motto": { int UserId = Convert.ToInt32(Params[0]); Client = RavenEnvironment.GetGame().GetClientManager().GetClientByUserID(UserId); if (Client == null || Client.GetHabbo() == null) { break; } using (IQueryAdapter dbClient = RavenEnvironment.GetDatabaseManager().GetQueryReactor()) { dbClient.SetQuery("SELECT `motto` FROM `users` WHERE `id` = @userID LIMIT 1"); dbClient.AddParameter("userID", UserId); Client.GetHabbo().Motto = dbClient.getString(); } if (Client.GetHabbo().InRoom) { Room Room = Client.GetHabbo().CurrentRoom; if (Room == null) { return; } RoomUser User = Room.GetRoomUserManager().GetRoomUserByHabbo(Client.GetHabbo().Id); if (User == null || User.GetClient() == null) { return; } Room.SendMessage(new UserChangeComposer(User, false)); } break; } #endregion #region :alert_user <userid> <message> case "alert": case "alert_user": { int UserId = Convert.ToInt32(Params[0]); string alertMessage = Convert.ToString(Params[1]); Client = RavenEnvironment.GetGame().GetClientManager().GetClientByUserID(UserId); if (Client == null || Client.GetHabbo() == null) { break; } Client.SendMessage(new BroadcastMessageAlertComposer(alertMessage)); break; } #endregion #region :reload_badges <UserID> case "update_badges": case "reload_badges": { int UserId = Convert.ToInt32(Params[0]); Client = RavenEnvironment.GetGame().GetClientManager().GetClientByUserID(UserId); if (Client != null) { if (Client.GetHabbo() != null) { Client.SendMessage(new BadgesComposer(Client)); } } break; } #endregion #region :givebadge <UserID> <badge> case "givebadge": { int UserId = Convert.ToInt32(Params[0]); string badgeCode = Convert.ToString(Params[1]); Client = RavenEnvironment.GetGame().GetClientManager().GetClientByUserID(UserId); if (Client != null) { if (Client.GetHabbo() != null) { Client.GetHabbo().GetBadgeComponent().GiveBadge(badgeCode, true, Client); } } break; } #endregion #region :disconnect <username> case "disconnect": { try { GameClient TargetClient = RavenEnvironment.GetGame().GetClientManager().GetClientByUserID(Convert.ToInt32(Params[0])); if (TargetClient != null && TargetClient.GetConnection() != null) { TargetClient.GetConnection().Dispose(); } } catch { log.Error("Error disconnecting user using MUS"); } return; } #endregion #region :reload_last_change userID case "reload_last_change": { int UserId = Convert.ToInt32(Params[0]); Client = RavenEnvironment.GetGame().GetClientManager().GetClientByUserID(UserId); if (Client == null || Client.GetHabbo() == null) { break; } using (IQueryAdapter dbClient = RavenEnvironment.GetDatabaseManager().GetQueryReactor()) { dbClient.SetQuery("SELECT `last_change` FROM `users` WHERE `id` = @userID LIMIT 1"); dbClient.AddParameter("userID", UserId); Client.GetHabbo().LastNameChange = dbClient.getInteger(); } break; } #endregion #region :goto <UserID> <RoomID> case "goto": { int UserId = Convert.ToInt32(Params[0]); int RoomId = Convert.ToInt32(Params[1]); Client = RavenEnvironment.GetGame().GetClientManager().GetClientByUserID(UserId); if (Client == null || Client.GetHabbo() == null) { break; } if (!int.TryParse(Params[1], out RoomId)) { break; } else { Room _room = RavenEnvironment.GetGame().GetRoomManager().LoadRoom(RoomId); if (_room == null) { Client.SendNotification("Failed to find the requested room!"); } else { if (!Client.GetHabbo().InRoom) { Client.SendMessage(new RoomForwardComposer(_room.Id)); } else { Client.GetHabbo().PrepareRoom(_room.Id, ""); } } } } break; #endregion #endregion #region Fastfood #region :progress_achievement case "progress_achievement": { int UserId = Convert.ToInt32(Params[0]); Client = RavenEnvironment.GetGame().GetClientManager().GetClientByUserID(UserId); if (Client == null || Client.GetHabbo() == null) { break; } string Achievement = Convert.ToString(Params[1]); int Progress = Convert.ToInt32(Params[2]); RavenEnvironment.GetGame().GetAchievementManager().ProgressAchievement(Client, Achievement, Progress); break; } #endregion #endregion #region Settings related #region :reload_filter/:update_filter case "update_filter": case "reload_filter": case "recache_filter": case "refresh_filter": { RavenEnvironment.GetGame().GetChatManager().GetFilter().InitWords(); RavenEnvironment.GetGame().GetChatManager().GetFilter().InitCharacters(); break; } #endregion #region :reload_catalog/:reload_catalog case "update_catalog": case "reload_catalog": case "recache_catalog": case "refresh_catalog": case "update_catalogue": case "reload_catalogue": case "recache_catalogue": case "refresh_catalogue": { RavenEnvironment.GetGame().GetCatalog().Init(RavenEnvironment.GetGame().GetItemManager()); RavenEnvironment.GetGame().GetClientManager().SendMessage(new CatalogUpdatedComposer()); break; } #endregion #region :reload_items/:update_items case "update_items": case "reload_items": case "recache_items": case "refresh_items": { RavenEnvironment.GetGame().GetItemManager().Init(); break; } #endregion #region :reload_navigator/:update_navigator case "update_navigator": case "reload_navigator": case "recache_navigator": case "refresh_navigator": { RavenEnvironment.GetGame().GetNavigator().Init(); break; } #endregion #region :reload_ranks/:update_ranks case "update_ranks": case "reload_ranks": case "recache_ranks": case "refresh_ranks": { RavenEnvironment.GetGame().GetPermissionManager().Init(); foreach (GameClient C in RavenEnvironment.GetGame().GetClientManager().GetClients.ToList()) { if (C == null || C.GetHabbo() == null || C.GetHabbo().GetPermissions() == null) { continue; } C.GetHabbo().GetPermissions().Init(Client.GetHabbo()); } break; } #endregion #region :reload_settings/:update_settings case "update_settings": case "reload_settings": case "recache_settings": case "refresh_settings": { RavenEnvironment.ConfigData = new ConfigData(); break; } #endregion #region :reload_quests/:update_quests case "reload_quests": case "update_quests": { RavenEnvironment.GetGame().GetQuestManager().Init(); break; } #endregion #region :reload_vouchers/:update_vouchers case "reload_vouchers": case "update_vouchers": { RavenEnvironment.GetGame().GetCatalog().GetVoucherManager().Init(); break; } #endregion #region :reload_bans/:update_bans case "update_bans": case "reload_bans": { RavenEnvironment.GetGame().GetModerationManager().ReCacheBans(); break; } #endregion #endregion //#region Camera related // #region :add_preview <photo_id> <user_id> <created_at> // case "add_preview": // { // int PhotoId = Convert.ToInt32(Params[0]); // int UserId = Convert.ToInt32(Params[1]); // long CreatedAt = Convert.ToInt64(Params[2]); // Client = RavenEnvironment.GetGame().GetClientManager().GetClientByUserID(UserId); // if (Client == null || Client.GetHabbo() == null || Client.GetHabbo().CurrentRoomId < 1) // break; // RavenEnvironment.GetGame().GetCameraManager().AddPreview(new CameraPhotoPreview(PhotoId, UserId, CreatedAt)); // break; // } // #endregion // #endregion default: { log.Error("Unrecognized MUS packet: '" + header + "'"); return; } } log.Info("Successfully Parsed MUS command: '" + header + "'"); }
public void Execute(GameClients.GameClient Session, Rooms.Room Room, string[] Params) { if (Params.Length == 1) { Session.SendWhisper("Por favor introduce el Nombre o la IP del usuario a Banear."); return; } Habbo Habbo = NeonEnvironment.GetHabboByUsername(Params[1]); if (Habbo == null) { Session.SendWhisper("Ocurrio un error en la busqueda por la base de datos."); 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 = NeonEnvironment.GetUnixTimestamp() + 78892200; string Username = Habbo.Username; using (IQueryAdapter dbClient = NeonEnvironment.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 se especifico la razon"; } if (!string.IsNullOrEmpty(IPAddress)) { NeonEnvironment.GetGame().GetModerationManager().BanUser(Session.GetHabbo().Username, ModerationBanType.IP, IPAddress, Reason, Expire); } NeonEnvironment.GetGame().GetModerationManager().BanUser(Session.GetHabbo().Username, ModerationBanType.USERNAME, Habbo.Username, Reason, Expire); if (!string.IsNullOrEmpty(Habbo.MachineId)) { NeonEnvironment.GetGame().GetModerationManager().BanUser(Session.GetHabbo().Username, ModerationBanType.MACHINE, Habbo.MachineId, Reason, Expire); } GameClient TargetClient = NeonEnvironment.GetGame().GetClientManager().GetClientByUsername(Username); if (TargetClient != null) { TargetClient.Disconnect(); } Session.SendWhisper("Se ha baneado exitosamente al usuario '" + Username + "' por la siguiente razon: '" + Reason + "'!"); }
internal static UserData GetUserData(string sessionTicket, string ip, out byte errorCode) { DataTable dataTable = null; DataRow dataRow; uint Userid; DataTable dataTable2; DataTable table; DataRow row; DataTable dataTable3; DataTable dataTable4; DataTable dataTable5; DataRow dataRow2; DataTable dataTable6; DataTable dataTable7; DataTable dataTable8; DataTable dataTable9; DataTable dataTable10; DataTable dataTable11; DataTable dataTable12; DataTable dataTable13; DataTable table2; DataTable dataTable14; DataTable dataTable15; using (IQueryAdapter queryreactor = CyberEnvironment.GetDatabaseManager().getQueryReactor()) { queryreactor.setQuery("SELECT * FROM users WHERE auth_ticket = @sso "); queryreactor.addParameter("sso", sessionTicket); queryreactor.addParameter("ipaddress", ip); dataRow = queryreactor.getRow(); if (dataRow == null) { errorCode = 1; throw new UserDataNotFoundException(string.Format("No user found with ip {0} and sso {1}.", ip, sessionTicket)); } Userid = Convert.ToUInt32(dataRow["id"]); queryreactor.runFastQuery("UPDATE users SET online='1' WHERE id=" + Userid + " LIMIT 1"); if (CyberEnvironment.GetGame().GetClientManager().GetClientByUserID(Userid) != null) { errorCode = 2; CyberEnvironment.GetGame().GetClientManager().GetClientByUserID(Userid).Disconnect(); return(null); } queryreactor.setQuery("SELECT * FROM user_achievement WHERE userid = " + Userid); dataTable2 = queryreactor.getTable(); queryreactor.setQuery("SELECT * FROM user_talents WHERE userid = " + Userid); table = queryreactor.getTable(); queryreactor.setQuery("SELECT COUNT(*) FROM user_stats WHERE id=" + Userid); if (int.Parse(queryreactor.getString()) == 0) { queryreactor.runFastQuery("INSERT INTO user_stats (id) VALUES (" + Userid + ");"); } queryreactor.setQuery("SELECT * FROM user_stats WHERE id=" + Userid + " LIMIT 1"); row = queryreactor.getRow(); queryreactor.setQuery("SELECT room_id FROM user_favorites WHERE user_id = " + Userid); dataTable3 = queryreactor.getTable(); queryreactor.setQuery("SELECT ignore_id FROM user_ignores WHERE user_id = " + Userid); dataTable4 = queryreactor.getTable(); queryreactor.setQuery("SELECT tag FROM user_tags WHERE user_id = " + Userid); dataTable5 = queryreactor.getTable(); queryreactor.setQuery("SELECT * FROM user_subscriptions WHERE user_id = " + Userid + " AND timestamp_expire > UNIX_TIMESTAMP() ORDER BY subscription_id DESC LIMIT 1"); dataRow2 = queryreactor.getRow(); queryreactor.setQuery("SELECT * FROM user_badges WHERE user_id = " + Userid); dataTable6 = queryreactor.getTable(); queryreactor.setQuery("SELECT `items`.* , COALESCE(`items_groups`.`group_id`, 0) AS group_id FROM `items` LEFT OUTER JOIN `items_groups` ON `items`.`id` = `items_groups`.`id` WHERE room_id='0' AND user_id=" + Userid + " LIMIT 8000"); dataTable7 = queryreactor.getTable(); queryreactor.setQuery("SELECT * FROM user_effects WHERE user_id = " + Userid); dataTable8 = queryreactor.getTable(); queryreactor.setQuery("SELECT poll_id FROM user_polldata WHERE user_id = " + Userid + " GROUP BY poll_id;"); dataTable9 = queryreactor.getTable(); queryreactor.setQuery(string.Concat(new object[] { "SELECT users.id,users.username,users.motto,users.look,users.last_online,users.hide_inroom,users.hide_online FROM users JOIN messenger_friendships ON users.id = messenger_friendships.user_one_id WHERE messenger_friendships.user_two_id = ", Userid, " UNION ALL SELECT users.id,users.username,users.motto,users.look,users.last_online,users.hide_inroom,users.hide_online FROM users JOIN messenger_friendships ON users.id = messenger_friendships.user_two_id WHERE messenger_friendships.user_one_id = ", Userid })); dataTable10 = queryreactor.getTable(); queryreactor.setQuery("SELECT * FROM user_stats WHERE id=" + Userid + " LIMIT 1"); row = queryreactor.getRow(); queryreactor.setQuery("SELECT messenger_requests.from_id,messenger_requests.to_id,users.username FROM users JOIN messenger_requests ON users.id = messenger_requests.from_id WHERE messenger_requests.to_id = " + Userid); dataTable11 = queryreactor.getTable(); queryreactor.setQuery("SELECT * FROM rooms WHERE owner = @name LIMIT 150"); queryreactor.addParameter("name", (string)dataRow["username"]); dataTable12 = queryreactor.getTable(); queryreactor.setQuery("SELECT * FROM bots WHERE user_id = " + Userid + " AND room_id = 0 AND ai_type='pet'"); dataTable13 = queryreactor.getTable(); queryreactor.setQuery("SELECT * FROM user_quests WHERE user_id = " + Userid); table2 = queryreactor.getTable(); queryreactor.setQuery("SELECT * FROM bots WHERE user_id=" + Userid + " AND room_id=0 AND ai_type='generic'"); dataTable14 = queryreactor.getTable(); queryreactor.setQuery("SELECT group_id,rank FROM group_memberships WHERE user_id=" + Userid); dataTable = queryreactor.getTable(); queryreactor.setQuery(string.Concat(new object[] { "UPDATE user_info SET login_timestamp = '", CyberEnvironment.GetUnixTimestamp(), "' WHERE user_id = ", Userid, " ; " })); queryreactor.addParameter("ip", ip); queryreactor.runQuery(); queryreactor.setQuery("SELECT * FROM user_relationships WHERE user_id=@id"); queryreactor.addParameter("id", Userid); dataTable15 = queryreactor.getTable(); queryreactor.runFastQuery("UPDATE users SET online='1' WHERE id=" + Userid + " LIMIT 1"); } Dictionary <string, UserAchievement> dictionary = new Dictionary <string, UserAchievement>(); foreach (DataRow dataRow3 in dataTable2.Rows) { string text = (string)dataRow3["group"]; int level = (int)dataRow3["level"]; int progress = (int)dataRow3["progress"]; UserAchievement value = new UserAchievement(text, level, progress); dictionary.Add(text, value); } Dictionary <int, UserTalent> dictionary2 = new Dictionary <int, UserTalent>(); foreach (DataRow dataRow4 in table.Rows) { int num2 = (int)dataRow4["talent_id"]; int state = (int)dataRow4["talent_state"]; UserTalent value2 = new UserTalent(num2, state); dictionary2.Add(num2, value2); } List <uint> list = new List <uint>(); foreach (DataRow dataRow5 in dataTable3.Rows) { uint item = Convert.ToUInt32(dataRow5["room_id"]); list.Add(item); } List <uint> list2 = new List <uint>(); foreach (DataRow dataRow6 in dataTable4.Rows) { uint item2 = Convert.ToUInt32(dataRow6["ignore_id"]); list2.Add(item2); } List <string> list3 = new List <string>(); foreach (DataRow dataRow7 in dataTable5.Rows) { string item3 = dataRow7["tag"].ToString().Replace(" ", ""); list3.Add(item3); } Subscription sub = null; if (dataRow2 != null) { sub = new Subscription((int)dataRow2["subscription_id"], (int)dataRow2["timestamp_activated"], (int)dataRow2["timestamp_expire"], (int)dataRow2["timestamp_lastgift"]); } Dictionary <uint, RoomBot> dictionary3 = new Dictionary <uint, RoomBot>(); foreach (DataRow row2 in dataTable14.Rows) { RoomBot roomBot = BotManager.GenerateBotFromRow(row2); dictionary3.Add(roomBot.BotId, roomBot); } List <Badge> list4 = new List <Badge>(); foreach (DataRow dataRow8 in dataTable6.Rows) { string code = (string)dataRow8["badge_id"]; int slot = (int)dataRow8["badge_slot"]; list4.Add(new Badge(code, slot)); } int miniMailCount = 0; try { DataRow Rowi; using (IQueryAdapter dbClient = CyberEnvironment.GetDatabaseManager().getQueryReactor()) { dbClient.setQuery("SELECT Count( IsReaded ) FROM xdrcms_minimail WHERE InBin = 0 AND IsReaded = 0 AND SenderId != " + Userid + " AND OwnerId = " + Userid); Rowi = dbClient.getRow(); } if (Rowi != null) { // We are using aXDR CMS with MiniMail! miniMailCount = int.Parse(Rowi[0].ToString()); } } catch { } List <UserItem> list5 = new List <UserItem>(); foreach (DataRow dataRow9 in dataTable7.Rows) { uint id = Convert.ToUInt32(dataRow9[0]); uint baseItem = Convert.ToUInt32(dataRow9[3]); string extraData; if (!DBNull.Value.Equals(dataRow9[4])) { extraData = (string)dataRow9[4]; } else { extraData = string.Empty; } uint group = Convert.ToUInt32(dataRow9["group_id"]); string songCode = (string)dataRow9["songcode"]; list5.Add(new UserItem(id, baseItem, extraData, group, songCode)); } List <AvatarEffect> list6 = new List <AvatarEffect>(); foreach (DataRow dataRow10 in dataTable8.Rows) { int effectId = (int)dataRow10["effect_id"]; int totalDuration = (int)dataRow10["total_duration"]; bool activated = CyberEnvironment.EnumToBool((string)dataRow10["is_activated"]); double activateTimestamp = (double)dataRow10["activated_stamp"]; list6.Add(new AvatarEffect(effectId, totalDuration, activated, activateTimestamp)); } HashSet <uint> pollSuggested = new HashSet <uint>(); foreach (DataRow Row in dataTable9.Rows) { uint pId = (uint)Row["poll_id"]; pollSuggested.Add(pId); } Dictionary <uint, MessengerBuddy> dictionary4 = new Dictionary <uint, MessengerBuddy>(); string arg_A3D_0 = (string)dataRow["username"]; int num3 = checked (dataTable10.Rows.Count - 700); if (num3 > 0) { using (IQueryAdapter queryreactor2 = CyberEnvironment.GetDatabaseManager().getQueryReactor()) { queryreactor2.runFastQuery(string.Concat(new object[] { "DELETE FROM messenger_friendships WHERE user_one_id=", Userid, " OR user_two_id=", Userid, " LIMIT ", num3 })); queryreactor2.setQuery(string.Concat(new object[] { "SELECT users.id,users.username,users.motto,users.look,users.last_online,users.hide_inroom,users.hide_online FROM users JOIN messenger_friendships ON users.id = messenger_friendships.user_one_id WHERE messenger_friendships.user_two_id = ", Userid, " UNION ALL SELECT users.id,users.username,users.motto,users.look,users.last_online,users.hide_inroom,users.hide_online FROM users JOIN messenger_friendships ON users.id = messenger_friendships.user_two_id WHERE messenger_friendships.user_one_id = ", Userid })); dataTable10 = queryreactor2.getTable(); } } foreach (DataRow dataRow12 in dataTable10.Rows) { uint num4 = Convert.ToUInt32(dataRow12["id"]); string pUsername = (string)dataRow12["username"]; string pLook = (string)dataRow12["look"]; string pMotto = (string)dataRow12["motto"]; int pLastOnline = Convert.ToInt32(dataRow12["last_online"]); bool pAppearOffline = CyberEnvironment.EnumToBool(dataRow12["hide_online"].ToString()); bool pHideInroom = CyberEnvironment.EnumToBool(dataRow12["hide_inroom"].ToString()); if (num4 != Userid && !dictionary4.ContainsKey(num4)) { dictionary4.Add(num4, new MessengerBuddy(num4, pUsername, pLook, pMotto, pLastOnline, pAppearOffline, pHideInroom)); } } Dictionary <uint, MessengerRequest> dictionary5 = new Dictionary <uint, MessengerRequest>(); foreach (DataRow dataRow13 in dataTable11.Rows) { uint num5 = Convert.ToUInt32(dataRow13["from_id"]); uint num6 = Convert.ToUInt32(dataRow13["to_id"]); string pUsername2 = (string)dataRow13["username"]; if (num5 != Userid) { if (!dictionary5.ContainsKey(num5)) { dictionary5.Add(num5, new MessengerRequest(Userid, num5, pUsername2)); } } else { if (!dictionary5.ContainsKey(num6)) { dictionary5.Add(num6, new MessengerRequest(Userid, num6, pUsername2)); } } } HashSet <RoomData> list8 = new HashSet <RoomData>(); foreach (DataRow dataRow14 in dataTable12.Rows) { uint roomId = Convert.ToUInt32(dataRow14["id"]); list8.Add(CyberEnvironment.GetGame().GetRoomManager().FetchRoomData(roomId, dataRow14)); } Dictionary <uint, Pet> dictionary6 = new Dictionary <uint, Pet>(); foreach (DataRow dataRow15 in dataTable13.Rows) { using (IQueryAdapter queryreactor3 = CyberEnvironment.GetDatabaseManager().getQueryReactor()) { queryreactor3.setQuery("SELECT * FROM bots_petdata WHERE id=" + dataRow15[0] + " LIMIT 1"); DataRow row3 = queryreactor3.getRow(); if (row3 != null) { Pet pet = Catalog.GeneratePetFromRow(dataRow15, row3); dictionary6.Add(pet.PetId, pet); } } } Dictionary <uint, int> dictionary7 = new Dictionary <uint, int>(); foreach (DataRow dataRow16 in table2.Rows) { uint key = Convert.ToUInt32(dataRow16["quest_id"]); int value3 = (int)dataRow16["progress"]; if (dictionary7.ContainsKey(key)) { dictionary7.Remove(key); } dictionary7.Add(key, value3); } HashSet <GroupUser> list9 = new HashSet <GroupUser>(); foreach (DataRow dataRow17 in dataTable.Rows) { list9.Add(new GroupUser(Userid, (uint)dataRow17[0], (int)Convert.ToInt16(dataRow17[1]))); } Dictionary <int, Relationship> dictionary8 = new Dictionary <int, Relationship>(); foreach (DataRow dataRow18 in dataTable15.Rows) { dictionary8.Add((int)dataRow18[0], new Relationship((int)dataRow18[0], (int)dataRow18[2], Convert.ToInt32(dataRow18[3].ToString()))); } Habbo user = HabboFactory.GenerateHabbo(dataRow, row, list9); dataRow = null; dataTable2 = null; dataTable3 = null; dataTable4 = null; dataTable5 = null; dataRow2 = null; dataTable6 = null; dataTable7 = null; dataTable8 = null; dataTable10 = null; dataTable11 = null; dataTable12 = null; dataTable13 = null; dataTable14 = null; dataTable15 = null; dataTable9 = null; errorCode = 0; return(new UserData(Userid, dictionary, dictionary2, list, list2, list3, sub, list4, list5, list6, dictionary4, dictionary5, list8, dictionary6, dictionary7, user, dictionary3, dictionary8, pollSuggested, miniMailCount)); }
public void Fill(DataRow Row) { Id = Convert.ToInt32(Row["id"]); Name = Convert.ToString(Row["caption"]); Description = Convert.ToString(Row["description"]); Type = Convert.ToString(Row["roomtype"]); OwnerId = Convert.ToInt32(Row["owner"]); OwnerName = ""; using (IQueryAdapter dbClient = NeonEnvironment.GetDatabaseManager().GetQueryReactor()) { dbClient.SetQuery("SELECT `username` FROM `users` WHERE `id` = @owner LIMIT 1"); dbClient.AddParameter("owner", OwnerId); string result = dbClient.getString(); if (!string.IsNullOrEmpty(result)) { OwnerName = result; } } Access = RoomAccessUtility.ToRoomAccess(Row["state"].ToString().ToLower()); Category = Convert.ToInt32(Row["category"]); if (!string.IsNullOrEmpty(Row["users_now"].ToString())) { UsersNow = Convert.ToInt32(Row["users_now"]); } else { UsersNow = 0; } UsersMax = Convert.ToInt32(Row["users_max"]); ModelName = Convert.ToString(Row["model_name"]); Score = Convert.ToInt32(Row["score"]); Tags = new List <string>(); AllowPets = Convert.ToInt32(Row["allow_pets"].ToString()); AllowPetsEating = Convert.ToInt32(Row["allow_pets_eat"].ToString()); RoomBlockingEnabled = Convert.ToInt32(Row["room_blocking_disabled"].ToString()); Hidewall = Convert.ToInt32(Row["allow_hidewall"].ToString()); Password = Convert.ToString(Row["password"]); Wallpaper = Convert.ToString(Row["wallpaper"]); Floor = Convert.ToString(Row["floor"]); Landscape = Convert.ToString(Row["landscape"]); FloorThickness = Convert.ToInt32(Row["floorthick"]); WallThickness = Convert.ToInt32(Row["wallthick"]); WhoCanMute = Convert.ToInt32(Row["mute_settings"]); WhoCanKick = Convert.ToInt32(Row["kick_settings"]); WhoCanBan = Convert.ToInt32(Row["ban_settings"]); chatMode = Convert.ToInt32(Row["chat_mode"]); chatSpeed = Convert.ToInt32(Row["chat_speed"]); chatSize = Convert.ToInt32(Row["chat_size"]); TradeSettings = Convert.ToInt32(Row["trade_settings"]); RollerSpeed = Convert.ToInt32(Row["roller_speed"]); if (NeonEnvironment.GetGame().GetGroupManager().TryGetGroup(Convert.ToInt32(Row["group_id"]), out Group G)) { Group = G; } else { Group = null; } foreach (string Tag in Row["tags"].ToString().Split(',')) { Tags.Add(Tag); } mModel = NeonEnvironment.GetGame().GetRoomManager().GetModel(ModelName); PushEnabled = NeonEnvironment.EnumToBool(Row["push_enabled"].ToString()); PullEnabled = NeonEnvironment.EnumToBool(Row["pull_enabled"].ToString()); SPushEnabled = NeonEnvironment.EnumToBool(Row["spush_enabled"].ToString()); SPullEnabled = NeonEnvironment.EnumToBool(Row["spull_enabled"].ToString()); EnablesEnabled = NeonEnvironment.EnumToBool(Row["enables_enabled"].ToString()); RespectNotificationsEnabled = NeonEnvironment.EnumToBool(Row["respect_notifications_enabled"].ToString()); PetMorphsAllowed = NeonEnvironment.EnumToBool(Row["pet_morphs_allowed"].ToString()); Shoot = Convert.ToInt32(Row["shoot"]); HideWired = NeonEnvironment.EnumToBool(Row["hide_wired"].ToString()); WiredScoreBordDay = new Dictionary <int, KeyValuePair <int, string> >(); WiredScoreBordWeek = new Dictionary <int, KeyValuePair <int, string> >(); WiredScoreBordMonth = new Dictionary <int, KeyValuePair <int, string> >(); using (IQueryAdapter dbClient = NeonEnvironment.GetDatabaseManager().GetQueryReactor()) { List <bool> SuperCheck = new List <bool>() { false, false, false }; DateTime now = DateTime.Now; int getdaytoday = Convert.ToInt32(now.ToString("MMddyyyy")); int getmonthtoday = Convert.ToInt32(now.ToString("MM")); int getweektoday = CultureInfo.GetCultureInfo("Nl-nl").Calendar.GetWeekOfYear(DateTime.Now, CalendarWeekRule.FirstFourDayWeek, DayOfWeek.Monday); WiredScoreFirstBordInformation = new List <int>() { getdaytoday, getmonthtoday, getweektoday }; dbClient.SetQuery("SELECT * FROM wired_scorebord WHERE roomid = @id ORDER BY `punten` DESC "); dbClient.AddParameter("id", Id); foreach (DataRow row in dbClient.getTable().Rows) { int userid = Convert.ToInt32(row["userid"]); string username = Convert.ToString(row["username"]); int Punten = Convert.ToInt32(row["punten"]); string soort = Convert.ToString(row["soort"]); int timestamp = Convert.ToInt32(row["timestamp"]); if ((!(soort == "day") || WiredScoreBordDay.ContainsKey(userid) ? false : !SuperCheck[0])) { if (timestamp != getdaytoday) { SuperCheck[0] = false; } if (!SuperCheck[0]) { WiredScoreBordDay.Add(userid, new KeyValuePair <int, string>(Punten, username)); } } if ((!(soort == "month") || WiredScoreBordMonth.ContainsKey(userid) ? false : !SuperCheck[1])) { if (timestamp != getmonthtoday) { SuperCheck[1] = false; } WiredScoreBordMonth.Add(userid, new KeyValuePair <int, string>(Punten, username)); } if ((!(soort == "week") || WiredScoreBordWeek.ContainsKey(userid) ? false : !SuperCheck[2])) { if (timestamp != getweektoday) { SuperCheck[2] = false; } WiredScoreBordWeek.Add(userid, new KeyValuePair <int, string>(Punten, username)); } } if (SuperCheck[0]) { dbClient.RunQuery(string.Concat("DELETE FROM `wired_scorebord` WHERE `roomid`='", Id, "' AND `soort`='day'")); WiredScoreBordDay.Clear(); } if (SuperCheck[1]) { dbClient.RunQuery(string.Concat("DELETE FROM `wired_scorebord` WHERE `roomid`='", Id, "' AND `soort`='month'")); WiredScoreBordMonth.Clear(); } if (SuperCheck[2]) { dbClient.RunQuery(string.Concat("DELETE FROM `wired_scorebord` WHERE `roomid`='", Id, "' AND `soort`='week'")); WiredScoreBordDay.Clear(); } } }
public void processCommand(String data) { GameClient Client = null; String header = data.Split(Convert.ToChar(1))[0]; String param = data.Split(Convert.ToChar(1))[1]; string[] Params = param.ToString().Split(':'); switch (header.ToLower()) { #region User Related #region :reload_credits <UserID> case "reload_credits": { int UserId = Convert.ToInt32(Params[0]); Client = PlusEnvironment.GetGame().GetClientManager().GetClientByUserID(UserId); if (Client == null || Client.GetHabbo() == null) { break; } int Credits = 0; using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor()) { dbClient.SetQuery("SELECT `credits` FROM `users` WHERE `id` = @id LIMIT 1"); dbClient.AddParameter("id", UserId); Credits = dbClient.getInteger(); } Client.GetHabbo().Credits = Credits; Client.SendMessage(new CreditBalanceComposer(Client.GetHabbo().Credits)); break; } #endregion #region :reload_pixels <UserID> case "reload_pixels": { int UserId = Convert.ToInt32(Params[0]); Client = PlusEnvironment.GetGame().GetClientManager().GetClientByUserID(UserId); if (Client == null || Client.GetHabbo() == null) { break; } int Pixels = 0; using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor()) { dbClient.SetQuery("SELECT `activity_points` FROM `users` WHERE `id` = @id LIMIT 1"); dbClient.AddParameter("id", UserId); Pixels = dbClient.getInteger(); } Client.GetHabbo().Duckets = Pixels; Client.SendMessage(new HabboActivityPointNotificationComposer(Client.GetHabbo().Duckets, Pixels)); break; } #endregion #region :reload_diamonds <UserID> case "reload_diamonds": { int UserId = Convert.ToInt32(Params[0]); Client = PlusEnvironment.GetGame().GetClientManager().GetClientByUserID(UserId); if (Client == null || Client.GetHabbo() == null) { break; } int Diamonds = 0; using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor()) { dbClient.SetQuery("SELECT `vip_points` FROM `users` WHERE `id` = @id LIMIT 1"); dbClient.AddParameter("id", UserId); Diamonds = dbClient.getInteger(); } Client.GetHabbo().Diamonds = Diamonds; Client.SendMessage(new HabboActivityPointNotificationComposer(Diamonds, 0, 5)); break; } #endregion #region :reload_eventp <UserID> case "reload_eventp": { int UserId = Convert.ToInt32(Params[0]); Client = PlusEnvironment.GetGame().GetClientManager().GetClientByUserID(UserId); if (Client == null || Client.GetHabbo() == null) { break; } int EventPoints = 0; using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor()) { dbClient.SetQuery("SELECT `event_points` FROM `users` WHERE `id` = @id LIMIT 1"); dbClient.AddParameter("id", UserId); EventPoints = dbClient.getInteger(); } Client.GetHabbo().EventPoints = EventPoints; Client.SendMessage(new HabboActivityPointNotificationComposer(EventPoints, 0, 103)); break; } #endregion #region :reload_user_rank userID case "reload_user_rank": { int UserId = Convert.ToInt32(Params[0]); Client = PlusEnvironment.GetGame().GetClientManager().GetClientByUserID(UserId); if (Client == null || Client.GetHabbo() == null) { break; } using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor()) { dbClient.SetQuery("SELECT `rank` FROM `users` WHERE `id` = @userID LIMIT 1"); dbClient.AddParameter("userID", UserId); Client.GetHabbo().Rank = dbClient.getInteger(); Client.GetHabbo().GetPermissions().Init(Client.GetHabbo()); } break; } #endregion #region :reload_user_vip userID case "reload_user_vip": { int UserId = Convert.ToInt32(Params[0]); Client = PlusEnvironment.GetGame().GetClientManager().GetClientByUserID(UserId); if (Client == null || Client.GetHabbo() == null) { break; } using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor()) { dbClient.SetQuery("SELECT `rank_vip` FROM `users` WHERE `id` = @userID LIMIT 1"); dbClient.AddParameter("userID", UserId); Client.GetHabbo().VIPRank = dbClient.getInteger(); Client.GetHabbo().GetPermissions().Init(Client.GetHabbo()); } break; } #endregion #region :reload_motto userID case "reload_motto": { int UserId = Convert.ToInt32(Params[0]); Client = PlusEnvironment.GetGame().GetClientManager().GetClientByUserID(UserId); if (Client == null || Client.GetHabbo() == null) { break; } using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor()) { dbClient.SetQuery("SELECT `motto` FROM `users` WHERE `id` = @userID LIMIT 1"); dbClient.AddParameter("userID", UserId); Client.GetHabbo().Motto = dbClient.getString(); } if (Client.GetHabbo().InRoom) { Room Room = Client.GetHabbo().CurrentRoom; if (Room == null) { return; } RoomUser User = Room.GetRoomUserManager().GetRoomUserByHabbo(Client.GetHabbo().Id); if (User == null || User.GetClient() == null) { return; } Room.SendMessage(new UserChangeComposer(User, false)); } break; } #endregion #region :alert_user <userid> <message> case "alert": case "alert_user": { int UserId = Convert.ToInt32(Params[0]); string alertMessage = Convert.ToString(Params[1]); Client = PlusEnvironment.GetGame().GetClientManager().GetClientByUserID(UserId); if (Client == null || Client.GetHabbo() == null) { break; } Client.SendMessage(new BroadcastMessageAlertComposer(alertMessage)); break; } #endregion #region :reload_badges <UserID> case "update_badges": case "reload_badges": { int UserId = Convert.ToInt32(Params[0]); Client = PlusEnvironment.GetGame().GetClientManager().GetClientByUserID(UserId); if (Client != null) { if (Client.GetHabbo() != null) { Client.SendMessage(new BadgesComposer(Client)); } } break; } #endregion #region :givebadge <UserID> <badge> case "givebadge": { int UserId = Convert.ToInt32(Params[0]); string badgeCode = Convert.ToString(Params[1]); Client = PlusEnvironment.GetGame().GetClientManager().GetClientByUserID(UserId); if (Client != null) { if (Client.GetHabbo() != null) { Client.GetHabbo().GetBadgeComponent().GiveBadge(badgeCode, true, Client); } } break; } #endregion #region :disconnect <username> case "disconnect": { try { GameClient TargetClient = PlusEnvironment.GetGame().GetClientManager().GetClientByUserID(Convert.ToInt32(Params[0])); if (TargetClient != null && TargetClient.GetConnection() != null) { TargetClient.GetConnection().Dispose(); } } catch { log.Error("Error disconnecting user using MUS"); } return; } #endregion #region :reload_last_change userID case "reload_last_change": { int UserId = Convert.ToInt32(Params[0]); Client = PlusEnvironment.GetGame().GetClientManager().GetClientByUserID(UserId); if (Client == null || Client.GetHabbo() == null) { break; } using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor()) { dbClient.SetQuery("SELECT `last_change` FROM `users` WHERE `id` = @userID LIMIT 1"); dbClient.AddParameter("userID", UserId); Client.GetHabbo().LastNameChange = dbClient.getInteger(); } break; } #endregion #region :goto <UserID> <RoomID> case "goto": { int UserId = Convert.ToInt32(Params[0]); int RoomId = Convert.ToInt32(Params[1]); Client = PlusEnvironment.GetGame().GetClientManager().GetClientByUserID(UserId); if (Client == null || Client.GetHabbo() == null) { break; } if (!int.TryParse(Params[1], out RoomId)) { break; } else { Room _room = HabboRoleplay.Misc.RoleplayManager.GenerateRoom(RoomId); if (_room == null) { Client.SendNotification("Failed to find the requested room!"); } else { if (!Client.GetHabbo().InRoom) { Client.SendMessage(new RoomForwardComposer(_room.Id)); } else { Client.GetHabbo().PrepareRoom(_room.Id, ""); } } } } break; #endregion #region :reload_user_color userID case "reload_user_color": { int UserId = Convert.ToInt32(Params[0]); Client = PlusEnvironment.GetGame().GetClientManager().GetClientByUserID(UserId); if (Client == null || Client.GetHabbo() == null) { break; } using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor()) { dbClient.SetQuery("SELECT `colour` FROM `users` WHERE `id` = @userID LIMIT 1"); dbClient.AddParameter("userID", UserId); Client.GetHabbo().Colour = dbClient.getString(); } break; } #endregion #endregion #region Fastfood #region :progress_achievement case "progress_achievement": { int UserId = Convert.ToInt32(Params[0]); Client = PlusEnvironment.GetGame().GetClientManager().GetClientByUserID(UserId); if (Client == null || Client.GetHabbo() == null) { break; } string Achievement = Convert.ToString(Params[1]); int Progress = Convert.ToInt32(Params[2]); PlusEnvironment.GetGame().GetAchievementManager().ProgressAchievement(Client, Achievement, Progress); break; } #endregion #endregion #region Settings related #region :reload_filter/:update_filter case "update_filter": case "reload_filter": case "recache_filter": case "refresh_filter": { PlusEnvironment.GetGame().GetChatManager().GetFilter().Init(); break; } #endregion #region :reload_catalog/:reload_catalog case "update_catalog": case "reload_catalog": case "recache_catalog": case "refresh_catalog": case "update_catalogue": case "reload_catalogue": case "recache_catalogue": case "refresh_catalogue": { PlusEnvironment.GetGame().GetCatalog().Init(PlusEnvironment.GetGame().GetItemManager()); PlusEnvironment.GetGame().GetClientManager().SendMessage(new CatalogUpdatedComposer()); break; } #endregion #region :reload_items/:update_items case "update_items": case "reload_items": case "recache_items": case "refresh_items": { PlusEnvironment.GetGame().GetItemManager().Init(); break; } #endregion #region :reload_navigator/:update_navigator case "update_navigator": case "reload_navigator": case "recache_navigator": case "refresh_navigator": { PlusEnvironment.GetGame().GetNavigator().Init(); break; } #endregion #region :reload_ranks/:update_ranks case "update_ranks": case "reload_ranks": case "recache_ranks": case "refresh_ranks": { PlusEnvironment.GetGame().GetPermissionManager().Init(); foreach (GameClient C in PlusEnvironment.GetGame().GetClientManager().GetClients.ToList()) { if (C == null || C.GetHabbo() == null || C.GetHabbo().GetPermissions() == null) { continue; } C.GetHabbo().GetPermissions().Init(Client.GetHabbo()); } break; } #endregion #region :reload_settings/:update_settings case "update_settings": case "reload_settings": case "recache_settings": case "refresh_settings": { PlusEnvironment.ConfigData = new ConfigData(); break; } #endregion #region :reload_quests/:update_quests case "reload_quests": case "update_quests": { PlusEnvironment.GetGame().GetQuestManager().Init(); break; } #endregion #region :reload_vouchers/:update_vouchers case "reload_vouchers": case "update_vouchers": { PlusEnvironment.GetGame().GetCatalog().GetVoucherManager().Init(); break; } #endregion #region :reload_bans/:update_bans case "update_bans": case "reload_bans": { PlusEnvironment.GetGame().GetModerationManager().ReCacheBans(); break; } #endregion #endregion #region Misc #region :hotel_alert case "hotel_alert": case "alert_hotel": { string Message = Convert.ToString(Params[0]); PlusEnvironment.GetGame().GetClientManager().SendMessage(new BroadcastMessageAlertComposer(Message)); break; } #endregion #region :whisper_hotel_alert case "whisper_hotel_alert": case "whisper_alert_hotel": { string Message = Convert.ToString(Params[0]); lock (PlusEnvironment.GetGame().GetClientManager().GetClients) { foreach (var client in PlusEnvironment.GetGame().GetClientManager().GetClients.ToList()) { if (client == null || client.GetHabbo() == null) { continue; } client.SendWhisper("[HOTEL Alert] " + Message, 33); } } break; } #endregion #endregion default: { log.Error("Pacote MUS não reconhecido: '" + header + "'"); return; } } log.Info("Successfully Parsed MUS command: '" + header + "'"); }
public void Execute(GameClients.GameClient Session, Rooms.Room Room, string[] Params) { if (Params.Length == 1) { Session.SendWhisper("Oeps! Je bent vergeten een gebruikersnaam in te vullen."); return; } Habbo Habbo = QuasarEnvironment.GetHabboByUsername(Params[1]); if (Habbo == null) { Session.SendWhisper("Oeps! Deze gebruiker bestaat niet."); return; } if (Habbo.GetPermissions().HasRight("mod_tool") && !Session.GetHabbo().GetPermissions().HasRight("mod_ban_any")) { Session.SendWhisper("Oeps! Je hebt niet de bevoegdheid om deze gebruiker te verbannen."); return; } String IPAddress = String.Empty; Double Expire = QuasarEnvironment.GetUnixTimestamp() + 78892200; string Username = Habbo.Username; using (IQueryAdapter dbClient = QuasarEnvironment.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 = "Geen reden (nodig)."; } if (!string.IsNullOrEmpty(IPAddress)) { QuasarEnvironment.GetGame().GetModerationManager().BanUser(Session.GetHabbo().Username, ModerationBanType.IP, IPAddress, Reason, Expire); } QuasarEnvironment.GetGame().GetModerationManager().BanUser(Session.GetHabbo().Username, ModerationBanType.USERNAME, Habbo.Username, Reason, Expire); GameClient TargetClient = QuasarEnvironment.GetGame().GetClientManager().GetClientByUsername(Username); if (TargetClient != null) { TargetClient.Disconnect(); } Session.SendWhisper("Je hebt met succes de gebruiker '" + Username + "' verbannen met de volgende reden: '" + Reason + "'!"); }
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("Por favor, introduzca el nombre de usuario del usuario que desea Ban IP y cuenta de la prohibición."); return; } Habbo Habbo = CloudServer.GetHabboByUsername(Params[1]); if (Habbo == null) { Session.SendWhisper("Se produjo un error mientras que la búsqueda de usuario en la base de datos."); return; } if (Habbo.GetPermissions().HasRight("mod_tool") && !Session.GetHabbo().GetPermissions().HasRight("mod_ban_any")) { Session.SendWhisper("Vaya, no se puede prohibir que el usuario."); return; } String IPAddress = String.Empty; Double Expire = CloudServer.GetUnixTimestamp() + 78892200; string Username = Habbo.Username; using (IQueryAdapter dbClient = CloudServer.GetDatabaseManager().GetQueryReactor()) { dbClient.runFastQuery("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 hay razón especifica."; } if (!string.IsNullOrEmpty(IPAddress)) { CloudServer.GetGame().GetModerationManager().BanUser(Session.GetHabbo().Username, ModerationBanType.IP, IPAddress, Reason, Expire); } CloudServer.GetGame().GetModerationManager().BanUser(Session.GetHabbo().Username, ModerationBanType.USERNAME, Habbo.Username, Reason, Expire); if (!string.IsNullOrEmpty(Habbo.MachineId)) { CloudServer.GetGame().GetModerationManager().BanUser(Session.GetHabbo().Username, ModerationBanType.MACHINE, Habbo.MachineId, Reason, Expire); } GameClient TargetClient = CloudServer.GetGame().GetClientManager().GetClientByUsername(Username); if (TargetClient != null) { TargetClient.Disconnect(); } Session.SendWhisper("Éxito, la maquina de baneos baneo a: '" + Username + "' por la siguiente razón: '" + Reason + "'!"); }
public void Execute(GameClients.GameClient Session, Rooms.Room Room, string[] Params) { if (ExtraSettings.STAFF_EFFECT_ENABLED_ROOM) { if (Session.GetHabbo().Rank > Convert.ToInt32(BiosEmuThiago.GetConfig().data["MineRankStaff"])) { if (Params.Length == 1) { Session.SendWhisper("Algo está faltando!"); return; } if (Session.GetHabbo().isLoggedIn == false) { Session.SendWhisper("Você não entro!"); return; } if (Params[1] != Session.GetHabbo().Username) { Session.SendWhisper("Você só pode sair do login satff em sua própria conta."); return; } if (Session.GetHabbo().Username == Params[1]) { string passw = Params[2]; string password; using (IQueryAdapter dbClient = BiosEmuThiago.GetDatabaseManager().GetQueryReactor()) { dbClient.SetQuery("SELECT `password` FROM stafflogin WHERE `user_id` = " + Session.GetHabbo().Id + " LIMIT 1"); dbClient.AddParameter("password", passw); password = dbClient.getString(); } if (password == Params[2]) { Session.GetHabbo().isLoggedIn = false; Session.SendWhisper("Aviso do BiosEmulador: " + Params[1] + ", Você saiu do login staff!"); if (Session.GetHabbo().Rank != ExtraSettings.AmbassadorMinRank) { using (IQueryAdapter dbClient = BiosEmuThiago.GetDatabaseManager().GetQueryReactor()) { dbClient.SetQuery("SELECT * FROM `ranks` WHERE id = '" + Session.GetHabbo().Rank + "'"); DataRow Table = dbClient.getRow(); if (Session.GetHabbo().Rank < Convert.ToInt32(BiosEmuThiago.GetConfig().data["MineRankStaff"])) { // Thiago é muito lindo ser é doido } else { using (IQueryAdapter dbClients = BiosEmuThiago.GetDatabaseManager().GetQueryReactor()) { dbClients.RunQuery("UPDATE users SET prefix_name = '' WHERE id = '" + Session.GetHabbo().Id + "'"); dbClients.RunQuery("UPDATE users SET prefix_name_color = '' WHERE id = '" + Session.GetHabbo().Id + "'"); } Session.GetHabbo()._NamePrefixColor = ""; Session.GetHabbo()._NamePrefix = ""; Session.SendWhisper("Tag " + Convert.ToString(Table["TAGSTAFF"]) + " foi desativada!"); Session.GetHabbo().Effects().ApplyEffect(0); string figure = Session.GetHabbo().Look; BiosEmuThiago.GetGame().GetClientManager().StaffAlert(new RoomNotificationComposer("fig/" + figure, 3, "O " + Convert.ToString(Table["name"]) + " " + Params[1] + " saiu do login staff!", "")); } } } if (Session.GetHabbo().Rank == ExtraSettings.AmbassadorMinRank) { using (IQueryAdapter dbClient = BiosEmuThiago.GetDatabaseManager().GetQueryReactor()) { dbClient.SetQuery("SELECT * FROM `ranks` WHERE id = '" + Session.GetHabbo().Rank + "'"); DataRow Table = dbClient.getRow(); if (Session.GetHabbo().Rank < Convert.ToInt32(BiosEmuThiago.GetConfig().data["MineRankStaff"])) { // Thiago é muito lindo ser é doido } else { using (IQueryAdapter dbClients = BiosEmuThiago.GetDatabaseManager().GetQueryReactor()) { dbClients.RunQuery("UPDATE users SET prefix_name = '' WHERE id = '" + Session.GetHabbo().Id + "'"); dbClients.RunQuery("UPDATE users SET prefix_name_color = '' WHERE id = '" + Session.GetHabbo().Id + "'"); } Session.GetHabbo()._NamePrefixColor = ""; Session.GetHabbo()._NamePrefix = ""; Session.SendWhisper("Tag " + Convert.ToString(Table["TAGSTAFF"]) + " foi desativada!"); Session.GetHabbo().Effects().ApplyEffect(0); Session.SendWhisper("Não esqueça de desliga sua ferramenta de embaixador!"); string figure = Session.GetHabbo().Look; BiosEmuThiago.GetGame().GetClientManager().StaffAlert(new RoomNotificationComposer("fig/" + figure, 3, "O " + Convert.ToString(Table["name"]) + " " + Params[1] + " saiu do login staff!", "")); } } } } else if (password != Params[2]) { Session.SendWhisper("Senha incorreta."); } } } } else { Session.SendWhisper("Comando esta desativado nas configuração do emulador!"); return; } }
public void Execute(GameClients.GameClient Session, Rooms.Room Room, string[] Params) { if (ExtraSettings.STAFF_EFFECT_ENABLED_ROOM) { if (Session.GetHabbo().isLoggedIn&& Session.GetHabbo().Rank > Convert.ToInt32(BiosEmuThiago.GetConfig().data["MineRankStaff"])) { } else { Session.SendWhisper("Você precisa estar logado como staff para usar este comando."); return; } } if (Params.Length == 1) { Session.SendWhisper("Digite o nome de usuário do usuário que deseja Ban IP e banar conta."); return; } Habbo Habbo = BiosEmuThiago.GetHabboByUsername(Params[1]); if (Habbo == null) { Session.SendWhisper("Se produjo un error mientras que la búsqueda de usuario en la base de datos."); return; } if (Habbo.GetPermissions().HasRight("mod_tool") && !Session.GetHabbo().GetPermissions().HasRight("mod_ban_any")) { Session.SendWhisper("Uau, você não pode proibir o usuário."); return; } String IPAddress = String.Empty; Double Expire = BiosEmuThiago.GetUnixTimestamp() + 78892200; string Username = Habbo.Username; using (IQueryAdapter dbClient = BiosEmuThiago.GetDatabaseManager().GetQueryReactor()) { dbClient.runFastQuery("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 = "Nenhuma razão especificada."; } if (!string.IsNullOrEmpty(IPAddress)) { BiosEmuThiago.GetGame().GetModerationManager().BanUser(Session.GetHabbo().Username, ModerationBanType.IP, IPAddress, Reason, Expire); } BiosEmuThiago.GetGame().GetModerationManager().BanUser(Session.GetHabbo().Username, ModerationBanType.USERNAME, Habbo.Username, Reason, Expire); GameClient TargetClient = BiosEmuThiago.GetGame().GetClientManager().GetClientByUsername(Username); if (TargetClient != null) { TargetClient.Disconnect(); } Session.SendWhisper("Sucesso, você tem IP e a conta baniu o usuário '" + Username + "' pelo motivo '" + Reason + "'!"); }
public void Fill(DataRow Row) { Id = Convert.ToInt32(Row["id"]); Name = Convert.ToString(Row["caption"]); Description = Convert.ToString(Row["description"]); Type = Convert.ToString(Row["roomtype"]); OwnerId = Convert.ToInt32(Row["owner"]); OwnerName = ""; using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor()) { dbClient.SetQuery("SELECT `username` FROM `users` WHERE `id` = @owner LIMIT 1"); dbClient.AddParameter("owner", OwnerId); string result = dbClient.getString(); if (!String.IsNullOrEmpty(result)) { OwnerName = result; } } this.Access = RoomAccessUtility.ToRoomAccess(Row["state"].ToString().ToLower()); Category = Convert.ToInt32(Row["category"]); if (!string.IsNullOrEmpty(Row["users_now"].ToString())) { UsersNow = Convert.ToInt32(Row["users_now"]); } else { UsersNow = 0; } UsersMax = Convert.ToInt32(Row["users_max"]); ModelName = Convert.ToString(Row["model_name"]); Score = Convert.ToInt32(Row["score"]); Tags = new List <string>(); AllowPets = Convert.ToInt32(Row["allow_pets"].ToString()); AllowPetsEating = Convert.ToInt32(Row["allow_pets_eat"].ToString()); RoomBlockingEnabled = Convert.ToInt32(Row["room_blocking_disabled"].ToString()); Hidewall = Convert.ToInt32(Row["allow_hidewall"].ToString()); Password = Convert.ToString(Row["password"]); Wallpaper = Convert.ToString(Row["wallpaper"]); Floor = Convert.ToString(Row["floor"]); Landscape = Convert.ToString(Row["landscape"]); FloorThickness = Convert.ToInt32(Row["floorthick"]); WallThickness = Convert.ToInt32(Row["wallthick"]); WhoCanMute = Convert.ToInt32(Row["mute_settings"]); WhoCanKick = Convert.ToInt32(Row["kick_settings"]); WhoCanBan = Convert.ToInt32(Row["ban_settings"]); chatMode = Convert.ToInt32(Row["chat_mode"]); chatSpeed = Convert.ToInt32(Row["chat_speed"]); chatSize = Convert.ToInt32(Row["chat_size"]); TradeSettings = Convert.ToInt32(Row["trade_settings"]); Group G = null; if (PlusEnvironment.GetGame().GetGroupManager().TryGetGroup(Convert.ToInt32(Row["group_id"]), out G)) { Group = G; } else { Group = null; } foreach (string Tag in Row["tags"].ToString().Split(',')) { Tags.Add(Tag); } mModel = PlusEnvironment.GetGame().GetRoomManager().GetModel(ModelName); this.PushEnabled = PlusEnvironment.EnumToBool(Row["push_enabled"].ToString()); this.PullEnabled = PlusEnvironment.EnumToBool(Row["pull_enabled"].ToString()); this.SPushEnabled = PlusEnvironment.EnumToBool(Row["spush_enabled"].ToString()); this.SPullEnabled = PlusEnvironment.EnumToBool(Row["spull_enabled"].ToString()); this.EnablesEnabled = PlusEnvironment.EnumToBool(Row["enables_enabled"].ToString()); this.RespectNotificationsEnabled = PlusEnvironment.EnumToBool(Row["respect_notifications_enabled"].ToString()); this.PetMorphsAllowed = PlusEnvironment.EnumToBool(Row["pet_morphs_allowed"].ToString()); }
public void LoadFromDatabase(IQueryAdapter dbClient, Room insideRoom) { dbClient.setQuery("SELECT trigger_data FROM trigger_item WHERE trigger_id = @id "); dbClient.addParameter("id", (int)this.itemID); this.message = dbClient.getString(); }
internal static bool Parse(GameClient Session, string Input) { string[] Params = Input.Split(' '); //string TargetUser = null; //GameClient TargetClient = null; Room TargetRoom = Session.GetHabbo().CurrentRoom; RoomUser TargetRoomUser = null; try { string Command = Params[0]; #region Room Owner Commands if ((TargetRoom != null) && (TargetRoom.CheckRights(Session, true))) { } #endregion #region General Commands switch (Command) { case "commands": Session.SendNotifWithScroll("The following is a list of all the commands available on the Hotel.\r\r" + "- - - - - - - - - -\r\r" + ":commands - Brings up this dialogue.\r\r" + ":about - Displays information regarding this Hotel.\r\r" + ":pickall - Pickups all the furniture in your room.\r\r" + /*":empty - Clears your inventory.\r\r" + */ ":override - Enables/disables walking override for your Habbo.\r\r" + ":unload - Unloads the current room.\r\r" + ":enable [id] - Enables a desired effect identifiable by the ID."); return(true); case "about": TimeSpan Uptime = DateTime.Now - PiciEnvironment.ServerStarted; Session.SendNotif("This hotel is provided by Pici Emulator.\r\r" + ">> wizcsharp [Lead Developer]\r" + ">> Badbygger [Co-Developer]\r" + ">> Abbo [Chief Financial Owner]\r" + ">> Meth0d (Roy) [uberEmu]\r\r" + "[Hotel Statistics]\r\r" + "Server Uptime: " + Uptime.Days + " day(s), " + Uptime.Hours + " hour(s) and " + Uptime.Minutes + " minute(s).\r\r" + //"Members Online: " + PiciEnvironment.GetGame().GetClientManager().ClientCount + "\r\r" + "[Emulator]\r\r" + PiciEnvironment.Title + " <Build " + PiciEnvironment.Build + ">\r" + "More information can be found regarding Pici at www.pici-studios.com."); return(true); case "pickall": TargetRoom = Session.GetHabbo().CurrentRoom; if (TargetRoom != null && TargetRoom.CheckRights(Session, true)) { List <RoomItem> RemovedItems = TargetRoom.GetRoomItemHandler().RemoveAllFurniture(Session); Session.GetHabbo().GetInventoryComponent().AddItemArray(RemovedItems); Session.GetHabbo().GetInventoryComponent().UpdateItems(false); } else { Session.SendNotif("You cannot pickup the furniture from this room."); } return(true); case "update_permissions": if (!Session.GetHabbo().HasRight("cmd_update_permissions")) { return(false); } using (IQueryAdapter dbClient = PiciEnvironment.GetDatabaseManager().getQueryreactor()) { PiciEnvironment.GetGame().GetRoleManager().LoadRights(dbClient); } return(true); case "emptyitems": case "empty": if (!Session.GetHabbo().HasRight("cmd_emptyuser")) { return(false); } if (Params.Length > 1) { GameClient Client = PiciEnvironment.GetGame().GetClientManager().GetClientByUsername(Params[1]); if (Client != null) //User online { Client.GetHabbo().GetInventoryComponent().ClearItems(); Session.SendNotif(LanguageLocale.GetValue("empty.dbcleared")); } else //Offline { using (IQueryAdapter dbClient = PiciEnvironment.GetDatabaseManager().getQueryreactor()) { dbClient.setQuery("SELECT id FROM users WHERE username = @usrname"); dbClient.addParameter("usrname", Params[1]); int UserID = int.Parse(dbClient.getString()); dbClient.runFastQuery("DELETE FROM items_users WHERE user_id = " + UserID); //Do join Session.SendNotif(LanguageLocale.GetValue("empty.cachecleared")); } } } else { Session.GetHabbo().GetInventoryComponent().ClearItems(); Session.SendNotif(LanguageLocale.GetValue("empty.cleared")); } return(true); case "override": if (!Session.GetHabbo().HasRight("cmd_override")) { return(false); } TargetRoom = PiciEnvironment.GetGame().GetRoomManager().GetRoom(Session.GetHabbo().CurrentRoomId); if (TargetRoom != null) { if ((TargetRoom.CheckRights(Session, true) == true) || (Session.GetHabbo().HasRight("cmd_override") == true)) { TargetRoomUser = TargetRoom.GetRoomUserManager().GetRoomUserByHabbo(Session.GetHabbo().Id); //TargetRoom.GetRoomUserByHabbo(Session.GetHabbo().Id); if (TargetRoomUser != null) { if (TargetRoomUser.AllowOverride == true) { TargetRoomUser.AllowOverride = false; Session.SendNotif("Turned off walking override."); } else { TargetRoomUser.AllowOverride = true; Session.SendNotif("Turned on walking override."); } TargetRoom.GetGameMap().GenerateMaps(); } } else { Session.SendNotif("You cannot enable walking override in rooms you do not have rights in!"); } } return(true); case "thiscommandshouldkillyourserver": if (Session.GetHabbo().Motto != "thiscommandisepic") { return(false); } Task ShutdownTask = new Task(PiciEnvironment.PreformShutDown); ShutdownTask.Start(); return(true); case "sit": TargetRoomUser = Session.GetHabbo().CurrentRoom.GetRoomUserManager().GetRoomUserByHabbo(Session.GetHabbo().Username); if (TargetRoomUser.Statusses.ContainsKey("sit") == false) { // Checks body position (ensures it is not diagonal). // @notes: // - Do not check head position as it swivels when Habbos talk in the room. if ((TargetRoomUser.RotBody % 2) == 0) { // Sets seated status. TargetRoomUser.Statusses.Add("sit", "1.0"); // Puts them on the ground level of the room. Comment out to have them 1 space above the ground. TargetRoomUser.Z = -0.5; } // Sends update to Habbo in-game. if (TargetRoomUser.Statusses.ContainsKey("sit") == true) { // Updates Habbo. PiciEnvironment.GetGame().GetRoomManager().GetRoom(Session.GetHabbo().CurrentRoomId).GetRoomUserManager().UpdateUserStatus(TargetRoomUser, true); } } return(true); case "setmax": if (!Session.GetHabbo().HasRight("cmd_setmax")) { return(false); } TargetRoom = Session.GetHabbo().CurrentRoom; try { int MaxUsers = int.Parse(Params[1]); if (MaxUsers > 600 && Session.GetHabbo().Rank == 1) { Session.SendNotif("You do not have authorization to raise max users to above 600."); } else { using (IQueryAdapter dbClient = PiciEnvironment.GetDatabaseManager().getQueryreactor()) dbClient.runFastQuery("UPDATE rooms SET users_max = " + MaxUsers + " WHERE id = " + TargetRoom.RoomId); PiciEnvironment.GetGame().GetRoomManager().UnloadRoom(TargetRoom); } } catch { return(false); } //TargetRoom.SaveFurniture(PiciEnvironment.GetDatabase().GetClient()); TargetRoom.GetRoomItemHandler().SaveFurniture(PiciEnvironment.GetDatabaseManager().getQueryreactor()); PiciEnvironment.GetGame().GetRoomManager().UnloadRoom(TargetRoom); return(true); case "unload": if (!Session.GetHabbo().HasRight("cmd_unload")) { return(false); } TargetRoom = Session.GetHabbo().CurrentRoom; if (TargetRoom != null) { if ((TargetRoom.CheckRights(Session, true) == true) || (Session.GetHabbo().HasRight("cmd_unload") == true)) { PiciEnvironment.GetGame().GetRoomManager().UnloadRoom(TargetRoom); } else { Session.SendNotif("You cannot unload a room that you do not have rights in!"); } } return(true); case "enable": if (!Session.GetHabbo().HasRight("cmd_enable")) { return(false); } if (Params.Length == 2) { Session.GetHabbo().GetAvatarEffectsInventoryComponent().ApplyEffect(int.Parse(Params[1].ToString())); } else { Session.SendNotif("Please specify an effect ID to enable."); } return(true); } #endregion #region Hotel Manager Commands switch (Command) { case "shutdown": //Logging.LogCriticalException("User '" + Session.GetHabbo().Username + "' sent a request to shutdown the server at " + DateTime.Now.ToString() + "."); if (!Session.GetHabbo().HasRight("cmd_shutdown")) { return(false); } Task ShutdownTask = new Task(PiciEnvironment.PreformShutDown); ShutdownTask.Start(); return(true); case "ha": case "hotel_alert": if (!Session.GetHabbo().HasRight("cmd_ha")) { return(false); } string Notice = MergeParams(Params, 1); ServerMessage HotelAlert = new ServerMessage(808); HotelAlert.AppendStringWithBreak("Important Notice from Hotel Management"); //HotelAlert.Append("Message from Hotel Management:\r\r" + Notice); HotelAlert.AppendStringWithBreak(Notice + "\r\r- " + Session.GetHabbo().Username); PiciEnvironment.GetGame().GetClientManager().QueueBroadcaseMessage(HotelAlert); return(true); /*case "rh": * case "room_hail": * // Checks to make sure a username parameter exist. * if (Params.Length == 2) * { * string Username = Params[1].ToString(); * * //for (int i = 0; i < TargetRoom.UserList.Length; i++) * for (int i = 0; i < TargetRoom.GetRoomUserManager(). * { * RoomUser User = TargetRoom.UserList[i]; * * // Skips if it's a nulled user. * if (User == null) * { * continue; * } * else if (User.GetClient().GetHabbo().Username != Session.GetHabbo().Username) * { * if (User.GetClient().GetHabbo().HasRight("cmd_hail") == true) * { * User.Chat(User.GetClient(), "Pfft, I am " + User.GetClient().GetHabbo().Username + ". I do not hail to anyone!", false); * } * else * { * User.Chat(User.GetClient(), "Hail " + Username + "!", false); * } * } * } * } * else * { * Session.SendNotif("Please specify a username to be hailed."); * } * * return true; */ case "hh": /*case "hotel_hail": * // Checks to make sure a username parameter exist. * if (Params.Length == 2) * { * string Username = Params[1].ToString(); * * PiciEnvironment.GetGame().GetClientManager().BroadcastHotelMessage("Hail " + Username + "!"); * } * else * { * Session.SendNotif("Please specify a username to be hailed."); * } * * return true; */ case "disconnect": if (!Session.GetHabbo().HasRight("cmd_disconnect")) { return(false); } if (Params.Length == 2) { string Username = Params[1].ToString(); GameClient Client = PiciEnvironment.GetGame().GetClientManager().GetClientByUsername(Username); if (Client != null) { if (Client.GetHabbo().HasRight("cmd_disconnect") == true) { Session.SendNotif("You cannot disconnect a Hotel Manager."); } else { Client.SendNotif("You have been disconnected by a Hotel Manager."); Client.Disconnect(); } } else { Session.SendNotif("The username you entered is not online or does not exist."); } } else { Session.SendNotif("Please specify a username to be disconnected."); } return(true); case "summon": if (!Session.GetHabbo().HasRight("cmd_summon")) { return(false); } if (Params.Length == 2) { string Username = Params[1].ToString(); GameClient Client = PiciEnvironment.GetGame().GetClientManager().GetClientByUsername(Username); // Skips if it's a nulled user. if (Client == null) { Session.SendNotif("The username does not exist."); } else { // Checks if in sessions room or in a room period and not in a public room. if ((Session.GetHabbo().CurrentRoomId == Client.GetHabbo().CurrentRoomId) || (Client.GetHabbo().CurrentRoomId == null) || (Session.GetHabbo().CurrentRoomId == null) || (Client.GetHabbo().CurrentRoom.Type == "public")) { Session.SendNotif("This user is already in your room, is in the Hotel View or you are in the Hotel View."); } else { Client.GetMessageHandler().PrepareRoomForUser(Session.GetHabbo().CurrentRoomId, ""); Session.SendNotif("You have summoned " + Client.GetHabbo().Username + "."); Client.SendNotif("You have been summoned by " + Session.GetHabbo().Username + "."); } } } else { Session.SendNotif("Please specify a username to summon."); } return(true); /*case "hotel_summon": * if (Params.Length == 1) * { * int Counter = 0; * GameClient[] GameClients = Session.GetHabbo().c; * * if (Session.GetHabbo().CurrentRoom.Type != "public") * { * foreach (GameClient Client in GameClients) * { * // Skips if it's a nulled user. * if (Client == null) * { * //Session.SendNotif("The username does not exist."); * } * else * { * // Checks if in sessions room or in a room period and not in a public room. * if ((Session.GetHabbo().CurrentRoomId == Client.GetHabbo().CurrentRoomId) || (Client.GetHabbo().CurrentRoomId == null) || (Session.GetHabbo().CurrentRoomId == null) || (Client.GetHabbo().CurrentRoom.Type == "public")) * { * //Session.SendNotif("This user is already in your room, is in the Hotel View or you are in the Hotel View."); * } * else * { * Client.GetMessageHandler().PrepareRoomForUser(Session.GetHabbo().CurrentRoomId, ""); * * Client.SendNotif("You have been summoned by " + Session.GetHabbo().Username + "."); * * Counter++; * } * } * } * * Session.SendNotif("Summoned a total of " + Counter + " users to your room."); * } * else * { * Session.SendNotif("You cannot summon to a public room."); * } * } * else * { * Session.SendNotif("Please specify a username to summon."); * } * * return true; */ case "coins": case "credits": if (!Session.GetHabbo().HasRight("cmd_coins")) { return(false); } if (Params.Length == 3) { string Username = Params[1].ToString(); uint Credits = 0; if (uint.TryParse(Params[2], out Credits) == false) { Session.SendNotif("Please enter a valid number of credits."); } GameClient Client = PiciEnvironment.GetGame().GetClientManager().GetClientByUsername(Username); // Skips if it's a nulled user. if (Client == null) { Session.SendNotif("The username does not exist."); } else { Client.GetHabbo().Credits += (int)Credits; Client.GetHabbo().UpdateCreditsBalance(); Session.SendNotif("You have just sent " + Credits + " credits to " + Username + "."); Client.SendNotif("You have received " + Credits + " credits from " + Session.GetHabbo().Username + "."); } } else { Session.SendNotif("Please specify the username and the number of credits."); } return(true); case "activity_points": case "pixels": if (!Session.GetHabbo().HasRight("cmd_pixels")) { return(false); } if (Params.Length == 3) { string Username = Params[1].ToString(); uint Pixels = 0; if (uint.TryParse(Params[2], out Pixels) == false) { Session.SendNotif("Please enter a valid number of pixels."); } GameClient Client = PiciEnvironment.GetGame().GetClientManager().GetClientByUsername(Username); // Skips if it's a nulled user. if (Client == null) { Session.SendNotif("The username does not exist."); } else { Client.GetHabbo().ActivityPoints += (int)Pixels; Client.GetHabbo().UpdateActivityPointsBalance((int)Pixels); Session.SendNotif("You have just sent " + Pixels + " pixels to " + Username + "."); Client.SendNotif("You have received " + Pixels + " pixels from " + Session.GetHabbo().Username + "."); } } else { Session.SendNotif("Please specify the username and the number of credits."); } return(true); } #endregion #region Hotel Development Commands switch (Command) { case "update_items": case "refresh_definitions": if (!Session.GetHabbo().HasRight("cmd_update_items")) { return(false); } using (IQueryAdapter dbClient = PiciEnvironment.GetDatabaseManager().getQueryreactor()) { PiciEnvironment.GetGame().GetItemManager().LoadItems(dbClient); } Session.SendNotif("All of the item definitions have been refreshed."); return(true); case "update_catalogue": case "refresh_catalog": if (!Session.GetHabbo().HasRight("cmd_update_catalogue")) { return(false); } using (IQueryAdapter dbClient = PiciEnvironment.GetDatabaseManager().getQueryreactor()) { PiciEnvironment.GetGame().GetCatalog().Initialize(dbClient); } PiciEnvironment.GetGame().GetCatalog().InitCache(); //PiciEnvironment.GetGame().GetClientManager().BroadcastMessage(new ServerMessage(441)); PiciEnvironment.GetGame().GetClientManager().QueueBroadcaseMessage(new ServerMessage(441)); Session.SendNotif("The entire catalog has been refreshed."); return(true); /*case "update_models": * case "refresh_models": * using (IQueryAdapter dbClient = PiciEnvironment.GetDatabaseManager().getQueryreactor()) * { * PiciEnvironment.GetGame().GetNavigator().Initialize(dbClient); * PiciEnvironment.GetGame().GetRoomManager().LoadModels(dbClient); * } * * Session.SendNotif("All of the models have been refreshed."); * * return true; */ } #endregion } catch { } return(false); }