Пример #1
0
 public static void CheckBoss(BaseCreature bc, ref int budget)
 {
     foreach (var entry in Entries)
     {
         if (entry.List.FirstOrDefault(t => t == bc.GetType() || bc.GetType().IsSubclassOf(t)) != null)
         {
             budget += entry.Bonus;
             return;
         }
     }
 }
Пример #2
0
            public static AuraDefinition GetDefinition(BaseCreature bc)
            {
                AuraDefinition def = null;

                for (var index = 0; index < Definitions.Count; index++)
                {
                    var d = Definitions[index];

                    bool any = false;

                    for (var i = 0; i < d.Uses.Length; i++)
                    {
                        var t = d.Uses[i];

                        if (t == bc.GetType())
                        {
                            any = true;
                            break;
                        }
                    }

                    if (any)
                    {
                        def = d;
                        break;
                    }
                }

                if (def == null)
                {
                    return(Definitions[0]); // Default
                }

                return(def);
            }
Пример #3
0
        public int GetDamage(BaseCreature bc)
        {
            if (_DamageCreatures.Any(t => t == bc.GetType()))
            {
                return(50);
            }

            return(0);
        }
Пример #4
0
            public static AuraDefinition GetDefinition(BaseCreature bc)
            {
                var def = Definitions.FirstOrDefault(d => d.Uses.Any(t => t == bc.GetType()));

                if (def == null)
                {
                    return(Definitions[0]);
                }
                return(def);
            }
Пример #5
0
        public int GetDamage(BaseCreature bc)
        {
            for (var index = 0; index < _DamageCreatures.Length; index++)
            {
                var t = _DamageCreatures[index];

                if (t == bc.GetType())
                {
                    return(50);
                }
            }

            return(0);
        }
Пример #6
0
        public virtual void DonatePet(PlayerMobile player, BaseCreature pet)
        {
            for (int i = 0; i < this.m_Donations.Count; i++)
            {
                if (this.m_Donations[i].Type == pet.GetType())
                {
                    pet.Delete();
                    this.Donate(player, this.m_Donations[i], 1);
                    return;
                }
            }

            player.SendLocalizedMessage(1073113); // This Collection is not accepting that type of creature.
        }
