예제 #1
0
        void ProcessParticipantFleet(StringBuilder rpCommandTextBuilder, Fleet rpFleet, ParticipantFleetType rpType)
        {
            var rFleetID = (int)rpType;

            rpCommandTextBuilder.Append($"INSERT OR IGNORE INTO battle_detail.participant_fleet_name(id, name) VALUES({rpFleet.RawData.NameID ?? -rpFleet.ID}, '{rpFleet.Name}');");
            rpCommandTextBuilder.Append($"INSERT INTO battle_detail.participant_fleet(battle, id, name) VALUES(@battle_id, {rFleetID}, {rpFleet.RawData.NameID ?? -rpFleet.ID});");

            for (var i = 0; i < rpFleet.Ships.Count; i++)
            {
                var rShip = rpFleet.Ships[i];
                var rID   = rFleetID * 6 + i;

                rpCommandTextBuilder.Append("INSERT INTO battle_detail.participant(battle, id, ship, level, condition, fuel, bullet, firepower, torpedo, aa, armor, evasion, asw, los, luck, range) ");
                rpCommandTextBuilder.Append($"VALUES(@battle_id, {rID}, {rShip.Info.ID}, {rShip.Level}, {rShip.Condition}, {rShip.Fuel.Current}, {rShip.Bullet.Current}, {rShip.Status.FirepowerBase.Current}, {rShip.Status.TorpedoBase.Current}, {rShip.Status.AABase.Current}, {rShip.Status.ArmorBase.Current}, {rShip.Status.Evasion}, {rShip.Status.ASW}, {rShip.Status.LoS}, {rShip.Status.Luck}, {rShip.RawData.Range});");

                for (var j = 0; j < rShip.Slots.Count; j++)
                {
                    var rSlot = rShip.Slots[j];
                    if (!rSlot.HasEquipment)
                    {
                        break;
                    }

                    var rLevelAndProficiency = rSlot.Equipment.Level + (rSlot.Equipment.Proficiency << 4);
                    rpCommandTextBuilder.Append($"INSERT INTO battle_detail.participant_slot(battle, participant, id, equipment, level, plane_count) VALUES(@battle_id, {rID}, {j}, {rSlot.Equipment.Info.ID}, {rLevelAndProficiency}, {rSlot.PlaneCount});");
                }

                if (rShip.ExtraSlot != null)
                {
                    rpCommandTextBuilder.Append($"INSERT INTO battle_detail.participant_slot(battle, participant, id, equipment, level, plane_count) VALUES(@battle_id, {rID}, -1, {rShip.ExtraSlot.Equipment.Info.ID}, 0, 0);");
                }
            }
        }
        void ProcessParticipantFleet(StringBuilder rpCommandTextBuilder, Fleet rpFleet, ParticipantFleetType rpType)
        {
            var rFleetID = (int)rpType;

            rpCommandTextBuilder.Append($"INSERT OR IGNORE INTO battle_detail.participant_fleet_name(id, name) VALUES({rpFleet.RawData.NameID ?? -rpFleet.ID}, '{rpFleet.Name}');");
            rpCommandTextBuilder.Append($"INSERT INTO battle_detail.participant_fleet(battle, id, name) VALUES(@battle_id, {rFleetID}, {rpFleet.RawData.NameID ?? -rpFleet.ID});");

            for (var i = 0; i < rpFleet.Ships.Count; i++)
            {
                var rShip = rpFleet.Ships[i];
                var rID = rFleetID * 6 + i;

                rpCommandTextBuilder.Append("INSERT INTO battle_detail.participant(battle, id, ship, level, condition, fuel, bullet, firepower, torpedo, aa, armor, evasion, asw, los, luck, range) ");
                rpCommandTextBuilder.Append($"VALUES(@battle_id, {rID}, {rShip.Info.ID}, {rShip.Level}, {rShip.Condition}, {rShip.Fuel.Current}, {rShip.Bullet.Current}, {rShip.Status.FirepowerBase.Current}, {rShip.Status.TorpedoBase.Current}, {rShip.Status.AABase.Current}, {rShip.Status.ArmorBase.Current}, {rShip.Status.Evasion}, {rShip.Status.ASW}, {rShip.Status.LoS}, {rShip.Status.Luck}, {rShip.RawData.Range});");

                for (var j = 0; j < rShip.Slots.Count; j++)
                {
                    var rSlot = rShip.Slots[j];
                    if (!rSlot.HasEquipment)
                        break;

                    var rLevelAndProficiency = rSlot.Equipment.Level + (rSlot.Equipment.Proficiency << 4);
                    rpCommandTextBuilder.Append($"INSERT INTO battle_detail.participant_slot(battle, participant, id, equipment, level, plane_count) VALUES(@battle_id, {rID}, {j}, {rSlot.Equipment.Info.ID}, {rLevelAndProficiency}, {rSlot.PlaneCount});");
                }

                if (rShip.ExtraSlot != null)
                    rpCommandTextBuilder.Append($"INSERT INTO battle_detail.participant_slot(battle, participant, id, equipment, level, plane_count) VALUES(@battle_id, {rID}, -1, {rShip.ExtraSlot.Equipment.Info.ID}, 0, 0);");
            }
        }
예제 #3
0
        void ProcessHeavilyDamagedShip(IList <BattleParticipantSnapshot> rpParticipants, ParticipantFleetType rpType)
        {
            for (var i = 0; i < rpParticipants.Count; i++)
            {
                var rID    = (int)rpType * 6 + i;
                var rState = rpParticipants[i].State;
                if (rState == BattleParticipantState.HeavilyDamaged || rState == BattleParticipantState.Sunk)
                {
                    using (var rCommand = Connection.CreateCommand())
                    {
                        rCommand.CommandText = "INSERT INTO battle_detail.participant_heavily_damaged(battle, id) VALUES(@battle_id, @id);";
                        rCommand.Parameters.AddWithValue("@battle_id", r_CurrentBattleID.Value);
                        rCommand.Parameters.AddWithValue("@id", rID);

                        rCommand.ExecuteNonQuery();
                    }
                }
            }
        }
        void ProcessHeavilyDamagedShip(IList<BattleParticipantSnapshot> rpParticipants, ParticipantFleetType rpType)
        {
            for (var i = 0; i < rpParticipants.Count; i++)
            {
                var rID = (int)rpType * 6 + i;
                var rState = rpParticipants[i].State;
                if (rState == BattleParticipantState.HeavilyDamaged || rState == BattleParticipantState.Sunk)
                    using (var rCommand = Connection.CreateCommand())
                    {
                        rCommand.CommandText = "INSERT INTO battle_detail.participant_heavily_damaged(battle, id) VALUES(@battle_id, @id);";
                        rCommand.Parameters.AddWithValue("@battle_id", r_CurrentBattleID.Value);
                        rCommand.Parameters.AddWithValue("@id", rID);

                        rCommand.ExecuteNonQuery();
                    }
            }
        }