Skip to content

Commit

Permalink
Release v1.2.0.2
Browse files Browse the repository at this point in the history
  • Loading branch information
IAmBatby committed Apr 27, 2024
1 parent 88b43aa commit bc89e5b
Show file tree
Hide file tree
Showing 7 changed files with 143 additions and 471 deletions.
42 changes: 40 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,45 @@
**Changelog**
--

**<details><summary>Version 1.2.2</summary>**

**<details><summary>Fixes</summary>**

* Fixed issue where vanilla items were being incorrectly destroyed when playing multiple lobbies during the same game session
* Restored functionality of the ExtendedLevel.IsRouteLocked feature
* Added safety check to help prevent saves made in pre 1.2.0 LethalLevelLoader modpacks from corrupting when being used
* Fixed issues with ExtendedDungeonFlow.DynamicDungeonSize related settings incorrectly applying after version 50 changes
* Removed ExtendedMod.ContentTagAsStrings() function
* Added ExtendedMod.TryGetTag(string tag) function
* Added ExtendedMod.TryGetTag(string tag, out ContentTag contentTag) function
* Added ExtendedMod.TryAddTag(string tag) function

</details>

</details>

**<details><summary>Version 1.2.1</summary>**

**<details><summary>Fixes</summary>**

* Updated LICENSE
* Changed accessor for ExtendedDungeonFlow.GenerateAutomaticConfigurationOptions from internal to public
* Fixed issue where ExtendedDungeonFlow.GenerationAutomaticConfigurationOptions was defaulting to false
* Changed accessor for EnemyManager.RefreshDynamicEnemyTypeRarityOnAllExtendedLevels from internal to public
* Changed accessor for EnemyManager.InjectCustomEnemyTypesIntoLevelViaDynamicRarity from internal to public
* Changed accessor for ItemManager.RefreshDynamicItemRarityOnAllExtendedLevels from internal to public
* Changed accessor for ItemManager.InjectCustomItemsIntoLevelViaDynamicRarity from internal to public
* Changed ConfigLoader default dungeon binding to list current level matching values as default values
* Added "Killable" ContentTag to Forest Giant
* Added "Chargable" ContentTag to Jetpack
* Added "Weapon" ContentTag to Knife
* Added additional developer debug logging for the scene validation and selection process

</details>

</details>


**<details><summary>Version 1.2.0</summary>**

**<details><summary>Features</summary>**
Expand Down Expand Up @@ -414,5 +453,4 @@ By default SelectableLevel.riskLevel is now automatically assigned using calcula

* *Initial Release*

</details>

</details>
32 changes: 31 additions & 1 deletion LethalLevelLoader/Components/ExtendedContent/ExtendedContent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public class ExtendedContent : ScriptableObject
public ContentType ContentType { get; internal set; } = ContentType.Vanilla;
/*Obsolete*/ public List<string> ContentTagStrings { get; internal set; } = new List<string>();
[field: SerializeField] public List<ContentTag> ContentTags { get; internal set; } = new List<ContentTag>();
public List<string> ContentTagsAsStrings => ContentTags.Select(t => t.contentTagName).ToList();
//public List<string> ContentTagsAsStrings => ContentTags.Select(t => t.contentTagName).ToList();

public string ModName => ExtendedMod.ModName;
public string AuthorName => ExtendedMod.AuthorName;
Expand All @@ -21,6 +21,36 @@ internal virtual void TryCreateMatchingProperties()
{

}

public bool TryGetTag(string tag)
{
foreach (ContentTag contentTag in ContentTags)
if (contentTag.contentTagName == tag)
return (true);
return (false);
}

public bool TryGetTag(string tag, out ContentTag returnTag)
{
returnTag = null;
foreach (ContentTag contentTag in ContentTags)
if (contentTag.contentTagName == tag)
{
returnTag = contentTag;
return (true);
}
return (false);
}

public bool TryAddTag(string tag)
{
if (TryGetTag(tag) == false)
{
ContentTags.Add(ContentTag.Create(tag));
return (true);
}
return (false);
}
}

[Serializable]
Expand Down
15 changes: 10 additions & 5 deletions LethalLevelLoader/General/Patches.cs
Original file line number Diff line number Diff line change
Expand Up @@ -151,11 +151,13 @@ internal static void StartOfRoundAwake_Prefix(StartOfRound __instance)
SceneManager.sceneLoaded += EventPatches.OnSceneLoaded;

//Removing the broken cardboard box item please understand
StartOfRound.allItemsList.itemsList.RemoveAt(2);
SaveManager.defaultCachedItemsList = new List<Item>(StartOfRound.allItemsList.itemsList);

