public override void OnDoubleClick(Mobile from) { if (from.AccessLevel >= AccessLevel.GameMaster) { from.SendGump(new FileSelectionGump(this, from)); } if (!m_HandleDblClick || m_Dialog == null || !Active || m_Users.Contains(from) || !from.CheckAlive(false)) { return; } DialogInit match = null; foreach (DialogInit init in m_Dialog.Init) { if (init.ReactToDoubleClick) { match = init; break; } } if (match != null && match.DoFunctionTrigger(this, from)) { StartConversation(from, match); } }
public override void OnSpeech(SpeechEventArgs e) { if (m_Dialog == null) { return; } DialogInit match = null; foreach (DialogInit init in m_Dialog.Init) { if (init.ReactToKeywords) { foreach (string key in init.Keywords) { if (e.Speech.IndexOf(key) > -1) { match = init; break; } } if (match != null) { break; } } } if (match != null && match.DoFunctionTrigger(this, e.Mobile)) { e.Handled = true; StartConversation(e.Mobile, match); } }
public override void OnMovement(Mobile m, Point3D oldLocation) { if (!m.Player || m_Dialog == null || !m_HandleItem || !Active || m_Users.Contains(m) || !m.CheckAlive(false)) { base.OnMovement(m, oldLocation); return; } // Trigger only when entering the range region: oldLocation not in range and new location in range if (!(this.InRange(m.Location, m_Dialog.Range) && !this.InRange(oldLocation, m_Dialog.Range))) { base.OnMovement(m, oldLocation); return; } DialogInit match = null; foreach (DialogInit init in m_Dialog.Init) { if (init.ReactToItemInBackpack && init.ItemType != null && m.Backpack != null) { Item target = m.Backpack.FindItemByType(init.ItemType, true); if (target != null) { if (target.Amount >= init.AmountBackpack) { match = init; break; } } } } if (match != null && match.DoFunctionTrigger(this, m)) { StartConversation(m, match); } else { base.OnMovement(m, oldLocation); } }
public override bool OnDragDrop(Mobile from, Item dropped) { if (m_Dialog == null || !m_HandleItemGiven || !Active || m_Users.Contains(from)) { this.SayTo(from, "*shakes head*"); return(false); } DialogInit match = null; foreach (DialogInit init in m_Dialog.Init) { if (init.ReactToItemGiven && init.ItemGivenType != null) { if (dropped.GetType() == init.ItemGivenType && dropped.Amount >= init.AmountGiven) { match = init; break; } } } if (match != null && match.DoFunctionTrigger(this, from)) { StartConversation(from, match); // If dropped more than needed, just take what's required if (dropped.Amount > match.AmountGiven) { dropped.Amount -= match.AmountGiven; return(false); } else { return(true); } } else { this.SayTo(from, "*shakes head*"); return(false); } }