public void Parse(HabboHotel.GameClients.GameClient Session, ClientPacket Packet) { Session.SendMessage(new AchievementsComposer(Session, QuasarEnvironment.GetGame().GetAchievementManager()._achievements.Values.ToList())); }
public void Execute(GameClients.GameClient Session, Rooms.Room Room, string[] Params) { if (Session.GetHabbo().Id == Room.OwnerId) { //Let us check anyway. if (!Room.CheckRights(Session, true)) { return; } foreach (Item Item in Room.GetRoomItemHandler().GetWallAndFloor.ToList()) { if (Item == null || Item.UserID == Session.GetHabbo().Id) { continue; } GameClient TargetClient = QuasarEnvironment.GetGame().GetClientManager().GetClientByUserID(Item.UserID); if (TargetClient != null && TargetClient.GetHabbo() != null) { Room.GetRoomItemHandler().RemoveFurniture(TargetClient, Item.Id); TargetClient.GetHabbo().GetInventoryComponent().AddNewItem(Item.Id, Item.BaseItem, Item.ExtraData, Item.GroupId, true, true, Item.LimitedNo, Item.LimitedTot); TargetClient.GetHabbo().GetInventoryComponent().UpdateItems(false); } else { Room.GetRoomItemHandler().RemoveFurniture(null, Item.Id); using (IQueryAdapter dbClient = QuasarEnvironment.GetDatabaseManager().GetQueryReactor()) { dbClient.RunQuery("UPDATE `items` SET `room_id` = '0' WHERE `id` = '" + Item.Id + "' LIMIT 1"); } } } } else { foreach (Item Item in Room.GetRoomItemHandler().GetWallAndFloor.ToList()) { if (Item == null || Item.UserID != Session.GetHabbo().Id) { continue; } GameClient TargetClient = QuasarEnvironment.GetGame().GetClientManager().GetClientByUserID(Item.UserID); if (TargetClient != null && TargetClient.GetHabbo() != null) { Room.GetRoomItemHandler().RemoveFurniture(TargetClient, Item.Id); TargetClient.GetHabbo().GetInventoryComponent().AddNewItem(Item.Id, Item.BaseItem, Item.ExtraData, Item.GroupId, true, true, Item.LimitedNo, Item.LimitedTot); TargetClient.GetHabbo().GetInventoryComponent().UpdateItems(false); } else { Room.GetRoomItemHandler().RemoveFurniture(null, Item.Id); using (IQueryAdapter dbClient = QuasarEnvironment.GetDatabaseManager().GetQueryReactor()) { dbClient.RunQuery("UPDATE `items` SET `room_id` = '0' WHERE `id` = '" + Item.Id + "' LIMIT 1"); } } } } }
public static UserData GetUserData(string SessionTicket, out byte errorCode) { int UserId; DataRow dUserInfo = null; DataTable dAchievements = null; DataTable dFavouriteRooms = null; DataTable dIgnores = null; DataTable dBadges = null; DataTable dEffects = null; DataTable dFriends = null; DataTable dRequests = null; DataTable dRooms = null; DataTable dQuests = null; DataTable dRelations = null; DataTable talentsTable = null; DataRow UserInfo = null; DataTable Subscriptions = null; using (IQueryAdapter dbClient = QuasarEnvironment.GetDatabaseManager().GetQueryReactor()) { dbClient.SetQuery("SELECT * FROM `users` WHERE `auth_ticket` = @sso LIMIT 1"); dbClient.AddParameter("sso", SessionTicket); dUserInfo = dbClient.getRow(); if (dUserInfo == null) { errorCode = 1; return(null); } UserId = Convert.ToInt32(dUserInfo["id"]); if (QuasarEnvironment.GetGame().GetClientManager().GetClientByUserID(UserId) != null) { errorCode = 2; QuasarEnvironment.GetGame().GetClientManager().GetClientByUserID(UserId).Disconnect(); return(null); } dbClient.SetQuery("SELECT `group`,`level`,`progress` FROM `user_achievements` WHERE `userid` = '" + UserId + "'"); dAchievements = dbClient.getTable(); dbClient.SetQuery("SELECT room_id FROM user_favorites WHERE `user_id` = '" + UserId + "'"); dFavouriteRooms = dbClient.getTable(); dbClient.SetQuery("SELECT ignore_id FROM user_ignores WHERE `user_id` = '" + UserId + "'"); dIgnores = dbClient.getTable(); dbClient.SetQuery("SELECT `badge_id`,`badge_slot` FROM user_badges WHERE `user_id` = '" + UserId + "'"); dBadges = dbClient.getTable(); dbClient.SetQuery("SELECT `effect_id`,`total_duration`,`is_activated`,`activated_stamp` FROM user_effects WHERE `user_id` = '" + UserId + "'"); dEffects = dbClient.getTable(); dbClient.SetQuery( "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); dFriends = dbClient.getTable(); dbClient.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); dRequests = dbClient.getTable(); dbClient.SetQuery("SELECT * FROM rooms WHERE `owner` = '" + UserId + "' LIMIT 150"); dRooms = dbClient.getTable(); dbClient.SetQuery("SELECT * FROM users_talents WHERE userid = '" + UserId + "'"); talentsTable = dbClient.getTable(); dbClient.SetQuery("SELECT `quest_id`,`progress` FROM user_quests WHERE `user_id` = '" + UserId + "'"); dQuests = dbClient.getTable(); dbClient.SetQuery("SELECT * FROM `user_relationships` WHERE `user_id` = @id"); dbClient.AddParameter("id", UserId); dRelations = dbClient.getTable(); dbClient.SetQuery("SELECT * FROM user_subscriptions WHERE user_id = '" + UserId + "'"); Subscriptions = dbClient.getTable(); dbClient.SetQuery("SELECT * FROM `user_info` WHERE `user_id` = '" + UserId + "' LIMIT 1"); UserInfo = dbClient.getRow(); if (UserInfo == null) { dbClient.RunQuery("INSERT INTO `user_info` (`user_id`) VALUES ('" + UserId + "')"); dbClient.SetQuery("SELECT * FROM `user_info` WHERE `user_id` = '" + UserId + "' LIMIT 1"); UserInfo = dbClient.getRow(); } dbClient.runFastQuery("UPDATE users SET online='1' WHERE id=" + UserId + " LIMIT 1"); } ConcurrentDictionary <string, UserAchievement> Achievements = new ConcurrentDictionary <string, UserAchievement>(); foreach (DataRow dRow in dAchievements.Rows) { Achievements.TryAdd(Convert.ToString(dRow["group"]), new UserAchievement(Convert.ToString(dRow["group"]), Convert.ToInt32(dRow["level"]), Convert.ToInt32(dRow["progress"]))); } List <int> favouritedRooms = new List <int>(); foreach (DataRow dRow in dFavouriteRooms.Rows) { favouritedRooms.Add(Convert.ToInt32(dRow["room_id"])); } List <int> ignores = new List <int>(); foreach (DataRow dRow in dIgnores.Rows) { ignores.Add(Convert.ToInt32(dRow["ignore_id"])); } List <Badge> badges = new List <Badge>(); foreach (DataRow dRow in dBadges.Rows) { badges.Add(new Badge(Convert.ToString(dRow["badge_id"]), Convert.ToInt32(dRow["badge_slot"]))); } Dictionary <int, MessengerBuddy> friends = new Dictionary <int, MessengerBuddy>(); foreach (DataRow dRow in dFriends.Rows) { int friendID = Convert.ToInt32(dRow["id"]); string friendName = Convert.ToString(dRow["username"]); string friendLook = Convert.ToString(dRow["look"]); string friendMotto = Convert.ToString(dRow["motto"]); int friendLastOnline = Convert.ToInt32(dRow["last_online"]); bool friendHideOnline = QuasarEnvironment.EnumToBool(dRow["hide_online"].ToString()); bool friendHideRoom = QuasarEnvironment.EnumToBool(dRow["hide_inroom"].ToString()); if (friendID == UserId) { continue; } if (!friends.ContainsKey(friendID)) { friends.Add(friendID, new MessengerBuddy(friendID, friendName, friendLook, friendMotto, friendLastOnline, friendHideOnline, friendHideRoom)); } } Dictionary <int, MessengerRequest> requests = new Dictionary <int, MessengerRequest>(); foreach (DataRow dRow in dRequests.Rows) { int receiverID = Convert.ToInt32(dRow["from_id"]); int senderID = Convert.ToInt32(dRow["to_id"]); string requestUsername = Convert.ToString(dRow["username"]); if (receiverID != UserId) { if (!requests.ContainsKey(receiverID)) { requests.Add(receiverID, new MessengerRequest(UserId, receiverID, requestUsername)); } } else { if (!requests.ContainsKey(senderID)) { requests.Add(senderID, new MessengerRequest(UserId, senderID, requestUsername)); } } } List <RoomData> rooms = new List <RoomData>(); foreach (DataRow dRow in dRooms.Rows) { rooms.Add(QuasarEnvironment.GetGame().GetRoomManager().FetchRoomData(Convert.ToInt32(dRow["id"]), dRow)); } Dictionary <int, int> quests = new Dictionary <int, int>(); foreach (DataRow dRow in dQuests.Rows) { int questId = Convert.ToInt32(dRow["quest_id"]); if (quests.ContainsKey(questId)) { quests.Remove(questId); } quests.Add(questId, Convert.ToInt32(dRow["progress"])); } Dictionary <int, Relationship> Relationships = new Dictionary <int, Relationship>(); foreach (DataRow Row in dRelations.Rows) { if (friends.ContainsKey(Convert.ToInt32(Row[2]))) { Relationships.Add(Convert.ToInt32(Row[2]), new Relationship(Convert.ToInt32(Row[0]), Convert.ToInt32(Row[2]), Convert.ToInt32(Row[3].ToString()))); } } Dictionary <int, UserTalent> talents = new Dictionary <int, UserTalent>(); if (talentsTable != null) { foreach (DataRow row in talentsTable.Rows) { int num2 = (int)row["talent_id"]; int state = (int)row["talent_state"]; talents.Add(num2, new UserTalent(num2, state)); } } Dictionary <string, Subscription> subscriptions = new Dictionary <string, Subscription>(); foreach (DataRow dataRow in Subscriptions.Rows) { string str = (string)dataRow["subscription_id"]; int TimeExpire = (int)dataRow["timestamp_expire"]; subscriptions.Add(str, new Subscription(str, TimeExpire)); } Habbo user = HabboFactory.GenerateHabbo(dUserInfo, UserInfo); dUserInfo = null; dAchievements = null; dFavouriteRooms = null; dIgnores = null; dBadges = null; dEffects = null; dFriends = null; dRequests = null; dRooms = null; dRelations = null; errorCode = 0; return(new UserData(UserId, Achievements, favouritedRooms, ignores, badges, friends, requests, rooms, quests, user, Relationships, talents, subscriptions)); }
public void Parse(HabboHotel.GameClients.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) + QuasarEnvironment.GetUnixTimestamp(); string Unknown1 = Packet.PopString(); string Unknown2 = Packet.PopString(); bool IPBan = Packet.PopBoolean(); bool MachineBan = Packet.PopBoolean(); if (MachineBan) { IPBan = false; } Habbo Habbo = QuasarEnvironment.GetHabboById(UserId); if (Habbo == null) { Session.SendWhisper("Oeps! Deze gebruiker besaat niet."); return; } if (Habbo.GetPermissions().HasRight("mod_tool") && !Session.GetHabbo().GetPermissions().HasRight("mod_ban_any")) { Session.SendWhisper("Oeps! Je kunt deze actie niet op deze gebruiker uitvoeren."); return; } Message = (Message != null ? Message : "geen reden (nodig)."); 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"); } if (IPBan == false && MachineBan == false) { QuasarEnvironment.GetGame().GetModerationManager().BanUser(Session.GetHabbo().Username, ModerationBanType.USERNAME, Habbo.Username, Message, Length); } else if (IPBan == true) { QuasarEnvironment.GetGame().GetModerationManager().BanUser(Session.GetHabbo().Username, ModerationBanType.IP, Habbo.Username, Message, Length); } else if (MachineBan == true) { QuasarEnvironment.GetGame().GetModerationManager().BanUser(Session.GetHabbo().Username, ModerationBanType.IP, Habbo.Username, Message, Length); QuasarEnvironment.GetGame().GetModerationManager().BanUser(Session.GetHabbo().Username, ModerationBanType.USERNAME, Habbo.Username, Message, Length); QuasarEnvironment.GetGame().GetModerationManager().BanUser(Session.GetHabbo().Username, ModerationBanType.MACHINE, Habbo.Username, Message, Length); } GameClient TargetClient = QuasarEnvironment.GetGame().GetClientManager().GetClientByUsername(Habbo.Username); if (TargetClient != null) { TargetClient.Disconnect(); } }
public void Execute(GameClients.GameClient Session, Rooms.Room Room, string[] Params) { if (Params.Length == 1) { Session.SendWhisper("Oeps! Je hebt geen waarde ingevoerd [Credits, Diamanten of Duckets]."); return; } string UpdateVal = Params[1]; switch (UpdateVal.ToLower()) { case "coins": case "credits": { if (!Session.GetHabbo().GetPermissions().HasCommand("command_geef_credits")) { Session.SendWhisper("Oeps! Je hebt niet de bevoegdheid om deze actie uit te voeren."); break; } else { int Amount; if (int.TryParse(Params[2], out Amount)) { foreach (GameClient Target in QuasarEnvironment.GetGame().GetClientManager().GetClients.ToList()) { if (Target == null || Target.GetHabbo() == null || Target.GetHabbo().Username == Session.GetHabbo().Username) { continue; } Target.GetHabbo().Credits = Target.GetHabbo().Credits += Amount; Target.SendMessage(new CreditBalanceComposer(Target.GetHabbo().Credits)); if (Target.GetHabbo().Id != Session.GetHabbo().Id) { Target.SendNotification("Je hebt <b>" + Amount.ToString() + "</b> Credit(s) ontvangen van het Hotel Management!"); } Session.SendWhisper("Je hebt " + Amount + " Credit(s) gegeven aan iedereen die online is.", 34); } break; } else { Session.SendWhisper("Oeps! Het ingevulde bedrag is niet geldig.", 34); break; } } } case "pixels": case "duckets": { if (!Session.GetHabbo().GetPermissions().HasCommand("command_geef_duckets")) { Session.SendWhisper("Oeps! Je hebt niet de bevoegdheid om deze actie uit te voeren."); break; } else { int Amount; if (int.TryParse(Params[2], out Amount)) { foreach (GameClient Target in QuasarEnvironment.GetGame().GetClientManager().GetClients.ToList()) { if (Target == null || Target.GetHabbo() == null || Target.GetHabbo().Username == Session.GetHabbo().Username) { continue; } Target.GetHabbo().Duckets += Amount; Target.SendMessage(new HabboActivityPointNotificationComposer(Target.GetHabbo().Duckets, Amount)); if (Target.GetHabbo().Id != Session.GetHabbo().Id) { Target.SendNotification("Je hebt <b>" + Amount.ToString() + "</b> Ducket(s) ontvangen van het Hotel Management!"); } Session.SendWhisper("Je hebt " + Amount + " Ducket(s) gegeven aan " + Target.GetHabbo().Username + " die online is.", 34); } break; } else { Session.SendWhisper("Oeps! Het ingevulde bedrag is niet geldig.", 34); break; } } } case "belcredits": case "diamanten": case "diamonds": { if (!Session.GetHabbo().GetPermissions().HasCommand("command_geef_diamanten")) { Session.SendWhisper("Oeps! Je hebt niet de bevoegdheid om deze actie uit te voeren."); break; } else { int Amount; if (int.TryParse(Params[2], out Amount)) { foreach (GameClient Target in QuasarEnvironment.GetGame().GetClientManager().GetClients.ToList()) { if (Target == null || Target.GetHabbo() == null || Target.GetHabbo().Username == Session.GetHabbo().Username) { continue; } Target.GetHabbo().Diamonds += Amount; Target.SendMessage(new HabboActivityPointNotificationComposer(Target.GetHabbo().Diamonds, Amount, 5)); if (Target.GetHabbo().Id != Session.GetHabbo().Id) { Target.SendNotification("Je hebt <b>" + Amount.ToString() + "</b> Diamant(en) ontvangen van het Hotel Management!"); } Session.SendWhisper("Je hebt " + Amount + " Diamant(en) gegeven aan iedereen die online is.", 34); } break; } else { Session.SendWhisper("Oeps! Het ingevulde bedrag is niet geldig.", 34); break; } } } case "punten": { if (!Session.GetHabbo().GetPermissions().HasCommand("command_geef_punten")) { Session.SendWhisper("Oeps! Je hebt niet de bevoegdheid om deze actie uit te voeren."); break; } else { int Amount; if (int.TryParse(Params[2], out Amount)) { if (Amount > 50) { Session.SendWhisper("Je kunt niet meer dan 50 punten per keer sturen."); return; } foreach (GameClient Target in QuasarEnvironment.GetGame().GetClientManager().GetClients.ToList()) { if (Target == null || Target.GetHabbo() == null || Target.GetHabbo().Username == Session.GetHabbo().Username) { continue; } Target.GetHabbo().GOTWPoints = Target.GetHabbo().GOTWPoints + Amount; Target.GetHabbo().UserPoints = Target.GetHabbo().UserPoints + 1; Target.SendMessage(new HabboActivityPointNotificationComposer(Target.GetHabbo().GOTWPoints, Amount, 103)); if (Target.GetHabbo().Id != Session.GetHabbo().Id) { Target.SendNotification("Je hebt <b>" + Amount.ToString() + "</b> Punt(en) ontvangen van het Hotel Management!"); } Session.SendWhisper("Je hebt " + Amount + " Punt(en) gegeven aan iedereen die online is.", 34); } break; } else { Session.SendWhisper("Oeps! Het ingevulde bedrag is niet geldig.", 34); break; } } } default: Session.SendWhisper("'" + UpdateVal + "' is geen geldige waarde!", 34); break; } }
public void Parse(HabboHotel.GameClients.GameClient Session, ClientPacket Packet) { int GroupId = Packet.PopInt(); Group Group = null; if (!QuasarEnvironment.GetGame().GetGroupManager().TryGetGroup(GroupId, out Group)) { return; } if (Group.CreatorId != Session.GetHabbo().Id) { return; } int Type = Packet.PopInt(); int FurniOptions = Packet.PopInt(); switch (Type) { default: case 0: Group.GroupType = GroupType.OPEN; break; case 1: Group.GroupType = GroupType.LOCKED; break; case 2: Group.GroupType = GroupType.PRIVATE; break; } if (Group.GroupType != GroupType.LOCKED) { if (Group.GetRequests.Count > 0) { foreach (int UserId in Group.GetRequests.ToList()) { Group.HandleRequest(UserId, false); } Group.ClearRequests(); } } using (IQueryAdapter dbClient = QuasarEnvironment.GetDatabaseManager().GetQueryReactor()) { dbClient.SetQuery("UPDATE `groups` SET `state` = @GroupState, `admindeco` = @AdminDeco WHERE `id` = " + Group.Id + " LIMIT 1"); dbClient.AddParameter("GroupState", (Group.GroupType == GroupType.OPEN ? 0 : Group.GroupType == GroupType.LOCKED ? 1 : 2).ToString()); dbClient.AddParameter("AdminDeco", (FurniOptions == 1 ? 1 : 0).ToString()); dbClient.RunQuery(); } Group.AdminOnlyDeco = FurniOptions; Room Room; if (!QuasarEnvironment.GetGame().GetRoomManager().TryGetRoom(Group.RoomId, out Room)) { return; } foreach (RoomUser User in Room.GetRoomUserManager().GetRoomUsers().ToList()) { if (Room.OwnerId == User.UserId || Group.IsAdmin(User.UserId) || !Group.IsMember(User.UserId)) { continue; } if (FurniOptions == 1) { User.RemoveStatus("flatctrl 1"); User.UpdateNeeded = true; User.GetClient().SendMessage(new YouAreControllerComposer(0)); } else if (FurniOptions == 0 && !User.Statusses.ContainsKey("flatctrl 1")) { User.AddStatus("flatctrl 1", ""); User.UpdateNeeded = true; User.GetClient().SendMessage(new YouAreControllerComposer(1)); } } Session.SendMessage(new GroupInfoComposer(Group, Session)); }
public void Parse(HabboHotel.GameClients.GameClient Session, ClientPacket Packet) { QuasarEnvironment.GetGame().GetQuestManager().CancelQuest(Session, Packet); }
public void Parse(HabboHotel.GameClients.GameClient Session, ClientPacket Packet) { int MinCost = Packet.PopInt(); int MaxCost = Packet.PopInt(); string SearchQuery = Packet.PopString(); int FilterMode = Packet.PopInt(); DataTable table = null; StringBuilder builder = new StringBuilder(); string str = ""; builder.Append("WHERE `state` = '1' AND `timestamp` >= " + QuasarEnvironment.GetGame().GetCatalog().GetMarketplace().FormatTimestampString()); if (MinCost >= 0) { builder.Append(" AND `total_price` > " + MinCost); } if (MaxCost >= 0) { builder.Append(" AND `total_price` < " + MaxCost); } switch (FilterMode) { case 1: str = "ORDER BY `asking_price` DESC"; break; default: str = "ORDER BY `asking_price` ASC"; break; } using (IQueryAdapter dbClient = QuasarEnvironment.GetDatabaseManager().GetQueryReactor()) { dbClient.SetQuery("SELECT `offer_id`, item_type, sprite_id, total_price, `limited_number`,`limited_stack` FROM catalog_marketplace_offers " + builder.ToString() + " " + str + " LIMIT 500"); dbClient.AddParameter("search_query", "%" + SearchQuery + "%"); if (SearchQuery.Length >= 1) { builder.Append(" AND public_name LIKE @search_query"); } table = dbClient.getTable(); } QuasarEnvironment.GetGame().GetCatalog().GetMarketplace().MarketItems.Clear(); QuasarEnvironment.GetGame().GetCatalog().GetMarketplace().MarketItemKeys.Clear(); if (table != null) { foreach (DataRow row in table.Rows) { if (!QuasarEnvironment.GetGame().GetCatalog().GetMarketplace().MarketItemKeys.Contains(Convert.ToInt32(row["offer_id"]))) { QuasarEnvironment.GetGame().GetCatalog().GetMarketplace().MarketItemKeys.Add(Convert.ToInt32(row["offer_id"])); QuasarEnvironment.GetGame().GetCatalog().GetMarketplace().MarketItems.Add(new MarketOffer(Convert.ToInt32(row["offer_id"]), Convert.ToInt32(row["sprite_id"]), Convert.ToInt32(row["total_price"]), int.Parse(row["item_type"].ToString()), Convert.ToInt32(row["limited_number"]), Convert.ToInt32(row["limited_stack"]))); } } } Dictionary <int, MarketOffer> dictionary = new Dictionary <int, MarketOffer>(); Dictionary <int, int> dictionary2 = new Dictionary <int, int>(); foreach (MarketOffer item in QuasarEnvironment.GetGame().GetCatalog().GetMarketplace().MarketItems) { if (dictionary.ContainsKey(item.SpriteId)) { if (item.LimitedNumber > 0) { if (!dictionary.ContainsKey(item.OfferID)) { dictionary.Add(item.OfferID, item); } if (!dictionary2.ContainsKey(item.OfferID)) { dictionary2.Add(item.OfferID, 1); } } else { if (dictionary[item.SpriteId].TotalPrice > item.TotalPrice) { dictionary.Remove(item.SpriteId); dictionary.Add(item.SpriteId, item); } int num = dictionary2[item.SpriteId]; dictionary2.Remove(item.SpriteId); dictionary2.Add(item.SpriteId, num + 1); } } else { if (!dictionary.ContainsKey(item.SpriteId)) { dictionary.Add(item.SpriteId, item); } if (!dictionary2.ContainsKey(item.SpriteId)) { dictionary2.Add(item.SpriteId, 1); } } } Session.SendMessage(new MarketPlaceOffersComposer(MinCost, MaxCost, dictionary, dictionary2)); }
public void Parse(HabboHotel.GameClients.GameClient Session, ClientPacket Packet) { if (!Session.GetHabbo().GetPermissions().HasRight("mod_tool")) { return; } Room Room = null; if (!QuasarEnvironment.GetGame().GetRoomManager().TryGetRoom(Packet.PopInt(), out Room)) { return; } bool SetLock = Packet.PopInt() == 1; bool SetName = Packet.PopInt() == 1; bool KickAll = Packet.PopInt() == 1; if (SetName) { Room.RoomData.Name = "Onacceptabel voor Hotel Management."; Room.RoomData.Description = "Deze kamer gaat tegen de regels van Habbis Hotel in."; } if (SetLock) { Room.RoomData.Access = RoomAccess.DOORBELL; } if (Room.Tags.Count > 0) { Room.ClearTags(); } if (Room.RoomData.HasActivePromotion) { Room.RoomData.EndPromotion(); } using (IQueryAdapter dbClient = QuasarEnvironment.GetDatabaseManager().GetQueryReactor()) { if (SetName && SetLock) { dbClient.RunQuery("UPDATE `rooms` SET `caption` = 'Onacceptabel voor Hotel Management.', `description` = 'Deze kamer gaat tegen de regels van Habbis Hotel in.', `tags` = '', `state` = '1' WHERE `id` = '" + Room.RoomId + "' LIMIT 1"); } else if (SetName && !SetLock) { dbClient.RunQuery("UPDATE `rooms` SET `caption` = 'Onacceptabel voor Hotel Management.', `description` = 'Deze kamer gaat tegen de regels van Habbis Hotel in.', `tags` = '' WHERE `id` = '" + Room.RoomId + "' LIMIT 1"); } else if (!SetName && SetLock) { dbClient.RunQuery("UPDATE `rooms` SET `state` = '1', `tags` = '' WHERE `id` = '" + Room.RoomId + "' LIMIT 1"); } } Room.SendMessage(new RoomSettingsSavedComposer(Room.RoomId)); Room.SendMessage(new RoomInfoUpdatedComposer(Room.RoomId)); if (KickAll) { foreach (RoomUser RoomUser in Room.GetRoomUserManager().GetUserList().ToList()) { if (RoomUser == null || RoomUser.IsBot) { continue; } if (RoomUser.GetClient() == null || RoomUser.GetClient().GetHabbo() == null) { continue; } if (RoomUser.GetClient().GetHabbo().Rank >= Session.GetHabbo().Rank || RoomUser.GetClient().GetHabbo().Id == Session.GetHabbo().Id) { continue; } Room.GetRoomUserManager().RemoveUserFromRoom(RoomUser.GetClient(), true, false); } } }
public void Parse(HabboHotel.GameClients.GameClient Session, ClientPacket Packet) { if (Session == null || Session.GetHabbo() == null) { return; } string Gender = Packet.PopString().ToUpper(); string Look = QuasarEnvironment.GetGame().GetAntiMutant().RunLook(Packet.PopString()); if (Look == Session.GetHabbo().Look) { return; } if ((DateTime.Now - Session.GetHabbo().LastClothingUpdateTime).TotalSeconds <= 2.0) { Session.GetHabbo().ClothingUpdateWarnings += 1; if (Session.GetHabbo().ClothingUpdateWarnings >= 25) { Session.GetHabbo().SessionClothingBlocked = true; } return; } if (Session.GetHabbo().SessionClothingBlocked) { return; } Session.GetHabbo().LastClothingUpdateTime = DateTime.Now; string[] AllowedGenders = { "M", "F" }; if (!AllowedGenders.Contains(Gender)) { Session.SendMessage(new BroadcastMessageAlertComposer("Oeps! Er is een onbekende fout opgetreden bij het ")); return; } QuasarEnvironment.GetGame().GetQuestManager().ProgressUserQuest(Session, QuestType.PROFILE_CHANGE_LOOK); Session.GetHabbo().Look = QuasarEnvironment.FilterFigure(Look); Session.GetHabbo().Gender = Gender.ToLower(); using (IQueryAdapter dbClient = QuasarEnvironment.GetDatabaseManager().GetQueryReactor()) { dbClient.SetQuery("UPDATE users SET look = @look, gender = @gender WHERE `id` = '" + Session.GetHabbo().Id + "' LIMIT 1"); dbClient.AddParameter("look", Look); dbClient.AddParameter("gender", Gender); dbClient.RunQuery(); } QuasarEnvironment.GetGame().GetAchievementManager().ProgressAchievement(Session, "ACH_AvatarLooks", 1); Session.SendMessage(new AvatarAspectUpdateMessageComposer(Look, Gender)); //esto if (Session.GetHabbo().Look.Contains("ha-1006")) { QuasarEnvironment.GetGame().GetQuestManager().ProgressUserQuest(Session, QuestType.WEAR_HAT); } if (Session.GetHabbo().InRoom) { RoomUser RoomUser = Session.GetHabbo().CurrentRoom.GetRoomUserManager().GetRoomUserByHabbo(Session.GetHabbo().Id); if (RoomUser != null) { Session.SendMessage(new UserChangeComposer(RoomUser, true)); Session.GetHabbo().CurrentRoom.SendMessage(new UserChangeComposer(RoomUser, false)); } } }
public void Parse(HabboHotel.GameClients.GameClient Session, ClientPacket Packet) { if (!Session.GetHabbo().InRoom) { return; } Room Room; if (!QuasarEnvironment.GetGame().GetRoomManager().TryGetRoom(Session.GetHabbo().CurrentRoomId, out Room)) { return; } RoomUser User = Room.GetRoomUserManager().GetRoomUserByHabbo(Session.GetHabbo().Id); if (User == null) { return; } int PetId = Packet.PopInt(); bool Type = Packet.PopBoolean(); RoomUser Pet = null; if (!Room.GetRoomUserManager().TryGetPet(PetId, out Pet)) { return; } if (Pet.PetData == null) { return; } if (Pet.PetData.AnyoneCanRide == 0 && Pet.PetData.OwnerId != User.UserId) { Session.SendNotification( "Oeps! Je kunt niet op dit paard rijden.\nDe eigenaar wilt liever niet dat andere op het paard rijdt."); return; } if (Type) { if (Pet.RidingHorse) { string[] Speech2 = QuasarEnvironment.GetGame().GetChatManager().GetPetLocale().GetValue("pet.alreadymounted"); var RandomSpeech2 = new Random(); Pet.Chat(Speech2[RandomSpeech2.Next(0, Speech2.Length - 1)], false); } else if (User.RidingHorse) { Session.SendNotification("Oeps! Je zit al op een paard."); } else { if (Pet.Statusses.Count > 0) { Pet.Statusses.Clear(); } int NewX2 = User.X; int NewY2 = User.Y; Room.SendMessage(Room.GetRoomItemHandler().UpdateUserOnRoller(Pet, new Point(NewX2, NewY2), 0, Room.GetGameMap().SqAbsoluteHeight(NewX2, NewY2))); Room.SendMessage(Room.GetRoomItemHandler().UpdateUserOnRoller(User, new Point(NewX2, NewY2), 0, Room.GetGameMap().SqAbsoluteHeight(NewX2, NewY2) + 1)); User.MoveTo(NewX2, NewY2); Pet.ClearMovement(true); User.RidingHorse = true; Pet.RidingHorse = true; Pet.HorseID = User.VirtualId; User.HorseID = Pet.VirtualId; User.ApplyEffect(77); User.RotBody = Pet.RotBody; User.RotHead = Pet.RotHead; User.UpdateNeeded = true; Pet.UpdateNeeded = true; } } else { if (User.VirtualId == Pet.HorseID) { Pet.Statusses.Remove("sit"); Pet.Statusses.Remove("lay"); Pet.Statusses.Remove("snf"); Pet.Statusses.Remove("eat"); Pet.Statusses.Remove("ded"); Pet.Statusses.Remove("jmp"); User.RidingHorse = false; User.HorseID = 0; Pet.RidingHorse = false; Pet.HorseID = 0; User.MoveTo(new Point(User.X + 2, User.Y + 2)); User.ApplyEffect(-1); User.UpdateNeeded = true; Pet.UpdateNeeded = true; } else { Session.SendNotification("Oeps! Je kunt niet van dit paard afstappen omdat je er niet op aan het rijden bent."); } } Room.SendMessage(new PetHorseFigureInformationComposer(Pet)); }
public void Parse(GameClient Session, ClientPacket Packet) { string CampaignName = Packet.PopString(); int CampaignDay = Packet.PopInt(); // INDEX VALUE. // Si no es el nombre de campaña actual. if (CampaignName != QuasarEnvironment.GetGame().GetCalendarManager().GetCampaignName()) { return; } // Si es un día inválido. if (CampaignDay < 0 || CampaignDay > QuasarEnvironment.GetGame().GetCalendarManager().GetTotalDays() - 1 || CampaignDay < QuasarEnvironment.GetGame().GetCalendarManager().GetUnlockDays()) { // Mini fix return; } // Días próximos if (CampaignDay > QuasarEnvironment.GetGame().GetCalendarManager().GetUnlockDays()) { return; } // Esta recompensa ya ha sido recogida. if (Session.GetHabbo().calendarGift[CampaignDay]) { return; } Session.GetHabbo().calendarGift[CampaignDay] = true; // PACKET PARA ACTUALIZAR? Session.SendMessage(new CalendarPrizesComposer(QuasarEnvironment.GetGame().GetCalendarManager().GetCampaignDay(CampaignDay + 1))); Session.SendMessage(new CampaignCalendarDataComposer(Session.GetHabbo().calendarGift)); string Gift = QuasarEnvironment.GetGame().GetCalendarManager().GetGiftByDay(CampaignDay + 1); string GiftType = Gift.Split(':')[0]; string GiftValue = Gift.Split(':')[1]; switch (GiftType.ToLower()) { case "itemid": { ItemData Item = null; if (!QuasarEnvironment.GetGame().GetItemManager().GetItem(int.Parse(GiftValue), out Item)) { // No existe este ItemId. return; } Item GiveItem = ItemFactory.CreateSingleItemNullable(Item, Session.GetHabbo(), "", ""); if (GiveItem != null) { Session.GetHabbo().GetInventoryComponent().TryAddItem(GiveItem); Session.SendMessage(new FurniListNotificationComposer(GiveItem.Id, 1)); Session.SendMessage(new FurniListUpdateComposer()); Session.SendNotification("Hoera! Je hebt een item ontvangen! (Open je inventaris)."); QuasarEnvironment.GetGame().GetAchievementManager().ProgressAchievement(Session, "ACH_Kalender", 1); } Session.GetHabbo().GetInventoryComponent().UpdateItems(false); } break; case "badge": { Session.GetHabbo().GetBadgeComponent().GiveBadge(GiftValue, true, Session); Session.SendNotification("Hoera! Je hebt een Badge ontvangen!"); QuasarEnvironment.GetGame().GetAchievementManager().ProgressAchievement(Session, "ACH_Kalender", 1); } break; case "diamonds": { Session.GetHabbo().Diamonds += int.Parse(GiftValue); Session.SendMessage(new HabboActivityPointNotificationComposer(Session.GetHabbo().Diamonds, 0, 5)); Session.SendNotification("Hoera! Je hebt " + GiftValue + " Diamanten ontvangen!"); QuasarEnvironment.GetGame().GetAchievementManager().ProgressAchievement(Session, "ACH_Kalender", 1); } break; case "gotwpoints": { Session.GetHabbo().GOTWPoints += int.Parse(GiftValue); Session.SendMessage(new HabboActivityPointNotificationComposer(Session.GetHabbo().GOTWPoints, 0, 103)); Session.SendNotification("Hoera! Je hebt " + GiftValue + " punten ontvangen!"); QuasarEnvironment.GetGame().GetAchievementManager().ProgressAchievement(Session, "ACH_Kalender", 1); } break; } using (IQueryAdapter dbClient = QuasarEnvironment.GetDatabaseManager().GetQueryReactor()) { dbClient.runFastQuery("INSERT INTO user_campaign_gifts VALUES (NULL, '" + Session.GetHabbo().Id + "','" + CampaignName + "','" + (CampaignDay + 1) + "')"); } }
public GameClient GetClient() { return(QuasarEnvironment.GetGame().GetClientManager().GetClientByUserID(UserId)); }
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 Parse(HabboHotel.GameClients.GameClient Session, ClientPacket Packet) { if (!Session.GetHabbo().InRoom) { return; } Room Room = null; if (!QuasarEnvironment.GetGame().GetRoomManager().TryGetRoom(Session.GetHabbo().CurrentRoomId, out Room)) { return; } if ((Room.AllowPets == 0 && !Room.CheckRights(Session, true)) || !Room.CheckRights(Session, true)) { Session.SendMessage(new RoomErrorNotifComposer(1)); return; } if (Room.GetRoomUserManager().PetCount > QuasarStaticGameSettings.RoomPetPlacementLimit) { Session.SendMessage(new RoomErrorNotifComposer(2));//5 = I have too many. return; } Pet Pet = null; if (!Session.GetHabbo().GetInventoryComponent().TryGetPet(Packet.PopInt(), out Pet)) { return; } if (Pet == null) { return; } if (Pet.PlacedInRoom) { Session.SendNotification("Oeps! Er is wat mis gegaan, de huisdier is al in de kamer."); return; } int X = Packet.PopInt(); int Y = Packet.PopInt(); if (!Room.GetGameMap().CanWalk(X, Y, false)) { Session.SendMessage(new RoomErrorNotifComposer(4)); return; } RoomUser OldPet = null; if (Room.GetRoomUserManager().TryGetPet(Pet.PetId, out OldPet)) { Room.GetRoomUserManager().RemoveBot(OldPet.VirtualId, false); } Pet.X = X; Pet.Y = Y; Pet.PlacedInRoom = true; Pet.RoomId = Room.RoomId; List <RandomSpeech> RndSpeechList = new List <RandomSpeech>(); RoomBot RoomBot = new RoomBot(Pet.PetId, Pet.RoomId, "pet", "freeroam", Pet.Name, "", Pet.Look, X, Y, 0, 0, 0, 0, 0, 0, ref RndSpeechList, "", 0, Pet.OwnerId, false, 0, false, 0); if (RoomBot == null) { return; } Room.GetRoomUserManager().DeployBot(RoomBot, Pet); Pet.DBState = DatabaseUpdateState.NeedsUpdate; Room.GetRoomUserManager().UpdatePets(); Pet ToRemove = null; if (!Session.GetHabbo().GetInventoryComponent().TryRemovePet(Pet.PetId, out ToRemove)) { string CurrentTime = DateTime.Now.ToString("HH:mm:ss" + " | "); Console.WriteLine(CurrentTime + "Fout bij het verwijderen van huisdier: " + ToRemove.PetId); return; } Session.SendMessage(new PetInventoryComposer(Session.GetHabbo().GetInventoryComponent().GetPets())); }
public void Parse(HabboHotel.GameClients.GameClient Session, ClientPacket Packet) { if (Session == null || Session.GetHabbo() == null || !Session.GetHabbo().InRoom || Session.GetHabbo().GetStats() == null || Session.GetHabbo().GetStats().DailyPetRespectPoints == 0) { return; } Room Room; if (!QuasarEnvironment.GetGame().GetRoomManager().TryGetRoom(Session.GetHabbo().CurrentRoomId, out Room)) { return; } RoomUser ThisUser = Room.GetRoomUserManager().GetRoomUserByHabbo(Session.GetHabbo().Id); if (ThisUser == null) { return; } int PetId = Packet.PopInt(); RoomUser Pet = null; if (!Session.GetHabbo().CurrentRoom.GetRoomUserManager().TryGetPet(PetId, out Pet)) { //Okay so, we've established we have no pets in this room by this virtual Id, let us check out users, maybe they're creeping as a pet?! RoomUser TargetUser = Session.GetHabbo().CurrentRoom.GetRoomUserManager().GetRoomUserByHabbo(PetId); if (TargetUser == null) { return; } //Check some values first, please! if (TargetUser.GetClient() == null || TargetUser.GetClient().GetHabbo() == null) { return; } if (TargetUser.GetClient().GetHabbo().Id == Session.GetHabbo().Id) { Session.SendWhisper("Oeps! Je kan dit niet op jezelf gebruiken - Je bent een punt kwijt maar geen probleem, relog en ze worden weer aangevuld."); return; } //And boom! Let us send some respect points. QuasarEnvironment.GetGame().GetQuestManager().ProgressUserQuest(Session, QuestType.SOCIAL_RESPECT); QuasarEnvironment.GetGame().GetAchievementManager().ProgressAchievement(Session, "ACH_RespectGiven", 1); QuasarEnvironment.GetGame().GetAchievementManager().ProgressAchievement(TargetUser.GetClient(), "ACH_RespectEarned", 1); //Take away from pet respect points, just in-case users abuse this.. Session.GetHabbo().GetStats().DailyPetRespectPoints -= 1; Session.GetHabbo().GetStats().RespectGiven += 1; TargetUser.GetClient().GetHabbo().GetStats().Respect += 1; //Apply the effect. ThisUser.CarryItemID = 999999999; ThisUser.CarryTimer = 5; //Send the magic out. if (Room.RespectNotificationsEnabled) { Room.SendMessage(new RespectPetNotificationMessageComposer(TargetUser.GetClient().GetHabbo(), TargetUser)); } Room.SendMessage(new CarryObjectComposer(ThisUser.VirtualId, ThisUser.CarryItemID)); return; } if (Pet == null || Pet.PetData == null || Pet.RoomId != Session.GetHabbo().CurrentRoomId) { return; } Session.GetHabbo().GetStats().DailyPetRespectPoints -= 1; QuasarEnvironment.GetGame().GetAchievementManager().ProgressAchievement(Session, "ACH_PetRespectGiver", 1, false); ThisUser.CarryItemID = 999999999; ThisUser.CarryTimer = 5; Pet.PetData.OnRespect(); Room.SendMessage(new CarryObjectComposer(ThisUser.VirtualId, ThisUser.CarryItemID)); }
public void Execute(GameClient Session, Room Room, string[] Params) { if (Params.Length == 1) { Session.SendWhisper("Je bent vergeten een naam te noemen!"); return; } if (!Room.PushEnabled && !Session.GetHabbo().GetPermissions().HasRight("room_override_custom_config")) { Session.SendWhisper("Oeps, de kamer eigenaar heeft deze command uitgezet voor de kamer."); return; } var TargetClient = QuasarEnvironment.GetGame().GetClientManager().GetClientByUsername(Params[1]); if (TargetClient == null) { Session.SendWhisper( "De speler kon niet worden gevonden. Waarschijnlijk offline of niet in de kamer aanwezig."); return; } var TargetUser = Room.GetRoomUserManager().GetRoomUserByHabbo(TargetClient.GetHabbo().Id); if (TargetUser == null) { Session.SendWhisper( "De speler kon niet worden gevonden. Waarschijnlijk offline of niet in de kamer aanwezig."); return; } if (TargetClient.GetHabbo().Username == Session.GetHabbo().Username) { Session.SendWhisper("Je kan deze command niet op jezelf gebruiken."); return; } if (TargetUser.TeleportEnabled) { Session.SendWhisper("Oeps, deze gebruiker heeft teleporter aan."); return; } var ThisUser = Room.GetRoomUserManager().GetRoomUserByHabbo(Session.GetHabbo().Id); if (ThisUser == null) { return; } if (!((Math.Abs(TargetUser.X - ThisUser.X) >= 2) || (Math.Abs(TargetUser.Y - ThisUser.Y) >= 2))) { if (TargetUser.SetX - 1 == Room.GetGameMap().Model.DoorX) { Session.SendWhisper("Come on man! Je gaat toch niet iemand uit de kamer gooien :(!"); return; } if (TargetUser.RotBody == 4) { TargetUser.MoveTo(TargetUser.X, TargetUser.Y + 1); } if (ThisUser.RotBody == 0) { TargetUser.MoveTo(TargetUser.X, TargetUser.Y - 1); } if (ThisUser.RotBody == 6) { TargetUser.MoveTo(TargetUser.X - 1, TargetUser.Y); } if (ThisUser.RotBody == 2) { TargetUser.MoveTo(TargetUser.X + 1, TargetUser.Y); } if (ThisUser.RotBody == 3) { TargetUser.MoveTo(TargetUser.X + 1, TargetUser.Y); TargetUser.MoveTo(TargetUser.X, TargetUser.Y + 1); } if (ThisUser.RotBody == 1) { TargetUser.MoveTo(TargetUser.X + 1, TargetUser.Y); TargetUser.MoveTo(TargetUser.X, TargetUser.Y - 1); } if (ThisUser.RotBody == 7) { TargetUser.MoveTo(TargetUser.X - 1, TargetUser.Y); TargetUser.MoveTo(TargetUser.X, TargetUser.Y - 1); } if (ThisUser.RotBody == 5) { TargetUser.MoveTo(TargetUser.X - 1, TargetUser.Y); TargetUser.MoveTo(TargetUser.X, TargetUser.Y + 1); } Room.SendMessage(new ChatComposer(ThisUser.VirtualId, "*Duwt " + Params[1] + " van zich af*", 0, ThisUser.LastBubble)); } else { Session.SendWhisper("Oeps, " + Params[1] + " is te ver weg!"); } }
public void Parse(GameClient Session, ClientPacket Packet) { if (Session == null || Session.GetHabbo() == null || !Session.GetHabbo().InRoom) { return; } Room Room = Session.GetHabbo().CurrentRoom; if (Room == null) { return; } RoomUser User = Room.GetRoomUserManager().GetRoomUserByHabbo(Session.GetHabbo().Id); if (User == null) { return; } string Message = StringCharFilter.Escape(Packet.PopString()); if (Message.Length > 100) { Message = Message.Substring(0, 100); } int Colour = Packet.PopInt(); ChatStyle Style = null; if (!QuasarEnvironment.GetGame().GetChatManager().GetChatStyles().TryGetStyle(Colour, out Style) || (Style.RequiredRight.Length > 0 && !Session.GetHabbo().GetPermissions().HasRight(Style.RequiredRight))) { Colour = 0; } User.UnIdle(); if (QuasarEnvironment.GetUnixTimestamp() < Session.GetHabbo().FloodTime&& Session.GetHabbo().FloodTime != 0) { return; } if (Session.GetHabbo().TimeMuted > 0) { Session.SendMessage(new MutedComposer(Session.GetHabbo().TimeMuted)); return; } if (!Session.GetHabbo().GetPermissions().HasRight("room_ignore_mute") && Room.CheckMute(Session)) { Session.SendMessage(new RoomCustomizedAlertComposer("Deze kamer heeft een spraakverbod.")); return; } User.LastBubble = Session.GetHabbo().CustomBubbleId == 0 ? Colour : Session.GetHabbo().CustomBubbleId; if (Room.GetWired().TriggerEvent(HabboHotel.Items.Wired.WiredBoxType.TriggerUserSays, Session.GetHabbo(), Message)) { return; } else if (!Session.GetHabbo().GetPermissions().HasRight("mod_tool")) { int MuteTime; if (User.IncrementAndCheckFlood(out MuteTime)) { Session.SendMessage(new FloodControlComposer(MuteTime)); return; } } if (Message.StartsWith(":", StringComparison.CurrentCulture)) { QuasarEnvironment.GetGame().GetAchievementManager().ProgressAchievement(Session, "ACH_ExploreCommand", 1); } if (Message.StartsWith(":", StringComparison.CurrentCulture) && QuasarEnvironment.GetGame().GetChatManager().GetCommands().Parse(Session, Message)) { return; } QuasarEnvironment.GetGame().GetChatManager().GetLogs().StoreChatlog(new ChatlogEntry(Session.GetHabbo().Id, Room.Id, Message, UnixTimestamp.GetNow(), Session.GetHabbo(), Room)); string word; if (!Session.GetHabbo().GetPermissions().HasRight("word_filter_override") && QuasarEnvironment.GetGame().GetChatManager().GetFilter().IsUnnaceptableWord(Message, out word)) { Session.SendMessage(new RoomCustomizedAlertComposer("Het woord '" + word + "' is verboden.")); QuasarEnvironment.GetGame().GetClientManager().StaffAlert(RoomNotificationComposer.SendBubble("bubble_filter", "Filter bericht\n\nHabbis: " + Session.GetHabbo().Username + "\nWoord: " + word + "\nType: Chat (kamer)", "")); return; } QuasarEnvironment.GetGame().GetQuestManager().ProgressUserQuest(Session, QuestType.SOCIAL_CHAT); User.OnChat(User.LastBubble, Message, false); if (Message.Length > 20) { QuasarEnvironment.GetGame().GetAchievementManager().ProgressAchievement(Session, "ACH_ChatSpeeches", 1); } }
public void Parse(HabboHotel.GameClients.GameClient Session, ClientPacket Packet) { int QuestId = Packet.PopInt(); QuasarEnvironment.GetGame().GetQuestManager().ActivateQuest(Session, QuestId); }
public void Parse(HabboHotel.GameClients.GameClient Session, ClientPacket Packet) { if (Session.GetHabbo().Credits < QuasarStaticGameSettings.GroupPurchaseAmount) { Session.SendMessage(new BroadcastMessageAlertComposer("Oeps! De groep kost " + QuasarStaticGameSettings.GroupPurchaseAmount + " credits! Jij hebt helaas maar " + Session.GetHabbo().Credits + " credits!")); return; } else { Session.GetHabbo().Credits -= QuasarStaticGameSettings.GroupPurchaseAmount; Session.SendMessage(new CreditBalanceComposer(Session.GetHabbo().Credits)); } string word; string Name = Packet.PopString(); Name = QuasarEnvironment.GetGame().GetChatManager().GetFilter().IsUnnaceptableWord(Name, out word) ? "Spam" : Name; string Description = Packet.PopString(); Description = QuasarEnvironment.GetGame().GetChatManager().GetFilter().IsUnnaceptableWord(Description, out word) ? "Spam" : Description; int RoomId = Packet.PopInt(); int Colour1 = Packet.PopInt(); int Colour2 = Packet.PopInt(); int groupID3 = Packet.PopInt(); int groupID4 = Packet.PopInt(); int groupID5 = Packet.PopInt(); int groupID6 = Packet.PopInt(); int groupID7 = Packet.PopInt(); int groupID8 = Packet.PopInt(); int groupID9 = Packet.PopInt(); int groupID10 = Packet.PopInt(); int groupID11 = Packet.PopInt(); int groupID12 = Packet.PopInt(); int groupID13 = Packet.PopInt(); int groupID14 = Packet.PopInt(); int groupID15 = Packet.PopInt(); int groupID16 = Packet.PopInt(); int groupID17 = Packet.PopInt(); int groupID18 = Packet.PopInt(); RoomData Room = QuasarEnvironment.GetGame().GetRoomManager().GenerateRoomData(RoomId); if (Room == null || Room.OwnerId != Session.GetHabbo().Id || Room.Group != null) { return; } string Base = "b" + ((groupID4 < 10) ? "0" + groupID4.ToString() : groupID4.ToString()) + ((groupID5 < 10) ? "0" + groupID5.ToString() : groupID5.ToString()) + groupID6; string Symbol1 = "s" + ((groupID7 < 10) ? "0" + groupID7.ToString() : groupID7.ToString()) + ((groupID8 < 10) ? "0" + groupID8.ToString() : groupID8.ToString()) + groupID9; string Symbol2 = "s" + ((groupID10 < 10) ? "0" + groupID10.ToString() : groupID10.ToString()) + ((groupID11 < 10) ? "0" + groupID11.ToString() : groupID11.ToString()) + groupID12; string Symbol3 = "s" + ((groupID13 < 10) ? "0" + groupID13.ToString() : groupID13.ToString()) + ((groupID14 < 10) ? "0" + groupID14.ToString() : groupID14.ToString()) + groupID15; string Symbol4 = "s" + ((groupID16 < 10) ? "0" + groupID16.ToString() : groupID16.ToString()) + ((groupID17 < 10) ? "0" + groupID17.ToString() : groupID17.ToString()) + groupID18; Symbol1 = QuasarEnvironment.GetGame().GetGroupManager().CheckActiveSymbol(Symbol1); Symbol2 = QuasarEnvironment.GetGame().GetGroupManager().CheckActiveSymbol(Symbol2); Symbol3 = QuasarEnvironment.GetGame().GetGroupManager().CheckActiveSymbol(Symbol3); Symbol4 = QuasarEnvironment.GetGame().GetGroupManager().CheckActiveSymbol(Symbol4); string Badge = Base + Symbol1 + Symbol2 + Symbol3 + Symbol4; Group Group = null; if (!QuasarEnvironment.GetGame().GetGroupManager().TryCreateGroup(Session.GetHabbo(), Name, Description, RoomId, Badge, Colour1, Colour2, out Group)) { Session.SendNotification("Oeps! Je groep kon niet worden aangemaakt. Meld dit even bij een medewerker."); return; } Session.SendMessage(new PurchaseOKComposer()); Room.Group = Group; if (Session.GetHabbo().CurrentRoomId != Room.Id) { Session.SendMessage(new RoomForwardComposer(Room.Id)); } Session.SendMessage(new NewGroupInfoComposer(RoomId, Group.Id)); QuasarEnvironment.GetGame().GetAchievementManager().ProgressAchievement(Session, "ACH_ExploreMakeGroup", 1); }
public void LoadFurniture() { if (this._floorItems.Count > 0) { this._floorItems.Clear(); } if (this._wallItems.Count > 0) { this._wallItems.Clear(); } List <Item> Items = ItemLoader.GetItemsForRoom(this._room.Id, this._room); foreach (Item Item in Items.ToList()) { if (Item == null) { continue; } if (Item.UserID == 0) { using (IQueryAdapter dbClient = QuasarEnvironment.GetDatabaseManager().GetQueryReactor()) { dbClient.SetQuery("UPDATE `items` SET `user_id` = @UserId WHERE `id` = @ItemId LIMIT 1"); dbClient.AddParameter("ItemId", Item.UserID); dbClient.AddParameter("UserId", this._room.OwnerId); dbClient.RunQuery(); } } if (Item.IsFloorItem) { if (!_room.GetGameMap().ValidTile(Item.GetX, Item.GetY)) { using (IQueryAdapter dbClient = QuasarEnvironment.GetDatabaseManager().GetQueryReactor()) { dbClient.RunQuery("UPDATE `items` SET `room_id` = '0' WHERE `id` = '" + Item.Id + "' LIMIT 1"); } GameClient Client = QuasarEnvironment.GetGame().GetClientManager().GetClientByUserID(Item.UserID); if (Client != null) { Client.GetHabbo().GetInventoryComponent().AddNewItem(Item.Id, Item.BaseItem, Item.ExtraData, Item.GroupId, true, true, Item.LimitedNo, Item.LimitedTot); Client.GetHabbo().GetInventoryComponent().UpdateItems(false); } continue; } if (!this._floorItems.ContainsKey(Item.Id)) { this._floorItems.TryAdd(Item.Id, Item); } } else if (Item.IsWallItem) { if (string.IsNullOrWhiteSpace(Item.wallCoord)) { using (IQueryAdapter dbClient = QuasarEnvironment.GetDatabaseManager().GetQueryReactor()) { dbClient.SetQuery("UPDATE `items` SET `wall_pos` = @WallPosition WHERE `id` = '" + Item.Id + "' LIMIT 1"); dbClient.AddParameter("WallPosition", ":w=0,2 l=11,53 l"); dbClient.RunQuery(); } Item.wallCoord = ":w=0,2 l=11,53 l"; } try { Item.wallCoord = WallPositionCheck(":" + Item.wallCoord.Split(':')[1]); } catch { using (IQueryAdapter dbClient = QuasarEnvironment.GetDatabaseManager().GetQueryReactor()) { dbClient.SetQuery("UPDATE `items` SET `wall_pos` = @WallPosition WHERE `id` = '" + Item.Id + "' LIMIT 1"); dbClient.AddParameter("WallPosition", ":w=0,2 l=11,53 l"); dbClient.RunQuery(); } Item.wallCoord = ":w=0,2 l=11,53 l"; } if (!this._wallItems.ContainsKey(Item.Id)) { this._wallItems.TryAdd(Item.Id, Item); } } } foreach (Item Item in _floorItems.Values.ToList()) { if (Item.IsRoller) { mGotRollers = true; } else if (Item.GetBaseItem().InteractionType == InteractionType.MOODLIGHT) { if (_room.MoodlightData == null) { _room.MoodlightData = new MoodlightData(Item.Id); } } else if (Item.GetBaseItem().InteractionType == InteractionType.TONER) { if (_room.TonerData == null) { _room.TonerData = new TonerData(Item.Id); } } else if (Item.IsWired) { if (_room == null) { continue; } if (_room.GetWired() == null) { continue; } _room.GetWired().LoadWiredBox(Item); } else if (Item.GetBaseItem().InteractionType == InteractionType.HOPPER) { HopperCount++; } } }
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 voeren."); return; } DataRow UserData = null; DataRow UserInfo = null; string Username = Params[1]; using (IQueryAdapter dbClient = QuasarEnvironment.GetDatabaseManager().GetQueryReactor()) { dbClient.SetQuery("SELECT `id`,`username`,`mail`,`rank`,`motto`,`credits`,`activity_points`,`vip_points`,`gotw_points`,`online`,`rank_vip` FROM users WHERE `username` = @Username LIMIT 1"); dbClient.AddParameter("Username", Username); UserData = dbClient.getRow(); } using (IQueryAdapter dbClient = QuasarEnvironment.GetDatabaseManager().GetQueryReactor()) { dbClient.SetQuery("SELECT `id`,`username`,`mail`,`rank`,`motto`,`credits`,`activity_points`,`vip_points`,`gotw_points`,`online`,`rank_vip` FROM users WHERE `username` = @Username LIMIT 1"); dbClient.AddParameter("Username", Username); UserData = dbClient.getRow(); } if (UserData == null) { Session.SendNotification("Oeps! De gebruiker " + Username + " bestaat niet!"); return; } using (IQueryAdapter dbClient = QuasarEnvironment.GetDatabaseManager().GetQueryReactor()) { dbClient.SetQuery("SELECT * FROM `user_info` WHERE `user_id` = '" + Convert.ToInt32(UserData["id"]) + "' LIMIT 1"); UserInfo = dbClient.getRow(); if (UserInfo == null) { dbClient.RunQuery("INSERT INTO `user_info` (`user_id`) VALUES ('" + Convert.ToInt32(UserData["id"]) + "')"); dbClient.SetQuery("SELECT * FROM `user_info` WHERE `user_id` = '" + Convert.ToInt32(UserData["id"]) + "' LIMIT 1"); UserInfo = dbClient.getRow(); } } GameClient TargetClient = QuasarEnvironment.GetGame().GetClientManager().GetClientByUsername(Username); DateTime origin = new DateTime(1970, 1, 1, 0, 0, 0, 0).AddSeconds(Convert.ToDouble(UserInfo["trading_locked"])); StringBuilder HabboInfo = new StringBuilder(); HabboInfo.Append("<b>Algemene Informatie</b>\r"); HabboInfo.Append("Naam: " + Convert.ToString(UserData["username"]) + " (" + Convert.ToInt32(UserData["id"]) + ")\r"); HabboInfo.Append("Rank: " + Convert.ToInt32(UserData["rank"]) + "\r"); HabboInfo.Append("Premium rank: " + Convert.ToInt32(UserData["rank_vip"]) + "\r"); HabboInfo.Append("Email: " + Convert.ToString(UserData["mail"]) + "\r"); HabboInfo.Append("Status: " + (TargetClient != null ? "Online" : "Offline") + "\r\r"); HabboInfo.Append("<b>Wisselkoers Informatie</b>\r"); HabboInfo.Append("Credits: " + Convert.ToInt32(UserData["credits"]) + "\r"); HabboInfo.Append("Duckets: " + Convert.ToInt32(UserData["activity_points"]) + "\r"); HabboInfo.Append("Diamanten: " + Convert.ToInt32(UserData["vip_points"]) + "\r\r"); HabboInfo.Append("<b>Moderator Informatie</b>\r"); HabboInfo.Append("Bans: " + Convert.ToInt32(UserInfo["bans"]) + "\r"); HabboInfo.Append("Tickets aangemaakt: " + Convert.ToInt32(UserInfo["cfhs"]) + "\r"); HabboInfo.Append("Tickets misbruik: " + Convert.ToInt32(UserInfo["cfhs_abusive"]) + "\r"); HabboInfo.Append("Ruil blokkering: " + (Convert.ToInt32(UserInfo["trading_locked"]) == 0 ? "Nee" : "Ja [" + (origin.ToString("dd/MM/yyyy")) + "]") + "\r\r"); if (TargetClient != null) { HabboInfo.Append("<b>Kamer Informatie</b>\r"); if (!TargetClient.GetHabbo().InRoom) { HabboInfo.Append(Convert.ToString(UserData["username"]) + "is niet in een kamer.\r"); } else { HabboInfo.Append("Kamer naam: " + TargetClient.GetHabbo().CurrentRoom.Name + " (" + TargetClient.GetHabbo().CurrentRoom.RoomId + ")\r"); HabboInfo.Append("Kamer eigenaar: " + TargetClient.GetHabbo().CurrentRoom.OwnerName + "\r"); HabboInfo.Append("Kamer populatie: " + TargetClient.GetHabbo().CurrentRoom.UserCount + "/" + TargetClient.GetHabbo().CurrentRoom.UsersMax); } } Session.SendNotification(HabboInfo.ToString()); }
public GroupInfoComposer(Group Group, GameClient Session, bool NewWindow = false) : base(ServerPacketHeader.GroupInfoMessageComposer) { DateTime Origin = new DateTime(1970, 1, 1, 0, 0, 0, 0).AddSeconds(Group.CreateTime); base.WriteInteger(Group.Id); base.WriteBoolean(true); base.WriteInteger(Group.GroupType == GroupType.OPEN ? 0 : Group.GroupType == GroupType.LOCKED ? 1 : 2); base.WriteString(Group.Name); base.WriteString(Group.Description); base.WriteString(Group.Badge); base.WriteInteger(Group.RoomId); base.WriteString((QuasarEnvironment.GetGame().GetRoomManager().GenerateRoomData(Group.RoomId) == null) ? "Oeps! Geen kamer gevonden.." : QuasarEnvironment.GetGame().GetRoomManager().GenerateRoomData(Group.RoomId).Name); // room name base.WriteInteger(Group.CreatorId == Session.GetHabbo().Id ? 3 : Group.HasRequest(Session.GetHabbo().Id) ? 2 : Group.IsMember(Session.GetHabbo().Id) ? 1 : 0); base.WriteInteger(Group.MemberCount); // Members base.WriteBoolean(false); //?? CHANGED base.WriteString(Origin.Day + "-" + Origin.Month + "-" + Origin.Year); base.WriteBoolean(Group.CreatorId == Session.GetHabbo().Id); base.WriteBoolean(Group.IsAdmin(Session.GetHabbo().Id)); // admin base.WriteString(QuasarEnvironment.GetUsernameById(Group.CreatorId)); base.WriteBoolean(NewWindow); // Show group info base.WriteBoolean(Group.AdminOnlyDeco == 0); // Any user can place furni in home room base.WriteInteger(Group.CreatorId == Session.GetHabbo().Id ? Group.RequestCount : Group.IsAdmin(Session.GetHabbo().Id) ? Group.RequestCount : Group.IsMember(Session.GetHabbo().Id) ? 0 : 0); // Pending users //base.WriteInteger(0);//what the f**k base.WriteBoolean(Group != null ? Group.ForumEnabled : true); //HabboTalk. }
public GroupFurniConfigComposer(ICollection <Group> Groups) : base(ServerPacketHeader.GroupFurniConfigMessageComposer) { base.WriteInteger(Groups.Count); foreach (Group Group in Groups) { base.WriteInteger(Group.Id); base.WriteString(Group.Name); base.WriteString(Group.Badge); base.WriteString((QuasarEnvironment.GetGame().GetGroupManager().SymbolColours.ContainsKey(Group.Colour1)) ? QuasarEnvironment.GetGame().GetGroupManager().SymbolColours[Group.Colour1].Colour : "4f8a00"); // Group Colour 1 base.WriteString((QuasarEnvironment.GetGame().GetGroupManager().BackGroundColours.ContainsKey(Group.Colour2)) ? QuasarEnvironment.GetGame().GetGroupManager().BackGroundColours[Group.Colour2].Colour : "4f8a00"); // Group Colour 2 base.WriteBoolean(false); base.WriteInteger(Group.CreatorId); base.WriteBoolean(Group.ForumEnabled); } }
public void Parse(HabboHotel.GameClients.GameClient Session, ClientPacket Packet) { if (!Session.GetHabbo().InRoom) { return; } Room Room; if (!QuasarEnvironment.GetGame().GetRoomManager().TryGetRoom(Session.GetHabbo().CurrentRoomId, out Room)) { return; } int ItemId = Packet.PopInt(); Item Item = Room.GetRoomItemHandler().GetItem(ItemId); if (Item == null) { return; } int PetId = Packet.PopInt(); RoomUser PetUser = null; if (!Room.GetRoomUserManager().TryGetPet(PetId, out PetUser)) { return; } if (PetUser.PetData == null || PetUser.PetData.OwnerId != Session.GetHabbo().Id) { return; } if (Item.Data.InteractionType == InteractionType.HORSE_SADDLE_1) { PetUser.PetData.Saddle = 9; using (IQueryAdapter dbClient = QuasarEnvironment.GetDatabaseManager().GetQueryReactor()) { dbClient.RunQuery("UPDATE `bots_petdata` SET `have_saddle` = '9' WHERE `id` = '" + PetUser.PetData.PetId + "' LIMIT 1"); dbClient.RunQuery("DELETE FROM `items` WHERE `id` = '" + Item.Id + "' LIMIT 1"); } //We only want to use this if we're successful. Room.GetRoomItemHandler().RemoveFurniture(Session, Item.Id, false); } else if (Item.Data.InteractionType == InteractionType.HORSE_SADDLE_2) { PetUser.PetData.Saddle = 10; using (IQueryAdapter dbClient = QuasarEnvironment.GetDatabaseManager().GetQueryReactor()) { dbClient.RunQuery("UPDATE `bots_petdata` SET `have_saddle` = '10' WHERE `id` = '" + PetUser.PetData.PetId + "' LIMIT 1"); dbClient.RunQuery("DELETE FROM `items` WHERE `id` = '" + Item.Id + "' LIMIT 1"); } //We only want to use this if we're successful. Room.GetRoomItemHandler().RemoveFurniture(Session, Item.Id, false); } else if (Item.Data.InteractionType == InteractionType.HORSE_HAIRSTYLE) { int Parse = 100; string HairType = Item.GetBaseItem().ItemName.Split('_')[2]; Parse = Parse + int.Parse(HairType); PetUser.PetData.PetHair = Parse; using (IQueryAdapter dbClient = QuasarEnvironment.GetDatabaseManager().GetQueryReactor()) { dbClient.RunQuery("UPDATE `bots_petdata` SET `pethair` = '" + PetUser.PetData.PetHair + "' WHERE `id` = '" + PetUser.PetData.PetId + "' LIMIT 1"); dbClient.RunQuery("DELETE FROM `items` WHERE `id` = '" + Item.Id + "' LIMIT 1"); } //We only want to use this if we're successful. Room.GetRoomItemHandler().RemoveFurniture(Session, Item.Id, false); } else if (Item.Data.InteractionType == InteractionType.HORSE_HAIR_DYE) { int HairDye = 48; string HairType = Item.GetBaseItem().ItemName.Split('_')[2]; HairDye = HairDye + int.Parse(HairType); PetUser.PetData.HairDye = HairDye; using (IQueryAdapter dbClient = QuasarEnvironment.GetDatabaseManager().GetQueryReactor()) { dbClient.RunQuery("UPDATE `bots_petdata` SET `hairdye` = '" + PetUser.PetData.HairDye + "' WHERE `id` = '" + PetUser.PetData.PetId + "' LIMIT 1"); dbClient.RunQuery("DELETE FROM `items` WHERE `id` = '" + Item.Id + "' LIMIT 1"); } //We only want to use this if we're successful. Room.GetRoomItemHandler().RemoveFurniture(Session, Item.Id, false); } else if (Item.Data.InteractionType == InteractionType.HORSE_BODY_DYE) { string Race = Item.GetBaseItem().ItemName.Split('_')[2]; int Parse = int.Parse(Race); int RaceLast = 2 + (Parse * 4) - 4; if (Parse == 13) { RaceLast = 61; } else if (Parse == 14) { RaceLast = 65; } else if (Parse == 15) { RaceLast = 69; } else if (Parse == 16) { RaceLast = 73; } PetUser.PetData.Race = RaceLast.ToString(); using (IQueryAdapter dbClient = QuasarEnvironment.GetDatabaseManager().GetQueryReactor()) { dbClient.RunQuery("UPDATE `bots_petdata` SET `race` = '" + PetUser.PetData.Race + "' WHERE `id` = '" + PetUser.PetData.PetId + "' LIMIT 1"); dbClient.RunQuery("DELETE FROM `items` WHERE `id` = '" + Item.Id + "' LIMIT 1"); } //We only want to use this if we're successful. Room.GetRoomItemHandler().RemoveFurniture(Session, Item.Id, false); } //Update the Pet and the Pet figure information. Room.SendMessage(new UsersComposer(PetUser)); Room.SendMessage(new PetHorseFigureInformationComposer(PetUser)); }
public void Parse(HabboHotel.GameClients.GameClient Session, ClientPacket Packet) { if (Session == null || Session.GetHabbo() == null || !Session.GetHabbo().InRoom) { return; } Room Room; if (!QuasarEnvironment.GetGame().GetRoomManager().TryGetRoom(Session.GetHabbo().CurrentRoomId, out Room)) { return; } if (!Room.CanTradeInRoom) { return; } RoomUser User = Room.GetRoomUserManager().GetRoomUserByHabbo(Session.GetHabbo().Id); if (User == null) { return; } if (Session.GetHabbo().TradingLockExpiry > 0) { if (Session.GetHabbo().TradingLockExpiry > QuasarEnvironment.GetUnixTimestamp()) { Session.SendNotification("Oeps! Je kunt niet ruilen want je hebt een ruil blokkering."); return; } else { Session.GetHabbo().TradingLockExpiry = 0; Session.SendNotification("De ruilban is opgeheven, je kan weer ruilen!."); using (IQueryAdapter dbClient = QuasarEnvironment.GetDatabaseManager().GetQueryReactor()) { dbClient.RunQuery("UPDATE `user_info` SET `trading_locked` = '0' WHERE `id` = '" + Session.GetHabbo().Id + "' LIMIT 1"); } } } RoomUser TargetUser = Room.GetRoomUserManager().GetRoomUserByVirtualId(Packet.PopInt()); if (TargetUser == null || TargetUser.GetClient() == null || TargetUser.GetClient().GetHabbo() == null) { return; } if (TargetUser.IsTrading) { Session.SendMessage(new TradingErrorComposer(8, TargetUser.GetUsername())); return; } if (!Session.GetHabbo().GetPermissions().HasRight("room_trade_override")) { if (Room.TradeSettings == 1 && Room.OwnerId != Session.GetHabbo().Id)//Owner only. { Session.SendMessage(new TradingErrorComposer(6, TargetUser.GetUsername())); return; } else if (Room.TradeSettings == 0 && Room.OwnerId != Session.GetHabbo().Id)//Trading is disabled. { Session.SendMessage(new TradingErrorComposer(6, TargetUser.GetUsername())); return; } } if (TargetUser.GetClient().GetHabbo().TradingLockExpiry > 0) { Session.SendNotification("Oeps! Deze gebruiker heeft een verbod op ruilen!"); return; } Room.TryStartTrade(User, TargetUser); QuasarEnvironment.GetGame().GetAchievementManager().ProgressAchievement(Session, "ACH_ExploreTrade", 1); }
public static void WriteRoom(ServerPacket Packet, RoomData Data, RoomPromotion Promotion, bool NewNavigator = false) { Packet.WriteInteger(Data.Id); Packet.WriteString(Data.Name); Packet.WriteInteger(Data.OwnerId); Packet.WriteString(Data.OwnerName); Packet.WriteInteger(RoomAccessUtility.GetRoomAccessPacketNum(Data.Access)); Packet.WriteInteger(Data.UsersNow); Packet.WriteInteger(Data.UsersMax); Packet.WriteString(Data.Description); Packet.WriteInteger(Data.TradeSettings); Packet.WriteInteger(Data.Score); Packet.WriteInteger(0);//Top rated room rank. Packet.WriteInteger(Data.Category); Packet.WriteInteger(Data.Tags.Count); foreach (string tag in Data.Tags) { Packet.WriteString(tag); } int RoomType = 0; if (Data.Group != null) { RoomType += 2; } if (Data.Promotion != null) { RoomType += 4; } if (Data.Type == "private") { RoomType += 8; } if (Data.AllowPets == 1) { RoomType += 16; } FeaturedRoom Item = null; if (QuasarEnvironment.GetGame().GetNavigator().TryGetFeaturedRoom(Data.Id, out Item)) { RoomType += 1; } Packet.WriteInteger(RoomType); if (Item != null) { Packet.WriteString(Item.Image); } if (Data.Group != null) { Packet.WriteInteger(Data.Group == null ? 0 : Data.Group.Id); Packet.WriteString(Data.Group == null ? "" : Data.Group.Name); Packet.WriteString(Data.Group == null ? "" : Data.Group.Badge); } if (Data.Promotion != null) { Packet.WriteString(Promotion != null ? Promotion.Name : ""); Packet.WriteString(Promotion != null ? Promotion.Description : ""); Packet.WriteInteger(Promotion != null ? Promotion.MinutesLeft : 0); } }
public void Parse(HabboHotel.GameClients.GameClient Session, ClientPacket Packet) { int PageId = Packet.PopInt(); int ItemId = Packet.PopInt(); string Data = Packet.PopString(); string GiftUser = StringCharFilter.Escape(Packet.PopString()); string GiftMessage = StringCharFilter.Escape(Packet.PopString().Replace(Convert.ToChar(5), ' ')); int SpriteId = Packet.PopInt(); int Ribbon = Packet.PopInt(); int Colour = Packet.PopInt(); bool dnow = Packet.PopBoolean(); if (QuasarEnvironment.GetDBConfig().DBData["gifts_enabled"] != "1") { Session.SendNotification("Het sturen van cadeau's is tijdelijk uitgeschakeld door het Hotel Management."); return; } /*if (QuasarEnvironment.GetGame().GetCatalog().CatalogFlatOffers.ContainsKey(ItemId) && PageId < 0) * { * PageId = QuasarEnvironment.GetGame().GetCatalog().CatalogFlatOffers[ItemId]; * * CatalogPage P = null; * if (!QuasarEnvironment.GetGame().GetCatalog().Pages.TryGetValue(PageId, out P)) * PageId = 0; * }*/ CatalogPage Page = null; if (!QuasarEnvironment.GetGame().GetCatalog().TryGetPage(PageId, out Page)) { return; } if (!Page.Enabled || !Page.Visible || Page.MinimumRank > Session.GetHabbo().Rank) /*|| (Page.MinimumVIP > Session.GetHabbo().VIPRank && Session.GetHabbo().Rank == 1))*/ { return; } CatalogItem Item = null; if (!Page.Items.TryGetValue(ItemId, out Item)) { if (Page.ItemOffers.ContainsKey(ItemId)) { Item = (CatalogItem)Page.ItemOffers[ItemId]; if (Item == null) { return; } } else { return; } } if (!ItemUtility.CanGiftItem(Item)) { return; } ItemData PresentData = null; if (!QuasarEnvironment.GetGame().GetItemManager().GetGift(SpriteId, out PresentData) || PresentData.InteractionType != InteractionType.GIFT) { return; } if (Session.GetHabbo().Credits < Item.CostCredits) { Session.SendMessage(new PresentDeliverErrorMessageComposer(true, false)); return; } if (Session.GetHabbo().Duckets < Item.CostPixels) { Session.SendMessage(new PresentDeliverErrorMessageComposer(false, true)); return; } Habbo Habbo = QuasarEnvironment.GetHabboByUsername(GiftUser); if (Habbo == null) { Session.SendMessage(new GiftWrappingErrorComposer()); return; } if (!Habbo.AllowGifts) { Session.SendNotification("Oeps! Je kan geen cadeau's sturen naar deze Habbis."); return; } if (Session.GetHabbo().Rank < 4) { if ((DateTime.Now - Session.GetHabbo().LastGiftPurchaseTime).TotalSeconds <= 10.0) { Session.SendNotification("Oeps! Wacht minstens 10 seconden tussen het kopen van cadeau's."); return; } } if (Session.GetHabbo().SessionGiftBlocked) { return; } string ED = GiftUser + Convert.ToChar(5) + GiftMessage + Convert.ToChar(5) + Session.GetHabbo().Id + Convert.ToChar(5) + Item.Data.Id + Convert.ToChar(5) + SpriteId + Convert.ToChar(5) + Ribbon + Convert.ToChar(5) + Colour; int NewItemId = 0; using (IQueryAdapter dbClient = QuasarEnvironment.GetDatabaseManager().GetQueryReactor()) { //Insert the dummy item. dbClient.SetQuery("INSERT INTO `items` (`base_item`,`user_id`,`extra_data`) VALUES ('" + PresentData.Id + "', '" + Habbo.Id + "', @extra_data)"); dbClient.AddParameter("extra_data", ED); NewItemId = Convert.ToInt32(dbClient.InsertQuery()); string ItemExtraData = null; switch (Item.Data.InteractionType) { case InteractionType.NONE: ItemExtraData = ""; break; #region Pet handling case InteractionType.pet0: // Hond case InteractionType.pet1: // Kat case InteractionType.pet2: // Krokodillen case InteractionType.pet3: // Terriers case InteractionType.pet4: // Beren case InteractionType.pet5: // Varkens case InteractionType.pet6: // Leeuwen case InteractionType.pet7: // Neushoorns case InteractionType.pet8: // Spinnen case InteractionType.pet9: // Schildpadden case InteractionType.pet10: // Kuikens case InteractionType.pet11: // Kikkers case InteractionType.pet12: // Draken case InteractionType.pet13: // Slenderman case InteractionType.pet14: // Apen case InteractionType.pet15: // Paarden case InteractionType.pet16: // Monsterplanten case InteractionType.pet17: // Konijnen case InteractionType.pet18: // Evil Konijnen case InteractionType.pet19: // Depressieve Konijnen case InteractionType.pet20: // Liefdes Konijnen case InteractionType.pet21: // Witte Duiven case InteractionType.pet22: // Zwarte Duiven case InteractionType.pet23: // Rode Aap case InteractionType.pet24: // Baby Beertjes case InteractionType.pet25: // Baby Terriers case InteractionType.pet26: // Kabouters case InteractionType.pet27: // Baby's case InteractionType.pet28: // Baby Beertjes case InteractionType.pet29: // Baby Terriers case InteractionType.pet30: // Kabouters case InteractionType.pet31: // Oempa Loempa's case InteractionType.pet32: // Stenen case InteractionType.pet33: // Pterodactylussen case InteractionType.pet34: // Velociraptors case InteractionType.pet35: // Wolven case InteractionType.pet36: // Monster Konijnen case InteractionType.pet37: // Pickachu case InteractionType.pet38: // Pinguins case InteractionType.pet39: // Mario case InteractionType.pet40: // Olifanten case InteractionType.pet41: // Alien Konijnen case InteractionType.pet42: // Gouden Konijnen case InteractionType.pet43: // Roze Mewtwo case InteractionType.pet44: // Entei case InteractionType.pet45: // Blauwe Mewtwo case InteractionType.pet46: // Cavia case InteractionType.pet47: // Uil case InteractionType.pet48: // Goude Mewtwo case InteractionType.pet49: // Eend case InteractionType.pet50: // Baby Bruin case InteractionType.pet51: // Baby Wit case InteractionType.pet52: // Dino case InteractionType.pet53: // Yoshi case InteractionType.pet54: // Koe case InteractionType.pet55: // Pokémon: Gengar case InteractionType.pet56: // Pokémon: Gengar case InteractionType.pet57: // Pokémon: Gengar case InteractionType.pet58: // Pokémon: Gengar case InteractionType.pet59: // Pokémon: Gengar case InteractionType.pet60: // Pokémon: Gengar case InteractionType.pet61: // Pokémon: Gengar case InteractionType.pet62: // Pokémon: Gengar case InteractionType.pet63: // Pokémon: Gengar case InteractionType.pet64: // Pokémon: Gengar case InteractionType.pet65: // Pokémon: Gengar case InteractionType.pet66: // Pokémon: Gengar case InteractionType.pet67: // Pokémon: Gengar case InteractionType.pet68: // Pokémon: Gengar case InteractionType.pet69: // Pokémon: Gengar case InteractionType.pet70: // Pokémon: Gengar try { string[] Bits = Data.Split('\n'); string PetName = Bits[0]; string Race = Bits[1]; string Color = Bits[2]; int.Parse(Race); // to trigger any possible errors if (PetUtility.CheckPetName(PetName)) { return; } if (Race.Length > 2) { return; } if (Color.Length != 6) { return; } QuasarEnvironment.GetGame().GetAchievementManager().ProgressAchievement(Session, "ACH_PetLover", 1); } catch { return; } break; #endregion case InteractionType.FLOOR: case InteractionType.WALLPAPER: case InteractionType.LANDSCAPE: Double Number = 0; try { if (string.IsNullOrEmpty(Data)) { Number = 0; } else { Number = Double.Parse(Data, QuasarEnvironment.CultureInfo); } } catch { } ItemExtraData = Number.ToString().Replace(',', '.'); break; // maintain extra data // todo: validate case InteractionType.POSTIT: ItemExtraData = "FFFF33"; break; case InteractionType.MOODLIGHT: ItemExtraData = "1,1,1,#000000,255"; break; case InteractionType.TROPHY: ItemExtraData = Session.GetHabbo().Username + Convert.ToChar(9) + DateTime.Now.Day + "-" + DateTime.Now.Month + "-" + DateTime.Now.Year + Convert.ToChar(9) + Data; break; case InteractionType.MANNEQUIN: ItemExtraData = "m" + Convert.ToChar(5) + ".ch-210-1321.lg-285-92" + Convert.ToChar(5) + "Default Maniqui"; break; case InteractionType.BADGE_DISPLAY: if (!Session.GetHabbo().GetBadgeComponent().HasBadge(Data)) { Session.SendMessage(new BroadcastMessageAlertComposer("Oeps! Je kan deze badge niet in een vitrine zetteno omdat je deze badge niet in je bezit hebt.")); return; } ItemExtraData = Data + Convert.ToChar(9) + Session.GetHabbo().Username + Convert.ToChar(9) + DateTime.Now.Day + "-" + DateTime.Now.Month + "-" + DateTime.Now.Year; break; default: ItemExtraData = Data; break; } //Insert the present, forever. dbClient.SetQuery("INSERT INTO `user_presents` (`item_id`,`base_id`,`extra_data`) VALUES ('" + NewItemId + "', '" + Item.Data.Id + "', @extra_data)"); dbClient.AddParameter("extra_data", (string.IsNullOrEmpty(ItemExtraData) ? "" : ItemExtraData)); dbClient.RunQuery(); //Here we're clearing up a record, this is dumb, but okay. dbClient.RunQuery("DELETE FROM `items` WHERE `id` = " + NewItemId + " LIMIT 1;"); } Item GiveItem = ItemFactory.CreateGiftItem(PresentData, Habbo, ED, ED, NewItemId, 0, 0); if (GiveItem != null) { GameClient Receiver = QuasarEnvironment.GetGame().GetClientManager().GetClientByUserID(Habbo.Id); if (Receiver != null) { if (Receiver.GetHabbo().Rank <= 5) { Session.SendMessage(new RoomCustomizedAlertComposer("Je hebt een cadeau ontvangen van " + Session.GetHabbo().Username + ".")); } { Receiver.GetHabbo().GetInventoryComponent().TryAddItem(GiveItem); Receiver.SendMessage(new FurniListNotificationComposer(GiveItem.Id, 1)); Receiver.SendMessage(new PurchaseOKComposer()); Receiver.SendMessage(new FurniListAddComposer(GiveItem)); Receiver.SendMessage(new FurniListUpdateComposer()); } } QuasarEnvironment.GetGame().GetAchievementManager().ProgressAchievement(Session, "ACH_GiftGiver", 1); QuasarEnvironment.GetGame().GetAchievementManager().ProgressAchievement(Receiver, "ACH_GiftReceiver", 1); QuasarEnvironment.GetGame().GetQuestManager().ProgressUserQuest(Session, QuestType.GIFT_OTHERS); Session.SendMessage(new RoomCustomizedAlertComposer("Je cadeau is ingepakt en verzonden!")); } Session.SendMessage(new PurchaseOKComposer(Item, PresentData)); if (Item.CostCredits > 0) { Session.GetHabbo().Credits -= Item.CostCredits; Session.SendMessage(new CreditBalanceComposer(Session.GetHabbo().Credits)); } if (Item.CostPixels > 0) { Session.GetHabbo().Duckets -= Item.CostPixels; Session.SendMessage(new HabboActivityPointNotificationComposer(Session.GetHabbo().Duckets, Session.GetHabbo().Duckets)); } Session.GetHabbo().LastGiftPurchaseTime = DateTime.Now; }
public static UserData GetUserData(int UserId) { DataRow dUserInfo = null; DataRow UserInfo = null; DataTable dRelations = null; DataTable dGroups = null; using (IQueryAdapter dbClient = QuasarEnvironment.GetDatabaseManager().GetQueryReactor()) { dbClient.SetQuery("SELECT * FROM `users` WHERE `id` = @id LIMIT 1"); dbClient.AddParameter("id", UserId); dUserInfo = dbClient.getRow(); QuasarEnvironment.GetGame().GetClientManager().LogClonesOut(Convert.ToInt32(UserId)); if (dUserInfo == null) { return(null); } if (QuasarEnvironment.GetGame().GetClientManager().GetClientByUserID(UserId) != null) { return(null); } dbClient.SetQuery("SELECT * FROM `user_info` WHERE `user_id` = '" + UserId + "' LIMIT 1"); UserInfo = dbClient.getRow(); if (UserInfo == null) { dbClient.RunQuery("INSERT INTO `user_info` (`user_id`) VALUES ('" + UserId + "')"); dbClient.SetQuery("SELECT * FROM `user_info` WHERE `user_id` = '" + UserId + "' LIMIT 1"); UserInfo = dbClient.getRow(); } dbClient.SetQuery("SELECT group_id,rank FROM group_memberships WHERE user_id=@id"); dbClient.AddParameter("id", UserId); dGroups = dbClient.getTable(); dbClient.SetQuery("SELECT `id`,`target`,`type` FROM user_relationships WHERE user_id=@id"); dbClient.AddParameter("id", UserId); dRelations = dbClient.getTable(); } ConcurrentDictionary <string, UserAchievement> Achievements = new ConcurrentDictionary <string, UserAchievement>(); Dictionary <int, UserTalent> talents = new Dictionary <int, UserTalent>(); List <int> FavouritedRooms = new List <int>(); List <int> Ignores = new List <int>(); List <Badge> Badges = new List <Badge>(); Dictionary <int, MessengerBuddy> Friends = new Dictionary <int, MessengerBuddy>(); Dictionary <int, MessengerRequest> FriendRequests = new Dictionary <int, MessengerRequest>(); List <RoomData> Rooms = new List <RoomData>(); Dictionary <int, int> Quests = new Dictionary <int, int>(); Dictionary <string, Subscription> subscriptions = new Dictionary <string, Subscription>(); Dictionary <int, Relationship> Relationships = new Dictionary <int, Relationship>(); foreach (DataRow Row in dRelations.Rows) { if (!Relationships.ContainsKey(Convert.ToInt32(Row["id"]))) { Relationships.Add(Convert.ToInt32(Row["target"]), new Relationship(Convert.ToInt32(Row["id"]), Convert.ToInt32(Row["target"]), Convert.ToInt32(Row["type"].ToString()))); } } Habbo user = HabboFactory.GenerateHabbo(dUserInfo, UserInfo); return(new UserData(UserId, Achievements, FavouritedRooms, Ignores, Badges, Friends, FriendRequests, Rooms, Quests, user, Relationships, talents, subscriptions)); }
public void Parse(GameClient Session, ClientPacket Packet) { var int1 = Packet.PopInt(); // View Order ID var int2 = Packet.PopInt(); // Forum List Index int int3 = Packet.PopInt(); //Forum List Length /* * My groups = 2 * Most Active = 0 * Most views = 1 */ var forums = new List <GroupForum>(); DataTable table; switch (int1) { case 2: var Forums = QuasarEnvironment.GetGame().GetGroupForumManager().GetForumsByUserId(Session.GetHabbo().Id); if (Forums.Count - 1 >= int2) { Forums = Forums.GetRange(int2, Math.Min(int3, Forums.Count)); } Session.SendMessage(new ForumsListDataComposer(Forums, Session, int1, int2, int3)); return; case 0: using (var adap = QuasarEnvironment.GetDatabaseManager().GetQueryReactor()) { adap.SetQuery("SELECT g.id FROM groups as g INNER JOIN group_forums_thread_posts as posts, group_forums_threads as threads WHERE posts.thread_id = threads.id AND @now - posts.`timestamp`<= @sdays AND threads.forum_id = g.id GROUP BY g.id ORDER BY posts.`timestamp` DESC LIMIT @index, @limit"); adap.AddParameter("limit", int3); adap.AddParameter("index", int2); adap.AddParameter("now", (int)QuasarEnvironment.GetUnixTimestamp()); adap.AddParameter("sdays", (60 * 60 * 24 * 7)); table = adap.getTable(); } foreach (DataRow Row in table.Rows) { GroupForum forum; if (QuasarEnvironment.GetGame().GetGroupForumManager().TryGetForum(Convert.ToInt32(Row["id"]), out forum)) { forums.Add(forum); } } break; case 1: using (var adap = QuasarEnvironment.GetDatabaseManager().GetQueryReactor()) { adap.SetQuery("SELECT g.id FROM groups as g INNER JOIN group_forums_thread_views as v, group_forums_threads as threads WHERE v.thread_id = threads.id AND threads.forum_id = g.id AND @now - v.`timestamp` <= @sdays GROUP BY g.id ORDER BY v.`timestamp` DESC LIMIT @index, @limit"); adap.AddParameter("limit", int3); adap.AddParameter("index", int2); adap.AddParameter("now", (int)QuasarEnvironment.GetUnixTimestamp()); adap.AddParameter("sdays", (60 * 60 * 24 * 7)); table = adap.getTable(); } foreach (DataRow Row in table.Rows) { GroupForum forum; if (QuasarEnvironment.GetGame().GetGroupForumManager().TryGetForum(Convert.ToInt32(Row["id"]), out forum)) { forums.Add(forum); } } break; } Session.SendMessage(new ForumsListDataComposer(forums, Session, int1, int2, int3)); }