public enum LogType\r
{\r
None = 0,\r
- Mission = 1,\r
- Battle = 2,\r
- Material = 4,\r
- CreateItem = 8,\r
- CreateShip = 16,\r
- RemodelSlot = 32,\r
- All = 63,\r
+ Mission = 1 << 0,\r
+ Battle = 1 << 1,\r
+ Material = 1 << 2,\r
+ CreateItem = 1 << 3,\r
+ CreateShip = 1 << 4,\r
+ RemodelSlot = 1 << 5,\r
+ Achivement = 1 << 6,\r
+ All = (1 << 7) - 1\r
}\r
\r
public class Logger\r
private int[] _currentMaterial = new int[Enum.GetValues(typeof(Material)).Length];\r
private int _materialLogInterval = 10;\r
private bool _start;\r
+ private int _lastExp = -1;\r
+ private DateTime _lastDate;\r
+ private DateTime _endOfMonth;\r
+ private DateTime _nextDate;\r
\r
public int MaterialLogInterval\r
{\r
- set { _materialLogInterval = value; }\r
+ set => _materialLogInterval = value;\r
}\r
\r
public string OutputDir\r
{\r
- set { _writer = new LogWriter(value).Write; }\r
+ set => _writer = new LogWriter(value).Write;\r
}\r
\r
public Logger(ShipInfo ship, ItemInfo item, BattleInfo battle)\r
_nowFunc = nowFunc;\r
}\r
\r
+ public void FlashLog()\r
+ {\r
+ FlashAchivementLog();\r
+ }\r
+\r
public void InspectMissionResult(dynamic json)\r
{\r
var r = (int)json.api_clear_result;\r
\r
public void InspectMapNext(dynamic json)\r
{\r
+ if ((_logType & LogType.Achivement) != 0 && json.api_get_eo_rate() && (int)json.api_get_eo_rate != 0)\r
+ {\r
+ _writer("戦果",\r
+ _nowFunc().ToString(DateTimeFormat) + "," + _lastExp + "," + (int)json.api_get_eo_rate,\r
+ "日付,経験値,EO");\r
+ }\r
_map = json;\r
}\r
\r
+ public void InspectClearItemGet(dynamic json)\r
+ {\r
+ if ((_logType & LogType.Achivement) == 0)\r
+ return;\r
+ if (json.api_bounus_count == 0)\r
+ return;\r
+ foreach (var entry in json.api_bounus)\r
+ {\r
+ if (entry.api_type != 18)\r
+ continue;\r
+ _writer("戦果",\r
+ _nowFunc().ToString(DateTimeFormat) + "," + _lastExp + "," + (int)entry.api_count,\r
+ "日付,経験値,EO");\r
+ break;\r
+ }\r
+\r
+ }\r
+\r
public void InspectBattle(dynamic json)\r
{\r
if (_battle != null) // 通常の夜戦は無視する\r
\r
public void InspectBattleResult(dynamic result)\r
{\r
+ if ((_logType & LogType.Achivement) != 0 && result.api_get_exmap_rate())\r
+ {\r
+ var rate = result.api_get_exmap_rate is string\r
+ ? int.Parse(result.api_get_exmap_rate)\r
+ : (int)result.api_get_exmap_rate;\r
+ if (rate != 0)\r
+ {\r
+ _writer("戦果", _nowFunc().ToString(DateTimeFormat) + "," + _lastExp + "," + rate,\r
+ "日付,経験値,EO");\r
+ }\r
+ }\r
if ((_logType & LogType.Battle) == 0 || _map == null || _battle == null)\r
{\r
_map = _battle = null;\r
dropType, dropName,\r
string.Join(",", fships),\r
string.Join(",", eships),\r
- fpower, _battleInfo.EnemyFighterPower,\r
+ fpower, _battleInfo.EnemyFighterPower.AirCombat + _battleInfo.EnemyFighterPower.UnknownMark,\r
AirControlLevelName(_battle)),\r
"日付,海域,マス,ボス,ランク,艦隊行動,味方陣形,敵陣形,敵艦隊,ドロップ艦種,ドロップ艦娘," +\r
"味方艦1,味方艦1HP,味方艦2,味方艦2HP,味方艦3,味方艦3HP,味方艦4,味方艦4HP,味方艦5,味方艦5HP,味方艦6,味方艦6HP," +\r
public void InspectBasic(dynamic json)\r
{\r
_basic = json;\r
+ if ((_logType & LogType.Achivement) == 0)\r
+ return;\r
+ var now = _nowFunc();\r
+ var exp = (int)json.api_experience;\r
+ var isNewMonth = _endOfMonth == DateTime.MinValue || now.CompareTo(_endOfMonth) >= 0;\r
+ var isNewDate = _nextDate == DateTime.MinValue || now.CompareTo(_nextDate) >= 0;\r
+ if (isNewDate || isNewMonth)\r
+ {\r
+ if (_lastDate != DateTime.MinValue)\r
+ {\r
+ _writer("戦果", _lastDate.ToString(DateTimeFormat) + "," + _lastExp + ",0", "日付,経験値,EO");\r
+ }\r
+ _writer("戦果", now.ToString(DateTimeFormat) + "," + exp + ",0", "日付,経験値,EO");\r
+ if (isNewMonth)\r
+ {\r
+ _endOfMonth = new DateTime(now.Year, now.Month, DateTime.DaysInMonth(now.Year, now.Month), 22, 0, 0);\r
+ if (_endOfMonth.CompareTo(now) <= 0)\r
+ {\r
+ var days = _endOfMonth.Month == 12\r
+ ? DateTime.DaysInMonth(_endOfMonth.Year + 1, 1)\r
+ : DateTime.DaysInMonth(_endOfMonth.Year, _endOfMonth.Month);\r
+ _endOfMonth = _endOfMonth.AddDays(days);\r
+ }\r
+ }\r
+ _nextDate = new DateTime(now.Year, now.Month, now.Day, 2, 0, 0);\r
+ if (now.Hour >= 2)\r
+ _nextDate = _nextDate.AddDays(1);\r
+ if (_nextDate.Day == 1)\r
+ _nextDate = _nextDate.AddDays(1);\r
+ }\r
+ _lastDate = now;\r
+ _lastExp = exp;\r
+ }\r
+\r
+ private void FlashAchivementLog()\r
+ {\r
+ if ((_logType & LogType.Achivement) == 0)\r
+ return;\r
+ if (_lastDate != DateTime.MinValue)\r
+ {\r
+ _writer("戦果", _lastDate.ToString(DateTimeFormat) + "," + _lastExp + ",0", "日付,経験値,EO");\r
+ }\r
}\r
\r
public void InspectCreateItem(string request, dynamic json)\r