示例#1
0
        public MoodlightData(int ItemId)
        {
            this.ItemId = ItemId;

            DataRow Row = null;

            using (IQueryAdapter dbClient = RocketEmulador.GetDatabaseManager().GetQueryReactor())
            {
                dbClient.SetQuery("SELECT enabled,current_preset,preset_one,preset_two,preset_three FROM room_items_moodlight WHERE item_id = '" + ItemId + "' LIMIT 1");
                Row = dbClient.getRow();
            }

            if (Row == null)
            {
                using (IQueryAdapter dbClient = RocketEmulador.GetDatabaseManager().GetQueryReactor())
                {
                    dbClient.RunQuery("INSERT INTO `room_items_moodlight` (item_id,enabled,current_preset,preset_one,preset_two,preset_three) VALUES (" + ItemId + ",0,1,'#000000,255,0','#000000,255,0','#000000,255,0')");
                    dbClient.SetQuery("SELECT enabled,current_preset,preset_one,preset_two,preset_three FROM room_items_moodlight WHERE item_id=" + ItemId + " LIMIT 1");
                    Row = dbClient.getRow();
                }
            }

            Enabled       = RocketEmulador.EnumToBool(Row["enabled"].ToString());
            CurrentPreset = Convert.ToInt32(Row["current_preset"]);
            Presets       = new List <MoodlightPreset>();

            Presets.Add(GeneratePreset(Convert.ToString(Row["preset_one"])));
            Presets.Add(GeneratePreset(Convert.ToString(Row["preset_two"])));
            Presets.Add(GeneratePreset(Convert.ToString(Row["preset_three"])));
        }
示例#2
0
        public static MoodlightPreset GeneratePreset(string Data)
        {
            String[] Bits = Data.Split(',');

            if (!IsValidColor(Bits[0]))
            {
                Bits[0] = "#000000";
            }

            return(new MoodlightPreset(Bits[0], int.Parse(Bits[1]), RocketEmulador.EnumToBool(Bits[2])));
        }
