Exemplo n.º 1
0
        private void DoClaim(Mobile from, BaseCreature pet, PetClaimTicket petClaimTicket)
        {
            pet.SetControlMaster(from);

            pet.ControlTarget = from;
            pet.ControlOrder  = OrderType.Follow;

            pet.MoveToWorld(from.Location, from.Map);

            pet.IsStabled = false;
            pet.StabledBy = null;

            petClaimTicket.Stabled = null;
            petClaimTicket.Delete();

            pet.CheckControlChance(from);
        }
Exemplo n.º 2
0
        public void Claim(Mobile from, PetClaimTicket petClaimTicket)
        {
            if (Deleted || !from.CheckAlive())
            {
                return;
            }

            var pet = petClaimTicket.Stabled;

            if (pet == null || pet.Deleted)
            {
                pet.IsStabled          = false;
                pet.StabledBy          = null;
                petClaimTicket.Stabled = null;
                return;
            }

            DoClaim(from, pet, petClaimTicket);

            SayTo(from, 1042559); // Here you go... and good day to you!
        }
        public override void OnResponse(NetState state, RelayInfo info)
        {
            Mobile from = state.Mobile;

            BaseCreature bc1 = (BaseCreature)m_Pet1;
            BaseCreature bc2 = (BaseCreature)m_Pet2;

            Mobile cm1 = bc1.ControlMaster;
            Mobile cm2 = bc2.ControlMaster;

            if (from == null)
            {
                return;
            }

            //Baby Stat Table
            if (info.ButtonID == 1)
            {
                from.CloseGump(typeof(BreedingAcceptGump));
                //from.CloseGump( typeof( BabyStatTableGump ) );

                from.SendGump(new BreedingAcceptGump(m_Pet1, m_Pet2));
                //from.SendGump( new BabyStatTableGump( m_Pet1, m_Pet2 ) );
            }

            //Accept
            if (info.ButtonID == 2)
            {
                Mobile breeder = new Mobile();

                Mobile owner = new Mobile();

                int ai = 0;

                if (bc1.AI == AIType.AI_Mage && bc2.AI == AIType.AI_Mage)
                {
                    ai = 1;
                }
                if (bc1.AI == AIType.AI_Melee && bc2.AI == AIType.AI_Melee)
                {
                    ai = 2;
                }

                int xstr = bc1.RawStr + bc2.RawStr;
                int xdex = bc1.RawDex + bc2.RawDex;
                int xint = bc1.RawInt + bc2.RawInt;

                int xhits = bc1.HitsMax + bc2.HitsMax;
                int xstam = bc1.StamMax + bc2.StamMax;
                int xmana = bc1.ManaMax + bc2.ManaMax;

                int xphys = bc1.PhysicalResistance + bc2.PhysicalResistance;
                int xfire = bc1.FireResistance + bc2.FireResistance;
                int xcold = bc1.ColdResistance + bc2.ColdResistance;
                int xnrgy = bc1.EnergyResistance + bc2.EnergyResistance;
                int xpois = bc1.PoisonResistance + bc2.PoisonResistance;

                int xdmin = bc1.DamageMin + bc2.DamageMin;
                int xdmax = bc1.DamageMax + bc2.DamageMax;

                int xmlev = bc1.Level + bc2.Level;

                int newStr = xstr / 2;
                int newDex = xdex / 2;
                int newInt = xint / 2;

                int newHits = xhits / 2;
                int newStam = xstam / 2;
                int newMana = xmana / 2;

                int newPhys = xphys / 2;
                int newFire = xfire / 2;
                int newCold = xcold / 2;
                int newNrgy = xnrgy / 2;
                int newPois = xpois / 2;

                int newDmin = xdmin / 2;
                int newDmax = xdmax / 2;

                int newMlev = xmlev / 2;

                int babyStr  = newStr + Utility.RandomMinMax(0, 1);
                int babyDex  = newDex + Utility.RandomMinMax(0, 1);
                int babyInt  = newInt + Utility.RandomMinMax(0, 1);
                int babyHits = newHits + Utility.RandomMinMax(0, 2);
                int babyStam = newStam + Utility.RandomMinMax(0, 2);
                int babyMana = newMana + Utility.RandomMinMax(0, 2);

                int babyPhys = newPhys + Utility.RandomMinMax(0, 2);
                int babyFire = newFire + Utility.RandomMinMax(0, 2);
                int babyCold = newCold + Utility.RandomMinMax(0, 2);
                int babyNrgy = newNrgy + Utility.RandomMinMax(0, 2);
                int babyPois = newPois + Utility.RandomMinMax(0, 2);

                int babyDmin = newDmin;
                int babyDmax = newDmax;

                int babyMlev = newMlev + Utility.RandomMinMax(1, 3);

                int stats     = babyStr + babyDex + babyInt + babyHits + babyStam + babyMana + babyPhys + babyFire + babyCold + babyNrgy + babyPois + babyDmin + babyDmax + babyMlev;
                int newPrice  = stats * 3;
                int babyPrice = newPrice;
                int chance    = stats;

                if (chance <= 1500)
                {
                    chance = 1500;
                }

                if (babyStr >= FSATS.NormalSTR)
                {
                    babyStr = FSATS.NormalSTR;
                }

                if (babyDex >= FSATS.NormalDEX)
                {
                    babyDex = FSATS.NormalDEX;
                }

                if (babyInt >= FSATS.NormalINT)
                {
                    babyInt = FSATS.NormalINT;
                }

                if (babyPhys >= FSATS.NormalPhys)
                {
                    babyPhys = FSATS.NormalPhys;
                }

                if (babyFire >= FSATS.NormalFire)
                {
                    babyFire = FSATS.NormalFire;
                }

                if (babyCold >= FSATS.NormalCold)
                {
                    babyCold = FSATS.NormalCold;
                }

                if (babyNrgy >= FSATS.NormalEnergy)
                {
                    babyNrgy = FSATS.NormalEnergy;
                }

                if (babyPois >= FSATS.NormalPoison)
                {
                    babyPois = FSATS.NormalPoison;
                }

                if (babyDmin >= FSATS.NormalMinDam)
                {
                    babyDmin = FSATS.NormalMinDam;
                }

                if (babyDmax >= FSATS.NormalMaxDam)
                {
                    babyDmax = FSATS.NormalMaxDam;
                }

                if (babyMlev >= 60)
                {
                    babyMlev = 60;
                }

                foreach (Mobile m in from.GetMobilesInRange(5))
                {
                    if (m is AnimalBreeder)
                    {
                        breeder = m;
                    }

                    if (m == cm1)
                    {
                        owner = m;
                    }
                }

                if (breeder == null)
                {
                    from.SendMessage("You must be near an animal breeder in order to breed your pet.");

                    if (cm1 != null)
                    {
                        cm1.SendMessage("The owner of the other pet is too far away from the animal breeder.");
                    }
                }
                else if (owner == null)
                {
                    from.SendMessage("The owner of the other pet is not near by.");

                    if (cm1 != null)
                    {
                        cm1.SendMessage("You are to far away from the other pet owner.");
                    }
                }
                else if (Utility.Random(chance) < 1500)
                {
                    if (cm1 != null)                       //Generate Claim Ticket One
                    {
                        PetClaimTicket pct = new PetClaimTicket();
                        pct.AI    = ai;
                        pct.Owner = cm1;
                        pct.Pet   = m_Pet1;
                        pct.Str   = babyStr;
                        pct.Dex   = babyDex;
                        pct.Int   = babyInt;
                        pct.Hits  = babyHits;
                        pct.Stam  = babyStam;
                        pct.Mana  = babyMana;
                        pct.Phys  = babyPhys;
                        pct.Fire  = babyFire;
                        pct.Cold  = babyCold;
                        pct.Nrgy  = babyNrgy;
                        pct.Pois  = babyPois;
                        pct.Dmin  = babyDmin;
                        pct.Dmax  = babyDmax;
                        pct.Mlev  = babyMlev;
                        pct.Gen   = bc1.Generation;
                        pct.Price = babyPrice;
                        cm1.AddToBackpack(pct);

                        breeder.SayTo(cm1, "Ill hold onto your pet for you while its mating.");
                        breeder.SayTo(cm1, "Return here in three days and show me the claim ticket I gave to you.");
                        cm1.SendMessage("They have accepted your offer.");

                        bc1.ControlTarget = null;
                        bc1.ControlOrder  = OrderType.Stay;
                        bc1.Internalize();

                        bc1.SetControlMaster(null);
                    }

                    if (cm2 != null)                       //Generate Claim Ticket One
                    {
                        PetClaimTicket pct = new PetClaimTicket();
                        pct.AI    = ai;
                        pct.Owner = cm2;
                        pct.Pet   = m_Pet2;
                        pct.Str   = babyStr;
                        pct.Dex   = babyDex;
                        pct.Int   = babyInt;
                        pct.Hits  = babyHits;
                        pct.Stam  = babyStam;
                        pct.Mana  = babyMana;
                        pct.Phys  = babyPhys;
                        pct.Fire  = babyFire;
                        pct.Cold  = babyCold;
                        pct.Nrgy  = babyNrgy;
                        pct.Pois  = babyPois;
                        pct.Dmin  = babyDmin;
                        pct.Dmax  = babyDmax;
                        pct.Mlev  = babyMlev;
                        pct.Gen   = bc2.Generation;
                        pct.Price = babyPrice;
                        cm2.AddToBackpack(pct);

                        breeder.SayTo(cm2, "Ill hold onto your pet for you while its mating.");
                        breeder.SayTo(cm2, "Return here in three days and the show me that claim ticket i gave to you.");
                        cm2.SendMessage("You accept their offer.");

                        bc2.ControlTarget = null;
                        bc2.ControlOrder  = OrderType.Stay;
                        bc2.Internalize();

                        bc2.SetControlMaster(null);
                    }

                    if (bc1 != null || bc2 != null)
                    {
                        bc1.MatingDelay = DateTime.Now + TimeSpan.FromHours(144.0);
                        bc2.MatingDelay = DateTime.Now + TimeSpan.FromHours(144.0);
                    }
                }
                else
                {
                    if (cm1 != null && cm2 != null)
                    {
                        cm1.SendMessage("Breeding Failed: It is hard to successfully mate two strong pets together, You will have to wait 6 hours to try again.");
                        cm2.SendMessage("Breeding Failed: It is hard to successfully mate two strong pets together, You will have to wait 6 hours to try again.");
                        bc1.MatingDelay = DateTime.Now + TimeSpan.FromHours(6.0);
                        bc2.MatingDelay = DateTime.Now + TimeSpan.FromHours(6.0);
                    }
                }
            }

            //Decline
            if (info.ButtonID == 3)
            {
                from.SendMessage("You have declined their offer.");

                if (cm1 != null)
                {
                    cm1.SendMessage("They have declined your offer");
                }
            }
        }
