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 void ExecuteAction(Mobile mob, object target, string action) { if (action == null || action.Length <= 0) { return; } string status_str = null; Server.Mobiles.XmlSpawner.SpawnObject TheSpawn = new Server.Mobiles.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 = Server.Mobiles.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); }