当前位置: 首页>>代码示例>>C#>>正文


C# BaseCreature.GetType方法代码示例

本文整理汇总了C#中Server.Mobiles.BaseCreature.GetType方法的典型用法代码示例。如果您正苦于以下问题:C# BaseCreature.GetType方法的具体用法?C# BaseCreature.GetType怎么用?C# BaseCreature.GetType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Server.Mobiles.BaseCreature的用法示例。


在下文中一共展示了BaseCreature.GetType方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: TransferItem

			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;
			}
开发者ID:Crome696,项目名称:ServUO,代码行数:21,代码来源:BaseAI.cs

示例2: IsHerdable

            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;
            }
开发者ID:kamronbatman,项目名称:Defiance-AOS-Pre-2012,代码行数:28,代码来源:ShepherdsCrook.cs

示例3: IsAuthorizedAccount

        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;
        }
开发者ID:greeduomacro,项目名称:UO-Forever,代码行数:39,代码来源:CreaturePossession.cs

示例4: Summon

        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.
        }
开发者ID:greeduomacro,项目名称:hubroot,代码行数:88,代码来源:SpellHelper.cs

示例5: DonatePet

        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.
        }
开发者ID:bittiez,项目名称:ServUO,代码行数:12,代码来源:BaseCollectionMobile.cs

示例6: DUPEMOB

			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;
			}
开发者ID:greeduomacro,项目名称:UO-Forever,代码行数:91,代码来源:UberScriptFunctions.cs

示例7: OnKill

        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;
                }
            }
        }
开发者ID:Crome696,项目名称:ServUO,代码行数:18,代码来源:Objectives.cs

示例8: CopyMobProperties

        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" );
                }
            }
        }
开发者ID:greeduomacro,项目名称:UO-Forever,代码行数:23,代码来源:Dupe.cs

示例9: WriteMobile

 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();
 }
开发者ID:FreeReign,项目名称:aosredux,代码行数:37,代码来源:GenScriptv1_2.cs

示例10: MonsterAttributes

            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];
                }
            }
开发者ID:greeduomacro,项目名称:UO-Forever,代码行数:23,代码来源:CopyMonsterCommand.cs


注:本文中的Server.Mobiles.BaseCreature.GetType方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。