protected void DialogsHandler(object sender, ScriptDialogEventArgs e) { if (TrackDialogs == true) { int dialogID = AddPendingDialog(e); string Dmess = e.Message; if (Dmess.Length > 30) { Dmess = Dmess.Substring(0, 30); } string DialogMessage = "NewDialog###" + dialogID.ToString() + "###" + Dmess + "###" + String.Join("~|~", e.ButtonLabels) + ""; if (RelayDialogsToChannel != 0) { CommandsInterface.SmartCommandReply(RelayDialogsToChannel.ToString(), DialogMessage, "NewDialogNotice"); } if (RelayDialogsToAvatar != UUID.Zero) { CommandsInterface.SmartCommandReply(RelayDialogsToAvatar.ToString(), DialogMessage, "NewDialogNotice"); } if (RelayDialogsToHttp != null) { if (RelayDialogsToHttp.StartsWith("http") == true) { CommandsInterface.SmartCommandReply(RelayDialogsToAvatar.ToString(), DialogMessage, "NewDialogNotice"); } } } }
public override void Self_OnScriptDialog(object sender, ScriptDialogEventArgs e) { var objectName = e.ObjectName; var buttons = e.ButtonLabels; EventQueue.Enqueue( () => { client.SendPersonalEvent(SimEventType.SCRIPT, "On-Script-Dialog", e.Message, objectName, e.ImageID, e.ObjectID, e.FirstName, e.LastName, e.Channel, buttons); if (AcceptOffersAnimationsObjects && buttons.Count > 0) { int buttonIndex = (new Random()).Next(buttons.Count); string buttonlabel = buttons[buttonIndex]; int maxTries = buttons.Count * 2; string buttonlabelToLower = buttonlabel.ToLower(); while (maxTries-- > 0 && (buttonlabelToLower.Contains("cancel") || buttonlabelToLower.Contains("ignore") || buttonlabelToLower.Contains("mute"))) { buttonIndex = (new Random()).Next(buttons.Count); buttonlabel = buttons[buttonIndex]; buttonlabelToLower = buttonlabel.ToLower(); } client.Self.ReplyToScriptDialog(e.Channel, buttonIndex, buttonlabel, e.ObjectID); } } ); }
private void onScriptDialog(object sender, ScriptDialogEventArgs e) { if (OCBotMemory.Memory.IgnoreScriptDialogsFrom.Contains(e.OwnerID)) { return; } ScriptDialogSession SDS = new ScriptDialogSession(); SDS.ObjectKey = e.ObjectID; SDS.DialogPrompt = e.Message; SDS.Buttons = e.ButtonLabels; SDS.ObjectName = e.ObjectName; SDS.ReplyChannel = e.Channel; string[] Blocks = SDS.ObjectKey.ToString().Split(new[] { '-' }); int Block2 = Convert.ToInt32("0x" + Blocks[1], 16); Block2 -= SDS.ReplyChannel; OCBSession.Instance.ScriptSessions.Add(Block2, SDS); string BTNStr = ""; int index = 0; foreach (string S in e.ButtonLabels) { BTNStr += index.ToString() + ". " + S + "\n"; index++; } MHE(Destinations.DEST_AGENT, e.OwnerID, $"Hi! I got this script dialog: \n \nDialogID: {Block2}\nChannel: {SDS.ReplyChannel}\nPrompt: {SDS.DialogPrompt}\nButtons: {BTNStr}\n \n[To respond to this dialog use the !reply_prompt command]"); MHE(Destinations.DEST_AGENT, e.OwnerID, $"Note: When responding to the dialog, please use the button IDs infront of the labels, not the actual label!\nFor example: !reply_prompt {Block2} 0"); }
public DialogMenu(ScriptDialogEventArgs e) { buttons = e.ButtonLabels; channel = e.Channel; name = e.ObjectName; uuid = e.ObjectID.ToString(); owner_uuid = e.OwnerID.ToString(); message = e.Message; }
void Self_ScriptDialog(object sender, ScriptDialogEventArgs e) { if (Dialogs.ContainsKey(e.ObjectID)) { Dialogs.Remove(e.ObjectID); } Dialogs.Add(e.ObjectID, new DialogMenu(e)); httpCallback(CallBackEvent.dialog, e.ObjectID.ToString(), Dialogs[e.ObjectID]); total_dialogs = Dialogs.Count; }
protected int AddPendingDialog(ScriptDialogEventArgs e) { int selected = new Random().Next(566678); while (pending_dialogs.ContainsKey(selected)) { selected = new Random().Next(566678); } pending_dialogs.Add(selected, e); pending_dialogs_age.Add(selected, helpers.UnixTimeNow()); return(selected); }
public frmDialogLoadURL(METAboltInstance instance, ScriptDialogEventArgs e) { InitializeComponent(); this.instance = instance; client = this.instance.Client; this.ed = e; timer1.Interval = instance.DialogTimeOut; timer1.Enabled = true; timer1.Start(); this.Text += " " + "[ " + client.Self.Name + " ]"; }
public void Self_ScriptDialog(object sender, ScriptDialogEventArgs e) { Hashtable item = new Hashtable(); item.Add("MessageType", "ScriptDialog"); item.Add("Message", e.Message); item.Add("ObjectName", e.ObjectName); item.Add("ImageID", e.ImageID); item.Add("ObjectID", e.ObjectID); item.Add("FirstName", e.FirstName); item.Add("LastName", e.LastName); item.Add("ChatChannel", e.Channel); item.Add("Buttons", e.ButtonLabels); enqueue(item); }
void Self_ScriptDialog(object sender, ScriptDialogEventArgs e) { if (instance.MainForm.InvokeRequired) { instance.MainForm.BeginInvoke(new MethodInvoker(() => Self_ScriptDialog(sender, e))); return; } // Is this object muted if (null != client.Self.MuteList.Find(m => (m.Type == MuteType.Object && m.ID == e.ObjectID) || // muted object by id (m.Type == MuteType.ByName && m.Name == e.ObjectName) // object muted by name )) { return; } instance.MainForm.AddNotification(new ntfScriptDialog(instance, e.Message, e.ObjectName, e.ImageID, e.ObjectID, e.FirstName, e.LastName, e.Channel, e.ButtonLabels)); }
private void OnScriptDialog(object sender, ScriptDialogEventArgs e) { var mlines = e.Message.Split('\n').Select(i => "[DIALOG] " + i).ToList(); mlines.Insert(0, "[DIALOG] ------------------------------------------"); mlines.Insert(1, string.Format("[DIALOG] {0} {1}'s \"{2}\" ({3})", e.FirstName, e.LastName, e.ObjectName, e.Channel)); mlines.AddRange(e.ButtonLabels.ChunkTrivialBetter(3).Select(i => "[DIALOG] " + string.Join(" ", i.Select(j => string.Format("[{0,-24}]", j)))).Reverse()); mlines.Add("[DIALOG] ------------------------------------------"); foreach (var i in mlines) { var msg = new IntermediateMessage(); msg.Sender = mapper.Grid; msg.Timestamp = DateTime.UtcNow; msg.Type = MessageType.ObjectIM; msg.Payload = i; localChannel.SendMessageDownstream(msg); } }
private void netcom_ScriptDialogReceived(object sender, ScriptDialogEventArgs e) { if (instance.IsObjectMuted(e.ObjectID, e.ObjectName)) return; if (string.IsNullOrEmpty(e.Message)) return; // Count the ones already on display // to avoid flood attacks if (this.instance.DialogCount < 9) { this.instance.DialogCount += 1; } if (this.instance.DialogCount < 9) { (new frmDialogLoadURL(instance, e)).ShowDialog(instance.MainForm); if (this.instance.DialogCount == 8) { UUID objID = e.ObjectID; string objname = e.ObjectName; string objinfo = "\nObject UUID: " + objID; objinfo += "\nObject Name: " + objname; PrintDialogWarning(e.FirstName + " " + e.LastName, objinfo); } } }