public void Parse(HabboHotel.GameClients.GameClient Session, ClientPacket Packet) { int userID = Packet.PopInt(); Habbo targetData = CloudServer.GetHabboById(userID); if (targetData == null) { Session.SendNotification("Ocorreu um erro ao encontrar o perfil do usuário."); return; } List <Group> groups = CloudServer.GetGame().GetGroupManager().GetGroupsForUser(targetData.Id); int friendCount = 0; using (IQueryAdapter dbClient = CloudServer.GetDatabaseManager().GetQueryReactor()) { dbClient.SetQuery("SELECT COUNT(0) FROM `messenger_friendships` WHERE (`user_one_id` = @userid OR `user_two_id` = @userid)"); dbClient.AddParameter("userid", userID); friendCount = dbClient.getInteger(); } Session.SendMessage(new ProfileInformationComposer(targetData, Session, groups, friendCount)); }
private List <ChatlogEntry> GetChatlogs(RoomData RoomData, double TimeEnter, double TimeExit) { List <ChatlogEntry> Chats = new List <ChatlogEntry>(); DataTable Data = null; using (IQueryAdapter dbClient = CloudServer.GetDatabaseManager().GetQueryReactor()) { dbClient.SetQuery("SELECT `user_id`, `timestamp`, `message` FROM `chatlogs` WHERE `room_id` = " + RoomData.Id + " AND `timestamp` > " + TimeEnter + " AND `timestamp` < " + TimeExit + " ORDER BY `timestamp` DESC LIMIT 100"); Data = dbClient.getTable(); if (Data != null) { foreach (DataRow Row in Data.Rows) { Habbo Habbo = CloudServer.GetHabboById(Convert.ToInt32(Row["user_id"])); if (Habbo != null) { Chats.Add(new ChatlogEntry(Convert.ToInt32(Row["user_id"]), RoomData.Id, Convert.ToString(Row["message"]), Convert.ToDouble(Row["timestamp"]), Habbo)); } } } } return(Chats); }
public void Parse(HabboHotel.GameClients.GameClient Session, ClientPacket Packet) { int UserId = Packet.PopInt(); Habbo Habbo = CloudServer.GetHabboById(UserId); if (Habbo == null) { return; } Session.SendMessage(new HabboUserBadgesComposer(Habbo)); }
public void Parse(HabboHotel.GameClients.GameClient Session, ClientPacket Packet) { if (Session == null || Session.GetHabbo() == null || !Session.GetHabbo().GetPermissions().HasRight("mod_trade_lock")) { return; } int UserId = Packet.PopInt(); string Message = Packet.PopString(); double Days = (Packet.PopInt() / 1440); string Unknown1 = Packet.PopString(); string Unknown2 = Packet.PopString(); double Length = (CloudServer.GetUnixTimestamp() + (Days * 86400)); Habbo Habbo = CloudServer.GetHabboById(UserId); if (Habbo == null) { Session.SendWhisper("Ocorreu um erro em encontrar esse usuário no banco de dados."); return; } if (Habbo.GetPermissions().HasRight("mod_trade_lock") && !Session.GetHabbo().GetPermissions().HasRight("mod_trade_lock_any")) { Session.SendWhisper("Ops, você não pode bloquear outro usuário avaliado em 5 ou superior."); return; } if (Days < 1) { Days = 1; } if (Days > 365) { Days = 365; } using (IQueryAdapter dbClient = CloudServer.GetDatabaseManager().GetQueryReactor()) { dbClient.runFastQuery("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("Suas trocas foram proibidas! " + Days + " día(s)!\r\rRazão:\r\r" + Message); } }
public void Parse(HabboHotel.GameClients.GameClient Session, ClientPacket Packet) { if (Session == null || Session.GetHabbo() == null) { return; } if (!Session.GetHabbo().GetPermissions().HasRight("mod_tool")) { return; } int Junk = Packet.PopInt(); int RoomId = Packet.PopInt(); Room Room = null; if (!CloudServer.GetGame().GetRoomManager().TryGetRoom(RoomId, out Room)) { return; } CloudServer.GetGame().GetChatManager().GetLogs().FlushAndSave(); List <ChatlogEntry> Chats = new List <ChatlogEntry>(); DataTable Data = null; using (IQueryAdapter dbClient = CloudServer.GetDatabaseManager().GetQueryReactor()) { dbClient.SetQuery("SELECT * FROM `chatlogs` WHERE `room_id` = @id ORDER BY `id` DESC LIMIT 100"); dbClient.AddParameter("id", RoomId); Data = dbClient.getTable(); if (Data != null) { foreach (DataRow Row in Data.Rows) { Habbo Habbo = CloudServer.GetHabboById(Convert.ToInt32(Row["user_id"])); if (Habbo != null) { Chats.Add(new ChatlogEntry(Convert.ToInt32(Row["user_id"]), RoomId, Convert.ToString(Row["message"]), Convert.ToDouble(Row["timestamp"]), Habbo)); } } } } Session.SendMessage(new ModeratorRoomChatlogComposer(Room, Chats)); }
public void Parse(HabboHotel.GameClients.GameClient Session, ClientPacket Packet) { if (Session == null || Session.GetHabbo() == null) { return; } if (!Session.GetHabbo().GetPermissions().HasRight("mod_tool")) { return; } int UserId = Packet.PopInt(); Habbo Habbo = CloudServer.GetHabboById(UserId); if (Habbo == null) { Session.SendNotification("Não foi possível encontrar este utilizador."); return; } CloudServer.GetGame().GetChatManager().GetLogs().FlushAndSave(); List <KeyValuePair <RoomData, List <ChatlogEntry> > > Chatlogs = new List <KeyValuePair <RoomData, List <ChatlogEntry> > >(); using (IQueryAdapter dbClient = CloudServer.GetDatabaseManager().GetQueryReactor()) { dbClient.SetQuery("SELECT `room_id`,`entry_timestamp`,`exit_timestamp` FROM `user_roomvisits` WHERE `user_id` = '" + Habbo.Id + "' ORDER BY `entry_timestamp` DESC LIMIT 7"); DataTable GetLogs = dbClient.getTable(); if (GetLogs != null) { foreach (DataRow Row in GetLogs.Rows) { RoomData RoomData = CloudServer.GetGame().GetRoomManager().GenerateRoomData(Convert.ToInt32(Row["room_id"])); if (RoomData == null) { continue; } double TimestampExit = (Convert.ToDouble(Row["exit_timestamp"]) <= 0 ? UnixTimestamp.GetNow() : Convert.ToDouble(Row["exit_timestamp"])); Chatlogs.Add(new KeyValuePair <RoomData, List <ChatlogEntry> >(RoomData, GetChatlogs(RoomData, Convert.ToDouble(Row["entry_timestamp"]), TimestampExit))); } } Session.SendMessage(new ModeratorUserChatlogComposer(Habbo, Chatlogs)); } }
public void Parse(HabboHotel.GameClients.GameClient Session, ClientPacket Packet) { int GroupId = Packet.PopInt(); int UserId = Packet.PopInt(); Group Group = null; if (!CloudServer.GetGame().GetGroupManager().TryGetGroup(GroupId, out Group)) { return; } if (Session.GetHabbo().Id != Group.CreatorId || !Group.IsMember(UserId)) { return; } Habbo Habbo = CloudServer.GetHabboById(UserId); if (Habbo == null) { Session.SendNotification("Ops! Ocorreu um erro ao encontrar esse usuário."); return; } Group.TakeAdmin(UserId); Room Room = null; if (CloudServer.GetGame().GetRoomManager().TryGetRoom(Group.RoomId, out Room)) { RoomUser User = Room.GetRoomUserManager().GetRoomUserByHabbo(UserId); if (User != null) { if (User.Statusses.ContainsKey("flatctrl 3")) { User.RemoveStatus("flatctrl 3"); } User.UpdateNeeded = true; if (User.GetClient() != null) { User.GetClient().SendMessage(new YouAreControllerComposer(0)); } } } Session.SendMessage(new GroupMemberUpdatedComposer(GroupId, Habbo, 2)); }
public bool Execute(params object[] Params) { if (Params == null || Params.Length == 0) { return(false); } Habbo Owner = CloudServer.GetHabboById(Item.UserID); Habbo Player = (Habbo)Params[0]; if (Player == null || Player.GetClient() == null) { return(false); } RoomUser User = Player.CurrentRoom.GetRoomUserManager().GetRoomUserByHabbo(Player.Username); if (User == null) { return(false); } if (String.IsNullOrEmpty(StringData)) { return(false); } int Amount; Amount = Convert.ToInt32(StringData); if (Amount > 500) { Player.GetClient().SendWhisper("La cantidad de Duckets pasa de los limites."); return(false); } else { string Ducket = StringData; Player.Duckets = Player.Duckets += Convert.ToInt32(Ducket); Player.GetClient().SendMessage(new HabboActivityPointNotificationComposer(Player.Duckets, Convert.ToInt32(Ducket))); Player.GetClient().SendMessage(new RoomNotificationComposer("command_notification_credits", "message", "Has recibido " + Ducket + " ducket(s)!")); return(true); } }
public bool Execute(params object[] Params) { if (Params == null || Params.Length == 0) { return(false); } Habbo Owner = CloudServer.GetHabboById(Item.UserID); if (Owner == null || !Owner.GetPermissions().HasRight("room_item_wired_rewards")) { return(false); } Habbo Player = (Habbo)Params[0]; if (Player == null || Player.GetClient() == null) { return(false); } RoomUser User = Player.CurrentRoom.GetRoomUserManager().GetRoomUserByHabbo(Player.Username); if (User == null) { return(false); } if (String.IsNullOrEmpty(StringData)) { return(false); } if (Player.GetBadgeComponent().HasBadge(StringData)) { Player.GetClient().SendNotification("Parece que você já tem esse emblema no inventário ."); } else { Player.GetBadgeComponent().GiveBadge(StringData, true, Player.GetClient()); Player.GetClient().SendMessage(RoomNotificationComposer.SendBubble("badge/" + Params[2], "Acaba de receber um emblema!", "/inventory/open/badge")); } return(true); }
public void Parse(HabboHotel.GameClients.GameClient session, ClientPacket packet) { List <string> ignoredUsers = new List <string>(); foreach (int userId in new List <int>(session.GetHabbo().GetIgnores().IgnoredUserIds())) { Habbo player = CloudServer.GetHabboById(userId); if (player != null) { if (!ignoredUsers.Contains(player.Username)) { ignoredUsers.Add(player.Username); } } } session.SendMessage(new IgnoredUsersComposer(ignoredUsers)); }
public void Parse(HabboHotel.GameClients.GameClient Session, ClientPacket Packet) { int GroupId = Packet.PopInt(); int UserId = Packet.PopInt(); Group Group = null; if (!CloudServer.GetGame().GetGroupManager().TryGetGroup(GroupId, out Group)) { return; } if ((Session.GetHabbo().Id != Group.CreatorId && !Group.IsAdmin(Session.GetHabbo().Id)) && !Session.GetHabbo().GetPermissions().HasRight("fuse_group_accept_any")) { return; } if (!Group.HasRequest(UserId)) { return; } Habbo Habbo = CloudServer.GetHabboById(UserId); if (Habbo == null) { Session.SendNotification("Ocorreu um erro ao procurar esse usuário!"); return; } Group.HandleRequest(UserId, true); if (Group.HasChat) { var Client = CloudServer.GetGame().GetClientManager().GetClientByUserID(UserId); if (Client != null) { Client.SendMessage(new FriendListUpdateComposer(Group, 1)); } } Session.SendMessage(new GroupMemberUpdatedComposer(GroupId, Habbo, 4)); }
public void Parse(HabboHotel.GameClients.GameClient Session, ClientPacket Packet) { Habbo Habbo = CloudServer.GetHabboById(Packet.PopInt()); if (Habbo == null) { return; } var rand = new Random(); Habbo.Relationships = Habbo.Relationships.OrderBy(x => rand.Next()).ToDictionary(item => item.Key, item => item.Value); int Loves = Habbo.Relationships.Count(x => x.Value.Type == 1); int Likes = Habbo.Relationships.Count(x => x.Value.Type == 2); int Hates = Habbo.Relationships.Count(x => x.Value.Type == 3); Session.SendMessage(new GetRelationshipsComposer(Habbo, Loves, Likes, Hates)); }
public void Parse(HabboHotel.GameClients.GameClient Session, ClientPacket Packet) { if (Session == null || Session.GetHabbo() == null || !Session.GetHabbo().GetPermissions().HasRight("mod_mute")) { return; } int UserId = Packet.PopInt(); string Message = Packet.PopString(); double Length = (Packet.PopInt() * 60); string Unknown1 = Packet.PopString(); string Unknown2 = Packet.PopString(); Habbo Habbo = CloudServer.GetHabboById(UserId); if (Habbo == null) { Session.SendWhisper("Ocorreu um erro em encontrar esse usuário no banco de dados."); return; } if (Habbo.GetPermissions().HasRight("mod_mute") && !Session.GetHabbo().GetPermissions().HasRight("mod_mute_any")) { Session.SendWhisper("Ops, você não pode silenciar esse usuário."); return; } using (IQueryAdapter dbClient = CloudServer.GetDatabaseManager().GetQueryReactor()) { dbClient.runFastQuery("UPDATE `users` SET `time_muted` = '" + Length + "' WHERE `id` = '" + Habbo.Id + "' LIMIT 1"); } if (Habbo.GetClient() != null) { Habbo.TimeMuted = Length; Habbo.GetClient().SendNotification("Você foi silenciando por " + Length + " segundos!"); } }
public void Parse(GameClient Session, ClientPacket Packet) { if (Session == null || Session.GetHabbo() == null || Session.GetHabbo().GetMessenger() == null) { return; } int User = Packet.PopInt(); int Type = Packet.PopInt(); if (!Session.GetHabbo().GetMessenger().FriendshipExists(User)) { Session.SendMessage(new BroadcastMessageAlertComposer("Ops, você só pode estabelecer um relacionamento aonde existe uma amizade.")); return; } if (Type < 0 || Type > 3) { Session.SendMessage(new BroadcastMessageAlertComposer("Ops, você escolheu um relacionamento invalido.")); return; } if (Session.GetHabbo().Relationships.Count > 2000) { Session.SendMessage(new BroadcastMessageAlertComposer("Sentimos muito, esta limitado a 2000 relacionamenos.")); return; } using (IQueryAdapter dbClient = CloudServer.GetDatabaseManager().GetQueryReactor()) { if (Type == 0) { dbClient.SetQuery("SELECT `id` FROM `user_relationships` WHERE `user_id` = '" + Session.GetHabbo().Id + "' AND `target` = @target LIMIT 1"); dbClient.AddParameter("target", User); int Id = dbClient.getInteger(); dbClient.SetQuery("DELETE FROM `user_relationships` WHERE `user_id` = '" + Session.GetHabbo().Id + "' AND `target` = @target LIMIT 1"); dbClient.AddParameter("target", User); dbClient.RunQuery(); if (Session.GetHabbo().Relationships.ContainsKey(User)) { Session.GetHabbo().Relationships.Remove(User); } } else { dbClient.SetQuery("SELECT id FROM `user_relationships` WHERE `user_id` = '" + Session.GetHabbo().Id + "' AND `target` = @target LIMIT 1"); dbClient.AddParameter("target", User); int Id = dbClient.getInteger(); if (Id > 0) { dbClient.SetQuery("DELETE FROM `user_relationships` WHERE `user_id` = '" + Session.GetHabbo().Id + "' AND `target` = @target LIMIT 1"); dbClient.AddParameter("target", User); dbClient.RunQuery(); if (Session.GetHabbo().Relationships.ContainsKey(Id)) { Session.GetHabbo().Relationships.Remove(Id); } } dbClient.SetQuery("INSERT INTO `user_relationships` (`user_id`,`target`,`type`) VALUES ('" + Session.GetHabbo().Id + "', @target, @type)"); dbClient.AddParameter("target", User); dbClient.AddParameter("type", Type); int newId = Convert.ToInt32(dbClient.InsertQuery()); if (!Session.GetHabbo().Relationships.ContainsKey(User)) { Session.GetHabbo().Relationships.Add(User, new Relationship(newId, User, Type)); } } GameClient Client = CloudServer.GetGame().GetClientManager().GetClientByUserID(User); if (Client != null) { Session.GetHabbo().GetMessenger().UpdateFriend(User, Client, true); } else { Habbo Habbo = CloudServer.GetHabboById(User); if (Habbo != null) { MessengerBuddy Buddy = null; if (Session.GetHabbo().GetMessenger().TryGetFriend(User, out Buddy)) { Session.SendMessage(new FriendListUpdateComposer(Session, Buddy)); } } } } }
public void Parse(GameClient Session, ClientPacket Packet) { if (Session == null || Session.GetHabbo() == null || !Session.GetHabbo().GetPermissions().HasRight("mod_soft_ban")) { return; } int UserId = Packet.PopInt(); string Message = Packet.PopString(); double Length = (Packet.PopInt() * 3600) + CloudServer.GetUnixTimestamp(); string Unknown1 = Packet.PopString(); string Unknown2 = Packet.PopString(); bool IPBan = Packet.PopBoolean(); bool MachineBan = Packet.PopBoolean(); if (MachineBan) { IPBan = false; } Habbo Habbo = CloudServer.GetHabboById(UserId); if (Habbo == null) { Session.SendWhisper("Ocorreu um erro em encontrar esse usuário no banco de dados."); return; } if (Habbo.GetPermissions().HasRight("mod_tool") && !Session.GetHabbo().GetPermissions().HasRight("mod_ban_any")) { Session.SendWhisper("Ops, você não pode proibir o usuário."); return; } Message = (Message ?? "nenhuma razão foi especificado."); 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"); } if (IPBan == false && MachineBan == false) { CloudServer.GetGame().GetModerationManager().BanUser(Session.GetHabbo().Username, ModerationBanType.USERNAME, Habbo.Username, Message, Length); } else if (IPBan == true) { CloudServer.GetGame().GetModerationManager().BanUser(Session.GetHabbo().Username, ModerationBanType.IP, Habbo.Username, Message, Length); } else if (MachineBan == true) { CloudServer.GetGame().GetModerationManager().BanUser(Session.GetHabbo().Username, ModerationBanType.IP, Habbo.Username, Message, Length); CloudServer.GetGame().GetModerationManager().BanUser(Session.GetHabbo().Username, ModerationBanType.USERNAME, Habbo.Username, Message, Length); CloudServer.GetGame().GetModerationManager().BanUser(Session.GetHabbo().Username, ModerationBanType.MACHINE, Habbo.Username, Message, Length); } GameClient TargetClient = CloudServer.GetGame().GetClientManager().GetClientByUsername(Habbo.Username); if (TargetClient != null) { TargetClient.Disconnect(); } }
public void Parse(HabboHotel.GameClients.GameClient Session, ClientPacket Packet) { if (Session == null || Session.GetHabbo() == null) { return; } // Run a quick check to see if we have any existing tickets. if (CloudServer.GetGame().GetModerationManager().UserHasTickets(Session.GetHabbo().Id)) { ModerationTicket PendingTicket = CloudServer.GetGame().GetModerationManager().GetTicketBySenderId(Session.GetHabbo().Id); if (PendingTicket != null) { Session.SendMessage(new CallForHelpPendingCallsComposer(PendingTicket)); return; } } List <string> Chats = new List <string>(); string Message = StringCharFilter.Escape(Packet.PopString().Trim()); int Category = Packet.PopInt(); int ReportedUserId = Packet.PopInt(); int Type = Packet.PopInt();// Unsure on what this actually is. Habbo ReportedUser = CloudServer.GetHabboById(ReportedUserId); if (ReportedUser == null) { // User doesn't exist. return; } int Messagecount = Packet.PopInt(); for (int i = 0; i < Messagecount; i++) { Packet.PopInt(); Chats.Add(Packet.PopString()); } ModerationTicket Ticket = new ModerationTicket(1, Type, Category, UnixTimestamp.GetNow(), 1, Session.GetHabbo(), ReportedUser, Message, Session.GetHabbo().CurrentRoom, Chats); if (!CloudServer.GetGame().GetModerationManager().TryAddTicket(Ticket)) { return; } using (IQueryAdapter dbClient = CloudServer.GetDatabaseManager().GetQueryReactor()) { // TODO: Come back to this. /*dbClient.SetQuery("INSERT INTO `moderation_tickets` (`score`,`type`,`status`,`sender_id`,`reported_id`,`moderator_id`,`message`,`room_id`,`room_name`,`timestamp`) VALUES (1, '" + Category + "', 'open', '" + Session.GetHabbo().Id + "', '" + ReportedUserId + "', '0', @message, '0', '', '" + CloudServer.GetUnixTimestamp() + "')"); * dbClient.AddParameter("message", Message); * dbClient.RunQuery();*/ dbClient.runFastQuery("UPDATE `user_info` SET `cfhs` = `cfhs` + '1' WHERE `user_id` = '" + Session.GetHabbo().Id + "' LIMIT 1"); } CloudServer.GetGame().GetClientManager().ModAlert("Um novo ticket de suporte foi enviado!"); CloudServer.GetGame().GetClientManager().SendMessage(new ModeratorSupportTicketComposer(Session.GetHabbo().Id, Ticket), "mod_tool"); }
public Habbo GetAuthor() { return(CloudServer.GetHabboById(UserId)); }
public bool Execute(params object[] Params) { if (Params == null || Params.Length == 0) { return(false); } Habbo Owner = CloudServer.GetHabboById(Item.UserID); if (Owner == null || !Owner.GetPermissions().HasRight("room_item_wired_rewards")) { return(false); } Habbo Player = (Habbo)Params[0]; if (Player == null || Player.GetClient() == null) { return(false); } RoomUser User = Player.CurrentRoom.GetRoomUserManager().GetRoomUserByHabbo(Player.Username); if (User == null) { return(false); } if (String.IsNullOrEmpty(StringData)) { return(false); } int amountLeft = int.Parse(StringData.Split('-')[2]); int often = int.Parse(StringData.Split('-')[1]); bool unique = BoolData; bool premied = false; if (amountLeft == 1) { Player.GetClient().SendNotification("Ya no hay mas premios, vuelve mas tarde."); return(true); } foreach (var dataStr in (StringData.Split('-')[0]).Split(';')) { var dataArray = dataStr.Split(','); var isbadge = dataArray[0] == "0"; var code = dataArray[1]; var percentage = int.Parse(dataArray[2]); var random = CloudServer.GetRandomNumber(0, 100); if (!unique && percentage < random) { continue; } premied = true; if (isbadge) { if (Player.GetBadgeComponent().HasBadge(code)) { Player.GetClient().SendMessage(new WhisperComposer(User.VirtualId, "Oops,Parece que já recebeu este emblema !", 0, User.LastBubble)); } else { Player.GetBadgeComponent().GiveBadge(code, true, Player.GetClient()); Player.GetClient().SendMessage(RoomNotificationComposer.SendBubble("badge/" + Params[2], "Acaba de receber um emblema!", "/inventory/open/badge")); } } else { ItemData ItemData = null; if (!CloudServer.GetGame().GetItemManager().GetItem(int.Parse(code), out ItemData)) { Player.GetClient().SendMessage(new WhisperComposer(User.VirtualId, "No se pudo obtener Item ID: " + code, 0, User.LastBubble)); return(false); } Item Item = ItemFactory.CreateSingleItemNullable(ItemData, Player.GetClient().GetHabbo(), "", "", 0, 0, 0); if (Item != null) { Player.GetClient().GetHabbo().GetInventoryComponent().TryAddItem(Item); Player.GetClient().SendMessage(new FurniListNotificationComposer(Item.Id, 1)); Player.GetClient().SendMessage(new PurchaseOKComposer()); Player.GetClient().SendMessage(new FurniListAddComposer(Item)); Player.GetClient().SendMessage(new FurniListUpdateComposer()); Player.GetClient().SendNotification("¡Has recibido un regalo! Revisa tu inventario."); } } } if (!premied) { Player.GetClient().SendNotification("Suerte la proxima vez :("); } else if (amountLeft > 1) { amountLeft--; this.StringData.Split('-')[2] = amountLeft.ToString(); } return(true); }
public Habbo GetDeleter() { return(CloudServer.GetHabboById(DeleterId)); }