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 { } } }
public override void OnDoubleClick(Mobile from) { if (from == null) { return; } if (!from.InRange(GetWorldLocation(), 2) || !from.InLOS(this)) { from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 1019045); // I can't reach that. return; } string status_str; // test the combination and apply the property to the target item if (Matched) { //from.PlaySound(m_CombinationSound); try { Effects.PlaySound(Location, Map, m_CombinationSound); } catch { } BaseXmlSpawner.ApplyObjectStringProperties(null, m_TargetProperty, m_TargetItem, from, this, out status_str); } }
public override void OnDoubleClick(Mobile from) { if (from == null) { return; } if (!from.InRange(GetWorldLocation(), 2) || !from.InLOS(this)) { from.SendLocalizedMessage(500446); // That is too far away. return; } string status_str; // test the combination and apply the property to the target item if (Matched) { //from.PlaySound(m_CombinationSound); try { Effects.PlaySound(Location, Map, m_CombinationSound); } catch { } BaseXmlSpawner.ApplyObjectStringProperties(null, m_TargetProperty, m_TargetItem, from, this, out status_str); } }
public virtual void OnEnter(Mobile m) { string status_str; m.PlaySound(SwitchSound); BaseXmlSpawner.ApplyObjectStringProperties(null, m_TargetProperty1, m_TargetItem1, m, this, out status_str); }
public virtual void OnEnter(Mobile m) { string status_str; m.PlaySound(SwitchSound); BaseXmlSpawner.ApplyObjectStringProperties(null, m_TargetProperty1, m_TargetItem1, m, this, out status_str); if (m is BaseCreature || m is PlayerMobile) { m.FixedParticles(0x36BD, 20, 10, 5044, EffectLayer.Head); m.PlaySound(0x307); m.DoHarmful(m, true); m.Damage(Utility.Random(30, 75)); if (m is PlayerMobile) { ; } { m.SendMessage(38, "You stepped on a mine!"); } this.Delete(); } }
public void Activate(Mobile from, int state, ArrayList links) { if (Disabled) { return; } string status_str = null; if (state < 0) { state = 0; } if (state > 1) { state = 1; } if (base.State != state) { // apply the offset SetSwitchOffset(); } // assign the latch state and start the timer base.State = state; // update the graphic SetSwitchStatic(); // play the switching sound //if (from != null) //{ // from.PlaySound(m_SwitchSound); //} try { Effects.PlaySound(Location, Map, m_SwitchSound); } catch { } // if a target object has been specified then apply the property modification if (state == 0 && m_TargetItem0 != null && !m_TargetItem0.Deleted && m_TargetProperty0 != null && m_TargetProperty0.Length > 0) { BaseXmlSpawner.ApplyObjectStringProperties(null, m_TargetProperty0, m_TargetItem0, null, this, out status_str); } if (state == 1 && m_TargetItem1 != null && !m_TargetItem1.Deleted && m_TargetProperty1 != null && m_TargetProperty1.Length > 0) { BaseXmlSpawner.ApplyObjectStringProperties(null, m_TargetProperty1, m_TargetItem1, null, this, out status_str); } // if the switch is linked, then activate the link as well if (Link != null && Link is ILinkable) { if (links == null) { links = new ArrayList(); } // activate other linked objects if they have not already been activated if (!links.Contains(this)) { links.Add(this); ((ILinkable)Link).Activate(from, state, links); } } // report any problems to staff if (status_str != null && from != null && from.AccessLevel > AccessLevel.Player) { from.SendMessage("{0}", status_str); } }
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); }
public virtual void OnExit(Mobile m) { string status_str; BaseXmlSpawner.ApplyObjectStringProperties(null, m_TargetProperty0, m_TargetItem0, m, this, out status_str); }
public void Activate(Mobile from, int state, ArrayList links) { if (this.Disabled) { return; } string status_str = null; // assign the lever state this.m_LeverState = state; if (this.m_LeverState < 0) { this.m_LeverState = 0; } if (this.m_LeverState > 1 && this.m_LeverType == leverType.Two_State) { this.m_LeverState = 1; } if (this.m_LeverState > 2) { this.m_LeverState = 2; } // update the graphic this.SetLeverStatic(); // play the switching sound if possible //if (from != null) //{ // from.PlaySound(m_LeverSound); //} try { Effects.PlaySound(this.Location, this.Map, this.m_LeverSound); } catch { } // if a target object has been specified then apply the property modification if (this.m_LeverState == 0 && this.m_TargetItem0 != null && !this.m_TargetItem0.Deleted && this.m_TargetProperty0 != null && this.m_TargetProperty0.Length > 0) { BaseXmlSpawner.ApplyObjectStringProperties(null, this.m_TargetProperty0, this.m_TargetItem0, from, this, out status_str); } if (this.m_LeverState == 1 && this.m_TargetItem1 != null && !this.m_TargetItem1.Deleted && this.m_TargetProperty1 != null && this.m_TargetProperty1.Length > 0) { BaseXmlSpawner.ApplyObjectStringProperties(null, this.m_TargetProperty1, this.m_TargetItem1, from, this, out status_str); } if (this.m_LeverState == 2 && this.m_TargetItem2 != null && !this.m_TargetItem2.Deleted && this.m_TargetProperty2 != null && this.m_TargetProperty2.Length > 0) { BaseXmlSpawner.ApplyObjectStringProperties(null, this.m_TargetProperty2, this.m_TargetItem2, from, this, out status_str); } // if the switch is linked, then activate the link as well if (this.Link != null && this.Link is ILinkable) { if (links == null) { links = new ArrayList(); } // activate other linked objects if they have not already been activated if (!links.Contains(this)) { links.Add(this); ((ILinkable)this.Link).Activate(from, state, links); } } // report any problems to staff if (status_str != null && from != null && from.IsStaff()) { from.SendMessage("{0}", status_str); } }