예제 #1
0
        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);
            int version = reader.ReadInt();

            m_Enabled = reader.ReadBool();
            m_Phase   = (Phase)reader.ReadInt();

            int count = reader.ReadInt();

            for (int i = 0; i < count; i++)
            {
                m_Plots.Add(new MaginciaBazaarPlot(reader));
            }

            count = reader.ReadInt();
            for (int i = 0; i < count; i++)
            {
                Mobile   m     = reader.ReadMobile();
                BidEntry entry = new BidEntry(reader);

                if (m != null)
                {
                    m_NextAvailable[m] = entry;
                }
            }

            count = reader.ReadInt();
            for (int i = 0; i < count; i++)
            {
                Mobile m = reader.ReadMobile();

                StorageEntry entry = new StorageEntry(reader);

                if (m != null)
                {
                    m_WarehouseStorage[m] = entry;
                }
            }

            count = reader.ReadInt();
            for (int i = 0; i < count; i++)
            {
                Mobile m   = reader.ReadMobile();
                int    amt = reader.ReadInt();

                if (m != null && amt > 0)
                {
                    m_Reserve[m] = amt;
                }
            }

            m_Instance = this;

            if (m_Enabled)
            {
                StartTimer();
            }
        }
예제 #2
0
            public ClaimStorageEntry(Mobile from, WarehouseSuperintendent mobile) : base(1150681, 3)
            {
                m_Mobile = mobile;
                m_Entry  = MaginciaBazaar.GetStorageEntry(from);

                if (m_Entry == null)
                {
                    Flags |= CMEFlags.Disabled;
                }
            }
예제 #3
0
        /*public override void OnDoubleClick(Mobile from)
         * {
         *      if(from.InRange(this.Location, 3) && from.Backpack != null)
         *      {
         *              WarehouseContainer container = MaginciaBazaar.ClaimContainer(from);
         *
         *              if(container != null)
         *                      TryTransferItems(from, container);
         *      }
         * }*/

        public void TryTransferPets(Mobile from, StorageEntry entry)
        {
            if (entry == null)
            {
                return;
            }

            int fees = entry.Funds;

            if (fees < 0)
            {
                int owed = fees * -1;
                SayTo(from, String.Format("It looks like you owe {0}gp as back fees.  How much would you like to pay now?", owed.ToString("###,###,###")));
                from.Prompt = new BackfeePrompt(this, entry);
                return;
            }

            if (!TryPayFunds(from, entry))
            {
                from.SendGump(new BazaarInformationGump(1150681, 1150678)); // Some personal possessions that were equipped on the broker still remain in storage, because your backpack cannot hold them. Please free up space in your backpack and return to claim these items.
                return;
            }

            List <BaseCreature> list = new List <BaseCreature>(entry.Creatures);

            foreach (BaseCreature bc in list)
            {
                if (from.Stabled.Count < AnimalTrainer.GetMaxStabled(from))
                {
                    bc.Blessed      = false;
                    bc.ControlOrder = OrderType.Stay;
                    bc.Internalize();
                    bc.IsStabled = true;
                    bc.Loyalty   = BaseCreature.MaxLoyalty; // Wonderfully happy
                    from.Stabled.Add(bc);
                    bc.SetControlMaster(null);
                    bc.SummonMaster = null;

                    entry.RemovePet(bc);
                }
                else
                {
                    from.SendGump(new BazaarInformationGump(1150681, 1150678)); // Some personal possessions that were equipped on the broker still remain in storage, because your backpack cannot hold them. Please free up space in your backpack and return to claim these items.
                    return;
                }
            }

            from.SendGump(new BazaarInformationGump(1150681, 1150677)); // There are no longer any items or funds in storage for your former bazaar stall. Thank you for your diligence in recovering your possessions.
            MaginciaBazaar.RemoveFromStorage(from);
        }
