public static void Initialize() { RUOVersion.AddCommand("TownHouseErrors", AccessLevel.Counselor, OnErrors); RUOVersion.AddCommand("the", AccessLevel.Counselor, OnErrors); EventSink.Login += OnLogin; }
public static void Initialize() { RUOVersion.AddCommand("TownHouseErrors", AccessLevel.Counselor, new TownHouseCommandHandler(OnErrors)); RUOVersion.AddCommand("the", AccessLevel.Counselor, new TownHouseCommandHandler(OnErrors)); EventSink.Login += new LoginEventHandler(OnLogin); }
private static void OnStarted() { foreach (TownHouse house in TownHouse.AllTownHouses) { house.InitSectorDefinition(); RUOVersion.UpdateRegion(house.ForSaleSign); } }
private void EntireHouse() { if (c_Contract == null || c_Contract.ParentHouse == null) { return; } c_Contract.EntireHouse = !c_Contract.EntireHouse; c_Contract.ClearPreview(); if (c_Contract.EntireHouse) { var list = new List <Rectangle2D>(); bool once = false; foreach (Rectangle3D rect in RUOVersion.RegionArea(c_Contract.ParentHouse.Region)) { list.Add(new Rectangle2D(new Point2D(rect.Start.X, rect.Start.Y), new Point2D(rect.End.X, rect.End.Y))); if (once) { continue; } if (rect.Start.Z >= rect.End.Z) { c_Contract.MinZ = rect.End.Z; c_Contract.MaxZ = rect.Start.Z; } else { c_Contract.MinZ = rect.Start.Z; c_Contract.MaxZ = rect.End.Z; } once = true; } c_Contract.Blocks = list; } else { c_Contract.Blocks.Clear(); c_Contract.MinZ = short.MinValue; c_Contract.MaxZ = short.MinValue; } NewGump(); }
public void UpdateBlocks() { if (!Owned) { return; } if (c_Blocks.Count == 0) { UnconvertDoors(); } RUOVersion.UpdateRegion(this); ConvertItems(false); c_House.InitSectorDefinition(); }
private static void HandleSpeech(SpeechEventArgs e) { ArrayList houses = new ArrayList(BaseHouse.GetHouses(e.Mobile)); if (houses == null) { return; } foreach (BaseHouse house in houses) { if (!RUOVersion.RegionContains(house.Region, e.Mobile)) { continue; } if (house is TownHouse) { house.OnSpeech(e); } if (house.Owner == e.Mobile && e.Speech.ToLower() == "create rental contract" && CanRent(e.Mobile, house, true)) { e.Mobile.AddToBackpack(new RentalContract()); e.Mobile.SendMessage("A rental contract has been placed in your bag."); } if (house.Owner == e.Mobile && e.Speech.ToLower() == "check storage") { int count = 0; e.Mobile.SendMessage("You have {0} lockdowns and {1} secures available.", RemainingSecures(house), RemainingLocks(house)); if ((count = AllRentalLocks(house)) != 0) { e.Mobile.SendMessage("Current rentals are using {0} of your lockdowns.", count); } if ((count = AllRentalSecures(house)) != 0) { e.Mobile.SendMessage("Current rentals are using {0} of your secures.", count); } } } }
private static void OnStarted() { var i = TownHouse.AllTownHouses.Count; while (--i >= 0) { if (i >= TownHouse.AllTownHouses.Count) { continue; } var h = TownHouse.AllTownHouses[i]; h.InitSectorDefinition(); RUOVersion.UpdateRegion(h.ForSaleSign); } }
public void Purchase(Mobile m, bool sellitems) { try { if (Owned) { m.SendMessage("Someone already owns this house!"); return; } if (!PriceReady) { m.SendMessage("The setup for this house is not yet complete."); return; } int price = c_Price + (sellitems ? c_ItemsPrice : 0); if (c_Free) { price = 0; } if (m.AccessLevel == AccessLevel.Player && !Server.Mobiles.Banker.Withdraw(m, price)) { m.SendMessage("You cannot afford this house."); return; } if (m.AccessLevel == AccessLevel.Player) { m.SendLocalizedMessage(1060398, price.ToString()); // ~1_AMOUNT~ gold has been withdrawn from your bank box. } Visible = false; int minX = ((Rectangle2D)c_Blocks[0]).Start.X; int minY = ((Rectangle2D)c_Blocks[0]).Start.Y; int maxX = ((Rectangle2D)c_Blocks[0]).End.X; int maxY = ((Rectangle2D)c_Blocks[0]).End.Y; foreach (Rectangle2D rect in c_Blocks) { if (rect.Start.X < minX) { minX = rect.Start.X; } if (rect.Start.Y < minY) { minY = rect.Start.Y; } if (rect.End.X > maxX) { maxX = rect.End.X; } if (rect.End.Y > maxY) { maxY = rect.End.Y; } } c_House = new TownHouse(m, this, c_Locks, c_Secures); c_House.Components.Resize(maxX - minX, maxY - minY); c_House.Components.Add(0x520, c_House.Components.Width - 1, c_House.Components.Height - 1, -5); c_House.Location = new Point3D(minX, minY, Map.GetAverageZ(minX, minY)); c_House.Map = Map; c_House.Region.GoLocation = c_BanLoc; c_House.Sign.Location = c_SignLoc; c_House.Hanger = new Item(0xB98); c_House.Hanger.Location = c_SignLoc; c_House.Hanger.Map = Map; c_House.Hanger.Movable = false; c_House.Price = (RentByTime == TimeSpan.FromDays(0) ? c_Price : 1); RUOVersion.UpdateRegion(this); if (c_House.Price == 0) { c_House.Price = 1; } if (c_RentByTime != TimeSpan.Zero) { BeginRentTimer(c_RentByTime); } c_RTOPayments = 1; HideOtherSigns(); c_DecoreItemInfos = new ArrayList(); ConvertItems(sellitems); } catch (Exception e) { Errors.Report(String.Format("An error occurred during home purchasing. More information available on the console.")); Console.WriteLine(e.Message); Console.WriteLine(e.Source); Console.WriteLine(e.StackTrace); } }
public static void Initialize() { RUOVersion.AddCommand("TownHouses", AccessLevel.Counselor, OnHouses); }