internal static void PrintPrefabDropTables() { List <string> tableData = new List <string>(); foreach (var prefab in ZNetScene.instance.m_prefabs) { tableData.AddRange(Extract(prefab)); } PrintDebugFile.PrintFile(tableData, "drop_that.drop_table.prefabs.txt", "drop tables for prefabs"); }
internal static void PrintDungeonDropTables() { var orderedLocations = ZoneSystem.instance.m_locations .OrderBy(x => x.m_biome) .ThenBy(x => x.m_prefabName); List <string> tableData = new(); foreach (var location in orderedLocations) { var locPrefab = location.m_prefab; if (locPrefab is null) { continue; } var dungeons = locPrefab.GetComponentsInChildren <DungeonGenerator>(); if (dungeons is not null && dungeons.Length > 0) { foreach (var dungeon in dungeons) { //Find rooms var rooms = DungeonDB.GetRooms() .Where(x => (x.m_room.m_theme & dungeon.m_themes) == x.m_room.m_theme) .ToList(); if (rooms is null) { continue; } if (rooms.Count == 0) { continue; } foreach (var room in rooms) { tableData.AddRange(Extract(room.m_room.gameObject, $"Biome: {location.m_biome.GetNames()}", $"Location: {location.m_prefabName}", $"Room Theme: {room.m_room.m_theme}", $"Room: {room.m_room.name}")); } } } } PrintDebugFile.PrintFile(tableData, "drop_that.drop_table.dungeons.txt", "drop tables for dungeons"); }
internal static void PrintLocationDropTables() { var orderedLocations = ZoneSystem.instance.m_locations .OrderBy(x => x.m_biome) .ThenBy(x => x.m_prefabName); List <string> tableData = new(); foreach (var location in orderedLocations) { var locPrefab = location.m_prefab; if (locPrefab.IsNull()) { continue; } tableData.AddRange(Extract(locPrefab, $"Biome: {location.m_biome.GetNames()}", $"Location: {location.m_prefabName}")); } PrintDebugFile.PrintFile(tableData, "drop_that.drop_table.locations.txt", "drop tables for locations"); }
public static void WriteToFile(List <Tuple <GameObject, CharacterDrop> > characters) { List <string> lines = new List <string>(characters.Count * 20); foreach (var characterDrop in characters) { if (characterDrop.Item2.IsNull() || (characterDrop.Item2.m_drops?.Count ?? 0) == 0) { continue; } var chr = characterDrop.Item1.GetComponent <Humanoid>(); HashSet <string> inventoryItems = new HashSet <string>(); if (chr is not null) { if (chr.m_defaultItems is not null) { foreach (var item in chr.m_defaultItems.Where(x => x is not null)) { inventoryItems.Add(item.name); } } if (chr.m_randomArmor is not null) { foreach (var item in chr.m_randomArmor.Where(x => x is not null)) { inventoryItems.Add(item.name); } } if (chr.m_randomShield is not null) { foreach (var item in chr.m_randomShield.Where(x => x is not null)) { inventoryItems.Add(item.name); } } if (chr.m_randomWeapon is not null) { foreach (var item in chr.m_randomWeapon.Where(x => x is not null)) { inventoryItems.Add(item.name); } } if (chr.m_randomSets is not null) { foreach (var set in chr.m_randomSets.Where(x => x is not null)) { foreach (var item in set.m_items.Where(x => x is not null)) { inventoryItems.Add(item.name); } } } } #if DEBUG if (inventoryItems.Count == 0) { Log.LogTrace("No inventory items found for " + characterDrop.Item1.name); } #endif lines.Add($"[{characterDrop.Item1.name}.0]"); lines.Add($"{nameof(CharacterDropItemConfiguration.ConditionHasItem)}={inventoryItems?.Join()}"); lines.Add(""); } PrintDebugFile.PrintFile(lines, FileName, "default creature items"); }