예제 #4
0
        public void TryTransferItems(Mobile from, StorageEntry entry)
        {
            if (entry == null)
            {
                return;
            }

            int fees = entry.Funds;

            if (fees < 0)
            {
                int owed = fees * -1;
                SayTo(from, String.Format("It looks like you owe {0}gp as back fees.  How much would you like to pay now?", owed.ToString("###,###,###")));
                from.Prompt = new BackfeePrompt(this, entry);
                return;
            }

            if (!TryPayFunds(from, entry))
            {
                from.SendGump(new BazaarInformationGump(1150681, 1150678)); // Some personal possessions that were equipped on the broker still remain in storage, because your backpack cannot hold them. Please free up space in your backpack and return to claim these items.
                return;
            }

            Dictionary <Type, int> copy = new Dictionary <Type, int>(entry.CommodityTypes);

            foreach (KeyValuePair <Type, int> commodities in copy)
            {
                Type type = commodities.Key;
                int  amt  = commodities.Value;

                if (!GiveItems(from, type, amt, entry))
                {
                    from.SendGump(new BazaarInformationGump(1150681, 1150678)); // Some personal possessions that were equipped on the broker still remain in storage, because your backpack cannot hold them. Please free up space in your backpack and return to claim these items.
                    return;
                }
            }

            from.SendGump(new BazaarInformationGump(1150681, 1150677));             // There are no longer any items or funds in storage for your former bazaar stall. Thank you for your diligence in recovering your possessions.
            MaginciaBazaar.RemoveFromStorage(from);
        }
