private static BattleInitializationData CreateBuffBaseBattleFromBattleTypeVO(string id, SquadWarBuffBaseData buffBaseData) { BattleInitializationData battleInitializationData = BattleInitializationData.CreateFromBattleTypeVO(id); battleInitializationData.BattleType = BattleType.PveBuffBase; battleInitializationData.Attacker.GuildId = Service.SquadController.StateManager.GetCurrentSquad().SquadID; battleInitializationData.AttackerGuildTroopsAvailable = BattleInitializationData.GetCurrentPlayerGuildTroops(); SquadWarManager warManager = Service.SquadController.WarManager; battleInitializationData.AttackerWarBuffs = warManager.GetBuffBasesOwnedBySquad(battleInitializationData.Attacker.GuildId); battleInitializationData.DefenderWarBuffs = null; SquadWarSquadData squadData = warManager.GetSquadData(SquadWarSquadType.PLAYER_SQUAD); SquadWarSquadData squadData2 = warManager.GetSquadData(SquadWarSquadType.OPPONENT_SQUAD); string ownerId = buffBaseData.OwnerId; if (!string.IsNullOrEmpty(ownerId)) { if (ownerId == squadData2.SquadId) { battleInitializationData.Defender.PlayerFaction = squadData2.Faction; } else if (ownerId == squadData.SquadId) { battleInitializationData.Defender.PlayerFaction = squadData.Faction; } } else { battleInitializationData.Defender.PlayerFaction = FactionType.Smuggler; } battleInitializationData.AttackerEquipment = BattleInitializationData.GetCurrentPlayerEquipment(battleInitializationData.PlanetId); battleInitializationData.DefenderEquipment = null; return(battleInitializationData); }
public static BattleInitializationData CreateFromCampaignMissionAndBattle(string id, string battleUid) { StaticDataController staticDataController = Service.StaticDataController; CampaignMissionVO campaignMissionVO = staticDataController.Get <CampaignMissionVO>(id); BattleInitializationData battleInitializationData = BattleInitializationData.CreateFromBattleTypeVO(battleUid); CampaignProgress campaignProgress = Service.CurrentPlayer.CampaignProgress; int missionLootCreditsRemaining = campaignProgress.GetMissionLootCreditsRemaining(campaignMissionVO); int missionLootMaterialsRemaining = campaignProgress.GetMissionLootMaterialsRemaining(campaignMissionVO); int missionLootContrabandRemaining = campaignProgress.GetMissionLootContrabandRemaining(campaignMissionVO); battleInitializationData.MissionUid = campaignMissionVO.Uid; battleInitializationData.LootCreditsAvailable = missionLootCreditsRemaining; battleInitializationData.LootMaterialsAvailable = missionLootMaterialsRemaining; battleInitializationData.LootContrabandAvailable = missionLootContrabandRemaining; battleInitializationData.BattleType = BattleType.PveAttack; battleInitializationData.BattleMusic = campaignMissionVO.BattleMusic; battleInitializationData.AmbientMusic = campaignMissionVO.AmbientMusic; battleInitializationData.BattleVO = staticDataController.Get <BattleTypeVO>(battleUid); battleInitializationData.AllowMultipleHeroDeploys = battleInitializationData.BattleVO.MultipleHeroDeploys; battleInitializationData.OverrideDeployables = battleInitializationData.BattleVO.OverridePlayerUnits; battleInitializationData.VictoryConditions = campaignMissionVO.Conditions; if (!string.IsNullOrEmpty(campaignMissionVO.FailureCondition)) { battleInitializationData.FailureCondition = staticDataController.Get <ConditionVO>(campaignMissionVO.FailureCondition); } battleInitializationData.IsReplay = false; battleInitializationData.IsRevenge = false; battleInitializationData.AllowReplay = false; battleInitializationData.AttackerEquipment = BattleInitializationData.GetCurrentPlayerEquipment(battleInitializationData.PlanetId); battleInitializationData.DefenderEquipment = null; return(battleInitializationData); }