private void timRefresh_Tick(object sender, EventArgs e) { Dictionary <string, string> dicStatus = new Dictionary <string, string>(); //Player dicStatus.Add("ログインステータス", ((LoginStatus)api.Player.LoginStatus).ToString()); dicStatus.Add("プレイヤーステータス", ((Status)api.Player.Status).ToString()); dicStatus.Add("エリア", string.Format("{0}({1})", api.Player.ZoneId.ToString("D"), resource.GetZoneName(api.Player.ZoneId))); dicStatus.Add("天気", string.Format("{0}({1})", api.Weather.CurrentWeather.ToString("D"), resource.GetWeatherName(api.Weather.CurrentWeather))); string statusEffectsStr = string.Empty; foreach (var statusEffect in api.Player.Buffs) { if (statusEffect != (int)EliteMMO.API.StatusEffect.Unknown) { statusEffectsStr += string.Format("{0}({1}),", statusEffect.ToString("D"), resource.GetStatusName(statusEffect)); } } dicStatus.Add("強化", statusEffectsStr); dicStatus.Add("釣りスキル", api.Player.CraftSkills.Fishing.Skill.ToString()); dicStatus.Add("位置X", api.Player.X.ToString()); dicStatus.Add("位置Y", api.Player.Y.ToString()); dicStatus.Add("位置Z", api.Player.Z.ToString()); dicStatus.Add("方向", api.Player.H.ToString()); dicStatus.Add("ターゲット", api.Target.GetTargetInfo().TargetIndex.ToString()); dicStatus.Add("MP残", api.Player.MP.ToString()); dicStatus.Add("スニーク覚えてる?", api.Player.HasSpell(137).ToString()); dicStatus.Add("残り詠唱時間", api.CastBar.Count.ToString()); dicStatus.Add("詠唱時間", api.CastBar.Max.ToString()); dicStatus.Add("詠唱時間%", api.CastBar.Percent.ToString()); //Timer dicStatus.Add("スニークリキャスト時間", api.Recast.GetSpellRecast(137).ToString()); dicStatus.Add("ヴァナ時間", string.Format("{0:0000}/{1:00}/{2:00} {3:00}:{4:00}:{5:00} {6} {7}({8}%)", api.VanaTime.CurrentYear, api.VanaTime.CurrentMonth, api.VanaTime.CurrentDay, api.VanaTime.CurrentHour, api.VanaTime.CurrentMinute, api.VanaTime.CurrentSecond, resource.GetDayName((int)api.VanaTime.CurrentWeekDay), resource.GetMoonPhaseName((int)api.VanaTime.CurrentMoonPhase, 0), api.VanaTime.CurrentMoonPercent)); //Menu dicStatus.Add("メニュー-開いてる?", api.Menu.IsMenuOpen.ToString()); dicStatus.Add("メニュー-名称", control.GetMenuHelpName()); //Dialog dicStatus.Add("ダイアログ-質問", api.Dialog.GetDialog().Question); dicStatus.Add("ダイアログ-選択インデックス", api.Dialog.DialogIndex.ToString()); dicStatus.Add("ダイアログ-選択肢", string.Join("/", api.Dialog.GetDialog().Options)); //Fish dicStatus.Add("魚-ID", string.Format("{0}-{1}-{2}-{3}", api.Fish.Id1, api.Fish.Id2, api.Fish.Id3, api.Fish.Id4)); dicStatus.Add("魚-最大HP", api.Fish.MaxStamina.ToString()); dicStatus.Add("魚-現在HP", api.Fish.Stamina.ToString()); dicStatus.Add("魚-残り時間", api.Fish.FightTime.ToString()); //Item dicStatus.Add("選択中アイテム", string.Format("{0}({1})", api.Inventory.SelectedItemId, resource.GetItem(api.Inventory.SelectedItemId).Name[1])); dicStatus.Add("鞄", string.Format("{0}/{1}", control.GetInventoryCountByType(InventoryType.Inventory), control.GetInventoryMaxByType(InventoryType.Inventory))); dicStatus.Add("金庫", string.Format("{0}/{1}", control.GetInventoryCountByType(InventoryType.Safe), control.GetInventoryMaxByType(InventoryType.Safe))); dicStatus.Add("金庫2", string.Format("{0}/{1}", control.GetInventoryCountByType(InventoryType.Safe2), control.GetInventoryMaxByType(InventoryType.Safe2))); dicStatus.Add("家具", string.Format("{0}/{1}", control.GetInventoryCountByType(InventoryType.Storage), control.GetInventoryMaxByType(InventoryType.Storage))); dicStatus.Add("ロッカー", string.Format("{0}/{1}", control.GetInventoryCountByType(InventoryType.Locker), control.GetInventoryMaxByType(InventoryType.Locker))); dicStatus.Add("サッチェル", string.Format("{0}/{1}", control.GetInventoryCountByType(InventoryType.Satchel), control.GetInventoryMaxByType(InventoryType.Satchel))); dicStatus.Add("サック", string.Format("{0}/{1}", control.GetInventoryCountByType(InventoryType.Sack), control.GetInventoryMaxByType(InventoryType.Sack))); dicStatus.Add("ケース", string.Format("{0}/{1}", control.GetInventoryCountByType(InventoryType.Case), control.GetInventoryMaxByType(InventoryType.Case))); dicStatus.Add("ワードローブ", string.Format("{0}/{1}", control.GetInventoryCountByType(InventoryType.Wardrobe), control.GetInventoryMaxByType(InventoryType.Wardrobe))); dicStatus.Add("装備-竿", string.Format("{0}({1})", api.Inventory.GetEquippedItem((int)EquipSlot.Range).Id, resource.GetItem(api.Inventory.GetEquippedItem((int)EquipSlot.Range).Id).Name[1])); dicStatus.Add("装備-竿-鞄残数", control.GetInventoryItemCount((uint)api.Inventory.GetEquippedItem((int)EquipSlot.Range).Id, InventoryType.Inventory).ToString()); dicStatus.Add("装備-竿-ワードローブ残数", control.GetInventoryItemCount((uint)api.Inventory.GetEquippedItem((int)EquipSlot.Range).Id, InventoryType.Wardrobe).ToString()); dicStatus.Add("装備-エサ", string.Format("{0}({1})", api.Inventory.GetEquippedItem((int)EquipSlot.Ammo).Id, resource.GetItem(api.Inventory.GetEquippedItem((int)EquipSlot.Ammo).Id).Name[1])); dicStatus.Add("装備-エサ-鞄残数", control.GetInventoryItemCount((uint)api.Inventory.GetEquippedItem((int)EquipSlot.Ammo).Id, InventoryType.Inventory).ToString()); dicStatus.Add("装備-エサ-サッチェル残数", control.GetInventoryItemCount((uint)api.Inventory.GetEquippedItem((int)EquipSlot.Ammo).Id, InventoryType.Satchel).ToString()); dicStatus.Add("装備-エサ-サック残数", control.GetInventoryItemCount((uint)api.Inventory.GetEquippedItem((int)EquipSlot.Ammo).Id, InventoryType.Sack).ToString()); dicStatus.Add("装備-エサ-ケース残数", control.GetInventoryItemCount((uint)api.Inventory.GetEquippedItem((int)EquipSlot.Ammo).Id, InventoryType.Case).ToString()); dicStatus.Add("装備-エサ-ワードローブ残数", control.GetInventoryItemCount((uint)api.Inventory.GetEquippedItem((int)EquipSlot.Ammo).Id, InventoryType.Wardrobe).ToString()); dicStatus.Add("装備-メイン", string.Format("{0}({1})", api.Inventory.GetEquippedItem((int)EquipSlot.Main).Id, resource.GetItem(api.Inventory.GetEquippedItem((int)EquipSlot.Main).Id).Name[1])); dicStatus.Add("装備-サブ", string.Format("{0}({1})", api.Inventory.GetEquippedItem((int)EquipSlot.Shield).Id, resource.GetItem(api.Inventory.GetEquippedItem((int)EquipSlot.Shield).Id).Name[1])); dicStatus.Add("装備-頭", string.Format("{0}({1})", api.Inventory.GetEquippedItem((int)EquipSlot.Head).Id, resource.GetItem(api.Inventory.GetEquippedItem((int)EquipSlot.Head).Id).Name[1])); dicStatus.Add("装備-胴", string.Format("{0}({1})", api.Inventory.GetEquippedItem((int)EquipSlot.Body).Id, resource.GetItem(api.Inventory.GetEquippedItem((int)EquipSlot.Body).Id).Name[1])); dicStatus.Add("装備-手", string.Format("{0}({1})", api.Inventory.GetEquippedItem((int)EquipSlot.Hands).Id, resource.GetItem(api.Inventory.GetEquippedItem((int)EquipSlot.Hands).Id).Name[1])); dicStatus.Add("装備-脚", string.Format("{0}({1})", api.Inventory.GetEquippedItem((int)EquipSlot.Legs).Id, resource.GetItem(api.Inventory.GetEquippedItem((int)EquipSlot.Legs).Id).Name[1])); dicStatus.Add("装備-足", string.Format("{0}({1})", api.Inventory.GetEquippedItem((int)EquipSlot.Feet).Id, resource.GetItem(api.Inventory.GetEquippedItem((int)EquipSlot.Feet).Id).Name[1])); dicStatus.Add("装備-首", string.Format("{0}({1})", api.Inventory.GetEquippedItem((int)EquipSlot.Neck).Id, resource.GetItem(api.Inventory.GetEquippedItem((int)EquipSlot.Neck).Id).Name[1])); dicStatus.Add("装備-背", string.Format("{0}({1})", api.Inventory.GetEquippedItem((int)EquipSlot.Back).Id, resource.GetItem(api.Inventory.GetEquippedItem((int)EquipSlot.Back).Id).Name[1])); dicStatus.Add("装備-腰", string.Format("{0}({1})", api.Inventory.GetEquippedItem((int)EquipSlot.Waist).Id, resource.GetItem(api.Inventory.GetEquippedItem((int)EquipSlot.Waist).Id).Name[1])); dicStatus.Add("装備-左耳", string.Format("{0}({1})", api.Inventory.GetEquippedItem((int)EquipSlot.EarLeft).Id, resource.GetItem(api.Inventory.GetEquippedItem((int)EquipSlot.EarLeft).Id).Name[1])); dicStatus.Add("装備-右耳", string.Format("{0}({1})", api.Inventory.GetEquippedItem((int)EquipSlot.EarRight).Id, resource.GetItem(api.Inventory.GetEquippedItem((int)EquipSlot.EarRight).Id).Name[1])); dicStatus.Add("装備-左手", string.Format("{0}({1})", api.Inventory.GetEquippedItem((int)EquipSlot.RingLeft).Id, resource.GetItem(api.Inventory.GetEquippedItem((int)EquipSlot.RingLeft).Id).Name[1])); dicStatus.Add("装備-右手", string.Format("{0}({1})", api.Inventory.GetEquippedItem((int)EquipSlot.RingRight).Id, resource.GetItem(api.Inventory.GetEquippedItem((int)EquipSlot.RingRight).Id).Name[1])); refreshStatus(dicStatus); }
/// <summary> /// メインスレッド /// </summary> private void threadHarakiri() { chat.CurrentIndex = chat.MaxIndex; setHarakiriStatus(HarakiriStatusKind.Normal); bool firsttime = true; logger.Debug("ハラキリスレッド開始"); chat.Reset(); while (this.RunningStatus == RunningStatusKind.Running) { //未入力チェック if (this.HarakiriFishName.Length == 0) { setRunningStatus(RunningStatusKind.Stop); setHarakiriStatus(HarakiriStatusKind.Error); setMessage("ハラキリする魚を入力してください"); return; } //鞄に入っている魚の総数を取得 uint itemId = resource.GetItem(this.HarakiriFishName).ItemID; int remain = GetHarakiriRemain(this.HarakiriFishName); if (remain <= 0) { setRunningStatus(RunningStatusKind.Stop); if (firsttime) { setHarakiriStatus(HarakiriStatusKind.Error); setMessage("ハラキリする魚が見つかりませんでした"); } else { setHarakiriStatus(HarakiriStatusKind.Normal); setMessage("ハラキリが完了しました"); } return; } firsttime = false; setMessage(string.Format("ハラキリ中:{0} 残り{1}匹", this.HarakiriFishName, remain)); //鞄に対象の魚を移動させる if (control.GetInventoryItemCount(itemId, StorageContainer.Inventory) <= 0) { if (control.GetInventoryItemCount(itemId, StorageContainer.Satchel) > 0) { control.GetItemizer(this.HarakiriFishName, StorageContainer.Satchel); } else if (control.GetInventoryItemCount(itemId, StorageContainer.Sack) > 0) { control.GetItemizer(this.HarakiriFishName, StorageContainer.Sack); } else if (control.GetInventoryItemCount(itemId, StorageContainer.Case) > 0) { control.GetItemizer(this.HarakiriFishName, StorageContainer.Case); } } //Zaldonの近くかチェック if (api.Player.ZoneId != (int)Zone.Selbina || (api.Entity.GetEntity(NPCID_ZALDON).Distance != 0f && api.Entity.GetEntity(NPCID_ZALDON).Distance > 6)) { setRunningStatus(RunningStatusKind.Stop); setHarakiriStatus(HarakiriStatusKind.Error); setMessage("セルビナのZaldonの近くで実行してください"); return; } //メニュー開いていたら閉じる if (!control.CloseDialog(10)) { setRunningStatus(RunningStatusKind.Stop); setHarakiriStatus(HarakiriStatusKind.Error); setMessage("エラー:会話を終了させてから実行してください"); break; } //ターゲット設定 control.SetTargetFromId(NPCID_ZALDON); Thread.Sleep(settings.Global.WaitChat);//Wait //プレイヤーステータスがstandingになるまで待機 while (api.Player.Status != (uint)Status.Standing) { Thread.Sleep(settings.Global.WaitBase);//wait } //アイテムトレード api.ThirdParty.SendString(string.Format("/item {0} <t>", this.HarakiriFishName)); //チャット監視開始 string itemName = string.Empty; int noResponseCount = 0; var cl = new EliteAPI.ChatEntry(); while (this.RunningStatus == RunningStatusKind.Running) { if (!chat.GetNextChatLine(out cl)) { noResponseCount++; if (noResponseCount > 10) { setRunningStatus(RunningStatusKind.Stop); setHarakiriStatus(HarakiriStatusKind.Error); setMessage("ハラキリ対象の魚ですか? 反応無し中止"); break; } Thread.Sleep(settings.Global.WaitChat);//wait continue; } //チャット区分の取得 List <string> chatKbnArgs = new List <string>(); ChatKbnKind chatKbn = getChatKbnFromChatline(cl, out chatKbnArgs); logger.Debug("Chat:{0} ChatKbn:{1}", cl.Text, chatKbn); if (chatKbn == ChatKbnKind.Zaldon) { noResponseCount = 0; if (!settings.UseEnternity) { api.ThirdParty.KeyPress(Keys.RETURN); } } else if (chatKbn == ChatKbnKind.NotFound) { noResponseCount = 0; if (!putDatabase(itemName)) { setRunningStatus(RunningStatusKind.Stop); setHarakiriStatus(HarakiriStatusKind.Error); setMessage("データベースの更新に失敗しました"); break; } EventHarakiriOnce(this.HarakiriFishName, itemName);//イベント発生 setMessage("ハラキリ結果:何も見つからなかった"); if (!settings.UseEnternity) { api.ThirdParty.KeyPress(Keys.RETURN); } } else if (chatKbn == ChatKbnKind.Found) { noResponseCount = 0; itemName = chatKbnArgs[0]; if (!putDatabase(itemName)) { setRunningStatus(RunningStatusKind.Stop); setHarakiriStatus(HarakiriStatusKind.Error); setMessage("データベースの更新に失敗しました"); break; } EventHarakiriOnce(this.HarakiriFishName, itemName);//イベント発生 setMessage(string.Format("ハラキリ結果:{0}を見つけた", itemName)); api.ThirdParty.KeyPress(Keys.RETURN); Thread.Sleep(settings.Global.WaitChat); } if (chatKbn == ChatKbnKind.Found || chatKbn == ChatKbnKind.NotFound) { noResponseCount = 0; Thread.Sleep(2000); //発見したら停止 if (chatKbn == ChatKbnKind.Found && settings.Harakiri.StopFound) { setRunningStatus(RunningStatusKind.Stop); setHarakiriStatus(HarakiriStatusKind.Normal); setMessage("アイテムを発見したので停止します"); } break; } Thread.Sleep(settings.Global.WaitBase); //wait } Thread.Sleep(settings.Global.WaitChat); //wait } logger.Debug("ハラキリスレッド終了"); }