public override void OnDestroyed() { //get the object that it is attached to Item building = AttachedTo as Item; //<---Building Point3D p = new Point3D(building.X, building.Y, building.Z); //<---location Region r = Region.Find(p, building.Map); //<---region PlayerCityRegion cityreg = r as PlayerCityRegion; //<---region if (r.IsPartOf(typeof(PlayerCityRegion))) //<---building is in city region { ArrayList deletelist = new ArrayList(); foreach (Item i in World.Items.Values) { if (i is CivicSign) { CivicSign z = (CivicSign)i; //<--- line 44 from error if (z.toDelete != null && z.toDelete.Contains(building)) //<---look for the Building/Addon in the arraylist { deletelist.Add(z); } } } foreach (Item d in deletelist) { d.Delete(); } //} ArrayList deletelist1 = new ArrayList(); foreach (Item t in World.Items.Values) { if (t is CityManagementStone) { CityManagementStone y = (CityManagementStone)t; if (y.toDelete != null && y.toDelete.Contains(building)) { deletelist1.Add(y); } } foreach (Item c in deletelist1) { c.Delete(); return; } } } // add code to find all of the items associated with the building and delete them // and to remove the building from the city system // the base method will destroy the target building itself base.OnDestroyed(); //EDITED THIS OUT AS THERE WONT BE ANY ID TO CHANGE ANYMORE }
public DestoryCityStructureGump(CivicSign sign, Mobile from) : base(50, 50) { m_Sign = sign; Closable = true; Disposable = true; Dragable = true; Resizable = false; AddPage(0); AddBackground(45, 34, 260, 91, 5120); AddLabel(64, 36, 1149, @"Are You Sure You Want To Demolish"); AddLabel(129, 53, 1149, @"This Building?"); AddButton(84, 88, 247, 248, 1, GumpButtonType.Reply, 0); AddButton(200, 88, 241, 242, 2, GumpButtonType.Reply, 0); }
public CityLandLord(CityManagementStone stone, Rectangle3D[] area, CivicSign sign, Point3D p, Map map) : base("Marketkeeper") { Frozen = true; Point3D loc = new Point3D(p.X - 4, p.Y, p.Z); Location = loc; Direction = Direction.South; Map = map; m_Stone = stone; m_Area = area; m_Sign = sign; m_vendorlist = new List <Mobile>(); UpdateMarketRegion(); CreateRandomVendors(loc, map); }
public override void Deserialize(GenericReader reader) { base.Deserialize(reader); int version = reader.ReadInt(); m_vendorlist = reader.ReadStrongMobileList(); m_Sign = (CivicSign)reader.ReadItem(); m_Stone = (CityManagementStone)reader.ReadItem(); m_Area = Server.Items.CityManagementStone.ReadRect3DArray(reader); Frozen = true; foreach (Mobile m in m_vendorlist) { m.Frozen = true; } UpdateMarketRegion(); }
public CityMarketRegion(CityManagementStone stone, CityLandLord lord, Map map, Rectangle3D[] area, CivicSign sign) : base(PickRegionName(), map, MarketPriority, area) { m_Stone = stone; m_LandLord = lord; m_Sign = sign; }