public static void TransferData(StaticHouse sh) { // now transfer over the data from the original blueprint house try { Misc.Diagnostics.Assert(sh != null, "sh == null"); if (!IsBlueprintLoaded(sh.HouseBlueprintID)) { if (!LoadBlueprint(sh.HouseBlueprintID)) { try { throw new ApplicationException(); } catch (Exception ex) { LogHelper.LogException(ex, "Can't find/load blueprint from hashtable/xml."); } return; } } Misc.Diagnostics.Assert(m_BlueprintList[sh.HouseBlueprintID] is HouseBlueprint, "m_BlueprintList[sh.HouseBlueprintID] is HouseBlueprint == false"); HouseBlueprint house = m_BlueprintList[sh.HouseBlueprintID] as HouseBlueprint; if (house == null) { try { throw new ApplicationException(); } catch (Exception ex) { LogHelper.LogException(ex, "Can't find/load blueprint from hashtable."); } return; } // copy the data sh.DefaultPrice = house.Price; sh.BlueprintVersion = house.Version; sh.Description = house.Description; sh.OriginalOwnerName = house.OriginalOwnerName; sh.OriginalOwnerAccount = house.OriginalOwnerAccount; sh.OriginalOwnerSerial = house.OriginalOwnerSerial; sh.SignHanger.ItemID = house.SignHangerGraphic; sh.Signpost.ItemID = house.SignpostGraphic; sh.SignpostGraphic = house.SignpostGraphic; sh.RevisionDate = house.Capture; Misc.Diagnostics.Assert(house.Region != null, "house.Region == null"); if (house.Region != null && house.Region.Count > 0) { Misc.Diagnostics.Assert(sh.Components != null, "sh.Components == null"); foreach (Rectangle2D rect in house.Region) { // fixup offsets MultiComponentList mcl = sh.Components; int x = rect.X + sh.X + mcl.Min.X; int y = rect.Y + sh.Y + mcl.Min.Y; sh.AreaList.Add(new Rectangle2D(x, y, rect.Width, rect.Height)); } sh.UpdateRegionArea(); } } catch (Exception e) { Server.Commands.LogHelper.LogException(e, "Botched Static Housing xml."); } }
private static void AddRegionCallback(Mobile from, Map map, Point3D start, Point3D end, object state) { if (state is StaticHouse == false) { return; } StaticHouse sh = state as StaticHouse; // normalize bounding rect if (start.X > end.X) { int ix = start.X; start.X = end.X; end.X = ix; } if (start.Y > end.Y) { int iy = start.Y; start.Y = end.Y; end.Y = iy; } int x = 0; int y = 0; /*MultiComponentList mcl = sh.Components; * int x = sh.X + mcl.Min.X; * int y = sh.Y + mcl.Min.Y;*/ x = start.X - sh.X; y = start.Y - sh.Y; Rectangle2D temp = new Rectangle2D(start, end); Rectangle2D rectangle = new Rectangle2D(x, y, temp.Width, temp.Height); sh.AreaList.Add(rectangle); sh.UpdateRegionArea(); }
protected override void OnTarget(Mobile from, object target) { if (target is HouseSign && (target as HouseSign).Structure != null) { HouseSign sign = target as HouseSign; if (sign.Structure is StaticHouse == false) { from.SendMessage("You may only wipe regions on a StaticHouse."); return; } StaticHouse sh = sign.Structure as StaticHouse; sh.AreaList.Clear(); sh.UpdateRegionArea(); from.SendMessage("All regions for thie StaticHouse have been wiped."); } else { from.SendMessage("That is not a house sign."); } }
public static void TransferData(StaticHouse sh) { // now transfer over the data from the original blueprint house try { Misc.Diagnostics.Assert(sh != null, "sh == null"); if (!IsBlueprintLoaded(sh.HouseBlueprintID)) if (!LoadBlueprint(sh.HouseBlueprintID)) { try { throw new ApplicationException(); } catch (Exception ex) { LogHelper.LogException(ex, "Can't find/load blueprint from hashtable/xml."); } return; } Misc.Diagnostics.Assert(m_BlueprintList[sh.HouseBlueprintID] is HouseBlueprint, "m_BlueprintList[sh.HouseBlueprintID] is HouseBlueprint == false"); HouseBlueprint house = m_BlueprintList[sh.HouseBlueprintID] as HouseBlueprint; if (house == null) { try { throw new ApplicationException(); } catch (Exception ex) { LogHelper.LogException(ex, "Can't find/load blueprint from hashtable."); } return; } // copy the data sh.DefaultPrice = house.Price; sh.BlueprintVersion = house.Version; sh.Description = house.Description; sh.OriginalOwnerName = house.OriginalOwnerName; sh.OriginalOwnerAccount = house.OriginalOwnerAccount; sh.OriginalOwnerSerial = house.OriginalOwnerSerial; sh.SignHanger.ItemID = house.SignHangerGraphic; sh.Signpost.ItemID = house.SignpostGraphic; sh.SignpostGraphic = house.SignpostGraphic; sh.RevisionDate = house.Capture; Misc.Diagnostics.Assert(house.Region != null, "house.Region == null"); if (house.Region != null && house.Region.Count > 0) { Misc.Diagnostics.Assert(sh.Components != null, "sh.Components == null"); foreach (Rectangle2D rect in house.Region) { // fixup offsets MultiComponentList mcl = sh.Components; int x = rect.X + sh.X + mcl.Min.X; int y = rect.Y + sh.Y + mcl.Min.Y; sh.AreaList.Add(new Rectangle2D (x, y, rect.Width, rect.Height)); } sh.UpdateRegionArea(); } } catch (Exception e) { Scripts.Commands.LogHelper.LogException(e, "Botched Static Housing xml."); } }