예제 #1
0
        public void AddInventoryToWarehouse(Mobile owner, BaseBazaarBroker broker)
        {
            StorageEntry newEntry = null;

            if (broker is CommodityBroker && ((CommodityBroker)broker).HasValidEntry())
            {
                newEntry = new StorageEntry(((CommodityBroker)broker).CommodityEntries, broker.BankBalance);
            }
            else if (broker is PetBroker && ((PetBroker)broker).HasValidEntry())
            {
                newEntry = new StorageEntry(((PetBroker)broker).BrokerEntries, broker.BankBalance);
            }

            if (newEntry != null)
            {
                m_WarehouseStorage[owner] = newEntry;

                /*Your hired broker has transferred any remaining inventory and funds from
                 * your stall at the New Magincia Bazaar into storage at the New Magincia
                 * Warehouse. You must reclaim these items or they will be destroyed! To reclaim
                 * these items, see the Warehouse Superintendent in New Magincia.<br><br>This
                 * service is provided free of charge. If you owed your broker any back fees,
                 * those fees must be paid before you can reclaim your belongings. The storage
                 * period lasts 7 days starting with the expiration of your lease at the New
                 * Magincia Bazaar, and this storage period cannot be extended. Claim your
                 * possessions and gold without delay!<br><br>The expiration time of this
                 * message coincides with the expiration time of your Warehouse storage.*/

                MaginciaLottoSystem.SendMessageTo(owner, new NewMaginciaMessage(1150676, new TextDefinition(1150674), null));
            }
        }
예제 #2
0
        public void TryPayBackfee(Mobile from, string text, StorageEntry entry)
        {
            int amount = Utility.ToInt32(text);
            int owed   = entry.Funds * -1;

            if (amount > 0)
            {
                int toDeduct = Math.Min(owed, amount);

                if (Banker.Withdraw(from, toDeduct))
                {
                    entry.Funds += toDeduct;
                    int newAmount = entry.Funds;

                    if (newAmount >= 0)
                    {
                        TryTransfer(from, entry);
                    }
                    else
                    {
                        SayTo(from, String.Format("Thank you! You have a remaining balance of {0}gp as backfees!", newAmount * -1));
                    }
                }
                else
                {
                    SayTo(from, "You don't have enough funds in your bankbox to support that amount.");
                }
            }
        }
예제 #3
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();
            }
        }
예제 #4
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;
                }
            }
예제 #5
0
        private bool TryPayFunds(Mobile from, StorageEntry entry)
        {
            int amount = entry.Funds;

            if (Banker.Withdraw(from, amount, true))
            {
                entry.Funds = 0;
                return(true);
            }

            return(false);
        }
예제 #6
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);
        }
예제 #7
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);
        }
예제 #8
0
        private bool GiveItems(Mobile from, Type type, int amt, StorageEntry entry)
        {
            int amount = amt;

            while (amount > 60000)
            {
                CommodityDeed deed = new CommodityDeed();
                Item          item = Loot.Construct(type);
                item.Amount = 60000;
                deed.SetCommodity(item);
                amount -= 60000;

                if (from.Backpack == null || !from.Backpack.TryDropItem(from, deed, false))
                {
                    deed.Delete();
                    return(false);
                }
                else
                {
                    entry.RemoveCommodity(type, 60000);
                }
            }

            CommodityDeed deed2 = new CommodityDeed();
            Item          item2 = Loot.Construct(type);

            item2.Amount = amount;
            deed2.SetCommodity(item2);

            if (from.Backpack == null || !from.Backpack.TryDropItem(from, deed2, false))
            {
                deed2.Delete();
                return(false);
            }
            else
            {
                entry.RemoveCommodity(type, amount);
            }

            return(true);
        }
예제 #9
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);
        }
예제 #10
0
        private bool TryPayFunds(Mobile from, StorageEntry entry)
        {
            int amount = entry.Funds;

            if (amount > 0)
            {
                while (amount > 60000)
                {
                    BankCheck check = new BankCheck(60000);

                    if (from.Backpack == null || !from.Backpack.TryDropItem(from, check, false))
                    {
                        check.Delete();
                        return(false);
                    }
                    else
                    {
                        amount -= 60000;
                    }
                }

                BankCheck check2 = new BankCheck(amount);

                if (from.Backpack == null || !from.Backpack.TryDropItem(from, check2, false))
                {
                    check2.Delete();
                    return(false);
                }
                else
                {
                    entry.Funds -= amount;
                }
            }

            return(true);
        }
