internal void method_1(HabboData UserData) { //this.mRequests = new Hashtable(); DataTable dataTable_ = UserData.GetUserRequests; if (dataTable_ != null) { foreach (DataRow dataRow in dataTable_.Rows) { this.mRequests.Add((uint)dataRow["from_id"], new MessengerRequest((uint)dataRow["Id"], this.UserId, (uint)dataRow["from_id"], dataRow["username"] as string)); } } }
public BadgeComponent(uint mUserId, HabboData Data) { Badges = new List<Badge>(); UserId = mUserId; DataTable data = Data.GetUserBadges; if (data != null) { foreach (DataRow Row in data.Rows) { Badges.Add(new Badge((string)Row["badge_id"], (int)Row["badge_slot"])); } } }
public SubscriptionManager(uint UserId, HabboData UserData) { this.UserId = UserId; this.Subscriptions = new Dictionary<string, Subscription>(); DataTable getSupscriptionData = UserData.GetSupscriptionData; if (getSupscriptionData != null) { foreach (DataRow dataRow in getSupscriptionData.Rows) { Subscriptions.Add((string)dataRow["subscription_id"], new Subscription((string)dataRow["subscription_id"], (int)dataRow["timestamp_activated"], (int)dataRow["timestamp_expire"])); } } }
public BadgeComponent(uint mUserId, HabboData Data) { Badges = new List <Badge>(); UserId = mUserId; DataTable data = Data.GetUserBadges; if (data != null) { foreach (DataRow Row in data.Rows) { Badges.Add(new Badge((string)Row["badge_id"], (int)Row["badge_slot"])); } } }
public SubscriptionManager(uint UserId, HabboData UserData) { this.UserId = UserId; this.Subscriptions = new Dictionary <string, Subscription>(); DataTable getSupscriptionData = UserData.GetSupscriptionData; if (getSupscriptionData != null) { foreach (DataRow dataRow in getSupscriptionData.Rows) { Subscriptions.Add((string)dataRow["subscription_id"], new Subscription((string)dataRow["subscription_id"], (int)dataRow["timestamp_activated"], (int)dataRow["timestamp_expire"])); } } }
public InventoryComponent(uint mUserId, GameClient Session, HabboData Data) { this.mClient = Session; this.UserId = mUserId; this.InventoryItems = new List <UserItem>(); this.InventoryPets = new Hashtable(); this.mAddedItems = new Hashtable(); this.discs = new Hashtable(); this.mRemovedItems = new List <uint>(); this.InventoryItems.Clear(); DataTable Table = Data.GetUserInventory; foreach (DataRow Row in Table.Rows) { this.InventoryItems.Add(new UserItem((uint)Row["Id"], (uint)Row["base_item"], (string)Row["extra_data"])); } this.InventoryPets.Clear(); DataTable dataTable_2 = Data.GetUserPets; foreach (DataRow dataRow in Table.Rows) { string str; uint id = Convert.ToUInt32(dataRow["Id"]); uint baseItem = Convert.ToUInt32(dataRow["base_item"]); if (!DBNull.Value.Equals(dataRow["extra_data"])) { str = (string)dataRow["extra_data"]; } else { str = string.Empty; } InventoryItems.Add(new UserItem(id, baseItem, str)); UserItem item = new UserItem(id, baseItem, str); if (item.GetBaseItem().InteractionType == "musicdisc") { this.discs.Add(item.Id, item); } } }
internal void LoadBuddies(HabboData UserData) { //this.mBuddies = new Hashtable(); DataTable getFriendList = UserData.GetUserFriends; if (getFriendList != null) { foreach (DataRow dataRow in getFriendList.Rows) { friends.Add((uint)dataRow["Id"], new MessengerBuddy((uint)dataRow["Id"], dataRow["username"] as string, dataRow["look"] as string, dataRow["motto"] as string, dataRow["last_online"] as string)); } try { if (GetClient().GetHabbo().HasRole("receive_sa")) { friends.Add(0, new MessengerBuddy(0, "Staff Chat", GetClient().GetHabbo().Look, "Staff Chat Room", "0")); } } catch { } } }
public InventoryComponent(uint mUserId, GameClient Session, HabboData Data) { this.mClient = Session; this.UserId = mUserId; this.InventoryItems = new List<UserItem>(); this.InventoryPets = new Hashtable(); this.mAddedItems = new Hashtable(); this.discs = new Hashtable(); this.mRemovedItems = new List<uint>(); this.InventoryItems.Clear(); DataTable Table = Data.GetUserInventory; foreach (DataRow Row in Table.Rows) { this.InventoryItems.Add(new UserItem((uint)Row["Id"], (uint)Row["base_item"], (string)Row["extra_data"])); } this.InventoryPets.Clear(); DataTable dataTable_2 = Data.GetUserPets; foreach (DataRow dataRow in Table.Rows) { string str; uint id = Convert.ToUInt32(dataRow["Id"]); uint baseItem = Convert.ToUInt32(dataRow["base_item"]); if (!DBNull.Value.Equals(dataRow["extra_data"])) { str = (string)dataRow["extra_data"]; } else { str = string.Empty; } InventoryItems.Add(new UserItem(id, baseItem, str)); UserItem item = new UserItem(id, baseItem, str); if (item.GetBaseItem().InteractionType == "musicdisc") { this.discs.Add(item.Id, item); } } }
public AvatarEffectsInventoryComponent(uint UserId, GameClient pClient, HabboData UserData) { this.Session = pClient; this.Effects = new List <AvatarEffect>(); this.UserId = UserId; this.CurrentEffect = -1; this.Effects.Clear(); DataTable getUserEffects = UserData.GetUserEffects; StringBuilder QueryBuilder = new StringBuilder(); foreach (DataRow dataRow in getUserEffects.Rows) { AvatarEffect item = new AvatarEffect((int)dataRow["effect_id"], (int)dataRow["total_duration"], PhoenixEnvironment.EnumToBool(dataRow["is_activated"].ToString()), (double)dataRow["activated_stamp"]); if (item.HasExpired) { QueryBuilder.Append(string.Concat(new object[] { "DELETE FROM user_effects WHERE user_id = '", UserId, "' AND effect_id = '", item.EffectId, "' LIMIT 1; " })); } else { this.Effects.Add(item); } } if (QueryBuilder.Length > 0) { using (DatabaseClient adapter = PhoenixEnvironment.GetDatabase().GetClient()) { adapter.ExecuteQuery(QueryBuilder.ToString()); } } }
public AvatarEffectsInventoryComponent(uint UserId, GameClient pClient, HabboData UserData) { this.Session = pClient; this.Effects = new List<AvatarEffect>(); this.UserId = UserId; this.CurrentEffect = -1; this.Effects.Clear(); DataTable getUserEffects = UserData.GetUserEffects; StringBuilder QueryBuilder = new StringBuilder(); foreach (DataRow dataRow in getUserEffects.Rows) { AvatarEffect item = new AvatarEffect((int)dataRow["effect_id"], (int)dataRow["total_duration"], PhoenixEnvironment.EnumToBool(dataRow["is_activated"].ToString()), (double)dataRow["activated_stamp"]); if (item.HasExpired) { QueryBuilder.Append(string.Concat(new object[] { "DELETE FROM user_effects WHERE user_id = '", UserId, "' AND effect_id = '", item.EffectId, "' LIMIT 1; " })); } else { this.Effects.Add(item); } } if (QueryBuilder.Length > 0) { using (DatabaseClient adapter = PhoenixEnvironment.GetDatabase().GetClient()) { adapter.ExecuteQuery(QueryBuilder.ToString()); } } }
internal static Habbo TryLoginHabbo(string AuthTicket, GameClient Session, HabboData pData, HabboData UserData) { return(GenerateHabbo(pData.GetHabboDataRow, AuthTicket, Session, UserData)); }
internal static Habbo GetHabboViaUsername(string Data) { HabboData userData = new HabboData(Data, false); return(GenerateHabbo(userData.GetHabboDataRow, "", null, userData)); }
private static Habbo GenerateHabbo(DataRow Data, string AuthTicket, GameClient Client, HabboData UserData) { uint id = (uint)Data["id"]; string username = (string)Data["username"]; string realName = (string)Data["real_name"]; uint rank = (uint)Data["rank"]; string motto = (string)Data["motto"]; string ip_last = (string)Data["ip_last"]; string look = (string)Data["look"]; string gender = (string)Data["gender"]; int credits = (int)Data["credits"]; int activityPoints = (int)Data["activity_points"]; return(new Habbo(id, username, realName, AuthTicket, rank, motto, look, gender, credits, activityPoints, (double)Data["activity_points_lastupdate"], PhoenixEnvironment.EnumToBool(Data["is_muted"].ToString()), (uint)Data["home_room"], (int)Data["newbie_status"], PhoenixEnvironment.EnumToBool(Data["block_newfriends"].ToString()), PhoenixEnvironment.EnumToBool(Data["hide_inroom"].ToString()), PhoenixEnvironment.EnumToBool(Data["hide_online"].ToString()), PhoenixEnvironment.EnumToBool(Data["vip"].ToString()), (int)Data["volume"], (int)Data["vip_points"], PhoenixEnvironment.EnumToBool(Data["accept_trading"].ToString()), ip_last, Client, UserData, PhoenixEnvironment.EnumToBool(Data["friend_stream_enabled"].ToString()))); }
internal void Login(string AuthTicket) { try { HabboData pData = new HabboData(AuthTicket, this.GetConnection().ipAddress, true); if (this.GetConnection().ipAddress == "127.0.0.1" && !pData.UserFound) { pData = new HabboData(AuthTicket, "::1", true); } if (!pData.UserFound) { Console.ForegroundColor = ConsoleColor.Red; string str = ""; if (GlobalClass.SecureSessions) { str = TextManager.GetText("emu_sso_wrong_secure") + "(" + this.GetConnection().ipAddress + ")"; } ServerMessage Message = new ServerMessage(161); Message.AppendStringWithBreak(TextManager.GetText("emu_sso_wrong") + str); this.GetConnection().SendMessage(Message); Console.ForegroundColor = ConsoleColor.Gray; this.Disconnect(); return; } Habbo habbo = Authenticator.TryLoginHabbo(AuthTicket, this, pData, pData); PhoenixEnvironment.GetGame().GetClientManager().LogClonesOut(habbo.Id); this.Habbo = habbo; this.Habbo.LoadData(pData); using (DatabaseClient adapter = PhoenixEnvironment.GetDatabase().GetClient()) { adapter.ReadString("SELECT ip_last FROM users WHERE Id = " + GetHabbo().Id + " LIMIT 1;"); } this.Habbo.isAaron = false; if (Habbo.isAaron) { Habbo.Rank = (uint)PhoenixEnvironment.GetGame().GetRoleManager().RankCount(); Habbo.Vip = true; } } catch (Exception ex) { this.SendNotif("Login error: " + ex.Message); this.Disconnect(); return; } try { PhoenixEnvironment.GetGame().GetBanManager().CheckForBanConflicts(this); } catch (ModerationBanException gException) { this.SendBanMessage(gException.Message); this.Disconnect(); return; } ServerMessage Message2 = new ServerMessage(2); if (this.GetHabbo().Vip || GlobalClass.VIPclothesforHCusers) { Message2.AppendInt32(2); } else if (this.GetHabbo().GetSubscriptionManager().HasSubscription("habbo_club")) { Message2.AppendInt32(1); } else { Message2.AppendInt32(0); } if (this.GetHabbo().HasRole("acc_anyroomowner")) { Message2.AppendInt32(7); } else if (this.GetHabbo().HasRole("acc_anyroomrights")) { Message2.AppendInt32(5); } else if (this.GetHabbo().HasRole("acc_supporttool")) { Message2.AppendInt32(4); } else if (this.GetHabbo().Vip || GlobalClass.VIPclothesforHCusers || this.GetHabbo().GetSubscriptionManager().HasSubscription("habbo_club")) { Message2.AppendInt32(2); } else { Message2.AppendInt32(0); } this.SendMessage(Message2); this.SendMessage(this.GetHabbo().GetAvatarEffectsInventoryComponent().Serialize()); ServerMessage Message3 = new ServerMessage(290); Message3.AppendBoolean(true); Message3.AppendBoolean(false); this.SendMessage(Message3); ServerMessage message4 = new ServerMessage(3); this.SendMessage(message4); if (this.GetHabbo().HasRole("acc_supporttool")) { this.SendMessage(PhoenixEnvironment.GetGame().GetModerationTool().SerializeTool()); PhoenixEnvironment.GetGame().GetModerationTool().SendOpenTickets(this); } ServerMessage Logging = new ServerMessage(517); Logging.AppendBoolean(true); this.SendMessage(Logging); if (PhoenixEnvironment.GetGame().GetPixelManager().NeedsUpdate(this)) { PhoenixEnvironment.GetGame().GetPixelManager().GivePixels(this); } ServerMessage Message5 = new ServerMessage(455); Message5.AppendUInt(this.GetHabbo().HomeRoom); this.SendMessage(Message5); ServerMessage Message6 = new ServerMessage(458); Message6.AppendInt32(30); Message6.AppendInt32(this.GetHabbo().FavoriteRooms.Count); foreach (uint current in this.GetHabbo().FavoriteRooms) { Message6.AppendUInt(current); } this.SendMessage(Message6); if (this.GetHabbo().Stat_OnlineTime > 8294400) { PhoenixEnvironment.GetGame().GetAchievementManager().UnlockAchievement(this, 16, 10); } else if (this.GetHabbo().Stat_OnlineTime > 4147200) { PhoenixEnvironment.GetGame().GetAchievementManager().UnlockAchievement(this, 16, 9); } else if (this.GetHabbo().Stat_OnlineTime > 2073600) { PhoenixEnvironment.GetGame().GetAchievementManager().UnlockAchievement(this, 16, 8); } else if (this.GetHabbo().Stat_OnlineTime > 1036800) { PhoenixEnvironment.GetGame().GetAchievementManager().UnlockAchievement(this, 16, 7); } else if (this.GetHabbo().Stat_OnlineTime > 518400) { PhoenixEnvironment.GetGame().GetAchievementManager().UnlockAchievement(this, 16, 6); } else if (this.GetHabbo().Stat_OnlineTime > 172800) { PhoenixEnvironment.GetGame().GetAchievementManager().UnlockAchievement(this, 16, 5); } else if (this.GetHabbo().Stat_OnlineTime > 57600) { PhoenixEnvironment.GetGame().GetAchievementManager().UnlockAchievement(this, 16, 4); } else if (this.GetHabbo().Stat_OnlineTime > 28800) { PhoenixEnvironment.GetGame().GetAchievementManager().UnlockAchievement(this, 16, 3); } else if (this.GetHabbo().Stat_OnlineTime > 10800) { PhoenixEnvironment.GetGame().GetAchievementManager().UnlockAchievement(this, 16, 2); } else if (this.GetHabbo().Stat_OnlineTime > 3600) { PhoenixEnvironment.GetGame().GetAchievementManager().UnlockAchievement(this, 16, 1); } if (GlobalClass.Motd != "") { this.SendNotif(GlobalClass.Motd, 2); } for (uint i = (uint)PhoenixEnvironment.GetGame().GetRoleManager().RankCount(); i > 1; i -= 1) { if (PhoenixEnvironment.GetGame().GetRoleManager().RanksBadge(i).Length > 0) { if (!GetHabbo().GetBadgeComponent().HasBadge(PhoenixEnvironment.GetGame().GetRoleManager().RanksBadge(i)) && GetHabbo().Rank == i) { GetHabbo().GetBadgeComponent().GiveBadge(this, PhoenixEnvironment.GetGame().GetRoleManager().RanksBadge(i), true); } else if (GetHabbo().GetBadgeComponent().HasBadge(PhoenixEnvironment.GetGame().GetRoleManager().RanksBadge(i)) && GetHabbo().Rank < i) { GetHabbo().GetBadgeComponent().RemoveBadge(PhoenixEnvironment.GetGame().GetRoleManager().RanksBadge(i)); } } } if (GetHabbo().GetSubscriptionManager().HasSubscription("habbo_club") && !GetHabbo().GetBadgeComponent().HasBadge("HC1")) { GetHabbo().GetBadgeComponent().GiveBadge(this, "HC1", true); } else { if (!GetHabbo().GetSubscriptionManager().HasSubscription("habbo_club") && GetHabbo().GetBadgeComponent().HasBadge("HC1")) { GetHabbo().GetBadgeComponent().RemoveBadge("HC1"); } } if (GetHabbo().Vip&& !GetHabbo().GetBadgeComponent().HasBadge("VIP")) { this.GetHabbo().GetBadgeComponent().GiveBadge(this, "VIP", true); } else { if (!GetHabbo().Vip&& GetHabbo().GetBadgeComponent().HasBadge("VIP")) { GetHabbo().GetBadgeComponent().RemoveBadge("VIP"); } } if (GetHabbo().CurrentQuestId > 0) { PhoenixEnvironment.GetGame().GetQuestManager().HandleQuest(GetHabbo().CurrentQuestId, this); } if (!Regex.IsMatch(this.GetHabbo().Username, "^[-a-zA-Z0-9._:,]+$")) { ServerMessage message8 = new ServerMessage(573); this.SendMessage(message8); } this.GetHabbo().Motto = PhoenixEnvironment.FilterInjectionChars(this.GetHabbo().Motto); DataTable table = null; using (DatabaseClient adapter = PhoenixEnvironment.GetDatabase().GetClient()) { table = adapter.ReadDataTable("SELECT achievement,achlevel FROM achievements_owed WHERE user = '******'"); } if (table != null) { foreach (DataRow row in table.Rows) { PhoenixEnvironment.GetGame().GetAchievementManager().UnlockAchievement(this, (uint)row["achievement"], (int)row["achlevel"]); using (DatabaseClient adapter = PhoenixEnvironment.GetDatabase().GetClient()) { adapter.ExecuteQuery(string.Concat(new object[] { "DELETE FROM achievements_owed WHERE achievement = '", (uint)row["achievement"], "' AND user = '******' LIMIT 1" })); } } } }