Example #1
0
        private static void ExecuteDeathAction(Item corpse, Mobile killer, string action)
        {
            if (action == null || action.Length <= 0 || corpse == null)
            {
                return;
            }

            string status_str = null;

            XmlSpawner.SpawnObject TheSpawn = new XmlSpawner.SpawnObject(null, 0);

            TheSpawn.TypeName = action;
            string substitutedtypeName = BaseXmlSpawner.ApplySubstitution(null, corpse, killer, action);
            string typeName            = BaseXmlSpawner.ParseObjectType(substitutedtypeName);

            Point3D loc = corpse.Location;
            Map     map = corpse.Map;

            if (BaseXmlSpawner.IsTypeOrItemKeyword(typeName))
            {
                BaseXmlSpawner.SpawnTypeKeyword(corpse, TheSpawn, typeName, substitutedtypeName, true, killer, loc, map, out status_str);
            }
            else
            {
                // its a regular type descriptor so find out what it is
                Type type = SpawnerType.GetType(typeName);
                try
                {
                    string[] arglist = BaseXmlSpawner.ParseString(substitutedtypeName, 3, "/");
                    object   o       = XmlSpawner.CreateObject(type, arglist[0]);

                    if (o == null)
                    {
                        status_str = "invalid type specification: " + arglist[0];
                    }
                    else
                    if (o is Mobile)
                    {
                        Mobile m = (Mobile)o;
                        if (m is BaseCreature)
                        {
                            BaseCreature c = (BaseCreature)m;
                            c.Home = loc;                                     // Spawners location is the home point
                        }

                        m.Location = loc;
                        m.Map      = map;

                        BaseXmlSpawner.ApplyObjectStringProperties(null, substitutedtypeName, m, killer, corpse, out status_str);
                    }
                    else
                    if (o is Item)
                    {
                        Item item = (Item)o;
                        BaseXmlSpawner.AddSpawnItem(null, corpse, TheSpawn, item, loc, map, killer, false, substitutedtypeName, out status_str);
                    }
                }
                catch { }
            }
        }
        private const int MinRegStackAmount   = 1;         // Minimum amount per reagent.

        public static void Initialize()
        {
            CommandSystem.Register("RegSpawnGen", AccessLevel.Administrator, new CommandEventHandler(RegSpawnGen_OnCommand));

            spawnGarlic = new XmlSpawner.SpawnObject("Garlic", MaxSpawnsPerReagent);
            spawnGarlic.SpawnsPerTick = RegSpawnsPerTick;
            spawnRegs[0] = spawnGarlic;

            spawnGinseng = new XmlSpawner.SpawnObject("Ginseng", MaxSpawnsPerReagent);
            spawnGinseng.SpawnsPerTick = RegSpawnsPerTick;
            spawnRegs[1] = spawnGinseng;

            spawnMandrakeRoot = new XmlSpawner.SpawnObject("MandrakeRoot", MaxSpawnsPerReagent);
            spawnMandrakeRoot.SpawnsPerTick = RegSpawnsPerTick;
            spawnRegs[2] = spawnMandrakeRoot;

            spawnSulfurousAsh = new XmlSpawner.SpawnObject("SulfurousAsh", MaxSpawnsPerReagent);
            spawnSulfurousAsh.SpawnsPerTick = RegSpawnsPerTick;
            spawnRegs[3] = spawnSulfurousAsh;

            spawnSpidersSilk = new XmlSpawner.SpawnObject("SpidersSilk", MaxSpawnsPerReagent);
            spawnSpidersSilk.SpawnsPerTick = RegSpawnsPerTick;
            spawnRegs[4] = spawnSpidersSilk;

            spawnBlackPearl = new XmlSpawner.SpawnObject("BlackPearl", MaxSpawnsPerReagent);
            spawnBlackPearl.SpawnsPerTick = RegSpawnsPerTick;
            spawnRegs[5] = spawnBlackPearl;

            spawnBloodMoss = new XmlSpawner.SpawnObject("BloodMoss", MaxSpawnsPerReagent);
            spawnBloodMoss.SpawnsPerTick = RegSpawnsPerTick;
            spawnRegs[6] = spawnBloodMoss;
        }
