public override void SetInitialState() { m_Current = new DesignState(this, GetEmptyFoundation()); // explicitly unused in StaticHousing m_Design = null; m_Backup = null; //init the other two design states just so they don't crash the base's serilization MultiComponentList y = new MultiComponentList(m_Current.Components); MultiComponentList x = new MultiComponentList(StaticHouseHelper.GetComponents(m_HouseBlueprintID)); //merge x into y. //first, remove all in y for (int i = y.List.Length - 1; i >= 0; i--) { y.Remove(y.List[i].m_ItemID, y.List[i].m_OffsetX, y.List[i].m_OffsetY, y.List[i].m_OffsetZ); } //then add all the ones we want to the list for (int i = 0; i < x.List.Length; ++i) { y.Add(x.List[i].m_ItemID, x.List[i].m_OffsetX, x.List[i].m_OffsetY, x.List[i].m_OffsetZ, true); } m_Current.Components = y; return; }
public StaticDeed(string houseID, string description) : base(0x14F0, StaticHouseHelper.GetFoundationID(houseID), new Point3D(0, 4, 0)) { Weight = 1.0; LootType = LootType.Newbied; m_HouseID = houseID; Name = "deed to a " + description; }
/* * public static void Initialize() * { * Server.Commands.Register("BuildFixerAddon", AccessLevel.Administrator, new CommandEventHandler(OnBuildFixerAddon)); * } * * [Usage("BuildFixerAddon")] * [Description("Add patchtiles to the static house.")] * private static void OnBuildFixerAddon(CommandEventArgs e) * { * e.Mobile.SendMessage("Build patch addon for which house?"); * e.Mobile.SendMessage("Please target the house sign."); * e.Mobile.Target = new BuildFixerAddonTarget(); * } * * public class BuildFixerAddonTarget : Target * { * * public BuildFixerAddonTarget() * : base(8, false, TargetFlags.None) * { * * } * * protected override void OnTarget(Mobile from, object target) * { * if (target is HouseSign && (target as HouseSign).Owner != null) * { * HouseSign sign = target as HouseSign; * * if (sign.Owner is StaticHouse == false) * { * from.SendMessage("This is not a StaticHouse."); * return; * } * * StaticHouse sh = sign.Owner as StaticHouse; * sh.BuildFixerAddon(); * from.SendMessage("Patch applied."); * } * else * { * from.SendMessage("That is not a house sign."); * } * } * }*/ public void BuildFixerAddon() { StaticHouseHelper.FixerAddon fa = StaticHouseHelper.BuildFixerAddon(m_HouseBlueprintID); ArrayList components = fa.Components; /* abandoned effort to remove doubled tiles before adding in the fixer addon. * Problem: We seem to get missing tiles like we do in original construction, which is the whole reason * for jumping through all of these hoops. * for (int ix=0; ix < fa.Components.Count; ix++) * { * AddonComponent mx = (AddonComponent)fa.Components[ix]; * this.Components.Remove(mx.ItemID, mx.Offset.X, mx.Offset.Y, mx.Offset.Z); * }*/ /* Abandoned: * This code simply proves that the "missing" tiles in a design are not only there in the MCL, but a acll to * Map.GetTilesAt() that location shows the (invisible) are actually there. We must therefore conclude there is * some (as yet) unsolavable Z Order issue when you have multiple tiles at the same x/y/z * This code is worth keeping as it is the basis for a tool to query missing tiles in a house. * Point2D center; * center = this.Components.Center; * int X0 = (this.X + this.Components.Min.X); * int Y0 = (this.Y + this.Components.Min.Y); * int xOffset = X0 + center.X; * int yOffset = Y0 + center.Y; * int count = 0; * * // just make sure things are what we expect * foreach (AddonComponent ms in components) * { * Point3D msp = ms.Offset; * Point2D px = new Point2D(xOffset + msp.X, yOffset + msp.Y); * ArrayList list = this.Map.GetTilesAt(px, false, false, true); * ArrayList foo = new ArrayList(this.Components.Tiles[center.X + msp.X][center.Y + msp.Y]); * if (foo.Count == list.Count) * { * for (int ix = 0; ix < foo.Count; ix++) * { * Tile tx1 = (Tile)foo[ix]; * Tile tx2 = (Tile)list[ix]; * if (tx1.Height != tx2.Height || * tx1.ID != tx2.ID || * tx1.Ignored != tx2.Ignored || * tx1.Z != tx2.Z) * continue; * } * } * else * continue; * }*/ fa.MoveToWorld(Location, this.Map); Addons.Add(fa); fa.OnPlaced(null, this); //m_Current.OnRevised(); // do we need this? }
public StaticHouse(Mobile owner, string houseID) : base(owner, StaticHouseHelper.GetFoundationID(houseID), 270, 2, 2) { m_HouseBlueprintID = houseID; // setup basic multi structure SetInitialState(); // apply FixerAddon BuildFixerAddon(); // now transfer over the data from the original blueprint house StaticHouseHelper.TransferData(this); }
public override void OnDoubleClick(Mobile from) { if (!IsChildOf(from.Backpack)) { from.SendLocalizedMessage(1042001); // That must be in your pack for you to use it. } else if (m_HouseID == null) { from.SendMessage("House ID is invalid! "); } else if (m_HouseID != string.Empty && StaticHouseHelper.IsBlueprintInFile(m_HouseID)) { from.Target = new HousePlacementTarget(this); } else { from.SendMessage("House ID is invalid! " + m_HouseID.ToString()); } }
public static ArrayList GetPatchTiles(string BlueprintID) { if (!StaticHouseHelper.IsBlueprintLoaded(BlueprintID)) { if (!StaticHouseHelper.LoadBlueprint(BlueprintID)) { return(null); } } //grab blueprint HouseBlueprint house = m_BlueprintList[BlueprintID] as HouseBlueprint; if (house == null) { return(null); } return(house.PatchTiles); }
public Unit(int xOffset, int yOffset, int zOffset, int id, StaticHouseHelper.TileType flags) { m_xOffset = xOffset; m_yOffset = yOffset; m_zOffset = zOffset; m_id = id; m_flags = flags; }