void BeforeAirForceSquadronSupply(ApiInfo rpInfo) { var rArea = int.Parse(rpInfo.Parameters["api_area_id"]); r_SupplyingGroup = Port.AirBase.Table[rArea][int.Parse(rpInfo.Parameters["api_base_id"])]; r_SupplyingSquadrons = rpInfo.Parameters["api_squadron_id"].Split(',').Select(r => r_SupplyingGroup.Squadrons[int.Parse(r)]).ToArray(); r_TotalPlaneCount = r_SupplyingSquadrons.Sum(r => r.Count); }
void AfterAirForceSquadronSupply(ApiInfo rpInfo) { var rArea = int.Parse(rpInfo.Parameters["api_area_id"]); var rCountDiff = r_SupplyingSquadrons.Sum(r => r.Count) - r_TotalPlaneCount; var rBuilder = new StringBuilder(256); rBuilder.AppendLine("INSERT OR IGNORE INTO sortie_consumption_detail(id, type) VALUES((SELECT max(sortie.id) FROM sortie_participant_airbase JOIN sortie ON sortie.id = sortie_participant_airbase.id AND sortie.map / 10 = @area AND [group] = @group), 5);"); rBuilder.AppendLine("UPDATE sortie_consumption_detail SET fuel = coalesce(fuel, 0) + @fuel, bauxite = coalesce(bauxite, 0) + @bauxite WHERE id = (SELECT max(sortie.id) FROM sortie_participant_airbase JOIN sortie ON sortie.id = sortie_participant_airbase.id AND sortie.map / 10 = @area AND [group] = @group) AND type = 5; "); var rCommand = Connection.CreateCommand(); rCommand.CommandText = rBuilder.ToString(); rCommand.Parameters.AddWithValue("@area", rArea); rCommand.Parameters.AddWithValue("@group", r_SupplyingGroup.ID); rCommand.Parameters.AddWithValue("@fuel", rCountDiff * 3); rCommand.Parameters.AddWithValue("@bauxite", rCountDiff * 5); r_SupplyingGroup = null; r_SupplyingSquadrons = null; rCommand.PostToTransactionQueue(); }
public AirForceSquadronRelocationCountdown(AirForceGroup rpGroup, AirForceSquadron rpSquadron) { r_Group = rpGroup; r_Squadron = rpSquadron; }
internal AirForceGroupViewModel(AirForceGroup rpGroup) { Source = rpGroup; }