[PLUS EMULATOR] Staff Unlimited Credits

Status
Not open for further replies.

Karel

Member
May 15, 2019
80
13
Hi Devbest, I've been looking for the message that tells you that you don't have enough credits. I wanted to edit it so that staff can override that message and buy stuff with not enough credits. If it was in the emulator I would just add a condition, but I found it in the Habbo.swf. I'm not really familiar with Actionscript, but I'm especially confused by the names of the variables. I can't read it hahaha. Has someone maybe thought about this and maybe even coded this or am I the only one? : P
 

JayC

Well-Known Member
Aug 8, 2013
5,505
1,401
There is a packet that handles the purchasing. When the rank is above a certain amount, or they have a permission you just don't charge them the credits.
 
  • Like
Reactions: Joe

Karel

Member
May 15, 2019
80
13
I added a condition to check the rank, but it's not working... Is this the right packet?

CatalogOfferComposer.cs
C#:
using System;
using System.Linq;
using System.Text;
using System.Collections.Generic;

using Plus.HabboHotel.Items;
using Plus.HabboHotel.Catalog;
using Plus.HabboHotel.Catalog.Utilities;
using Plus.HabboHotel.GameClients;

namespace Plus.Communication.Packets.Outgoing.Catalog
{
    class CatalogOfferComposer : ServerPacket
    {
        public CatalogOfferComposer(GameClient Session, CatalogItem Item)
            : base(ServerPacketHeader.CatalogOfferMessageComposer)
        {
            base.WriteInteger(Item.OfferId);
            base.WriteString(Item.Data.ItemName);
            base.WriteBoolean(false);//IsRentable

            if(Session.GetHabbo().Rank == 9)
            {
                base.WriteInteger(0);

                if (Item.CostDiamonds > 0)
                {
                    base.WriteInteger(0);
                    base.WriteInteger(5); // Diamonds
                }
                else if (Item.CostPixels > 0)
                {
                    base.WriteInteger(0);
                    base.WriteInteger(0); // Type of PixelCost
                }
                else
                {
                    base.WriteInteger(0);
                    base.WriteInteger(103); // Gotw
                }
            }
            else
            {
                base.WriteInteger(Item.CostCredits);

                if (Item.CostDiamonds > 0)
                {
                    base.WriteInteger(Item.CostDiamonds);
                    base.WriteInteger(5); // Diamonds
                }
                else if (Item.CostPixels > 0)
                {
                    base.WriteInteger(Item.CostPixels);
                    base.WriteInteger(0); // Type of PixelCost
                }
                else
                {
                    base.WriteInteger(Item.CostBelcredits);
                    base.WriteInteger(103); //Gotw
                }
            }

            base.WriteBoolean(ItemUtility.CanGiftItem(Item));
            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")
                base.WriteString(Item.Data.ItemName);//Badge name.
            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.PageID == 9)//Bots
                {
                    CatalogBot CataBot = null;
                    if (!PlusEnvironment.GetGame().GetCatalog().TryGetBot(Item.ItemId, out CataBot))
                        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(CataBot.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(false);// TODO: Figure out
            base.WriteString("");//previewImage -> e.g; catalogue/pet_lion.png
        }
    }
}

I don't think that replacing Item.CostCredits with 0 was the solution lmao
Post automatically merged:

Owh, I did the same for CatalogPageComposer.cs and editted the PurchaseFromCatalogEvent.cs and know it works. But I don't get why it doesn't work without the PageComposer... That one is for showing the prices right? It doesn't show prices now for staff
 
Last edited:

Pollak

Active Member
Oct 12, 2017
161
51
Why? If all purchases involve catalog like the file PurchaseFromCatalogEvent or gifts PurchaseFromCatalogAsGiftEvent. You need check in this files.
Post automatically merged:

PurchaseFromCatalogEvent.cs

Search: if (Item.CostCredits > 0)
replace with this:
C#:
if (Session.GetHabbo().Rank < 6)
            {
                if (Item.CostCredits > 0)
                {
                    Session.GetHabbo().Credits -= TotalCreditsCost;
                    Session.SendMessage(new CreditBalanceComposer(Session.GetHabbo().Credits));
                }
            }
You must be registered for see images attach
 
Last edited:

Karel

Member
May 15, 2019
80
13
It works fine now :) The CatalogPageComposer apparently also checks the users currency and shows the not enough money alert if needed. Thanks for your help!
 
Status
Not open for further replies.

Users who are viewing this thread

Top