Beispiel #1
0
 public void AddPublicItem(PublicItem item)
 {
     if (item == null) return;
     _publicItems.Add(Convert.ToUInt32(item.Id), item);
 }
Beispiel #2
0
        internal void ToggleStaffPick()
        {
            if (!Session.GetHabbo().HasFuse("user_room_staff_pick")) return;
            var roomId = Request.GetUInteger();
            var current = Request.GetBool();
            var room = AzureEmulator.GetGame().GetRoomManager().GetRoom(roomId);
            AzureEmulator.GetGame().GetAchievementManager().ProgressUserAchievement(Session, "ACH_Spr", 1, false);
            if (room == null) return;
            using (var queryReactor = AzureEmulator.GetDatabaseManager().GetQueryReactor())
            {
                var pubItem = AzureEmulator.GetGame().GetNavigator().GetPublicItem(roomId);
                if (pubItem == null) // not picked
                {

                    queryReactor.SetQuery("INSERT INTO navigator_publics (bannertype, room_id, category_parent_id) VALUES ('0', @roomId, '-2')");
                    queryReactor.AddParameter("roomId", room.RoomId);
                    queryReactor.RunQuery();
                    queryReactor.RunFastQuery("SELECT last_insert_id()");
                    var publicItemId = (uint)queryReactor.GetInteger();
                    var publicItem = new PublicItem(publicItemId, 0, string.Empty, string.Empty, string.Empty, PublicImageType.Internal, room.RoomId, 0, -2, false, 1, string.Empty);
                    AzureEmulator.GetGame().GetNavigator().AddPublicItem(publicItem);
                }
                else // picked
                {
                    queryReactor.SetQuery("DELETE FROM navigator_publics WHERE id = @pubId");
                    queryReactor.AddParameter("pubId", pubItem.Id);
                    queryReactor.RunQuery();
                    AzureEmulator.GetGame().GetNavigator().RemovePublicItem(pubItem.Id);
                }
                room.RoomData.SerializeRoomData(Response, Session, false, true);
                AzureEmulator.GetGame().GetNavigator().LoadNewPublicRooms();
            }
        }