public EatResponse OnEvent(EventId id, object cookie) { if (id != EventId.PvpBattleStarting) { if (id == EventId.BattleEndFullyProcessed) { this.eventManager.UnregisterObserver(this, EventId.BattleEndFullyProcessed); CurrentBattle currentBattle = Service.BattleController.GetCurrentBattle(); if (currentBattle.Won) { this.parent.CompleteMission(currentBattle.EarnedStars); if (this.parent.OnSuccessHook()) { base.PauseBattle(); } } else if (this.parent.OnFailureHook()) { base.PauseBattle(); } } } else { this.eventManager.RegisterObserver(this, EventId.BattleEndFullyProcessed, EventPriority.Default); Service.BattleController.GetCurrentBattle().PvpMissionUid = this.parent.MissionVO.Uid; } return(EatResponse.NotEaten); }
public EatResponse OnEvent(EventId id, object cookie) { if (id == EventId.BattleEndProcessing) { if (this.IsEventValidForGoal()) { CurrentBattle currentBattle = Service.BattleController.GetCurrentBattle(); int num = 0; if (this.itemType == 0) { num = currentBattle.LootCreditsEarned; } else if (this.itemType == 1) { num = currentBattle.LootMaterialsEarned; } else if (this.itemType == 2) { num = currentBattle.LootContrabandEarned; } if (num > 0) { this.parent.Progress(this, num); } } } return(EatResponse.NotEaten); }
public EatResponse OnEvent(EventId id, object cookie) { if (id != EventId.BattleEndFullyProcessed) { if (id == EventId.GameStateChanged) { if (Service.Get <GameStateMachine>().CurrentState is HomeState) { this.parent.CancelMission(); } } } else { this.RemoveListeners(); CurrentBattle currentBattle = Service.Get <BattleController>().GetCurrentBattle(); CurrentPlayer currentPlayer = Service.Get <CurrentPlayer>(); currentPlayer.CampaignProgress.UpdateMissionLoot(this.parent.MissionVO.Uid, currentBattle); if (currentBattle.Won) { this.parent.CompleteMission(currentBattle.EarnedStars); if (this.parent.OnSuccessHook()) { base.PauseBattle(); } } else if (this.parent.OnFailureHook()) { base.PauseBattle(); } } return(EatResponse.NotEaten); }
private void ProcessSkin(GeometryTag cookie) { if (!(cookie.geometry is TroopTypeVO)) { return; } TroopTypeVO troop = cookie.geometry as TroopTypeVO; ProjectorConfig projector = cookie.projector; TeamType team = TeamType.Attacker; CurrentBattle currentBattle = Service.BattleController.GetCurrentBattle(); if (currentBattle != null && !string.IsNullOrEmpty(currentBattle.MissionId)) { CampaignMissionVO campaignMissionVO = Service.StaticDataController.Get <CampaignMissionVO>(currentBattle.MissionId); if (campaignMissionVO != null && campaignMissionVO.IsRaidDefense()) { team = TeamType.Defender; } } SkinTypeVO applicableSkin = this.GetApplicableSkin(troop, cookie.armory, cookie.battle, team); if (applicableSkin != null) { ProjectorConfig config = ProjectorUtils.GenerateGeometryConfig(applicableSkin, projector.FrameSprite, projector.closeup); projector.MakeEquivalentTo(config); } }
private void SetStandardDataForAction(out string tier1, out string tier2, out string tier6) { string text = "u"; string text2 = "u"; string text3 = string.Empty; int num = -1; string text4 = string.Empty; if (Service.IsSet <CurrentPlayer>()) { CurrentPlayer currentPlayer = Service.Get <CurrentPlayer>(); text = currentPlayer.Faction.ToString(); text2 = currentPlayer.PlanetId; if (currentPlayer.Map != null) { num = currentPlayer.Map.FindHighestHqLevel(); } } if (Service.IsSet <SquadController>()) { SquadController squadController = Service.Get <SquadController>(); text3 = ((squadController.StateManager.GetCurrentSquad() != null) ? squadController.StateManager.GetCurrentSquad().SquadID : string.Empty); } if (Service.IsSet <BattleController>()) { CurrentBattle currentBattle = Service.Get <BattleController>().GetCurrentBattle(); if (currentBattle != null) { text4 = currentBattle.BattleUid; } } tier1 = text + "|" + num; tier2 = text2; tier6 = text3 + "|" + text4; }
protected override void BecomeConfused() { foreach (CombatantActionEvent e in CurrentBattle.GetEventsFromSource(this)) { // TODO: each event needs a new set of targets. } }
public void OnPvpBattleComplete(PvpBattleEndResponse endResponse, object cookie) { CurrentPlayer currentPlayer = Service.Get <CurrentPlayer>(); currentPlayer.BattleHistory.AddBattle(endResponse.BattleEntry); this.CurrentPvpTarget = null; CurrentBattle currentBattle = Service.Get <BattleController>().GetCurrentBattle(); currentBattle.Attacker = endResponse.BattleEntry.Attacker; currentBattle.Defender = endResponse.BattleEntry.Defender; currentPlayer.AttackRating += endResponse.BattleEntry.Attacker.AttackRatingDelta; currentPlayer.DefenseRating += endResponse.BattleEntry.Attacker.DefenseRatingDelta; if (endResponse.BattleEntry.Won) { CurrentPlayer expr_93 = currentPlayer; int attacksWon = expr_93.AttacksWon; expr_93.AttacksWon = attacksWon + 1; } AchievementController achievementController = Service.Get <AchievementController>(); achievementController.TryUnlockAchievementByValue(AchievementType.LootCreditsPvp, currentPlayer.BattleHistory.GetTotalPvpCreditsLooted()); achievementController.TryUnlockAchievementByValue(AchievementType.LootAlloyPvp, currentPlayer.BattleHistory.GetTotalPvpMaterialLooted()); achievementController.TryUnlockAchievementByValue(AchievementType.LootContrabandPvp, currentPlayer.BattleHistory.GetTotalPvpContrabandLooted()); achievementController.TryUnlockAchievementByValue(AchievementType.PvpWon, currentPlayer.BattleHistory.GetTotalPvpWins()); this.recentBattleList.Add(endResponse.BattleEntry); Service.Get <TournamentController>().OnPvpBattleComplete(endResponse.TournamentData, currentBattle.Attacker.TournamentRatingDelta); }
private void SetStandardDataForAction(out string tier1, out string tier2, out string tier6) { string arg = "u"; string text = "u"; string str = string.Empty; int num = -1; string str2 = string.Empty; if (Service.CurrentPlayer != null) { CurrentPlayer currentPlayer = Service.CurrentPlayer; arg = currentPlayer.Faction.ToString(); text = currentPlayer.PlanetId; if (currentPlayer.Map != null) { num = currentPlayer.Map.FindHighestHqLevel(); } } if (Service.SquadController != null) { SquadController squadController = Service.SquadController; str = ((squadController.StateManager.GetCurrentSquad() == null) ? string.Empty : squadController.StateManager.GetCurrentSquad().SquadID); } if (Service.BattleController != null) { CurrentBattle currentBattle = Service.BattleController.GetCurrentBattle(); if (currentBattle != null) { str2 = currentBattle.BattleUid; } } tier1 = arg + "|" + num; tier2 = text; tier6 = str + "|" + str2; }
private void HandleBattleEndedEvent(object cookie) { Service.Get <PerformanceMonitor>().UnregisterFPSObserver(this); CurrentBattle currentBattle = this.battleController.GetCurrentBattle(); this.battleRecord.BattleAttributes.BattleEndedAt = this.battleController.Now; this.battleRecord.BattleAttributes.TimeLeft = currentBattle.TimeLeft; this.battleRecord.BattleAttributes.DamagePercentage = currentBattle.DamagePercent; this.battleRecord.BattleAttributes.LootCreditsEarned = currentBattle.LootCreditsEarned; this.battleRecord.BattleAttributes.LootMaterialsEarned = currentBattle.LootMaterialsEarned; this.battleRecord.BattleAttributes.LootContrabandEarned = currentBattle.LootContrabandEarned; this.eventManager.SendEvent(EventId.BattleEndRecorded, null); if ((float)GameConstants.FPS_THRESHOLD > this.battleRecord.LowestFPS) { GamePlayer worldOwner = GameUtils.GetWorldOwner(); StringBuilder stringBuilder = new StringBuilder(); stringBuilder.Append("battle: "); stringBuilder.Append(this.battleRecord.RecordId); stringBuilder.Append("|"); stringBuilder.Append(worldOwner.CurrentXPAmount); stringBuilder.Append("|"); stringBuilder.Append(currentBattle.DefenderBaseScore); Service.Get <BILoggingController>().TrackLowFPS(stringBuilder.ToString()); } }
private void ProcessSkin(SmartEntity entity) { ActiveArmory activeArmory = (!(Service.GameStateMachine.CurrentState is HomeState)) ? null : Service.CurrentPlayer.ActiveArmory; CurrentBattle battle = (activeArmory != null) ? null : Service.BattleController.GetCurrentBattle(); SkinTypeVO applicableSkin = this.GetApplicableSkin((TroopTypeVO)entity.TroopComp.TroopType, activeArmory, battle, entity.TeamComp.TeamType); if (applicableSkin != null) { entity.TroopComp.AssetName = applicableSkin.AssetName; entity.TroopComp.AudioVO = applicableSkin; if (entity.ShooterComp != null) { entity.ShooterComp.isSkinned = true; } if (applicableSkin.Override != null) { entity.TroopComp.TroopShooterVO = new SkinnedTroopShooterFacade(entity.TroopComp.TroopShooterVO, applicableSkin.Override); entity.TroopComp.OriginalTroopShooterVO = new SkinnedTroopShooterFacade(entity.TroopComp.OriginalTroopShooterVO, applicableSkin.Override); if (entity.ShooterComp != null) { entity.ShooterComp.SetVOData(new SkinnedShooterFacade(entity.ShooterComp.ShooterVO, applicableSkin.Override)); entity.ShooterComp.OriginalShooterVO = new SkinnedShooterFacade(entity.ShooterComp.OriginalShooterVO, applicableSkin.Override); } } if (entity.WalkerComp != null) { entity.WalkerComp.SetVOData(applicableSkin); } } }
public bool UpdateMissionLoot(string uid, CurrentBattle battle) { if (this.missions.ContainsKey(uid)) { this.missions[uid].SetLootRemaining(battle.LootCreditsAvailable - battle.LootCreditsEarned, battle.LootMaterialsAvailable - battle.LootMaterialsEarned, battle.LootContrabandAvailable - battle.LootContrabandEarned); return(true); } return(false); }
protected override void BecomeConfused() { if (WaitingToResolve) { CurrentBattle.PruneEventsFromSource(this, "became confused"); WaitingToResolve = false; } }
private void AddVisitorToValidate(BuffTypeVO buffType, string summonUid, int numVisitors) { if (buffType.AppliesOnlyToSelf()) { CurrentBattle currentBattle = Service.BattleController.GetCurrentBattle(); int num = 0; currentBattle.NumVisitors.TryGetValue(summonUid, out num); currentBattle.NumVisitors[summonUid] = num + numVisitors; } }
private void ReplayLastBattleOrReplay() { CurrentBattle currentBattle = Service.Get <BattleController>().GetCurrentBattle(); ReplayMapDataLoader replayMapDataLoader = Service.Get <ReplayMapDataLoader>(); BattleRecord battleRecord = Service.Get <BattleRecordController>().BattleRecord; BattleEntry battleEntry = currentBattle.Clone(); replayMapDataLoader.InitializeFromData(battleEntry, battleRecord); BattlePlaybackState.GoToBattlePlaybackState(battleRecord, battleEntry, replayMapDataLoader); this.LogReplayViewed(battleEntry.RecordID, battleEntry.Defender.PlayerId, battleEntry.SharerPlayerId); }
public override void AcceptMPLoss(Combatant source, int delta) { CurrentBattle.AddDamageIcon(delta, this, true); _c.MP -= delta; if (source is Enemy) { LastAttacker = source; } }
public override void Recover(Combatant source) { CurrentBattle.AddRecoveryIcon(this); if (Death) { CureDeath(source); } _hp = MaxHP; _mp = MaxMP; }
public void RegisterChampionPlatforms(CurrentBattle currentBattle) { SmartEntity smartEntity = null; TroopTypeVO troopTypeVO = null; bool flag = false; NodeList <BuildingNode> nodeList = Service.EntityController.GetNodeList <BuildingNode>(); for (BuildingNode buildingNode = nodeList.Head; buildingNode != null; buildingNode = buildingNode.Next) { flag = false; smartEntity = (SmartEntity)buildingNode.Entity; troopTypeVO = this.FindChampionTypeIfPlatform(smartEntity.BuildingComp.BuildingType); if (buildingNode.BuildingComp.BuildingType.Type == BuildingType.ChampionPlatform) { if (currentBattle.Type == BattleType.PveAttack || currentBattle.Type == BattleType.ClientBattle || currentBattle.Type == BattleType.PveBuffBase || currentBattle.Type == BattleType.PvpAttackSquadWar) { if (troopTypeVO != null && smartEntity != null) { this.AddDefensiveChampionToPlatfrom(smartEntity, troopTypeVO); } } else if (troopTypeVO != null && currentBattle.DisabledBuildings != null && !currentBattle.DisabledBuildings.Contains(buildingNode.BuildingComp.BuildingTO.Key)) { if (currentBattle.IsPvP()) { if (currentBattle.DefenderChampionsAvailable != null) { foreach (KeyValuePair <string, int> current in currentBattle.DefenderChampionsAvailable) { if (current.Key == troopTypeVO.Uid && current.Value > 0) { flag = true; } } } } else if (currentBattle.Type == BattleType.PveDefend && !ContractUtils.IsBuildingUpgrading(smartEntity) && !ContractUtils.IsChampionRepairing(smartEntity)) { Inventory inventory = Service.CurrentPlayer.Inventory; bool flag2 = inventory.Champion.HasItem(troopTypeVO.Uid) && inventory.Champion.GetItemAmount(troopTypeVO.Uid) > 0; if (flag2) { flag = true; } } if (flag) { this.AddDefensiveChampionToPlatfrom(smartEntity, troopTypeVO); } } } } }
public void StartRecord() { this.EraseRecord(); foreach (EventId current in this.eventHandlers.Keys) { this.eventManager.RegisterObserver(this, current, EventPriority.Default); } this.battleRecord.LowestFPS = 9999f; Service.Get <PerformanceMonitor>().RegisterFPSObserver(this); this.battleRecord.SimSeed = this.battleController.SimSeed; this.battleRecord.ViewTimePassedPreBattle = this.battleController.ViewTimePassedPreBattle; this.battleRecord.CombatEncounter = Service.Get <CombatEncounterController>().GetCurrentCombatEncounter(); CurrentBattle currentBattle = this.battleController.GetCurrentBattle(); this.battleRecord.RecordId = currentBattle.RecordID; this.battleRecord.BattleType = currentBattle.Type; this.battleRecord.AttackerDeploymentData = BattleDeploymentData.Copy(currentBattle.AttackerDeployableData); this.battleRecord.DefenderDeploymentData = BattleDeploymentData.Copy(currentBattle.DefenderDeployableData); this.battleRecord.DefenderGuildTroops = currentBattle.DefenderGuildTroopsAvailable; this.battleRecord.AttackerGuildTroops = currentBattle.AttackerGuildTroopsAvailable; this.battleRecord.LootCreditsAvailable = currentBattle.LootCreditsAvailable; this.battleRecord.LootMaterialsAvailable = currentBattle.LootMaterialsAvailable; this.battleRecord.LootContrabandAvailable = currentBattle.LootContrabandAvailable; this.battleRecord.BuildingLootCreditsMap = currentBattle.BuildingLootCreditsMap; this.battleRecord.BuildingLootMaterialsMap = currentBattle.BuildingLootMaterialsMap; this.battleRecord.BuildingLootContrabandMap = currentBattle.BuildingLootContrabandMap; this.battleRecord.DefenderChampions = currentBattle.DefenderChampionsAvailable; this.battleRecord.CmsVersion = Service.Get <FMS>().GetFileVersion("patches/base.json").ToString(); this.battleRecord.BattleVersion = "21.0"; this.battleRecord.PlanetId = currentBattle.PlanetId; this.battleRecord.BattleLength = currentBattle.TimeLeft; this.battleRecord.DisabledBuildings = currentBattle.DisabledBuildings; this.battleRecord.victoryConditionsUids = new List <string>(); for (int i = 0; i < currentBattle.VictoryConditions.Count; i++) { this.battleRecord.victoryConditionsUids.Add(currentBattle.VictoryConditions[i].Uid); } if (currentBattle.FailureCondition != null) { this.battleRecord.failureConditionUid = currentBattle.FailureCondition.Uid; } else { this.battleRecord.failureConditionUid = ""; } this.battleRecord.BattleAttributes.AddDeviceInfo(); this.battleRecord.DefenseEncounterProfile = currentBattle.DefenseEncounterProfile; this.battleRecord.AttackerWarBuffs = currentBattle.AttackerWarBuffs; this.battleRecord.DefenderWarBuffs = currentBattle.DefenderWarBuffs; this.battleRecord.AttackerEquipment = currentBattle.AttackerEquipment; this.battleRecord.DefenderEquipment = currentBattle.DefenderEquipment; }
public override void AcceptDamage(Combatant source, int delta, AttackType type = AttackType.None) { CurrentBattle.AddDamageIcon(delta, this); // limit shtuff goes here if (type == AttackType.Physical) { if (Sleep) { CureSleep(source); } if (Confusion) { CureConfusion(source); } } int hp = _c.HP - delta; if (hp < 0) { hp = 0; } else if (hp >= _c.MaxHP) { hp = _c.MaxHP; } _c.HP = hp; if (HP == 0) { Kill(); } if (source is Enemy) { LastAttacker = source; switch (type) { case AttackType.Physical: LastAttackerPhysical = source; break; case AttackType.Magical: LastAttackerMagical = source; break; } } }
public void RegisterTraps(CurrentBattle currentBattle) { NodeList <TrapNode> nodeList = Service.Get <EntityController>().GetNodeList <TrapNode>(); for (TrapNode trapNode = nodeList.Head; trapNode != null; trapNode = trapNode.Next) { if (currentBattle.DisabledBuildings == null || !currentBattle.DisabledBuildings.Contains(trapNode.BuildingComp.BuildingTO.Key)) { TrapCombatTrigger combatTrigger = new TrapCombatTrigger(trapNode); this.ctm.RegisterTrigger(combatTrigger); } } }
public EatResponse OnEvent(EventId id, object cookie) { BattleController battleController = Service.BattleController; CurrentBattle currentBattle = battleController.GetCurrentBattle(); bool flag = currentBattle != null && currentBattle.Canceled; if ((id == EventId.WorldInTransitionComplete || id == EventId.HoloCommScreenDestroyed) && flag) { this.PlayActiveEquipmentAnimation(); return(EatResponse.NotEaten); } if (cookie == null) { return(EatResponse.NotEaten); } SmartEntity smartEntity = (SmartEntity)cookie; if (smartEntity == null || smartEntity.TroopComp == null) { return(EatResponse.NotEaten); } string uid = smartEntity.TroopComp.TroopType.Uid; if (uid != this.DeployableUid) { return(EatResponse.NotEaten); } switch (id) { case EventId.HeroDeployed: this.HeroEntityID = smartEntity.ID; break; case EventId.TroopAbilityDeactivate: this.PutHeroAbilityOnCoolDown(); break; case EventId.TroopAbilityCoolDownComplete: this.StopCoolDown(); this.PrepareHeroAbility(); break; case EventId.HeroKilled: this.Disable(); this.StopObserving(); break; } return(EatResponse.NotEaten); }
public BattleEndRequest(CurrentBattle battle, Dictionary <string, int> seededTroopsDeployed, Dictionary <string, int> defendingUnitsKilled, Dictionary <string, int> attackingUnitsKilled, Dictionary <string, int> defenderGuildUnitsSpent, Dictionary <string, int> attackerGuildUnitsSpent, Dictionary <string, int> lootEarned, Dictionary <string, int> buildingHealthMap, Dictionary <string, string> buildingUids, List <string> unarmedTraps, BattleRecord replayData) { this.battle = battle; this.seededTroopsDeployed = seededTroopsDeployed; this.defendingUnitsKilled = defendingUnitsKilled; this.attackingUnitsKilled = attackingUnitsKilled; this.defenderGuildUnitsSpent = ((defenderGuildUnitsSpent == null) ? new Dictionary <string, int>() : defenderGuildUnitsSpent); this.attackerGuildUnitsSpent = ((attackerGuildUnitsSpent == null) ? new Dictionary <string, int>() : attackerGuildUnitsSpent); this.lootEarned = ((lootEarned == null) ? new Dictionary <string, int>() : lootEarned); this.buildingHealthMap = buildingHealthMap; this.buildingUids = buildingUids; this.unarmedTraps = ((unarmedTraps == null) ? new List <string>() : unarmedTraps); this.replayData = replayData; this.planetId = Service.CurrentPlayer.PlanetId; }
public static int get_RealTimePVPBattleReport(IntPtr l) { int result; try { CurrentBattle currentBattle = (CurrentBattle)LuaObject.checkSelf(l); LuaObject.pushValue(l, true); LuaObject.pushValue(l, currentBattle.RealTimePVPBattleReport); result = 2; } catch (Exception e) { result = LuaObject.error(l, e); } return(result); }
public static int get_ArenaDefenderTrainTechs(IntPtr l) { int result; try { CurrentBattle currentBattle = (CurrentBattle)LuaObject.checkSelf(l); LuaObject.pushValue(l, true); LuaObject.pushValue(l, currentBattle.ArenaDefenderTrainTechs); result = 2; } catch (Exception e) { result = LuaObject.error(l, e); } return(result); }
public static int get_IsArenaRevenge(IntPtr l) { int result; try { CurrentBattle currentBattle = (CurrentBattle)LuaObject.checkSelf(l); LuaObject.pushValue(l, true); LuaObject.pushValue(l, currentBattle.IsArenaRevenge); result = 2; } catch (Exception e) { result = LuaObject.error(l, e); } return(result); }
public static int get_BattleType(IntPtr l) { int result; try { CurrentBattle currentBattle = (CurrentBattle)LuaObject.checkSelf(l); LuaObject.pushValue(l, true); LuaObject.pushEnum(l, (int)currentBattle.BattleType); result = 2; } catch (Exception e) { result = LuaObject.error(l, e); } return(result); }
public static int Clear(IntPtr l) { int result; try { CurrentBattle currentBattle = (CurrentBattle)LuaObject.checkSelf(l); currentBattle.Clear(); LuaObject.pushValue(l, true); result = 1; } catch (Exception e) { result = LuaObject.error(l, e); } return(result); }
public static int constructor(IntPtr l) { int result; try { CurrentBattle o = new CurrentBattle(); LuaObject.pushValue(l, true); LuaObject.pushValue(l, o); result = 2; } catch (Exception e) { result = LuaObject.error(l, e); } return(result); }
public static int set_IsArenaRevenge(IntPtr l) { int result; try { CurrentBattle currentBattle = (CurrentBattle)LuaObject.checkSelf(l); bool isArenaRevenge; LuaObject.checkType(l, 2, out isArenaRevenge); currentBattle.IsArenaRevenge = isArenaRevenge; LuaObject.pushValue(l, true); result = 1; } catch (Exception e) { result = LuaObject.error(l, e); } return(result); }
public static int set_BattleType(IntPtr l) { int result; try { CurrentBattle currentBattle = (CurrentBattle)LuaObject.checkSelf(l); BattleType battleType; LuaObject.checkEnum <BattleType>(l, 2, out battleType); currentBattle.BattleType = battleType; LuaObject.pushValue(l, true); result = 1; } catch (Exception e) { result = LuaObject.error(l, e); } return(result); }