public void Parse(HabboHotel.GameClients.GameClient Session, ClientPacket Packet) { if (!NeonEnvironment.GetGame().GetRoomManager().TryGetRoom(Session.GetHabbo().CurrentRoomId, out Room Room)) { return; } RoomUser User = Room.GetRoomUserManager().GetRoomUserByHabbo(Session.GetHabbo().Id); if (User == null) { return; } if (User.IsAsleep) { return; } User.UnIdle(); int X = Packet.PopInt(); int Y = Packet.PopInt(); if ((X == User.X && Y == User.Y) || User.IsWalking || User.RidingHorse) { return; } int Rot = Rotation.Calculate(User.X, User.Y, X, Y); User.SetRot(Rot, false); User.UpdateNeeded = true; if (User.RidingHorse) { RoomUser Horse = Session.GetHabbo().CurrentRoom.GetRoomUserManager().GetRoomUserByVirtualId(User.HorseID); if (Horse != null) { Horse.SetRot(Rot, false); Horse.UpdateNeeded = true; } } }
public void Parse(HabboHotel.GameClients.GameClient Session, ClientPacket Packet) { int itemId = Packet.PopInt(); string locationData = Packet.PopString(); if (!Session.GetHabbo().InRoom) { return; } if (!NeonEnvironment.GetGame().GetRoomManager().TryGetRoom(Session.GetHabbo().CurrentRoomId, out Room Room)) { return; } if (!Room.CheckRights(Session)) { return; } Item Item = Session.GetHabbo().GetInventoryComponent().GetItem(itemId); if (Item == null) { return; } try { string WallPossition = WallPositionCheck(":" + locationData.Split(':')[1]); Item RoomItem = new Item(Item.Id, Room.RoomId, Item.BaseItem, Item.ExtraData, 0, 0, 0, 0, Session.GetHabbo().Id, Item.GroupId, 0, 0, WallPossition, Room); if (Room.GetRoomItemHandler().SetWallItem(Session, RoomItem)) { Session.GetHabbo().GetInventoryComponent().RemoveItem(itemId); } } catch { //TODO: Send a packet return; } }
public void Parse(HabboHotel.GameClients.GameClient Session, ClientPacket Packet) { int itemId = Packet.PopInt(); if (!NeonEnvironment.GetGame().GetRoomManager().TryGetRoom(Session.GetHabbo().CurrentRoomId, out Room room)) { return; } if (room == null || room.GetRoomItemHandler() == null) { return; } Item item = room.GetRoomItemHandler().GetItem(itemId); if (item == null) { return; } if (!NeonEnvironment.GetGame().GetRentableSpaceManager().GetRentableSpaceItem(itemId, out RentableSpaceItem _rentableSpace)) { return; } int errorCode = NeonEnvironment.GetGame().GetRentableSpaceManager().GetCancelErrorCode(Session, _rentableSpace); if (errorCode > 0) { Session.SendMessage(new RentableSpaceComposer(_rentableSpace.IsRented(), errorCode, _rentableSpace.OwnerId, _rentableSpace.OwnerUsername, _rentableSpace.GetExpireSeconds(), _rentableSpace.Price)); return; } if (!NeonEnvironment.GetGame().GetRentableSpaceManager().ConfirmCancel(Session, _rentableSpace)) { Session.SendNotification("global.error"); return; } Session.SendMessage(new RentableSpaceComposer(false, 0, 0, "", 0, _rentableSpace.Price)); }
public void Parse(HabboHotel.GameClients.GameClient Session, ClientPacket Packet) { int itemId = Packet.PopInt(); if (!NeonEnvironment.GetGame().GetRoomManager().TryGetRoom(Session.GetHabbo().CurrentRoomId, out Room room)) { return; } if (room == null || room.GetRoomItemHandler() == null) { return; } if (NeonEnvironment.GetGame().GetRentableSpaceManager().GetRentableSpaceItem(itemId, out RentableSpaceItem rsi)) { NeonEnvironment.GetGame().GetRentableSpaceManager().ConfirmBuy(Session, rsi, 3600); } }
public void Parse(HabboHotel.GameClients.GameClient Session, ClientPacket Packet) { int Songs = Packet.PopInt(); List <SongData> SongData = new List <SongData>(); for (int i = 0; i < Songs; i++) { int Pint = Packet.PopInt(); SongData item = NeonEnvironment.GetGame().GetMusicManager().GetSong(Pint); if (item != null) { SongData.Add(item); } } Session.SendMessage(new GetMusicDataComposer(SongData)); }
public void Parse(HabboHotel.GameClients.GameClient Session, ClientPacket Packet) { int roomID = Packet.PopInt(); if (roomID == 0) { return; } RoomData Data = NeonEnvironment.GetGame().GetRoomManager().GenerateRoomData(roomID); if (Data == null) { return; } Session.GetHabbo().HomeRoom = roomID; Session.SendMessage(new NavigatorSettingsComposer(roomID)); }
public void Execute(GameClient Session, Room Room, string[] Params) { if (Params.Length == 0) { Session.SendWhisper("Por favor introduce un nombre de usuario para premiar.", 34); return; } GameClient Target = NeonEnvironment.GetGame().GetClientManager().GetClientByUsername(Params[1]); if (Target == null) { Session.SendWhisper("Oops, No se ha conseguido este usuario!"); return; } Target.SendMessage(NeonEnvironment.GetGame().GetNuxUserGiftsManager().NuxUserGifts.Serialize()); Session.SendWhisper("Has activado correctamente el premio especial para " + Target.GetHabbo().Username, 34); }
public void Parse(GameClient Session, ClientPacket Packet) { if (Session == null || Session.GetHabbo() == null || !Session.GetHabbo().GetPermissions().HasRight("mod_alert")) { return; } int UserId = Packet.PopInt(); string Message = Packet.PopString(); GameClient Client = NeonEnvironment.GetGame().GetClientManager().GetClientByUserID(UserId); if (Client == null) { return; } Client.SendNotification(Message); }
public void OnStatusChanged(bool notification) { if (GetClient() == null || GetClient().GetHabbo() == null || GetClient().GetHabbo().GetMessenger() == null) { return; } if (_friends == null) { return; } IEnumerable <GameClient> onlineUsers = NeonEnvironment.GetGame().GetClientManager().GetClientsById(_friends.Keys); if (onlineUsers.Count() == 0) { return; } foreach (GameClient client in onlineUsers.ToList()) { try { if (client == null || client.GetHabbo() == null || client.GetHabbo().GetMessenger() == null) { continue; } client.GetHabbo().GetMessenger().UpdateFriend(_userId, client, true); if (this == null || client == null || client.GetHabbo() == null) { continue; } UpdateFriend(client.GetHabbo().Id, client, notification); } catch { continue; } } }
public CommunityGoalComposer() : base(ServerPacketHeader.CommunityGoalComposer) { int VOTE_LONG = NeonEnvironment.GetGame().GetCommunityGoalVS().GetLeftVotes(); int VOTE_SHORT = NeonEnvironment.GetGame().GetCommunityGoalVS().GetRightVotes(); base.WriteBoolean(false); // Achieved? base.WriteInteger(0); // personalContributionScore (Si no es 0 no se muestran los botones) base.WriteInteger(0); // User Rank base.WriteInteger(1); // totalAmount Parts | En cuantas partes se divide la votación. //base.WriteInteger(getCommunityHighestAchievedLevel(VOTE_LONG, VOTE_SHORT)); // communityHighestAchievedLevel (nivel en el que está la flecha. De -3 a 3) base.WriteInteger(2); base.WriteInteger(VOTE_LONG > VOTE_SHORT ? -1 : 1); // scoreRemainingUntilNextLevel (puntuación restante hasta el siguiente nivel) base.WriteInteger(getPercentCompletionTowardsNextLevel(VOTE_LONG, VOTE_SHORT)); // percentCompletionTowardsNextLevel (porcentaje completado hasta el siguiente nivel) base.WriteString(NeonEnvironment.GetGame().GetCommunityGoalVS().GetName()); base.WriteInteger(0); // countdown_widget | 0 = disable, > 0 = enable base.WriteInteger(0); // Número de premios disponibles. // base.WriteInteger(2); // Número de ganadores (ganador 1, 2, 3...) }
public void Dispose() { int length = _rooms.Count; int i = 0; foreach (Room Room in _rooms.Values.ToList()) { if (Room == null) { continue; } NeonEnvironment.GetGame().GetRoomManager().UnloadRoom(Room); Console.Clear(); log.Info("<<- SERVER SHUTDOWN ->> ROOM ITEM SAVE: " + string.Format("{0:0.##}", ((double)i / length) * 100) + "%"); i++; } log.Info("Salas Guardadas correctamente!"); }
public void Execute(GameClients.GameClient Session, Rooms.Room Room, string[] Params) { if (Params.Length == 1) { Session.SendWhisper("Introduce el nombre correctamente."); return; } GameClient TargetClient = NeonEnvironment.GetGame().GetClientManager().GetClientByUsername(Params[1]); if (TargetClient == null) { Session.SendWhisper("Ocurrio un error, escribe correctamente el nombre o el usuario no se encuentra online."); return; } if (TargetClient.GetHabbo().CurrentRoom == Session.GetHabbo().CurrentRoom) { Session.SendWhisper("Hey! Abre los ojos, el usuario " + TargetClient.GetHabbo().Username + " esta en esta sala!"); return; } if (TargetClient.GetHabbo().Username == Session.GetHabbo().Username) { Session.SendWhisper("Sadooooooooo!"); return; } if (!TargetClient.GetHabbo().InRoom) { Session.SendWhisper("El no esta en ninguna sala"); return; } if (TargetClient.GetHabbo().CurrentRoom.Access != RoomAccess.OPEN && !Session.GetHabbo().GetPermissions().HasRight("mod_tool")) { Session.SendWhisper("Oops, el usuario esta en una sala cerrada con timbre o contraseña, no puedes seguirlo!"); return; } Session.GetHabbo().PrepareRoom(TargetClient.GetHabbo().CurrentRoom.RoomId, ""); }
public void Execute(GameClients.GameClient Session, Rooms.Room Room, string[] Params) { RoomUser User = Room.GetRoomUserManager().GetRoomUserByHabbo(Session.GetHabbo().Id); if (!Room.CheckRights(Session, true)) { Session.SendWhisper("You can only reset a scoreboard in a room you own!"); return; } //Unload the Room if (!NeonEnvironment.GetGame().GetRoomManager().TryGetRoom(Room.Id, out Room R)) { return; } List <RoomUser> UsersToReturn = Room.GetRoomUserManager().GetRoomUsers().ToList(); NeonEnvironment.GetGame().GetNavigator().Init(); NeonEnvironment.GetGame().GetRoomManager().UnloadRoom(R, true); foreach (RoomUser User2 in UsersToReturn) { if (User2 == null || User2.GetClient() == null) { continue; } Task.Run(async delegate { await Task.Delay(1000); User.GetClient().SendMessage(new RoomForwardComposer(Room.Id)); using (IQueryAdapter Adapter = NeonEnvironment.GetDatabaseManager().GetQueryReactor()) { Adapter.SetQuery("DELETE FROM `wired_scorebord` WHERE(`roomid`= @roomid)"); Adapter.AddParameter("roomid", Room.Id); Adapter.RunQuery(); } }); Session.SendMessage(new RoomNotificationComposer("Scoreboard Alert", "\rYou have just reset your scoreboards!\r\n<i>Scoreboard Reset!</i>", $"figure/{Session.GetHabbo().Look}&head_direction=3&action=wav&gesture=sml&direction=2", "OK!", "event:close")); } }
public void Execute(GameClient Session, Room Room, string[] Params) { if (Params.Length == 1) { Session.SendWhisper("Por favor, debe introducir el nombre del usuario al cual se le quiere cambiar el nombre"); return; } GameClient TargetClient = NeonEnvironment.GetGame().GetClientManager().GetClientByUsername(Params[1]); if (TargetClient == null) { Session.SendWhisper("Ha ocurrido un problema mientras se buscaba al usuario, o quizas no esta online"); return; } else if (TargetClient.GetHabbo()._changename != 1) { Session.SendNotification("El usuario " + TargetClient.GetHabbo().Username + " no puede recibir el cambio de nombre, a causa de que ya ha agotado el cambio permitido."); TargetClient.SendNotification("¡Vaya!, uno de nuestros staffs ha intentado cambiarte el nombre, pero como lo has cambiado hace menos de un mes, no podemos proceder a tu cambio, si lo deseas, puedes comprar un cambio adicional dentro del catálogo"); return; } else if (TargetClient.GetHabbo().GetPermissions().HasRight("mod_tool")) { Session.SendWhisper("Usted no puede elegir un nombre."); return; } else { TargetClient.GetHabbo().LastNameChange = 0; TargetClient.GetHabbo().ChangingName = true; TargetClient.SendNotification("Por favor se ha determinado que su nombre de usuario no es correcto o es inapropiado\r\rUn staff ha decidido darte una oportunidad para que puedas cambiar tu nombre, asi podrias evitar una expulsion del hotel.\r\rCierra esta ventana, y has clic sobre ti mismo y te saldra la opcion de cambiar nombre, Cambiatelo! \n\n <b><u>Recuerda que solo posees un cambio de nombre, piensa bien antes de elegirlo</b></u>"); using (IQueryAdapter dbClient = NeonEnvironment.GetDatabaseManager().GetQueryReactor()) { dbClient.RunQuery("UPDATE users SET changename = '0' WHERE id = " + TargetClient.GetHabbo().Id + ""); } TargetClient.GetHabbo()._changename = 0; TargetClient.SendMessage(new UserObjectComposer(TargetClient.GetHabbo())); } }
public UserCache GenerateUser(int Id) { UserCache User = null; if (_usersCached.ContainsKey(Id)) { if (TryGetUser(Id, out User)) { return(User); } } GameClient Client = NeonEnvironment.GetGame().GetClientManager().GetClientByUserID(Id); if (Client != null) { if (Client.GetHabbo() != null) { User = new UserCache(Id, Client.GetHabbo().Username, Client.GetHabbo().Motto, Client.GetHabbo().Look); _usersCached.TryAdd(Id, User); return(User); } } using (IQueryAdapter dbClient = NeonEnvironment.GetDatabaseManager().GetQueryReactor()) { dbClient.SetQuery("SELECT `username`, `motto`, `look` FROM users WHERE id = @id LIMIT 1"); dbClient.AddParameter("id", Id); DataRow dRow = dbClient.getRow(); if (dRow != null) { User = new UserCache(Id, dRow["username"].ToString(), dRow["motto"].ToString(), dRow["look"].ToString()); _usersCached.TryAdd(Id, User); } dRow = null; } return(User); }
public void Parse(GameClient Session, ClientPacket Packet) { if (!Session.GetHabbo().InRoom) { return; } if (!NeonEnvironment.GetGame().GetRoomManager().TryGetRoom(Session.GetHabbo().CurrentRoomId, out Room Room)) { return; } if (!Room.CheckRights(Session, false)) { return; } if (Room.UsersWithRights.Contains(Session.GetHabbo().Id)) { RoomUser User = Room.GetRoomUserManager().GetRoomUserByHabbo(Session.GetHabbo().Id); if (User != null && !User.IsBot) { User.RemoveStatus("flatctrl 1"); User.UpdateNeeded = true; User.GetClient().SendMessage(new YouAreNotControllerComposer()); } using (IQueryAdapter dbClient = NeonEnvironment.GetDatabaseManager().GetQueryReactor()) { dbClient.SetQuery("DELETE FROM `room_rights` WHERE `user_id` = @uid AND `room_id` = @rid LIMIT 1"); dbClient.AddParameter("uid", Session.GetHabbo().Id); dbClient.AddParameter("rid", Room.Id); dbClient.RunQuery(); } if (Room.UsersWithRights.Contains(Session.GetHabbo().Id)) { Room.UsersWithRights.Remove(Session.GetHabbo().Id); } } }
public void OnTrigger(GameClients.GameClient Session, Item Item, int Request, bool HasRights) { if (Session == null || Session.GetHabbo() == null || Item == null) { return; } Room Room = Session.GetHabbo().CurrentRoom; if (Room == null) { return; } RoomUser Actor = Room.GetRoomUserManager().GetRoomUserByHabbo(Session.GetHabbo().Id); if (Actor == null) { return; } if (Gamemap.TileDistance(Actor.X, Actor.Y, Item.GetX, Item.GetY) > 2) { return; } if (Actor.CurrentEffect == 5) { int count = int.Parse(Item.ExtraData); if (count < 5) { count++; Item.ExtraData = count + ""; Item.UpdateState(true, true); } if (count == 5) { NeonEnvironment.GetGame().GetAchievementManager().ProgressAchievement(Actor.GetClient(), "ACH_ViciousViking", 1); } return; } }
public void Execute(GameClients.GameClient Session, Rooms.Room Room, string[] Params) { if (Params.Length == 1) { Session.SendWhisper("Por favor escribe el mensaje a enviar"); return; } string Message = CommandManager.MergeParams(Params, 1); if (NeonEnvironment.GetDBConfig().DBData["hotel.name"] == "Habbi") { NeonEnvironment.GetGame().GetClientManager().SendMessage(new RoomNotificationComposer("Mensaje de " + Session.GetHabbo().Username + ":", "<font size =\"11\">Querido usuario de " + NeonEnvironment.GetDBConfig().DBData["hotel.name"] + ", el usuario " + Session.GetHabbo().Username + " tiene un mensaje para todo el hotel:</font><br><br><font size =\"11\" color=\"#B40404\">" + Message + "</font><br><br><font size =\"10\" color=\"#0B4C5F\">Recuerda estar atent@ a las redes sociales para mantenerte siempre al d\x00eda de las actualizaciones en Habbi Hotel:<br><br><b>FACEBOOK</b>: @EsHabbiHotel<br><b>TWITTER</b>: @EsHabbi<br><b>INSTAGRAM:</b> @EsHabbi</font>", "alertz", "")); } else { NeonEnvironment.GetGame().GetClientManager().SendMessage(new BroadcastMessageAlertComposer(NeonEnvironment.GetGame().GetLanguageLocale().TryGetValue("hotelalert_text") + Message + "\r\n- " + Session.GetHabbo().Username, "")); } return; }
public void Parse(HabboHotel.GameClients.GameClient Session, ClientPacket Packet) { if (Session == null || Session.GetHabbo() == null || !Session.GetHabbo().GetPermissions().HasRight("mod_tool")) { return; } int Amount = Packet.PopInt(); for (int i = 0; i < Amount; i++) { if (!NeonEnvironment.GetGame().GetModerationManager().TryGetTicket(Packet.PopInt(), out ModerationTicket Ticket)) { continue; } Ticket.Moderator = null; NeonEnvironment.GetGame().GetClientManager().SendMessage(new ModeratorSupportTicketComposer(Session.GetHabbo().Id, Ticket), "mod_tool"); } }
public static Bot CreateBot(ItemData Data, int OwnerId) { DataRow BotData = null; if (!NeonEnvironment.GetGame().GetCatalog().TryGetBot(Data.Id, out CatalogBot CataBot)) { return(null); } using (IQueryAdapter dbClient = NeonEnvironment.GetDatabaseManager().GetQueryReactor()) { dbClient.SetQuery("INSERT INTO bots (`user_id`,`name`,`motto`,`look`,`gender`,`ai_type`) VALUES ('" + OwnerId + "', '" + CataBot.Name + "', '" + CataBot.Motto + "', '" + CataBot.Figure + "', '" + CataBot.Gender + "', '" + CataBot.AIType + "')"); int Id = Convert.ToInt32(dbClient.InsertQuery()); dbClient.SetQuery("SELECT `id`,`user_id`,`name`,`motto`,`look`,`gender` FROM `bots` WHERE `user_id` = '" + OwnerId + "' AND `id` = '" + Id + "' LIMIT 1"); BotData = dbClient.getRow(); } return(new Bot(Convert.ToInt32(BotData["id"]), Convert.ToInt32(BotData["user_id"]), Convert.ToString(BotData["name"]), Convert.ToString(BotData["motto"]), Convert.ToString(BotData["look"]), Convert.ToString(BotData["gender"]))); }
public SupportTicket(int Id, int Score, int Type, int SenderId, int ReportedId, string Message, int RoomId, string RoomName, double Timestamp, List <string> ReportedChats) { this.Id = Id; this.Score = Score; this.Type = Type; Status = TicketStatus.OPEN; this.SenderId = SenderId; this.ReportedId = ReportedId; ModeratorId = 0; this.Message = Message; this.RoomId = RoomId; this.RoomName = RoomName; this.Timestamp = Timestamp; this.ReportedChats = ReportedChats; SenderName = NeonEnvironment.GetGame().GetClientManager().GetNameById(SenderId); ReportedName = NeonEnvironment.GetGame().GetClientManager().GetNameById(ReportedId); ModName = NeonEnvironment.GetGame().GetClientManager().GetNameById(ModeratorId); }
public void Parse(HabboHotel.GameClients.GameClient Session, ClientPacket Packet) { if (Session == null || Session.GetHabbo() == null || !Session.GetHabbo().InRoom) { return; } if (!NeonEnvironment.GetGame().GetRoomManager().TryGetRoom(Session.GetHabbo().CurrentRoomId, out Room Room)) { return; } if (!Room.CanTradeInRoom) { return; } Room.TryStopTrade(Session.GetHabbo().Id); }
public void OnTrigger(GameClients.GameClient Session, Item Item, int Request, bool HasRights) { if (Session == null || Session.GetHabbo() == null || Item == null) { return; } Room Room = Session.GetHabbo().CurrentRoom; if (Room == null) { return; } RoomUser Actor = Room.GetRoomUserManager().GetRoomUserByHabbo(Session.GetHabbo().Id); if (Actor == null) { return; } int tick = int.Parse(Item.ExtraData); if (tick < 1) { if (Gamemap.TileDistance(Actor.X, Actor.Y, Item.GetX, Item.GetY) < 2) { tick++; Item.ExtraData = tick.ToString(); Item.UpdateState(true, true); int X = Item.GetX, Y = Item.GetY, Rot = Item.Rotation; double Z = Item.GetZ; if (tick == 1) { NeonEnvironment.GetGame().GetPinataManager().ReceiveCrackableReward(Actor, Room, Item); NeonEnvironment.GetGame().GetAchievementManager().ProgressAchievement(Actor.GetClient(), "ACH_PinataWhacker", 1); NeonEnvironment.GetGame().GetAchievementManager().ProgressAchievement(Actor.GetClient(), "ACH_PinataBreaker", 1); } } } }
public void Parse(HabboHotel.GameClients.GameClient Session, ClientPacket Packet) { int ItemId = Packet.PopInt(); if (!NeonEnvironment.GetGame().GetRoomManager().TryGetRoom(Session.GetHabbo().CurrentRoomId, out Room room)) { return; } Item item = room.GetRoomItemHandler().GetItem(ItemId); if (item == null) { return; } if (item.GetBaseItem() == null) { return; } if (item.GetBaseItem().InteractionType != InteractionType.RENTABLE_SPACE) { return; } if (!NeonEnvironment.GetGame().GetRentableSpaceManager().GetRentableSpaceItem(ItemId, out RentableSpaceItem _rentableSpace)) { _rentableSpace = NeonEnvironment.GetGame().GetRentableSpaceManager().CreateAndAddItem(ItemId, Session); } if (_rentableSpace.Rented) { Session.SendMessage(new RentableSpaceComposer(_rentableSpace.OwnerId, _rentableSpace.OwnerUsername, _rentableSpace.GetExpireSeconds())); } else { int errorCode = NeonEnvironment.GetGame().GetRentableSpaceManager().GetButtonErrorCode(Session, _rentableSpace); Session.SendMessage(new RentableSpaceComposer(false, errorCode, -1, "", 0, _rentableSpace.Price)); } }
public void Parse(HabboHotel.GameClients.GameClient Session, ClientPacket Packet) { if (Session == null || Session.GetHabbo() == null || !Session.GetHabbo().InRoom) { return; } if (!NeonEnvironment.GetGame().GetRoomManager().TryGetRoom(Session.GetHabbo().CurrentRoomId, out Room Room)) { return; } RoomUser User = Room.GetRoomUserManager().GetRoomUserByHabbo(Session.GetHabbo().Id); if (User == null) { return; } RoomUser TargetUser = Room.GetRoomUserManager().GetRoomUserByHabbo(Packet.PopInt()); if (TargetUser == null) { return; } if (!((Math.Abs((User.X - TargetUser.X)) >= 3) || (Math.Abs((User.Y - TargetUser.Y)) >= 3)) || Session.GetHabbo().GetPermissions().HasRight("mod_tool")) { if (User.CarryItemID > 0 && User.CarryTimer > 0) { if (User.CarryItemID == 8) { NeonEnvironment.GetGame().GetQuestManager().ProgressUserQuest(Session, QuestType.GIVE_COFFEE); } TargetUser.CarryItem(User.CarryItemID); User.CarryItem(0); TargetUser.DanceId = 0; } } }
public void Parse(HabboHotel.GameClients.GameClient Session, ClientPacket Packet) { if (Session == null || Session.GetHabbo() == null) { return; } string HabboType = Packet.PopString(); if (HabboType != "HabboWay1") { return; } int HabboQuestions = Packet.PopInt(); List <int> errors = new List <int>(5); ServerPacket answer = new ServerPacket(ServerPacketHeader.PostQuizAnswersMessageComposer); answer.WriteString(HabboType); for (int i = 0; i < HabboQuestions; i++) { int QuestionId = Session.GetHabbo()._HabboQuizQuestions[i]; int respuesta = Packet.PopInt(); if (!Quiz.CorrectAnswer(QuestionId, respuesta)) { errors.Add(QuestionId); } } answer.WriteInteger(errors.Count); foreach (int error in errors) { answer.WriteInteger(error); } Session.SendMessage(answer); if (errors.Count == 0) { NeonEnvironment.GetGame().GetAchievementManager().ProgressAchievement(Session, "ACH_HabboWayGraduate", 1); } }
public void Parse(HabboHotel.GameClients.GameClient Session, ClientPacket Packet) { int GroupId = Packet.PopInt(); int UserId = Packet.PopInt(); if (!NeonEnvironment.GetGame().GetGroupManager().TryGetGroup(GroupId, out Group Group)) { return; } if ((Session.GetHabbo().Id != Group.CreatorId && !Group.IsAdmin(Session.GetHabbo().Id)) && !Session.GetHabbo().GetPermissions().HasRight("fuse_group_accept_any")) { return; } if (!Group.HasRequest(UserId)) { return; } Habbo Habbo = NeonEnvironment.GetHabboById(UserId); if (Habbo == null) { Session.SendNotification("Oops, ha recibido un error mientras recibe la busqueda de este usuario."); return; } Group.HandleRequest(UserId, true); if (Group.HasChat) { HabboHotel.GameClients.GameClient Client = NeonEnvironment.GetGame().GetClientManager().GetClientByUserID(UserId); if (Client != null) { Client.SendMessage(new FriendListUpdateComposer(Group, 1)); } } Session.SendMessage(new GroupMemberUpdatedComposer(GroupId, Habbo, 4)); }
public void Parse(GameClient Session, ClientPacket Packet) { int PageId = Packet.PopInt(); _ = Packet.PopInt(); string CataMode = Packet.PopString(); CatalogPage Page = null; if (CataMode == "NORMAL") { if (!NeonEnvironment.GetGame().GetCatalog().TryGetPage(PageId, out Page)) { return; } if (!Page.Enabled || !Page.Visible || Page.MinimumRank > Session.GetHabbo().CatRank || (Page.MinimumVIP > Session.GetHabbo().VIPRank&& Session.GetHabbo().Rank == 1)) { return; } Session.SendMessage(new CatalogPageComposer(Page, CataMode, Session)); } if (CataMode == "BUILDERS_CLUB") { if (!NeonEnvironment.GetGame().GetCatalog().TryGetBCPage(PageId, out BCCatalogPage BCPage)) { return; } if (!BCPage.Enabled || !BCPage.Visible || BCPage.MinimumRank > Session.GetHabbo().CatRank || (BCPage.MinimumVIP > Session.GetHabbo().VIPRank&& Session.GetHabbo().Rank == 1)) { return; } Session.SendMessage(new BCCatalogPageComposer(BCPage, CataMode)); } Session.GetHabbo().lastLayout = Page.Template; }
public bool TryGetForum(int Id, out GroupForum Forum) { if ((Forum = Forums.FirstOrDefault(c => c.Id == Id)) != null) { return(true); } if (!NeonEnvironment.GetGame().GetGroupManager().TryGetGroup(Id, out Group Gp)) { return(false); } if (!Gp.HasForum) { return(false); } Forum = new GroupForum(Gp); Forums.Add(Forum); return(true); }
public void Parse(GameClient Session, ClientPacket Packet) { int GameId = Packet.PopInt(); int weekNum = new GregorianCalendar(GregorianCalendarTypes.Localized).GetWeekOfYear(DateTime.Now, CalendarWeekRule.FirstFourDayWeek, DayOfWeek.Monday); int lastWeekNum = 0; if (weekNum == 1) { lastWeekNum = 52; } else { lastWeekNum = weekNum - 1; } if (NeonEnvironment.GetGame().GetGameDataManager().TryGetGame(GameId, out GameData GameData)) { } }