public TargetOfferMessageComposer() : base(ServerPacketHeader.TargetOfferMessageComposer)
 {
     base.WriteInteger(1);
     base.WriteInteger(190);
     base.WriteString("bf16_tko_gr1");
     base.WriteString("bf16_tko1");
     base.WriteInteger(105); //Credits
     base.WriteInteger(105); //Diamonds
     base.WriteInteger(5);
     base.WriteInteger(2);
     base.WriteInteger(RocketEmulador.Oferta);                            //3 Days ... time in seconds
     base.WriteString(RocketEmulador.RocketData().data["oferta.title"]);  //Title
     base.WriteString(RocketEmulador.RocketData().data["oferta.desc"]);   //Description
     base.WriteString(RocketEmulador.RocketData().data["oferta.image"]);  //Image Large
     base.WriteString(RocketEmulador.RocketData().data["oferta.image1"]); //Image on Close Notification
     base.WriteInteger(1);
     base.WriteInteger(15);
     base.WriteString("wf_act_mute_triggerer"); //1 Month HC
     base.WriteString("wf_xtra_random");        //Snack
     base.WriteString("wf_act_leave_team");     //10 Credits
     base.WriteString("wf_trg_game_ends");      //Roof Building
     base.WriteString("wf_trg_game_ends");      //Snack
     base.WriteString("wf_trg_game_ends");      //10 Credits
     base.WriteString("wf_trg_game_ends");      //10 Credits
     base.WriteString("wf_trg_game_ends");      //Building 1
     base.WriteString("wf_trg_game_ends");      //Building 2
     base.WriteString("wf_trg_game_ends");      //10 Credits
     base.WriteString("wf_trg_game_ends");      //Clothes Scarf
     base.WriteString("wf_trg_game_ends");      //10 Credits
     base.WriteString("wf_trg_game_ends");      //10 Credits
     base.WriteString("wf_trg_game_ends");      //
     base.WriteString("wf_trg_game_ends");      //10 Credits
 }
Пример #2
0
        public void Init(ItemDataManager itemDataManager)
        {
            RocketEmulador.RocketData().data.TryGetValue("camera.path.preview", out this._previewPath);
            RocketEmulador.RocketData().data.TryGetValue("camera.path.purchased", out this._purchasedPath);

            if (RocketEmulador.RocketData().data.ContainsKey("camera.preview.maxcache"))
            {
                this._maxPreviewCacheCount = int.Parse(RocketEmulador.RocketData().data["camera.preview.maxcache"]);
            }

            if (RocketEmulador.GetDBConfig().DBData.ContainsKey("camera.photo.purchase.price.coins"))
            {
                this._purchaseCoinsPrice = int.Parse(RocketEmulador.GetDBConfig().DBData["camera.photo.purchase.price.coins"]);
            }

            if (RocketEmulador.GetDBConfig().DBData.ContainsKey("camera.photo.purchase.price.duckets"))
            {
                this._purchaseDucketsPrice = int.Parse(RocketEmulador.GetDBConfig().DBData["camera.photo.purchase.price.duckets"]);
            }

            if (RocketEmulador.GetDBConfig().DBData.ContainsKey("camera.photo.publish.price.duckets"))
            {
                this._publishDucketsPrice = int.Parse(RocketEmulador.GetDBConfig().DBData["camera.photo.publish.price.duckets"]);
            }

            int ItemId = int.Parse(RocketEmulador.GetDBConfig().DBData ["camera.photo.purchase.item_id"]);

            if (!itemDataManager.GetItem(ItemId, out this._photoPoster))
            {
                log.Error("Couldn't load photo poster item " + ItemId + ", no furniture record found.");
            }

            //log.Info("Camera Photo Manager -> LOADED");
        }