示例#3
0
        public void Init()
        {
            if (this._televisions.Count > 0)
            {
                _televisions.Clear();
            }

            DataTable getData = null;

            using (IQueryAdapter dbClient = RocketEmulador.GetDatabaseManager().GetQueryReactor())
            {
                dbClient.SetQuery("SELECT * FROM `items_youtube` ORDER BY `id` DESC");
                getData = dbClient.getTable();

                if (getData != null)
                {
                    foreach (DataRow Row in getData.Rows)
                    {
                        this._televisions.Add(Convert.ToInt32(Row["id"]), new TelevisionItem(Convert.ToInt32(Row["id"]), Row["youtube_id"].ToString(), Row["title"].ToString(), Row["description"].ToString(), RocketEmulador.EnumToBool(Row["enabled"].ToString())));
                    }
                }
            }



            Console.ForegroundColor = ConsoleColor.White;
            Console.WriteLine("       [FUNCIONANDO] => [Rocket Emu] =>  Carregando item da televisão..");
        }
        public void Parse(HabboHotel.GameClients.GameClient Session, ClientPacket Packet)
        {
            if (Session == null || Session.GetHabbo() == null)
            {
                return;
            }

            Room Room = RocketEmulador.GetGame().GetRoomManager().LoadRoom(Packet.PopInt());

            if (Room == null || !Room.CheckRights(Session, true))
            {
                return;
            }

            string     Name        = RocketEmulador.GetGame().GetChatManager().GetFilter().CheckMessage(Packet.PopString());
            string     Description = RocketEmulador.GetGame().GetChatManager().GetFilter().CheckMessage(Packet.PopString());
            RoomAccess Access      = RoomAccessUtility.ToRoomAccess(Packet.PopInt());
            string     Password    = Packet.PopString();
            int        MaxUsers    = Packet.PopInt();
            int        CategoryId  = Packet.PopInt();
            int        TagCount    = Packet.PopInt();

            List <string> Tags          = new List <string>();
            StringBuilder formattedTags = new StringBuilder();

            for (int i = 0; i < TagCount; i++)
            {
                if (i > 0)
                {
                    formattedTags.Append(",");
                }

                string tag = Packet.PopString().ToLower();

                Tags.Add(tag);
                formattedTags.Append(tag);
            }

            int TradeSettings       = Packet.PopInt();//2 = All can trade, 1 = owner only, 0 = no trading.
            int AllowPets           = Convert.ToInt32(RocketEmulador.BoolToEnum(Packet.PopBoolean()));
            int AllowPetsEat        = Convert.ToInt32(RocketEmulador.BoolToEnum(Packet.PopBoolean()));
            int RoomBlockingEnabled = Convert.ToInt32(RocketEmulador.BoolToEnum(Packet.PopBoolean()));
            int Hidewall            = Convert.ToInt32(RocketEmulador.BoolToEnum(Packet.PopBoolean()));
            int WallThickness       = Packet.PopInt();
            int FloorThickness      = Packet.PopInt();
            int WhoMute             = Packet.PopInt(); // mute
            int WhoKick             = Packet.PopInt(); // kick
            int WhoBan = Packet.PopInt();              // ban

            int chatMode     = Packet.PopInt();
            int chatSize     = Packet.PopInt();
            int chatSpeed    = Packet.PopInt();
            int chatDistance = Packet.PopInt();
            int extraFlood   = Packet.PopInt();

            if (chatMode < 0 || chatMode > 1)
            {
                chatMode = 0;
            }

            if (chatSize < 0 || chatSize > 2)
            {
                chatSize = 0;
            }

            if (chatSpeed < 0 || chatSpeed > 2)
            {
                chatSpeed = 0;
            }

            if (chatDistance < 0)
            {
                chatDistance = 1;
            }

            if (chatDistance > 99)
            {
                chatDistance = 100;
            }

            if (extraFlood < 0 || extraFlood > 2)
            {
                extraFlood = 0;
            }

            if (TradeSettings < 0 || TradeSettings > 2)
            {
                TradeSettings = 0;
            }

            if (WhoMute < 0 || WhoMute > 1)
            {
                WhoMute = 0;
            }

            if (WhoKick < 0 || WhoKick > 1)
            {
                WhoKick = 0;
            }

            if (WhoBan < 0 || WhoBan > 1)
            {
                WhoBan = 0;
            }

            if (WallThickness < -2 || WallThickness > 1)
            {
                WallThickness = 0;
            }

            if (FloorThickness < -2 || FloorThickness > 1)
            {
                FloorThickness = 0;
            }

            if (Name.Length < 1)
            {
                return;
            }

            if (Name.Length > 60)
            {
                Name = Name.Substring(0, 60);
            }

            if (Access == RoomAccess.PASSWORD && Password.Length == 0)
            {
                Access = RoomAccess.OPEN;
            }

            if (MaxUsers < 0)
            {
                MaxUsers = 10;
            }

            if (MaxUsers > 50)
            {
                MaxUsers = 50;
            }

            SearchResultList SearchResultList = null;

            if (!RocketEmulador.GetGame().GetNavigator().TryGetSearchResultList(CategoryId, out SearchResultList))
            {
                CategoryId = 36;
            }

            if (SearchResultList.CategoryType != NavigatorCategoryType.CATEGORY || SearchResultList.RequiredRank > Session.GetHabbo().Rank || (Session.GetHabbo().Id != Room.OwnerId && Session.GetHabbo().Rank >= SearchResultList.RequiredRank))
            {
                CategoryId = 36;
            }

            if (TagCount > 2)
            {
                return;
            }

            Room.AllowPets           = AllowPets;
            Room.AllowPetsEating     = AllowPetsEat;
            Room.RoomBlockingEnabled = RoomBlockingEnabled;
            Room.Hidewall            = Hidewall;

            Room.RoomData.AllowPets           = AllowPets;
            Room.RoomData.AllowPetsEating     = AllowPetsEat;
            Room.RoomData.RoomBlockingEnabled = RoomBlockingEnabled;
            Room.RoomData.Hidewall            = Hidewall;

            Room.Name        = Name;
            Room.Access      = Access;
            Room.Description = Description;
            Room.Category    = CategoryId;
            Room.Password    = Password;

            Room.RoomData.Name        = Name;
            Room.RoomData.Access      = Access;
            Room.RoomData.Description = Description;
            Room.RoomData.Category    = CategoryId;
            Room.RoomData.Password    = Password;

            Room.WhoCanBan           = WhoBan;
            Room.WhoCanKick          = WhoKick;
            Room.WhoCanMute          = WhoMute;
            Room.RoomData.WhoCanBan  = WhoBan;
            Room.RoomData.WhoCanKick = WhoKick;
            Room.RoomData.WhoCanMute = WhoMute;

            Room.ClearTags();
            Room.AddTagRange(Tags);
            Room.UsersMax = MaxUsers;

            Room.RoomData.Tags.Clear();
            Room.RoomData.Tags.AddRange(Tags);
            Room.RoomData.UsersMax = MaxUsers;

            Room.WallThickness           = WallThickness;
            Room.FloorThickness          = FloorThickness;
            Room.RoomData.WallThickness  = WallThickness;
            Room.RoomData.FloorThickness = FloorThickness;

            Room.chatMode     = chatMode;
            Room.chatSize     = chatSize;
            Room.chatSpeed    = chatSpeed;
            Room.chatDistance = chatDistance;
            Room.extraFlood   = extraFlood;

            Room.TradeSettings = TradeSettings;

            Room.RoomData.chatMode     = chatMode;
            Room.RoomData.chatSize     = chatSize;
            Room.RoomData.chatSpeed    = chatSpeed;
            Room.RoomData.chatDistance = chatDistance;
            Room.RoomData.extraFlood   = extraFlood;

            Room.RoomData.TradeSettings = TradeSettings;

            string AccessStr = Password.Length > 0 ? "password" : "open";

            switch (Access)
            {
            default:
            case RoomAccess.OPEN:
                AccessStr = "open";
                break;

            case RoomAccess.PASSWORD:
                AccessStr = "password";
                break;

            case RoomAccess.DOORBELL:
                AccessStr = "locked";
                break;

            case RoomAccess.INVISIBLE:
                AccessStr = "invisible";
                break;
            }

            using (IQueryAdapter dbClient = RocketEmulador.GetDatabaseManager().GetQueryReactor())
            {
                dbClient.SetQuery("UPDATE rooms SET caption = @caption, description = @description, password = @password, category = " +
                                  CategoryId + ", state = '" + AccessStr + "', tags = @tags, users_max = " + MaxUsers +
                                  ", allow_pets = '" + AllowPets + "', allow_pets_eat = '" + AllowPetsEat + "', room_blocking_disabled = '" +
                                  RoomBlockingEnabled + "', allow_hidewall = '" + Room.Hidewall + "', floorthick = " +
                                  Room.FloorThickness + ", wallthick = " + Room.WallThickness + ", mute_settings='" + Room.WhoCanMute +
                                  "', kick_settings='" + Room.WhoCanKick + "',ban_settings='" + Room.WhoCanBan + "', `chat_mode` = '" + Room.chatMode + "', `chat_size` = '" + Room.chatSize + "', `chat_speed` = '" + Room.chatSpeed + "', `chat_extra_flood` = '" + Room.extraFlood + "', `chat_hearing_distance` = '" + Room.chatDistance + "', `trade_settings` = '" + Room.TradeSettings + "' WHERE `id` = '" + Room.RoomId + "' LIMIT 1");
                dbClient.AddParameter("caption", Room.Name);
                dbClient.AddParameter("description", Room.Description);
                dbClient.AddParameter("password", Room.Password);
                dbClient.AddParameter("tags", formattedTags.ToString());
                dbClient.RunQuery();
            }

            Room.GetGameMap().GenerateMaps();

            if (Session.GetHabbo().CurrentRoom == null)
            {
                Session.SendMessage(new RoomSettingsSavedComposer(Room.RoomId));
                Session.SendMessage(new RoomInfoUpdatedComposer(Room.RoomId));
                Session.SendMessage(new RoomVisualizationSettingsComposer(Room.WallThickness, Room.FloorThickness, RocketEmulador.EnumToBool(Room.Hidewall.ToString())));
            }
            else
            {
                Room.SendMessage(new RoomSettingsSavedComposer(Room.RoomId));
                Room.SendMessage(new RoomInfoUpdatedComposer(Room.RoomId));
                Room.SendMessage(new RoomVisualizationSettingsComposer(Room.WallThickness, Room.FloorThickness, RocketEmulador.EnumToBool(Room.Hidewall.ToString())));
            }

            RocketEmulador.GetGame().GetAchievementManager().ProgressAchievement(Session, "ACH_SelfModDoorModeSeen", 1);
            RocketEmulador.GetGame().GetAchievementManager().ProgressAchievement(Session, "ACH_SelfModWalkthroughSeen", 1);
            RocketEmulador.GetGame().GetAchievementManager().ProgressAchievement(Session, "ACH_SelfModChatScrollSpeedSeen", 1);
            RocketEmulador.GetGame().GetAchievementManager().ProgressAchievement(Session, "ACH_SelfModChatFloodFilterSeen", 1);
            RocketEmulador.GetGame().GetAchievementManager().ProgressAchievement(Session, "ACH_SelfModChatHearRangeSeen", 1);
        }
