/// <summary> /// Npc名からIndexを取得する /// </summary> /// <param name="iNpcName">NpcName</param> /// <returns>NpcIndex</returns> private int findNpcIndexFromName(string iNpcName) { List <string> regStr = new List <string>(); for (int i = 0; i < Constants.MAX_LOOP_COUNT; i++) { for (int j = 0; j < 2048; j++) { EliteAPI.XiEntity ent = api.Entity.GetEntity(j); if (!string.IsNullOrEmpty(ent.Name) && MiscTools.GetRegexString(ent.Name, iNpcName, out regStr)) { return(j); } } Thread.Sleep(settings.BaseWait); } return(-1); }
/// <summary> /// ダイアログが指定した質問になるまで待機する /// </summary> /// <param name="iQuestion">質問内容(正規表現)</param> private void waitDialogTitle(string iQuestion) { List <string> regStr = new List <string>(); while (!MiscTools.GetRegexString(api.Dialog.GetDialog().Question, iQuestion, out regStr)) { Thread.Sleep(settings.BaseWait); } if (MiscTools.GetRegexString(api.Dialog.GetDialog().Question, Constants.DIALOG_QUESTION_COU1, out regStr)) { remainTicket = int.Parse(regStr[0]); } if (MiscTools.GetRegexString(api.Dialog.GetDialog().Question, Constants.DIALOG_QUESTION_COU4, out regStr)) { remainTicket = int.Parse(regStr[0]); } if (MiscTools.GetRegexString(api.Dialog.GetDialog().Question, Constants.DIALOG_QUESTION_WAYPOINT1, out regStr)) { remainCp = int.Parse(regStr[0]); } }
/// <summary> /// POLアタッチ クリックイベント /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnPolAttach_Click(object sender, EventArgs e) { int polID = getSelectedPolID(); string polName = getSelectedPolName(); Console.WriteLine("PolID:{0}", polID); Console.WriteLine("PolID:{0}", polName); api = new EliteAPI(polID); settings = new Settings(polName); this.Text = string.Format(Constants.WINDOW_TITLE_FORMAT, MiscTools.GetAppTitle(), MiscTools.GetAppVersion(), polName); }
/// <summary> /// モニタ用タイマーイベント /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void timMonitor_Tick(object sender, EventArgs e) { //ログイン状態監視 if (api.Player.Name != null) { btnExec.Enabled = true; //if (string.IsNullOrEmpty(lastPlayerName)) //{ // settings.Load(api.Player.Name); // initForm(); //} lastPlayerName = api.Player.Name; } else { btnExec.Enabled = false; lastPlayerName = string.Empty; } //ダイアログ監視 List <string> regStr = new List <string>(); if (api.Menu.IsMenuOpen) { if (MiscTools.GetRegexString(api.Dialog.GetDialog().Question, Constants.DIALOG_QUESTION_COU1, out regStr)) { remainTicket = int.Parse(regStr[0]); lblTicket.Text = regStr[0]; } if (MiscTools.GetRegexString(api.Dialog.GetDialog().Question, Constants.DIALOG_QUESTION_COU4, out regStr)) { remainTicket = int.Parse(regStr[0]); lblTicket.Text = regStr[0]; } if (MiscTools.GetRegexString(api.Dialog.GetDialog().Question, Constants.DIALOG_QUESTION_WAYPOINT1, out regStr)) { remainCp = int.Parse(regStr[0]); lblCP.Text = int.Parse(regStr[0]).ToString("#,0"); } } //チャット監視 EliteAPI.ChatEntry cl = api.Chat.GetNextChatLine(); while (cl != null) { //Console.WriteLine(string.Format("type:{0} idx1:{1} idx2:{2} {3}", cl.ChatType, cl.Index1, cl.Index2, cl.Text)); if ((cl.ChatType == 152 || cl.ChatType == 144) && MiscTools.GetRegexString(cl.Text, Constants.CHAT_TICKET_REMAIN, out regStr)) { remainTicket = int.Parse(regStr[0]); lblTicket.Text = regStr[0]; } if (cl.ChatType == 148 && MiscTools.GetRegexString(cl.Text, Constants.CHAT_CP_REMAIN, out regStr)) { if (lblCP.Text != "--") { remainCp -= int.Parse(regStr[0]); lblCP.Text = remainCp.ToString("#,0"); } } cl = api.Chat.GetNextChatLine(); } }