예제 #1
0
        public override void OnMovement(Mobile m, Point3D oldLocation)
        {
            base.OnMovement(m, oldLocation);


            int hours, minutes, uoDay, totalUoDays, totalMinutes;

            Server.Items.Clock.GetTime(m.Map, m.X, m.Y, out hours, out minutes, out totalMinutes);

            totalUoDays = (int)Math.Ceiling((double)totalMinutes / (60 * 24));

            Math.DivRem(totalUoDays, 30, out uoDay);

            //if (uoDay== 1 || uoDay == 7 || uoDay == 15 || uoDay== 23)
            // {
            if (hours >= 6 && hours <= 18)
            {
                int marketplace    = m_market.Count;
                int marketplacemob = m_marketmob.Count;

                if (marketplace >= marketCount && marketplacemob >= marketCount)
                {
                    return;
                }

                bool validLocation = false;
                Map  map           = this.Map;

                for (int i = marketplace; i < marketCount; ++i)
                {
                    if (i == 0)
                    {
                        Point3D marketloc = this.Location;//
                        AG_MarketStandMercerEastAddon market = new AG_MarketStandMercerEastAddon();

                        for (int k = 0; !validLocation && k < 10; ++k)
                        {
                            int ax = X;
                            int ay = Y + 3;
                            int az = map.GetAverageZ(ax, ay);

                            if (validLocation = map.CanFit(ax, ay, this.Z, 16, false, false))
                            {
                                marketloc = new Point3D(ax, ay, Z);
                            }
                            else if (validLocation = map.CanFit(ax, ay, az, 16, false, false))
                            {
                                marketloc = new Point3D(ax, ay, az);
                            }
                        }
                        market.MoveToWorld(marketloc, this.Map);
                        m_market.Add(market);
                    }

                    if (i == 1)
                    {
                        Point3D marketloc1 = this.Location;//
                        AG_MarketStandCheeseSouthAddon market = new AG_MarketStandCheeseSouthAddon();

                        int bx = X - 3;
                        int by = Y;
                        int bz = map.GetAverageZ(bx, by);

                        if (validLocation = map.CanFit(bx, by, this.Z, 16, false, false))
                        {
                            marketloc1 = new Point3D(bx, by, Z);
                        }
                        else if (validLocation = map.CanFit(bx, by, bz, 16, false, false))
                        {
                            marketloc1 = new Point3D(bx, by, bz);
                        }

                        market.MoveToWorld(marketloc1, this.Map);
                        m_market.Add(market);
                    }

                    if (i == 2)
                    {
                        Point3D marketloc2 = this.Location;//
                        MarketStandVegetablesSouthAddon market = new MarketStandVegetablesSouthAddon();

                        int cx = X + 3;
                        int cy = Y;
                        int cz = map.GetAverageZ(cx, cy);

                        if (validLocation = map.CanFit(cx, cy, this.Z, 16, false, false))
                        {
                            marketloc2 = new Point3D(cx, cy, Z);
                        }
                        else if (validLocation = map.CanFit(cx, cy, cz, 16, false, false))
                        {
                            marketloc2 = new Point3D(cx, cy, cz);
                        }

                        market.MoveToWorld(marketloc2, this.Map);
                        m_market.Add(market);
                    }

                    if (i == 3)
                    {
                        Point3D marketloc3 = this.Location;//
                        AG_MarketStandFishEastAddon market = new AG_MarketStandFishEastAddon();

                        int dx = X;
                        int dy = Y - 3;
                        int dz = map.GetAverageZ(dx, dy);

                        if (validLocation = map.CanFit(dx, dy, this.Z, 16, false, false))
                        {
                            marketloc3 = new Point3D(dx, dy, Z);
                        }
                        else if (validLocation = map.CanFit(dx, dy, dz, 16, false, false))
                        {
                            marketloc3 = new Point3D(dx, dy, dz);
                        }

                        market.MoveToWorld(marketloc3, this.Map);
                        m_market.Add(market);
                    }
                }

                for (int i = marketplacemob; i < marketmobCount; ++i)
                {
                    if (i == 0)
                    {
                        Point3D         marketloc5 = this.Location;//
                        VegetableFarmer marketmob0 = new VegetableFarmer();

                        int fx = X + 3;
                        int fy = Y;
                        int fz = map.GetAverageZ(fx, fy);

                        if (validLocation = map.CanFit(fx, fy, this.Z, 16, false, false))
                        {
                            marketloc5 = new Point3D(fx, fy, Z);
                        }
                        else if (validLocation = map.CanFit(fx, fy, fz, 16, false, false))
                        {
                            marketloc5 = new Point3D(fx, fy, fz);
                        }

                        marketmob0.Home      = marketloc5;
                        marketmob0.RangeHome = 0;
                        marketmob0.MoveToWorld(marketloc5, this.Map);
                        m_marketmob.Add(marketmob0);
                    }
                    if (i == 1)
                    {
                        Point3D marketloc6 = this.Location;//
                        Mercer  marketmob1 = new Mercer();

                        int gx = X - 2;
                        int gy = Y + 3;
                        int gz = map.GetAverageZ(gx, gy);

                        if (validLocation = map.CanFit(gx, gy, this.Z, 16, false, false))
                        {
                            marketloc6 = new Point3D(gx, gy, Z);
                        }
                        else if (validLocation = map.CanFit(gx, gy, gz, 16, false, false))
                        {
                            marketloc6 = new Point3D(gx, gy, gz);
                        }

                        marketmob1.Home      = marketloc6;
                        marketmob1.RangeHome = 0;
                        marketmob1.MoveToWorld(marketloc6, this.Map);
                        m_marketmob.Add(marketmob1);
                    }
                    if (i == 2)
                    {
                        Point3D   marketloc7 = this.Location; //
                        Fisherman marketmob2 = new Fisherman();

                        int hx = X + 3;
                        int hy = Y - 3;
                        int hz = map.GetAverageZ(hx, hy);

                        if (validLocation = map.CanFit(hx, hy, this.Z, 16, false, false))
                        {
                            marketloc7 = new Point3D(hx, hy, Z);
                        }
                        else if (validLocation = map.CanFit(hx, hy, hz, 16, false, false))
                        {
                            marketloc7 = new Point3D(hx, hy, hz);
                        }

                        marketmob2.Home      = marketloc7;
                        marketmob2.RangeHome = 0;
                        marketmob2.MoveToWorld(marketloc7, this.Map);
                        m_marketmob.Add(marketmob2);
                    }
                    if (i == 3)
                    {
                        Point3D      marketloc8 = this.Location; //
                        CheeseMonger marketmob3 = new CheeseMonger();

                        int ix = X - 3;
                        int iy = Y - 2;
                        int iz = map.GetAverageZ(ix, iy);

                        if (validLocation = map.CanFit(ix, iy, this.Z, 16, false, false))
                        {
                            marketloc8 = new Point3D(ix, iy, Z);
                        }
                        else if (validLocation = map.CanFit(ix, iy, iz, 16, false, false))
                        {
                            marketloc8 = new Point3D(ix, iy, iz);
                        }

                        marketmob3.Home      = marketloc8;
                        marketmob3.RangeHome = 0;
                        marketmob3.MoveToWorld(marketloc8, this.Map);
                        m_marketmob.Add(marketmob3);
                    }
                }
            }
            //}

            else
            {
                foreach (Item that in m_market)
                {
                    that.Delete();
                }

                foreach (Mobile thats in m_marketmob)
                {
                    thats.Delete();
                }
            }
        }