示例#5
0
        public void Parse(HabboHotel.GameClients.GameClient Session, ClientPacket Packet)
        {
            if (!Session.GetHabbo().InRoom)
            {
                return;
            }

            Room Room = Session.GetHabbo().CurrentRoom;

            if (Room == null)
            {
                return;
            }

            DynamicRoomModel Model = Room.GetGameMap().Model;

            if (Model == null)
            {
                return;
            }

            ICollection <Item> FloorItems = Room.GetRoomItemHandler().GetFloor;

            Session.SendMessage(new FloorPlanFloorMapComposer(FloorItems));
            Session.SendMessage(new FloorPlanSendDoorComposer(Model.DoorX, Model.DoorY, Model.DoorOrientation));
            Session.SendMessage(new RoomVisualizationSettingsComposer(Room.WallThickness, Room.FloorThickness, RocketEmulador.EnumToBool(Room.Hidewall.ToString())));
        }
示例#6
0
        public void Init()
        {
            if (_games.Count > 0)
            {
                _games.Clear();
            }

            using (IQueryAdapter dbClient = RocketEmulador.GetDatabaseManager().GetQueryReactor())
            {
                DataTable GetData = null;
                dbClient.SetQuery("SELECT `id`,`name`,`colour_one`,`colour_two`,`resource_path`,`string_three`,`game_swf`,`game_assets`,`game_server_host`,`game_server_port`,`socket_policy_port`,`game_enabled` FROM `games_config`");
                GetData = dbClient.getTable();

                if (GetData != null)
                {
                    foreach (DataRow Row in GetData.Rows)
                    {
                        this._games.Add(Convert.ToInt32(Row["id"]), new GameData(Convert.ToInt32(Row["id"]), Convert.ToString(Row["name"]), Convert.ToString(Row["colour_one"]), Convert.ToString(Row["colour_two"]), Convert.ToString(Row["resource_path"]), Convert.ToString(Row["string_three"]), Convert.ToString(Row["game_swf"]), Convert.ToString(Row["game_assets"]), Convert.ToString(Row["game_server_host"]), Convert.ToString(Row["game_server_port"]), Convert.ToString(Row["socket_policy_port"]), RocketEmulador.EnumToBool(Row["game_enabled"].ToString())));
                    }
                }
            }

            Console.ForegroundColor = ConsoleColor.White;
            Console.WriteLine("       [FUNCIONANDO] => [Rocket Emu] =>  Carregando as configurações de jogos.");
        }
        public void Parse(HabboHotel.GameClients.GameClient Session, ClientPacket Packet)
        {
            if (Session == null || Session.GetHabbo() == null)
            {
                return;
            }

            Room Room = Session.GetHabbo().CurrentRoom;

            if (Room == null)
            {
                return;
            }

            if (Session.GetHabbo().InRoom)
            {
                Room OldRoom;

                if (!RocketEmulador.GetGame().GetRoomManager().TryGetRoom(Session.GetHabbo().CurrentRoomId, out OldRoom))
                {
                    return;
                }

                if (OldRoom.GetRoomUserManager() != null)
                {
                    OldRoom.GetRoomUserManager().RemoveUserFromRoom(Session, false, false);
                }
            }

            if (!Room.GetRoomUserManager().AddAvatarToRoom(Session))
            {
                Room.GetRoomUserManager().RemoveUserFromRoom(Session, false, false);
                return;//TODO: Remove?
            }

            Room.SendObjects(Session);

            //Status updating for messenger, do later as buggy.

            try
            {
                if (Session.GetHabbo().GetMessenger() != null)
                {
                    Session.GetHabbo().GetMessenger().OnStatusChanged(true);
                }
            }
            catch { }

            if (Session.GetHabbo().GetStats().QuestID > 0)
            {
                RocketEmulador.GetGame().GetQuestManager().QuestReminder(Session, Session.GetHabbo().GetStats().QuestID);
            }

            Session.SendMessage(new RoomEntryInfoComposer(Room.RoomId, Room.CheckRights(Session, true)));
            Session.SendMessage(new RoomVisualizationSettingsComposer(Room.WallThickness, Room.FloorThickness, RocketEmulador.EnumToBool(Room.Hidewall.ToString())));

            RoomUser ThisUser = Room.GetRoomUserManager().GetRoomUserByHabbo(Session.GetHabbo().Username);

            if (ThisUser != null && Session.GetHabbo().PetId == 0)
            {
                Room.SendMessage(new UserChangeComposer(ThisUser, false));
            }

            Session.SendMessage(new RoomEventComposer(Room.RoomData, Room.RoomData.Promotion));

            if (Room.GetWired() != null)
            {
                Room.GetWired().TriggerEvent(WiredBoxType.TriggerRoomEnter, Session.GetHabbo());
            }

            if (RocketEmulador.GetUnixTimestamp() < Session.GetHabbo().FloodTime&& Session.GetHabbo().FloodTime != 0)
            {
                Session.SendMessage(new FloodControlComposer((int)Session.GetHabbo().FloodTime - (int)RocketEmulador.GetUnixTimestamp()));
            }

            if (Room.OwnerId == Session.GetHabbo().Id)
            {
                DataRow dFrank = null;
                using (var dbClient = RocketEmulador.GetDatabaseManager().GetQueryReactor())
                {
                    dbClient.SetQuery("SELECT bot_frank FROM users WHERE id = '" + Session.GetHabbo().Id + "'");
                    dFrank = dbClient.getRow();
                }

                if (Convert.ToBoolean(dFrank["bot_frank"]) == false)
                {
                    using (var dbClient = RocketEmulador.GetDatabaseManager().GetQueryReactor())
                    {
                        dbClient.RunQuery("UPDATE users SET bot_frank = 'true' WHERE id = " + Session.GetHabbo().Id + ";");
                        dbClient.RunQuery("UPDATE users SET bot_user = '******' WHERE id = " + Session.GetHabbo().Id + ";");
                    }
                    string Chat1    = RocketEmulador.GetDBConfig().DBData["frank.chat.1"];
                    string Chat2    = RocketEmulador.GetDBConfig().DBData["frank.chat.2"];
                    string Chat3    = RocketEmulador.GetDBConfig().DBData["frank.chat.3"];
                    string Chat4    = RocketEmulador.GetDBConfig().DBData["frank.chat.4"];
                    string Chat5    = RocketEmulador.GetDBConfig().DBData["frank.chat.5"];
                    string Credits  = RocketEmulador.GetDBConfig().DBData["frank.give.credits"];
                    string Diamonds = RocketEmulador.GetDBConfig().DBData["frank.give.diamonds"];
                    string Duckets  = RocketEmulador.GetDBConfig().DBData["frank.give.duckets"];
                    string Gotws    = RocketEmulador.GetDBConfig().DBData["frank.give.gotws"];
                    string Furni    = RocketEmulador.GetDBConfig().DBData["frank.give.furni"];

                    List <RandomSpeech> BotSpeechList = new List <RandomSpeech>();
                    Console.WriteLine("Só se mostra bot e nuxs 1 vez por usuario.");
                    int      X       = 0;
                    int      Y       = 0;
                    string   hola    = "false";
                    RoomUser BotUser = Room.GetRoomUserManager().DeployBot(new RoomBot(0, Session.GetHabbo().CurrentRoomId, "generic", "freeroam", "Frank", "Gerente do hotel", "hr-3194-38-36.hd-180-1.ch-220-1408.lg-285-73.sh-906-90.ha-3129-73.fa-1206-73.cc-3039-73", X, Y, 0, 4, 0, 0, 0, 0, ref BotSpeechList, "", 0, 0, false, 0, Convert.ToBoolean(hola), 1), null);
                    System.Threading.Thread.Sleep(4000); // Mensagem de Boas vindas.
                    BotUser.Chat(Chat1, false, 0);
                    System.Threading.Thread.Sleep(3000); // Segunda mensagem
                    BotUser.Chat(Chat2, false, 0);
                    System.Threading.Thread.Sleep(2000); // Terceira mensagem e entrega das moedas
                    if (!string.IsNullOrWhiteSpace(Credits) && !string.IsNullOrWhiteSpace(Diamonds) && !string.IsNullOrWhiteSpace(Duckets) && !string.IsNullOrWhiteSpace(Gotws))
                    {
                        BotUser.Chat("Você tem " + Credits + " créditos, " + Diamonds + " diamantes, " + Duckets + " duckets, " + Gotws + " estrelas e nubes!", false, 0);
                        Session.GetHabbo().Credits    += Convert.ToInt32(RocketEmulador.GetDBConfig().DBData["frank.give.credits"]);
                        Session.GetHabbo().Diamonds   += Convert.ToInt32(RocketEmulador.GetDBConfig().DBData["frank.give.diamonds"]);
                        Session.GetHabbo().Duckets    += Convert.ToInt32(RocketEmulador.GetDBConfig().DBData["frank.give.duckets"]);
                        Session.GetHabbo().GOTWPoints += Convert.ToInt32(RocketEmulador.GetDBConfig().DBData["frank.give.gotws"]);
                        Session.SendMessage(new CreditBalanceComposer(Session.GetHabbo().Credits));
                    }
                    else if (!string.IsNullOrWhiteSpace(Credits) && !string.IsNullOrWhiteSpace(Diamonds) && !string.IsNullOrWhiteSpace(Duckets) && !string.IsNullOrWhiteSpace(Gotws))
                    {
                        BotUser.Chat("Você tem " + Credits + " créditos, " + Diamonds + " diamantes, " + Duckets + " duckets e " + Gotws + " estrelas!", false, 0);
                        Session.GetHabbo().Credits    += Convert.ToInt32(RocketEmulador.GetDBConfig().DBData["frank.give.credits"]);
                        Session.GetHabbo().Diamonds   += Convert.ToInt32(RocketEmulador.GetDBConfig().DBData["frank.give.diamonds"]);
                        Session.GetHabbo().Duckets    += Convert.ToInt32(RocketEmulador.GetDBConfig().DBData["frank.give.duckets"]);
                        Session.GetHabbo().GOTWPoints += Convert.ToInt32(RocketEmulador.GetDBConfig().DBData["frank.give.gotws"]);
                        Session.SendMessage(new CreditBalanceComposer(Session.GetHabbo().Credits));
                        Session.SendMessage(new ActivityPointsComposer(Session.GetHabbo().Duckets, Session.GetHabbo().Diamonds, Session.GetHabbo().GOTWPoints));
                    }
                    else if (!string.IsNullOrWhiteSpace(Credits) && !string.IsNullOrWhiteSpace(Diamonds) && !string.IsNullOrWhiteSpace(Duckets))
                    {
                        BotUser.Chat("Você tem " + Credits + " créditos, " + Diamonds + " diamantes e " + Duckets + " duckets!", false, 0);
                        Session.GetHabbo().Credits  += Convert.ToInt32(RocketEmulador.GetDBConfig().DBData["frank.give.credits"]);
                        Session.GetHabbo().Diamonds += Convert.ToInt32(RocketEmulador.GetDBConfig().DBData["frank.give.diamonds"]);
                        Session.GetHabbo().Duckets  += Convert.ToInt32(RocketEmulador.GetDBConfig().DBData["frank.give.duckets"]);
                        Session.SendMessage(new CreditBalanceComposer(Session.GetHabbo().Credits));
                        Session.SendMessage(new ActivityPointsComposer(Session.GetHabbo().Duckets, Session.GetHabbo().Diamonds, Session.GetHabbo().GOTWPoints));
                    }
                    else if (!string.IsNullOrWhiteSpace(Credits) && !string.IsNullOrWhiteSpace(Diamonds))
                    {
                        BotUser.Chat("Você tem " + Credits + " créditos e " + Diamonds + " diamantes!", false, 0);
                        Session.GetHabbo().Credits  += Convert.ToInt32(RocketEmulador.GetDBConfig().DBData["frank.give.credits"]);
                        Session.GetHabbo().Diamonds += Convert.ToInt32(RocketEmulador.GetDBConfig().DBData["frank.give.diamonds"]);
                        Session.SendMessage(new CreditBalanceComposer(Session.GetHabbo().Credits));
                        Session.SendMessage(new ActivityPointsComposer(Session.GetHabbo().Duckets, Session.GetHabbo().Diamonds, Session.GetHabbo().GOTWPoints));
                    }
                    else if (!string.IsNullOrWhiteSpace(Credits))
                    {
                        BotUser.Chat("Você tem " + Credits + " créditos!", false, 0);
                        Session.GetHabbo().Credits += Convert.ToInt32(RocketEmulador.GetDBConfig().DBData["frank.give.credits"]);
                        Session.SendMessage(new CreditBalanceComposer(Session.GetHabbo().Credits));
                    }
                    else
                    {
                        BotUser.Chat("Não iremos te dar nada por enquanto.", false, 0);
                    }
                    if (!string.IsNullOrWhiteSpace(Chat4) || !string.IsNullOrEmpty(Furni))
                    {
                        System.Threading.Thread.Sleep(4000); // Quarta mensagen, entregando o raro.
                        BotUser.Chat(Chat4, false, 0);
                        DataRow dFurni = null;
                        using (var dbClient = RocketEmulador.GetDatabaseManager().GetQueryReactor())
                        {
                            dbClient.SetQuery("SELECT public_name FROM furniture WHERE id = '" + Convert.ToInt32(Furni) + "'");
                            dFurni = dbClient.getRow();
                        }
                        Session.GetHabbo().GetInventoryComponent().AddNewItem(0, Convert.ToInt32(Furni), Convert.ToString(dFurni["public_name"]), 1, true, false, 0, 0);
                        Session.GetHabbo().GetInventoryComponent().UpdateItems(false);
                    }
                    System.Threading.Thread.Sleep(5000); // Quinta mensagem.
                    BotUser.Chat(Chat5, false, 0);
                    Room.GetGameMap().RemoveUserFromMap(BotUser, new System.Drawing.Point(0, 0));
                    Room.GetRoomUserManager().RemoveBot(BotUser.VirtualId, false);
                }
                else
                {
                    Console.WriteLine("O Bot não irá mais aparecer para esse usuário.");
                }
            }
        }
