internal TargetedOffers(int id, int limit, int time, bool open, bool active, string code, string title, string description, string image, string icon, string moneyType, string items, string price) { Id = id; Limit = limit; Time = time - BiosEmuThiago.GetIUnixTimestamp(); Open = open; Active = active; Code = code; Title = title; Description = description; Image = image; Icon = icon; MoneyType = moneyType; Items = items.Split(';'); Price = price.Split(';'); Expire = time; Products = new List <TargetedItems>(); foreach (var item in Items) { var itemType = item.Split(',')[0]; var itemProduct = item.Split(',')[1]; Products.Add(new TargetedItems(Id, itemType, itemProduct)); } }
public bool TryGetGroup(int id, out Group Group) { Group = null; if (this._groups.ContainsKey(id)) { return(this._groups.TryGetValue(id, out Group)); } lock (this._groupLoadingSync) { if (this._groups.ContainsKey(id)) { return(this._groups.TryGetValue(id, out Group)); } DataRow Row = null; using (IQueryAdapter dbClient = BiosEmuThiago.GetDatabaseManager().GetQueryReactor()) { dbClient.SetQuery("SELECT * FROM `groups` WHERE `id` = @id LIMIT 1"); dbClient.AddParameter("id", id); Row = dbClient.getRow(); if (Row != null) { int created; try { int.TryParse(Row["created"].ToString(), out created); } catch { created = BiosEmuThiago.GetIUnixTimestamp(); } Group = new Group( Convert.ToInt32(Row["id"]), Convert.ToString(Row["name"]), Convert.ToString(Row["desc"]), Convert.ToString(Row["badge"]), Convert.ToInt32(Row["room_id"]), Convert.ToInt32(Row["owner_id"]), Convert.ToInt32(Row["created"]), Convert.ToInt32(Row["state"]), Convert.ToInt32(Row["colour1"]), Convert.ToInt32(Row["colour2"]), Convert.ToInt32(Row["admindeco"]), Convert.ToInt32(Row["forum_enabled"]) == 1, Convert.ToInt32(Row["has_chat"]) == 1); this._groups.TryAdd(Group.Id, Group); return(true); } } } return(false); }
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 (BiosEmuThiago.GetGame().GetModerationManager().IsBanned(MachineId, out BanRecord)) { if (BiosEmuThiago.GetGame().GetModerationManager().MachineBanCheck(MachineId)) { Disconnect(); return(false); } } } if (userData.user != null) { //Now let us check for a username ban record.. BanRecord = null; if (BiosEmuThiago.GetGame().GetModerationManager().IsBanned(userData.user.Username, out BanRecord)) { if (BiosEmuThiago.GetGame().GetModerationManager().UsernameBanCheck(userData.user.Username)) { Disconnect(); return(false); } } } #endregion BiosEmuThiago.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(BiosEmuThiago.GetGame().GetModerationManager().UserActionPresets)); SendMessage(new BadgeDefinitionsComposer(BiosEmuThiago.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 = BiosEmuThiago.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 (BiosEmuThiago.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 (!BiosEmuThiago.GetGame().GetCacheManager().ContainsUser(_habbo.Id)) { BiosEmuThiago.GetGame().GetCacheManager().GenerateUser(_habbo.Id); } _habbo.InitProcess(); if (userData.user.GetPermissions().HasRight("mod_tickets")) { SendMessage(new ModeratorInitComposer( BiosEmuThiago.GetGame().GetModerationManager().UserMessagePresets, BiosEmuThiago.GetGame().GetModerationManager().RoomMessagePresets, BiosEmuThiago.GetGame().GetModerationManager().GetTickets)); } if (BiosEmuThiago.GetGame().GetSettingsManager().TryGetValue("user.login.message.enabled") == "1") { SendMessage(new MOTDNotificationComposer(BiosEmuThiago.GetGame().GetLanguageManager().TryGetValue("user.login.message"))); } if (ExtraSettings.WELCOME_MESSAGE_ENABLED) { SendMessage(new MOTDNotificationComposer(ExtraSettings.WelcomeMessage.Replace("%username%", GetHabbo().Username))); } if (GetHabbo().Rank >= 3) { using (IQueryAdapter dbClient = BiosEmuThiago.GetDatabaseManager().GetQueryReactor()) { dbClient.SetQuery("SELECT * FROM `ranks` WHERE id = '" + GetHabbo().Rank + "'"); DataRow Table = dbClient.getRow(); if (GetHabbo().GetBadgeComponent().HasBadge(Convert.ToString(Table["badgeid"]))) { } else { GetHabbo().GetBadgeComponent().GiveBadge(Convert.ToString(Table["badgeid"]), true, GetHabbo().GetClient()); SendMessage(RoomNotificationComposer.SendBubble("badge/" + Table["badgeid"], "Você recebeu o emblema staff do seu rank!", "/inventory/open/badge")); } } } if (ExtraSettings.TARGETED_OFFERS_ENABLED) { if (BiosEmuThiago.GetGame().GetTargetedOffersManager().TargetedOffer != null) { BiosEmuThiago.GetGame().GetTargetedOffersManager().Initialize(BiosEmuThiago.GetDatabaseManager().GetQueryReactor()); TargetedOffers TargetedOffer = BiosEmuThiago.GetGame().GetTargetedOffersManager().TargetedOffer; if (TargetedOffer.Expire > BiosEmuThiago.GetIUnixTimestamp()) { if (TargetedOffer.Limit != GetHabbo()._TargetedBuy) { SendMessage(BiosEmuThiago.GetGame().GetTargetedOffersManager().TargetedOffer.Serialize()); } } else { using (var dbClient = BiosEmuThiago.GetDatabaseManager().GetQueryReactor()) dbClient.runFastQuery("UPDATE targeted_offers SET active = 'false'"); using (var dbClient2 = BiosEmuThiago.GetDatabaseManager().GetQueryReactor()) dbClient2.runFastQuery("UPDATE users SET targeted_buy = '0' WHERE targeted_buy > 0"); } } } // Fixe do Presentes do HC By Thiago Araujo //DateTime dateGregorians = new DateTime(); //dateGregorians = DateTime.Today; //int days = (dateGregorians.Day); //if (30 == days) //{ // SendMessage(new HCGiftsAlertComposer()); // SendMessage(new RoomNotificationComposer("sumando", "message", "Hoje é dia de presentes HC, pegue o seu antes que acabe!")); //} // Da a conquista de login por dia feito por Thiago Araujo string dFrank = null; using (var dbClient = BiosEmuThiago.GetDatabaseManager().GetQueryReactor()) { dbClient.SetQuery("SELECT Datahoje FROM users WHERE id = '" + userData.user.GetClient().GetHabbo().Id + "' LIMIT 1"); dFrank = dbClient.getString(); } int dFrankInt = Int32.Parse(dFrank); DateTime dateGregorian = new DateTime(); dateGregorian = DateTime.Today; int day = (dateGregorian.Day); if (dFrankInt != day) { using (var dbClient = BiosEmuThiago.GetDatabaseManager().GetQueryReactor()) { dbClient.RunQuery("UPDATE users SET Datahoje = '" + day + "' WHERE id = " + GetHabbo().Id + ";"); } BiosEmuThiago.GetGame().GetAchievementManager().ProgressAchievement(userData.user.GetClient(), "ACH_Login", 1); } if (ExtraSettings.STAFF_MENSG_ENTERTHIAGO) { using (IQueryAdapter dbClient = BiosEmuThiago.GetDatabaseManager().GetQueryReactor()) { dbClient.SetQuery("SELECT * FROM `ranks` WHERE id = '" + GetHabbo().Rank + "'"); DataRow Table = dbClient.getRow(); if (GetHabbo().Rank == 1) { // Thiago é muito lindo ser é doido } else { string figure = this.GetHabbo().Look; BiosEmuThiago.GetGame().GetClientManager().SendMessage(new RoomNotificationComposer("fig/" + figure, 3, "O " + Convert.ToString(Table["name"]) + " " + userData.user.GetClient().GetHabbo().Username + " entrou no hotel!", "")); } } if (GetHabbo().isMedal) { var nuxStatus = new ServerPacket(ServerPacketHeader.NuxUserStatus); nuxStatus.WriteInteger(2); SendMessage(nuxStatus); string thiagolindogostoso = this.GetHabbo().Look; BiosEmuThiago.GetGame().GetClientManager().StaffAlert(new RoomNotificationComposer("fig/" + thiagolindogostoso, 3, "Hey o usuário: " + GetHabbo().Username + " acaba de se registra no hotel.", "")); if (GetHabbo().isMedal) { string thiago = this.GetHabbo().Look; SendMessage(new RoomNotificationComposer("fig/" + thiago, 3, "Hey " + userData.user.GetClient().GetHabbo().Username + " Bem-vindo ao nosso hotel!", "")); } if (GetHabbo().isMedal == false) { string thiagolindo = this.GetHabbo().Look; SendMessage(new RoomNotificationComposer("fig/" + thiagolindo, 3, "Hey " + userData.user.GetClient().GetHabbo().Username + " Bem-vindo de volta ao nosso hotel!", "")); } } } if (GetHabbo().Rank > Convert.ToInt32(BiosEmuThiago.GetConfig().data["MineRankStaff"])) { using (IQueryAdapter dbClient = BiosEmuThiago.GetDatabaseManager().GetQueryReactor()) { dbClient.RunQuery("UPDATE users SET prefix_name = '' WHERE id = '" + GetHabbo().Id + "'"); dbClient.RunQuery("UPDATE users SET prefix_name_color = '' WHERE id = '" + GetHabbo().Id + "'"); } GetHabbo()._NamePrefixColor = ""; GetHabbo()._NamePrefix = ""; } if (GetHabbo().Rank > 0) { using (IQueryAdapter dbClient = BiosEmuThiago.GetDatabaseManager().GetQueryReactor()) { dbClient.SetQuery("SELECT * FROM `users` WHERE id = '" + GetHabbo().Id + "'"); DataRow Table = dbClient.getRow(); if (Convert.ToString(Table["LalaConf"]) == "0") { // Thiago é muito lindo ser é doido } else { BiosEmuThiago.GetGame().GetAchievementManager().ProgressAchievement(userData.user.GetClient(), "ACH_TraderPass", 1); BiosEmuThiago.GetGame().GetAchievementManager().ProgressAchievement(userData.user.GetClient(), "ACH_AvatarTags", 1); BiosEmuThiago.GetGame().GetAchievementManager().ProgressAchievement(userData.user.GetClient(), "ACH_EmailVerification", 1); } } } if (GetHabbo().isMedal) { if (ExtraSettings.WELCOME_NEW_MESSAGE_ENABLED) { ServerPacket notif = new ServerPacket(ServerPacketHeader.NuxAlertMessageComposer); notif.WriteString(ExtraSettings.WELCOME_MESSAGE_URL); SendMessage(notif); } using (var dbClient = BiosEmuThiago.GetDatabaseManager().GetQueryReactor()) { dbClient.RunQuery("UPDATE users SET isMedal = '0' WHERE id = " + GetHabbo().Id + ";"); } GetHabbo().isMedal = false; } BiosEmuThiago.GetGame().GetRewardManager().CheckRewards(this); BiosEmuThiago.GetGame().GetAchievementManager().TryProgressHabboClubAchievements(this); BiosEmuThiago.GetGame().GetAchievementManager().TryProgressRegistrationAchievements(this); BiosEmuThiago.GetGame().GetAchievementManager().TryProgressLoginAchievements(this); ICollection <MessengerBuddy> Friends = new List <MessengerBuddy>(); foreach (MessengerBuddy Buddy in GetHabbo().GetMessenger().GetFriends().ToList()) { if (Buddy == null) { continue; } GameClient Friend = BiosEmuThiago.GetGame().GetClientManager().GetClientByUserID(Buddy.Id); if (Friend == null) { continue; } string figure = GetHabbo().Look; Friend.SendMessage(new RoomNotificationComposer("fig/" + figure, 3, this.GetHabbo().Username + ", seu amigo acabou de entrar no hotel!", "")); } return(true); } } catch (Exception e) { ExceptionLogger.LogException(e); } return(false); }