예제 #2
0
        public override void OnMovement(Mobile m, Point3D oldLocation)
        {
            base.OnMovement(m, oldLocation);


            int hours, minutes, uoDay, totalUoDays, totalMinutes;

            Server.Items.Clock.GetTime(m.Map, m.X, m.Y, out hours, out minutes, out totalMinutes);

            totalUoDays = (int)Math.Ceiling((double)totalMinutes / (60 * 24));

            Math.DivRem(totalUoDays, 30, out uoDay);

            //if (uoDay== 1 || uoDay == 7 || uoDay == 15 || uoDay== 23)
            // {
            if (hours >= 6 && hours <= 18)
            {
                int marketplace    = m_market.Count;
                int marketplacemob = m_marketmob.Count;

                if (marketplace >= marketCount && marketplacemob >= marketCount)
                {
                    return;
                }

                bool validLocation = false;
                Map  map           = this.Map;

                switch (Utility.Random(11))
                {
                    #region fisherman
                case 0:
                {
                    for (int i = marketplace; i < marketCount; ++i)
                    {
                        if (i == 0)
                        {
                            Point3D marketloc = this.Location;        //
                            MarketStandFishSouthAddon market = new MarketStandFishSouthAddon();

                            for (int k = 0; !validLocation && k < 10; ++k)
                            {
                                int ax = X;
                                int ay = Y;
                                int az = map.GetAverageZ(ax, ay);

                                if (validLocation = map.CanFit(ax, ay, this.Z, 16, false, false))
                                {
                                    marketloc = new Point3D(ax, ay, Z);
                                }
                                else if (validLocation = map.CanFit(ax, ay, az, 16, false, false))
                                {
                                    marketloc = new Point3D(ax, ay, az);
                                }
                            }
                            market.MoveToWorld(marketloc, this.Map);
                            m_market.Add(market);
                        }
                    }
                    for (int i = marketplacemob; i < marketmobCount; ++i)
                    {
                        if (i == 0)
                        {
                            Point3D   marketloc6 = this.Location;      //
                            Fisherman marketmob1 = new Fisherman();

                            int gx = X;
                            int gy = Y + 3;
                            int gz = map.GetAverageZ(gx, gy);

                            if (validLocation = map.CanFit(gx, gy, this.Z, 16, false, false))
                            {
                                marketloc6 = new Point3D(gx, gy, Z);
                            }
                            else if (validLocation = map.CanFit(gx, gy, gz, 16, false, false))
                            {
                                marketloc6 = new Point3D(gx, gy, gz);
                            }

                            marketmob1.Home      = marketloc6;
                            marketmob1.RangeHome = 0;
                            marketmob1.MoveToWorld(marketloc6, this.Map);
                            m_marketmob.Add(marketmob1);
                        }
                    }
                    break;
                }

                    #endregion

                    #region mercer
                case 1:
                {
                    for (int i = marketplace; i < marketCount; ++i)
                    {
                        if (i == 0)
                        {
                            Point3D marketloc = this.Location;        //
                            MarketStandMercerSouthAddon market = new MarketStandMercerSouthAddon();

                            for (int k = 0; !validLocation && k < 10; ++k)
                            {
                                int ax = X;
                                int ay = Y;
                                int az = map.GetAverageZ(ax, ay);

                                if (validLocation = map.CanFit(ax, ay, this.Z, 16, false, false))
                                {
                                    marketloc = new Point3D(ax, ay, Z);
                                }
                                else if (validLocation = map.CanFit(ax, ay, az, 16, false, false))
                                {
                                    marketloc = new Point3D(ax, ay, az);
                                }
                            }
                            market.MoveToWorld(marketloc, this.Map);
                            m_market.Add(market);
                        }
                    }
                    for (int i = marketplacemob; i < marketmobCount; ++i)
                    {
                        if (i == 0)
                        {
                            Point3D marketloc6 = this.Location;        //
                            Tailor  marketmob1 = new Tailor();

                            int gx = X;
                            int gy = Y + 3;
                            int gz = map.GetAverageZ(gx, gy);

                            if (validLocation = map.CanFit(gx, gy, this.Z, 16, false, false))
                            {
                                marketloc6 = new Point3D(gx, gy, Z);
                            }
                            else if (validLocation = map.CanFit(gx, gy, gz, 16, false, false))
                            {
                                marketloc6 = new Point3D(gx, gy, gz);
                            }

                            marketmob1.Home      = marketloc6;
                            marketmob1.RangeHome = 0;
                            marketmob1.MoveToWorld(marketloc6, this.Map);
                            m_marketmob.Add(marketmob1);
                        }
                    }
                    break;
                }

                    #endregion

                    #region vegetables
                case 2:
                {
                    for (int i = marketplace; i < marketCount; ++i)
                    {
                        if (i == 0)
                        {
                            Point3D marketloc = this.Location;        //
                            MarketStandVegetablesSouthAddon market = new MarketStandVegetablesSouthAddon();

                            for (int k = 0; !validLocation && k < 10; ++k)
                            {
                                int ax = X;
                                int ay = Y;
                                int az = map.GetAverageZ(ax, ay);

                                if (validLocation = map.CanFit(ax, ay, this.Z, 16, false, false))
                                {
                                    marketloc = new Point3D(ax, ay, Z);
                                }
                                else if (validLocation = map.CanFit(ax, ay, az, 16, false, false))
                                {
                                    marketloc = new Point3D(ax, ay, az);
                                }
                            }
                            market.MoveToWorld(marketloc, this.Map);
                            m_market.Add(market);
                        }
                    }
                    for (int i = marketplacemob; i < marketmobCount; ++i)
                    {
                        if (i == 0)
                        {
                            Point3D marketloc6 = this.Location;        //
                            Farmer  marketmob1 = new Farmer();

                            int gx = X;
                            int gy = Y + 3;
                            int gz = map.GetAverageZ(gx, gy);

                            if (validLocation = map.CanFit(gx, gy, this.Z, 16, false, false))
                            {
                                marketloc6 = new Point3D(gx, gy, Z);
                            }
                            else if (validLocation = map.CanFit(gx, gy, gz, 16, false, false))
                            {
                                marketloc6 = new Point3D(gx, gy, gz);
                            }

                            marketmob1.Home      = marketloc6;
                            marketmob1.RangeHome = 0;
                            marketmob1.MoveToWorld(marketloc6, this.Map);
                            m_marketmob.Add(marketmob1);
                        }
                    }
                    break;
                }

                    #endregion

                    #region cheese
                case 3:
                {
                    for (int i = marketplace; i < marketCount; ++i)
                    {
                        if (i == 0)
                        {
                            Point3D marketloc = this.Location;        //
                            MarketStandCheeseSouthAddon market = new MarketStandCheeseSouthAddon();

                            for (int k = 0; !validLocation && k < 10; ++k)
                            {
                                int ax = X;
                                int ay = Y;
                                int az = map.GetAverageZ(ax, ay);

                                if (validLocation = map.CanFit(ax, ay, this.Z, 16, false, false))
                                {
                                    marketloc = new Point3D(ax, ay, Z);
                                }
                                else if (validLocation = map.CanFit(ax, ay, az, 16, false, false))
                                {
                                    marketloc = new Point3D(ax, ay, az);
                                }
                            }
                            market.MoveToWorld(marketloc, this.Map);
                            m_market.Add(market);
                        }
                    }
                    for (int i = marketplacemob; i < marketmobCount; ++i)
                    {
                        if (i == 0)
                        {
                            Point3D      marketloc6 = this.Location;   //
                            CheeseMonger marketmob1 = new CheeseMonger();

                            int gx = X;
                            int gy = Y + 3;
                            int gz = map.GetAverageZ(gx, gy);

                            if (validLocation = map.CanFit(gx, gy, this.Z, 16, false, false))
                            {
                                marketloc6 = new Point3D(gx, gy, Z);
                            }
                            else if (validLocation = map.CanFit(gx, gy, gz, 16, false, false))
                            {
                                marketloc6 = new Point3D(gx, gy, gz);
                            }

                            marketmob1.Home      = marketloc6;
                            marketmob1.RangeHome = 0;
                            marketmob1.MoveToWorld(marketloc6, this.Map);
                            m_marketmob.Add(marketmob1);
                        }
                    }
                    break;
                }

                    #endregion

                    #region wine

                    /*
                     * case 4:
                     *  {
                     *      for (int i = marketplace; i < marketCount; ++i)
                     *      {
                     *          if (i == 0)
                     *          {
                     *              Point3D marketloc = this.Location;//
                     *              MarketStandWineSouthAddon market = new MarketStandWineSouthAddon();
                     *
                     *              for (int k = 0; !validLocation && k < 10; ++k)
                     *              {
                     *                  int ax = X ;
                     *                  int ay = Y;
                     *                  int az = map.GetAverageZ(ax, ay);
                     *
                     *                  if (validLocation = map.CanFit(ax, ay, this.Z, 16, false, false))
                     *                      marketloc = new Point3D(ax, ay, Z);
                     *                  else if (validLocation = map.CanFit(ax, ay, az, 16, false, false))
                     *                      marketloc = new Point3D(ax, ay, az);
                     *              }
                     *              market.MoveToWorld(marketloc, this.Map);
                     *              m_market.Add(market);
                     *          }
                     *
                     *      }
                     *      for (int i = marketplacemob; i < marketmobCount; ++i)
                     *      {
                     *          if (i == 0)
                     *          {
                     *              Point3D marketloc6 = this.Location;//
                     *              RomanWineMerchant marketmob1 = new RomanWineMerchant();
                     *
                     *              int gx = X ;
                     *              int gy = Y + 3;
                     *              int gz = map.GetAverageZ(gx, gy);
                     *
                     *              if (validLocation = map.CanFit(gx, gy, this.Z, 16, false, false))
                     *                  marketloc6 = new Point3D(gx, gy, Z);
                     *              else if (validLocation = map.CanFit(gx, gy, gz, 16, false, false))
                     *                  marketloc6 = new Point3D(gx, gy, gz);
                     *
                     *              marketmob1.Home = marketloc6;
                     *              marketmob1.RangeHome = 0;
                     *              marketmob1.MoveToWorld(marketloc6, this.Map);
                     *              m_marketmob.Add(marketmob1);
                     *          }
                     *      }
                     *      break;
                     *  }
                     */
                    #endregion

                    #region herbs
                case 5:
                {
                    for (int i = marketplace; i < marketCount; ++i)
                    {
                        if (i == 0)
                        {
                            Point3D marketloc = this.Location;        //
                            MarketStandHerbsSouthAddon market = new MarketStandHerbsSouthAddon();

                            for (int k = 0; !validLocation && k < 10; ++k)
                            {
                                int ax = X;
                                int ay = Y;
                                int az = map.GetAverageZ(ax, ay);

                                if (validLocation = map.CanFit(ax, ay, this.Z, 16, false, false))
                                {
                                    marketloc = new Point3D(ax, ay, Z);
                                }
                                else if (validLocation = map.CanFit(ax, ay, az, 16, false, false))
                                {
                                    marketloc = new Point3D(ax, ay, az);
                                }
                            }
                            market.MoveToWorld(marketloc, this.Map);
                            m_market.Add(market);
                        }
                    }
                    for (int i = marketplacemob; i < marketmobCount; ++i)
                    {
                        if (i == 0)
                        {
                            Point3D   marketloc6 = this.Location;      //
                            Herbalist marketmob1 = new Herbalist();

                            int gx = X;
                            int gy = Y + 3;
                            int gz = map.GetAverageZ(gx, gy);

                            if (validLocation = map.CanFit(gx, gy, this.Z, 16, false, false))
                            {
                                marketloc6 = new Point3D(gx, gy, Z);
                            }
                            else if (validLocation = map.CanFit(gx, gy, gz, 16, false, false))
                            {
                                marketloc6 = new Point3D(gx, gy, gz);
                            }

                            marketmob1.Home      = marketloc6;
                            marketmob1.RangeHome = 0;
                            marketmob1.MoveToWorld(marketloc6, this.Map);
                            m_marketmob.Add(marketmob1);
                        }
                    }
                    break;
                }

                    #endregion

                    #region mushroom
                case 6:
                {
                    for (int i = marketplace; i < marketCount; ++i)
                    {
                        if (i == 0)
                        {
                            Point3D marketloc = this.Location;        //
                            MarketStandMushroomSouthAddon market = new MarketStandMushroomSouthAddon();

                            for (int k = 0; !validLocation && k < 10; ++k)
                            {
                                int ax = X;
                                int ay = Y;
                                int az = map.GetAverageZ(ax, ay);

                                if (validLocation = map.CanFit(ax, ay, this.Z, 16, false, false))
                                {
                                    marketloc = new Point3D(ax, ay, Z);
                                }
                                else if (validLocation = map.CanFit(ax, ay, az, 16, false, false))
                                {
                                    marketloc = new Point3D(ax, ay, az);
                                }
                            }
                            market.MoveToWorld(marketloc, this.Map);
                            m_market.Add(market);
                        }
                    }
                    for (int i = marketplacemob; i < marketmobCount; ++i)
                    {
                        if (i == 0)
                        {
                            Point3D   marketloc6 = this.Location;      //
                            Herbalist marketmob1 = new Herbalist();

                            int gx = X;
                            int gy = Y + 3;
                            int gz = map.GetAverageZ(gx, gy);

                            if (validLocation = map.CanFit(gx, gy, this.Z, 16, false, false))
                            {
                                marketloc6 = new Point3D(gx, gy, Z);
                            }
                            else if (validLocation = map.CanFit(gx, gy, gz, 16, false, false))
                            {
                                marketloc6 = new Point3D(gx, gy, gz);
                            }

                            marketmob1.Home      = marketloc6;
                            marketmob1.RangeHome = 0;
                            marketmob1.MoveToWorld(marketloc6, this.Map);
                            m_marketmob.Add(marketmob1);
                        }
                    }
                    break;
                }

                    #endregion

                    #region fur
                case 7:
                {
                    for (int i = marketplace; i < marketCount; ++i)
                    {
                        if (i == 0)
                        {
                            Point3D marketloc = this.Location;        //
                            MarketStandFurSouthAddon market = new MarketStandFurSouthAddon();

                            for (int k = 0; !validLocation && k < 10; ++k)
                            {
                                int ax = X;
                                int ay = Y;
                                int az = map.GetAverageZ(ax, ay);

                                if (validLocation = map.CanFit(ax, ay, this.Z, 16, false, false))
                                {
                                    marketloc = new Point3D(ax, ay, Z);
                                }
                                else if (validLocation = map.CanFit(ax, ay, az, 16, false, false))
                                {
                                    marketloc = new Point3D(ax, ay, az);
                                }
                            }
                            market.MoveToWorld(marketloc, this.Map);
                            m_market.Add(market);
                        }
                    }
                    for (int i = marketplacemob; i < marketmobCount; ++i)
                    {
                        if (i == 0)
                        {
                            Point3D   marketloc6 = this.Location;      //
                            Furtrader marketmob1 = new Furtrader();

                            int gx = X;
                            int gy = Y + 3;
                            int gz = map.GetAverageZ(gx, gy);

                            if (validLocation = map.CanFit(gx, gy, this.Z, 16, false, false))
                            {
                                marketloc6 = new Point3D(gx, gy, Z);
                            }
                            else if (validLocation = map.CanFit(gx, gy, gz, 16, false, false))
                            {
                                marketloc6 = new Point3D(gx, gy, gz);
                            }

                            marketmob1.Home      = marketloc6;
                            marketmob1.RangeHome = 0;
                            marketmob1.MoveToWorld(marketloc6, this.Map);
                            m_marketmob.Add(marketmob1);
                        }
                    }
                    break;
                }

                    #endregion

                    #region bee
                case 8:
                {
                    for (int i = marketplace; i < marketCount; ++i)
                    {
                        if (i == 0)
                        {
                            Point3D marketloc = this.Location;        //
                            MarketStandBeeSouthAddon market = new MarketStandBeeSouthAddon();

                            for (int k = 0; !validLocation && k < 10; ++k)
                            {
                                int ax = X;
                                int ay = Y;
                                int az = map.GetAverageZ(ax, ay);

                                if (validLocation = map.CanFit(ax, ay, this.Z, 16, false, false))
                                {
                                    marketloc = new Point3D(ax, ay, Z);
                                }
                                else if (validLocation = map.CanFit(ax, ay, az, 16, false, false))
                                {
                                    marketloc = new Point3D(ax, ay, az);
                                }
                            }
                            market.MoveToWorld(marketloc, this.Map);
                            m_market.Add(market);
                        }
                    }
                    for (int i = marketplacemob; i < marketmobCount; ++i)
                    {
                        if (i == 0)
                        {
                            Point3D   marketloc6 = this.Location;      //
                            Beekeeper marketmob1 = new Beekeeper();

                            int gx = X;
                            int gy = Y + 3;
                            int gz = map.GetAverageZ(gx, gy);

                            if (validLocation = map.CanFit(gx, gy, this.Z, 16, false, false))
                            {
                                marketloc6 = new Point3D(gx, gy, Z);
                            }
                            else if (validLocation = map.CanFit(gx, gy, gz, 16, false, false))
                            {
                                marketloc6 = new Point3D(gx, gy, gz);
                            }

                            marketmob1.Home      = marketloc6;
                            marketmob1.RangeHome = 0;
                            marketmob1.MoveToWorld(marketloc6, this.Map);
                            m_marketmob.Add(marketmob1);
                        }
                    }
                    break;
                }

                    #endregion

                    #region copper
                case 9:
                {
                    for (int i = marketplace; i < marketCount; ++i)
                    {
                        if (i == 0)
                        {
                            Point3D marketloc = this.Location;        //
                            MarketStandCopperSouthAddon market = new MarketStandCopperSouthAddon();

                            for (int k = 0; !validLocation && k < 10; ++k)
                            {
                                int ax = X;
                                int ay = Y;
                                int az = map.GetAverageZ(ax, ay);

                                if (validLocation = map.CanFit(ax, ay, this.Z, 16, false, false))
                                {
                                    marketloc = new Point3D(ax, ay, Z);
                                }
                                else if (validLocation = map.CanFit(ax, ay, az, 16, false, false))
                                {
                                    marketloc = new Point3D(ax, ay, az);
                                }
                            }
                            market.MoveToWorld(marketloc, this.Map);
                            m_market.Add(market);
                        }
                    }
                    for (int i = marketplacemob; i < marketmobCount; ++i)
                    {
                        if (i == 0)
                        {
                            Point3D    marketloc6 = this.Location;     //
                            Blacksmith marketmob1 = new Blacksmith();

                            int gx = X;
                            int gy = Y + 3;
                            int gz = map.GetAverageZ(gx, gy);

                            if (validLocation = map.CanFit(gx, gy, this.Z, 16, false, false))
                            {
                                marketloc6 = new Point3D(gx, gy, Z);
                            }
                            else if (validLocation = map.CanFit(gx, gy, gz, 16, false, false))
                            {
                                marketloc6 = new Point3D(gx, gy, gz);
                            }

                            marketmob1.Home      = marketloc6;
                            marketmob1.RangeHome = 0;
                            marketmob1.MoveToWorld(marketloc6, this.Map);
                            m_marketmob.Add(marketmob1);
                        }
                    }
                    break;
                }

                    #endregion

                    #region tool
                case 10:
                {
                    for (int i = marketplace; i < marketCount; ++i)
                    {
                        if (i == 0)
                        {
                            Point3D marketloc = this.Location;        //
                            MarketStandToolSouthAddon market = new MarketStandToolSouthAddon();

                            for (int k = 0; !validLocation && k < 10; ++k)
                            {
                                int ax = X;
                                int ay = Y;
                                int az = map.GetAverageZ(ax, ay);

                                if (validLocation = map.CanFit(ax, ay, this.Z, 16, false, false))
                                {
                                    marketloc = new Point3D(ax, ay, Z);
                                }
                                else if (validLocation = map.CanFit(ax, ay, az, 16, false, false))
                                {
                                    marketloc = new Point3D(ax, ay, az);
                                }
                            }
                            market.MoveToWorld(marketloc, this.Map);
                            m_market.Add(market);
                        }
                    }
                    for (int i = marketplacemob; i < marketmobCount; ++i)
                    {
                        if (i == 0)
                        {
                            Point3D marketloc6 = this.Location;        //
                            Tinker  marketmob1 = new Tinker();

                            int gx = X;
                            int gy = Y + 3;
                            int gz = map.GetAverageZ(gx, gy);

                            if (validLocation = map.CanFit(gx, gy, this.Z, 16, false, false))
                            {
                                marketloc6 = new Point3D(gx, gy, Z);
                            }
                            else if (validLocation = map.CanFit(gx, gy, gz, 16, false, false))
                            {
                                marketloc6 = new Point3D(gx, gy, gz);
                            }

                            marketmob1.Home      = marketloc6;
                            marketmob1.RangeHome = 0;
                            marketmob1.MoveToWorld(marketloc6, this.Map);
                            m_marketmob.Add(marketmob1);
                        }
                    }
                    break;
                }

                    #endregion
                }
            }

            else
            {
                foreach (Item that in m_market)
                {
                    that.Delete();
                }

                foreach (Mobile thats in m_marketmob)
                {
                    thats.Delete();
                }
            }
        }