示例#8
0
        public void Parse(HabboHotel.GameClients.GameClient Session, ClientPacket Packet)
        {
            if (!Session.GetHabbo().InRoom)
            {
                return;
            }

            Room Room;

            if (!RocketEmulador.GetGame().GetRoomManager().TryGetRoom(Session.GetHabbo().CurrentRoomId, out Room))
            {
                return;
            }

            if (!Room.CheckRights(Session, true))
            {
                return;
            }

            int BotId = Packet.PopInt();
            int X     = Packet.PopInt();
            int Y     = Packet.PopInt();

            if (!Room.GetGameMap().CanWalk(X, Y, false) || !Room.GetGameMap().ValidTile(X, Y))
            {
                Session.SendNotification("You cannot place a bot here!");
                return;
            }

            Bot Bot = null;

            if (!Session.GetHabbo().GetInventoryComponent().TryGetBot(BotId, out Bot))
            {
                return;
            }

            int BotCount = 0;

            foreach (RoomUser User in Room.GetRoomUserManager().GetUserList().ToList())
            {
                if (User == null || User.IsPet || !User.IsBot)
                {
                    continue;
                }

                BotCount += 1;
            }

            if (BotCount >= 5 && !Session.GetHabbo().GetPermissions().HasRight("bot_place_any_override"))
            {
                Session.SendNotification("Sorry; 5 bots per room only!");
                return;
            }

            //TODO: Hmm, maybe not????
            using (IQueryAdapter dbClient = RocketEmulador.GetDatabaseManager().GetQueryReactor())
            {
                dbClient.SetQuery("UPDATE `bots` SET `room_id` = '" + Room.RoomId + "', `x` = @CoordX, `y` = @CoordY WHERE `id` = @BotId LIMIT 1");
                dbClient.AddParameter("BotId", Bot.Id);
                dbClient.AddParameter("CoordX", X);
                dbClient.AddParameter("CoordY", Y);
                dbClient.RunQuery();
            }

            List <RandomSpeech> BotSpeechList = new List <RandomSpeech>();

            //TODO: Grab data?
            DataRow GetData = null;

            using (IQueryAdapter dbClient = RocketEmulador.GetDatabaseManager().GetQueryReactor())
            {
                dbClient.SetQuery("SELECT `ai_type`,`rotation`,`walk_mode`,`automatic_chat`,`speaking_interval`,`mix_sentences`,`chat_bubble` FROM `bots` WHERE `id` = @BotId LIMIT 1");
                dbClient.AddParameter("BotId", Bot.Id);
                GetData = dbClient.getRow();

                dbClient.SetQuery("SELECT `text` FROM `bots_speech` WHERE `bot_id` = @BotId");
                dbClient.AddParameter("BotId", Bot.Id);
                DataTable BotSpeech = dbClient.getTable();

                foreach (DataRow Speech in BotSpeech.Rows)
                {
                    BotSpeechList.Add(new RandomSpeech(Convert.ToString(Speech["text"]), Bot.Id));
                }
            }

            RoomUser BotUser = Room.GetRoomUserManager().DeployBot(new RoomBot(Bot.Id, Session.GetHabbo().CurrentRoomId, Convert.ToString(GetData["ai_type"]), Convert.ToString(GetData["walk_mode"]), Bot.Name, "", Bot.Figure, X, Y, 0, 4, 0, 0, 0, 0, ref BotSpeechList, "", 0, Bot.OwnerId, RocketEmulador.EnumToBool(GetData["automatic_chat"].ToString()), Convert.ToInt32(GetData["speaking_interval"]), RocketEmulador.EnumToBool(GetData["mix_sentences"].ToString()), Convert.ToInt32(GetData["chat_bubble"])), null);

            BotUser.Chat("Hello!", false, 0);

            Room.GetGameMap().UpdateUserMovement(new System.Drawing.Point(X, Y), new System.Drawing.Point(X, Y), BotUser);


            Bot ToRemove = null;

            if (!Session.GetHabbo().GetInventoryComponent().TryRemoveBot(BotId, out ToRemove))
            {
                Console.WriteLine("Error whilst removing Bot: " + ToRemove.Id);
                return;
            }
            Session.SendMessage(new BotInventoryComposer(Session.GetHabbo().GetInventoryComponent().GetBots()));
        }
