Esempio n. 1
0
        public static void GiveArtifactTo(Mobile m)
        {
            if (!(ActivatorUtil.CreateInstance(Artifacts[Utility.Random(Artifacts.Length)]) is Item item))
            {
                return;
            }

            if (m.AddToBackpack(item))
            {
                m.SendLocalizedMessage(1072223); // An item has been placed in your backpack.
                m.SendLocalizedMessage(
                    1062317);                    // For your valor in combating the fallen beast, a special artifact has been bestowed on you.
            }
            else if (m.BankBox.TryDropItem(m, item, false))
            {
                m.SendLocalizedMessage(1072224); // An item has been placed in your bank box.
                m.SendLocalizedMessage(
                    1062317);                    // For your valor in combating the fallen beast, a special artifact has been bestowed on you.
            }
            else
            {
                // Item was placed at feet by m.AddToBackpack
                m.SendLocalizedMessage(1072523); // You find an artifact, but your backpack and bank are too full to hold it.
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Corresponds to CLI "run" keyword. Executes handler specified by run options.
        /// </summary>
        public void Execute()
        {
            Type recordType = ActivatorUtil.ResolveType(Type, ActivatorSettings.Assemblies)
                              ?? throw new ArgumentException($"Type '{Type}' not found");

            // Register type in BsonClassMap if not yet registered.
            // This part is critical for derived types, since collection creation registers only base type.
            if (!BsonClassMap.IsClassMapRegistered(recordType))
            {
                MethodInfo registerMap = typeof(BsonClassMap)
                                         .GetMethod(nameof(BsonClassMap.RegisterClassMap), new Type[] { })
                                         .MakeGenericMethod(recordType);
                registerMap.Invoke(null, new object[] { });
            }

            (Type keyType, Type baseRecordType) = GetRecordTypeArguments(recordType);

            MethodInfo createHandlerMethod = typeof(RunCommand)
                                             .GetMethod(nameof(CreateHandler), BindingFlags.Static | BindingFlags.NonPublic)
                                             .MakeGenericMethod(keyType, baseRecordType, recordType);

            // TODO: changes to db naming should be synchronized with client, afterwards connection should be parsed from source
            string connectionLiteral = "ConnectionString=";

            // Extract ConnectionString from source string
            string[] sourceParams     = Source.Split(',');
            string   connectionString = sourceParams.First(t => t.StartsWith(connectionLiteral)).Substring(connectionLiteral.Length);

            // Convert connection string to db name and hosts
            MongoUrl url = MongoUrl.Create(connectionString);

            // Use case insensitive parsing for the environment type
            var dataSource = new TemporalMongoDataSource
            {
                EnvType     = Enum.Parse <EnvType>(EnvType, true),
                EnvGroup    = EnvGroup,
                EnvName     = EnvName,
                MongoServer = new MongoServerKey {
                    MongoServerUri = $"mongodb://{url.Server}"
                }
            };

            var context = new Context();

            context.DataSource = dataSource;
            context.DataSet    = TemporalId.Empty;

            object record = createHandlerMethod.Invoke(null, new object[] { context, this });

            MethodInfo handlerMethod = record.GetType().GetMethod(Handler)
                                       ?? throw new ArgumentException($"Method '{Handler}' not found");

            // Check that method has [HandlerMethod] attribute before calling it.
            if (handlerMethod.GetCustomAttribute <HandlerMethodAttribute>() == null)
            {
                throw new Exception($"Cannot run {Handler} method, missing [HandlerMethod] attribute.");
            }

            handlerMethod.Invoke(record, ActivatorUtil.CreateParameterValues(handlerMethod, Arguments));
        }
Esempio n. 3
0
        public override void OnResponse(NetState sender, RelayInfo info)
        {
            int index = info.ButtonID - 1;

            if (index >= 0 && index < m_Entries.Length)
            {
                SummonFamiliarEntry entry = m_Entries[index];

                double necro  = m_From.Skills.Necromancy.Value;
                double spirit = m_From.Skills.SpiritSpeak.Value;

                if ((m_From as PlayerMobile)?.DuelContext?.AllowSpellCast(m_From, m_Spell) == false)
                {
                }
                else if (SummonFamiliarSpell.Table.TryGetValue(m_From, out BaseCreature check) && check?.Deleted == false)
                {
                    m_From.SendLocalizedMessage(1061605); // You already have a familiar.
                }
                else if (necro < entry.ReqNecromancy || spirit < entry.ReqSpiritSpeak)
                {
                    // That familiar requires ~1_NECROMANCY~ Necromancy and ~2_SPIRIT~ Spirit Speak.
                    m_From.SendLocalizedMessage(1061606, $"{entry.ReqNecromancy:F1}\t{entry.ReqSpiritSpeak:F1}");

                    m_From.CloseGump <SummonFamiliarGump>();
                    m_From.SendGump(new SummonFamiliarGump(m_From, SummonFamiliarSpell.Entries, m_Spell));
                }
                else if (entry.Type == null)
                {
                    m_From.SendMessage("That familiar has not yet been defined.");

                    m_From.CloseGump <SummonFamiliarGump>();
                    m_From.SendGump(new SummonFamiliarGump(m_From, SummonFamiliarSpell.Entries, m_Spell));
                }
                else
                {
                    try
                    {
                        BaseCreature bc = (BaseCreature)ActivatorUtil.CreateInstance(entry.Type);

                        // TODO: Is this right?
                        bc.Skills.MagicResist.Base = m_From.Skills.MagicResist.Base;

                        if (BaseCreature.Summon(bc, m_From, m_From.Location, -1, TimeSpan.FromDays(1.0)))
                        {
                            m_From.FixedParticles(0x3728, 1, 10, 9910, EffectLayer.Head);
                            bc.PlaySound(bc.GetIdleSound());
                            SummonFamiliarSpell.Table[m_From] = bc;
                        }
                    }
                    catch
                    {
                        // ignored
                    }
                }
            }
            else
            {
                m_From.SendLocalizedMessage(1061825); // You decide not to summon a familiar.
            }
        }
Esempio n. 4
0
        public static Spell NewSpell(int spellID, Mobile caster, Item scroll)
        {
            if (spellID < 0 || spellID >= m_Types.Length)
            {
                return(null);
            }

            var t = m_Types[spellID];

            if (t?.IsSubclassOf(typeof(SpecialMove)) == false)
            {
                m_Params[0] = caster;
                m_Params[1] = scroll;

                try
                {
                    return((Spell)ActivatorUtil.CreateInstance(t, m_Params));
                }
                catch
                {
                    // ignored
                }
            }

            return(null);
        }
Esempio n. 5
0
        public override void OnCast()
        {
            if (CheckSequence())
            {
                try
                {
                    BaseCreature creature = (BaseCreature)ActivatorUtil.CreateInstance(m_Types[Utility.Random(m_Types.Length)]);

                    //creature.ControlSlots = 2;

                    TimeSpan duration;

                    if (Core.AOS)
                    {
                        duration = TimeSpan.FromSeconds(2 * Caster.Skills.Magery.Fixed / 5.0);
                    }
                    else
                    {
                        duration = TimeSpan.FromSeconds(4.0 * Caster.Skills.Magery.Value);
                    }

                    SpellHelper.Summon(creature, Caster, 0x215, duration, false, false);
                }
                catch
                {
                    // ignored
                }
            }

            FinishSequence();
        }
Esempio n. 6
0
            static FormatterCache()
            {
#if UNITY_WSA && !NETFX_CORE
                var attr = (MessagePackFormatterAttribute)typeof(T).GetCustomAttributes(typeof(MessagePackFormatterAttribute), true).FirstOrDefault();
#else
                var attr = typeof(T).GetCustomAttributeX <MessagePackFormatterAttribute>();
#endif
                if (attr == null)
                {
                    return;
                }

                if (attr.FormatterType == MessagePackSerializer.Typeless.TypelessFormatterType ||
                    attr.FormatterType == MessagePackSerializer.Typeless.DefaultTypelessFormatterType)
                {
                    formatter = (IMessagePackFormatter <T>)MessagePackSerializer.Typeless.TypelessFormatter;
                }
                else
                {
                    if (attr.Arguments == null)
                    {
                        formatter = (IMessagePackFormatter <T>)ActivatorUtils.FastCreateInstance(attr.FormatterType);
                    }
                    else
                    {
                        formatter = (IMessagePackFormatter <T>)ActivatorUtil.CreateInstance(attr.FormatterType, attr.Arguments);
                    }
                }
            }
Esempio n. 7
0
        public override void OnCast()
        {
            if (CheckSequence())
            {
                var duration = TimeSpan.FromMinutes(Caster.Skills.Spellweaving.Value / 24 + FocusLevel * 2);
                var summons  = Math.Min(1 + FocusLevel, Caster.FollowersMax - Caster.Followers);

                for (var i = 0; i < summons; i++)
                {
                    BaseCreature bc;

                    try
                    {
                        bc = ActivatorUtil.CreateInstance <T>();
                    }
                    catch
                    {
                        break;
                    }

                    SpellHelper.Summon(bc, Caster, Sound, duration, false, false);
                }

                FinishSequence();
            }
        }
Esempio n. 8
0
            static FormatterCache()
            {
#if (UNITY_METRO || UNITY_WSA) && !NETFX_CORE
                var attr = (JsonFormatterAttribute)typeof(T).GetCustomAttributes(typeof(JsonFormatterAttribute), true).FirstOrDefault();
#else
                var attr = typeof(T).GetCustomAttributeX <JsonFormatterAttribute>();
#endif
                if (attr == null)
                {
                    return;
                }

                try
                {
#if NET40
                    if (attr.FormatterType.IsGenericType && !attr.FormatterType.IsConstructedGenericType())
#else
                    if (attr.FormatterType.IsGenericType && !attr.FormatterType.IsConstructedGenericType)
#endif
                    {
                        var t = attr.FormatterType.GetCachedGenericType(typeof(T)); // use T self
                        formatter = (IJsonFormatter <T>)ActivatorUtil.CreateInstance(t, attr.Arguments);
                    }
                    else
                    {
                        formatter = (IJsonFormatter <T>)ActivatorUtil.CreateInstance(attr.FormatterType, attr.Arguments);
                    }
                }
                catch (Exception ex)
                {
                    throw new InvalidOperationException("Can not create formatter from JsonFormatterAttribute, check the target formatter is public and has constructor with right argument. FormatterType:" + attr.FormatterType.Name, ex);
                }
            }
Esempio n. 9
0
        public virtual void SpawnDelivery(Container pack)
        {
            if (!SpawnsDelivery || pack == null)
            {
                return;
            }

            List <Item> delivery = new List <Item>();

            for (int i = 0; i < Amount; ++i)
            {
                if (!(ActivatorUtil.CreateInstance(Delivery) is Item item))
                {
                    continue;
                }

                delivery.Add(item);

                if (item.Stackable && Amount > 1)
                {
                    item.Amount = Amount;
                    break;
                }
            }

            foreach (Item item in delivery)
            {
                pack.DropItem(item); // Confirmed: on OSI items are added even if your pack is full
            }
        }
Esempio n. 10
0
        private static void ProcessDirectory(Context context, string path, TemporalId parentDataset)
        {
            var dirName = Path.GetFileName(path);

            // Do not create dataset for Common
            var currentDataset = dirName != "Common"
                                     ? context.CreateDataSet(dirName)
                                     : parentDataset;

            foreach (var csvFile in Directory.GetFiles(path, "*.csv"))
            {
                var  type       = Path.GetFileNameWithoutExtension(csvFile);
                Type recordType = ActivatorUtil.ResolveType(type, ActivatorSettings.Assemblies)
                                  ?? throw new ArgumentException($"Type '{type}' not found");

                MethodInfo convertToMongo = typeof(CsvConvertCommand)
                                            .GetMethod(nameof(ConvertCsvToMongo), BindingFlags.Static | BindingFlags.NonPublic)
                                            ?.MakeGenericMethod(recordType);

                convertToMongo?.Invoke(null, new object[] { context, currentDataset, csvFile });
            }

            var directories = Directory.GetDirectories(path);

            foreach (string directory in directories)
            {
                ProcessDirectory(context, directory, currentDataset);
            }
        }
Esempio n. 11
0
        public override void OnHarvestFinished(
            Mobile from, Item tool, HarvestDefinition def, HarvestVein vein,
            HarvestBank bank, HarvestResource resource, object harvested
            )
        {
            if (tool is GargoylesPickaxe && def == OreAndStone && Utility.RandomDouble() < 0.1)
            {
                var res = vein.PrimaryResource;

                if (res == resource && res.Types.Length >= 3)
                {
                    try
                    {
                        var map = from.Map;

                        if (map == null)
                        {
                            return;
                        }

                        if (ActivatorUtil.CreateInstance(res.Types[2], 25) is BaseCreature spawned)
                        {
                            var offset = Utility.Random(8) * 2;

                            for (var i = 0; i < m_Offsets.Length; i += 2)
                            {
                                var x = from.X + m_Offsets[(offset + i) % m_Offsets.Length];
                                var y = from.Y + m_Offsets[(offset + i + 1) % m_Offsets.Length];

                                if (map.CanSpawnMobile(x, y, from.Z))
                                {
                                    spawned.OnBeforeSpawn(new Point3D(x, y, from.Z), map);
                                    spawned.MoveToWorld(new Point3D(x, y, from.Z), map);
                                    spawned.Combatant = from;
                                    return;
                                }

                                var z = map.GetAverageZ(x, y);

                                if (Math.Abs(z - from.Z) < 10 && map.CanSpawnMobile(x, y, z))
                                {
                                    spawned.OnBeforeSpawn(new Point3D(x, y, z), map);
                                    spawned.MoveToWorld(new Point3D(x, y, z), map);
                                    spawned.Combatant = from;
                                    return;
                                }
                            }

                            spawned.OnBeforeSpawn(from.Location, from.Map);
                            spawned.MoveToWorld(from.Location, from.Map);
                            spawned.Combatant = from;
                        }
                    }
                    catch
                    {
                        // ignored
                    }
                }
            }
        }
Esempio n. 12
0
        public static Spell NewSpell(string name, Mobile caster, Item scroll)
        {
            name = name.Replace(" ", "");

            for (var i = 0; i < m_CircleNames.Length; ++i)
            {
                var t =
                    AssemblyHandler.FindFirstTypeForName($"Server.Spells.{m_CircleNames[i]}.{name}", true) ??
                    AssemblyHandler.FindFirstTypeForName($"Server.Spells.{m_CircleNames[i]}.{name}Spell", true);

                if (t?.IsSubclassOf(typeof(SpecialMove)) == false)
                {
                    m_Params[0] = caster;
                    m_Params[1] = scroll;

                    try
                    {
                        return((Spell)ActivatorUtil.CreateInstance(t, m_Params));
                    }
                    catch
                    {
                        // ignored
                    }
                }
            }

            return(null);
        }
Esempio n. 13
0
        public override int CanCraft(Mobile from, BaseTool tool, Type typeItem)
        {
            if (tool?.Deleted != false || tool.UsesRemaining < 0)
            {
                return(1044038); // You have worn out your tool!
            }
            if (!BaseTool.CheckAccessible(tool, from))
            {
                return(1044263); // The tool must be on your person to use.
            }
            if (typeItem != null)
            {
                object o = ActivatorUtil.CreateInstance(typeItem);

                if (o is SpellScroll scroll)
                {
                    bool hasSpell = Spellbook.Find(from, scroll.SpellID)?.HasSpell(scroll.SpellID) == true;

                    scroll.Delete();

                    return(hasSpell ? 0 : 1042404); // null : You don't have that spell!
                }

                if (o is Item item)
                {
                    item.Delete();
                }
            }

            return(0);
        }
Esempio n. 14
0
        public static int ItemIDOf(Type type)
        {
            if (_itemIds.TryGetValue(type, out int itemId))
            {
                return(itemId);
            }

            if (type == typeof(FactionExplosionTrap))
            {
                itemId = 14034;
            }
            else if (type == typeof(FactionGasTrap))
            {
                itemId = 4523;
            }
            else if (type == typeof(FactionSawTrap))
            {
                itemId = 4359;
            }
            else if (type == typeof(FactionSpikeTrap))
            {
                itemId = 4517;
            }

            if (itemId == 0)
            {
                object[] attrs = type.GetCustomAttributes(typeof(CraftItemIDAttribute), false);

                if (attrs.Length > 0)
                {
                    CraftItemIDAttribute craftItemID = (CraftItemIDAttribute)attrs[0];
                    itemId = craftItemID.ItemID;
                }
            }

            if (itemId == 0)
            {
                Item item = null;

                try
                {
                    item = ActivatorUtil.CreateInstance(type) as Item;
                }
                catch
                {
                    // ignored
                }

                if (item != null)
                {
                    itemId = item.ItemID;
                    item.Delete();
                }
            }

            _itemIds[type] = itemId;

            return(itemId);
        }
Esempio n. 15
0
        protected override void Init()
        {
            Item item = (Item)ActivatorUtil.CreateInstance(Type);

            m_Height = item.ItemData.Height;

            item.Delete();
        }
        public void ObjectActivatorTest1()
        {
            var personActivator = ActivatorUtil.GetActivator <Person>("name", 123);
            var person          = personActivator("name", 123);

            Assert.AreEqual(person.Name, "name");
            Assert.AreEqual(person.Age, 123);
        }
Esempio n. 17
0
        public override void OnResponse(NetState sender, RelayInfo info)
        {
            var index = info.ButtonID - 1;

            if (index >= 0 && index < m_SellList.Length)
            {
                var buyInfo = m_SellList[index];

                var balance = Banker.GetBalance(m_From);

                var isFemale = m_From.Female || m_From.Body.IsFemale;

                if (buyInfo.FacialHair && isFemale)
                {
                    m_Vendor.PrivateOverheadMessage(MessageType.Regular, 0x3B2, 1010639, m_From.NetState);
                }
                else if (balance >= buyInfo.Price)
                {
                    try
                    {
                        var origArgs = buyInfo.GumpArgs;
                        var args     = new object[origArgs.Length];

                        for (var i = 0; i < args.Length; ++i)
                        {
                            if (origArgs[i] == CustomHairstylist.Price)
                            {
                                args[i] = m_SellList[index].Price;
                            }
                            else if (origArgs[i] == CustomHairstylist.From)
                            {
                                args[i] = m_From;
                            }
                            else if (origArgs[i] == CustomHairstylist.Vendor)
                            {
                                args[i] = m_Vendor;
                            }
                            else
                            {
                                args[i] = origArgs[i];
                            }
                        }

                        var g = ActivatorUtil.CreateInstance(buyInfo.GumpType, args) as Gump;

                        m_From.SendGump(g);
                    }
                    catch
                    {
                        // ignored
                    }
                }
                else
                {
                    m_Vendor.PrivateOverheadMessage(MessageType.Regular, 0x3B2, 1042293, m_From.NetState);
                }
            }
        }
Esempio n. 18
0
        protected override void Init()
        {
            Mobile mob = (Mobile)ActivatorUtil.CreateInstance(Type);

            m_Land  = !mob.CantWalk;
            m_Water = mob.CanSwim;

            mob.Delete();
        }
Esempio n. 19
0
 public BaseFactionVendor Construct(Town town, Faction faction)
 {
     try
     {
         return(ActivatorUtil.CreateInstance(Definition.Type, town, faction) as BaseFactionVendor);
     }
     catch
     {
         return(null);
     }
 }
 public StaticNullableFormatter(Type formatterType, object[] formatterArguments)
 {
     try
     {
         underlyingFormatter = (IJsonFormatter <T>)ActivatorUtil.CreateInstance(formatterType, formatterArguments);
     }
     catch (Exception ex)
     {
         throw new InvalidOperationException("Can not create formatter from JsonFormatterAttribute, check the target formatter is public and has constructor with right argument. FormatterType:" + formatterType.Name, ex);
     }
 }
Esempio n. 21
0
 private static object Construct(Type type)
 {
     try
     {
         return(ActivatorUtil.CreateInstance(type));
     }
     catch
     {
         return(null);
     }
 }
Esempio n. 22
0
 public static Item Construct(Type type)
 {
     try
     {
         return(ActivatorUtil.CreateInstance(type) as Item);
     }
     catch
     {
         return(null);
     }
 }
Esempio n. 23
0
 public BaseFactionGuard Construct()
 {
     try
     {
         return(ActivatorUtil.CreateInstance(Definition.Type) as BaseFactionGuard);
     }
     catch
     {
         return(null);
     }
 }
Esempio n. 24
0
        public static void GiveArtifactTo(Mobile m)
        {
            Item item = (Item)ActivatorUtil.CreateInstance(Artifacts[Utility.Random(Artifacts.Length)]);

            if (m.AddToBackpack(item))
            {
                m.SendMessage("As a reward for slaying the mighty paragon, an artifact has been placed in your backpack.");
            }
            else
            {
                m.SendMessage(
                    "As your backpack is full, your reward for destroying the legendary paragon has been placed at your feet.");
            }
        }
Esempio n. 25
0
        public Item Create()
        {
            Item item;

            try
            {
                item = (Item)ActivatorUtil.CreateInstance(Type);
            }
            catch
            {
                item = null;
            }

            return(item);
        }
Esempio n. 26
0
        private static void Unload(Mobile from, INinjaWeapon weapon)
        {
            if (weapon.UsesRemaining > 0)
            {
                INinjaAmmo ammo = ActivatorUtil.CreateInstance(weapon.AmmoType, weapon.UsesRemaining) as INinjaAmmo;

                ammo.Poison        = weapon.Poison;
                ammo.PoisonCharges = weapon.PoisonCharges;

                from.AddToBackpack((Item)ammo);

                weapon.UsesRemaining = 0;
                weapon.PoisonCharges = 0;
                weapon.Poison        = null;
            }
        }
Esempio n. 27
0
        public static void LoadRegions()
        {
            var path = Path.Join(Core.BaseDirectory, "Data/regions.json");

            // Json Deserialization options for custom objects
            JsonSerializerOptions options = new JsonSerializerOptions();

            options.Converters.Add(new MapConverterFactory());
            options.Converters.Add(new Point3DConverterFactory());
            options.Converters.Add(new Rectangle3DConverterFactory());

            List <string> failures = new List <string>();
            int           count    = 0;

            Console.Write("Regions: Loading...");

            var stopwatch = Stopwatch.StartNew();
            List <DynamicJson> regions = JsonConfig.Deserialize <List <DynamicJson> >(path);

            foreach (var json in regions)
            {
                Type type = AssemblyHandler.FindFirstTypeForName(json.Type);

                if (type == null || !typeof(Region).IsAssignableFrom(type))
                {
                    failures.Add($"\tInvalid region type {json.Type}");
                    continue;
                }

                var region = ActivatorUtil.CreateInstance(type, json, options) as Region;
                region?.Register();
                count++;
            }

            stopwatch.Stop();

            Console.ForegroundColor = failures.Count > 0 ? ConsoleColor.Yellow : ConsoleColor.Green;
            Console.Write("done{0}. ", failures.Count > 0 ? " with failures" : "");
            Console.ResetColor();
            Console.WriteLine("({0} regions, {1} failures) ({2:F2} seconds)", count, failures.Count, stopwatch.Elapsed.TotalSeconds);
            if (failures.Count > 0)
            {
                Console.ForegroundColor = ConsoleColor.Red;
                Console.WriteLine(string.Join("\n", failures));
                Console.ResetColor();
            }
        }
Esempio n. 28
0
        public override void OnDoubleClick(Mobile from)
        {
            if (Utility.InRange(from.Location, Location, 2))
            {
                try
                {
                    if (NextSpawn < DateTime.UtcNow)
                    {
                        Map          map = Map;
                        BaseCreature bc  =
                            (BaseCreature)ActivatorUtil.CreateInstance(Creatures[Utility.Random(Creatures.Length)]);

                        Point3D spawnLoc = GetSpawnPosition();

                        DoEffect(spawnLoc, map);

                        Timer.DelayCall(TimeSpan.FromSeconds(1), delegate
                        {
                            bc.Home      = Location;
                            bc.RangeHome = SpawnRange;
                            bc.FightMode = FightMode.Closest;

                            bc.MoveToWorld(spawnLoc, map);

                            DoEffect(spawnLoc, map);

                            bc.ForceReacquire();
                        });

                        NextSpawn = DateTime.UtcNow + NextSpawnDelay;
                    }
                    else
                    {
                        PublicOverheadMessage(MessageType.Regular, 0x3B2,
                                              500760); // The brazier fizzes and pops, but nothing seems to happen.
                    }
                }
                catch
                {
                    // ignored
                }
            }
            else
            {
                from.SendLocalizedMessage(500446); // That is too far away.
            }
        }
Esempio n. 29
0
    public Item Construct()
    {
      try
      {
        Item item = ActivatorUtil.CreateInstance(ItemType, Args) as Item;

        if (item is IRewardItem rewardItem)
          rewardItem.IsRewardItem = true;

        return item;
      }
      catch
      {
        // ignored
      }

      return null;
    }
Esempio n. 30
0
        public virtual Item CreateItem()
        {
            Item spawnedItem = null;

            try
            {
                spawnedItem = ActivatorUtil.CreateInstance(m_Type) as Item;
            }
            catch (Exception e)
            {
                if (MLQuestSystem.Debug)
                {
                    Console.WriteLine("WARNING: ItemReward.CreateItem failed for {0}: {1}", m_Type, e);
                }
            }

            return(spawnedItem);
        }