├── eugFile ├── nbproject │ ├── .cvsignore │ ├── genfiles.properties │ ├── project.xml │ └── project.properties ├── Authors.txt ├── test-lib │ ├── junit-4.12.jar │ └── hamcrest-core-1.3.jar ├── lib │ └── jflex-full-1.8.2.jar ├── test │ └── testLoadFromZip.eu4 ├── .gitignore ├── src │ └── eug │ │ ├── shared │ │ ├── ModHandler.java │ │ ├── SpecificObject.java │ │ ├── WritableObject.java │ │ ├── Version.java │ │ ├── Scenario.java │ │ ├── HeaderComment.java │ │ ├── EuropaModHandler.java │ │ ├── Utilities.java │ │ ├── InlineComment.java │ │ └── Comment.java │ │ └── parser │ │ ├── ParserException.java │ │ └── TokenType.java └── Readme.txt ├── .github ├── FUNDING.yml └── workflows │ ├── ant.yml │ └── codeql-analysis.yml ├── PositionsEditor ├── pos-ed.bat ├── .gitignore ├── manifest.mf ├── src │ └── posed │ │ ├── EditorDialog.java │ │ ├── MapPanelDataModel.java │ │ ├── MapPanel.form │ │ └── ProvincePanel.form ├── config.txt ├── nbproject │ ├── genfiles.properties │ ├── project.xml │ └── project.properties └── Changelog.txt ├── EugSyntax ├── .gitignore ├── manifest.mf ├── nbproject │ ├── genfiles.properties │ ├── project.xml │ └── project.properties └── src │ └── eug │ └── syntax │ ├── StyleSet.java │ └── EUGEditorKit.java ├── EU3_Scenario_Editor ├── config.txt ├── scen-ed.bat ├── .gitignore ├── Changelog.txt ├── src │ ├── editor │ │ ├── zoomin.bmp │ │ ├── zoomin.gif │ │ ├── zoomout.bmp │ │ ├── zoomout.gif │ │ ├── mapmode │ │ │ ├── ProvinceMode.java │ │ │ ├── SingleAreaMode.java │ │ │ ├── SuperRegionMode.java │ │ │ ├── ProvinceGroupMode.java │ │ │ ├── ClimateMode.java │ │ │ ├── NativeGroupMode.java │ │ │ ├── ContinentMode.java │ │ │ ├── MapMode.java │ │ │ ├── PopMode.java │ │ │ ├── HistoryExistsMode.java │ │ │ ├── SingleRegionMode.java │ │ │ ├── AdvancedCustomMode.java │ │ │ ├── HistorySimpleTerrainMode.java │ │ │ ├── GroupMode.java │ │ │ ├── CK3DevelopmentMapMode.java │ │ │ ├── CountryFlagMode.java │ │ │ ├── CountryMode.java │ │ │ ├── CoreMapMode.java │ │ │ ├── SingleCountryMode.java │ │ │ ├── ProvReligionMode.java │ │ │ ├── DevelopmentMapMode.java │ │ │ ├── CountryHistoryExistsMode.java │ │ │ ├── CapitalsMode.java │ │ │ ├── ProvinceFlagMode.java │ │ │ ├── AdvancedCustomCountryMode.java │ │ │ ├── ProvCultureMode.java │ │ │ ├── CultureGroupMode.java │ │ │ ├── PopSplitMapMode.java │ │ │ ├── SimpleTerrainMode.java │ │ │ ├── HotspotMode.java │ │ │ ├── CustomCountryMode.java │ │ │ ├── IsPlayerMapMode.java │ │ │ ├── CtryReligionMode.java │ │ │ └── ProvincePaintingMode.java │ │ └── MapPanel.form │ └── images │ │ ├── GitHub-Mark-32px.png │ │ ├── pdx-icon-32x32.png │ │ ├── Discord-Logo-Color.png │ │ └── Digital-Patreon-Logo_FieryCoral.png ├── manifest.mf ├── editor_cfg.txt ├── nbproject │ ├── genfiles.properties │ ├── project.xml │ └── project.properties └── colors.txt ├── screenshot.png ├── EugFile_specific ├── .gitignore ├── test-lib │ ├── junit-4.12.jar │ └── hamcrest-core-1.3.jar ├── src │ └── eug │ │ └── specific │ │ ├── ck │ │ ├── CKScenario.java │ │ ├── Country.java │ │ ├── CKSpecificObject.java │ │ ├── Province.java │ │ └── Character.java │ │ ├── victoria2 │ │ ├── Vic2DataSource.java │ │ └── Vic2SaveGame.java │ │ ├── victoria │ │ ├── VicSpecificObject.java │ │ ├── Population.java │ │ └── VicCountry.java │ │ ├── eu2 │ │ ├── EU2SpecificObject.java │ │ ├── LandUnit.java │ │ ├── Monarch.java │ │ └── Leader.java │ │ ├── eu3 │ │ ├── EU3SpecificObject.java │ │ ├── EU3Scenario.java │ │ ├── EU3Event.java │ │ ├── EU3Province.java │ │ └── EU3Text.java │ │ ├── ck2 │ │ └── CK2DataSource.java │ │ └── ck3 │ │ └── CK3DataSource.java └── nbproject │ ├── genfiles.properties │ ├── project.xml │ └── project.properties ├── multi-edit-demo.gif ├── screenshot-editor.png ├── screenshot-menu.png ├── screenshot-religions.png ├── screenshot-tradenodes.png ├── Rome_Scenario_Editor ├── manifest.mf ├── src │ └── editor │ │ ├── zoomin.bmp │ │ ├── zoomin.gif │ │ ├── zoomout.bmp │ │ ├── zoomout.gif │ │ ├── mapmode │ │ ├── ProvinceMode.java │ │ ├── MapMode.java │ │ ├── AdvancedCustomMode.java │ │ ├── CountryMode.java │ │ ├── GroupMode.java │ │ ├── CoreMapMode.java │ │ ├── GoodsMode.java │ │ ├── SingleCountryMode.java │ │ ├── CapitalsMode.java │ │ ├── AdvancedCustomCountryMode.java │ │ ├── FortMapMode.java │ │ ├── PopSplitMapMode.java │ │ ├── CustomCountryMode.java │ │ ├── CtryReligionMode.java │ │ ├── PoliticalMode.java │ │ └── CustomMode.java │ │ ├── MapPanel.form │ │ ├── Main.java │ │ ├── TestEditorDialog.java │ │ └── Text.java ├── editor_cfg.txt ├── nbproject │ ├── genfiles.properties │ ├── project.xml │ └── project.properties └── config.txt ├── .gitignore └── README.md /eugFile/nbproject/.cvsignore: -------------------------------------------------------------------------------- 1 | private 2 | -------------------------------------------------------------------------------- /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | patreon: user?u=60455822 2 | -------------------------------------------------------------------------------- /PositionsEditor/pos-ed.bat: -------------------------------------------------------------------------------- 1 | java -jar PositionsEditor.jar 2 | pause -------------------------------------------------------------------------------- /EugSyntax/.gitignore: -------------------------------------------------------------------------------- 1 | /build/ 2 | /dist/ 3 | /nbproject/private/ 4 | *.zip -------------------------------------------------------------------------------- /EU3_Scenario_Editor/config.txt: -------------------------------------------------------------------------------- 1 | #Automatically generated file 2 | game = dw 3 | -------------------------------------------------------------------------------- /screenshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mmyers/eug/HEAD/screenshot.png -------------------------------------------------------------------------------- /EugFile_specific/.gitignore: -------------------------------------------------------------------------------- 1 | /build/ 2 | /dist/ 3 | /nbproject/private/ 4 | *.zip -------------------------------------------------------------------------------- /eugFile/Authors.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mmyers/eug/HEAD/eugFile/Authors.txt -------------------------------------------------------------------------------- /multi-edit-demo.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mmyers/eug/HEAD/multi-edit-demo.gif -------------------------------------------------------------------------------- /screenshot-editor.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mmyers/eug/HEAD/screenshot-editor.png -------------------------------------------------------------------------------- /screenshot-menu.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mmyers/eug/HEAD/screenshot-menu.png -------------------------------------------------------------------------------- /screenshot-religions.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mmyers/eug/HEAD/screenshot-religions.png -------------------------------------------------------------------------------- /screenshot-tradenodes.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mmyers/eug/HEAD/screenshot-tradenodes.png -------------------------------------------------------------------------------- /EU3_Scenario_Editor/scen-ed.bat: -------------------------------------------------------------------------------- 1 | @java -version 2 | java -jar EU3_Scenario_Editor.jar 3 | pause 4 | -------------------------------------------------------------------------------- /PositionsEditor/.gitignore: -------------------------------------------------------------------------------- 1 | /build/ 2 | /dist/ 3 | /nbproject/private/ 4 | *.zip 5 | *.log 6 | mapcheck.txt -------------------------------------------------------------------------------- /eugFile/test-lib/junit-4.12.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mmyers/eug/HEAD/eugFile/test-lib/junit-4.12.jar -------------------------------------------------------------------------------- /EU3_Scenario_Editor/.gitignore: -------------------------------------------------------------------------------- 1 | /build/ 2 | /dist/ 3 | /nbproject/private/ 4 | /.scannerwork/ 5 | *.zip 6 | *.log -------------------------------------------------------------------------------- /EU3_Scenario_Editor/Changelog.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mmyers/eug/HEAD/EU3_Scenario_Editor/Changelog.txt -------------------------------------------------------------------------------- /eugFile/lib/jflex-full-1.8.2.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mmyers/eug/HEAD/eugFile/lib/jflex-full-1.8.2.jar -------------------------------------------------------------------------------- /eugFile/test/testLoadFromZip.eu4: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mmyers/eug/HEAD/eugFile/test/testLoadFromZip.eu4 -------------------------------------------------------------------------------- /EugSyntax/manifest.mf: -------------------------------------------------------------------------------- 1 | Manifest-Version: 1.0 2 | X-COMMENT: Main-Class will be added automatically by build 3 | 4 | -------------------------------------------------------------------------------- /PositionsEditor/manifest.mf: -------------------------------------------------------------------------------- 1 | Manifest-Version: 1.0 2 | X-COMMENT: Main-Class will be added automatically by build 3 | 4 | -------------------------------------------------------------------------------- /eugFile/.gitignore: -------------------------------------------------------------------------------- 1 | /build/ 2 | /dist/ 3 | /nbproject/private/ 4 | *.zip 5 | 6 | # Backup files created by JFlex 7 | *.java~ -------------------------------------------------------------------------------- /eugFile/test-lib/hamcrest-core-1.3.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mmyers/eug/HEAD/eugFile/test-lib/hamcrest-core-1.3.jar -------------------------------------------------------------------------------- /EU3_Scenario_Editor/src/editor/zoomin.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mmyers/eug/HEAD/EU3_Scenario_Editor/src/editor/zoomin.bmp -------------------------------------------------------------------------------- /EU3_Scenario_Editor/src/editor/zoomin.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mmyers/eug/HEAD/EU3_Scenario_Editor/src/editor/zoomin.gif -------------------------------------------------------------------------------- /EugFile_specific/test-lib/junit-4.12.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mmyers/eug/HEAD/EugFile_specific/test-lib/junit-4.12.jar -------------------------------------------------------------------------------- /Rome_Scenario_Editor/manifest.mf: -------------------------------------------------------------------------------- 1 | Manifest-Version: 1.0 2 | X-COMMENT: Main-Class will be added automatically by build 3 | 4 | -------------------------------------------------------------------------------- /EU3_Scenario_Editor/src/editor/zoomout.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mmyers/eug/HEAD/EU3_Scenario_Editor/src/editor/zoomout.bmp -------------------------------------------------------------------------------- /EU3_Scenario_Editor/src/editor/zoomout.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mmyers/eug/HEAD/EU3_Scenario_Editor/src/editor/zoomout.gif -------------------------------------------------------------------------------- /PositionsEditor/src/posed/EditorDialog.java: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mmyers/eug/HEAD/PositionsEditor/src/posed/EditorDialog.java -------------------------------------------------------------------------------- /Rome_Scenario_Editor/src/editor/zoomin.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mmyers/eug/HEAD/Rome_Scenario_Editor/src/editor/zoomin.bmp -------------------------------------------------------------------------------- /Rome_Scenario_Editor/src/editor/zoomin.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mmyers/eug/HEAD/Rome_Scenario_Editor/src/editor/zoomin.gif -------------------------------------------------------------------------------- /Rome_Scenario_Editor/src/editor/zoomout.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mmyers/eug/HEAD/Rome_Scenario_Editor/src/editor/zoomout.bmp -------------------------------------------------------------------------------- /Rome_Scenario_Editor/src/editor/zoomout.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mmyers/eug/HEAD/Rome_Scenario_Editor/src/editor/zoomout.gif -------------------------------------------------------------------------------- /EugFile_specific/test-lib/hamcrest-core-1.3.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mmyers/eug/HEAD/EugFile_specific/test-lib/hamcrest-core-1.3.jar -------------------------------------------------------------------------------- /EU3_Scenario_Editor/src/images/GitHub-Mark-32px.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mmyers/eug/HEAD/EU3_Scenario_Editor/src/images/GitHub-Mark-32px.png -------------------------------------------------------------------------------- /EU3_Scenario_Editor/src/images/pdx-icon-32x32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mmyers/eug/HEAD/EU3_Scenario_Editor/src/images/pdx-icon-32x32.png -------------------------------------------------------------------------------- /EU3_Scenario_Editor/src/images/Discord-Logo-Color.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mmyers/eug/HEAD/EU3_Scenario_Editor/src/images/Discord-Logo-Color.png -------------------------------------------------------------------------------- /EU3_Scenario_Editor/src/images/Digital-Patreon-Logo_FieryCoral.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mmyers/eug/HEAD/EU3_Scenario_Editor/src/images/Digital-Patreon-Logo_FieryCoral.png -------------------------------------------------------------------------------- /EU3_Scenario_Editor/manifest.mf: -------------------------------------------------------------------------------- 1 | Manifest-Version: 1.0 2 | Class-Path: lib/EugFile.jar lib/EugFile_specific.jar lib/EugSyntax.jar 3 | X-COMMENT: Main-Class will be added automatically by build 4 | 5 | -------------------------------------------------------------------------------- /EU3_Scenario_Editor/editor_cfg.txt: -------------------------------------------------------------------------------- 1 | # Configuration file for the text editor 2 | editor.font.name = "Monospaced" 3 | editor.font.style = PLAIN # One of PLAIN, BOLD, or ITALIC (currently unused) 4 | editor.font.size = 12 # Others to come... 5 | -------------------------------------------------------------------------------- /Rome_Scenario_Editor/editor_cfg.txt: -------------------------------------------------------------------------------- 1 | # Configuration file for the text editor 2 | editor.font.name = "Monospaced" 3 | editor.font.style = PLAIN # One of PLAIN, BOLD, or ITALIC (currently unused) 4 | editor.font.size = 12 # Others to come... 5 | -------------------------------------------------------------------------------- /eugFile/src/eug/shared/ModHandler.java: -------------------------------------------------------------------------------- 1 | package eug.shared; 2 | 3 | import java.io.File; 4 | 5 | /** 6 | * 7 | * @author Michael 8 | */ 9 | public interface ModHandler { 10 | 11 | public String resolveDirectory(String path); 12 | public String resolveFilename(String filename); 13 | public File[] listFiles(String path); 14 | } 15 | -------------------------------------------------------------------------------- /EugFile_specific/src/eug/specific/ck/CKScenario.java: -------------------------------------------------------------------------------- 1 | /* 2 | * CKScenario.java 3 | * 4 | * Created on July 13, 2006, 1:17 PM 5 | */ 6 | 7 | package eug.specific.ck; 8 | 9 | import eug.shared.Scenario; 10 | 11 | /** 12 | * 13 | * @author Michael Myers 14 | */ 15 | public class CKScenario extends Scenario { 16 | 17 | /** Creates a new instance of CKScenario */ 18 | public CKScenario() { 19 | } 20 | 21 | } 22 | -------------------------------------------------------------------------------- /eugFile/src/eug/shared/SpecificObject.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SpecificObject.java 3 | * 4 | * Created on June 23, 2006, 6:56 PM 5 | */ 6 | 7 | package eug.shared; 8 | 9 | /** 10 | * 11 | * @author Michael Myers 12 | */ 13 | public abstract class SpecificObject { 14 | 15 | public GenericObject go;//the GenericObject containing the data 16 | 17 | /** Creates a new instance of SpecificObject */ 18 | public SpecificObject() { 19 | } 20 | 21 | } 22 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | /EU3_Scenario_Editor/nbproject/private/ 2 | /EugFile_specific/nbproject/private/ 3 | /EugSyntax/nbproject/private/ 4 | /PositionsEditor/nbproject/private/ 5 | /eugFile/nbproject/private/ 6 | /eugFile/build/ 7 | /eugFile/dist/ 8 | /EugFile_specific/build/ 9 | /EugFile_specific/dist/ 10 | /EugSyntax/build/ 11 | /EugSyntax/dist/ 12 | /PositionsEditor/build/ 13 | /EU3_Scenario_Editor/build/ 14 | /EU3_Scenario_Editor/dist/ 15 | /PositionsEditor/dist/ 16 | *.zip 17 | *.log 18 | -------------------------------------------------------------------------------- /PositionsEditor/config.txt: -------------------------------------------------------------------------------- 1 | #Specifies the game version to use (as defined in position_types.txt) 2 | game=httt 3 | use_localization=yes 4 | recent={ 5 | httt={ "C:\Games\Europa Universalis III - Copy\map\default.map" } 6 | v2={ "C:\Games\Victoria 2 - DEMO\map\default.map" } 7 | rome={ "C:\Games\Rome - Demo\map\default.map" } 8 | hoi3={ "C:\Games\Hearts of Iron 3 - Demo\map\default.map" } 9 | dw={ "C:\Games\Europa Universalis III\map\default.map" } 10 | } 11 | -------------------------------------------------------------------------------- /EugFile_specific/src/eug/specific/victoria2/Vic2DataSource.java: -------------------------------------------------------------------------------- 1 | 2 | package eug.specific.victoria2; 3 | 4 | import eug.shared.GenericObject; 5 | import eug.specific.clausewitz.ClausewitzDataSource; 6 | import java.util.List; 7 | 8 | /** 9 | * Shared interface for Victoria 2 and 3 specific data, primarily pops. 10 | * @author Michael 11 | */ 12 | public interface Vic2DataSource extends ClausewitzDataSource { 13 | 14 | public List getPops(int provId); 15 | } 16 | -------------------------------------------------------------------------------- /eugFile/nbproject/genfiles.properties: -------------------------------------------------------------------------------- 1 | build.xml.data.CRC32=f6f56fe9 2 | build.xml.script.CRC32=016b8a5a 3 | build.xml.stylesheet.CRC32=d5b6853a 4 | # This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml. 5 | # Do not edit this file. You may delete it but then the IDE will never regenerate such files for you. 6 | nbproject/build-impl.xml.data.CRC32=f6f56fe9 7 | nbproject/build-impl.xml.script.CRC32=05ab21de 8 | nbproject/build-impl.xml.stylesheet.CRC32=6ddba6b6@1.53.1.46 9 | -------------------------------------------------------------------------------- /Rome_Scenario_Editor/nbproject/genfiles.properties: -------------------------------------------------------------------------------- 1 | build.xml.data.CRC32=df092a41 2 | build.xml.script.CRC32=65b9c6f6 3 | build.xml.stylesheet.CRC32=be360661 4 | # This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml. 5 | # Do not edit this file. You may delete it but then the IDE will never regenerate such files for you. 6 | nbproject/build-impl.xml.data.CRC32=df092a41 7 | nbproject/build-impl.xml.script.CRC32=6b7ebe3d 8 | nbproject/build-impl.xml.stylesheet.CRC32=487672f9 9 | -------------------------------------------------------------------------------- /EugSyntax/nbproject/genfiles.properties: -------------------------------------------------------------------------------- 1 | build.xml.data.CRC32=f6610292 2 | build.xml.script.CRC32=64815116 3 | build.xml.stylesheet.CRC32=8064a381@1.74.1.48 4 | # This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml. 5 | # Do not edit this file. You may delete it but then the IDE will never regenerate such files for you. 6 | nbproject/build-impl.xml.data.CRC32=f6610292 7 | nbproject/build-impl.xml.script.CRC32=1f2a35e6 8 | nbproject/build-impl.xml.stylesheet.CRC32=05530350@1.79.1.48 9 | -------------------------------------------------------------------------------- /EugFile_specific/nbproject/genfiles.properties: -------------------------------------------------------------------------------- 1 | build.xml.data.CRC32=c61df3f1 2 | build.xml.script.CRC32=8ffd2882 3 | build.xml.stylesheet.CRC32=28e38971@1.38.2.45 4 | # This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml. 5 | # Do not edit this file. You may delete it but then the IDE will never regenerate such files for you. 6 | nbproject/build-impl.xml.data.CRC32=c61df3f1 7 | nbproject/build-impl.xml.script.CRC32=d2949b4b 8 | nbproject/build-impl.xml.stylesheet.CRC32=6ddba6b6@1.53.1.46 9 | -------------------------------------------------------------------------------- /EugFile_specific/src/eug/specific/victoria/VicSpecificObject.java: -------------------------------------------------------------------------------- 1 | /* 2 | * "Mother class" of classes used to provide object type-specific methods 3 | */ 4 | 5 | package eug.specific.victoria; 6 | 7 | import eug.shared.GenericObject; 8 | import eug.shared.SpecificObject; 9 | 10 | public abstract class VicSpecificObject extends SpecificObject { 11 | public VicScenario scenario; 12 | 13 | public VicSpecificObject(GenericObject o, VicScenario t) { 14 | go = o; 15 | scenario = t; 16 | } 17 | 18 | } 19 | -------------------------------------------------------------------------------- /EugSyntax/src/eug/syntax/StyleSet.java: -------------------------------------------------------------------------------- 1 | /* 2 | * StyleSet.java 3 | * 4 | * Created on June 26, 2007, 5:18 PM 5 | */ 6 | 7 | package eug.syntax; 8 | 9 | import eug.parser.TokenType; 10 | import javax.swing.text.MutableAttributeSet; 11 | 12 | /** 13 | * 14 | * @author Michael Myers 15 | */ 16 | public interface StyleSet extends java.io.Serializable { 17 | 18 | /** 19 | * Returns the style that should be used to color the given token. 20 | */ 21 | public MutableAttributeSet getStyle(TokenType token, String str); 22 | 23 | } 24 | -------------------------------------------------------------------------------- /eugFile/src/eug/shared/WritableObject.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Interface implemented by GenericObject, GenericList and ObjectVariable. 3 | * 4 | * Used to write them to a file. 5 | */ 6 | 7 | package eug.shared; 8 | 9 | import java.io.BufferedWriter; 10 | import java.io.IOException; 11 | 12 | public interface WritableObject { 13 | 14 | public void toFileString(BufferedWriter bw, int depth) throws IOException; 15 | /** @since EUGFile 1.06.00pre1 */ 16 | public void toFileString(BufferedWriter bw, int depth, Style style) throws IOException; 17 | } 18 | -------------------------------------------------------------------------------- /EugFile_specific/src/eug/specific/victoria/Population.java: -------------------------------------------------------------------------------- 1 | package eug.specific.victoria; 2 | 3 | import eug.shared.GenericObject; 4 | 5 | public class Population extends VicSpecificObject { 6 | 7 | public Population(GenericObject o, VicScenario t) { 8 | super(o, t); 9 | } 10 | 11 | public double getSize() { 12 | return go.getDouble("size"); 13 | } 14 | 15 | public void setSize(double s) { 16 | go.setDouble("size", s); 17 | } 18 | 19 | public int getId() { 20 | return go.getInt("id"); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /EugFile_specific/src/eug/specific/ck/Country.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Country.java 3 | * 4 | * Created on July 13, 2006, 2:20 PM 5 | */ 6 | 7 | package eug.specific.ck; 8 | 9 | import eug.shared.GenericObject; 10 | 11 | /** 12 | * 13 | * @author Michael Myers 14 | */ 15 | public class Country extends CKSpecificObject { 16 | 17 | /** Creates a new instance of Country */ 18 | public Country(GenericObject go, CKScenario s) { 19 | super(go, s); 20 | } 21 | 22 | public String getTag() { 23 | return go.getString("tag"); 24 | } 25 | 26 | 27 | } 28 | -------------------------------------------------------------------------------- /EugFile_specific/src/eug/specific/ck/CKSpecificObject.java: -------------------------------------------------------------------------------- 1 | /* 2 | * CKSpecificObject.java 3 | * 4 | * Created on July 13, 2006, 1:59 PM 5 | */ 6 | 7 | package eug.specific.ck; 8 | 9 | import eug.shared.GenericObject; 10 | import eug.shared.SpecificObject; 11 | 12 | /** 13 | * 14 | * @author Michael Myers 15 | */ 16 | public class CKSpecificObject extends SpecificObject { 17 | 18 | public CKScenario scenario; 19 | 20 | /** Creates a new instance of CKSpecificObject */ 21 | public CKSpecificObject(GenericObject o, CKScenario s) { 22 | go = o; 23 | scenario = s; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /EugFile_specific/src/eug/specific/eu2/EU2SpecificObject.java: -------------------------------------------------------------------------------- 1 | /* 2 | * EU2SpecificObject.java 3 | * 4 | * Created on June 23, 2006, 6:57 PM 5 | */ 6 | 7 | package eug.specific.eu2; 8 | 9 | import eug.shared.GenericObject; 10 | import eug.shared.SpecificObject; 11 | 12 | /** 13 | * 14 | * @author Michael Myers 15 | */ 16 | public class EU2SpecificObject extends SpecificObject { 17 | 18 | public EU2Scenario scenario; 19 | 20 | /** Creates a new instance of EU2SpecificObject */ 21 | public EU2SpecificObject(GenericObject o, EU2Scenario s) { 22 | go = o; 23 | scenario = s; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /Rome_Scenario_Editor/config.txt: -------------------------------------------------------------------------------- 1 | #EU3 directory definition 2 | #Uncomment the one that fits your needs, or put in your own. 3 | 4 | #For use in development. 5 | #maindir = "/media/winhd/Program Files/Paradox Interactive/Rome - DEMO/" 6 | #maindir = "/media/winhd/Program Files/Paradox Interactive/Rome/" 7 | 8 | #For more common use. 9 | maindir = "C:/Program Files/Paradox Interactive/Rome - DEMO/" 10 | #maindir = "C:/Program Files/Paradox Interactive/Rome/" 11 | 12 | #Mod directory definition 13 | #If you are using this with a mod, uncomment the line below and replace it 14 | #with the name of the mod (without any slashes). 15 | #moddir = "" 16 | -------------------------------------------------------------------------------- /eugFile/nbproject/project.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | org.netbeans.modules.java.j2seproject 4 | 5 | 6 | EugFile 7 | 1.6.5 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /PositionsEditor/nbproject/genfiles.properties: -------------------------------------------------------------------------------- 1 | build.xml.data.CRC32=f531fe40 2 | build.xml.script.CRC32=4700c78b 3 | build.xml.stylesheet.CRC32=be360661 4 | # This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml. 5 | # Do not edit this file. You may delete it but then the IDE will never regenerate such files for you. 6 | nbproject/build-impl.xml.data.CRC32=68e8254a 7 | nbproject/build-impl.xml.script.CRC32=005eb372 8 | nbproject/build-impl.xml.stylesheet.CRC32=05530350@1.79.1.48 9 | nbproject/profiler-build-impl.xml.data.CRC32=f531fe40 10 | nbproject/profiler-build-impl.xml.script.CRC32=abda56ed 11 | nbproject/profiler-build-impl.xml.stylesheet.CRC32=42cb6bcf 12 | -------------------------------------------------------------------------------- /EU3_Scenario_Editor/nbproject/genfiles.properties: -------------------------------------------------------------------------------- 1 | build.xml.data.CRC32=c6e952df 2 | build.xml.script.CRC32=3d1c3ead 3 | build.xml.stylesheet.CRC32=958a1d3e@1.32.1.45 4 | # This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml. 5 | # Do not edit this file. You may delete it but then the IDE will never regenerate such files for you. 6 | nbproject/build-impl.xml.data.CRC32=c6e952df 7 | nbproject/build-impl.xml.script.CRC32=326f0c77 8 | nbproject/build-impl.xml.stylesheet.CRC32=6ddba6b6@1.53.1.46 9 | nbproject/profiler-build-impl.xml.data.CRC32=c6e952df 10 | nbproject/profiler-build-impl.xml.script.CRC32=abda56ed 11 | nbproject/profiler-build-impl.xml.stylesheet.CRC32=42cb6bcf@1.9.1 12 | -------------------------------------------------------------------------------- /EugFile_specific/src/eug/specific/eu3/EU3SpecificObject.java: -------------------------------------------------------------------------------- 1 | /* 2 | * EU3SpecificObject.java 3 | * 4 | * Created on March 22, 2007, 2:22 PM 5 | */ 6 | 7 | package eug.specific.eu3; 8 | 9 | import eug.shared.GenericObject; 10 | import eug.shared.SpecificObject; 11 | import eug.specific.clausewitz.ClausewitzDataSource; 12 | 13 | /** 14 | * 15 | * @author Michael Myers 16 | * @since EUGFile 1.03.00 17 | */ 18 | public class EU3SpecificObject extends SpecificObject { 19 | 20 | public ClausewitzDataSource dataSource; 21 | 22 | /** Creates a new instance of EU3SpecificObject */ 23 | public EU3SpecificObject(GenericObject o, ClausewitzDataSource src) { 24 | go = o; 25 | dataSource = src; 26 | } 27 | 28 | } 29 | -------------------------------------------------------------------------------- /EU3_Scenario_Editor/src/editor/mapmode/ProvinceMode.java: -------------------------------------------------------------------------------- 1 | package editor.mapmode; 2 | 3 | import editor.MapPanel; 4 | import java.awt.Graphics2D; 5 | 6 | 7 | /** 8 | * A MapMode that only paints the province map. 9 | * @author Michael Myers 10 | * @since 0.4pre1 11 | */ 12 | public class ProvinceMode extends MapMode { 13 | public ProvinceMode() { 14 | } 15 | 16 | public ProvinceMode(MapPanel panel) { 17 | super(panel); 18 | } 19 | 20 | public void paint(Graphics2D g) { 21 | paintBackground(g); 22 | } 23 | 24 | public void paintBackground(Graphics2D g) { 25 | mapPanel.paintProvinces(g); 26 | } 27 | 28 | public boolean paintsBorders() { 29 | return false; 30 | } 31 | } -------------------------------------------------------------------------------- /EugFile_specific/src/eug/specific/ck/Province.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Province.java 3 | * 4 | * Created on July 13, 2006, 2:29 PM 5 | */ 6 | 7 | package eug.specific.ck; 8 | 9 | import eug.shared.GenericObject; 10 | 11 | /** 12 | * 13 | * @author Michael Myers 14 | */ 15 | public class Province extends CKSpecificObject { 16 | 17 | /** Creates a new instance of Province */ 18 | public Province(GenericObject go, CKScenario s) { 19 | super(go, s); 20 | } 21 | 22 | public int getId() { 23 | return go.getInt("id"); 24 | } 25 | 26 | public String getReligion() { 27 | return go.getString("religion"); 28 | } 29 | 30 | public String getCulture() { 31 | return go.getString("culture"); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /Rome_Scenario_Editor/src/editor/mapmode/ProvinceMode.java: -------------------------------------------------------------------------------- 1 | package editor.mapmode; 2 | 3 | import editor.MapPanel; 4 | import java.awt.Graphics2D; 5 | 6 | 7 | /** 8 | * A MapMode that only paints the province map. 9 | * @author Michael Myers 10 | * @since 0.4pre1 11 | */ 12 | public class ProvinceMode extends MapMode { 13 | public ProvinceMode() { 14 | super(); 15 | } 16 | 17 | public ProvinceMode(MapPanel panel) { 18 | super(panel); 19 | } 20 | 21 | public void paint(Graphics2D g) { 22 | paintBackground(g); 23 | } 24 | 25 | public void paintBackground(Graphics2D g) { 26 | mapPanel.paintProvinces(g); 27 | } 28 | 29 | public boolean paintsBorders() { 30 | return false; 31 | } 32 | 33 | } -------------------------------------------------------------------------------- /EugFile_specific/src/eug/specific/eu3/EU3Scenario.java: -------------------------------------------------------------------------------- 1 | /* 2 | * EU3Scenario.java 3 | * 4 | * Created on July 2, 2007, 1:59 PM 5 | */ 6 | 7 | package eug.specific.eu3; 8 | 9 | import eug.shared.FilenameResolver; 10 | import eug.specific.clausewitz.ClausewitzScenario; 11 | 12 | /** 13 | * Implementation of EU3DataSource which gets country and province 14 | * data from the history files. 15 | * @author Michael Myers 16 | * @since EUGFile 1.06.00pre1 17 | */ 18 | public class EU3Scenario extends ClausewitzScenario { 19 | 20 | /** Creates a new instance of EU3Scenario */ 21 | public EU3Scenario(FilenameResolver resolver) { 22 | super(resolver); 23 | } 24 | 25 | public EU3Scenario(String mainDir, String modDir) { 26 | super(mainDir, modDir); 27 | } 28 | 29 | } 30 | -------------------------------------------------------------------------------- /EugFile_specific/src/eug/specific/eu3/EU3Event.java: -------------------------------------------------------------------------------- 1 | /* 2 | * EU3Event.java 3 | * 4 | * Created on September 12, 2007, 2:31 PM 5 | * 6 | * To change this template, choose Tools | Template Manager 7 | * and open the template in the editor. 8 | */ 9 | 10 | package eug.specific.eu3; 11 | 12 | import eug.shared.GenericObject; 13 | import eug.specific.clausewitz.ClausewitzDataSource; 14 | 15 | 16 | /** 17 | * 18 | * @author jeff 19 | */ 20 | public class EU3Event extends EU3SpecificObject { 21 | 22 | /** Creates a new instance of EU3Event */ 23 | public EU3Event(GenericObject g, ClausewitzDataSource ds) { 24 | super(g, ds); 25 | } 26 | 27 | public int getID() { 28 | return 0; 29 | } 30 | 31 | public String getIDAsString() { 32 | return ""; 33 | } 34 | 35 | 36 | 37 | } 38 | -------------------------------------------------------------------------------- /eugFile/Readme.txt: -------------------------------------------------------------------------------- 1 | The eugFile project houses a set of three parsers that handle Paradox game script 2 | syntax. The parsers are generated by JFlex from the .flex files inside eug/parser. 3 | 4 | Most interaction with this library will begin with EUGFileIO, which has a number 5 | of static methods to handle loading and saving script files. None of the other 6 | classes in eug.parser are meant for direct interaction, with the exception of 7 | ParserSettings. 8 | 9 | EUGFileIO's loading methods return an object of eug.shared.GenericObject. This is 10 | a tree-style data structure, but not all descendants are GenericObjects. See the 11 | JavaDocs of GenericObject, GenericList, and ObjectVariable for more details. 12 | 13 | 14 | JFlex is available from https://jflex.de under a BSD-style license. 15 | See https://jflex.de/copying.html for copyright information. -------------------------------------------------------------------------------- /EU3_Scenario_Editor/src/editor/mapmode/SingleAreaMode.java: -------------------------------------------------------------------------------- 1 | 2 | package editor.mapmode; 3 | 4 | import editor.MapPanel; 5 | import editor.ProvinceData.Province; 6 | import java.util.List; 7 | 8 | /** 9 | * @since 0.9 10 | */ 11 | public class SingleAreaMode extends GroupMode { 12 | 13 | public SingleAreaMode(MapPanel panel, String area) { 14 | super(panel); 15 | provIds = getMap().getArea(area); 16 | } 17 | 18 | @Override 19 | public String getTooltipExtraText(final Province current) { 20 | if (!getMap().isLand(current.getId())) 21 | return ""; 22 | 23 | StringBuilder ret = new StringBuilder("Areas: "); 24 | List areas = getMap().getAreasOfProv(current.getId()); 25 | ret.append(String.join(", ", areas)); 26 | 27 | return ret.toString(); 28 | } 29 | 30 | } 31 | -------------------------------------------------------------------------------- /EU3_Scenario_Editor/src/editor/mapmode/SuperRegionMode.java: -------------------------------------------------------------------------------- 1 | 2 | package editor.mapmode; 3 | 4 | import editor.MapPanel; 5 | import editor.ProvinceData.Province; 6 | import java.util.List; 7 | 8 | /** 9 | * @since 0.9 10 | */ 11 | public class SuperRegionMode extends GroupMode { 12 | 13 | public SuperRegionMode(MapPanel panel, String superRegion) { 14 | super(panel); 15 | provIds = getMap().getSuperRegion(superRegion); 16 | } 17 | 18 | @Override 19 | public String getTooltipExtraText(final Province current) { 20 | if (!getMap().isLand(current.getId())) 21 | return ""; 22 | 23 | StringBuilder ret = new StringBuilder("Super regions: "); 24 | List regions = getMap().getSuperRegionsOfProv(current.getId()); 25 | ret.append(String.join(", ", regions)); 26 | 27 | return ret.toString(); 28 | } 29 | 30 | } 31 | -------------------------------------------------------------------------------- /EugFile_specific/src/eug/specific/eu2/LandUnit.java: -------------------------------------------------------------------------------- 1 | package eug.specific.eu2; 2 | ///* 3 | // * LandUnit.java 4 | // * 5 | // * Created on August 1, 2006, 10:05 PM 6 | // */ 7 | // 8 | //package eug.specific.eu2; 9 | // 10 | //import eug.shared.GenericObject; 11 | // 12 | ///** 13 | // * 14 | // * @author Michael Myers 15 | // */ 16 | //public class LandUnit extends EU2SpecificObject { 17 | // 18 | // /** Creates a new instance of LandUnit */ 19 | // public LandUnit(GenericObject go, EU2Scenario s) { 20 | // super(go, s); 21 | // } 22 | // 23 | // public double numInf() { 24 | // return go.getDouble("inf"); 25 | // } 26 | // 27 | // public double numCav() { 28 | // return go.getDouble("cav"); 29 | // } 30 | // 31 | // public double numArt() { 32 | // return go.getDouble("art"); 33 | // } 34 | // 35 | // public int getLocation() { 36 | // return go.getInt("location"); 37 | // } 38 | //} 39 | -------------------------------------------------------------------------------- /eugFile/src/eug/parser/ParserException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ParserException.java 3 | * 4 | * Created on February 17, 2007, 11:19 AM 5 | */ 6 | 7 | package eug.parser; 8 | 9 | /** 10 | * Exception thrown when the parser encounters an illegal token. 11 | *

