示例#1
0
        void SaveFriends(object sender, MVControlEventArgs e)
        {
            try
            {
                int NewFriendly = Convert.ToInt32(NewFriendBox.Text.Trim());

                if (!Friends.TryGetValue(NewFriendly, out int IsFriendly))
                {
                    PlayerListRemove(NewFriendly);
                    Friends.Add(NewFriendly, NewFriendly);

                    try
                    {
                        string filename = MyAppPath.Trim() + "friends.cfg";
                        using (StreamWriter sw = new StreamWriter(@filename, true))
                            sw.WriteLine(NewFriendBox.Text);
                    }
                    catch (Exception ex) { Util.LogError(ex); }

                    NewFriendBox.Text = null;

                    Util.WriteToChat("New friendly added!");
                }
                else
                {
                    Util.WriteToChat("Oops... " + IsFriendly.ToString() + " might already be in friends.cfg?");
                }
            }
            catch (Exception ex)
            {
                Util.WriteToChat("Invalid integer? Check the log.");
                Util.LogError(ex);
            }
        }
示例#2
0
        void btnChatTriggerAdd_Click(object sender, MVControlEventArgs e)
        {
            try
            {
                if (edtChatTriggerPattern.Text.Length <= 0)
                {
                    throw new Exception("You have to enter a Pattern for your ChatTrigger.");
                }

                ChatTrigger trigger = new ChatTrigger(
                    edtChatTriggerPattern.Text,
                    (Webhook)chcChatTriggerWebhook.Data[chcChatTriggerWebhook.Selected],
                    edtChatTriggerMessage.Text,
                    true);

                ChatTriggers.Add(trigger);

                RefreshChatTriggerList();
                SaveSettings();
            }
            catch (Exception ex)
            {
                Util.WriteToChat("Error adding new ChatTrigger: " + ex.Message);
                Util.LogError(ex);
            }
        }
示例#3
0
        void btnTimedTriggerAdd_Click(object sender, MVControlEventArgs e)
        {
            try
            {
                if (int.Parse(edtTimedTriggerMinutes.Text) <= 0)
                {
                    throw new Exception("Value for Minutes must be a whole number greater than 0.");
                }

                if (edtTimedTriggerMessage.Text.Length <= 0)
                {
                    throw new Exception("You have to enter a Message for your Timer.");
                }

                TimedTrigger trigger = new TimedTrigger(
                    int.Parse(edtTimedTriggerMinutes.Text),
                    (Webhook)chcTimedTriggerWebhook.Data[chcTimedTriggerWebhook.Selected],
                    edtTimedTriggerMessage.Text,
                    true);

                TimedTriggers.Add(trigger);

                RefreshTimedTriggerList();
                SaveSettings();
            }
            catch (Exception ex)
            {
                Util.WriteToChat("Error adding new Timer: " + ex.Message);
                Util.LogError(ex);
            }
        }
示例#4
0
 void DoesNothing_Click(object sender, MVControlEventArgs e)
 {
     try
     {
     }
     catch (Exception ex) { Util.LogError(ex); }
 }
示例#5
0
 void DoesNothing_Click(object sender, MVControlEventArgs e)
 {
     /*
      * try
      * {
      *
      * }
      * catch (Exception ex) { Util.LogError(ex); }
      */
 }
示例#6
0
 void QuestRefresh_Click(object sender, MVControlEventArgs e)
 {
     qt.GetMyQuestsList();
     //RedrawQuests();
     //foreach (var quest in Quests)
     //{
     //    //_allQuestsView.AddQuest(quest);
     //}
     //QuestRedrawTimer_Elapsed(null, null);
 }
示例#7
0
 void ToggleAttack_Click(object sender, MVControlEventArgs e)
 {
     /*
      * try
      * {
      *  Util.WriteToChat("ToggleAttack");
      *
      *  if (Globals.Host.Actions.CombatMode == CombatState.Peace)
      *      Globals.Host.Actions.SetCombatMode(CombatState.Melee);
      *  else
      *      Globals.Host.Actions.SetCombatMode(CombatState.Peace);
      * }
      * catch (Exception ex) { Util.LogError(ex); }
      */
 }
示例#8
0
        void UseSelectedItem_Click(object sender, MVControlEventArgs e)
        {
            try
            {
                if (Globals.Host.Actions.CurrentSelection == 0 || Globals.Core.WorldFilter[Globals.Host.Actions.CurrentSelection] == null)
                {
                    Util.WriteToChat("UseSelectedItem no item selected");

                    return;
                }

                Util.WriteToChat("UseSelectedItem " + Globals.Core.WorldFilter[Globals.Host.Actions.CurrentSelection].Name);

                Globals.Host.Actions.UseItem(Globals.Host.Actions.CurrentSelection, 0);
            }
            catch (Exception ex) { Util.LogError(ex); }
        }
