public CountryController(ICountryRepository countryRepository, ICountryService countryService, IPresidentVotingRepository presidentVotingRepository, IWarService warService, ITransactionsService transactionService, IWarRepository warRepository, IRegionService regionService, IRegionRepository regionRepository, IEmbargoService embargoService, IEmbargoRepository embargoRepository, IWalletRepository walletRepository, IPopupService popupService, ICountryTreasureService countryTreasureService, IWalletService walletService, ICompanyService companyService, IMPPService mppService, IMilitaryProtectionPactRepository mppRepository, IMilitaryProtectionPactOfferRepository mppOfferRepository, ITransactionScopeProvider transactionScopeProvider, IConstructionRepository constructionRepository, IConstructionService constructionService) : base(popupService) { this.countryRepository = countryRepository; this.countryService = countryService; this.presidentVotingRepository = presidentVotingRepository; this.warService = warService; this.transactionService = transactionService; this.warRepository = warRepository; this.regionService = regionService; this.regionRepository = regionRepository; this.embargoService = embargoService; this.embargoRepository = embargoRepository; this.walletRepository = walletRepository; this.countryTreasureService = countryTreasureService; this.walletService = walletService; this.companyService = companyService; this.mppService = mppService; this.mppRepository = mppRepository; this.mppOfferRepository = mppOfferRepository; this.transactionScopeProvider = transactionScopeProvider; this.constructionRepository = constructionRepository; this.constructionService = constructionService; }
public MilitarySimulator(IMilitaryCalculator militaryCalculator, IWarRepository warRepository, IEconomicSimulator economicSimulator, IEmpireRepository empireRepository) { _militaryCalculator = militaryCalculator; _warRepository = warRepository; _economicSimulator = economicSimulator; _empireRepository = empireRepository; }
public HomeController(ICongressCandidateService congressCandidateService, IWarRepository warRepository, IArticleRepository articleRepository , IPopupService popupService, ICountryEventRepository countryEventRepository) : base(popupService) { this.congressCandidateService = congressCandidateService; this.warRepository = warRepository; this.articleRepository = articleRepository; this.countryEventRepository = countryEventRepository; }
public WarViewModel(Entities.War war, IWarService warService, IWarRepository warRepository) { Info = new WarInfoViewModel(war, warRepository, warService); foreach (var battle in war.Battles.OrderByDescending(b => b.Active).ThenByDescending(b => b.ID).ToList()) { ActiveBattles.Add(new SummaryBattleViewModel(battle)); } }
public BattleController(IBattleRepository battleRepository, IBattleService battleService, IWarRepository warRepository, IWarService warService, IProductRepository productRepository, IEquipmentRepository equipmentRepository, IPopupService popupService) : base(popupService) { this.battleRepository = battleRepository; this.battleService = battleService; this.warRepository = warRepository; this.warService = warService; this.productRepository = productRepository; this.equipmentRepository = equipmentRepository; }
public AvoidEnemiesRegionSelector(Country attackerCountry, IWarRepository warRepository, int destinationID) { List <int> countryInWar = getCountryInWar(attackerCountry, warRepository); DestinationID = destinationID; NoCrossCountries = countryInWar .Distinct() .ToArray(); }
public WarController(IWarRepository warRepository, IWarService warService, IBattleService battleService, ICountryRepository countryRepository, IRegionRepository regionRepository, Entities.Repository.IWalletRepository walletRepository, IPopupService popupService) : base(popupService) { this.warRepository = warRepository; this.warService = warService; this.battleService = battleService; this.countryRepository = countryRepository; this.regionRepository = regionRepository; this.walletRepository = walletRepository; }
public WarController(IMapper mapper, IRankingService rankingService, IWarRepository warRepo, IMatchFactory matchFactory, IMatchRepository matchRepository, IContestantRepository contestantRepository, IUserRepository userRepository, IVoteRepository voteRepository) { _mapper = mapper; _rankingService = rankingService; _warRepo = warRepo; _matchFactory = matchFactory; _matchRepository = matchRepository; _contestantRepository = contestantRepository; _userRepository = userRepository; _voteRepository = voteRepository; }
public TravelService(IRegionService regionService, IEquipmentService equipmentService, IEquipmentRepository equipmentRepository, IProductRepository productRepository, ICitizenRepository citizenRepository, IWarRepository warRepository, ITradeRepository tradeRepository, ITradeService tradeService) { this.regionService = Attach(regionService); this.equipmentService = Attach(equipmentService); this.equipmentRepository = equipmentRepository; this.citizenRepository = citizenRepository; this.productRepository = productRepository; this.warRepository = warRepository; this.tradeRepository = tradeRepository; this.tradeService = tradeService; }
private List <int> getCountryInWar(Country buyerCountry, IWarRepository warRepository) { List <int> countryIDs = warRepository.GetDirectWarsForCountry(buyerCountry.ID) .Select(w => w.AttackerCountryID == buyerCountry.ID ? w.DefenderCountryID : w.AttackerCountryID) .Distinct() .ToList(); countryIDs.AddRange(warRepository.GetDirectWarsForCountry(buyerCountry.ID) .SelectMany(w => w.CountryInWars.Where(c => c.IsAttacker == (buyerCountry.ID == w.AttackerCountryID))) .Select(ciw => ciw.CountryID) .Distinct() .ToList()); return(countryIDs); }
public WarService(IWarRepository warRepository, Entities.Repository.IWalletRepository walletRepository, ICountryRepository countryRepository, ITransactionsService transactionService, IWarningService warningService, ICitizenRepository citizenRepository, ICitizenService citizenService, IPopupService popupService, IWalletService walletService, IBattleRepository battleRepository, IWarEventService warEventService) { this.warRepository = warRepository; this.walletRepository = walletRepository; this.countryRepository = countryRepository; this.transactionService = Attach(transactionService); this.warningService = Attach(warningService); this.citizenRepository = citizenRepository; this.citizenService = citizenService; this.popupService = Attach(popupService); this.walletService = Attach(walletService); this.battleRepository = battleRepository; this.warEventService = warEventService; }
public CitizenController(ICitizenRepository citizenRepository, IEquipmentRepository equipmentRepository, IRegionRepository regionRepository , IRegionService regionService, ITravelService travelService, IWarRepository warRepository, Entities.Repository.IWalletRepository walletRepository, ICountryRepository countryRepository, ICitizenService citizenService, IPopupService popupService, IFriendService friendService, IFriendRepository friendRepository) : base(popupService) { this.citizenRepository = citizenRepository; this.equipmentRepository = equipmentRepository; this.regionRepository = regionRepository; this.regionService = regionService; this.travelService = travelService; this.warRepository = warRepository; this.walletRepository = walletRepository; this.countryRepository = countryRepository; this.citizenService = citizenService; this.friendService = friendService; this.friendRepository = friendRepository; }
public WarsPenaltyCostCalculator(Citizen citizen, IWarRepository warRepository, IRegionService regionService) : base(regionService) { EnemyCountriesIDs = warRepository.GetDirectWarsForCountry(citizen.CitizenshipID) .Select(w => w.AttackerCountryID == citizen.CitizenshipID ? w.DefenderCountryID : w.AttackerCountryID) .ToArray(); var indirectEnemiesIDs = warRepository.GetIndirectWarsForCountry(citizen.CitizenshipID) .SelectMany(w => w.CountryInWars) .Where(ciw => ciw.CountryID != citizen.CitizenshipID) .Select(ciw => ciw.CountryID) .ToList(); indirectEnemiesIDs.AddRange(warRepository.GetDirectWarsForCountry(citizen.CitizenshipID) .SelectMany(w => w.CountryInWars) .Select(ciw => ciw.CountryID) .ToList()); IndirectEnemyCountriesIDs = indirectEnemiesIDs.ToArray(); }
public BattleService(IBattleRepository battleRepository, IRegionRepository regionRepository, IWarService warService, IEquipmentRepository equipmentRepository, IWarningService warningService, ICountryRepository countryRepository, ITransactionsService transactionService, IRegionService regionService, IWarRepository warRepository, ICitizenRepository citizenRepository, ICitizenService citizenService, IEntityRepository entityRepository, IBattleEventService battleEventService) { this.battleRepository = battleRepository; this.regionRepository = regionRepository; this.warService = Attach(warService); this.equipmentRepository = equipmentRepository; this.warningService = Attach(warningService); this.countryRepository = countryRepository; this.transactionService = Attach(transactionService); this.regionService = Attach(regionService); this.warRepository = warRepository; this.citizenRepository = citizenRepository; this.citizenService = citizenService; this.entityRepository = entityRepository; this.battleEventService = battleEventService; }
public StartBattleViewModel(Entities.War war, IWarRepository warRepository, IWarService warSerivce) { Info = new WarInfoViewModel(war, warRepository, warSerivce); var warSide = warSerivce.GetWarSide(war, SessionHelper.CurrentEntity); ConquerableRegions.Add(new SelectListItem() { Value = "null", Text = "-- Select region --" }); ConquerableRegions.AddRange(warRepository.GetAttackableRegions(war.ID, warSide == WarSideEnum.Attacker) .Select(r => new { Name = r.Name, ID = r.ID }) .ToList() .Select(r => new SelectListItem() { Value = r.ID.ToString(), Text = r.Name }) .ToList()); }
public DiplomacySimulator(IDiplomacyCalculator diplomacyCalculator, IWarRepository warRepository, IEmpireRepository empireRepository) { _diplomacyCalculator = diplomacyCalculator; _warRepository = warRepository; _empireRepository = empireRepository; }
public BattleViewModel(Entities.Battle battle, IBattleRepository battleRepository, IBattleService battleService, IWarRepository warRepository, IWarService warService) { Info = new WarInfoViewModel(battle.War, warRepository, warService); initBasic(battle); initCanFight(battle, warService); initTime(battle); IsActive = battle.Active; CanFight = (CanFighstAsDefender || CanFightAsAttacker) && IsActive && WaitingForResolve == false; if (IsActive == false) { AttackerWon = battle.WonByAttacker; GoldTaken = (double?)battle.GoldTaken; } addRealLastParticipants(battle); addDummiesIfNeeded(); AttackerInitiated = battle.AttackerInitiatedBattle; var attackerHero = battleService.GetBattleHero(battle, true); var defenderHero = battleService.GetBattleHero(battle, false); if (attackerHero != null) { AttackerHero = new ShortBattleParticipantViewModel(attackerHero); } if (defenderHero != null) { DefenderHero = new ShortBattleParticipantViewModel(defenderHero); } if (battle.War.IsTrainingWar) { CanFighstAsDefender = true; CanFight = SessionHelper.CurrentEntity.Is(EntityTypeEnum.Citizen); CanFightAsAttacker = true; RegionName = "Edge of the Earth"; TimeLeft = ""; WaitingForResolve = false; } if (CanFight) { AvailableWeaponQualities = battleService.GetUsableQualitiesOfWeapons(SessionHelper.LoggedCitizen); } AttackerName = Info.Info.Attacker.Name; DefenderName = Info.Info.Defender.Name; if (battle.AttackerInitiatedBattle == false) { AttackerName = Info.Info.Defender.Name; DefenderName = Info.Info.Attacker.Name; } }
public WarInfoViewModel(Entities.War war, IWarRepository warRepository, IWarService warService) { Info = new ShortWarInfoViewModel(war, warService); Active = war.Active; var countriesInWar = warRepository.GetCountriesInWar(war.ID); var countries = new { Attackers = countriesInWar. Where(ciw => ciw.IsAttacker) .Select(ciw => ciw.Country) .ToList(), Defenders = countriesInWar .Where(ciw => ciw.IsAttacker == false) .Select(ciw => ciw.Country) .ToList() }; IsRessistance = war.IsRessistanceWar; foreach (var attacker in countries.Attackers) { AttackerAllies.Add(new ShortWarCountryInfoViewModel(attacker)); } foreach (var defender in countries.Defenders) { DefendedAllies.Add(new ShortWarCountryInfoViewModel(defender)); } var entity = SessionHelper.CurrentEntity; var operatedCountry = warService.GetControlledCountryInWar(entity, war); CanInitiateBattle = warService.CanStartBattle(entity, operatedCountry, war).isSuccess; CanInitiateSurrender = warService.CanSurrenderWar(war, entity).isSuccess; if (Active) { WarStateText = "Active"; if (war.AttackerOfferedSurrender == true) { WarStateText = "Attacker offered surrender"; } else if (war.AttackerOfferedSurrender == false) { WarStateText = "Defender offered surrender"; } } else { WarStateText = "Inactive"; } var warSide = warService.GetWarSide(war, SessionHelper.CurrentEntity); if (war.AttackerOfferedSurrender.HasValue == false && CanInitiateSurrender) { SurrenderText = "Send surrender offer"; } if (((war.AttackerOfferedSurrender == true && warSide == WarSideEnum.Defender) || (war.AttackerOfferedSurrender == false && warSide == WarSideEnum.Attacker)) && CanInitiateSurrender) { SurrenderText = "Accept surrender"; } CanCancelSurrender = warService.CanCancelSurrender(war, SessionHelper.CurrentEntity).isSuccess; var attackerHero = warService.GetWarHero(war, true); var defenderHero = warService.GetWarHero(war, false); if (attackerHero != null) { AttackerHero = new ShortBattleParticipantViewModel(attackerHero); } if (defenderHero != null) { DefenderHero = new ShortBattleParticipantViewModel(defenderHero); } if (war.IsTrainingWar) { AttackerAllies = new List <ShortWarCountryInfoViewModel>(); DefendedAllies = new List <ShortWarCountryInfoViewModel>(); CanCancelSurrender = CanInitiateBattle = CanInitiateSurrender = false; } //testAddAllies(war); createMenu(); }