protected override void DoLoadingForGameManager( GameManagerLoadingSteps gameManagerLoadingStep, out GameManagerLoadingSteps nextStep) { nextStep = GameManagerLoadingSteps.None; switch (gameManagerLoadingStep) { case GameManagerLoadingSteps.PreInitializeZerothStep: nextStep = GameManagerLoadingSteps.FirstInitializeFirstStep; break; case GameManagerLoadingSteps.FirstInitializeFirstStep: LoadModuleData(false); nextStep = GameManagerLoadingSteps.WaitSecondStep; break; case GameManagerLoadingSteps.WaitSecondStep: StartNewGame(); nextStep = GameManagerLoadingSteps.SecondInitializeThirdState; break; case GameManagerLoadingSteps.SecondInitializeThirdState: MBGlobals.InitializeReferences(); { MBDebug.Print("Initializing new game begin..."); var campaign = new Campaign(); TaleWorlds.Core.Game.CreateGame(campaign, this); campaign.SetLoadingParameters(TaleWorlds.CampaignSystem.Campaign.GameLoadingType.NewCampaign, _seed); MBDebug.Print("Initializing new game end..."); } TaleWorlds.Core.Game.Current.DoLoading(); nextStep = GameManagerLoadingSteps.PostInitializeFourthState; break; case GameManagerLoadingSteps.PostInitializeFourthState: bool flag = true; foreach (MBSubModuleBase subModule in Module.CurrentModule.SubModules) { flag = flag && subModule.DoLoading(TaleWorlds.Core.Game.Current); } nextStep = flag ? GameManagerLoadingSteps.FinishLoadingFifthStep : GameManagerLoadingSteps.PostInitializeFourthState; break; case GameManagerLoadingSteps.FinishLoadingFifthStep: nextStep = TaleWorlds.Core.Game.Current.DoLoading() ? GameManagerLoadingSteps.None : GameManagerLoadingSteps.FinishLoadingFifthStep; EnhancedBattleTestPartyController.Initialize(); break; } }
protected override void DoLoadingForGameManager(GameManagerLoadingSteps gameManagerLoadingStep, out GameManagerLoadingSteps nextStep) { nextStep = GameManagerLoadingSteps.None; switch (gameManagerLoadingStep) { case GameManagerLoadingSteps.PreInitializeZerothStep: MBGameManager.LoadModuleData(false); MBGlobals.InitializeReferences(); new Game(new CommunityTestGame(), this).DoLoading(); nextStep = GameManagerLoadingSteps.FirstInitializeFirstStep; return; case GameManagerLoadingSteps.FirstInitializeFirstStep: { bool flag = true; foreach (MBSubModuleBase mbsubModuleBase in Module.CurrentModule.SubModules) { flag = (flag && mbsubModuleBase.DoLoading(Game.Current)); } nextStep = (flag ? GameManagerLoadingSteps.WaitSecondStep : GameManagerLoadingSteps.FirstInitializeFirstStep); return; } case GameManagerLoadingSteps.WaitSecondStep: MBGameManager.StartNewGame(); nextStep = GameManagerLoadingSteps.SecondInitializeThirdState; return; case GameManagerLoadingSteps.SecondInitializeThirdState: nextStep = (Game.Current.DoLoading() ? GameManagerLoadingSteps.PostInitializeFourthState : GameManagerLoadingSteps.SecondInitializeThirdState); return; case GameManagerLoadingSteps.PostInitializeFourthState: nextStep = GameManagerLoadingSteps.FinishLoadingFifthStep; return; case GameManagerLoadingSteps.FinishLoadingFifthStep: nextStep = GameManagerLoadingSteps.None; return; default: return; } }
public override bool DoLoading( ) { bool result = false; if (this._stepNo == 0) { MBGameManager.LoadModuleData(false); MBGlobals.InitializeReferences(); new Game(new CaptureTheBannerLordGame(), this).DoLoading(); this._stepNo++; } else if (this._stepNo == 1) { bool flag = true; foreach (MBSubModuleBase mbsubModuleBase in Module.CurrentModule.SubModules) { flag = (flag && mbsubModuleBase.DoLoading(Game.Current)); } if (flag) { this._stepNo++; } } else if (this._stepNo == 2) { MBGameManager.StartNewGame(); this._stepNo++; } else if (this._stepNo == 3) { if (Game.Current.DoLoading()) { this._stepNo++; } } else { result = true; } return(result); }
protected override void DoLoadingForGameManager( GameManagerLoadingSteps gameManagerLoadingStep, out GameManagerLoadingSteps nextStep) { nextStep = GameManagerLoadingSteps.None; switch (gameManagerLoadingStep) { case GameManagerLoadingSteps.PreInitializeZerothStep: MBGameManager.LoadModuleData(false); MBGlobals.InitializeReferences(); TaleWorlds.Core.Game.CreateGame(new T(), this).DoLoading(); nextStep = GameManagerLoadingSteps.FirstInitializeFirstStep; break; case GameManagerLoadingSteps.FirstInitializeFirstStep: bool flag = true; foreach (MBSubModuleBase subModule in Module.CurrentModule.SubModules) { flag = flag && subModule.DoLoading(TaleWorlds.Core.Game.Current); } nextStep = flag ? GameManagerLoadingSteps.WaitSecondStep : GameManagerLoadingSteps.FirstInitializeFirstStep; break; case GameManagerLoadingSteps.WaitSecondStep: MBGameManager.StartNewGame(); nextStep = GameManagerLoadingSteps.SecondInitializeThirdState; break; case GameManagerLoadingSteps.SecondInitializeThirdState: nextStep = TaleWorlds.Core.Game.Current.DoLoading() ? GameManagerLoadingSteps.PostInitializeFourthState : GameManagerLoadingSteps.SecondInitializeThirdState; break; case GameManagerLoadingSteps.PostInitializeFourthState: nextStep = GameManagerLoadingSteps.FinishLoadingFifthStep; break; case GameManagerLoadingSteps.FinishLoadingFifthStep: nextStep = GameManagerLoadingSteps.None; break; } }
public override Agent SpawnTroop(BattleSideEnum side, bool hasFormation, bool spawnWithHorse, bool isReinforcement, bool enforceSpawningOnInitialPoint, int formationTroopCount, int formationTroopIndex, bool isAlarmed, bool wieldInitialWeapons, bool forceDismounted = false, string specialActionSet = null, MatrixFrame?initFrame = null) { BasicCharacterObject troop = Troop; var team = IsUnderPlayersCommand ? Mission.Current.PlayerTeam : Mission.Current.PlayerEnemyTeam; MatrixFrame frame = initFrame ?? Mission.Current .GetFormationSpawnFrame(team.Side, FormationClass.NumberOfRegularFormations, false).ToGroundMatrixFrame(); if (SPCharacter.IsPlayer && !forceDismounted) { spawnWithHorse = true; } AgentBuildData agentBuildData = new AgentBuildData(this) .Team(team).Banner(Banner) .ClothingColor1(team.Color).ClothingColor2(team.Color2) .NoHorses(!spawnWithHorse).CivilianEquipment(Mission.Current.DoesMissionRequireCivilianEquipment); agentBuildData.IsFemale(SPCharacter.IsFemale); if (!SPCharacter.IsPlayer) { agentBuildData.IsReinforcement(isReinforcement).SpawnOnInitialPoint(enforceSpawningOnInitialPoint); } if (!hasFormation || SPCharacter.IsPlayer) { agentBuildData.InitialFrame(frame); } if (spawnWithHorse) { agentBuildData.MountKey(MountCreationKey.GetRandomMountKey( troop.Equipment[EquipmentIndex.ArmorItemEndSlot].Item, troop.GetMountKeySeed())); } if (hasFormation && !SPCharacter.IsPlayer) { Formation formation = team.GetFormation(SPCharacter.FormationIndex); agentBuildData.Formation(formation); agentBuildData.FormationTroopCount(formationTroopCount).FormationTroopIndex(formationTroopIndex); } if (SPCharacter.IsPlayer) { agentBuildData.Controller(Agent.ControllerType.Player); } if (troop.IsHero) { agentBuildData.Equipment(troop.GetFirstEquipment(agentBuildData.AgentCivilianEquipment).Clone(false)); } else { var equipmentModifierType = BattleConfig.Instance.BattleTypeConfig.EquipmentModifierType; var equipment = Equipment.GetRandomEquipmentElements(troop, equipmentModifierType == EquipmentModifierType.Random, agentBuildData.AgentCivilianEquipment, agentBuildData.AgentEquipmentSeed); if (equipmentModifierType == EquipmentModifierType.Average) { for (EquipmentIndex index = EquipmentIndex.Weapon0; index < EquipmentIndex.NumEquipmentSetSlots; ++index) { var equipmentElement = equipment.GetEquipmentFromSlot(index); if (equipmentElement.Item != null) { if (equipmentElement.Item.HasArmorComponent) { equipmentElement.SetModifier( Utility.AverageItemModifier(equipmentElement.Item.ArmorComponent .ItemModifierGroup)); } else if (equipmentElement.Item.HasHorseComponent) { equipmentElement.SetModifier( Utility.AverageItemModifier(equipmentElement.Item.HorseComponent .ItemModifierGroup)); } } } } agentBuildData.Equipment(equipment); } Agent agent = Mission.Current.SpawnAgent(agentBuildData, false, formationTroopCount); if (agent.IsAIControlled & isAlarmed) { agent.SetWatchState(AgentAIStateFlagComponent.WatchState.Alarmed); } if (wieldInitialWeapons) { agent.WieldInitialWeapons(); } if (!specialActionSet.IsStringNoneOrEmpty()) { AnimationSystemData animationSystemData = agentBuildData.AgentMonster.FillAnimationSystemData(MBGlobals.GetActionSet(specialActionSet), agent.Character.GetStepSize(), false); AgentVisualsNativeData agentVisualsNativeData = agentBuildData.AgentMonster.FillAgentVisualsNativeData(); agentBuildData.AgentMonster.FillAgentVisualsNativeData(); agent.SetActionSet(ref agentVisualsNativeData, ref animationSystemData); } return(agent); }
public override Agent SpawnTroop(BattleSideEnum side, bool hasFormation, bool spawnWithHorse, bool isReinforcement, bool enforceSpawningOnInitialPoint, int formationTroopCount, int formationTroopIndex, bool isAlarmed, bool wieldInitialWeapons, bool forceDismounted = false, string specialActionSet = null, MatrixFrame?initFrame = null) { BasicCharacterObject troop = Troop; var team = IsUnderPlayersCommand ? Mission.Current.PlayerTeam : Mission.Current.PlayerEnemyTeam; MatrixFrame frame = initFrame ?? Mission.Current .GetFormationSpawnFrame(team.Side, FormationClass.NumberOfRegularFormations, false).ToGroundMatrixFrame(); if (MPCharacter.IsPlayer && !forceDismounted) { spawnWithHorse = true; } AgentBuildData agentBuildData = new AgentBuildData(this).Team(team).Banner(Banner) .ClothingColor1(team.Color).ClothingColor2(team.Color2) .NoHorses(!spawnWithHorse).CivilianEquipment(Mission.Current.DoesMissionRequireCivilianEquipment); var equipment = Utility.GetNewEquipmentsForPerks(MPCharacter.HeroClass, MPCharacter.IsHero, MPCharacter.SelectedFirstPerk, MPCharacter.SelectedSecondPerk, MPCharacter.IsHero, Seed); agentBuildData.Equipment(equipment); agentBuildData.IsFemale(MPCharacter.IsFemale); if (!MPCharacter.IsPlayer) { agentBuildData.IsReinforcement(isReinforcement).SpawnOnInitialPoint(enforceSpawningOnInitialPoint); } if (!hasFormation || MPCharacter.IsPlayer) { agentBuildData.InitialFrame(frame); } if (spawnWithHorse) { agentBuildData.MountKey(MountCreationKey.GetRandomMountKey( troop.Equipment[EquipmentIndex.ArmorItemEndSlot].Item, troop.GetMountKeySeed())); } if (hasFormation && !MPCharacter.IsPlayer) { Formation formation = team.GetFormation(MPCharacter.FormationIndex); agentBuildData.Formation(formation); agentBuildData.FormationTroopCount(formationTroopCount).FormationTroopIndex(formationTroopIndex); } if (MPCharacter.IsPlayer) { agentBuildData.Controller(Agent.ControllerType.Player); } Agent agent = Mission.Current.SpawnAgent(agentBuildData, false, formationTroopCount); if (agent.IsAIControlled & isAlarmed) { agent.SetWatchState(AgentAIStateFlagComponent.WatchState.Alarmed); } if (wieldInitialWeapons) { agent.WieldInitialWeapons(); } if (!specialActionSet.IsStringNoneOrEmpty()) { AnimationSystemData animationSystemData = agentBuildData.AgentMonster.FillAnimationSystemData(MBGlobals.GetActionSet(specialActionSet), agent.Character.GetStepSize(), false); AgentVisualsNativeData agentVisualsNativeData = agentBuildData.AgentMonster.FillAgentVisualsNativeData(); agentBuildData.AgentMonster.FillAgentVisualsNativeData(); agent.SetActionSet(ref agentVisualsNativeData, ref animationSystemData); } return(agent); }
private void AddMount(bool isRiderAgentMounted = false) { this.RemoveMount(); HorseComponent horseComponent = this._equipment[10].Item.HorseComponent; Monster arg_39_0 = horseComponent.Monster; this._mountEntity = GameEntity.CreateEmpty(this._tableauScene, true); AnimationSystemData animationSystemData = arg_39_0.FillAnimationSystemData(MBGlobals.GetActionSet(horseComponent.Monster.ActionSetCode), 1f, false); AgentVisualsNativeData agentVisualsNativeData = arg_39_0.FillAgentVisualsNativeData(); this._mountEntity.CreateSkeletonWithActionSet(ref agentVisualsNativeData, ref animationSystemData); if (isRiderAgentMounted) { this._mountEntity.Skeleton.SetAgentActionChannel(0, (horseComponent.Monster.MonsterUsage == "camel") ? SpouseCharacterTableau.act_camel_stand : SpouseCharacterTableau.act_horse_stand, MBRandom.RandomFloat, -0.2f); } else { this._mountEntity.Skeleton.SetAgentActionChannel(0, SpouseCharacterTableau.act_inventory_idle_start, MBRandom.RandomFloat, -0.2f); } this._mountEntity.EntityFlags |= EntityFlags.AnimateWhenVisible; MountVisualCreator.AddMountMeshToEntity(this._mountEntity, this._equipment[10].Item, this._equipment[11].Item, this._mountCreationKey, null); this._mountEntity.SetFrame(ref this._mountSpawnPoint); }