Exemple #1
0
        internal void ClaimVault(Mobile m)
        {
            if (Account == null || m.Account == null || m.Account.Username != Account)
            {
                return;
            }

            var cont  = Container;
            var items = new List <Item>(Items.Where(i => i != cont && !i.IsChildOf(cont)));

            foreach (var item in items)
            {
                cont.DropItem(item);
            }

            ColUtility.Free(items);
            _Container = null;

            cont.Index = Index;

            if (m.Backpack == null || !m.Backpack.TryDropItem(m, cont, false))
            {
                m.BankBox.DropItem(cont);
            }

            ClearVault();
        }
Exemple #2
0
        public VaultAuctionClaimTimer(Mobile winner, AccountVaultContainer container, DateTime deadline)
            : base(TimeSpan.FromMinutes(1), TimeSpan.FromMinutes(1))
        {
            Winner    = winner;
            Container = container;
            Deadline  = deadline;

            TryUnload();
        }
Exemple #3
0
        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);
            int version = reader.ReadInt(); // version

            switch (version)
            {
            case 1:
                _Container = reader.ReadItem <AccountVaultContainer>();
                PastDue    = reader.ReadBool();
                Index      = reader.ReadInt();
                goto case 0;

            case 0:
                Account  = reader.ReadString();
                Balance  = reader.ReadInt();
                NextRent = reader.ReadDateTime();
                break;
            }

            if (version == 0)
            {
                Timer.DelayCall(() =>
                {
                    if (Account != null)
                    {
                        var cont = Container;
                        var list = new List <Item>(Items);

                        for (int i = 0; i < list.Count; i++)
                        {
                            cont.DropItem(list[i]);
                        }

                        DropItem(cont);
                    }

                    AssignIndex();
                });
            }

            AssignIndex();
        }
Exemple #4
0
        internal void ClearVault()
        {
            if (_Container != null)
            {
                var auctionVault = AuctionVault.GetFirstAvailable();

                if (auctionVault != null)
                {
                    var auction = auctionVault.Auction;

                    auction.AuctionItem = _Container;

                    _Container.AuctionItem = true;
                    _Container.Movable     = false;
                    _Container.MoveToWorld(new Point3D(auctionVault.X, auctionVault.Y, auctionVault.Z + 7), auctionVault.Map);

                    auction.Description = "Contents of an unpaid vault.";
                    auction.Duration    = SystemSettings.AuctionDuration;
                    auction.StartBid    = 1000;
                    auction.OnBegin();

                    var m = GetAccountMobile();

                    if (m != null)
                    {
                        var region = Region.Find(GetWorldLocation(), Map).Name;

                        if (!string.IsNullOrEmpty(region))
                        {
                            MaginciaLottoSystem.SendMessageTo(
                                m,
                                new NewMaginciaMessage(
                                    1158081, // Rent Past Due
                                    1158053, // Your vault contents have been put up for auction and no longer can be claimed. This vault was located in ~1_CITY~.
                                    SystemSettings.PastDuePeriod,
                                    region,
                                    true));
                        }
                        else
                        {
                            MaginciaLottoSystem.SendMessageTo(
                                m,
                                new NewMaginciaMessage(
                                    1158081, // Rent Past Due
                                    string.Format("Your vault contents have been put up for auction and no longer can be claimed. This vault is located at {0} [{1}].", GetWorldLocation().ToString(), Map.ToString()),
                                    SystemSettings.PastDuePeriod,
                                    true));
                        }
                    }

                    _Container = null;
                }
                else
                {
                    // None available, so we'll delay a day
                    NextRent = DateTime.UtcNow + TimeSpan.FromDays(1);
                }
            }

            Account  = null;
            NextRent = DateTime.MinValue;

            ColUtility.SafeDelete(Items);

            InvalidateProperties();
            Hue     = 0;
            Balance = 0;
            PastDue = false;
        }