void BattleFinished(string apiname, dynamic data)
        {
            var bm = KCDatabase.Instance.Battle;
            ReadOnlyCollection <int> hps = null;


            #region Slaughter


            switch (bm.BattleMode & Battle.BattleManager.BattleModes.BattlePhaseMask)
            {
            case Battle.BattleManager.BattleModes.Normal:
            case Battle.BattleManager.BattleModes.AirBattle:
            case Battle.BattleManager.BattleModes.AirRaid:
            default:
                if (bm.BattleNight != null)
                {
                    hps = bm.BattleNight.ResultHPs;
                }
                else
                {
                    hps = bm.BattleDay.ResultHPs;
                }
                break;

            case Battle.BattleManager.BattleModes.NightOnly:
            case Battle.BattleManager.BattleModes.NightDay:
                if (bm.BattleDay != null)
                {
                    hps = bm.BattleDay.ResultHPs;
                }
                else
                {
                    hps = bm.BattleNight.ResultHPs;
                }
                break;
            }

            if (hps == null)
            {
                return;
            }

            IEnumerable <ProgressSlaughter> slaughterList = Progresses.Values.Where(p => p is ProgressSlaughter).Cast <ProgressSlaughter>();

            for (int i = 0; i < 6; i++)
            {
                if (hps[i + 6] <= 0)
                {
                    var ship = bm.BattleDay != null ? bm.BattleDay.Initial.EnemyMembersInstance[i] : bm.BattleNight.Initial.EnemyMembersInstance[i];
                    if (ship == null)
                    {
                        continue;
                    }

                    foreach (var p in slaughterList)
                    {
                        p.Increment(ship.ShipType);
                    }
                }
            }


            #endregion


            #region Battle


            IEnumerable <ProgressBattle> battleList = Progresses.Values.Where(p => p is ProgressBattle).Cast <ProgressBattle>();

            foreach (var p in battleList)
            {
                p.Increment(bm.Result.Rank, bm.Compass.MapAreaID * 10 + bm.Compass.MapInfoID, bm.Compass.EventID == 5);
            }


            #endregion


            ProgressAGo pago = (ProgressAGo)Progresses.Values.FirstOrDefault(p => p is ProgressAGo);
            if (pago != null)
            {
                pago.IncrementBattle(bm.Result.Rank, bm.Compass.EventID == 5);
            }


            OnProgressChanged();
        }
        void BattleFinished(string apiname, dynamic data)
        {
            var bm = KCDatabase.Instance.Battle;
            ReadOnlyCollection <int> hps = null;


            #region Slaughter


            if (bm.StartsFromDayBattle)
            {
                if (bm.BattleNight != null)
                {
                    hps = bm.BattleNight.ResultHPs;
                }
                else
                {
                    hps = bm.BattleDay.ResultHPs;
                }
            }
            else
            {
                if (bm.BattleDay != null)
                {
                    hps = bm.BattleDay.ResultHPs;
                }
                else
                {
                    hps = bm.BattleNight.ResultHPs;
                }
            }

            if (hps == null)
            {
                return;
            }

            var slaughterList = Progresses.Values.Where(p => p is ProgressSlaughter).Cast <ProgressSlaughter>();

            for (int i = 0; i < 6; i++)
            {
                if (hps[i + 6] <= 0)
                {
                    var ship = bm.BattleDay != null ? bm.BattleDay.Initial.EnemyMembersInstance[i] : bm.BattleNight.Initial.EnemyMembersInstance[i];
                    if (ship == null)
                    {
                        continue;
                    }

                    foreach (var p in slaughterList)
                    {
                        p.Increment(ship.ShipType);
                    }
                }

                if (bm.IsEnemyCombined && hps[i + 18] <= 0)
                {
                    var ship = bm.BattleDay != null ? bm.BattleDay.Initial.EnemyMembersEscortInstance[i] : bm.BattleNight.Initial.EnemyMembersEscortInstance[i];
                    if (ship == null)
                    {
                        continue;
                    }

                    foreach (var p in slaughterList)
                    {
                        p.Increment(ship.ShipType);
                    }
                }
            }


            #endregion


            #region Battle


            IEnumerable <ProgressBattle> battleList = Progresses.Values.Where(p => p is ProgressBattle).Cast <ProgressBattle>();

            foreach (var p in battleList)
            {
                p.Increment(bm.Result.Rank, bm.Compass.MapAreaID * 10 + bm.Compass.MapInfoID, bm.Compass.EventID == 5);
            }


            #endregion


            ProgressAGo pago = (ProgressAGo)Progresses.Values.FirstOrDefault(p => p is ProgressAGo);
            if (pago != null)
            {
                pago.IncrementBattle(bm.Result.Rank, bm.Compass.EventID == 5);
            }


            OnProgressChanged();
        }