Example #3
0
        public static void ConvertRegionSpawners(Region r)
        {
            if (r == null)
            {
                return;
            }

            List <XmlSpawner> list = new List <XmlSpawner>();

            for (var index = 0; index < r.Sectors.Length; index++)
            {
                Sector s = r.Sectors[index];

                for (var index1 = 0; index1 < s.Items.Count; index1++)
                {
                    Item i = s.Items[index1];

                    if (i is XmlSpawner spawner && _SpawnerBounds.Contains(i))
                    {
                        for (var i1 = 0; i1 < spawner.SpawnObjects.Length; i1++)
                        {
                            XmlSpawner.SpawnObject obj = spawner.SpawnObjects[i1];

                            if (obj.TypeName != null)
                            {
                                string name = obj.TypeName.ToLower();

                                if (name == "gazer" || name == "gazerlarva")
                                {
                                    obj.TypeName = "StrangeGazer";
                                }
                                else if (name == "headlessone")
                                {
                                    obj.TypeName = "HeadlessMiner";
                                }
                                else if (name == "harpy")
                                {
                                    obj.TypeName = "DazzledHarpy";
                                }
                                else if (name == "stoneharpy")
                                {
                                    obj.TypeName = "VampireMongbat";
                                }
                            }
                        }

                        list.Add(spawner);
                    }
                }
            }

            for (var index = 0; index < list.Count; index++)
            {
                var spawner = list[index];

                spawner.DoRespawn = true;
            }

            ColUtility.Free(list);
        }
Example #4
0
        private void ExecuteAction(Mobile mob, object target, string action)
        {
            if (action == null || action.Length <= 0)
            {
                return;
            }

            string status_str = null;

            XmlSpawner.SpawnObject TheSpawn = new XmlSpawner.SpawnObject(null, 0);

            TheSpawn.TypeName = action;
            string substitutedtypeName = BaseXmlSpawner.ApplySubstitution(null, target, mob, action);
            string typeName            = BaseXmlSpawner.ParseObjectType(substitutedtypeName);

            Point3D loc = new Point3D(0, 0, 0);
            Map     map = null;


            if (target is Item)
            {
                Item ti = target as Item;
                if (ti.Parent == null)
                {
                    loc = ti.Location;
                    map = ti.Map;
                }
                else if (ti.RootParent is Item)
                {
                    loc = ((Item)ti.RootParent).Location;
                    map = ((Item)ti.RootParent).Map;
                }
                else if (ti.RootParent is Mobile)
                {
                    loc = ((Mobile)ti.RootParent).Location;
                    map = ((Mobile)ti.RootParent).Map;
                }
            }
            else if (target is Mobile)
            {
                Mobile ti = target as Mobile;

                loc = ti.Location;
                map = ti.Map;
            }

            if (BaseXmlSpawner.IsTypeOrItemKeyword(typeName))
            {
                BaseXmlSpawner.SpawnTypeKeyword(target, TheSpawn, typeName, substitutedtypeName, true, mob, loc, map, out status_str);
            }
            else
            {
                // its a regular type descriptor so find out what it is
                Type type = SpawnerType.GetType(typeName);
                try
                {
                    string[] arglist = BaseXmlSpawner.ParseString(substitutedtypeName, 3, "/");
                    object   o       = XmlSpawner.CreateObject(type, arglist[0]);

                    if (o == null)
                    {
                        status_str = "invalid type specification: " + arglist[0];
                    }
                    else
                    if (o is Mobile)
                    {
                        Mobile m = (Mobile)o;
                        if (m is BaseCreature)
                        {
                            BaseCreature c = (BaseCreature)m;
                            c.Home = loc;     // Spawners location is the home point
                        }

                        m.Location = loc;
                        m.Map      = map;

                        BaseXmlSpawner.ApplyObjectStringProperties(null, substitutedtypeName, m, mob, target, out status_str);
                    }
                    else
                    if (o is Item)
                    {
                        Item item = (Item)o;
                        BaseXmlSpawner.AddSpawnItem(null, target, TheSpawn, item, loc, map, mob, false, substitutedtypeName, out status_str);
                    }
                }
                catch { }
            }

            ReportError(mob, status_str);
        }