diff --git a/Common/AssetManager.cs b/Common/AssetManager.cs deleted file mode 100644 index 01e3384..0000000 --- a/Common/AssetManager.cs +++ /dev/null @@ -1,24 +0,0 @@ -using System.Collections.Generic; -using System.Reflection; -using Jotunn.Utils; -using UnityEngine; - -namespace Common; - -public class AssetManager -{ - public static AssetBundle assetBundle; - public static string bundleName; - - public static void LoadAssetBundle() - { - assetBundle = AssetUtils.LoadAssetBundleFromResources( - bundleName, - Assembly.GetExecutingAssembly() - ); - if (assetBundle == null) - { - WarpLogger.Logger.LogError("Failed to load asset bundle with name: " + bundleName); - } - } -} \ No newline at end of file diff --git a/Common/Common.projitems b/Common/Common.projitems index 661cff6..2cc82c9 100644 --- a/Common/Common.projitems +++ b/Common/Common.projitems @@ -9,17 +9,12 @@ Common - - - - - diff --git a/Common/DebugUtils.cs b/Common/DebugUtils.cs deleted file mode 100644 index dc6339f..0000000 --- a/Common/DebugUtils.cs +++ /dev/null @@ -1,17 +0,0 @@ -namespace Common -{ - public class DebugUtils - { - public static void NullCheck(T obj, string name) where T : class - { - if (obj == null) - { - UnityEngine.Debug.Log(name + " is null"); - } - else - { - UnityEngine.Debug.Log(name + " is not null"); - } - } - } -} \ No newline at end of file diff --git a/Common/PieceManager.cs b/Common/PieceManager.cs deleted file mode 100644 index 8882155..0000000 --- a/Common/PieceManager.cs +++ /dev/null @@ -1,34 +0,0 @@ -using System.Collections.Generic; -using Jotunn.Entities; - -namespace Common -{ - public class PieceManager - { - public static void ReplaceResourceDrops(CustomLocation location) - { - Piece[] allPieces = location.Prefab.GetComponentsInChildren(); - - foreach (var piece in allPieces) - { - if (piece.transform.parent != null) - { - WarpLogger.Logger.LogDebug("Piece with name " + piece + " found in location with name: " + location); - - var resources = piece.m_resources; - - foreach (var resource in resources) - { - if (resource != null) - { - WarpLogger.Logger.LogDebug("Resource with name " + resource + " found in piece with name: " + piece.transform.parent.name); - } - } - } - } - - - - } - } -} \ No newline at end of file diff --git a/Common/TraderManager.cs b/Common/TraderManager.cs deleted file mode 100644 index 982a33a..0000000 --- a/Common/TraderManager.cs +++ /dev/null @@ -1,80 +0,0 @@ -using System.Collections.Generic; -using Jotunn.Managers; -using UnityEngine; -using YamlDotNet.Serialization; -using YamlDotNet.Serialization.NamingConventions; - -namespace Common -{ - public static class TraderManager - { - public static Dictionary> buyItemLists = new Dictionary>(); - - public static void AddTraderBuyItems(GameObject locationContainer, List traderItems) - { - Trader trader = locationContainer.GetComponentInChildren(); - if (trader == null) - { - WarpLogger.Logger.LogWarning("Failed to find Trader script in location with name: " + locationContainer); - return; - } - - trader.m_items = traderItems; - } - - public static void BuildBuyItemList(string traderItemYamlContent, string traderName) - { - List buyItems = new List(); - - var deserializer = new DeserializerBuilder() - .WithNamingConvention(CamelCaseNamingConvention.Instance) - .Build(); - - var parsedData = deserializer.Deserialize>>(traderItemYamlContent); - if (parsedData == null || !parsedData.ContainsKey(traderName)) - { - WarpLogger.Logger.LogWarning("Parsed data is null or trader name: " + traderName + " does not exist in the YAML content."); - return; - } - var traderList = parsedData[traderName]; - - foreach (var item in traderList) - { - GameObject itemPrefab = PrefabManager.Cache.GetPrefab(item.PrefabName); - if (itemPrefab == null) - { - WarpLogger.Logger.LogWarning("Failed to find prefab with name: " + item.PrefabName); - continue; - } - - ItemDrop itemDrop = itemPrefab.GetComponent(); - if (itemDrop == null) - { - WarpLogger.Logger.LogWarning("Failed to find ItemDrop component on prefab: " + item.PrefabName); - continue; - } - - Trader.TradeItem tradeItem = new Trader.TradeItem - { - m_prefab = itemDrop, - m_stack = item.Stack, - m_price = item.Price, - m_requiredGlobalKey = item.RequiredGlobalKey - }; - buyItems.Add(tradeItem); - Debug.Log("Added item with name: " + item.PrefabName + " to trader buy list with name: " + traderName); - } - - buyItemLists.Add(traderName,buyItems); - } - - public class TradeItemYAML - { - public string PrefabName { get; set; } - public int Stack { get; set; } = 1; - public int Price { get; set; } - public string RequiredGlobalKey { get; set; } = ""; - public string NotRequiredGlobalKey { get; set; } = ""; - } - } -} \ No newline at end of file diff --git a/Common/WarpLocation.cs b/Common/WarpLocation.cs deleted file mode 100644 index 886df95..0000000 --- a/Common/WarpLocation.cs +++ /dev/null @@ -1,29 +0,0 @@ -using BepInEx.Configuration; -using Jotunn.Configs; - -namespace Common; - -public class WarpLocation -{ - public string LocationName { get; set; } - public int SpawnQuantity { get; set; } - public string CreatureYaml { get; set; } - public string LootYaml { get; set; } - public LocationConfiguration BepinExConfig { get; set; } - - - - public LocationConfig JotunnLocationConfig { get; set; } - - - public WarpLocation( - ConfigFile config, - string locationName, - int spawnQuantity, - string creatureYaml, - string lootYaml) - { - BepinExConfig = new LocationConfiguration(config, locationName, spawnQuantity, creatureYaml, lootYaml); - - } -} diff --git a/Common/YAMLManager.cs b/Common/YAMLManager.cs index 31e4748..db23001 100644 --- a/Common/YAMLManager.cs +++ b/Common/YAMLManager.cs @@ -52,11 +52,11 @@ public void ParseCustomYamls(ConfigurationManager.Toggle useCustomLocationYAML) try { customCreatureYamlContent = File.ReadAllText(customCreatureListYamlFilePath); - WarpLogger.Logger.LogInfo("Successfully loaded warpalicious.More_World_Locations_CreatureLists.yml from BepInEx config folder"); + More_World_Locations_AIOPlugin.More_World_Locations_AIOLogger.LogInfo("Successfully loaded warpalicious.More_World_Locations_CreatureLists.yml from BepInEx config folder"); } catch (System.Exception ex) { - WarpLogger.Logger.LogError("Failed to load custom creature YAML: " + ex.Message); + More_World_Locations_AIOPlugin.More_World_Locations_AIOLogger.LogError("Failed to load custom creature YAML: " + ex.Message); } } @@ -65,11 +65,11 @@ public void ParseCustomYamls(ConfigurationManager.Toggle useCustomLocationYAML) try { customlootYamlContent = File.ReadAllText(customLootListYamlFilePath); - WarpLogger.Logger.LogInfo("Successfully loaded warpalicious.More_World_Locations_LootLists.yml from BepInEx config folder"); + More_World_Locations_AIOPlugin.More_World_Locations_AIOLogger.LogInfo("Successfully loaded warpalicious.More_World_Locations_LootLists.yml from BepInEx config folder"); } catch (System.Exception ex) { - WarpLogger.Logger.LogError("Failed to load custom loot YAML: " + ex.Message); + More_World_Locations_AIOPlugin.More_World_Locations_AIOLogger.LogError("Failed to load custom loot YAML: " + ex.Message); } } } @@ -82,7 +82,7 @@ public void ParseCreatureYaml(string filename) if (File.Exists(customCreatureListYamLFilePath)) { customCreatureYamlContent = File.ReadAllText(customCreatureListYamLFilePath); - WarpLogger.Logger.LogInfo("Successfully loaded + " + filename + "_CreatureLists.yml file from BepinEx config folder");; + More_World_Locations_AIOPlugin.More_World_Locations_AIOLogger.LogInfo("Successfully loaded + " + filename + "_CreatureLists.yml file from BepinEx config folder");; } } @@ -98,11 +98,11 @@ public void ParseTraderYaml(string filename, ConfigurationManager.Toggle useCust try { File.WriteAllText(customTraderListYamlFilePath, defaultTraderYamlContent); - WarpLogger.Logger.LogInfo("Auto-extracted " + filename + " to BepInEx config folder"); + More_World_Locations_AIOPlugin.More_World_Locations_AIOLogger.LogInfo("Auto-extracted " + filename + " to BepInEx config folder"); } catch (System.Exception ex) { - WarpLogger.Logger.LogError("Failed to extract " + filename + ": " + ex.Message); + More_World_Locations_AIOPlugin.More_World_Locations_AIOLogger.LogError("Failed to extract " + filename + ": " + ex.Message); } } @@ -111,11 +111,11 @@ public void ParseTraderYaml(string filename, ConfigurationManager.Toggle useCust try { customTraderYamlContent = File.ReadAllText(customTraderListYamlFilePath); - WarpLogger.Logger.LogInfo("Successfully loaded " + filename + " from BepInEx config folder"); + More_World_Locations_AIOPlugin.More_World_Locations_AIOLogger.LogInfo("Successfully loaded " + filename + " from BepInEx config folder"); } catch (System.Exception ex) { - WarpLogger.Logger.LogError("Failed to load custom trader YAML: " + ex.Message); + More_World_Locations_AIOPlugin.More_World_Locations_AIOLogger.LogError("Failed to load custom trader YAML: " + ex.Message); } } } @@ -128,7 +128,7 @@ public void ParseContainerYaml(string filename) if (File.Exists(customCreatureListYamLFilePath)) { customlootYamlContent = File.ReadAllText(customCreatureListYamLFilePath); - WarpLogger.Logger.LogInfo("Successfully loaded + " + filename + "_ContainerLists.yml file from BepinEx config folder");; + More_World_Locations_AIOPlugin.More_World_Locations_AIOLogger.LogInfo("Successfully loaded + " + filename + "_ContainerLists.yml file from BepinEx config folder");; } } @@ -140,7 +140,7 @@ public void ParsePickableItemYaml(string filename) if (File.Exists(customCreatureListYamLFilePath)) { customPickableItemContent = File.ReadAllText(customCreatureListYamLFilePath); - WarpLogger.Logger.LogInfo("Successfully loaded + " + filename + "_PickableItemLists.yml file from BepinEx config folder");; + More_World_Locations_AIOPlugin.More_World_Locations_AIOLogger.LogInfo("Successfully loaded + " + filename + "_PickableItemLists.yml file from BepinEx config folder");; } } diff --git a/More World Locations_AIO/Src/Traders/TraderPrefabs.cs b/More World Locations_AIO/Src/Traders/TraderPrefabs.cs index ea14556..c9c001b 100644 --- a/More World Locations_AIO/Src/Traders/TraderPrefabs.cs +++ b/More World Locations_AIO/Src/Traders/TraderPrefabs.cs @@ -96,7 +96,7 @@ private static void BuildAllTraderItemsFromYAML() { if (kvp.Key == "version") continue; - var itemsYaml = deserializer.Deserialize>( + var itemsYaml = deserializer.Deserialize>( new SerializerBuilder().Build().Serialize(kvp.Value)); List items = new List(); @@ -117,8 +117,8 @@ private static void BuildAllTraderItemsFromYAML() } catch (Exception ex) { - WarpLogger.Logger.LogError("Failed to parse trader YAML: " + ex.Message); - WarpLogger.Logger.LogWarning("Falling back to hardcoded trader items"); + More_World_Locations_AIOPlugin.More_World_Locations_AIOLogger.LogError("Failed to parse trader YAML: " + ex.Message); + More_World_Locations_AIOPlugin.More_World_Locations_AIOLogger.LogWarning("Falling back to hardcoded trader items"); } } @@ -129,7 +129,7 @@ private static void BuildAllTraderItemsFromYAML() return items; } - WarpLogger.Logger.LogWarning($"No YAML data for {traderName}, using hardcoded fallback"); + More_World_Locations_AIOPlugin.More_World_Locations_AIOLogger.LogWarning($"No YAML data for {traderName}, using hardcoded fallback"); switch (traderName) { @@ -279,5 +279,14 @@ private static void AddItem(List items, string prefabName, int if (item != null) items.Add(item); } + + public class TradeItemYAML + { + public string PrefabName { get; set; } + public int Stack { get; set; } = 1; + public int Price { get; set; } + public string RequiredGlobalKey { get; set; } = ""; + public string NotRequiredGlobalKey { get; set; } = ""; + } }