예제 #1
0
        private void DoWarning()
        {
            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
                            1158041, //Rent is past due for your Vault and your items will be lost after 168 hours unless you claim your Vault from the Vault Manager. This vault is located in ~1_CITY~.
                            SystemSettings.PastDuePeriod,
                            region,
                            true));
                }
                else
                {
                    MaginciaLottoSystem.SendMessageTo(
                        m,
                        new NewMaginciaMessage(
                            1158081, // Rent Past Due
                            string.Format("Rent is past due for your Vault and your items will be lost after 168 hours unless you claim your Vault from the Vault Manager. This vault is located at {0} [{1}].", GetWorldLocation().ToString(), Map.ToString()),
                            SystemSettings.PastDuePeriod,
                            true));
                }
            }
        }
예제 #2
0
        public override void OnDoubleClick(Mobile from)
        {
            MaginciaLottoSystem system = MaginciaLottoSystem.Instance;

            if (system == null || !system.Enabled || m_Plot == null)
            {
                return;
            }

            if (from.InRange(Location, 4))
            {
                if (m_Plot.LottoOngoing)
                {
                    from.CloseGump(typeof(MaginciaLottoGump));
                    from.SendGump(new MaginciaLottoGump(from, m_Plot));
                }
                else if (!m_Plot.IsAvailable)
                {
                    from.SendMessage("The lottory for this lot has ended.");
                }
                else
                {
                    from.SendMessage("The lottory for this lot has expired.  Check back soon!");
                }
            }
        }
예제 #3
0
        public void EndAuction()
        {
            if (HighestBid != null && HighestBid.Mobile != null)
            {
                var    isPublic = PublicAuction;
                var    m        = HighestBid.Mobile;
                string name     = AuctionItemName();

                if (string.IsNullOrEmpty(name))
                {
                    name = "the item you bid on";
                }

                NewMaginciaMessage message = new NewMaginciaMessage(null, isPublic ? 1158078 : 1156426, TimeSpan.FromHours(72), String.Format("{0}\t{1}\t{2}",
                                                                                                                                              name,
                                                                                                                                              CurrentPlatBid.ToString("N0", CultureInfo.GetCultureInfo("en-US")),
                                                                                                                                              CurrentGoldBid.ToString("N0", CultureInfo.GetCultureInfo("en-US"))));

                /*  You have won an auction for ~1_ITEMNAME~! Your bid amount of ~2_BIDAMT~plat and ~3_BIDAMT~gp won the auction.
                 *  You have 3 days from the end of the auction to claim your item or it will be lost.*/

                MaginciaLottoSystem.SendMessageTo(HighestBid.Mobile, message);

                Account a   = m.Account as Account;
                Account b   = isPublic ? null : Owner.Account as Account;
                long    dif = HighestBid.CurrentBid - CurrentBid;

                if (a != null && dif > 0)
                {
                    a.DepositGold(dif);
                }

                if (b != null)
                {
                    b.DepositGold(HighestBid.CurrentBid);
                }

                if (!isPublic)
                {
                    message = new NewMaginciaMessage(null, new TextDefinition(1156428), TimeSpan.FromHours(24), String.Format("{0}\t{1}\t{2}",
                                                                                                                              name,
                                                                                                                              CurrentPlatBid.ToString("N0", CultureInfo.GetCultureInfo("en-US")),
                                                                                                                              CurrentGoldBid.ToString("N0", CultureInfo.GetCultureInfo("en-US"))));

                    /*Your auction for ~1_ITEMNAME~ has ended with a winning bid of ~2_BIDAMT~plat and ~3_BIDAMT~gp. The winning bid has
                     * been deposited into your currency account.*/
                    MaginciaLottoSystem.SendMessageTo(Owner, message);
                }

                ClaimPeriod = DateTime.UtcNow + TimeSpan.FromDays(3);
            }
            else
            {
                TrayAuction();
            }

            CloseGumps();
        }
예제 #4
0
        public override void OnAfterDelete()
        {
            if (m_Plot != null)
            {
                MaginciaLottoSystem.UnregisterPlot(m_Plot);
            }

            base.OnAfterDelete();
        }