Exemplo n.º 4
0
        public void EndStable(Mobile from, BaseCreature pet)
        {
            if (Deleted || !from.CheckAlive())
            {
                return;
            }

            if (pet.Body.IsHuman)
            {
                SayTo(from, 502672); // HA HA HA! Sorry, I am not an inn.
            }
            else if (!pet.Controlled)
            {
                SayTo(from, 1048053); // You can't stable that!
            }
            else if (pet.ControlMaster != from)
            {
                SayTo(from, 1042562); // You do not own that pet!
            }
            else if (pet.Summoned || pet.AI == AIType.AI_Familiar)
            {
                SayTo(from, 502673); // I can not stable summoned creatures.
            }
            else if ((pet is PackLlama || pet is PackHorse) && pet.Backpack != null && pet.Backpack.Items.Count > 0)
            {
                SayTo(from, 1042563); // You need to unload your pet.
            }
            else if (pet.Combatant != null && pet.InRange(pet.Combatant, 12) && pet.Map == pet.Combatant.Map)
            {
                SayTo(from, 1042564); // I'm sorry.  Your pet seems to be busy.
            }
            else
            {
                var       amount = pet.Str * 2;
                Container bank   = from.FindBankNoCreate();

                SayTo(from, true, $"I charge {amount} to take care of that {pet.Name}.");

                if (@from.Backpack != null && @from.Backpack.ConsumeTotal(typeof(Gold), amount) ||
                    bank != null && bank.ConsumeTotal(typeof(Gold), amount))
                {
                    pet.ControlTarget = null;
                    pet.ControlOrder  = OrderType.Stay;
                    pet.Internalize();

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

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

                    var petClaimTicket = new PetClaimTicket {
                        Name = $"Pet claim ticket - Name: {pet.Name}"
                    };
                    petClaimTicket.Stabled = pet;

                    var cont = from.Backpack;
                    if (cont == null || !cont.TryDropItem(from, petClaimTicket, false))
                    {
                        petClaimTicket.MoveToWorld(from.Location, from.Map);
                    }

                    SayTo(from, true, $"Keep this ticket and give it to me when you want {pet.Name} back.");
                }
                else
                {
                    SayTo(from, 502677); // But thou hast not the funds in thy bank account!
                }
            }
        }