Пример #7
0
        public static void OnDeath(BaseCreature bc, Container corpse)
        {
            if (corpse == null || corpse.Map == Map.Internal || corpse.Map == null)
            {
                return;
            }

            Type type = bc.GetType();

            foreach (KeyValuePair <Type, List <DropEntry> > kvp in m_Table)
            {
                if (type == kvp.Key || type.IsSubclassOf(kvp.Key))
                {
                    Region r   = Region.Find(corpse.Location, corpse.Map);
                    Map    map = corpse.Map;

                    if (r != null)
                    {
                        foreach (DropEntry entry in kvp.Value)
                        {
                            if (entry.Region == null || entry.Region == r.Name || entry.Region == map.ToString())
                            {
                                for (int i = 0; i < entry.Amount; i++)
                                {
                                    if (Utility.Random(100) < entry.Probability)
                                    {
                                        Item item = RunicReforging.GenerateRandomItem(bc.LastKiller, bc);

                                        if (item != null)
                                        {
                                            corpse.DropItem(item);
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
Пример #8
0
        public static void Summon( BaseCreature creature, Mobile caster, int sound, TimeSpan duration, bool scaleDuration, bool scaleStats )
        {
            Map map = caster.Map;

            if( map == null )
                return;

            double scale = 1.0 + ((caster.Skills[SkillName.Magery].Value - 100.0) / 200.0);

            if( scaleDuration )
                duration = TimeSpan.FromSeconds(duration.TotalSeconds * scale);

            if ( creature != null && creature.ControlMaster != null && creature.ControlMaster is Player)
            {
                Summoner sum = Perk.GetByType<Summoner>((Player)creature.ControlMaster);

                if (sum != null && sum.Remanence())
                {
                    duration += TimeSpan.FromSeconds(90.0);
                }

            }

            Point3D p = new Point3D(caster);

            if( SpellHelper.FindValidSpawnLocation(map, ref p, true) )
            {
                BaseCreature.Summon(creature, caster, p, sound, duration);

                if (creature != null && creature.ControlMaster != null && creature.ControlMaster is Player)
                {
                    Summoner sum = Perk.GetByType<Summoner>((Player)creature.ControlMaster);

                    if (sum != null && sum.IntelligentDesign())
                    {
                        creature.SetSkill(SkillName.Wrestling, creature.Skills.Wrestling.Value + Utility.RandomMinMax(15, 20));
                        creature.SetSkill(SkillName.Tactics, creature.Skills.Tactics.Value + Utility.RandomMinMax(20, 25));
                        creature.SetSkill(SkillName.MagicResist, creature.Skills.MagicResist.Value + Utility.RandomMinMax(30, 40));
                        creature.SetSkill(SkillName.Meditation, creature.Skills.Meditation.Value + Utility.RandomMinMax(30, 40));
                        creature.SetSkill(SkillName.Magery, creature.Skills.Magery.Value + Utility.RandomMinMax(15, 20));
                        creature.SetSkill(SkillName.EvalInt, creature.Skills.EvalInt.Value + Utility.RandomMinMax(15, 20));
                    }

                    if (sum != null && sum.SecondNature())
                    {
                        creature.HitsMaxSeed += (int)(creature.HitsMaxSeed * 0.33) + Utility.RandomMinMax(20, 40);
                        creature.Hits = creature.HitsMax;
                    }

                    if (sum != null && sum.Horde())
                    {

                        for(int x = 1; x <= 3; x ++)
                        {
                            if (creature.ControlMaster.Followers + creature.ControlSlots <= creature.ControlMaster.FollowersMax)
                            {
                                BaseCreature newSummon;
                                newSummon = Activator.CreateInstance(creature.GetType()) as BaseCreature;

                                if (SpellHelper.FindValidSpawnLocation(map, ref p, true))
                                    BaseCreature.Summon(newSummon, caster, p, sound, duration);

                                if (sum != null && sum.IntelligentDesign())
                                {
                                    newSummon.SetSkill(SkillName.Wrestling, creature.Skills.Wrestling.Value + Utility.RandomMinMax(15, 20));
                                    newSummon.SetSkill(SkillName.Tactics, creature.Skills.Tactics.Value + Utility.RandomMinMax(20, 25));
                                    newSummon.SetSkill(SkillName.MagicResist, creature.Skills.MagicResist.Value + Utility.RandomMinMax(30, 40));
                                    newSummon.SetSkill(SkillName.Meditation, creature.Skills.Meditation.Value + Utility.RandomMinMax(30, 40));
                                    newSummon.SetSkill(SkillName.Magery, creature.Skills.Magery.Value + Utility.RandomMinMax(15, 20));
                                    newSummon.SetSkill(SkillName.EvalInt, creature.Skills.EvalInt.Value + Utility.RandomMinMax(15, 20));
                                }

                                if (sum != null && sum.SecondNature())
                                {
                                    newSummon.HitsMaxSeed += (int)(newSummon.HitsMaxSeed * 0.33) + Utility.RandomMinMax(20, 40);
                                    newSummon.Hits = newSummon.HitsMax;
                                }
                            }
                        }
                    }
                }

                return;
            }

            creature.Delete();
            caster.SendLocalizedMessage(501942); // That location is blocked.
        }
Пример #9
0
        static bool IsAuthorizedAccount(IAccount account, BaseCreature Subject)
        {
            if (account == null) return false;
            
            if (IsAuthorizedStaff(account)) return true;
            
            if (PseudoSeerStone.Instance == null) return false;
            
            Type creaturetype = Subject.GetType();
            //Console.WriteLine("Creature: " + creaturetype.ToString());
            string perms = PseudoSeerStone.Instance.GetPermissionsFor(account);
            //Console.WriteLine("perms: " + perms);
            if (perms == null)
            {
                return false;
            }
            string[] permittedTypeStrings = perms.Split();
            string[] typesegments = (creaturetype.ToString()).Split('.'); // string is something like Server.Mobiles.Orc
            if (typesegments.Length == 0)
            {
                return false;
            }
            //Console.WriteLine("permittedTypeStrings: " + permittedTypeStrings);
            foreach (string permittedTypeString in permittedTypeStrings)
            {
                //Console.WriteLine(permittedTypeString.ToLower() + "=" + typesegments[typesegments.Length - 1] + "?");
                //Console.WriteLine("" + permittedTypeString.ToLower() == typesegments[typesegments.Length - 1].ToLower());
                if (permittedTypeString.ToLower() == typesegments[typesegments.Length - 1].ToLower() || permittedTypeString == "all")
                {
                    return true;
                }

            }
            return false;
            //PossessPermissions reqPerms;
            //if (PermissionDictionary.TryGetValue(creaturetype, out reqPerms))
            //    return (perms & reqPerms) != 0;
           // return false;
        }
Пример #10
0
        public static bool CheckMastery(Mobile tamer, BaseCreature creature)
        {
            var familiar = (BaseCreature)SummonFamiliarSpell.Table[tamer];

            if (familiar != null && !familiar.Deleted && familiar is DarkWolfFamiliar && ControlTypes.Any(t => t == creature.GetType()))
            {
                return(true);
            }

            return(false);
        }
Пример #11
0
        public virtual void DonatePet(PlayerMobile player, BaseCreature pet)
        {
            for (int i = 0; i < this.m_Donations.Count; i ++)
                if (this.m_Donations[i].Type == pet.GetType())
                {
                    pet.Delete();
                    this.Donate(player, this.m_Donations[i], 1);
                    return;
                }

            player.SendLocalizedMessage(1073113); // This Collection is not accepting that type of creature.
        }
            private bool IsHerdable( BaseCreature bc )
            {
                if ( bc.IsParagon )
                    return false;

                if ( bc.Tamable )
                    return true;

                Map map = bc.Map;

                ChampionSpawnRegion region = Region.Find( bc.Home, map ) as ChampionSpawnRegion;

                if ( region != null )
                {
                    ChampionSpawn spawn = region.Spawn;

                    if ( spawn != null && spawn.IsChampionSpawn( bc ) )
                    {
                        Type t = bc.GetType();

                        foreach ( Type type in m_ChampTamables )
                            if ( type == t )
                                return true;
                    }
                }

                return false;
            }
Пример #13
0
 public void WriteMobile(StreamWriter op, BaseCreature m)
 {
     op.WriteLine("using System;");
     op.WriteLine(" ");
     op.WriteLine("namespace Server.Mobiles");
     op.WriteLine("{");
     op.WriteLine(String.Format("    public class {0} : {1}", ClassName, m.GetType().Name));
     op.WriteLine("    {");
     op.WriteLine("        [Constructable]");
     op.WriteLine(String.Format("        public {0}() : base( AIType.{1}, FightMode.{2}, {3}, {4}, {5}, {6} )", ClassName, m.AI.ToString(), m.FightMode.ToString(), m.RangePerception, m.RangeFight, m.ActiveSpeed.ToString("0.0", CultureInfo.InvariantCulture), m.PassiveSpeed.ToString("0.0", CultureInfo.InvariantCulture)));
     op.WriteLine("        {");
     op.WriteLine(String.Format("            this.Name = \"{0}\";", m.Name));
     op.WriteLine(String.Format("            this.Body = {0};", m.BodyValue));
     op.WriteLine(String.Format("            this.Hue = {0};", m.Hue.ToString()));
     op.WriteLine("        }");
     op.WriteLine(" ");
     op.WriteLine(String.Format("        public {0}( Serial serial ) : base( serial )", ClassName));
     op.WriteLine("        {");
     op.WriteLine("        }");
     op.WriteLine(" ");
     op.WriteLine("        public override void Serialize( GenericWriter writer )");
     op.WriteLine("        {");
     op.WriteLine("            base.Serialize( writer );");
     op.WriteLine(" ");
     op.WriteLine("            writer.Write( (int) 0 ); // version");
     op.WriteLine("        }");
     op.WriteLine(" ");
     op.WriteLine("        public override void Deserialize( GenericReader reader )");
     op.WriteLine("        {");
     op.WriteLine("            base.Deserialize( reader );");
     op.WriteLine(" ");
     op.WriteLine("            int version = reader.ReadInt();");
     op.WriteLine("        }");
     op.WriteLine("    }");
     op.WriteLine("}");
     op.Flush();
 }
Пример #14
0
        public static void CopyMobProperties(BaseCreature dest, BaseCreature src)
        {
            PropertyInfo[] props = src.GetType().GetProperties();

            for (int i = 0; i < props.Length; i++)
            {
                try
                {
                    //string name = props[i].Name.ToLower();
                    if (props[i].CanRead && props[i].CanWrite)
                 //       && name != "backpack"
                   //     && name != "bank")
                    {
                        //Console.WriteLine( "Setting {0} = {1}", props[i].Name, props[i].GetValue( src, null ) );
                        props[i].SetValue(dest, props[i].GetValue(src, null), null);
                    }
                }
                catch
                {
                    //Console.WriteLine( "Denied" );
                }
            }
        }
Пример #15
0
            protected override void OnTarget(Mobile from, object targeted)
            {
                if (targeted is BaseCreature)
                {
                    BaseCreature m_Creature = (BaseCreature)targeted;
                    if (!m_Creature.Controled || m_Creature.ControlMaster != from)
                    {
                        m_Trainer.SayTo(from, false, "You've no claim to that animal.");
                    }
                    else if (!m_Creature.Alive || m_Creature == null)
                    {
                        m_Trainer.SayTo(from, false, "They don't look up to the task.");
                    }
                    else if (m_Creature.Female == m_First.Female || m_Creature.GetType() != m_First.GetType())
                    {
                        m_Trainer.SayTo(from, false, "I'm afraid that's biologically impossible.");
                        // DEBUG TEXT
                        //from.SendMessage("{0},{1}",m_First.GetType().ToString(), m_Creature.GetType().ToString());
                    }
                    else if (from.Stabled.Count + 3 >= GetMaxStabled(from))
                    {
                        m_Trainer.SayTo(from, false, "I'm afraid there's no room in the stable to breed these animals.");
                    }
                    else
                    {
                        Type type = m_First.GetType();
                        if (type != null)
                        {
                            try
                            {
                                object o = Activator.CreateInstance(type);

                                if (o is BaseCreature)
                                {
                                    BaseCreature child = (BaseCreature)o;

                                    m_First.ControlTarget = null;
                                    m_First.ControlOrder  = OrderType.Stay;

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

                                    m_First.IsStabled = true;

                                    m_Creature.ControlTarget = null;
                                    m_Creature.ControlOrder  = OrderType.Stay;

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

                                    m_Creature.IsStabled = true;

                                    child.IsStabled = true;

                                    from.Stabled.Add(child);
                                    from.Stabled.Add(m_First);
                                    from.Stabled.Add(m_Creature);
                                    child.BardEndTime      = DateTime.Now.AddDays(1);
                                    m_First.BardEndTime    = DateTime.Now.AddDays(1);
                                    m_Creature.BardEndTime = DateTime.Now.AddDays(1);
                                    child.Internalize();
                                    m_First.Internalize();
                                    m_Creature.Internalize();
                                    TAVUtilities.Reproduce(m_Creature, m_First, child);
                                    from.SendMessage("The animals have been stabled, neither the new born nor the parents may be removed from the stable for 24 hours.");
                                    m_Trainer.SayTo(from, false, "Very well, the animals will be stored in the stable overnight.");
                                }
                            }
                            catch
                            {
                            }
                        }
                    }
                }
                else if (targeted == from)
                {
                    m_Trainer.SayTo(from, 502672); // HA HA HA! Sorry, I am not an inn.
                }
                else
                {
                    m_Trainer.SayTo(from, false, "I'm afraid I wouldn't know anything about that."); // You can't stable that!
                }
            }
Пример #16
0
        public override void OnKill(BaseCreature creature, Container corpse)
        {
            IngredientInfo info = IngredientInfo.Get(this.Ingredient);

            for (int i = 0; i < info.Creatures.Length; i++)
            {
                Type type = info.Creatures[i];

                if (creature.GetType() == type)
                {
                    this.System.From.SendLocalizedMessage(1055043, "#" + info.Name); // You gather a ~1_INGREDIENT_NAME~ from the corpse.

                    this.CurProgress++;

                    break;
                }
            }
        }
Пример #17
0
			public static Mobile DUPEMOB(TriggerObject trigObject, BaseCreature copy, int amount, bool copyItems)
			{
				Type t = copy.GetType();
				BaseCreature output = null;

				//ConstructorInfo[] info = t.GetConstructors();

				ConstructorInfo c = t.GetConstructor(Type.EmptyTypes);

				bool done = false;
				if (c != null)
				{
					for (int i = 0; i < amount; i++)
					{
						object o = c.Invoke(null);

						if (!(o is BaseCreature))
						{
							continue;
						}

						BaseCreature newMob = (BaseCreature)o;
						Dupe.CopyMobProperties(newMob, copy);

						// internalize it while everything is updating 
						newMob.Map = Map.Internal;

						if (copyItems)
						{
							// have to remove all the spawned layers (except backpack) on the mob, so that
							// it doesn't double up when they are duped over

							var toDelete = new List<Item>();

							foreach (Item item in newMob.Items)
							{
								if (item.Layer == Layer.Backpack)
								{
									while (item.Items.Count != 0)
									{
										item.Items[0].Delete();
									}
									continue;
								}

								toDelete.Add(item);
							}

							foreach (Item item in toDelete)
							{
								item.Delete();
							}

							// does not copy bank contents
							foreach (Item inItem in copy.Items)
							{
								if (inItem.Layer == Layer.Bank)
								{
									continue;
								}

								if (inItem.Layer == Layer.Backpack)
								{
									foreach (Item packItem in inItem.Items)
									{
										newMob.Backpack.AddItem(DUPE(trigObject, packItem, false, 1, true));
									}
								}
								else
								{
									newMob.AddItem(DUPE(trigObject, inItem, false, 1));
								}
							}
						}

						newMob.MoveToWorld(copy.Location, copy.Map);

						newMob.InvalidateProperties();
						output = newMob;
					}

					done = true;
				}

				if (!done)
				{
					throw new UberScriptException("DUPEMOB command: tried to dupe object without 0 arg constructor!: " + copy);
				}

				return output;
			}
Пример #18
0
			public TransferItem(BaseCreature creature)
				: base(ShrinkTable.Lookup(creature))
			{
				m_Creature = creature;

				Movable = false;

				if (!Core.AOS)
				{
					Name = creature.Name;
				}
				else if (ItemID == ShrinkTable.DefaultItemID || creature.GetType().IsDefined(typeof(FriendlyNameAttribute), false) ||
						 creature is Reptalon)
				{
					Name = FriendlyNameAttribute.GetFriendlyNameFor(creature.GetType()).ToString();
				}

				//(As Per OSI)No name.  Normally, set by the ItemID of the Shrink Item unless we either explicitly set it with an Attribute, or, no lookup found

				Hue = creature.Hue & 0x0FFF;
			}
Пример #19
0
            public MonsterAttributes(BaseCreature m)
            {
                MonsterType = m.GetType();
                RawStr = m.RawStr;
                RawDex = m.RawDex;
                RawInt = m.RawInt;
                HitsMax = m.HitsMax;
                Mana = m.ManaMax;
                Stam = m.StamMax;
                VirtualArmor = m.VirtualArmor; // not sure if this should be physical resistance?
                DamageMax = m.DamageMax;
                DamageMin = m.DamageMin;
                Hue = m.Hue;
                Name = m.Name;

                SkillInfo[] info = SkillInfo.Table;

                skills = new Skill[info.Length];
                for (int i = 0; i < m.Skills.Length; i++)
                {
                    skills[i] = m.Skills[i];
                }
            }