internal bool tryLogin(string AuthTicket) { 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; } if (Program.LicHandeler != null && ButterflyEnvironment.GetGame().GetClientManager().ClientCount > Program.LicHandeler.AmountOfSlots) { Program.LicHandeler.ReportFullServer(); SendBanMessage(LanguageLocale.GetValue("server.full")); return false; } ButterflyEnvironment.GetGame().GetClientManager().RegisterClient(this, userData.userID, userData.user.Username); this.Habbo = userData.user; userData.user.LoadData(userData); if (userData.user.Username == null) { SendBanMessage("You have no username."); return false; } string banReason = ButterflyEnvironment.GetGame().GetBanManager().GetBanReason(userData.user.Username, ip); if (!string.IsNullOrEmpty(banReason)) { SendBanMessage(banReason); return false; } userData.user.Init(this, userData); QueuedServerMessage response = new QueuedServerMessage(Connection); userData.user.SerializeQuests(ref response); List<string> Rights = ButterflyEnvironment.GetGame().GetRoleManager().GetRightsForHabbo(userData.user); ServerMessage appendingResponse = new ServerMessage(2); appendingResponse.Init(2); appendingResponse.AppendInt32(Rights.Count); foreach (string Right in Rights) { appendingResponse.AppendStringWithBreak(Right); } response.appendResponse(appendingResponse); if (userData.user.HasFuse("fuse_mod")) { response.appendResponse(ButterflyEnvironment.GetGame().GetModerationTool().SerializeTool()); ButterflyEnvironment.GetGame().GetModerationTool().SerializeOpenTickets(ref response, userData.userID); } response.appendResponse(userData.user.GetAvatarEffectsInventoryComponent().Serialize()); appendingResponse.Init(290); appendingResponse.AppendBoolean(true); appendingResponse.AppendBoolean(false); response.appendResponse(appendingResponse); appendingResponse.Init(3); response.appendResponse(appendingResponse); appendingResponse.Init(517); appendingResponse.AppendBoolean(true); response.appendResponse(appendingResponse); //if (PixelManager.NeedsUpdate(this)) // PixelManager.GivePixels(this); if (ButterflyEnvironment.GetGame().GetClientManager().pixelsOnLogin > 0) { PixelManager.GivePixels(this, ButterflyEnvironment.GetGame().GetClientManager().pixelsOnLogin); } if (ButterflyEnvironment.GetGame().GetClientManager().creditsOnLogin > 0) { userData.user.Credits += ButterflyEnvironment.GetGame().GetClientManager().creditsOnLogin; userData.user.UpdateCreditsBalance(); } if (userData.user.HomeRoom > 0) { appendingResponse.Init(455); appendingResponse.AppendUInt(userData.user.HomeRoom); response.appendResponse(appendingResponse); } appendingResponse.Init(458); appendingResponse.AppendInt32(30); appendingResponse.AppendInt32(userData.user.FavoriteRooms.Count); foreach (uint Id in userData.user.FavoriteRooms.ToArray()) { appendingResponse.AppendUInt(Id); } response.appendResponse(appendingResponse); if (userData.user.HasFuse("fuse_use_club_badge") && !userData.user.GetBadgeComponent().HasBadge("ACH_BasicClub1")) { userData.user.GetBadgeComponent().GiveBadge("ACH_BasicClub1", true); } else if (!userData.user.HasFuse("fuse_use_club_badge") && userData.user.GetBadgeComponent().HasBadge("ACH_BasicClub1")) { userData.user.GetBadgeComponent().RemoveBadge("ACH_BasicClub1"); } if (!userData.user.GetBadgeComponent().HasBadge("Z63")) userData.user.GetBadgeComponent().GiveBadge("Z63", true); appendingResponse.Init(2); appendingResponse.AppendInt32(0); if (userData.user.HasFuse("fuse_use_vip_outfits")) // VIP appendingResponse.AppendInt32(2); else if (userData.user.HasFuse("fuse_furni_chooser")) // HC appendingResponse.AppendInt32(1); else appendingResponse.AppendInt32(0); appendingResponse.AppendInt32(0); response.appendResponse(appendingResponse); appendingResponse.Init(2); appendingResponse.AppendInt32(Rights.Count); foreach (string Right in Rights) { appendingResponse.AppendStringWithBreak(Right); } response.appendResponse(appendingResponse); if (LanguageLocale.welcomeAlertEnabled) { ServerMessage alert = new ServerMessage(810); alert.AppendUInt(1); alert.AppendStringWithBreak(LanguageLocale.welcomeAlert); response.appendResponse(alert); } response.sendResponse(); Logging.WriteLine("[" + Habbo.Username + "] logged in"); return true; } catch (UserDataNotFoundException e) { SendNotifWithScroll(LanguageLocale.GetValue("login.invalidsso") + "extra data: " + e.ToString()); } catch (Exception e) { //Logging.LogCriticalException("Invalid Dario bug duing user login: "******"Login error: " + e.ToString()); SendNotifWithScroll("Login error: " + e.ToString()); } return false; }
internal void GetRoomData3() { if (Session.GetHabbo().LoadingRoom <= 0 || !Session.GetHabbo().LoadingChecksPassed || CurrentLoadingRoom == null) { return; } if (CurrentLoadingRoom.UsersNow + 1 > CurrentLoadingRoom.UsersMax && !Session.GetHabbo().HasFuse("fuse_enter_full_rooms")) { Session.SendNotif(LanguageLocale.GetValue("room.roomfull")); return; } ClearRoomLoading(); QueuedServerMessage response = new QueuedServerMessage(Session.GetConnection()); Response.Init(30); if (!string.IsNullOrEmpty(CurrentLoadingRoom.GetGameMap().StaticModel.StaticFurniMap)) { Response.AppendStringWithBreak(CurrentLoadingRoom.GetGameMap().StaticModel.StaticFurniMap); } else { Response.AppendInt32(0); } response.appendResponse(GetResponse()); //SendResponse(); if (CurrentLoadingRoom.Type == "private") { RoomItem[] floorItems = CurrentLoadingRoom.GetRoomItemHandler().mFloorItems.Values.ToArray(); RoomItem[] wallItems = CurrentLoadingRoom.GetRoomItemHandler().mWallItems.Values.ToArray(); Response.Init(32); Response.AppendInt32(floorItems.Length); foreach (RoomItem Item in floorItems) Item.Serialize(Response); response.appendResponse(GetResponse()); Response.Init(45); Response.AppendInt32(wallItems.Length); foreach (RoomItem Item in wallItems) Item.Serialize(Response); response.appendResponse(GetResponse()); Array.Clear(floorItems, 0, floorItems.Length); Array.Clear(wallItems, 0, wallItems.Length); floorItems = null; wallItems = null; } response.sendResponse(); CurrentLoadingRoom.GetRoomUserManager().AddUserToRoom(Session, Session.GetHabbo().SpectatorMode); }
internal void GetRoomData2() { try { QueuedServerMessage message = new QueuedServerMessage(Session.GetConnection()); if (Session.GetHabbo().LoadingRoom <= 0 || CurrentLoadingRoom == null) return; RoomData Data = CurrentLoadingRoom.RoomData;//ButterflyEnvironment.GetGame().GetRoomManager().GenerateRoomData(Session.GetHabbo().LoadingRoom); if (Data == null) { return; } if (Data.Model == null) { Session.SendNotif(LanguageLocale.GetValue("room.missingmodeldata")); Session.SendMessage(new ServerMessage(18)); ClearRoomLoading(); return; } //CurrentLoadingRoom = ButterflyEnvironment.GetGame().GetRoomManager().GetRoom(Session.GetHabbo().LoadingRoom); message.appendResponse(CurrentLoadingRoom.GetGameMap().Model.GetHeightmap()); message.appendResponse(CurrentLoadingRoom.GetGameMap().Model.SerializeRelativeHeightmap()); message.sendResponse(); //Session.SendMessage(CurrentLoadingRoom.Model.GetHeightmap()); //Session.SendMessage(CurrentLoadingRoom.Model.SerializeRelativeHeightmap()); } catch (Exception e) { Logging.LogException("Unable to load room ID [" + Session.GetHabbo().LoadingRoom + "] " + e.ToString()); Session.SendNotif(LanguageLocale.GetValue("room.roomdataloaderror")); } }
internal void GetInventory() { QueuedServerMessage response = new QueuedServerMessage(Session.GetConnection()); response.appendResponse(Session.GetHabbo().GetInventoryComponent().SerializeFloorItemInventory()); response.appendResponse(Session.GetHabbo().GetInventoryComponent().SerializeWallItemInventory()); response.sendResponse(); }
internal void PrepareRoomForUser(uint Id, string Password) { ClearRoomLoading(); QueuedServerMessage response = new QueuedServerMessage(Session.GetConnection()); if (ButterflyEnvironment.ShutdownStarted) { Session.SendNotif(LanguageLocale.GetValue("shutdown.alert")); return; } if (Session.GetHabbo().InRoom) { Room OldRoom = ButterflyEnvironment.GetGame().GetRoomManager().GetRoom(Session.GetHabbo().CurrentRoomId); if (OldRoom != null) { OldRoom.GetRoomUserManager().RemoveUserFromRoom(Session, false, false); Session.CurrentRoomUserID = -1; } } Room Room = ButterflyEnvironment.GetGame().GetRoomManager().LoadRoom(Id); if (Room == null || Session == null || Session.GetHabbo() == null) return; if (Session.GetHabbo().IsTeleporting && Session.GetHabbo().TeleportingRoomID != Id) return; Session.GetHabbo().LoadingRoom = Id; CurrentLoadingRoom = Room; if (!Session.GetHabbo().HasFuse("fuse_enter_any_room") && Room.UserIsBanned(Session.GetHabbo().Id)) { if (Room.HasBanExpired(Session.GetHabbo().Id)) { Room.RemoveBan(Session.GetHabbo().Id); } else { // C`PA Response.Init(224); Response.AppendInt32(4); //SendResponse();//****** response.appendResponse(GetResponse()); Response.Init(18); //SendResponse();//****** response.appendResponse(GetResponse()); response.sendResponse(); return; } } if (Room.UsersNow >= Room.UsersMax && !Session.GetHabbo().HasFuse("fuse_enter_full_rooms")) { if (!ButterflyEnvironment.GetGame().GetRoleManager().RankHasRight(Session.GetHabbo().Rank, "fuse_enter_full_rooms")) { Response.Init(224); Response.AppendInt32(1); //SendResponse();//****** response.appendResponse(GetResponse()); Response.Init(18); //SendResponse();//****** response.appendResponse(GetResponse()); response.sendResponse(); return; } } if (Room.Type == "public") { if (Room.State > 0 && !Session.GetHabbo().HasFuse("fuse_mod")) { Session.SendNotif(LanguageLocale.GetValue("room.noaccess")); Response.Init(18); //SendResponse();//****** response.appendResponse(GetResponse()); response.sendResponse(); return; } Response.Init(166); Response.AppendStringWithBreak("/client/public/" + Room.ModelName + "/0"); //SendResponse();//****** response.appendResponse(GetResponse()); } else if (Room.Type == "private") { Response.Init(19); //SendResponse();//****** response.appendResponse(GetResponse()); if (!Session.GetHabbo().HasFuse("fuse_enter_any_room") && !Room.CheckRights(Session, true) && !Session.GetHabbo().IsTeleporting) { if (Room.State == 1) { if (Room.UserCount == 0) { Response.Init(131); //SendResponse();//****** response.appendResponse(GetResponse()); } else { Response.Init(91); Response.AppendStringWithBreak(""); //SendResponse();//****** response.appendResponse(GetResponse()); ServerMessage RingMessage = new ServerMessage(91); RingMessage.AppendStringWithBreak(Session.GetHabbo().Username); Room.SendMessageToUsersWithRights(RingMessage); } response.sendResponse(); return; } else if (Room.State == 2) { if (Password.ToLower() != Room.Password.ToLower()) { Response.Init(33); Response.AppendInt32(-100002); //SendResponse();//****** response.appendResponse(GetResponse()); Response.Init(18); //SendResponse();//****** response.appendResponse(GetResponse()); response.sendResponse(); return; } } } Response.Init(166); Response.AppendStringWithBreak("/client/internal/" + Room.RoomId + "/id"); //SendResponse(); //****** response.appendResponse(GetResponse()); } Session.GetHabbo().LoadingChecksPassed = true; response.addBytes(LoadRoomForUser().getPacket); //LoadRoomForUser(); response.sendResponse(); }
internal void OnRoomUserAdd() { QueuedServerMessage response = new QueuedServerMessage(Session.GetConnection()); List<RoomUser> UsersToDisplay = new List<RoomUser>(); if (CurrentLoadingRoom == null) return; foreach (RoomUser User in CurrentLoadingRoom.GetRoomUserManager().UserList.Values) { if (User.IsSpectator) continue; UsersToDisplay.Add(User); } Response.Init(28); Response.AppendInt32(UsersToDisplay.Count); foreach (RoomUser User in UsersToDisplay) { User.Serialize(Response, CurrentLoadingRoom.GetGameMap().gotPublicPool); } response.appendResponse(GetResponse()); GetResponse().Init(472); GetResponse().AppendBoolean(CurrentLoadingRoom.Hidewall); GetResponse().AppendInt32(CurrentLoadingRoom.WallThickness); GetResponse().AppendInt32(CurrentLoadingRoom.FloorThickness); response.appendResponse(GetResponse()); if (CurrentLoadingRoom.Type == "public") { Response.Init(471); Response.AppendBoolean(false); Response.AppendStringWithBreak(CurrentLoadingRoom.ModelName, "room modelname"); Response.AppendBoolean(false); response.appendResponse(GetResponse()); } else if (CurrentLoadingRoom.Type == "private") { Response.Init(471); Response.AppendBoolean(true); Response.AppendUInt(CurrentLoadingRoom.RoomId); if (CurrentLoadingRoom.CheckRights(Session, true)) { Response.AppendBoolean(true); } else { Response.AppendBoolean(false); } response.appendResponse(GetResponse()); // GQhntX]uberEmu PacketloggingDescriptionHQMSCQFJtag1tag2Ika^SMqurbIHH Response.Init(454); Response.AppendInt32(1); Response.AppendUInt(CurrentLoadingRoom.RoomId); Response.AppendInt32(0); Response.AppendStringWithBreak(CurrentLoadingRoom.Name); Response.AppendStringWithBreak(CurrentLoadingRoom.Owner); Response.AppendInt32(CurrentLoadingRoom.State); Response.AppendInt32(0); Response.AppendInt32(25); Response.AppendStringWithBreak(CurrentLoadingRoom.Description); Response.AppendInt32(0); Response.AppendInt32(1); Response.AppendInt32(8228); Response.AppendInt32(CurrentLoadingRoom.Category); Response.AppendStringWithBreak(""); Response.AppendInt32(CurrentLoadingRoom.TagCount); foreach (string Tag in CurrentLoadingRoom.Tags.ToArray()) { Response.AppendStringWithBreak(Tag); } CurrentLoadingRoom.Icon.Serialize(Response); Response.AppendBoolean(false); response.appendResponse(GetResponse()); } ServerMessage Updates = CurrentLoadingRoom.GetRoomUserManager().SerializeStatusUpdates(true); if (Updates != null) { //Session.SendMessage(Updates); response.appendResponse(Updates); } foreach (RoomUser User in CurrentLoadingRoom.GetRoomUserManager().UserList.Values) { if (User.IsSpectator) continue; if (User.IsDancing) { Response.Init(480); Response.AppendInt32(User.VirtualId); Response.AppendInt32(User.DanceId); response.appendResponse(GetResponse()); } if (User.IsAsleep) { Response.Init(486); Response.AppendInt32(User.VirtualId); Response.AppendBoolean(true); response.appendResponse(GetResponse()); } if (User.CarryItemID > 0 && User.CarryTimer > 0) { Response.Init(482); Response.AppendInt32(User.VirtualId); Response.AppendInt32(User.CarryTimer); response.appendResponse(GetResponse()); } if (!User.IsBot) { try { if (User.GetClient() != null && User.GetClient().GetHabbo() != null && User.GetClient().GetHabbo().GetAvatarEffectsInventoryComponent() != null && User.GetClient().GetHabbo().GetAvatarEffectsInventoryComponent().CurrentEffect >= 1) { Response.Init(485); Response.AppendInt32(User.VirtualId); Response.AppendInt32(User.GetClient().GetHabbo().GetAvatarEffectsInventoryComponent().CurrentEffect); response.appendResponse(GetResponse()); } } catch (Exception e) { Logging.HandleException(e, "Rooms.SendRoomData3"); } } } response.sendResponse(); CurrentLoadingRoom = null; }