├── .config └── dotnet-tools.json ├── .editorconfig ├── .gitattributes ├── .gitignore ├── ConsoleAdventure.sln ├── ConsoleAdventure ├── .config │ └── dotnet-tools.json ├── CaModLoader.cs ├── CaModLoaderAPI │ ├── EmptyMod.cs │ ├── GlobalItem.cs │ ├── GlobalPlayer.cs │ ├── IMod.cs │ ├── Main.cs │ ├── Mod.cs │ ├── ModItem.cs │ └── ModTags.cs ├── ColorAssets.cs ├── ConsoleAdventure.cs ├── ConsoleAdventure.csproj ├── ConsoleAdventure.csproj.DEBUG ├── Content │ ├── AudioFiles │ │ └── Music │ │ │ ├── ItsMagicRain.mp3 │ │ │ ├── StrangeWorld.mp3 │ │ │ └── WorldInsideOut.mp3 │ ├── Content.mgcb │ ├── Fonts │ │ └── font.spritefont │ ├── Localization │ │ ├── en.json │ │ └── ru.json │ ├── Scripts │ │ ├── Abstracts │ │ │ ├── PathFinder.cs │ │ │ ├── Position.cs │ │ │ ├── Rotation.cs │ │ │ └── Time.cs │ │ ├── Audio │ │ │ ├── MusicEngine.cs │ │ │ ├── SoundEngine.cs │ │ │ └── Wave.cs │ │ ├── Buffs │ │ │ ├── Buff.cs │ │ │ └── InTheFlames.cs │ │ ├── CharTexture.cs │ │ ├── Debug │ │ │ └── Commands │ │ │ │ ├── ChunkCommand.cs │ │ │ │ ├── Command.cs │ │ │ │ ├── ExploreWorld.cs │ │ │ │ ├── GetItem.cs │ │ │ │ ├── GodMod.cs │ │ │ │ ├── HackLight.cs │ │ │ │ ├── Help.cs │ │ │ │ ├── PlaceTextMark.cs │ │ │ │ ├── PlaceTrees.cs │ │ │ │ ├── SetTime.cs │ │ │ │ ├── ShowTypes.cs │ │ │ │ └── TeleportPlayer.cs │ │ ├── Display.cs │ │ ├── Entities │ │ │ ├── Bomb.cs │ │ │ ├── Cat.cs │ │ │ ├── Entity.cs │ │ │ ├── EntityColor.cs │ │ │ ├── Explosion.cs │ │ │ ├── Fire.cs │ │ │ ├── HighTemperatureFire.cs │ │ │ ├── Leaves.cs │ │ │ └── StateMachine │ │ │ │ ├── IState.cs │ │ │ │ ├── StateMachine.cs │ │ │ │ ├── States │ │ │ │ ├── IdleState.cs │ │ │ │ └── MovingState.cs │ │ │ │ └── StatesEnum.cs │ │ ├── FormatString.cs │ │ ├── FrameSystem.cs │ │ ├── IO │ │ │ ├── SerializeData.cs │ │ │ ├── Tags.cs │ │ │ └── WorldIO.cs │ │ ├── InputLogic │ │ │ ├── Input.cs │ │ │ ├── InputConfig.cs │ │ │ └── TextInput.cs │ │ ├── Items │ │ │ ├── Inventory │ │ │ │ ├── Inventory.cs │ │ │ │ ├── ItemType.cs │ │ │ │ └── Stack.cs │ │ │ ├── Item.cs │ │ │ ├── Loot.cs │ │ │ ├── Recipe.cs │ │ │ ├── Storage.cs │ │ │ └── content │ │ │ │ ├── food │ │ │ │ ├── Apple.cs │ │ │ │ ├── Food.cs │ │ │ │ └── FoodItem.cs │ │ │ │ ├── furniture │ │ │ │ ├── AlfisolFloorItem.cs │ │ │ │ ├── AnvilItem.cs │ │ │ │ ├── BlackSoilIFloortem.cs │ │ │ │ ├── BrokenLogItem.cs │ │ │ │ ├── ChestItem.cs │ │ │ │ ├── DoorItem.cs │ │ │ │ ├── FloorItem.cs │ │ │ │ ├── FurnaceItem.cs │ │ │ │ ├── GraniteFloorItem.cs │ │ │ │ ├── GraniteWallItem.cs │ │ │ │ ├── PlaceableItem.cs │ │ │ │ ├── RuineItem.cs │ │ │ │ ├── SandFloorItem.cs │ │ │ │ ├── TorchItem.cs │ │ │ │ ├── WallItem.cs │ │ │ │ ├── WoodFloorItem.cs │ │ │ │ └── WorkbenchItem.cs │ │ │ │ ├── materials │ │ │ │ ├── AlfisolItem.cs │ │ │ │ ├── BiotiteItem.cs │ │ │ │ ├── BlackSoilItem.cs │ │ │ │ ├── BrownIronOreItem.cs │ │ │ │ ├── GraniteItem.cs │ │ │ │ ├── IronBar.cs │ │ │ │ ├── Log.cs │ │ │ │ ├── QuartzItem.cs │ │ │ │ ├── RubyItem.cs │ │ │ │ ├── SaltItem.cs │ │ │ │ ├── StoneItem.cs │ │ │ │ ├── TreeSeed.cs │ │ │ │ ├── WebItem.cs │ │ │ │ └── ZoisiteItem.cs │ │ │ │ ├── tools │ │ │ │ ├── BombItem.cs │ │ │ │ ├── IronHammer.cs │ │ │ │ └── IronPick.cs │ │ │ │ └── weapons │ │ │ │ └── IronSword.cs │ │ ├── Language.cs │ │ ├── Light.cs │ │ ├── Localization.cs │ │ ├── Map.cs │ │ ├── MapChunk.cs │ │ ├── OpenSimplex.cs │ │ ├── PerlinNoise.cs │ │ ├── Player │ │ │ ├── Cursor.cs │ │ │ ├── Player.cs │ │ │ ├── PlayerInfo.cs │ │ │ └── PlayerMovement.cs │ │ ├── Settings │ │ │ ├── Docs.cs │ │ │ ├── ExceptionLogger.cs │ │ │ ├── Loger.cs │ │ │ └── MessageType.cs │ │ ├── SettingsSystem.cs │ │ ├── SineNoise.cs │ │ ├── Transform.cs │ │ ├── UI │ │ │ ├── Bar.cs │ │ │ ├── BaseUI.cs │ │ │ ├── CharPaintUtil │ │ │ │ └── CharPaint.cs │ │ │ ├── ChestUI.cs │ │ │ ├── InfoPanel.cs │ │ │ ├── ListUI.cs │ │ │ ├── Menu │ │ │ │ ├── ControlConfig.cs │ │ │ │ ├── KeyPanel.cs │ │ │ │ ├── Menu.cs │ │ │ │ ├── MenuButton.cs │ │ │ │ ├── MenuState.cs │ │ │ │ └── ModList.cs │ │ │ ├── ModPanel.cs │ │ │ ├── OnlineModPanel.cs │ │ │ ├── ProgressBar.cs │ │ │ ├── RecipesUI.cs │ │ │ ├── TextInputField.cs │ │ │ ├── TextListUI.cs │ │ │ └── WorldPanel.cs │ │ ├── Utils.cs │ │ └── WorldEngine │ │ │ ├── Biomes │ │ │ └── Biome.cs │ │ │ ├── Chunk.cs │ │ │ ├── Events │ │ │ ├── GameEvent.cs │ │ │ └── Rain.cs │ │ │ ├── Field.cs │ │ │ ├── Generate │ │ │ ├── EmptyGenerator.cs │ │ │ ├── Generator.cs │ │ │ ├── LandspaceGenerator.cs │ │ │ ├── Properties │ │ │ │ └── NoisesProperties.cs │ │ │ ├── Structures │ │ │ │ ├── House.cs │ │ │ │ ├── Structure.cs │ │ │ │ ├── StructureMap.cs │ │ │ │ └── Treasury.cs │ │ │ ├── WorldGenUtils.cs │ │ │ └── WorldPropertiesGenerator.cs │ │ │ ├── IWorldObject.cs │ │ │ ├── Levels │ │ │ ├── Cavern.cs │ │ │ ├── LavaCavern.cs │ │ │ ├── Sedimentary.cs │ │ │ ├── Surface.cs │ │ │ └── UnloadWorldLevel.cs │ │ │ ├── LoadedChunk.cs │ │ │ ├── NoiseBuffer.cs │ │ │ ├── Objects │ │ │ ├── BrokenLog.cs │ │ │ ├── Buildings │ │ │ │ ├── Anvil.cs │ │ │ │ ├── Chest.cs │ │ │ │ ├── Climb.cs │ │ │ │ ├── Descent.cs │ │ │ │ ├── Door.cs │ │ │ │ ├── Floor.cs │ │ │ │ ├── Furnace.cs │ │ │ │ ├── Torch.cs │ │ │ │ └── Workbench.cs │ │ │ ├── Charcoal.cs │ │ │ ├── Floors │ │ │ │ ├── CharcoalFloor.cs │ │ │ │ ├── GraniteFloor.cs │ │ │ │ └── WoodFloor.cs │ │ │ ├── GraniteWall.cs │ │ │ ├── Grass.cs │ │ │ ├── Plank.cs │ │ │ ├── Rocks │ │ │ │ ├── Biotite.cs │ │ │ │ ├── Granite.cs │ │ │ │ ├── Ores │ │ │ │ │ ├── BrownIronOre.cs │ │ │ │ │ └── Ruby.cs │ │ │ │ ├── Quartz.cs │ │ │ │ ├── Salt.cs │ │ │ │ ├── Soils │ │ │ │ │ ├── Alfisol.cs │ │ │ │ │ ├── AlfisolFloor.cs │ │ │ │ │ ├── BlackSoil.cs │ │ │ │ │ ├── BlackSoilFloor.cs │ │ │ │ │ └── SandFloor.cs │ │ │ │ ├── Stone.cs │ │ │ │ └── Zoisite.cs │ │ │ ├── Ruine.cs │ │ │ ├── Seedling.cs │ │ │ ├── Stalactite.cs │ │ │ ├── TextMark.cs │ │ │ ├── Trees │ │ │ │ ├── AppleTree.cs │ │ │ │ ├── PineTree.cs │ │ │ │ ├── SpruceTree.cs │ │ │ │ └── Tree.cs │ │ │ ├── UnloadedTransform.cs │ │ │ ├── Wall.cs │ │ │ ├── Water.cs │ │ │ └── Web.cs │ │ │ ├── Observer.cs │ │ │ ├── RenderFieldType.cs │ │ │ ├── Renderer.cs │ │ │ ├── SpawnCondition.cs │ │ │ ├── Spawner.cs │ │ │ ├── StringPaint.cs │ │ │ ├── UnloadedChunk.cs │ │ │ ├── VanillaTransforms.cs │ │ │ ├── World.cs │ │ │ ├── WorldLevel.cs │ │ │ └── WorldLevelsSystem.cs │ └── logoAnim.png ├── FontEditor.cs ├── Icon.ico ├── ModCreator.cs ├── NetworkManager.cs ├── Networks │ ├── ClientObject.cs │ ├── NetPacket.cs │ └── Server.cs ├── Program.cs ├── TextAssets.cs └── app.manifest └── README.md /.config/dotnet-tools.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": 1, 3 | "isRoot": true, 4 | "tools": {} 5 | } -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | [*.cs] 2 | 3 | # CS1591: Отсутствует комментарий XML для открытого видимого типа или члена 4 | dotnet_diagnostic.CS1591.severity = none 5 | -------------------------------------------------------------------------------- /ConsoleAdventure.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio Version 17 4 | VisualStudioVersion = 17.8.34511.84 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ConsoleAdventure", "ConsoleAdventure\ConsoleAdventure.csproj", "{A8BD34AF-63A0-4C87-BAFC-E9A40014C2A6}" 7 | EndProject 8 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{F3F9FF8B-E0AC-414E-A1EC-F211502E6521}" 9 | ProjectSection(SolutionItems) = preProject 10 | .editorconfig = .editorconfig 11 | EndProjectSection 12 | EndProject 13 | Global 14 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 15 | Debug|Any CPU = Debug|Any CPU 16 | Release|Any CPU = Release|Any CPU 17 | EndGlobalSection 18 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 19 | {A8BD34AF-63A0-4C87-BAFC-E9A40014C2A6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 20 | {A8BD34AF-63A0-4C87-BAFC-E9A40014C2A6}.Debug|Any CPU.Build.0 = Debug|Any CPU 21 | {A8BD34AF-63A0-4C87-BAFC-E9A40014C2A6}.Release|Any CPU.ActiveCfg = Release|Any CPU 22 | {A8BD34AF-63A0-4C87-BAFC-E9A40014C2A6}.Release|Any CPU.Build.0 = Release|Any CPU 23 | EndGlobalSection 24 | GlobalSection(SolutionProperties) = preSolution 25 | HideSolutionNode = FALSE 26 | EndGlobalSection 27 | GlobalSection(ExtensibilityGlobals) = postSolution 28 | SolutionGuid = {2D46C511-5E79-4713-B3D8-8FBF266EDB2D} 29 | EndGlobalSection 30 | EndGlobal 31 | -------------------------------------------------------------------------------- /ConsoleAdventure/.config/dotnet-tools.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": 1, 3 | "isRoot": true, 4 | "tools": { 5 | "dotnet-mgcb": { 6 | "version": "3.8.1.303", 7 | "commands": [ 8 | "mgcb" 9 | ] 10 | }, 11 | "dotnet-mgcb-editor": { 12 | "version": "3.8.1.303", 13 | "commands": [ 14 | "mgcb-editor" 15 | ] 16 | }, 17 | "dotnet-mgcb-editor-linux": { 18 | "version": "3.8.1.303", 19 | "commands": [ 20 | "mgcb-editor-linux" 21 | ] 22 | }, 23 | "dotnet-mgcb-editor-windows": { 24 | "version": "3.8.1.303", 25 | "commands": [ 26 | "mgcb-editor-windows" 27 | ] 28 | }, 29 | "dotnet-mgcb-editor-mac": { 30 | "version": "3.8.1.303", 31 | "commands": [ 32 | "mgcb-editor-mac" 33 | ] 34 | } 35 | } 36 | } -------------------------------------------------------------------------------- /ConsoleAdventure/CaModLoaderAPI/EmptyMod.cs: -------------------------------------------------------------------------------- 1 | using ConsoleAdventure.Content.Scripts; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | 8 | namespace ConsoleAdventure.CaModLoaderAPI 9 | { 10 | internal class EmptyMod : IMod 11 | { 12 | /// 13 | /// Название папки мода 14 | /// 15 | public string dirName { get; set; } 16 | 17 | /// 18 | /// Название мода 19 | /// 20 | public string modName { get; set; } = "undefined"; 21 | 22 | /// 23 | /// Версия мода 24 | /// 25 | public string modVersion { get; set; } = "1.0.0"; 26 | 27 | /// 28 | /// Описание мода 29 | /// 30 | public string modDescription { get; set; } = "No description"; 31 | 32 | /// 33 | /// Автор мода 34 | /// 35 | public string modAuthor { get; set; } = "Anonymous"; 36 | 37 | /// 38 | /// Иконка мода 39 | /// 40 | public CharTexture modIcon { get; set; } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /ConsoleAdventure/CaModLoaderAPI/GlobalItem.cs: -------------------------------------------------------------------------------- 1 | using ConsoleAdventure.Content.Scripts.Player; 2 | 3 | namespace ConsoleAdventure.CaModLoaderAPI 4 | { 5 | public abstract class GlobalItem 6 | { 7 | public virtual string GetDescription(Item item) 8 | { 9 | return null; 10 | } 11 | 12 | public virtual bool? CanBePickedUp(Item item, Player player) 13 | { 14 | return null; 15 | } 16 | 17 | public virtual Recipe EditRecipes(Item item) 18 | { 19 | return null; 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /ConsoleAdventure/CaModLoaderAPI/GlobalPlayer.cs: -------------------------------------------------------------------------------- 1 | using ConsoleAdventure.Content.Scripts.Player; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | 8 | namespace ConsoleAdventure.CaModLoaderAPI 9 | { 10 | public class GlobalPlayer 11 | { 12 | public virtual bool OnTheScreen(Player player) 13 | { 14 | return true; 15 | } 16 | 17 | public virtual bool CraftItem(Player player, Recipe recipe) 18 | { 19 | return true; 20 | } 21 | 22 | public virtual bool? CanBuildAt(Player player, Position pos, int layer) 23 | { 24 | return null; 25 | } 26 | 27 | public virtual bool? CanDestroyAt(Player player, Position pos, int layer) 28 | { 29 | return null; 30 | } 31 | 32 | public virtual void PostInteractWithWorld(Player player) 33 | { 34 | 35 | } 36 | 37 | public virtual List SetStartItems(List startInventory) 38 | { 39 | return null; 40 | } 41 | 42 | public virtual void PostConnect(Player player) 43 | { 44 | 45 | } 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /ConsoleAdventure/CaModLoaderAPI/IMod.cs: -------------------------------------------------------------------------------- 1 | using ConsoleAdventure.Content.Scripts; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | 8 | namespace ConsoleAdventure.CaModLoaderAPI 9 | { 10 | public interface IMod 11 | { 12 | /// 13 | /// Название папки мода 14 | /// 15 | public string dirName { get; set; } 16 | 17 | /// 18 | /// Название мода 19 | /// 20 | public string modName { get; set; } 21 | 22 | /// 23 | /// Версия мода 24 | /// 25 | public string modVersion { get; set; } 26 | 27 | /// 28 | /// Описание мода 29 | /// 30 | public string modDescription { get; set; } 31 | 32 | /// 33 | /// Автор мода 34 | /// 35 | public string modAuthor { get; set; } 36 | 37 | /// 38 | /// Иконка мода 39 | /// 40 | public CharTexture modIcon { get; set; } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /ConsoleAdventure/CaModLoaderAPI/ModItem.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace ConsoleAdventure.CaModLoaderAPI 4 | { 5 | [Serializable] 6 | public abstract class ModItem : Item 7 | { 8 | public virtual void Init() 9 | { 10 | name = "ModItem Name missing"; 11 | description = "ModItem Description missing"; 12 | } 13 | 14 | public ModItem() { 15 | Init(); 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /ConsoleAdventure/CaModLoaderAPI/ModTags.cs: -------------------------------------------------------------------------------- 1 | using ConsoleAdventure.Content.Scripts.IO; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | 8 | namespace ConsoleAdventure.CaModLoaderAPI 9 | { 10 | public class ModTags 11 | { 12 | string modName; 13 | 14 | Tags tags; 15 | 16 | public ModTags(Tags tags, string modName) 17 | { 18 | this.modName = modName; 19 | this.tags = tags; 20 | } 21 | 22 | public object this[string key] 23 | { 24 | get 25 | { 26 | return tags[modName + "." + key]; 27 | } 28 | set 29 | { 30 | tags[modName + "." + key] = value; 31 | } 32 | } 33 | 34 | public T SafelyGet(string key) 35 | { 36 | return tags.SafelyGet(modName + "." + key); 37 | } 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /ConsoleAdventure/ColorAssets.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Xna.Framework; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | 8 | namespace ConsoleAdventure 9 | { 10 | public class ColorAssets 11 | { 12 | public static readonly Color woodenColor = new Color(94, 61, 38); 13 | public static readonly Color graniteColor = new Color(45, 45, 45); 14 | public static readonly Color theLionColor = new Color(140, 102, 81); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /ConsoleAdventure/ConsoleAdventure.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | Exe 4 | net6.0-windows 5 | 6 | Major 7 | false 8 | false 9 | true 10 | bin\Debug\net6.0-windows\ConsoleAdventure.xml 11 | 12 | 13 | 14 | true 15 | app.manifest 16 | Icon.ico 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | Always 25 | 26 | 27 | Always 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | -------------------------------------------------------------------------------- /ConsoleAdventure/ConsoleAdventure.csproj.DEBUG: -------------------------------------------------------------------------------- 1 | 2 | 3 | Exe 4 | net6.0-windows 5 | 6 | Major 7 | false 8 | false 9 | 10 | 11 | 12 | true 13 | app.manifest 14 | Icon.ico 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | Always 23 | 24 | 25 | Always 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | -------------------------------------------------------------------------------- /ConsoleAdventure/Content/AudioFiles/Music/ItsMagicRain.mp3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AbdSayen/ConsoleAdventure/eefe459dbb5f531d66e530e0d5a9319808e1a20e/ConsoleAdventure/Content/AudioFiles/Music/ItsMagicRain.mp3 -------------------------------------------------------------------------------- /ConsoleAdventure/Content/AudioFiles/Music/StrangeWorld.mp3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AbdSayen/ConsoleAdventure/eefe459dbb5f531d66e530e0d5a9319808e1a20e/ConsoleAdventure/Content/AudioFiles/Music/StrangeWorld.mp3 -------------------------------------------------------------------------------- /ConsoleAdventure/Content/AudioFiles/Music/WorldInsideOut.mp3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AbdSayen/ConsoleAdventure/eefe459dbb5f531d66e530e0d5a9319808e1a20e/ConsoleAdventure/Content/AudioFiles/Music/WorldInsideOut.mp3 -------------------------------------------------------------------------------- /ConsoleAdventure/Content/Content.mgcb: -------------------------------------------------------------------------------- 1 | 2 | #----------------------------- Global Properties ----------------------------# 3 | 4 | /outputDir:bin/$(Platform) 5 | /intermediateDir:obj/$(Platform) 6 | /platform:Windows 7 | /config: 8 | /profile:Reach 9 | /compress:False 10 | 11 | #-------------------------------- References --------------------------------# 12 | 13 | 14 | #---------------------------------- Content ---------------------------------# 15 | 16 | #begin AudioFiles/Music/ItsMagicRain.mp3 17 | /importer:Mp3Importer 18 | /processor:SongProcessor 19 | /processorParam:Quality=Best 20 | /build:AudioFiles/Music/ItsMagicRain.mp3 21 | 22 | #begin AudioFiles/Music/StrangeWorld.mp3 23 | /importer:Mp3Importer 24 | /processor:SongProcessor 25 | /processorParam:Quality=Best 26 | /build:AudioFiles/Music/StrangeWorld.mp3 27 | 28 | #begin AudioFiles/Music/WorldInsideOut.mp3 29 | /importer:Mp3Importer 30 | /processor:SongProcessor 31 | /processorParam:Quality=Best 32 | /build:AudioFiles/Music/WorldInsideOut.mp3 33 | 34 | #begin Fonts/font.spritefont 35 | /importer:FontDescriptionImporter 36 | /processor:FontDescriptionProcessor 37 | /processorParam:PremultiplyAlpha=True 38 | /processorParam:TextureFormat=Compressed 39 | /build:Fonts/font.spritefont 40 | 41 | #begin logoAnim.png 42 | /importer:TextureImporter 43 | /processor:TextureProcessor 44 | /processorParam:ColorKeyColor=255,0,255,255 45 | /processorParam:ColorKeyEnabled=True 46 | /processorParam:GenerateMipmaps=False 47 | /processorParam:PremultiplyAlpha=True 48 | /processorParam:ResizeToPowerOfTwo=False 49 | /processorParam:MakeSquare=False 50 | /processorParam:TextureFormat=Color 51 | /build:logoAnim.png 52 | 53 | -------------------------------------------------------------------------------- /ConsoleAdventure/Content/Fonts/font.spritefont: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | Consolas 5 | 12 6 | 0 7 | true 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /ConsoleAdventure/Content/Scripts/Abstracts/Rotation.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace ConsoleAdventure 4 | { 5 | [Serializable] 6 | public enum Rotation 7 | { 8 | up, 9 | upRight, 10 | right, 11 | rightDown, 12 | down, 13 | downLeft, 14 | left, 15 | upLeft 16 | } 17 | } -------------------------------------------------------------------------------- /ConsoleAdventure/Content/Scripts/Abstracts/Time.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Windows.Forms; 3 | 4 | namespace ConsoleAdventure 5 | { 6 | [Serializable] 7 | public class Time 8 | { 9 | public int day { get; private set; } = 1; 10 | public int hour { get; private set; } = 8; 11 | public int minute { get; private set; } 12 | public int second { get; private set; } 13 | 14 | private int multiplier = 1; 15 | 16 | public void PassTime(int secondsPass) 17 | { 18 | second += secondsPass * multiplier; 19 | Stack(); 20 | } 21 | 22 | public string GetTime() 23 | { 24 | return $"{TextAssets.Day + day} {TextAssets.Time} {hour}:{minute.ToString("D2")}"; 25 | } 26 | 27 | private void Stack() 28 | { 29 | while (hour >= 24) 30 | { 31 | day++; 32 | hour -= 24; 33 | } 34 | while (second >= 60) 35 | { 36 | minute++; 37 | second -= 60; 38 | } 39 | while (minute >= 60) 40 | { 41 | hour++; 42 | minute -= 60; 43 | } 44 | } 45 | 46 | public int GetDaySeconds() 47 | { 48 | return ((hour * 3600) + (minute * 60) + second); 49 | } 50 | 51 | public int GetAllSeconds() 52 | { 53 | return (day * 86400) + (hour * 3600) + (minute * 60) + second; 54 | } 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /ConsoleAdventure/Content/Scripts/Buffs/Buff.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using Microsoft.Xna.Framework; 4 | using Microsoft.Xna.Framework.Graphics; 5 | using System.Linq; 6 | using System.Text; 7 | using System.Threading.Tasks; 8 | 9 | namespace ConsoleAdventure.Content.Scripts 10 | { 11 | public class Buff 12 | { 13 | public int time; 14 | public int maxTime; 15 | 16 | public void SetMaxTime(int time) 17 | { 18 | maxTime = time; 19 | this.time = time; 20 | } 21 | 22 | public Buff(int time) 23 | { 24 | SetMaxTime(time); 25 | } 26 | 27 | public virtual void Update(Entity entity) 28 | { 29 | } 30 | 31 | public virtual CharTexture GetTexture() 32 | { 33 | return new CharTexture().AddLayer("B"); 34 | } 35 | 36 | public void Draw(SpriteBatch spriteBatch, Vector2 position) 37 | { 38 | Color color = Color.White * ((float)(time) / (float)(maxTime)); 39 | spriteBatch.DrawFrame(ConsoleAdventure.Font, TextAssets.NormalFrame3x2, position, color); 40 | 41 | GetTexture().Draw(spriteBatch, position + new Vector2(7, 9)); 42 | } 43 | 44 | public virtual string GetName() 45 | { 46 | return Localization.GetTranslation("Buffs", GetType().Name); 47 | } 48 | 49 | public virtual string GetDescription() 50 | { 51 | return Localization.GetTranslation("BuffDescription", GetType().Name); 52 | } 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /ConsoleAdventure/Content/Scripts/Buffs/InTheFlames.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Xna.Framework; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading; 7 | using System.Threading.Tasks; 8 | 9 | namespace ConsoleAdventure.Content.Scripts 10 | { 11 | public class InTheFlames : Buff 12 | { 13 | public InTheFlames(int time) : base(time) 14 | { 15 | } 16 | 17 | float timer = -1; 18 | public override CharTexture GetTexture() 19 | { 20 | timer++; 21 | return new CharTexture() 22 | .AddLayer("●", Color.OrangeRed, new(-0.58f, -0.03f)) 23 | .AddLayer("•", Color.OrangeRed * 0.8f, new Vector2(0.42f + (float)(Math.Sin(timer / 30 * Math.PI) / 2), -2.4f)) 24 | .AddLayer("•", Color.Orange * (float)(1 + Math.Sin(timer / 60 * Math.PI) / 4), new(0.2f, -0.03f)); 25 | } 26 | 27 | public override void Update(Entity entity) 28 | { 29 | if(time % 30 == 0) 30 | { 31 | entity.life -= 1; 32 | } 33 | } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /ConsoleAdventure/Content/Scripts/Debug/Commands/ChunkCommand.cs: -------------------------------------------------------------------------------- 1 | using ConsoleAdventure.WorldEngine; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | 8 | namespace ConsoleAdventure.Content.Scripts.Debug.Commands 9 | { 10 | public class ChunkCommand : Command 11 | { 12 | public ChunkCommand() 13 | { 14 | Name = "chunk"; 15 | Description = "???"; 16 | Arguments = new List() 17 | { 18 | "attribute", 19 | "x", 20 | "y" 21 | }; 22 | } 23 | 24 | public override void Logic(string[] args, short id = -2) 25 | { 26 | string a = GetStringArg(args, "attribute"); 27 | int x = GetIntArg(args, "x"); 28 | int y = GetIntArg(args, "y"); 29 | 30 | try 31 | { 32 | if (a == "load") 33 | { 34 | ConsoleAdventure.world.LoadChunk(x, y, false); 35 | } 36 | 37 | if (a == "unload") 38 | { 39 | ConsoleAdventure.world.UnloadChunk(x, y); 40 | } 41 | } 42 | 43 | catch (Exception) 44 | { 45 | if(a == "a") 46 | { 47 | 48 | } 49 | } 50 | } 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /ConsoleAdventure/Content/Scripts/Debug/Commands/GetItem.cs: -------------------------------------------------------------------------------- 1 | using ConsoleAdventure.Settings; 2 | using ConsoleAdventure.WorldEngine; 3 | using SharpDX.DirectWrite; 4 | using System; 5 | using System.Collections.Generic; 6 | using System.Linq; 7 | using System.Text; 8 | using System.Threading.Tasks; 9 | 10 | namespace ConsoleAdventure.Content.Scripts.Debug.Commands 11 | { 12 | public class GetItem: Command 13 | { 14 | public GetItem() 15 | { 16 | Name = "item"; 17 | Description = "gives the player \nan item"; 18 | Arguments = new List() 19 | { 20 | "name", 21 | "count", 22 | "namespace" 23 | }; 24 | } 25 | 26 | public override void Logic(string[] args, short id = -2) 27 | { 28 | try 29 | { 30 | string name = GetStringArg(args, "name"); 31 | int count = GetIntArg(args, "count"); 32 | string namespace_ = "ConsoleAdventure"; 33 | if (args.Length >= 3) 34 | namespace_ = GetStringArg(args, "namespace"); 35 | 36 | try 37 | { 38 | Type[] type = new Type[2] { Type.GetType(namespace_ + "." + name), Type.GetType(namespace_ + "." + name + "Item") }; 39 | 40 | for (int i = 0; i < type.Length; i++) 41 | { 42 | if (type[i] != null && type[i].IsSubclassOf(typeof(Item))) 43 | { 44 | if (count < 1) count = 1; 45 | 46 | Item item = (Item)Activator.CreateInstance(type[i]); 47 | if (id == -2) id = NetworkManager.Id; 48 | if (id == -1) id = 0; 49 | Player.Player pl = ConsoleAdventure.world.players[id]; 50 | pl.inventory.PickUpItems(new List() { new Stack(item, count) }); 51 | break; 52 | } 53 | } 54 | } 55 | 56 | catch (Exception) { } 57 | } 58 | catch 59 | { 60 | Loger.AddLog("Неверный формат аргумента!"); 61 | } 62 | } 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /ConsoleAdventure/Content/Scripts/Debug/Commands/GodMod.cs: -------------------------------------------------------------------------------- 1 | using ConsoleAdventure.Settings; 2 | using ConsoleAdventure.WorldEngine; 3 | using SharpDX.DirectWrite; 4 | using System; 5 | using System.Collections.Generic; 6 | using System.Linq; 7 | using System.Text; 8 | using System.Threading.Tasks; 9 | 10 | namespace ConsoleAdventure.Content.Scripts.Debug.Commands 11 | { 12 | public class GodMode : Command 13 | { 14 | public GodMode() 15 | { 16 | Name = "godmode"; 17 | Description = "set/reset god mode"; 18 | Arguments = new List() 19 | { 20 | }; 21 | } 22 | 23 | public override void Logic(string[] args, short id = -2) 24 | { 25 | ConsoleAdventure.GodMode = !ConsoleAdventure.GodMode; 26 | if (ConsoleAdventure.GodMode) Loger.AddLog("god mode activated!"); 27 | if (!ConsoleAdventure.GodMode) Loger.AddLog("god mode deactivated!"); 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /ConsoleAdventure/Content/Scripts/Debug/Commands/HackLight.cs: -------------------------------------------------------------------------------- 1 | using ConsoleAdventure.Settings; 2 | using ConsoleAdventure.WorldEngine; 3 | using SharpDX.DirectWrite; 4 | using System; 5 | using System.Collections.Generic; 6 | using System.Linq; 7 | using System.Text; 8 | using System.Threading.Tasks; 9 | 10 | namespace ConsoleAdventure.Content.Scripts.Debug.Commands 11 | { 12 | public class HackLight : Command 13 | { 14 | public HackLight() 15 | { 16 | Name = "hacklight"; 17 | Description = "gives a complete initial\nvision"; 18 | Arguments = new List() 19 | { 20 | }; 21 | } 22 | 23 | public override void Logic(string[] args, short id = -2) 24 | { 25 | Light.hackLight = !Light.hackLight; 26 | if (Light.hackLight) Loger.AddLog("now you can see in the\ndark!"); 27 | if (!Light.hackLight) Loger.AddLog("you stopped seeing in\nthe dark!"); 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /ConsoleAdventure/Content/Scripts/Debug/Commands/Help.cs: -------------------------------------------------------------------------------- 1 | using ConsoleAdventure.Settings; 2 | using ConsoleAdventure.WorldEngine; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Linq; 6 | using System.Text; 7 | using System.Threading.Tasks; 8 | 9 | namespace ConsoleAdventure.Content.Scripts.Debug.Commands 10 | { 11 | public class Help : Command 12 | { 13 | public Help() 14 | { 15 | Name = "help"; 16 | Description = "help for commands"; 17 | Arguments = new List() 18 | { 19 | "command" 20 | }; 21 | } 22 | 23 | public override void Logic(string[] args, short id = -1) 24 | { 25 | try 26 | { 27 | if (args.Length < 1) 28 | { 29 | for (int i = 0; i < Commands.Count; i++) 30 | { 31 | Loger.AddLog(GetCommandHelp(Commands.ElementAt(i).Key)); 32 | } 33 | } 34 | else 35 | { 36 | string name = GetStringArg(args, "command"); 37 | if (Commands.Keys.Contains(name)) 38 | Loger.AddLog(GetCommandHelp(name) + "\n " + Commands[name].Description.Replace("\n", "\n ")); 39 | } 40 | } 41 | 42 | catch (Exception) { } 43 | } 44 | 45 | private string GetCommandHelp(string cmd) 46 | { 47 | Command command = Commands[cmd]; 48 | string argsText = ""; 49 | 50 | for (int j = 0; j < command.Arguments.Count; j++) 51 | { 52 | argsText += command.Arguments[j]; 53 | if (j < command.Arguments.Count - 1) 54 | argsText += ", "; 55 | } 56 | 57 | return command.Name + " - " + argsText; 58 | } 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /ConsoleAdventure/Content/Scripts/Debug/Commands/PlaceTextMark.cs: -------------------------------------------------------------------------------- 1 | using ConsoleAdventure.Settings; 2 | using ConsoleAdventure.WorldEngine; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Linq; 6 | using System.Text; 7 | using System.Threading.Tasks; 8 | using static System.Net.Mime.MediaTypeNames; 9 | 10 | namespace ConsoleAdventure.Content.Scripts.Debug.Commands 11 | { 12 | public class PlaceTextMark : Command 13 | { 14 | public PlaceTextMark() 15 | { 16 | Name = "textmark"; 17 | Description = "place a text in world"; 18 | Arguments = new List() 19 | { 20 | "text" 21 | }; 22 | } 23 | 24 | public override void Logic(string[] args, short id = -1) 25 | { 26 | try 27 | { 28 | StringBuilder stringBuilder = new StringBuilder(); 29 | for (int i = 0; i < args.Length; i++) 30 | { 31 | stringBuilder.Append(args[i]); 32 | 33 | if (i != args.Length - 1) 34 | { 35 | stringBuilder.Append(" "); 36 | } 37 | } 38 | 39 | Position position = ConsoleAdventure.world.GetLocalPlayer().position; 40 | (new TextMark(position, ConsoleAdventure.world.Surface)).LoadData(stringBuilder.ToString()); 41 | } 42 | 43 | catch (Exception) { } 44 | } 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /ConsoleAdventure/Content/Scripts/Debug/Commands/PlaceTrees.cs: -------------------------------------------------------------------------------- 1 | using ConsoleAdventure.Settings; 2 | using ConsoleAdventure.WorldEngine; 3 | using SharpDX.DirectWrite; 4 | using System; 5 | using System.Collections.Generic; 6 | using System.Linq; 7 | using System.Reflection; 8 | using System.Text; 9 | using System.Threading.Tasks; 10 | 11 | namespace ConsoleAdventure.Content.Scripts.Debug.Commands 12 | { 13 | public class PlaceTrees : Command 14 | { 15 | public PlaceTrees() 16 | { 17 | Name = "placetrees"; 18 | Description = "place all trees"; 19 | Arguments = new List() 20 | { 21 | }; 22 | } 23 | 24 | public override void Logic(string[] args, short id = -2) 25 | { 26 | int chunk = 0; 27 | 28 | Type baseType = typeof(Transform); 29 | IEnumerable list = Assembly.GetAssembly(baseType).GetTypes().Where(type => type.IsSubclassOf(baseType)).ToList().Concat(CaModLoader.modTransforms); 30 | foreach (Type type in list) 31 | { 32 | if (type.IsAbstract) 33 | continue; 34 | 35 | if (type.IsSubclassOf(typeof(Tree))) 36 | { 37 | Position position = new Position(8, 8) + new Position(chunk * 16, 0); 38 | 39 | ConsoleAdventure.world.chunks[chunk, 0] = new LoadedChunk(); 40 | Transform.Init(type, position, ConsoleAdventure.world.Surface, null, null); 41 | 42 | string text = ConsoleAdventure.world.GetField(position, World.BlocksLayerId, ConsoleAdventure.world.Surface)?.content?.ModifyTooltip() ?? "~*??*~"; 43 | (new TextMark(position + new Position(0, 5), ConsoleAdventure.world.Surface)).LoadData(text); 44 | 45 | ConsoleAdventure.world.chunks[chunk, 0].IsUpdated = true; 46 | chunk++; 47 | } 48 | } 49 | } 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /ConsoleAdventure/Content/Scripts/Debug/Commands/SetTime.cs: -------------------------------------------------------------------------------- 1 | using ConsoleAdventure.WorldEngine; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | 8 | namespace ConsoleAdventure.Content.Scripts.Debug.Commands 9 | { 10 | public class SetTime : Command 11 | { 12 | public SetTime() 13 | { 14 | Name = "addtime"; 15 | Description = "set world time"; 16 | Arguments = new List() 17 | { 18 | "hours", 19 | "mins" 20 | }; 21 | } 22 | 23 | public override void Logic(string[] args, short id = -2) 24 | { 25 | 26 | int h = GetIntArg(args, "hours"); 27 | int m = GetIntArg(args, "mins"); 28 | 29 | try 30 | { 31 | ConsoleAdventure.world.time.PassTime((h * 3600) + (m * 60)); 32 | } 33 | 34 | catch (Exception) { } 35 | } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /ConsoleAdventure/Content/Scripts/Debug/Commands/ShowTypes.cs: -------------------------------------------------------------------------------- 1 | using ConsoleAdventure.Settings; 2 | using ConsoleAdventure.WorldEngine; 3 | using SharpDX.DirectWrite; 4 | using System; 5 | using System.Collections.Generic; 6 | using System.Linq; 7 | using System.Text; 8 | using System.Threading.Tasks; 9 | 10 | namespace ConsoleAdventure.Content.Scripts.Debug.Commands 11 | { 12 | public class ShowTypes : Command 13 | { 14 | public ShowTypes() 15 | { 16 | Name = "showtypes"; 17 | Description = "on/off display types"; 18 | Arguments = new List() 19 | { 20 | }; 21 | } 22 | 23 | public override void Logic(string[] args, short id = -2) 24 | { 25 | ConsoleAdventure.ShowTypes = !ConsoleAdventure.ShowTypes; 26 | if (ConsoleAdventure.ShowTypes) Loger.AddLog("types is shown!"); 27 | if (!ConsoleAdventure.ShowTypes) Loger.AddLog("types is hidden!"); 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /ConsoleAdventure/Content/Scripts/Debug/Commands/TeleportPlayer.cs: -------------------------------------------------------------------------------- 1 | using ConsoleAdventure.WorldEngine; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | 8 | namespace ConsoleAdventure.Content.Scripts.Debug.Commands 9 | { 10 | public class TeleportPlayer : Command 11 | { 12 | public TeleportPlayer() 13 | { 14 | Name = "tp"; 15 | Description = "teleports the player \nto specified coordinates"; 16 | Arguments = new List() 17 | { 18 | "x", 19 | "y" 20 | }; 21 | } 22 | 23 | public override void Logic(string[] args, short id = -2) 24 | { 25 | 26 | int x = GetIntArg(args, "x"); 27 | int y = GetIntArg(args, "y"); 28 | 29 | try 30 | { 31 | if (x < 0) 32 | return; 33 | if (y < 0) 34 | return; 35 | if (x > ConsoleAdventure.world.size) 36 | return; 37 | if (y > ConsoleAdventure.world.size) 38 | return; 39 | 40 | if (id == -2) id = NetworkManager.Id; 41 | if (id == -1) id = 0; 42 | Player.Player pl = ConsoleAdventure.world.players[id]; 43 | pl.SetPosition(new(x, y)); 44 | } 45 | 46 | catch (Exception) { } 47 | } 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /ConsoleAdventure/Content/Scripts/Entities/EntityColor.cs: -------------------------------------------------------------------------------- 1 | using ConsoleAdventure.WorldEngine; 2 | using Microsoft.Xna.Framework; 3 | 4 | namespace ConsoleAdventure.Content.Scripts.Entities; 5 | 6 | public class EntityColor 7 | { 8 | public Color[] Colors = new Color[9] 9 | { 10 | new Color(50, 50, 50), 11 | new Color(131, 105, 44), 12 | new Color(193, 138, 45), 13 | new Color(243, 171, 51), 14 | new Color(140, 147, 153), 15 | new Color(255, 255, 255), 16 | new Color(196, 207, 211), 17 | new Color(250, 194, 45), 18 | new Color(240, 210, 80), 19 | }; 20 | 21 | public int ColorIndex { get; set; } 22 | 23 | public EntityColor() 24 | { 25 | ColorIndex = ConsoleAdventure.rand.Next(0, Colors.Length); 26 | } 27 | 28 | public void ChooseColor(Position position, int w) 29 | { 30 | SetColor(Colors[ColorIndex], position, w); 31 | } 32 | 33 | private void SetColor(Color color, Position position, int w) 34 | { 35 | //ConsoleAdventure.world.GetField(position.x, position.y, World.MobsLayerId, w).content.color = color; 36 | } 37 | } -------------------------------------------------------------------------------- /ConsoleAdventure/Content/Scripts/Entities/Explosion.cs: -------------------------------------------------------------------------------- 1 | using ConsoleAdventure.WorldEngine; 2 | using Microsoft.Xna.Framework; 3 | using System; 4 | using System.Collections.Generic; 5 | using ConsoleAdventure.Content.Scripts.Entities.StateMachine; 6 | using System.Reflection; 7 | using System.Threading; 8 | 9 | namespace ConsoleAdventure.Content.Scripts 10 | { 11 | [Serializable] 12 | public class Explosion : Entity 13 | { 14 | static string[] Symbols = new string[] 15 | { 16 | " ", 17 | "@@", 18 | "¼¼", 19 | "÷÷", 20 | "\\\\", 21 | "~~", 22 | "··" 23 | }; 24 | 25 | int frame; 26 | 27 | public Explosion(Position position, int w, List parameters = null) : base(position, w, parameters) 28 | { 29 | type = (int)VanillaTransforms.explosion; 30 | SetMaxLife(-1); 31 | 32 | AddTypeToMap(type); 33 | 34 | Initialize(); 35 | } 36 | 37 | public override string GetSymbol() 38 | { 39 | return Symbols[frame]; 40 | } 41 | 42 | public override Color GetColor() 43 | { 44 | return new Color(255, 211, 51); 45 | } 46 | 47 | int timer; 48 | int delay = 5; 49 | public override void AI() 50 | { 51 | if (CanHitToPlayer(out short id) && world.players[id].invulnerabilityTime < 0) 52 | { 53 | world.players[id].Hit(10); 54 | } 55 | 56 | if (timer % delay == 0 && frame < Symbols.Length-1) 57 | frame++; 58 | 59 | if (timer >= (Symbols.Length - 1) * delay) 60 | { 61 | Kill(); 62 | 63 | if(ConsoleAdventure.rand.Next(0, 21) == 20 && NetworkManager.isHost) 64 | { 65 | Spawner.Spawn(new Fire(position, w)); 66 | } 67 | } 68 | 69 | timer++; 70 | } 71 | 72 | public override void OnTheScreen() 73 | { 74 | Light.Add(position.x, position.y, w, new Color(255, 255, 255), 8.5f); 75 | } 76 | } 77 | } 78 | -------------------------------------------------------------------------------- /ConsoleAdventure/Content/Scripts/Entities/Leaves.cs: -------------------------------------------------------------------------------- 1 | using ConsoleAdventure.WorldEngine; 2 | using Microsoft.Xna.Framework; 3 | using System; 4 | using System.Collections.Generic; 5 | using ConsoleAdventure.Content.Scripts.Entities.StateMachine; 6 | using System.Reflection; 7 | using System.Threading; 8 | 9 | namespace ConsoleAdventure.Content.Scripts 10 | { 11 | [Serializable] 12 | public class Leaves : Entity 13 | { 14 | static string[] Symbols = new string[] 15 | { 16 | " ", 17 | "¾¾", 18 | "÷÷", 19 | "\\\\", 20 | "⁄⁄", 21 | "··" 22 | }; 23 | 24 | int delay; 25 | int frame; 26 | 27 | public Leaves(Position position, int w, List parameters = null) : base(position, w, parameters) 28 | { 29 | type = (int)VanillaTransforms.leaves; 30 | SetMaxLife(-1); 31 | 32 | AddTypeToMap(type); 33 | 34 | delay = ConsoleAdventure.rand.Next(3, 20); 35 | 36 | Initialize(); 37 | } 38 | 39 | public override string GetSymbol() 40 | { 41 | return Symbols[frame]; 42 | } 43 | 44 | public override Color GetColor() 45 | { 46 | Color color = new Color(13, 152, 20) * 0.5f; 47 | color.A = 255; 48 | return color; 49 | } 50 | 51 | int timer; 52 | 53 | public override void AI() 54 | { 55 | if (timer % delay == 0 && frame < Symbols.Length) 56 | { 57 | frame++; 58 | Position newPos = new(ConsoleAdventure.rand.Next(position.x - 1, position.x + 2), ConsoleAdventure.rand.Next(position.y - 1, position.y + 2)); 59 | SetPosition(newPos); 60 | } 61 | 62 | if (frame >= Symbols.Length) frame = Symbols.Length - 1; 63 | if (frame < 0) frame = 0; 64 | 65 | if (timer >= (Symbols.Length - 1) * delay) 66 | Kill(); 67 | 68 | timer++; 69 | } 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /ConsoleAdventure/Content/Scripts/Entities/StateMachine/IState.cs: -------------------------------------------------------------------------------- 1 | namespace ConsoleAdventure.Content.Scripts.Entities.StateMachine; 2 | 3 | public interface IState 4 | { 5 | public void Enter(); 6 | public void InteractWithWorld(); 7 | public void Exit(); 8 | } -------------------------------------------------------------------------------- /ConsoleAdventure/Content/Scripts/Entities/StateMachine/StateMachine.cs: -------------------------------------------------------------------------------- 1 | using ConsoleAdventure.Content.Scripts.Entities.StateMachine.States; 2 | 3 | namespace ConsoleAdventure.Content.Scripts.Entities.StateMachine; 4 | 5 | public class StateMachine 6 | { 7 | public IState CurrentState { get; private set; } 8 | 9 | private Entity _owner; 10 | 11 | private MovingState _movingState; 12 | private IdleState _idleState; 13 | 14 | public StateMachine(Entity owner) 15 | { 16 | _owner = owner; 17 | _movingState = new MovingState(_owner); 18 | _idleState = new IdleState(_owner); 19 | } 20 | 21 | public void InteractWithWorld() 22 | { 23 | CurrentState?.InteractWithWorld(); 24 | } 25 | 26 | public void ChangeState(StatesEnum state) 27 | { 28 | CurrentState?.Exit(); 29 | 30 | switch (state) 31 | { 32 | case StatesEnum.Moving: 33 | CurrentState = _movingState; 34 | break; 35 | case StatesEnum.Idle: 36 | CurrentState = _idleState; 37 | break; 38 | } 39 | 40 | CurrentState?.Enter(); 41 | } 42 | } -------------------------------------------------------------------------------- /ConsoleAdventure/Content/Scripts/Entities/StateMachine/States/IdleState.cs: -------------------------------------------------------------------------------- 1 | namespace ConsoleAdventure.Content.Scripts.Entities.StateMachine.States; 2 | 3 | public class IdleState : IState 4 | { 5 | private int _timer; 6 | private int _randomTime; 7 | 8 | private Entity _entity; 9 | 10 | public IdleState(Entity entity) 11 | { 12 | _entity = entity; 13 | } 14 | 15 | public void Enter() 16 | { 17 | _randomTime = ConsoleAdventure.rand.Next(0, 100); 18 | } 19 | 20 | public void InteractWithWorld() 21 | { 22 | if (_timer > _randomTime) 23 | { 24 | _entity.StateMachine.ChangeState(StatesEnum.Moving); 25 | } 26 | 27 | _timer++; 28 | } 29 | 30 | public void Exit() 31 | { 32 | _timer = 0; 33 | } 34 | } -------------------------------------------------------------------------------- /ConsoleAdventure/Content/Scripts/Entities/StateMachine/States/MovingState.cs: -------------------------------------------------------------------------------- 1 | namespace ConsoleAdventure.Content.Scripts.Entities.StateMachine.States; 2 | 3 | public class MovingState : IState 4 | { 5 | private readonly Entity _entity; 6 | 7 | public MovingState(Entity entity) 8 | { 9 | _entity = entity; 10 | } 11 | 12 | public void Enter() 13 | { 14 | _entity.Move(1, new Position(ConsoleAdventure.rand.Next(-15, 15), ConsoleAdventure.rand.Next(-15, 15))); 15 | //_entity.EntityColor.ChooseColor(_entity.position, _entity.w); 16 | _entity.StateMachine.ChangeState(StatesEnum.Idle); 17 | } 18 | 19 | public void InteractWithWorld() 20 | { 21 | 22 | } 23 | 24 | public void Exit() 25 | { 26 | 27 | } 28 | } -------------------------------------------------------------------------------- /ConsoleAdventure/Content/Scripts/Entities/StateMachine/StatesEnum.cs: -------------------------------------------------------------------------------- 1 | namespace ConsoleAdventure.Content.Scripts.Entities.StateMachine; 2 | 3 | public enum StatesEnum 4 | { 5 | Moving, 6 | Idle 7 | } -------------------------------------------------------------------------------- /ConsoleAdventure/Content/Scripts/IO/SerializeData.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.IO; 4 | using System.Linq; 5 | using System.Runtime.Serialization.Formatters.Binary; 6 | using System.Text; 7 | using System.Threading.Tasks; 8 | 9 | namespace ConsoleAdventure.Content.Scripts.IO 10 | { 11 | public class SerializeData 12 | { 13 | public static byte[] Serialize(T obj) 14 | { 15 | if (obj == null) 16 | { 17 | throw new ArgumentNullException(nameof(obj), "The object to serialize cannot be null."); 18 | } 19 | 20 | using (MemoryStream ms = new MemoryStream()) 21 | { 22 | BinaryFormatter formatter = new BinaryFormatter(); 23 | formatter.Serialize(ms, obj); 24 | return ms.ToArray(); 25 | } 26 | } 27 | 28 | public static T Deserialize(byte[] data) 29 | { 30 | if (data == null || data.Length == 0) 31 | { 32 | throw new ArgumentNullException(nameof(data), "The data to deserialize cannot be null or empty."); 33 | } 34 | 35 | using (MemoryStream ms = new MemoryStream(data)) 36 | { 37 | BinaryFormatter formatter = new BinaryFormatter(); 38 | return (T)formatter.Deserialize(ms); 39 | } 40 | } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /ConsoleAdventure/Content/Scripts/IO/Tags.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace ConsoleAdventure.Content.Scripts.IO 8 | { 9 | public class Tags 10 | { 11 | public Dictionary Data { get; internal set; } 12 | 13 | public Tags() 14 | { 15 | Data = new(new Dictionary()); 16 | } 17 | 18 | /// 19 | /// Чтение/Запись тега. При записи, в случае существования тега, он перезаписываеться.

20 | /// Рекомендация:
21 | /// Старайтесь следовать единому стилю имён тегов "", а именно PascalCasing, тоесть: все слова в названии должны начинаться с большой буквы и писаться слитно. 22 | /// Например: 23 | /// 24 | /// - ObjectPosition 25 | /// - CustomWorldData 26 | /// - Objects 27 | /// Желательно указывать в начале имя вашего мода, в таком стиле: ModName/TagName 28 | ///
29 | /// 30 | /// Имя тега. 31 | /// 32 | /// 33 | public object this[string key] 34 | { 35 | get 36 | { 37 | return Data[key]; 38 | } 39 | set 40 | { 41 | if (!Data.ContainsKey(key)) 42 | Data.Add(key, value); 43 | 44 | else Data[key] = value; 45 | } 46 | } 47 | 48 | /// 49 | /// Не совсем безопасный способ извлечения данных из 50 | /// 51 | /// Десериализуемый тип тега 52 | /// Ключ тега, его имя 53 | /// Значение по умолчанию, которое будет возвращено в случае отсутствия тега 54 | /// Данные тега "" 55 | public T SafelyGet(string key, T def = default) 56 | { 57 | if (Data.TryGetValue(key, out var value)) 58 | { 59 | return (T)value; 60 | } 61 | 62 | return def; 63 | } 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /ConsoleAdventure/Content/Scripts/InputLogic/Input.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AbdSayen/ConsoleAdventure/eefe459dbb5f531d66e530e0d5a9319808e1a20e/ConsoleAdventure/Content/Scripts/InputLogic/Input.cs -------------------------------------------------------------------------------- /ConsoleAdventure/Content/Scripts/Items/Inventory/ItemType.cs: -------------------------------------------------------------------------------- 1 | namespace ConsoleAdventure 2 | { 3 | public enum ItemType 4 | { 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /ConsoleAdventure/Content/Scripts/Items/Inventory/Stack.cs: -------------------------------------------------------------------------------- 1 | using ConsoleAdventure.Settings; 2 | using System; 3 | 4 | namespace ConsoleAdventure 5 | { 6 | [Serializable] 7 | public class Stack 8 | { 9 | private Item item { get; set; } 10 | 11 | public Item Item 12 | { 13 | get 14 | { 15 | return item; 16 | } 17 | 18 | private set 19 | { 20 | item = value; 21 | maxStackCount = item.maxCount; 22 | } 23 | } 24 | 25 | public int count { get; set; } 26 | 27 | public int maxStackCount { get; private set; } = 50; 28 | 29 | public Stack(Item item, int count = 1) 30 | { 31 | this.Item = item; 32 | this.count = count; 33 | } 34 | 35 | public string GetInfo() 36 | { 37 | return $"{((Item)Item).name}" + (count > 1 ? $" ({count})" : ""); 38 | } 39 | 40 | public void AddItems(int count = 1) 41 | { 42 | if (count < maxStackCount) 43 | { 44 | this.count += count; 45 | } 46 | } 47 | 48 | public Stack Copy() 49 | { 50 | Stack copy = (Stack)MemberwiseClone(); 51 | if (Item != null) 52 | { 53 | copy.Item = Item; 54 | } 55 | 56 | return copy; 57 | } 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /ConsoleAdventure/Content/Scripts/Items/content/food/Apple.cs: -------------------------------------------------------------------------------- 1 | using ConsoleAdventure.Content.Scripts; 2 | using Microsoft.Xna.Framework; 3 | using System; 4 | using System.Collections.Generic; 5 | 6 | namespace ConsoleAdventure 7 | { 8 | [Serializable] 9 | public class Apple : FoodItem 10 | { 11 | public Apple() 12 | { 13 | satiety = 1; 14 | name = Localization.GetTranslation("Items", GetType().Name); 15 | description = GetDescription(); 16 | canUse = true; 17 | consume = true; 18 | 19 | AddTypeToMap(); 20 | } 21 | 22 | public override CharTexture GetTexture() 23 | { 24 | return new CharTexture().AddLayer("o", Color.Red).AddLayer("`", Color.Green); 25 | } 26 | 27 | public new string GetDescription() 28 | { 29 | return " " + Localization.GetTranslation("ItemDescription", GetType().Name) + "\n " + base.GetDescription(); 30 | } 31 | 32 | public override void UseItem() 33 | { 34 | Eat(); 35 | new Loot(ConsoleAdventure.world.GetLocalPlayer().position, ConsoleAdventure.world.GetLocalPlayer().w, new List { new Stack(new TreeSeed(), ConsoleAdventure.rand.Next(1, 4)) }); 36 | } 37 | } 38 | } -------------------------------------------------------------------------------- /ConsoleAdventure/Content/Scripts/Items/content/food/Food.cs: -------------------------------------------------------------------------------- 1 | using ConsoleAdventure.Settings; 2 | using System; 3 | 4 | namespace ConsoleAdventure 5 | { 6 | [Serializable] 7 | public abstract class Food : Item 8 | { 9 | public int satiety { get; protected set; } = 1; 10 | public void Eat() 11 | { 12 | Loger.AddLog(name.ToString() + " " + Localization.GetTranslation("Events", "Eating")); 13 | } 14 | 15 | protected new string GetDescription() 16 | { 17 | return Localization.GetTranslation("ItemDescription", "BaseFood"); 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /ConsoleAdventure/Content/Scripts/Items/content/food/FoodItem.cs: -------------------------------------------------------------------------------- 1 | using ConsoleAdventure.Settings; 2 | using System; 3 | 4 | namespace ConsoleAdventure 5 | { 6 | [Serializable] 7 | public abstract class FoodItem : Item 8 | { 9 | public int satiety { get; protected set; } = 1; 10 | public void Eat() 11 | { 12 | Loger.AddLog(name.ToString() + " " + Localization.GetTranslation("Events", "Eating")); 13 | } 14 | 15 | protected new string GetDescription() 16 | { 17 | return Localization.GetTranslation("ItemDescription", "BaseFood"); 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /ConsoleAdventure/Content/Scripts/Items/content/furniture/AlfisolFloorItem.cs: -------------------------------------------------------------------------------- 1 | using ConsoleAdventure.Content.Scripts; 2 | using ConsoleAdventure.WorldEngine; 3 | using Microsoft.Xna.Framework; 4 | using System; 5 | using System.Collections.Generic; 6 | using System.Windows.Forms; 7 | 8 | namespace ConsoleAdventure 9 | { 10 | [Serializable] 11 | public class AlfisolFloorItem : PlaceableItem 12 | { 13 | public AlfisolFloorItem() 14 | { 15 | name = Localization.GetTranslation("Transforms", "AlfisolFloor"); 16 | description = GetDescription(); 17 | placeType = (int)VanillaTransforms.alfisolFloor; 18 | placeLayer = World.FloorLayerId; 19 | maxCount = 100; 20 | AddTypeToMap(); 21 | } 22 | 23 | public override CharTexture GetTexture() 24 | { 25 | return new CharTexture().AddLayer("`", new Color(54, 43, 32)); 26 | } 27 | } 28 | } -------------------------------------------------------------------------------- /ConsoleAdventure/Content/Scripts/Items/content/furniture/AnvilItem.cs: -------------------------------------------------------------------------------- 1 | using ConsoleAdventure.Content.Scripts; 2 | using ConsoleAdventure.WorldEngine; 3 | using Microsoft.Xna.Framework; 4 | using System; 5 | using System.Collections.Generic; 6 | 7 | namespace ConsoleAdventure 8 | { 9 | [Serializable] 10 | public class AnvilItem : PlaceableItem 11 | { 12 | public AnvilItem() 13 | { 14 | name = Localization.GetTranslation("Transforms", "Anvil"); 15 | description = GetDescription(); 16 | placeType = (int)VanillaTransforms.anvil; 17 | AddTypeToMap(); 18 | } 19 | 20 | public override CharTexture GetTexture() 21 | { 22 | return new CharTexture().AddLayer("■", new(40, 40, 40)).AddLayer("σ", Color.Gray); 23 | } 24 | 25 | public override Recipe AddRecipe() 26 | { 27 | Recipe recipe = new Recipe(new Stack(this, 1)); 28 | recipe.AddIngredient(new IronBar(), 8); 29 | recipe.AddStation((int)VanillaTransforms.workbench); 30 | return recipe; 31 | } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /ConsoleAdventure/Content/Scripts/Items/content/furniture/BlackSoilIFloortem.cs: -------------------------------------------------------------------------------- 1 | using ConsoleAdventure.Content.Scripts; 2 | using ConsoleAdventure.WorldEngine; 3 | using Microsoft.Xna.Framework; 4 | using System; 5 | using System.Collections.Generic; 6 | using System.Windows.Forms; 7 | 8 | namespace ConsoleAdventure 9 | { 10 | [Serializable] 11 | public class BlackSoilFloorItem : PlaceableItem 12 | { 13 | public BlackSoilFloorItem() 14 | { 15 | name = Localization.GetTranslation("Transforms", "BlackSoilFloor"); 16 | description = GetDescription(); 17 | placeType = (int)VanillaTransforms.blackSoilFloor; 18 | placeLayer = World.FloorLayerId; 19 | maxCount = 100; 20 | AddTypeToMap(); 21 | } 22 | 23 | public override CharTexture GetTexture() 24 | { 25 | return new CharTexture().AddLayer("`", new Color(20, 20, 20)); 26 | } 27 | } 28 | } -------------------------------------------------------------------------------- /ConsoleAdventure/Content/Scripts/Items/content/furniture/BrokenLogItem.cs: -------------------------------------------------------------------------------- 1 | using ConsoleAdventure.Content.Scripts; 2 | using ConsoleAdventure.WorldEngine; 3 | using Microsoft.Xna.Framework; 4 | using System; 5 | using System.Collections.Generic; 6 | 7 | namespace ConsoleAdventure 8 | { 9 | [Serializable] 10 | public class BrokenLogItem : PlaceableItem 11 | { 12 | public BrokenLogItem() 13 | { 14 | name = Localization.GetTranslation("Transforms", "BrokenLog"); 15 | description = GetDescription(); 16 | placeType = (int)VanillaTransforms.brokenLog; 17 | AddTypeToMap(); 18 | } 19 | 20 | public override CharTexture GetTexture() 21 | { 22 | return new CharTexture().AddLayer(":", ColorAssets.woodenColor); 23 | } 24 | 25 | public override Recipe AddRecipe() 26 | { 27 | Recipe recipe = new Recipe(new Stack(this, 1)); 28 | recipe.AddIngredient(new Log(), 1); 29 | recipe.AddStation((int)VanillaTransforms.workbench); 30 | 31 | return recipe; 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /ConsoleAdventure/Content/Scripts/Items/content/furniture/ChestItem.cs: -------------------------------------------------------------------------------- 1 | using ConsoleAdventure.Content.Scripts; 2 | using ConsoleAdventure.WorldEngine; 3 | using Microsoft.Xna.Framework; 4 | using System; 5 | using System.Collections.Generic; 6 | 7 | namespace ConsoleAdventure 8 | { 9 | [Serializable] 10 | public class ChestItem : PlaceableItem 11 | { 12 | public ChestItem() 13 | { 14 | name = Localization.GetTranslation("Transforms", "Chest"); 15 | description = GetDescription(); 16 | placeType = (int)VanillaTransforms.chest; 17 | AddTypeToMap(); 18 | } 19 | 20 | public override CharTexture GetTexture() 21 | { 22 | return new CharTexture().AddLayer("■", new Color(43, 23, 15), new Vector2(0, -1)) 23 | .AddLayer("▬", new Color(94, 61, 38), new Vector2(0, 2)) 24 | .AddLayer("▬", new Color(94, 61, 38), new Vector2(0, 5)) 25 | .AddLayer("─", Color.Gray, new Vector2(0, 1)) 26 | .AddLayer("ˈ", Color.Gray, new Vector2(4, 8)); 27 | } 28 | 29 | public override Recipe AddRecipe() 30 | { 31 | Recipe recipe = new Recipe(new Stack(this, 1)); 32 | recipe.AddIngredient(new Log(), 5); 33 | recipe.AddStation((int)VanillaTransforms.workbench); 34 | 35 | return recipe; 36 | } 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /ConsoleAdventure/Content/Scripts/Items/content/furniture/DoorItem.cs: -------------------------------------------------------------------------------- 1 | using ConsoleAdventure.Content.Scripts; 2 | using ConsoleAdventure.WorldEngine; 3 | using Microsoft.Xna.Framework; 4 | using System; 5 | using System.Collections.Generic; 6 | 7 | namespace ConsoleAdventure 8 | { 9 | [Serializable] 10 | public class DoorItem : PlaceableItem 11 | { 12 | public DoorItem() 13 | { 14 | name = Localization.GetTranslation("Transforms", "Door"); 15 | description = GetDescription(); 16 | placeType = (int)VanillaTransforms.door; 17 | AddTypeToMap(); 18 | } 19 | 20 | public override CharTexture GetTexture() 21 | { 22 | return new CharTexture().AddLayer("█", new(94, 61, 38)) 23 | .AddLayer("╴", Color.Gray); 24 | } 25 | 26 | public override Recipe AddRecipe() 27 | { 28 | Recipe recipe = new Recipe(new Stack(this, 1)); 29 | recipe.AddIngredient(new Log(), 3); 30 | recipe.AddStation((int)VanillaTransforms.workbench); 31 | 32 | return recipe; 33 | } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /ConsoleAdventure/Content/Scripts/Items/content/furniture/FloorItem.cs: -------------------------------------------------------------------------------- 1 | using ConsoleAdventure.Content.Scripts; 2 | using ConsoleAdventure.WorldEngine; 3 | using Microsoft.Xna.Framework; 4 | using System; 5 | using System.Collections.Generic; 6 | 7 | namespace ConsoleAdventure 8 | { 9 | [Serializable] 10 | public class FloorItem : PlaceableItem 11 | { 12 | public FloorItem() 13 | { 14 | name = Localization.GetTranslation("Transforms", "Floor"); 15 | description = GetDescription(); 16 | placeType = (int)VanillaTransforms.floor; 17 | placeLayer = World.FloorLayerId; 18 | maxCount = 100; 19 | AddTypeToMap(); 20 | } 21 | 22 | public override CharTexture GetTexture() 23 | { 24 | return new CharTexture().AddLayer(".", Color.Gray); 25 | } 26 | 27 | public override Recipe AddRecipe() 28 | { 29 | Recipe recipe = new Recipe(new Stack(this, 2)); 30 | recipe.AddIngredient(new StoneItem(), 1); 31 | recipe.AddStation((int)VanillaTransforms.workbench); 32 | return recipe; 33 | } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /ConsoleAdventure/Content/Scripts/Items/content/furniture/FurnaceItem.cs: -------------------------------------------------------------------------------- 1 | using ConsoleAdventure.Content.Scripts; 2 | using ConsoleAdventure.WorldEngine; 3 | using Microsoft.Xna.Framework; 4 | using System; 5 | using System.Collections.Generic; 6 | 7 | namespace ConsoleAdventure 8 | { 9 | [Serializable] 10 | public class FurnaceItem : PlaceableItem 11 | { 12 | public FurnaceItem() 13 | { 14 | name = Localization.GetTranslation("Transforms", "Furnace"); 15 | description = GetDescription(); 16 | placeType = (int)VanillaTransforms.furnace; 17 | AddTypeToMap(); 18 | } 19 | 20 | public override CharTexture GetTexture() 21 | { 22 | return new CharTexture().AddLayer("■", Color.Gray) 23 | .AddLayer("&", Color.Gray) 24 | .AddLayer("┻", Color.Gray) 25 | .AddLayer("⌂", new Color(50, 50, 50)); 26 | } 27 | 28 | public override Recipe AddRecipe() 29 | { 30 | Recipe recipe = new Recipe(new Stack(this, 1)); 31 | recipe.AddIngredient(new StoneItem(), 10); 32 | recipe.AddIngredient(new Log(), 5); 33 | recipe.AddStation((int)VanillaTransforms.workbench); 34 | 35 | return recipe; 36 | } 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /ConsoleAdventure/Content/Scripts/Items/content/furniture/GraniteFloorItem.cs: -------------------------------------------------------------------------------- 1 | using ConsoleAdventure.Content.Scripts; 2 | using ConsoleAdventure.WorldEngine; 3 | using Microsoft.Xna.Framework; 4 | using System; 5 | using System.Collections.Generic; 6 | 7 | namespace ConsoleAdventure 8 | { 9 | [Serializable] 10 | public class GraniteFloorItem : PlaceableItem 11 | { 12 | public GraniteFloorItem() 13 | { 14 | name = Localization.GetTranslation("Transforms", "GraniteFloor"); 15 | description = GetDescription(); 16 | placeType = (int)VanillaTransforms.graniteFloor; 17 | placeLayer = World.FloorLayerId; 18 | maxCount = 100; 19 | AddTypeToMap(); 20 | } 21 | 22 | public override CharTexture GetTexture() 23 | { 24 | return new CharTexture().AddLayer("~", new(45, 45, 45)); 25 | } 26 | 27 | public override Recipe AddRecipe() 28 | { 29 | Recipe recipe = new Recipe(new Stack(this, 2)); 30 | recipe.AddIngredient(new GraniteItem(), 1); 31 | recipe.AddStation((int)VanillaTransforms.workbench); 32 | return recipe; 33 | } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /ConsoleAdventure/Content/Scripts/Items/content/furniture/GraniteWallItem.cs: -------------------------------------------------------------------------------- 1 | using ConsoleAdventure.Content.Scripts; 2 | using ConsoleAdventure.WorldEngine; 3 | using Microsoft.Xna.Framework; 4 | using System; 5 | using System.Collections.Generic; 6 | 7 | namespace ConsoleAdventure 8 | { 9 | [Serializable] 10 | public class GraniteWallItem : PlaceableItem 11 | { 12 | public GraniteWallItem() 13 | { 14 | name = Localization.GetTranslation("Transforms", "GraniteWall"); 15 | description = GetDescription(); 16 | placeType = (int)VanillaTransforms.graniteWall; 17 | AddTypeToMap(); 18 | } 19 | 20 | public override CharTexture GetTexture() 21 | { 22 | return new CharTexture().AddLayer("∫", new Color(45, 45, 45)); 23 | } 24 | 25 | public override Recipe AddRecipe() 26 | { 27 | Recipe recipe = new Recipe(new Stack(this, 1)); 28 | recipe.AddIngredient(new GraniteItem(), 1); 29 | recipe.AddStation((int)VanillaTransforms.workbench); 30 | return recipe; 31 | } 32 | } 33 | } -------------------------------------------------------------------------------- /ConsoleAdventure/Content/Scripts/Items/content/furniture/PlaceableItem.cs: -------------------------------------------------------------------------------- 1 | using ConsoleAdventure.WorldEngine; 2 | using Microsoft.Xna.Framework; 3 | using System; 4 | using System.Collections.Generic; 5 | 6 | namespace ConsoleAdventure 7 | { 8 | [Serializable] 9 | public class PlaceableItem : Item 10 | { 11 | public int placeType = -1; 12 | public int placeLayer = World.BlocksLayerId; 13 | 14 | public new string GetDescription() 15 | { 16 | description = Localization.GetTranslation("Generic", "CanBePlaced"); 17 | return description; 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /ConsoleAdventure/Content/Scripts/Items/content/furniture/RuineItem.cs: -------------------------------------------------------------------------------- 1 | using ConsoleAdventure.Content.Scripts; 2 | using ConsoleAdventure.WorldEngine; 3 | using Microsoft.Xna.Framework; 4 | using System; 5 | using System.Collections.Generic; 6 | 7 | namespace ConsoleAdventure 8 | { 9 | [Serializable] 10 | public class RuineItem : PlaceableItem 11 | { 12 | public RuineItem() 13 | { 14 | name = Localization.GetTranslation("Transforms", "Ruine"); 15 | description = GetDescription(); 16 | placeType = (int)VanillaTransforms.ruine; 17 | AddTypeToMap(); 18 | } 19 | 20 | public override CharTexture GetTexture() 21 | { 22 | return new CharTexture().AddLayer(":", Color.Gray); 23 | } 24 | 25 | public override Recipe AddRecipe() 26 | { 27 | Recipe recipe = new Recipe(new Stack(this, 1)); 28 | recipe.AddIngredient(new StoneItem(), 1); 29 | recipe.AddStation((int)VanillaTransforms.workbench); 30 | 31 | return recipe; 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /ConsoleAdventure/Content/Scripts/Items/content/furniture/SandFloorItem.cs: -------------------------------------------------------------------------------- 1 | using ConsoleAdventure.Content.Scripts; 2 | using ConsoleAdventure.WorldEngine; 3 | using Microsoft.Xna.Framework; 4 | using System; 5 | using System.Collections.Generic; 6 | using System.Windows.Forms; 7 | 8 | namespace ConsoleAdventure 9 | { 10 | [Serializable] 11 | public class SandFloorItem : PlaceableItem 12 | { 13 | public SandFloorItem() 14 | { 15 | name = Localization.GetTranslation("Transforms", "SandFloor"); 16 | description = GetDescription(); 17 | placeType = (int)VanillaTransforms.sandFloor; 18 | placeLayer = World.FloorLayerId; 19 | maxCount = 100; 20 | AddTypeToMap(); 21 | } 22 | 23 | public override CharTexture GetTexture() 24 | { 25 | return new CharTexture().AddLayer("≈", new Color(196, 190, 11)); 26 | } 27 | } 28 | } -------------------------------------------------------------------------------- /ConsoleAdventure/Content/Scripts/Items/content/furniture/TorchItem.cs: -------------------------------------------------------------------------------- 1 | using ConsoleAdventure.Content.Scripts; 2 | using ConsoleAdventure.WorldEngine; 3 | using Microsoft.Xna.Framework; 4 | using System; 5 | using System.Collections.Generic; 6 | 7 | namespace ConsoleAdventure 8 | { 9 | [Serializable] 10 | public class TorchItem : PlaceableItem 11 | { 12 | public TorchItem() 13 | { 14 | name = Localization.GetTranslation("Transforms", "Torch"); 15 | description = GetDescription(); 16 | placeType = (int)VanillaTransforms.torch; 17 | AddTypeToMap(); 18 | } 19 | 20 | int timer; 21 | 22 | public override CharTexture GetTexture() 23 | { 24 | timer++; 25 | return new CharTexture().AddLayer("/", new(94, 61, 38)) 26 | .AddLayer("●", Color.OrangeRed, new(-0.58f + 2, -0.03f - 2.5f)) 27 | .AddLayer("•", Color.OrangeRed * 0.8f, new Vector2(0.42f + (float)(Math.Sin(timer / 30 * Math.PI) / 2) + 2, -2.4f - 2.5f)) 28 | .AddLayer("•", Color.Orange * (float)(1 + Math.Sin(timer / 60 * Math.PI) / 4), new Vector2(0.2f + 2, -0.03f - 2.5f)) 29 | ; 30 | } 31 | 32 | public override Recipe AddRecipe() 33 | { 34 | Recipe recipe = new Recipe(new Stack(this, 3)); 35 | recipe.AddIngredient(new Log(), 1); 36 | 37 | return recipe; 38 | } 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /ConsoleAdventure/Content/Scripts/Items/content/furniture/WallItem.cs: -------------------------------------------------------------------------------- 1 | using ConsoleAdventure.Content.Scripts; 2 | using ConsoleAdventure.WorldEngine; 3 | using Microsoft.Xna.Framework; 4 | using System; 5 | using System.Collections.Generic; 6 | 7 | namespace ConsoleAdventure 8 | { 9 | [Serializable] 10 | public class WallItem : PlaceableItem 11 | { 12 | public WallItem() 13 | { 14 | name = Localization.GetTranslation("Transforms", "Wall"); 15 | description = GetDescription(); 16 | placeType = (int)VanillaTransforms.wall; 17 | AddTypeToMap(); 18 | } 19 | 20 | public override CharTexture GetTexture() 21 | { 22 | return new CharTexture().AddLayer("#", Color.White); 23 | } 24 | 25 | public override Recipe AddRecipe() 26 | { 27 | Recipe recipe = new Recipe(new Stack(this, 1)); 28 | recipe.AddIngredient(new StoneItem(), 1); 29 | recipe.AddStation((int)VanillaTransforms.workbench); 30 | 31 | return recipe; 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /ConsoleAdventure/Content/Scripts/Items/content/furniture/WoodFloorItem.cs: -------------------------------------------------------------------------------- 1 | using ConsoleAdventure.Content.Scripts; 2 | using ConsoleAdventure.WorldEngine; 3 | using Microsoft.Xna.Framework; 4 | using System; 5 | using System.Collections.Generic; 6 | 7 | namespace ConsoleAdventure 8 | { 9 | [Serializable] 10 | public class WoodFloorItem : PlaceableItem 11 | { 12 | public WoodFloorItem() 13 | { 14 | name = Localization.GetTranslation("Transforms", "WoodFloor"); 15 | description = GetDescription(); 16 | placeType = (int)VanillaTransforms.woodFloor; 17 | placeLayer = World.FloorLayerId; 18 | maxCount = 100; 19 | AddTypeToMap(); 20 | } 21 | 22 | public override CharTexture GetTexture() 23 | { 24 | return new CharTexture().AddLayer(".", new(94, 61, 38)); 25 | } 26 | 27 | public override Recipe AddRecipe() 28 | { 29 | Recipe recipe = new Recipe(new Stack(this, 2)); 30 | recipe.AddIngredient(new Log(), 1); 31 | recipe.AddStation((int)VanillaTransforms.workbench); 32 | return recipe; 33 | } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /ConsoleAdventure/Content/Scripts/Items/content/furniture/WorkbenchItem.cs: -------------------------------------------------------------------------------- 1 | using ConsoleAdventure.Content.Scripts; 2 | using ConsoleAdventure.WorldEngine; 3 | using Microsoft.Xna.Framework; 4 | using System; 5 | using System.Collections.Generic; 6 | 7 | namespace ConsoleAdventure 8 | { 9 | [Serializable] 10 | public class WorkbenchItem : PlaceableItem 11 | { 12 | public WorkbenchItem() 13 | { 14 | name = Localization.GetTranslation("Transforms", "Workbench"); 15 | description = GetDescription(); 16 | placeType = (int)VanillaTransforms.workbench; 17 | AddTypeToMap(); 18 | } 19 | 20 | public override CharTexture GetTexture() 21 | { 22 | return new CharTexture().AddLayer("∏", new Color(94, 61, 38)); 23 | } 24 | 25 | public override Recipe AddRecipe() 26 | { 27 | Recipe recipe = new Recipe(new Stack(this, 1)); 28 | recipe.AddIngredient(new Log(), 5); 29 | 30 | return recipe; 31 | } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /ConsoleAdventure/Content/Scripts/Items/content/materials/AlfisolItem.cs: -------------------------------------------------------------------------------- 1 | using ConsoleAdventure.Content.Scripts; 2 | using ConsoleAdventure.WorldEngine; 3 | using Microsoft.Xna.Framework; 4 | using System; 5 | using System.Collections.Generic; 6 | 7 | namespace ConsoleAdventure 8 | { 9 | [Serializable] 10 | public class AlfisolItem : PlaceableItem 11 | { 12 | public AlfisolItem() 13 | { 14 | name = Localization.GetTranslation("Transforms", "Alfisol"); 15 | description = GetDescription(); 16 | placeType = (int)VanillaTransforms.alfisol; 17 | AddTypeToMap(); 18 | } 19 | 20 | public override CharTexture GetTexture() 21 | { 22 | return new CharTexture().AddLayer("≈", new Color(54, 43, 32)); 23 | } 24 | } 25 | } -------------------------------------------------------------------------------- /ConsoleAdventure/Content/Scripts/Items/content/materials/BiotiteItem.cs: -------------------------------------------------------------------------------- 1 | using ConsoleAdventure.Content.Scripts; 2 | using ConsoleAdventure.WorldEngine; 3 | using Microsoft.Xna.Framework; 4 | using System; 5 | using System.Collections.Generic; 6 | 7 | namespace ConsoleAdventure 8 | { 9 | [Serializable] 10 | public class BiotiteItem : PlaceableItem 11 | { 12 | public BiotiteItem() 13 | { 14 | name = Localization.GetTranslation("Transforms", "Biotite"); 15 | description = GetDescription(); 16 | placeType = (int)VanillaTransforms.biotite; 17 | AddTypeToMap(); 18 | } 19 | 20 | public override CharTexture GetTexture() 21 | { 22 | return new CharTexture().AddLayer("≡", new Color(45, 45, 45)); 23 | } 24 | } 25 | } -------------------------------------------------------------------------------- /ConsoleAdventure/Content/Scripts/Items/content/materials/BlackSoilItem.cs: -------------------------------------------------------------------------------- 1 | using ConsoleAdventure.Content.Scripts; 2 | using ConsoleAdventure.WorldEngine; 3 | using Microsoft.Xna.Framework; 4 | using System; 5 | using System.Collections.Generic; 6 | 7 | namespace ConsoleAdventure 8 | { 9 | [Serializable] 10 | public class BlackSoilItem : PlaceableItem 11 | { 12 | public BlackSoilItem() 13 | { 14 | name = Localization.GetTranslation("Transforms", "BlackSoil"); 15 | description = GetDescription(); 16 | placeType = (int)VanillaTransforms.blackSoil; 17 | AddTypeToMap(); 18 | } 19 | 20 | public override CharTexture GetTexture() 21 | { 22 | return new CharTexture().AddLayer("≈", new Color(20, 20, 20)); 23 | } 24 | } 25 | } -------------------------------------------------------------------------------- /ConsoleAdventure/Content/Scripts/Items/content/materials/BrownIronOreItem.cs: -------------------------------------------------------------------------------- 1 | using ConsoleAdventure.Content.Scripts; 2 | using ConsoleAdventure.WorldEngine; 3 | using Microsoft.Xna.Framework; 4 | using System; 5 | using System.Collections.Generic; 6 | 7 | namespace ConsoleAdventure 8 | { 9 | [Serializable] 10 | public class BrownIronOreItem : PlaceableItem 11 | { 12 | public BrownIronOreItem() 13 | { 14 | name = Localization.GetTranslation("Transforms", "BrownIronOre"); 15 | description = GetDescription(); 16 | placeType = (int)VanillaTransforms.brownIronOre; 17 | AddTypeToMap(); 18 | } 19 | 20 | public override CharTexture GetTexture() 21 | { 22 | return new CharTexture().AddLayer("§", new Color(206, 83, 33)); 23 | } 24 | } 25 | } -------------------------------------------------------------------------------- /ConsoleAdventure/Content/Scripts/Items/content/materials/GraniteItem.cs: -------------------------------------------------------------------------------- 1 | using ConsoleAdventure.Content.Scripts; 2 | using ConsoleAdventure.WorldEngine; 3 | using Microsoft.Xna.Framework; 4 | using System; 5 | using System.Collections.Generic; 6 | 7 | namespace ConsoleAdventure 8 | { 9 | [Serializable] 10 | public class GraniteItem : PlaceableItem 11 | { 12 | public GraniteItem() 13 | { 14 | name = Localization.GetTranslation("Transforms", "Granite"); 15 | description = GetDescription(); 16 | placeType = (int)VanillaTransforms.granite; 17 | AddTypeToMap(); 18 | } 19 | 20 | public override CharTexture GetTexture() 21 | { 22 | return new CharTexture().AddLayer("#", new Color(45, 45, 45)); 23 | } 24 | } 25 | } -------------------------------------------------------------------------------- /ConsoleAdventure/Content/Scripts/Items/content/materials/IronBar.cs: -------------------------------------------------------------------------------- 1 | using ConsoleAdventure.Content.Scripts; 2 | using ConsoleAdventure.WorldEngine; 3 | using Microsoft.Xna.Framework; 4 | using System; 5 | using System.Collections.Generic; 6 | 7 | namespace ConsoleAdventure 8 | { 9 | [Serializable] 10 | public class IronBar : Item 11 | { 12 | public IronBar() 13 | { 14 | name = Localization.GetTranslation("Items", "IronBar"); 15 | description = GetDescription(); 16 | AddTypeToMap(); 17 | } 18 | 19 | public override CharTexture GetTexture() 20 | { 21 | return new CharTexture().AddLayer("▬", new(50, 50, 50), new(0, 4f), -0.2f) 22 | .AddLayer("▬", new(50, 50, 50), new(-1, 3), -0.2f) 23 | .AddLayer("▬", new(180, 180, 180), new(0, 1f), -0.2f) 24 | .AddLayer("▬", new(180, 180, 180), new(-1, 0), -0.2f) 25 | .AddLayer("─", Color.White, new(0, 2), -0.2f) 26 | .AddLayer("ˈ", Color.White, new(2, 8)); 27 | } 28 | 29 | public override Recipe AddRecipe() 30 | { 31 | Recipe recipe = new Recipe(new Stack(this, 1)); 32 | recipe.AddIngredient(new BrownIronOreItem(), 3); 33 | recipe.AddStation((int)VanillaTransforms.furnace); 34 | 35 | return recipe; 36 | } 37 | } 38 | } -------------------------------------------------------------------------------- /ConsoleAdventure/Content/Scripts/Items/content/materials/Log.cs: -------------------------------------------------------------------------------- 1 | using ConsoleAdventure.Content.Scripts; 2 | using ConsoleAdventure.WorldEngine; 3 | using Microsoft.Xna.Framework; 4 | using System; 5 | using System.Collections.Generic; 6 | 7 | namespace ConsoleAdventure 8 | { 9 | [Serializable] 10 | public class Log : PlaceableItem 11 | { 12 | public Log() 13 | { 14 | name = Localization.GetTranslation("Items", GetType().Name); 15 | description = GetDescription(); 16 | placeType = (int)VanillaTransforms.log; 17 | AddTypeToMap(); 18 | } 19 | 20 | public override CharTexture GetTexture() 21 | { 22 | return new CharTexture().AddLayer("⸗", new Color(94, 61, 38)); 23 | } 24 | 25 | public new string GetDescription() 26 | { 27 | return Localization.GetTranslation("ItemDescription", GetType().Name); 28 | } 29 | } 30 | } -------------------------------------------------------------------------------- /ConsoleAdventure/Content/Scripts/Items/content/materials/QuartzItem.cs: -------------------------------------------------------------------------------- 1 | using ConsoleAdventure.Content.Scripts; 2 | using ConsoleAdventure.WorldEngine; 3 | using Microsoft.Xna.Framework; 4 | using System; 5 | using System.Collections.Generic; 6 | 7 | namespace ConsoleAdventure 8 | { 9 | [Serializable] 10 | public class QuartzItem : PlaceableItem 11 | { 12 | public QuartzItem() 13 | { 14 | name = Localization.GetTranslation("Transforms", "Quartz"); 15 | description = GetDescription(); 16 | placeType = (int)VanillaTransforms.quartz; 17 | AddTypeToMap(); 18 | } 19 | 20 | public override CharTexture GetTexture() 21 | { 22 | return new CharTexture().AddLayer("◊", Color.White); 23 | } 24 | } 25 | } -------------------------------------------------------------------------------- /ConsoleAdventure/Content/Scripts/Items/content/materials/RubyItem.cs: -------------------------------------------------------------------------------- 1 | using ConsoleAdventure.Content.Scripts; 2 | using ConsoleAdventure.WorldEngine; 3 | using Microsoft.Xna.Framework; 4 | using System; 5 | using System.Collections.Generic; 6 | 7 | namespace ConsoleAdventure 8 | { 9 | [Serializable] 10 | public class RubyItem : PlaceableItem 11 | { 12 | public RubyItem() 13 | { 14 | name = Localization.GetTranslation("Transforms", "Ruby"); 15 | description = GetDescription(); 16 | placeType = (int)VanillaTransforms.ruby; 17 | AddTypeToMap(); 18 | } 19 | 20 | public override CharTexture GetTexture() 21 | { 22 | return new CharTexture().AddLayer("♦", new Color(200, 21, 110)); 23 | } 24 | } 25 | } -------------------------------------------------------------------------------- /ConsoleAdventure/Content/Scripts/Items/content/materials/SaltItem.cs: -------------------------------------------------------------------------------- 1 | using ConsoleAdventure.Content.Scripts; 2 | using ConsoleAdventure.WorldEngine; 3 | using Microsoft.Xna.Framework; 4 | using System; 5 | using System.Collections.Generic; 6 | 7 | namespace ConsoleAdventure 8 | { 9 | [Serializable] 10 | public class SaltItem : PlaceableItem 11 | { 12 | public SaltItem() 13 | { 14 | name = Localization.GetTranslation("Transforms", "Salt"); 15 | description = GetDescription(); 16 | placeType = (int)VanillaTransforms.salt; 17 | AddTypeToMap(); 18 | } 19 | 20 | public override CharTexture GetTexture() 21 | { 22 | return new CharTexture().AddLayer("∆", new Color(193, 157, 175)); 23 | } 24 | } 25 | } -------------------------------------------------------------------------------- /ConsoleAdventure/Content/Scripts/Items/content/materials/StoneItem.cs: -------------------------------------------------------------------------------- 1 | using ConsoleAdventure.Content.Scripts; 2 | using ConsoleAdventure.WorldEngine; 3 | using Microsoft.Xna.Framework; 4 | using System; 5 | using System.Collections.Generic; 6 | 7 | namespace ConsoleAdventure 8 | { 9 | [Serializable] 10 | public class StoneItem : PlaceableItem 11 | { 12 | public StoneItem() 13 | { 14 | name = Localization.GetTranslation("Transforms", "Stone"); 15 | description = GetDescription(); 16 | placeType = (int)VanillaTransforms.stone; 17 | AddTypeToMap(); 18 | } 19 | 20 | public override CharTexture GetTexture() 21 | { 22 | return new CharTexture().AddLayer("●", Color.Gray); 23 | } 24 | } 25 | } -------------------------------------------------------------------------------- /ConsoleAdventure/Content/Scripts/Items/content/materials/TreeSeed.cs: -------------------------------------------------------------------------------- 1 | using ConsoleAdventure.Content.Scripts; 2 | using ConsoleAdventure.WorldEngine; 3 | using Microsoft.Xna.Framework; 4 | using System; 5 | using System.Collections.Generic; 6 | 7 | namespace ConsoleAdventure 8 | { 9 | [Serializable] 10 | public class TreeSeed : PlaceableItem 11 | { 12 | public TreeSeed() 13 | { 14 | name = Localization.GetTranslation("Items", GetType().Name); 15 | description = GetDescription(); 16 | placeType = (int)VanillaTransforms.seedling; 17 | AddTypeToMap(); 18 | } 19 | 20 | public override CharTexture GetTexture() 21 | { 22 | return new CharTexture().AddLayer("•", new Color(94, 61, 38)); 23 | } 24 | 25 | //public new string GetDescription() 26 | //{ 27 | // return Localization.GetTranslation("ItemDescription", GetType().Name); 28 | //} 29 | } 30 | } -------------------------------------------------------------------------------- /ConsoleAdventure/Content/Scripts/Items/content/materials/WebItem.cs: -------------------------------------------------------------------------------- 1 | using ConsoleAdventure.Content.Scripts; 2 | using ConsoleAdventure.WorldEngine; 3 | using Microsoft.Xna.Framework; 4 | using System; 5 | using System.Collections.Generic; 6 | 7 | namespace ConsoleAdventure 8 | { 9 | [Serializable] 10 | public class WebItem : PlaceableItem 11 | { 12 | public WebItem() 13 | { 14 | name = Localization.GetTranslation("Transforms", "Web"); 15 | description = GetDescription(); 16 | placeType = (int)VanillaTransforms.web; 17 | AddTypeToMap(); 18 | } 19 | 20 | public override CharTexture GetTexture() 21 | { 22 | return new CharTexture().AddLayer("¼", new Color(120, 120, 120)); 23 | } 24 | } 25 | } -------------------------------------------------------------------------------- /ConsoleAdventure/Content/Scripts/Items/content/materials/ZoisiteItem.cs: -------------------------------------------------------------------------------- 1 | using ConsoleAdventure.Content.Scripts; 2 | using ConsoleAdventure.WorldEngine; 3 | using Microsoft.Xna.Framework; 4 | using System; 5 | using System.Collections.Generic; 6 | 7 | namespace ConsoleAdventure 8 | { 9 | [Serializable] 10 | public class ZoisiteItem : PlaceableItem 11 | { 12 | public ZoisiteItem() 13 | { 14 | name = Localization.GetTranslation("Transforms", "Zoisite"); 15 | description = GetDescription(); 16 | placeType = (int)VanillaTransforms.zoisite; 17 | AddTypeToMap(); 18 | } 19 | 20 | public override CharTexture GetTexture() 21 | { 22 | return new CharTexture().AddLayer("η", new Color(6, 61, 31)); 23 | } 24 | } 25 | } -------------------------------------------------------------------------------- /ConsoleAdventure/Content/Scripts/Items/content/tools/BombItem.cs: -------------------------------------------------------------------------------- 1 | using ConsoleAdventure.Content.Scripts; 2 | using ConsoleAdventure.WorldEngine; 3 | using Microsoft.Xna.Framework; 4 | using System; 5 | using System.Collections.Generic; 6 | 7 | namespace ConsoleAdventure 8 | { 9 | [Serializable] 10 | public class BombItem : PlaceableItem 11 | { 12 | public BombItem() 13 | { 14 | name = Localization.GetTranslation("Transforms", "Bomb"); 15 | description = GetDescription(); 16 | placeType = (int)VanillaTransforms.bomb; 17 | placeLayer = World.MobsLayerId; 18 | AddTypeToMap(); 19 | } 20 | 21 | public override CharTexture GetTexture() 22 | { 23 | return new CharTexture().AddLayer("B", Color.Red); 24 | } 25 | } 26 | } -------------------------------------------------------------------------------- /ConsoleAdventure/Content/Scripts/Items/content/tools/IronHammer.cs: -------------------------------------------------------------------------------- 1 | using ConsoleAdventure.Content.Scripts; 2 | using ConsoleAdventure.WorldEngine; 3 | using Microsoft.Xna.Framework; 4 | using System; 5 | using System.Collections.Generic; 6 | 7 | namespace ConsoleAdventure 8 | { 9 | [Serializable] 10 | public class IronHammer : Item 11 | { 12 | public IronHammer() 13 | { 14 | name = Localization.GetTranslation("Items", "IronHammer"); 15 | description = GetDescription(); 16 | hammer = 1; 17 | maxCount = 1; 18 | AddTypeToMap(); 19 | } 20 | 21 | public override CharTexture GetTexture() 22 | { 23 | return new CharTexture().AddLayer("/", new(94, 61, 38)).AddLayer("▬", Color.Gray, new(1, -2), 0.25f); 24 | } 25 | 26 | public override Recipe AddRecipe() 27 | { 28 | Recipe recipe = new Recipe(new Stack(this, 1)); 29 | recipe.AddIngredient(new IronBar(), 2); 30 | recipe.AddIngredient(new Log(), 1); 31 | recipe.AddStation((int)VanillaTransforms.anvil); 32 | 33 | return recipe; 34 | } 35 | } 36 | } -------------------------------------------------------------------------------- /ConsoleAdventure/Content/Scripts/Items/content/tools/IronPick.cs: -------------------------------------------------------------------------------- 1 | using ConsoleAdventure.Content.Scripts; 2 | using ConsoleAdventure.WorldEngine; 3 | using Microsoft.Xna.Framework; 4 | using System; 5 | using System.Collections.Generic; 6 | 7 | namespace ConsoleAdventure 8 | { 9 | [Serializable] 10 | public class IronPick : Item 11 | { 12 | public IronPick() 13 | { 14 | name = Localization.GetTranslation("Items", "IronPick"); 15 | description = GetDescription(); 16 | pick = 10; 17 | maxCount = 1; 18 | AddTypeToMap(); 19 | } 20 | 21 | public override CharTexture GetTexture() 22 | { 23 | return new CharTexture().AddLayer("/", new(94, 61, 38)).AddLayer("͡", Color.Gray); 24 | } 25 | 26 | public override Recipe AddRecipe() 27 | { 28 | Recipe recipe = new Recipe(new Stack(this, 1)); 29 | recipe.AddIngredient(new IronBar(), 3); 30 | recipe.AddIngredient(new Log(), 1); 31 | recipe.AddStation((int)VanillaTransforms.anvil); 32 | 33 | return recipe; 34 | } 35 | } 36 | } -------------------------------------------------------------------------------- /ConsoleAdventure/Content/Scripts/Items/content/weapons/IronSword.cs: -------------------------------------------------------------------------------- 1 | using ConsoleAdventure.Content.Scripts; 2 | using ConsoleAdventure.WorldEngine; 3 | using Microsoft.Xna.Framework; 4 | using System; 5 | using System.Collections.Generic; 6 | 7 | namespace ConsoleAdventure 8 | { 9 | [Serializable] 10 | public class IronSword : Item 11 | { 12 | public IronSword() 13 | { 14 | name = Localization.GetTranslation("Items", "IronSword"); 15 | description = GetDescription(); 16 | damage = 1; 17 | damageClass = 1; 18 | maxCount = 1; 19 | AddTypeToMap(); 20 | } 21 | 22 | public override CharTexture GetTexture() 23 | { 24 | return new CharTexture().AddLayer("̸", Color.Gray).AddLayer("₋", Color.Gray, new Vector2(4.5f, -0.7f), 0.4f); 25 | } 26 | 27 | public override Recipe AddRecipe() 28 | { 29 | Recipe recipe = new Recipe(new Stack(this, 1)); 30 | recipe.AddIngredient(new IronBar(), 6); 31 | recipe.AddStation((int)VanillaTransforms.anvil); 32 | 33 | return recipe; 34 | } 35 | } 36 | } -------------------------------------------------------------------------------- /ConsoleAdventure/Content/Scripts/Language.cs: -------------------------------------------------------------------------------- 1 | namespace ConsoleAdventure 2 | { 3 | public enum Language 4 | { 5 | english, 6 | russian, 7 | } 8 | } -------------------------------------------------------------------------------- /ConsoleAdventure/Content/Scripts/MapChunk.cs: -------------------------------------------------------------------------------- 1 | using ConsoleAdventure.WorldEngine; 2 | using Microsoft.Xna.Framework; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Linq; 6 | using System.Text; 7 | using System.Threading.Tasks; 8 | 9 | namespace ConsoleAdventure.Content.Scripts 10 | { 11 | internal struct MapChunk 12 | { 13 | public MapField?[,,] fields; 14 | 15 | public MapChunk() 16 | { 17 | fields = new MapField?[Chunk.Size, Chunk.Size, Chunk.maxDeep]; 18 | } 19 | } 20 | 21 | public struct MapField // 22 | { 23 | public Color color; 24 | 25 | public MapField(Color color, byte lighting) 26 | { 27 | this.color = color; 28 | this.color.A = lighting; 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /ConsoleAdventure/Content/Scripts/Player/Cursor.cs: -------------------------------------------------------------------------------- 1 | using ConsoleAdventure.Content.Scripts.InputLogic; 2 | 3 | namespace ConsoleAdventure.Content.Scripts.Player; 4 | 5 | public class Cursor 6 | { 7 | public Position CursorPosition; 8 | public bool IsActive { get; set; } 9 | 10 | public static Cursor Instance => _instance; 11 | 12 | private static Cursor _instance; 13 | 14 | public Cursor() 15 | { 16 | CursorPosition = Position.Zero(); 17 | 18 | if (_instance == null) 19 | { 20 | _instance = this; 21 | } 22 | } 23 | 24 | public void Toggle() 25 | { 26 | if (IsActive) IsActive = false; 27 | else IsActive = true; 28 | } 29 | 30 | public void CursorMovement() 31 | { 32 | if (Input.IsKeyDown(InputConfig.CursorUp) && CursorPosition.y > -2) 33 | { 34 | CursorPosition.SetPosition(CursorPosition.x, CursorPosition.y - 1); 35 | } 36 | 37 | if (Input.IsKeyDown(InputConfig.CursorDown) && CursorPosition.y < 2) 38 | { 39 | CursorPosition.SetPosition(CursorPosition.x, CursorPosition.y + 1); 40 | } 41 | 42 | if (Input.IsKeyDown(InputConfig.CursorLeft) && CursorPosition.x > -2) 43 | { 44 | CursorPosition.SetPosition(CursorPosition.x - 1, CursorPosition.y); 45 | } 46 | 47 | if (Input.IsKeyDown(InputConfig.CursorRight) && CursorPosition.x < 2) 48 | { 49 | CursorPosition.SetPosition(CursorPosition.x + 1, CursorPosition.y); 50 | } 51 | } 52 | } -------------------------------------------------------------------------------- /ConsoleAdventure/Content/Scripts/Player/PlayerInfo.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | 5 | namespace ConsoleAdventure.Content.Scripts.Player; 6 | 7 | public class PlayerInfo 8 | { 9 | public short Id; 10 | public string pcId; 11 | public string Name = "William"; 12 | 13 | public PlayerInfo(Dictionary data) 14 | { 15 | data.TryGetValue("name", out Name); 16 | data.TryGetValue("pcId", out pcId); 17 | string strId = ""; 18 | data.TryGetValue("id", out strId); 19 | Id = Int16.Parse(strId); 20 | } 21 | 22 | public PlayerInfo() 23 | { 24 | 25 | } 26 | } -------------------------------------------------------------------------------- /ConsoleAdventure/Content/Scripts/Player/PlayerMovement.cs: -------------------------------------------------------------------------------- 1 | using ConsoleAdventure.Content.Scripts.InputLogic; 2 | 3 | namespace ConsoleAdventure.Content.Scripts.Player; 4 | 5 | public class PlayerMovement 6 | { 7 | public bool isMoving { get; private set; } 8 | public int speed { get; set; } 9 | 10 | private int x; 11 | private int y; 12 | 13 | private Position _direction; 14 | 15 | public PlayerMovement(int speed = 1) 16 | { 17 | this.speed = speed; 18 | } 19 | 20 | public void Move(Transform target) 21 | { 22 | target.Move(speed, GetDirection()); 23 | } 24 | 25 | private Position GetDirection() 26 | { 27 | x = 0; 28 | y = 0; 29 | 30 | _direction = Position.Zero(); 31 | 32 | _direction.x = (short)Input.GetHorizontalMovement(); 33 | _direction.y = (short)Input.GetVerticalMovement(); 34 | 35 | if (x != 0 || y != 0) 36 | { 37 | isMoving = true; 38 | } 39 | 40 | return _direction; 41 | } 42 | } -------------------------------------------------------------------------------- /ConsoleAdventure/Content/Scripts/Settings/Docs.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace ConsoleAdventure.Settings 4 | { 5 | public static class Docs 6 | { 7 | public static string version = "0.5v pre alpha"; 8 | private static string info; 9 | private static List messages = new List(); 10 | public static string GetInfo() 11 | { 12 | info = TextAssets.Version + version; 13 | return info; 14 | } 15 | 16 | public static void AddMessage(MessageType type, string message) 17 | { 18 | messages.Add(message); 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /ConsoleAdventure/Content/Scripts/Settings/ExceptionLogger.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.IO; 3 | 4 | namespace ConsoleAdventure.Content.Scripts.Settings 5 | { 6 | public class ExceptionLogger 7 | { 8 | private readonly string logsPath; 9 | private readonly string logFilePath; 10 | private string oldText = ""; 11 | 12 | public ExceptionLogger(string logFileName) 13 | { 14 | logFilePath = Program.savePath + "Logs\\"; 15 | 16 | logsPath = logFilePath; 17 | 18 | if (!Directory.Exists(logFilePath)) 19 | { 20 | Directory.CreateDirectory(logFilePath); 21 | } 22 | 23 | logFilePath += logFileName; 24 | 25 | if (!File.Exists(logFilePath)) 26 | { 27 | File.Create(logFilePath).Dispose(); 28 | } 29 | 30 | AddText("------------------------------------------\n"); 31 | } 32 | 33 | public void AddText(string text) 34 | { 35 | try 36 | { 37 | TryLogExist(); 38 | File.AppendAllText(logFilePath, text); 39 | Console.Write(text); 40 | } 41 | catch 42 | { 43 | 44 | } 45 | } 46 | 47 | public void AddMessage(string message) 48 | { 49 | AddText($"{DateTime.Now}: {message}\n"); 50 | } 51 | 52 | public void AddException(string error) 53 | { 54 | string exceptionMessage = $"{DateTime.Now}: [EXCEPTION] {error}"; 55 | AddText(exceptionMessage + Environment.NewLine); 56 | } 57 | 58 | public void AddException(Exception ex) 59 | { 60 | string exceptionMessage = $"{DateTime.Now}: [EXCEPTION] {ex.GetType()}: {ex.Message}\n{ex.InnerException}\n{ex.StackTrace}\n{ex.Source}\n{ex.TargetSite}"; 61 | AddText(exceptionMessage + Environment.NewLine); 62 | } 63 | 64 | private void TryLogExist() 65 | { 66 | if (!Directory.Exists(logsPath)) 67 | { 68 | Directory.CreateDirectory(logsPath); 69 | } 70 | 71 | if (!File.Exists(logFilePath)) 72 | { 73 | File.Create(logFilePath).Dispose(); 74 | } 75 | } 76 | } 77 | } 78 | -------------------------------------------------------------------------------- /ConsoleAdventure/Content/Scripts/Settings/Loger.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace ConsoleAdventure.Settings 4 | { 5 | public static class Loger 6 | { 7 | static List logs = new List(); 8 | 9 | public static int buffer = 10; 10 | 11 | public static void AddLog(string log) 12 | { 13 | logs.Add(log); 14 | if (logs.Count > buffer) 15 | { 16 | logs.RemoveAt(0); 17 | } 18 | } 19 | 20 | public static void ClearLogs() 21 | { 22 | logs.Clear(); 23 | } 24 | 25 | public static string GetLogs() 26 | { 27 | string output = string.Empty; 28 | if (logs.Count > 0) 29 | { 30 | output += "Logs:\n"; 31 | } 32 | for (int i = 0; i < logs.Count; i++) 33 | { 34 | output += $"{logs[logs.Count - i - 1]}\n"; 35 | } 36 | return output; 37 | } 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /ConsoleAdventure/Content/Scripts/Settings/MessageType.cs: -------------------------------------------------------------------------------- 1 | namespace ConsoleAdventure.Settings 2 | { 3 | public enum MessageType { 4 | info, 5 | error, 6 | warning 7 | } 8 | } -------------------------------------------------------------------------------- /ConsoleAdventure/Content/Scripts/SineNoise.cs: -------------------------------------------------------------------------------- 1 | using ConsoleAdventure.Content.Scripts.WorldEngine; 2 | using Microsoft.Xna.Framework; 3 | using System; 4 | 5 | namespace ConsoleAdventure.Content.Scripts 6 | { 7 | [Serializable] 8 | public struct SineNoise 9 | { 10 | public int size = 0; 11 | public float simplexScale = 1; 12 | public float height = 1; 13 | public float width = 1; 14 | public float xOffset = 1; 15 | public float yOffset = 1; 16 | public NoiseBuffer noise = new NoiseBuffer(); 17 | 18 | public SineNoise(int size, float simplexScale, float height, float width, float yOffset, float xOffset, NoiseBuffer noise) 19 | { 20 | this.size = size; 21 | this.simplexScale = simplexScale; 22 | this.height = height; 23 | this.width = width; 24 | this.xOffset = xOffset; 25 | this.yOffset = yOffset; 26 | this.noise = noise; 27 | } 28 | 29 | public float GetValue(int x, int y) 30 | { 31 | float X = x; 32 | float Y = ((float)y) / ((float)size) - 0.5f; 33 | 34 | float simplexValue = Math.Abs(noise.FractalSimplex2(0, X * simplexScale)); 35 | float simplex2Value = Math.Abs(noise.FractalSimplex2(16, X * simplexScale)); 36 | float value = Function(Y, height + (simplexValue * xOffset), width + (simplex2Value * yOffset)); 37 | 38 | if (value > width * 2) value = 1; 39 | else if (value < 0) value = 0; 40 | 41 | return value; 42 | } 43 | 44 | private static float Function(float x, float height, float width) 45 | { 46 | if (x * width <= 1f && x * width >= -1f) 47 | return height * MathF.Cos(MathHelper.Pi * x * width) + height; 48 | 49 | return 0; 50 | } 51 | } 52 | } -------------------------------------------------------------------------------- /ConsoleAdventure/Content/Scripts/UI/CharPaintUtil/CharPaint.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace ConsoleAdventure.Content.Scripts.UI.CharPaintUtil 8 | { 9 | internal class CharPaint 10 | { 11 | //public static 12 | 13 | public static void Init() 14 | { 15 | 16 | } 17 | 18 | public static void Updater() 19 | { 20 | 21 | } 22 | 23 | public static void Draw() 24 | { 25 | 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /ConsoleAdventure/Content/Scripts/UI/ChestUI.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Xna.Framework; 2 | using Microsoft.Xna.Framework.Graphics; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Linq; 6 | using System.Text; 7 | using System.Threading.Tasks; 8 | 9 | namespace ConsoleAdventure.Content.Scripts.UI 10 | { 11 | public class ChestUI 12 | { 13 | public InfoPanel panel; 14 | 15 | public string items; 16 | 17 | public ChestUI(Point position, string items) 18 | { 19 | this.items = items; 20 | panel = new InfoPanel(new(10, 40, position.X, position.Y), "Chest", items); 21 | } 22 | 23 | public void Draw(SpriteBatch spriteBatch) 24 | { 25 | panel.Draw(spriteBatch); 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /ConsoleAdventure/Content/Scripts/UI/InfoPanel.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Xna.Framework; 2 | using Microsoft.Xna.Framework.Graphics; 3 | 4 | namespace ConsoleAdventure.Content.Scripts.UI 5 | { 6 | public class InfoPanel : BaseUI 7 | { 8 | string name = ""; 9 | Texture2D pixel; 10 | public bool isVisible { get; set; } 11 | 12 | private Color nameColor; 13 | private Color textColor; 14 | 15 | public InfoPanel(Rectangle rectangle, string name, string text, Color? nameColor = null, Color? textColor = null) : base(rectangle, Color.White) 16 | { 17 | this.name = name; 18 | this.text = text; 19 | this.isVisible = true; 20 | 21 | pixel = new Texture2D(ConsoleAdventure._graphics.GraphicsDevice, 1, 1); 22 | pixel.SetData(new Color[] { Color.Black }); 23 | 24 | if (nameColor == null) nameColor = Color.White; 25 | if (textColor == null) textColor = Color.White; 26 | 27 | this.nameColor = (Color)nameColor; 28 | this.textColor = (Color)textColor; 29 | } 30 | 31 | public override void Draw(SpriteBatch spriteBatch) 32 | { 33 | if (!isVisible) return; 34 | 35 | SpriteFont font = ConsoleAdventure.Font; 36 | 37 | spriteBatch.Draw(pixel, new Rectangle((int)Position.X, (int)Position.Y, rectangle.Width * 9, rectangle.Height * 19), Color.White); 38 | spriteBatch.DrawFrame(font, Utils.GetPanel(new(rectangle.Width, rectangle.Height), 0), Position, Color.White); 39 | spriteBatch.DrawFrame(font, Utils.GetPanel(new(rectangle.Width, 3), 0), Position, Color.White); 40 | 41 | spriteBatch.DrawString(font, name, Position + (new Vector2(9 * 8, 19 * 1)), nameColor); 42 | spriteBatch.DrawString(font, text, Position + (new Vector2(9 * 3, 19 * 3)), textColor); 43 | } 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /ConsoleAdventure/Content/Scripts/UI/Menu/ControlConfig.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Xna.Framework; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | 8 | namespace ConsoleAdventure.Content.Scripts.UI 9 | { 10 | internal class ControlConfig : ListUI 11 | { 12 | public ControlConfig(string text, Vector2 position, List elements, Color color) : base(text, position, elements, color) 13 | { 14 | } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /ConsoleAdventure/Content/Scripts/UI/Menu/KeyPanel.cs: -------------------------------------------------------------------------------- 1 | using ConsoleAdventure.Content.Scripts.InputLogic; 2 | using Microsoft.Xna.Framework; 3 | using Microsoft.Xna.Framework.Graphics; 4 | using Microsoft.Xna.Framework.Input; 5 | using System.Collections.Generic; 6 | using System.Linq; 7 | using System.Text; 8 | using System.Threading.Tasks; 9 | using System.Xml.Linq; 10 | 11 | namespace ConsoleAdventure.Content.Scripts.UI 12 | { 13 | internal class KeyPanel : BaseUI 14 | { 15 | public Color cursorColor = Color.White; 16 | 17 | public Key key; 18 | 19 | public bool flag; 20 | 21 | public KeyPanel(Rectangle rectangle, Key key) : base(rectangle, Color.White) 22 | { 23 | this.key = key; 24 | } 25 | 26 | public override void Draw(SpriteBatch spriteBatch) 27 | { 28 | if (flag && isHover) 29 | { 30 | Keys[] ks = ConsoleAdventure.kstate.GetPressedKeys(); 31 | if (ks.Length > 0) 32 | { 33 | Keys k = ks[0]; 34 | if (k != Keys.None) 35 | { 36 | key.key = k; 37 | SettingsSystem.SetSetting("Control", key.name, (int)key.key); 38 | flag = false; 39 | } 40 | } 41 | } 42 | 43 | SpriteFont font = ConsoleAdventure.Font; 44 | 45 | if (isHover) 46 | { 47 | cursorColor = Color.Yellow; 48 | spriteBatch.DrawString(font, ">", Position + (new Vector2(-9, 8)), Color.Yellow); 49 | } 50 | 51 | else cursorColor = Color.White; 52 | 53 | spriteBatch.DrawFrame(font, Utils.GetPanel(new(80, 2), 0), Position, cursorColor); 54 | spriteBatch.DrawFrame(font, Utils.GetPanel(new(55, 2), 0), Position, cursorColor); 55 | 56 | spriteBatch.DrawString(font, Localization.GetTranslation("KeysConfig", key.name), Position + (new Vector2(9, 8)), Color.White); 57 | 58 | if (!flag) 59 | { 60 | spriteBatch.DrawString(font, Localization.GetTranslation("Keys", key.key.ToString()), Position + (new Vector2((55 * 9), 8)), ((int)key.key) == 0 ? Color.Gray : Color.White); 61 | } 62 | } 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /ConsoleAdventure/Content/Scripts/UI/Menu/MenuButton.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Xna.Framework; 2 | using Microsoft.Xna.Framework.Graphics; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Linq; 6 | using System.Text; 7 | using System.Threading.Tasks; 8 | 9 | namespace ConsoleAdventure.Content.Scripts.UI 10 | { 11 | internal class MenuButton : BaseUI 12 | { 13 | public Color cursorColor = Color.Yellow; 14 | 15 | public byte type; 16 | 17 | public MenuButton(Vector2 position, string kay, Color color, byte type) : base(position, color, kay) 18 | { 19 | this.type = type; 20 | } 21 | 22 | public override void Draw(SpriteBatch spriteBatch) 23 | { 24 | base.Draw(spriteBatch); 25 | 26 | if (isHover) 27 | { 28 | spriteBatch.DrawString(ConsoleAdventure.Font, "<", Position - new Vector2(10, 0), cursorColor, 0, Vector2.Zero, 1, 0, 0); 29 | spriteBatch.DrawString(ConsoleAdventure.Font, ">", Position + new Vector2(rectangle.Width + 2, 0), cursorColor, 0, Vector2.Zero, 1, 0, 0); 30 | } 31 | } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /ConsoleAdventure/Content/Scripts/UI/Menu/MenuState.cs: -------------------------------------------------------------------------------- 1 | namespace ConsoleAdventure.Content.Scripts.UI 2 | { 3 | public enum MenuState 4 | { 5 | mainScreen, 6 | worldMenu, 7 | settings, 8 | aboutGame, 9 | aboutControl, 10 | mods, 11 | worldLoadingProgress, 12 | worldGenProgress, 13 | wordGenMenu, 14 | modCreateMenu, 15 | modDescription, 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /ConsoleAdventure/Content/Scripts/UI/ProgressBar.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Xna.Framework; 2 | using Microsoft.Xna.Framework.Graphics; 3 | 4 | namespace ConsoleAdventure.Content.Scripts.UI 5 | { 6 | public class ProgressBar : Bar 7 | { 8 | private static string[] loadAnimFrames = {"-", "/", "|", @"\" }; 9 | 10 | public const bool PercentLeft = true; 11 | public const bool PercentRight = false; 12 | 13 | bool percentPos; 14 | 15 | public string stepText = "load"; 16 | 17 | public ProgressBar(Rectangle rectangle, Color color, uint size, bool percentPos) : base(rectangle, color, size) 18 | { 19 | this.percentPos = percentPos; 20 | } 21 | 22 | public ProgressBar(Vector2 position, Color color, uint size, bool percentPos) : base(position, color, size) 23 | { 24 | this.percentPos = percentPos; 25 | } 26 | 27 | int timer; 28 | public override void Draw(SpriteBatch spriteBatch) 29 | { 30 | base.Draw(spriteBatch); 31 | 32 | int num = (int)(((float)Progress / (float)Size) * 100f); 33 | 34 | string text = stepText + " "; 35 | string percent = num + "%"; 36 | string loadAnimation = loadAnimFrames[(timer / 4) % 4]; 37 | 38 | if(percentPos) 39 | text += percent + " "; 40 | else 41 | loadAnimation = percent + " " + loadAnimation; 42 | 43 | SpriteFont font = ConsoleAdventure.Font; 44 | spriteBatch.DrawString(font, text, Position - new Vector2(font.MeasureString(text).X + 9, 0), Color.White); 45 | spriteBatch.DrawString(font, loadAnimation, Position + new Vector2(SizeInPixel.X + 18, 0), Color.White); 46 | 47 | timer++; 48 | } 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /ConsoleAdventure/Content/Scripts/UI/WorldPanel.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Xna.Framework; 2 | using Microsoft.Xna.Framework.Graphics; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Linq; 6 | using System.Text; 7 | using System.Threading.Tasks; 8 | using System.Xml.Linq; 9 | 10 | namespace ConsoleAdventure.Content.Scripts.UI 11 | { 12 | internal class WorldPanel : BaseUI 13 | { 14 | public Color cursorColor = Color.White; 15 | 16 | public int curssor = 0; 17 | 18 | internal string name = ""; 19 | 20 | internal string seed = ""; 21 | 22 | public WorldPanel(Rectangle rectangle, string name, string seed) : base(rectangle, Color.White) 23 | { 24 | this.name = name; 25 | this.seed = seed; 26 | } 27 | 28 | public override void Draw(SpriteBatch spriteBatch) 29 | { 30 | SpriteFont font = ConsoleAdventure.Font; 31 | 32 | if(isHover) 33 | { 34 | cursorColor = Color.Yellow; 35 | spriteBatch.DrawString(font, "^", Position + (new Vector2(9 * (39 + (curssor * 2)), 19 * 2)), Color.Yellow); 36 | } 37 | 38 | else 39 | { 40 | cursorColor = Color.White; 41 | } 42 | 43 | spriteBatch.DrawFrame(font, Utils.GetPanel(new(46, 4), 0), Position, cursorColor); 44 | spriteBatch.DrawFrame(font, Utils.GetPanel(new(7, 4), 0), Position, cursorColor); 45 | spriteBatch.DrawString(font, " Λ \n╱ ╲", Position + (new Vector2(14, 19) * 1), Color.White); 46 | 47 | spriteBatch.DrawString(font, TextAssets.Name + name, Position + (new Vector2(9 * 8, 19 * 1)), Color.White); 48 | spriteBatch.DrawString(font, TextAssets.Seed + seed, Position + (new Vector2(9 * 8, 19 * 2)), Color.White); 49 | 50 | spriteBatch.DrawString(font, "►", Position + (new Vector2(9 * 39, 19 * 1)), Color.White); 51 | spriteBatch.DrawString(font, "≡", Position + (new Vector2(9 * 41, 19 * 1)), Color.White); 52 | spriteBatch.DrawString(font, "Ս", Position + (new Vector2(9 * 43, 19 * 1)), Color.White); 53 | } 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /ConsoleAdventure/Content/Scripts/WorldEngine/Biomes/Biome.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace ConsoleAdventure.WorldEngine 8 | { 9 | public abstract class Biome 10 | { 11 | public List transformTypes = new(); 12 | public int minCountForCreate; 13 | 14 | protected Biome() 15 | { 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /ConsoleAdventure/Content/Scripts/WorldEngine/Chunk.cs: -------------------------------------------------------------------------------- 1 | using ConsoleAdventure.WorldEngine; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | 8 | namespace ConsoleAdventure.WorldEngine 9 | { 10 | public class Chunk 11 | { 12 | protected short biome; 13 | public bool IsUpdated { get; internal set; } = false; 14 | public static int Size { get; internal set; } = 16; 15 | public static int maxDeep { get; internal set; } = 2; 16 | 17 | public virtual Field GetField(int x, int y, int z, int w) 18 | { 19 | return null; 20 | } 21 | 22 | public virtual void SetField(int x, int y, int layer, int w, Field field) 23 | { 24 | } 25 | 26 | public virtual short GetBiome() 27 | { 28 | return biome; 29 | } 30 | public virtual Field[,,,] GetFields() 31 | { 32 | return null; 33 | } 34 | 35 | public bool IsValidCoordinate(int x, int y, int z, int w) 36 | { 37 | return x >= 0 && x < Size && 38 | y >= 0 && y < Size && 39 | z >= 0 && z < World.CountOfLayers && 40 | w >= 0 && w < maxDeep; 41 | } 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /ConsoleAdventure/Content/Scripts/WorldEngine/Events/GameEvent.cs: -------------------------------------------------------------------------------- 1 | using ConsoleAdventure.Content.Scripts.Debug.Commands; 2 | using ConsoleAdventure.Settings; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Linq; 6 | using System.Reflection; 7 | using System.Text; 8 | using System.Threading.Tasks; 9 | 10 | namespace ConsoleAdventure.Content.Scripts.WorldEngine.Events 11 | { 12 | public class GameEvent 13 | { 14 | public static List Events = new List(); 15 | 16 | public static void AddEvent(GameEvent evt) 17 | { 18 | if (!Events.Contains(evt)) 19 | Events.Add(evt); 20 | } 21 | 22 | public static void InitEvents() 23 | { 24 | Events.Clear(); 25 | 26 | Type baseType = typeof(GameEvent); 27 | IEnumerable list = Assembly.GetAssembly(baseType).GetTypes().Where(type => type.IsSubclassOf(baseType)); 28 | 29 | foreach (Type type in list) 30 | { 31 | GameEvent gameEvent = (GameEvent)Activator.CreateInstance(type); 32 | gameEvent.Init(); 33 | AddEvent(gameEvent); 34 | } 35 | 36 | Loger.AddLog("Events inited: " + Events.Count.ToString()); 37 | } 38 | 39 | public virtual void Init() 40 | { 41 | 42 | } 43 | 44 | public virtual bool IsActive() 45 | { 46 | return false; 47 | } 48 | 49 | public virtual void Update() 50 | { 51 | 52 | } 53 | 54 | public virtual void Draw() 55 | { 56 | 57 | } 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /ConsoleAdventure/Content/Scripts/WorldEngine/Field.cs: -------------------------------------------------------------------------------- 1 | using ConsoleAdventure.Content.Scripts; 2 | using ConsoleAdventure.Content.Scripts.IO; 3 | using Microsoft.Xna.Framework; 4 | using System; 5 | using System.Collections.Generic; 6 | 7 | namespace ConsoleAdventure.WorldEngine 8 | { 9 | [Serializable] 10 | public class Field 11 | { 12 | public bool isStructure = false; 13 | 14 | private Transform content_; 15 | 16 | public Transform content 17 | { 18 | get 19 | { 20 | return content_; 21 | } 22 | set 23 | { 24 | if (content_ != null) 25 | Transform.UpdatedChunk(content_.position, content_.worldLayer); 26 | 27 | content_ = value; 28 | } 29 | } 30 | 31 | public void Destroy() 32 | { 33 | if (content != null) 34 | content.OnDestroy(); 35 | content = null; 36 | } 37 | 38 | public string GetSymbol() 39 | { 40 | if (content == null) return " "; 41 | 42 | else return content.GetSymbol(); 43 | } 44 | 45 | internal void Deconstruct() 46 | { 47 | throw new NotImplementedException(); 48 | } 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /ConsoleAdventure/Content/Scripts/WorldEngine/Generate/EmptyGenerator.cs: -------------------------------------------------------------------------------- 1 | using ConsoleAdventure.Content.Scripts.IO; 2 | using ConsoleAdventure.WorldEngine; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Linq; 6 | using System.Text; 7 | using System.Threading.Tasks; 8 | 9 | namespace ConsoleAdventure.WorldEngine.Generate 10 | { 11 | public class EmptyGenerator 12 | { 13 | // cx, cy = Левый верхний угол чанка 14 | // setBlock = метод для установки блока или чего либо еще 15 | internal void ChunkGeneration(int cx, int cy, Action setBlock) 16 | { 17 | for (int i = 0; i < Chunk.Size; i++) 18 | { 19 | for (int j = 0; j < Chunk.Size; j++) 20 | { 21 | setBlock(cx * Chunk.Size + i, cy * Chunk.Size + j); 22 | } 23 | } 24 | } 25 | 26 | internal void IterateWorldChunkByChunk(World world, Action setBlock) 27 | { 28 | int chunksInWorld = (world.size / Chunk.Size); 29 | 30 | for (int ci = 0; ci < world.size / Chunk.Size; ci++) 31 | { 32 | for (int cj = 0; cj < world.size / Chunk.Size; cj++) 33 | { 34 | ChunkGeneration(ci, cj, setBlock); 35 | //processProgress = (int)((float)(ci * chunksInWorld + cj) / (chunksInWorld * chunksInWorld) * 100); 36 | } 37 | } 38 | } 39 | 40 | public virtual async Task Generate(World world, Position startPosition, Position chunkPosition, Tags genProperties) 41 | { 42 | 43 | } 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /ConsoleAdventure/Content/Scripts/WorldEngine/Generate/Properties/NoisesProperties.cs: -------------------------------------------------------------------------------- 1 | using ConsoleAdventure.Content.Scripts; 2 | using ConsoleAdventure.Content.Scripts.IO; 3 | using ConsoleAdventure.Content.Scripts.WorldEngine; 4 | using ConsoleAdventure.Content.Scripts.WorldEngine.Generate; 5 | using ConsoleAdventure.Generate.Structures; 6 | using ConsoleAdventure.Settings; 7 | using Microsoft.Xna.Framework; 8 | using SharpDX.Direct2D1.Effects; 9 | using System; 10 | using System.Collections.Generic; 11 | using System.Drawing; 12 | using System.Threading.Tasks; 13 | 14 | namespace ConsoleAdventure.WorldEngine.Generate 15 | { 16 | public class NoisesProperties : WorldPropertiesGenerator 17 | { 18 | public override async Task UpdateWorldProperties(Tags tags, World world) 19 | { 20 | await base.UpdateWorldProperties(tags, world); 21 | processHint = Localization.GetTranslation("Progress", "CreateNoises"); 22 | processProgress = 100; 23 | 24 | NoiseBuffer landspaceNoise = new NoiseBuffer(world.seed, 6, 0.5, 3.8); 25 | float landspaceScale = 0.00005f; 26 | tags["LandspaceNoise"] = landspaceNoise; 27 | tags["LandspaceScale"] = landspaceScale; 28 | 29 | tags["ClimaticNoise"] = new SineNoise(world.size / Chunk.Size, landspaceScale, 0.3f, 2f, 1f, 1f, landspaceNoise); 30 | 31 | tags["ForestNoise"] = new NoiseBuffer(world.seed, 6, 0.5, 3.8); 32 | tags["ForestScale"] = 0.0005f; 33 | 34 | 35 | processProgress = 0; 36 | processHint = Localization.GetTranslation("Progress", "DeterminationHeights"); 37 | processProgress = 100; 38 | 39 | tags["PlateBoundary"] = Generator.GenRand.NextFloat(-0.2f, -0.4f); 40 | 41 | float seaLevel = Generator.GenRand.NextFloat(-0.05f, 0.15f); 42 | tags["SeaLevel"] = seaLevel; 43 | tags["BeachLevel"] = Generator.GenRand.NextFloat(seaLevel + 0.005f, seaLevel + 0.05f); 44 | } 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /ConsoleAdventure/Content/Scripts/WorldEngine/Generate/Structures/Structure.cs: -------------------------------------------------------------------------------- 1 | namespace ConsoleAdventure.Generate.Structures 2 | { 3 | public abstract class Structure 4 | { 5 | public string name { get; set; } 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /ConsoleAdventure/Content/Scripts/WorldEngine/Generate/Structures/StructureMap.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Xna.Framework; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | 8 | namespace ConsoleAdventure.Generate.Structures 9 | { 10 | public static class StructureMap 11 | { 12 | public static List Structures { get; private set; } = new List(); 13 | } 14 | 15 | public struct StructureUnit 16 | { 17 | public int x; 18 | public int y; 19 | public int w; 20 | 21 | public int width; 22 | public int height; 23 | 24 | public string name; 25 | 26 | public StructureUnit(int x, int y, int w, int width, int height, string name) 27 | { 28 | this.x = x; 29 | this.y = y; 30 | this.w = w; 31 | this.width = width; 32 | this.height = height; 33 | this.name = name; 34 | } 35 | 36 | public bool IsInside(int x, int y, int w) 37 | { 38 | return (w == this.w && x > this.x && y > this.y && x < this.x + width && y < this.y + height); 39 | } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /ConsoleAdventure/Content/Scripts/WorldEngine/Generate/WorldPropertiesGenerator.cs: -------------------------------------------------------------------------------- 1 | using ConsoleAdventure.Content.Scripts.IO; 2 | using ConsoleAdventure.WorldEngine; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Linq; 6 | using System.Text; 7 | using System.Threading.Tasks; 8 | 9 | namespace ConsoleAdventure.Content.Scripts.WorldEngine.Generate 10 | { 11 | public class WorldPropertiesGenerator 12 | { 13 | public string processHint 14 | { 15 | get 16 | { 17 | return processHint; 18 | } 19 | set 20 | { 21 | ConsoleAdventure.progressBar.stepText = value; 22 | } 23 | } 24 | public int processProgress 25 | { 26 | get 27 | { 28 | return processProgress; 29 | } 30 | set 31 | { 32 | ConsoleAdventure.progressBar.Progress = (uint)value; 33 | } 34 | } 35 | 36 | public virtual async Task UpdateWorldProperties(Tags tags, World world) 37 | { 38 | processHint = "Generate something?.."; 39 | processProgress = 0; 40 | } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /ConsoleAdventure/Content/Scripts/WorldEngine/IWorldObject.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Xna.Framework; 2 | 3 | namespace ConsoleAdventure.WorldEngine 4 | { 5 | public interface IWorldObject 6 | { 7 | void Initialize(); 8 | void Collapse(); 9 | string GetSymbol(); 10 | Color GetColor(); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /ConsoleAdventure/Content/Scripts/WorldEngine/Levels/Cavern.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace ConsoleAdventure.WorldEngine.Levels 8 | { 9 | public class Cavern : WorldLevel 10 | { 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /ConsoleAdventure/Content/Scripts/WorldEngine/Levels/LavaCavern.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace ConsoleAdventure.WorldEngine.Levels 8 | { 9 | public class LavaCavern : WorldLevel 10 | { 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /ConsoleAdventure/Content/Scripts/WorldEngine/Levels/Sedimentary.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace ConsoleAdventure.WorldEngine.Levels 8 | { 9 | public class Sedimentary : WorldLevel 10 | { 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /ConsoleAdventure/Content/Scripts/WorldEngine/Levels/Surface.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace ConsoleAdventure.WorldEngine.Levels 8 | { 9 | public class Surface : WorldLevel 10 | { 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /ConsoleAdventure/Content/Scripts/WorldEngine/Levels/UnloadWorldLevel.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace ConsoleAdventure.WorldEngine.Levels 8 | { 9 | public class UnloadWorldLevel : WorldLevel 10 | { 11 | public string Name { get; set; } 12 | } 13 | } -------------------------------------------------------------------------------- /ConsoleAdventure/Content/Scripts/WorldEngine/LoadedChunk.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | 4 | namespace ConsoleAdventure.WorldEngine 5 | { 6 | [Serializable] 7 | public class LoadedChunk : Chunk 8 | { 9 | private readonly Field[,,,] fields; 10 | 11 | public bool IsPlayer { get; internal set; } 12 | public int OherUpdCount { get; internal set; } 13 | 14 | public LoadedChunk() 15 | { 16 | fields = InitializeFields(); 17 | } 18 | 19 | private Field[,,,] InitializeFields() 20 | { 21 | var initializedFields = new Field[Size, Size, World.CountOfLayers, maxDeep]; 22 | 23 | for (int i = 0; i < Size; i++) 24 | { 25 | for (int j = 0; j < Size; j++) 26 | { 27 | for (int k = 0; k < World.CountOfLayers; k++) 28 | { 29 | for (int l = 0; l < maxDeep; l++) 30 | { 31 | initializedFields[i, j, k, l] = new Field(); 32 | } 33 | } 34 | } 35 | } 36 | 37 | return initializedFields; 38 | } 39 | 40 | public override Field GetField(int x, int y, int z, int w) 41 | { 42 | if (IsValidCoordinate(x, y, z, w)) 43 | { 44 | Field field = fields[x, y, z, w]; 45 | if (field == null) 46 | { 47 | field = new Field(); 48 | } 49 | return field; 50 | } 51 | return null; 52 | } 53 | 54 | public override void SetField(int x, int y, int layer, int w, Field field) 55 | { 56 | if (IsValidCoordinate(x, y, layer, w)) 57 | { 58 | fields[x, y, layer, w] = field; 59 | } 60 | } 61 | 62 | public override Field[,,,] GetFields() 63 | { 64 | return fields; 65 | } 66 | } 67 | } -------------------------------------------------------------------------------- /ConsoleAdventure/Content/Scripts/WorldEngine/NoiseBuffer.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace ConsoleAdventure.Content.Scripts.WorldEngine 8 | { 9 | [Serializable] 10 | public struct NoiseBuffer 11 | { 12 | public long seed; 13 | public int octaves = 0; 14 | public double persistence = 0; 15 | public double lacunarity = 0; 16 | 17 | public NoiseBuffer(long seed) 18 | { 19 | this.seed = seed; 20 | } 21 | 22 | public NoiseBuffer(long seed, int octaves, double persistence, double lacunarity) 23 | { 24 | this.seed = seed; 25 | this.octaves = octaves; 26 | this.persistence = persistence; 27 | this.lacunarity = lacunarity; 28 | } 29 | 30 | public float Simplex2(double x, double y) 31 | { 32 | return OpenSimplex.noise2(seed, x, y); 33 | } 34 | 35 | public float Simplex3(double x, double y, double z) 36 | { 37 | return OpenSimplex.noise3_Fallback(seed, x, y, z); 38 | } 39 | 40 | public float FractalSimplex2(double x, double y) 41 | { 42 | return OpenSimplex.FractalNoise2D(seed, x, y, octaves, persistence, lacunarity); 43 | } 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /ConsoleAdventure/Content/Scripts/WorldEngine/Objects/BrokenLog.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using Microsoft.Xna.Framework; 4 | 5 | namespace ConsoleAdventure.WorldEngine 6 | { 7 | [Serializable] 8 | public class BrokenLog : Transform 9 | { 10 | public BrokenLog(Position position, int w, int worldLayer = -1) : base(position, (byte)w) 11 | { 12 | this.position = position; 13 | if (worldLayer == -1) this.worldLayer = World.BlocksLayerId; 14 | else this.worldLayer = (byte)worldLayer; 15 | 16 | type = (int)VanillaTransforms.brokenLog; 17 | isObstacle = false; 18 | burnType = 0; 19 | 20 | AddTypeToMap(type); 21 | 22 | Initialize(); 23 | } 24 | 25 | public override void Collapse() 26 | { 27 | if(ConsoleAdventure.rand.Next(0, 3) == 0) 28 | { 29 | new Loot(position, w, new List() { new Stack(new Log(), 1) }); 30 | } 31 | } 32 | 33 | public override string GetSymbol() 34 | { 35 | return "⸗₋"; 36 | } 37 | 38 | public override Color GetColor() 39 | { 40 | return new(74, 41, 18); 41 | } 42 | 43 | public override void AfterBurning() 44 | { 45 | if (ConsoleAdventure.rand.Next(0, 2) == 1) 46 | { 47 | new Charcoal(position, w); 48 | } 49 | 50 | else 51 | { 52 | base.AfterBurning(); 53 | } 54 | } 55 | } 56 | } -------------------------------------------------------------------------------- /ConsoleAdventure/Content/Scripts/WorldEngine/Objects/Buildings/Anvil.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Xna.Framework; 2 | using System; 3 | using System.Collections; 4 | 5 | namespace ConsoleAdventure.WorldEngine 6 | { 7 | [Serializable] 8 | public class Anvil : Transform 9 | { 10 | public Anvil(Position position, int w, int worldLayer = -1) : base(position, (byte)w) 11 | { 12 | this.position = position; 13 | if (worldLayer == -1) this.worldLayer = World.BlocksLayerId; 14 | else this.worldLayer = (byte)worldLayer; 15 | 16 | type = (int)VanillaTransforms.anvil; 17 | isObstacle = false; 18 | 19 | AddTypeToMap(type); 20 | 21 | Initialize(); 22 | } 23 | 24 | public override void Collapse() 25 | { 26 | new Loot(position, w, new() { new Stack(new AnvilItem(), 1) }); 27 | } 28 | 29 | public override string GetSymbol() 30 | { 31 | return " σ"; 32 | } 33 | 34 | public override Color GetColor() 35 | { 36 | return Color.Gray; 37 | } 38 | } 39 | } -------------------------------------------------------------------------------- /ConsoleAdventure/Content/Scripts/WorldEngine/Objects/Buildings/Chest.cs: -------------------------------------------------------------------------------- 1 | using ConsoleAdventure.Content.Scripts.Player; 2 | using Microsoft.Xna.Framework; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Linq; 6 | using System.Text; 7 | using System.Threading.Tasks; 8 | 9 | namespace ConsoleAdventure.WorldEngine 10 | { 11 | public class Chest : Storage 12 | { 13 | internal bool isBrake = false; 14 | public Chest(Position position, int w, List items, int worldLayer = -1) : base(position, w, items) 15 | { 16 | this.worldLayer = World.BlocksLayerId; 17 | type = (int)VanillaTransforms.chest; 18 | 19 | AddTypeToMap(type); 20 | 21 | Initialize(); 22 | } 23 | 24 | public override string GetSymbol() 25 | { 26 | return "<>"; 27 | } 28 | 29 | public override Color GetColor() 30 | { 31 | return new(94, 61, 38); 32 | } 33 | 34 | public override void Interaction() 35 | { 36 | Player player = world.GetLocalPlayer(); 37 | player.ClearChest(); 38 | 39 | if (!player.isChestOpen) 40 | { 41 | world.GetLocalPlayer().chest.slots = items; 42 | player.chestPosition = new Vector3(position.x, position.y, w); 43 | player.isChestOpen = true; 44 | } 45 | 46 | else if (player.isChestOpen) 47 | { 48 | player.isChestOpen = false; 49 | player.chestPosition = new Vector3(-1, -1, -1); 50 | } 51 | } 52 | 53 | public override void Collapse() 54 | { 55 | Player player = world.GetLocalPlayer(); 56 | player.ClearChest(); 57 | player.isChestOpen = false; 58 | player.chestPosition = new Vector3(-1, -1, -1); 59 | isBrake = true; 60 | new Loot(position, w, new List() { new Stack(new ChestItem(), 1) }); 61 | } 62 | 63 | public override bool CanBeDestroyed() 64 | { 65 | return items == null || items.Count <= 0; 66 | } 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /ConsoleAdventure/Content/Scripts/WorldEngine/Objects/Buildings/Climb.cs: -------------------------------------------------------------------------------- 1 | using ConsoleAdventure.Content.Scripts; 2 | using ConsoleAdventure.Content.Scripts.Player; 3 | using Microsoft.Xna.Framework; 4 | using System; 5 | using System.Diagnostics; 6 | 7 | namespace ConsoleAdventure.WorldEngine 8 | { 9 | [Serializable] 10 | public class Climb : Transform 11 | { 12 | public Climb(Position position, int w, int worldLayer = -1) : base(position, (byte)w) 13 | { 14 | this.position = position; 15 | if (worldLayer == -1) this.worldLayer = World.BlocksLayerId; 16 | else this.worldLayer = (byte)worldLayer; 17 | 18 | type = (int)VanillaTransforms.climb; 19 | isObstacle = false; 20 | hardness = -1; 21 | 22 | AddTypeToMap(type); 23 | Initialize(); 24 | } 25 | 26 | public override string GetSymbol() 27 | { 28 | return "▲▲"; 29 | } 30 | 31 | public override Color GetColor() 32 | { 33 | return Color.Gray; 34 | } 35 | 36 | public override void Interaction() 37 | { 38 | Player player = world.GetLocalPlayer(); 39 | 40 | player.SetPosition(player.position, player.w++); 41 | } 42 | 43 | public override void OnTheScreen() 44 | { 45 | if (w == world.Surface - 1) 46 | Light.Add(position.x, position.y, w, Light.GetSunLightColor(), 8.5f); 47 | } 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /ConsoleAdventure/Content/Scripts/WorldEngine/Objects/Buildings/Descent.cs: -------------------------------------------------------------------------------- 1 | using ConsoleAdventure.Content.Scripts.Player; 2 | using Microsoft.Xna.Framework; 3 | using System; 4 | using System.Diagnostics; 5 | 6 | namespace ConsoleAdventure.WorldEngine 7 | { 8 | [Serializable] 9 | public class Descent : Transform 10 | { 11 | public Descent(Position position, int w, int worldLayer = 1) : base(position, (byte)w) 12 | { 13 | this.position = position; 14 | if (worldLayer == -1) this.worldLayer = World.BlocksLayerId; 15 | else this.worldLayer = (byte)worldLayer; 16 | 17 | type = (int)VanillaTransforms.descent; 18 | isObstacle = false; 19 | hardness = -1; 20 | 21 | AddTypeToMap(type); 22 | 23 | Initialize(); 24 | } 25 | 26 | public override string GetSymbol() 27 | { 28 | return "▼▼"; 29 | } 30 | 31 | public override Color GetColor() 32 | { 33 | return Color.Gray; 34 | } 35 | 36 | public override void Interaction() 37 | { 38 | Player player = world.GetLocalPlayer(); 39 | 40 | player.SetPosition(player.position, player.w--); 41 | } 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /ConsoleAdventure/Content/Scripts/WorldEngine/Objects/Buildings/Door.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Xna.Framework; 2 | using System; 3 | using System.Collections.Generic; 4 | 5 | namespace ConsoleAdventure.WorldEngine 6 | { 7 | [Serializable] 8 | public class Door : Transform 9 | { 10 | public Door(Position position, int w, int worldLayer = -1) : base(position, (byte)w) 11 | { 12 | this.position = position; 13 | if (worldLayer == -1) this.worldLayer = World.BlocksLayerId; 14 | else this.worldLayer = (byte)worldLayer; 15 | 16 | type = (int)VanillaTransforms.door; 17 | isObstacle = false; 18 | burnType = 0; 19 | 20 | AddTypeToMap(type); 21 | 22 | Initialize(); 23 | } 24 | 25 | public override void Collapse() 26 | { 27 | new Loot(position, w, new List() { new Stack(new DoorItem(), 1) }); 28 | } 29 | 30 | public override string GetSymbol() 31 | { 32 | return "[]"; 33 | } 34 | 35 | public override Color GetColor() 36 | { 37 | return new(94, 61, 38); 38 | } 39 | 40 | public override void AfterBurning() 41 | { 42 | if (ConsoleAdventure.rand.Next(0, 2) == 1) 43 | { 44 | new Charcoal(position, w); 45 | } 46 | 47 | else 48 | { 49 | base.AfterBurning(); 50 | } 51 | } 52 | } 53 | } -------------------------------------------------------------------------------- /ConsoleAdventure/Content/Scripts/WorldEngine/Objects/Buildings/Floor.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Xna.Framework; 2 | using System; 3 | using System.CodeDom; 4 | using System.Collections.Generic; 5 | 6 | namespace ConsoleAdventure.WorldEngine 7 | { 8 | [Serializable] 9 | public class Floor : Transform 10 | { 11 | public Floor(Position position, int w, int worldLayer = -1) : base(position, (byte)w) 12 | { 13 | this.position = position; 14 | if (worldLayer == -1) this.worldLayer = World.FloorLayerId; 15 | else this.worldLayer = (byte)worldLayer; 16 | 17 | type = (int)VanillaTransforms.floor; 18 | isObstacle = false; 19 | 20 | AddTypeToMap(type); 21 | 22 | Initialize(); 23 | } 24 | 25 | public override void Collapse() 26 | { 27 | new Loot(position, w, new List() { new Stack(new FloorItem(), 1) }); 28 | } 29 | 30 | public override string GetSymbol() 31 | { 32 | return " ."; 33 | } 34 | 35 | public override Color GetColor() 36 | { 37 | return Color.Gray; 38 | } 39 | } 40 | } -------------------------------------------------------------------------------- /ConsoleAdventure/Content/Scripts/WorldEngine/Objects/Buildings/Furnace.cs: -------------------------------------------------------------------------------- 1 | using ConsoleAdventure.Content.Scripts; 2 | using Microsoft.Xna.Framework; 3 | using Microsoft.Xna.Framework.Graphics; 4 | using System; 5 | using System.Collections; 6 | 7 | namespace ConsoleAdventure.WorldEngine 8 | { 9 | [Serializable] 10 | public class Furnace : Transform 11 | { 12 | public Furnace(Position position, int w, int worldLayer = -1) : base(position, (byte)w) 13 | { 14 | this.position = position; 15 | if (worldLayer == -1) this.worldLayer = World.BlocksLayerId; 16 | else this.worldLayer = (byte)worldLayer; 17 | 18 | type = (int)VanillaTransforms.furnace; 19 | isObstacle = false; 20 | 21 | AddTypeToMap(type); 22 | 23 | Initialize(); 24 | } 25 | 26 | public override void Collapse() 27 | { 28 | new Loot(position, w, new() { new Stack(new FurnaceItem(), 1) }); 29 | } 30 | 31 | public override string GetSymbol() 32 | { 33 | return "[]"; 34 | } 35 | 36 | public override Color GetColor() 37 | { 38 | return Color.Gray; 39 | } 40 | 41 | int drawTimer; 42 | public override void OnTheScreen() 43 | { 44 | Light.Add(position.x, position.y, w, Color.White, 100f); 45 | 46 | if (CanDraw()) 47 | { 48 | StringPaint.Draw("●", position, w, new(0.24f, -0.00f), Color.OrangeRed); 49 | StringPaint.Draw("•", position, w, new(0.28f + (float)(Math.Sin((float)drawTimer / 30 * Math.PI) / 20), -0.12f), Color.OrangeRed * 0.8f); 50 | StringPaint.Draw("•", position, w, new(0.28f, -0.00f), Color.Orange * (float)(1 + Math.Sin((float)drawTimer / 60 * Math.PI) / 4)); 51 | } 52 | 53 | drawTimer++; 54 | } 55 | } 56 | } -------------------------------------------------------------------------------- /ConsoleAdventure/Content/Scripts/WorldEngine/Objects/Buildings/Workbench.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Xna.Framework; 2 | using System; 3 | using System.Collections; 4 | 5 | namespace ConsoleAdventure.WorldEngine 6 | { 7 | [Serializable] 8 | public class Workbench : Transform 9 | { 10 | public Workbench(Position position, int w, int worldLayer = -1) : base(position, (byte)w) 11 | { 12 | this.position = position; 13 | if (worldLayer == -1) this.worldLayer = World.BlocksLayerId; 14 | else this.worldLayer = (byte)worldLayer; 15 | 16 | type = (int)VanillaTransforms.workbench; 17 | isObstacle = false; 18 | burnType = 0; 19 | 20 | AddTypeToMap(type); 21 | 22 | Initialize(); 23 | } 24 | 25 | public override void Collapse() 26 | { 27 | new Loot(position, w, new() { new Stack(new WorkbenchItem(), 1) }); 28 | } 29 | 30 | public override string GetSymbol() 31 | { 32 | return " ∏"; 33 | } 34 | 35 | public override Color GetColor() 36 | { 37 | return new(94, 61, 38); 38 | } 39 | 40 | public override void AfterBurning() 41 | { 42 | if (ConsoleAdventure.rand.Next(0, 2) == 1) 43 | { 44 | new Charcoal(position, w); 45 | } 46 | 47 | else 48 | { 49 | base.AfterBurning(); 50 | } 51 | } 52 | } 53 | } -------------------------------------------------------------------------------- /ConsoleAdventure/Content/Scripts/WorldEngine/Objects/Charcoal.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.VisualBasic.Logging; 2 | using Microsoft.Xna.Framework; 3 | using System.Collections.Generic; 4 | 5 | namespace ConsoleAdventure.WorldEngine 6 | { 7 | public class Charcoal : Transform 8 | { 9 | public Charcoal(Position position, int w, int worldLayer = -1) : base(position, (byte)w) 10 | { 11 | if (worldLayer == -1) this.worldLayer = World.BlocksLayerId; 12 | else this.worldLayer = (byte)worldLayer; 13 | 14 | type = (int)VanillaTransforms.charcoal; 15 | isObstacle = true; 16 | hardness = 0.6f; 17 | 18 | AddTypeToMap(type); 19 | 20 | Initialize(); 21 | } 22 | 23 | public override void Collapse() 24 | { 25 | //new Loot(position, w, new List() { new Stack(new Log(), 1) }); 26 | } 27 | 28 | public override string GetSymbol() 29 | { 30 | return "≡≡"; 31 | } 32 | 33 | public override Color GetColor() 34 | { 35 | return new(45, 45, 45); 36 | } 37 | } 38 | } -------------------------------------------------------------------------------- /ConsoleAdventure/Content/Scripts/WorldEngine/Objects/Floors/CharcoalFloor.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Xna.Framework; 2 | using System; 3 | using System.CodeDom; 4 | using System.Collections.Generic; 5 | 6 | namespace ConsoleAdventure.WorldEngine 7 | { 8 | [Serializable] 9 | public class CharcoalFloor : Transform 10 | { 11 | public CharcoalFloor(Position position, int w, int worldLayer = -1) : base(position, (byte)w) 12 | { 13 | this.position = position; 14 | if (worldLayer == -1) this.worldLayer = World.FloorLayerId; 15 | else this.worldLayer = (byte)worldLayer; 16 | 17 | type = (int)VanillaTransforms.charcoalFloor; 18 | isObstacle = false; 19 | 20 | AddTypeToMap(type); 21 | 22 | Initialize(); 23 | } 24 | 25 | public override void Collapse() 26 | { 27 | //new Loot(position, w, new List() { new Stack(new WoodFloorItem(), 1) }); 28 | } 29 | 30 | public override string GetSymbol() 31 | { 32 | return " ."; 33 | } 34 | 35 | public override Color GetColor() 36 | { 37 | return new(35, 35, 35); 38 | } 39 | } 40 | } -------------------------------------------------------------------------------- /ConsoleAdventure/Content/Scripts/WorldEngine/Objects/Floors/GraniteFloor.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Xna.Framework; 2 | using System; 3 | using System.CodeDom; 4 | 5 | namespace ConsoleAdventure.WorldEngine 6 | { 7 | [Serializable] 8 | public class GraniteFloor : Transform 9 | { 10 | static string[] symbolsMap = new string[] 11 | { 12 | " .", 13 | " ~", 14 | " ,", 15 | }; 16 | 17 | //byte Sindex; 18 | 19 | public GraniteFloor(Position position, int w, int worldLayer = -1) : base(position, (byte)w) 20 | { 21 | this.position = position; 22 | if (worldLayer == -1) this.worldLayer = World.FloorLayerId; 23 | else this.worldLayer = (byte)worldLayer; 24 | 25 | type = (int)VanillaTransforms.graniteFloor; 26 | isObstacle = false; 27 | 28 | AddTypeToMap(type); 29 | 30 | Initialize(); 31 | 32 | //Sindex = (byte)ConsoleAdventure.rand.Next(0, symbolsMap.Length); 33 | } 34 | 35 | public override string GetSymbol() 36 | { 37 | return symbolsMap[Utils.HashNoise(position.x, position.y, 3)]; 38 | } 39 | 40 | public override Color GetColor() 41 | { 42 | return new Color(35, 35, 35); 43 | } 44 | } 45 | } -------------------------------------------------------------------------------- /ConsoleAdventure/Content/Scripts/WorldEngine/Objects/Floors/WoodFloor.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Xna.Framework; 2 | using System; 3 | using System.CodeDom; 4 | using System.Collections.Generic; 5 | 6 | namespace ConsoleAdventure.WorldEngine 7 | { 8 | [Serializable] 9 | public class WoodFloor : Transform 10 | { 11 | public WoodFloor(Position position, int w, int worldLayer = -1) : base(position, (byte)w) 12 | { 13 | this.position = position; 14 | if (worldLayer == -1) this.worldLayer = World.FloorLayerId; 15 | else this.worldLayer = (byte)worldLayer; 16 | 17 | type = (int)VanillaTransforms.woodFloor; 18 | isObstacle = false; 19 | burnType = 0; 20 | 21 | AddTypeToMap(type); 22 | 23 | Initialize(); 24 | } 25 | 26 | public override void Collapse() 27 | { 28 | new Loot(position, w, new List() { new Stack(new WoodFloorItem(), 1) }); 29 | } 30 | 31 | public override string GetSymbol() 32 | { 33 | return " ."; 34 | } 35 | 36 | public override Color GetColor() 37 | { 38 | return new(74, 41, 18); 39 | } 40 | 41 | public override void AfterBurning() 42 | { 43 | if (ConsoleAdventure.rand.Next(0, 2) == 1) 44 | { 45 | new CharcoalFloor(position, w); 46 | } 47 | 48 | else 49 | { 50 | base.AfterBurning(); 51 | } 52 | } 53 | } 54 | } -------------------------------------------------------------------------------- /ConsoleAdventure/Content/Scripts/WorldEngine/Objects/GraniteWall.cs: -------------------------------------------------------------------------------- 1 | using ConsoleAdventure.WorldEngine; 2 | using Microsoft.Xna.Framework; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Linq; 6 | using System.Runtime.CompilerServices; 7 | using System.Text; 8 | using System.Threading.Tasks; 9 | 10 | namespace ConsoleAdventure.WorldEngine 11 | { 12 | public class GraniteWall : Transform 13 | { 14 | public GraniteWall(Position position, int w, int worldLayer = -1) : base(position, (byte)w) 15 | { 16 | if (worldLayer == -1) this.worldLayer = World.BlocksLayerId; 17 | else this.worldLayer = (byte)worldLayer; 18 | 19 | type = (int)VanillaTransforms.graniteWall; 20 | isObstacle = true; 21 | hardness = 2; 22 | 23 | AddTypeToMap(type); 24 | 25 | Initialize(); 26 | } 27 | 28 | public override void Collapse() 29 | { 30 | new Loot(position, w, new List() { new Stack(new GraniteWallItem(), 1) }); 31 | } 32 | 33 | public override string GetSymbol() 34 | { 35 | return "∫∫"; 36 | } 37 | 38 | public override Color GetColor() 39 | { 40 | return new Color(45, 45, 45); 41 | } 42 | 43 | public override Color? GetBGColor() 44 | { 45 | return base.GetBGColor(); 46 | } 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /ConsoleAdventure/Content/Scripts/WorldEngine/Objects/Grass.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Xna.Framework; 2 | using System; 3 | using System.CodeDom; 4 | 5 | namespace ConsoleAdventure.WorldEngine 6 | { 7 | [Serializable] 8 | public class Grass : Transform 9 | { 10 | 11 | static string[] symbolsMap = new string[] //√♠♣ɾɿɼϔϒ☼"'rϓՐ 12 | { 13 | //"√\"", 14 | //"Ր√", 15 | //"ϔr", 16 | //"''", 17 | //"ɿ,", 18 | //",ɼ", 19 | //"ɾr", 20 | "'√", 21 | "√√", 22 | "√r", 23 | "♣♣", 24 | "√♣", 25 | "ϔϔ", 26 | "ϒ ", 27 | " ϒ", 28 | "\"\"", 29 | ",'", 30 | "',", 31 | " r" 32 | }; 33 | 34 | static float darkDegree = 1.6f; 35 | 36 | static Color[] colorsMap = new Color[] 37 | { 38 | new(106, 255, 0), 39 | new(76, 182, 0), 40 | new(52, 124, 0), 41 | new(17, 255, 0), 42 | new(13, 191, 0), 43 | new(8, 120, 0), 44 | new(0, 255, 72), 45 | new(0, 200, 57), 46 | new(0, 112, 32) 47 | }; 48 | 49 | public Grass(Position position, int w, int worldLayer = -1) : base(position, (byte)w) 50 | { 51 | this.position = position; 52 | if (worldLayer == -1) this.worldLayer = World.BlocksLayerId; 53 | else this.worldLayer = (byte)worldLayer; 54 | 55 | type = (int)VanillaTransforms.grass; 56 | isObstacle = false; 57 | hardness = 0.1f; 58 | burnType = 0; 59 | 60 | AddTypeToMap(type); 61 | Initialize(); 62 | } 63 | 64 | public override string GetSymbol() 65 | { 66 | return symbolsMap[Utils.HashNoise(position.x, position.y, 12)]; 67 | } 68 | 69 | public override Color GetColor() 70 | { 71 | return colorsMap[Utils.HashNoise(position.x, position.y, 9)]; 72 | } 73 | } 74 | } 75 | -------------------------------------------------------------------------------- /ConsoleAdventure/Content/Scripts/WorldEngine/Objects/Plank.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.VisualBasic.Logging; 2 | using Microsoft.Xna.Framework; 3 | using System.Collections.Generic; 4 | 5 | namespace ConsoleAdventure.WorldEngine 6 | { 7 | public class Plank : Transform 8 | { 9 | public Plank(Position position, int w, int worldLayer = -1) : base(position, (byte)w) 10 | { 11 | if (worldLayer == -1) this.worldLayer = World.BlocksLayerId; 12 | else this.worldLayer = (byte)worldLayer; 13 | 14 | type = (int)VanillaTransforms.log; 15 | isObstacle = true; 16 | burnType = 0; 17 | hardness = 0.8f; 18 | 19 | AddTypeToMap(type); 20 | 21 | Initialize(); 22 | } 23 | 24 | public override void Collapse() 25 | { 26 | new Loot(position, w, new List() { new Stack(new Log(), 1) }); 27 | } 28 | 29 | public override string GetSymbol() 30 | { 31 | return "≡≡"; 32 | } 33 | 34 | public override Color GetColor() 35 | { 36 | return new(94, 61, 38); 37 | } 38 | 39 | public override void AfterBurning() 40 | { 41 | if (ConsoleAdventure.rand.Next(0, 2) == 1) 42 | { 43 | new Charcoal(position, w); 44 | } 45 | 46 | else 47 | { 48 | base.AfterBurning(); 49 | } 50 | } 51 | } 52 | } -------------------------------------------------------------------------------- /ConsoleAdventure/Content/Scripts/WorldEngine/Objects/Rocks/Biotite.cs: -------------------------------------------------------------------------------- 1 | using ConsoleAdventure.WorldEngine; 2 | using Microsoft.Xna.Framework; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Linq; 6 | using System.Runtime.CompilerServices; 7 | using System.Text; 8 | using System.Threading.Tasks; 9 | 10 | namespace ConsoleAdventure.WorldEngine 11 | { 12 | public class Biotite : Transform 13 | { 14 | public Biotite(Position position, int w, int worldLayer = -1) : base(position, (byte)w) 15 | { 16 | if (worldLayer == -1) this.worldLayer = World.BlocksLayerId; 17 | else this.worldLayer = (byte)worldLayer; 18 | 19 | type = (int)VanillaTransforms.biotite; 20 | isObstacle = true; 21 | hardness = 0.5f; 22 | 23 | AddTypeToMap(type); 24 | 25 | Initialize(); 26 | } 27 | 28 | public override void Collapse() 29 | { 30 | new Loot(position, w, new List() { new Stack(new BiotiteItem(), 1) }); 31 | } 32 | 33 | public override string GetSymbol() 34 | { 35 | return "≡≡"; 36 | } 37 | 38 | public override Color GetColor() 39 | { 40 | return new Color(45, 45, 45); 41 | } 42 | 43 | public override Color? GetBGColor() 44 | { 45 | return new Color(15, 15, 15); 46 | } 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /ConsoleAdventure/Content/Scripts/WorldEngine/Objects/Rocks/Granite.cs: -------------------------------------------------------------------------------- 1 | using ConsoleAdventure.WorldEngine; 2 | using Microsoft.Xna.Framework; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Linq; 6 | using System.Runtime.CompilerServices; 7 | using System.Text; 8 | using System.Threading.Tasks; 9 | 10 | namespace ConsoleAdventure.WorldEngine 11 | { 12 | public class Granite : Transform 13 | { 14 | public Granite(Position position, int w, int worldLayer = -1) : base(position, (byte)w) 15 | { 16 | if (worldLayer == -1) this.worldLayer = World.BlocksLayerId; 17 | else this.worldLayer = (byte)worldLayer; 18 | 19 | type = (int)VanillaTransforms.granite; 20 | isObstacle = true; 21 | hardness = 2; 22 | burnType = 1; 23 | 24 | AddTypeToMap(type); 25 | 26 | Initialize(); 27 | } 28 | 29 | public override void Collapse() 30 | { 31 | new Loot(position, w, new List() { new Stack(new GraniteItem(), 1) }); 32 | } 33 | 34 | public override string GetSymbol() 35 | { 36 | return "##"; 37 | } 38 | 39 | public override Color GetColor() 40 | { 41 | return new Color(45, 45, 45); 42 | } 43 | 44 | public override Color? GetBGColor() 45 | { 46 | return Color.Gray; 47 | } 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /ConsoleAdventure/Content/Scripts/WorldEngine/Objects/Rocks/Ores/BrownIronOre.cs: -------------------------------------------------------------------------------- 1 | using ConsoleAdventure.WorldEngine; 2 | using Microsoft.Xna.Framework; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Linq; 6 | using System.Runtime.CompilerServices; 7 | using System.Text; 8 | using System.Threading.Tasks; 9 | 10 | namespace ConsoleAdventure.WorldEngine 11 | { 12 | public class BrownIronOre : Transform 13 | { 14 | public BrownIronOre(Position position, int w, int worldLayer = -1) : base(position, (byte)w) 15 | { 16 | if (worldLayer == -1) this.worldLayer = World.BlocksLayerId; 17 | else this.worldLayer = (byte)worldLayer; 18 | 19 | type = (int)VanillaTransforms.brownIronOre; 20 | isObstacle = true; 21 | hardness = 0.8f; 22 | burnType = 1; 23 | 24 | AddTypeToMap(type); 25 | 26 | Initialize(); 27 | } 28 | 29 | public override void Collapse() 30 | { 31 | new Loot(position, w, new List() { new Stack(new BrownIronOreItem(), 1) }); 32 | } 33 | 34 | public override string GetSymbol() 35 | { 36 | return "§§"; 37 | } 38 | 39 | public override Color GetColor() 40 | { 41 | return new Color(206, 83, 33); 42 | } 43 | 44 | public override Color? GetBGColor() 45 | { 46 | return Color.Gray; 47 | } 48 | 49 | public override string ModifyTooltip() 50 | { 51 | return base.GetName() + " {" + Localization.GetTranslation("TooltipAdds", GetType().Name) + " [item:ConsoleAdventure.IronBar]}"; 52 | } 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /ConsoleAdventure/Content/Scripts/WorldEngine/Objects/Rocks/Ores/Ruby.cs: -------------------------------------------------------------------------------- 1 | using ConsoleAdventure.WorldEngine; 2 | using Microsoft.Xna.Framework; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Linq; 6 | using System.Runtime.CompilerServices; 7 | using System.Text; 8 | using System.Threading.Tasks; 9 | 10 | namespace ConsoleAdventure.WorldEngine 11 | { 12 | public class Ruby : Transform 13 | { 14 | public Ruby(Position position, int w, int worldLayer = -1) : base(position, (byte)w) 15 | { 16 | if (worldLayer == -1) this.worldLayer = World.BlocksLayerId; 17 | else this.worldLayer = (byte)worldLayer; 18 | 19 | type = (int)VanillaTransforms.ruby; 20 | isObstacle = true; 21 | hardness = 4f; 22 | 23 | AddTypeToMap(type); 24 | 25 | Initialize(); 26 | } 27 | 28 | public override void Collapse() 29 | { 30 | new Loot(position, w, new List() { new Stack(new RubyItem(), 1) }); 31 | } 32 | 33 | public override string GetSymbol() 34 | { 35 | return "♦♦"; 36 | } 37 | 38 | public override Color GetColor() 39 | { 40 | return new Color(200, 21, 110); 41 | } 42 | 43 | public override Color? GetBGColor() 44 | { 45 | return new Color(19, 124, 50); 46 | } 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /ConsoleAdventure/Content/Scripts/WorldEngine/Objects/Rocks/Quartz.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Xna.Framework; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace ConsoleAdventure.WorldEngine 8 | { 9 | public class Quartz : Transform 10 | { 11 | public Quartz(Position position, int w, int worldLayer = -1) : base(position, (byte)w) 12 | { 13 | if (worldLayer == -1) this.worldLayer = World.BlocksLayerId; 14 | else this.worldLayer = (byte)worldLayer; 15 | 16 | type = (int)VanillaTransforms.quartz; 17 | isObstacle = true; 18 | hardness = 2; 19 | burnType = 1; 20 | 21 | AddTypeToMap(type); 22 | 23 | Initialize(); 24 | } 25 | 26 | public override void Collapse() 27 | { 28 | new Loot(position, w, new List() { new Stack(new QuartzItem(), 1) }); 29 | } 30 | 31 | public override string GetSymbol() 32 | { 33 | return "◊◊"; 34 | } 35 | 36 | public override Color GetColor() 37 | { 38 | return Color.White; 39 | } 40 | 41 | public override Color? GetBGColor() 42 | { 43 | return Color.Gray; 44 | } 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /ConsoleAdventure/Content/Scripts/WorldEngine/Objects/Rocks/Salt.cs: -------------------------------------------------------------------------------- 1 | using ConsoleAdventure.WorldEngine; 2 | using Microsoft.Xna.Framework; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Linq; 6 | using System.Runtime.CompilerServices; 7 | using System.Text; 8 | using System.Threading.Tasks; 9 | 10 | namespace ConsoleAdventure.WorldEngine 11 | { 12 | public class Salt : Transform 13 | { 14 | public Salt(Position position, int w, int worldLayer = -1) : base(position, (byte)w) 15 | { 16 | if (worldLayer == -1) this.worldLayer = World.BlocksLayerId; 17 | else this.worldLayer = (byte)worldLayer; 18 | 19 | type = (int)VanillaTransforms.salt; 20 | isObstacle = true; 21 | hardness = 2; 22 | 23 | AddTypeToMap(type); 24 | 25 | Initialize(); 26 | } 27 | 28 | public override void Collapse() 29 | { 30 | new Loot(position, w, new List() { new Stack(new SaltItem(), 1) }); 31 | } 32 | 33 | public override string GetSymbol() 34 | { 35 | return "∆∆"; 36 | } 37 | 38 | public override Color GetColor() 39 | { 40 | return new Color(193, 157, 175); 41 | } 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /ConsoleAdventure/Content/Scripts/WorldEngine/Objects/Rocks/Soils/Alfisol.cs: -------------------------------------------------------------------------------- 1 | using CaModLoaderAPI; 2 | using ConsoleAdventure; 3 | using ConsoleAdventure.WorldEngine; 4 | using Microsoft.Xna.Framework; 5 | using System.Collections.Generic; 6 | 7 | namespace ConsoleAdventure.WorldEngine 8 | { 9 | public class Alfisol : Transform 10 | { 11 | static string[] symbolsMap = new string[] 12 | { 13 | "~~", 14 | "~≈", 15 | "≈~", 16 | "≈≈", 17 | "~ ", 18 | " ~", 19 | " ≈", 20 | "≈ " 21 | }; 22 | 23 | public Alfisol(Position position, int w, int worldLayer = -1) : base(position, (byte)w) 24 | { 25 | this.position = position; 26 | this.worldLayer = World.BlocksLayerId; 27 | 28 | type = (byte)VanillaTransforms.alfisol; 29 | 30 | isObstacle = true; 31 | hardness = 0.5f; 32 | 33 | AddTypeToMap(type); 34 | Initialize(); 35 | } 36 | 37 | public override void Collapse() 38 | { 39 | new Loot(position, w, new List { new Stack(new AlfisolItem(), 1) }); 40 | } 41 | 42 | public override string GetSymbol() 43 | { 44 | return symbolsMap[Utils.HashNoise(position.x, position.y, 8)]; 45 | } 46 | 47 | public override Color GetColor() 48 | { 49 | return new Color(134, 107, 81); 50 | } 51 | 52 | public override Color? GetBGColor() 53 | { 54 | return new Color(54, 43, 32); 55 | } 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /ConsoleAdventure/Content/Scripts/WorldEngine/Objects/Rocks/Soils/AlfisolFloor.cs: -------------------------------------------------------------------------------- 1 | using CaModLoaderAPI; 2 | using ConsoleAdventure; 3 | using ConsoleAdventure.WorldEngine; 4 | using Microsoft.Xna.Framework; 5 | using System.Collections.Generic; 6 | 7 | namespace ConsoleAdventure.WorldEngine 8 | { 9 | public class AlfisolFloor : Transform 10 | { 11 | static string[] symbolsMap = new string[] 12 | { 13 | " ~", 14 | " ≈", 15 | " .", 16 | " ,", 17 | " `", 18 | }; 19 | 20 | public AlfisolFloor(Position position, int w, int worldLayer = -1) : base(position, (byte)w) 21 | { 22 | this.position = position; 23 | this.worldLayer = World.FloorLayerId; 24 | 25 | type = (byte)VanillaTransforms.alfisolFloor; 26 | 27 | isObstacle = true; 28 | 29 | AddTypeToMap(type); 30 | Initialize(); 31 | } 32 | 33 | public override void Collapse() 34 | { 35 | new Loot(position, w, new List { new Stack(new AlfisolFloorItem(), 1) }); 36 | } 37 | 38 | public override string GetSymbol() 39 | { 40 | return symbolsMap[Utils.HashNoise(position.x, position.y, 5)]; 41 | } 42 | 43 | public override Color GetColor() 44 | { 45 | return new Color(54, 43, 32); 46 | } 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /ConsoleAdventure/Content/Scripts/WorldEngine/Objects/Rocks/Soils/BlackSoil.cs: -------------------------------------------------------------------------------- 1 | using CaModLoaderAPI; 2 | using ConsoleAdventure; 3 | using ConsoleAdventure.WorldEngine; 4 | using Microsoft.Xna.Framework; 5 | using System.Collections.Generic; 6 | 7 | namespace ConsoleAdventure.WorldEngine 8 | { 9 | public class BlackSoil : Transform 10 | { 11 | static string[] symbolsMap = new string[] 12 | { 13 | "~~", 14 | "~≈", 15 | "≈~", 16 | "≈≈", 17 | "~ ", 18 | " ~", 19 | " ≈", 20 | "≈ " 21 | }; 22 | 23 | public BlackSoil(Position position, int w, int worldLayer = -1) : base(position, (byte)w) 24 | { 25 | this.position = position; 26 | this.worldLayer = World.BlocksLayerId; 27 | 28 | type = (byte)VanillaTransforms.blackSoil; 29 | 30 | isObstacle = true; 31 | hardness = 0.5f; 32 | 33 | AddTypeToMap(type); 34 | Initialize(); 35 | } 36 | 37 | public override void Collapse() 38 | { 39 | new Loot(position, w, new List { new Stack(new BlackSoilItem(), 1) }); 40 | } 41 | 42 | public override string GetSymbol() 43 | { 44 | return symbolsMap[Utils.HashNoise(position.x, position.y, 8)]; 45 | } 46 | 47 | public override Color GetColor() 48 | { 49 | return new Color(30, 30, 30); 50 | } 51 | 52 | public override Color? GetBGColor() 53 | { 54 | return new Color(10, 10, 10); 55 | } 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /ConsoleAdventure/Content/Scripts/WorldEngine/Objects/Rocks/Soils/BlackSoilFloor.cs: -------------------------------------------------------------------------------- 1 | using CaModLoaderAPI; 2 | using ConsoleAdventure; 3 | using ConsoleAdventure.WorldEngine; 4 | using Microsoft.Xna.Framework; 5 | using System.Collections.Generic; 6 | 7 | namespace ConsoleAdventure.WorldEngine 8 | { 9 | public class BlackSoilFloor : Transform 10 | { 11 | static string[] symbolsMap = new string[] 12 | { 13 | " ~", 14 | " ≈", 15 | " .", 16 | " ,", 17 | " `", 18 | }; 19 | 20 | public BlackSoilFloor(Position position, int w, int worldLayer = -1) : base(position, (byte)w) 21 | { 22 | this.position = position; 23 | this.worldLayer = World.FloorLayerId; 24 | 25 | type = (byte)VanillaTransforms.blackSoilFloor; 26 | 27 | isObstacle = true; 28 | 29 | AddTypeToMap(type); 30 | Initialize(); 31 | } 32 | 33 | public override void Collapse() 34 | { 35 | new Loot(position, w, new List { new Stack(new BlackSoilFloorItem(), 1) }); 36 | } 37 | 38 | public override string GetSymbol() 39 | { 40 | return symbolsMap[Utils.HashNoise(position.x, position.y, 5)]; 41 | } 42 | 43 | public override Color GetColor() 44 | { 45 | return new Color(20, 20, 20); 46 | } 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /ConsoleAdventure/Content/Scripts/WorldEngine/Objects/Rocks/Soils/SandFloor.cs: -------------------------------------------------------------------------------- 1 | using CaModLoaderAPI; 2 | using ConsoleAdventure; 3 | using ConsoleAdventure.WorldEngine; 4 | using Microsoft.Xna.Framework; 5 | using System.Collections.Generic; 6 | 7 | namespace ConsoleAdventure.WorldEngine 8 | { 9 | public class SandFloor : Transform 10 | { 11 | static string[] symbolsMap = new string[] 12 | { 13 | " ~", 14 | " ≈", 15 | }; 16 | 17 | public SandFloor(Position position, int w, int worldLayer = -1) : base(position, (byte)w) 18 | { 19 | this.position = position; 20 | this.worldLayer = World.FloorLayerId; 21 | 22 | type = (byte)VanillaTransforms.sandFloor; 23 | 24 | isObstacle = true; 25 | 26 | AddTypeToMap(type); 27 | Initialize(); 28 | } 29 | 30 | public override void Collapse() 31 | { 32 | new Loot(position, w, new List { new Stack(new SandFloorItem(), 1) }); 33 | } 34 | 35 | public override string GetSymbol() 36 | { 37 | return symbolsMap[Utils.HashNoise(position.x, position.y, 2)]; 38 | } 39 | 40 | public override Color GetColor() 41 | { 42 | return new Color(196, 190, 32); 43 | } 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /ConsoleAdventure/Content/Scripts/WorldEngine/Objects/Rocks/Stone.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Xna.Framework; 2 | using System; 3 | using System.Collections.Generic; 4 | 5 | namespace ConsoleAdventure.WorldEngine 6 | { 7 | [Serializable] 8 | public class Stone : Transform 9 | { 10 | public Stone(Position position, int w, int worldLayer = -1) : base(position, (byte)w) 11 | { 12 | if (worldLayer == -1) this.worldLayer = World.BlocksLayerId; 13 | else this.worldLayer = (byte)worldLayer; 14 | 15 | type = (int)VanillaTransforms.stone; 16 | isObstacle = true; 17 | burnType = 1; 18 | 19 | AddTypeToMap(type); 20 | 21 | Initialize(); 22 | } 23 | 24 | public override void Collapse() 25 | { 26 | new Loot(position, w, new List() { new Stack(new StoneItem(), 1) }); 27 | } 28 | 29 | public override string GetSymbol() 30 | { 31 | return "██"; 32 | } 33 | 34 | public override Color GetColor() 35 | { 36 | return Color.Gray; 37 | } 38 | } 39 | } -------------------------------------------------------------------------------- /ConsoleAdventure/Content/Scripts/WorldEngine/Objects/Rocks/Zoisite.cs: -------------------------------------------------------------------------------- 1 | using ConsoleAdventure.WorldEngine; 2 | using Microsoft.Xna.Framework; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Linq; 6 | using System.Runtime.CompilerServices; 7 | using System.Text; 8 | using System.Threading.Tasks; 9 | 10 | namespace ConsoleAdventure.WorldEngine 11 | { 12 | public class Zoisite : Transform 13 | { 14 | public Zoisite(Position position, int w, int worldLayer = -1) : base(position, (byte)w) 15 | { 16 | if (worldLayer == -1) this.worldLayer = World.BlocksLayerId; 17 | else this.worldLayer = (byte)worldLayer; 18 | 19 | type = (int)VanillaTransforms.zoisite; 20 | isObstacle = true; 21 | hardness = 2; 22 | 23 | AddTypeToMap(type); 24 | 25 | Initialize(); 26 | } 27 | 28 | public override void Collapse() 29 | { 30 | new Loot(position, w, new List() { new Stack(new ZoisiteItem(), 1) }); 31 | } 32 | 33 | public override string GetSymbol() 34 | { 35 | return "ηη"; 36 | } 37 | 38 | public override Color GetColor() 39 | { 40 | return new Color(6, 61, 31); 41 | } 42 | 43 | public override Color? GetBGColor() 44 | { 45 | return new Color(19, 124, 50); 46 | } 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /ConsoleAdventure/Content/Scripts/WorldEngine/Objects/Ruine.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using Microsoft.Xna.Framework; 4 | 5 | namespace ConsoleAdventure.WorldEngine 6 | { 7 | [Serializable] 8 | public class Ruine : Transform 9 | { 10 | public Ruine(Position position, int w, int worldLayer = -1) : base(position, (byte)w) 11 | { 12 | this.position = position; 13 | if (worldLayer == -1) this.worldLayer = World.BlocksLayerId; 14 | else this.worldLayer = (byte)worldLayer; 15 | 16 | type = (int)VanillaTransforms.ruine; 17 | this.isObstacle = false; 18 | 19 | AddTypeToMap(type); 20 | 21 | Initialize(); 22 | } 23 | 24 | public override void Collapse() 25 | { 26 | if(ConsoleAdventure.rand.Next(0, 3) == 0) 27 | { 28 | new Loot(position, w, new List() { new Stack(new StoneItem(), 1) }); 29 | } 30 | } 31 | 32 | public override string GetSymbol() 33 | { 34 | return "::"; 35 | } 36 | 37 | public override Color GetColor() 38 | { 39 | return Color.Gray; 40 | } 41 | } 42 | } -------------------------------------------------------------------------------- /ConsoleAdventure/Content/Scripts/WorldEngine/Objects/Seedling.cs: -------------------------------------------------------------------------------- 1 | using ConsoleAdventure.Content.Scripts; 2 | using Microsoft.Xna.Framework; 3 | using SharpDX.Direct3D11; 4 | using System; 5 | using System.Collections.Generic; 6 | using System.Text; 7 | 8 | namespace ConsoleAdventure.WorldEngine 9 | { 10 | [Serializable] 11 | public class Seedling : Transform 12 | { 13 | public Seedling(Position position, int w, int worldLayer = -1) : base(position, (byte)w) 14 | { 15 | this.position = position; 16 | if (worldLayer == -1) this.worldLayer = World.BlocksLayerId; 17 | else this.worldLayer = (byte)worldLayer; 18 | 19 | type = (int)VanillaTransforms.seedling; 20 | burnType = 0; 21 | 22 | AddTypeToMap(type); 23 | 24 | Initialize(); 25 | } 26 | 27 | public override string GetSymbol() 28 | { 29 | return " ╢"; 30 | } 31 | 32 | public override Color GetColor() 33 | { 34 | return new (94, 61, 38); 35 | } 36 | 37 | public override void OnTheScreen() 38 | { 39 | Color color = new Color(13, 152, 20) * 0.5f; 40 | color.A = 255; 41 | 42 | Position tryColorPos = new Position(Math.Clamp(position.x - ConsoleAdventure.startDisplay.x, 0, 60), Math.Clamp(position.y - ConsoleAdventure.startDisplay.y, 0, 30)); 43 | Color crownColor = (color.ToVector3() * Light.colors[tryColorPos.x, tryColorPos.y].ToVector3()).ToColor(); 44 | 45 | if (crownColor.R != 0 && crownColor.G != 0 && crownColor.B != 0 && CanDraw()) 46 | { 47 | StringPaint.Draw("¾", position, w, new(), crownColor); 48 | } 49 | } 50 | 51 | public override void RandomUpdate() 52 | { 53 | //new Tree(position, w); 54 | } 55 | 56 | public override void AfterBurning() 57 | { 58 | if (ConsoleAdventure.rand.Next(0, 2) == 1) 59 | { 60 | new Charcoal(position, w); 61 | } 62 | 63 | 64 | else 65 | { 66 | base.AfterBurning(); 67 | } 68 | } 69 | } 70 | } -------------------------------------------------------------------------------- /ConsoleAdventure/Content/Scripts/WorldEngine/Objects/TextMark.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Xna.Framework; 2 | using System; 3 | using System.Text; 4 | 5 | namespace ConsoleAdventure.WorldEngine 6 | { 7 | [Serializable] 8 | public class TextMark : Transform 9 | { 10 | string text; 11 | 12 | public TextMark(Position position, int w, int worldLayer = -1) : base(position, (byte)w) 13 | { 14 | if (worldLayer == -1) this.worldLayer = World.BlocksLayerId; 15 | else this.worldLayer = (byte)worldLayer; 16 | 17 | type = (int)VanillaTransforms.textMark; 18 | 19 | AddTypeToMap(type); 20 | 21 | Initialize(); 22 | } 23 | 24 | public override string GetSymbol() 25 | { 26 | return "__"; 27 | } 28 | 29 | public override Color GetColor() 30 | { 31 | return Color.White; 32 | } 33 | 34 | public override void OnTheScreen() 35 | { 36 | int offset = text.Length / 4; 37 | Position pos = new Position(position.x - offset, position.y); 38 | 39 | if (position.y >= ConsoleAdventure.startDisplay.y && position.y < ConsoleAdventure.endDisplay.y) 40 | { 41 | StringBuilder sb = new StringBuilder(); 42 | 43 | for (int i = 0; i < text.Length; i++) 44 | { 45 | Position position = pos + new Position(i / 2, 0); 46 | 47 | if (position.x < ConsoleAdventure.startDisplay.x || position.x >= ConsoleAdventure.endDisplay.x) 48 | { 49 | sb.Append(" "); 50 | } 51 | 52 | else 53 | { 54 | sb.Append(text[i]); 55 | } 56 | } 57 | 58 | StringPaint.Draw(sb.ToString(), pos, w, new Vector2(), Color.White); 59 | } 60 | } 61 | 62 | public override object SaveData() 63 | { 64 | return text; 65 | } 66 | 67 | public override void LoadData(object data) 68 | { 69 | text = (string)data; 70 | } 71 | } 72 | } -------------------------------------------------------------------------------- /ConsoleAdventure/Content/Scripts/WorldEngine/Objects/Trees/AppleTree.cs: -------------------------------------------------------------------------------- 1 | using ConsoleAdventure.Content.Scripts.IO; 2 | using Microsoft.Xna.Framework; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | 8 | namespace ConsoleAdventure.WorldEngine 9 | { 10 | public class AppleTree : Tree 11 | { 12 | static string[] symbolsMap = new string[] 13 | { 14 | "-O", "O-", "Oʹ", 15 | ">O", "O~", "~O", 16 | "()", "o-", "~o" 17 | }; 18 | 19 | public AppleTree(Position position, int w, int worldLayer = -1) : base(position, (byte)w) 20 | { 21 | type = (int)VanillaTransforms.tree; 22 | AddTypeToMap(type); 23 | Initialize(); 24 | } 25 | 26 | public override object SetStaticData() 27 | { 28 | Tags tags = new Tags(); 29 | 30 | tags["Crown"] = new string[,] 31 | { 32 | { " ", " ", "¾¾", "¾¾", "¾¾", " ", " " }, 33 | { "¾¾", "¾¾", "¾¾", "¾¾", "¾¾", "¾¾", " " }, 34 | { "¾¾", "¾¾", "¾¾", "¾¾", "¾¾", "¾¾", "¾¾" }, 35 | { "¾¾", "¾¾", "¾¾", " ", "¾¾", "¾¾", "¾¾" }, 36 | { "¾¾", "¾¾", "¾¾", "¾¾", "¾¾", "¾¾", "¾¾" }, 37 | { "¾¾", "¾¾", "¾¾", "¾¾", "¾¾", "¾¾", " " }, 38 | { " ", "¾¾", "¾¾", "¾¾", "¾¾", " ", " ",}, 39 | }; 40 | 41 | tags["CrownColor"] = new Color(13, 152, 20) * 0.5f; 42 | 43 | tags["LogType"] = typeof(Log); 44 | tags["FruitType"] = typeof(Apple); 45 | 46 | return tags; 47 | } 48 | 49 | public override string GetSymbol() 50 | { 51 | return symbolsMap[Utils.HashNoise(position.x, position.y, symbolsMap.Length - 1)]; 52 | } 53 | 54 | public override Color GetColor() 55 | { 56 | return new(94, 61, 38); 57 | } 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /ConsoleAdventure/Content/Scripts/WorldEngine/Objects/Trees/PineTree.cs: -------------------------------------------------------------------------------- 1 | using ConsoleAdventure.Content.Scripts.IO; 2 | using Microsoft.Xna.Framework; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | 8 | namespace ConsoleAdventure.WorldEngine 9 | { 10 | public class PineTree : Tree 11 | { 12 | static string[] symbolsMap = new string[] 13 | { 14 | "-O", "O<", "Oʹ", 15 | ">O", "O~", "`O", 16 | "()", "o^", ">o" 17 | }; 18 | 19 | public PineTree(Position position, int w, int worldLayer = -1) : base(position, (byte)w) 20 | { 21 | type = (int)VanillaTransforms.pineTree; 22 | AddTypeToMap(type); 23 | Initialize(); 24 | } 25 | 26 | public override object SetStaticData() 27 | { 28 | Tags tags = new Tags(); 29 | 30 | tags["Crown"] = new string[,] 31 | { 32 | { " ", " ", "¾¾", " ", "¾¾", " ", " " }, 33 | { " ", "¾¾", "¾¾", " ¾", "¾¾", "¾¾", "¾ " }, 34 | { " ¾", "¾¾", "¾¾", "¾¾", "¾¾", "¾¾", " " }, 35 | { " ", "¾¾", "¾¾", " ", "¾¾", "¾¾", "¾ " }, 36 | { "¾¾", "¾¾", "¾¾", "¾¾", "¾¾", "¾¾", "¾¾" }, 37 | { " ¾", "¾¾", " ¾", "¾¾", "¾¾", "¾¾", " " }, 38 | { " ", " ", " ", "¾¾", " ¾", " ¾", " ",}, 39 | }; 40 | 41 | tags["CrownColor"] = new Color(42, 113, 26) * 0.7f; 42 | 43 | tags["LogType"] = typeof(Log); 44 | tags["FruitType"] = typeof(Apple); 45 | 46 | return tags; 47 | } 48 | 49 | public override string GetSymbol() 50 | { 51 | return symbolsMap[Utils.HashNoise(position.x, position.y, symbolsMap.Length - 1)]; 52 | } 53 | 54 | public override Color GetColor() 55 | { 56 | return new(88, 50, 22); 57 | } 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /ConsoleAdventure/Content/Scripts/WorldEngine/Objects/Trees/SpruceTree.cs: -------------------------------------------------------------------------------- 1 | using ConsoleAdventure.Content.Scripts.IO; 2 | using Microsoft.Xna.Framework; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | 8 | namespace ConsoleAdventure.WorldEngine 9 | { 10 | public class SpruceTree : Tree 11 | { 12 | static string[] symbolsMap = new string[] 13 | { 14 | "-O", "O-", "Oʹ", 15 | ">O", "O~", "~O", 16 | "()", "o-", "~o" 17 | }; 18 | 19 | public SpruceTree(Position position, int w, int worldLayer = -1) : base(position, (byte)w) 20 | { 21 | type = (int)VanillaTransforms.spruceTree; 22 | AddTypeToMap(type); 23 | Initialize(); 24 | } 25 | 26 | public override object SetStaticData() 27 | { 28 | Tags tags = new Tags(); 29 | 30 | tags["Crown"] = new string[,] 31 | { 32 | //{ " ", " ¾", "¾ ", " ", " ", " ", " " }, 33 | { " ", " ", "¾¾", "¾ ", " ¾", " ", " " }, 34 | { "¾¾", "¾ ", "¾¾", "¾¾", "¾¾", " ", "¾¾" }, 35 | { " ¾", "¾¾", "¾¾", "¾¾", "¾¾", "¾¾", "¾ " }, 36 | { "¾¾", "¾¾", "¾¾", " ", "¾¾", "¾¾", " " }, 37 | { " ", "¾¾", "¾¾", "¾¾", "¾¾", "¾¾", "¾¾" }, 38 | { " ¾", "¾¾", "¾¾", "¾¾", "¾¾", "¾¾", " ¾" }, 39 | { "¾¾", " ", "¾¾", "¾¾", " ", "¾¾", " " }, 40 | //{ " ", " ", "¾¾", " ", " ", " ¾", " " }, 41 | }; 42 | 43 | tags["CrownColor"] = new Color(17, 54, 27); 44 | 45 | tags["LogType"] = typeof(Log); 46 | tags["FruitType"] = typeof(Apple); 47 | 48 | return tags; 49 | } 50 | 51 | public override string GetSymbol() 52 | { 53 | return symbolsMap[Utils.HashNoise(position.x, position.y, symbolsMap.Length - 1)]; 54 | } 55 | 56 | public override Color GetColor() 57 | { 58 | return new(94, 61, 38); 59 | } 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /ConsoleAdventure/Content/Scripts/WorldEngine/Objects/UnloadedTransform.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Xna.Framework; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | 6 | namespace ConsoleAdventure.WorldEngine 7 | { 8 | [Serializable] 9 | public class UnloadedTransform : Transform 10 | { 11 | public object data = null; 12 | 13 | public UnloadedTransform(Position position, int w, int worldLayer, int modType) : base(position, (byte)w) 14 | { 15 | if (worldLayer == -1) this.worldLayer = World.BlocksLayerId; 16 | else this.worldLayer = (byte)worldLayer; 17 | 18 | type = (byte)modType; 19 | isObstacle = true; 20 | hardness = 1f; 21 | 22 | Initialize(); 23 | } 24 | 25 | public override string GetSymbol() 26 | { 27 | return " ?"; 28 | } 29 | 30 | public override Color? GetBGColor() 31 | { 32 | Color color = new Color(255, 0, 255); 33 | 34 | if (worldLayer == 0) color = new Color(90, 0, 90); 35 | 36 | return color; 37 | } 38 | 39 | public override Color GetColor() 40 | { 41 | return new Color(10, 0, 10); 42 | } 43 | 44 | public override string ModifyTooltip() 45 | { 46 | string name = Localization.GetTranslation("Transforms", "Unloaded") + ":" + 47 | world.modTransforms.FirstOrDefault(x => x.Value == type).Key; 48 | 49 | string degree = degreeDestruction > 0 ? $" ({100 - degreeDestruction} / 100)" : ""; 50 | return name + degree; 51 | } 52 | 53 | public override object SaveData() 54 | { 55 | return data; 56 | } 57 | 58 | public override void LoadData(object data) 59 | { 60 | this.data = data; 61 | } 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /ConsoleAdventure/Content/Scripts/WorldEngine/Objects/Wall.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Xna.Framework; 2 | using System; 3 | using System.Collections.Generic; 4 | 5 | namespace ConsoleAdventure.WorldEngine 6 | { 7 | [Serializable] 8 | public class Wall : Transform 9 | { 10 | public Wall(Position position, int w, int worldLayer = -1) : base(position, (byte)w) 11 | { 12 | if (worldLayer == -1) this.worldLayer = World.BlocksLayerId; 13 | else this.worldLayer = (byte)worldLayer; 14 | 15 | type = (int)VanillaTransforms.wall; 16 | isObstacle = true; 17 | 18 | AddTypeToMap(type); 19 | 20 | Initialize(); 21 | } 22 | 23 | public override void Collapse() 24 | { 25 | new Loot(position, w, new List() { new Stack(new WallItem(), 1) }); 26 | } 27 | 28 | public override string GetSymbol() 29 | { 30 | return "##"; 31 | } 32 | 33 | public override Color GetColor() 34 | { 35 | return Color.White; 36 | } 37 | } 38 | } -------------------------------------------------------------------------------- /ConsoleAdventure/Content/Scripts/WorldEngine/Objects/Water.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Xna.Framework; 2 | using System; 3 | 4 | namespace ConsoleAdventure.WorldEngine 5 | { 6 | [Serializable] 7 | public class Water : Transform 8 | { 9 | public Water(Position position, int w, int worldLayer = -1) : base(position, (byte)w) 10 | { 11 | if (worldLayer == -1) this.worldLayer = World.BlocksLayerId; 12 | else this.worldLayer = (byte)worldLayer; 13 | 14 | type = (int)VanillaTransforms.water; 15 | //isObstacle = true; 16 | hardness = -1; 17 | 18 | AddTypeToMap(type); 19 | 20 | Initialize(); 21 | } 22 | 23 | public override string GetSymbol() 24 | { 25 | return "≈≈"; 26 | } 27 | 28 | public override Color GetColor() 29 | { 30 | return new(16, 29, 211); 31 | } 32 | } 33 | } -------------------------------------------------------------------------------- /ConsoleAdventure/Content/Scripts/WorldEngine/Objects/Web.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Xna.Framework; 2 | using System; 3 | using System.Collections.Generic; 4 | 5 | namespace ConsoleAdventure.WorldEngine 6 | { 7 | [Serializable] 8 | public class Web : Transform 9 | { 10 | public Web(Position position, int w, int worldLayer = -1) : base(position, (byte)w) 11 | { 12 | if (worldLayer == -1) this.worldLayer = World.BlocksLayerId; 13 | else this.worldLayer = (byte)worldLayer; 14 | 15 | type = (int)VanillaTransforms.web; 16 | isObstacle = false; 17 | hardness = 0.1f; 18 | burnType = 0; 19 | 20 | AddTypeToMap(type); 21 | 22 | Initialize(); 23 | } 24 | 25 | public override void Collapse() 26 | { 27 | new Loot(position, w, new List() { new Stack(new WebItem(), 1) }); 28 | } 29 | 30 | public override string GetSymbol() 31 | { 32 | return "¼¼"; 33 | } 34 | 35 | public override Color GetColor() 36 | { 37 | return new Color(120, 120, 120); 38 | } 39 | } 40 | } -------------------------------------------------------------------------------- /ConsoleAdventure/Content/Scripts/WorldEngine/Observer.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace ConsoleAdventure.Content.Scripts.WorldEngine 8 | { 9 | public class Observer 10 | { 11 | public Position position; 12 | public int w; 13 | public Observer(Position pos, int w) 14 | { 15 | this.position = pos; 16 | this.w = w; 17 | } 18 | } 19 | } -------------------------------------------------------------------------------- /ConsoleAdventure/Content/Scripts/WorldEngine/RenderFieldType.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace ConsoleAdventure.WorldEngine 4 | { 5 | [Serializable] 6 | public enum RenderFieldType { 7 | empty, 8 | player, 9 | wall, 10 | loot, 11 | tree, 12 | floor, 13 | door, 14 | ruine, 15 | water, 16 | log, 17 | entity, 18 | cat, 19 | chest, 20 | grass, 21 | 22 | stone, //+ 23 | granite, //+ 24 | quartz, //+ 25 | feldspar, 26 | graniteFloor, //+ 27 | feldsparFloor, 28 | quartzite, 29 | redQuartzite, 30 | yellowQuartzite, 31 | quartziteFloor, 32 | dirt, 33 | dirtFloor, 34 | sand, 35 | sandFloor, 36 | sandstone, 37 | clay, 38 | clayFloor, 39 | brownIronOre, //+ 40 | basalt, 41 | basaltFloor, 42 | obsidian, 43 | obsidianFloor, 44 | slate, 45 | onyx, 46 | amethyst, 47 | fossil, 48 | marble, 49 | marbleFloor, 50 | chalk, 51 | chalkFloor, 52 | moss, 53 | mossFloor, 54 | redMoss, 55 | redMossFloor, 56 | fungus, 57 | fungusFloor, 58 | descent, //+ 59 | climb, //+ 60 | 61 | workbench, 62 | furnace, 63 | anvil, 64 | bomb, 65 | explosion, 66 | web, 67 | graniteWall, 68 | torch, 69 | stalactite, 70 | woodFloor, 71 | brokenLog, 72 | leaves, 73 | seedling, 74 | zoisite, 75 | ruby, 76 | salt, 77 | fire, 78 | charcoal, 79 | charcoalFloor, 80 | highTemperatureFire, 81 | } 82 | } -------------------------------------------------------------------------------- /ConsoleAdventure/Content/Scripts/WorldEngine/SpawnCondition.cs: -------------------------------------------------------------------------------- 1 | using ConsoleAdventure.Content.Scripts; 2 | using ConsoleAdventure.WorldEngine; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Linq; 6 | using System.Text; 7 | using System.Threading.Tasks; 8 | 9 | namespace ConsoleAdventure.WorldEngine 10 | { 11 | public struct SpawnCondition 12 | { 13 | private short mobType = (short)VanillaTransforms.entity; 14 | private double probability = 0; 15 | public Range wRange = new(0, 0); 16 | public List biomes = new(); 17 | 18 | public double Probability 19 | { 20 | get { return probability; } 21 | set 22 | { 23 | probability = Math.Clamp(value, 0, 1); 24 | } 25 | } 26 | 27 | public short MobType 28 | { 29 | get { return mobType; } 30 | set 31 | { 32 | if (value >= 0 && value < Transform.TypeMapping.Length) 33 | { 34 | Type type = Transform.TypeMapping[value]; 35 | 36 | if (type != null) 37 | { 38 | if (type.IsSubclassOf(typeof(Entity))) 39 | { 40 | mobType = value; 41 | return; 42 | } 43 | } 44 | } 45 | } 46 | } 47 | 48 | public SpawnCondition(short mobType, Range wRange, List biomes, double probability) 49 | { 50 | MobType = mobType; 51 | this.wRange = wRange; 52 | this.biomes = biomes; 53 | Probability = probability; 54 | } 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /ConsoleAdventure/Content/Scripts/WorldEngine/StringPaint.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using ConsoleAdventure.Content.Scripts.Player; 6 | using ConsoleAdventure.Content.Scripts.WorldEngine.Events; 7 | using Microsoft.Xna.Framework; 8 | using Microsoft.Xna.Framework.Graphics; 9 | 10 | namespace ConsoleAdventure.WorldEngine 11 | { 12 | public static class StringPaint 13 | { 14 | private static List drawableUnits = new(); 15 | 16 | private struct DrawableUnit 17 | { 18 | public string text; 19 | public Vector2 position; 20 | public int w; 21 | public Color color; 22 | public float rotation; 23 | 24 | public DrawableUnit(string text, Position worldPos, int w, Vector2 offset, Color color, float rotation) 25 | { 26 | this.text = text; 27 | this.w = w; 28 | this.color = color; 29 | position = worldPos.ToVector2() + offset; 30 | this.rotation = rotation; 31 | } 32 | } 33 | 34 | public static void Draw(string text, Position worldPos, int w, Vector2 offset, Color color, float rotation = 0) 35 | { 36 | drawableUnits.Add(new(text, worldPos, w, offset, color, rotation)); 37 | } 38 | 39 | internal static void DrawUnits(Vector2 startPos) 40 | { 41 | for (int i = 0; i < GameEvent.Events.Count; i++) 42 | { 43 | if (GameEvent.Events[i].IsActive()) 44 | { 45 | GameEvent.Events[i].Draw(); 46 | } 47 | } 48 | 49 | int playerW = ConsoleAdventure.world.GetLocalPlayer().w; 50 | for (int i = 0; i < drawableUnits.Count; i++) 51 | { 52 | DrawableUnit unit = drawableUnits[i]; 53 | if (unit.w == playerW) 54 | { 55 | Vector2 position = ((unit.position - startPos) * ConsoleAdventure.cellSize) + ConsoleAdventure.worldPos; 56 | ConsoleAdventure._spriteBatch.DrawString(ConsoleAdventure.Font, unit.text, position, unit.color, unit.rotation, Vector2.Zero, 1, 0, 0); 57 | } 58 | } 59 | } 60 | 61 | public static void Clear() 62 | { 63 | drawableUnits.Clear(); 64 | } 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /ConsoleAdventure/Content/Scripts/WorldEngine/UnloadedChunk.cs: -------------------------------------------------------------------------------- 1 | using SharpDX.Direct2D1; 2 | using System; 3 | using System.Collections.Generic; 4 | 5 | namespace ConsoleAdventure.WorldEngine 6 | { 7 | [Serializable] 8 | public class UnloadedChunk : Chunk 9 | { 10 | public short[,,,] fields; 11 | public List data = new(); 12 | 13 | public UnloadedChunk() 14 | { 15 | fields = new short[Size, Size, World.CountOfLayers, maxDeep]; 16 | } 17 | } 18 | 19 | public struct TransformDataInChunk 20 | { 21 | public Position position = new(); 22 | public byte z; 23 | public byte w; 24 | public object data; 25 | 26 | public TransformDataInChunk(short x, short y, byte z, byte w, object data) 27 | { 28 | position.x = x; 29 | position.y = y; 30 | this.z = z; 31 | this.w = w; 32 | this.data = data; 33 | } 34 | } 35 | } -------------------------------------------------------------------------------- /ConsoleAdventure/Content/Scripts/WorldEngine/VanillaTransforms.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace ConsoleAdventure.WorldEngine 4 | { 5 | [Serializable] 6 | public enum VanillaTransforms { 7 | empty, 8 | player, 9 | wall, 10 | loot, 11 | tree, 12 | floor, 13 | door, 14 | ruine, 15 | water, 16 | log, 17 | entity, 18 | cat, 19 | chest, 20 | grass, 21 | 22 | stone, //+ 23 | granite, //+ 24 | quartz, //+ 25 | feldspar, 26 | graniteFloor, //+ 27 | feldsparFloor, 28 | quartzite, 29 | redQuartzite, 30 | yellowQuartzite, 31 | quartziteFloor, 32 | blackSoil, 33 | blackSoilFloor, 34 | sand, 35 | sandFloor, 36 | sandstone, 37 | clay, 38 | clayFloor, 39 | brownIronOre, //+ 40 | basalt, 41 | basaltFloor, 42 | obsidian, 43 | obsidianFloor, 44 | slate, 45 | onyx, 46 | amethyst, 47 | fossil, 48 | marble, 49 | marbleFloor, 50 | chalk, 51 | chalkFloor, 52 | moss, 53 | mossFloor, 54 | redMoss, 55 | redMossFloor, 56 | fungus, 57 | fungusFloor, 58 | descent, //+ 59 | climb, //+ 60 | 61 | workbench, 62 | furnace, 63 | anvil, 64 | bomb, 65 | explosion, 66 | web, 67 | graniteWall, 68 | torch, 69 | stalactite, 70 | woodFloor, 71 | brokenLog, 72 | leaves, 73 | seedling, 74 | zoisite, 75 | ruby, 76 | salt, 77 | fire, 78 | charcoal, 79 | charcoalFloor, 80 | highTemperatureFire, 81 | biotite, 82 | 83 | limestone, 84 | limestoneFloor, 85 | brownEarth, 86 | brownEarthFloor, 87 | alfisol, 88 | alfisolFloor, 89 | textMark, 90 | 91 | spruceTree, 92 | pineTree, 93 | cedarTree, 94 | firTree, 95 | larchTree 96 | } 97 | } -------------------------------------------------------------------------------- /ConsoleAdventure/Content/Scripts/WorldEngine/WorldLevel.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace ConsoleAdventure.WorldEngine 8 | { 9 | public class WorldLevel 10 | { 11 | 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /ConsoleAdventure/Content/Scripts/WorldEngine/WorldLevelsSystem.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using ConsoleAdventure.WorldEngine.Levels; 5 | using System.Threading.Tasks; 6 | using CaModLoaderAPI; 7 | 8 | namespace ConsoleAdventure.WorldEngine 9 | { 10 | public class WorldLevelsSystem 11 | { 12 | public List Levels { get; private set; } 13 | 14 | public WorldLevelsSystem(List levels) 15 | { 16 | Chunk.maxDeep = 1; 17 | 18 | if (levels == null) 19 | { 20 | Levels = new List 21 | { 22 | new LavaCavern(), 23 | new Cavern(), 24 | new Sedimentary(), 25 | new Surface() 26 | }; 27 | 28 | foreach (Mod mod in CaModLoader.GetActiveMods()) 29 | { 30 | List newLevels = mod.ModifyWorldLevels(Levels); 31 | 32 | if (newLevels != null) 33 | { 34 | Levels = newLevels; 35 | } 36 | } 37 | } 38 | 39 | else 40 | { 41 | Levels = levels; 42 | } 43 | 44 | for (int i = 0; i < Levels.Count; i++) 45 | { 46 | if (Levels[i] == null) 47 | { 48 | Levels.RemoveAt(i); 49 | i--; 50 | } 51 | } 52 | 53 | Chunk.maxDeep = Levels.Count; 54 | } 55 | 56 | /// 57 | /// Метод получение координаты по оси W, используя экземпляр класса уровня. если уровня нет, то вернётся -1 58 | /// 59 | /// 60 | /// 61 | public int GetLevel(WorldLevel level) 62 | { 63 | Type type = level.GetType(); 64 | 65 | for (int i = 0; i < Levels.Count; i++) 66 | { 67 | if (Levels[i].GetType() == type) 68 | { 69 | return i; 70 | } 71 | } 72 | 73 | return -1; 74 | } 75 | } 76 | } 77 | -------------------------------------------------------------------------------- /ConsoleAdventure/Content/logoAnim.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AbdSayen/ConsoleAdventure/eefe459dbb5f531d66e530e0d5a9319808e1a20e/ConsoleAdventure/Content/logoAnim.png -------------------------------------------------------------------------------- /ConsoleAdventure/FontEditor.cs: -------------------------------------------------------------------------------- 1 | using CaModLoaderAPI; 2 | using Microsoft.VisualBasic.Logging; 3 | using Microsoft.Xna.Framework; 4 | using Microsoft.Xna.Framework.Content; 5 | using Microsoft.Xna.Framework.Graphics; 6 | using System; 7 | using System.Collections.Generic; 8 | using System.Linq; 9 | using System.Text; 10 | using System.Threading.Tasks; 11 | 12 | namespace ConsoleAdventure 13 | { 14 | public class FontEditor 15 | { 16 | public static void ModifyChars(ContentManager content) 17 | { 18 | ConsoleAdventure.SetFont(content.Load("Fonts/font")); 19 | 20 | Texture2D fontTexture = ConsoleAdventure.Font.Texture; 21 | 22 | Color[] pixelData = new Color[fontTexture.Width * fontTexture.Height]; 23 | fontTexture.GetData(pixelData); 24 | 25 | List mods = CaModLoader.GetActiveMods(); 26 | for (int i = -1; i < mods.Count; i++) 27 | { 28 | if (i == -1) 29 | { 30 | 31 | } 32 | 33 | else 34 | { 35 | 36 | } 37 | } 38 | } 39 | 40 | private static void ReplaceChar(Color[] fontColors, Texture2D texture, Vector2 position) 41 | { 42 | Color[] colors = new Color[texture.Width * texture.Height]; 43 | texture.GetData(colors); 44 | 45 | for (int y = 0; y < texture.Height; y++) 46 | { 47 | for (int x = 0; x < texture.Width; x++) 48 | { 49 | Color color = colors[x + y * texture.Width]; 50 | } 51 | } 52 | } 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /ConsoleAdventure/Icon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AbdSayen/ConsoleAdventure/eefe459dbb5f531d66e530e0d5a9319808e1a20e/ConsoleAdventure/Icon.ico -------------------------------------------------------------------------------- /ConsoleAdventure/Program.cs: -------------------------------------------------------------------------------- 1 | using ConsoleAdventure.Content.Scripts.IO; 2 | using System; 3 | using System.Text; 4 | 5 | namespace ConsoleAdventure 6 | { 7 | public class Program 8 | { 9 | public static readonly string savePath = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\ConsoleAdventure\\"; 10 | public static readonly string pcIdPath = savePath + "pc.id"; 11 | 12 | public static ConsoleAdventure game; 13 | 14 | [STAThreadAttribute] 15 | public static void Main() 16 | { 17 | game = new ConsoleAdventure(); 18 | 19 | try 20 | { 21 | game.Run(); 22 | } 23 | catch (Exception ex) 24 | { 25 | ConsoleAdventure.logger.AddException(ex); 26 | 27 | try 28 | { 29 | if (ConsoleAdventure.world != null) 30 | { 31 | StringBuilder name = new(); 32 | name.Append($"({ConsoleAdventure.world.name})"); 33 | int count = ConsoleAdventure.rand.Next(10, 16); 34 | 35 | for (int i = 0; i < count; i++) 36 | { 37 | string symbol = ""; 38 | int type = ConsoleAdventure.rand.Next(0, 3); 39 | Encoding encoding = Encoding.ASCII; 40 | 41 | if (type == 0) 42 | symbol = encoding.GetString(new byte[1] { (byte)ConsoleAdventure.rand.Next(48, 58) }); 43 | 44 | else if (type == 1) 45 | symbol = encoding.GetString(new byte[1] { (byte)ConsoleAdventure.rand.Next(65, 91) }); 46 | 47 | else if (type == 2) 48 | symbol = encoding.GetString(new byte[1] { (byte)ConsoleAdventure.rand.Next(97, 123) }); 49 | 50 | name.Append(symbol); 51 | } 52 | 53 | WorldIO.Save(name.ToString()); 54 | } 55 | } 56 | 57 | catch (Exception ex1) 58 | { 59 | ConsoleAdventure.logger.AddException(ex1); 60 | throw; 61 | } 62 | 63 | throw; 64 | } 65 | } 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /ConsoleAdventure/app.manifest: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | true/pm 39 | permonitorv2,permonitor 40 | 41 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # The Console Adventure 2 | 3 | **The Console Adventure** is a project created on May 16 2024. 4 | This game should be a *RPG*. 5 | 6 | ## Game features 7 | Currently this game supports features like: 8 | > Create new, Save/Load World 9 | > 10 | > Building 11 | > 12 | > Write, Download and Use Mods 13 | > 14 | > Multiplayer (in progress) 15 | > 16 | > Craft items 17 | > 18 | > Craft Book 19 | > 20 | > Mine in caves 21 | > 22 | > and much more ) 23 | 24 | ## Author 25 | **Youtube channel with dev logs about this project [here](https://youtube.com/@bondscreators?si=1MNw7WM65vtAx_gr)** 26 | 27 | ## Download the game 28 | **Telegram channel [click](https://t.me/bondschanel)** 29 | 30 | --------------------------------------------------------------------------------