public VendorRentalContract() : base(0x14F0)
        {
            Weight = 1.0;
            Hue    = 0x672;

            m_Duration = VendorRentalDuration.Instances[0];
            m_Price    = 1500;
        }
예제 #2
0
        public VendorRentalContract() : base(0x14F0)
        {
            Weight = 1.0;
            Hue    = 0x672;

            m_Duration      = VendorRentalDuration.Instances[0];
            m_Price         = 0;
            m_LandlordRenew = true;
        }
예제 #3
0
    private void AfterDeserialization()
    {
        var index = Math.Clamp(_rentalDurationId, 0, VendorRentalDuration.Instances.Length - 1);

        RentalDuration = VendorRentalDuration.Instances[index];

        var delay = _rentalExpireTime - Core.Now;

        _rentalExpireTimer = new RentalExpireTimer(this, delay > TimeSpan.Zero ? delay : TimeSpan.Zero).Start();
    }
예제 #4
0
    public RentedVendor(
        Mobile owner, BaseHouse house, VendorRentalDuration duration, int rentalPrice,
        bool landlordRenew, int rentalGold
        ) : base(owner, house)
    {
        RentalDuration = duration;
        RentalPrice    = RenewalPrice = rentalPrice;
        LandlordRenew  = landlordRenew;
        RenterRenew    = false;

        RentalGold = rentalGold;

        RentalExpireTime   = Core.Now + duration.Duration;
        _rentalExpireTimer = new RentalExpireTimer(this, duration.Duration);
        _rentalExpireTimer.Start();
    }
        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);

            int version = reader.ReadEncodedInt();

            int durationID = reader.ReadEncodedInt();

            if (durationID < VendorRentalDuration.Instances.Length)
            {
                m_Duration = VendorRentalDuration.Instances[durationID];
            }
            else
            {
                m_Duration = VendorRentalDuration.Instances[0];
            }

            m_Price         = reader.ReadInt();
            m_LandlordRenew = reader.ReadBool();
        }
예제 #6
0
        protected override void SetContractDuration(Mobile from, VendorRentalDuration duration)
        {
            m_Contract.Duration = duration;

            from.SendGump(new VendorRentalContractGump(m_Contract, from));
        }
예제 #7
0
 protected virtual void SetContractDuration(Mobile from, VendorRentalDuration duration)
 {
 }
