コード例 #1
0
ファイル: Errors.cs プロジェクト: alucardxlx/Casiopia
        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);
        }
コード例 #2
0
ファイル: General.cs プロジェクト: alucardxlx/Casiopia
 private static void OnStarted()
 {
     foreach (TownHouse house in TownHouse.AllTownHouses)
     {
         house.InitSectorDefinition();
         RUOVersion.UpdateRegion(house.ForSaleSign);
     }
 }
コード例 #3
0
        private void EntireHouse()
        {
            if (m_Contract == null || m_Contract.ParentHouse == null)
            {
                return;
            }

            m_Contract.EntireHouse = !m_Contract.EntireHouse;

            m_Contract.ClearPreview();

            if (m_Contract.EntireHouse)
            {
                List <Rectangle2D> list = new List <Rectangle2D>();

                bool once = false;
                foreach (Rectangle3D rect in RUOVersion.RegionArea(m_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)
                    {
                        m_Contract.MinZ = rect.End.Z;
                        m_Contract.MaxZ = rect.Start.Z;
                    }
                    else
                    {
                        m_Contract.MinZ = rect.Start.Z;
                        m_Contract.MaxZ = rect.End.Z;
                    }

                    once = true;
                }

                m_Contract.Blocks = list;
            }
            else
            {
                m_Contract.Blocks.Clear();
                m_Contract.MinZ = short.MinValue;
                m_Contract.MaxZ = short.MinValue;
            }

            NewGump();
        }
コード例 #4
0
        public void UpdateBlocks()
        {
            if (!Owned)
            {
                return;
            }

            if (m_Blocks.Count == 0)
            {
                UnconvertDoors();
            }

            RUOVersion.UpdateRegion(this);
            ConvertItems(false);
            m_House.InitSectorDefinition();
        }
コード例 #5
0
ファイル: General.cs プロジェクト: alucardxlx/Casiopia
        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);
                    }
                }
            }
        }
コード例 #6
0
        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 = m_Price + (sellitems ? m_ItemsPrice : 0);

                if (m_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;
                Rectangle2D startrec = m_Blocks[0];

                int minX = startrec.Start.X;
                int minY = startrec.Start.Y;
                int maxX = startrec.End.X;
                int maxY = startrec.End.Y;

                foreach (Rectangle2D rect in m_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;
                    }
                }

                m_House = new TownHouse(m, this, m_Locks, m_Secures);

                m_House.Components.Resize(maxX - minX, maxY - minY);
                m_House.Components.Add(0x520, m_House.Components.Width - 1, m_House.Components.Height - 1, -5);

                m_House.MoveToWorld(new Point3D(minX, minY, Map.GetAverageZ(minX, minY)), Map);

                m_House.Region.GoLocation = m_BanLoc;
                m_House.Sign.Location     = m_SignLoc;
                m_House.Hanger            = new Static(0xB98);
                m_House.Hanger.MoveToWorld(m_SignLoc, Map);

                if (m_ForcePublic)
                {
                    m_House.Public = true;
                }

                m_House.Price = (RentByTime == TimeSpan.FromDays(0) ? m_Price : 1);

                RUOVersion.UpdateRegion(this);

                if (m_House.Price == 0)
                {
                    m_House.Price = 1;
                }

                if (m_RentByTime != TimeSpan.Zero)
                {
                    BeginRentTimer(m_RentByTime);
                }

                m_RTOPayments = 1;

                HideOtherSigns();

                m_DecoreItemInfos = new List <DecoreItemInfo>();

                ConvertItems(sellitems);

                uint keyval = m_House.CreateKeys(m);
                foreach (GenericHouseDoor door in m_House.Doors)
                {
                    door.KeyValue = keyval;
                }
            }
            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);
            }
        }
コード例 #7
0
 public static void Initialize()
 {
     RUOVersion.AddCommand("TownHouses", AccessLevel.Counselor, new TownHouseCommandHandler(OnHouses));
 }