示例#9
0
        void SaveConfig(object sender, MVControlEventArgs e)
        {
            try
            {
                string       filename = MyAppPath.Trim() + Core.CharacterFilter.Name.Trim().ToLower() + ".cfg";
                StreamWriter sw       = new StreamWriter(filename);
                sw.WriteLine("logout=" + PKLogout.ToString().ToLower());
                sw.WriteLine("death=" + DeathLogout.ToString().ToLower());
                sw.WriteLine("vitae=" + Vitae.ToString().ToLower());
                sw.WriteLine("comps=" + LowComps.ToString().ToLower());
                sw.WriteLine("alert=" + PKAlert.ToString().ToLower());
                sw.WriteLine("altF4=" + AltF4.ToString().ToLower());
                sw.WriteLine("sound=" + PlaySounds.ToString().ToLower());
                sw.Close();
            }
            catch (Exception ex) { Util.LogError(ex); }

            Util.WriteToChat("Saved to: " + Core.CharacterFilter.Name.Trim().ToLower() + ".cfg");
        }
示例#10
0
        void btnWebhookAdd_Click(object sender, MVControlEventArgs e)
        {
            try
            {
                // Webhooks need names
                if (edtName.Text.Length <= 0)
                {
                    throw new Exception("Webhooks need to have names.");
                }

                // Either the URL or the PayloadFormatString should have an @ symbol, but just warn
                if (!(edtName.Text.Contains("@") || edtPayload.Text.Contains("@")))
                {
                    Util.WriteToChat("Warning: Neither your URL or JSON had an @ symbol in them which means your webhooks will trigger without a message.");
                }

                // Stop if the name isn't unique
                if (Webhooks != null && Webhooks.Count > 0)
                {
                    List <Webhook> found = Webhooks.FindAll(w => w.Name == edtName.Text);

                    if (found.Count > 0)
                    {
                        throw new Exception("A webhook with this name already exists");
                    }
                }

                Webhook webhook = new Webhook(edtName.Text, edtURL.Text, (string)chcMethod.Data[chcMethod.Selected], edtPayload.Text);
                Webhooks.Add(webhook);

                RefreshWebhooksList();
                RefreshEventTriggerWebhookChoice();
                RefreshTimedTriggerWebhookChoice();
                RefreshChatTriggerWebhookChoice();
                SaveSettings();
            }
            catch (Exception ex)
            {
                Util.WriteToChat("Error adding new Webhook: " + ex.Message);
                Util.LogError(ex);
            }
        }
示例#11
0
        void btnEventTriggerAdd_Click(object sender, MVControlEventArgs e)
        {
            try
            {
                EventTrigger trigger = new EventTrigger(
                    (string)chcEventTriggerEvent.Data[chcEventTriggerEvent.Selected],
                    (Webhook)chcEventsWebhook.Data[chcEventsWebhook.Selected],
                    edtEventsMessage.Text,
                    true);

                EventTriggers.Add(trigger);

                RefreshEventTriggerList();
                SaveSettings();
            }
            catch (Exception ex)
            {
                Util.WriteToChat("Error adding new EventTrigger: " + ex.Message);
                Util.LogError(ex);
            }
        }
示例#12
0
        void EditQuestSave_Click(object sender, MVControlEventArgs e)
        {
            var updatedQuest     = questForEdit != null ? questForEdit : new Quest();
            var Name             = ((HudTextBox)questView["EditQuestName"]).Text;
            var LevelRequirement = ((HudTextBox)questView["EditQuestLevelRequirement"]).Text;
            var Description      = ((HudTextBox)questView["EditQuestDescription"]).Text;
            var Notes            = ((HudTextBox)questView["EditQuestNotes"]).Text;
            var QuestFlags       = ((HudTextBox)questView["EditQuestQuestFlags"]).Text;
            var Route            = ((HudTextBox)questView["EditQuestRoute"]).Text;
            var Priority         = ((HudTextBox)questView["EditQuestPriority"]).Text;
            var XpReward         = ((HudTextBox)questView["EditQuestXpReward"]).Text;
            var LuminanceReward  = ((HudTextBox)questView["EditQuestLuminanceReward"]).Text;
            var KeyReward        = ((HudTextBox)questView["EditQuestKeyReward"]).Text;

            try
            {
                updatedQuest.Name             = Name;
                updatedQuest.LevelRequirement = string.IsNullOrEmpty(LevelRequirement) ? 0 : int.Parse(LevelRequirement);
                updatedQuest.Description      = Description;
                updatedQuest.Notes            = Notes;
                updatedQuest.QuestFlags       = new List <string>(QuestFlags.Split(','));
                updatedQuest.Route            = Route;
                updatedQuest.Priority         = string.IsNullOrEmpty(Priority) ? 0 : double.Parse(Priority);
                updatedQuest.XpReward         = string.IsNullOrEmpty(XpReward) ? 0 : long.Parse(XpReward);
                updatedQuest.LuminanceReward  = string.IsNullOrEmpty(LuminanceReward) ? 0 : int.Parse(LuminanceReward);
                updatedQuest.KeyReward        = KeyReward;
            }
            catch (Exception ex)
            {
                Util.WriteToChat($"Failed to save Quest: {ex}");
                return;
            }
            if (questForEdit == null)
            {
                _questManager.Add(updatedQuest);
            }
            ClearEditQuest();
        }
示例#13
0
 void QuestTick_Click(object sender, MVControlEventArgs e)
 {
     _allQuestsView.RedrawItems();
     _favoriteQuestsView.RedrawItems();
 }
示例#14
0
 void Stop_Click(object sender, MVControlEventArgs e)
 {
     AllQuestRedrawTimer.Stop();
     AutoSaveTimer.Stop();
 }
示例#15
0
 void EditQuestCancel_Click(object sender, MVControlEventArgs e)
 {
     ClearEditQuest();
 }