Thread: Shop in nexus.

Page 1 of 2 12 LastLast
Results 1 to 15 of 20
  1. #1
    qpadones1's Avatar
    Join Date
    Apr 2014
    Gender
    male
    Posts
    37
    Reputation
    10
    Thanks
    12
    My Mood
    Amazed

    Post Shop in nexus.

    First off all I know many people already know this, but it can still be help full for people who dont know this. And please dont get angry at me because i wrote this tutorial. I just want to share it with the people that dont know how to.


    1. Make a nexus map.
    2. In the place you want the shop to draw Merchants (you find merchant in object when you edit the map).
    3. Once you draw the merchants where you want your shop to be its time to decide what you will have in the shop.
    4. Go on edit not draw or erase but edit and click on one of the merchants, and type this.
    Code:
    mtype:0xb0b;mcost:750;mcur:1
    That is for anacclaim and it cost 750 FAME.
    You change the id after "mtype" to what ever item you want to be there and you add after "mcost:" how much it should cost and you can edit what it should cost after "mcur:" 1 is Fame and 0 is Gold.
    5. You do that with all of your merchants and save the map.
    6. Save it were ever you have your world converter file (most have in nexus) and run it and you should have a .wmap file of the map you made.
    7. Put both of the files in wserver/realm/worlds (replace with the old nexus jm file and wmap).
    8. Rebuild server and your done!

    If you cant get to nexus or wserver crash you probably have walls or ground that is not coded in your server and if shop does not work post the code you type in edit on the merchant and i will try to help you.

    Credits to Jankos for explaining this to me

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

    BARm (04-14-2015),derickfls (04-14-2015),scoutscaps (10-14-2015)

  3. #2
    BARm's Avatar
    Join Date
    Sep 2012
    Gender
    male
    Location
    Tel Aviv
    Posts
    406
    Reputation
    32
    Thanks
    1,007
    My Mood
    Inspired
    Thanks for sharing!

  4. #3
    Stellar Spark's Avatar
    Join Date
    Jun 2013
    Gender
    female
    Posts
    724
    Reputation
    35
    Thanks
    799
    I remember that the current system of merchants bugs me...

    I'm thinking of making and openly releasing a redesigned script system for prod-like merchants (that check time, availability, make discounts, etc.)

  5. The Following 4 Users Say Thank You to Stellar Spark For This Useful Post:

    BlackRayquaza (04-19-2015),Invoked (04-14-2015),swaqmech (04-14-2015),TJRAE%TJAJAZetjtjtjjt (04-23-2015)

  6. #4
    swaqmech's Avatar
    Join Date
    Oct 2014
    Gender
    male
    Posts
    35
    Reputation
    10
    Thanks
    23
    My Mood
    Goofy
    Quote Originally Posted by ProHackBot999 View Post
    I remember that the current system of merchants bugs me...

    I'm thinking of making and openly releasing a redesigned script system for prod-like merchants (that check time, availability, make discounts, etc.)
    Great! cant wait to see

  7. #5
    Invoked's Avatar
    Join Date
    Apr 2015
    Gender
    male
    Location
    Biosphere
    Posts
    13
    Reputation
    10
    Thanks
    0
    Quote Originally Posted by ProHackBot999 View Post
    I remember that the current system of merchants bugs me...

    I'm thinking of making and openly releasing a redesigned script system for prod-like merchants (that check time, availability, make discounts, etc.)
    Sounds nice, I'd like to see a lot of things is sources be cleaned up.

  8. #6
    ossimc82's Avatar
    Join Date
    Jul 2012
    Gender
    male
    Posts
    496
    Reputation
    42
    Thanks
    887
    My Mood
    In Love
    Quote Originally Posted by ProHackBot999 View Post
    I remember that the current system of merchants bugs me...

    I'm thinking of making and openly releasing a redesigned script system for prod-like merchants (that check time, availability, make discounts, etc.)
    So like I did?


     

     

     

     

    Code:
    #region
    
    using common;
    using log4net;
    using System;
    using System.Collections.Generic;
    using System.Xml.Linq;
    using wServer.networking.svrPackets;
    using wServer.realm.entities.player;
    
    #endregion
    
    namespace wServer.realm.entities
    {
        public class Merchants : SellableObject
        {
            private const int BUY_NO_GOLD = 3;
            private const int BUY_NO_FAME = 6;
            private const int BUY_NO_FORTUNETOKENS = 9; //Doesnt exist in client I guess :3
            private const int merchantSize = 100;
            private static readonly new ILog log = LogManager.GetLogger(typeof(Merchants));
    
            private readonly Dictionary<int, Tuple<int, CurrencyType>> prices = MerchantLists.prices;
            private int objType;
    
            private bool closing;
            private bool newMerchant;
            private int tickcount;
    
            public static Random Random { get; private set; }
    
            public Merchants(RealmManager manager, ushort objType, World owner = null)
                : base(manager, objType)
            {
                MType = -1;
                this.objType = objType;
                Size = merchantSize;
                if (owner != null)
                    Owner = owner;
    
                if (Random == null) Random = new Random();
                if (AddedTypes == null) AddedTypes = new List<KeyValuePair<string, int>>();
                if(owner != null) ResolveMType();
            }
    
            private static List<KeyValuePair<string, int>> AddedTypes { get; set; }
    
            public bool Custom { get; set; }
    
            public int MType { get; set; }
            public int MRemaining { get; set; }
            public int MTime { get; set; }
            public int Discount { get; set; }
    
            protected override void ExportStats(IDictionary<StatsType, object> stats)
            {
                stats[StatsType.MerchantMerchandiseType] = MType;
                stats[StatsType.MerchantRemainingCount] = MRemaining;
                stats[StatsType.MerchantRemainingMinute] = newMerchant ? Int32.MaxValue : MTime;
                stats[StatsType.MerchantDiscount] = Discount;
                stats[StatsType.SellablePrice] = Price;
                stats[StatsType.SellableRankRequirement] = RankReq;
                stats[StatsType.SellablePriceCurrency] = Currency;
    
                base.ExportStats(stats);
            }
    
            public override void Init(World owner)
            {
                base.Init(owner);
                ResolveMType();
                UpdateCount++;
                if (MType == -1) Owner.LeaveWorld(this);
            }
    
            protected override bool TryDeduct(Player player)
            {
                DbAccount acc = player.Client.Account;
                if (player.Stars < RankReq) return false;
    
                if (Currency == CurrencyType.Fame)
                    if (acc.Fame < Price) return false;
    
                if (Currency == CurrencyType.Gold)
                    if (acc.Credits < Price) return false;
    
                if (Currency == CurrencyType.FortuneTokens)
                    if (acc.FortuneTokens < Price) return false;
                return true;
            }
    
            public override void Buy(Player player)
            {
                if (ObjectType == 0x01ca) //Merchant
                {
                    if (TryDeduct(player))
                    {
                        for (int i = 0; i < player.Inventory.Length; i++)
                        {
                            try
                            {
                                XElement ist;
                                Manager.GameData.ObjectTypeToElement.TryGetValue((ushort)MType, out ist);
                                if (player.Inventory[i] == null &&
                                    (player.SlotTypes[i] == 10 ||
                                     player.SlotTypes[i] == Convert.ToInt16(ist.Element("SlotType").Value)))
                                // Exploit fix - No more mnovas as weapons!
                                {
                                    player.Inventory[i] = Manager.GameData.Items[(ushort)MType];
    
                                    if (Currency == CurrencyType.Fame)
                                        player.CurrentFame = player.Client.Account.Fame -= Price;
                                    if (Currency == CurrencyType.Gold)
                                        player.Credits = player.Client.Account.Credits -= Price;
                                    if (Currency == CurrencyType.FortuneTokens)
                                        player.Tokens = player.Client.Account.FortuneTokens -= Price;
    
                                    player.Client.SendPacket(new BuyResultPacket
                                    {
                                        Result = 0,
                                        Message = "{\"key\":\"server.buy_success\"}"
                                    });
                                    MRemaining--;
                                    player.UpdateCount++;
                                    player.SaveToCharacter();
                                    player.Client.Account.Flush();
                                    player.Client.Account.Reload();
                                    UpdateCount++;
                                    return;
                                }
                            }
                            catch (Exception e)
                            {
                                log.Error(e);
                            }
                        }
                        player.Client.SendPacket(new BuyResultPacket
                        {
                            Result = 0,
                            Message = "{\"key\":\"server.inventory_full\"}"
                        });
                    }
                    else
                    {
                        if (player.Stars < RankReq)
                        {
                            player.Client.SendPacket(new BuyResultPacket
                            {
                                Result = 0,
                                Message = "Not enough stars!"
                            });
                            return;
                        }
                        switch (Currency)
                        {
                            case CurrencyType.Gold:
                                player.Client.SendPacket(new BuyResultPacket
                                {
                                    Result = BUY_NO_GOLD,
                                    Message = "{\"key\":\"server.not_enough_gold\"}"
                                });
                                break;
                            case CurrencyType.Fame:
                                player.Client.SendPacket(new BuyResultPacket
                                {
                                    Result = BUY_NO_FAME,
                                    Message = "{\"key\":\"server.not_enough_fame\"}"
                                });
                                break;
                            case CurrencyType.FortuneTokens:
                                player.Client.SendPacket(new BuyResultPacket
                                {
                                    Result = BUY_NO_FORTUNETOKENS,
                                    Message = "{\"key\":\"server.not_enough_fortunetokens\"}"
                                });
                                break;
                        }
                    }
                }
            }
    
            public override void Tick(RealmTime time)
            {
                try
                {
                    if (Size == 0 && MType != -1)
                    {
                        Size = merchantSize;
                        UpdateCount++;
                    }
    
                    if (!closing)
                    {
                        tickcount++;
                        if (Manager != null)
                        {
                            if (tickcount % (Manager.TPS * 60) == 0) //once per minute after spawning
                            {
                                MTime--;
                                UpdateCount++;
                            }
                        }
                    }
    
                    if (MRemaining == 0 &&  MType != -1)
                    {
                        if (AddedTypes.Contains(new KeyValuePair<string, int>(Owner.Name, MType)))
                            AddedTypes.Remove(new KeyValuePair<string, int>(Owner.Name, MType));
                        Recreate(this);
                        UpdateCount++;
                    }
    
                    if (MTime == -1 && Owner != null)
                    {
                        if (AddedTypes.Contains(new KeyValuePair<string, int>(Owner.Name, MType)))
                            AddedTypes.Remove(new KeyValuePair<string, int>(Owner.Name, MType));
                        Recreate(this);
                        UpdateCount++;
                    }
    
                    if (MTime == 1 && !closing)
                    {
                        closing = true;
                        if (Owner != null) Owner.Timers.Add(new WorldTimer(30 * 1000, (w1, t1) =>
                        {
                            MTime--;
                            UpdateCount++;
                            w1.Timers.Add(new WorldTimer(30 * 1000, (w2, t2) =>
                            {
                                MTime--;
                                UpdateCount++;
                            }));
                        }));
                    }
    
                    if (MType == -1 && Owner != null) Owner.LeaveWorld(this);
    
                    base.Tick(time);
                }
                catch (Exception ex)
                {
                    log.Error(ex);
                }
            }
    
            public void Recreate(Merchants x)
            {
                try
                {
                    Merchants mrc = new Merchants(Manager, x.ObjectType, x.Owner);
                    mrc.Move(x.X, x.Y);
                    World w = Owner;
                    Owner.LeaveWorld(this);
                    w.Timers.Add(new WorldTimer(Random.Next(30, 60) * 1000, (world, time) => w.EnterWorld(mrc)));
                }
                catch (Exception e)
                {
                    log.Error(e);
                }
            }
    
            public void ResolveMType()
            {
                MType = -1;
                int[] list = new int[0];
                if (Owner.Map[(int) X, (int) Y].Region == TileRegion.Store_1)
                    list = MerchantLists.store1List;
                else if (Owner.Map[(int) X, (int) Y].Region == TileRegion.Store_2)
                    list = MerchantLists.store2List;
                else if (Owner.Map[(int) X, (int) Y].Region == TileRegion.Store_3)
                    list = MerchantLists.store3List;
                else if (Owner.Map[(int) X, (int) Y].Region == TileRegion.Store_4)
                    list = MerchantLists.store4List;
                else if (Owner.Map[(int) X, (int) Y].Region == TileRegion.Store_5)
                    list = MerchantLists.store5List;
                else if (Owner.Map[(int) X, (int) Y].Region == TileRegion.Store_6)
                    list = MerchantLists.store6List;
                else if (Owner.Map[(int) X, (int) Y].Region == TileRegion.Store_7)
                    list = MerchantLists.store7List;
                else if (Owner.Map[(int) X, (int) Y].Region == TileRegion.Store_8)
                    list = MerchantLists.store8List;
                else if (Owner.Map[(int) X, (int) Y].Region == TileRegion.Store_9)
                    list = MerchantLists.store9List;
                else if (Owner.Map[(int) X, (int) Y].Region == TileRegion.Store_10)
                    list = MerchantLists.store10List;
                else if (Owner.Map[(int) X, (int) Y].Region == TileRegion.Store_11)
                    list = MerchantLists.store11List;
                else if (Owner.Map[(int) X, (int) Y].Region == TileRegion.Store_12)
                    list = MerchantLists.AccessoryDyeList;
                else if (Owner.Map[(int) X, (int) Y].Region == TileRegion.Store_13)
                    list = MerchantLists.ClothingClothList;
                else if (Owner.Map[(int) X, (int) Y].Region == TileRegion.Store_14)
                    list = MerchantLists.AccessoryClothList;
                else if (Owner.Map[(int) X, (int) Y].Region == TileRegion.Store_15)
                    list = MerchantLists.ClothingDyeList;
                else if (Owner.Map[(int) X, (int) Y].Region == TileRegion.Store_16)
                    list = MerchantLists.store5List;
                else if (Owner.Map[(int) X, (int) Y].Region == TileRegion.Store_17)
                    list = MerchantLists.store7List;
                else if (Owner.Map[(int) X, (int) Y].Region == TileRegion.Store_18)
                    list = MerchantLists.store6List;
                else if (Owner.Map[(int) X, (int) Y].Region == TileRegion.Store_19)
                    list = MerchantLists.store2List;
                else if (Owner.Map[(int) X, (int) Y].Region == TileRegion.Store_20)
                    list = MerchantLists.store20List;
                else if (Owner.Map[(int) X, (int) Y].Region == TileRegion.Store_21)
                    list = MerchantLists.AccessoryClothList;
                else if (Owner.Map[(int) X, (int) Y].Region == TileRegion.Store_22)
                    list = MerchantLists.AccessoryDyeList;
                else if (Owner.Map[(int) X, (int) Y].Region == TileRegion.Store_23)
                    list = MerchantLists.ClothingClothList;
                else if (Owner.Map[(int) X, (int) Y].Region == TileRegion.Store_24)
                    list = MerchantLists.ClothingDyeList;
    
                if (AddedTypes == null) AddedTypes = new List<KeyValuePair<string, int>>();
                list.Shuffle();
                for (int i = 0; i < list.Length; i++)
                {
                    if (!AddedTypes.Contains(new KeyValuePair<string, int>(Owner.Name, list[i])))
                    {
                        AddedTypes.Add(new KeyValuePair<string, int>(Owner.Name, list[i]));
                        MType = list[i];
                        MTime = Random.Next(6, 15);
                        MRemaining = Random.Next(6, 11);
                        newMerchant = true;
                        Owner.Timers.Add(new WorldTimer(30000, (w, t) =>
                        {
                            newMerchant = false;
                            UpdateCount++;
                        }));
    
                        int s = Random.Next(0, 100);
    
                        if(s < 2)
                            Discount = 50;
                        else if(s < 5)
                            Discount = 25;
                        else if (s < 10)
                            Discount = 15;
                        else if(s < 15)
                            Discount = 10;
                        else Discount = 0;
    
                        Tuple<int, CurrencyType> price;
                        if (prices.TryGetValue(MType, out price))
                        {
                            if (Discount != 0)
                                Price = (int)(price.Item1 - (price.Item1 * ((double)Discount / 100))) < 1 ?
                                    price.Item1 : (int)(price.Item1 - (price.Item1 * ((double)Discount / 100)));
                            else
                                Price = price.Item1;
                            Currency = price.Item2;
                        }
    
                        break;
                    }
                }
                UpdateCount++;
            }
        }
    }




  9. The Following User Says Thank You to ossimc82 For This Useful Post:

    [MPGH]Ahl (04-15-2015)

  10. #7
    sebastianfra12's Avatar
    Join Date
    Dec 2013
    Gender
    male
    Posts
    361
    Reputation
    21
    Thanks
    75
    My Mood
    Inspired
    Quote Originally Posted by ossimc82 View Post
    So like I did?


     

     

     

     

    Code:
    #region
    
    using common;
    using log4net;
    using System;
    using System.Collections.Generic;
    using System.Xml.Linq;
    using wServer.networking.svrPackets;
    using wServer.realm.entities.player;
    
    #endregion
    
    namespace wServer.realm.entities
    {
        public class Merchants : SellableObject
        {
            private const int BUY_NO_GOLD = 3;
            private const int BUY_NO_FAME = 6;
            private const int BUY_NO_FORTUNETOKENS = 9; //Doesnt exist in client I guess :3
            private const int merchantSize = 100;
            private static readonly new ILog log = LogManager.GetLogger(typeof(Merchants));
    
            private readonly Dictionary<int, Tuple<int, CurrencyType>> prices = MerchantLists.prices;
            private int objType;
    
            private bool closing;
            private bool newMerchant;
            private int tickcount;
    
            public static Random Random { get; private set; }
    
            public Merchants(RealmManager manager, ushort objType, World owner = null)
                : base(manager, objType)
            {
                MType = -1;
                this.objType = objType;
                Size = merchantSize;
                if (owner != null)
                    Owner = owner;
    
                if (Random == null) Random = new Random();
                if (AddedTypes == null) AddedTypes = new List<KeyValuePair<string, int>>();
                if(owner != null) ResolveMType();
            }
    
            private static List<KeyValuePair<string, int>> AddedTypes { get; set; }
    
            public bool Custom { get; set; }
    
            public int MType { get; set; }
            public int MRemaining { get; set; }
            public int MTime { get; set; }
            public int Discount { get; set; }
    
            protected override void ExportStats(IDictionary<StatsType, object> stats)
            {
                stats[StatsType.MerchantMerchandiseType] = MType;
                stats[StatsType.MerchantRemainingCount] = MRemaining;
                stats[StatsType.MerchantRemainingMinute] = newMerchant ? Int32.MaxValue : MTime;
                stats[StatsType.MerchantDiscount] = Discount;
                stats[StatsType.SellablePrice] = Price;
                stats[StatsType.SellableRankRequirement] = RankReq;
                stats[StatsType.SellablePriceCurrency] = Currency;
    
                base.ExportStats(stats);
            }
    
            public override void Init(World owner)
            {
                base.Init(owner);
                ResolveMType();
                UpdateCount++;
                if (MType == -1) Owner.LeaveWorld(this);
            }
    
            protected override bool TryDeduct(Player player)
            {
                DbAccount acc = player.Client.Account;
                if (player.Stars < RankReq) return false;
    
                if (Currency == CurrencyType.Fame)
                    if (acc.Fame < Price) return false;
    
                if (Currency == CurrencyType.Gold)
                    if (acc.Credits < Price) return false;
    
                if (Currency == CurrencyType.FortuneTokens)
                    if (acc.FortuneTokens < Price) return false;
                return true;
            }
    
            public override void Buy(Player player)
            {
                if (ObjectType == 0x01ca) //Merchant
                {
                    if (TryDeduct(player))
                    {
                        for (int i = 0; i < player.Inventory.Length; i++)
                        {
                            try
                            {
                                XElement ist;
                                Manager.GameData.ObjectTypeToElement.TryGetValue((ushort)MType, out ist);
                                if (player.Inventory[i] == null &&
                                    (player.SlotTypes[i] == 10 ||
                                     player.SlotTypes[i] == Convert.ToInt16(ist.Element("SlotType").Value)))
                                // Exploit fix - No more mnovas as weapons!
                                {
                                    player.Inventory[i] = Manager.GameData.Items[(ushort)MType];
    
                                    if (Currency == CurrencyType.Fame)
                                        player.CurrentFame = player.Client.Account.Fame -= Price;
                                    if (Currency == CurrencyType.Gold)
                                        player.Credits = player.Client.Account.Credits -= Price;
                                    if (Currency == CurrencyType.FortuneTokens)
                                        player.Tokens = player.Client.Account.FortuneTokens -= Price;
    
                                    player.Client.SendPacket(new BuyResultPacket
                                    {
                                        Result = 0,
                                        Message = "{\"key\":\"server.buy_success\"}"
                                    });
                                    MRemaining--;
                                    player.UpdateCount++;
                                    player.SaveToCharacter();
                                    player.Client.Account.Flush();
                                    player.Client.Account.Reload();
                                    UpdateCount++;
                                    return;
                                }
                            }
                            catch (Exception e)
                            {
                                log.Error(e);
                            }
                        }
                        player.Client.SendPacket(new BuyResultPacket
                        {
                            Result = 0,
                            Message = "{\"key\":\"server.inventory_full\"}"
                        });
                    }
                    else
                    {
                        if (player.Stars < RankReq)
                        {
                            player.Client.SendPacket(new BuyResultPacket
                            {
                                Result = 0,
                                Message = "Not enough stars!"
                            });
                            return;
                        }
                        switch (Currency)
                        {
                            case CurrencyType.Gold:
                                player.Client.SendPacket(new BuyResultPacket
                                {
                                    Result = BUY_NO_GOLD,
                                    Message = "{\"key\":\"server.not_enough_gold\"}"
                                });
                                break;
                            case CurrencyType.Fame:
                                player.Client.SendPacket(new BuyResultPacket
                                {
                                    Result = BUY_NO_FAME,
                                    Message = "{\"key\":\"server.not_enough_fame\"}"
                                });
                                break;
                            case CurrencyType.FortuneTokens:
                                player.Client.SendPacket(new BuyResultPacket
                                {
                                    Result = BUY_NO_FORTUNETOKENS,
                                    Message = "{\"key\":\"server.not_enough_fortunetokens\"}"
                                });
                                break;
                        }
                    }
                }
            }
    
            public override void Tick(RealmTime time)
            {
                try
                {
                    if (Size == 0 && MType != -1)
                    {
                        Size = merchantSize;
                        UpdateCount++;
                    }
    
                    if (!closing)
                    {
                        tickcount++;
                        if (Manager != null)
                        {
                            if (tickcount % (Manager.TPS * 60) == 0) //once per minute after spawning
                            {
                                MTime--;
                                UpdateCount++;
                            }
                        }
                    }
    
                    if (MRemaining == 0 &&  MType != -1)
                    {
                        if (AddedTypes.Contains(new KeyValuePair<string, int>(Owner.Name, MType)))
                            AddedTypes.Remove(new KeyValuePair<string, int>(Owner.Name, MType));
                        Recreate(this);
                        UpdateCount++;
                    }
    
                    if (MTime == -1 && Owner != null)
                    {
                        if (AddedTypes.Contains(new KeyValuePair<string, int>(Owner.Name, MType)))
                            AddedTypes.Remove(new KeyValuePair<string, int>(Owner.Name, MType));
                        Recreate(this);
                        UpdateCount++;
                    }
    
                    if (MTime == 1 && !closing)
                    {
                        closing = true;
                        if (Owner != null) Owner.Timers.Add(new WorldTimer(30 * 1000, (w1, t1) =>
                        {
                            MTime--;
                            UpdateCount++;
                            w1.Timers.Add(new WorldTimer(30 * 1000, (w2, t2) =>
                            {
                                MTime--;
                                UpdateCount++;
                            }));
                        }));
                    }
    
                    if (MType == -1 && Owner != null) Owner.LeaveWorld(this);
    
                    base.Tick(time);
                }
                catch (Exception ex)
                {
                    log.Error(ex);
                }
            }
    
            public void Recreate(Merchants x)
            {
                try
                {
                    Merchants mrc = new Merchants(Manager, x.ObjectType, x.Owner);
                    mrc.Move(x.X, x.Y);
                    World w = Owner;
                    Owner.LeaveWorld(this);
                    w.Timers.Add(new WorldTimer(Random.Next(30, 60) * 1000, (world, time) => w.EnterWorld(mrc)));
                }
                catch (Exception e)
                {
                    log.Error(e);
                }
            }
    
            public void ResolveMType()
            {
                MType = -1;
                int[] list = new int[0];
                if (Owner.Map[(int) X, (int) Y].Region == TileRegion.Store_1)
                    list = MerchantLists.store1List;
                else if (Owner.Map[(int) X, (int) Y].Region == TileRegion.Store_2)
                    list = MerchantLists.store2List;
                else if (Owner.Map[(int) X, (int) Y].Region == TileRegion.Store_3)
                    list = MerchantLists.store3List;
                else if (Owner.Map[(int) X, (int) Y].Region == TileRegion.Store_4)
                    list = MerchantLists.store4List;
                else if (Owner.Map[(int) X, (int) Y].Region == TileRegion.Store_5)
                    list = MerchantLists.store5List;
                else if (Owner.Map[(int) X, (int) Y].Region == TileRegion.Store_6)
                    list = MerchantLists.store6List;
                else if (Owner.Map[(int) X, (int) Y].Region == TileRegion.Store_7)
                    list = MerchantLists.store7List;
                else if (Owner.Map[(int) X, (int) Y].Region == TileRegion.Store_8)
                    list = MerchantLists.store8List;
                else if (Owner.Map[(int) X, (int) Y].Region == TileRegion.Store_9)
                    list = MerchantLists.store9List;
                else if (Owner.Map[(int) X, (int) Y].Region == TileRegion.Store_10)
                    list = MerchantLists.store10List;
                else if (Owner.Map[(int) X, (int) Y].Region == TileRegion.Store_11)
                    list = MerchantLists.store11List;
                else if (Owner.Map[(int) X, (int) Y].Region == TileRegion.Store_12)
                    list = MerchantLists.AccessoryDyeList;
                else if (Owner.Map[(int) X, (int) Y].Region == TileRegion.Store_13)
                    list = MerchantLists.ClothingClothList;
                else if (Owner.Map[(int) X, (int) Y].Region == TileRegion.Store_14)
                    list = MerchantLists.AccessoryClothList;
                else if (Owner.Map[(int) X, (int) Y].Region == TileRegion.Store_15)
                    list = MerchantLists.ClothingDyeList;
                else if (Owner.Map[(int) X, (int) Y].Region == TileRegion.Store_16)
                    list = MerchantLists.store5List;
                else if (Owner.Map[(int) X, (int) Y].Region == TileRegion.Store_17)
                    list = MerchantLists.store7List;
                else if (Owner.Map[(int) X, (int) Y].Region == TileRegion.Store_18)
                    list = MerchantLists.store6List;
                else if (Owner.Map[(int) X, (int) Y].Region == TileRegion.Store_19)
                    list = MerchantLists.store2List;
                else if (Owner.Map[(int) X, (int) Y].Region == TileRegion.Store_20)
                    list = MerchantLists.store20List;
                else if (Owner.Map[(int) X, (int) Y].Region == TileRegion.Store_21)
                    list = MerchantLists.AccessoryClothList;
                else if (Owner.Map[(int) X, (int) Y].Region == TileRegion.Store_22)
                    list = MerchantLists.AccessoryDyeList;
                else if (Owner.Map[(int) X, (int) Y].Region == TileRegion.Store_23)
                    list = MerchantLists.ClothingClothList;
                else if (Owner.Map[(int) X, (int) Y].Region == TileRegion.Store_24)
                    list = MerchantLists.ClothingDyeList;
    
                if (AddedTypes == null) AddedTypes = new List<KeyValuePair<string, int>>();
                list.Shuffle();
                for (int i = 0; i < list.Length; i++)
                {
                    if (!AddedTypes.Contains(new KeyValuePair<string, int>(Owner.Name, list[i])))
                    {
                        AddedTypes.Add(new KeyValuePair<string, int>(Owner.Name, list[i]));
                        MType = list[i];
                        MTime = Random.Next(6, 15);
                        MRemaining = Random.Next(6, 11);
                        newMerchant = true;
                        Owner.Timers.Add(new WorldTimer(30000, (w, t) =>
                        {
                            newMerchant = false;
                            UpdateCount++;
                        }));
    
                        int s = Random.Next(0, 100);
    
                        if(s < 2)
                            Discount = 50;
                        else if(s < 5)
                            Discount = 25;
                        else if (s < 10)
                            Discount = 15;
                        else if(s < 15)
                            Discount = 10;
                        else Discount = 0;
    
                        Tuple<int, CurrencyType> price;
                        if (prices.TryGetValue(MType, out price))
                        {
                            if (Discount != 0)
                                Price = (int)(price.Item1 - (price.Item1 * ((double)Discount / 100))) < 1 ?
                                    price.Item1 : (int)(price.Item1 - (price.Item1 * ((double)Discount / 100)));
                            else
                                Price = price.Item1;
                            Currency = price.Item2;
                        }
    
                        break;
                    }
                }
                UpdateCount++;
            }
        }
    }



    i have a lots of errors with fortune etc :c

  11. #8
    qpadones1's Avatar
    Join Date
    Apr 2014
    Gender
    male
    Posts
    37
    Reputation
    10
    Thanks
    12
    My Mood
    Amazed
    Well, I just wanted to share what i could. And now as the private server community is being so well and I dident find any tutorial for this so worth it I guess

  12. #9
    ossimc82's Avatar
    Join Date
    Jul 2012
    Gender
    male
    Posts
    496
    Reputation
    42
    Thanks
    887
    My Mood
    In Love
    Quote Originally Posted by sebastianfra12 View Post
    i have a lots of errors with fortune etc :c
    wow, dont say, its a snippet from my fabiano swagger of doom source, you need to modify some stuff to get it work for normal sources

  13. The Following User Says Thank You to ossimc82 For This Useful Post:

    [MPGH]Ahl (04-15-2015)

  14. #10
    KieronZeCoder69's Avatar
    Join Date
    Jun 2014
    Gender
    male
    Location
    On my computer
    Posts
    439
    Reputation
    20
    Thanks
    219
    My Mood
    Aggressive
    Quote Originally Posted by ossimc82 View Post
    wow, dont say, its a snippet from my fabiano swagger of doom source, you need to modify some stuff to get it work for normal sources
    lol he tried to use the code xD

  15. The Following User Says Thank You to KieronZeCoder69 For This Useful Post:

    [MPGH]Ahl (04-15-2015)

  16. #11
    Chrisrocks126's Avatar
    Join Date
    Feb 2015
    Gender
    male
    Location
    Running from the cops because I'm black
    Posts
    133
    Reputation
    10
    Thanks
    52
    My Mood
    Relaxed
    Anyone have item ID list for pserv? Trying to change the items being sold in nexus for a server im working on.

  17. #12
    Ahl's Avatar
    Join Date
    Dec 2012
    Gender
    male
    Location
    /modcp
    Posts
    16,599
    Reputation
    3219
    Thanks
    5,383
    My Mood
    Angelic
    Quote Originally Posted by sebastianfra12 View Post
    i have a lots of errors with fortune etc :c
    nice try. Delete the fortune token lines.
    News Force Head Editor from 09/14/2018 - 03/02/2020
    Publicist from 11/23/2017 - 06/07/2019
    Global Moderator since 09/24/2017
    Minion+ from 04/16/2017 - 09/24/2017
    Market Place Minion from 04/16/2017 - 09/24/2017
    Minecraft Minion from 02/23/2017 - 09/24/2017
    Realm of the Mad God Minion from 11/06/2016 - 09/24/2017

    Middleman from 09/14/2016 - 09/24/2017
    News Force Editor from 08/23/2016 - 09/14/2018
    News Force (Section of the Week) from 03/21/2016 - 07/17/2017
    News Force (User News) from 10/18/2015 - 09/14/2018

    Donator since 03/16/2015
    Realm of the Mad God Editor from 05/20/2014 - 07/08/2014
    Member since 12/23/2012


    Rep Power: 82

  18. #13
    qpadones1's Avatar
    Join Date
    Apr 2014
    Gender
    male
    Posts
    37
    Reputation
    10
    Thanks
    12
    My Mood
    Amazed
    You find items id in item.xml etc or addition2.xml

  19. #14
    qpadones1's Avatar
    Join Date
    Apr 2014
    Gender
    male
    Posts
    37
    Reputation
    10
    Thanks
    12
    My Mood
    Amazed
    No problem!

  20. #15
    Kierze's Avatar
    Join Date
    Apr 2015
    Gender
    male
    Posts
    152
    Reputation
    10
    Thanks
    163
    thanks for sharing this, a lot of people struggle with it xD idk why

Page 1 of 2 12 LastLast

Similar Threads

  1. [Help Request] Signs and shops at Nexus
    By cxydsaewq in forum Realm of the Mad God Private Servers Help
    Replies: 0
    Last Post: 09-18-2014, 11:24 AM
  2. [Solved] how can i change shops in nexus
    By unholydmg in forum Realm of the Mad God Private Servers Help
    Replies: 5
    Last Post: 10-07-2013, 01:56 AM
  3. Shops in nexus
    By sage232 in forum Realm of the Mad God Private Servers Help
    Replies: 5
    Last Post: 08-13-2013, 04:41 PM
  4. [WTS] Nexus Account Shop [Variety of accounts]!
    By NexusBay in forum Selling Accounts/Keys/Items
    Replies: 2
    Last Post: 06-12-2013, 08:21 AM