예제 #5
0
        public void EndAuction()
        {
            if (m_Plot == null)
            {
                return;
            }

            if (m_Plot.HasTempMulti())
            {
                m_Plot.RemoveTempPlot();
            }

            Mobile winner  = null;
            int    highest = 0;

            Dictionary <Mobile, BidEntry> combined = new Dictionary <Mobile, BidEntry>(m_Auctioners);

            //Combine auction bids with the bids for next available plot
            foreach (KeyValuePair <Mobile, BidEntry> kvp in MaginciaBazaar.NextAvailable)
            {
                combined.Add(kvp.Key, kvp.Value);
            }

            //Get highest bid
            foreach (BidEntry entry in combined.Values)
            {
                if (entry.Amount > highest)
                {
                    highest = entry.Amount;
                }
            }

            // Check for owner, and if the owner has a match bad AND hasn't bidded on another plot!
            if (m_Plot.Owner != null && MaginciaBazaar.Reserve.ContainsKey(m_Plot.Owner) && MaginciaBazaar.Instance != null && !MaginciaBazaar.Instance.HasActiveBid(m_Plot.Owner))
            {
                int matching = MaginciaBazaar.GetBidMatching(m_Plot.Owner);

                if (matching >= highest)
                {
                    MaginciaBazaar.DeductReserve(m_Plot.Owner, highest);
                    int newreserve = MaginciaBazaar.GetBidMatching(m_Plot.Owner);
                    winner = m_Plot.Owner;

                    /*You extended your lease on Stall ~1_STALLNAME~ at the ~2_FACET~ New Magincia
                     * Bazaar. You matched the top bid of ~3_BIDAMT~gp. That amount has been deducted
                     * from your Match Bid of ~4_MATCHAMT~gp. Your Match Bid balance is now
                     *~5_NEWMATCH~gp. You may reclaim any additional match bid funds or adjust
                     * your match bid for next week at the bazaar.*/
                    MaginciaLottoSystem.SendMessageTo(m_Plot.Owner, new NewMaginciaMessage(null, new TextDefinition(1150427), string.Format("@{0}@{1}@{2}@{3}@{4}", m_Plot.PlotDef.ID, m_Plot.PlotDef.Map.ToString(), highest.ToString("N0"), matching.ToString("N0"), newreserve.ToString("N0"))));
                }
                else
                {
                    /*You lost the bid to extend your lease on Stall ~1_STALLNAME~ at the ~2_FACET~
                     * New Magincia Bazaar. Your match bid amount of ~3_BIDAMT~gp is held in escrow
                     * at the Bazaar. You may obtain a full refund there at any time. Your hired
                     * merchant, if any, has deposited your proceeds and remaining inventory at the
                     * Warehouse in New Magincia. You must retrieve these within one week or they
                     * will be destroyed.*/
                    MaginciaLottoSystem.SendMessageTo(m_Plot.Owner, new NewMaginciaMessage(null, new TextDefinition(1150528), string.Format("@{0}@{1}@{2}", m_Plot.PlotDef.ID, m_Plot.PlotDef.Map.ToString(), matching.ToString("N0"))));
                }
            }
            else if (m_Plot.Owner != null)
            {
                /*Your lease has expired on Stall ~1_STALLNAME~ at the ~2_FACET~ New Magincia Bazaar.*/
                MaginciaLottoSystem.SendMessageTo(m_Plot.Owner, new NewMaginciaMessage(null, new TextDefinition(1150430), string.Format("@{0}@{1}", m_Plot.PlotDef.ID, m_Plot.PlotDef.Map.ToString())));
            }

            if (winner == null)
            {
                //Get list of winners
                List <BidEntry> winners = new List <BidEntry>();
                foreach (KeyValuePair <Mobile, BidEntry> kvp in combined)
                {
                    if (kvp.Value.Amount >= highest)
                    {
                        winners.Add(kvp.Value);
                    }
                }

                // One winner!
                if (winners.Count == 1)
                {
                    winner = winners[0].Bidder;
                }
                else
                {
                    // get a list of specific type (as opposed to next available)
                    List <BidEntry> specifics = new List <BidEntry>();
                    foreach (BidEntry bid in winners)
                    {
                        if (bid.BidType == BidType.Specific)
                        {
                            specifics.Add(bid);
                        }
                    }

                    // one 1 specific!
                    if (specifics.Count == 1)
                    {
                        winner = specifics[0].Bidder;
                    }
                    else if (specifics.Count > 1)
                    {
                        //gets oldest specific
                        BidEntry oldest = null;
                        foreach (BidEntry entry in specifics)
                        {
                            if (oldest == null || entry.DatePlaced < oldest.DatePlaced)
                            {
                                oldest = entry;
                            }
                        }

                        winner = oldest.Bidder;
                    }
                    else
                    {
                        //no specifics! gets oldest of list of winners
                        BidEntry oldest = null;
                        foreach (BidEntry entry in winners)
                        {
                            if (oldest == null || entry.DatePlaced < oldest.DatePlaced)
                            {
                                oldest = entry;
                            }
                        }

                        if (oldest != null)
                        {
                            winner = oldest.Bidder;
                        }
                    }
                }
            }

            //Give back gold
            foreach (KeyValuePair <Mobile, BidEntry> kvp in m_Auctioners)
            {
                Mobile m = kvp.Key;

                if (m != winner)
                {
                    if (!Banker.Deposit(m, kvp.Value.Amount, true) && m.Backpack != null)
                    {
                        int total = kvp.Value.Amount;

                        while (total > 60000)
                        {
                            m.Backpack.DropItem(new BankCheck(60000));
                            total -= 60000;
                        }

                        if (total > 0)
                        {
                            m.Backpack.DropItem(new BankCheck(total));
                        }
                    }
                }
            }
            //Does actual changes to plots
            if (winner != null)
            {
                MaginciaBazaar.AwardPlot(this, winner, highest);
            }
            else
            {
                m_Plot.Reset(); // lease expires
                m_Plot.NewAuction(MaginciaBazaar.GetShortAuctionTime);
            }
        }
예제 #6
0
		public override void Deserialize(GenericReader reader)
		{
			base.Deserialize(reader);
			int version = reader.ReadInt();

            m_Enabled = reader.ReadBool();
            m_Phase = (Phase)reader.ReadInt();

			int count = reader.ReadInt();
			for(int i = 0; i < count; i++)
			{
                m_Plots.Add(new MaginciaBazaarPlot(reader));
			}
			
			count = reader.ReadInt();
			for(int i = 0; i < count; i++)
			{
				Mobile m = reader.ReadMobile();
				BidEntry entry = new BidEntry(reader);
				
				if(m != null)
					m_NextAvailable[m] = entry;
			}

            count = reader.ReadInt();
            for (int i = 0; i < count; i++)
            {
                Mobile m = reader.ReadMobile();

                StorageEntry entry = new StorageEntry(reader);

                if (m != null)
                    m_WarehouseStorage[m] = entry;
            }

            count = reader.ReadInt();
            for (int i = 0; i < count; i++)
            {
                Mobile m = reader.ReadMobile();
                int amt = reader.ReadInt();

                if (m != null && amt > 0)
                    m_Reserve[m] = amt;
            }
			
			m_Instance = this;

            if (m_Enabled)
                StartTimer();
		}