예제 #11
0
        private bool TryPayFunds(Mobile from, StorageEntry entry)
        {
            int amount = entry.Funds;

            if (Banker.Deposit(from, amount, true))
            {
                entry.Funds = 0;
                return true;
            }

            return false;
        }
예제 #12
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;
			}
예제 #13
0
			public BackfeePrompt(WarehouseSuperintendent mobile, StorageEntry entry)
			{
				m_Mobile = mobile;
                m_Entry = entry; ;
			}
예제 #14
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();
		}
예제 #15
0
 public BackfeePrompt(WarehouseSuperintendent mobile, StorageEntry entry)
 {
     m_Mobile = mobile;
     m_Entry  = entry;;
 }
예제 #16
0
        private bool GiveItems(Mobile from, Type type, int amt, StorageEntry entry)
        {
            int amount = amt;

            while (amount > 60000)
            {
                CommodityDeed deed = new CommodityDeed();
                Item item = Loot.Construct(type);
                item.Amount = 60000;
                deed.SetCommodity(item);
                amount -= 60000;

                if (from.Backpack == null || !from.Backpack.TryDropItem(from, deed, false))
                {
                    deed.Delete();
                    return false;
                }
                else
                    entry.RemoveCommodity(type, 60000);
            }

            CommodityDeed deed2 = new CommodityDeed();
            Item item2 = Loot.Construct(type);
            item2.Amount = amount;
            deed2.SetCommodity(item2);

            if (from.Backpack == null || !from.Backpack.TryDropItem(from, deed2, false))
            {
                deed2.Delete();
                return false;
            }
            else
                entry.RemoveCommodity(type, amount);

            return true;
        }
예제 #17
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);
		}
예제 #18
0
        public void OnTick()
        {
            foreach (MaginciaBazaarPlot plot in m_Plots)
            {
                if (plot.Active)
                {
                    plot.OnTick();
                }
            }

            List <Mobile> toRemove = new List <Mobile>();

            foreach (KeyValuePair <Mobile, StorageEntry> kvp in m_WarehouseStorage)
            {
                Mobile       m     = kvp.Key;
                StorageEntry entry = kvp.Value;

                if (entry.Expires < DateTime.UtcNow)
                {
                    bool deleted = false;
                    bool stabled = false;

                    if (entry.CommodityTypes.Count > 0)
                    {
                        deleted = true;
                    }

                    foreach (BaseCreature bc in entry.Creatures)
                    {
                        if (m.Stabled.Count < AnimalTrainer.GetMaxStabled(m))
                        {
                            PetBroker.SendToStables(m, bc);

                            if (!stabled)
                            {
                                stabled = true;
                            }
                        }
                        else
                        {
                            if (!deleted)
                            {
                                deleted = true;
                            }

                            bc.Delete();
                        }
                    }

                    if (stabled)
                    {
                        string message;

                        if (deleted)
                        {
                            message = "Your broker inventory and/or funds in storage at the New Magincia Warehouse " +
                                      "have been donated to charity, because these items remained unclaimed for a " +
                                      "full week. These items may no longer be recovered, but the orphans will " +
                                      "appreciate a nice hot meal. One or all of your pets have been placed in your stables.";
                        }
                        else
                        {
                            message = "Because your pets remained in storage for more than a full week, one or all of them have been placed in your stables. " +
                                      "If you had insufficient room in your stables, any further pets will be lost and returned to the wild.";
                        }

                        MaginciaLottoSystem.SendMessageTo(m, new NewMaginciaMessage(new TextDefinition(1150676), message, null));
                    }
                    else if (deleted)
                    {
                        toRemove.Add(m);

                        /*Your broker inventory and/or funds in storage at the New Magincia Warehouse
                         * have been donated to charity, because these items remained unclaimed for a
                         * full week. These items may no longer be recovered, but the orphans will
                         * appreciate a nice hot meal.*/

                        MaginciaLottoSystem.SendMessageTo(m, new NewMaginciaMessage(new TextDefinition(1150676), new TextDefinition(1150673), null));
                    }
                }
            }

            foreach (Mobile m in toRemove)
            {
                if (m_WarehouseStorage.ContainsKey(m))
                {
                    m_WarehouseStorage.Remove(m);
                }
            }

            ColUtility.Free(toRemove);
        }
