ADDON UBEREMU : Room Recommanded & Appart categories

Results 1 to 17 of 17
  1. #1
    Member dimitri54480 is offline
    MemberRank
    Feb 2011 Join Date
    44Posts

    ADDON UBEREMU : Room Recommanded & Appart categories

    Hello, Anthony93260 gave me a code for uberemu

    Go on this link : Fichier #pjtyxw36-4572 - C - Code source | sourcepod.com



    SQL for Room Recommended

    Code:
    ALTER TABLE `navigator_publics`
    ADD `recommended` INT( 2 ) NOT NULL DEFAULT '0'
    This RELEASE is on Facebook : Uber Hotel Development | Facebook

    http://img10.imageshack.us/img10/9383/itworks.png
    Last edited by dimitri54480; 03-04-11 at 04:22 PM. Reason: Put the Screnn By davidaap


  2. #2
    Banned PEjump2 is offline
    BannedRank
    Jan 2010 Join Date
    The NetherlandsLocation
    2,838Posts

    Re: ADDON UBEREMU : Room Recommanded & Appart categories

    Nice release if it works! :o

  3. #3
    Member efferinie is offline
    MemberRank
    Aug 2008 Join Date
    69Posts

    Re: ADDON UBEREMU : Room Recommanded & Appart categories

    I have 80 Errors :S

    ---------- Post added at 12:29 PM ---------- Previous post was at 12:28 PM ----------

    Navigator.cs

    PHP Code:
    using System;
    using System.Collections.Generic;
    using System.Data;
    using System.Text;

    using Uber.HabboHotel.Rooms;
    using Uber.HabboHotel.Users.Messenger;
    using Uber.HabboHotel.GameClients;
    using Uber.Messages;
    using Uber.Storage;

    namespace 
    Uber.HabboHotel.Navigators
    {
        class 
    Navigator
        
    {
            private 
    Dictionary<intstringPublicCategories;
            private List<
    FlatCatPrivateCategories;

            private 
    Dictionary<intPublicItemPublicItems;
            private 
    Dictionary<intPublicRecommendedPublicRecommended;

            public 
    Navigator()
            {
            }

            public 
    void Initialize()
            {
                
    PublicCategories = new Dictionary<intstring>();
                
    PrivateCategories = new List<FlatCat>();
                
    PublicItems = new Dictionary<intPublicItem>();
                
    PublicRecommended = new Dictionary<intPublicRecommended>();

                
    DataTable dPubCats null;
                
    DataTable dPrivCats null;
                
    DataTable dPubItems null;

                
    using (DatabaseClient dbClient UberEnvironment.GetDatabase().GetClient())
                {
                    
    dPubCats dbClient.ReadDataTable("SELECT id,caption FROM navigator_pubcats WHERE enabled = '1'");
                    
    dPrivCats dbClient.ReadDataTable("SELECT id,caption,min_rank FROM navigator_flatcats WHERE enabled = '1'");
                    
    dPubItems dbClient.ReadDataTable("SELECT id,bannertype,caption,image,image_type,room_id,category_id,category_parent_id FROM navigator_publics WHERE enabled = '1' ORDER BY ordernum ASC");
                    
    dPubRecommended dbClient.ReadDataTable("SELECT id,bannertype,caption,image,image_type,room_id,category_id,category_parent_id FROM navigator_publics WHERE recommended = '1' ORDER BY ordernum ASC");
                }

                if (
    dPubCats != null)
                {
                    foreach (
    DataRow Row in dPubCats.Rows)
                    {
                        
    PublicCategories.Add((int)Row["id"], (string)Row["caption"]);
                    }
                }

                if (
    dPrivCats != null)
                {
                    foreach (
    DataRow Row in dPrivCats.Rows)
                    {
                        
    PrivateCategories.Add(new FlatCat((int)Row["id"], (string)Row["caption"], (int)Row["min_rank"]));
                    }
                }

                if (
    dPubItems != null)
                {
                    foreach (
    DataRow Row in dPubItems.Rows)
                    {
                        
    PublicItems.Add((int)Row["id"], new PublicItem((int)Row["id"], int.Parse(Row["bannertype"].ToString()), (string)Row["caption"],
                            (string)
    Row["image"], ((Row["image_type"].ToString().ToLower() == "internal") ? PublicImageType.INTERNAL PublicImageType.EXTERNAL),
                            (
    uint)Row["room_id"], (int)Row["category_id"], (int)Row["category_parent_id"]));
                    }
                }
            }

            if (
    dPubRecommended != null//Ont définie les variables dont on va ce servir
                
    {
                    foreach (
    DataRow Row in dPubRecommended.Rows)
                    {
                        
    PublicRecommended.Add((int)Row["id"], new PublicRecommended((int)Row["id"], int.Parse(Row["bannertype"].ToString()), (string)Row["caption"],
                            (string)
    Row["image"], ((Row["image_type"].ToString().ToLower() == "internal") ? PublicImageType2.INTERNAL PublicImageType2.EXTERNAL),
                            (
    uint)Row["room_id"], (int)Row["category_id"], (int)Row["category_parent_id"]));
                    }
                } 

            public 
    int GetCountForParent(int ParentId)
            {
                
    int i 0;

                
    lock ((PublicItems))
                {
                    foreach (
    PublicItem Item in PublicItems.Values)
                    {
                        if (
    Item.ParentId == ParentId || ParentId == -1)
                        {
                            
    i++;
                        }
                    }
                }

                return 
    i;
            }

            public 
    FlatCat GetFlatCat(int Id)
            {
                
    lock ((PrivateCategories))
                {
                    foreach (
    FlatCat FlatCat in PrivateCategories)
                    {
                        if (
    FlatCat.Id == Id)
                        {
                            return 
    FlatCat;
                        }
                    }
                }

                return 
    null;
            }

            public 
    ServerMessage SerializeFlatCategories()
            {
                
    ServerMessage Cats = new ServerMessage(221);
                
    Cats.AppendInt32(PrivateCategories.Count);

                foreach (
    FlatCat FlatCat in PrivateCategories)
                {
                    if (
    FlatCat.Id 0)
                    {
                        
    Cats.AppendBoolean(true);
                    }

                    
    Cats.AppendInt32(FlatCat.Id);
                    
    Cats.AppendStringWithBreak(FlatCat.Caption);
                }

                
    Cats.AppendStringWithBreak("");

                return 
    Cats;
            }


            public 
    ServerMessage SerializePublicRooms()
            {
                
    // GBPAS[Cafes and RestaurantsPQLounges and Entertainment[{APubs and ClubsQQOutside Spaces & Swimming PoolsQA
                // GBSP[DlHDe Elfstedentocht!officialrooms_nl/schaats_official_rooms.gifHPFJiUp`RHElfstedentocht - 1 - STARTElfstedentochtHPFQFBinnenkort - De Elfstedentocht!HHXZHHHHHHHYElHHabbo Hotel Werkvloerofficialrooms_nl/exec_official_rooms.gifHRLJiouUWHHabbo Hotel WerkvloerCrowleyHRLRLHHZWHHHHHHYFlDe Ontva

                
    ServerMessage Frontpage = new ServerMessage(450);             
                
    Frontpage.AppendInt32(GetCountForParent(-1));

                
    lock ((PublicItems))
                {
                    foreach (
    PublicItem Pub in PublicItems.Values)
                    {
                        
    Pub.Serialize(Frontpage);
                    }
                }

                return 
    Frontpage;
            }

            public 
    ServerMessage SerializeFavoriteRooms(GameClient Session)
            {
                
    ServerMessage Rooms = new ServerMessage(451);
                
    Rooms.AppendInt32(0);
                
    Rooms.AppendInt32(6);
                
    Rooms.AppendStringWithBreak("");
                
    Rooms.AppendInt32(Session.GetHabbo().FavoriteRooms.Count);

                
    // lock (Session.GetHabbo().FavoriteRooms)
                
    lock ((Session.GetHabbo().FavoriteRooms))
                {
                    foreach (
    uint Id in Session.GetHabbo().FavoriteRooms)
                    {
                        
    UberEnvironment.GetGame().GetRoomManager().GenerateRoomData(Id).Serialize(Roomsfalse);
                    }
                }

                return 
    Rooms;
            }

            public 
    ServerMessage SerializeRecentRooms(GameClient Session)
            {
                
    DataTable Data null;

                
    using (DatabaseClient dbClient UberEnvironment.GetDatabase().GetClient())
                {
                    
    Data dbClient.ReadDataTable("SELECT * FROM user_roomvisits ORDER BY entry_timestamp DESC LIMIT 50");
                }

                List<
    RoomDataValidRecentRooms = new List<RoomData>();
                List<
    uintRoomsListed = new List<uint>();

                if (
    Data != null)
                {
                    foreach (
    DataRow Row in Data.Rows)
                    {
                        
    RoomData rData UberEnvironment.GetGame().GetRoomManager().GenerateRoomData((uint)Row["room_id"]);

                        if (
    rData == null || rData.IsPublicRoom || RoomsListed.Contains(rData.Id))
                        {
                            continue;
                        }

                        
    ValidRecentRooms.Add(rData);
                        
    RoomsListed.Add(rData.Id);
                    }
                }

                
    ServerMessage Rooms = new ServerMessage(451);
                
    Rooms.AppendInt32(0);
                
    Rooms.AppendInt32(7);
                
    Rooms.AppendStringWithBreak("");
                
    Rooms.AppendInt32(ValidRecentRooms.Count);

                foreach (
    RoomData _Data in ValidRecentRooms)
                {
                    
    _Data.Serialize(Roomsfalse);
                }

                return 
    Rooms;
            }

            public 
    ServerMessage SerializeEventListing(GameClient Sessionint Category)
            {
                
    ServerMessage Message = new ServerMessage(451);
                
    Message.AppendInt32(Category);
                
    Message.AppendInt32(12);
                
    Message.AppendStringWithBreak("");

                List<
    RoomEventRooms UberEnvironment.GetGame().GetRoomManager().GetEventRoomsForCategory(Category);
                
    Message.AppendInt32(EventRooms.Count);

                foreach (
    Room Room in EventRooms)
                {
                    
    RoomData Data = new RoomData();
                    
    Data.Fill(Room);
                    
    Data.Serialize(Messagetrue);
                }

                return 
    Message;
            }

            public 
    ServerMessage SerializePopularRoomTags()
            {
                
    Dictionary<stringintTags = new Dictionary<stringint>();
                
    DataTable Data null;

                
    using (DatabaseClient dbClient UberEnvironment.GetDatabase().GetClient())
                {
                    
    Data dbClient.ReadDataTable("SELECT tags,users_now FROM rooms WHERE roomtype = 'private' AND users_now > 0 ORDER BY users_now DESC LIMIT 50");
                }

                if (
    Data != null)
                {
                    foreach (
    DataRow Row in Data.Rows)
                    {
                        List<
    stringRoomTags = new List<string>();

                        foreach (
    string Tag in Row["tags"].ToString().Split(','))
                        {
                            
    RoomTags.Add(Tag);
                        }

                        foreach (
    string Tag in RoomTags)
                        {
                            if (
    Tags.ContainsKey(Tag))
                            {
                                
    Tags[Tag] += (int)Row["users_now"];
                            }
                            else
                            {
                                
    Tags.Add(Tag, (int)Row["users_now"]);
                            }
                        }
                    }
                }

                List<
    KeyValuePair<stringint>> SortedTags = new List<KeyValuePair<stringint>>(Tags);

                
    SortedTags.Sort (

                    
    delegate(KeyValuePair<stringintfirstPair,

                    
    KeyValuePair<stringintnextPair)
                    {
                        return 
    firstPair.Value.CompareTo(nextPair.Value);
                    }

                );

                
    ServerMessage Message = new ServerMessage(452);
                
    Message.AppendInt32(SortedTags.Count);

                foreach (
    KeyValuePair<stringintTagData in SortedTags)
                {
                    
    Message.AppendStringWithBreak(TagData.Key);
                    
    Message.AppendInt32(TagData.Value);
                }

                return 
    Message;
            }

            public 
    ServerMessage SerializeSearchResults(string SearchQuery)
            {
                
    DataTable Data null;

                
    using (DatabaseClient dbClient UberEnvironment.GetDatabase().GetClient())
                {
                    
    SearchQuery UberEnvironment.FilterInjectionChars(SearchQuery.ToLower()).Trim();

                    if (
    SearchQuery.Length 0)
                    {
                        
    dbClient.AddParamWithValue("query"SearchQuery "%");
                        
    dbClient.AddParamWithValue("tags_query""%" SearchQuery "%");
                        
    Data dbClient.ReadDataTable("SELECT * FROM rooms WHERE caption LIKE @query AND roomtype = 'private' OR tags LIKE @tags_query AND roomtype = 'private' OR owner LIKE @query AND roomtype = 'private' ORDER BY users_now DESC LIMIT 30");
                    }
                }

                List<
    RoomDataResults = new List<RoomData>();

                if (
    Data != null)
                {
                    foreach (
    DataRow Row in Data.Rows)
                    {
                        
    RoomData RData = new RoomData();
                        
    RData.Fill(Row);
                        
    Results.Add(RData);
                    }
                }

                
    ServerMessage Message = new ServerMessage(451);
                
    Message.AppendInt32(1);
                
    Message.AppendInt32(9);
                
    Message.AppendStringWithBreak(SearchQuery);
                
    Message.AppendInt32(Results.Count);

                foreach (
    RoomData Room in Results)
                {
                    
    Room.Serialize(Messagefalse);
                }

                return 
    Message;
            }

            public 
    ServerMessage SerializeRoomListing(GameClient Sessionint Mode)
            {
                
    ServerMessage Rooms = new ServerMessage(451);

                if (
    Mode >= -1)
                {
                    
    Rooms.AppendInt32(Mode);
                    
    Rooms.AppendInt32(1);
                }
                else if (
    Mode == -2)
                {
                    
    Rooms.AppendInt32(0);
                    
    Rooms.AppendInt32(2);
                }
                else if (
    Mode == -3)
                {
                    
    Rooms.AppendInt32(0);
                    
    Rooms.AppendInt32(5);
                }
                else if (
    Mode == -4)
                {
                    
    Rooms.AppendInt32(0);
                    
    Rooms.AppendInt32(3);
                }
                else if (
    Mode == -5)
                {
                    
    Rooms.AppendInt32(0);
                    
    Rooms.AppendInt32(4);
                }

                
    Rooms.AppendStringWithBreak("");

                
    DataTable Data null;

                
    using (DatabaseClient dbClient UberEnvironment.GetDatabase().GetClient())
                {
                    switch (
    Mode)
                    {
                        case -
    5:

                            List<
    uintFriendRooms = new List<uint>();

                            
    // lock (Session.GetHabbo().GetMessenger().GetBuddies())
                            
    lock ((Session.GetHabbo().GetMessenger().GetBuddies()))
                            {
                                foreach (
    MessengerBuddy Buddy in Session.GetHabbo().GetMessenger().GetBuddies())
                                {
                                    
    GameClient Client UberEnvironment.GetGame().GetClientManager().GetClientByHabbo(Buddy.Id);

                                    if (
    Client == null || Client.GetHabbo() == null || Client.GetHabbo().CurrentRoomId <= 0)
                                    {
                                        continue;
                                    }

                                    
    FriendRooms.Add(Client.GetHabbo().CurrentRoomId);
                                }
                            }

                            
    StringBuilder _Query = new StringBuilder("SELECT * FROM rooms WHERE");

                            
    int _i 0;

                            foreach (
    uint Room in FriendRooms)
                            {
                                if (
    _i 0)
                                {
                                    
    _Query.Append(" OR");
                                }

                                
    _Query.Append(" id = '" Room "'");

                                
    _i++;
                            }

                            
    _Query.Append(" ORDER BY users_now DESC LIMIT 40");

                            if (
    _i 0)
                            {
                                
    Data dbClient.ReadDataTable(_Query.ToString());
                            }
                            else
                            {
                                
    Data null;
                            }

                            break;

                        case -
    4:

                            List<
    stringFriendsNames = new List<string>();

                            
    // lock ()
                            
    lock ((Session.GetHabbo().GetMessenger().GetBuddies()))
                            {
                                foreach (
    MessengerBuddy Buddy in Session.GetHabbo().GetMessenger().GetBuddies())
                                {
                                    
    FriendsNames.Add(Buddy.Username);
                                }
                            }

                            
    StringBuilder Query = new StringBuilder("SELECT * FROM rooms WHERE");

                            
    int i 0;

                            foreach (
    string Name in FriendsNames)
                            {
                                if (
    0)
                                {
                                    
    Query.Append(" OR");
                                }

                                
    Query.Append(" owner = '" Name "'");

                                
    i++;
                            }

                            
    Query.Append(" ORDER BY users_now DESC LIMIT 40");

                            if (
    0)
                            {
                                
    Data dbClient.ReadDataTable(Query.ToString());
                            }
                            else
                            {
                                
    Data null;
                            }

                            break;

                        case -
    3:

                            
    Data dbClient.ReadDataTable("SELECT * FROM rooms WHERE owner = '" Session.GetHabbo().Username "' ORDER BY id ASC");
                            break;

                        case -
    2:
                            
                            
    Data dbClient.ReadDataTable("SELECT * FROM rooms WHERE score > 0 AND roomtype = 'private' ORDER BY score DESC LIMIT 40");
                            break;

                        case -
    1:

                            
    Data dbClient.ReadDataTable("SELECT * FROM rooms WHERE users_now > 0 AND roomtype = 'private' ORDER BY users_now DESC LIMIT 40");
                            break;

                        default:

                            
    Data dbClient.ReadDataTable("SELECT * FROM rooms WHERE category = '" Mode "' AND roomtype = 'private' ORDER BY users_now DESC LIMIT 40");
                            break;
                    }
                }

                if (
    Data == null)
                {
                    
    Rooms.AppendInt32(0);
                }
                else
                {
                    
    Rooms.AppendInt32(Data.Rows.Count);

                    foreach (
    DataRow Row in Data.Rows)
                    {
                        
    UberEnvironment.GetGame().GetRoomManager().GenerateRoomData((uint)Row["id"]).Serialize(Roomsfalse);
                    }
                }

    lock (PublicRecommended
                {
                    foreach (
    PublicRecommended Pub in PublicRecommended.Values)
                    {
                        
    Pub.Serialize(Rooms); // Et la, on envoi le tout ;)
                    
    }
                }

                return 
    Rooms;
            }
        }


  4. #4
    What about no. Davidaap is offline
    Grand MasterRank
    Nov 2009 Join Date
    773Posts

    Re: ADDON UBEREMU : Room Recommanded & Appart categories

    It works :D
    thanks!

  5. #5
    Demi-God tweeney is offline
    Grand MasterRank
    Aug 2008 Join Date
    888Posts

    Re: ADDON UBEREMU : Room Recommanded & Appart categories

    What does this do?

    Is it the recomended rooms at the bottom of the navigator?

  6. #6
    What about no. Davidaap is offline
    Grand MasterRank
    Nov 2009 Join Date
    773Posts

    Re: ADDON UBEREMU : Room Recommanded & Appart categories

    yes, i will make a screen

    ----
    Last edited by Davidaap; 03-04-11 at 04:11 PM.

  7. #7
    Member dimitri54480 is offline
    MemberRank
    Feb 2011 Join Date
    44Posts

    Re: ADDON UBEREMU : Room Recommanded & Appart categories

    Thank you for the screnn, i put this in my release

  8. #8
    Grand Master salah-salah is offline
    Grand MasterRank
    Jan 2009 Join Date
    UndergroundLocation
    716Posts

    Re: ADDON UBEREMU : Room Recommanded & Appart categories

    WOOT THANKS:o

  9. #9
    Sorcerer Supreme FlyCoder is offline
    Member +Rank
    Jan 2011 Join Date
    United KingdomLocation
    469Posts

    Re: ADDON UBEREMU : Room Recommanded & Appart categories

    Kewl release. 1 Question...

    Will it show which room has the most Users or just a random one?

  10. #10
    What about no. Davidaap is offline
    Grand MasterRank
    Nov 2009 Join Date
    773Posts

    Re: ADDON UBEREMU : Room Recommanded & Appart categories

    Quote Originally Posted by FlyCoder View Post
    Kewl release. 1 Question...

    Will it show which room has the most Users or just a random one?
    no, just the publics room that you have selected

  11. #11
    Member Rocksmurf is offline
    MemberRank
    Jan 2011 Join Date
    28Posts

    Re: ADDON UBEREMU : Room Recommanded & Appart categories

    Wtf?

    http://www.plaatjesupload.nl/bekijk/2011/04/03/1301830998-470.png

    I saw that?

  12. #12
    Member scription is offline
    MemberRank
    Jun 2010 Join Date
    66Posts

    Re: ADDON UBEREMU : Room Recommanded & Appart categories

    Works, Nice :D

    @Rocksmurf
    Search:
    DataTable dPubCats = null;
    DataTable dPrivCats = null;
    DataTable dPubItems = null;

    Ad after that:

    DataTable dPubRecommended = null;

    (Navigator.cs)
    Last edited by scription; 03-04-11 at 06:17 PM.

  13. #13
    Member Rocksmurf is offline
    MemberRank
    Jan 2011 Join Date
    28Posts

    Re: ADDON UBEREMU : Room Recommanded & Appart categories

    Thank you!

    It's Working :P

  14. #14
    Member WizardKing is offline
    MemberRank
    Apr 2011 Join Date
    Somewhere on eaLocation
    70Posts

    Re: ADDON UBEREMU : Room Recommanded & Appart categories

    and appart categories?

  15. #15
    Grand Master Miggs is offline
    Grand MasterRank
    Oct 2010 Join Date
    711Posts

    Re: ADDON UBEREMU : Room Recommanded & Appart categories

    Very nice.Thanks for releasing...But we should thanks Anthony aswell :D

  16. #16
    Sorcerer Supreme GuikBretas is offline
    Member +Rank
    Apr 2009 Join Date
    NorwayLocation
    332Posts

    Re: ADDON UBEREMU : Room Recommanded & Appart categories


  17. #17
    Member samuele309 is offline
    MemberRank
    Mar 2011 Join Date
    52Posts

    Re: ADDON UBEREMU : Room Recommanded & Appart categories

    Thank, 100 % :)



Advertisement