Exemplo n.º 1
0
        internal void ActivateQuest(GameClient Session, ClientMessage Message)
        {
            Quest Quest = GetQuest(Message.PopWiredUInt());

            if (Quest == null)
            {
                return;
            }

            using (IQueryAdapter dbClient = ButterflyEnvironment.GetDatabaseManager().getQueryreactor())
            {
                if (dbClient.dbType == Database_Manager.Database.DatabaseType.MySQL)
                    dbClient.runFastQuery("REPLACE INTO user_quests VALUES (" + Session.GetHabbo().Id + ", " + Quest.Id + ", 0)");
                else
                    dbClient.runFastQuery("IF NOT EXISTS (SELECT user_id FROM user_quests WHERE user_id = " + Session.GetHabbo().Id + " AND quest_id = " + Quest.Id + ") " +
                                          "INSERT INTO user_quests VALUES (" + Session.GetHabbo().Id + ", " + Quest.Id + ", 0)");
                dbClient.runFastQuery("UPDATE users SET currentquestid = " + Quest.Id + " WHERE id = " + Session.GetHabbo().Id);
            }

            Session.GetHabbo().CurrentQuestId = Quest.Id;
            GetList(Session, null);
            Session.SendMessage(QuestStartedComposer.Compose(Session, Quest));
        }
Exemplo n.º 2
0
        private static List<RoomItem> GetItems(ClientMessage message, Room room, out int itemCount)
        {
            List<RoomItem> items = new List<RoomItem>();
            itemCount = message.PopWiredInt32();

            uint itemID;
            RoomItem item;
            for (int i = 0; i < itemCount; i++)
            {
                itemID = message.PopWiredUInt();
                item = room.GetRoomItemHandler().GetItem(itemID);

                if (item != null && !WiredUtillity.TypeIsWired(item.GetBaseItem().InteractionType))
                    items.Add(item);
            }

            return items;
        }
Exemplo n.º 3
0
        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()));
        }
Exemplo n.º 4
0
        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));
        }