예제 #8
0
        protected BaseVendorRentalGump(GumpType type, VendorRentalDuration duration, int price, int renewalPrice,
                                       IEntity landlord, IEntity renter, bool landlordRenew, bool renterRenew, bool renew)
            : base(100, 100)
        {
            if (type == GumpType.Offer)
            {
                Closable = false;
            }

            AddPage(0);

            AddImage(0, 0, 0x1F40);
            AddImageTiled(20, 37, 300, 308, 0x1F42);
            AddImage(20, 325, 0x1F43);

            AddImage(35, 8, 0x39);
            AddImageTiled(65, 8, 257, 10, 0x3A);
            AddImage(290, 8, 0x3B);

            AddImageTiled(70, 55, 230, 2, 0x23C5);

            AddImage(32, 33, 0x2635);
            AddHtmlLocalized(70, 35, 270, 20, 1062353, 0x1, false, false); // Vendor Rental Contract

            AddPage(1);

            if (type != GumpType.UnlockedContract)
            {
                AddImage(65, 60, 0x827);
                AddHtmlLocalized(79, 58, 270, 20, 1062370, 0x1, false, false); // Landlord:
                AddLabel(150, 58, 0x64, landlord != null ? landlord.Name : "");

                AddImageTiled(70, 80, 230, 2, 0x23C5);
            }

            if (type == GumpType.UnlockedContract || type == GumpType.LockedContract)
            {
                AddButton(30, 96, 0x15E1, 0x15E5, 0, GumpButtonType.Page, 2);
            }
            AddHtmlLocalized(50, 95, 150, 20, 1062354, 0x1, false, false); // Contract Length
            AddHtmlLocalized(230, 95, 270, 20, duration.Name, 0x1, false, false);

            if (type == GumpType.UnlockedContract || type == GumpType.LockedContract)
            {
                AddButton(30, 116, 0x15E1, 0x15E5, 1, GumpButtonType.Reply, 0);
            }
            AddHtmlLocalized(50, 115, 150, 20, 1062356, 0x1, false, false); // Price Per Rental
            AddLabel(230, 115, 0x64, price > 0 ? price.ToString() : "FREE");

            AddImageTiled(50, 160, 250, 2, 0x23BF);

            if (type == GumpType.Offer)
            {
                AddButton(67, 180, 0x482, 0x483, 2, GumpButtonType.Reply, 0);
                AddHtmlLocalized(100, 180, 270, 20, 1049011, 0x28, false, false); // I accept!

                AddButton(67, 210, 0x47F, 0x480, 0, GumpButtonType.Reply, 0);
                AddHtmlLocalized(100, 210, 270, 20, 1049012, 0x28, false, false); // No thanks, I decline.
            }
            else
            {
                AddImage(49, 170, 0x61);
                AddHtmlLocalized(60, 170, 250, 20, 1062355, 0x1, false, false); // Renew On Expiration?

                if (type == GumpType.LockedContract || type == GumpType.UnlockedContract || type == GumpType.VendorLandlord)
                {
                    AddButton(30, 192, 0x15E1, 0x15E5, 3, GumpButtonType.Reply, 0);
                }
                AddHtmlLocalized(85, 190, 250, 20, 1062359, 0x1, false, false);                            // Landlord:
                AddHtmlLocalized(230, 190, 270, 20, landlordRenew ? 1049717 : 1049718, 0x1, false, false); // YES / NO

                if (type == GumpType.VendorRenter)
                {
                    AddButton(30, 212, 0x15E1, 0x15E5, 4, GumpButtonType.Reply, 0);
                }
                AddHtmlLocalized(85, 210, 250, 20, 1062360, 0x1, false, false);                          // Renter:
                AddHtmlLocalized(230, 210, 270, 20, renterRenew ? 1049717 : 1049718, 0x1, false, false); // YES / NO

                if (renew)
                {
                    AddImage(49, 233, 0x939);
                    AddHtmlLocalized(70, 230, 250, 20, 1062482, 0x1, false, false); // Contract WILL renew
                }
                else
                {
                    AddImage(49, 233, 0x938);
                    AddHtmlLocalized(70, 230, 250, 20, 1062483, 0x1, false, false); // Contract WILL NOT renew
                }
            }

            AddImageTiled(30, 283, 257, 30, 0x5D);
            AddImage(285, 283, 0x5E);
            AddImage(20, 288, 0x232C);

            if (type == GumpType.LockedContract)
            {
                AddButton(67, 295, 0x15E1, 0x15E5, 5, GumpButtonType.Reply, 0);
                AddHtmlLocalized(85, 294, 270, 20, 1062358, 0x28, false, false); // Offer Contract To Someone
            }
            else if (type == GumpType.VendorLandlord || type == GumpType.VendorRenter)
            {
                if (type == GumpType.VendorLandlord)
                {
                    AddButton(30, 250, 0x15E1, 0x15E1, 6, GumpButtonType.Reply, 0);
                }
                AddHtmlLocalized(85, 250, 250, 20, 1062499, 0x1, false, false); // Renewal Price
                AddLabel(230, 250, 0x64, renewalPrice.ToString());

                AddHtmlLocalized(60, 294, 270, 20, 1062369, 0x1, false, false); // Renter:
                AddLabel(120, 293, 0x64, renter != null ? renter.Name : "");
            }

            if (type == GumpType.UnlockedContract || type == GumpType.LockedContract)
            {
                AddPage(2);

                for (int i = 0; i < VendorRentalDuration.Instances.Length; i++)
                {
                    VendorRentalDuration durationItem = VendorRentalDuration.Instances[i];

                    AddButton(30, 76 + i * 20, 0x15E1, 0x15E5, 0x10 | i, GumpButtonType.Reply, 1);
                    AddHtmlLocalized(50, 75 + i * 20, 150, 20, durationItem.Name, 0x1, false, false);
                }
            }
        }