Beispiel #1
0
 private static void ChangeIntelligence(Mobile from, Server.Mobiles.BaseCreature pet, int value)
 {
     if (value < 10 || value > pet.IntMax)
     {
         from.SendMessage("Your pet's intelligence ranges between 10 and {0}.", pet.IntMax);
     }
     else
     {
         if (pet is Server.Mobiles.Dragon)
         {
             pet.RawInt = value;
             pet.ValidateStatCap(Stat.Int);
             from.SendMessage("Your pet's stats have been adjusted.");
         }
         else
         {
             if ((value + pet.RawDex + pet.RawStr) > pet.StatCap)
             {
                 from.SendMessage("Your pet's statcap is {0}. Try setting another stat lower first.", pet.StatCap);
             }
             else
             {
                 pet.RawInt = value;
                 from.SendMessage("Your pet's stats have been adjusted.");
             }
         }
     }
 }
Beispiel #2
0
                protected override void OnTarget(Mobile from, object targeted)
                {
                    Server.Mobiles.BaseCreature pet = targeted as Server.Mobiles.BaseCreature;
                    if (pet == null || pet.ControlMaster != from)
                    {
                        from.SendMessage("That's not your pet!");
                        return;
                    }

                    string[] split = m_Args.Speech.Split(' ');

                    if (split.Length == 3)
                    {
                        try
                        {
                            string name = split[1];
                            //double value = Convert.ToDouble(split[2]);
                            double value;
                            if (double.TryParse(split[2], out value) == false)
                            {
                                from.SendMessage("'{0}' is not a valid value.", split[2]);
                                return;
                            }

                            if (Insensitive.Equals(name, "str"))
                            {
                                ChangeStrength(from, pet, (int)value);
                            }
                            else if (Insensitive.Equals(name, "dex"))
                            {
                                ChangeDexterity(from, pet, (int)value);
                            }
                            else if (Insensitive.Equals(name, "int"))
                            {
                                ChangeIntelligence(from, pet, (int)value);
                            }
                            else
                            {
                                ChangeSkill(from, pet, name, value);
                            }
                        }
                        catch (Exception ex) { EventSink.InvokeLogException(new LogExceptionEventArgs(ex)); }
                    }
                }
Beispiel #3
0
                private static void ChangeSkill(Mobile from, Server.Mobiles.BaseCreature pet, string name, double value)
                {
                    SkillName index;

                    try
                    {
                        index = (SkillName)Enum.Parse(typeof(SkillName), name, true);
                    }
                    catch
                    {
                        from.SendLocalizedMessage(1005631);                         // You have specified an invalid skill to set.
                        return;
                    }

                    Skill skill = pet.Skills[index];

                    if (skill != null)
                    {
                        if (value < 0 || value > skill.Cap)
                        {
                            from.SendMessage(String.Format("Your pet's skill in {0} is capped at {1:F1}.", skill.Info.Name, skill.Cap));
                        }
                        else
                        {
                            int newFixedPoint = (int)(value * 10.0);
                            int oldFixedPoint = skill.BaseFixedPoint;

                            if (((skill.Owner.Total - oldFixedPoint) + newFixedPoint) > skill.Owner.Cap)
                            {
                                from.SendMessage("You can not exceed the skill cap.  Try setting another skill lower first.");
                            }
                            else
                            {
                                skill.BaseFixedPoint = newFixedPoint;
                                from.SendMessage("Your pet's skill has been adjusted.");
                            }
                        }
                    }
                    else
                    {
                        from.SendLocalizedMessage(1005631);                         // You have specified an invalid skill to set.
                    }
                }
Beispiel #4
0
 protected override void OnTarget(Mobile from, object targeted)
 {
     Server.Mobiles.BaseCreature pet = targeted as Server.Mobiles.BaseCreature;
     if (pet != null)
     {
         if (pet.ControlMaster != null)
         {
             from.SendMessage("That creature is already tame.");
             return;
         }
         if (pet.Tamable == false)
         {
             from.SendMessage("that creature cannot be tamed.");
             return;
         }
         pet.ControlMaster = from;
         pet.Controlled    = true;
         from.SendMessage(string.Format("That creature had no choice but to accept you as {0} master.", pet.Female ? "her" : "his"));
     }
 }