public override void OnAdded(object parent) { if (parent is Mobile) { if (XmlScript.HasTrigger(this, TriggerName.onEquip) && UberScriptTriggers.Trigger(this, (Mobile)parent, TriggerName.onEquip)) { ((Mobile)parent).AddToBackpack(this); // override, put it in their pack base.OnAdded(parent); return; } if (Server.Engines.XmlSpawner2.XmlAttach.CheckCanEquip(this, (Mobile)parent)) { Server.Engines.XmlSpawner2.XmlAttach.CheckOnEquip(this, (Mobile)parent); } else { ((Mobile)parent).AddToBackpack(this); } } else if (parent is Item) { Item parentItem = (Item)parent; if (XmlScript.HasTrigger(this, TriggerName.onAdded)) { UberScriptTriggers.Trigger(this, parentItem.RootParentEntity as Mobile, TriggerName.onAdded, parentItem); } } base.OnAdded(parent); }
public override void OnDelete() { if (XmlScript.HasTrigger(this, TriggerName.onDelete)) { UberScriptTriggers.Trigger(this, this.RootParentEntity as Mobile, TriggerName.onDelete); } base.OnDelete(); }
public override void OnSpeech(SpeechEventArgs e) { if (XmlScript.HasTrigger(this, TriggerName.onSpeech) && UberScriptTriggers.Trigger(this, e.Mobile, TriggerName.onSpeech, null, e.Speech)) { e.Handled = true; return; } }
public override bool OnMoveOver(Mobile m) { if (XmlScript.HasTrigger(this, TriggerName.onMoveOver) && UberScriptTriggers.Trigger(this, m, TriggerName.onMoveOver)) { return(false); } return(true); }
public override void OnMovement(Mobile m, Point3D oldLocation) { base.OnMovement(m, oldLocation); if (XmlScript.HasTrigger(this, TriggerName.onNearbyMove)) { UberScriptTriggers.Trigger(this, m, TriggerName.onNearbyMove); } }
public override void OnRemoved(object parent) { if (parent is Mobile) { UberScriptTriggers.Trigger(this, (Mobile)parent, TriggerName.onUnequip); } else if (parent is Item) { Item parentItem = (Item)parent; UberScriptTriggers.Trigger(this, parentItem.RootParentEntity as Mobile, TriggerName.onRemove, parentItem); } Server.Engines.XmlSpawner2.XmlAttach.CheckOnRemoved(this, parent); base.OnRemoved(parent); }
public void OnExpiration() { if (XmlScript.HasTrigger(AttachedTo, TriggerName.onExpire)) { UberScriptTriggers.Trigger(AttachedTo, AttachedTo as Mobile, TriggerName.onExpire, AttachedTo as Item); } // with uberscript, I don't really see the need for this anymore /* * // now check for any conditions as well * // check for any condition that must be met for this entry to be processed * if (!BaseXmlSpawner.CheckCondition(ExpireActCondition, null, m_OwnedBy as Mobile)) * return; * * BaseXmlSpawner.ExecuteActions(m_OwnedBy as Mobile, null, ExpireAction); */ }
public override void OnAttach() { base.OnAttach(); AllScripts.Add(this, true); /* * List<string> timerTriggers = ParsedScripts.GetTimerTriggers(ScriptFile, RootNodeIndeces); * if (timerTriggers != null) * { * // subscribe to timers * UberScriptTimedScripts.SubscribeScript(this, timerTriggers); * } * */ UpdateScriptTriggerLookup(); if (XmlScript.HasTrigger(AttachedTo, TriggerName.onCreate)) { TriggerObject trigObject = new TriggerObject(); trigObject.TrigName = TriggerName.onCreate; trigObject.This = AttachedTo; this.Execute(trigObject, true); } if (AttachedTo is BaseCreature) { if (XmlScript.HasTrigger(AttachedTo, TriggerName.onActivate)) { BaseCreature bc = (BaseCreature)AttachedTo; if (bc.AIObject.m_Timer != null && bc.AIObject.m_Timer.Running) { UberScriptTriggers.Trigger(bc, bc, TriggerName.onActivate); } } } }