Пример #3
0
        public bool TryAuthenticate(string AuthTicket)
        {
            try
            {
                byte     errorCode = 0;
                UserData userData  = UserDataFactory.GetUserData(AuthTicket, out errorCode);
                if (errorCode == 1 || errorCode == 2)
                {
                    Disconnect();
                    return(false);
                }

                #region Ban Checking

                ModerationBan BanRecord = null;
                if (!string.IsNullOrEmpty(MachineId))
                {
                    if (RocketEmulador.GetGame().GetModerationManager().IsBanned(MachineId, out BanRecord))
                    {
                        if (RocketEmulador.GetGame().GetModerationManager().MachineBanCheck(MachineId))
                        {
                            Disconnect();
                            return(false);
                        }
                    }
                }

                if (userData.user != null)
                {
                    BanRecord = null;
                    if (RocketEmulador.GetGame().GetModerationManager().IsBanned(userData.user.Username, out BanRecord))
                    {
                        if (RocketEmulador.GetGame().GetModerationManager().UsernameBanCheck(userData.user.Username))
                        {
                            Disconnect();
                            return(false);
                        }
                    }
                }
                #endregion

                RocketEmulador.GetGame().GetClientManager().RegisterClient(this, userData.userID, userData.user.Username);
                this._habbo = userData.user;
                bool flag8 = this._habbo != null;
                if (flag8)
                {
                    userData.user.Init(this, userData);
                    this.SendMessage(new AuthenticationOKComposer());
                    this.SendMessage(new AvatarEffectsComposer(this._habbo.Effects().GetAllEffects));
                    this.SendMessage(new NavigatorSettingsComposer(this._habbo.HomeRoom));
                    this.SendMessage(new FavouritesComposer(userData.user.FavoriteRooms));
                    this.SendMessage(new FigureSetIdsComposer(this._habbo.GetClothing().GetClothingAllParts));
                    this.SendMessage(new UserRightsComposer(this._habbo.Rank));
                    this.SendMessage(new AvailabilityStatusComposer());

                    this.SendMessage(new TalentTrackLevelComposer());
                    this.SendMessage(new TargetOfferMessageComposer());
                    this.SendMessage(new AchievementScoreComposer(this._habbo.GetStats().AchievementPoints));

                    ServerPacket serverPacket = new ServerPacket(879);
                    serverPacket.WriteString("club_habbo");
                    serverPacket.WriteInteger(0);
                    serverPacket.WriteInteger(0);
                    serverPacket.WriteInteger(0);
                    serverPacket.WriteInteger(2);
                    serverPacket.WriteBoolean(false);
                    serverPacket.WriteBoolean(false);
                    serverPacket.WriteInteger(0);
                    serverPacket.WriteInteger(0);
                    serverPacket.WriteInteger(0);
                    this.SendMessage(serverPacket);
                    this.SendMessage(new BuildersClubMembershipComposer());
                    this.SendMessage(new CfhTopicsInitComposer());
                    this.SendMessage(new BadgeDefinitionsComposer(RocketEmulador.GetGame().GetAchievementManager()._achievements));
                    this.SendMessage(new SoundSettingsComposer(this._habbo.ClientVolume, this._habbo.ChatPreference, this._habbo.AllowMessengerInvites, this._habbo.FocusPreference, FriendBarStateUtility.GetInt(this._habbo.FriendbarState)));
                    bool flag9 = this.GetHabbo().GetMessenger() != null;
                    if (flag9)
                    {
                        this.GetHabbo().GetMessenger().OnStatusChanged(true);
                    }
                    bool flag10 = !string.IsNullOrEmpty(this.MachineId);
                    if (flag10)
                    {
                        bool flag11 = this._habbo.MachineId != this.MachineId;
                        if (flag11)
                        {
                            using (IQueryAdapter queryReactor = RocketEmulador.GetDatabaseManager().GetQueryReactor())
                            {
                                queryReactor.SetQuery("UPDATE `users` SET `machine_id` = @MachineId WHERE `id` = @id LIMIT 1");
                                queryReactor.AddParameter("MachineId", this.MachineId);
                                queryReactor.AddParameter("id", this._habbo.Id);
                                queryReactor.RunQuery();
                            }
                        }
                        this._habbo.MachineId = this.MachineId;
                    }

                    PermissionGroup PermissionGroup = null;
                    if (RocketEmulador.GetGame().GetPermissionManager().TryGetGroup(_habbo.Rank, out PermissionGroup))
                    {
                        if (!String.IsNullOrEmpty(PermissionGroup.Badge))
                        {
                            if (!_habbo.GetBadgeComponent().HasBadge(PermissionGroup.Badge))
                            {
                                _habbo.GetBadgeComponent().GiveBadge(PermissionGroup.Badge, true, this);
                            }
                        }
                    }

                    SubscriptionData SubData = null;
                    if (RocketEmulador.GetGame().GetSubscriptionManager().TryGetSubscriptionData(this._habbo.VIPRank, out SubData))
                    {
                        if (!String.IsNullOrEmpty(SubData.Badge))
                        {
                            if (!_habbo.GetBadgeComponent().HasBadge(SubData.Badge))
                            {
                                _habbo.GetBadgeComponent().GiveBadge(SubData.Badge, true, this);
                            }
                        }
                    }

                    if (!RocketEmulador.GetGame().GetCacheManager().ContainsUser(_habbo.Id))
                    {
                        RocketEmulador.GetGame().GetCacheManager().GenerateUser(_habbo.Id);
                    }

                    _habbo.InitProcess();

                    if (userData.user.GetPermissions().HasRight("mod_tickets"))
                    {
                        SendMessage(new ModeratorInitComposer(
                                        RocketEmulador.GetGame().GetModerationManager().UserMessagePresets,
                                        RocketEmulador.GetGame().GetModerationManager().RoomMessagePresets,
                                        RocketEmulador.GetGame().GetModerationManager().UserActionPresets,
                                        RocketEmulador.GetGame().GetModerationTool().GetTickets));
                    }

                    {
                        string hotelName = RocketEmulador.RocketData().data["hotelname"];
                        if (!string.IsNullOrWhiteSpace(RocketEmulador.GetDBConfig().DBData["welcome_message"]))
                        {
                            SendMessage(new MOTDNotificationComposer(RocketEmulador.GetDBConfig().DBData["welcome_message"]));
                        }


                        SendMessage(new RoomNotificationComposer("entrar", "message", "Bem-vindo" +
                                                                 " " + userData.user.GetClient().GetHabbo().Username + " " +
                                                                 "ao " + hotelName + "!"));


                        if (GetHabbo().Rank == 10)
                        {
                            RocketEmulador.GetGame().GetClientManager().SendMessage(new RoomNotificationComposer("login", "message", "O PROGRAMADOR" +
                                                                                                                 " " + userData.user.GetClient().GetHabbo().Username + " " +
                                                                                                                 "entrou no " + hotelName + "!"));
                        }
                        if (GetHabbo().Rank == 9)
                        {
                            RocketEmulador.GetGame().GetClientManager().SendMessage(new RoomNotificationComposer("login", "message", "O CEO" +
                                                                                                                 " " + userData.user.GetClient().GetHabbo().Username + " " +
                                                                                                                 "entrou no " + hotelName + "!"));
                        }

                        if (GetHabbo().Rank == 8)
                        {
                            RocketEmulador.GetGame().GetClientManager().SendMessage(new RoomNotificationComposer("login", "message", "O GERENTE" +
                                                                                                                 " " + userData.user.GetClient().GetHabbo().Username + " " +
                                                                                                                 "entrou no " + hotelName + "!"));
                        }

                        if (GetHabbo().Rank == 7)
                        {
                            RocketEmulador.GetGame().GetClientManager().SendMessage(new RoomNotificationComposer("login", "message", "O ADM" +
                                                                                                                 " " + userData.user.GetClient().GetHabbo().Username + " " +
                                                                                                                 "entrou no " + hotelName + "!"));
                        }

                        if (GetHabbo().Rank == 6)
                        {
                            RocketEmulador.GetGame().GetClientManager().SendMessage(new RoomNotificationComposer("login", "message", "O MOD" +
                                                                                                                 " " + userData.user.GetClient().GetHabbo().Username + " " +
                                                                                                                 "entrou no " + hotelName + "!"));
                        }

                        if (GetHabbo().Rank == 5)
                        {
                            RocketEmulador.GetGame().GetClientManager().SendMessage(new RoomNotificationComposer("login", "message", "O PROMOTOR" +
                                                                                                                 " " + userData.user.GetClient().GetHabbo().Username + " " +
                                                                                                                 "entrou no " + hotelName + "!"));
                        }

                        if (GetHabbo().Rank == 4)
                        {
                            RocketEmulador.GetGame().GetClientManager().SendMessage(new RoomNotificationComposer("login", "message", "O EMB" +
                                                                                                                 " " + userData.user.GetClient().GetHabbo().Username + " " +
                                                                                                                 "entrou no " + hotelName + "!"));
                        }

                        if (GetHabbo().Rank == 3)
                        {
                            RocketEmulador.GetGame().GetClientManager().SendMessage(new RoomNotificationComposer("login", "message", "O VIP" +
                                                                                                                 " " + userData.user.GetClient().GetHabbo().Username + " " +
                                                                                                                 "entrou no " + hotelName + "!"));
                        }



                        if (GetHabbo().Rank == 2)
                        {
                            RocketEmulador.GetGame().GetClientManager().SendMessage(new RoomNotificationComposer("login", "message", "O LOCUTOR" +
                                                                                                                 " " + userData.user.GetClient().GetHabbo().Username + " " +
                                                                                                                 "entrou no " + hotelName + "!"));
                        }

                        Console.WriteLine("Um novo usuário se conectou seu nick é: " + userData.user.GetClient().GetHabbo().Username + " e seu ip: " + userData.user.GetClient().GetConnection().getIp(), "Rocket.Users",
                                          ConsoleColor.DarkGreen);
                    }
                }
            }


            catch (Exception e)
            {
                Logging.LogCriticalException("Bug during user login: " + e);
            }
            return(false);
        }
