internal void BindClientToGroupMembers(Habbo data) { GroupMember m = null; List<uint> theMemberlist = new List<uint>(data.GroupList); foreach (uint i in theMemberlist) { m = data.GetGroupMember(i); if (m == null) { continue; } m.SetNewClient(this); this.myGroups.Add(m.Group.ID, m); } foreach (uint i in data.PendingGroupJoins) { m = ButterflyEnvironment.GetGame().GetGroupManager().GetGroup(i).GetPendingGroupUser(data.Id); if (m != null) { m.SetNewClient(this); this.myGroups.Add(m.Group.ID, m); } } }
internal static void ProcessSSOTicket(Habbo sender, IncomingMessage message) { ClassicIncomingMessage classicMessage = (ClassicIncomingMessage)message; Habbo fullHabbo = CoreManager.ServerCore.HabboDistributor.GetHabboFromSSOTicket(classicMessage.PopPrefixedString()); if (fullHabbo == null) { new MConnectionClosed { Reason = ConnectionClosedReason.InvalidSSOTicket }.Send(sender); sender.Socket.Disconnect("Invalid SSO Ticket"); } else { // If this Habbo is already logged in... if (fullHabbo.LoggedIn) { // Disconnect them. new MConnectionClosed { Reason = ConnectionClosedReason.ConcurrentLogin }.Send(fullHabbo); fullHabbo.Socket.Disconnect("Concurrent Login"); } LoginMerge(fullHabbo, sender); } }
internal static void ProcessBalanceRequest(Habbo sender, IncomingMessage message) { new MCreditBalance { Balance = sender.Credits }.Send(sender); }
/// <summary> /// Initialize the PermissionComponent. /// </summary> /// <param name="Player"></param> public bool Init(Habbo Player) { if (this._lateBoxes.Count > 0) this._lateBoxes.Clear(); if (this._openedBoxes.Count > 0) this._openedBoxes.Clear(); DataTable GetData = null; using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor()) { dbClient.SetQuery("SELECT * FROM `user_xmas15_calendar` WHERE `user_id` = @id;"); dbClient.AddParameter("id", Player.Id); GetData = dbClient.getTable(); if (GetData != null) { foreach (DataRow Row in GetData.Rows) { if (Convert.ToInt32(Row["status"]) == 0) { this._lateBoxes.Add(Convert.ToInt32(Row["day"])); } else { this._openedBoxes.Add(Convert.ToInt32(Row["day"])); } } } } return true; }
internal static void ProcessSessionRequest(Habbo sender, IncomingMessage message) { new MSessionParams { A = 9, B = 0, C = 0, D = 1, E = 1, F = 3, G = 0, H = 2, I = 1, J = 4, K = 0, L = 5, DateFormat = "dd-MM-yyyy", M = "", N = 7, O = false, P = 8, URL = "http://null", Q = "", R = 9, S = false }.Send(sender); }
internal static void ProcessEncryptionRequest(Habbo sender, IncomingMessage message) { new MSetupEncryption { UnknownA = false }.Send(sender); }
/// <summary> /// Initializes the EffectsComponent. /// </summary> /// <param name="UserId"></param> public bool Init(Habbo Habbo) { if (_allClothing.Count > 0) return false; DataTable GetClothing = null; using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor()) { dbClient.SetQuery("SELECT `id`,`part_id`,`part` FROM `user_clothing` WHERE `user_id` = @id;"); dbClient.AddParameter("id", Habbo.Id); GetClothing = dbClient.getTable(); if (GetClothing != null) { foreach (DataRow Row in GetClothing.Rows) { if (this._allClothing.TryAdd(Convert.ToInt32(Row["part_id"]), new ClothingParts(Convert.ToInt32(Row["id"]), Convert.ToInt32(Row["part_id"]), Convert.ToString(Row["part"])))) { //umm? } } } } this._habbo = Habbo; return true; }
internal static void ProcessGetVolumeLevel(Habbo sender, IncomingMessage message) { new MVolumeLevel { // TODO: Should Volume really be an extension? Volume = sender.VolumeProperty() }.Send(sender); }
internal static void ProcessHabboInfoRequest(Habbo sender, IncomingMessage message) { new MHabboData { HabboId = sender.Id, Username = sender.Username, Motto = sender.Motto, Figure = sender.Figure }.Send(sender); }
/// <summary> /// /// </summary> /// <param name="Habbo"></param> public void CheckEffectExpiry(Habbo Habbo) { foreach (AvatarEffect Effect in this._effects.Values.ToList()) { if (Effect.HasExpired) { Effect.HandleExpiration(Habbo); } } }
private static Room GetVirtualTest(Habbo habbo) { if (_virtualTest == null) { _virtualTest = new RoomModelA(CoreManager.ServerCore.RoomDistributor.GetFreeRoomId()) { Name = "VirtualTest1" }; } return _virtualTest; }
/// <summary> /// Creates a new AvatarEffect with the specified details. /// </summary> /// <param name="Habbo"></param> /// <param name="SpriteId"></param> /// <param name="Duration"></param> /// <returns></returns> public static AvatarEffect CreateNullable(Habbo Habbo, int SpriteId, double Duration) { using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor()) { dbClient.SetQuery("INSERT INTO `user_effects` (`user_id`,`effect_id`,`total_duration`,`is_activated`,`activated_stamp`,`quantity`) VALUES(@uid,@sid,@dur,'0',0,1)"); dbClient.AddParameter("uid", Habbo.Id); dbClient.AddParameter("sid", SpriteId); dbClient.AddParameter("dur", Duration); return new AvatarEffect(Convert.ToInt32(dbClient.InsertQuery()), Habbo.Id, SpriteId, Duration, false, 0, 1); } }
/// <summary> /// Initialize the PermissionComponent. /// </summary> /// <param name="Player"></param> public bool Init(Habbo Player) { if (this._permissions.Count > 0) this._permissions.Clear(); if (this._commands.Count > 0) this._commands.Clear(); this._permissions.AddRange(PlusEnvironment.GetGame().GetPermissionManager().GetPermissionsForPlayer(Player)); this._commands.AddRange(PlusEnvironment.GetGame().GetPermissionManager().GetCommandsForPlayer(Player)); return true; }
internal static void ProcessMessengerInit(Habbo sender, IncomingMessage message) { // TODO: Load friends and categories. new MMessengerInit { Categories = sender.MessengerCategories, UnknownA = 10, UnknownB = 20, UnknownC = 30, }.Send(sender); }
public SubscriptionData(Habbo habbo, string type) { _habbo = habbo; using (ISession db = CoreManager.ServerCore.GetDatabaseSession()) { _subscriptionDatabase = db.CreateCriteria<Subscription>(). Add(Restrictions.Eq("habbo_id", _habbo.GetID())). Add(Restrictions.Eq("subscription_type", type)). UniqueResult<Subscription>(); } if (_subscriptionDatabase != null) return; _subscriptionDatabase = new Subscription {habbo_id = habbo.GetID()}; }
public BadgeComponent(Habbo Player, UserData data) { this._player = Player; this._badges = new Dictionary<string, Badge>(); foreach (Badge badge in data.badges) { BadgeDefinition BadgeDefinition = null; if (!PlusEnvironment.GetGame().GetBadgeManager().TryGetBadge(badge.Code, out BadgeDefinition) || BadgeDefinition.RequiredRight.Length > 0 && !Player.GetPermissions().HasRight(BadgeDefinition.RequiredRight)) continue; if (!this._badges.ContainsKey(badge.Code)) this._badges.Add(badge.Code, badge); } }
internal void Clean() { if (this.mClient != null) { this.mClient = null; this.data = null; lock (myGroups) { foreach (GroupMember m in this.myGroups.Values) { m.SetNewClient(null); } } } }
public UserData(int userID, ConcurrentDictionary<string, UserAchievement> achievements, List<int> favouritedRooms, List<int> ignores, List<Badge> badges, Dictionary<int, MessengerBuddy> friends, Dictionary<int, MessengerRequest> requests, List<RoomData> rooms, Dictionary<int, int> quests, Habbo user, Dictionary<int, Relationship> Relations) { this.userID = userID; this.achievements = achievements; this.favouritedRooms = favouritedRooms; this.ignores = ignores; this.badges = badges; this.friends = friends; this.requests = requests; this.rooms = rooms; this.quests = quests; this.user = user; this.Relations = Relations; }
private static void LoginMerge(Habbo fullHabbo, Habbo connectionHabbo) { CancelReasonEventArgs eventArgs = new CancelReasonEventArgs(); CoreManager.ServerCore.EventManager.Fire("habbo_login", EventPriority.Before, fullHabbo, eventArgs); if (eventArgs.Cancel) { if (connectionHabbo.Socket != null) connectionHabbo.Socket.Disconnect(eventArgs.CancelReason); return; } connectionHabbo.Socket.Habbo = fullHabbo; fullHabbo.Socket = connectionHabbo.Socket; fullHabbo.LastAccess = DateTime.Now; CoreManager.ServerCore.EventManager.Fire("habbo_login", EventPriority.After, fullHabbo, eventArgs); }
internal static void ProcessSubscriptionDataRequest(Habbo sender, IncomingMessage message) { ClassicIncomingMessage classicMessage = (ClassicIncomingMessage)message; string subscriptionName = classicMessage.PopPrefixedString(); // Only "club_habbo" is valid for this client. if (subscriptionName != "club_habbo") return; SubscriptionData data = sender.Subscriptions[subscriptionName]; new MSubscriptionData { SubscriptionName = subscriptionName, CurrentDay = data.Expired.Days % 31, ElapsedMonths = data.Expired.Days / 31, PrepaidMonths = data.Remaining.Days / 31, IsActive = data.IsActive }.Send(sender); }
internal static void ProcessBadgeListingRequest(Habbo sender, IncomingMessage message) { // TODO: Send badges to client /*List<string> allBadges = new List<string>(sender.Badges.Count); Dictionary<BadgeSlot, string> badgeSlots = new Dictionary<BadgeSlot, string>(5); foreach (KeyValuePair<string, BadgeSlot> badge in sender.Badges) { allBadges.Add(badge.Key); if(badge.Value != BadgeSlot.NoSlot) badgeSlots.Add(badge.Value, badge.Key); } new MBadgeListing { AllBadges = allBadges, BadgeSlots = badgeSlots }.Send(sender);*/ }
public bool Init(Habbo Player) { if (this._savedSearches.Count > 0) this._savedSearches.Clear(); DataTable GetSearches = null; using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor()) { dbClient.SetQuery("SELECT `id`,`filter`,`search_code` FROM `user_saved_searches` WHERE `user_id` = @UserId"); dbClient.AddParameter("UserId", Player.Id); GetSearches = dbClient.getTable(); if (GetSearches != null) { foreach (DataRow Row in GetSearches.Rows) { this._savedSearches.TryAdd(Convert.ToInt32(Row["id"]), new SavedSearch(Convert.ToInt32(Row["id"]), Convert.ToString(Row["filter"]), Convert.ToString(Row["search_code"]))); } } } return true; }
public UserData(uint userID, Dictionary<string, UserAchievement> achievements, Dictionary<int, UserTalent> talents, List<uint> favouritedRooms, List<uint> ignores, List<string> tags, Subscription Sub, List<Badge> badges, List<UserItem> inventory, List<AvatarEffect> effects, Dictionary<uint, MessengerBuddy> friends, Dictionary<uint, MessengerRequest> requests, HashSet<RoomData> rooms, Dictionary<uint, Pet> pets, Dictionary<uint, int> quests, Habbo user, Dictionary<uint, RoomBot> bots, Dictionary<int, Relationship> Relations, HashSet<uint> suggestedPolls, int miniMailCount) { this.userID = userID; this.achievements = achievements; this.talents = talents; this.favouritedRooms = favouritedRooms; this.ignores = ignores; this.tags = tags; this.subscriptions = Sub; this.badges = badges; this.inventory = inventory; this.effects = effects; this.friends = friends; this.requests = requests; this.rooms = rooms; this.pets = pets; this.quests = quests; this.user = user; this.Botinv = bots; this.Relations = Relations; this.suggestedPolls = suggestedPolls; this.miniMailCount = miniMailCount; }
/// <summary> /// Initialize the PermissionComponent. /// </summary> /// <param name="Player"></param> public bool Init(Habbo Player) { if (_lateBoxes.Count > 0) { _lateBoxes.Clear(); } if (_openedBoxes.Count > 0) { _openedBoxes.Clear(); } DataTable GetData = null; using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor()) { dbClient.SetQuery("SELECT * FROM `user_xmas15_calendar` WHERE `user_id` = @id;"); dbClient.AddParameter("id", Player.Id); GetData = dbClient.GetTable(); if (GetData != null) { foreach (DataRow Row in GetData.Rows) { if (Convert.ToInt32(Row["status"]) == 0) { _lateBoxes.Add(Convert.ToInt32(Row["day"])); } else { _openedBoxes.Add(Convert.ToInt32(Row["day"])); } } } } return(true); }
/// <summary> /// Determines whether this instance can use the specified minimum rank. /// </summary> /// <param name="minRank">The minimum rank.</param> /// <param name="user">The user.</param> /// <returns><c>true</c> if this instance can use the specified minimum rank; otherwise, <c>false</c>.</returns> public static bool CanUse(short minRank, GameClient user) { Habbo habbo = user.GetHabbo(); uint userRank = habbo.Rank; bool staff = habbo.HasFuse("fuse_any_room_controller"); switch (minRank) { case -3: return habbo.HasFuse("fuse_vip_commands") || habbo.Vip; case -2: return staff || habbo.CurrentRoom.RoomData.OwnerId == habbo.Id; case -1: return staff || habbo.CurrentRoom.RoomData.OwnerId == habbo.Id || habbo.CurrentRoom.CheckRights(user); case 0: return false; } return userRank >= minRank; }
internal static void MuteUser(GameClient ModSession, Habbo Client, int Length, String Message) { if (OtanixEnvironment.GetGame().GetMuteManager().UserIsMuted(Client.Id)) { if (ModSession != null) { ModSession.SendNotif("El usuario ya está muteado."); } return; } OtanixEnvironment.GetGame().GetMuteManager().AddUserMute(Client.Id, Length); if (Client.GetClient() != null) { DateTime newDateTime = OtanixEnvironment.UnixTimeStampToDateTime(OtanixEnvironment.GetGame().GetMuteManager().UsersMuted[Client.Id].ExpireTime); ServerMessage nMessage = new ServerMessage(Outgoing.SendLinkNotif); nMessage.AppendString("Tu keko no podrá hablar hasta " + newDateTime.ToString() + " Eh, levanta el pie. Tú también puedes hacer que tod@s pasen un rato agradable en " + EmuSettings.HOTEL_LINK + ". ¡Respeto sí! ¡Bullyng no! Vale, vale, ¡tiempo muerto! No vendría mal releer la Manera " + EmuSettings.HOTEL_LINK + " y los Términos de Servicio."); nMessage.AppendString("http://www." + EmuSettings.HOTEL_LINK + "/legal/terms-of-service"); Client.GetClient().SendMessage(nMessage); } }
public override void Compose(ServerPacket packet) { int AmountInCat = PlusEnvironment.GetGame().GetQuestManager().GetAmountOfQuestsInCategory(Quest.Category); int Number = Quest == null ? AmountInCat : Quest.Number; int UserProgress = Quest == null ? 0 : Habbo.GetQuestProgress(Quest.Id); packet.WriteString(Quest.Category); packet.WriteInteger(Number); // Quest progress in this cat packet.WriteInteger((Quest.Name.Contains("xmas2012")) ? 1 : AmountInCat); // Total quests in this cat packet.WriteInteger(Quest == null ? 3 : Quest.RewardType); // Reward type (1 = Snowflakes, 2 = Love hearts, 3 = Pixels, 4 = Seashells, everything else is pixels packet.WriteInteger(Quest == null ? 0 : Quest.Id); // Quest id packet.WriteBoolean(Quest == null ? false : Habbo.GetStats().QuestId == Quest.Id); // Quest started packet.WriteString(Quest == null ? string.Empty : Quest.ActionName); packet.WriteString(Quest == null ? string.Empty : Quest.DataBit); packet.WriteInteger(Quest == null ? 0 : Quest.Reward); packet.WriteString(Quest == null ? string.Empty : Quest.Name); packet.WriteInteger(UserProgress); // Current progress packet.WriteInteger(Quest == null ? 0 : Quest.GoalData); // Target progress packet.WriteInteger(Quest == null ? 0 : Quest.TimeUnlock); // "Next quest available countdown" in seconds packet.WriteString(""); packet.WriteString(""); packet.WriteBoolean(true); // ? packet.WriteBoolean(true); // Activate next quest.. }
public static Item CreateSingleItemNullable(ItemData Data, Habbo Habbo, string ExtraData, string DisplayFlags, int GroupId = 0, int LimitedNumber = 0, int LimitedStack = 0) { if (Data == null) { throw new InvalidOperationException("Data cannot be null."); } Item Item = new Item(0, 0, Data.Id, ExtraData, 0, 0, 0, 0, Habbo.Id, GroupId, LimitedNumber, LimitedStack, ""); using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor()) { dbClient.SetQuery("INSERT INTO `items` (base_item,user_id,room_id,x,y,z,wall_pos,rot,extra_data,`limited_number`,`limited_stack`) VALUES (@did,@uid,@rid,@x,@y,@z,@wall_pos,@rot,@extra_data, @limited_number, @limited_stack)"); dbClient.AddParameter("did", Data.Id); dbClient.AddParameter("uid", Habbo.Id); dbClient.AddParameter("rid", 0); dbClient.AddParameter("x", 0); dbClient.AddParameter("y", 0); dbClient.AddParameter("z", 0); dbClient.AddParameter("wall_pos", ""); dbClient.AddParameter("rot", 0); dbClient.AddParameter("extra_data", ExtraData); dbClient.AddParameter("limited_number", LimitedNumber); dbClient.AddParameter("limited_stack", LimitedStack); Item.Id = Convert.ToInt32(dbClient.InsertQuery()); if (GroupId > 0) { dbClient.SetQuery("INSERT INTO `items_groups` (`id`, `group_id`) VALUES (@id, @gid)"); dbClient.AddParameter("id", Item.Id); dbClient.AddParameter("gid", GroupId); dbClient.RunQuery(); } return(Item); } }
private static void ProcessMessengerSearch(Habbo sender, IncomingMessage message) { string searchString = message.PopPrefixedString(); List <IHI.Database.Habbo> matching; // Using IHIDB.Habbo rather than IHIDB.Friend because this will be passed to the HabboDistributor using (ISession db = CoreManager.ServerCore.GetDatabaseSession()) { matching = db.CreateCriteria <IHI.Database.Habbo>(). Add(new LikeExpression("username", searchString + "%")). SetMaxResults(20). // TODO: External config List <IHI.Database.Habbo>() as List <IHI.Database.Habbo>; } List <IBefriendable> friends = new List <IBefriendable>(); List <IBefriendable> strangers = new List <IBefriendable>(); MessengerObject messenger = sender.GetMessenger(); HabboDistributor habboDistributor = CoreManager.ServerCore.GetHabboDistributor(); foreach (IHI.Database.Habbo match in matching) { IBefriendable habbo = habboDistributor.GetHabbo(match); if (messenger.IsFriend(habbo)) { friends.Add(habbo); } else { strangers.Add(habbo); } } new MMessengerSearchResults(friends, strangers).Send(sender); }
private void DeliverOffer(Habbo user, CatalogOffer offer, string extraData) { OfferRepository.Save(offer); user.Router.GetComposer <CreditsBalanceMessageComposer>().Compose(user, user.Info.Wallet.Credits); user.Router.GetComposer <ActivityPointsMessageComposer>().Compose(user, user.Info.Wallet); var items = new Dictionary <ItemType, ICollection <Item> >(); foreach (CatalogProduct product in offer.Products) { Item item = product.Item.CreateNew(); item.Owner = user.Info; item.TryParseExtraData(extraData); if (!items.ContainsKey(product.Item.Type)) { items.Add(product.Item.Type, new List <Item>()); } items[product.Item.Type].Add(item); user.Info.Inventory.Add(item); } user.Router.GetComposer <UpdateInventoryMessageComposer>().Compose(user); user.Router.GetComposer <PurchaseOkComposer>().Compose(user, offer); user.Router.GetComposer <NewInventoryObjectMessageComposer>().Compose(user, items); if (offer.Badge != null) { user.Info.Badges.GiveBadge(offer.Badge); UserRepository.Save(user.Info); } }
public ModerationTicket(int id, int type, int category, double timestamp, int priority, Habbo sender, Habbo reported, string issue, RoomData room, List <string> reportedChats) { Id = id; Type = type; Category = category; Timestamp = timestamp; Priority = priority; Sender = sender; Reported = reported; Moderator = null; Issue = issue; Room = room; Answered = false; ReportedChats = reportedChats; }
public SubscriptionManager(uint id, Habbo habbo, UserDataFactory factory) { this.Subscriptions = new Dictionary <string, List <Subscription> >(); this.ID = id; this.Habbo = habbo; foreach (DataRow dataRow in factory.GetSubscriptions()?.Rows) { string subscription = (string)dataRow["subscription_name"]; Subscription sub = new Subscription((int)dataRow["id"], subscription, (double)dataRow["subscription_started"], (double)dataRow["subscription_expires"]); if (!this.Subscriptions.ContainsKey(subscription)) { this.Subscriptions.Add(subscription, new List <Subscription> { sub }); } else { this.Subscriptions[subscription].Add(sub); } } }
public bool Execute(params object[] Params) { if (Params == null || Params.Length == 0) { return(false); } Habbo Player = (Habbo)Params[0]; if (Player == null) { return(false); } Player.LastEffect = Player.Effects().CurrentEffect; if (Player.Effects() != null) { Player.Effects().ApplyEffect(4); } this._queue.Enqueue(Player); return(true); }
public void CompleteUserTalent(Habbo user, Talent talent) { throw new NotImplementedException(); /*if (user.Info.Talents.Any ((x) => x.Talent == talent)) * return; * * if (!LevelIsCompleted (user, talent.Type, talent.Level)) * return; * * if (talent.PrizeBaseItem != null) * Yupi.GetGame () * .GetCatalogManager () * .DeliverItems (session, talent.PrizeBaseItem, 1, * string.Empty, 0, 0, string.Empty); * * user.Info.Talents.Add (talent.Id, new UserTalent (talent.Id, 1)); * * user.Session.Router.GetComposer<AchievementTalentComposer> ().Compose (user, talent); * * if (talent.Type == "citizenship") { * switch (talent.Level) { * case 3: * Yupi.GetGame ().GetAchievementManager ().ProgressUserAchievement (session, "ACH_Citizenship", 1); * break; * case 4: * session.GetHabbo ().GetSubscriptionManager ().AddSubscription (7); * * using (IQueryAdapter queryReactor = Yupi.GetDatabaseManager ().GetQueryReactor ()) * queryReactor.RunFastQuery ( * $"UPDATE users SET talent_status = 'helper' WHERE id = '{session.GetHabbo().Id}'"); * * break; * } * }*/ }
private static bool TrySetWallItem(Habbo Habbo, Item item, string[] data, out string position) { if (data.Length != 3 || !data[0].StartsWith(":w=") || !data[1].StartsWith("l=") || (data[2] != "r" && data[2] != "l")) { position = null; return(false); } string wBit = data[0].Substring(3, data[0].Length - 3); string lBit = data[1].Substring(2, data[1].Length - 2); if (!wBit.Contains(",") || !lBit.Contains(",")) { position = null; return(false); } int.TryParse(wBit.Split(',')[0], out int w1); int.TryParse(wBit.Split(',')[1], out int w2); int.TryParse(lBit.Split(',')[0], out int l1); int.TryParse(lBit.Split(',')[1], out int l2); /*if (!Habbo.HasFuse("super_admin") && (w1 < 0 || w2 < 0 || l1 < 0 || l2 < 0 || w1 > 200 || w2 > 200 || l1 > 200 || l2 > 200)) * { * position = null; * return false; * }*/ string WallPos = ":w=" + w1 + "," + w2 + " l=" + l1 + "," + l2 + " " + data[2]; position = WallPositionCheck(WallPos); return(position != null); }
public void Parse(HabboHotel.GameClients.GameClient Session, ClientPacket Packet) { Habbo habbo = Session.GetHabbo(); habbo.PassedNuxCount++; if (habbo.PassedNuxCount == 2) { Session.SendPacket(new NuxAlertComposer("helpBubble/add/BOTTOM_BAR_CATALOGUE/nux.bot.info.shop.1")); } else if (habbo.PassedNuxCount == 3) { Session.SendPacket(new NuxAlertComposer("helpBubble/add/BOTTOM_BAR_INVENTORY/nux.bot.info.inventory.1")); } else if (habbo.PassedNuxCount == 4) { Session.SendPacket(new NuxAlertComposer("helpBubble/add/MEMENU_CLOTHES/nux.bot.info.memenu.1")); } else if (habbo.PassedNuxCount == 5) { Session.SendPacket(new NuxAlertComposer("helpBubble/add/CHAT_INPUT/nux.bot.info.chat.1")); } else if (habbo.PassedNuxCount == 6) { Session.SendPacket(new NuxAlertComposer("helpBubble/add/CREDITS_BUTTON/nux.bot.info.credits.1")); } else { Session.SendPacket(new NuxAlertComposer("nux/lobbyoffer/show")); habbo.Nuxenable = false; ServerPacket nuxStatus = new ServerPacket(ServerPacketHeader.NuxAlertComposer); nuxStatus.WriteInteger(0); Session.SendPacket(nuxStatus); } }
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.SendPacket(new BroadcastMessageAlertComposer("Oops, you can only set a relationship where a friendship exists.")); return; } if (type < 0 || type > 3) { session.SendPacket(new BroadcastMessageAlertComposer("Oops, you've chosen an invalid relationship type.")); return; } if (session.GetHabbo().Relationships.Count > 2000) { session.SendPacket(new BroadcastMessageAlertComposer("Sorry, you're limited to a total of 2000 relationships.")); return; } using (IQueryAdapter dbClient = PlusEnvironment.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); 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 = PlusEnvironment.GetGame().GetClientManager().GetClientByUserId(user); if (client != null) { session.GetHabbo().GetMessenger().UpdateFriend(user, client, true); } else { Habbo habbo = PlusEnvironment.GetHabboById(user); if (habbo != null) { if (session.GetHabbo().GetMessenger().TryGetFriend(user, out MessengerBuddy buddy)) { session.SendPacket(new FriendListUpdateComposer(session, buddy)); } } } } }
public void Handle(GameClient Session, ClientMessage Event) { int guildId = Event.PopWiredInt32(); GroupsManager guild = Groups.GetGroupById(guildId); if (guild != null && guild.UserWithRanks.Contains((int)Session.GetHabbo().Id)) { int userId = Event.PopWiredInt32(); guild.JoinGroup(userId); guild.Petitions.Remove(userId); using (DatabaseClient dbClient = Essential.GetDatabase().GetClient()) { dbClient.ExecuteQuery("DELETE FROM group_requests WHERE userid=" + userId + " AND groupid=" + guildId); dbClient.ExecuteQuery("UPDATE user_stats SET groupid=" + guildId + " WHERE id=" + userId); dbClient.ExecuteQuery("INSERT INTO group_memberships (`groupid`,`userid`) VALUES (" + guildId + "," + userId + ")"); } GameClient gc = Essential.GetGame().GetClientManager().GetClientById((uint)userId); Habbo habbo = null; if (gc != null) { habbo = gc.GetHabbo(); } if (habbo != null) { Room room = Essential.GetGame().GetRoomManager().GetRoom((uint)guild.RoomId); if (habbo.FavouriteGroup == 0) { habbo.FavouriteGroup = guild.Id; habbo.RefreshGuilds(); if (habbo.CurrentRoomId > 0) { if (room == null) { return; } ServerMessage message = new ServerMessage(Outgoing.SendGroup); //Rootkit message.AppendInt32(1); message.AppendInt32(guild.Id); message.AppendString(guild.Badge); gc.SendMessage(message); ServerMessage message2 = new ServerMessage(Outgoing.SetRoomUser); //Rootkit message2.AppendInt32(1); RoomUser ru = gc.GetHabbo().CurrentRoom.GetRoomUserByHabbo(habbo.Id); if (ru != null) { ru.method_14(message2); } gc.GetHabbo().CurrentRoom.SendMessage(message2, null); } } ServerMessage message3 = new ServerMessage(Outgoing.AddNewMember); //Rootkit message3.AppendInt32(guildId); message3.AppendInt32(guild.getRank(userId)); message3.AppendInt32(habbo.Id); message3.AppendString(habbo.Username); message3.AppendString(habbo.Figure); message3.AppendString(string.Concat(new object[] { DateTime.Now.Month, " ", DateTime.Now.Day, ", ", DateTime.Now.Year })); Session.SendMessage(message3); ServerMessage message4 = new ServerMessage(Outgoing.UpdatePetitionsGuild); //Rootkit message4.AppendInt32(1); message4.AppendInt32(guild.Id); message4.AppendInt32(3); message4.AppendString(guild.Name); Session.SendMessage(message4); gc.SendMessage(message4); ServerMessage message5 = new ServerMessage(Outgoing.SetRoomUser); //Rootkit message5.AppendInt32(1); RoomUser ru2 = gc.GetHabbo().CurrentRoom.GetRoomUserByHabbo(habbo.Id); if (ru2 != null) { ru2.method_14(message5); } gc.GetHabbo().CurrentRoom.SendMessage(message5, null); } ServerMessage message6 = new ServerMessage(Outgoing.SendHtmlColors); message6.AppendInt32(Session.GetHabbo().dataTable_0.Rows.Count); foreach (DataRow num4 in Session.GetHabbo().dataTable_0.Rows) { GroupsManager guild2 = Groups.GetGroupById((int)num4["groupid"]); message6.AppendInt32(guild2.Id); message6.AppendString(guild2.Name); message6.AppendString(guild2.Badge); message6.AppendString(guild2.ColorOne); message6.AppendString(guild2.ColorTwo); message6.AppendBoolean(guild2.Id == Session.GetHabbo().FavouriteGroup); } Session.SendMessage(message6); Session.GetClientMessageHandler().LoadMembersPetitions(2, guildId, 0, "", Session); RoomData data = Essential.GetGame().GetRoomManager().method_11((uint)guild.RoomId); if (gc != null) { ServerMessage message7 = new ServerMessage(Outgoing.SendAdvGroupInit); message7.AppendInt32(guild.Id); message7.AppendBoolean(true); message7.AppendInt32(guild.Type); message7.AppendString(guild.Name); message7.AppendString(guild.Description); message7.AppendString(guild.Badge); message7.AppendInt32(data.Id); message7.AppendString(data.Name); if (guild.Petitions.Contains((int)habbo.Id)) { message7.AppendInt32(2); } else if (!habbo.InGuild(guild.Id)) { message7.AppendInt32(0); } else if (habbo.InGuild(guild.Id)) { message7.AppendInt32(1); } message7.AppendInt32(guild.Members.Count); message7.AppendBoolean(false); message7.AppendString(guild.Created); message7.AppendBoolean(guild.UserWithRanks.Contains((int)Session.GetHabbo().Id)); //habbo.Id == guild.OwnerId); if (habbo.InGuild(guild.Id)) { if (guild.UserWithRanks.Contains((int)habbo.Id)) { message7.AppendBoolean(true); } else { message7.AppendBoolean(false); } } else { message7.AppendBoolean(false); } message7.AppendString(guild.OwnerName); message7.AppendBoolean(true); message7.AppendBoolean(true); message7.AppendInt32(guild.Members.Contains((int)habbo.Id) ? guild.Petitions.Count : 0); gc.SendMessage(message7); } } }
public UserData(uint userID, Dictionary <string, UserAchievement> achievements, Dictionary <int, UserTalent> talents, List <uint> favouritedRooms, List <uint> ignores, List <string> tags, Subscription Sub, List <Badge> badges, List <UserItem> inventory, List <AvatarEffect> effects, Dictionary <uint, MessengerBuddy> friends, Dictionary <uint, MessengerRequest> requests, HashSet <RoomData> rooms, Dictionary <uint, Pet> pets, Dictionary <uint, int> quests, Habbo user, Dictionary <uint, RoomBot> bots, Dictionary <int, Relationship> Relations, HashSet <uint> suggestedPolls, int miniMailCount) { this.userID = userID; this.achievements = achievements; this.talents = talents; this.favouritedRooms = favouritedRooms; this.ignores = ignores; this.tags = tags; this.subscriptions = Sub; this.badges = badges; this.inventory = inventory; this.effects = effects; this.friends = friends; this.requests = requests; this.rooms = rooms; this.pets = pets; this.quests = quests; this.user = user; this.Botinv = bots; this.Relations = Relations; this.suggestedPolls = suggestedPolls; this.miniMailCount = miniMailCount; }
public bool Execute(params object[] Params) { Habbo Player = (Habbo)Params[0]; if (Player == null || Player.CurrentRoom == null || !Player.InRoom) { return(false); } RoomUser User = Player.CurrentRoom.GetRoomUserManager().GetRoomUserByHabbo(Player.Id); if (User == null) { return(false); } if ((BoolData && Instance.OwnerId != Player.Id) || string.IsNullOrWhiteSpace(this.StringData)) { return(false); } IChatCommand ChatCommand = null; if (!PlusEnvironment.GetGame().GetChatManager().GetCommands().TryGetCommand(this.StringData.Replace(":", "").ToLower(), out ChatCommand)) { return(false); } if (Player.IChatCommand == ChatCommand) { Player.WiredInteraction = true; ICollection <IWiredItem> Effects = Instance.GetWired().GetEffects(this); ICollection <IWiredItem> Conditions = Instance.GetWired().GetConditions(this); foreach (IWiredItem Condition in Conditions.ToList()) { if (!Condition.Execute(Player)) { return(false); } Instance.GetWired().OnEvent(Condition.Item); } Player.GetClient().SendMessage(new WhisperComposer(User.VirtualId, this.StringData, 0, 0)); //Check the ICollection to find the random addon effect. bool HasRandomEffectAddon = Effects.Where(x => x.Type == WiredBoxType.AddonRandomEffect).ToList().Count() > 0; if (HasRandomEffectAddon) { //Okay, so we have a random addon effect, now lets get the IWiredItem and attempt to execute it. IWiredItem RandomBox = Effects.FirstOrDefault(x => x.Type == WiredBoxType.AddonRandomEffect); if (!RandomBox.Execute()) { return(false); } //Success! Let's get our selected box and continue. IWiredItem SelectedBox = Instance.GetWired().GetRandomEffect(Effects.ToList()); if (!SelectedBox.Execute()) { return(false); } //Woo! Almost there captain, now lets broadcast the update to the room instance. if (Instance != null) { Instance.GetWired().OnEvent(RandomBox.Item); Instance.GetWired().OnEvent(SelectedBox.Item); } } else { foreach (IWiredItem Effect in Effects.ToList()) { if (!Effect.Execute(Player)) { return(false); } Instance.GetWired().OnEvent(Effect.Item); } } return(true); } return(false); }
/// <summary> /// Initializes the ProcessComponent. /// </summary> /// <param name="Player">Player.</param> public bool Init(Habbo Player) { if (Player == null) return false; else if (this._player != null) return false; this._player = Player; this._timer = new Timer(new TimerCallback(Run), null, _runtimeInSec * 1000, _runtimeInSec * 1000); return true; }
public Game2LastWeekLeaderboardMessageComposer(int GameId, int Week) : base(ServerPacketHeader.Game2LastWeekLeaderboardMessageComposer) { base.WriteInteger(2018); base.WriteInteger(1); base.WriteInteger(0); base.WriteInteger(1); base.WriteInteger(1581); int count = 0; using (IQueryAdapter dbClient = RavenEnvironment.GetDatabaseManager().GetQueryReactor()) { dbClient.SetQuery("SELECT COUNT(0) FROM `games_leaderboard` WHERE game_id = " + GameId + " AND week = " + Week + " LIMIT 5"); count = dbClient.getInteger(); } base.WriteInteger(count);//Count int id = 1; using (IQueryAdapter dbClient2 = RavenEnvironment.GetDatabaseManager().GetQueryReactor()) { DataTable GetLeaderData = null; dbClient2.SetQuery("SELECT * FROM `games_leaderboard` WHERE game_id = " + GameId + " AND week = " + Week + " LIMIT 5"); GetLeaderData = dbClient2.getTable(); if (GetLeaderData != null) { foreach (DataRow Rows in GetLeaderData.Rows) { Habbo habbo = RavenEnvironment.GetHabboById(Convert.ToInt32(Rows["user_id"])); base.WriteInteger(habbo.Id); //Id base.WriteInteger(Convert.ToInt32(Rows["points"])); //Score base.WriteInteger(id++); //Rank base.WriteString(habbo.Username); //Username base.WriteString(habbo.Look); //Figure base.WriteString(habbo.Gender.ToLower()); //Gender .ToLower() } } } base.WriteInteger(0); // base.WriteInteger(GameId); //Game Id? //int count = 0; //if (Game.LeaderBoard.Count() > 5) { count = 5; } else { count = Game.LeaderBoard.Count(); } //base.WriteInteger(2018); //base.WriteInteger(1); //base.WriteInteger(0); //base.WriteInteger(1); //base.WriteInteger(1581); //base.WriteInteger(count);//Count //Console.WriteLine(Game.GameName + ":" + Game.LeaderBoard.Count()); //int id = 0; //foreach (var Data in Game.LeaderBoard) //{ // if(Data.Value.Week != Week) { return; } // id++; // Habbo habbo = RavenEnvironment.GetHabboById(Data.Value.UserId); // base.WriteInteger(habbo.Id);//Id // base.WriteInteger(id);//Rank // base.WriteInteger(Data.Value.Points);//Score // base.WriteString(habbo.Username);//Username // base.WriteString(habbo.Look);//Figure // base.WriteString(habbo.Gender.ToLower());//Gender .ToLower() // if(id == 5) { break; } //} //Used to generate the ranking numbers. //int num = 0; //base.WriteInteger(Habbos.Count);//Count //foreach (Habbo Habbo in Habbos.ToList()) //{ // num++; // base.WriteInteger(Habbo.Id);//Id // base.WriteInteger(Habbo.FastfoodScore);//Score // base.WriteInteger(num);//Rank // base.WriteString(Habbo.Username);//Username // base.WriteString(Habbo.Look);//Figure // base.WriteString(Habbo.Gender.ToLower());//Gender .ToLower() //} //base.WriteInteger(0);// //base.WriteInteger(GameData.GameId);//Game Id? /*base.WriteInteger(5);//Count * * base.WriteInteger(1);//Id * base.WriteInteger(10);//Rank * base.WriteInteger(1);//Score * base.WriteString("Custom - Derecha");//Username * base.WriteString("ch-235-1408.hd-3095-14.lg-3116-85-1408.sh-3115-1408-1408.ca-1805-64.ha-1002-1408");//Figure * base.WriteString("m");//Gender .ToLower() * * base.WriteInteger(2);//Id * base.WriteInteger(19999);//Score * base.WriteInteger(2);//Rank * base.WriteString("Salinas");//Username * base.WriteString("ch-255-96.sh-3115-1408-1408.lg-3116-85-1408.ea-1404-1194.fa-1203-1189.hr-831-1041.hd-3103-1389");//Figure * base.WriteString("m");//Gender .ToLower() * * base.WriteInteger(3);//Id * base.WriteInteger(1232);//Score * base.WriteInteger(3);//Rank * base.WriteString("HiddenKey");//Username * base.WriteString("ch-235-1408.fa-1208-1189.lg-3116-85-1408.cc-886-62.ea-1404-1194.ha-3086-96-1194.sh-3115-1408-1408.hr-100-1041.hd-3103-1389");//Figure * base.WriteString("m");//Gender .ToLower() * * base.WriteInteger(4);//Id * base.WriteInteger(1000);//Score * base.WriteInteger(4);//Rank * base.WriteString("Custom");//Username * base.WriteString("fa-1201-62.sh-6102459-96-62.hr-831-1031.ch-804-1201.lg-281-110.ha-1012-78.hd-180-11");//Figure * base.WriteString("m");//Gender .ToLower() * * base.WriteInteger(5);//Id * base.WriteInteger(1000);//Score * base.WriteInteger(5);//Rank * base.WriteString("Custom");//Username * base.WriteString("hd-180-11.hr-828-55.ch-804-96.sh-3089-1186.lg-281-110");//Figure * base.WriteString("m");//Gender .ToLower()*/ //base.WriteInteger(0);// //base.WriteInteger(Game.GameId);//Game Id? }
/// <summary> /// Blows up the dynamite /// </summary> public override void Execute() { try { GameClient Session = (GameClient)Params[1]; Poll Poll = (Poll)Params[2]; bool RoomOnly = (bool)Params[3]; Room Room = Session.GetHabbo().CurrentRoom; List <RoomUser> Users = Room.GetRoomUserManager().GetRoomUsers(); if (Poll == null || Room == null || Poll.Type != PollType.Matching) { base.EndTimer(); return; } System.Threading.Thread.Sleep(3000); TimeLeft -= 1000; if (TimeLeft > 0) { if (RoomOnly) { lock (Users) { foreach (RoomUser User in Room.GetRoomUserManager().GetRoomUsers()) { Habbo RoomUser = PlusEnvironment.GetHabboById(User.UserId); if (RoomUser == null) { continue; } if (RoomUser.AnsweredMatchingPoll) { RoomUser.GetClient().SendMessage(new MatchingPollResultMessageComposer(Poll)); } } } return; } else { lock (PlusEnvironment.GetGame().GetClientManager().GetClients) { foreach (GameClient client in PlusEnvironment.GetGame().GetClientManager().GetClients) { if (client == null || client.GetHabbo() == null || client.GetRoomUser() == null) { continue; } if (client.GetHabbo().AnsweredMatchingPoll) { client.SendMessage(new MatchingPollResultMessageComposer(Poll)); } } } } return; } if (RoomOnly) { lock (Users) { foreach (RoomUser User in Room.GetRoomUserManager().GetRoomUsers()) { Habbo RoomUser = PlusEnvironment.GetHabboById(User.UserId); if (RoomUser == null) { continue; } RoomUser.AnsweredMatchingPoll = false; } } return; } else { lock (PlusEnvironment.GetGame().GetClientManager().GetClients) { foreach (GameClient client in PlusEnvironment.GetGame().GetClientManager().GetClients) { if (client == null || client.GetHabbo() == null || client.GetRoomUser() == null) { continue; } client.GetHabbo().AnsweredMatchingPoll = false; } } } base.EndTimer(); return; } catch (Exception e) { Logging.LogRPTimersError("Error in Execute() void: " + e); base.EndTimer(); } }
public int CalculateHCSubscription(Habbo habbo) { if (habbo.GetSubscriptionManager().HasSubscription("habbo_club")) { return ((int)Essential.GetUnixTimestamp() - habbo.GetSubscriptionManager().GetSubscriptionByType("habbo_club").StartingTime) / 2678400; } else { if (habbo.GetSubscriptionManager().GetSubscriptionByType(habbo.Id.ToString()) != null) return (habbo.GetSubscriptionManager().GetSubscriptionByType("habbo_club").ExpirationTime - habbo.GetSubscriptionManager().GetSubscriptionByType("habbo_club").StartingTime) / 2678400; return 0; } }
private void TeleportUser(Habbo Player) { RoomUser User = Player.CurrentRoom.GetRoomUserManager().GetRoomUserByHabbo(Player.Id); if (User == null) { return; } Room Instance = Player.CurrentRoom; int currentscore = 0; int mScore = int.Parse(StringData.Split(';')[0]) * int.Parse(StringData.Split(';')[1]); KeyValuePair <int, string> newkey; KeyValuePair <int, string> item; if ((Instance == null || User == null ? false : !User.IsBot)) { Instance.GetRoomItemHandler().usedwiredscorebord = true; if (Instance.WiredScoreFirstBordInformation.Count == 3) { Instance.GetRoomItemHandler().ScorebordChangeCheck(); } if ((Instance.WiredScoreBordDay == null || Instance.WiredScoreBordMonth == null ? false : Instance.WiredScoreBordWeek != null)) { string username = User.GetClient().GetHabbo().Username; lock (Instance.WiredScoreBordDay) { if (!Instance.WiredScoreBordDay.ContainsKey(User.UserId)) { Instance.WiredScoreBordDay.Add(User.UserId, new KeyValuePair <int, string>(mScore, username)); } else { item = Instance.WiredScoreBordDay[User.UserId]; currentscore = (item.Key + mScore); newkey = new KeyValuePair <int, string>(currentscore, username); Instance.WiredScoreBordDay[User.UserId] = newkey; } } lock (Instance.WiredScoreBordWeek) { if (!Instance.WiredScoreBordWeek.ContainsKey(User.UserId)) { Instance.WiredScoreBordWeek.Add(User.UserId, new KeyValuePair <int, string>(mScore, username)); } else { item = Instance.WiredScoreBordWeek[User.UserId]; currentscore = (item.Key + mScore); newkey = new KeyValuePair <int, string>(currentscore, username); Instance.WiredScoreBordWeek[User.UserId] = newkey; } } lock (Instance.WiredScoreBordMonth) { if (!Instance.WiredScoreBordMonth.ContainsKey(User.UserId)) { Instance.WiredScoreBordMonth.Add(User.UserId, new KeyValuePair <int, string>(mScore, username)); } else { item = Instance.WiredScoreBordMonth[User.UserId]; currentscore = (item.Key + mScore); newkey = new KeyValuePair <int, string>(currentscore, username); Instance.WiredScoreBordMonth[User.UserId] = newkey; } } //Instance.GetWired().ExecuteWired(WiredItemType.TriggerScoreAchieved, User, currentscore); } Instance.GetRoomItemHandler().UpdateWiredScoreBord(); User.GetClient().SendMessage(RoomNotificationComposer.SendBubble("award", "Has ganado " + mScore + " puntos en la clasificación. ¡Enhorabuena!", "")); if (Player.Effects() != null) { Player.Effects().ApplyEffect(0); } } }
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 bool TryAuthenticate(string AuthTicket) { try { UserData userData = UserDataFactory.GetUserData(AuthTicket, out byte errorCode); if (errorCode == 1 || errorCode == 2) { Disconnect(); return(false); } #region Ban Checking //Let's have a quick search for a ban before we successfully authenticate.. ModerationBan BanRecord = null; if (!string.IsNullOrEmpty(MachineId)) { if (CloudServer.GetGame().GetModerationManager().IsBanned(MachineId, out BanRecord)) { if (CloudServer.GetGame().GetModerationManager().MachineBanCheck(MachineId)) { Disconnect(); return(false); } } } if (userData.user != null) { //Now let us check for a username ban record.. BanRecord = null; if (CloudServer.GetGame().GetModerationManager().IsBanned(userData.user.Username, out BanRecord)) { if (CloudServer.GetGame().GetModerationManager().UsernameBanCheck(userData.user.Username)) { Disconnect(); return(false); } } } #endregion CloudServer.GetGame().GetClientManager().RegisterClient(this, userData.userID, userData.user.Username); _habbo = userData.user; _habbo.ssoTicket = AuthTicket; if (_habbo != null) { userData.user.Init(this, userData); SendMessage(new AuthenticationOKComposer()); SendMessage(new AvatarEffectsComposer(_habbo.Effects().GetAllEffects)); SendMessage(new NavigatorSettingsComposer(_habbo.HomeRoom)); SendMessage(new FavouritesComposer(userData.user.FavoriteRooms)); SendMessage(new FigureSetIdsComposer(_habbo.GetClothing().GetClothingParts)); SendMessage(new UserRightsComposer(_habbo)); SendMessage(new AvailabilityStatusComposer()); SendMessage(new AchievementScoreComposer(_habbo.GetStats().AchievementPoints)); SendMessage(new BuildersClubMembershipComposer()); SendMessage(new CfhTopicsInitComposer(CloudServer.GetGame().GetModerationManager().UserActionPresets)); SendMessage(new BadgeDefinitionsComposer(CloudServer.GetGame().GetAchievementManager()._achievements)); SendMessage(new SoundSettingsComposer(_habbo.ClientVolume, _habbo.ChatPreference, _habbo.AllowMessengerInvites, _habbo.FocusPreference, FriendBarStateUtility.GetInt(_habbo.FriendbarState))); if (GetHabbo().GetMessenger() != null) { GetHabbo().GetMessenger().OnStatusChanged(true); } if (!string.IsNullOrEmpty(MachineId)) { if (_habbo.MachineId != MachineId) { using (IQueryAdapter dbClient = CloudServer.GetDatabaseManager().GetQueryReactor()) { dbClient.SetQuery("UPDATE `users` SET `machine_id` = @MachineId WHERE `id` = @id LIMIT 1"); dbClient.AddParameter("MachineId", MachineId); dbClient.AddParameter("id", _habbo.Id); dbClient.RunQuery(); } } _habbo.MachineId = MachineId; } if (CloudServer.GetGame().GetPermissionManager().TryGetGroup(_habbo.Rank, out PermissionGroup PermissionGroup)) { if (!String.IsNullOrEmpty(PermissionGroup.Badge)) { if (!_habbo.GetBadgeComponent().HasBadge(PermissionGroup.Badge)) { _habbo.GetBadgeComponent().GiveBadge(PermissionGroup.Badge, true, this); } } } if (!CloudServer.GetGame().GetCacheManager().ContainsUser(_habbo.Id)) { CloudServer.GetGame().GetCacheManager().GenerateUser(_habbo.Id); } _habbo.InitProcess(); if (userData.user.GetPermissions().HasRight("mod_tickets")) { SendMessage(new ModeratorInitComposer( CloudServer.GetGame().GetModerationManager().UserMessagePresets, CloudServer.GetGame().GetModerationManager().RoomMessagePresets, CloudServer.GetGame().GetModerationManager().GetTickets)); } if (CloudServer.GetGame().GetSettingsManager().TryGetValue("user.login.message.enabled") == "1") { SendMessage(new MOTDNotificationComposer(CloudServer.GetGame().GetLanguageManager().TryGetValue("user.login.message"))); } if (ExtraSettings.WELCOME_MESSAGE_ENABLED) { SendMessage(new MOTDNotificationComposer(ExtraSettings.WelcomeMessage.Replace("%username%", GetHabbo().Username))); } if (ExtraSettings.TARGETED_OFFERS_ENABLED) { if (CloudServer.GetGame().GetTargetedOffersManager().TargetedOffer != null) { CloudServer.GetGame().GetTargetedOffersManager().Initialize(CloudServer.GetDatabaseManager().GetQueryReactor()); TargetedOffers TargetedOffer = CloudServer.GetGame().GetTargetedOffersManager().TargetedOffer; if (TargetedOffer.Expire > CloudServer.GetIUnixTimestamp()) { if (TargetedOffer.Limit != GetHabbo()._TargetedBuy) { SendMessage(CloudServer.GetGame().GetTargetedOffersManager().TargetedOffer.Serialize()); } } else { using (var dbClient = CloudServer.GetDatabaseManager().GetQueryReactor()) dbClient.runFastQuery("UPDATE targeted_offers SET active = 'false'"); using (var dbClient2 = CloudServer.GetDatabaseManager().GetQueryReactor()) dbClient2.runFastQuery("UPDATE users SET targeted_buy = '0' WHERE targeted_buy > 0"); } } } //SendMessage(new HCGiftsAlertComposer()); /*var nuxStatuss = new ServerPacket(ServerPacketHeader.NuxSuggestFreeGiftsMessageComposer); * SendMessage(nuxStatuss);*/ CloudServer.GetGame().GetRewardManager().CheckRewards(this); CloudServer.GetGame().GetAchievementManager().TryProgressHabboClubAchievements(this); CloudServer.GetGame().GetAchievementManager().TryProgressRegistrationAchievements(this); CloudServer.GetGame().GetAchievementManager().TryProgressLoginAchievements(this); ICollection <MessengerBuddy> Friends = new List <MessengerBuddy>(); foreach (MessengerBuddy Buddy in GetHabbo().GetMessenger().GetFriends().ToList()) { if (Buddy == null) { continue; } GameClient Friend = CloudServer.GetGame().GetClientManager().GetClientByUserID(Buddy.Id); if (Friend == null) { continue; } string figure = GetHabbo().Look; } return(true); } } catch (Exception e) { ExceptionLogger.LogException(e); } return(false); }
public void LoginMerge(Habbo loggedInUser) { _connection = loggedInUser._connection; _connection.Habbo = this; }
public bool Execute(params object[] Params) { if (Params == null || Params.Length == 0) { return(false); } if (String.IsNullOrEmpty(this.StringData)) { return(false); } Habbo Player = (Habbo)Params[0]; if (Player == null) { return(false); } RoomUser Human = Instance.GetRoomUserManager().GetRoomUserByHabbo(Player.Id); if (Human == null) { return(false); } string[] Stuff = this.StringData.Split(';'); if (Stuff.Length != 2) { return(false);//This is important, incase a c**t scripts. } string Username = Stuff[1]; RoomUser User = this.Instance.GetRoomUserManager().GetBotByName(Username); if (User == null) { return(false); } int FollowMode = 0; if (!int.TryParse(Stuff[0], out FollowMode)) { return(false); } if (FollowMode == 0) { User.BotData.ForcedUserTargetMovement = 0; if (User.IsWalking) { User.ClearMovement(true); } } else if (FollowMode == 1) { User.BotData.ForcedUserTargetMovement = Player.Id; if (User.IsWalking) { User.ClearMovement(true); } User.MoveTo(Human.X, Human.Y); } return(true); }
public UserData(int userID, ConcurrentDictionary <string, UserAchievement> achievements, List <int> favouritedRooms, List <Badge> badges, Dictionary <int, MessengerBuddy> friends, Dictionary <int, MessengerRequest> requests, Dictionary <int, int> quests, Habbo user, Dictionary <int, Relationship> Relations) { UserId = userID; this.achievements = achievements; this.favouritedRooms = favouritedRooms; this.badges = badges; this.friends = friends; this.requests = requests; this.quests = quests; this.user = user; this.Relations = Relations; }
public FriendListUpdateComposer(Habbo habbo, MessengerBuddy Buddy) : base(ServerPacketHeader.FriendListUpdateMessageComposer) { this.Habbo = habbo; this.Buddy = Buddy; }
public void Parse(GameClient session, ClientPacket packet) { int pageId = packet.PopInt(); int itemId = packet.PopInt(); string data = packet.PopString(); string giftUser = StringCharFilter.Escape(packet.PopString()); string giftMessage = StringCharFilter.Escape(packet.PopString().Replace(Convert.ToChar(5), ' ')); int spriteId = packet.PopInt(); int ribbon = packet.PopInt(); int colour = packet.PopInt(); packet.PopBoolean(); if (PlusEnvironment.GetSettingsManager().TryGetValue("room.item.gifts.enabled") != "1") { session.SendNotification("The hotel managers have disabled gifting"); return; } if (!PlusEnvironment.GetGame().GetCatalog().TryGetPage(pageId, out CatalogPage page)) { return; } if (!page.Enabled || !page.Visible || page.MinimumRank > session.GetHabbo().Rank || page.MinimumVIP > session.GetHabbo().VIPRank&& session.GetHabbo().Rank == 1) { return; } if (!page.Items.TryGetValue(itemId, out CatalogItem item)) { if (page.ItemOffers.ContainsKey(itemId)) { item = page.ItemOffers[itemId]; if (item == null) { return; } } else { return; } } if (!ItemUtility.CanGiftItem(item)) { return; } if (!PlusEnvironment.GetGame().GetItemManager().GetGift(spriteId, out ItemData presentData) || presentData.InteractionType != InteractionType.GIFT) { return; } if (session.GetHabbo().Credits < item.CostCredits) { session.SendPacket(new PresentDeliverErrorMessageComposer(true, false)); return; } if (session.GetHabbo().Duckets < item.CostPixels) { session.SendPacket(new PresentDeliverErrorMessageComposer(false, true)); return; } Habbo habbo = PlusEnvironment.GetHabboByUsername(giftUser); if (habbo == null) { session.SendPacket(new GiftWrappingErrorComposer()); return; } if (!habbo.AllowGifts) { session.SendNotification("Oops, this user doesn't allow gifts to be sent to them!"); return; } if ((DateTime.Now - session.GetHabbo().LastGiftPurchaseTime).TotalSeconds <= 15.0) { session.SendNotification("You're purchasing gifts too fast! Please wait 15 seconds!"); session.GetHabbo().GiftPurchasingWarnings += 1; if (session.GetHabbo().GiftPurchasingWarnings >= 25) { session.GetHabbo().SessionGiftBlocked = true; } return; } if (session.GetHabbo().SessionGiftBlocked) { return; } string ed = giftUser + Convert.ToChar(5) + giftMessage + Convert.ToChar(5) + session.GetHabbo().Id + Convert.ToChar(5) + item.Data.Id + Convert.ToChar(5) + spriteId + Convert.ToChar(5) + ribbon + Convert.ToChar(5) + colour; int newItemId; using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor()) { //Insert the dummy item. dbClient.SetQuery("INSERT INTO `items` (`base_item`,`user_id`,`extra_data`) VALUES (@baseId, @habboId, @extra_data)"); dbClient.AddParameter("baseId", presentData.Id); dbClient.AddParameter("habboId", habbo.Id); dbClient.AddParameter("extra_data", ed); newItemId = Convert.ToInt32(dbClient.InsertQuery()); string itemExtraData = null; switch (item.Data.InteractionType) { case InteractionType.NONE: itemExtraData = ""; break; #region Pet handling case InteractionType.PET: try { string[] bits = data.Split('\n'); string petName = bits[0]; string race = bits[1]; string color = bits[2]; if (PetUtility.CheckPetName(petName)) { return; } if (race.Length > 2) { return; } if (color.Length != 6) { return; } PlusEnvironment.GetGame().GetAchievementManager().ProgressAchievement(session, "ACH_PetLover", 1); } catch { return; } break; #endregion case InteractionType.FLOOR: case InteractionType.WALLPAPER: case InteractionType.LANDSCAPE: double number = 0; try { number = string.IsNullOrEmpty(data) ? 0 : double.Parse(data, PlusEnvironment.CultureInfo); } catch { //ignored } itemExtraData = number.ToString(CultureInfo.CurrentCulture).Replace(',', '.'); break; // maintain extra data // todo: validate case InteractionType.POSTIT: itemExtraData = "FFFF33"; break; case InteractionType.MOODLIGHT: itemExtraData = "1,1,1,#000000,255"; break; case InteractionType.TROPHY: itemExtraData = session.GetHabbo().Username + Convert.ToChar(9) + DateTime.Now.Day + "-" + DateTime.Now.Month + "-" + DateTime.Now.Year + Convert.ToChar(9) + data; break; case InteractionType.MANNEQUIN: itemExtraData = "m" + Convert.ToChar(5) + ".ch-210-1321.lg-285-92" + Convert.ToChar(5) + "Default Mannequin"; break; case InteractionType.BADGE_DISPLAY: if (!session.GetHabbo().GetBadgeComponent().HasBadge(data)) { session.SendPacket(new BroadcastMessageAlertComposer("Oops, it appears that you do not own this badge.")); return; } itemExtraData = data + Convert.ToChar(9) + session.GetHabbo().Username + Convert.ToChar(9) + DateTime.Now.Day + "-" + DateTime.Now.Month + "-" + DateTime.Now.Year; break; default: itemExtraData = data; break; } //Insert the present, forever. dbClient.SetQuery("INSERT INTO `user_presents` (`item_id`,`base_id`,`extra_data`) VALUES (@itemId, @baseId, @extra_data)"); dbClient.AddParameter("itemId", newItemId); dbClient.AddParameter("baseId", item.Data.Id); dbClient.AddParameter("extra_data", string.IsNullOrEmpty(itemExtraData) ? "" : itemExtraData); dbClient.RunQuery(); //Here we're clearing up a record, this is dumb, but okay. dbClient.SetQuery("DELETE FROM `items` WHERE `id` = @deleteId LIMIT 1"); dbClient.AddParameter("deleteId", newItemId); dbClient.RunQuery(); } Item giveItem = ItemFactory.CreateGiftItem(presentData, habbo, ed, ed, newItemId); if (giveItem != null) { GameClient receiver = PlusEnvironment.GetGame().GetClientManager().GetClientByUserId(habbo.Id); if (receiver != null) { receiver.GetHabbo().GetInventoryComponent().TryAddItem(giveItem); receiver.SendPacket(new FurniListNotificationComposer(giveItem.Id, 1)); receiver.SendPacket(new PurchaseOKComposer()); receiver.SendPacket(new FurniListAddComposer(giveItem)); receiver.SendPacket(new FurniListUpdateComposer()); } if (habbo.Id != session.GetHabbo().Id&& !string.IsNullOrWhiteSpace(giftMessage)) { PlusEnvironment.GetGame().GetAchievementManager().ProgressAchievement(session, "ACH_GiftGiver", 1); if (receiver != null) { PlusEnvironment.GetGame().GetAchievementManager().ProgressAchievement(receiver, "ACH_GiftReceiver", 1); } PlusEnvironment.GetGame().GetQuestManager().ProgressUserQuest(session, QuestType.GiftOthers); } } session.SendPacket(new PurchaseOKComposer(item, presentData)); if (item.CostCredits > 0) { session.GetHabbo().Credits -= item.CostCredits; session.SendPacket(new CreditBalanceComposer(session.GetHabbo().Credits)); } if (item.CostPixels > 0) { session.GetHabbo().Duckets -= item.CostPixels; session.SendPacket(new HabboActivityPointNotificationComposer(session.GetHabbo().Duckets, session.GetHabbo().Duckets)); } session.GetHabbo().LastGiftPurchaseTime = DateTime.Now; }
public void HandleExpiration(Habbo Habbo) { this._quantity--; this._activated = false; this._timestampActivated = 0; using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor()) { if (this._quantity < 1) { dbClient.SetQuery("DELETE FROM `user_effects` WHERE `id` = @id"); dbClient.AddParameter("id", this.Id); dbClient.RunQuery(); } else { dbClient.SetQuery("UPDATE `user_effects` SET `quantity` = @qt, `is_activated` = '0', `activated_stamp` = 0 WHERE `id` = @id"); dbClient.AddParameter("qt", this.Quantity); dbClient.AddParameter("id", this.Id); dbClient.RunQuery(); } } Habbo.GetClient().SendMessage(new AvatarEffectExpiredComposer(this)); // reset fx if in room? }
/// <summary> /// Initializes the EffectsComponent. /// </summary> /// <param name="UserId"></param> public bool Init(Habbo Habbo) { if (_effects.Count > 0) return false; DataTable GetEffects = null; using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor()) { dbClient.SetQuery("SELECT * FROM `user_effects` WHERE `user_id` = @id;"); dbClient.AddParameter("id", Habbo.Id); GetEffects = dbClient.getTable(); if (GetEffects != null) { foreach (DataRow Row in GetEffects.Rows) { if (this._effects.TryAdd(Convert.ToInt32(Row["id"]), new AvatarEffect(Convert.ToInt32(Row["id"]), Convert.ToInt32(Row["user_id"]), Convert.ToInt32(Row["effect_id"]), Convert.ToDouble(Row["total_duration"]), PlusEnvironment.EnumToBool(Row["is_activated"].ToString()), Convert.ToDouble(Row["activated_stamp"]), Convert.ToInt32(Row["quantity"])))) { //umm? } } } } this._habbo = Habbo; this._currentEffect = 0; return true; }
public void Execute(GameClients.GameClient Session, Rooms.Room Room, string[] Params) { if (Params.Length == 1) { Session.SendWhisper("Please enter the username of the user you'd like to IP ban & account ban."); return; } Habbo Habbo = PlusEnvironment.GetHabboByUsername(Params[1]); if (Habbo == null) { Session.SendWhisper("An error occoured whilst finding that user in the database."); return; } if (Habbo.GetPermissions().HasRight("mod_tool") && !Session.GetHabbo().GetPermissions().HasRight("mod_ban_any")) { Session.SendWhisper("Oops, you cannot ban that user."); return; } String IPAddress = String.Empty; Double Expire = PlusEnvironment.GetUnixTimestamp() + 78892200; string Username = Habbo.Username; using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor()) { dbClient.RunQuery("UPDATE `user_info` SET `bans` = `bans` + '1' WHERE `user_id` = '" + Habbo.Id + "' LIMIT 1"); dbClient.SetQuery("SELECT `ip_last` FROM `users` WHERE `id` = '" + Habbo.Id + "' LIMIT 1"); IPAddress = dbClient.GetString(); } string Reason = null; if (Params.Length >= 3) { Reason = CommandManager.MergeParams(Params, 2); } else { Reason = "No reason specified."; } if (!string.IsNullOrEmpty(IPAddress)) { PlusEnvironment.GetGame().GetModerationManager().BanUser(Session.GetHabbo().Username, ModerationBanType.IP, IPAddress, Reason, Expire); } PlusEnvironment.GetGame().GetModerationManager().BanUser(Session.GetHabbo().Username, ModerationBanType.USERNAME, Habbo.Username, Reason, Expire); if (!string.IsNullOrEmpty(Habbo.MachineId)) { PlusEnvironment.GetGame().GetModerationManager().BanUser(Session.GetHabbo().Username, ModerationBanType.MACHINE, Habbo.MachineId, Reason, Expire); } GameClient TargetClient = PlusEnvironment.GetGame().GetClientManager().GetClientByUsername(Username); if (TargetClient != null) { TargetClient.Disconnect(); } Session.SendWhisper("Success, you have machine, IP and account banned the user '" + Username + "' for '" + Reason + "'!"); }
/// <summary> /// Initializes a new instance of the <see cref="UserData"/> class. /// </summary> /// <param name="userId">The user identifier.</param> /// <param name="achievements">The achievements.</param> /// <param name="talents">The talents.</param> /// <param name="favouritedRooms">The favourited rooms.</param> /// <param name="ignores">The ignores.</param> /// <param name="tags">The tags.</param> /// <param name="sub">The sub.</param> /// <param name="badges">The badges.</param> /// <param name="inventory">The inventory.</param> /// <param name="effects">The effects.</param> /// <param name="friends">The friends.</param> /// <param name="requests">The requests.</param> /// <param name="rooms">The rooms.</param> /// <param name="pets">The pets.</param> /// <param name="quests">The quests.</param> /// <param name="user">The user.</param> /// <param name="bots">The bots.</param> /// <param name="relations">The relations.</param> /// <param name="suggestedPolls">The suggested polls.</param> /// <param name="miniMailCount">The mini mail count.</param> public UserData(uint userId, Dictionary<string, UserAchievement> achievements, Dictionary<int, UserTalent> talents, List<uint> favouritedRooms, List<uint> ignores, List<string> tags, Subscription sub, List<Badge> badges, List<UserItem> inventory, List<AvatarEffect> effects, Dictionary<uint, MessengerBuddy> friends, Dictionary<uint, MessengerRequest> requests, HashSet<RoomData> rooms, Dictionary<uint, Pet> pets, Dictionary<uint, int> quests, Habbo user, Dictionary<uint, RoomBot> bots, Dictionary<int, Relationship> relations, HashSet<uint> suggestedPolls, uint miniMailCount) { UserId = userId; Achievements = achievements; Talents = talents; FavouritedRooms = favouritedRooms; Ignores = ignores; Tags = tags; Subscriptions = sub; Badges = badges; Inventory = inventory; Effects = effects; Friends = friends; Requests = requests; Rooms = rooms; Pets = pets; Quests = quests; User = user; Bots = bots; Relations = relations; SuggestedPolls = suggestedPolls; MiniMailCount = miniMailCount; }
public bool Execute(params object[] Params) { Instance.GetWired().OnEvent(Item); Habbo Player = (Habbo)Params[0]; if (!string.IsNullOrWhiteSpace(StringData) && Player.Username != StringData) { return(false); } ICollection <IWiredItem> Effects = Instance.GetWired().GetEffects(this); ICollection <IWiredItem> Conditions = Instance.GetWired().GetConditions(this); foreach (IWiredItem Condition in Conditions) { if (!Condition.Execute(Player)) { return(false); } Instance.GetWired().OnEvent(Condition.Item); } //Check the ICollection to find the random addon effect. bool HasRandomEffectAddon = Effects.Count(x => x.Type == WiredBoxType.AddonRandomEffect) > 0; if (HasRandomEffectAddon) { //Okay, so we have a random addon effect, now lets get the IWiredItem and attempt to execute it. IWiredItem RandomBox = Effects.FirstOrDefault(x => x.Type == WiredBoxType.AddonRandomEffect); if (!RandomBox.Execute()) { return(false); } //Success! Let's get our selected box and continue. IWiredItem SelectedBox = Instance.GetWired().GetRandomEffect(Effects.ToList()); if (!SelectedBox.Execute()) { return(false); } //Woo! Almost there captain, now lets broadcast the update to the room instance. if (Instance != null) { Instance.GetWired().OnEvent(RandomBox.Item); Instance.GetWired().OnEvent(SelectedBox.Item); } } else { foreach (IWiredItem Effect in Effects) { if (!Effect.Execute(Player)) { return(false); } Instance.GetWired().OnEvent(Effect.Item); } } return(true); }
public static bool RemoveFromCache(int Id, out Habbo Data) { return(_usersCached.TryRemove(Id, out Data)); }
public ChatlogEntry(int PlayerId, int RoomId, string Message, double Timestamp, Habbo Player = null, RoomData Instance = null) { this._playerId = PlayerId; this._roomId = RoomId; this._message = Message; this._timestamp = Timestamp; if (Player != null) { this._playerReference = new WeakReference(Player); } if (Instance != null) { this._roomReference = new WeakReference(Instance); } }
/// <summary> /// Stops the timer and disposes everything. /// </summary> public void Dispose() { // Wait until any processing is complete first. try { this._resetEvent.WaitOne(TimeSpan.FromMinutes(5)); } catch { } // give up // Set the timer to disabled this._disabled = true; // Dispose the timer to disable it. try { if (this._timer != null) this._timer.Dispose(); } catch { } // Remove reference to the timer. this._timer = null; // Null the player so we don't reference it here anymore this._player = null; }