Ejemplo n.º 1
0
        public void Parse(HabboHotel.GameClients.GameClient Session, ClientPacket Packet)
        {
            HabboHotel.Users.Habbo habbo = Session.GetHabbo();

            if (habbo == null)
            {
                return;
            }
            //if (!habbo.PassedNuxNavigator && !habbo.PassedNuxCatalog && !habbo.PassedNuxChat && !habbo.PassedNuxDuckets && !habbo.PassedNuxItems)
            //{
            //    Session.SendMessage(new NuxAlertComposer("helpBubble/add/BOTTOM_BAR_NAVIGATOR/Este es el navegador de salas, en el, podrás visitar nuevas salas y hacer nuevas amistades."));
            //    habbo.PassedNuxNavigator = true;
            //}

            //if (habbo.PassedNuxNavigator && !habbo.PassedNuxCatalog && !habbo.PassedNuxChat && !habbo.PassedNuxDuckets && !habbo.PassedNuxItems)
            //{
            //    Session.SendMessage(new NuxAlertComposer("helpBubble/add/BOTTOM_BAR_CATALOG/Aquí tienes la tienda, en ella, encontrarás lo necesario para hacer las salas mas chic del hotel!"));
            //    habbo.PassedNuxCatalog = true;
            //}
            //else if (habbo.PassedNuxNavigator && habbo.PassedNuxCatalog && !habbo.PassedNuxChat && !habbo.PassedNuxDuckets && !habbo.PassedNuxItems)
            //{
            //    Session.SendMessage(new NuxAlertComposer("helpBubble/add/CHAT_INPUT/Este es el chat, en el puedes interactuar con el resto de miembros de la comunidad y seleccionar estilos diferentes."));
            //    habbo.PassedNuxChat = true;
            //}
            //else if (habbo.PassedNuxNavigator && habbo.PassedNuxCatalog && habbo.PassedNuxChat && !habbo.PassedNuxDuckets && !habbo.PassedNuxItems)
            //{
            //    Session.SendMessage(new NuxAlertComposer("helpBubble/add/DUCKETS_BUTTON/En este apartado, dispondrás de toda la información de tu economía dentro del Hotel"));
            //    habbo.PassedNuxDuckets = true;
            //}
            //else if (habbo.PassedNuxNavigator && habbo.PassedNuxCatalog && habbo.PassedNuxChat && habbo.PassedNuxDuckets && !habbo.PassedNuxItems)
            //{
            //    Session.SendMessage(new NuxAlertComposer("helpBubble/add/BOTTOM_BAR_INVENTORY/Aquí está el inventario, en el, todos los furnis que compres, serán almacenados y posteriormente, podrás colocarlos."));
            //    habbo.PassedNuxItems = true;
            //}

            //if (habbo.PassedNuxNavigator && habbo.PassedNuxCatalog && habbo.PassedNuxChat && habbo.PassedNuxDuckets && habbo.PassedNuxItems)
            //{
            Session.SendMessage(new NuxAlertComposer("nux/lobbyoffer/show"));
            habbo._NUX = false;
            using (Database.Interfaces.IQueryAdapter dbClient = NeonEnvironment.GetDatabaseManager().GetQueryReactor())
            {
                dbClient.runFastQuery("UPDATE users SET nux_user = '******' WHERE id = " + Session.GetHabbo().Id + ";");
            }

            ServerPacket nuxStatus = new ServerPacket(ServerPacketHeader.NuxUserStatus);

            nuxStatus.WriteInteger(0);
            Session.SendMessage(nuxStatus);
            //}
        }