예제 #19
0
        public void OnTick()
        {
            foreach (MaginciaBazaarPlot plot in m_Plots)
            {
                if (plot.Active)
                {
                    plot.OnTick();
                }
            }

            List <Mobile> toRemove = new List <Mobile>();

            foreach (KeyValuePair <Mobile, StorageEntry> kvp in m_WarehouseStorage)
            {
                Mobile       m       = kvp.Key;
                StorageEntry entry   = kvp.Value;
                bool         deleted = false;

                if (entry.Expires < DateTime.UtcNow)
                {
                    switch (entry.StorageType)
                    {
                    case StorageType.None: break;

                    case StorageType.Commodity: deleted = true; break;

                    case StorageType.Pet:
                    {
                        foreach (BaseCreature bc in entry.Creatures)
                        {
                            if (!deleted)
                            {
                                deleted = true;
                            }
                            bc.Delete();
                        }
                    }
                    break;
                    }
                }

                if (deleted)
                {
                    toRemove.Add(m);

                    /*Your broker inventory and/or funds in storage at the New Magincia Warehouse
                     * have been donated to charity, because these items remained unclaimed for a
                     * full week. These items may no longer be recovered, but the orphans will
                     * appreciate a nice hot meal.*/

                    MaginciaLottoSystem.SendMessageTo(m, new NewMaginciaMessage(new TextDefinition(1150676), new TextDefinition(1150673), null));
                }
            }

            foreach (Mobile m in toRemove)
            {
                if (m_WarehouseStorage.ContainsKey(m))
                {
                    m_WarehouseStorage.Remove(m);
                }
            }
        }
예제 #20
0
		public void TryPayBackfee(Mobile from, string text, StorageEntry entry)
		{
			int amount = 0;
            int owed = entry.Funds * -1;

			try
			{
				amount = Convert.ToInt32(text);
				
				if(amount > 0)
				{
					int toDeduct = Math.Min(owed, amount);
					
					if(Banker.Withdraw(from, toDeduct))
					{
						entry.Funds += toDeduct;
                        int newAmount = entry.Funds;

                        if (newAmount >= 0)
							TryTransferPets(from, entry);
						else
							SayTo(from, String.Format("Thank you! You have a remaining balance of {0}gp as backfees!", newAmount * -1));
					}
					else
						SayTo(from, "You don't have enough funds in your bankbox to support that amount.");
				}
				
			}
			catch 
            {
                from.SendMessage("Invalid amount.");
            }
		}
예제 #21
0
		public void AddInventoryToWarehouse(Mobile owner, BaseBazaarBroker broker)
		{
            StorageEntry newEntry = null;

            if (broker is CommodityBroker && ((CommodityBroker)broker).CommodityEntries.Count > 0 && ((CommodityBroker)broker).HasValidEntry())
                newEntry = new StorageEntry(((CommodityBroker)broker).CommodityEntries, broker.BankBalance);
            else if (broker is PetBroker && ((PetBroker)broker).BrokerEntries.Count > 0 && ((PetBroker)broker).HasValidEntry())
                newEntry = new StorageEntry(((PetBroker)broker).BrokerEntries, broker.BankBalance);

            if (newEntry != null)
            {
                m_WarehouseStorage[owner] = newEntry;
                /*Your hired broker has transferred any remaining inventory and funds from 
                 *your stall at the New Magincia Bazaar into storage at the New Magincia 
                 *Warehouse. You must reclaim these items or they will be destroyed! To reclaim 
                 *these items, see the Warehouse Superintendent in New Magincia.<br><br>This 
                 *service is provided free of charge. If you owed your broker any back fees, 
                 *those fees must be paid before you can reclaim your belongings. The storage 
                 *period lasts 7 days starting with the expiration of your lease at the New 
                 *Magincia Bazaar, and this storage period cannot be extended. Claim your 
                 *possessions and gold without delay!<br><br>The expiration time of this 
                 *message coincides with the expiration time of your Warehouse storage.*/

                MaginciaLottoSystem.SendMessageTo(owner, new NewMaginciaMessage(1150676, new TextDefinition(1150674), null));
            }
		}