protected override void OnTarget(Mobile from, object targ) { AddOnEditor_Att addoneditor = (AddOnEditor_Att)XmlAttach.FindAttachment(from, typeof(AddOnEditor_Att)); BaseAddon addon = addoneditor.SelectedAddon; AddonComponent component = (AddonComponent)targ; if (targ is AddonComponent) { addon.Components.Remove(component); component.Addon = null; if (_delete == true) { component.Delete(); } } else { from.SendMessage("That is not an Addon."); from.Target = new Remove_Target(from, _delete); } }
protected override void OnTarget(Mobile from, object targ) { int converted = 0; int deleted = 0; if (targ is HouseSign) { HouseSign sign = (HouseSign)targ; if (sign.Owner != null) { if (sign.Owner is BaseHouse) { // don't let staff convert original custom houses to static .. force them to make a copy first if (sign.Owner is HouseFoundation == true && sign.Owner is StaticHouse == false) { from.SendMessage(0x22, "Please make a COPY of this house before converting it to static."); from.SendMessage(0x22, "[housegen"); } else { //ok, we got what we want :) BaseHouse house = sign.Owner as BaseHouse; //get a copy of the location Point3D location = new Point3D(house.Location.X, house.Location.Y, house.Location.Z); // make a copy of the doors - see comments below // ArrayList Doors = new ArrayList(house.Doors); //Now we need to iterate through the components and place their static equivalent while skipping doors and other fixtures for (int i = 0; i < house.Components.List.Length; i++) { string sz = location.X + house.Components.List[i].GetType().ToString(); if (!IsFixture(house.Components.List[i].m_ItemID)) { Point3D itemloc = new Point3D( location.X + house.Components.List[i].m_OffsetX, location.Y + house.Components.List[i].m_OffsetY, location.Z + house.Components.List[i].m_OffsetZ ); Static item = new Static((int)(house.Components.List[i].m_ItemID & 0x3FFF)); item.MoveToWorld(itemloc, from.Map); converted++; } else { deleted++; } } // not adding the doors back because we want players to have to purchase them /*foreach (BaseDoor bd in Doors) * { * if (bd == null) * continue; * * BaseDoor replacement = GetFixtureItem(bd.ItemID) as BaseDoor; * if (replacement != null && replacement.Deleted == false) * { * Point3D itemloc = new Point3D( * location.X + bd.Offset.X, * location.Y + bd.Offset.Y, * location.Z + bd.Offset.Z * ); * * replacement.MoveToWorld(itemloc, from.Map); * } * }*/ //delete the house house.Delete(); } } } else { from.SendMessage(0x22, "That house sign does not point to a house"); } } else if (targ is AddonComponent) { //ok, we got what we want :) AddonComponent addon = targ as AddonComponent; // use the players location as the addon's location is whacky Point3D location = new Point3D(from.Location.X, from.Location.Y, from.Location.Z); from.SendMessage("Using your location for the static location."); //Now we need to iterate through the components and place their static equivalent while skipping doors and other fixtures foreach (Item item in addon.Addon.Components) { if (item == null || item is AddonComponent == false) { continue; } AddonComponent ac = item as AddonComponent; if (!IsFixture((short)ac.ItemID)) { Point3D itemloc = new Point3D( location.X + ac.Offset.X, location.Y + ac.Offset.Y, location.Z + ac.Offset.Z ); Static sitem = new Static((int)(ac.ItemID & 0x3FFF)); sitem.MoveToWorld(itemloc, from.Map); converted++; } else { deleted++; } } //delete the addon addon.Delete(); } else { from.SendMessage(0x22, "That is neither a house sign nor an addon"); } from.SendMessage("Conversion complete with {0} tiles converted and {1} deleted.", converted, deleted); }