Skip to content

Commit

Permalink
Update to v1.2.8
Browse files Browse the repository at this point in the history
  • Loading branch information
cookgreen committed Feb 21, 2024
1 parent e84b56a commit d35ce6a
Show file tree
Hide file tree
Showing 11 changed files with 36 additions and 24 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@
A mod for Mount&Blade Bannerlord that provides more powerful custom battle.

## Current Version
v1.1.6
v1.2.8

## Mod File
[Release v1.2.8](https://github.com/cookgreen/EnhancedBattleTest/releases/tag/ebt-v1.2.8)
[Release v1.1.6](https://github.com/cookgreen/EnhancedBattleTest/releases/tag/ebt-v1.1.6)
[Release v1.0.2](https://github.com/cookgreen/EnhancedBattleTest/releases/tag/ebt-v1.0.2)

Expand Down
2 changes: 1 addition & 1 deletion source/EnhancedBattleTest/src/Config/TeamConfig.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public Banner GetPreviewBanner()
? new Banner(BannerKey)
: (HasGeneral
? (Generals.Troops[0].Character.CharacterObject as CharacterObject).HeroObject?.ClanBanner
: null) ?? CampaignData.NeutralFaction.Banner;
: null) ?? null;
}

public TeamConfig()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public static AtmosphereInfo CreateAtmosphereInfoForMission(string seasonString
string atmosphereTypeName = isInSettlement ? "empire" : "field_battle";
return new AtmosphereInfo()
{
AtmosphereTypeName = atmosphereTypeName,
//AtmosphereTypeName = atmosphereTypeName,
AtmosphereName = atmosphereName,
TimeInfo = new TimeInformation
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,5 +57,9 @@ public override void OnLoadFinished()
base.OnLoadFinished();
TaleWorlds.Core.Game.Current.GameStateManager.CleanAndPushState(TaleWorlds.Core.Game.Current.GameStateManager.CreateState<EnhancedBattleTestState>());
}
}

public override void OnAfterCampaignStart(Game game)
{
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -74,15 +74,21 @@ public override void OnGameEnd(TaleWorlds.Core.Game game)

public override void OnLoadFinished()
{
if (CampaignSiegeTestStatic.IsSiegeTestBuild)
CampaignSiegeTestStatic.DisableSiegeTest();
//if (CampaignSiegeTestStatic.IsSiegeTestBuild)
// CampaignSiegeTestStatic.DisableSiegeTest();

Game.Current.GameStateManager.OnSavedGameLoadFinished();
Game.Current.GameStateManager.CleanAndPushState((GameState)Game.Current.GameStateManager.CreateState<MapState>());
PartyBase.MainParty.Visuals?.SetMapIconAsDirty();
TaleWorlds.CampaignSystem.Campaign.Current.CampaignInformationManager.OnGameLoaded();
PartyBase.MainParty.SetVisualAsDirty();
TaleWorlds.CampaignSystem.Campaign.Current.CampaignInformationManager.OnGameLoaded();

foreach (Settlement settlement in Settlement.All)
settlement.Party.Visuals.RefreshLevelMask(settlement.Party);
{
settlement.Party.OnLevelMaskUpdated();
}

CampaignEventDispatcher.Instance.OnGameLoadFinished();

if (Game.Current.GameStateManager.ActiveState is MapState activeState)
activeState.OnLoadingFinished();

Expand Down
2 changes: 1 addition & 1 deletion source/EnhancedBattleTest/src/GameMode/MultiplayerGame.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ private void InitializeGameModels(IGameStarter gameStarter)
gameStarter.AddModel(new MultiplayerApplyWeatherEffectsModel());
//gameStarter.AddModel(new MultiplayerAgentApplyDamageModel());
gameStarter.AddModel(new DefaultRidingModel());
gameStarter.AddModel(new MultiplayerStrikeMagnitudeModel());
//gameStarter.AddModel(new MultiplayerStrikeMagnitudeModel());
gameStarter.AddModel(new MultiplayerBattleMoraleModel());
}

Expand Down
10 changes: 5 additions & 5 deletions source/EnhancedBattleTest/src/Patch/Patch_Initializer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,19 +44,19 @@ public static bool Patch()

public static void Init(AtmosphereInfo atmosphere, float timeOfDay)
{
Atmosphere = atmosphere;
Atmosphere = atmosphere;
TimeOfDay = timeOfDay;
}

public static void Reset()
{
Atmosphere = null;
TimeOfDay = null;
{
Atmosphere.AtmosphereName = null;
TimeOfDay = null;
}

public static void Postfix_CreateSandBoxMissionInitializerRecord(ref MissionInitializerRecord __result)
{
if (BattleStarter.IsEnhancedBattleTestBattle && Atmosphere != null && TimeOfDay != null)
if (BattleStarter.IsEnhancedBattleTestBattle && Atmosphere.IsValid && TimeOfDay != null)
{
__result.AtmosphereOnCampaign = Atmosphere;
__result.TimeOfDay = (float)TimeOfDay;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ public class Patch_MissionAgentSpawnLogic
if (formation != null && !formation.HasBeenPositioned)
{
formation.BeginSpawn(count, isMounted && ____spawnWithHorses);
Mission.Current.SpawnFormation(formation);
Mission.Current.SetFormationPositioningFromDeploymentPlan(formation);
____spawnedFormations.Add(formation);
}
agentOriginBase.SpawnTroop(____side, true, ____spawnWithHorses, isReinforcement,
Expand Down
8 changes: 4 additions & 4 deletions source/EnhancedBattleTest/src/SinglePlayer/BattleStarter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@ public static void MissionEnded()
_originalParties.Clear();
_originalSettlements.Clear();
_bannerSave.Clear();
Campaign.Current.MainParty.Party.Visuals?.SetMapIconAsDirty();
Campaign.Current.MainParty.Party.SetVisualAsDirty();
IsEnhancedBattleTestBattle = false;
}
catch (Exception e)
Expand All @@ -326,7 +326,7 @@ private static Clan GetSettlementClan(BattleConfig config)
}
}

return CampaignData.NeutralFaction;
return null;
}

private static void ResetMapEventSide(PartyBase partyBase)
Expand Down Expand Up @@ -357,10 +357,10 @@ private static MissionInitializerRecord CreateMissionInitializerRecord(BattleCon
rec.PlayingInCampaignMode = true;
rec.RandomTerrainSeed = MBRandom.RandomInt(10000);
rec.AtmosphereOnCampaign = AtmosphereModel.CreateAtmosphereInfoForMission(config.MapConfig.Season, config.MapConfig.TimeOfDay, true);
rec.AtlasGroup = 2;
rec.DecalAtlasGroup = 2;
if (config.BattleTypeConfig.BattleType == BattleType.Field && !config.MapConfig.OverridesPlayerPosition)
{
rec.AtmosphereOnCampaign = Campaign.Current.Models.MapWeatherModel.GetAtmosphereModel(CampaignTime.Now, MobileParty.MainParty.GetLogicalPosition());
rec.AtmosphereOnCampaign = Campaign.Current.Models.MapWeatherModel.GetAtmosphereModel(/*CampaignTime.Now, */MobileParty.MainParty.GetLogicalPosition());
float num = Campaign.CurrentTime % 24f;
if (Campaign.Current != null)
rec.TimeOfDay = num;
Expand Down
7 changes: 4 additions & 3 deletions source/EnhancedBattleTest/src/UI/EnhancedBattleTestVM.cs
Original file line number Diff line number Diff line change
Expand Up @@ -441,7 +441,8 @@ private void OnMeleeMachineSelection(CustomBattleSiegeMachineVM selectedSlot)
};
foreach (SiegeEngineType attackerMeleeMachine in GetAllAttackerMeleeMachines())
inquiryElements.Add(new InquiryElement(attackerMeleeMachine, attackerMeleeMachine.Name.ToString(), null));
MBInformationManager.ShowMultiSelectionInquiry(new MultiSelectionInquiryData(new TextObject("{=MVOWsP48}Select a Melee Machine").ToString(), string.Empty, inquiryElements, false, 1, GameTexts.FindText("str_done").ToString(), "", selectedElements => selectedSlot.SetMachineType(selectedElements.First().Identifier as SiegeEngineType), null));
MBInformationManager.ShowMultiSelectionInquiry(
new MultiSelectionInquiryData("{=MVOWsP48}Select a Melee Machine", string.Empty, inquiryElements, false, 1, inquiryElements.Count, GameTexts.FindText("str_done").ToString(), string.Empty, (selectedElements) => selectedSlot.SetMachineType(selectedElements.First().Identifier as SiegeEngineType), null));
}

private void OnAttackerRangedMachineSelection(CustomBattleSiegeMachineVM selectedSlot)
Expand All @@ -452,7 +453,7 @@ private void OnAttackerRangedMachineSelection(CustomBattleSiegeMachineVM selecte
};
foreach (SiegeEngineType attackerRangedMachine in GetAllAttackerRangedMachines())
inquiryElements.Add(new InquiryElement(attackerRangedMachine, attackerRangedMachine.Name.ToString(), null));
MBInformationManager.ShowMultiSelectionInquiry(new MultiSelectionInquiryData(new TextObject("{=SLZzfNPr}Select a Ranged Machine").ToString(), string.Empty, inquiryElements, false, 1, GameTexts.FindText("str_done").ToString(), "", selectedElements => selectedSlot.SetMachineType(selectedElements[0].Identifier as SiegeEngineType), null));
MBInformationManager.ShowMultiSelectionInquiry(new MultiSelectionInquiryData(new TextObject("{=SLZzfNPr}Select a Ranged Machine").ToString(), string.Empty, inquiryElements, false, 1, inquiryElements.Count, GameTexts.FindText("str_done").ToString(), "", selectedElements => selectedSlot.SetMachineType(selectedElements[0].Identifier as SiegeEngineType), null));
}

private void OnDefenderRangedMachineSelection(CustomBattleSiegeMachineVM selectedSlot)
Expand All @@ -463,7 +464,7 @@ private void OnDefenderRangedMachineSelection(CustomBattleSiegeMachineVM selecte
};
foreach (SiegeEngineType defenderRangedMachine in GetAllDefenderRangedMachines())
inquiryElements.Add(new InquiryElement(defenderRangedMachine, defenderRangedMachine.Name.ToString(), null));
MBInformationManager.ShowMultiSelectionInquiry(new MultiSelectionInquiryData(new TextObject("{=SLZzfNPr}Select a Ranged Machine").ToString(), string.Empty, inquiryElements, false, 1, GameTexts.FindText("str_done").ToString(), "", selectedElements => selectedSlot.SetMachineType(selectedElements[0].Identifier as SiegeEngineType), null));
MBInformationManager.ShowMultiSelectionInquiry(new MultiSelectionInquiryData(new TextObject("{=SLZzfNPr}Select a Ranged Machine").ToString(), string.Empty, inquiryElements, false, 1, inquiryElements.Count, GameTexts.FindText("str_done").ToString(), "", selectedElements => selectedSlot.SetMachineType(selectedElements[0].Identifier as SiegeEngineType), null));
}
private void OnResetMachineSelection(CustomBattleSiegeMachineVM selectedSlot) => selectedSlot.SetMachineType((SiegeEngineType)null);
}
Expand Down
2 changes: 1 addition & 1 deletion source/EnhancedBattleTest/src/Utility.cs
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,7 @@ public static void SetMapEvents(PartyBase attacker, PartyBase defender, BattleTy
}
}

Campaign.Current.MapEventManager.StartBattleMapEvent(attacker, defender);
Campaign.Current.MapEventManager.StartSallyOutMapEvent(attacker, defender);
}
catch (Exception e)
{
Expand Down

0 comments on commit d35ce6a

Please sign in to comment.