Example #1
0
 public ClaimListGump(AnimalTrainer trainer, Mobile owner, ArrayList list)
     : this(trainer, owner, list, 0)
 {
 }
Example #2
0
        public void EndStable(Mobile from, BaseCreature pet)
        {
            if (Deleted || !from.CheckAlive())
            {
                return;
            }

            if (pet.Body.IsHuman)
            {
                from.SendLocalizedMessage(502672); // HA HA HA! Sorry, I am not an inn.
            }
            else if (!pet.Controlled)
            {
                from.SendLocalizedMessage(1048053); // You can't stable that!
            }
            else if (pet.ControlMaster != from)
            {
                from.SendLocalizedMessage(1042562); // You do not own that pet!
            }
            else if (pet.IsDeadPet)
            {
                from.SendLocalizedMessage(1049668); // Living pets only, please.
            }
            else if (pet.Summoned)
            {
                from.SendLocalizedMessage(502673); // I can not stable summoned creatures.
            }
            else if (pet.Allured)
            {
                from.SendLocalizedMessage(1048053); // You can't stable that!
            }
            else if ((pet is PackLlama || pet is PackHorse || pet is Beetle) &&
                     (pet.Backpack != null && pet.Backpack.Items.Count > 0))
            {
                from.SendLocalizedMessage(1042563); // You need to unload your pet.
            }
            else if (pet.Combatant != null && pet.InRange(pet.Combatant, 12) && pet.Map == pet.Combatant.Map)
            {
                from.SendLocalizedMessage(1042564); // I'm sorry.  Your pet seems to be busy.
            }
            else if (from.Stabled.Count >= AnimalTrainer.GetMaxStabled(from))
            {
                from.SendLocalizedMessage(1042565); // You have too many pets in the stables!
            }
            else if ((from.Backpack != null && from.Backpack.ConsumeTotal(typeof(Gold), 30)) || Banker.Withdraw(from, 30))
            {
                pet.ControlTarget = null;
                pet.ControlOrder  = OrderType.Stay;
                pet.Internalize();

                pet.SetControlMaster(null);
                pet.SummonMaster = null;

                pet.IsStabled = true;
                pet.StabledBy = from;

                pet.Loyalty = BaseCreature.MaxLoyalty; // Wonderfully happy

                from.Stabled.Add(pet);

                from.SendLocalizedMessage(1049677); // Your pet has been stabled.
            }
            else
            {
                from.SendLocalizedMessage(502677); // But thou hast not the funds in thy bank account!
            }
        }
Example #3
0
        public void EndStable(Mobile from, BaseCreature pet)
        {
            if (Deleted || !from.CheckAlive())
            {
                return;
            }

            if (!pet.Controlled || pet.ControlMaster != from)
            {
                from.SendLocalizedMessage(1042562); // You do not own that pet!
            }
            else if (pet.IsDeadPet)
            {
                from.SendLocalizedMessage(1049668); // Living pets only, please.
            }
            else if (pet.Summoned)
            {
                from.SendLocalizedMessage(502673); // I can not stable summoned creatures.
            }
            #region Mondain's Legacy
            else if (pet.Allured)
            {
                from.SendLocalizedMessage(1048053); // You can't stable that!
            }
            #endregion
            else if (pet.Body.IsHuman)
            {
                from.SendLocalizedMessage(502672); // HA HA HA! Sorry, I am not an inn.
            }
            else if ((pet is PackLlama || pet is PackHorse || pet is Beetle) && (pet.Backpack != null && pet.Backpack.Items.Count > 0))
            {
                from.SendLocalizedMessage(1042563); // You need to unload your pet.
            }
            else if (pet.Combatant != null && pet.InRange(pet.Combatant, 12) && pet.Map == pet.Combatant.Map)
            {
                from.SendLocalizedMessage(1042564); // I'm sorry.  Your pet seems to be busy.
            }
            else if (from.Stabled.Count >= AnimalTrainer.GetMaxStabled(from))
            {
                from.SendLocalizedMessage(1042565); // You have too many pets in the stables!
            }
            else
            {
                Container bank = from.FindBankNoCreate();

                if ((bank != null && bank.ConsumeTotal(typeof(Gold), 30)) || Banker.Withdraw(from, 30, true))
                {
                    pet.ControlTarget = null;
                    pet.ControlOrder  = OrderType.Stay;
                    pet.Internalize();

                    pet.SetControlMaster(null);
                    pet.SummonMaster = null;

                    pet.IsStabled = true;

                    pet.Loyalty = BaseCreature.MaxLoyalty; // Wonderfully happy

                    from.Stabled.Add(pet);

                    if (m_Replica)
                    {
                        UsesRemaining -= 1;
                    }

                    from.SendLocalizedMessage(502679); // Very well, thy pet is stabled. Thou mayst recover it by saying 'claim' to me. In one real world week, I shall sell it off if it is not claimed!
                }
                else
                {
                    from.SendLocalizedMessage(502677); // But thou hast not the funds in thy bank account!
                }
            }
        }
Example #4
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);
        }
        /*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 TryTransfer(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;
            }

            if (entry.Creatures.Count > 0)
            {
                List <BaseCreature> list = new List <BaseCreature>(entry.Creatures);

                for (var index = 0; index < list.Count; index++)
                {
                    BaseCreature bc = list[index];

                    if (from.Stabled.Count < AnimalTrainer.GetMaxStabled(from))
                    {
                        bc.Blessed      = false;
                        bc.ControlOrder = OrderType.Stay;
                        bc.Internalize();
                        bc.IsStabled = true;
                        bc.Loyalty   = 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;
                    }
                }

                ColUtility.Free(list);
            }

            if (entry.CommodityTypes.Count > 0)
            {
                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;
                    }
                }

                copy.Clear();
            }

            entry.CommodityTypes.Clear();
            ColUtility.Free(entry.Creatures);

            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);
        }