//internal Role GetRole(UInt32 Id) //{ // if (!ContainsRole(Id)) // { // return null; // } // return Roles[Id]; //} internal List<string> GetRightsForHabbo(Habbo Habbo) { List<string> UserRights = new List<string>(); if (Habbo == null) return UserRights; UserRights.AddRange(GetRightsForRank(Habbo.Rank)); foreach (string SubscriptionId in Habbo.GetSubscriptionManager().SubList) { UserRights.AddRange(GetRightsForSub(SubscriptionId)); } return UserRights; }
public UserData(uint userID, Dictionary<string, UserAchievement> achievements, List<uint> favouritedRooms, List<uint> ignores, List<string> tags, Dictionary<string, Subscription> subscriptions, List<Badge> badges, List<UserItem> inventory, List<AvatarEffect> effects, Dictionary<uint, MessengerBuddy> friends, Dictionary<uint, MessengerRequest> requests, List<RoomData> rooms, Dictionary<uint, Pet> pets, Dictionary<uint, int> quests, Hashtable inventorySongs, Habbo user) { this.userID = userID; this.achievements = achievements; this.favouritedRooms = favouritedRooms; this.ignores = ignores; this.tags = tags; this.subscriptions = subscriptions; 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.inventorySongs = inventorySongs; this.user = user; }
internal bool tryLogin(string AuthTicket) { int loginProgress = 0; try { string ip = GetConnection().getIp(); byte errorCode = 0; UserData userData = UserDataFactory.GetUserData(AuthTicket, ip, out errorCode); if (errorCode == 1) { SendNotifWithScroll(LanguageLocale.GetValue("login.invalidsso")); return false; } else if (errorCode == 2) { SendNotifWithScroll(LanguageLocale.GetValue("login.loggedin")); return false; } loginProgress++; FirewindEnvironment.GetGame().GetClientManager().RegisterClient(this, userData.userID, userData.user.Username); this.Habbo = userData.user; userData.user.LoadData(userData); loginProgress++; if (userData.user.Username == null) { SendBanMessage("You have no username."); return false; } string banReason = FirewindEnvironment.GetGame().GetBanManager().GetBanReason(userData.user.Username, ip); loginProgress++; if (!string.IsNullOrEmpty(banReason)) { SendBanMessage(banReason); return false; } userData.user.Init(this, userData); QueuedServerMessage response = new QueuedServerMessage(Connection); ServerMessage UniqueId = new ServerMessage(Outgoing.UniqueID); UniqueId.AppendString(this.MachineId); response.appendResponse(UniqueId); ServerMessage authok = new ServerMessage(Outgoing.AuthenticationOK); response.appendResponse(authok); ServerMessage HomeRoom = new ServerMessage(Outgoing.HomeRoom); HomeRoom.AppendUInt(this.GetHabbo().HomeRoom); // first home HomeRoom.AppendUInt(this.GetHabbo().HomeRoom); // first home SendMessage(HomeRoom); loginProgress++; ServerMessage FavouriteRooms = new ServerMessage(Outgoing.FavouriteRooms); FavouriteRooms.AppendInt32(30); // max rooms FavouriteRooms.AppendInt32(userData.user.FavoriteRooms.Count); foreach (uint Id in userData.user.FavoriteRooms.ToArray()) { FavouriteRooms.AppendUInt(Id); } response.appendResponse(FavouriteRooms); loginProgress++; ServerMessage fuserights = new ServerMessage(Outgoing.Fuserights); if (GetHabbo().GetSubscriptionManager().HasSubscription("habbo_vip")) // VIP fuserights.AppendInt32(2); else if (GetHabbo().GetSubscriptionManager().HasSubscription("habbo_club")) // HC fuserights.AppendInt32(1); else fuserights.AppendInt32(0); fuserights.AppendUInt(this.GetHabbo().Rank); response.appendResponse(fuserights); loginProgress++; ServerMessage bools1 = new ServerMessage(Outgoing.AvailabilityStatus); bools1.AppendBoolean(true); bools1.AppendBoolean(false); response.appendResponse(bools1); ServerMessage bools2 = new ServerMessage(Outgoing.InfoFeedEnable); bools2.AppendBoolean(false); response.appendResponse(bools2); loginProgress++; ServerMessage setRanking = new ServerMessage(Outgoing.SerializeCompetitionWinners); setRanking.AppendString("hlatCompetitions"); // competition type setRanking.AppendInt32(Ranking.getCompetitionForInfo("hlatCompetitions").Count); loginProgress++; int i = 0; foreach (Ranking r in Ranking.getCompetitionForInfo("hlatCompetitions")) { i++; setRanking.AppendUInt(r.UserId); Habbo data = FirewindEnvironment.getHabboForId(r.UserId); setRanking.AppendString((data != null) ? data.Username : "******"); setRanking.AppendString((data != null) ? data.Look : "sh-907-96.hd-3096-3.he-3082-91.lg-3018-81.ch-660-95.hr-9534-34"); setRanking.AppendInt32(i); // position setRanking.AppendInt32(r.Score); } response.appendResponse(setRanking); loginProgress++; if (userData.user.HasFuse("fuse_mod")) { this.SendMessage(FirewindEnvironment.GetGame().GetModerationTool().SerializeTool()); FirewindEnvironment.GetGame().GetModerationTool().SerializeOpenTickets(ref response, userData.userID); } if (LanguageLocale.welcomeAlertEnabled) { this.SendMOTD(LanguageLocale.welcomeAlert); } loginProgress++; using (IQueryAdapter db = FirewindEnvironment.GetDatabaseManager().getQueryreactor()) { db.setQuery("UPDATE users SET online = '1' WHERE id = @id"); db.addParameter("id", this.GetHabbo().Id); db.runQuery(); } loginProgress++; // Send the big chunk response.sendResponse(); // fire the event! FirewindEnvironment.GetGame().GetClientManager().ClientLoggedIn(this); return true; } catch (UserDataNotFoundException e) { SendNotifWithScroll(LanguageLocale.GetValue("login.invalidsso") + "extra data: " + e.ToString()); } catch (Exception e) { Logging.LogCriticalException(String.Format("Invalid Dario bug duing user login (progress = {0}): ", loginProgress) + e.ToString()); SendNotifWithScroll("Login error: " + e.ToString()); } return false; }
internal void Stop() { if (GetMessageHandler() != null) MessageHandler.Destroy(); if (GetHabbo() != null) Habbo.OnDisconnect(); CurrentRoomUserID = -1; this.MessageHandler = null; this.Habbo = null; this.Connection = null; }