internal void ActivateQuest(GameClient Session, ClientMessage Message) { Quest Quest = GetQuest(Message.PopWiredUInt()); if (Quest == null) { return; } using (IQueryAdapter dbClient = SilverwaveEnvironment.GetDatabaseManager().getQueryreactor()) { dbClient.runFastQuery("REPLACE INTO user_quests(user_id,quest_id) VALUES (" + Session.GetHabbo().Id + ", " + Quest.Id + ")"); dbClient.runFastQuery("UPDATE user_stats SET quest_id = " + Quest.Id + " WHERE id = " + Session.GetHabbo().Id); } Session.GetHabbo().CurrentQuestId = Quest.Id; GetList(Session, null); Session.SendMessage(QuestStartedComposer.Compose(Session, Quest)); }
private static void AddToPlaylist(GameClient Session, ClientMessage Message) { Room Instance = Session.GetHabbo().CurrentRoom; if (Instance == null || !Instance.CheckRights(Session, true) || !Instance.GotMusicController() || Instance.GetRoomMusicController().PlaylistSize >= Instance.GetRoomMusicController().PlaylistCapacity) { return; } UserItem DiskUserItem = Session.GetHabbo().GetInventoryComponent().GetItem(Message.PopWiredUInt()); if (DiskUserItem == null || DiskUserItem.GetBaseItem().InteractionType != InteractionType.musicdisc) { return; } SongItem item = new SongItem(DiskUserItem); int NewOrder = Instance.GetRoomMusicController().AddDisk(item); if (NewOrder < 0) { return; } Session.GetHabbo().GetInventoryComponent().RemoveItem(item.itemID, true); Session.SendMessage(JukeboxComposer.Compose(Instance.GetRoomMusicController().PlaylistCapacity, Instance.GetRoomMusicController().Playlist.Values.ToList())); }
private static List<RoomItem> GetFurniItems(ClientMessage Request, Room Room) { List<RoomItem> Items = new List<RoomItem>(); int FurniCount = Request.PopWiredInt32(); for (int i = 0; i < FurniCount; i++) { RoomItem Item = Room.GetRoomItemHandler().GetItem(Request.PopWiredUInt()); if (Item != null) { Items.Add(Item); } } return Items; }
private static void GetSongData(GameClient Session, ClientMessage Message) { int Amount = Message.PopWiredInt32(); List<SongData> Songs = new List<SongData>(); for (int i = 0; i < Amount; i++) { SongData Song = GetSong(Message.PopWiredUInt()); if (Song == null) continue; Songs.Add(Song); } Session.SendMessage(JukeboxComposer.Compose(Songs)); }