示例#9
0
        public void Init(ItemDataManager ItemDataManager)
        {
            if (this._pages.Count > 0)
            {
                this._pages.Clear();
            }
            if (this._botPresets.Count > 0)
            {
                this._botPresets.Clear();
            }
            if (this._items.Count > 0)
            {
                this._items.Clear();
            }
            if (this._deals.Count > 0)
            {
                this._deals.Clear();
            }

            using (IQueryAdapter dbClient = RocketEmulador.GetDatabaseManager().GetQueryReactor())
            {
                dbClient.SetQuery("SELECT `id`,`item_id`,`catalog_name`,`cost_credits`,`cost_pixels`,`cost_diamonds`, `cost_gotw`,`amount`,`page_id`,`limited_sells`,`limited_stack`,`offer_active`,`extradata`,`badge`,`offer_id` FROM `catalog_items`");
                DataTable CatalogueItems = dbClient.getTable();

                if (CatalogueItems != null)
                {
                    foreach (DataRow Row in CatalogueItems.Rows)
                    {
                        if (Convert.ToInt32(Row["amount"]) <= 0)
                        {
                            continue;
                        }

                        int ItemId  = Convert.ToInt32(Row["id"]);
                        int PageId  = Convert.ToInt32(Row["page_id"]);
                        int BaseId  = Convert.ToInt32(Row["item_id"]);
                        int OfferId = Convert.ToInt32(Row["offer_id"]);

                        ItemData Data = null;
                        if (!ItemDataManager.GetItem(BaseId, out Data))
                        {
                            Console.ForegroundColor = ConsoleColor.White;
                            Console.WriteLine("       [FUNCIONANDO] => [Rocket Emu] =>  Ocorreu um erro ao carregar o item " + ItemId + "por favor cheque a tabela furniture");
                            continue;
                        }

                        if (!this._items.ContainsKey(PageId))
                        {
                            this._items[PageId] = new Dictionary <int, CatalogItem>();
                        }

                        if (OfferId != -1 && !this._itemOffers.ContainsKey(OfferId))
                        {
                            this._itemOffers.Add(OfferId, PageId);
                        }

                        this._items[PageId].Add(Convert.ToInt32(Row["id"]), new CatalogItem(Convert.ToInt32(Row["id"]), Convert.ToInt32(Row["item_id"]),
                                                                                            Data, Convert.ToString(Row["catalog_name"]), Convert.ToInt32(Row["page_id"]), Convert.ToInt32(Row["cost_credits"]), Convert.ToInt32(Row["cost_pixels"]), Convert.ToInt32(Row["cost_diamonds"]), Convert.ToInt32(Row["cost_gotw"]),
                                                                                            Convert.ToInt32(Row["amount"]), Convert.ToInt32(Row["limited_sells"]), Convert.ToInt32(Row["limited_stack"]), RocketEmulador.EnumToBool(Row["offer_active"].ToString()),
                                                                                            Convert.ToString(Row["extradata"]), Convert.ToString(Row["badge"]), Convert.ToInt32(Row["offer_id"])));
                    }
                }

                dbClient.SetQuery("SELECT * FROM `catalog_deals`");
                DataTable GetDeals = dbClient.getTable();

                if (GetDeals != null)
                {
                    foreach (DataRow Row in GetDeals.Rows)
                    {
                        int    Id      = Convert.ToInt32(Row["id"]);
                        int    PageId  = Convert.ToInt32(Row["page_id"]);
                        string Items   = Convert.ToString(Row["items"]);
                        string Name    = Convert.ToString(Row["name"]);
                        int    Credits = Convert.ToInt32(Row["cost_credits"]);
                        int    Pixels  = Convert.ToInt32(Row["cost_pixels"]);

                        if (!this._deals.ContainsKey(PageId))
                        {
                            this._deals[PageId] = new Dictionary <int, CatalogDeal>();
                        }

                        CatalogDeal Deal = new CatalogDeal(Id, PageId, Items, Name, Credits, Pixels, ItemDataManager);
                        this._deals[PageId].Add(Deal.Id, Deal);
                    }
                }


                dbClient.SetQuery("SELECT `id`,`parent_id`,`caption`,`page_link`,`visible`,`enabled`,`min_rank`,`min_vip`,`icon_image`,`page_layout`,`page_strings_1`,`page_strings_2` FROM `catalog_pages` ORDER BY `order_num`");
                DataTable CatalogPages = dbClient.getTable();

                if (CatalogPages != null)
                {
                    foreach (DataRow Row in CatalogPages.Rows)
                    {
                        this._pages.Add(Convert.ToInt32(Row["id"]), new CatalogPage(Convert.ToInt32(Row["id"]), Convert.ToInt32(Row["parent_id"]), Row["enabled"].ToString(), Convert.ToString(Row["caption"]),
                                                                                    Convert.ToString(Row["page_link"]), Convert.ToInt32(Row["icon_image"]), Convert.ToInt32(Row["min_rank"]), Convert.ToInt32(Row["min_vip"]), Row["visible"].ToString(), Convert.ToString(Row["page_layout"]),
                                                                                    Convert.ToString(Row["page_strings_1"]), Convert.ToString(Row["page_strings_2"]),
                                                                                    this._items.ContainsKey(Convert.ToInt32(Row["id"])) ? this._items[Convert.ToInt32(Row["id"])] : new Dictionary <int, CatalogItem>(),
                                                                                    this._deals.ContainsKey(Convert.ToInt32(Row["id"])) ? this._deals[Convert.ToInt32(Row["id"])] : new Dictionary <int, CatalogDeal>(), ref this._itemOffers));
                    }
                }

                dbClient.SetQuery("SELECT `id`,`name`,`figure`,`motto`,`gender`,`ai_type` FROM `catalog_bot_presets`");
                DataTable bots = dbClient.getTable();

                if (bots != null)
                {
                    foreach (DataRow Row in bots.Rows)
                    {
                        this._botPresets.Add(Convert.ToInt32(Row[0]), new CatalogBot(Convert.ToInt32(Row[0]), Convert.ToString(Row[1]), Convert.ToString(Row[2]), Convert.ToString(Row[3]), Convert.ToString(Row[4]), Convert.ToString(Row[5])));
                    }
                }

                this._petRaceManager.Init();
                this._clothingManager.Init();
            }


            Console.ForegroundColor = ConsoleColor.White;
            Console.WriteLine("       [FUNCIONANDO] => [Rocket Emu] =>  Carregando as configurações do catálago.");
        }