Ejemplo n.º 2
0
        public ThreadReplyComposer(GameClient Session, GroupForumThreadPost Post)
            : base(ServerPacketHeader.ThreadReplyMessageComposer)
        {
            HabboHotel.Users.Habbo User = Post.GetAuthor();
            base.WriteInteger(Post.ParentThread.ParentForum.Id);
            base.WriteInteger(Post.ParentThread.Id);

            base.WriteInteger(Post.Id);                                                    //Post Id
            base.WriteInteger(Post.ParentThread.Posts.IndexOf(Post));                      //Post Index

            base.WriteInteger(User.Id);                                                    //User id
            base.WriteString(User.Username);                                               //Username
            base.WriteString(User.Look);                                                   //User look

            base.WriteInteger((int)(NeonEnvironment.GetUnixTimestamp() - Post.Timestamp)); //User message timestamp
            base.WriteString(Post.Message);                                                // Message text
            base.WriteByte(0);                                                             // User message oculted by - level
            base.WriteInteger(0);                                                          // User that oculted message ID
            base.WriteString("");                                                          //Oculted message user name
            base.WriteInteger(10);
            base.WriteInteger(Post.ParentThread.GetUserPosts(User.Id).Count);              //User messages count
        }
        public void Parse(HabboHotel.GameClients.GameClient Session, ClientPacket Packet)

        {
            #region RETURN VALUES
            TargetedOffers         offer = NeonEnvironment.GetGame().GetTargetedOffersManager().TargetedOffer;
            HabboHotel.Users.Habbo habbo = Session.GetHabbo();
            if (offer == null || habbo == null)
            {
                Session.SendMessage(new PurchaseErrorComposer(1));
                return;
            }
            #endregion

            #region FIELDS
            Packet.PopInt();
            int amount = Packet.PopInt();
            if (amount > offer.Limit)
            {
                Session.SendMessage(new PurchaseErrorComposer(1));
                return;
            }
            int creditsCost    = int.Parse(offer.Price[0]) * amount;
            int extraMoneyCost = int.Parse(offer.Price[1]) * amount;
            #endregion

            //#region CREDITS COST
            //if (creditsCost > 0)
            //{
            //    if (habbo.Credits < creditsCost)
            //    {
            //        Session.SendMessage(new PurchaseErrorComposer(1));
            //        return;
            //    }

            //    habbo.Credits -= creditsCost;
            //    Session.SendMessage(new CreditBalanceComposer(Session.GetHabbo().Credits - creditsCost));
            //}
            //#endregion

            //#region EXTRA MONEY COST
            //if (extraMoneyCost > 0)
            //{
            //    #region GET MONEY TYPE AND DISCOUNT
            //    switch (offer.MoneyType)
            //    {
            //        #region DUCKETS COST
            //        case "duckets":
            //            {
            //                if (habbo.Duckets < extraMoneyCost)
            //                {
            //                    Session.SendMessage(new PurchaseErrorComposer(1));
            //                    return;
            //                }

            //                //habbo.Duckets -= extraMoneyCost;
            //                Session.GetHabbo().Duckets -= extraMoneyCost;
            //                Session.SendMessage(new HabboActivityPointNotificationComposer(Session.GetHabbo().Duckets, Session.GetHabbo().Duckets));
            //                break;
            //            }
            //        #endregion

            //        #region DIAMONDS COST
            //        case "diamonds":
            //            {
            //                if (habbo.Diamonds < extraMoneyCost)
            //                {
            //                    Session.SendMessage(new PurchaseErrorComposer(1));
            //                    return;
            //                }

            //                //habbo.Diamonds -= extraMoneyCost;
            //                Session.GetHabbo().Diamonds -= extraMoneyCost;
            //                Session.SendMessage(new HabboActivityPointNotificationComposer(Session.GetHabbo().Diamonds, 0, 5));
            //                break;
            //            }
            //            #endregion

            //            //#region OTHER COST
            //            //default:
            //            //    goto case "duckets";
            //            //    #endregion
            //    }
            //    #endregion

            //    //habbo.UpdateExtraMoneyBalance();
            //}
            //#endregion

            #region BUY AND CREATE ITEMS PROGRESS
            TargetedOffers TargetedOffer = NeonEnvironment.GetGame().GetTargetedOffersManager().TargetedOffer;
            using (IQueryAdapter dbQuery = NeonEnvironment.GetDatabaseManager().GetQueryReactor())
            {
                dbQuery.SetQuery("SELECT targeted_buy FROM users where id = " + habbo.Id + " LIMIT 1");
                DataTable count = dbQuery.getTable();
                foreach (DataRow Row in count.Rows)
                {
                    int offer2 = Convert.ToInt32(Row["targeted_buy"]);


                    if (TargetedOffer.Limit == offer2)
                    {
                        Session.SendMessage(new RoomCustomizedAlertComposer("Ya has pasado el limite de compras de esta Oferta."));
                    }

                    else

                    {
                        using (IQueryAdapter dbClient = NeonEnvironment.GetDatabaseManager().GetQueryReactor())
                        {
                            dbClient.runFastQuery("UPDATE users SET targeted_buy = targeted_buy +1 WHERE id = " + Session.GetHabbo().Id + ";");
                        }

                        foreach (TargetedItems product in offer.Products)
                        {
                            #region CHECK PRODUCT TYPE
                            switch (product.ItemType)
                            {
                                #region NORMAL ITEMS CASE
                            case "item":
                            {
                                if (!NeonEnvironment.GetGame().GetItemManager().GetItem(int.Parse(product.Item), out ItemData item))
                                {
                                    return;
                                }

                                if (item == null)
                                {
                                    return;
                                }

                                Item cItem = ItemFactory.CreateSingleItemNullable(item, Session.GetHabbo(), string.Empty, string.Empty);
                                if (cItem != null)
                                {
                                    Session.GetHabbo().GetInventoryComponent().TryAddItem(cItem);

                                    Session.SendMessage(new FurniListAddComposer(cItem));
                                    Session.SendMessage(new FurniListUpdateComposer());
                                }

                                Session.GetHabbo().GetInventoryComponent().UpdateItems(true);
                                break;
                            }
                                #endregion

                                #region BADGE CASE
                            case "badge":
                            {
                                if (habbo.GetBadgeComponent().HasBadge(product.Item))
                                {
                                    //Session.SendMessage(new RoomCustomizedAlertComposer("mira men ahi te pudras joder"));
                                    //break;
                                }

                                habbo.GetBadgeComponent().GiveBadge(product.Item, true, Session);
                                break;
                            }
                                #endregion
                            }
                            #endregion
                        }
                    }
                }
            }
            #endregion

            #region CREDITS COST
            if (creditsCost > 0)
            {
                if (habbo.Credits < creditsCost)
                {
                    Session.SendMessage(new PurchaseErrorComposer(1));
                    return;
                }

                habbo.Credits -= creditsCost;
                Session.SendMessage(new CreditBalanceComposer(Session.GetHabbo().Credits - creditsCost));
            }
            #endregion

            #region EXTRA MONEY COST
            if (extraMoneyCost > 0)
            {
                #region GET MONEY TYPE AND DISCOUNT
                switch (offer.MoneyType)
                {
                    #region DUCKETS COST
                case "duckets":
                {
                    if (habbo.Duckets < extraMoneyCost)
                    {
                        Session.SendMessage(new PurchaseErrorComposer(1));
                        return;
                    }

                    //habbo.Duckets -= extraMoneyCost;
                    Session.GetHabbo().Duckets -= extraMoneyCost;
                    Session.SendMessage(new HabboActivityPointNotificationComposer(Session.GetHabbo().Duckets, Session.GetHabbo().Duckets));
                    break;
                }
                    #endregion

                    #region DIAMONDS COST
                case "diamonds":
                {
                    if (habbo.Diamonds < extraMoneyCost)
                    {
                        Session.SendMessage(new PurchaseErrorComposer(1));
                        return;
                    }

                    //habbo.Diamonds -= extraMoneyCost;
                    Session.GetHabbo().Diamonds -= extraMoneyCost;
                    Session.SendMessage(new HabboActivityPointNotificationComposer(Session.GetHabbo().Diamonds, 0, 5));
                    break;
                }
                    #endregion

                    //#region OTHER COST
                    //default:
                    //    goto case "duckets";
                    //    #endregion
                }
                #endregion

                //habbo.UpdateExtraMoneyBalance();
            }
            #endregion

            #region RE-OPEN TARGETED BOX
            TargetedOffers TargetedOffer2 = NeonEnvironment.GetGame().GetTargetedOffersManager().TargetedOffer;

            int offer22 = Session.GetHabbo()._TargetedBuy;


            if (TargetedOffer2.Limit > offer22)
            {
                Session.SendMessage(NeonEnvironment.GetGame().GetTargetedOffersManager().TargetedOffer.Serialize());
            }
        }