12 | * For example, an instance of this class might be thrown if a warning is 13 | * produced while the parser is in strict mode. 14 | * @author Michael Myers 15 | * @since EUGFile 1.02.00 16 | */ 17 | public class ParserException extends RuntimeException { 18 | 19 | private static final long serialVersionUID = 1L; 20 | 21 | /** 22 | * Creates a new instance of ParserException without detail message. 23 | */ 24 | public ParserException() { 25 | } 26 | 27 | /** 28 | * Constructs an instance of ParserException with the specified detail message. 29 | * @param msg the detail message. 30 | */ 31 | public ParserException(String msg) { 32 | super(msg); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /EU3_Scenario_Editor/src/editor/mapmode/ProvinceGroupMode.java: -------------------------------------------------------------------------------- 1 | 2 | package editor.mapmode; 3 | 4 | import editor.MapPanel; 5 | import editor.ProvinceData.Province; 6 | import java.util.List; 7 | 8 | /** 9 | * Highlights a single province group as defined in provincegroup.txt 10 | * @since 0.9 11 | */ 12 | public class ProvinceGroupMode extends GroupMode { 13 | 14 | public ProvinceGroupMode(MapPanel panel, String group) { 15 | super(panel); 16 | provIds = getMap().getProvinceGroup(group); 17 | } 18 | 19 | @Override 20 | public String getTooltipExtraText(final Province current) { 21 | if (!getMap().isLand(current.getId())) 22 | return ""; 23 | 24 | StringBuilder ret = new StringBuilder("Province groups: "); 25 | List groups = getMap().getGroupsOfProv(current.getId()); 26 | ret.append(String.join(", ", groups)); 27 | 28 | return ret.toString(); 29 | } 30 | 31 | } 32 | -------------------------------------------------------------------------------- /EugSyntax/nbproject/project.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | org.netbeans.modules.java.j2seproject 4 | 5 | 6 | EugSyntax 7 | 1.6.5 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | EugFile 16 | jar 17 | 18 | jar 19 | clean 20 | jar 21 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /eugFile/src/eug/parser/TokenType.java: -------------------------------------------------------------------------------- 1 | package eug.parser; 2 | 3 | 4 | /** 5 | * Enumeration of all possible token types. 6 | */ 7 | public enum TokenType { 8 | 9 | /** Constant indicating that the end of the stream has been read. */ 10 | EOF, 11 | 12 | /** Constant indicating that an unquoted string has been read. */ 13 | ULSTRING, 14 | 15 | /** Constant indicating that a quoted string has been read. */ 16 | DLSTRING, 17 | 18 | /** Constant indicating that an equals sign has been read. */ 19 | EQUALS, 20 | 21 | /** Constant indicating that a left brace has been read. */ 22 | LBRACE, 23 | 24 | /** Constant indicating that a right brace has been read. */ 25 | RBRACE, 26 | 27 | /** Constant indicating that a comment has been read. */ 28 | COMMENT, 29 | 30 | /** Constant indicating that an identifier ("xxx =") has been read. */ 31 | IDENT, 32 | 33 | /** Constant indicating that a newline character (\r, \n, or \r\n) has been read. */ 34 | NEWLINE, 35 | } -------------------------------------------------------------------------------- /EugFile_specific/nbproject/project.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | org.netbeans.modules.java.j2seproject 4 | 5 | 6 | EugFile_specific 7 | 1.6.5 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | EugFile 18 | jar 19 | 20 | jar 21 | clean 22 | jar 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /EU3_Scenario_Editor/colors.txt: -------------------------------------------------------------------------------- 1 | # Colors used for scaling map modes. 2 | # All RGB values are on a scale of 0-255, inclusive. 3 | # If a map mode does not appear here, default color values will be chosen for it 4 | # by the editor. 5 | 6 | leadership={ 7 | low={ 255 255 51 } 8 | middle={ 0 255 0 } 9 | high={ 0 178 0 } 10 | } 11 | manpower={ 12 | low={ 240 240 102 } 13 | middle={ 51 224 0 } 14 | high={ 0 51 0 } 15 | } 16 | resources={ 17 | low={ 255 255 0 } 18 | middle={ 0 255 0 } 19 | high={ 0 178 0 } 20 | } 21 | buildings={ 22 | low={ 255 255 51 } 23 | middle={ 51 255 0 } 24 | high={ 0 161 0 } 25 | } 26 | life-rating={ 27 | low={ 255 0 0 } 28 | middle={ 255 255 0 } 29 | high={ 0 149 0 } 30 | } 31 | fort-level={ 32 | low={ 240 240 110 } 33 | middle={ 0 178 32 } 34 | high={ 0 32 178 } 35 | } 36 | population={ 37 | low={ 232 204 81 } 38 | middle={ 24 204 24 } 39 | high={ 14 81 14 } 40 | } 41 | natives={ 42 | low={ 255 255 0 } 43 | middle={ 204 153 0 } 44 | high={ 204 0 0 } 45 | } 46 | base-tax={ 47 | low={ 255 204 51 } 48 | middle={ 24 204 24 } 49 | high={ 0 51 0 } 50 | } 51 | -------------------------------------------------------------------------------- /EU3_Scenario_Editor/src/editor/mapmode/ClimateMode.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ClimateMode.java 3 | * 4 | * Created on August 1, 2007, 2:19 PM 5 | */ 6 | 7 | package editor.mapmode; 8 | 9 | import editor.MapPanel; 10 | import editor.ProvinceData.Province; 11 | import java.util.List; 12 | 13 | /** 14 | * 15 | * @author Michael Myers 16 | * @since 0.5pre3 17 | */ 18 | public class ClimateMode extends GroupMode { 19 | 20 | /** Creates a new instance of ClimateMode */ 21 | public ClimateMode(String climate) { 22 | provIds = getMap().getClimate(climate); 23 | } 24 | 25 | public ClimateMode(List climate) { 26 | super(climate); 27 | } 28 | 29 | public ClimateMode(MapPanel panel, String climate) { 30 | super(panel); 31 | provIds = getMap().getClimate(climate); 32 | } 33 | 34 | public ClimateMode(MapPanel panel, List climate) { 35 | super(panel, climate); 36 | } 37 | 38 | @Override 39 | public String getTooltipExtraText(final Province current) { 40 | if (!getMap().isLand(current.getId())) 41 | return ""; 42 | 43 | return "Climate: " + getMap().getClimateOfProv(current.getId()); 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /EU3_Scenario_Editor/src/editor/MapPanel.form: -------------------------------------------------------------------------------- 1 | 2 | 3 |

4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /Rome_Scenario_Editor/src/editor/MapPanel.form: -------------------------------------------------------------------------------- 1 | 2 | 3 |
4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /EU3_Scenario_Editor/src/editor/mapmode/NativeGroupMode.java: -------------------------------------------------------------------------------- 1 | /* 2 | * NativeGroupMode.java 3 | * 4 | * Created on December 19, 2007, 5:38 PM 5 | */ 6 | 7 | package editor.mapmode; 8 | 9 | import editor.MapPanel; 10 | import editor.ProvinceData.Province; 11 | import java.util.List; 12 | 13 | /** 14 | * 15 | * @author Michael Myers 16 | * @since 0.6pre1 17 | */ 18 | public class NativeGroupMode extends GroupMode { 19 | 20 | public NativeGroupMode(String nativeGroup) { 21 | provIds = getMap().getNatives(nativeGroup); 22 | } 23 | 24 | public NativeGroupMode(List nativeGroup) { 25 | super(nativeGroup); 26 | } 27 | 28 | public NativeGroupMode(MapPanel panel, String nativeGroup) { 29 | super(panel); 30 | provIds = getMap().getNatives(nativeGroup); 31 | } 32 | 33 | public NativeGroupMode(MapPanel panel, List nativeGroup) { 34 | super(panel, nativeGroup); 35 | } 36 | 37 | @Override 38 | public String getTooltipExtraText(final Province current) { 39 | if (!getMap().isLand(current.getId())) 40 | return ""; 41 | 42 | return "Natives type: " + getMap().getNativeTypeOfProv(current.getId()); 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /PositionsEditor/src/posed/MapPanelDataModel.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MapPanelDataModel.java 3 | * 4 | * Created on June 11, 2007, 1:49 PM 5 | */ 6 | 7 | package posed; 8 | 9 | import java.util.List; 10 | 11 | /** 12 | * 13 | * @author Michael Myers 14 | */ 15 | public class MapPanelDataModel implements java.io.Serializable { 16 | 17 | private static final long serialVersionUID = 1L; 18 | 19 | // TODO: Perhaps an abstract superclass should be extracted? 20 | 21 | private final ProvinceData provinceData; 22 | 23 | private final MapData mapData; 24 | 25 | 26 | public MapPanelDataModel(final MapData data, final int numProvs, final String defFileName, boolean useLocalization, String provinceLocFmt) { 27 | provinceData = new ProvinceData(numProvs, defFileName, useLocalization, provinceLocFmt); 28 | mapData = data; 29 | } 30 | 31 | 32 | public ProvinceData getProvinceData() { 33 | return provinceData; 34 | } 35 | 36 | public MapData getMapData() { 37 | return mapData; 38 | } 39 | 40 | public List getLinesInProv(int provId) { 41 | return mapData.getLinesInProv(provinceData.getProvByID(provId).getColor()); 42 | } 43 | 44 | } 45 | -------------------------------------------------------------------------------- /Rome_Scenario_Editor/src/editor/mapmode/MapMode.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MapMode.java 3 | * 4 | * Created on June 7, 2007, 5:45 PM 5 | */ 6 | 7 | package editor.mapmode; 8 | 9 | import editor.MapPanel; 10 | import editor.ProvinceData.Province; 11 | import java.awt.Graphics; 12 | import java.awt.Graphics2D; 13 | 14 | /** 15 | * 16 | * @author Michael Myers 17 | * @version 1.0 18 | * @since 0.4pre1 19 | */ 20 | public abstract class MapMode { 21 | 22 | protected MapPanel mapPanel; 23 | 24 | /** 25 | * Creates a new instance of MapMode. 26 | */ 27 | public MapMode() { 28 | this(null); 29 | } 30 | 31 | public MapMode(MapPanel panel) { 32 | setMapPanel(panel); 33 | } 34 | 35 | public MapPanel getMapPanel() { 36 | return mapPanel; 37 | } 38 | 39 | public void setMapPanel(MapPanel mapPanel) { 40 | this.mapPanel = mapPanel; 41 | } 42 | 43 | public abstract void paint(final Graphics2D g); 44 | 45 | public void paint(final Graphics g) { 46 | paint((Graphics2D) g); 47 | } 48 | 49 | public String getTooltipExtraText(final Province current) { 50 | return ""; 51 | } 52 | 53 | public abstract boolean paintsBorders(); 54 | } 55 | -------------------------------------------------------------------------------- /EU3_Scenario_Editor/src/editor/mapmode/ContinentMode.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ContinentMode.java 3 | * 4 | * Created on August 1, 2007, 9:22 AM 5 | */ 6 | 7 | package editor.mapmode; 8 | 9 | import editor.MapPanel; 10 | import editor.ProvinceData.Province; 11 | import java.util.List; 12 | 13 | /** 14 | * 15 | * @author Michael Myers 16 | * @since 0.5pre3 17 | */ 18 | public class ContinentMode extends GroupMode { 19 | 20 | /** Creates a new instance of ContinentMode */ 21 | public ContinentMode(String continent) { 22 | provIds = getMap().getContinent(continent); 23 | } 24 | 25 | public ContinentMode(List continent) { 26 | super(continent); 27 | } 28 | 29 | public ContinentMode(MapPanel panel, String continent) { 30 | super(panel); 31 | provIds = getMap().getContinent(continent); 32 | } 33 | 34 | public ContinentMode(MapPanel panel, List continent) { 35 | super(panel, continent); 36 | } 37 | 38 | @Override 39 | public String getTooltipExtraText(final Province current) { 40 | String continent = getMap().getContinentOfProv(current.getId()); 41 | if (continent.startsWith("(")) 42 | return ""; 43 | 44 | return "Continent: " + continent; 45 | } 46 | 47 | } 48 | -------------------------------------------------------------------------------- /EU3_Scenario_Editor/src/editor/mapmode/MapMode.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MapMode.java 3 | * 4 | * Created on June 7, 2007, 5:45 PM 5 | */ 6 | 7 | package editor.mapmode; 8 | 9 | import editor.Map; 10 | import editor.MapPanel; 11 | import editor.ProvinceData.Province; 12 | import java.awt.Graphics; 13 | import java.awt.Graphics2D; 14 | 15 | /** 16 | * 17 | * @author Michael Myers 18 | * @version 1.0 19 | * @since 0.4pre1 20 | */ 21 | public abstract class MapMode { 22 | 23 | protected MapPanel mapPanel; 24 | 25 | /** 26 | * Creates a new instance of MapMode. 27 | */ 28 | public MapMode() { 29 | this(null); 30 | } 31 | 32 | public MapMode(MapPanel panel) { 33 | setMapPanel(panel); 34 | } 35 | 36 | public MapPanel getMapPanel() { 37 | return mapPanel; 38 | } 39 | 40 | public void setMapPanel(MapPanel mapPanel) { 41 | this.mapPanel = mapPanel; 42 | } 43 | 44 | protected Map getMap() { 45 | return mapPanel.getMap(); 46 | } 47 | 48 | public abstract void paint(final Graphics2D g); 49 | 50 | public void paint(final Graphics g) { 51 | paint((Graphics2D) g); 52 | } 53 | 54 | public String getTooltipExtraText(final Province current) { 55 | return ""; 56 | } 57 | 58 | public abstract boolean paintsBorders(); 59 | } 60 | -------------------------------------------------------------------------------- /PositionsEditor/src/posed/MapPanel.form: -------------------------------------------------------------------------------- 1 | 2 | 3 |
4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /EU3_Scenario_Editor/src/editor/mapmode/PopMode.java: -------------------------------------------------------------------------------- 1 | 2 | package editor.mapmode; 3 | 4 | import editor.MapPanel; 5 | import eug.shared.GenericObject; 6 | import eug.shared.ObjectVariable; 7 | 8 | /** 9 | * 10 | * @author Michael 11 | */ 12 | public abstract class PopMode extends ProvincePaintingMode { 13 | 14 | protected PopMode() { 15 | } 16 | 17 | protected PopMode(MapPanel panel) { 18 | super(panel); 19 | } 20 | 21 | // For some reason, pops in saved games don't do religion = "religion" or culture = "culture". 22 | // Instead, they do culture = religion. But it's always in the third position, so we can reliably access it. 23 | protected String getCulture(GenericObject pop) { 24 | if (mapPanel.getDataSource().isSavedGame()) { 25 | ObjectVariable variable = pop.getVariable(2); 26 | if (variable == null) 27 | return ""; 28 | return variable.varname; 29 | } else { 30 | return pop.getString("culture"); 31 | } 32 | } 33 | protected String getReligion(GenericObject pop) { 34 | if (mapPanel.getDataSource().isSavedGame()) { 35 | ObjectVariable variable = pop.getVariable(2); 36 | if (variable == null) 37 | return ""; 38 | return variable.getValue(); 39 | } else { 40 | return pop.getString("religion"); 41 | } 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /PositionsEditor/src/posed/ProvincePanel.form: -------------------------------------------------------------------------------- 1 | 2 | 3 |
4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /EU3_Scenario_Editor/src/editor/mapmode/HistoryExistsMode.java: -------------------------------------------------------------------------------- 1 | 2 | package editor.mapmode; 3 | 4 | import editor.MapPanel; 5 | import editor.ProvinceData; 6 | import java.awt.Color; 7 | import java.awt.Graphics2D; 8 | 9 | /** 10 | * 11 | * @author Michael 12 | */ 13 | public class HistoryExistsMode extends ProvincePaintingMode { 14 | 15 | private static final Color COLOR_NO_HIST = Color.RED.darker(); 16 | 17 | public HistoryExistsMode() { 18 | } 19 | 20 | public HistoryExistsMode(MapPanel panel) { 21 | super(panel); 22 | } 23 | 24 | @Override 25 | protected void paintProvince(Graphics2D g, int provId) { 26 | if (mapPanel.getDataSource().getProvinceHistory(provId) != null) 27 | mapPanel.paintProvince(g, provId, Utilities.COLOR_LAND_DEFAULT); 28 | else 29 | mapPanel.paintProvince(g, provId, COLOR_NO_HIST); 30 | } 31 | 32 | @Override 33 | protected void paintSeaZone(Graphics2D g, int id) { 34 | if (mapPanel.getDataSource().getProvinceHistory(id) == null) 35 | mapPanel.paintProvince(g, id, COLOR_NO_HIST); 36 | } 37 | 38 | @Override 39 | public String getTooltipExtraText(ProvinceData.Province current) { 40 | if (mapPanel.getDataSource().getProvinceHistory(current.getId()) == null) 41 | return "Does not have a history file"; 42 | else 43 | return "Has a history file"; 44 | } 45 | 46 | } 47 | -------------------------------------------------------------------------------- /PositionsEditor/nbproject/project.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | org.netbeans.modules.java.j2seproject 4 | 5 | 6 | PositionsEditor 7 | 1.6.5 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | EugFile 18 | jar 19 | 20 | jar 21 | clean 22 | jar 23 | 24 | 25 | EugSyntax 26 | jar 27 | 28 | jar 29 | clean 30 | jar 31 | 32 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /Rome_Scenario_Editor/src/editor/Main.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Main.java 3 | * 4 | * Created on January 25, 2007, 4:40 PM 5 | */ 6 | 7 | package editor; 8 | 9 | import eug.shared.FilenameResolver; 10 | //import javax.swing.UIManager; 11 | 12 | /** 13 | * 14 | * @author Michael Myers 15 | */ 16 | public class Main { 17 | 18 | public static final FilenameResolver filenameResolver = 19 | new FilenameResolver(new java.io.File("config.txt")); 20 | 21 | public static final Map map = new Map(); // must be initialized after filenameResolver 22 | 23 | public static final ProvinceData provinceData = new ProvinceData(map); 24 | 25 | /** Creates a new instance of Main */ 26 | private Main() { } 27 | 28 | /** 29 | * @param args the command line arguments 30 | */ 31 | public static void main(String[] args) { 32 | System.out.println("Main Rome directory is " + filenameResolver.getMainDirName()); 33 | 34 | if (filenameResolver.getModDirName().length() == 0) 35 | System.out.println("No mod"); 36 | else 37 | System.out.println("Mod directory is " + filenameResolver.getModDirName()); 38 | 39 | // try { 40 | // UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); 41 | // } catch (Exception ex) { 42 | // ex.printStackTrace(); 43 | // } 44 | new EditorUI().setVisible(true); 45 | } 46 | 47 | } 48 | -------------------------------------------------------------------------------- /EU3_Scenario_Editor/src/editor/mapmode/SingleRegionMode.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ContinentMode.java 3 | * 4 | * Created on August 1, 2007, 9:22 AM 5 | */ 6 | 7 | package editor.mapmode; 8 | 9 | import editor.MapPanel; 10 | import editor.ProvinceData.Province; 11 | import java.util.List; 12 | 13 | /** 14 | * 15 | * @author Michael Myers 16 | * @since 0.6pre1 17 | */ 18 | public class SingleRegionMode extends GroupMode { 19 | 20 | /** Creates a new instance of RegionsMode */ 21 | public SingleRegionMode(String region) { 22 | provIds = getMap().getRegion(region); 23 | } 24 | 25 | public SingleRegionMode(List continent) { 26 | super(continent); 27 | } 28 | 29 | public SingleRegionMode(MapPanel panel, String region) { 30 | super(panel); 31 | provIds = getMap().getRegion(region); 32 | } 33 | 34 | public SingleRegionMode(MapPanel panel, List region) { 35 | super(panel, region); 36 | } 37 | 38 | @Override 39 | public String getTooltipExtraText(final Province current) { 40 | if (!getMap().isLand(current.getId())) 41 | return ""; 42 | 43 | StringBuilder ret = new StringBuilder("Regions: "); 44 | List regions = getMap().getRegionsOfProv(current.getId()); 45 | ret.append(String.join(", ", regions)); 46 | 47 | return ret.toString(); 48 | } 49 | 50 | } 51 | -------------------------------------------------------------------------------- /EU3_Scenario_Editor/src/editor/mapmode/AdvancedCustomMode.java: -------------------------------------------------------------------------------- 1 | /* 2 | * AdvancedCustomMode.java 3 | * 4 | * Created on June 12, 2007, 12:47 PM 5 | */ 6 | 7 | package editor.mapmode; 8 | 9 | import editor.MapPanel; 10 | import java.awt.Graphics2D; 11 | import java.util.regex.Pattern; 12 | 13 | /** 14 | * Similar to {@link CustomMode}, but with regex support. 15 | * @author Michael Myers 16 | */ 17 | public class AdvancedCustomMode extends CustomMode { 18 | 19 | private final Pattern pattern; 20 | 21 | /** Creates a new instance of AdvancedCustomMode */ 22 | public AdvancedCustomMode(String name, String pattern) { 23 | super(name, pattern); 24 | this.pattern = Pattern.compile(pattern, Pattern.CASE_INSENSITIVE); 25 | } 26 | 27 | public AdvancedCustomMode(MapPanel panel, String name, String pattern) { 28 | super(panel, name, pattern); 29 | this.pattern = Pattern.compile(pattern, Pattern.CASE_INSENSITIVE); 30 | } 31 | 32 | protected void paintProvince(final Graphics2D g, int provId) { 33 | final String prop = mapPanel.getModel().getHistString(provId, name); 34 | 35 | if (prop == null || !pattern.matcher(prop).matches()) { 36 | mapPanel.paintProvince(g, provId, notFoundColor); 37 | } else { 38 | mapPanel.paintProvince(g, provId, foundColor); 39 | } 40 | } 41 | 42 | public String toString() { 43 | return "Provinces with " + name + " matching " + pattern; 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /Rome_Scenario_Editor/src/editor/mapmode/AdvancedCustomMode.java: -------------------------------------------------------------------------------- 1 | /* 2 | * AdvancedCustomMode.java 3 | * 4 | * Created on June 12, 2007, 12:47 PM 5 | */ 6 | 7 | package editor.mapmode; 8 | 9 | import editor.MapPanel; 10 | import java.awt.Graphics2D; 11 | import java.util.regex.Pattern; 12 | 13 | /** 14 | * Similar to {@link CustomMode}, but with regex support. 15 | * @author Michael Myers 16 | */ 17 | public class AdvancedCustomMode extends CustomMode { 18 | 19 | private final Pattern pattern; 20 | 21 | /** Creates a new instance of AdvancedCustomMode */ 22 | public AdvancedCustomMode(String name, String pattern) { 23 | super(name, pattern); 24 | this.pattern = Pattern.compile(pattern, Pattern.CASE_INSENSITIVE); 25 | } 26 | 27 | public AdvancedCustomMode(MapPanel panel, String name, String pattern) { 28 | super(panel, name, pattern); 29 | this.pattern = Pattern.compile(pattern, Pattern.CASE_INSENSITIVE); 30 | } 31 | 32 | protected void paintProvince(final Graphics2D g, int provId) { 33 | final String prop = mapPanel.getModel().getHistString(provId, name); 34 | 35 | if (prop == null || !pattern.matcher(prop).matches()) { 36 | mapPanel.paintProvince(g, provId, notFoundColor); 37 | } else { 38 | mapPanel.paintProvince(g, provId, foundColor); 39 | } 40 | } 41 | 42 | public String toString() { 43 | return "Provinces with " + name + " matching " + pattern; 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /EU3_Scenario_Editor/src/editor/mapmode/HistorySimpleTerrainMode.java: -------------------------------------------------------------------------------- 1 | 2 | package editor.mapmode; 3 | 4 | import editor.MapPanel; 5 | import editor.ProvinceData; 6 | import editor.Text; 7 | import java.awt.Color; 8 | import java.awt.Graphics2D; 9 | 10 | /** 11 | * 12 | * @author Michael 13 | */ 14 | public class HistorySimpleTerrainMode extends ProvincePaintingMode { 15 | 16 | public HistorySimpleTerrainMode(MapPanel panel) { 17 | super(panel); 18 | } 19 | 20 | @Override 21 | protected void paintProvince(Graphics2D g, int provId) { 22 | String terrain = mapPanel.getModel().getHistString(provId, "terrain"); 23 | if (terrain != null) { 24 | Color c = mapPanel.getMap().getTerrainColors().getOrDefault(terrain, null); 25 | if (c != null) 26 | mapPanel.paintProvince(g, provId, c); 27 | else 28 | mapPanel.paintProvince(g, provId, Utilities.COLOR_LAND_DEFAULT); 29 | } else { 30 | mapPanel.paintProvince(g, provId, Utilities.COLOR_LAND_DEFAULT); 31 | } 32 | } 33 | 34 | @Override 35 | protected void paintSeaZone(Graphics2D g, int id) { 36 | // do nothing 37 | } 38 | 39 | @Override 40 | public String getTooltipExtraText(ProvinceData.Province current) { 41 | String terr = mapPanel.getModel().getHistString(current.getId(), "terrain"); 42 | if (terr != null) { 43 | return Text.getText(terr); 44 | } 45 | return ""; 46 | } 47 | 48 | } 49 | -------------------------------------------------------------------------------- /EugFile_specific/src/eug/specific/eu2/Monarch.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Monarch.java 3 | * 4 | * Created on July 14, 2006, 7:52 PM 5 | */ 6 | 7 | package eug.specific.eu2; 8 | 9 | import eug.shared.GenericObject; 10 | 11 | /** 12 | * 13 | * @author Michael Myers 14 | */ 15 | public class Monarch extends EU2SpecificObject { 16 | 17 | /** Creates a new instance of Monarch */ 18 | public Monarch(GenericObject go, EU2Scenario s) { 19 | super(go, s); 20 | } 21 | public int getId() { 22 | return go.getChild("id").getInt("id"); 23 | } 24 | 25 | public String getName() { 26 | return go.getString("name"); 27 | } 28 | 29 | public int getDip() { 30 | return go.getInt("DIP"); 31 | } 32 | 33 | public int getAdm() { 34 | return go.getInt("ADM"); 35 | } 36 | 37 | public int getMil() { 38 | return go.getInt("MIL"); 39 | } 40 | 41 | public int getTotalSkill() { 42 | return getDip()+getAdm()+getMil(); 43 | } 44 | 45 | public boolean isDormant() { 46 | return go.getString("dormant").equals("yes"); 47 | } 48 | 49 | public int getStartYear() { 50 | return go.getChild("startdate").getInt("year"); 51 | } 52 | 53 | public int getDeathYear() { 54 | GenericObject deathDate = go.getChild("deathdate"); 55 | if (deathDate == null) { 56 | deathDate = go.getChild("enddate"); 57 | if (deathDate == null) 58 | return 2000; 59 | } 60 | return deathDate.getInt("year"); 61 | } 62 | 63 | } 64 | -------------------------------------------------------------------------------- /eugFile/src/eug/shared/Version.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Version.java 3 | * 4 | * Created on July 11, 2006, 9:13 PM 5 | */ 6 | 7 | package eug.shared; 8 | 9 | import java.text.DecimalFormat; 10 | import java.text.NumberFormat; 11 | 12 | /** 13 | * This class holds the version information for the EUGFile library. 14 | * @author Michael Myers 15 | */ 16 | public final class Version { 17 | private static final NumberFormat minorVersionFormat = NumberFormat.getInstance(); 18 | static { 19 | if (minorVersionFormat instanceof DecimalFormat) { 20 | ((DecimalFormat) minorVersionFormat).setMinimumIntegerDigits(2); 21 | } 22 | } 23 | 24 | /** No Version instances are allowed. */ 25 | private Version() { } 26 | 27 | public static String getVersion() { 28 | return String.format("%s %d.%s.%s %s", 29 | getName(), getMajorVersion(), 30 | minorVersionFormat.format(getMinorVersion()), 31 | minorVersionFormat.format(getUpdate()), getState()//, getBuild() 32 | ); 33 | } 34 | 35 | public static String getName() { 36 | return "EUGFile Library"; 37 | } 38 | 39 | public static int getMajorVersion() { 40 | return 1; 41 | } 42 | 43 | public static int getMinorVersion() { 44 | return 10; 45 | } 46 | 47 | public static int getUpdate() { 48 | return 2; 49 | } 50 | 51 | // public static int getBuild() { 52 | // return 1; 53 | // } 54 | 55 | public static String getState() { 56 | return ""; 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /Rome_Scenario_Editor/src/editor/mapmode/CountryMode.java: -------------------------------------------------------------------------------- 1 | package editor.mapmode; 2 | 3 | import editor.MapPanel; 4 | import editor.ProvinceData.Province; 5 | import editor.Text; 6 | import java.awt.Color; 7 | import java.awt.Graphics2D; 8 | 9 | /** 10 | * A MapMode that paints all land provinces the color of the 11 | * country that owns them. 12 | * @author Michael Myers 13 | * @since 0.4pre1 14 | */ 15 | public class CountryMode extends ProvincePaintingMode { 16 | 17 | 18 | public CountryMode() { 19 | super(); 20 | } 21 | 22 | public CountryMode(MapPanel panel) { 23 | super(panel); 24 | } 25 | 26 | protected void paintProvince(final Graphics2D g, int provId) { 27 | final String owner = mapPanel.getModel().getHistString(provId, "owner"); 28 | mapPanel.paintProvince(g, provId, (owner == null ? Utilities.COLOR_NO_HIST : getCtryColor(owner))); 29 | } 30 | 31 | protected void paintSeaZone(final Graphics2D g, int id) { 32 | // Don't paint sea zones. 33 | return; 34 | } 35 | 36 | protected Color getCtryColor(String country) { 37 | return Utilities.getCtryColor(country); 38 | } 39 | 40 | public String getTooltipExtraText(final Province current) { 41 | final int id = current.getId(); 42 | if (id == 0 || id >= SEA_STARTS) 43 | return ""; 44 | 45 | final String ret = Text.getText(mapPanel.getModel().getHistString(id, "owner")); 46 | if (ret.length() == 0) 47 | return ""; 48 | return "Owned by: " + ret; 49 | } 50 | 51 | } -------------------------------------------------------------------------------- /EU3_Scenario_Editor/src/editor/mapmode/GroupMode.java: -------------------------------------------------------------------------------- 1 | /* 2 | * GroupMode.java 3 | * 4 | * Created on July 31, 2007, 8:32 PM 5 | */ 6 | 7 | package editor.mapmode; 8 | 9 | import editor.MapPanel; 10 | import java.awt.Color; 11 | import java.awt.Graphics2D; 12 | import java.util.List; 13 | 14 | /** 15 | * 16 | * @author Michael Myers 17 | * @since 0.5pre3 18 | */ 19 | public class GroupMode extends ProvincePaintingMode { 20 | 21 | protected List provIds; 22 | 23 | protected Color foundColor = Color.GREEN; 24 | protected Color notFoundColor = new Color(100, 100, 100); // darker than GRAY, lighter than DARK_GRAY 25 | 26 | public GroupMode(List provIds) { 27 | this.provIds = provIds; 28 | } 29 | 30 | public GroupMode(MapPanel panel, List provIds) { 31 | super(panel); 32 | this.provIds = provIds; 33 | } 34 | 35 | protected GroupMode() { 36 | } 37 | 38 | protected GroupMode(MapPanel panel) { 39 | super(panel); 40 | } 41 | 42 | @Override 43 | protected void paintProvince(final Graphics2D g, int provId) { 44 | if (provIds.contains(provId)) { 45 | mapPanel.paintProvince(g, provId, foundColor); 46 | } else { 47 | mapPanel.paintProvince(g, provId, notFoundColor); 48 | } 49 | } 50 | 51 | @Override 52 | protected void paintSeaZone(final Graphics2D g, int id) { 53 | if (provIds.contains(id)) { 54 | mapPanel.paintProvince(g, id, foundColor); 55 | } 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /eugFile/src/eug/shared/Scenario.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Scenario.java 3 | * 4 | * Created on June 23, 2006, 6:50 PM 5 | */ 6 | 7 | package eug.shared; 8 | 9 | import eug.parser.EUGFileIO; 10 | import java.util.List; 11 | import java.util.Map; 12 | 13 | /** 14 | * 15 | * @author Michael Myers 16 | */ 17 | public abstract class Scenario { 18 | 19 | public GenericObject root; 20 | public List countries; 21 | public Map provinces; 22 | public String scenarioName; 23 | public Map displayNames; 24 | protected Style saveStyle = Style.EU3_SAVE_GAME; 25 | 26 | /** Creates a new instance of Scenario */ 27 | public Scenario() { 28 | } 29 | 30 | public void setStyle(Style style) { 31 | this.saveStyle = style; 32 | } 33 | 34 | public GenericObject getRoot() { 35 | return root; 36 | } 37 | 38 | public int numCountries() { 39 | return countries.size(); 40 | } 41 | 42 | /** 43 | * Returns the display name of the given value as found in the game text 44 | * files, or the string itself if it cannot be found. 45 | */ 46 | public String getDisplayName(String value) { 47 | 48 | String s = displayNames.get(value.toLowerCase()); 49 | 50 | if (s == null) { 51 | String stab[] = value.split("_"); 52 | return stab[stab.length-1]; 53 | } 54 | 55 | return s; 56 | } 57 | 58 | 59 | public void saveFile(String path) { 60 | eug.parser.EUGFileIO.save(root, path, EUGFileIO.NO_COMMENT, true, saveStyle); 61 | } 62 | 63 | } 64 | -------------------------------------------------------------------------------- /EU3_Scenario_Editor/src/editor/mapmode/CK3DevelopmentMapMode.java: -------------------------------------------------------------------------------- 1 | 2 | package editor.mapmode; 3 | 4 | import editor.MapPanel; 5 | import editor.ProvinceData; 6 | import java.awt.Color; 7 | 8 | /** 9 | * 10 | * @author Michael 11 | */ 12 | public class CK3DevelopmentMapMode extends TitleMode { 13 | 14 | private final Color[] colors = Utilities.createSteppedColors(0, 101, 1, Color.WHITE, Color.GREEN.darker(), Color.GREEN.darker().darker().darker()); 15 | 16 | public CK3DevelopmentMapMode(MapPanel panel) { 17 | super(panel, TitleMode.TitleType.COUNTY); 18 | } 19 | 20 | @Override 21 | protected Color getTitleColor(String title) { 22 | String devStr = getLiegeHistString(title, "change_development_level"); 23 | if (devStr == null || devStr.isEmpty()) 24 | return getColorFromDevLevel(0); 25 | 26 | try { 27 | int devLevel = Integer.parseInt(devStr); 28 | return getColorFromDevLevel(devLevel); 29 | } catch (NumberFormatException ex) { 30 | } 31 | return Utilities.COLOR_NO_CTRY_DEF; 32 | } 33 | 34 | private Color getColorFromDevLevel(int devLevel) { 35 | if (devLevel >= 0 && devLevel < colors.length) 36 | return colors[devLevel]; 37 | return Utilities.COLOR_LAND_DEFAULT; 38 | } 39 | 40 | @Override 41 | public String getTooltipExtraText(ProvinceData.Province current) { 42 | if (!mapPanel.getMap().isLand(current.getId()) || mapPanel.getMap().isWasteland(current.getId())) 43 | return ""; 44 | 45 | return "Development level: " + getLiegeHistString(getLowestHistTitleHolder(current.getId()), "change_development_level"); 46 | } 47 | 48 | } 49 | -------------------------------------------------------------------------------- /EU3_Scenario_Editor/src/editor/mapmode/CountryFlagMode.java: -------------------------------------------------------------------------------- 1 | 2 | package editor.mapmode; 3 | 4 | import editor.MapPanel; 5 | import editor.ProvinceData; 6 | import editor.Text; 7 | import java.awt.Color; 8 | import java.awt.Graphics2D; 9 | import java.util.List; 10 | 11 | /** 12 | * Highlights provinces whose owner has the specified flag set. That is, they must have 13 | * set_country_flag = <flag> 14 | * without a corresponding 15 | * clr_country_flag = <flag> 16 | * in their history. 17 | * @author Michael 18 | */ 19 | public class CountryFlagMode extends CountryMode { 20 | 21 | private final String flagName; 22 | 23 | private static final String SET_COUNTRY_FLAG = "set_country_flag"; 24 | private static final String CLR_COUNTRY_FLAG = "clr_country_flag"; 25 | 26 | public CountryFlagMode(MapPanel panel, String flagName) { 27 | super(panel); 28 | this.flagName = flagName; 29 | } 30 | 31 | @Override 32 | protected Color getCtryColor(String country) { 33 | boolean flag = mapPanel.getModel().isRhsSet(country, SET_COUNTRY_FLAG, CLR_COUNTRY_FLAG, flagName); 34 | 35 | return flag ? Color.GREEN : Color.DARK_GRAY; 36 | } 37 | 38 | @Override 39 | public String getTooltipExtraText(ProvinceData.Province current) { 40 | String owner = mapPanel.getModel().getOwner(current.getId()); 41 | if (Utilities.isNotACountry(owner)) 42 | return ""; 43 | 44 | StringBuilder sb = new StringBuilder("Flags:
"); 45 | List flags = mapPanel.getModel().getRhsSet(owner, SET_COUNTRY_FLAG, CLR_COUNTRY_FLAG); 46 | sb.append(String.join("
", flags)); 47 | return sb.toString(); 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /EU3_Scenario_Editor/nbproject/project.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | org.netbeans.modules.java.j2seproject 4 | 5 | 6 | EU3_Scenario_Editor 7 | 1.6.5 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | EugFile 18 | jar 19 | 20 | jar 21 | clean 22 | jar 23 | 24 | 25 | EugFile_specific 26 | jar 27 | 28 | jar 29 | clean 30 | jar 31 | 32 | 33 | EugSyntax 34 | jar 35 | 36 | jar 37 | clean 38 | jar 39 | 40 | 41 | 42 | 43 | -------------------------------------------------------------------------------- /Rome_Scenario_Editor/nbproject/project.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | org.netbeans.modules.java.j2seproject 4 | 5 | 6 | Rome_Scenario_Editor 7 | 1.6.5 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | EugFile 18 | jar 19 | 20 | jar 21 | clean 22 | jar 23 | 24 | 25 | EugFile_specific 26 | jar 27 | 28 | jar 29 | clean 30 | jar 31 | 32 | 33 | EugSyntax 34 | jar 35 | 36 | jar 37 | clean 38 | jar 39 | 40 | 41 | 42 | 43 | -------------------------------------------------------------------------------- /Rome_Scenario_Editor/src/editor/mapmode/GroupMode.java: -------------------------------------------------------------------------------- 1 | /* 2 | * GroupMode.java 3 | * 4 | * Created on July 31, 2007, 8:32 PM 5 | */ 6 | 7 | package editor.mapmode; 8 | 9 | import editor.MapPanel; 10 | import java.awt.Color; 11 | import java.awt.Graphics2D; 12 | import java.util.ArrayList; 13 | import java.util.List; 14 | 15 | /** 16 | * 17 | * @author Michael Myers 18 | * @since 0.5pre3 19 | */ 20 | public class GroupMode extends ProvincePaintingMode { 21 | 22 | protected List provIds; 23 | 24 | protected Color foundColor = Color.GREEN; 25 | protected Color notFoundColor = new Color(100, 100, 100); // darker than GRAY, lighter than DARK_GRAY 26 | 27 | /** 28 | * Creates a new instance of GroupMode 29 | */ 30 | public GroupMode(List provIds) { 31 | super(); 32 | this.provIds = makeIntList(provIds); 33 | } 34 | 35 | public GroupMode(MapPanel panel, List provIds) { 36 | super(panel); 37 | this.provIds = makeIntList(provIds); 38 | } 39 | 40 | protected void paintProvince(final Graphics2D g, int provId) { 41 | if (provIds.contains(provId)) { 42 | mapPanel.paintProvince(g, provId, foundColor); 43 | } else { 44 | mapPanel.paintProvince(g, provId, notFoundColor); 45 | } 46 | } 47 | 48 | protected void paintSeaZone(final Graphics2D g, int id) { 49 | if (provIds.contains(id)) { 50 | mapPanel.paintProvince(g, id, foundColor); 51 | } 52 | } 53 | 54 | private List makeIntList(List provIds) { 55 | final List ret = new ArrayList(provIds.size()); 56 | for (String id : provIds) { 57 | ret.add(Integer.parseInt(id)); 58 | } 59 | return ret; 60 | } 61 | 62 | } 63 | -------------------------------------------------------------------------------- /EU3_Scenario_Editor/src/editor/mapmode/CountryMode.java: -------------------------------------------------------------------------------- 1 | package editor.mapmode; 2 | 3 | import editor.MapPanel; 4 | import editor.ProvinceData.Province; 5 | import editor.Text; 6 | import java.awt.Color; 7 | import java.awt.Graphics2D; 8 | 9 | /** 10 | * A MapMode that paints all land provinces the color of the 11 | * country that owns them. 12 | * @author Michael Myers 13 | * @since 0.4pre1 14 | */ 15 | public class CountryMode extends ProvincePaintingMode { 16 | 17 | public CountryMode() { 18 | } 19 | 20 | public CountryMode(MapPanel panel) { 21 | super(panel); 22 | } 23 | 24 | @Override 25 | protected void paintProvince(final Graphics2D g, int provId) { 26 | final String owner = mapPanel.getModel().getOwner(provId); 27 | if (getMap().isWasteland(provId)) 28 | mapPanel.paintProvince(g, provId, java.awt.Color.BLACK); 29 | else if (owner == null || owner.isEmpty()) 30 | mapPanel.paintProvince(g, provId, Utilities.COLOR_LAND_DEFAULT); 31 | else 32 | mapPanel.paintProvince(g, provId, getCtryColor(owner)); 33 | } 34 | 35 | @Override 36 | protected void paintSeaZone(final Graphics2D g, int id) { 37 | // Don't paint sea zones. 38 | } 39 | 40 | protected Color getCtryColor(String country) { 41 | return Utilities.getCtryColor(country); 42 | } 43 | 44 | @Override 45 | public String getTooltipExtraText(final Province current) { 46 | final int id = current.getId(); 47 | if (!getMap().isLand(id)) 48 | return ""; 49 | 50 | final String ret = Text.getText(mapPanel.getModel().getOwner(id)); 51 | if (ret.length() == 0) 52 | return ""; 53 | return "Owned by: " + ret; 54 | } 55 | 56 | } -------------------------------------------------------------------------------- /EugFile_specific/src/eug/specific/eu2/Leader.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Leader.java 3 | * 4 | * Created on July 14, 2006, 6:17 PM 5 | */ 6 | 7 | package eug.specific.eu2; 8 | 9 | import eug.shared.GenericObject; 10 | 11 | /** 12 | * 13 | * @author Michael Myers 14 | */ 15 | public final class Leader extends EU2SpecificObject { 16 | 17 | /** Creates a new instance of Leader */ 18 | public Leader(GenericObject go, EU2Scenario s) { 19 | super(go, s); 20 | } 21 | 22 | public int getId() { 23 | return go.getChild("id").getInt("id"); 24 | } 25 | 26 | public String getCategory() { 27 | return go.getString("category"); 28 | } 29 | 30 | public String getName() { 31 | return go.getString("name"); 32 | } 33 | 34 | public int getRank() { 35 | return go.getInt("rank"); 36 | } 37 | 38 | public int getMovement() { 39 | return go.getInt("movement"); 40 | } 41 | 42 | public int getFire() { 43 | return go.getInt("fire"); 44 | } 45 | 46 | public int getShock() { 47 | return go.getInt("shock"); 48 | } 49 | 50 | public int getSiege() { 51 | final int siege = go.getInt("siege"); 52 | return (siege == -1 ? 0 : siege); 53 | } 54 | 55 | public int getTotalSkill() { 56 | return getMovement()+getFire()+getShock()+getSiege(); 57 | } 58 | 59 | public boolean isDormant() { 60 | return go.getString("dormant").equals("yes"); 61 | } 62 | 63 | public int getStartYear() { 64 | return go.getChild("startdate").getInt("year"); 65 | } 66 | 67 | public int getDeathYear() { 68 | GenericObject deathDate = go.getChild("deathdate"); 69 | if (deathDate == null) 70 | deathDate = go.getChild("enddate"); 71 | return deathDate.getInt("year"); 72 | } 73 | } 74 | -------------------------------------------------------------------------------- /EU3_Scenario_Editor/src/editor/mapmode/CoreMapMode.java: -------------------------------------------------------------------------------- 1 | /* 2 | * CoreMapMode.java 3 | * 4 | * Created on June 13, 2007, 4:15 PM 5 | */ 6 | 7 | package editor.mapmode; 8 | 9 | import editor.MapPanel; 10 | import editor.ProvinceData.Province; 11 | import java.awt.Color; 12 | import java.awt.Graphics2D; 13 | import java.util.List; 14 | 15 | /** 16 | * MapMode that highlights core provinces of a single country. 17 | * @author Michael Myers 18 | */ 19 | public class CoreMapMode extends ProvincePaintingMode { 20 | 21 | protected String tag; 22 | protected Color coreColor = Color.GREEN; 23 | protected Color notCoreColor = new Color(100, 100, 100); // darker than GRAY, lighter than DARK_GRAY 24 | 25 | /** Creates a new instance of CoreMapMode */ 26 | public CoreMapMode(String tag) { 27 | this.tag = tag; 28 | } 29 | 30 | public CoreMapMode(MapPanel panel, String tag) { 31 | super(panel); 32 | this.tag = tag; 33 | } 34 | 35 | protected void paintProvince(final Graphics2D g, int provId) { 36 | final List coreOf = mapPanel.getModel().isCoreOf(provId); 37 | if (coreOf != null && coreOf.contains(tag)) { 38 | mapPanel.paintProvince(g, provId, coreColor); 39 | } else { 40 | mapPanel.paintProvince(g, provId, notCoreColor); 41 | } 42 | } 43 | 44 | protected void paintSeaZone(final Graphics2D g, int id) { 45 | // Sea zones can't be cores. 46 | return; 47 | } 48 | 49 | @Override 50 | public String getTooltipExtraText(Province current) { 51 | if (!getMap().isLand(current.getId())) 52 | return ""; 53 | 54 | final List coreOf = mapPanel.getModel().isCoreOf(current.getId()); 55 | if (coreOf.isEmpty()) 56 | return ""; 57 | return "Core of: " + coreOf; 58 | } 59 | 60 | } 61 | -------------------------------------------------------------------------------- /Rome_Scenario_Editor/src/editor/mapmode/CoreMapMode.java: -------------------------------------------------------------------------------- 1 | /* 2 | * CoreMapMode.java 3 | * 4 | * Created on June 13, 2007, 4:15 PM 5 | */ 6 | 7 | package editor.mapmode; 8 | 9 | import editor.MapPanel; 10 | import editor.ProvinceData.Province; 11 | import java.awt.Color; 12 | import java.awt.Graphics2D; 13 | import java.util.List; 14 | 15 | /** 16 | * MapMode that highlights core provinces of a single country. 17 | * @author Michael Myers 18 | */ 19 | public class CoreMapMode extends ProvincePaintingMode { 20 | 21 | protected String tag; 22 | protected Color coreColor = Color.GREEN; 23 | protected Color notCoreColor = new Color(100, 100, 100); // darker than GRAY, lighter than DARK_GRAY 24 | 25 | /** Creates a new instance of CoreMapMode */ 26 | public CoreMapMode(String tag) { 27 | super(); 28 | this.tag = tag; 29 | } 30 | 31 | public CoreMapMode(MapPanel panel, String tag) { 32 | super(panel); 33 | this.tag = tag; 34 | } 35 | 36 | protected void paintProvince(final Graphics2D g, int provId) { 37 | final List coreOf = mapPanel.getModel().isCoreOf(provId); 38 | if (coreOf.contains(tag)) { 39 | mapPanel.paintProvince(g, provId, coreColor); 40 | } else { 41 | mapPanel.paintProvince(g, provId, notCoreColor); 42 | } 43 | } 44 | 45 | protected void paintSeaZone(final Graphics2D g, int id) { 46 | // Sea zones can't be cores. 47 | return; 48 | } 49 | 50 | public String getTooltipExtraText(Province current) { 51 | if (current.getId() == 0 || current.getId() >= SEA_STARTS) 52 | return ""; 53 | 54 | final List coreOf = mapPanel.getModel().isCoreOf(current.getId()); 55 | if (coreOf.isEmpty()) 56 | return ""; 57 | return "Core of: " + coreOf; 58 | } 59 | 60 | } 61 | -------------------------------------------------------------------------------- /Rome_Scenario_Editor/src/editor/mapmode/GoodsMode.java: -------------------------------------------------------------------------------- 1 | /* 2 | * GoodsMode.java 3 | * 4 | * Created on June 12, 2007, 3:27 PM 5 | */ 6 | 7 | package editor.mapmode; 8 | 9 | import editor.Main; 10 | import editor.MapPanel; 11 | import editor.ProvinceData.Province; 12 | import editor.Text; 13 | import eug.parser.EUGFileIO; 14 | import eug.parser.ParserSettings; 15 | import eug.shared.GenericList; 16 | import eug.shared.GenericObject; 17 | import java.awt.Color; 18 | import java.awt.Graphics2D; 19 | import java.util.HashMap; 20 | 21 | /** 22 | * 23 | * @author Michael Myers 24 | */ 25 | public class GoodsMode extends ProvincePaintingMode { 26 | 27 | 28 | /** Creates a new instance of GoodsMode */ 29 | public GoodsMode() { 30 | super(); 31 | } 32 | 33 | public GoodsMode(MapPanel panel) { 34 | super(panel); 35 | } 36 | 37 | protected void paintProvince(Graphics2D g, int provId) { 38 | final String goods = mapPanel.getModel().getHistString(provId, "trade_goods"); 39 | if (goods == null) { 40 | mapPanel.paintProvince(g, provId, Utilities.COLOR_NO_HIST); 41 | } else if (goods.length() == 0 || goods.equals("none")) { 42 | mapPanel.paintProvince(g, provId, Utilities.COLOR_NO_GOODS); 43 | } else { 44 | mapPanel.paintProvince(g, provId, Utilities.getGoodsColor(goods)); 45 | } 46 | } 47 | 48 | protected void paintSeaZone(Graphics2D g, int id) { 49 | // Do nothing 50 | return; 51 | } 52 | 53 | 54 | public String getTooltipExtraText(Province current) { 55 | if (current.getId() == 0 || current.getId() >= SEA_STARTS) 56 | return ""; 57 | 58 | final String ret = Text.getText(mapPanel.getModel().getHistString(current.getId(), "trade_goods")); 59 | if (ret.equals("")) 60 | return ""; 61 | return "Goods: " + ret; 62 | } 63 | 64 | } 65 | -------------------------------------------------------------------------------- /Rome_Scenario_Editor/src/editor/mapmode/SingleCountryMode.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SingleCountryMode.java 3 | * 4 | * Created on June 11, 2007, 2:56 PM 5 | */ 6 | 7 | package editor.mapmode; 8 | 9 | import editor.MapPanel; 10 | import editor.ProvinceData.Province; 11 | import editor.Text; 12 | import java.awt.Color; 13 | import java.awt.Graphics2D; 14 | 15 | /** 16 | * 17 | * @author Michael Myers 18 | */ 19 | public class SingleCountryMode extends ProvincePaintingMode { 20 | 21 | private Color sameCountryColor = Color.GREEN; 22 | private Color differentCountryColor = Color.GRAY; 23 | 24 | private String tag; 25 | 26 | /** Creates a new instance of SingleCountryMode */ 27 | public SingleCountryMode(String tag) { 28 | super(); 29 | this.tag = tag; 30 | } 31 | 32 | public SingleCountryMode(MapPanel panel, String tag) { 33 | super(panel); 34 | this.tag = tag; 35 | } 36 | 37 | protected void paintProvince(Graphics2D g, int provId) { 38 | if (mapPanel.getModel().getHistString(provId, "owner").equals(tag)) 39 | mapPanel.paintProvince(g, provId, sameCountryColor); 40 | else 41 | mapPanel.paintProvince(g, provId, differentCountryColor); 42 | } 43 | 44 | protected void paintSeaZone(Graphics2D g, int id) { 45 | // Do nothing 46 | return; 47 | } 48 | 49 | public String getTag() { 50 | return tag; 51 | } 52 | 53 | public void setTag(String tag) { 54 | this.tag = tag; 55 | } 56 | 57 | public String getTooltipExtraText(Province current) { 58 | if (current.getId() == 0 || current.getId() >= SEA_STARTS) 59 | return ""; 60 | 61 | final String owner = mapPanel.getModel().getHistString(current.getId(), "owner"); 62 | if (owner == null || owner.equals("")) 63 | return ""; 64 | return "Owned by: " + Text.getText(owner); 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /EU3_Scenario_Editor/src/editor/mapmode/SingleCountryMode.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SingleCountryMode.java 3 | * 4 | * Created on June 11, 2007, 2:56 PM 5 | */ 6 | 7 | package editor.mapmode; 8 | 9 | import editor.MapPanel; 10 | import editor.ProvinceData.Province; 11 | import editor.Text; 12 | import java.awt.Color; 13 | import java.awt.Graphics2D; 14 | 15 | /** 16 | * 17 | * @author Michael Myers 18 | */ 19 | public class SingleCountryMode extends ProvincePaintingMode { 20 | 21 | private Color sameCountryColor = Color.GREEN; 22 | private Color differentCountryColor = Color.GRAY; 23 | 24 | private String tag; 25 | 26 | /** Creates a new instance of SingleCountryMode */ 27 | public SingleCountryMode(String tag) { 28 | this.tag = tag; 29 | } 30 | 31 | public SingleCountryMode(MapPanel panel, String tag) { 32 | super(panel); 33 | this.tag = tag; 34 | } 35 | 36 | protected void paintProvince(Graphics2D g, int provId) { 37 | if (mapPanel.getModel().getOwner(provId).equalsIgnoreCase(tag)) 38 | mapPanel.paintProvince(g, provId, sameCountryColor); 39 | else 40 | mapPanel.paintProvince(g, provId, differentCountryColor); 41 | } 42 | 43 | protected void paintSeaZone(Graphics2D g, int id) { 44 | // Do nothing 45 | return; 46 | } 47 | 48 | public String getTag() { 49 | return tag; 50 | } 51 | 52 | public void setTag(String tag) { 53 | this.tag = tag; 54 | } 55 | 56 | @Override 57 | public String getTooltipExtraText(Province current) { 58 | if (!getMap().isLand(current.getId())) 59 | return ""; 60 | 61 | final String owner = mapPanel.getModel().getOwner(current.getId()); 62 | if (owner == null || owner.length() == 0) 63 | return ""; 64 | return "Owned by: " + Text.getText(owner); 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /EU3_Scenario_Editor/src/editor/mapmode/ProvReligionMode.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ProvReligionMode.java 3 | * 4 | * Created on June 12, 2007, 2:00 PM 5 | */ 6 | 7 | package editor.mapmode; 8 | 9 | import editor.MapPanel; 10 | import editor.ProvinceData.Province; 11 | import editor.Text; 12 | import java.awt.Graphics2D; 13 | 14 | /** 15 | * 16 | * @author Michael Myers 17 | */ 18 | public class ProvReligionMode extends ProvincePaintingMode { 19 | 20 | /** 21 | * Creates a new instance of ProvReligionMode. 22 | */ 23 | public ProvReligionMode() { 24 | } 25 | 26 | public ProvReligionMode(MapPanel panel) { 27 | super(panel); 28 | } 29 | 30 | protected void paintProvince(final Graphics2D g, int provId) { 31 | final String religion = mapPanel.getModel().getHistString(provId, "religion"); 32 | if (mapPanel.getMap().isWasteland(provId)) 33 | mapPanel.paintProvince(g, provId, java.awt.Color.BLACK); 34 | else if (religion == null) { 35 | mapPanel.paintProvince(g, provId, Utilities.COLOR_NO_HIST); 36 | } else if (religion.length() == 0 || religion.equalsIgnoreCase("none")) { 37 | mapPanel.paintProvince(g, provId, Utilities.COLOR_NO_RELIGION); 38 | } else { 39 | mapPanel.paintProvince(g, provId, Utilities.getReligionColor(religion)); 40 | } 41 | } 42 | 43 | protected void paintSeaZone(final Graphics2D g, int id) { 44 | // Do nothing 45 | return; 46 | } 47 | 48 | @Override 49 | public String getTooltipExtraText(final Province current) { 50 | if (!getMap().isLand(current.getId())) 51 | return ""; 52 | 53 | final String ret = Text.getText(mapPanel.getModel().getHistString(current.getId(), "religion")); 54 | if (ret == null || ret.length() == 0) 55 | return ""; 56 | return "Religion: " + ret; 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /EugFile_specific/src/eug/specific/eu3/EU3Province.java: -------------------------------------------------------------------------------- 1 | /* 2 | * EU3Province.java 3 | * 4 | * Created on March 22, 2007, 9:48 PM 5 | */ 6 | 7 | package eug.specific.eu3; 8 | 9 | import eug.shared.GenericObject; 10 | import java.util.List; 11 | 12 | /** 13 | * 14 | * @author Michael Myers 15 | * @since EUGFile 1.03.00 16 | */ 17 | public class EU3Province extends EU3SpecificObject { 18 | 19 | private GenericObject history = null; 20 | 21 | /** Creates a new instance of EU3Province */ 22 | public EU3Province(GenericObject go, EU3SaveGame s) { 23 | super(go, s); 24 | } 25 | 26 | /** Lazy creation of history object. */ 27 | private GenericObject getHistory() { 28 | if (history == null) { 29 | history = go.getChild("history"); 30 | } 31 | return history; 32 | } 33 | 34 | public int getId() { 35 | return Integer.parseInt(go.name); 36 | } 37 | 38 | public String getOwner() { 39 | return go.getString("owner"); 40 | } 41 | 42 | public String getController() { 43 | return go.getString("controller"); 44 | } 45 | 46 | public List isCoreOf() { 47 | return go.getStrings("core"); 48 | } 49 | 50 | public boolean hasBuilding(String name) { 51 | return go.getString(name).equals("yes"); 52 | } 53 | 54 | public double getCitySize() { 55 | return go.getDouble("citysize"); 56 | } 57 | 58 | public String getCulture() { 59 | return go.getString("culture"); 60 | } 61 | 62 | public String getReligion() { 63 | return go.getString("religion"); 64 | } 65 | 66 | public double getBaseTax() { 67 | return go.getDouble("base_tax"); 68 | } 69 | 70 | public double getManpower() { 71 | return go.getDouble("manpower"); 72 | } 73 | 74 | public String getTradeGoods() { 75 | return go.getString("trade_goods"); 76 | } 77 | } 78 | -------------------------------------------------------------------------------- /EU3_Scenario_Editor/src/editor/mapmode/DevelopmentMapMode.java: -------------------------------------------------------------------------------- 1 | 2 | package editor.mapmode; 3 | 4 | import editor.MapPanel; 5 | import editor.ProvinceData; 6 | 7 | /** 8 | * 9 | * @author Michael 10 | */ 11 | public class DevelopmentMapMode extends DiscreteScalingMapMode { 12 | 13 | public DevelopmentMapMode(MapPanel panel, int min, int max, int step) { 14 | super(panel, "", min, max, step); 15 | setName("development"); 16 | } 17 | 18 | 19 | @Override 20 | protected double getProvinceValue(int provId) { 21 | String manpower = mapPanel.getModel().getHistString(provId, "base_manpower"); 22 | String baseTax = mapPanel.getModel().getHistString(provId, "base_tax"); 23 | String production = mapPanel.getModel().getHistString(provId, "base_production"); 24 | 25 | return toInt(manpower) + toInt(baseTax) + toInt(production); 26 | } 27 | 28 | private int toInt(String strInt) { 29 | if (strInt == null || strInt.isEmpty()) 30 | return 0; 31 | try { 32 | return Integer.parseInt(strInt); 33 | } catch (NumberFormatException ex) { 34 | return 0; 35 | } 36 | } 37 | 38 | @Override 39 | public String getTooltipExtraText(ProvinceData.Province current) { 40 | final int id = current.getId(); 41 | if (!getMap().isLand(id)) 42 | return ""; 43 | if (getMap().isWasteland(id)) 44 | return ""; 45 | 46 | String manpower = mapPanel.getModel().getHistString(id, "base_manpower"); 47 | String baseTax = mapPanel.getModel().getHistString(id, "base_tax"); 48 | String production = mapPanel.getModel().getHistString(id, "base_production"); 49 | 50 | return "Base tax: " + baseTax 51 | + "
Production: " + production 52 | + "
Manpower: " + manpower 53 | + "
Total development: " + (int)getProvinceValue(id) + ""; 54 | } 55 | 56 | 57 | } 58 | -------------------------------------------------------------------------------- /EU3_Scenario_Editor/src/editor/mapmode/CountryHistoryExistsMode.java: -------------------------------------------------------------------------------- 1 | 2 | package editor.mapmode; 3 | 4 | import editor.MapPanel; 5 | import editor.ProvinceData; 6 | import eug.shared.GenericObject; 7 | import java.awt.Color; 8 | import java.awt.Graphics2D; 9 | 10 | /** 11 | * 12 | * @author Michael 13 | */ 14 | public class CountryHistoryExistsMode extends ProvincePaintingMode { 15 | 16 | private static final Color COLOR_NO_HIST = Color.RED.darker(); 17 | private static final Color COLOR_HAS_HIST = Color.GREEN.darker(); 18 | 19 | public CountryHistoryExistsMode() { 20 | } 21 | 22 | public CountryHistoryExistsMode(MapPanel panel) { 23 | super(panel); 24 | } 25 | 26 | @Override 27 | protected void paintProvince(Graphics2D g, int provId) { 28 | final String ownerTag = mapPanel.getModel().getOwner(provId); 29 | if (Utilities.isNotACountry(ownerTag)) { 30 | mapPanel.paintProvince(g, provId, Utilities.COLOR_LAND_DEFAULT); 31 | return; 32 | } 33 | 34 | final GenericObject history = mapPanel.getDataSource().getCountryHistory(ownerTag); 35 | 36 | if (history != null) 37 | mapPanel.paintProvince(g, provId, COLOR_HAS_HIST); 38 | else 39 | mapPanel.paintProvince(g, provId, COLOR_NO_HIST); 40 | } 41 | 42 | @Override 43 | protected void paintSeaZone(Graphics2D g, int id) { 44 | // Nothing here 45 | } 46 | 47 | @Override 48 | public String getTooltipExtraText(ProvinceData.Province current) { 49 | final String ownerTag = mapPanel.getModel().getOwner(current.getId()); 50 | if (Utilities.isNotACountry(ownerTag)) 51 | return "Not part of a country"; 52 | 53 | final GenericObject history = mapPanel.getDataSource().getCountryHistory(ownerTag); 54 | 55 | if (history == null) 56 | return ownerTag + " does not have a country history file"; 57 | else 58 | return ownerTag + " has a country history file"; 59 | } 60 | 61 | } 62 | -------------------------------------------------------------------------------- /eugFile/src/eug/shared/HeaderComment.java: -------------------------------------------------------------------------------- 1 | /* 2 | * HeaderComment.java 3 | * 4 | * Created on July 11, 2006, 10:20 PM 5 | */ 6 | 7 | package eug.shared; 8 | 9 | import java.io.BufferedWriter; 10 | import java.io.IOException; 11 | 12 | /** 13 | * 14 | * @author Michael Myers 15 | */ 16 | public class HeaderComment extends InlineComment { 17 | 18 | /** Creates a new instance of HeaderComment */ 19 | public HeaderComment(String comment) { 20 | super(comment); 21 | } 22 | 23 | // /** 24 | // * @deprecated As of EUGFile 1.01.03, use 25 | // * {@link Comment#appendComment appendComment} instead. 26 | // */ 27 | // @Deprecated 28 | // public void addCommentLine(String newComment) { 29 | // super.appendComment(newComment); 30 | //// comment += "\n" + newComment; 31 | // } 32 | 33 | public void toFileString(BufferedWriter bw, int depth) throws IOException { 34 | toFileString(bw, depth, Style.DEFAULT); 35 | } 36 | 37 | public void toFileString(BufferedWriter bw, int depth, Style style) throws IOException { 38 | if (comment.length() == 0) 39 | return; 40 | 41 | // writeHashLine(bw, depth); 42 | style.printHeaderCommentStart(bw, depth); 43 | final String[] lines = newLinePattern.split(comment); 44 | final int num = lines.length; 45 | for (int i = 0; i < num; i++) { 46 | bw.write(style.getTab(depth)); 47 | style.printCommentStart(bw, depth); 48 | bw.write(lines[i]); 49 | if (i < num-1) 50 | bw.newLine(); 51 | } 52 | style.printHeaderCommentEnd(bw, depth); 53 | // writeHashLine(bw, depth); 54 | bw.newLine(); 55 | } 56 | 57 | // private static final void writeHashLine(BufferedWriter bw, int depth) throws IOException { 58 | // GenericObject.writeTab(bw, depth); 59 | // 60 | // for (int i = depth*GenericObject.tabLength; i < 80; i++) 61 | // bw.write(commentChar); 62 | // 63 | // bw.newLine(); 64 | // } 65 | 66 | } 67 | -------------------------------------------------------------------------------- /Rome_Scenario_Editor/src/editor/mapmode/CapitalsMode.java: -------------------------------------------------------------------------------- 1 | /* 2 | * CapitalsMode.java 3 | * 4 | * Created on Feb 23, 2008, 11:15:31 PM 5 | */ 6 | 7 | package editor.mapmode; 8 | 9 | import editor.MapPanel; 10 | import editor.ProvinceData.Province; 11 | import editor.Text; 12 | import java.awt.Color; 13 | import java.awt.Graphics2D; 14 | import java.util.HashMap; 15 | import java.util.List; 16 | import java.util.Map; 17 | 18 | /** 19 | * MapMode that highlights all provinces that are capitals. 20 | * @author Michael 21 | */ 22 | public final class CapitalsMode extends ProvincePaintingMode { 23 | 24 | protected Color foundColor = Color.GREEN; 25 | protected Color notFoundColor = new Color(100, 100, 100); // darker than GRAY, lighter than DARK_GRAY 26 | 27 | private final Map capitals = 28 | new HashMap(100); 29 | 30 | public CapitalsMode() { 31 | super(); 32 | } 33 | 34 | public CapitalsMode(MapPanel panel) { 35 | super(panel); 36 | } 37 | 38 | @Override 39 | protected void paintingStarted(final Graphics2D g) { 40 | capitals.clear(); 41 | final List tags = mapPanel.getModel().getTags(); 42 | 43 | for (String tag : tags) { 44 | String cap = mapPanel.getModel().getHistString(tag, "capital"); 45 | if (!cap.equals("")) 46 | capitals.put(Integer.parseInt(cap), Text.getText(tag)); 47 | } 48 | } 49 | 50 | @Override 51 | protected void paintProvince(final Graphics2D g, int provId) { 52 | if (capitals.containsKey(provId)) 53 | mapPanel.paintProvince(g, provId, foundColor); 54 | else 55 | mapPanel.paintProvince(g, provId, notFoundColor); 56 | } 57 | 58 | @Override 59 | protected void paintSeaZone(final Graphics2D g, int id) { 60 | // do nothing 61 | } 62 | 63 | @Override 64 | public String getTooltipExtraText(final Province current) { 65 | if (capitals.containsKey(current.getId())) 66 | return "Capital of " + capitals.get(current.getId()); 67 | return ""; 68 | } 69 | 70 | } 71 | -------------------------------------------------------------------------------- /EugFile_specific/src/eug/specific/victoria2/Vic2SaveGame.java: -------------------------------------------------------------------------------- 1 | 2 | 3 | package eug.specific.victoria2; 4 | 5 | import eug.parser.EUGFileIO; 6 | import eug.shared.FilenameResolver; 7 | import eug.shared.GenericObject; 8 | import eug.shared.Style; 9 | import eug.specific.clausewitz.ClausewitzSaveGame; 10 | import java.util.ArrayList; 11 | import java.util.Collections; 12 | import java.util.List; 13 | 14 | /** 15 | * 16 | * @author Michael 17 | */ 18 | public class Vic2SaveGame extends ClausewitzSaveGame implements Vic2DataSource { 19 | 20 | public Vic2SaveGame(GenericObject root, String savePath, String mainPath, String modName) { 21 | super(root, savePath, mainPath, modName); 22 | } 23 | 24 | public Vic2SaveGame(GenericObject root, String savePath, FilenameResolver resolver) { 25 | super(root, savePath, null, null); 26 | } 27 | 28 | public static Vic2SaveGame loadSaveGame(String filename, String mainPath, String modName) { 29 | return new Vic2SaveGame(EUGFileIO.load(filename), filename, mainPath, modName); 30 | } 31 | 32 | public static Vic2SaveGame loadSaveGame(String filename, FilenameResolver resolver) { 33 | return new Vic2SaveGame(EUGFileIO.load(filename), filename, resolver); 34 | } 35 | 36 | @Override 37 | public GenericObject getProvinceHistory(int id) { 38 | return getProvince(id); 39 | } 40 | 41 | @Override 42 | public String getProvinceHistoryAsStr(int id) { 43 | return getProvince(id).toString(Style.EU3_SAVE_GAME); 44 | } 45 | 46 | @Override 47 | public GenericObject getCountryHistory(String tag) { 48 | return getCountry(tag); 49 | } 50 | 51 | @Override 52 | public String getCountryHistoryAsStr(String tag) { 53 | return getCountry(tag).toString(Style.EU3_SAVE_GAME); 54 | } 55 | 56 | @Override 57 | public List getPops(int provId) { 58 | GenericObject province = getProvince(provId); 59 | // Pops are directly inside the province data 60 | if (province != null) 61 | return Collections.singletonList(province); 62 | else 63 | return Collections.emptyList(); 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /eugFile/nbproject/project.properties: -------------------------------------------------------------------------------- 1 | #Sat Dec 17 23:19:08 CST 2016 2 | excludes= 3 | file.reference.hamcrest-core-1.3.jar=test-lib/hamcrest-core-1.3.jar 4 | file.reference.junit-4.12.jar=test-lib/junit-4.12.jar 5 | javac.deprecation=true 6 | build.test.results.dir=${build.dir}/test/results 7 | javac.external.vm=false 8 | run.classpath=\ 9 | ${javac.classpath}:\ 10 | ${build.classes.dir} 11 | javadoc.nonavbar=false 12 | run.test.classpath=\ 13 | ${javac.test.classpath}:\ 14 | ${build.test.classes.dir} 15 | javac.processorpath=\ 16 | ${javac.classpath} 17 | javac.target=1.8 18 | annotation.processing.processors.list= 19 | javadoc.noindex=false 20 | javadoc.additionalparam= 21 | includes=** 22 | build.classes.dir=${build.dir}/classes 23 | javadoc.author=false 24 | test.src.dir=test 25 | build.dir=build 26 | build.test.classes.dir=${build.dir}/test/classes 27 | platform.active=default_platform 28 | javac.compilerargs=-Xlint 29 | main.class=eug.parser.ParserTestMain 30 | dist.jar=${dist.dir}/EugFile.jar 31 | javadoc.use=true 32 | build.sysclasspath=ignore 33 | debug.test.classpath=${run.test.classpath} 34 | dist.dir=dist 35 | build.classes.excludes=**/*.java, **/*.form, **/*.flex, **/*.jj 36 | javadoc.splitindex=true 37 | javadoc.encoding= 38 | javac.source=1.8 39 | application.vendor= 40 | junit.selected.version=3 41 | debug.classpath=${run.classpath} 42 | run.jvmargs=-Xmx256m -Xprof -ea 43 | build.generated.dir=${build.dir}/generated 44 | jar.compress=false 45 | javac.test.classpath=\ 46 | ${javac.classpath}:\ 47 | ${build.classes.dir}:\ 48 | ${file.reference.junit-4.12.jar}:\ 49 | ${file.reference.hamcrest-core-1.3.jar} 50 | javadoc.private=true 51 | annotation.processing.run.all.processors=true 52 | application.title=EugFile 53 | meta.inf.dir=${src.dir}/META-INF 54 | annotation.processing.enabled=true 55 | dist.javadoc.dir=${dist.dir}/javadoc 56 | src.dir=src 57 | mkdist.disabled=false 58 | endorsed.classpath= 59 | javac.classpath= 60 | annotation.processing.enabled.in.editor=false 61 | build.generated.sources.dir=${build.dir}/generated-sources 62 | application.args= 63 | javadoc.version=false 64 | javadoc.windowtitle= 65 | javadoc.notree=false 66 | -------------------------------------------------------------------------------- /EU3_Scenario_Editor/src/editor/mapmode/CapitalsMode.java: -------------------------------------------------------------------------------- 1 | /* 2 | * CapitalsMode.java 3 | * 4 | * Created on Feb 23, 2008, 11:15:31 PM 5 | */ 6 | 7 | package editor.mapmode; 8 | 9 | import editor.MapPanel; 10 | import editor.ProvinceData.Province; 11 | import editor.Text; 12 | import java.awt.Color; 13 | import java.awt.Graphics2D; 14 | import java.util.HashMap; 15 | import java.util.List; 16 | import java.util.Map; 17 | 18 | /** 19 | * MapMode that highlights all provinces that are capitals. 20 | * @author Michael 21 | */ 22 | public final class CapitalsMode extends ProvincePaintingMode { 23 | 24 | private Color foundColor = Color.GREEN; 25 | private Color notFoundColor = new Color(100, 100, 100); // darker than GRAY, lighter than DARK_GRAY 26 | 27 | private final Map capitals = 28 | new HashMap(100); 29 | 30 | public CapitalsMode() { 31 | } 32 | 33 | public CapitalsMode(MapPanel panel) { 34 | super(panel); 35 | } 36 | 37 | @Override 38 | protected void paintingStarted(final Graphics2D g) { 39 | capitals.clear(); 40 | final List tags = mapPanel.getModel().getTags(); 41 | 42 | for (String tag : tags) { 43 | String cap = mapPanel.getModel().getHistString(tag, "capital"); 44 | if (cap != null && cap.length() != 0) 45 | capitals.put(Integer.parseInt(cap), Text.getText(tag)); 46 | } 47 | } 48 | 49 | @Override 50 | protected void paintProvince(final Graphics2D g, int provId) { 51 | if (capitals.containsKey(provId)) 52 | mapPanel.paintProvince(g, provId, foundColor); 53 | else 54 | mapPanel.paintProvince(g, provId, notFoundColor); 55 | } 56 | 57 | @Override 58 | protected void paintSeaZone(final Graphics2D g, int id) { 59 | // do nothing 60 | } 61 | 62 | @Override 63 | public String getTooltipExtraText(final Province current) { 64 | if (capitals.containsKey(current.getId())) 65 | return "Capital of " + capitals.get(current.getId()); 66 | return ""; 67 | } 68 | 69 | } 70 | -------------------------------------------------------------------------------- /Rome_Scenario_Editor/src/editor/mapmode/AdvancedCustomCountryMode.java: -------------------------------------------------------------------------------- 1 | /* 2 | * AdvancedCustomCountryMode.java 3 | * 4 | * Created on July 30, 2007, 9:30 PM 5 | */ 6 | 7 | package editor.mapmode; 8 | 9 | import editor.MapPanel; 10 | import editor.ProvinceData.Province; 11 | import editor.Text; 12 | import java.awt.Color; 13 | import java.util.regex.Pattern; 14 | 15 | /** 16 | * 17 | * @author Michael Myers 18 | * @since 0.5pre3 19 | */ 20 | public class AdvancedCustomCountryMode extends CustomCountryMode { 21 | 22 | private final Pattern pattern; 23 | 24 | /** Creates a new instance of AdvancedCustomCountryMode */ 25 | public AdvancedCustomCountryMode(String name, String pattern) { 26 | super(name, pattern); 27 | this.pattern = Pattern.compile(pattern, Pattern.CASE_INSENSITIVE); 28 | } 29 | 30 | public AdvancedCustomCountryMode(MapPanel panel, String name, String pattern) { 31 | super(panel, name, pattern); 32 | this.pattern = Pattern.compile(pattern, Pattern.CASE_INSENSITIVE); 33 | } 34 | 35 | protected Color getCtryColor(String country) { 36 | country = country.toUpperCase(); 37 | 38 | final String prop = mapPanel.getModel().getHistString(country, name); 39 | 40 | if (prop == null || !pattern.matcher(prop).matches()) { 41 | return notFoundColor; 42 | } else { 43 | return foundColor; 44 | } 45 | } 46 | 47 | public String getTooltipExtraText(final Province current) { 48 | final int id = current.getId(); 49 | if (id == 0 || id >= SEA_STARTS) 50 | return ""; 51 | 52 | final String tag = mapPanel.getModel().getHistString(id, "owner"); 53 | if (tag.length() == 0) 54 | return ""; 55 | final String owner = Text.getText(tag); 56 | final StringBuilder ret = new StringBuilder("Owned by: ").append(owner).append("
"); 57 | ret.append(Text.getText(name)).append(": ").append(Text.getText(mapPanel.getModel().getHistString(tag, name))); 58 | return ret.toString(); 59 | } 60 | 61 | public String toString() { 62 | return "Countries with " + name + " matching " + pattern; 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /eugFile/src/eug/shared/EuropaModHandler.java: -------------------------------------------------------------------------------- 1 | 2 | package eug.shared; 3 | 4 | import java.io.File; 5 | import java.nio.file.Path; 6 | import java.nio.file.Paths; 7 | 8 | /** 9 | * Europa engine mod handler. This class has very basic mod handling behavior. 10 | * If a file is in the mod directory, it overrides a file in the base game directory. 11 | * @author Michael 12 | */ 13 | public class EuropaModHandler implements ModHandler { 14 | 15 | private final Path baseDir; 16 | private final Path modDir; 17 | 18 | /** 19 | * Creates a new mod handler with the specified base (game) directory and 20 | * mod directory. If @{code modDir} is null, only vanilla files will be used. 21 | * @param baseDir 22 | * @param modDir 23 | */ 24 | public EuropaModHandler(String baseDir, String modDir) { 25 | this.baseDir = Paths.get(baseDir); 26 | //if (!this.baseDir.toFile().exists()) 27 | // throw new IllegalArgumentException("Base dir " + baseDir + " does not exist"); 28 | 29 | if (modDir == null || modDir.isEmpty()) 30 | this.modDir = null; 31 | else if (new File(modDir).exists()) 32 | this.modDir = Paths.get(modDir); 33 | else //if (new File(baseDir + File.separator + modDir).exists()) 34 | this.modDir = Paths.get(baseDir, modDir); 35 | //else 36 | // throw new IllegalArgumentException("Mod dir must either be a subfolder of the game folder or else a fully qualified pathname"); 37 | } 38 | 39 | @Override 40 | public String resolveDirectory(String path) { 41 | // Europa engine resolves files and directories the same 42 | return resolveFilename(path) + File.separatorChar; 43 | } 44 | 45 | @Override 46 | public String resolveFilename(String filename) { 47 | if (modDir != null) { 48 | Path modPath = modDir.resolve(filename); 49 | if (modPath.toFile().exists()) 50 | return modPath.toAbsolutePath().toString(); 51 | } 52 | 53 | return baseDir.resolve(filename).toAbsolutePath().toString(); 54 | } 55 | 56 | @Override 57 | public File[] listFiles(String path) { 58 | return new File(resolveDirectory(path)).listFiles(); 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /EU3_Scenario_Editor/src/editor/mapmode/ProvinceFlagMode.java: -------------------------------------------------------------------------------- 1 | 2 | package editor.mapmode; 3 | 4 | import editor.MapPanel; 5 | import editor.ProvinceData; 6 | import java.awt.Color; 7 | import java.awt.Graphics2D; 8 | import java.util.List; 9 | 10 | /** 11 | * Highlights provinces that have the specified flag set. That is, they must have 12 | * set_province_flag = <flag> 13 | * without a corresponding 14 | * clr_province_flag = <flag> 15 | * in their history. 16 | * @author Michael 17 | */ 18 | public class ProvinceFlagMode extends ProvincePaintingMode { 19 | 20 | private final String flagName; 21 | 22 | private static final String SET_PROVINCE_FLAG = "set_province_flag"; 23 | private static final String CLR_PROVINCE_FLAG = "clr_province_flag"; 24 | 25 | public ProvinceFlagMode(MapPanel panel, String flagName) { 26 | super(panel); 27 | this.flagName = flagName; 28 | } 29 | 30 | @Override 31 | protected void paintProvince(Graphics2D g, int provId) { 32 | // flags are tricky because the left-hand side isn't unique, just the right-hand side 33 | // so the usual getHistString will only retrieve the last flag that was set 34 | // and getHistStrings will return all of them, but not the dates they were set 35 | boolean flag = mapPanel.getModel().isRhsSet(provId, SET_PROVINCE_FLAG, CLR_PROVINCE_FLAG, flagName); 36 | 37 | if (flag) { 38 | mapPanel.paintProvince(g, provId, Color.GREEN); 39 | } else { 40 | mapPanel.paintProvince(g, provId, Color.DARK_GRAY); 41 | } 42 | } 43 | 44 | @Override 45 | protected void paintSeaZone(Graphics2D g, int id) { 46 | // probably don't care about sea zones - who is setting flags on them? 47 | } 48 | 49 | @Override 50 | public String getTooltipExtraText(ProvinceData.Province current) { 51 | if (!getMap().isLand(current.getId())) 52 | return ""; 53 | 54 | StringBuilder sb = new StringBuilder("Flags:
"); 55 | List flags = mapPanel.getModel().getRhsSet(current.getId(), SET_PROVINCE_FLAG, CLR_PROVINCE_FLAG); 56 | sb.append(String.join("
", flags)); 57 | return sb.toString(); 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /.github/workflows/ant.yml: -------------------------------------------------------------------------------- 1 | # This workflow will build a Java project with Ant 2 | # For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-ant 3 | 4 | name: Java CI 5 | 6 | on: 7 | push: 8 | branches: [ master ] 9 | pull_request: 10 | branches: [ master ] 11 | 12 | jobs: 13 | build: 14 | 15 | runs-on: windows-latest 16 | 17 | steps: 18 | - uses: actions/checkout@v3 19 | - name: Set up JDK 8 20 | uses: actions/setup-java@v3 21 | with: 22 | java-version: '8' 23 | distribution: 'adopt' 24 | 25 | - name: Initialize CodeQL 26 | uses: github/codeql-action/init@v3 27 | with: 28 | languages: java 29 | 30 | # Build all four main projects 31 | - name: Build eugFile 32 | run: ant -noinput -buildfile eugFile/build.xml 33 | - name: Build EugFile_specific 34 | run: ant -noinput -buildfile EugFile_specific/build.xml 35 | env: 36 | project.EugFile: ../EugFile 37 | - name: Build EugSyntax 38 | run: ant -noinput -buildfile EugSyntax/build.xml 39 | env: 40 | project.EugFile: ../EugFile 41 | - name: Build Scenario Editor 42 | run: ant -noinput -buildfile EU3_Scenario_Editor/build.xml 43 | env: 44 | project.EugFile: ../EugFile 45 | project.EugFile_specific: ../EugFile_specific 46 | project.EugSyntax: ../EugSyntax 47 | 48 | # CodeQL 49 | - name: Perform CodeQL Analysis 50 | uses: github/codeql-action/analyze@v3 51 | 52 | # Artifact upload 53 | - name: Upload EugFile artifact 54 | uses: actions/upload-artifact@v4 55 | with: 56 | name: EugFile 57 | path: eugFile/dist/eugFile.jar 58 | - name: Upload EugFile_specific artifact 59 | uses: actions/upload-artifact@v4 60 | with: 61 | name: EugFile_specific 62 | path: EugFile_specific/dist/EugFile_specific.jar 63 | - name: Upload EugSyntax artifact 64 | uses: actions/upload-artifact@v4 65 | with: 66 | name: EugSyntax 67 | path: EugSyntax/dist/EugSyntax.jar 68 | - name: Upload scenario editor snapshot artifact 69 | uses: actions/upload-artifact@v4 70 | with: 71 | name: Scenario_Editor 72 | path: EU3_Scenario_Editor/Scenario_Editor.zip 73 | -------------------------------------------------------------------------------- /EU3_Scenario_Editor/src/editor/mapmode/AdvancedCustomCountryMode.java: -------------------------------------------------------------------------------- 1 | /* 2 | * AdvancedCustomCountryMode.java 3 | * 4 | * Created on July 30, 2007, 9:30 PM 5 | */ 6 | 7 | package editor.mapmode; 8 | 9 | import editor.MapPanel; 10 | import editor.ProvinceData.Province; 11 | import editor.Text; 12 | import java.awt.Color; 13 | import java.util.regex.Pattern; 14 | 15 | /** 16 | * 17 | * @author Michael Myers 18 | * @since 0.5pre3 19 | */ 20 | public class AdvancedCustomCountryMode extends CustomCountryMode { 21 | 22 | private final Pattern pattern; 23 | 24 | /** Creates a new instance of AdvancedCustomCountryMode */ 25 | public AdvancedCustomCountryMode(String name, String pattern) { 26 | super(name, pattern); 27 | this.pattern = Pattern.compile(pattern, Pattern.CASE_INSENSITIVE); 28 | } 29 | 30 | public AdvancedCustomCountryMode(MapPanel panel, String name, String pattern) { 31 | super(panel, name, pattern); 32 | this.pattern = Pattern.compile(pattern, Pattern.CASE_INSENSITIVE); 33 | } 34 | 35 | @Override 36 | protected Color getCtryColor(String country) { 37 | country = country.toUpperCase(); 38 | 39 | final String prop = mapPanel.getModel().getHistString(country, name); 40 | 41 | if (prop == null || !pattern.matcher(prop).matches()) { 42 | return notFoundColor; 43 | } else { 44 | return foundColor; 45 | } 46 | } 47 | 48 | @Override 49 | public String getTooltipExtraText(final Province current) { 50 | final int id = current.getId(); 51 | if (!getMap().isLand(id)) 52 | return ""; 53 | 54 | final String tag = mapPanel.getModel().getOwner(id); 55 | if (tag == null || tag.length() == 0) 56 | return ""; 57 | final String owner = Text.getText(tag); 58 | final StringBuilder ret = new StringBuilder("Owned by: ").append(owner).append("
"); 59 | ret.append(Text.getText(name)).append(": ").append(Text.getText(mapPanel.getModel().getHistString(tag, name))); 60 | return ret.toString(); 61 | } 62 | 63 | @Override 64 | public String toString() { 65 | return "Countries with " + name + " matching " + pattern; 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /EU3_Scenario_Editor/src/editor/mapmode/ProvCultureMode.java: -------------------------------------------------------------------------------- 1 | 2 | package editor.mapmode; 3 | 4 | import editor.MapPanel; 5 | import editor.ProvinceData.Province; 6 | import editor.Text; 7 | import java.awt.Graphics2D; 8 | 9 | /** 10 | * 11 | * @author Michael Myers 12 | */ 13 | public class ProvCultureMode extends ProvincePaintingMode { 14 | 15 | public ProvCultureMode() { 16 | } 17 | 18 | public ProvCultureMode(MapPanel panel) { 19 | super(panel); 20 | } 21 | 22 | @Override 23 | protected void paintProvince(final Graphics2D g, int provId) { 24 | if (mapPanel.getMap().isWasteland(provId)) { 25 | mapPanel.paintProvince(g, provId, Utilities.COLOR_NO_CULTURE); 26 | return; 27 | } 28 | 29 | final String culture = mapPanel.getModel().getHistString(provId, "culture"); 30 | if (culture == null) { 31 | mapPanel.paintProvince(g, provId, Utilities.COLOR_NO_HIST); 32 | } else if (culture.length() == 0 || culture.equalsIgnoreCase("none")) { 33 | mapPanel.paintProvince(g, provId, Utilities.COLOR_NO_CULTURE); 34 | } else { 35 | mapPanel.paintProvince(g, provId, Utilities.getCultureColor(culture)); 36 | } 37 | } 38 | 39 | @Override 40 | protected void paintSeaZone(final Graphics2D g, int id) { 41 | // Do nothing 42 | } 43 | 44 | @Override 45 | public String getTooltipExtraText(final Province current) { 46 | if (!getMap().isLand(current.getId())) 47 | return ""; 48 | 49 | final String cultureTag = mapPanel.getModel().getHistString(current.getId(), "culture"); 50 | final String cultureText = Text.getText(cultureTag); 51 | if (cultureText == null || cultureText.length() == 0) 52 | return ""; 53 | final String cultureGroupTag = Utilities.getCultureGroup(cultureTag); 54 | java.awt.Color c = Utilities.getCultureColor(cultureTag); 55 | String ret = "Culture: " + cultureTag + " (" + cultureText + ")
"; 56 | if (cultureGroupTag != null) 57 | ret += "Group: " + cultureGroupTag + " (" + Text.getText(cultureGroupTag) + ")
"; 58 | ret += "Color: " + c.getRed() + " " + c.getGreen() + " " + c.getBlue(); 59 | return ret; 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /EU3_Scenario_Editor/src/editor/mapmode/CultureGroupMode.java: -------------------------------------------------------------------------------- 1 | 2 | package editor.mapmode; 3 | 4 | import editor.MapPanel; 5 | import editor.ProvinceData; 6 | import editor.Text; 7 | import java.awt.Color; 8 | import java.awt.Graphics2D; 9 | 10 | /** 11 | * 12 | * @author Michael 13 | */ 14 | public class CultureGroupMode extends ProvincePaintingMode { 15 | 16 | private final String cultureGroup; 17 | 18 | public CultureGroupMode(MapPanel panel, String cultureGroup) { 19 | super(panel); 20 | this.cultureGroup = cultureGroup; 21 | } 22 | 23 | @Override 24 | protected void paintProvince(Graphics2D g, int provId) { 25 | if (mapPanel.getMap().isWasteland(provId)) { 26 | mapPanel.paintProvince(g, provId, Utilities.COLOR_NO_CULTURE); 27 | return; 28 | } 29 | 30 | final String pCulture = mapPanel.getModel().getHistString(provId, "culture"); 31 | if (pCulture != null) { 32 | String pGroup = Utilities.getCultureGroup(pCulture); 33 | if (pGroup != null && pGroup.equalsIgnoreCase(this.cultureGroup)) { 34 | // randomly assign a color based on the culture name 35 | Color c = Utilities.getGeographyColors().get(Math.abs(pCulture.hashCode()) % Utilities.getGeographyColors().size()); 36 | mapPanel.paintProvince(g, provId, c); 37 | return; 38 | } 39 | } 40 | mapPanel.paintProvince(g, provId, Utilities.COLOR_LAND_DEFAULT); 41 | } 42 | 43 | @Override 44 | protected void paintSeaZone(Graphics2D g, int id) { 45 | // do nothing 46 | } 47 | 48 | @Override 49 | public String getTooltipExtraText(final ProvinceData.Province current) { 50 | if (!getMap().isLand(current.getId())) 51 | return ""; 52 | 53 | final String cultureTag = mapPanel.getModel().getHistString(current.getId(), "culture"); 54 | final String cultureText = Text.getText(cultureTag); 55 | if (cultureText == null || cultureText.length() == 0) 56 | return ""; 57 | final String cultureGroupTag = Utilities.getCultureGroup(cultureTag); 58 | String ret = "Culture: " + cultureTag + " (" + cultureText + ")
"; 59 | ret += "Group: " + cultureGroupTag + " (" + Text.getText(cultureGroupTag) + ")
"; 60 | return ret; 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /EugFile_specific/src/eug/specific/victoria/VicCountry.java: -------------------------------------------------------------------------------- 1 | package eug.specific.victoria; 2 | 3 | import eug.shared.GenericList; 4 | import eug.shared.GenericObject; 5 | import eug.shared.ObjectVariable; 6 | 7 | public class VicCountry extends VicSpecificObject { 8 | 9 | public VicCountry(GenericObject o, VicScenario t) { 10 | super(o, t); 11 | } 12 | 13 | public String getTag() { 14 | return go.getString("tag"); 15 | } 16 | 17 | public String getName() { 18 | return scenario.getDisplayName(go.getString("tag")); 19 | } 20 | 21 | public int getCapital() { 22 | return go.getInt("capital"); 23 | } 24 | 25 | public int nbOwned() { 26 | return go.getChild("ownedprovinces").size(); 27 | } 28 | 29 | public Province owned(int pos) { 30 | GenericObject owned = go.getChild("ownedprovinces"); 31 | 32 | if (pos >= owned.size()) { 33 | System.err.println("Invalid pos id: "+pos); 34 | return null; 35 | } 36 | 37 | String id = owned.getVariable(pos).getValue(); 38 | 39 | return scenario.getProvince(Integer.parseInt(id)); 40 | } 41 | 42 | public int getStatePos(String name) { 43 | for (int i = 0; i < go.nbChild(); i++) { 44 | if (go.getChild(i).name.equals("state")) 45 | if (go.getChild(i).getString("name").equals(name)) 46 | return i; 47 | } 48 | return -1; 49 | } 50 | 51 | public int getProvRGO(int statepos,int provid) { 52 | GenericObject state=go.getChild(statepos); 53 | for (int i = 0; i < state.nbChild(); i++) { 54 | if (state.getChild(i).name.equals("rgo") && state.getChild(i).getInt("location") == provid) 55 | return i; 56 | 57 | } 58 | return -1; 59 | } 60 | 61 | public boolean ownsProvince(int id) { 62 | return go.getList("ownedprovinces").contains(Integer.toString(id)); 63 | } 64 | 65 | public double getTotalPop() { 66 | double pop = 0.0; 67 | final GenericList owned = go.getList("ownedprovinces"); 68 | 69 | for (String sid : owned) { 70 | int id = Integer.parseInt(sid); 71 | pop += scenario.getProvince(id).getTotalPop(); 72 | } 73 | return pop; 74 | } 75 | } 76 | -------------------------------------------------------------------------------- /EugFile_specific/nbproject/project.properties: -------------------------------------------------------------------------------- 1 | #Sat Apr 23 20:39:25 CDT 2022 2 | excludes= 3 | file.reference.hamcrest-core-1.3.jar=test-lib/hamcrest-core-1.3.jar 4 | file.reference.junit-4.12.jar=test-lib/junit-4.12.jar 5 | javac.test.classpath=\ 6 | ${javac.classpath}:\ 7 | ${build.classes.dir}:\ 8 | ${file.reference.junit-4.12.jar}:\ 9 | ${file.reference.hamcrest-core-1.3.jar} 10 | run.classpath=${javac.classpath}\:${build.classes.dir} 11 | javac.processorpath=${javac.classpath} 12 | dist.javadoc.dir=${dist.dir}/javadoc 13 | test.src.dir=test 14 | run.modulepath=${javac.modulepath} 15 | annotation.processing.enabled=true 16 | build.sysclasspath=ignore 17 | debug.modulepath=${run.modulepath} 18 | javac.compilerargs=-Xlint 19 | javadoc.noindex=false 20 | javadoc.private=false 21 | javadoc.author=false 22 | endorsed.classpath= 23 | main.class=eug.specific.eu3.EU3SaveGame 24 | junit.selected.version=3 25 | javac.source=1.8 26 | includes=** 27 | javadoc.use=true 28 | jar.compress=false 29 | javadoc.nonavbar=false 30 | annotation.processing.enabled.in.editor=false 31 | javadoc.notree=false 32 | annotation.processing.processors.list= 33 | javac.deprecation=true 34 | application.vendor=Michael 35 | javadoc.additionalparam= 36 | build.generated.sources.dir=${build.dir}/generated-sources 37 | javadoc.splitindex=true 38 | javac.processormodulepath= 39 | run.jvmargs=-Xmx256m 40 | javadoc.encoding= 41 | javac.classpath=${reference.EugFile.jar} 42 | mkdist.disabled=false 43 | run.test.modulepath=${javac.test.modulepath} 44 | build.classes.excludes=**/*.java,**/*.form 45 | dist.jar=${dist.dir}/EugFile_specific.jar 46 | build.classes.dir=${build.dir}/classes 47 | debug.test.modulepath=${run.test.modulepath} 48 | build.test.classes.dir=${build.dir}/test/classes 49 | javadoc.windowtitle= 50 | reference.EugFile.jar=${project.EugFile}/dist/EugFile.jar 51 | build.test.results.dir=${build.dir}/test/results 52 | dist.dir=dist 53 | build.dir=build 54 | build.generated.dir=${build.dir}/generated 55 | javadoc.version=false 56 | application.args= 57 | application.title=EugFile_specific 58 | javac.test.modulepath=${javac.modulepath} 59 | debug.test.classpath=${run.test.classpath} 60 | javac.target=1.8 61 | platform.active=default_platform 62 | meta.inf.dir=${src.dir}/META-INF 63 | run.test.classpath=${javac.test.classpath}\:${build.test.classes.dir} 64 | annotation.processing.run.all.processors=true 65 | javac.modulepath= 66 | src.dir=src 67 | debug.classpath=${run.classpath} 68 | -------------------------------------------------------------------------------- /eugFile/src/eug/shared/Utilities.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Utilities.java 3 | * 4 | * Created on July 17, 2006, 1:14 PM 5 | */ 6 | 7 | package eug.shared; 8 | 9 | import java.io.File; 10 | import java.io.FileFilter; 11 | import java.io.FilenameFilter; 12 | import java.io.Serializable; 13 | import java.text.DecimalFormat; 14 | import java.util.Arrays; 15 | import java.util.Comparator; 16 | 17 | /** 18 | * 19 | * @author Michael Myers 20 | */ 21 | public final class Utilities { 22 | public static final DecimalFormat POP_FORMATTER = 23 | new DecimalFormat("##,###,##0.000"); 24 | private static final FileDateComparator SORT_BY_DATE = 25 | new FileDateComparator(); 26 | public static final EugFileFilter EUG_FILTER = new EugFileFilter(); 27 | 28 | private Utilities() { } 29 | 30 | public static String formatPop(double pop) { 31 | return POP_FORMATTER.format(pop); 32 | } 33 | 34 | public static String findNewestFile(File dir) { 35 | final File[] list = dir.listFiles(/*EUG_FILTER*/); 36 | Arrays.sort(list, SORT_BY_DATE); 37 | return list[0].getAbsolutePath(); 38 | } 39 | 40 | public static String findNewestFile(File dir, FileFilter filter) { 41 | final File[] list = dir.listFiles(filter); 42 | Arrays.sort(list, SORT_BY_DATE); 43 | return list[0].getAbsolutePath(); 44 | } 45 | 46 | public static String findNewestFile(File dir, FilenameFilter filter) { 47 | final File[] list = dir.listFiles(filter); 48 | Arrays.sort(list, SORT_BY_DATE); 49 | return list[0].getAbsolutePath(); 50 | } 51 | 52 | // Implement Serializable so that any list that uses this comparator can be 53 | // serialized. 54 | private static final class FileDateComparator 55 | implements Comparator, Serializable { 56 | private static final long serialVersionUID = 1L; 57 | public int compare(File f1, File f2) { 58 | final long f1mod = f1.lastModified(); 59 | final long f2mod = f2.lastModified(); 60 | return (f1mod < f2mod ? 1 : (f1mod == f2mod ? 0 : -1)); 61 | } 62 | } 63 | 64 | private static final class EugFileFilter implements FileFilter { 65 | public boolean accept(File pathname) { 66 | return pathname.getName().endsWith(".eug") 67 | || pathname.getName().endsWith(".eu3"); 68 | } 69 | } 70 | 71 | 72 | } 73 | -------------------------------------------------------------------------------- /eugFile/src/eug/shared/InlineComment.java: -------------------------------------------------------------------------------- 1 | /* 2 | * InlineComment.java 3 | * 4 | * Created on July 11, 2006, 10:22 PM 5 | */ 6 | 7 | package eug.shared; 8 | 9 | import java.io.BufferedWriter; 10 | import java.io.IOException; 11 | import java.util.logging.Level; 12 | import java.util.logging.Logger; 13 | 14 | /** 15 | * 16 | * @author Michael Myers 17 | */ 18 | public class InlineComment extends Comment { 19 | 20 | // /** @since EUGFile 1.02.00 */ 21 | // public static boolean spaceBeforeComment = true; 22 | 23 | /** Creates a new instance of InlineComment */ 24 | public InlineComment(String comment) { 25 | super(comment); 26 | } 27 | 28 | public void toFileString(BufferedWriter bw, int depth) throws IOException { 29 | toFileString(bw, depth, Style.DEFAULT); 30 | } 31 | 32 | public void toFileString(BufferedWriter bw, int depth, Style style) throws IOException { 33 | if (comment.length() == 0) { 34 | bw.newLine(); 35 | return; 36 | } 37 | 38 | boolean firstLine = true; 39 | 40 | for (String str : newLinePattern.split(comment)) { 41 | if (firstLine) 42 | firstLine = false; 43 | else { 44 | bw.newLine(); 45 | style.printTab(bw, depth); 46 | } 47 | 48 | style.printCommentStart(bw, depth); 49 | bw.write(str); 50 | } 51 | // bw.newLine(); 52 | } 53 | 54 | // /** @since EUGFile 1.01.03 */ 55 | // protected static final void writeCommentLine(final BufferedWriter bw, final String c, final Style s) 56 | // throws IOException { 57 | // bw.write(commentChar); 58 | // if (spaceBeforeComment) 59 | // bw.write(' '); 60 | // bw.write(c); 61 | // } 62 | 63 | public String toString() { 64 | // System.out.println("Called InlineComment.toString()"); 65 | return toString(Style.DEFAULT); 66 | } 67 | 68 | public String toString(Style s) { 69 | return s.getCommentStart() + comment; 70 | } 71 | 72 | @Override 73 | public InlineComment clone() { 74 | try { 75 | return (InlineComment)super.clone(); 76 | } catch (CloneNotSupportedException ex) { 77 | Logger.getLogger(InlineComment.class.getName()).log(Level.SEVERE, null, ex); 78 | return null; 79 | } 80 | } 81 | } 82 | -------------------------------------------------------------------------------- /Rome_Scenario_Editor/nbproject/project.properties: -------------------------------------------------------------------------------- 1 | build.classes.dir=${build.dir}/classes 2 | build.classes.excludes=**/*.java,**/*.form 3 | # This directory is removed when the project is cleaned: 4 | build.dir=build 5 | build.generated.dir=${build.dir}/generated 6 | # Only compile against the classpath explicitly listed here: 7 | build.sysclasspath=ignore 8 | build.test.classes.dir=${build.dir}/test/classes 9 | build.test.results.dir=${build.dir}/test/results 10 | debug.classpath=\ 11 | ${run.classpath} 12 | debug.test.classpath=\ 13 | ${run.test.classpath} 14 | # This directory is removed when the project is cleaned: 15 | dist.dir=dist 16 | dist.jar=${dist.dir}/Rome_Scenario_Editor.jar 17 | dist.javadoc.dir=${dist.dir}/javadoc 18 | excludes= 19 | includes=** 20 | jar.compress=false 21 | javac.classpath=\ 22 | ${reference.EugFile.jar}:\ 23 | ${reference.EugFile_specific.jar}:\ 24 | ${reference.EugSyntax.jar} 25 | # Space-separated list of extra javac options 26 | javac.compilerargs= 27 | javac.deprecation=false 28 | javac.source=1.5 29 | javac.target=1.5 30 | javac.test.classpath=\ 31 | ${javac.classpath}:\ 32 | ${build.classes.dir}:\ 33 | ${libs.junit.classpath}:\ 34 | ${libs.junit_4.classpath} 35 | javadoc.additionalparam= 36 | javadoc.author=false 37 | javadoc.encoding=${source.encoding} 38 | javadoc.noindex=false 39 | javadoc.nonavbar=false 40 | javadoc.notree=false 41 | javadoc.private=false 42 | javadoc.splitindex=true 43 | javadoc.use=true 44 | javadoc.version=false 45 | javadoc.windowtitle= 46 | main.class=editor.Main 47 | manifest.file=manifest.mf 48 | meta.inf.dir=${src.dir}/META-INF 49 | platform.active=default_platform 50 | project.EugFile=../eug/eugFile 51 | project.EugFile_specific=../eug/EugFile_specific 52 | project.EugSyntax=../eug/EugSyntax 53 | reference.EugFile.jar=${project.EugFile}/dist/EugFile.jar 54 | reference.EugFile_specific.jar=${project.EugFile_specific}/dist/EugFile_specific.jar 55 | reference.EugSyntax.jar=${project.EugSyntax}/dist/EugSyntax.jar 56 | run.classpath=\ 57 | ${javac.classpath}:\ 58 | ${build.classes.dir} 59 | # Space-separated list of JVM arguments used when running the project 60 | # (you may also define separate properties like run-sys-prop.name=value instead of -Dname=value 61 | # or test-sys-prop.name=value to set system properties for unit tests): 62 | run.jvmargs= 63 | run.test.classpath=\ 64 | ${javac.test.classpath}:\ 65 | ${build.test.classes.dir} 66 | source.encoding=UTF-8 67 | src.dir=src 68 | test.src.dir=test 69 | -------------------------------------------------------------------------------- /PositionsEditor/Changelog.txt: -------------------------------------------------------------------------------- 1 | /=================\ 2 | |=== Changelog ===| 3 | \=================/ 4 | 5 | === May 21, 2022 === 6 | 7 | - Updated to work with newer games that store positions as lists of coordinates. 8 | 9 | 10 | === Beta 6 === 11 | 12 | - Fixed crash when loading malformed province definitions. 13 | 14 | 15 | === Beta 5 === 16 | 17 | - Implemented a basic map error checker. 18 | - Improved handling of lakes. 19 | - Province name localization format can now be specified with the province_loc 20 | command in position_types.txt. Previously "PROV000000" was hardcoded. 21 | - Implemented logging instead of printing everything to the console. 22 | - Reversed port rotation in Divine Wind. 23 | - Made a few user interface tweaks. 24 | 25 | 26 | === Beta 4 === 27 | 28 | - Added an option to use game localization files or rely on the names in 29 | definition.csv. 30 | - Corrected the loading of localization files in mods. 31 | 32 | 33 | === Beta 3 === 34 | 35 | - Rewrote much of the logic; it should now work with any Clausewitz game that 36 | is properly defined in position_types.txt. 37 | - Changed the layout of the editor dialog to show the positions on the left 38 | side rather than below. 39 | 40 | 41 | === Beta 2 === 42 | 43 | - The port text is now printed on the side that the ships would actually be in 44 | game, rather than the opposite side. 17blue17 helped me realize that the way 45 | I thought was natural was actually counterintuitive. 46 | - A more helpful tooltip is now shown in the rotation editor dialog. 47 | 48 | 49 | === Beta 1 === 50 | 51 | - Added config.txt, allowing the .map file to be specified at startup. 52 | - Bumped to beta, since no major issues have been reported. 53 | 54 | 55 | === Alpha 5 === 56 | 57 | - Fixed a bug preventing new position entries from being created. 58 | - If the province in the editor window is too big, a scroll bar will now be 59 | shown. 60 | 61 | 62 | === Alpha 4 === 63 | 64 | - The editor no longer requires text editing. It's all in a form now. 65 | - Some improvements to the rotation editor. 66 | 67 | 68 | === Alpha 3 === 69 | 70 | - Added rotation editor, so you won't have to remember how to do radians. 71 | 72 | 73 | === Alpha 2 === 74 | 75 | - Added text color toggle button, so if the province is dark, you can switch 76 | to light text. 77 | - Fixed placement of province names when there is no text position defined. 78 | 79 | 80 | === Alpha === 81 | 82 | - Initial release. -------------------------------------------------------------------------------- /EugSyntax/nbproject/project.properties: -------------------------------------------------------------------------------- 1 | annotation.processing.enabled=true 2 | annotation.processing.enabled.in.editor=false 3 | annotation.processing.processors.list= 4 | annotation.processing.run.all.processors=true 5 | application.title=EugSyntax 6 | application.vendor=Michael 7 | build.classes.dir=${build.dir}/classes 8 | build.classes.excludes=**/*.java,**/*.form 9 | # This directory is removed when the project is cleaned: 10 | build.dir=build 11 | build.generated.dir=${build.dir}/generated 12 | build.generated.sources.dir=${build.dir}/generated-sources 13 | # Only compile against the classpath explicitly listed here: 14 | build.sysclasspath=ignore 15 | build.test.classes.dir=${build.dir}/test/classes 16 | build.test.results.dir=${build.dir}/test/results 17 | debug.classpath=\ 18 | ${run.classpath} 19 | debug.test.classpath=\ 20 | ${run.test.classpath} 21 | # This directory is removed when the project is cleaned: 22 | dist.dir=dist 23 | dist.jar=${dist.dir}/EugSyntax.jar 24 | dist.javadoc.dir=${dist.dir}/javadoc 25 | endorsed.classpath= 26 | excludes= 27 | file.reference.EugSyntax-src=src 28 | includes=** 29 | jar.compress=false 30 | javac.classpath=\ 31 | ${reference.EugFile.jar} 32 | # Space-separated list of extra javac options 33 | javac.compilerargs= 34 | javac.deprecation=false 35 | javac.processorpath=\ 36 | ${javac.classpath} 37 | javac.source=1.8 38 | javac.target=1.8 39 | javac.test.classpath=\ 40 | ${javac.classpath}:\ 41 | ${build.classes.dir}:\ 42 | ${libs.junit.classpath}:\ 43 | ${libs.junit_4.classpath} 44 | javadoc.additionalparam= 45 | javadoc.author=false 46 | javadoc.encoding=${source.encoding} 47 | javadoc.noindex=false 48 | javadoc.nonavbar=false 49 | javadoc.notree=false 50 | javadoc.private=false 51 | javadoc.splitindex=true 52 | javadoc.use=true 53 | javadoc.version=false 54 | javadoc.windowtitle= 55 | main.class= 56 | manifest.file=manifest.mf 57 | meta.inf.dir=${src.dir}/META-INF 58 | mkdist.disabled=false 59 | platform.active=default_platform 60 | reference.EugFile.jar=${project.EugFile}/dist/EugFile.jar 61 | run.classpath=\ 62 | ${javac.classpath}:\ 63 | ${build.classes.dir} 64 | # Space-separated list of JVM arguments used when running the project 65 | # (you may also define separate properties like run-sys-prop.name=value instead of -Dname=value 66 | # or test-sys-prop.name=value to set system properties for unit tests): 67 | run.jvmargs= 68 | run.test.classpath=\ 69 | ${javac.test.classpath}:\ 70 | ${build.test.classes.dir} 71 | source.encoding=UTF-8 72 | src.dir=${file.reference.EugSyntax-src} 73 | -------------------------------------------------------------------------------- /EugFile_specific/src/eug/specific/ck/Character.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Character.java 3 | * 4 | * Created on July 13, 2006, 2:01 PM 5 | */ 6 | 7 | package eug.specific.ck; 8 | 9 | import eug.shared.GenericObject; 10 | import eug.shared.ObjectVariable; 11 | import java.util.ArrayList; 12 | import java.util.List; 13 | 14 | /** 15 | * 16 | * @author Michael Myers 17 | */ 18 | public class Character extends CKSpecificObject { 19 | 20 | /** Creates a new instance of Character */ 21 | public Character(GenericObject go, CKScenario s) { 22 | super(go, s); 23 | } 24 | 25 | public String getName() { 26 | return go.getString("name"); 27 | } 28 | 29 | public String getTag() { 30 | return go.getString("tag"); 31 | } 32 | 33 | public String getReligion() { 34 | return go.getString("religion"); 35 | } 36 | 37 | public String getCulture() { 38 | return go.getString("culture"); 39 | } 40 | 41 | public double getAttribute(String attr) { 42 | return go.getChild("attributes").getDouble(attr); 43 | } 44 | 45 | 46 | public double getMartial() { 47 | return getAttribute("martial"); 48 | } 49 | 50 | public double getDiplomacy() { 51 | return getAttribute("diplomacy"); 52 | } 53 | 54 | public double getIntrigue() { 55 | return getAttribute("intrigue"); 56 | } 57 | 58 | public double getStewardship() { 59 | return getAttribute("stewardship"); 60 | } 61 | 62 | public double getHealth() { 63 | return getAttribute("health"); 64 | } 65 | 66 | public double getFertility() { 67 | return getAttribute("fertility"); 68 | } 69 | 70 | public List getTraits() { 71 | final GenericObject traits = go.getChild("traits"); 72 | final List ret = new ArrayList(traits.size()); 73 | 74 | for (ObjectVariable var : traits.values) 75 | ret.add(var.varname); 76 | 77 | return ret; 78 | } 79 | 80 | public boolean hasTrait(String trait) { 81 | return go.getChild("traits").contains(trait); 82 | } 83 | 84 | /** 85 | * Note: This method does not check whether a contradictory trait 86 | * is already present. 87 | */ 88 | public void addTrait(String type) { 89 | go.getChild("traits").setString(type, "yes", false); 90 | } 91 | 92 | public boolean isDead() { 93 | return go.contains("deathdate"); 94 | } 95 | } 96 | -------------------------------------------------------------------------------- /Rome_Scenario_Editor/src/editor/mapmode/FortMapMode.java: -------------------------------------------------------------------------------- 1 | /* 2 | * FortMapMode.java 3 | * 4 | * Created on June 15, 2007, 6:02 PM 5 | */ 6 | 7 | package editor.mapmode; 8 | 9 | import editor.MapPanel; 10 | import editor.MapPanelDataModel; 11 | import editor.ProvinceData.Province; 12 | import eug.shared.GenericObject; 13 | import java.awt.Graphics2D; 14 | import java.util.List; 15 | 16 | /** 17 | * MapMode that highlights provinces lighter or darker depending on 18 | * fort level. 19 | * @author Michael Myers 20 | */ 21 | public final class FortMapMode extends DiscreteScalingMapMode { 22 | 23 | private GenericObject[] forts; 24 | private int[] fortLevels; 25 | 26 | /** Creates a new instance of FortMapMode */ 27 | public FortMapMode(final List forts) { 28 | super("", 0, 1, 1); 29 | initialize(forts); 30 | setMax(getMaxFortLevel(forts) + 1); 31 | } 32 | 33 | public FortMapMode(final MapPanel panel, final List forts) { 34 | super(panel, "", 0, 1, 1); 35 | initialize(forts); 36 | setMax(getMaxFortLevel(forts) + 1); 37 | } 38 | 39 | private void initialize(final List forts) { 40 | this.forts = forts.toArray(new GenericObject[forts.size()]); 41 | fortLevels = new int[this.forts.length]; 42 | for (int i = 0; i < this.forts.length; i++) { 43 | fortLevels[i] = this.forts[i].getInt("fort_level"); 44 | } 45 | } 46 | 47 | protected void paintProvince(final Graphics2D g, int provId) { 48 | mapPanel.paintProvince(g, provId, colors[getFortLevel(provId)]); 49 | } 50 | 51 | private int getFortLevel(final int provId) { 52 | int level = 0; 53 | final MapPanelDataModel model = mapPanel.getModel(); 54 | for (int i = 0; i < forts.length; i++) { 55 | if ("yes".equalsIgnoreCase(model.getHistString(provId, forts[i].name))) { 56 | level += fortLevels[i]; 57 | } 58 | } 59 | return level; 60 | } 61 | 62 | private static int getMaxFortLevel(final List forts) { 63 | int level = 0; 64 | for (GenericObject fort : forts) { 65 | level += fort.getInt("fort_level"); 66 | } 67 | return level; 68 | } 69 | 70 | public String getTooltipExtraText(final Province current) { 71 | final int id = current.getId(); 72 | if (id == 0 || id >= SEA_STARTS) 73 | return ""; 74 | 75 | return "Fort level: " + getFortLevel(id); 76 | } 77 | 78 | } 79 | -------------------------------------------------------------------------------- /Rome_Scenario_Editor/src/editor/mapmode/PopSplitMapMode.java: -------------------------------------------------------------------------------- 1 | /* 2 | * PopSplitMapMode.java 3 | * 4 | * Created on Apr 5, 2008, 12:09:11 PM 5 | */ 6 | 7 | package editor.mapmode; 8 | 9 | import editor.MapPanel; 10 | import editor.ProvinceData.Province; 11 | import java.awt.Color; 12 | import java.awt.Graphics2D; 13 | import java.util.regex.Pattern; 14 | 15 | /** 16 | * 17 | * @author Michael 18 | */ 19 | public class PopSplitMapMode extends ProvincePaintingMode { 20 | 21 | private static final Pattern DOT = Pattern.compile("\\."); 22 | private static final double MAX_PERCENT = 60.0; 23 | private static final double MIN_PERCENT = 0.0; 24 | private static final double MAX_COLOR = 255.0; 25 | private static final double ratio = MAX_COLOR / MAX_PERCENT; 26 | 27 | public PopSplitMapMode() { 28 | super(); 29 | } 30 | 31 | public PopSplitMapMode(MapPanel panel) { 32 | super(panel); 33 | } 34 | 35 | @Override 36 | protected void paintProvince(final Graphics2D g2d, final int provId) { 37 | final String[] split = 38 | DOT.split(mapPanel.getModel().getHistString(provId, "split")); 39 | 40 | int r,g,b; 41 | int citizens = Integer.parseInt(split[0]); 42 | int freemen = Integer.parseInt(split[1]); 43 | int slaves = Integer.parseInt(split[2]); 44 | r = (int) Math.min((citizens - MIN_PERCENT) * ratio, MAX_COLOR); 45 | g = (int) Math.min((freemen - MIN_PERCENT) * ratio, MAX_COLOR); 46 | b = (int) Math.min((slaves - MIN_PERCENT) * ratio, MAX_COLOR); 47 | 48 | try { 49 | mapPanel.paintProvince(g2d, provId, new Color(r,g,b)); 50 | } catch (IllegalArgumentException ex) { 51 | System.out.println("r = " + r + ", g = " + g + ", b = " + b); 52 | } 53 | } 54 | 55 | @Override 56 | protected final void paintSeaZone(Graphics2D g, int id) { 57 | // do nothing 58 | } 59 | 60 | @Override 61 | public String getTooltipExtraText(final Province current) { 62 | final int id = current.getId(); 63 | if (id == 0 || id > SEA_STARTS) 64 | return ""; 65 | 66 | final StringBuilder ret = new StringBuilder(); 67 | final String[] split = 68 | DOT.split(mapPanel.getModel().getHistString(id, "split")); 69 | ret.append("Citizens: ").append(split[0]).append("%
"); 70 | ret.append("Freedmen: ").append(split[1]).append("%
"); 71 | ret.append("Slaves: ").append(split[2]).append("%"); 72 | return ret.toString(); 73 | } 74 | 75 | } 76 | -------------------------------------------------------------------------------- /EU3_Scenario_Editor/src/editor/mapmode/PopSplitMapMode.java: -------------------------------------------------------------------------------- 1 | /* 2 | * PopSplitMapMode.java 3 | * 4 | * Created on Apr 5, 2008, 12:09:11 PM 5 | */ 6 | 7 | package editor.mapmode; 8 | 9 | import editor.MapPanel; 10 | import editor.ProvinceData.Province; 11 | import java.awt.Color; 12 | import java.awt.Graphics2D; 13 | import java.util.regex.Pattern; 14 | 15 | /** 16 | * 17 | * @author Michael 18 | */ 19 | public class PopSplitMapMode extends ProvincePaintingMode { 20 | 21 | private static final Pattern DOT = Pattern.compile("\\."); 22 | private static final double MAX_PERCENT = 60.0; 23 | private static final double MIN_PERCENT = 0.0; 24 | private static final double MAX_COLOR = 255.0; 25 | private static final double ratio = MAX_COLOR / MAX_PERCENT; 26 | 27 | public PopSplitMapMode() { 28 | } 29 | 30 | public PopSplitMapMode(MapPanel panel) { 31 | super(panel); 32 | } 33 | 34 | @Override 35 | protected void paintProvince(final Graphics2D g2d, final int provId) { 36 | final String[] split = 37 | DOT.split(mapPanel.getModel().getHistString(provId, "split")); 38 | 39 | int r,g,b; 40 | int citizens = Integer.parseInt(split[0]); 41 | int freemen = Integer.parseInt(split[1]); 42 | int slaves = Integer.parseInt(split[2]); 43 | r = (int) Math.min((citizens - MIN_PERCENT) * ratio, MAX_COLOR); 44 | g = (int) Math.min((freemen - MIN_PERCENT) * ratio, MAX_COLOR); 45 | b = (int) Math.min((slaves - MIN_PERCENT) * ratio, MAX_COLOR); 46 | 47 | try { 48 | mapPanel.paintProvince(g2d, provId, new Color(r,g,b)); 49 | } catch (IllegalArgumentException ex) { 50 | java.util.logging.Logger.getLogger(getClass().getName()).log(java.util.logging.Level.WARNING, "Color error", ex); 51 | } 52 | } 53 | 54 | @Override 55 | protected final void paintSeaZone(Graphics2D g, int id) { 56 | // do nothing 57 | } 58 | 59 | @Override 60 | public String getTooltipExtraText(final Province current) { 61 | final int id = current.getId(); 62 | if (!getMap().isLand(id)) 63 | return ""; 64 | 65 | final StringBuilder ret = new StringBuilder(); 66 | final String[] split = 67 | DOT.split(mapPanel.getModel().getHistString(id, "split")); 68 | ret.append("Citizens: ").append(split[0]).append("%
"); 69 | ret.append("Freedmen: ").append(split[1]).append("%
"); 70 | ret.append("Slaves: ").append(split[2]).append("%"); 71 | return ret.toString(); 72 | } 73 | 74 | } 75 | -------------------------------------------------------------------------------- /EU3_Scenario_Editor/src/editor/mapmode/SimpleTerrainMode.java: -------------------------------------------------------------------------------- 1 | 2 | package editor.mapmode; 3 | 4 | import editor.MapPanel; 5 | import editor.ProvinceData; 6 | import editor.Text; 7 | import java.awt.Graphics2D; 8 | import java.util.HashMap; 9 | import java.util.Map; 10 | 11 | /** 12 | * 13 | * @author Michael 14 | */ 15 | public class SimpleTerrainMode extends ProvincePaintingMode { 16 | 17 | private static final java.util.logging.Logger log = java.util.logging.Logger.getLogger(SimpleTerrainMode.class.getName()); 18 | private final Map provTerrains; 19 | private Map terrains; 20 | 21 | public SimpleTerrainMode(MapPanel panel) { 22 | super(panel); 23 | 24 | terrains = panel.getMap().getTerrainOverrides(); 25 | if (terrains == null) 26 | terrains = panel.getMap().getTerrainOverridesCK3(); 27 | 28 | provTerrains = new HashMap<>(); 29 | for (editor.Map.Terrain terr : terrains.values()) { 30 | for (String strId : terr.getOverrides()) { 31 | int id = Integer.parseInt(strId); 32 | if (provTerrains.get(id) != null) 33 | log.log(java.util.logging.Level.WARNING, "Province {0} is defined in multiple terrain_override lists", strId); 34 | provTerrains.put(id, terr.getName()); 35 | } 36 | } 37 | } 38 | 39 | @Override 40 | protected void paintProvince(Graphics2D g, int provId) { 41 | String sTerr = provTerrains.getOrDefault(provId, null); 42 | if (sTerr != null) { 43 | editor.Map.Terrain terr = terrains.getOrDefault(sTerr, null); 44 | if (terr != null) 45 | mapPanel.paintProvince(g, provId, terr.getColor()); 46 | else 47 | mapPanel.paintProvince(g, provId, Utilities.COLOR_LAND_DEFAULT); 48 | } else { 49 | mapPanel.paintProvince(g, provId, Utilities.COLOR_LAND_DEFAULT); 50 | } 51 | } 52 | 53 | @Override 54 | protected void paintSeaZone(Graphics2D g, int id) { 55 | String terr = provTerrains.getOrDefault(id, null); 56 | if (terr != null) { 57 | mapPanel.paintProvince(g, id, terrains.get(terr).getColor()); 58 | } 59 | } 60 | 61 | @Override 62 | public String getTooltipExtraText(ProvinceData.Province current) { 63 | String terr = provTerrains.get(current.getId()); 64 | if (terr != null) { 65 | return Text.getText(terr); 66 | } 67 | return ""; 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /EU3_Scenario_Editor/nbproject/project.properties: -------------------------------------------------------------------------------- 1 | annotation.processing.enabled=true 2 | annotation.processing.enabled.in.editor=false 3 | annotation.processing.processors.list= 4 | annotation.processing.run.all.processors=true 5 | application.args= 6 | application.title=EU3_Scenario_Editor 7 | application.vendor=Michael 8 | build.classes.dir=${build.dir}/classes 9 | build.classes.excludes=**/*.java,**/*.form,**/*.bmp 10 | # This directory is removed when the project is cleaned: 11 | build.dir=build 12 | build.generated.dir=${build.dir}/generated 13 | build.generated.sources.dir=${build.dir}/generated-sources 14 | # Only compile against the classpath explicitly listed here: 15 | build.sysclasspath=ignore 16 | build.test.classes.dir=${build.dir}/test/classes 17 | build.test.results.dir=${build.dir}/test/results 18 | debug.classpath=\ 19 | ${run.classpath} 20 | debug.test.classpath=\ 21 | ${run.test.classpath} 22 | # This directory is removed when the project is cleaned: 23 | dist.dir=dist 24 | dist.jar=${dist.dir}/EU3_Scenario_Editor.jar 25 | dist.javadoc.dir=${dist.dir}/javadoc 26 | endorsed.classpath= 27 | excludes= 28 | file.reference.EugFile.jar=media/shared/Java/eugFile 29 | includes=** 30 | jar.compress=false 31 | javac.classpath=\ 32 | ${reference.EugFile_specific.jar}:\ 33 | ${reference.EugSyntax.jar}:\ 34 | ${reference.EugFile.jar} 35 | # Space-separated list of extra javac options 36 | javac.compilerargs= 37 | javac.deprecation=true 38 | javac.processorpath=\ 39 | ${javac.classpath} 40 | javac.source=1.8 41 | javac.target=1.8 42 | javac.test.classpath=\ 43 | ${javac.classpath}:\ 44 | ${build.classes.dir}:\ 45 | ${libs.junit.classpath} 46 | javadoc.additionalparam= 47 | javadoc.author=false 48 | javadoc.encoding= 49 | javadoc.noindex=false 50 | javadoc.nonavbar=false 51 | javadoc.notree=false 52 | javadoc.private=false 53 | javadoc.splitindex=true 54 | javadoc.use=true 55 | javadoc.version=false 56 | javadoc.windowtitle= 57 | main.class=editor.Main 58 | manifest.file=manifest.mf 59 | meta.inf.dir=${src.dir}/META-INF 60 | mkdist.disabled=false 61 | no.dependencies=true 62 | platform.active=default_platform 63 | project.EugFile=../eugFile 64 | project.EugFile_specific=../EugFile_specific 65 | project.EugSyntax=../EugSyntax 66 | reference.EugFile.jar=${project.EugFile}/dist/EugFile.jar 67 | reference.EugFile_specific.jar=${project.EugFile_specific}/dist/EugFile_specific.jar 68 | reference.EugSyntax.jar=${project.EugSyntax}/dist/EugSyntax.jar 69 | run.classpath=\ 70 | ${javac.classpath}:\ 71 | ${build.classes.dir} 72 | run.test.classpath=\ 73 | ${javac.test.classpath}:\ 74 | ${build.test.classes.dir} 75 | src.dir=src 76 | test.src.dir=test 77 | -------------------------------------------------------------------------------- /EU3_Scenario_Editor/src/editor/mapmode/HotspotMode.java: -------------------------------------------------------------------------------- 1 | 2 | package editor.mapmode; 3 | 4 | import editor.MapPanel; 5 | import editor.ProvinceData; 6 | import eug.shared.GenericObject; 7 | import java.awt.Color; 8 | import java.awt.Graphics2D; 9 | import java.util.List; 10 | 11 | /** 12 | * Mode for saves mostly which shows which provinces have changed hands the most. 13 | * @author Michael 14 | */ 15 | public class HotspotMode extends DiscreteScalingMapMode { 16 | 17 | public HotspotMode(MapPanel panel, String property, int max, int step) { 18 | super(panel, property, 0, max, step); 19 | setMinColor(Color.GREEN.darker()); 20 | setMaxColor(Color.RED.darker()); 21 | } 22 | 23 | @Override 24 | protected void paintProvince(Graphics2D g, int provId) { 25 | List strings = mapPanel.getModel().getHistStrings(provId, prop); // not very efficient - could precalculate some of this maybe 26 | int count; 27 | 28 | if (strings != null && !strings.isEmpty()) { 29 | count = strings.size(); 30 | } else { 31 | List objects = mapPanel.getModel().getHistObjects(provId, prop); 32 | if (objects != null) { 33 | count = objects.size(); 34 | } else { 35 | mapPanel.paintProvince(g, provId, Utilities.COLOR_LAND_DEFAULT); 36 | return; 37 | } 38 | } 39 | 40 | int index = (int) ((count + 0.0) / getStep()); 41 | index = Math.max(0, Math.min(colors.length-1, index)); 42 | 43 | mapPanel.paintProvince(g, provId, colors[index]); 44 | } 45 | 46 | @Override 47 | protected void paintSeaZone(Graphics2D g, int id) { 48 | } 49 | 50 | @Override 51 | public String getTooltipExtraText(ProvinceData.Province current) { 52 | final int id = current.getId(); 53 | if (!getMap().isLand(id)) 54 | return ""; 55 | 56 | List strings = mapPanel.getModel().getHistStrings(id, prop); 57 | int count = -1; 58 | 59 | if (strings != null && !strings.isEmpty()) { 60 | count = strings.size(); 61 | } else { 62 | List objects = mapPanel.getModel().getHistObjects(id, prop); 63 | if (objects != null) { 64 | count = objects.size(); 65 | } 66 | } 67 | return "\"" + prop + "\" changes: " + count; 68 | } 69 | 70 | @Override 71 | public String getName() { 72 | return "hotspot"; 73 | } 74 | } 75 | -------------------------------------------------------------------------------- /EugSyntax/src/eug/syntax/EUGEditorKit.java: -------------------------------------------------------------------------------- 1 | /* 2 | * EUGEditorKit.java 3 | * 4 | * Created on June 26, 2007, 11:56 AM 5 | */ 6 | 7 | package eug.syntax; 8 | 9 | import javax.swing.text.DefaultEditorKit; 10 | import javax.swing.text.Document; 11 | import javax.swing.text.ViewFactory; 12 | 13 | /** 14 | * The only class that is absolutely necessary to have syntax highlighting. To 15 | * use it in the default form, call 16 | * myJEditorPane.setEditorKit(new EUGEditorKit());. Further 17 | * customization is possible by using something like the following: 18 | *
19 |  * EUGContext myContext = new EUGContext();
20 |  * DefaultEUGStyleSet myStyleSet = myContext.getStyles();
21 |  * // ... customize style set ...
22 |  * EUGEditorKit myEditorKit = new EUGEditorKit();
23 |  * myEditorKit.setStylePreferences(myContext);
24 |  * myJEditorPane.setEditorKit(myEditorKit);
25 |  * 
26 | * @see EUGContext 27 | * @see DefaultEUGStyleSet 28 | * @author Michael Myers 29 | */ 30 | public class EUGEditorKit extends DefaultEditorKit { 31 | 32 | private static final long serialVersionUID = 1L; 33 | 34 | private EUGContext preferences; 35 | 36 | /** Creates a new instance of EUGEditorKit */ 37 | public EUGEditorKit() { 38 | super(); 39 | } 40 | 41 | public EUGContext getStylePreferences() { 42 | if (preferences == null) { 43 | preferences = new EUGContext(); 44 | } 45 | return preferences; 46 | } 47 | 48 | public void setStylePreferences(EUGContext prefs) { 49 | preferences = prefs; 50 | } 51 | 52 | /** 53 | * Creates an uninitialized text storage model 54 | * that is appropriate for this type of editor. 55 | * @return the model 56 | */ 57 | @Override 58 | public Document createDefaultDocument() { 59 | return new EUGDocument(); 60 | } 61 | 62 | /** 63 | * Fetches a factory that is suitable for producing 64 | * views of any models that are produced by this 65 | * kit. 66 | * @return the view factory 67 | */ 68 | @Override 69 | public ViewFactory getViewFactory() { 70 | return getStylePreferences(); 71 | } 72 | 73 | /** 74 | * Gets the MIME type of the data that this 75 | * kit represents support for. 76 | * @return the string "text/eug" 77 | */ 78 | @Override 79 | public String getContentType() { 80 | return "text/eug"; 81 | } 82 | 83 | @Override 84 | public Object clone() { 85 | final EUGEditorKit kit = (EUGEditorKit) super.clone(); 86 | kit.preferences = preferences; 87 | return kit; 88 | } 89 | 90 | } 91 | -------------------------------------------------------------------------------- /EU3_Scenario_Editor/src/editor/mapmode/CustomCountryMode.java: -------------------------------------------------------------------------------- 1 | /* 2 | * CustomCountryMode.java 3 | * 4 | * Created on July 30, 2007, 11:19 AM 5 | */ 6 | 7 | package editor.mapmode; 8 | 9 | import editor.MapPanel; 10 | import editor.ProvinceData.Province; 11 | import editor.Text; 12 | import java.awt.Color; 13 | 14 | /** 15 | * A MapMode that paints countries based on a property defined in 16 | * the constructor. 17 | * @author Michael Myers 18 | * @since 0.5pre3 19 | */ 20 | public class CustomCountryMode extends CountryMode { 21 | 22 | protected static final Color COLOR_ERROR = Color.RED; 23 | protected Color foundColor = Color.GREEN; 24 | protected Color notFoundColor = new Color(100, 100, 100); // darker than GRAY, lighter than DARK_GRAY 25 | 26 | protected String name; 27 | protected String value; 28 | 29 | /** Creates a new instance of CustomCountryMode */ 30 | public CustomCountryMode(String name, String value) { 31 | this.name = name; 32 | this.value = value.toLowerCase(); 33 | } 34 | 35 | public CustomCountryMode(MapPanel panel, String name, String value) { 36 | super(panel); 37 | this.name = name; 38 | this.value = value.toLowerCase(); 39 | } 40 | 41 | 42 | @Override 43 | protected Color getCtryColor(String country) { 44 | country = country.toUpperCase(); 45 | 46 | // Special case: XXX means no one 47 | if (Utilities.isNotACountry(country)) 48 | return notFoundColor; 49 | 50 | if (value.equals(mapPanel.getModel().getHistString(country, name).toLowerCase())) 51 | return foundColor; 52 | else 53 | return notFoundColor; 54 | } 55 | 56 | @Override 57 | public String getTooltipExtraText(final Province current) { 58 | final int id = current.getId(); 59 | if (!getMap().isLand(id)) 60 | return ""; 61 | 62 | final String tag = mapPanel.getModel().getOwner(id); 63 | if (tag == null || tag.length() == 0) 64 | return ""; 65 | final String owner = Text.getText(tag); 66 | final StringBuilder ret = new StringBuilder("Owned by: ").append(owner).append("
"); 67 | ret.append(Text.getText(name)).append(": ").append(Text.getText(mapPanel.getModel().getHistString(tag, name))); 68 | return ret.toString(); 69 | } 70 | 71 | @Override 72 | public String toString() { 73 | return "Countries with " + name + " = " + value; 74 | } 75 | 76 | public String getName() { 77 | return name; 78 | } 79 | 80 | public String getValue() { 81 | return value; 82 | } 83 | } 84 | -------------------------------------------------------------------------------- /Rome_Scenario_Editor/src/editor/mapmode/CustomCountryMode.java: -------------------------------------------------------------------------------- 1 | /* 2 | * CustomCountryMode.java 3 | * 4 | * Created on July 30, 2007, 11:19 AM 5 | */ 6 | 7 | package editor.mapmode; 8 | 9 | import editor.MapPanel; 10 | import editor.ProvinceData.Province; 11 | import editor.Text; 12 | import java.awt.Color; 13 | 14 | /** 15 | * A MapMode that paints countries based on a property defined in 16 | * either the constructor or in {@link #setName}. 17 | * @author Michael Myers 18 | * @since 0.5pre3 19 | */ 20 | public class CustomCountryMode extends CountryMode { 21 | 22 | protected static final Color COLOR_ERROR = Color.RED; 23 | protected Color foundColor = Color.GREEN; 24 | protected Color notFoundColor = new Color(100, 100, 100); // darker than GRAY, lighter than DARK_GRAY 25 | 26 | protected String name; 27 | protected String value; 28 | 29 | /** Creates a new instance of CustomCountryMode */ 30 | public CustomCountryMode(String name, String value) { 31 | super(); 32 | this.name = name; 33 | this.value = value.toLowerCase(); 34 | } 35 | 36 | public CustomCountryMode(MapPanel panel, String name, String value) { 37 | super(panel); 38 | this.name = name; 39 | this.value = value.toLowerCase(); 40 | } 41 | 42 | 43 | @Override 44 | protected Color getCtryColor(String country) { 45 | country = country.toUpperCase(); 46 | 47 | // Special case: XXX means no one 48 | if (Utilities.isNotACountry(country)) 49 | return notFoundColor; 50 | // country = "BAR"; 51 | 52 | if (value.equals(mapPanel.getModel().getHistString(country, name))) 53 | return foundColor; 54 | else 55 | return notFoundColor; 56 | } 57 | 58 | @Override 59 | public String getTooltipExtraText(final Province current) { 60 | final int id = current.getId(); 61 | if (id == 0 || id >= SEA_STARTS) 62 | return ""; 63 | 64 | final String tag = mapPanel.getModel().getHistString(id, "owner"); 65 | if (Utilities.isNotACountry(tag)) 66 | return ""; 67 | final String owner = Text.getText(tag); 68 | final StringBuilder ret = new StringBuilder("Owned by: ").append(owner).append("
"); 69 | ret.append(Text.getText(name)).append(": ").append(Text.getText(mapPanel.getModel().getHistString(tag, name))); 70 | return ret.toString(); 71 | } 72 | 73 | @Override 74 | public String toString() { 75 | return "Countries with " + name + " = " + value; 76 | } 77 | 78 | public String getName() { 79 | return name; 80 | } 81 | 82 | public String getValue() { 83 | return value; 84 | } 85 | } 86 | -------------------------------------------------------------------------------- /EugFile_specific/src/eug/specific/ck2/CK2DataSource.java: -------------------------------------------------------------------------------- 1 | package eug.specific.ck2; 2 | 3 | import eug.shared.GenericObject; 4 | import eug.specific.clausewitz.ClausewitzDataSource; 5 | 6 | /** 7 | * 8 | * @author Michael 9 | */ 10 | public interface CK2DataSource extends ClausewitzDataSource { 11 | 12 | /** 13 | * Returns the title data for the landed title with the given name. 14 | *

15 | * In some implementations, this may be equivalent to 16 | * {@link #getTitleHistory}. 17 | * @param title the title to fetch data for. 18 | * @return the title data. 19 | */ 20 | public GenericObject getTitle(String title); 21 | 22 | /** 23 | * Returns the title history for the landed title with the given name. 24 | *

25 | * In some implementations, this may be equivalent to 26 | * {@link #getTitle}. 27 | * @param title the title to fetch data for. 28 | * @return the title history. 29 | */ 30 | public GenericObject getTitleHistory(String title); 31 | 32 | /** 33 | * Returns the title data for the landed title with the given name. 34 | *

35 | * This may or may not be equivalent to calling 36 | * getTitle(tag).toString(). 37 | * @param title the title to fetch data for. 38 | * @return the title data in the form of a string. 39 | */ 40 | public String getTitleAsStr(String title); 41 | 42 | /** 43 | * Returns the title history for the landed title with the given name. 44 | *

45 | * This may or may not be equivalent to calling 46 | * getTitleHistory(title).toString(). 47 | * @param title the title to fetch data for. 48 | * @return the title data in the form of a string. 49 | */ 50 | public String getTitleHistoryAsStr(String title); 51 | 52 | 53 | /** 54 | * Forces a reload of the data for the title with the given name, if the 55 | * implementation uses a cache. 56 | * @param title the title to reload data for. 57 | */ 58 | public void reloadTitle(String title); 59 | 60 | /** 61 | * Forces a reload of the history for the the given title, if the 62 | * implementation uses a cache. 63 | * @param title the title to reload data for. 64 | */ 65 | public void reloadTitleHistory(String title); 66 | 67 | /** 68 | * Forces a reload of all title data if the implementation uses a cache. 69 | */ 70 | public void reloadTitles(); 71 | 72 | 73 | /** 74 | * Saves the data for the given title. Depending on the implementation, a 75 | * call to {@link #saveChanges()} may still be necessary. 76 | * @param title the name (tag) of the title. 77 | * @param data the title data to save. 78 | */ 79 | public void saveTitle(String title, final String data); 80 | } 81 | -------------------------------------------------------------------------------- /Rome_Scenario_Editor/src/editor/mapmode/CtryReligionMode.java: -------------------------------------------------------------------------------- 1 | /* 2 | * CtryReligionMode.java 3 | * 4 | * Created on July 30, 2007, 12:19 PM 5 | */ 6 | 7 | package editor.mapmode; 8 | 9 | import editor.MapPanel; 10 | import editor.ProvinceData.Province; 11 | import editor.Text; 12 | import java.awt.Color; 13 | 14 | /** 15 | * 16 | * @author Michael Myers 17 | * @since 0.5pre3 18 | */ 19 | public class CtryReligionMode extends CountryMode { 20 | 21 | // Mostly the same as ProvReligionMode, but paints countries instead. 22 | 23 | /** Creates a new instance of CtryReligionMode */ 24 | public CtryReligionMode() { 25 | super(); 26 | } 27 | 28 | public CtryReligionMode(MapPanel panel) { 29 | super(panel); 30 | } 31 | 32 | protected Color getCtryColor(String country) { 33 | if (Utilities.isNotACountry(country)) 34 | country = "BAR"; 35 | else 36 | country = country.toUpperCase(); 37 | 38 | final String religion = mapPanel.getModel().getHistString(country, "religion"); 39 | 40 | if (religion == null) { 41 | return Utilities.COLOR_NO_HIST; 42 | } else if (religion.length() == 0 || religion.equals("none")) { 43 | return Utilities.COLOR_NO_RELIGION; 44 | } else { 45 | return Utilities.getReligionColor(religion); 46 | } 47 | } 48 | 49 | 50 | public String getTooltipExtraText(final Province current) { 51 | final int id = current.getId(); 52 | if (id == 0 || id >= SEA_STARTS) 53 | return ""; 54 | 55 | final String rel = Text.getText(mapPanel.getModel().getHistString(id, "religion")); 56 | if (rel.length() == 0) 57 | return ""; 58 | 59 | String owner = mapPanel.getModel().getHistString(id, "owner"); 60 | String ctryRel = null; 61 | 62 | if (owner != null) { 63 | owner = owner.toUpperCase(); 64 | if (Utilities.isNotACountry(owner) /*noCountryPattern.matcher(owner).matches()*/) { 65 | // don't add anything 66 | owner = "-"; 67 | } else { 68 | ctryRel = Text.getText(mapPanel.getModel().getHistString(owner, "religion")); 69 | } 70 | } else { 71 | owner = "-"; 72 | } 73 | 74 | final StringBuilder text = new StringBuilder("Owner: "); 75 | if (!owner.equals("-")) 76 | text.append(Text.getText(owner)).append(" ").append("(").append(owner).append(")
"); 77 | text.append("Religion: ").append(rel); 78 | 79 | if (ctryRel != null) 80 | text.append("
Owner's religion: ").append(ctryRel); 81 | 82 | return text.toString(); 83 | } 84 | 85 | } 86 | -------------------------------------------------------------------------------- /Rome_Scenario_Editor/src/editor/TestEditorDialog.java: -------------------------------------------------------------------------------- 1 | /* 2 | * TestEditorDialog.java 3 | * 4 | * Created on June 29, 2007, 8:35 PM 5 | */ 6 | 7 | package editor; 8 | 9 | import eug.specific.eu3.EU3DataSource; 10 | import java.util.HashMap; 11 | 12 | /** 13 | * 14 | * @author Michael Myers 15 | */ 16 | public class TestEditorDialog extends EditorDialog { 17 | 18 | private int id; 19 | 20 | /** Creates a new instance of TestEditorDialog */ 21 | public TestEditorDialog(int id) { 22 | super(null, "Test"); 23 | this.id = id; 24 | register(this); 25 | } 26 | 27 | public TestEditorDialog(String countryTag, String countryName) { 28 | super(null, countryName); 29 | this.id = countryTag.hashCode(); 30 | // this.tag = countryTag; 31 | // this.name = countryName; 32 | readFile(countryTag, countryName); 33 | register(this); // Register last in case exceptions occur 34 | } 35 | 36 | private void readFile(String tag, String cname) { 37 | final String data = dataSource.getCountryAsStr(tag); 38 | 39 | if (data == null) { 40 | setOriginalContents("# No previous file for " + cname + "\n"); 41 | } else { 42 | setOriginalContents(data); 43 | } 44 | } 45 | 46 | @Override 47 | protected void close() { 48 | unRegister(this); 49 | super.close(); 50 | } 51 | 52 | private static final java.util.Map showing = 53 | new HashMap(); 54 | 55 | private static void register(TestEditorDialog d) { 56 | showing.put(d.id, d); 57 | } 58 | private static void unRegister(TestEditorDialog d) { 59 | showing.remove(d.id); 60 | } 61 | 62 | private static EU3DataSource dataSource = null; 63 | 64 | public static void setDataSource(EU3DataSource newSource) { 65 | dataSource = newSource; 66 | } 67 | 68 | public static void showDialog(String tag, String name) { 69 | TestEditorDialog d = showing.get(tag.hashCode()); 70 | if (d == null) { 71 | // No previous one, so create new. 72 | try { 73 | TestEditorDialog ted = new TestEditorDialog(tag, name); 74 | ted.setVisible(true); 75 | } catch (RuntimeException ex) { 76 | ex.printStackTrace(); 77 | } 78 | } else { 79 | d.setVisible(true); 80 | } 81 | } 82 | 83 | 84 | public static void main(String[] args) { 85 | setDataSource(new eug.specific.eu3.EU3Scenario(Main.filenameResolver)); 86 | showDialog("ROM", "Rome"); 87 | // showDialog(100, "test = {\n\tstring = \"value\"\n}"); 88 | // showDialog(100, "gobbledygook"); 89 | } 90 | } 91 | -------------------------------------------------------------------------------- /EU3_Scenario_Editor/src/editor/mapmode/IsPlayerMapMode.java: -------------------------------------------------------------------------------- 1 | 2 | package editor.mapmode; 3 | 4 | import editor.MapPanel; 5 | import editor.ProvinceData; 6 | import editor.Text; 7 | import eug.shared.GenericList; 8 | import eug.specific.clausewitz.ClausewitzSaveGame; 9 | import java.awt.Color; 10 | 11 | /** 12 | * 13 | * @author Michael 14 | */ 15 | public class IsPlayerMapMode extends CountryMode { 16 | 17 | private ClausewitzSaveGame saveGame; 18 | protected Color foundColor = Color.GREEN; 19 | protected Color notFoundColor = new Color(100, 100, 100); // darker than GRAY, lighter than DARK_GRAY 20 | 21 | public IsPlayerMapMode(MapPanel panel) { 22 | super(panel); 23 | if (mapPanel.getModel().getDataSource().isSavedGame()) { 24 | saveGame = (ClausewitzSaveGame) mapPanel.getModel().getDataSource(); 25 | } 26 | } 27 | 28 | @Override 29 | protected Color getCtryColor(String country) { 30 | if (saveGame == null) 31 | return super.getCtryColor(country); 32 | 33 | if (Utilities.isNotACountry(country)) 34 | return Utilities.COLOR_LAND_DEFAULT; 35 | else 36 | country = country.toUpperCase(); 37 | 38 | boolean player = saveGame.getCountry(country).getBoolean("was_player"); 39 | 40 | if (player) { 41 | return super.getCtryColor(country); 42 | } else { 43 | return notFoundColor; 44 | } 45 | } 46 | 47 | 48 | @Override 49 | public String getTooltipExtraText(ProvinceData.Province current) { 50 | if (saveGame == null) 51 | return "This map mode can only be used with saved games."; 52 | 53 | final int id = current.getId(); 54 | if (!getMap().isLand(id)) 55 | return ""; 56 | 57 | String owner = mapPanel.getModel().getOwner(id); 58 | 59 | if (owner != null) { 60 | owner = owner.toUpperCase(); 61 | if (!Utilities.isNotACountry(owner)) { 62 | boolean player = saveGame.getCountry(owner).getBoolean("was_player"); 63 | if (player) { 64 | GenericList players = saveGame.root.getList("players_countries"); 65 | for (int i = 0; i < players.size() - 1; i+=2) { 66 | String playerName = players.get(i); 67 | String playerTag = players.get(i+1); 68 | if (playerTag.equals(owner)) { 69 | return Text.getText(owner) + " played by " + playerName; 70 | } 71 | } 72 | return Text.getText(owner) + " (unknown player)"; 73 | } 74 | } 75 | } 76 | 77 | return "Not a player country"; 78 | } 79 | } 80 | -------------------------------------------------------------------------------- /eugFile/src/eug/shared/Comment.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Comment.java 3 | * 4 | * Created on July 11, 2006, 10:21 PM 5 | */ 6 | 7 | package eug.shared; 8 | 9 | import java.lang.reflect.InvocationTargetException; 10 | import java.util.logging.Level; 11 | import java.util.logging.Logger; 12 | import java.util.regex.Pattern; 13 | 14 | /** 15 | * Abstract class that encapsulates a comment. The exact format of the comment is 16 | * left to subclasses, but the {@link #commentChar comment-start character} is not. 17 | * @author Michael Myers 18 | */ 19 | public abstract class Comment implements WritableObject, Cloneable { 20 | 21 | /** 22 | * The character that must start all comments when printed out. 23 | */ 24 | protected static final String commentChar = "#"; 25 | 26 | /** 27 | * The actual comment text. 28 | */ 29 | protected String comment; 30 | 31 | /** 32 | * The pattern used to split comments into lines. 33 | */ 34 | protected static final Pattern newLinePattern = Pattern.compile("(\\n|\\r\\n)"); 35 | 36 | /** 37 | * Creates a new Comment with the given text. 38 | * @param comment the comment text. 39 | */ 40 | public Comment(String comment) { 41 | this.comment = (comment == null ? "" : comment); 42 | } 43 | 44 | /** 45 | * Gets the comment text. 46 | * @return the comment text. 47 | */ 48 | public String getComment() { 49 | return comment; 50 | } 51 | 52 | /** 53 | * Sets the comment text to the given string. 54 | * @param comment the new comment text. 55 | */ 56 | public void setComment(String comment) { 57 | this.comment = comment; 58 | } 59 | 60 | /** 61 | * Appends the given string to the comment text. If the comment was empty, 62 | * it is set to the given string. 63 | *

64 | * Note that different subclasses of Comment may print 65 | * multiline comments in different ways. 66 | * @param toAdd a String to append to the comment. 67 | * @since EUGFile 1.01.03 68 | */ 69 | public void appendComment(String toAdd) { 70 | if (toAdd.length() == 0) 71 | return; 72 | 73 | if (comment.length() == 0) 74 | comment = toAdd; 75 | else 76 | comment += "\n" + toAdd; 77 | } 78 | 79 | @Override 80 | public boolean equals(Object obj) { 81 | if (obj == null) 82 | return false; 83 | 84 | return getClass() == obj.getClass() && // check for subclasses 85 | comment.equals(((Comment)obj).comment); 86 | } 87 | 88 | @Override 89 | public int hashCode() { 90 | int hash = 7; 91 | hash = 79 * hash + (this.comment != null ? this.comment.hashCode() : 0); 92 | return hash; 93 | } 94 | } 95 | -------------------------------------------------------------------------------- /Rome_Scenario_Editor/src/editor/Text.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Text.java 3 | * 4 | * Created on May 31, 2007, 12:47 PM 5 | */ 6 | 7 | package editor; 8 | 9 | import java.io.File; 10 | import java.io.FileNotFoundException; 11 | import java.io.IOException; 12 | import java.util.HashMap; 13 | import java.util.regex.Pattern; 14 | 15 | /** 16 | * 17 | * @author Michael Myers 18 | * @since 0.4pre1 19 | */ 20 | public final class Text { 21 | 22 | // All keys are converted to lower case before putting or getting text, to 23 | // standardize. 24 | private static final java.util.Map text = 25 | new HashMap(); 26 | 27 | private static final Pattern semicolon = Pattern.compile(";"); 28 | 29 | static { 30 | try { 31 | initText(); 32 | } catch (FileNotFoundException ex) { 33 | ex.printStackTrace(); 34 | } catch (IOException ex) { 35 | ex.printStackTrace(); 36 | } 37 | } 38 | 39 | private static void initText() throws FileNotFoundException, IOException { 40 | java.io.BufferedReader reader; 41 | String line; 42 | String[] splitLine; 43 | for (File f : Main.filenameResolver.listFiles("localisation")) { 44 | if (!f.getName().endsWith(".csv")) 45 | continue; // Could use a FileFilter or FilenameFilter 46 | 47 | if (f.length() <= 0) { 48 | continue; 49 | } 50 | 51 | reader = new java.io.BufferedReader(new java.io.FileReader(f), Math.min(1024000, (int)f.length())); 52 | try { 53 | while ((line = reader.readLine()) != null) { 54 | if (line.startsWith("#")) 55 | continue; 56 | splitLine = semicolon.split(line); //line.split(";"); 57 | if (splitLine.length < 2) { 58 | if (!line.contains(";")) { 59 | // If it contains ";", then it's probably just a line like ;;;;;;;;;;;; 60 | // If not, we need to know what it is. 61 | System.err.println("Malformed line in file " + f.getPath() + ":"); 62 | System.err.println(line); 63 | } 64 | continue; 65 | } 66 | text.put(splitLine[0].toLowerCase(), splitLine[1]); // English 67 | } 68 | } finally { 69 | reader.close(); 70 | } 71 | } 72 | } 73 | 74 | public static String getText(final String key) { 75 | final String ret = text.get(key.toLowerCase()); 76 | return (ret == null ? key : ret); 77 | } 78 | 79 | /** Creates a new instance of Text */ 80 | private Text() { } 81 | 82 | } 83 | -------------------------------------------------------------------------------- /PositionsEditor/nbproject/project.properties: -------------------------------------------------------------------------------- 1 | annotation.processing.enabled=true 2 | annotation.processing.enabled.in.editor=false 3 | annotation.processing.processors.list= 4 | annotation.processing.run.all.processors=true 5 | application.args= 6 | application.title=PositionsEditor 7 | application.vendor=Michael 8 | build.classes.dir=${build.dir}/classes 9 | build.classes.excludes=**/*.java,**/*.form 10 | # This directory is removed when the project is cleaned: 11 | build.dir=build 12 | build.generated.dir=${build.dir}/generated 13 | build.generated.sources.dir=${build.dir}/generated-sources 14 | # Only compile against the classpath explicitly listed here: 15 | build.sysclasspath=ignore 16 | build.test.classes.dir=${build.dir}/test/classes 17 | build.test.results.dir=${build.dir}/test/results 18 | debug.classpath=\ 19 | ${run.classpath} 20 | debug.test.classpath=\ 21 | ${run.test.classpath} 22 | # This directory is removed when the project is cleaned: 23 | dist.dir=dist 24 | dist.jar=${dist.dir}/PositionsEditor.jar 25 | dist.javadoc.dir=${dist.dir}/javadoc 26 | endorsed.classpath= 27 | excludes= 28 | includes=** 29 | jar.compress=false 30 | javac.classpath=\ 31 | ${reference.EugFile.jar}:\ 32 | ${reference.EugSyntax.jar} 33 | # Space-separated list of extra javac options 34 | javac.compilerargs= 35 | javac.deprecation=false 36 | javac.processorpath=\ 37 | ${javac.classpath} 38 | javac.source=1.8 39 | javac.target=1.8 40 | javac.test.classpath=\ 41 | ${javac.classpath}:\ 42 | ${build.classes.dir}:\ 43 | ${libs.junit.classpath} 44 | javadoc.additionalparam= 45 | javadoc.author=false 46 | javadoc.encoding= 47 | javadoc.noindex=false 48 | javadoc.nonavbar=false 49 | javadoc.notree=false 50 | javadoc.private=false 51 | javadoc.splitindex=true 52 | javadoc.use=true 53 | javadoc.version=false 54 | javadoc.windowtitle= 55 | jnlp.codebase.type=local 56 | jnlp.codebase.url=file:/D:/Java/EU3%20Positions%20Editor/dist/ 57 | jnlp.enabled=false 58 | jnlp.offline-allowed=false 59 | jnlp.signed=false 60 | main.class=posed.PositionsEditor 61 | manifest.file=manifest.mf 62 | meta.inf.dir=${src.dir}/META-INF 63 | mkdist.disabled=false 64 | platform.active=default_platform 65 | project.EugFile=../eug/eugFile 66 | project.EugSyntax=../EugSyntax 67 | reference.EugFile.jar=${project.EugFile}/dist/EugFile.jar 68 | reference.EugSyntax.jar=${project.EugSyntax}/dist/EugSyntax.jar 69 | run.classpath=\ 70 | ${javac.classpath}:\ 71 | ${build.classes.dir} 72 | # Space-separated list of JVM arguments used when running the project 73 | # (you may also define separate properties like run-sys-prop.name=value instead of -Dname=value 74 | # or test-sys-prop.name=value to set system properties for unit tests): 75 | run.jvmargs= 76 | run.test.classpath=\ 77 | ${javac.test.classpath}:\ 78 | ${build.test.classes.dir} 79 | src.dir=src 80 | test.src.dir=test 81 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ### Europa Universalis Editor 2 | [![Download Europa Universalis Game Tools](https://a.fsdn.com/con/app/sf-download-button)](https://sourceforge.net/projects/eug/files/latest/download) [![Download Europa Universalis Game Tools](https://img.shields.io/sourceforge/dt/eug.svg)](https://sourceforge.net/projects/eug/files/latest/download) [Chat on Discord!](https://discord.gg/j382dvC3Fw) 3 | 4 | A game editor which has as many mapmodes as the game does itself. Includes a syntax-checking text editor at no extra cost. 5 | 6 | Compatible with: 7 | - Crusader Kings 3 ([see discussion thread on Paradox forums](https://forum.paradoxplaza.com/forum/threads/tool-clausewitz-scenario-editor-now-for-ck3.1689106/)) 8 | - Europa Universalis IV ([EU4 discusson thread](https://forum.paradoxplaza.com/forum/index.php?threads/announcing-a-scenario-editor-and-map-viewer.707474/)) 9 | - Europa Universalis III ([EU3 discussion thread](https://forum.paradoxplaza.com/forum/index.php?threads/clausewitz-save-game-and-scenario-editor-viewer.527308/)) 10 | 11 | Compatible with older versions of: 12 | - Crusader Kings II (CK2) 13 | - Hearts of Iron III (HOI3) 14 | - Victoria II 15 | - Europa Universalis: Rome 16 | 17 | The editor might be compatible with the current versions of all of the above, but I own none except CK2 and Victoria II, which I do not have the expansions for. I welcome test reports for any game. 18 | 19 | ### Screenshots 20 | 21 | ![Demo of multi edit](/multi-edit-demo.gif) 22 | *Editing multiple province history files at the same time.* 23 | 24 | ![Map view](/screenshot.png) 25 | *Europe map in 1444. Click for larger image* 26 | 27 | ![Religions view](/screenshot-religions.png) 28 | *Religious map at the Thirty Years War bookmark. As in game, diagonal stripes indicate the province religion is different from the country religion.* 29 | 30 | ![Editor](/screenshot-editor.png) 31 | *Syntax-highlighting text editor. If a brace is unmatched, the editor will highlight the line to make it easy to find.* 32 | 33 | ![Trade nodes view](/screenshot-tradenodes.png) 34 | *Trade nodes and trade flow* 35 | 36 | ![Map modes](/screenshot-menu.png) 37 | *Menu showing all current mapmodes available when working on EU4. Other games may have different mapmodes available.* 38 | 39 | #### Subprojects 40 | 41 | - **EU3_Scenario_Editor** - This is the main scenario editor project. 42 | - **eugFile** - The library that makes the rest of this possible. It handles parsing and loading Paradox game files. The "eug" refers to EU2 save games, which used a .eug extension. 43 | - **EugFile_specific** - Abstracts engine-specific details, mostly Clausewitz vs. Clausewitz 2 games. Also has some code for old Europa games. 44 | - **EugSyntax** - A plug-and-play syntax highlighting editor kit for a javax.swing.JEditorPane. 45 | - **PositionsEditor** - Editor for sprite positions on the game map. Useful for map modders only. Mostly irrelevant for newer games which include the "nudge" editor. 46 | -------------------------------------------------------------------------------- /EugFile_specific/src/eug/specific/ck3/CK3DataSource.java: -------------------------------------------------------------------------------- 1 | package eug.specific.ck3; 2 | 3 | import eug.specific.ck2.*; 4 | import eug.shared.GenericObject; 5 | import eug.specific.clausewitz.ClausewitzDataSource; 6 | 7 | /** 8 | * 9 | * @author Michael 10 | */ 11 | public interface CK3DataSource extends ClausewitzDataSource { 12 | 13 | /** 14 | * Returns the title data for the landed title with the given name. 15 | *

16 | * In some implementations, this may be equivalent to 17 | * {@link #getTitleHistory}. 18 | * @param title the title to fetch data for. 19 | * @return the title data. 20 | */ 21 | public GenericObject getTitle(String title); 22 | 23 | /** 24 | * Returns the title history for the landed title with the given name. 25 | *

26 | * In some implementations, this may be equivalent to 27 | * {@link #getTitle}. 28 | * @param title the title to fetch data for. 29 | * @return the title history. 30 | */ 31 | public GenericObject getTitleHistory(String title); 32 | 33 | /** 34 | * Returns the title data for the landed title with the given name. 35 | *

36 | * This may or may not be equivalent to calling 37 | * getTitle(tag).toString(). 38 | * @param title the title to fetch data for. 39 | * @return the title data in the form of a string. 40 | */ 41 | public String getTitleAsStr(String title); 42 | 43 | /** 44 | * Returns the title history for the landed title with the given name. 45 | *

46 | * This may or may not be equivalent to calling 47 | * getTitleHistory(title).toString(). 48 | * @param title the title to fetch data for. 49 | * @return the title data in the form of a string. 50 | */ 51 | public String getTitleHistoryAsStr(String title); 52 | 53 | 54 | /** 55 | * Forces a reload of the data for the title with the given name, if the 56 | * implementation uses a cache. 57 | * @param title the title to reload data for. 58 | */ 59 | public void reloadTitle(String title); 60 | 61 | /** 62 | * Forces a reload of the history for the the given title, if the 63 | * implementation uses a cache. 64 | * @param title the title to reload data for. 65 | */ 66 | public void reloadTitleHistory(String title); 67 | 68 | /** 69 | * Forces a reload of all title data if the implementation uses a cache. 70 | */ 71 | public void reloadTitles(); 72 | 73 | /** 74 | * Preloads all available title data into a cache. 75 | */ 76 | public void preloadTitles(); 77 | 78 | 79 | /** 80 | * Saves the data for the given title. Depending on the implementation, a 81 | * call to {@link #saveChanges()} may still be necessary. 82 | * @param title the name (tag) of the title. 83 | * @param data the title data to save. 84 | */ 85 | public void saveTitle(String title, final String data); 86 | } 87 | -------------------------------------------------------------------------------- /Rome_Scenario_Editor/src/editor/mapmode/PoliticalMode.java: -------------------------------------------------------------------------------- 1 | /* 2 | * PoliticalMode.java 3 | * 4 | * Created on August 18, 2007, 9:08 PM 5 | */ 6 | 7 | package editor.mapmode; 8 | 9 | import editor.MapPanel; 10 | import editor.ProvinceData.Province; 11 | import editor.Text; 12 | import java.awt.Graphics2D; 13 | import java.awt.Paint; 14 | 15 | /** 16 | * 17 | * @author Michael Myers 18 | * @since 0.5pre3 19 | */ 20 | public final class PoliticalMode extends ProvincePaintingMode { 21 | 22 | 23 | /** Creates a new instance of PoliticalMode */ 24 | public PoliticalMode() { 25 | super(); 26 | } 27 | 28 | public PoliticalMode(MapPanel panel) { 29 | super(panel); 30 | } 31 | 32 | protected void paintProvince(final Graphics2D g, int provId) { 33 | final String owner = mapPanel.getModel().getHistString(provId, "owner"); 34 | final String controller = (owner == null ? null : mapPanel.getModel().getHistString(provId, "controller")); 35 | 36 | if (owner == null) { 37 | mapPanel.paintProvince(g, provId, Utilities.getCtryColor("BAR")); 38 | } else if (controller == null) { 39 | final Paint p = Utilities.createPaint(Utilities.getCtryColor(owner), Utilities.COLOR_NO_HIST); 40 | if (p != null) 41 | mapPanel.paintProvince(g, provId, p); 42 | else 43 | System.err.println("Unknown problem in PoliticalMode.java"); 44 | } else if (!owner.equals(controller)) { 45 | final Paint p = Utilities.createPaint(Utilities.getCtryColor(owner), Utilities.getCtryColor(controller)); 46 | if (p != null) 47 | mapPanel.paintProvince(g, provId, p); 48 | else 49 | System.err.println("Unknown problem in PoliticalMode.java"); 50 | } else { 51 | mapPanel.paintProvince(g, provId, Utilities.getCtryColor(owner)); 52 | } 53 | } 54 | 55 | protected void paintSeaZone(final Graphics2D g, int id) { 56 | // do nothing 57 | } 58 | 59 | 60 | 61 | public String getTooltipExtraText(final Province curr) { 62 | final int id = curr.getId(); 63 | if (id == 0 || id >= SEA_STARTS) 64 | return ""; 65 | 66 | final String owner = Text.getText(mapPanel.getModel().getHistString(id, "owner")); 67 | final String controller = Text.getText(mapPanel.getModel().getHistString(id, "controller")); 68 | 69 | if (owner == null && controller == null) 70 | return ""; 71 | 72 | final StringBuilder ret = new StringBuilder(); 73 | if (owner != null && !Utilities.isNotACountry(owner)) 74 | ret.append("Owner: ").append(owner).append("
"); 75 | if (controller != null && !controller.equals(owner)) 76 | ret.append("Controller: ").append(Utilities.isNotACountry(controller) ? "none" : controller); 77 | 78 | return ret.toString(); 79 | } 80 | 81 | } 82 | -------------------------------------------------------------------------------- /EugFile_specific/src/eug/specific/eu3/EU3Text.java: -------------------------------------------------------------------------------- 1 | /* 2 | * EU3Text.java 3 | * 4 | * Created on September 12, 2007, 2:59 PM 5 | * 6 | * To change this template, choose Tools | Template Manager 7 | * and open the template in the editor. 8 | */ 9 | 10 | package eug.specific.eu3; 11 | 12 | import java.io.File; 13 | import java.io.FileNotFoundException; 14 | import java.io.IOException; 15 | import java.util.HashMap; 16 | import java.util.regex.Pattern; 17 | 18 | import eug.shared.FilenameResolver; 19 | 20 | /** 21 | * 22 | * @author jeff 23 | */ 24 | public class EU3Text { 25 | FilenameResolver filenameresolver = null; 26 | 27 | /** Creates a new instance of EU3Text */ 28 | public EU3Text(FilenameResolver fnr) { 29 | filenameresolver = fnr; 30 | try { 31 | initText(); 32 | } catch (FileNotFoundException ex) { 33 | ex.printStackTrace(); 34 | } catch (IOException ex) { 35 | ex.printStackTrace(); 36 | } 37 | 38 | } 39 | private static final java.util.Map text = 40 | new HashMap(); 41 | 42 | private static final Pattern semicolon = Pattern.compile(";"); 43 | 44 | 45 | private void initText() throws FileNotFoundException, IOException { 46 | java.io.BufferedReader reader; 47 | String line; 48 | String[] splitLine; 49 | for (File f : filenameresolver.listFiles("localisation")) { 50 | if (!f.getName().endsWith(".csv")) 51 | continue; // Could use a FileFilter or FilenameFilter 52 | 53 | if (f.length() <= 0) { 54 | continue; 55 | } 56 | 57 | reader = new java.io.BufferedReader(new java.io.FileReader(f), Math.min(1024000, (int)f.length())); 58 | try { 59 | while ((line = reader.readLine()) != null) { 60 | if (line.charAt(0) == '#') 61 | continue; 62 | splitLine = semicolon.split(line); //line.split(";"); 63 | if (splitLine.length < 2) { 64 | if (!line.contains(";")) { 65 | // If it contains ";", then it's probably just a line like ;;;;;;;;;;;; 66 | // If not, we need to know what it is. 67 | System.err.println("Malformed line in file " + f.getPath() + ":"); 68 | System.err.println(line); 69 | } 70 | continue; 71 | } 72 | text.put(splitLine[0].toLowerCase(), splitLine[1]); // English 73 | } 74 | } finally { 75 | reader.close(); 76 | } 77 | } 78 | } 79 | 80 | public static String getText(final String key) { 81 | final String ret = text.get(key.toLowerCase()); 82 | return (ret == null ? key : ret); 83 | } 84 | 85 | 86 | } 87 | -------------------------------------------------------------------------------- /EU3_Scenario_Editor/src/editor/mapmode/CtryReligionMode.java: -------------------------------------------------------------------------------- 1 | /* 2 | * CtryReligionMode.java 3 | * 4 | * Created on July 30, 2007, 12:19 PM 5 | */ 6 | 7 | package editor.mapmode; 8 | 9 | import editor.MapPanel; 10 | import editor.ProvinceData.Province; 11 | import editor.Text; 12 | import java.awt.Color; 13 | 14 | /** 15 | * 16 | * @author Michael Myers 17 | * @since 0.5pre3 18 | */ 19 | public class CtryReligionMode extends CountryMode { 20 | 21 | // Mostly the same as ProvReligionMode, but paints countries instead. 22 | 23 | /** Creates a new instance of CtryReligionMode */ 24 | public CtryReligionMode() { 25 | } 26 | 27 | public CtryReligionMode(MapPanel panel) { 28 | super(panel); 29 | } 30 | 31 | @Override 32 | protected Color getCtryColor(String country) { 33 | if (Utilities.isNotACountry(country)) 34 | return Utilities.COLOR_LAND_DEFAULT; 35 | // if (noCountryPattern.matcher(country).matches()) 36 | // country = "NAT"; 37 | else 38 | country = country.toUpperCase(); 39 | 40 | final String religion = mapPanel.getModel().getHistString(country, "religion"); 41 | 42 | if (religion == null) { 43 | return Utilities.COLOR_NO_HIST; 44 | } else if (religion.length() == 0 || religion.equalsIgnoreCase("none")) { 45 | return Utilities.COLOR_NO_RELIGION; 46 | } else { 47 | return Utilities.getReligionColor(religion); 48 | } 49 | } 50 | 51 | 52 | @Override 53 | public String getTooltipExtraText(final Province current) { 54 | final int id = current.getId(); 55 | if (!getMap().isLand(id)) 56 | return ""; 57 | 58 | final String rel = Text.getText(mapPanel.getModel().getHistString(id, "religion")); 59 | //if (rel.length() == 0) 60 | // return ""; 61 | 62 | String owner = mapPanel.getModel().getOwner(id); 63 | String ctryRel = null; 64 | 65 | if (owner != null) { 66 | owner = owner.toUpperCase(); 67 | if (Utilities.isNotACountry(owner)) { 68 | // don't add anything 69 | owner = "-"; 70 | } else { 71 | ctryRel = Text.getText(mapPanel.getModel().getHistString(owner, "religion")); 72 | } 73 | } else { 74 | owner = "-"; 75 | } 76 | 77 | final StringBuilder text = new StringBuilder("Owner: "); 78 | if (!owner.equals("-")) 79 | text.append(Text.getText(owner)).append(" ").append("(").append(owner).append(")
"); 80 | if (rel.length() != 0) 81 | text.append("Religion: ").append(rel); 82 | 83 | if (ctryRel != null) 84 | text.append("
Owner's religion: ").append(ctryRel); 85 | 86 | return text.toString(); 87 | } 88 | 89 | } 90 | -------------------------------------------------------------------------------- /EU3_Scenario_Editor/src/editor/mapmode/ProvincePaintingMode.java: -------------------------------------------------------------------------------- 1 | package editor.mapmode; 2 | 3 | import editor.MapPanel; 4 | import java.awt.Color; 5 | import java.awt.Graphics2D; 6 | import java.awt.Paint; 7 | 8 | /** 9 | * A MapMode that paints a blue background and then delegates 10 | * any painting of provinces to the subclass. Painting provinces is made 11 | * easier by {@link #paintProvince}. 12 | *

13 | * Subclasses must override {@link #paintProvince(Graphics2D, int)} and 14 | * {@link #paintSeaZone(Graphics2D, int)}. They may also override 15 | * {@link #paintBackground(Graphics2D)} or 16 | * {@link #paintTerraIncognita(Graphics2D)} if they wish; the default is to 17 | * paint the background blue and terra incognita black. 18 | * @author Michael Myers 19 | * @since 0.4pre1 20 | */ 21 | public abstract class ProvincePaintingMode extends MapMode { 22 | 23 | private static final Paint background = new Color(15, 100, 255); 24 | 25 | protected ProvincePaintingMode() { 26 | } 27 | 28 | protected ProvincePaintingMode(MapPanel panel) { 29 | super(panel); 30 | } 31 | 32 | @Override 33 | public void paint(final Graphics2D g) { 34 | paintBackground(g); 35 | 36 | paintingStarted(g); 37 | 38 | // First, paint PTI 39 | paintTerraIncognita(g); 40 | 41 | // Now, send the rest to the subclass. 42 | int maxProvinces = getMap().getMaxProvinces(); 43 | for (int i = 1; i < maxProvinces; i++) { 44 | if (getMap().isLand(i)) 45 | paintProvince(g, i); 46 | else 47 | paintSeaZone(g, i); 48 | } 49 | 50 | paintingEnded(g); 51 | } 52 | 53 | /** 54 | * Called after the background is painted, but before any provinces have 55 | * been painted. Subclasses may override this to do some processing (e.g. 56 | * caching) before having to paint. 57 | * @param g the Graphics2D object to paint with. 58 | */ 59 | protected void paintingStarted(final Graphics2D g) { 60 | // do nothing, but allow subclasses to override 61 | } 62 | 63 | protected void paintTerraIncognita(final Graphics2D g) { 64 | mapPanel.paintProvince(g, 0, Color.BLACK); 65 | } 66 | 67 | protected void paintBackground(final Graphics2D g) { 68 | g.setPaint(background); 69 | g.fillRect(0, 0, mapPanel.getWidth(), mapPanel.getHeight()); 70 | } 71 | 72 | protected abstract void paintProvince(final Graphics2D g, int provId); 73 | 74 | protected abstract void paintSeaZone(final Graphics2D g, int id); 75 | 76 | /** 77 | * Called after all provinces have been painted. Subclasses may override 78 | * this, but will typically only do so if also overriding 79 | * {@link #paintingStarted}. 80 | * @param g the Graphics2D object to paint with. 81 | */ 82 | protected void paintingEnded(final Graphics2D g) { 83 | // do nothing, but allow subclasses to override 84 | } 85 | 86 | @Override 87 | public boolean paintsBorders() { 88 | return true; 89 | } 90 | 91 | } -------------------------------------------------------------------------------- /.github/workflows/codeql-analysis.yml: -------------------------------------------------------------------------------- 1 | # For most projects, this workflow file will not need changing; you simply need 2 | # to commit it to your repository. 3 | # 4 | # You may wish to alter this file to override the set of languages analyzed, 5 | # or to provide custom queries or build logic. 6 | # 7 | # ******** NOTE ******** 8 | # We have attempted to detect the languages in your repository. Please check 9 | # the `language` matrix defined below to confirm you have the correct set of 10 | # supported CodeQL languages. 11 | # 12 | name: "CodeQL" 13 | 14 | on: 15 | push: 16 | branches: [ master ] 17 | pull_request: 18 | # The branches below must be a subset of the branches above 19 | branches: [ master ] 20 | schedule: 21 | - cron: '15 1 * * 5' 22 | 23 | jobs: 24 | analyze: 25 | name: Analyze 26 | runs-on: ubuntu-latest 27 | permissions: 28 | actions: read 29 | contents: read 30 | security-events: write 31 | 32 | strategy: 33 | fail-fast: false 34 | matrix: 35 | language: [ 'java' ] 36 | # CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ] 37 | # Learn more about CodeQL language support at https://git.io/codeql-language-support 38 | 39 | steps: 40 | - name: Checkout repository 41 | uses: actions/checkout@v3 42 | 43 | # Initializes the CodeQL tools for scanning. 44 | - name: Initialize CodeQL 45 | uses: github/codeql-action/init@v2 46 | with: 47 | languages: ${{ matrix.language }} 48 | # If you wish to specify custom queries, you can do so here or in a config file. 49 | # By default, queries listed here will override any specified in a config file. 50 | # Prefix the list here with "+" to use these queries and those in the config file. 51 | # queries: ./path/to/local/query, your-org/your-repo/queries@main 52 | 53 | # Autobuild attempts to build any compiled languages (C/C++, C#, or Java). 54 | # If this step fails, then you should remove it and run the build manually (see below) 55 | #- name: Autobuild 56 | # uses: github/codeql-action/autobuild@v2 57 | 58 | # ℹ️ Command-line programs to run using the OS shell. 59 | # 📚 https://git.io/JvXDl 60 | 61 | # ✏️ If the Autobuild fails above, remove it and uncomment the following three lines 62 | # and modify them (or add more) to build your code if your project 63 | # uses a compiled language 64 | 65 | #- run: | 66 | # make bootstrap 67 | # make release 68 | - name: Build eugFile 69 | run: ant -noinput -buildfile eugFile/build.xml 70 | #- name: Build EugFile_specific 71 | # run: ant -noinput -buildfile EugFile_specific/build.xml 72 | # env: 73 | # project.EugFile: ../EugFile 74 | #- name: Build EugSyntax 75 | # run: ant -noinput -buildfile EugSyntax/build.xml 76 | # env: 77 | # project.EugFile: ../EugFile 78 | #- name: Build Scenario Editor 79 | # run: ant -noinput -buildfile EU3_Scenario_Editor/build.xml 80 | # env: 81 | # project.EugFile: ../EugFile 82 | # project.EugFile_specific: ../EugFile_specific 83 | # project.EugSyntax: ../EugSyntax 84 | 85 | - name: Perform CodeQL Analysis 86 | uses: github/codeql-action/analyze@v2 87 | -------------------------------------------------------------------------------- /Rome_Scenario_Editor/src/editor/mapmode/CustomMode.java: -------------------------------------------------------------------------------- 1 | /* 2 | * CustomMode.java 3 | * 4 | * Created on June 11, 2007, 12:15 PM 5 | */ 6 | 7 | package editor.mapmode; 8 | 9 | import editor.MapPanel; 10 | import editor.ProvinceData.Province; 11 | import java.awt.Color; 12 | import java.awt.Graphics2D; 13 | 14 | /** 15 | * A MapMode that paints provinces based on a property defined in 16 | * either the constructor or in {@link #setName}. 17 | * @author Michael Myers 18 | */ 19 | public class CustomMode extends ProvincePaintingMode { 20 | 21 | protected static final Color COLOR_ERROR = Color.RED; 22 | protected Color foundColor = Color.GREEN; 23 | protected Color notFoundColor = new Color(100, 100, 100); // darker than GRAY, lighter than DARK_GRAY 24 | 25 | protected String name; 26 | protected String value; 27 | 28 | /** Creates a new instance of CustomMode */ 29 | public CustomMode(String name, String value) { 30 | super(); 31 | this.name = name; 32 | this.value = value.toLowerCase(); 33 | } 34 | 35 | public CustomMode(MapPanel panel, String name, String value) { 36 | super(panel); 37 | this.name = name; 38 | this.value = value.toLowerCase(); 39 | } 40 | 41 | protected void paintProvince(final Graphics2D g, int provId) { 42 | final String prop = mapPanel.getModel().getHistString(provId, name); 43 | 44 | if (prop == null || !value.equals(prop.toLowerCase())) { 45 | mapPanel.paintProvince(g, provId, notFoundColor); 46 | } else { 47 | mapPanel.paintProvince(g, provId, foundColor); 48 | } 49 | } 50 | 51 | protected void paintSeaZone(final Graphics2D g, int id) { 52 | // Default is to do nothing 53 | return; 54 | } 55 | 56 | public String getTooltipExtraText(final Province current) { 57 | // Default is to only show extra text for land provinces 58 | if (current.getId() == 0 || current.getId() >= SEA_STARTS) 59 | return ""; 60 | 61 | final String prop = mapPanel.getModel().getHistString(current.getId(), name); 62 | if (prop == null || prop.length() == 0) 63 | return ""; 64 | return name + ": " + prop; 65 | } 66 | 67 | 68 | public String getName() { 69 | return name; 70 | } 71 | 72 | public void setName(String name) { 73 | this.name = name; 74 | } 75 | 76 | public String getValue() { 77 | return value; 78 | } 79 | 80 | public void setValue(String value) { 81 | this.value = value.toLowerCase(); 82 | } 83 | 84 | public Color getFoundColor() { 85 | return foundColor; 86 | } 87 | 88 | public void setFoundColor(Color foundColor) { 89 | this.foundColor = foundColor; 90 | } 91 | 92 | public Color getNotFoundColor() { 93 | return notFoundColor; 94 | } 95 | 96 | public void setNotFoundColor(Color notFoundColor) { 97 | this.notFoundColor = notFoundColor; 98 | } 99 | 100 | public String toString() { 101 | return "Provinces with " + name + " = " + value; 102 | } 103 | 104 | } 105 | --------------------------------------------------------------------------------