Пример #4
0
        public CatalogPageComposer(CatalogPage Page, string CataMode)
            : base(ServerPacketHeader.CatalogPageMessageComposer)
        {
            base.WriteInteger(Page.Id);
            base.WriteString(CataMode);
            base.WriteString(Page.Template);

            base.WriteInteger(Page.PageStrings1.Count);
            foreach (string s in Page.PageStrings1)
            {
                base.WriteString(s);
            }

            base.WriteInteger(Page.PageStrings2.Count);
            foreach (string s in Page.PageStrings2)
            {
                base.WriteString(s);
            }
            if (Page.Template.Equals("vip_buy"))
            {
                base.WriteInteger(630395);
                base.WriteString("NORMAL");
                base.WriteString("vip_buy");
                base.WriteInteger(2);
                base.WriteString("hc2_clubtitle");
                base.WriteString("clubcat_pic");
                base.WriteInteger(0);
                base.WriteInteger(0);
                base.WriteInteger(-1);
                base.WriteBoolean(false);
            }
            if (!Page.Template.Equals("frontpage") && !Page.Template.Equals("club_buy"))
            {
                base.WriteInteger(Page.Items.Count);
                foreach (CatalogItem Item in Page.Items.Values)
                {
                    base.WriteInteger(Item.Id);
                    base.WriteString(Item.Name);
                    base.WriteBoolean(false);//IsRentable
                    base.WriteInteger(Item.CostCredits);
                    if (Item.CostGotw > 0)
                    {
                        base.WriteInteger(Item.CostGotw);
                        base.WriteInteger(103);
                    }
                    else if (Item.CostDiamonds > 0)
                    {
                        base.WriteInteger(Item.CostDiamonds);
                        base.WriteInteger(5);
                    }
                    else
                    {
                        base.WriteInteger(Item.CostPixels);
                        base.WriteInteger(0);
                    }
                    base.WriteBoolean(ItemUtility.CanGiftItem(Item));

                    if (Item.Data.InteractionType == InteractionType.DEAL)
                    {
                        foreach (CatalogDeal Deal in Page.Deals.Values)
                        {
                            base.WriteInteger(Deal.ItemDataList.Count);//Count

                            foreach (CatalogItem DealItem in Deal.ItemDataList.ToList())
                            {
                                base.WriteString(DealItem.Data.Type.ToString());
                                base.WriteInteger(DealItem.Data.SpriteId);
                                base.WriteString("");
                                base.WriteInteger(1);
                                base.WriteBoolean(false);
                            }
                            base.WriteInteger(0);//club_level
                            base.WriteBoolean(ItemUtility.CanSelectAmount(Item));
                            base.WriteBoolean(true);
                            base.WriteString("");
                        }
                    }
                    else
                    {
                        base.WriteInteger(string.IsNullOrEmpty(Item.Badge) ? 1 : 2);//Count 1 item if there is no badge, otherwise count as 2.
                        {
                            if (!string.IsNullOrEmpty(Item.Badge))
                            {
                                base.WriteString("b");
                                base.WriteString(Item.Badge);
                            }

                            base.WriteString(Item.Data.Type.ToString());
                            if (Item.Data.Type.ToString().ToLower() == "b")
                            {
                                //This is just a badge, append the name.
                                base.WriteString(Item.Data.ItemName);
                            }
                            else
                            {
                                base.WriteInteger(Item.Data.SpriteId);
                                if (Item.Data.InteractionType == InteractionType.WALLPAPER || Item.Data.InteractionType == InteractionType.FLOOR || Item.Data.InteractionType == InteractionType.LANDSCAPE)
                                {
                                    base.WriteString(Item.Name.Split('_')[2]);
                                }
                                else if (Item.Data.InteractionType == InteractionType.BOT)//Bots
                                {
                                    CatalogBot CatalogBot = null;
                                    if (!RocketEmulador.GetGame().GetCatalog().TryGetBot(Item.ItemId, out CatalogBot))
                                    {
                                        base.WriteString("hd-180-7.ea-1406-62.ch-210-1321.hr-831-49.ca-1813-62.sh-295-1321.lg-285-92");
                                    }
                                    else
                                    {
                                        base.WriteString(CatalogBot.Figure);
                                    }
                                }
                                else if (Item.ExtraData != null)
                                {
                                    base.WriteString(Item.ExtraData != null ? Item.ExtraData : string.Empty);
                                }
                                base.WriteInteger(Item.Amount);
                                base.WriteBoolean(Item.IsLimited); // IsLimited
                                if (Item.IsLimited)
                                {
                                    base.WriteInteger(Item.LimitedEditionStack);
                                    base.WriteInteger(Item.LimitedEditionStack - Item.LimitedEditionSells);
                                }
                            }
                            base.WriteInteger(0); //club_level
                            base.WriteBoolean(ItemUtility.CanSelectAmount(Item));
                            base.WriteBoolean(true);
                            base.WriteString("");
                        }
                    }
                }
            }
            else
            {
                base.WriteInteger(0);
            }

            base.WriteInteger(-1);
            base.WriteBoolean(false);
            //base.WriteInteger(-1);
            //base.WriteBoolean(false);

            if (Page.Template.Equals("frontpage4"))
            {
                base.WriteInteger(4);
                base.WriteInteger(1);
                base.WriteString(RocketEmulador.RocketData().data["catalago1.text"]);
                base.WriteString(RocketEmulador.RocketData().data["catalago1.image"]);
                base.WriteInteger(0);
                base.WriteString(RocketEmulador.RocketData().data["catalago1.pagelink"]);
                base.WriteInteger(-1);
                base.WriteInteger(2);
                base.WriteString(RocketEmulador.RocketData().data["catalago2.text"]);
                base.WriteString(RocketEmulador.RocketData().data["catalago2.image"]);
                base.WriteInteger(0);
                base.WriteString(RocketEmulador.RocketData().data["catalago2.pagelink"]);
                base.WriteInteger(-1);
                base.WriteInteger(3);
                base.WriteString(RocketEmulador.RocketData().data["catalago3.text"]);
                base.WriteString(RocketEmulador.RocketData().data["catalago3.image"]);
                base.WriteInteger(0);
                base.WriteString(RocketEmulador.RocketData().data["catalago3.pagelink"]);
                base.WriteInteger(-1);
                base.WriteInteger(4);
                base.WriteString(RocketEmulador.RocketData().data["catalago4.text"]);
                base.WriteString(RocketEmulador.RocketData().data["catalago4.image"]);
                base.WriteInteger(0);
                base.WriteString(RocketEmulador.RocketData().data["catalago4.pagelink"]);
                base.WriteInteger(-1);
            }
        }