Inheritance: AddonComponent
Ejemplo n.º 1
0
        public static void Add(Mobile citizen, Item spots, int range)
        {
            bool hasCitizen = false;

            ArrayList items = new ArrayList();

            foreach (Item item in spots.GetItemsInRange(range))
            {
                if (item is WorkingSpots && item != spots)
                {
                    hasCitizen = true;
                    items.Add(item);
                }
            }
            for (int i = 0; i < items.Count; ++i)
            {
                if (hasCitizen)
                {
                    Item spot = ( Item )items[i];
                    if (spot.Name == "anvil" && (citizen is TradesmanSmelter || citizen is TradesmanSmith))
                    {
                        Item item = new AnvilHit(); item.MoveToWorld(spot.Location, spot.Map); item.Weight = -2.0;
                    }
                    else if (spot.Name == "dummy" && citizen is TrainingSingle)
                    {
                        Item item = new TrainingDummy(); item.MoveToWorld(spot.Location, spot.Map); item.Weight = -2.0;
                    }
                    else if (spot.Name == "forge" && (citizen is TradesmanSmelter || citizen is TradesmanSmith))
                    {
                        Item item = new ForgeHit(); item.MoveToWorld(spot.Location, spot.Map); item.Weight = -2.0;
                    }
                    else if (spot.Name == "hidden anvil" && (citizen is TradesmanSmelter || citizen is TradesmanSmith))
                    {
                        Item item = new AnvilHit(); item.MoveToWorld(spot.Location, spot.Map); item.Visible = false; item.Weight = -2.0;
                    }
                    else if (spot.Name == "hidden forge" && (citizen is TradesmanSmelter || citizen is TradesmanSmith))
                    {
                        Item item = new ForgeHit(); item.MoveToWorld(spot.Location, spot.Map); item.Visible = false; item.Weight = -2.0;
                    }
                    else if (spot.Name == "hidden hide" && citizen is TradesmanLeather)
                    {
                        Item item = new LeatherHit(); item.MoveToWorld(spot.Location, spot.Map); item.Visible = false; item.Weight = -2.0;
                    }
                    else if (spot.Name == "hide" && citizen is TradesmanLeather)
                    {
                        Item item = new LeatherHit(); item.MoveToWorld(spot.Location, spot.Map); item.Weight = -2.0;
                    }
                    else if (spot.Name == "pentagram" && citizen is TrainingMagery)
                    {
                        Item item = new MagicHit(); item.MoveToWorld(spot.Location, spot.Map); item.Visible = false; item.OnAfterSpawn(); item.Weight = -2.0;
                    }
                    else if (spot.Name == "potion" && citizen is TradesmanAlchemist)
                    {
                        Item item = new CauldronHit(); item.MoveToWorld(spot.Location, spot.Map); item.Weight = -2.0;
                    }
                    else if (spot.Name == "rock" && citizen is TradesmanMiner)
                    {
                        Item item = new RockHit(); item.MoveToWorld(spot.Location, spot.Map); item.Visible = false; item.Weight = -2.0;
                    }
                    else if (spot.Name == "saw" && citizen is TradesmanLumber)
                    {
                        Item item = new SawHit(); item.MoveToWorld(spot.Location, spot.Map); item.Visible = false; item.Weight = -2.0;
                    }
                    else if (spot.Name == "target" && citizen is TrainingBow)
                    {
                        Item item = new ArcheryButte(); item.MoveToWorld(spot.Location, spot.Map); item.Weight = -2.0;
                    }
                    else if (spot.Name == "tree" && citizen is TradesmanLogger)
                    {
                        Item item = new TreeHit(); item.MoveToWorld(spot.Location, spot.Map); item.Visible = false; item.Weight = -2.0;
                    }
                    else if (spot.Name == "water" && citizen is TrainingFishing)
                    {
                        Item item = new WaterHit(); item.MoveToWorld(spot.Location, spot.Map); item.Visible = false; item.Weight = -2.0;
                    }
                    else if (spot.Name == "knight" && citizen is Warriors)
                    {
                        Mobile knight = new Warriors(); knight.MoveToWorld(spot.Location, spot.Map); ((BaseCreature)knight).Home = spot.Location; ((BaseCreature)knight).RangeHome = 0; knight.OnAfterSpawn();
                    }
                }
            }
            //if ( !hasCitizen && spots.Name != "fighter" && spots.Name != "archer" ){ Console.WriteLine("" + spots.Name + " " + spots.X + ", " + spots.Y + ""); }
        }