예제 #5
0
        public void HouseCollapse()
        {
            Item item = AuctionItem;

            if (Bids != null)
            {
                Bids.ForEach(bid =>
                {
                    string name = "Unknown Item";

                    if (item.Name != null)
                    {
                        name = item.Name;
                    }
                    else
                    {
                        name = String.Format("#{0}", item.LabelNumber.ToString());
                    }

                    var mes = new NewMaginciaMessage(null, new TextDefinition(1156454), String.Format("{0}\t{1}\t{2}",
                                                                                                      CurrentPlatBid.ToString("N0", CultureInfo.GetCultureInfo("en-US")),
                                                                                                      CurrentGoldBid.ToString("N0", CultureInfo.GetCultureInfo("en-US")),
                                                                                                      name));
                    /*Your winning bid amount of ~1_BIDAMT~plat and ~2_BIDAMT~gp for ~3_ITEMNAME~ has been refunded to you due to house collapse.*/
                    MaginciaLottoSystem.SendMessageTo(bid.Mobile, mes);

                    Account a = bid.Mobile.Account as Account;

                    if (a != null)
                    {
                        a.DepositGold(bid.CurrentBid);
                    }
                });

                RemoveAuction();
            }

            if (item != null)
            {
                item.Movable = true;

                if (Owner != null)
                {
                    Owner.BankBox.DropItem(item);
                }
            }
        }
예제 #6
0
        private void DoOutBidMessage(Mobile to)
        {
            string name = AuctionItemName();

            if (string.IsNullOrEmpty(name))
            {
                name = "the item you bid on";
            }

            NewMaginciaMessage message = new NewMaginciaMessage(null, 1156427, string.Format("{0}\t{1}\t{2}",
                                                                                             name,
                                                                                             CurrentPlatBid.ToString("N0", CultureInfo.GetCultureInfo("en-US")),
                                                                                             CurrentGoldBid.ToString("N0", CultureInfo.GetCultureInfo("en-US"))));

            /*  You have been out bid in an auction for ~1_ITEMNAME~. The current winning bid amount is
             * ~2_BIDAMT~plat and ~3_BIDAMT~gp.*/
            MaginciaLottoSystem.SendMessageTo(to, message);
        }
예제 #7
0
        public void HouseCollapse()
        {
            Item item = AuctionItem;

            if (Bids != null)
            {
                for (var index = 0; index < Bids.Count; index++)
                {
                    var bid = Bids[index];

                    string name = AuctionItemName();

                    if (string.IsNullOrEmpty(name))
                    {
                        name = "the item you bid on";
                    }

                    NewMaginciaMessage mes = new NewMaginciaMessage(null, new TextDefinition(1156454), string.Format(
                                                                        "{0}\t{1}\t{2}",
                                                                        CurrentPlatBid.ToString("N0", CultureInfo.GetCultureInfo("en-US")),
                                                                        CurrentGoldBid.ToString("N0", CultureInfo.GetCultureInfo("en-US")),
                                                                        name));
                    /*Your winning bid amount of ~1_BIDAMT~plat and ~2_BIDAMT~gp for ~3_ITEMNAME~ has been refunded to you due to house collapse.*/
                    MaginciaLottoSystem.SendMessageTo(bid.Mobile, mes);

                    if (bid.Mobile.Account is Account a)
                    {
                        a.DepositGold(bid.CurrentBid);
                    }
                }

                RemoveAuction();
            }

            if (item != null)
            {
                item.Movable = true;

                if (Owner != null)
                {
                    Owner.BankBox.DropItem(item);
                }
            }
        }
예제 #8
0
        public bool TryPlaceBid(Mobile m, long bidTotal)
        {
            if (!OnGoing || InClaimPeriod)
            {
                m.SendLocalizedMessage(1156432); // There is no active auction to complete this action.
                return(false);
            }

            BidEntry entry = GetBidEntry(m);
            Account  acct  = m.Account as Account;

            long highestBid = HighestBid != null ? HighestBid.CurrentBid : CurrentBid;

            if (acct == null || Banker.GetBalance(m) < bidTotal)
            {
                m.SendLocalizedMessage(1155867); // The amount entered is invalid. Verify that there are sufficient funds to complete this transaction.
                return(false);
            }
            else if (bidTotal < entry.CurrentBid || entry == HighestBid)
            {
                m.SendLocalizedMessage(1156445); // You have been out bid.
                return(false);
            }

            if (bidTotal <= highestBid)
            {
                m.SendLocalizedMessage(1156445);                 // You have been out bid.
            }
            else
            {
                acct.WithdrawGold(bidTotal);
                entry.CurrentBid = bidTotal;

                CurrentBid = highestBid + 1;

                if (HighestBid != null)
                {
                    string name = "Unknown Item";

                    if (AuctionItem.Name != null)
                    {
                        name = AuctionItem.Name;
                    }
                    else
                    {
                        name = String.Format("#{0}", AuctionItem.LabelNumber.ToString());
                    }

                    var message = new NewMaginciaMessage(null, new TextDefinition(1156427), String.Format("{0}\t{1}\t{2}",
                                                                                                          name,
                                                                                                          CurrentPlatBid.ToString("N0", CultureInfo.GetCultureInfo("en-US")),
                                                                                                          CurrentGoldBid.ToString("N0", CultureInfo.GetCultureInfo("en-US"))));

                    /*  You have been out bid in an auction for ~1_ITEMNAME~. The current winning bid amount is
                     * ~2_BIDAMT~plat and ~3_BIDAMT~gp.*/
                    MaginciaLottoSystem.SendMessageTo(HighestBid.Mobile, message);

                    Account a = HighestBid.Mobile.Account as Account;

                    if (a != null)
                    {
                        a.DepositGold(HighestBid.CurrentBid);
                    }

                    HighestBid.CurrentBid = 0;
                }

                m.SendLocalizedMessage(1156433);                 // Your bid has been placed.

                AuctionMap map = new AuctionMap(Safe);

                if (m.Backpack == null || !m.Backpack.TryDropItem(m, map, false))
                {
                    map.Delete();
                }
                else
                {
                    m.SendLocalizedMessage(1156478); // The auction safe map has been placed in your backpack.
                }

                HighestBid = entry;
                AddToHistory(m, entry.CurrentBid);
                return(true);
            }

            return(false);
        }
