\r
using System;\r
using KancolleSniffer.Util;\r
-using KancolleSniffer.View;\r
using System.Collections.Generic;\r
using System.Linq;\r
+using KancolleSniffer.Log;\r
using KancolleSniffer.Model;\r
\r
namespace KancolleSniffer\r
{\r
private bool _start;\r
private readonly ItemMaster _itemMaster = new ItemMaster();\r
- private readonly ItemInventry _itemInventry = new ItemInventry();\r
+ private readonly ItemInventory _itemInventory = new ItemInventory();\r
private readonly ItemInfo _itemInfo;\r
private readonly ShipMaster _shipMaster = new ShipMaster();\r
- private readonly ShipInventry _shipInventry = new ShipInventry();\r
+ private readonly ShipInventory _shipInventory = new ShipInventory();\r
private readonly ShipInfo _shipInfo;\r
private readonly MaterialInfo _materialInfo = new MaterialInfo();\r
private readonly QuestInfo _questInfo;\r
private readonly Logger _logger;\r
private readonly ExMapInfo _exMapInfo = new ExMapInfo();\r
private readonly MiscTextInfo _miscTextInfo;\r
- private readonly BaseAirCoprs _baseAirCoprs;\r
+ private readonly BaseAirCorps _baseAirCorps;\r
private readonly PresetDeck _presetDeck = new PresetDeck();\r
private readonly CellInfo _cellInfo = new CellInfo();\r
private readonly Status _status = new Status();\r
\r
public IRepeatingTimerController RepeatingTimerController { get; set; }\r
\r
+ public Dictionary<string, string> MapDictionary { get; } = new Dictionary<string, string>\r
+ {\r
+ {"南西作戦海域方面 バリ島沖", "42-1"},\r
+ {"西方作戦海域方面 マラッカ海峡北方", "42-2"},\r
+ {"西方作戦海域方面 セイロン島南西沖", "42-3"},\r
+ {"欧州作戦海域方面 地中海マルタ島沖", "42-4"},\r
+ {"欧州作戦海域方面 北海/北大西洋海域", "42-5"}\r
+ };\r
+\r
[Flags]\r
public enum Update\r
{\r
public Sniffer(bool start = false)\r
{\r
_start = start;\r
- _itemInfo = new ItemInfo(_itemMaster, _itemInventry);\r
- _shipInfo = new ShipInfo(_shipMaster, _shipInventry, _itemInventry);\r
+ _itemInfo = new ItemInfo(_itemMaster, _itemInventory);\r
+ _shipInfo = new ShipInfo(_shipMaster, _shipInventory, _itemInventory);\r
_conditionTimer = new ConditionTimer(_shipInfo);\r
- _dockInfo = new DockInfo(_shipInventry, _materialInfo);\r
+ _dockInfo = new DockInfo(_shipInventory, _materialInfo);\r
_akashiTimer = new AkashiTimer(_shipInfo, _dockInfo, _presetDeck);\r
_battleInfo = new BattleInfo(_shipInfo, _itemInfo);\r
_logger = new Logger(_shipInfo, _itemInfo, _battleInfo);\r
_questInfo = new QuestInfo(_itemInfo, _battleInfo);\r
- _baseAirCoprs = new BaseAirCoprs(_itemInfo);\r
+ _baseAirCorps = new BaseAirCorps(_itemInfo);\r
_miscTextInfo = new MiscTextInfo(_shipInfo, _itemInfo);\r
_haveState = new List<IHaveState> {_achievement, _materialInfo, _conditionTimer, _exMapInfo, _questInfo};\r
AdditionalData = new AdditionalData();\r
return Update.None;\r
var data = json.api_data() ? json.api_data : new object();\r
\r
- if (url.EndsWith("api_start2"))\r
+ if (url.Contains("api_start2"))\r
{\r
return ApiStart(data);\r
}\r
return Update.None;\r
\r
if (url.EndsWith("api_port/port"))\r
- return ApiPort(data);\r
+ return ApiPort(url, data);\r
if (url.Contains("member"))\r
return ApiMember(url, json);\r
if (url.Contains("kousyou"))\r
return ApiBattle(url, request, data);\r
if (url.Contains("hensei"))\r
return ApiHensei(url, request, data);\r
+ if (url.Contains("kaisou"))\r
+ return ApiKaisou(url, request, data);\r
if (url.Contains("air_corps"))\r
return ApiAirCorps(url, request, data);\r
return ApiOthers(url, request, data);\r
private Update ApiStart(dynamic data)\r
{\r
_shipInfo.InspectMaster(data);\r
+ _shipInfo.ClearBattleResult();\r
_missionInfo.InspectMaster(data.api_mst_mission);\r
_itemInfo.InspectMaster(data);\r
_exMapInfo.ResetIfNeeded();\r
_miscTextInfo.InspectMaster(data);\r
+ SetMapDictionary(data.api_mst_mapinfo);\r
_start = true;\r
return Update.Start;\r
}\r
\r
- private Update ApiPort(dynamic data)\r
+ private void SetMapDictionary(dynamic json)\r
+ {\r
+ foreach (var map in json)\r
+ MapDictionary[map.api_name] = $"{map.api_maparea_id}-{map.api_no}";\r
+ }\r
+\r
+ private Update ApiPort(string url, dynamic data)\r
{\r
_itemInfo.InspectBasic(data.api_basic);\r
_materialInfo.InspectMaterialPort(data.api_material);\r
_logger.InspectBasic(data.api_basic);\r
_logger.InspectMaterial(data.api_material);\r
- _shipInfo.InspectShip(data);\r
+ _shipInfo.InspectShip(url, data);\r
_shipInfo.ClearBadlyDamagedShips();\r
- _conditionTimer.CalcRegenTime();\r
+ _conditionTimer.CalcRegainTime();\r
_missionInfo.InspectDeck(data.api_deck_port);\r
_questInfo.InspectDeck(data.api_deck_port);\r
_dockInfo.InspectNDock(data.api_ndock);\r
if (data.api_parallel_quest_count()) // 昔のログにはないので\r
_questInfo.AcceptMax = (int)data.api_parallel_quest_count;\r
if (data.api_event_object())\r
- _baseAirCoprs.InspectEventObject(data.api_event_object);\r
+ _baseAirCorps.InspectEventObject(data.api_event_object);\r
if (data.api_plane_info())\r
- _baseAirCoprs.InspectPlaneInfo(data.api_plane_info);\r
+ _baseAirCorps.InspectPlaneInfo(data.api_plane_info);\r
_battleInfo.CleanupResult();\r
_battleInfo.BattleState = BattleState.None;\r
_miscTextInfo.Port();\r
if (url.EndsWith("api_get_member/ship2"))\r
{\r
// ここだけjsonなので注意\r
- _shipInfo.InspectShip(json);\r
+ _shipInfo.InspectShip(url, json);\r
_akashiTimer.CheckFleet();\r
_battleInfo.BattleState = BattleState.None;\r
return Update.Item | Update.Ship | Update.Battle;\r
}\r
if (url.EndsWith("api_get_member/ship_deck"))\r
{\r
- _shipInfo.InspectShip(data);\r
+ _shipInfo.InspectShip(url, data);\r
_akashiTimer.CheckFleet();\r
_battleInfo.BattleState = BattleState.None;\r
return Update.Ship | Update.Battle | Update.Item;\r
}\r
if (url.EndsWith("api_get_member/ship3"))\r
{\r
- _shipInfo.InspectShip(data);\r
+ _shipInfo.InspectShip(url, data);\r
_akashiTimer.CheckFleet();\r
_conditionTimer.CheckCond();\r
return Update.Ship;\r
_exMapInfo.InspectMapInfo(data);\r
_miscTextInfo.InspectMapInfo(data);\r
if (data.api_air_base())\r
- _baseAirCoprs.Inspect(data.api_air_base);\r
+ _baseAirCorps.Inspect(data.api_air_base);\r
return Update.Item;\r
}\r
if (url.EndsWith("api_req_member/get_practice_enemyinfo"))\r
}\r
if (url.EndsWith("api_get_member/base_air_corps"))\r
{\r
- _baseAirCoprs.Inspect(data);\r
+ _baseAirCorps.Inspect(data);\r
return Update.Ship;\r
}\r
return Update.None;\r
if (url.EndsWith("api_req_kousyou/getship"))\r
{\r
_itemInfo.InspectGetShip(data);\r
- _shipInfo.InspectShip(data);\r
+ _shipInfo.InspectShip(url, data);\r
_dockInfo.InspectKDock(data.api_kdock);\r
_conditionTimer.CheckCond();\r
RepeatingTimerController?.Stop("建造完了");\r
{\r
if (IsNormalBattleAPI(url) || IsCombinedBattleAPI(url))\r
{\r
+ _shipInfo.ClearBadlyDamagedShips();\r
+ RepeatingTimerController?.Stop("大破警告");\r
_battleInfo.InspectBattle(url, request, data);\r
_logger.InspectBattle(data);\r
_cellInfo.StartBattle();\r
return Update.None;\r
}\r
\r
+ private Update ApiKaisou(string url, string request, dynamic data)\r
+ {\r
+ if (url.EndsWith("api_req_kaisou/powerup"))\r
+ {\r
+ _shipInfo.InspectPowerUp(request, data);\r
+ _conditionTimer.CheckCond();\r
+ _akashiTimer.CheckFleet();\r
+ _questInfo.InspectPowerUp(data);\r
+ return Update.Item | Update.Ship | Update.QuestList;\r
+ }\r
+ if (url.EndsWith("api_req_kaisou/slot_exchange_index"))\r
+ {\r
+ _shipInfo.InspectSlotExchange(request, data);\r
+ return Update.Ship;\r
+ }\r
+ if (url.EndsWith("api_req_kaisou/slot_deprive"))\r
+ {\r
+ _shipInfo.InspectSlotDeprive(data);\r
+ return Update.Ship;\r
+ }\r
+ if (url.EndsWith("api_req_kaisou/marriage"))\r
+ {\r
+ _shipInfo.InspectMarriage(data);\r
+ return Update.Ship;\r
+ }\r
+ return Update.None;\r
+ }\r
+\r
private Update ApiAirCorps(string url, string request, dynamic data)\r
{\r
if (url.EndsWith("api_req_air_corps/supply"))\r
{\r
_materialInfo.InspectAirCorpsSupply(data);\r
- _baseAirCoprs.InspectSupply(request, data);\r
+ _baseAirCorps.InspectSupply(request, data);\r
return Update.Item;\r
}\r
if (url.EndsWith("api_req_air_corps/set_plane"))\r
{\r
_materialInfo.InspectAirCorpsSetPlane(data);\r
- _baseAirCoprs.InspectSetPlane(request, data);\r
+ _baseAirCorps.InspectSetPlane(request, data);\r
return Update.Item | Update.Ship;\r
}\r
if (url.EndsWith("api_req_air_corps/set_action"))\r
{\r
- _baseAirCoprs.InspectSetAction(request);\r
+ _baseAirCorps.InspectSetAction(request);\r
return Update.Ship;\r
}\r
if (url.EndsWith("api_req_air_corps/expand_base"))\r
{\r
- _baseAirCoprs.InspectExpandBase(request, data);\r
+ _baseAirCorps.InspectExpandBase(request, data);\r
return Update.Ship;\r
}\r
return Update.None;\r
_questInfo.CountCharge();\r
return Update.Item | Update.Ship | Update.QuestList;\r
}\r
- if (url.EndsWith("api_req_kaisou/powerup"))\r
- {\r
- _shipInfo.InspectPowerup(request, data);\r
- _conditionTimer.CheckCond();\r
- _akashiTimer.CheckFleet();\r
- _questInfo.InspectPowerup(data);\r
- return Update.Item | Update.Ship | Update.QuestList;\r
- }\r
- if (url.EndsWith("api_req_kaisou/slot_exchange_index"))\r
- {\r
- _shipInfo.InspectSlotExchange(request, data);\r
- return Update.Ship;\r
- }\r
- if (url.EndsWith("api_req_kaisou/slot_deprive"))\r
- {\r
- _shipInfo.InspectSlotDeprive(data);\r
- return Update.Ship;\r
- }\r
if (url.EndsWith("api_req_nyukyo/start"))\r
{\r
_dockInfo.InspectNyukyo(request);\r
\r
public AlarmCounter ShipCounter => _shipInfo.Counter;\r
\r
- public Fleet[] Fleets => _shipInfo.Fleets;\r
+ public IReadOnlyList<Fleet> Fleets => _shipInfo.Fleets;\r
\r
public ShipInfo.ShipStatusPair[] BattleResultStatusDiff => _shipInfo.BattleResultDiff;\r
\r
{\r
_itemInfo.ClearHolder();\r
_shipInfo.SetItemHolder();\r
- _baseAirCoprs.SetItemHolder();\r
+ _baseAirCorps.SetItemHolder();\r
return _itemInfo.ItemList;\r
}\r
}\r
\r
public string MiscText => _miscTextInfo.Text;\r
\r
- public BaseAirCoprs.BaseInfo[] BaseAirCorps => _baseAirCoprs.AllAirCorps;\r
+ public BaseAirCorps.BaseInfo[] BaseAirCorps => _baseAirCorps.AllAirCorps;\r
\r
public CellInfo CellInfo => _cellInfo;\r
\r