Results 1 to 4 of 4
  1. #1
    B3CLAWED's Avatar
    Join Date
    Apr 2013
    Gender
    male
    Posts
    143
    Reputation
    10
    Thanks
    57
    My Mood
    Busy

    [FSOD/AS3] Amount of items being bought at once fix

    If you are running as3 client with fsod then you may have noticed when you buy an item it has "Amount: " and you can change it but even if you increase it, you only get one. Here is an easy fix for that, just replace these two files with what I give.

     
    Code:
    namespace wServer.networking.cliPackets
    {
        public class BuyPacket : ClientPacket
        {
            public int ObjectId { get; set; }
            public int Quantity { get; set; }
    
            public override PacketID ID
            {
                get { return PacketID.BUY; }
            }
    
            public override Packet CreateInstance()
            {
                return new BuyPacket();
            }
    
            protected override void Read(Client psr, NReader rdr)
            {
                ObjectId = rdr.ReadInt32();
                Quantity = rdr.ReadInt32();
            }
    
            protected override void Write(Client psr, NWriter wtr)
            {
                wtr.Write(ObjectId);
                wtr.Write(Quantity);
            }
        }
    }


     

    Code:
    #region
    
    using wServer.networking.cliPackets;
    using wServer.realm;
    using wServer.realm.entities;
    
    #endregion
    
    namespace wServer.networking.handlers
    {
        internal class BuyHandler : PacketHandlerBase<BuyPacket>
        {
            public override PacketID ID
            {
                get { return PacketID.BUY; }
            }
    
            protected override void HandlePacket(Client client, BuyPacket packet)
            {
                client.Manager.Logic.AddPendingAction(t =>
                {
                    if (client.Player.Owner == null) return;
                    SellableObject obj = client.Player.Owner.GetEntity(packet.ObjectId) as SellableObject;
                    int quantity = packet.Quantity;
                    for(int x=0; x<quantity; x++)
                    {
                        if (obj != null)
                            obj.Buy(client.Player);
                    }          
                }, PendingPriority.Networking);
            }
        }
    }

  2. The Following 2 Users Say Thank You to B3CLAWED For This Useful Post:

    backpack-o (06-26-2017),ManKindGaming (05-25-2017)

  3. #2
    Zolmex's Avatar
    Join Date
    Apr 2016
    Gender
    male
    Location
    on my chair
    Posts
    356
    Reputation
    94
    Thanks
    209
    For a moment I thought that this was a fix for -currency xd but nice job I guess
    hi

  4. #3
    B3CLAWED's Avatar
    Join Date
    Apr 2013
    Gender
    male
    Posts
    143
    Reputation
    10
    Thanks
    57
    My Mood
    Busy
    Quote Originally Posted by Zolmex View Post
    For a moment I thought that this was a fix for -currency xd but nice job I guess
    Hahaha nope just something that always bugged me so I actually took a minute to fix it

  5. #4
    bog624's Avatar
    Join Date
    Jun 2012
    Gender
    male
    Posts
    873
    Reputation
    95
    Thanks
    1,982
    My Mood
    Aggressive
    Quote Originally Posted by B3CLAWED View Post
    If you are running as3 client with fsod then you may have noticed when you buy an item it has "Amount: " and you can change it but even if you increase it, you only get one. Here is an easy fix for that, just replace these two files with what I give.

     
    Code:
    namespace wServer.networking.cliPackets
    {
        public class BuyPacket : ClientPacket
        {
            public int ObjectId { get; set; }
            public int Quantity { get; set; }
    
            public override PacketID ID
            {
                get { return PacketID.BUY; }
            }
    
            public override Packet CreateInstance()
            {
                return new BuyPacket();
            }
    
            protected override void Read(Client psr, NReader rdr)
            {
                ObjectId = rdr.ReadInt32();
                Quantity = rdr.ReadInt32();
            }
    
            protected override void Write(Client psr, NWriter wtr)
            {
                wtr.Write(ObjectId);
                wtr.Write(Quantity);
            }
        }
    }


     

    Code:
    #region
    
    using wServer.networking.cliPackets;
    using wServer.realm;
    using wServer.realm.entities;
    
    #endregion
    
    namespace wServer.networking.handlers
    {
        internal class BuyHandler : PacketHandlerBase<BuyPacket>
        {
            public override PacketID ID
            {
                get { return PacketID.BUY; }
            }
    
            protected override void HandlePacket(Client client, BuyPacket packet)
            {
                client.Manager.Logic.AddPendingAction(t =>
                {
                    if (client.Player.Owner == null) return;
                    SellableObject obj = client.Player.Owner.GetEntity(packet.ObjectId) as SellableObject;
                    int quantity = packet.Quantity;
                    for(int x=0; x<quantity; x++)
                    {
                        if (obj != null)
                            obj.Buy(client.Player);
                    }          
                }, PendingPriority.Networking);
            }
        }
    }
    This kinda works It says I made two purchases but only one egg. maybe its the client. if I buy 3 I get 2. weird.
    Good Day.



    Quote Originally Posted by DimitriSavage View Post
    *le wild bog is hunting in his natural habitat....le wild bog sees pray...le wild bog uses HACK....le wild bog wins....le wild bog is evolving....le wild bog is now le wild gob*

    LE WILD BOG IN LE POKEDEX : POKEDEX ENTRY

    LE WILD GOB IN LE POKEDEX : POKEDEX ENTRY

    TEH FINAL EVOLUTION OF LE WILD BOG : POKEDEX ENTRY


Similar Threads

  1. [Solved] [FSoD/AS3] Given Item Disappears After Joining World.
    By EHaehthsthethetheh in forum Realm of the Mad God Private Servers Help
    Replies: 8
    Last Post: 11-06-2016, 02:26 PM
  2. [Discussion] Limited items being removed in the next content update
    By ogkush317 in forum CrossFire Discussions
    Replies: 5
    Last Post: 11-17-2012, 03:53 PM
  3. UNREALEASED ITEMS BEING DROPPED!!>?!?!
    By TravisMoore in forum Realm of the Mad God Discussions
    Replies: 16
    Last Post: 11-04-2012, 11:02 AM
  4. Is it me or is there too many good items being sold?
    By Suuuuuuuuuuuuuuuuuuuuuuuu in forum Vindictus Discussions
    Replies: 22
    Last Post: 12-12-2011, 11:06 AM
  5. [Info] Market Place went down... Hacked items being remove?
    By Hitman 47 in forum Vindictus Discussions
    Replies: 250
    Last Post: 04-28-2011, 01:27 PM