예제 #9
0
        public void EndAuction()
        {
            if (HighestBid != null && HighestBid.Mobile != null)
            {
                Mobile m    = HighestBid.Mobile;
                string name = "Unknown Item";

                if (AuctionItem.Name != null)
                {
                    name = AuctionItem.Name;
                }
                else
                {
                    name = String.Format("#{0}", AuctionItem.LabelNumber.ToString());
                }

                NewMaginciaMessage message = new NewMaginciaMessage(null, new TextDefinition(1156426), String.Format("{0}\t{1}\t{2}",
                                                                                                                     name,
                                                                                                                     CurrentPlatBid.ToString("N0", CultureInfo.GetCultureInfo("en-US")),
                                                                                                                     CurrentGoldBid.ToString("N0", CultureInfo.GetCultureInfo("en-US"))));

                /*  You have won an auction for ~1_ITEMNAME~! Your bid amount of ~2_BIDAMT~plat and ~3_BIDAMT~gp won the auction.
                 *  You have 3 days from the end of the auction to claim your item or it will be lost.*/
                MaginciaLottoSystem.SendMessageTo(HighestBid.Mobile, message);

                Account a   = m.Account as Account;
                Account b   = Owner.Account as Account;
                long    dif = HighestBid.CurrentBid - CurrentBid;

                if (a != null && dif > 0)
                {
                    a.DepositGold(dif);
                }

                if (b != null)
                {
                    b.DepositGold(HighestBid.CurrentBid);
                }

                message = new NewMaginciaMessage(null, new TextDefinition(1156428), String.Format("{0}\t{1}\t{2}",
                                                                                                  name,
                                                                                                  CurrentPlatBid.ToString("N0", CultureInfo.GetCultureInfo("en-US")),
                                                                                                  CurrentGoldBid.ToString("N0", CultureInfo.GetCultureInfo("en-US"))));

                /*Your auction for ~1_ITEMNAME~ has ended with a winning bid of ~2_BIDAMT~plat and ~3_BIDAMT~gp. The winning bid has
                 * been deposited into your currency account.*/
                MaginciaLottoSystem.SendMessageTo(Owner, message);

                ClaimPeriod = DateTime.UtcNow + TimeSpan.FromDays(3);

                if (Safe != null && Safe.Components.Count > 0)
                {
                    Safe.Components[0].InvalidateProperties();
                }
            }
            else
            {
                Cancel();
            }

            CloseGumps();
        }