//Scrape Vanilla For Content References
if (Plugin.IsSetupComplete == false)
{
StartOfRound.allItemsList.itemsList.RemoveAt(2);
SaveManager.defaultCachedItemsList = new List<Item>(StartOfRound.allItemsList.itemsList);

DebugStopwatch.StartStopWatch("Scrape Vanilla Content");
ContentExtractor.TryScrapeVanillaItems(StartOfRound);
ContentExtractor.TryScrapeVanillaContent(StartOfRound, RoundManager);
Expand Down Expand Up @@ -283,6 +285,9 @@ internal static void StartOfRoundAwake_Prefix(StartOfRound __instance)
//Populate SelectableLevel Data To Be Used In Overhaul Of The Terminal Moons Catalogue.
TerminalManager.CreateMoonsFilterTerminalAssets();

foreach (CompatibleNoun routeNode in TerminalManager.routeKeyword.compatibleNouns)
TerminalManager.AddTerminalNodeEventListener(routeNode.result, TerminalManager.LockedNodeEventTest, TerminalManager.LoadNodeActionType.Before);

//Create Terminal Data For Custom StoryLog's And Patch Basegame References To StoryLog's To Include Custom StoryLogs.
TerminalManager.CreateTerminalDataForAllExtendedStoryLogs();

Expand Down Expand Up @@ -440,7 +445,7 @@ internal static bool TerminalRunTerminalEvents_Prefix(Terminal __instance, Termi
return (returnBool);*/

return (TerminalManager.OnBeforeLoadNewNode(node));
return (TerminalManager.OnBeforeLoadNewNode(ref node));
}

[HarmonyPriority(harmonyPriority)]
Expand All @@ -449,7 +454,7 @@ internal static bool TerminalRunTerminalEvents_Prefix(Terminal __instance, Termi
internal static bool TerminalLoadNewNode_Prefix(Terminal __instance, ref TerminalNode node)
{
Terminal.screenText.textComponent.fontSize = TerminalManager.defaultTerminalFontSize;
return (TerminalManager.OnBeforeLoadNewNode(node));
return (TerminalManager.OnBeforeLoadNewNode(ref node));
/*foreach (ExtendedLevel extendedLevel in PatchedContent.ExtendedLevels)
if (extendedLevel.RouteNode == node && extendedLevel.IsRouteLocked == true)
TerminalManager.SwapRouteNodeToLockedNode(extendedLevel, ref node);*/
Expand All @@ -460,7 +465,7 @@ internal static bool TerminalLoadNewNode_Prefix(Terminal __instance, ref Termina
[HarmonyPostfix]
internal static void TerminalLoadNewNode_Postfix(Terminal __instance, ref TerminalNode node)
{
TerminalManager.OnLoadNewNode(node);
TerminalManager.OnLoadNewNode(ref node);
//if (ranLethalLevelLoaderTerminalEvent == true)
//__instance.currentNode = TerminalManager.moonsKeyword.specialKeywordResult;
}
Expand Down
30 changes: 20 additions & 10 deletions LethalLevelLoader/Loaders/DungeonLoader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,20 +49,30 @@ internal static void PrepareDungeon()

public static float GetClampedDungeonSize()
{
float returnValue = LevelManager.CurrentExtendedLevel.SelectableLevel.factorySizeMultiplier * Patches.RoundManager.mapSizeMultiplier;
ExtendedDungeonFlow extendedDungeonFlow = DungeonManager.CurrentExtendedDungeonFlow;
ExtendedLevel extendedLevel = LevelManager.CurrentExtendedLevel;
float calculatedMultiplier = CalculateDungeonMutliplier(LevelManager.CurrentExtendedLevel, DungeonManager.CurrentExtendedDungeonFlow);
if (DungeonManager.CurrentExtendedDungeonFlow != null && DungeonManager.CurrentExtendedDungeonFlow.IsDynamicDungeonSizeRestrictionEnabled == true)
{
ExtendedDungeonFlow extendedDungeonFlow = DungeonManager.CurrentExtendedDungeonFlow;
ExtendedLevel extendedLevel = LevelManager.CurrentExtendedLevel;
if (extendedLevel.SelectableLevel.factorySizeMultiplier > extendedDungeonFlow.DynamicDungeonSizeMinMax.y)
returnValue = Mathf.Lerp(extendedLevel.SelectableLevel.factorySizeMultiplier, extendedDungeonFlow.DynamicDungeonSizeMinMax.y, extendedDungeonFlow.DynamicDungeonSizeLerpRate) * Patches.RoundManager.mapSizeMultiplier; //This is how vanilla does it.
else if (extendedLevel.SelectableLevel.factorySizeMultiplier < extendedDungeonFlow.DynamicDungeonSizeMinMax.x)
returnValue = Mathf.Lerp(extendedLevel.SelectableLevel.factorySizeMultiplier, extendedDungeonFlow.DynamicDungeonSizeMinMax.x, extendedDungeonFlow.DynamicDungeonSizeLerpRate) * Patches.RoundManager.mapSizeMultiplier; //This is how vanilla does it.
DebugHelper.Log("CurrentLevel: " + LevelManager.CurrentExtendedLevel.NumberlessPlanetName + " DungeonSize Is: " + LevelManager.CurrentExtendedLevel.SelectableLevel.factorySizeMultiplier + " | Overrriding DungeonSize To: " + (returnValue / Patches.RoundManager.mapSizeMultiplier) + " (" + returnValue + ")", DebugType.User);
if (calculatedMultiplier > extendedDungeonFlow.DynamicDungeonSizeMinMax.y)
calculatedMultiplier = Mathf.Lerp(calculatedMultiplier, extendedDungeonFlow.DynamicDungeonSizeMinMax.y, extendedDungeonFlow.DynamicDungeonSizeLerpRate); //This is how vanilla does it.
else if (calculatedMultiplier < extendedDungeonFlow.DynamicDungeonSizeMinMax.x)
calculatedMultiplier = Mathf.Lerp(calculatedMultiplier, extendedDungeonFlow.DynamicDungeonSizeMinMax.x, extendedDungeonFlow.DynamicDungeonSizeLerpRate);//This is how vanilla does it.
DebugHelper.Log("Current ExtendedLevel: " + LevelManager.CurrentExtendedLevel.NumberlessPlanetName + " ExtendedLevel DungeonSize Is: " + LevelManager.CurrentExtendedLevel.SelectableLevel.factorySizeMultiplier + " | Overrriding DungeonSize To: " + calculatedMultiplier, DebugType.User);
}
else
DebugHelper.Log("CurrentLevel: " + LevelManager.CurrentExtendedLevel.NumberlessPlanetName + " DungeonSize Is: " + LevelManager.CurrentExtendedLevel.SelectableLevel.factorySizeMultiplier + " | Leaving DungeonSize As: " + (returnValue / Patches.RoundManager.mapSizeMultiplier) + " (" + returnValue + ")", DebugType.User);
return (returnValue);
DebugHelper.Log("CurrentLevel: " + LevelManager.CurrentExtendedLevel.NumberlessPlanetName + " DungeonSize Is: " + LevelManager.CurrentExtendedLevel.SelectableLevel.factorySizeMultiplier + " | Leaving DungeonSize As: " + calculatedMultiplier, DebugType.User);
return (calculatedMultiplier);
}

public static float CalculateDungeonMutliplier(ExtendedLevel extendedLevel, ExtendedDungeonFlow extendedDungeonFlow)
{
foreach (IndoorMapType indoorMapType in RoundManager.Instance.dungeonFlowTypes)
if (indoorMapType.dungeonFlow == extendedDungeonFlow.DungeonFlow)
return (extendedLevel.selectableLevel.factorySizeMultiplier / indoorMapType.MapTileSize * RoundManager.Instance.mapSizeMultiplier);

return 1f;

}

internal static void PatchDungeonSize(DungeonGenerator dungeonGenerator, ExtendedLevel extendedLevel, ExtendedDungeonFlow extendedDungeonFlow)
Expand Down
16 changes: 15 additions & 1 deletion LethalLevelLoader/Patches/SaveManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,10 @@ internal static void InitializeSave()
else
currentSaveFile = new LLLSaveFile("LLLSaveFile");
currentSaveFile.Load();
DebugHelper.Log("Initialized LLL Save File, Current Level Was: " + currentSaveFile.CurrentLevelName + ", Current Vanilla Save Is: " + GameNetworkManager.Instance.currentSaveFileName, DebugType.User);
if (currentSaveFile.CurrentLevelName != null)
DebugHelper.Log("Initialized LLL Save File, Current Level Was: " + currentSaveFile.CurrentLevelName + ", Current Vanilla Save Is: " + GameNetworkManager.Instance.currentSaveFileName, DebugType.User);
else
DebugHelper.Log("Initialized LLL Save File, Current Level Was: (Empty) " + ", Current Vanilla Save Is: " + GameNetworkManager.Instance.currentSaveFileName, DebugType.User);

if (ES3.KeyExists("CurrentPlanetID", GameNetworkManager.Instance.currentSaveFileName))
DebugHelper.Log("Vanilla CurrentSaveFileName Has Saved Current Planet ID: " + ES3.Load<int>("CurrentPlanetID", GameNetworkManager.Instance.currentSaveFileName), DebugType.Developer);
Expand All @@ -36,6 +39,17 @@ internal static void InitializeSave()
currentSaveFile.CurrentLevelName = string.Empty;
}

if (currentSaveFile.customItemDictionary == null)
currentSaveFile.customItemDictionary = new Dictionary<string, string>();
if (currentSaveFile.allItemsList == null)
currentSaveFile.allItemsList = new List<string>();
if (currentSaveFile.itemSaveDataList == null)
currentSaveFile.itemSaveDataList = new List<AllItemsListItemData>();
if (currentSaveFile.itemSaveData == null)
currentSaveFile.itemSaveData = new Dictionary<int, AllItemsListItemData>();
if (currentSaveFile.CurrentLevelName == null)
currentSaveFile.CurrentLevelName = string.Empty;

/*foreach (string item in currentSaveFile.allItemsList)
DebugHelper.Log("Saved AllItemsList: " + item);
Expand Down
Loading

0 comments on commit bc89e5b

Please sign in to comment.