Exemplo n.º 5
0
        public override bool OnDragDrop(Mobile from, Item dropped)
        {
            if (dropped is PetClaimTicket)
            {
                PetClaimTicket pct = (PetClaimTicket)dropped;
                if (pct.Time <= DateTime.UtcNow)
                {
                    if (pct.Pet == null)
                    {
                        from.SendMessage("Error! Contact Gamemaster");
                        return(false);
                    }
                    else if (from.Followers == 0)
                    {
                        Type         pettype = pct.Pet.GetType();
                        BaseCreature bc      = (BaseCreature)pct.Pet;

                        bc.IsStabled = true;
                        from.Stabled.Add(bc);
                        this.SayTo(from, "I have put your pet that was mating in the stable under you name.");

                        BaseCreature baby = null;

                        if (pettype != null)
                        {
                            object o = Activator.CreateInstance(pettype);
                            baby = o as BaseCreature;
                        }

                        if (baby == null)
                        {
                            from.SendMessage(38, "There was an internal error and breeding has failed due to lack of type, Please contact a member of the staff.");
                            return(false);
                        }
                        else
                        {
                            if (from == pct.Owner)
                            {
                                if (Banker.Withdraw(from, pct.Price))
                                {
                                    from.SendLocalizedMessage(1060398, pct.Price.ToString());
                                    from.SendLocalizedMessage(1060022, Banker.GetBalance(from).ToString());

                                    baby.Str                    = pct.Str;
                                    baby.Dex                    = pct.Dex;
                                    baby.Int                    = pct.Int;
                                    baby.HitsMaxSeed            = pct.Hits;
                                    baby.StamMaxSeed            = pct.Stam;
                                    baby.ManaMaxSeed            = pct.Mana;
                                    baby.PhysicalResistanceSeed = pct.Phys;
                                    baby.FireResistSeed         = pct.Fire;
                                    baby.ColdResistSeed         = pct.Cold;
                                    baby.EnergyResistSeed       = pct.Nrgy;
                                    baby.PoisonResistSeed       = pct.Pois;
                                    baby.DamageMin              = pct.Dmin;
                                    baby.DamageMax              = pct.Dmax;
                                    baby.MaxLevel               = pct.Mlev;
                                    baby.Generation             = pct.Gen + 1;

                                    baby.Controlled    = true;
                                    baby.ControlMaster = from;
                                    baby.Location      = from.Location;
                                    baby.ControlTarget = from;
                                    baby.Map           = from.Map;
                                    baby.Name          = baby.Name + " baby";

                                    if (pct.AI == 1)
                                    {
                                        baby.AI = AIType.AI_Mage;
                                    }
                                    else if (pct.AI == 2)
                                    {
                                        baby.AI = AIType.AI_Melee;
                                    }

                                    baby.MoveToWorld(from.Location, from.Map);
                                    baby.ControlOrder = OrderType.Follow;

                                    pct.Delete();

                                    return(true);
                                }
                                else
                                {
                                    this.SayTo(from, "Hey! you tring to cheat me! This anit for free buddy.");
                                    from.SendMessage("You lack the gold in your banking account to do this.");
                                    return(false);
                                }
                            }
                            else
                            {
                                this.SayTo(from, "You are not the owner of this deed.");
                                return(false);
                            }
                        }
                    }
                    else
                    {
                        this.SayTo(from, "Please stable or shrink all your pets before we go on.");
                        return(false);
                    }
                }
                else
                {
                    if (pct.Pet != null)
                    {
                        this.SayTo(from, "Your pet {0} is not done mating yet, Please check back later.", pct.Pet.Name);
                        return(false);
                    }
                    else
                    {
                        from.SendMessage("Error in your (Pet Claim Ticket) please contact the staff.");
                        return(false);
                    }
                }
            }
            else
            {
                return(false);
            }
        }
Exemplo n.º 6
0
 public BreedingCancelMenu(Mobile from, PetClaimTicket cancel) : base(0091, 5)
 {
     m_From   = from;
     m_Cancel = cancel;
 }