private static Habbo CreateHabbo(DataRow habboData, string ssoTicket, GameClient session, UserDataFactory otherData) { uint Id = (uint)habboData["Id"]; string Username = (string)habboData["username"]; string Name = (string)habboData["real_name"]; uint Rank = (uint)habboData["rank"]; string Motto = (string)habboData["motto"]; string ip_last = (string)habboData["ip_last"]; string look = (string)habboData["look"]; string gender = (string)habboData["gender"]; int credits = (int)habboData["credits"]; int pixels = (int)habboData["activity_points"]; string account_created = (string)habboData["account_created"]; double activity_points_lastupdate = (double)habboData["activity_points_lastupdate"]; string last_loggedin = (string)habboData["last_loggedin"]; int daily_respect_points = (int)habboData["daily_respect_points"]; int daily_pet_respect_points = (int)habboData["daily_pet_respect_points"]; int unmutetime = (int)habboData["unmute_timestamp"]; double vipha_last = (double)habboData["vipha_last"]; double viphal_last = (double)habboData["viphal_last"]; bool passed_quiz = Essential.StringToBoolean(habboData["quiz_passed"].ToString()); bool passed_safetyquiz = Essential.StringToBoolean(habboData["passed_safety_quiz"].ToString()); double eventwin_last = (double)habboData["eventwin_last"]; return new Habbo(Id, Username, Name, ssoTicket, Rank, Motto, look, gender, credits, pixels, activity_points_lastupdate, account_created, Essential.StringToBoolean(habboData["is_muted"].ToString()), (uint)habboData["home_room"], (int)habboData["newbie_status"], Essential.StringToBoolean(habboData["block_newfriends"].ToString()), Essential.StringToBoolean(habboData["hide_inroom"].ToString()), Essential.StringToBoolean(habboData["hide_online"].ToString()), Essential.StringToBoolean(habboData["vip"].ToString()), (int)habboData["volume"], (int)habboData["vip_points"], Essential.StringToBoolean(habboData["accept_trading"].ToString()), ip_last, session, otherData, last_loggedin, daily_respect_points, daily_pet_respect_points, vipha_last, viphal_last, Essential.StringToBoolean(habboData["friend_stream_enabled"].ToString()), passed_quiz, passed_safetyquiz, unmutetime, eventwin_last); }
public InventoryComponent(uint userId, GameClient client, UserDataFactory userdata) { this.Session = client; this.UserId = userId; this.Items = new List<UserItem>(); this.Pets = new Hashtable(); this.Bots = new Hashtable(); this.hashtable_1 = new Hashtable(); this.Discs = new Hashtable(); this.list_1 = new List<uint>(); foreach (DataRow row in userdata.GetItems().Rows) { string str; uint id = Convert.ToUInt32(row["Id"]); uint baseItem = Convert.ToUInt32(row["base_item"]); int ltdi = Convert.ToInt32(row["ltd_id"]); int ltdc = Convert.ToInt32(row["ltd_cnt"]); string glddata = (string)row["guild_data"]; if (!DBNull.Value.Equals(row["extra_data"])) str = (string)row["extra_data"]; else str = string.Empty; UserItem item = new UserItem(id, baseItem, str, ltdi, ltdc, glddata); Items.Add(item); if (item.GetBaseItem().InteractionType == "musicdisc") this.Discs.Add(item.uint_0, item); } foreach (DataRow row in userdata.GetPets().Rows) { Pet pet = Essential.GetGame().GetCatalog().GetPet(row); this.Pets.Add(pet.PetId, pet); } foreach (DataRow row in userdata.GetBots().Rows) { UserBot bot = Essential.GetGame().GetCatalog().RetrBot(row); this.Bots.Add(bot.BotId, bot); } }
public SubscriptionManager(uint userId, UserDataFactory userdata) { this.UserId = userId; this.Subscriptions = new Dictionary<string, Subscription>(); DataTable dataTable_ = userdata.GetSubscriptions(); if (dataTable_ != null) { foreach (DataRow dataRow in dataTable_.Rows) { this.Subscriptions.Add((string)dataRow["subscription_id"], new Subscription((string)dataRow["subscription_id"], (int)dataRow["timestamp_activated"], (int)dataRow["timestamp_expire"])); } } }
public BadgeComponent(uint userId, UserDataFactory userdata) { this.Badges = new List<Badge>(); this.UserId = userId; DataTable dataTable_ = userdata.GetBadges(); if (dataTable_ != null) { foreach (DataRow dataRow in dataTable_.Rows) { this.Badges.Add(new Badge((string)dataRow["badge_id"], (int)dataRow["badge_slot"])); } } }
public AvatarEffectsInventoryComponent(uint uint_1, GameClient class16_1, UserDataFactory class12_0) { this.Session = class16_1; this.list_0 = new List<AvatarEffect>(); this.uint_0 = uint_1; this.int_0 = -1; this.list_0.Clear(); DataTable dataTable_ = class12_0.GetEffects(); StringBuilder stringBuilder = new StringBuilder(); foreach (DataRow dataRow in dataTable_.Rows) { AvatarEffect @class = new AvatarEffect((int)dataRow["effect_id"], (int)dataRow["total_duration"], Essential.StringToBoolean(dataRow["is_activated"].ToString()), (double)dataRow["activated_stamp"]); if (@class.Boolean_0) { stringBuilder.Append(string.Concat(new object[] { "DELETE FROM user_effects WHERE user_id = '", uint_1, "' AND effect_id = '", @class.int_0, "' LIMIT 1; " })); } else { this.list_0.Add(@class); } } if (stringBuilder.Length > 0) { using (DatabaseClient class2 = Essential.GetDatabase().GetClient()) { class2.ExecuteQuery(stringBuilder.ToString()); } } }
internal RelationshipComposer(uint userID, UserDataFactory data) { this.UserID = userID; foreach (Relationship relation in data.GetRelationships()) { if (!this.composedRelations.ContainsKey(relation.targetID)) { composedRelations.Add(relation.targetID, relation.relationshipStatus); switch (relation.relationshipStatus) { case 1: relationshipStatusIndex[0]++; break; case 2: relationshipStatusIndex[1]++; break; case 3: relationshipStatusIndex[2]++; break; } } } }
public void LoadAchievements(UserDataFactory userdata) { DataTable dataTable = userdata.GetAchievements(); if (dataTable != null) { foreach (DataRow dataRow in dataTable.Rows) { if (!this.dictionary_0.ContainsKey((uint)dataRow["achievement_id"])) { this.dictionary_0.Add((uint)dataRow["achievement_id"], (int)dataRow["achievement_level"]); } } } }
public void LoadTags(UserDataFactory userdata) { this.list_3.Clear(); DataTable dataTable_ = userdata.GetTags(); foreach (DataRow dataRow in dataTable_.Rows) { this.list_3.Add((string)dataRow["tag"]); } if (this.list_3.Count >= 5 && this.GetClient() != null) { this.TagAchievementsCompleted(); } }
public void LoadIgnores(UserDataFactory userdata) { DataTable dataTable_ = userdata.GetIgnores(); foreach (DataRow dataRow in dataTable_.Rows) { this.list_2.Add((uint)dataRow["ignore_id"]); } }
public void LoadFavorites(UserDataFactory class12_1) { this.list_1.Clear(); DataTable dataTable_ = class12_1.GetFavorites(); foreach (DataRow dataRow in dataTable_.Rows) { this.list_1.Add((uint)dataRow["room_id"]); } }
public void method_2(UserDataFactory class12_1) { this.LoadAchievements(class12_1); this.LoadFavorites(class12_1); this.LoadIgnores(class12_1); this.LoadTags(class12_1); this.LoadQuests(); }
public Habbo(uint UserId, string Username, string Name, string SSO, uint Rank, string Motto, string Look, string Gender, int Credits, int Pixels, double Activity_Points_LastUpdate, string DataCadastro, bool Muted, uint HomeRoom, int NewbieStatus, bool BlockNewFriends, bool HideInRoom, bool HideOnline, bool Vip, int Volume, int Points, bool AcceptTrading, string LastIp, GameClient Session, UserDataFactory userDataFactory, string last_online, int daily_respect_points, int daily_pet_respect_points, double vipha_last, double viphal_last, bool FriendStream,bool quizpassed, bool passedsafety, int muteTime, double ewl) { if (Session != null) Essential.GetGame().GetClientManager().AddClient(UserId, Username, Session); this.Id = UserId; this.Username = Username; this.RealName = Name; this.IsJuniori = false; this.IsVisible = true; this.SSO = SSO; this.Rank = Rank; this.Motto = Motto; this.Figure = Essential.FilterString(Look.ToLower()); this.Gender = Gender.ToLower(); this.Credits = Credits; this.VipPoints = Points; this.ActivityPoints = Pixels; this.LastActivityPointsUpdate = Activity_Points_LastUpdate; this.stream = new Stream.Stream(); this.TradingDisabled = AcceptTrading; this.IsMuted = Muted; this.uint_2 = 0u; this.bool_5 = false; this.bool_6 = false; this.EventWinLast = ewl; this.CurrentRoomId = 0u; this.HomeRoomId = HomeRoom; this.list_1 = new List<uint>(); this.list_2 = new List<uint>(); this.list_3 = new List<string>(); this.dictionary_0 = new Dictionary<uint, int>(); this.list_4 = new List<uint>(); this.NewbieStatus = NewbieStatus; this.bool_10 = false; this.BlockNewFriends = BlockNewFriends; this.HideInRom = HideInRoom; this.HideOnline = HideOnline; this.IsVIP = Vip; this.Volume = Volume; this.int_1 = 0; this.int_24 = 1; this.LastIp = LastIp; this.bool_7 = false; this.uint_5 = 0u; this.PassedHabboWayQuiz = quizpassed; this.PassedSafetyQuiz = passedsafety; this.Session = Session; this.UserDataFactory = userDataFactory; this.OwnedRooms = new List<RoomData>(); this.list_0 = new List<int>(); this.DataCadastro = DataCadastro; this.LastOnline = last_online; this.Online = true; this.RespectPoints = daily_respect_points; this.PetRespectPoints = daily_pet_respect_points; this.LastVipAlert = vipha_last; this.LastVipAlertLink = viphal_last; this.UnmuteTime = muteTime; DataRow dataRow = null; using (DatabaseClient dbClient = Essential.GetDatabase().GetClient()) { dbClient.AddParamWithValue("user_id", UserId); dataRow = dbClient.ReadDataRow("SELECT * FROM user_stats WHERE Id = @user_id LIMIT 1"); if (dataRow == null) { dbClient.ExecuteQuery("INSERT INTO user_stats (Id) VALUES ('" + UserId + "')"); dataRow = dbClient.ReadDataRow("SELECT * FROM user_stats WHERE Id = @user_id LIMIT 1"); } this.dataTable_0 = dbClient.ReadDataTable("SELECT * FROM group_memberships WHERE userid = @user_id"); dbClient.ExecuteQuery("INSERT INTO user_currentroom (`userid`) VALUES (" + UserId + ")"); IEnumerator enumerator; if (this.dataTable_0 != null) { enumerator = this.dataTable_0.Rows.GetEnumerator(); try { while (enumerator.MoveNext()) { DataRow dataRow2 = (DataRow)enumerator.Current; GroupsManager class2 = Groups.GetGroupById((int)dataRow2["groupid"]); if (class2 == null) { DataTable dataTable = dbClient.ReadDataTable("SELECT * FROM groups WHERE Id = " + (int)dataRow2["groupid"] + " LIMIT 1;"); IEnumerator enumerator2 = dataTable.Rows.GetEnumerator(); try { while (enumerator2.MoveNext()) { DataRow dataRow3 = (DataRow)enumerator2.Current; if (!Groups.GroupsManager.ContainsKey((int)dataRow3["Id"])) { Groups.GroupsManager.Add((int)dataRow3["Id"], new GroupsManager((int)dataRow3["Id"], dataRow3, dbClient)); } } continue; } finally { IDisposable disposable = enumerator2 as IDisposable; if (disposable != null) { disposable.Dispose(); } } } if (!class2.Members.Contains((int)UserId)) { class2.JoinGroup((int)UserId); } } } finally { IDisposable disposable = enumerator as IDisposable; if (disposable != null) { disposable.Dispose(); } } int num = (int)dataRow["groupid"]; GroupsManager class3 = Groups.GetGroupById(num); if (class3 != null) this.FavouriteGroup = num; else this.FavouriteGroup = 0; } else { this.FavouriteGroup = 0; } DataTable dataTable2 = dbClient.ReadDataTable("SELECT groupid FROM group_requests WHERE userid = '" + UserId + "';"); enumerator = dataTable2.Rows.GetEnumerator(); try { while (enumerator.MoveNext()) { DataRow dataRow2 = (DataRow)enumerator.Current; this.list_0.Add((int)dataRow2["groupid"]); } } finally { IDisposable disposable = enumerator as IDisposable; if (disposable != null) { disposable.Dispose(); } } } this.RoomVisits = (int)dataRow["RoomVisits"]; this.LoginTimestamp = (int)Essential.GetUnixTimestamp(); this.OnlineTime = (int)dataRow["OnlineTime"]; this.Respect = (int)dataRow["Respect"]; this.RespectGiven = (int)dataRow["RespectGiven"]; this.GiftsGiven = (int)dataRow["GiftsGiven"]; this.FireworkPixelLoadedCount = (int)dataRow["fireworks"]; this.GiftsReceived = (int)dataRow["GiftsReceived"]; this.RespectPoints = (int)dataRow["DailyRespectPoints"]; this.PetRespectPoints = (int)dataRow["DailyPetRespectPoints"]; this.AchievementScore = (int)dataRow["AchievementScore"]; this.CompletedQuests = new List<uint>(); this.uint_7 = 0u; this.CurrentQuestId = (uint)dataRow["quest_id"]; this.CurrentQuestProgress = (int)dataRow["quest_progress"]; this.BuilderLevel = (int)dataRow["lev_builder"]; this.IdentityLevel = (int)dataRow["lev_identity"]; this.SocialLevel = (int)dataRow["lev_social"]; this.ExplorerLevel = (int)dataRow["lev_explore"]; this.RegularVisitor = (int)dataRow["RegularVisitor"]; this.FootballGoalScorer = (int)dataRow["FootballGoalScorer"]; this.FootballGoalHost = (int)dataRow["FootballGoalHost"]; this.TilesLocked = (int)dataRow["TilesLocked"]; this.StaffPicks = (int)dataRow["staff_picks"]; if (Session != null) { this.SubscriptionManager = new SubscriptionManager(UserId, userDataFactory); this.BadgeComponent = new BadgeComponent(UserId, userDataFactory); this.InventoryComponent = new InventoryComponent(UserId, Session, userDataFactory); this.EffectsInventoryComponent = new AvatarEffectsInventoryComponent(UserId, Session, userDataFactory); this.bool_8 = false; this.bool_9 = false; foreach (DataRow dataRow3 in userDataFactory.GetRooms().Rows) { this.OwnedRooms.Add(Essential.GetGame().GetRoomManager().method_17((uint)dataRow3["Id"], dataRow3)); } } this.RelationshipComposer = new HabboHotel.Users.Relationship.RelationshipComposer(this.Id, userDataFactory); }
internal static Habbo CreateHabbo(string ssoTicket, GameClient Session, UserDataFactory userData, UserDataFactory otherData) { return Authenticator.CreateHabbo(userData.GetUserData(), ssoTicket, Session, otherData); }
internal static Habbo CreateHabbo(string username) { UserDataFactory userdata = new UserDataFactory(username, false); return Authenticator.CreateHabbo(userdata.GetUserData(), "", null, userdata); }
internal void tryLogin(string AuthTicket) { try { UserDataFactory @class = new UserDataFactory(AuthTicket, this.GetConnection().String_0, true); if ([email protected]) { @class = new UserDataFactory(AuthTicket,this.GetConnection().String_0, true); } if ([email protected]) { string str = ""; if (ServerConfiguration.EnableSSO) { str = EssentialEnvironment.GetExternalText("emu_sso_wrong_secure") + "(" + this.GetConnection().String_0 + ")"; } SendNotifWithScroll(EssentialEnvironment.GetExternalText("emu_sso_wrong") + str); return; } Habbo class2 = Authenticator.CreateHabbo(AuthTicket, this, @class, @class); Essential.GetGame().GetClientManager().Disconnect(class2.Id,"New Session"); this.Habbo = class2; this.Habbo.method_2(@class); } catch (Exception ex) { Console.WriteLine("Logging login error because you are on alpha test!"); Logging.LogException(ex.ToString()); if (this != null) { this.SendNotification(ex.ToString()); this.Disconnect("Login Error"); } return; } try { Essential.GetGame().GetBanManager().method_1(this); } catch (ModerationBanException gException) { this.NotifyBan(gException.Message); this.Disconnect("Banned!"); return; } #region "AKS" if (this.MachineId != "" && !Essential.StringToBoolean(this.GetHabbo().GetUserDataFactory().GetUserData()["staff_inacc"].ToString())) { using (DatabaseClient dbClient = Essential.GetDatabase().GetClient()) { string oldMachineId = dbClient.SpecialString("SELECT machineId FROM user_machineids WHERE userid=" + this.GetHabbo().Id); dbClient.AddParamWithValue("machineid", this.MachineId); if ((oldMachineId == "" || oldMachineId != this.MachineId)) { dbClient.AddParamWithValue("username", this.GetHabbo().Username); dbClient.ExecuteQuery("INSERT INTO user_machineids (username,userid,timestamp,machineId) VALUES (@username," + this.GetHabbo().Id + ",'" + Convert.ToInt32(Essential.GetUnixTimestamp()) + "',@machineid)"); } } } #endregion ServerMessage Message2 = new ServerMessage(Outgoing.Fuserights); if (this == null || this.GetHabbo() == null) return; if (this.GetHabbo().IsVIP || ServerConfiguration.HabboClubForClothes) { Message2.AppendInt32(2); } else { if (this.GetHabbo().GetSubscriptionManager().HasSubscription("habbo_club")) { Message2.AppendInt32(1); } else { Message2.AppendInt32(0); } } if (this.GetHabbo().HasFuse("acc_anyroomowner")) { Message2.AppendInt32(7); } else { if (this.GetHabbo().HasFuse("acc_anyroomrights")) { Message2.AppendInt32(5); } else { if (this.GetHabbo().HasFuse("acc_supporttool")) { Message2.AppendInt32(4); } else { if (this.GetHabbo().IsVIP || ServerConfiguration.HabboClubForClothes || this.GetHabbo().GetSubscriptionManager().HasSubscription("habbo_club")) { Message2.AppendInt32(2); } else { Message2.AppendInt32(0); } } } } this.SendMessage(Message2); this.SendMessage(this.GetHabbo().GetEffectsInventoryComponent().method_6()); ServerMessage Message3 = new ServerMessage(Outgoing.AvailabilityStatus); Message3.AppendBoolean(true); Message3.AppendBoolean(false); this.SendMessage(Message3); ServerMessage message = new ServerMessage(Outgoing.UniqueID); message.AppendString(this.MachineId); this.SendMessage(message); ServerMessage Message5_ = new ServerMessage(Outgoing.AuthenticationOK); this.SendMessage(Message5_); if (GetHabbo().HomeRoomId <= 0) GetHabbo().HomeRoomId = 64259; ServerMessage Message5 = new ServerMessage(Outgoing.HomeRoom); Message5.AppendUInt(this.GetHabbo().HomeRoomId); Message5.AppendUInt(this.GetHabbo().HomeRoomId); this.SendMessage(Message5); Console.WriteLine("[" + this.GetConnection().UInt32_0 + "] [" + this.GetHabbo().Username + "] [" + this.GetHabbo().Id + "] [" + this.GetConnection().String_0 + "] [" + DateTime.Now.Hour + ":" + DateTime.Now.Minute + "]"); GetHabbo().UpdateCredits(false); GetHabbo().UpdateActivityPoints(false); if (this.GetHabbo().HasFuse("acc_supporttool")) { this.SendMessage(Essential.GetGame().GetModerationTool().SerializeTool()); Essential.GetGame().GetModerationTool().method_4(this); } if (Essential.GetGame().GetPixelManager().CanHaveReward(this)) { Essential.GetGame().GetPixelManager().UpdateNeeded(this); } ServerMessage Message6 = new ServerMessage(Outgoing.FavouriteRooms); Message6.AppendInt32(30); Message6.AppendInt32(this.GetHabbo().list_1.Count); foreach (uint current in this.GetHabbo().list_1) { Message6.AppendUInt(current); } this.SendMessage(Message6); try { this.GetHabbo().CheckTotalTimeOnlineAchievements(); this.GetHabbo().CheckHappyHourAchievements(); this.GetHabbo().CheckTrueHabboAchievements(); this.GetHabbo().CheckRegularVisitorAchievements(); this.GetHabbo().CheckFootballGoalHostScoreAchievements(); this.GetHabbo().CheckStaffPicksAchievement(); } catch { } if (ServerConfiguration.MOTD != "") { this.SendNotification(ServerConfiguration.MOTD, 2); } for (uint num = (uint)Essential.GetGame().GetRoleManager().GetRankCount(); num > 1u; num -= 1u) { if (Essential.GetGame().GetRoleManager().GetBadgeByRank(num).Length > 0) { if (!this.GetHabbo().GetBadgeComponent().HasBadge(Essential.GetGame().GetRoleManager().GetBadgeByRank(num)) && this.GetHabbo().Rank == num) { this.GetHabbo().GetBadgeComponent().SendBadge(this, Essential.GetGame().GetRoleManager().GetBadgeByRank(num), true); } else { if (this.GetHabbo().GetBadgeComponent().HasBadge(Essential.GetGame().GetRoleManager().GetBadgeByRank(num)) && this.GetHabbo().Rank < num) { this.GetHabbo().GetBadgeComponent().RemoveBadge(Essential.GetGame().GetRoleManager().GetBadgeByRank(num)); } } } } if (this.GetHabbo().GetSubscriptionManager().HasSubscription("habbo_club")) { this.GetHabbo().CheckHCAchievements(); } if (this.GetHabbo().IsVIP && !this.GetHabbo().GetBadgeComponent().HasBadge("VIP")) { this.GetHabbo().GetBadgeComponent().SendBadge(this, "VIP", true); } else { if (!this.GetHabbo().IsVIP && this.GetHabbo().GetBadgeComponent().HasBadge("VIP")) { this.GetHabbo().GetBadgeComponent().RemoveBadge("VIP"); } } if (this.GetHabbo().CurrentQuestId > 0u) { Essential.GetGame().GetQuestManager().ActivateQuest(this.GetHabbo().CurrentQuestId, this); } if (!Regex.IsMatch(this.GetHabbo().Username, "^[-a-zA-Z0-9._:,]+$")) { ServerMessage Message5_2 = new ServerMessage(Outgoing.Disconnect); this.SendMessage(Message5_2); } this.GetHabbo().Motto = Essential.FilterString(this.GetHabbo().Motto); DataTable dataTable = null; using (DatabaseClient class3 = Essential.GetDatabase().GetClient()) { dataTable = class3.ReadDataTable("SELECT achievement,achlevel FROM achievements_owed WHERE user = '******'"); } if (dataTable != null) { foreach (DataRow dataRow in dataTable.Rows) { Essential.GetGame().GetAchievementManager().addAchievement(this, (uint)dataRow["achievement"], (int)dataRow["achlevel"]); using (DatabaseClient class3 = Essential.GetDatabase().GetClient()) { class3.ExecuteQuery(string.Concat(new object[] { "DELETE FROM achievements_owed WHERE achievement = '", (uint)dataRow["achievement"], "' AND user = '******' LIMIT 1" })); } } } if(this.GetHabbo().list_2 != null && this.GetHabbo().list_2.Count > 0) { ServerMessage IgnoringList = new ServerMessage(Outgoing.IgnoringList); IgnoringList.AppendInt32(this.GetHabbo().list_2.Count); foreach(uint userId in this.GetHabbo().list_2) { IgnoringList.AppendString(Essential.GetGame().GetClientManager().GetNameById(userId)); } this.SendMessage(IgnoringList); } //this.GetClientMessageHandler().method_5(this.GetHabbo().HomeRoomId, ""); }