예제 #10
0
        public bool TryPlaceBid(Mobile m, long bidTotal)
        {
            if (!OnGoing)
            {
                return(false);
            }

            BidEntry entry = GetBidEntry(m);
            Account  acct  = m.Account as Account;

            if (bidTotal < entry.CurrentBid || entry == HighestBid)
            {
                m.SendMessage("You are already own the leading bid!");
                return(false);
            }

            long actualBid = bidTotal - entry.CurrentBid;

            if (acct == null || Banker.GetBalance(m) < bidTotal)
            {
                m.SendLocalizedMessage(1155867);                 // The amount entered is invalid. Verify that there are sufficient funds to complete this transaction.
                return(false);
            }

            long highestBid = HighestBid != null ? HighestBid.CurrentBid : CurrentBid;

            if (bidTotal <= highestBid)
            {
                //if(BidHistory != null && BidHistory.Count > 0)
                //	BidHistory[BidHistory.Count - 1].ShowRealBid = true;

                m.SendLocalizedMessage(1156445);                 // You have been out bid.
            }
            else
            {
                acct.WithdrawGold(bidTotal);
                entry.CurrentBid = bidTotal;

                CurrentBid = highestBid + 1;

                if (HighestBid != null)
                {
                    string name = "Unknown Item";

                    if (AuctionItem.Name != null)
                    {
                        name = AuctionItem.Name;
                    }
                    else
                    {
                        name = String.Format("#{0}", AuctionItem.LabelNumber.ToString());
                    }

                    var message = new NewMaginciaMessage(null, new TextDefinition(1156427), String.Format("{0}\t{1}\t{2}",
                                                                                                          name,
                                                                                                          CurrentPlatBid.ToString("N0", CultureInfo.GetCultureInfo("en-US")),
                                                                                                          CurrentGoldBid.ToString("N0", CultureInfo.GetCultureInfo("en-US"))));

                    /*  You have been out bid in an auction for ~1_ITEMNAME~. The current winning bid amount is
                     * ~2_BIDAMT~plat and ~3_BIDAMT~gp.*/
                    MaginciaLottoSystem.SendMessageTo(HighestBid.Mobile, message);

                    Account a = HighestBid.Mobile.Account as Account;

                    if (a != null)
                    {
                        a.DepositGold(HighestBid.CurrentBid);
                    }

                    HighestBid.CurrentBid = 0;
                }

                m.SendLocalizedMessage(1156433);                 // Your bid has been placed.
                HighestBid = entry;
                AddToHistory(m, entry.CurrentBid);
                return(true);
            }

            return(false);
        }
예제 #11
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;
        }
예제 #12
0
        public bool TryPlaceBid(Mobile m, long bidTotal)
        {
            if (!OnGoing || InClaimPeriod)
            {
                m.SendLocalizedMessage(1156432); // There is no active auction to complete this action.
                return(false);
            }

            BidEntry entry    = GetBidEntry(m);
            Account  acct     = m.Account as Account;
            bool     firstBid = HighestBid == null;

            long highestBid = firstBid ? CurrentBid : HighestBid.CurrentBid;

            if (acct == null || Banker.GetBalance(m) < bidTotal)
            {
                m.SendLocalizedMessage(1155867); // The amount entered is invalid. Verify that there are sufficient funds to complete this transaction.
                return(false);
            }

            if ((firstBid && bidTotal < highestBid) || (!firstBid && bidTotal <= highestBid))
            {
                m.SendLocalizedMessage(1156445); // You have been out bid.

                if (bidTotal > CurrentBid)
                {
                    CurrentBid = bidTotal;

                    AddToHistory(m, bidTotal);
                }
            }
            else
            {
                acct.WithdrawGold(bidTotal);
                entry.CurrentBid = bidTotal;

                if (!firstBid)
                {
                    if (HighestBid.Mobile != m)
                    {
                        string name = AuctionItemName();

                        if (string.IsNullOrEmpty(name))
                        {
                            name = "the item you bid on";
                        }

                        NewMaginciaMessage message = new NewMaginciaMessage(null, 1156427, String.Format("{0}\t{1}\t{2}",
                                                                                                         name,
                                                                                                         CurrentPlatBid.ToString("N0", CultureInfo.GetCultureInfo("en-US")),
                                                                                                         CurrentGoldBid.ToString("N0", CultureInfo.GetCultureInfo("en-US"))));

                        /*  You have been out bid in an auction for ~1_ITEMNAME~. The current winning bid amount is
                         * ~2_BIDAMT~plat and ~3_BIDAMT~gp.*/
                        MaginciaLottoSystem.SendMessageTo(HighestBid.Mobile, message);
                    }

                    Account a = HighestBid.Mobile.Account as Account;

                    if (a != null)
                    {
                        a.DepositGold(HighestBid.CurrentBid);
                    }
                }
                else
                {
                    AddToHistory(m, bidTotal);
                }

                m.SendLocalizedMessage(1156433); // Your bid has been placed.

                AuctionMap map = new AuctionMap(Safe);

                if (m.Backpack == null || !m.Backpack.TryDropItem(m, map, false))
                {
                    map.Delete();
                }
                else
                {
                    m.SendLocalizedMessage(1156478); // The auction safe map has been placed in your backpack.
                }

                HighestBid = entry;
                return(true);
            }

            return(false);
        }