├── icon.png ├── .gitattributes ├── Images ├── WorldOptions.png └── CopyWorldButton.png ├── TestItems ├── CorruptionOrb.png └── CorruptionOrb.cs ├── global.json ├── Base ├── PacketId.cs ├── ZenithOption.cs ├── Legacy.cs ├── WorlgenSettings.cs ├── OptionHelper.Utils.cs ├── Option.cs ├── OptionHelper.Initializer.cs └── OptionHelper.InGame.cs ├── CustomSized ├── TerrainType.cs ├── MapRelated.cs ├── KnownLimits.cs ├── OverhauledWorld.cs ├── WaterfallFix.cs ├── Params.cs └── WorldSettings.cs ├── BetterVanillaWorldGen ├── FloatingSky │ ├── FloatingIslandInfo.cs │ ├── FloatingHouses.cs │ └── FloatingIslands.cs ├── Interface │ ├── VanillaInterface.Custom.cs │ ├── VanillaInterface.Mods.cs │ ├── VanillaInterface.Backing.cs │ └── VanillaInterface.Getters.cs ├── ControlledWorldGenPass.cs ├── DungeonStuff │ └── DungeonPass.Pass.cs ├── GraniteStuff │ └── Granite.cs ├── Replacer.Passes.cs ├── SurfaceOreAndStone.cs ├── Replacer.IL.cs ├── Gems.cs ├── GenerateIceBiome.cs ├── DesertStuff │ └── Desert.cs ├── Jungle │ └── JungleChests.cs └── Replacer.Hooks.cs ├── .gitignore ├── Tool ├── Localization │ ├── fr-FR │ │ ├── WorldgenEdit.hjson │ │ ├── ui.hjson │ │ └── base.hjson │ ├── ru-RU │ │ ├── WorldgenEdit.hjson │ │ ├── ui.hjson │ │ └── base.hjson │ ├── zh-Hans │ │ ├── worldgenEdit.hjson │ │ ├── ui.hjson │ │ └── base.hjson │ └── en-US │ │ ├── worldgenEdit.hjson │ │ ├── ui.hjson │ │ └── base.hjson ├── setup.py └── main.py ├── UI ├── InputUI │ ├── OrderedUIItem.cs │ ├── List │ │ ├── BooleanExpandableList.cs │ │ ├── ExpandableList.cs │ │ ├── TileExpandableList.cs │ │ ├── EnumInputListBox.cs │ │ └── ValuesList.cs │ ├── Number │ │ ├── JsonNumberTextBox.cs │ │ ├── NumberTextBox.cs │ │ └── ConfigNumberTextBox.cs │ ├── FocusElement.cs │ ├── InputBox.cs │ └── EditableText.cs ├── Preset │ ├── Preset.cs │ └── PresetUI.cs ├── WarningUI.cs ├── OverhauledWorldGenConfigurator.cs ├── DedServUi.cs └── VanillaWorldGenConfigurator.cs ├── SpecialOptions ├── 100kSpecial │ ├── ColdAndHot │ │ ├── CactusPass.cs │ │ ├── CactusGrower.cs │ │ └── BiomeExchanger.cs │ ├── featureList.txt │ ├── Entities │ │ ├── Shark.cs │ │ ├── BoC │ │ │ ├── BoCHead.cs │ │ │ └── BoCCreeper.cs │ │ ├── EoW │ │ │ └── EoWCreepers.cs │ │ └── Bnuuy.cs │ ├── InvertedPyramid │ │ └── FloatingIslandOutsideOfDesert.cs │ ├── ReplaceCorruption100k.cs │ ├── Oceans.cs │ └── 100kWorld.cs ├── ClassicOptions.cs ├── SellDirt.cs ├── MeltIce.cs ├── SpecialCase.cs ├── Halloween │ ├── DifficultyValue.cs │ ├── NPCs │ │ ├── HalloweenGlobalNPC.cs │ │ ├── BrainOfCthulhu.cs │ │ └── EyeOfCthulhu.cs │ ├── Worldgen │ │ └── Utilities.cs │ └── HalloweenCommon.cs ├── SortedWorld.cs ├── EvilReplacer.cs ├── SpawnPass.cs ├── Snow │ ├── SnowReplacer.cs │ └── SnowWorld.cs ├── TileReplacer.cs ├── DrunkOptions.cs ├── NPCPass.cs └── RandomReplacer.cs ├── Helper ├── Accessors │ ├── ReflectionAccessor.cs │ ├── ReflectionCaller.cs │ ├── FieldAccessor.cs │ └── PropertyAccessor.cs ├── DifficultyHelper.cs ├── TileFinder.cs ├── WorldGenHelpers │ ├── TilePlacer.cs │ └── StalactiteHelper.cs ├── JsonRange.cs ├── RTree.cs ├── RandomPointInLine.cs └── Extensions.cs ├── Properties └── launchSettings.json ├── Debug ├── RainbowLiner.cs ├── ILPrinter.cs └── MethodTimer.cs ├── AdvancedWorldGen.csproj.user ├── Secret ├── Temple │ └── MudSeller.cs └── Special.cs ├── Folder.DotSettings.user ├── Configuration.json ├── ModHooks ├── Spooky.cs └── WorldGenPreviewer.cs ├── LICENSE ├── AdvancedWorldGen.csproj ├── description.txt ├── Todo.md └── GlobalUsings.cs /icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ishigh1/AdvancedWorldGen/HEAD/icon.png -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | -------------------------------------------------------------------------------- /Images/WorldOptions.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ishigh1/AdvancedWorldGen/HEAD/Images/WorldOptions.png -------------------------------------------------------------------------------- /Images/CopyWorldButton.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ishigh1/AdvancedWorldGen/HEAD/Images/CopyWorldButton.png -------------------------------------------------------------------------------- /TestItems/CorruptionOrb.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ishigh1/AdvancedWorldGen/HEAD/TestItems/CorruptionOrb.png -------------------------------------------------------------------------------- /global.json: -------------------------------------------------------------------------------- 1 | { 2 | "sdk": { 3 | "version": "8.0.0", 4 | "rollForward": "latestMajor", 5 | "allowPrerelease": true 6 | } 7 | } -------------------------------------------------------------------------------- /Base/PacketId.cs: -------------------------------------------------------------------------------- 1 | namespace AdvancedWorldGen.Base; 2 | 3 | public enum PacketId 4 | { 5 | SantaWaterFreezing, 6 | EntropyHappening, 7 | Puff 8 | } -------------------------------------------------------------------------------- /CustomSized/TerrainType.cs: -------------------------------------------------------------------------------- 1 | namespace AdvancedWorldGen.CustomSized; 2 | 3 | public enum TerrainType 4 | { 5 | Normal, 6 | Superflat, 7 | Flat, 8 | Mountainous, 9 | PeaksAndRifts, 10 | SkyPillars, 11 | BogoTerrain 12 | } -------------------------------------------------------------------------------- /BetterVanillaWorldGen/FloatingSky/FloatingIslandInfo.cs: -------------------------------------------------------------------------------- 1 | namespace AdvancedWorldGen.BetterVanillaWorldGen.FloatingSky; 2 | 3 | public struct FloatingIslandInfo 4 | { 5 | public int X, Y; 6 | public bool IsLake; 7 | public int Style; 8 | } -------------------------------------------------------------------------------- /BetterVanillaWorldGen/Interface/VanillaInterface.Custom.cs: -------------------------------------------------------------------------------- 1 | namespace AdvancedWorldGen.BetterVanillaWorldGen.Interface; 2 | 3 | public partial class VanillaInterface 4 | { 5 | public List FloatingIslandInfos = new(); 6 | } -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | bin/ 2 | obj/ 3 | **/.* 4 | **/__pycache__ 5 | workshop.json 6 | Tool/*-*.json 7 | Tool/Options.json 8 | changelog.txt 9 | AdvancedWorldGen.sln 10 | Options.json 11 | /Localization/ 12 | /*.hjson 13 | AdvancedWorldGen.sln.DotSettings.user 14 | -------------------------------------------------------------------------------- /Tool/Localization/fr-FR/WorldgenEdit.hjson: -------------------------------------------------------------------------------- 1 | { 2 | "CustomSizes": { 3 | "SizeX": "Taille horizontale :", 4 | "SizeY": "Taille verticale :", 5 | "TempleMultiplier": "Multiplicateur de taille de temple :", 6 | "BeachMultiplier": "Multiplicateur de taille de plage :" 7 | } 8 | } -------------------------------------------------------------------------------- /CustomSized/MapRelated.cs: -------------------------------------------------------------------------------- 1 | namespace AdvancedWorldGen.CustomSized; 2 | 3 | public static class MapRelated 4 | { 5 | public static bool UpdateMapTileInBounds(On_WorldGen.orig_UpdateMapTile orig, int i, int j, bool addtolist) 6 | { 7 | return WorldGen.InWorld(i, j) && orig(i, j, addtolist); 8 | } 9 | } -------------------------------------------------------------------------------- /UI/InputUI/OrderedUIItem.cs: -------------------------------------------------------------------------------- 1 | namespace AdvancedWorldGen.UI.InputUI; 2 | 3 | public class OrderedUIItem : UIElement 4 | { 5 | public int Order; 6 | 7 | public override int CompareTo(object obj) 8 | { 9 | if (obj is OrderedUIItem other) return Order - other.Order; 10 | return 0; 11 | } 12 | } -------------------------------------------------------------------------------- /Tool/Localization/ru-RU/WorldgenEdit.hjson: -------------------------------------------------------------------------------- 1 | { 2 | "CustomSizes": { 3 | "SizeX": "Ширина :", 4 | "SizeY": "Высота :", 5 | "TempleMultiplier": "Множитель размера Храма джунглей :", 6 | "DungeonMultiplier": "Множитель размера Данжа :", 7 | "BeachMultiplier": "Множитель размера пляжа :" 8 | } 9 | } -------------------------------------------------------------------------------- /SpecialOptions/100kSpecial/ColdAndHot/CactusPass.cs: -------------------------------------------------------------------------------- 1 | namespace AdvancedWorldGen.SpecialOptions._100kSpecial.ColdAndHot; 2 | 3 | public class CactusPass : ControlledWorldGenPass 4 | { 5 | public CactusPass() : base("Cactuses", 1f) 6 | { 7 | } 8 | 9 | protected override void ApplyPass() 10 | { 11 | throw new NotImplementedException(); 12 | } 13 | } -------------------------------------------------------------------------------- /Base/ZenithOption.cs: -------------------------------------------------------------------------------- 1 | namespace AdvancedWorldGen.Base; 2 | 3 | public class ZenithOption : Option 4 | { 5 | public override void OnEnable() 6 | { 7 | base.OnEnable(); 8 | foreach (Option option in OptionHelper.GetOptions("Celebrationmk10", "Drunk", "ForTheWorthy", "NoTraps", 9 | "NotTheBees", "TheConstant", "Remix")) option.Enable(); 10 | } 11 | } -------------------------------------------------------------------------------- /SpecialOptions/100kSpecial/ColdAndHot/CactusGrower.cs: -------------------------------------------------------------------------------- 1 | namespace AdvancedWorldGen.SpecialOptions._100kSpecial.ColdAndHot; 2 | 3 | public class CactusGrower : GlobalTile 4 | { 5 | public override void RandomUpdate(int i, int j, int type) 6 | { 7 | if (_100kWorld.Enabled && type == TileID.SnowBlock) 8 | { 9 | Cactus.GrowCactus(null, i, j); 10 | } 11 | } 12 | } -------------------------------------------------------------------------------- /SpecialOptions/ClassicOptions.cs: -------------------------------------------------------------------------------- 1 | namespace AdvancedWorldGen.SpecialOptions; 2 | 3 | public class ClassicOptions 4 | { 5 | public static void SmallNotTheBees(On_WorldGen.orig_NotTheBees orig) 6 | { 7 | if (OptionHelper.OptionsContains("NotTheBees.JungleWorld")) 8 | { 9 | bool wasNotTheBees = WorldGen.notTheBees; 10 | WorldGen.notTheBees = true; 11 | orig(); 12 | WorldGen.notTheBees = wasNotTheBees; 13 | } 14 | } 15 | } -------------------------------------------------------------------------------- /Helper/Accessors/ReflectionAccessor.cs: -------------------------------------------------------------------------------- 1 | namespace AdvancedWorldGen.Helper.Accessors; 2 | 3 | public abstract class ReflectionAccessor 4 | { 5 | public object? Data; 6 | 7 | public T Value 8 | { 9 | get => Get(); 10 | set => Set(value); 11 | } 12 | 13 | protected abstract void Set(T value); 14 | protected abstract T Get(); 15 | 16 | public static implicit operator T(ReflectionAccessor accessor) 17 | { 18 | return accessor.Value; 19 | } 20 | } -------------------------------------------------------------------------------- /SpecialOptions/SellDirt.cs: -------------------------------------------------------------------------------- 1 | namespace AdvancedWorldGen.SpecialOptions; 2 | 3 | public class SellDirt : GlobalNPC 4 | { 5 | public override void ModifyShop(NPCShop shop) 6 | { 7 | if (shop.NpcType == NPCID.Dryad) 8 | { 9 | Item expensiveDirt = new(ItemID.DirtBlock) 10 | { 11 | shopCustomPrice = Item.buyPrice(gold: 20) 12 | }; 13 | shop.Add(expensiveDirt, new Condition("randomWorld", () => OptionHelper.OptionsContains("Random"))); 14 | } 15 | } 16 | } -------------------------------------------------------------------------------- /Properties/launchSettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "profiles": { 3 | "Terraria": { 4 | "commandName": "Executable", 5 | "executablePath": "dotnet.exe", 6 | "commandLineArgs": "$(tMLPath)", 7 | "workingDirectory": "$(tMLSteamPath)" 8 | }, 9 | "TerrariaServer": { 10 | "commandName": "Executable", 11 | "executablePath": "dotnet.exe", 12 | "commandLineArgs": "$(tMLServerPath)", 13 | "workingDirectory": "$(tMLSteamPath)" 14 | } 15 | } 16 | } -------------------------------------------------------------------------------- /Debug/RainbowLiner.cs: -------------------------------------------------------------------------------- 1 | #if SPECIALDEBUG 2 | namespace AdvancedWorldGen.Debug 3 | { 4 | public static class RainbowLiner 5 | { 6 | public static void CreateColumn(int x) 7 | { 8 | for (int y = 0; y < Main.maxTilesY; y++) WorldGen.PlaceTile(x, y, TileID.RainbowBrick, forced: true); 9 | } 10 | 11 | public static void CreateLine(int y) 12 | { 13 | for (int x = 0; x < Main.maxTilesX; x++) WorldGen.PlaceTile(x, y, TileID.RainbowBrick, forced: true); 14 | } 15 | } 16 | } 17 | #endif -------------------------------------------------------------------------------- /SpecialOptions/MeltIce.cs: -------------------------------------------------------------------------------- 1 | using static Terraria.ID.TileID; 2 | 3 | namespace AdvancedWorldGen.SpecialOptions; 4 | 5 | public class MeltIce : GlobalTile 6 | { 7 | public override void KillTile(int i, int j, int type, ref bool fail, ref bool effectOnly, ref bool noItem) 8 | { 9 | if (type == BreakableIce && !fail && OptionHelper.OptionsContains("Santa")) 10 | { 11 | Tile tile = Main.tile[i, j]; 12 | tile.LiquidAmount = byte.MaxValue; 13 | tile.LiquidType = LiquidID.Water; 14 | } 15 | } 16 | } -------------------------------------------------------------------------------- /SpecialOptions/SpecialCase.cs: -------------------------------------------------------------------------------- 1 | namespace AdvancedWorldGen.SpecialOptions; 2 | 3 | public class SpecialCase 4 | { 5 | public delegate bool ConditionDelegate(int x, int y, Tile tile); 6 | 7 | public ConditionDelegate? Condition; 8 | public int Type; 9 | 10 | public SpecialCase(int type, ConditionDelegate? condition = null) 11 | { 12 | Type = type; 13 | Condition = condition; 14 | } 15 | 16 | public bool IsValid(int x, int y, Tile tile) 17 | { 18 | return Condition == null || Condition(x, y, tile); 19 | } 20 | } -------------------------------------------------------------------------------- /Debug/ILPrinter.cs: -------------------------------------------------------------------------------- 1 | #if SPECIALDEBUG 2 | namespace AdvancedWorldGen.Debug; 3 | 4 | public static class ILPrinter 5 | { 6 | public static void Print(this ILCursor cursor) 7 | { 8 | foreach (Instruction cursorInstr in cursor.Instrs) 9 | { 10 | if(cursorInstr.Operand is ILLabel label) 11 | Console.WriteLine($"At {cursorInstr.Offset} {cursorInstr.OpCode} : {label.Target.Offset}"); 12 | else 13 | Console.WriteLine($"At {cursorInstr.Offset} {cursorInstr.OpCode} : {cursorInstr.Operand}"); 14 | } 15 | } 16 | } 17 | #endif -------------------------------------------------------------------------------- /UI/InputUI/List/BooleanExpandableList.cs: -------------------------------------------------------------------------------- 1 | namespace AdvancedWorldGen.UI.InputUI.List; 2 | 3 | public class BooleanExpandableList : ExpandableList 4 | { 5 | public BooleanExpandableList(string name, string? localizationPath) : base(name, localizationPath, false) 6 | { 7 | PossibleValues = new[] 8 | { 9 | bool.TrueString, bool.FalseString 10 | }; 11 | 12 | CreateUIElement(); 13 | } 14 | 15 | public override string Value 16 | { 17 | get => Params.Get(Name).ToString()!; 18 | set => Params.Set(Name, bool.Parse(value)); 19 | } 20 | } -------------------------------------------------------------------------------- /UI/InputUI/Number/JsonNumberTextBox.cs: -------------------------------------------------------------------------------- 1 | namespace AdvancedWorldGen.UI.InputUI.Number; 2 | 3 | public class JsonNumberTextBox : NumberTextBox where T : IConvertible, IComparable 4 | { 5 | public JValue JValue; 6 | 7 | public JsonNumberTextBox(JValue jValue, T min, T max, string? localizationPath) : base(jValue.Path, min, max, 8 | localizationPath) 9 | { 10 | JValue = jValue; 11 | 12 | CreateUIElement(); 13 | } 14 | 15 | public override T? Value 16 | { 17 | get => (T)JValue.Value; 18 | set => JValue.Value = value; 19 | } 20 | } -------------------------------------------------------------------------------- /BetterVanillaWorldGen/FloatingSky/FloatingHouses.cs: -------------------------------------------------------------------------------- 1 | namespace AdvancedWorldGen.BetterVanillaWorldGen.FloatingSky; 2 | 3 | public class FloatingHouses : ControlledWorldGenPass 4 | { 5 | public FloatingHouses() : base("Floating Island Houses", 1.5022f) 6 | { 7 | } 8 | 9 | protected override void ApplyPass() 10 | { 11 | foreach (FloatingIslandInfo floatingIslandInfo in VanillaInterface.FloatingIslandInfos.Where( 12 | floatingIslandInfo => !floatingIslandInfo.IsLake)) 13 | WorldGen.IslandHouse(floatingIslandInfo.X, floatingIslandInfo.Y, floatingIslandInfo.Style); 14 | } 15 | } -------------------------------------------------------------------------------- /AdvancedWorldGen.csproj.user: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | ProjectDebugger 5 | 6 | 7 | TerrariaServer 8 | 9 | 10 | ProjectDebugger 11 | 12 | -------------------------------------------------------------------------------- /Secret/Temple/MudSeller.cs: -------------------------------------------------------------------------------- 1 | namespace AdvancedWorldGen.Secret.Temple; 2 | 3 | public class MudSeller : GlobalNPC 4 | { 5 | public override void ModifyShop(NPCShop shop) 6 | { 7 | if (shop.NpcType == NPCID.Dryad) 8 | { 9 | Condition condition = new("TempleWorld", () => Special.TempleWorld); 10 | Item mudBlock = new(ItemID.MudBlock) 11 | { 12 | shopCustomPrice = Item.buyPrice(gold: 20) 13 | }; 14 | shop.Add(mudBlock, condition); 15 | 16 | Item waterBucket = new(ItemID.WaterBucket) 17 | { 18 | shopCustomPrice = Item.buyPrice(5) 19 | }; 20 | shop.Add(waterBucket, condition); 21 | } 22 | } 23 | } -------------------------------------------------------------------------------- /SpecialOptions/100kSpecial/featureList.txt: -------------------------------------------------------------------------------- 1 | This is a list of implemented things up to now : 2 | - Inverted pyramid above the desert, with an house on it. The spawn is located threr 3 | - All bunnies are named "Baba", enemies can't kill them, but if they die, they spawn a jungle turtle or the moon lord instead (for the explosive one) 4 | - Brain of Corruption behaves like Eater of World should and vice versa 5 | - The surface is lower than usual on overhauled, to leave space to the many things above ground 6 | - Living tree extending to the underworld 7 | - One of the ocean gets a column of water held by slightly bugged bubbles and one gets dried -------------------------------------------------------------------------------- /UI/InputUI/List/ExpandableList.cs: -------------------------------------------------------------------------------- 1 | namespace AdvancedWorldGen.UI.InputUI.List; 2 | 3 | public abstract class ExpandableList : InputBox 4 | { 5 | public bool AllowOther; 6 | public string[] PossibleValues; 7 | 8 | protected ExpandableList(string name, string? localizationPath, bool allowOther) : base(name, localizationPath) 9 | { 10 | AllowOther = allowOther; 11 | } 12 | 13 | public override void CreateUIElement() 14 | { 15 | base.CreateUIElement(); 16 | 17 | ValuesList valuesList = new(this, PossibleValues) 18 | { 19 | VAlign = 0.5f, 20 | HAlign = 1f 21 | }; 22 | Background.Append(valuesList); 23 | } 24 | } -------------------------------------------------------------------------------- /UI/InputUI/Number/NumberTextBox.cs: -------------------------------------------------------------------------------- 1 | namespace AdvancedWorldGen.UI.InputUI.Number; 2 | 3 | public abstract class NumberTextBox : InputBox where T : IConvertible, IComparable 4 | { 5 | public T Max; 6 | public T Min; 7 | 8 | protected NumberTextBox(string name, T min, T max, string? localizationPath) : base(name, localizationPath) 9 | { 10 | Min = min; 11 | Max = max; 12 | } 13 | 14 | public override void CreateUIElement() 15 | { 16 | base.CreateUIElement(); 17 | 18 | EditableText editableText = new(this) 19 | { 20 | VAlign = 0.5f, 21 | HAlign = 1f 22 | }; 23 | Background.Append(editableText); 24 | } 25 | } -------------------------------------------------------------------------------- /SpecialOptions/Halloween/DifficultyValue.cs: -------------------------------------------------------------------------------- 1 | namespace AdvancedWorldGen.SpecialOptions.Halloween; 2 | 3 | public readonly struct DifficultyValue 4 | { 5 | private readonly T ExpertMode; 6 | private readonly T MasterMode; 7 | private readonly T NormalMode; 8 | 9 | public DifficultyValue(T normalMode, T expertMode, T masterMode) 10 | { 11 | NormalMode = normalMode; 12 | ExpertMode = expertMode; 13 | MasterMode = masterMode; 14 | } 15 | 16 | public T GetCurrentValue() 17 | { 18 | if (Main.masterMode) 19 | return MasterMode; 20 | 21 | if (Main.expertMode) 22 | return ExpertMode; 23 | 24 | return NormalMode; 25 | } 26 | } -------------------------------------------------------------------------------- /Tool/Localization/zh-Hans/worldgenEdit.hjson: -------------------------------------------------------------------------------- 1 | { 2 | "CustomSizes": { 3 | "SizeX": "水平尺寸:", 4 | "SizeY": "垂直尺寸:", 5 | "TempleMultiplier": "神庙规模倍增:", 6 | "DungeonMultiplier": "地牢大小倍增:", 7 | "BeachMultiplier": "海洋沙滩大小倍增:", 8 | "ScaledBeaches": "用世界大小来平衡海滩大小", 9 | "EditTerrainPass": "在世界创建期间启用另一个自定义", 10 | "TerrainType": "地形类型" 11 | }, 12 | "Overhauled": {}, 13 | "TerrainPass": {}, 14 | "Vanilla": { 15 | "Passes['Micro_Biomes']": { 16 | "CorruptionPitCount": { 17 | "Min": "生物群落中邪恶的最小数量", 18 | "Max": "在一个生物群落中邪恶的最大数目", 19 | "ScaleWith": "邪恶的数目:" 20 | } 21 | } 22 | } 23 | } -------------------------------------------------------------------------------- /Helper/DifficultyHelper.cs: -------------------------------------------------------------------------------- 1 | namespace AdvancedWorldGen.Helper; 2 | 3 | public static class DifficultyHelper 4 | { 5 | public static float GetDamageModifier() 6 | { 7 | float power = Main.GameModeInfo.EnemyDamageMultiplier; 8 | 9 | if (Main.getGoodWorld) 10 | { 11 | power++; 12 | power *= 4 / 3f; 13 | } 14 | 15 | if (!ModLoader.TryGetMod("CreativeFix", out Mod _) && Main.GameModeInfo.IsJourneyMode) 16 | { 17 | CreativePowers.DifficultySliderPower difficultySliderPower = 18 | CreativePowerManager.Instance.GetPower(); 19 | power *= difficultySliderPower.StrengthMultiplierToGiveNPCs; 20 | } 21 | 22 | return power; 23 | } 24 | } -------------------------------------------------------------------------------- /SpecialOptions/100kSpecial/Entities/Shark.cs: -------------------------------------------------------------------------------- 1 | namespace AdvancedWorldGen.SpecialOptions._100kSpecial.Entities; 2 | 3 | public class Shark : GlobalNPC 4 | { 5 | public override void EditSpawnPool(IDictionary pool, NPCSpawnInfo spawnInfo) 6 | { 7 | if (_100kWorld.Enabled && !spawnInfo.Water && 8 | ((spawnInfo.SpawnTileX < WorldGen.oceanDistance || 9 | spawnInfo.SpawnTileX > Main.maxTilesX - WorldGen.oceanDistance) && 10 | Main.tileSand[spawnInfo.SpawnTileType] && spawnInfo.SpawnTileY < Main.rockLayer) || 11 | (spawnInfo.SpawnTileType == 53 && WorldGen.oceanDepths(spawnInfo.SpawnTileX, spawnInfo.SpawnTileY))) 12 | { 13 | pool.Add(NPCID.Shark, 1/8f); 14 | } 15 | } 16 | } -------------------------------------------------------------------------------- /Helper/Accessors/ReflectionCaller.cs: -------------------------------------------------------------------------------- 1 | namespace AdvancedWorldGen.Helper.Accessors; 2 | 3 | public class ReflectionCaller 4 | { 5 | public MethodInfo MethodInfo; 6 | public object? VanillaData; 7 | 8 | public ReflectionCaller(IReflect type, string name, object? vanillaData) 9 | { 10 | MethodInfo = type.GetMethod(name, BindingFlags.Instance | BindingFlags.NonPublic)!; 11 | VanillaData = vanillaData; 12 | } 13 | 14 | public ReflectionCaller(IReflect type, string name) 15 | { 16 | MethodInfo = type.GetMethod(name, BindingFlags.Static | BindingFlags.NonPublic)!; 17 | VanillaData = null; 18 | } 19 | 20 | public object? Call(params object[] args) 21 | { 22 | return MethodInfo.Invoke(VanillaData, args)!; 23 | } 24 | } -------------------------------------------------------------------------------- /Tool/setup.py: -------------------------------------------------------------------------------- 1 | import os 2 | import commands 3 | 4 | def find_newest(path): 5 | """Recursively find the newest modified time of any file in the hierarchy""" 6 | if not os.path.exists(path): 7 | return 0 8 | 9 | newest_time = 0 10 | for item in os.listdir(path): 11 | item_path = os.path.join(path, item) 12 | if os.path.isfile(item_path): 13 | item_time = os.path.getmtime(item_path) 14 | else: 15 | item_time = find_newest(item_path) 16 | if item_time > newest_time: 17 | newest_time = item_time 18 | return newest_time 19 | 20 | if find_newest("../Localization") < find_newest("."): 21 | commands.make_files() 22 | commands.setup() -------------------------------------------------------------------------------- /Helper/TileFinder.cs: -------------------------------------------------------------------------------- 1 | namespace AdvancedWorldGen.Helper; 2 | 3 | public static class TileFinder 4 | { 5 | public static (int x, int y) SpiralSearch(int x, int y, Func check) 6 | { 7 | const int stepSize = 2; 8 | int xStep = stepSize; 9 | int yStep = 0; 10 | 11 | int activeLength = 1; 12 | float length = 1; 13 | 14 | while (true) 15 | { 16 | if (WorldGen.InWorld(x, y, 10) && check(x, y)) break; 17 | 18 | x += xStep; 19 | y += yStep; 20 | if (--activeLength == 0) 21 | { 22 | int tmp = xStep; 23 | xStep = -yStep; 24 | yStep = tmp; 25 | length += 0.5f; 26 | activeLength = (int)length; 27 | if (length >= 1000f) 28 | return (-1, -1); 29 | } 30 | } 31 | 32 | return (x, y); 33 | } 34 | } -------------------------------------------------------------------------------- /BetterVanillaWorldGen/ControlledWorldGenPass.cs: -------------------------------------------------------------------------------- 1 | namespace AdvancedWorldGen.BetterVanillaWorldGen; 2 | 3 | public abstract class ControlledWorldGenPass : GenPass 4 | { 5 | public GameConfiguration Configuration = null!; 6 | public GenerationProgress Progress = null!; 7 | public Stopwatch? Stopwatch; 8 | public VanillaInterface VanillaInterface; 9 | 10 | protected ControlledWorldGenPass(string name, float loadWeight) : base(name, loadWeight) 11 | { 12 | VanillaInterface = Replacer.VanillaInterface; 13 | } 14 | 15 | protected abstract void ApplyPass(); 16 | 17 | protected sealed override void ApplyPass(GenerationProgress progress, GameConfiguration configuration) 18 | { 19 | Progress = progress; 20 | Configuration = configuration; 21 | ApplyPass(); 22 | } 23 | } -------------------------------------------------------------------------------- /CustomSized/KnownLimits.cs: -------------------------------------------------------------------------------- 1 | namespace AdvancedWorldGen.CustomSized; 2 | 3 | public static class KnownLimits 4 | { 5 | public const int OverhauledMinX = 1_500; 6 | public const int NormalMinX = 4_200; 7 | public const int ComfortNormalMaxX = 9_000; 8 | public const int NormalMaxX = 12_000; 9 | public const int OverhauledMinY = 500; 10 | 11 | public const int DataLoad = 8; 12 | public const int MapLoad = 4; 13 | public const int LiquidLoad = 2; 14 | public const int WallLoad = 2; 15 | public const int TileLoad = 2; 16 | public const int EweLoad = DataLoad + MapLoad + LiquidLoad + WallLoad + TileLoad; 17 | 18 | public static bool WillCrashMissingEwe(int sizeX, int sizeY) 19 | { 20 | return sizeX * sizeY * EweLoad > GC.GetGCMemoryInfo().TotalAvailableMemoryBytes; 21 | } 22 | } -------------------------------------------------------------------------------- /Folder.DotSettings.user: -------------------------------------------------------------------------------- 1 | 2 | <AssemblyExplorer> 3 | <Assembly Path="D:\SteamLibrary\steamapps\common\tModLoader\Libraries\Newtonsoft.Json\12.0.0.0\Newtonsoft.Json.dll" /> 4 | </AssemblyExplorer> 5 | True 6 | True -------------------------------------------------------------------------------- /Configuration.json: -------------------------------------------------------------------------------- 1 | { 2 | "Evil": { 3 | "BiomeAmount": { 4 | "Min": 1.89, 5 | "Max": 1.89, 6 | "ScaleWith": "WorldWidth" 7 | }, 8 | "EvilBiomeSizeAroundCenter": { 9 | "Min": 100, 10 | "Max": 300, 11 | "ScaleWith": "None" 12 | } 13 | }, 14 | "SkyIslands": { 15 | "HouseAmount": { 16 | "Min": 3.36, 17 | "Max": 3.36, 18 | "ScaleWith": "WorldWidth" 19 | }, 20 | "LakeAmount": { 21 | "Min": 1.68, 22 | "Max": 1.68, 23 | "ScaleWith": "WorldWidth" 24 | } 25 | }, 26 | "Desert": { 27 | "Width": { 28 | "Min": 80, 29 | "Max": 80, 30 | "ScaleWith": "WorldWidth" 31 | }, 32 | "Height": { 33 | "Min": 170, 34 | "Max": 170, 35 | "ScaleWith": "WorldHeight" 36 | } 37 | } 38 | } -------------------------------------------------------------------------------- /Tool/Localization/en-US/worldgenEdit.hjson: -------------------------------------------------------------------------------- 1 | { 2 | "CustomSizes": { 3 | "SizeX": "Horizontal size :", 4 | "SizeY": "Vertical size :", 5 | "TempleMultiplier": "Temple size multiplier :", 6 | "DungeonMultiplier": "Dungeon size multiplier :", 7 | "BeachMultiplier": "Beach size multiplier :", 8 | "ScaledBeaches": "Scale beaches with world size", 9 | "EditTerrainPass": "Enable another customisation during worldgen", 10 | "TerrainType": "Terrain type" 11 | }, 12 | "Overhauled": {}, 13 | "TerrainPass": {}, 14 | "Vanilla": { 15 | "Passes['Micro_Biomes']": { 16 | "CorruptionPitCount": { 17 | "Min": "Minimum number of corruption pits in a biome", 18 | "Max": "Maximum number of corruption pits in a biome", 19 | "ScaleWith": "Scale the number of corruption pits with :" 20 | } 21 | } 22 | } 23 | } -------------------------------------------------------------------------------- /BetterVanillaWorldGen/Interface/VanillaInterface.Mods.cs: -------------------------------------------------------------------------------- 1 | namespace AdvancedWorldGen.BetterVanillaWorldGen.Interface; 2 | 3 | public partial class VanillaInterface // Yes, I know, bad name... 4 | { 5 | public CalamityInterface Calamity; 6 | 7 | public VanillaInterface() 8 | { 9 | Calamity = new CalamityInterface(); 10 | } 11 | 12 | public class CalamityInterface 13 | { 14 | public readonly bool Enabled; 15 | public readonly ReflectionAccessor SulphurousSeaBiomeWidth; 16 | 17 | public CalamityInterface() 18 | { 19 | if (ModLoader.TryGetMod("CalamityMod", out Mod mod)) 20 | { 21 | Type? sulphurousSea = mod.GetType("CalamityMod.World.SulphurousSea"); 22 | if (sulphurousSea == null) 23 | return; 24 | SulphurousSeaBiomeWidth = new PropertyAccessor(sulphurousSea, "BiomeWidth"); 25 | 26 | Enabled = true; 27 | } 28 | } 29 | } 30 | } -------------------------------------------------------------------------------- /Base/Legacy.cs: -------------------------------------------------------------------------------- 1 | namespace AdvancedWorldGen.Base; 2 | 3 | public class Legacy 4 | { 5 | public static void MoveFiles() 6 | { 7 | #region 2.9, 30/03/2023 8 | 9 | string advancedWorldGenPassesDataPath = Path.Combine(Main.SavePath, "AdvancedWorldGenPassesData.json"); 10 | if (File.Exists(advancedWorldGenPassesDataPath)) 11 | if (File.Exists(ModifiedWorld.DataPath)) 12 | File.Delete(advancedWorldGenPassesDataPath); 13 | else 14 | File.Move(advancedWorldGenPassesDataPath, ModifiedWorld.DataPath); 15 | 16 | #endregion 17 | 18 | #region 3.1, 04/04/2023 19 | 20 | string presetDataPath = Path.Combine(AdvancedWorldGenMod.FolderPath, "Presets.json"); 21 | if (File.Exists(presetDataPath)) 22 | if (File.Exists(PresetUI.DataPath)) 23 | File.Delete(presetDataPath); 24 | else 25 | File.Move(presetDataPath, PresetUI.DataPath); 26 | 27 | #endregion 28 | } 29 | } -------------------------------------------------------------------------------- /UI/InputUI/Number/ConfigNumberTextBox.cs: -------------------------------------------------------------------------------- 1 | namespace AdvancedWorldGen.UI.InputUI.Number; 2 | 3 | public class ConfigNumberTextBox : NumberTextBox where T : IConvertible, IComparable 4 | { 5 | public Dictionary? Data; 6 | 7 | public ConfigNumberTextBox(Dictionary data, string name, T min, T max, 8 | string? localizationPath = null) : base(name, min, max, localizationPath) 9 | { 10 | Data = data; 11 | 12 | CreateUIElement(); 13 | } 14 | 15 | public ConfigNumberTextBox(string name, T min, T max, string? localizationPath = null) : base(name, min, max, 16 | localizationPath) 17 | { 18 | CreateUIElement(); 19 | } 20 | 21 | public override T? Value 22 | { 23 | get 24 | { 25 | if (Data != null) 26 | return (T?)Data![Name]; 27 | return (T?)Params.Get(Name); 28 | } 29 | set 30 | { 31 | if (Data != null) 32 | Data![Name] = value!; 33 | else 34 | Params.Set(Name, value!); 35 | } 36 | } 37 | } -------------------------------------------------------------------------------- /BetterVanillaWorldGen/Interface/VanillaInterface.Backing.cs: -------------------------------------------------------------------------------- 1 | namespace AdvancedWorldGen.BetterVanillaWorldGen.Interface; 2 | 3 | public partial class VanillaInterface 4 | { 5 | private static readonly FieldAccessor _optionSize = 6 | new(typeof(UIWorldCreation), "_optionSize", null); 7 | 8 | private static readonly FieldAccessor _sizeButtons = 9 | new(typeof(UIWorldCreation), "_sizeButtons", null); 10 | 11 | private static readonly FieldAccessor _seedPlate = 12 | new(typeof(UIWorldCreation), "_seedPlate", null); 13 | 14 | private static readonly FieldAccessor> _iconTexture = 15 | new(typeof(GroupOptionButton), "_iconTexture", null); 16 | 17 | private static readonly FieldAccessor _descriptionText = 18 | new(typeof(UIWorldCreation), "_descriptionText", null); 19 | 20 | private static readonly FieldAccessor _buttonLabel = 21 | new(typeof(UIWorldListItem), "_buttonLabel", null); 22 | } -------------------------------------------------------------------------------- /CustomSized/OverhauledWorld.cs: -------------------------------------------------------------------------------- 1 | /* 2 | Removed as beaches are nox constant 3 | 4 | namespace AdvancedWorldGen.CustomSized; 5 | 6 | public class OverhauledWorld : ModSystem 7 | { 8 | public const int BaseOceanDistance = 250; 9 | public const int BaseBeachDistance = 380; 10 | 11 | public override void LoadWorldData(TagCompound tag) 12 | { 13 | if (tag.TryGet("ocean", out int value)) WorldGen.oceanDistance = value; 14 | if (tag.TryGet("beach", out value)) WorldGen.beachDistance = value; 15 | } 16 | 17 | public override void SaveWorldData(TagCompound tagCompound) 18 | { 19 | if (WorldGen.oceanDistance != BaseOceanDistance) 20 | tagCompound["ocean"] = WorldGen.oceanDistance; 21 | if (WorldGen.beachDistance != BaseBeachDistance) 22 | tagCompound["beach"] = WorldGen.beachDistance; 23 | } 24 | 25 | public override void OnWorldUnload() 26 | { 27 | WorldGen.oceanDistance = BaseOceanDistance; 28 | WorldGen.beachDistance = BaseBeachDistance; 29 | } 30 | } 31 | */ 32 | 33 | -------------------------------------------------------------------------------- /ModHooks/Spooky.cs: -------------------------------------------------------------------------------- 1 | namespace AdvancedWorldGen.ModHooks; 2 | 3 | public class Spooky : ModSystem 4 | { 5 | private ILHook? Hook; 6 | 7 | private static ILContext.Manipulator GetManipulator(ILContext.Manipulator self) 8 | { 9 | return self; 10 | } 11 | 12 | public override void Load() 13 | { 14 | if (ModLoader.TryGetMod("Spooky", out Mod mod) && 15 | mod.TryGetMethod("Spooky.Content.Generation.SpookyHell", "ClearArea", 16 | BindingFlags.Public | BindingFlags.Instance, 17 | out MethodInfo? methodInfo)) 18 | Hook = new ILHook(methodInfo, GetManipulator(AvoidRight)); 19 | } 20 | 21 | public override void Unload() 22 | { 23 | Hook?.Dispose(); 24 | } 25 | 26 | private static void AvoidRight(ILContext ilContext) //Will have to remove when it is implemented 27 | { 28 | ILCursor cursor = new(ilContext); 29 | cursor.GotoNext(MoveType.Before, 30 | instruction => instruction.OpCode == OpCodes.Ble_S && instruction.Next.MatchLdloc(0)); 31 | cursor.Remove(); 32 | cursor.Emit(OpCodes.Blt); 33 | } 34 | } -------------------------------------------------------------------------------- /Helper/Accessors/FieldAccessor.cs: -------------------------------------------------------------------------------- 1 | namespace AdvancedWorldGen.Helper.Accessors; 2 | 3 | public class FieldAccessor : ReflectionAccessor 4 | { 5 | public FieldInfo FieldInfo; 6 | public object? VanillaData; 7 | 8 | public FieldAccessor(IEnumerable fieldInfos, string name, object? vanillaData) 9 | { 10 | FieldInfo = fieldInfos.First(info => info.Name == name); 11 | VanillaData = vanillaData; 12 | } 13 | 14 | public FieldAccessor(IReflect type, string name, object? vanillaData) 15 | { 16 | FieldInfo = type.GetField(name, BindingFlags.Instance | BindingFlags.NonPublic)!; 17 | VanillaData = vanillaData; 18 | } 19 | 20 | public FieldAccessor(IReflect type, string name) 21 | { 22 | FieldInfo = type.GetField(name, BindingFlags.Static | BindingFlags.NonPublic)!; 23 | VanillaData = null; 24 | } 25 | 26 | protected override void Set(T value) 27 | { 28 | FieldInfo.SetValue(VanillaData, value); 29 | } 30 | 31 | protected override T Get() 32 | { 33 | return (T)FieldInfo.GetValue(VanillaData)!; 34 | } 35 | } -------------------------------------------------------------------------------- /Helper/Accessors/PropertyAccessor.cs: -------------------------------------------------------------------------------- 1 | namespace AdvancedWorldGen.Helper.Accessors; 2 | 3 | public class PropertyAccessor : ReflectionAccessor 4 | { 5 | public PropertyInfo PropertyInfo; 6 | 7 | public PropertyAccessor(IEnumerable propertyInfos, string name, object? data) 8 | { 9 | PropertyInfo = propertyInfos.First(info => info.Name == name); 10 | Data = data; 11 | } 12 | 13 | public PropertyAccessor(IReflect type, string name, object? data) 14 | { 15 | PropertyInfo = type.GetProperty(name, BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public)!; 16 | Data = data; 17 | } 18 | 19 | public PropertyAccessor(IReflect type, string name) 20 | { 21 | PropertyInfo = type.GetProperty(name, BindingFlags.Static | BindingFlags.NonPublic | BindingFlags.Public)!; 22 | Data = null; 23 | } 24 | 25 | protected override void Set(T value) 26 | { 27 | PropertyInfo.SetValue(Data, value); 28 | } 29 | 30 | protected override T Get() 31 | { 32 | return (T)PropertyInfo.GetValue(Data)!; 33 | } 34 | } -------------------------------------------------------------------------------- /Helper/WorldGenHelpers/TilePlacer.cs: -------------------------------------------------------------------------------- 1 | using System.Runtime.CompilerServices; 2 | 3 | namespace AdvancedWorldGen.Helper.WorldGenHelpers; 4 | 5 | public static class TilePlacer 6 | { 7 | // All of the following methods place things starting from top-left 8 | [MethodImpl(MethodImplOptions.AggressiveInlining)] 9 | public static void QuickPlaceFurniture(int x, int y, ushort type, int sizeX, int sizeY, int styleX = 0, 10 | int styleY = 0) 11 | { 12 | for (short i = 0; i < sizeX; i++) 13 | for (short j = 0; j < sizeY; j++) 14 | { 15 | QuickPlaceTile(x + i, y + j, type, styleX: i + styleX * sizeX, styleY: j + styleY * sizeY); 16 | } 17 | } 18 | 19 | [MethodImpl(MethodImplOptions.AggressiveInlining)] 20 | public static void QuickPlaceTile(int x, int y, ushort type, int styleX = 0, int styleY = 0) 21 | { 22 | Tile tile = Main.tile[x, y]; 23 | tile.HasTile = true; 24 | const short styleSize = 18; 25 | tile.TileFrameX = (short)(styleX * styleSize); 26 | tile.TileFrameY = (short)(styleY * styleSize); 27 | tile.TileType = type; 28 | } 29 | } -------------------------------------------------------------------------------- /Tool/Localization/zh-Hans/ui.hjson: -------------------------------------------------------------------------------- 1 | { 2 | "Abort": "中止计划", 3 | "CopySettings": "复制设置", 4 | "CopiedSettings": "设置已复制", 5 | "CustomSize": "自定义大小", 6 | "CustomSizedWorld": "{0}x{1}", 7 | "DedServ": { 8 | "Import": ":导入选项", 9 | "InvalidId": "无效数字", 10 | "InvalidImport": "无效导入", 11 | "InvalidInput": "无法识别输入", 12 | "Selected": "(选择)", 13 | "ShowHidden": "h:显示隐藏选项", 14 | "Validate": "y:验证" 15 | }, 16 | "DeleteWorlds": "删除最后一个世界", 17 | "DownLevel": "编辑将从这个种子中使用的内容", 18 | "Export": "导出到剪贴板", 19 | "HideHidden": { 20 | "Description": "隐藏次要、不稳定的特性。" 21 | }, 22 | "Import": "从剪贴板导入", 23 | "NoOptions": "没有选择的世界", 24 | "NoneSelected": { 25 | "Description": "请选择您想要的选项。" 26 | }, 27 | "OptionButton": "选择你的世界生成设置", 28 | "Randomize": "随机化选项", 29 | "Presets": "预设", 30 | "ShowHidden": { 31 | "Description": "显示次要、不稳定的特性。" 32 | }, 33 | "Timer": "剩余时间:{0}", 34 | "VanillaConfig": "原版配置", 35 | "OverhauledConfig": "大修配置", 36 | "OverhauledDisabled": "使大修的世界有更多的选择", 37 | "Warning": "警告" 38 | } -------------------------------------------------------------------------------- /TestItems/CorruptionOrb.cs: -------------------------------------------------------------------------------- 1 | namespace AdvancedWorldGen.TestItems; 2 | 3 | public class CorruptionOrb : ModItem 4 | { 5 | public override void SetDefaults() 6 | { 7 | Item.width = 32; 8 | Item.height = 32; 9 | Item.consumable = true; 10 | Item.useStyle = ItemUseStyleID.HoldUp; 11 | Item.useAnimation = 45; 12 | Item.useTime = 45; 13 | Item.maxStack = 20; 14 | #if !SPECIALDEBUG 15 | ItemID.Sets.Deprecated[Item.type] = true; 16 | #endif 17 | } 18 | 19 | public override bool? UseItem(Player player) 20 | { 21 | int centerX = (int)(player.position.X / 16); 22 | int corruptionLeft = centerX - Main.rand.Next(100, 300); 23 | int corruptionRight = centerX + Main.rand.Next(100, 300); 24 | int positionY = (int)(player.position.Y / 16); 25 | GenVars.worldSurfaceHigh = positionY + 50; 26 | Corruption.MakeSingleCorruptionBiome(corruptionLeft, corruptionRight, centerX, positionY); 27 | for (int x = corruptionLeft; x < corruptionRight; x++) 28 | for (int y = positionY - 20; y < Main.rockLayer; y++) 29 | WorldGen.TileFrame(x, y); 30 | return true; 31 | } 32 | } -------------------------------------------------------------------------------- /UI/InputUI/FocusElement.cs: -------------------------------------------------------------------------------- 1 | namespace AdvancedWorldGen.UI.InputUI; 2 | 3 | public abstract class FocusElement : UIElement 4 | { 5 | public static FocusElement? CurrentFocus; 6 | public bool IsTheCurrentFocus => CurrentFocus == this; 7 | 8 | public abstract string DisplayText { get; } 9 | 10 | public virtual void Focus() 11 | { 12 | CurrentFocus?.Unfocus(); 13 | CurrentFocus = this; 14 | } 15 | 16 | public virtual void Unfocus() 17 | { 18 | CurrentFocus = null; 19 | } 20 | 21 | protected override void DrawSelf(SpriteBatch spriteBatch) 22 | { 23 | if (Main.mouseLeft && Main.mouseLeftRelease) 24 | if (IsTheCurrentFocus) 25 | Unfocus(); 26 | else if (Parent.IsMouseHovering) 27 | Focus(); 28 | 29 | if (!IsTheCurrentFocus) DrawText(spriteBatch, DisplayText); 30 | } 31 | 32 | public void DrawText(SpriteBatch spriteBatch, string text) 33 | { 34 | CalculatedStyle space = GetDimensions(); 35 | Vector2 size = 36 | Utils.DrawBorderString(spriteBatch, text, new Vector2(space.X, space.Y), Color.White); 37 | Width.Pixels = size.X; 38 | Height.Pixels = size.Y; 39 | } 40 | } -------------------------------------------------------------------------------- /Base/WorlgenSettings.cs: -------------------------------------------------------------------------------- 1 | namespace AdvancedWorldGen.Base; 2 | 3 | public class WorldgenSettings : ModConfig 4 | { 5 | [DefaultValue(false)] 6 | [ReloadRequired] 7 | [LabelKey("$Mods.AdvancedWorldGen.Config.FasterWorldgen.Label")] 8 | [TooltipKey("$Mods.AdvancedWorldGen.Config.FasterWorldgen.Tooltip")] 9 | public bool FasterWorldgen; 10 | 11 | [DefaultValue(false)] 12 | [LabelKey("$Mods.AdvancedWorldGen.Config.SaveOnFail.Label")] 13 | [TooltipKey("$Mods.AdvancedWorldGen.Config.SaveOnFail.Tooltip")] 14 | public bool SaveOnFail; 15 | 16 | [DefaultValue(false)] 17 | [LabelKey("$Mods.AdvancedWorldGen.Config.VanillaWeight.Label")] 18 | [TooltipKey("$Mods.AdvancedWorldGen.Config.VanillaWeight.Tooltip")] 19 | public bool VanillaWeight; 20 | 21 | [DefaultValue(true)] 22 | [LabelKey("$Mods.AdvancedWorldGen.Config.ZenithEnabler.Label")] 23 | [TooltipKey("$Mods.AdvancedWorldGen.Config.ZenithEnabler.Tooltip")] 24 | public bool ZenithEnabler; 25 | 26 | public static WorldgenSettings Instance => ModContent.GetInstance(); 27 | 28 | public override ConfigScope Mode => ConfigScope.ServerSide; 29 | } -------------------------------------------------------------------------------- /UI/InputUI/List/TileExpandableList.cs: -------------------------------------------------------------------------------- 1 | namespace AdvancedWorldGen.UI.InputUI.List; 2 | 3 | public class TileExpandableList : ExpandableList 4 | { 5 | public const int Random = -1; 6 | 7 | public TileExpandableList(string name, string? localizationPath, bool allowOther, params int[] possibleValues) : 8 | base(name, localizationPath, allowOther) 9 | { 10 | PossibleValues = new string[possibleValues.Length]; 11 | for (int index = 0; index < possibleValues.Length; index++) 12 | { 13 | int possibleValue = possibleValues[index]; 14 | if (possibleValue == Random) 15 | PossibleValues[index] = nameof(Random); 16 | else 17 | PossibleValues[index] = TileID.Search.GetName(possibleValue); 18 | } 19 | 20 | CreateUIElement(); 21 | } 22 | 23 | public override string Value 24 | { 25 | get 26 | { 27 | int value = (int)Params.Get(Name); 28 | return value == Random ? nameof(Random) : TileID.Search.GetName(value); 29 | } 30 | set 31 | { 32 | if (value == nameof(Random)) 33 | Params.Set(Name, Random); 34 | else 35 | Params.Set(Name, TileID.Search.GetId(value)); 36 | } 37 | } 38 | } -------------------------------------------------------------------------------- /Tool/Localization/fr-FR/ui.hjson: -------------------------------------------------------------------------------- 1 | { 2 | "Import": "Importer depuis le presse-papier", 3 | "Export": "Exporter vers le presse-papier", 4 | "NoneSelected": { 5 | "Description": "Choisissez vos options." 6 | }, 7 | "ShowHidden": { 8 | "Description": "Montre les options mineures et/ou instables." 9 | }, 10 | "HideHidden": { 11 | "Description": "Cache les options mineures et/ou instables." 12 | }, 13 | "DedServ": { 14 | "Selected": "(selectioné)", 15 | "ShowHidden": "h : Montre les options cachées", 16 | "Import": "i : Importe les options", 17 | "Validate": "y : Valider", 18 | "InvalidId": "Nombre invalide", 19 | "InvalidImport": "Import invalide", 20 | "InvalidInput": "Commande invalide" 21 | }, 22 | "Warning": "Attention", 23 | "CustomSize": "Choisir la taille", 24 | "Abort": "Avorter", 25 | "NoOptions": "Monde sans options", 26 | "CopySettings": "Copier les options", 27 | "OptionButton": "Choisissez vos options pour générer le monde", 28 | "DownLevel": "Modifiez quelles parties de cette option vont être utilisées", 29 | "CustomSizedWorld": "{0}x{1}" 30 | } -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2021 Gaelyte 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /Tool/Localization/ru-RU/ui.hjson: -------------------------------------------------------------------------------- 1 | { 2 | "Import": "Импортировать из буфера обмена", 3 | "Export": "Экспортировать в буфер обмена", 4 | "NoneSelected": { 5 | "Description": "Выберите опции создания мира." 6 | }, 7 | "ShowHidden": { 8 | "Description": "Показывать минорные и/или нестабильные опции." 9 | }, 10 | "HideHidden": { 11 | "Description": "Скрывать минорные и/или нестабильные опции." 12 | }, 13 | "DedServ": { 14 | "Selected": "(выбрано)", 15 | "ShowHidden": "h : Показывать скрытые опции", 16 | "Import": "i : Импорт опций", 17 | "Validate": "y : Проверить правильность", 18 | "InvalidId": "Неправильное число", 19 | "InvalidImport": "Неверный импорт", 20 | "InvalidInput": "Ввод не распознан" 21 | }, 22 | "Warning": "Внимание", 23 | "CustomSize": "Кастомный размер", 24 | "Abort": "Отмена", 25 | "NoOptions": "Мир без опций", 26 | "CopySettings": "Скопировать настройки", 27 | "OptionButton": "Выберите настройки генерации мира", 28 | "DownLevel": "Настройка опций сида", 29 | "CustomSizedWorld": "{0}x{1}", 30 | "UI": { 31 | "Config": "Сброс к настройкам мира Terraria" 32 | } 33 | } -------------------------------------------------------------------------------- /UI/InputUI/List/EnumInputListBox.cs: -------------------------------------------------------------------------------- 1 | namespace AdvancedWorldGen.UI.InputUI.List; 2 | 3 | public class EnumInputListBox : InputBox where T : struct, Enum 4 | { 5 | private readonly JValue? JValue; 6 | 7 | public EnumInputListBox(JValue jValue, string? localizationPath) : base(jValue.Path, localizationPath) 8 | { 9 | JValue = jValue; 10 | 11 | CreateUIElement(); 12 | } 13 | 14 | public EnumInputListBox(string name, string? localizationPath) : base(name, localizationPath) 15 | { 16 | CreateUIElement(); 17 | } 18 | 19 | public override string? Value 20 | { 21 | get 22 | { 23 | if (JValue != null) 24 | return (string?)JValue.Value; 25 | return Enum.GetName((T)Params.Get(Name)); 26 | } 27 | set 28 | { 29 | if (JValue != null) 30 | JValue.Value = value; 31 | else 32 | Params.Set(Name, Enum.Parse(value!)); 33 | } 34 | } 35 | 36 | public override void CreateUIElement() 37 | { 38 | base.CreateUIElement(); 39 | 40 | Array enumValues = Enum.GetValues(typeof(T)); 41 | ValuesList valuesList = new(this, enumValues) 42 | { 43 | VAlign = 0.5f, 44 | HAlign = 1f 45 | }; 46 | Background.Append(valuesList); 47 | } 48 | } -------------------------------------------------------------------------------- /Helper/JsonRange.cs: -------------------------------------------------------------------------------- 1 | namespace AdvancedWorldGen.Helper; 2 | 3 | public class JsonRange 4 | { 5 | public enum ScalingMode 6 | { 7 | None, 8 | WorldArea, 9 | WorldWidth, 10 | WorldHeight 11 | } 12 | 13 | [JsonProperty("Max")] public readonly double Maximum; 14 | 15 | [JsonProperty("Min")] public readonly double Minimum; 16 | 17 | [JsonProperty] [JsonConverter(typeof(StringEnumConverter))] 18 | public readonly ScalingMode ScaleWith; 19 | 20 | public JsonRange(int minimum, int maximum) 21 | { 22 | Minimum = minimum; 23 | Maximum = maximum; 24 | } 25 | 26 | public double ScaledMinimum => ScaleValue(Minimum); 27 | 28 | public double ScaledMaximum => ScaleValue(Maximum); 29 | 30 | public double GetRandom(UnifiedRandom random) 31 | { 32 | return random.Next(ScaledMinimum, ScaledMaximum + 1); 33 | } 34 | 35 | private double ScaleValue(double value) 36 | { 37 | double num = ScaleWith switch 38 | { 39 | ScalingMode.WorldArea => Main.maxTilesX * Main.maxTilesY / (4200.0 * 1200.0), 40 | ScalingMode.WorldWidth => Main.maxTilesX / 4200.0, 41 | ScalingMode.WorldHeight => Main.maxTilesY / 1200.0, 42 | _ => 1.0 43 | }; 44 | 45 | return num * value; 46 | } 47 | } -------------------------------------------------------------------------------- /SpecialOptions/100kSpecial/Entities/BoC/BoCHead.cs: -------------------------------------------------------------------------------- 1 | namespace AdvancedWorldGen.SpecialOptions._100kSpecial.Entities.BoC; 2 | 3 | public class BoCHead : GlobalNPC 4 | { 5 | 6 | public override bool AppliesToEntity(NPC entity, bool lateInstantiation) 7 | { 8 | return entity.type is NPCID.BrainofCthulhu; 9 | } 10 | 11 | public override void SetDefaults(NPC entity) 12 | { 13 | if (_100kWorld.Enabled) 14 | { 15 | entity.aiStyle = NPCAIStyleID.Worm; 16 | } 17 | } 18 | 19 | public override bool PreAI(NPC npc) 20 | { 21 | if (!_100kWorld.Enabled) 22 | return true; 23 | if (Main.netMode != NetmodeID.MultiplayerClient && npc.ai[0] == 0) 24 | { 25 | npc.ai[2] = NPC.GetBrainOfCthuluCreepersCount(); 26 | npc.ai[0] = NPC.NewNPC(new EntitySource_BossSpawn(npc), (int)(npc.position.X + npc.width / 2f), 27 | (int)(npc.position.Y + npc.height), NPCID.Creeper, npc.whoAmI); 28 | Main.npc[(int)npc.ai[0]].ai[1] = npc.whoAmI; 29 | Main.npc[(int)npc.ai[0]].ai[2] = npc.ai[2] - 1f; 30 | npc.netUpdate = true; 31 | } 32 | 33 | if (!Main.npc[(int)npc.ai[0]].active) 34 | { 35 | npc.life = 0; 36 | npc.checkDead(); 37 | npc.active = false; 38 | } 39 | 40 | return true; 41 | } 42 | } -------------------------------------------------------------------------------- /ModHooks/WorldGenPreviewer.cs: -------------------------------------------------------------------------------- 1 | namespace AdvancedWorldGen.ModHooks; 2 | 3 | public class WorldGenPreviewer : ModSystem 4 | { 5 | private Hook? Hook; 6 | 7 | public override void Load() 8 | { 9 | if (ModLoader.TryGetMod("WorldGenPreviewer", out Mod mod) && 10 | mod.TryGetMethod("WorldGenPreviewer.UIWorldLoadSpecial", "CancelClick", 11 | BindingFlags.NonPublic | BindingFlags.Instance, out MethodInfo? methodInfo)) 12 | Hook = new Hook(methodInfo, CancelClick); 13 | } 14 | 15 | public override void Unload() 16 | { 17 | Hook?.Dispose(); 18 | } 19 | 20 | private static void Unpause() 21 | { 22 | Mod mod = ModLoader.GetMod("WorldGenPreviewer"); 23 | Assembly assembly = mod.GetType().Assembly; 24 | Type type = assembly.GetType("WorldGenPreviewer.WorldGenPreviewerModWorld")!; 25 | FieldInfo fieldInfo = type.GetField("continueWorldGen", BindingFlags.NonPublic | BindingFlags.Static)!; 26 | fieldInfo.SetValue(null, true); 27 | } 28 | 29 | private static void CancelClick(Action action, object self, UIMouseEvent evt, 30 | UIElement listeningElement) 31 | { 32 | Unpause(); 33 | AdvancedWorldGenMod.Instance.UIChanger.Abort(evt, listeningElement); 34 | } 35 | } -------------------------------------------------------------------------------- /Tool/Localization/zh-Hans/base.hjson: -------------------------------------------------------------------------------- 1 | { 2 | "Exceptions": { 3 | "RockUnderHell": "世界不够高!" 4 | }, 5 | "Config": { 6 | "FasterWorldgen": { 7 | "Label": "大修世界", 8 | "Tooltip": "调整世界,使其生成更快,更适应自定义大小的世界。." 9 | }, 10 | "SaveOnFail": { 11 | "Label": "保存生成失败或被中止的世界", 12 | "Tooltip": "如果世界生成失败或被中止,无论如何都要保存它" 13 | }, 14 | "ZenithEnabler": { 15 | "Label": "启用天顶世界时启用其他选项", 16 | "Tooltip": "启用天顶世界时,启用醉酒世界,永恒领域(饥荒联动),FTW世界,没有陷阱和Remix选项。" 17 | }, 18 | "VanillaWeight": { 19 | "Label": "较不准确的世界时间预测", 20 | "Tooltip": "启用它可以更快地调试你的MOD,除此之外启用它没有多大意义。" 21 | } 22 | }, 23 | "WorldGenMessage": { 24 | "Evil": "全邪恶", 25 | "Random": "随机化图块", 26 | "SnowReplace": "让世界变得更酷。" 27 | }, 28 | "InvalidSizes": { 29 | "TooBigFromRAM": "对于这台计算机来说,大小为{0} x {1}的世界太大了。", 30 | "OverhauledMinX": "已知在 x={0} 下无法生成。", 31 | "OverhauledMinY": "已知在 y={0} 下无法生成。", 32 | "NormalMinX": "您需要在mod设置中启用修改后的世界,以便能够生成 x={0} 下的世界。", 33 | "ComfortNormalMaxX": "世界将缓慢生成一个大的世界,你应该在mod设置中启用修改后的世界。", 34 | "NormalMaxX": "如果你试图生成一个这么大的世界,世界会崩溃,你必须在mod设置中启用大修世界来生成这样的世界。", 35 | "ClamityMinX": "灾厄并不是为了创造小世界而设计的", 36 | "ClamityMaxX": "灾厄并不是为了生成XL世界而设计的" 37 | }, 38 | } 39 | -------------------------------------------------------------------------------- /UI/InputUI/InputBox.cs: -------------------------------------------------------------------------------- 1 | namespace AdvancedWorldGen.UI.InputUI; 2 | 3 | public abstract class InputBox : OrderedUIItem 4 | { 5 | private readonly string? LocalizationPath; 6 | public UIPanel Background = null!; 7 | public string Name; 8 | 9 | protected InputBox(string name, string? localizationPath) 10 | { 11 | Name = name; 12 | LocalizationPath = localizationPath; 13 | } 14 | 15 | public abstract T? Value { get; set; } 16 | 17 | public virtual void CreateUIElement() 18 | { 19 | Height = new StyleDimension 20 | { 21 | Pixels = 40 22 | }; 23 | Width = new StyleDimension 24 | { 25 | Percent = 1f 26 | }; 27 | 28 | Background = new UIPanel 29 | { 30 | Height = 31 | { 32 | Percent = 1f 33 | }, 34 | Width = 35 | { 36 | Percent = 1f 37 | } 38 | }; 39 | Append(Background); 40 | 41 | string localization = Name; 42 | if (LocalizationPath is not null) 43 | { 44 | localization = $"{LocalizationPath}.{Name}"; 45 | localization = localization.Replace(' ', '_'); 46 | if (!Language.Exists(localization)) localization = Name; 47 | } 48 | 49 | UIText title = new(Language.GetText(localization)) 50 | { 51 | VAlign = 0.5f 52 | }; 53 | Background.Append(title); 54 | } 55 | } -------------------------------------------------------------------------------- /BetterVanillaWorldGen/DungeonStuff/DungeonPass.Pass.cs: -------------------------------------------------------------------------------- 1 | namespace AdvancedWorldGen.BetterVanillaWorldGen.DungeonStuff; 2 | 3 | public partial class DungeonPass : ControlledWorldGenPass 4 | { 5 | public DungeonPass() : base("Dungeon", 477.1963f) 6 | { 7 | } 8 | 9 | protected override void ApplyPass() 10 | { 11 | Progress.Message = Language.GetTextValue("LegacyWorldGen.58"); 12 | int dungeonX = GenVars.dungeonLocation; 13 | int dungeonY; 14 | bool solidGround = false; 15 | if (WorldGen.drunkWorldGen) 16 | { 17 | dungeonY = (int)Main.worldSurface + 70 * Main.maxTilesY / 1200; 18 | } 19 | else 20 | { 21 | dungeonY = (int)((Main.worldSurface + Main.rockLayer) / 2.0) + 22 | WorldGen.genRand.Next(-200, 200) * Main.maxTilesY / 1200; 23 | for (int num665 = 0; num665 < 10; num665++) 24 | if (WorldGen.SolidTile(dungeonX, dungeonY + num665)) 25 | { 26 | solidGround = true; 27 | break; 28 | } 29 | 30 | if (!solidGround) 31 | { 32 | int minX = (int)((Main.worldSurface + Main.rockLayer) / 2.0) + 200; 33 | for (; dungeonY < minX && !WorldGen.SolidTile(dungeonX, dungeonY + 10); dungeonY++) 34 | { 35 | } 36 | } 37 | } 38 | 39 | 40 | MakeDungeon(dungeonX, dungeonY); 41 | } 42 | } -------------------------------------------------------------------------------- /Tool/Localization/ru-RU/base.hjson: -------------------------------------------------------------------------------- 1 | { 2 | "Exceptions": { 3 | "RockUnderHell": "Недостаточная высота мира!" 4 | }, 5 | "Config": { 6 | "FasterWorldgen": { 7 | "Label": "Улучшенная генерация", 8 | "Tooltip": "Ускоряет генерацию и адаптирует её к кастомным размерам миров.\nТребуется для генерации миров размером меньше 4200 x ... ." 9 | }, 10 | "SaveOnFail": { 11 | "Label": "Сохранение при ошибке генерации", 12 | "Tooltip": "Если генерация была отменена или мир не смог сгенерироваться, он всеравно будет сохранён." 13 | } 14 | }, 15 | "WorldGenMessage": { 16 | "Evil": "Добавление нечисти", 17 | "Random": "Блоки становятся более случайными", 18 | "SnowReplace": "Охлаждение мира" 19 | }, 20 | "InvalidSizes": { 21 | "TooBigFromRAM": "Обьёма оперативной памяти недостаточно для мира размером {0} x {1}.", 22 | "OverhauledMinX": "Мир не будет генерироваться при X меньше {0}.", 23 | "OverhauledMinY": "Мир не будет генерироваться при Y меньше {0}.", 24 | "NormalMinX": "Необходимо включить улучшенную генерацию в настройках мода для генерации мира меньше x={0}.", 25 | "ComfortNormalMaxX": "Большой мир будет генерироваться долго,\nвозможно следует включть улучшенную генерацию в настройках мода." 26 | } 27 | } -------------------------------------------------------------------------------- /Base/OptionHelper.Utils.cs: -------------------------------------------------------------------------------- 1 | namespace AdvancedWorldGen.Base; 2 | 3 | public partial class OptionHelper 4 | { 5 | public static void ClearAll() 6 | { 7 | foreach ((string? _, Option? option) in OptionDict) option.Disable(); 8 | } 9 | 10 | public static void Import(IEnumerable optionNames) 11 | { 12 | ClearAll(); 13 | foreach (string optionName in optionNames) 14 | if (OptionDict.TryGetValue(optionName, out Option? option)) 15 | option.Enable(); 16 | } 17 | 18 | public static List Export() 19 | { 20 | List list = new(); 21 | foreach ((string? _, Option? option) in OptionDict) 22 | if (option.Enabled is true && option.Children.Count == 0) 23 | list.Add(option.FullName); 24 | return list; 25 | } 26 | 27 | public static bool OptionsContains(string optionName) 28 | { 29 | if (!OptionDict.TryGetValue(optionName, out Option? option)) 30 | return false; 31 | return option.Children.Count == 0 ? option.Enabled is true : option.Children[0].Enabled is true; 32 | } 33 | 34 | public static IEnumerable