public void Parse(HabboHotel.GameClients.GameClient Session, ClientPacket Packet) { if (!Session.GetHabbo().InRoom) return; int PetId = Packet.PopInt(); RoomUser Pet = null; if (!Session.GetHabbo().CurrentRoom.GetRoomUserManager().TryGetPet(PetId, out Pet)) { //Okay so, we've established we have no pets in this room by this virtual Id, let us check out users, maybe they're creeping as a pet?! RoomUser User = Session.GetHabbo().CurrentRoom.GetRoomUserManager().GetRoomUserByHabbo(PetId); if (User == null) return; //Check some values first, please! if (User.GetClient() == null || User.GetClient().GetHabbo() == null) return; //And boom! Let us send the information composer 8-). Session.SendMessage(new PetInformationComposer(User.GetClient().GetHabbo())); return; } //Continue as a regular pet.. if (Pet.RoomId != Session.GetHabbo().CurrentRoomId || Pet.PetData == null) return; Session.SendMessage(new PetInformationComposer(Pet.PetData)); }
public void Parse(HabboHotel.GameClients.GameClient Session, ClientPacket Packet) { int CreditsOwed = 0; DataTable Table = null; using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor()) { dbClient.SetQuery("SELECT `asking_price` FROM `catalog_marketplace_offers` WHERE `user_id` = '" + Session.GetHabbo().Id + "' AND state = '2'"); Table = dbClient.getTable(); } if (Table != null) { foreach (DataRow row in Table.Rows) { CreditsOwed += Convert.ToInt32(row["asking_price"]); } if (CreditsOwed >= 1) { Session.GetHabbo().Credits += CreditsOwed; Session.SendMessage(new CreditBalanceComposer(Session.GetHabbo().Credits)); } using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor()) { dbClient.RunQuery("DELETE FROM `catalog_marketplace_offers` WHERE `user_id` = '" + Session.GetHabbo().Id + "' AND `state` = '2'"); } } }
public void Parse(HabboHotel.GameClients.GameClient Session, ClientPacket Packet) { if (Session == null || Session.GetHabbo() == null || Session.GetHabbo().GetMessenger() == null) return; int Amount = Packet.PopInt(); if (Amount > 50) Amount = 50; else if (Amount < 0) return; for (int i = 0; i < Amount; i++) { int RequestId = Packet.PopInt(); MessengerRequest Request = null; if (!Session.GetHabbo().GetMessenger().TryGetRequest(RequestId, out Request)) continue; if (Request.To != Session.GetHabbo().Id) return; if (!Session.GetHabbo().GetMessenger().FriendshipExists(Request.To)) Session.GetHabbo().GetMessenger().CreateFriendship(Request.From); Session.GetHabbo().GetMessenger().HandleRequest(RequestId); } }
public void Parse(HabboHotel.GameClients.GameClient Session, ClientPacket Packet) { int SlotId = Packet.PopInt(); string Look = PlusEnvironment.GetGame().GetAntiMutant().RunLook(Packet.PopString()); string Gender = Packet.PopString(); using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor()) { dbClient.SetQuery("SELECT null FROM `user_wardrobe` WHERE `user_id` = " + Session.GetHabbo().Id + " AND `slot_id` = @slot"); dbClient.AddParameter("slot", SlotId); if (dbClient.getRow() != null) { dbClient.SetQuery("UPDATE `user_wardrobe` SET `look` = @look, `gender` = @gender WHERE `user_id` = '" + Session.GetHabbo().Id + "' AND `slot_id` = @slot LIMIT 1"); dbClient.AddParameter("slot", SlotId); dbClient.AddParameter("look", Look); dbClient.AddParameter("gender", Gender.ToUpper()); dbClient.RunQuery(); } else { dbClient.SetQuery("INSERT INTO `user_wardrobe` (`user_id`,`slot_id`,`look`,`gender`) VALUES ('" + Session.GetHabbo().Id + "',@slot,@look,@gender)"); dbClient.AddParameter("slot", SlotId); dbClient.AddParameter("look", Look); dbClient.AddParameter("gender", Gender.ToUpper()); dbClient.RunQuery(); } } }
public void Parse(HabboHotel.GameClients.GameClient Session, Messages.ClientMessage Packet) { Silverwave.HabboHotel.Users.Habbo targetHabbo = Session.GetHabbo(); if (targetHabbo == null) { return; } uint Id = Packet.PopWiredUInt(); RoomData Data = SilverwaveEnvironment.GetGame().GetRoomManager().GenerateRoomData(Id); if (Data == null || Session.GetHabbo().FavoriteRooms.Count >= 30 || Session.GetHabbo().FavoriteRooms.Contains(Id)) { // send packet that favourites is full. return; } Session.GetHabbo().FavoriteRooms.Add(Id); Session.SendMessage(new UpdateFavouriteRoomComposer(Id, true)); using (IQueryAdapter dbClient = SilverwaveEnvironment.GetDatabaseManager().getQueryreactor()) { dbClient.runFastQuery("INSERT INTO user_favorites (user_id,room_id) VALUES (" + Session.GetHabbo().Id + "," + Id + ")"); } }
public void Parse(HabboHotel.GameClients.GameClient Session, ClientPacket Packet) { if (Session == null || Session.GetHabbo() == null || !Session.GetHabbo().InRoom) return; Room Room = null; if (!PlusEnvironment.GetGame().GetRoomManager().TryGetRoom(Session.GetHabbo().CurrentRoomId, out 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) PlusEnvironment.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; if (!Session.GetHabbo().InRoom) return; int ItemId = Packet.PopInt(); Session.SendMessage(new HideWiredConfigComposer()); Room Room = Session.GetHabbo().CurrentRoom; if (Room == null) return; Item SelectedItem = Room.GetRoomItemHandler().GetItem(ItemId); if (SelectedItem == null) return; IWiredItem Box = null; if (!Session.GetHabbo().CurrentRoom.GetWired().TryGet(ItemId, out Box)) return; if (Box.Type == WiredBoxType.EffectGiveUserBadge && !Session.GetHabbo().GetPermissions().HasRight("room_item_wired_rewards")) { Session.SendNotification("You don't have the correct permissions to do this."); return; } Box.HandleSave(Packet); Session.GetHabbo().CurrentRoom.GetWired().SaveBox(Box); }
public void Parse(HabboHotel.GameClients.GameClient Session, Messages.ClientMessage Packet) { Session.SendMessage(new UserObjectComposer(Session.GetHabbo())); Session.SendMessage(new UserPerksComposer()); Session.GetHabbo().InitMessenger(); // Temporary fixxx }
public void Handle(HabboHotel.GameClients.GameClient Session, global::Essential.Messages.ClientMessage Event) { using(DatabaseClient dbClient = Essential.GetDatabase().GetClient()) { string username = Event.PopFixedString(); string password = Event.PopFixedString(); //TODO: Hash undso.. dbClient.AddParamWithValue("username", username); string currentpassword = ""; try { currentpassword = dbClient.ReadString("SELECT password FROM users WHERE username=@username"); } catch { } if (currentpassword == "") { Session.SendMessage(new ServerMessage(Outgoing.InvalidUsername)); return; } if (currentpassword != password) { Session.SendMessage(new ServerMessage(Outgoing.InvalidPassword)); return; } ServerMessage asdf = new ServerMessage(12345); asdf.AppendBoolean(true); asdf.AppendString("Hi"); asdf.AppendInt32(1337); asdf.AppendUInt(12345); Session.SendMessage(asdf); Session.tryLogin(dbClient.ReadString("SELECT auth_ticket FROM users WHERE username=@username")); } }
public void Parse(HabboHotel.GameClients.GameClient Session, ClientPacket Packet) { if (!Session.GetHabbo().InRoom) return; Room Room = null; if (!PlusEnvironment.GetGame().GetRoomManager().TryGetRoom(Session.GetHabbo().CurrentRoomId, out Room)) return; if (!Room.CheckRights(Session)) return; Item Item = Room.GetRoomItemHandler().GetItem(Packet.PopInt()); if (Item == null) return; if (Item.GetBaseItem().InteractionType == InteractionType.POSTIT || Item.GetBaseItem().InteractionType == InteractionType.CAMERA_PICTURE) { Room.GetRoomItemHandler().RemoveFurniture(Session, Item.Id); using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor()) { dbClient.RunQuery("DELETE FROM `items` WHERE `id` = '" + Item.Id + "' LIMIT 1"); } } }
public void Parse(HabboHotel.GameClients.GameClient Session, ClientPacket Packet) { if (Session == null || Session.GetHabbo() == null || !Session.GetHabbo().InRoom) return; Room Room = null; if (!PlusEnvironment.GetGame().GetRoomManager().TryGetRoom(Session.GetHabbo().CurrentRoomId, out Room)) return; if (!Room.CanTradeInRoom) return; Trade Trade = Room.GetUserTrade(Session.GetHabbo().Id); if (Trade == null) return; int Amount = Packet.PopInt(); Item Item = Session.GetHabbo().GetInventoryComponent().GetItem(Packet.PopInt()); if (Item == null) return; List<Item> AllItems = Session.GetHabbo().GetInventoryComponent().GetItems.Where(x => x.Data.Id == Item.Data.Id).Take(Amount).ToList(); foreach (Item I in AllItems) { Trade.OfferItem(Session.GetHabbo().Id, I); } }
public void Parse(HabboHotel.GameClients.GameClient Session, ClientPacket Packet) { Room Room = Session.GetHabbo().CurrentRoom; if (Room == null || !Room.CheckRights(Session, true)) return; int ItemId = Packet.PopInt(); Item Item = Session.GetHabbo().CurrentRoom.GetRoomItemHandler().GetItem(ItemId); if (Item == null) return; string Gender = Session.GetHabbo().Gender.ToLower(); string Figure = ""; foreach (string Str in Session.GetHabbo().Look.Split('.')) { if (Str.Contains("hr") || Str.Contains("hd") || Str.Contains("he") || Str.Contains("ea") || Str.Contains("ha")) continue; Figure += Str + "."; } Figure = Figure.TrimEnd('.'); if (Item.ExtraData.Contains(Convert.ToChar(5))) { string[] Flags = Item.ExtraData.Split(Convert.ToChar(5)); Item.ExtraData = Gender + Convert.ToChar(5) + Figure + Convert.ToChar(5) + Flags[2]; } else Item.ExtraData = Gender + Convert.ToChar(5) + Figure + Convert.ToChar(5) + "Default"; Item.UpdateState(true, true); }
public void Parse(HabboHotel.GameClients.GameClient Session, ClientPacket Packet) { Room Instance = PlusEnvironment.GetGame().GetRoomManager().TryGetRandomLoadedRoom(); if (Instance != null) Session.SendMessage(new RoomForwardComposer(Instance.Id)); }
public void Parse(HabboHotel.GameClients.GameClient Session, ClientPacket Packet) { if (!Session.GetHabbo().InRoom) return; Room Room; if (!PlusEnvironment.GetGame().GetRoomManager().TryGetRoom(Session.GetHabbo().CurrentRoomId, out Room)) return; RoomUser User = Room.GetRoomUserManager().GetRoomUserByHabbo(Session.GetHabbo().Id); if (User == null) return; User.UnIdle(); int DanceId = Packet.PopInt(); if (DanceId < 0 || DanceId > 4) DanceId = 0; if (DanceId > 0 && User.CarryItemID > 0) User.CarryItem(0); if (Session.GetHabbo().Effects().CurrentEffect > 0) Room.SendMessage(new AvatarEffectComposer(User.VirtualId, 0)); User.DanceId = DanceId; Room.SendMessage(new DanceComposer(User, DanceId)); PlusEnvironment.GetGame().GetQuestManager().ProgressUserQuest(Session, QuestType.SOCIAL_DANCE); if (Room.GetRoomUserManager().GetRoomUsers().Count > 19) PlusEnvironment.GetGame().GetQuestManager().ProgressUserQuest(Session, QuestType.MASS_DANCE); }
public void Parse(HabboHotel.GameClients.GameClient Session, Messages.ClientMessage Packet) { string Junk = Packet.PopFixedString(); string MachineId = Packet.PopFixedString(); Session.MachineId = MachineId; }
public void Parse(HabboHotel.GameClients.GameClient Session, ClientPacket Packet) { if (!Session.GetHabbo().InRoom) return; Room Room = null; if (!PlusEnvironment.GetGame().GetRoomManager().TryGetRoom(Session.GetHabbo().CurrentRoomId, out Room)) return; int PetId = Packet.PopInt(); RoomUser Pet = null; if (!Room.GetRoomUserManager().TryGetPet(PetId, out Pet)) return; if (Pet.PetData.AnyoneCanRide == 1) Pet.PetData.AnyoneCanRide = 0; else Pet.PetData.AnyoneCanRide = 1; using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor()) { dbClient.RunQuery("UPDATE `bots_petdata` SET `anyone_ride` = '" + Pet.PetData.AnyoneCanRide + "' WHERE `id` = '" + PetId + "' LIMIT 1"); } Room.SendMessage(new PetInformationComposer(Pet.PetData)); }
public void Parse(HabboHotel.GameClients.GameClient Session, ClientPacket Packet) { int GroupId = Packet.PopInt(); string Name = PlusEnvironment.GetGame().GetChatManager().GetFilter().CheckMessage(Packet.PopString()); string Desc = PlusEnvironment.GetGame().GetChatManager().GetFilter().CheckMessage(Packet.PopString()); Group Group = null; if (!PlusEnvironment.GetGame().GetGroupManager().TryGetGroup(GroupId, out Group)) return; if (Group.CreatorId != Session.GetHabbo().Id) return; using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor()) { dbClient.SetQuery("UPDATE `groups` SET `name`= @name, `desc` = @desc WHERE `id` = '" + GroupId + "' LIMIT 1"); dbClient.AddParameter("name", Name); dbClient.AddParameter("desc", Desc); dbClient.RunQuery(); } Group.Name = Name; Group.Description = Desc; Session.SendMessage(new GroupInfoComposer(Group, Session)); }
public void Parse(HabboHotel.GameClients.GameClient Session, ClientPacket Packet) { if (Session == null || Session.GetHabbo() == null || !Session.GetHabbo().InRoom) return; Room Room; if (!PlusEnvironment.GetGame().GetRoomManager().TryGetRoom(Session.GetHabbo().CurrentRoomId, out Room)) return; int itemID = Packet.PopInt(); Item Item = Room.GetRoomItemHandler().GetItem(itemID); if (Item == null) return; bool hasRights = false; if (Room.CheckRights(Session, false, true)) hasRights = true; string oldData = Item.ExtraData; int request = Packet.PopInt(); Item.Interactor.OnTrigger(Session, Item, request, hasRights); Item.GetRoom().GetWired().TriggerEvent(WiredBoxType.TriggerStateChanges, Session.GetHabbo(), Item); PlusEnvironment.GetGame().GetQuestManager().ProgressUserQuest(Session, QuestType.EXPLORE_FIND_ITEM, Item.GetBaseItem().Id); }
public void Parse(HabboHotel.GameClients.GameClient Session, ClientPacket Packet) { if (Session == null) return; int GroupId = Packet.PopInt(); if (GroupId == 0) return; Group Group = null; if (!PlusEnvironment.GetGame().GetGroupManager().TryGetGroup(GroupId, out Group)) return; Session.GetHabbo().GetStats().FavouriteGroupId = Group.Id; using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor()) { dbClient.RunQuery("UPDATE `user_stats` SET `groupid` = " + Session.GetHabbo().GetStats().FavouriteGroupId + " WHERE `id` = '" + Session.GetHabbo().Id + "' LIMIT 1"); } if (Session.GetHabbo().InRoom && Session.GetHabbo().CurrentRoom != null) { Session.GetHabbo().CurrentRoom.SendMessage(new RefreshFavouriteGroupComposer(Session.GetHabbo().Id)); if (Group != null) { Session.GetHabbo().CurrentRoom.SendMessage(new HabboGroupBadgesComposer(Group)); RoomUser User = Session.GetHabbo().CurrentRoom.GetRoomUserManager().GetRoomUserByHabbo(Session.GetHabbo().Id); if (User != null) Session.GetHabbo().CurrentRoom.SendMessage(new UpdateFavouriteGroupComposer(Session.GetHabbo().Id, Group, User.VirtualId)); } } else Session.SendMessage(new RefreshFavouriteGroupComposer(Session.GetHabbo().Id)); }
public void Parse(HabboHotel.GameClients.GameClient Session, ClientPacket Packet) { int itemId = Packet.PopInt(); string locationData = Packet.PopString(); if (!Session.GetHabbo().InRoom) return; Room Room; if (!PlusEnvironment.GetGame().GetRoomManager().TryGetRoom(Session.GetHabbo().CurrentRoomId, out 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) { if (!Session.GetHabbo().InRoom) return; int UserId = Packet.PopInt(); int RoomId = Packet.PopInt(); int Time = Packet.PopInt(); Room Room = Session.GetHabbo().CurrentRoom; if (Room == null) return; if (((Room.WhoCanMute == 0 && !Room.CheckRights(Session, true) && Room.Group == null) || (Room.WhoCanMute == 1 && !Room.CheckRights(Session)) && Room.Group == null) || (Room.Group != null && !Room.CheckRights(Session, false, true))) return; RoomUser Target = Room.GetRoomUserManager().GetRoomUserByHabbo(PlusEnvironment.GetUsernameById(UserId)); if (Target == null) return; else if (Target.GetClient().GetHabbo().GetPermissions().HasRight("mod_tool")) return; if (Room.MutedUsers.ContainsKey(UserId)) { if (Room.MutedUsers[UserId] < PlusEnvironment.GetUnixTimestamp()) Room.MutedUsers.Remove(UserId); else return; } Room.MutedUsers.Add(UserId, (PlusEnvironment.GetUnixTimestamp() + (Time * 60))); Target.GetClient().SendWhisper("The room owner has muted you for " + Time + " minutes!"); PlusEnvironment.GetGame().GetAchievementManager().ProgressAchievement(Session, "ACH_SelfModMuteSeen", 1); }
public void Parse(HabboHotel.GameClients.GameClient Session, ClientPacket Packet) { int RoomId = Packet.PopInt(); string Name = PlusEnvironment.GetGame().GetChatManager().GetFilter().CheckMessage(Packet.PopString()); string Desc = PlusEnvironment.GetGame().GetChatManager().GetFilter().CheckMessage(Packet.PopString()); RoomData Data = PlusEnvironment.GetGame().GetRoomManager().GenerateRoomData(RoomId); if (Data == null) return; if (Data.OwnerId != Session.GetHabbo().Id) return;//HAX if (Data.Promotion == null) { Session.SendNotification("Oops, it looks like there isn't a room promotion in this room?"); return; } using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor()) { dbClient.SetQuery("UPDATE `room_promotions` SET `title` = @title, `description` = @desc WHERE `room_id` = " + RoomId + " LIMIT 1"); dbClient.AddParameter("title", Name); dbClient.AddParameter("desc", Desc); dbClient.RunQuery(); } Room Room; if (!PlusEnvironment.GetGame().GetRoomManager().TryGetRoom(Convert.ToInt32(RoomId), out Room)) return; Data.Promotion.Name = Name; Data.Promotion.Description = Desc; Room.SendMessage(new RoomEventComposer(Data, Data.Promotion)); }
public void Parse(HabboHotel.GameClients.GameClient Session, ClientPacket Packet) { if (Session == null || Session.GetHabbo() == null || Session.GetHabbo().GetMessenger() == null) return; int BuddyId = Packet.PopInt(); if (BuddyId == 0 || BuddyId == Session.GetHabbo().Id) return; GameClient Client = PlusEnvironment.GetGame().GetClientManager().GetClientByUserID(BuddyId); if (Client == null || Client.GetHabbo() == null) return; if (!Client.GetHabbo().InRoom) { Session.SendMessage(new FollowFriendFailedComposer(2)); Session.GetHabbo().GetMessenger().UpdateFriend(Client.GetHabbo().Id, Client, true); return; } else if (Session.GetHabbo().CurrentRoom != null && Client.GetHabbo().CurrentRoom != null) { if (Session.GetHabbo().CurrentRoom.RoomId == Client.GetHabbo().CurrentRoom.RoomId) return; } Session.SendMessage(new RoomForwardComposer(Client.GetHabbo().CurrentRoomId)); }
public void Parse(HabboHotel.GameClients.GameClient Session, ClientPacket Packet) { if (!Session.GetHabbo().InRoom) return; int BotId = Packet.PopInt(); int ActionId = Packet.PopInt(); Room Room = Session.GetHabbo().CurrentRoom; if (Room == null) return; RoomUser BotUser = null; if (!Room.GetRoomUserManager().TryGetBot(BotId, out BotUser)) return; string BotSpeech = ""; foreach (RandomSpeech Speech in BotUser.BotData.RandomSpeech.ToList()) { BotSpeech += (Speech.Message + "\n"); } BotSpeech += ";#;"; BotSpeech += BotUser.BotData.AutomaticChat; BotSpeech += ";#;"; BotSpeech += BotUser.BotData.SpeakingInterval; BotSpeech += ";#;"; BotSpeech += BotUser.BotData.MixSentences; if (ActionId == 2 || ActionId == 5) Session.SendMessage(new OpenBotActionComposer(BotUser, ActionId, BotSpeech)); }
public void Parse(HabboHotel.GameClients.GameClient Session, ClientPacket Packet) { int GroupId = Packet.PopInt(); int UserId = Packet.PopInt(); Group Group = null; if (!PlusEnvironment.GetGame().GetGroupManager().TryGetGroup(GroupId, out 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 = PlusEnvironment.GetHabboById(UserId); if (Habbo == null) { Session.SendNotification("Oops, an error occurred whilst finding this user."); return; } Group.HandleRequest(UserId, true); Session.SendMessage(new GroupMemberUpdatedComposer(GroupId, Habbo, 4)); }
public void Parse(HabboHotel.GameClients.GameClient Session, ClientPacket Packet) { if (!Session.GetHabbo().InRoom) return; Room Room; if (!PlusEnvironment.GetGame().GetRoomManager().TryGetRoom(Session.GetHabbo().CurrentRoomId, out Room)) return; if (!Room.CheckRights(Session, true) || Room.MoodlightData == null) return; Item Item = Room.GetRoomItemHandler().GetItem(Room.MoodlightData.ItemId); if (Item == null || Item.GetBaseItem().InteractionType != InteractionType.MOODLIGHT) return; if (Room.MoodlightData.Enabled) Room.MoodlightData.Disable(); else Room.MoodlightData.Enable(); Item.ExtraData = Room.MoodlightData.GenerateExtraData(); Item.UpdateState(); }
public void Parse(HabboHotel.GameClients.GameClient Session, ClientPacket Packet) { string Category = Packet.PopString(); string Unknown = Packet.PopString(); if (!string.IsNullOrEmpty(Unknown)) { Category = "hotel_view"; ICollection<SearchResultList> Test = new List<SearchResultList>(); SearchResultList Null = null; if (PlusEnvironment.GetGame().GetNavigator().TryGetSearchResultList(0, out Null)) { Test.Add(Null); Session.SendMessage(new NavigatorSearchResultSetComposer(Category, Unknown, Test, Session)); } } else { //Fetch the categorys. ICollection<SearchResultList> Test = PlusEnvironment.GetGame().GetNavigator().GetCategorysForSearch(Category); if (Test.Count == 0) { ICollection<SearchResultList> SecondTest = PlusEnvironment.GetGame().GetNavigator().GetResultByIdentifier(Category); if (SecondTest.Count > 0) { Session.SendMessage(new NavigatorSearchResultSetComposer(Category, Unknown, SecondTest, Session, 2, 100)); return; } } Session.SendMessage(new NavigatorSearchResultSetComposer(Category, Unknown, Test, Session)); } }
public void Handle(HabboHotel.GameClients.GameClient Session, global::Essential.Messages.ClientMessage Event) { int num = Event.PopWiredInt32(); int num2 = Event.PopWiredInt32(); int num3 = Event.PopWiredInt32(); if ((num2 == 1) && (num3 == 0)) { Room room = Essential.GetGame().GetRoomManager().GetRoom((uint)num); if ((room != null) && (room.GetRoomUserByHabbo(Session.GetHabbo().Id) == null)) { } } else if ((num2 != 0) || (num3 != 0)) { RoomData data = Essential.GetGame().GetRoomManager().method_12((uint)num); if (data != null) { ServerMessage message = new ServerMessage(Outgoing.RoomData); message.AppendBoolean(false); data.Serialize(message, false, false); message.AppendBoolean(true); message.AppendBoolean(false); message.AppendBoolean(true); message.AppendBoolean(true); message.AppendInt32(0); message.AppendInt32(0); message.AppendInt32(0); message.AppendBoolean(true); Session.SendMessage(message); //Console.WriteLine("aa"); } } }
public void Parse(HabboHotel.GameClients.GameClient Session, ClientPacket Packet) { if (Session == null || Session.GetHabbo() == null || !Session.GetHabbo().GetPermissions().HasRight("mod_mute")) return; int UserId = Packet.PopInt(); string Message = Packet.PopString(); double Length = (Packet.PopInt() * 60); string Unknown1 = Packet.PopString(); string Unknown2 = Packet.PopString(); Habbo Habbo = PlusEnvironment.GetHabboById(UserId); if (Habbo == null) { Session.SendWhisper("An error occoured whilst finding that user in the database."); return; } if (Habbo.GetPermissions().HasRight("mod_mute") && !Session.GetHabbo().GetPermissions().HasRight("mod_mute_any")) { Session.SendWhisper("Oops, you cannot mute that user."); return; } using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor()) { dbClient.RunQuery("UPDATE `users` SET `time_muted` = '" + Length + "' WHERE `id` = '" + Habbo.Id + "' LIMIT 1"); } if (Habbo.GetClient() != null) { Habbo.TimeMuted = Length; Habbo.GetClient().SendNotification("You have been muted by a moderator for " + Length + " seconds!"); } }
public void Parse(HabboHotel.GameClients.GameClient Session, ClientPacket Packet) { Room Room = null; if (!PlusEnvironment.GetGame().GetRoomManager().TryGetRoom(Session.GetHabbo().CurrentRoomId, out Room)) return; if (!Room.CheckRights(Session)) return; int itemID = Packet.PopInt(); string wallPositionData = Packet.PopString(); Item Item = Room.GetRoomItemHandler().GetItem(itemID); if (Item == null) return; try { string WallPos = Room.GetRoomItemHandler().WallPositionCheck(":" + wallPositionData.Split(':')[1]); Item.wallCoord = WallPos; } catch { return; } Room.GetRoomItemHandler().UpdateItem(Item); Room.SendMessage(new ItemUpdateComposer(Item, Room.OwnerId)); }
/// <summary> /// Main Void, Initializes the Emulator. /// </summary> internal static void Initialize() { Console.Title = "Yupi Emulator | Starting [...]"; YupiServerStartDateTime = DateTime.Now; YupiServerTextEncoding = Encoding.Default; MutedUsersByFilter = new Dictionary <uint, uint>(); ChatEmotions.Initialize(); CultureInfo = CultureInfo.CreateSpecificCulture("en-GB"); YupiRootDirectory = Directory.GetParent(Directory.GetParent(Environment.CurrentDirectory).FullName).FullName; YupiVariablesDirectory = Path.Combine(YupiRootDirectory, "Variables"); try { ServerConfigurationSettings.Load(Path.Combine(YupiVariablesDirectory, "Settings/main.ini")); ServerConfigurationSettings.Load(Path.Combine(YupiVariablesDirectory, "Settings/Welcome/settings.ini"), true); if (uint.Parse(ServerConfigurationSettings.Data["db.pool.maxsize"]) > MaxRecommendedMySqlConnections) { YupiWriterManager.WriteLine("MySQL Max Conn is High!, Recommended Value: " + MaxRecommendedMySqlConnections, "Yupi.Data", ConsoleColor.DarkYellow); } MySqlConnectionStringBuilder mySqlConnectionStringBuilder = new MySqlConnectionStringBuilder { Server = ServerConfigurationSettings.Data["db.hostname"], Port = uint.Parse(ServerConfigurationSettings.Data["db.port"]), UserID = ServerConfigurationSettings.Data["db.username"], Password = ServerConfigurationSettings.Data["db.password"], Database = ServerConfigurationSettings.Data["db.name"], MinimumPoolSize = uint.Parse(ServerConfigurationSettings.Data["db.pool.minsize"]), MaximumPoolSize = uint.Parse(ServerConfigurationSettings.Data["db.pool.maxsize"]), Pooling = true, AllowZeroDateTime = true, ConvertZeroDateTime = true, DefaultCommandTimeout = 300, ConnectionTimeout = 10 }; YupiDatabaseManager = new BasicDatabaseManager(mySqlConnectionStringBuilder); using (IQueryAdapter queryReactor = GetDatabaseManager().GetQueryReactor()) { DatabaseSettings = new ServerDatabaseSettings(queryReactor); PetCommandHandler.Init(queryReactor); PetLocale.Init(queryReactor); OfflineMessages = new Dictionary <uint, List <OfflineMessage> >(); OfflineMessage.InitOfflineMessages(queryReactor); } YupiLogManager.Init(MethodBase.GetCurrentMethod().DeclaringType); ConsoleCleanTimeInterval = int.Parse(ServerConfigurationSettings.Data["console.clear.time"]); ConsoleTimerOn = bool.Parse(ServerConfigurationSettings.Data["console.clear.enabled"]); FriendRequestLimit = (uint)int.Parse(ServerConfigurationSettings.Data["client.maxrequests"]); LibraryParser.Incoming = new Dictionary <int, LibraryParser.StaticRequestHandler>(); LibraryParser.Library = new Dictionary <string, string>(); LibraryParser.Outgoing = new Dictionary <string, int>(); LibraryParser.Config = new Dictionary <string, string>(); LibraryParser.ReleaseName = ServerConfigurationSettings.Data["client.build"]; LibraryParser.RegisterLibrary(); LibraryParser.RegisterOutgoing(); LibraryParser.RegisterIncoming(); LibraryParser.RegisterConfig(); Plugins = new Dictionary <string, IPlugin>(); ICollection <IPlugin> plugins = LoadPlugins(); if (plugins != null) { foreach (IPlugin item in plugins.Where(item => item != null)) { Plugins.Add(item.PluginName, item); YupiWriterManager.WriteLine("Loaded Plugin: " + item.PluginName + " ServerVersion: " + item.PluginVersion, "Yupi.Plugins", ConsoleColor.DarkBlue); } } ServerExtraSettings.RunExtraSettings(); FurnitureDataManager.SetCache(); CrossDomainSettings.Set(); GameServer = new HabboHotel(int.Parse(ServerConfigurationSettings.Data["game.tcp.conlimit"])); GameServer.ContinueLoading(); FurnitureDataManager.Clear(); if (ServerConfigurationSettings.Data.ContainsKey("server.lang")) { ServerLanguage = ServerConfigurationSettings.Data["server.lang"]; } ServerLanguageVariables = new ServerLanguageSettings(ServerLanguage); YupiWriterManager.WriteLine("Loaded " + ServerLanguageVariables.Count() + " Languages Vars", "Yupi.Boot"); if (plugins != null) { foreach (IPlugin plugin in plugins) { plugin?.message_void(); } } if (ConsoleTimerOn) { YupiWriterManager.WriteLine("Console Clear ConsoleRefreshTimer is Enabled, with " + ConsoleCleanTimeInterval + " Seconds.", "Yupi.Boot"); } ClientMessageFactory.Init(); YupiUserConnectionManager = new ConnectionHandler(int.Parse(ServerConfigurationSettings.Data["game.tcp.port"]), int.Parse(ServerConfigurationSettings.Data["game.tcp.conlimit"]), int.Parse(ServerConfigurationSettings.Data["game.tcp.conperip"]), ServerConfigurationSettings.Data["game.tcp.antiddos"].ToLower() == "true", ServerConfigurationSettings.Data["game.tcp.enablenagles"].ToLower() == "true"); YupiWriterManager.WriteLine("Server Started at Port " + ServerConfigurationSettings.Data["game.tcp.port"] + " and Address " + ServerConfigurationSettings.Data["game.tcp.bindip"], "Yupi.Boot"); if (LibraryParser.Config["Crypto.Enabled"] == "true") { Handler.Initialize(LibraryParser.Config["Crypto.RSA.N"], LibraryParser.Config["Crypto.RSA.D"], LibraryParser.Config["Crypto.RSA.E"]); YupiWriterManager.WriteLine("Started RSA crypto service", "Yupi.Crypto"); } else { YupiWriterManager.WriteLine("The encryption system is disabled.", "Yupi.Crypto", ConsoleColor.DarkYellow); } LibraryParser.Initialize(); if (ConsoleTimerOn) { ConsoleRefreshTimer = new Timer { Interval = ConsoleCleanTimeInterval }; ConsoleRefreshTimer.Elapsed += ConsoleRefreshTimerElapsed; ConsoleRefreshTimer.Start(); } if (ServerConfigurationSettings.Data.ContainsKey("game.multithread.enabled")) { SeparatedTasksInMainLoops = ServerConfigurationSettings.Data["game.multithread.enabled"] == "true"; } if (ServerConfigurationSettings.Data.ContainsKey("client.multithread.enabled")) { SeparatedTasksInGameClientManager = ServerConfigurationSettings.Data["client.multithread.enabled"] == "true"; } if (ServerConfigurationSettings.Data.ContainsKey("debug.packet")) { PacketDebugMode = ServerConfigurationSettings.Data["debug.packet"] == "true"; } YupiWriterManager.WriteLine("Yupi Emulator ready.", "Yupi.Boot"); IsLive = true; } catch (Exception e) { YupiWriterManager.WriteLine("Error When Starting Yupi Environment!" + Environment.NewLine + e.Message, "Yupi.Boot", ConsoleColor.Red); YupiWriterManager.WriteLine("Please press Y to get more details or press other Key to Exit", "Yupi.Boot", ConsoleColor.Red); ConsoleKeyInfo key = Console.ReadKey(); if (key.Key == ConsoleKey.Y) { Console.WriteLine(); YupiWriterManager.WriteLine( Environment.NewLine + "[Message] Error Details: " + Environment.NewLine + e.StackTrace + Environment.NewLine + e.InnerException + Environment.NewLine + e.TargetSite + Environment.NewLine + "[Message] Press Any Key To Exit", "Yupi.Boot", ConsoleColor.Red); Console.ReadKey(); } Environment.Exit(1); } }