Esempio n. 1
0
        public PlayerVendor(Mobile owner, BaseHouse house)
        {
            Owner = owner;
            House = house;

            m_BankAccount = 1000;
            m_HoldGold    = 0;

            m_SellItems = new Hashtable();

            CantWalk = true;

            NameHue = 0x35;

            InitStats(100, 100, 25);
            InitBody();
            InitOutfit();

            TimeSpan delay = PayTimer.GetInterval();

            m_PayTimer = new PayTimer(this, delay);
            m_PayTimer.Start();

            m_NextPayTime = DateTime.Now + delay;
        }
Esempio n. 2
0
        public PlayerVendor(Mobile owner, IHouse house)
        {
            Owner = owner;
            House = house;

            m_BankAccount = 0;
            m_HoldGold    = 4;

            ShopName = "Shop Not Yet Named";

            m_SellItems = new Hashtable();

            CantWalk = true;

            InitStats(75, 75, 75);
            InitBody();
            InitOutfit();

            TimeSpan delay = PayTimer.GetInterval();

            m_PayTimer = new PayTimer(this, delay);
            m_PayTimer.Start();

            m_NextPayTime = DateTime.Now + delay;
        }
Esempio n. 3
0
        public override bool OnDragDrop(Mobile from, Item item)
        {
            if (Pay != 0)
            {
                // Is the creature already hired
                if (!Controlled)
                {
                    // Is the item the payment in gold
                    if (item is Gold)
                    {
                        // Is the payment in gold sufficient
                        if (item.Amount >= Pay)
                        {
                            if (from.Followers + ControlSlots > from.FollowersMax)
                            {
                                SayTo(from, 500896, 0x3B2); // I see you already have an escort.
                                return(false);
                            }

                            // Try to add the hireling as a follower
                            if (AddHire(from))
                            {
                                SayTo(from, 1043258, string.Format("{0}", item.Amount / Pay), 0x3B2);//"I thank thee for paying me. I will work for thee for ~1_NUMBER~ days.", (int)item.Amount / Pay );
                                HoldGold += item.Amount;

                                NextPay = DateTime.UtcNow + PayTimer.GetInterval();

                                PayTimer.RegisterTimer(this);
                                return(true);
                            }
                            else
                            {
                                return(false);
                            }
                        }
                        else
                        {
                            SayHireCost();
                        }
                    }
                    else
                    {
                        SayTo(from, 1043268, 0x3B2);// Tis crass of me, but I want gold
                    }
                }
                else
                {
                    SayTo(from, 1042495, 0x3B2);// I have already been hired.
                }
            }
            else
            {
                SayTo(from, 500200, 0x3B2);// I have no need for that.
            }

            return(base.OnDragDrop(from, item));
        }
Esempio n. 4
0
            public static void RegisterTimer(BaseHire hire)
            {
                if (Instance == null)
                {
                    Instance = new PayTimer();
                }

                if (!Instance.Running)
                {
                    Instance.Start();
                }

                if (!Instance.Hires.Contains(hire))
                {
                    Instance.Hires.Add(hire);
                }
            }
Esempio n. 5
0
            public static void RegisterTimer(BaseHire hire)
            {
                if (Instance == null)
                {
                    Instance = new PayTimer();
                }

                if (!Instance.Running)
                {
                    Instance.Start();
                }

                if (!Instance.Hires.Contains(hire))
                {
                    Console.WriteLine("ADding hire: {0}", hire);
                    Instance.Hires.Add(hire);
                }
            }
Esempio n. 6
0
        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);

            int version = reader.ReadInt();

            switch (version)
            {
            case 1:
                NextPay = reader.ReadDateTime();
                goto case 0;

            case 0:
                IsHired  = reader.ReadBool();
                HoldGold = reader.ReadInt();
                break;
            }

            if (IsHired)
            {
                PayTimer.RegisterTimer(this);
            }
        }
Esempio n. 7
0
        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);

            int version = reader.ReadInt();

            switch (version)
            {
            case 2:
            case 1:
            {
                m_NextPayTime = reader.ReadDeltaTime();
                House         = (BaseHouse)reader.ReadItem();

                goto case 0;
            }

            case 0:
            {
                m_Owner       = reader.ReadMobile();
                m_BankAccount = reader.ReadInt();
                m_HoldGold    = reader.ReadInt();

                m_SellItems = new Hashtable();

                int count = reader.ReadInt();
                for (int i = 0; i < count; i++)
                {
                    Item item = reader.ReadItem();

                    int price = reader.ReadInt();
                    if (price > 100000000)
                    {
                        price = 100000000;
                    }

                    string description = reader.ReadString();

                    DateTime created = version < 1 ? DateTime.Now : reader.ReadDateTime();

                    if (item != null)
                    {
                        SetVendorItem(item, version < 1 && price <= 0 ? -1 : price, description, created);
                    }
                }

                break;
            }
            }

            Timer.DelayCall(TimeSpan.Zero, new TimerCallback(FixDresswear));

            m_NextPayTime = DateTime.Now + PayTimer.GetInterval();

            if (version < 2 && RawStr == 75 && RawDex == 75 && RawInt == 75)
            {
                InitStats(100, 100, 25);
            }

            TimeSpan delay = m_NextPayTime - DateTime.Now;

            m_PayTimer = new PayTimer(this, delay > TimeSpan.Zero ? delay : TimeSpan.Zero);
            m_PayTimer.Start();

            Blessed = false;
        }
Esempio n. 8
0
        public override void Delete()
        {
            base.Delete();

            PayTimer.RemoveTimer(this);
        }