From fc02ac8825cf83eb23d761f98678a8dbfab1c565 Mon Sep 17 00:00:00 2001 From: Yair Morgenstern Date: Sun, 24 Sep 2023 11:55:54 +0300 Subject: [PATCH] Added nations json schema --- .../jsons/Civ V - Gods & Kings/Nations.json | 50 ++---------- .../assets/jsons/Civ V - Vanilla/Nations.json | 14 +--- docs/Modders/Type-checking.md | 6 ++ docs/Modders/schemas/buildings.json | 6 +- docs/Modders/schemas/color.json | 11 +++ docs/Modders/schemas/nations.json | 78 +++++++++++++++++++ docs/Modders/schemas/units.json | 6 -- 7 files changed, 106 insertions(+), 65 deletions(-) create mode 100644 docs/Modders/schemas/color.json create mode 100644 docs/Modders/schemas/nations.json diff --git a/android/assets/jsons/Civ V - Gods & Kings/Nations.json b/android/assets/jsons/Civ V - Gods & Kings/Nations.json index 3beb204a5e..9c36307b20 100644 --- a/android/assets/jsons/Civ V - Gods & Kings/Nations.json +++ b/android/assets/jsons/Civ V - Gods & Kings/Nations.json @@ -2,7 +2,7 @@ //Spectator { "name": "Spectator", - "outerColor": [255,255,255] + "outerColor": [255,255,255], // "innerColor": [255,255,255] }, @@ -65,7 +65,7 @@ "uniques": ["[-50]% City-State Influence degradation", "City-State Influence recovers at twice the normal rate", "City-State territory always counts as friendly territory"], "cities": ["Athens","Sparta","Corinth","Argos","Knossos","Mycenae","Pharsalos","Ephesus","Halicarnassus","Rhodes", "Eretria","Pergamon","Miletos","Megara","Phocaea","Sicyon","Tiryns","Samos","Mytilene","Chios", - "Paros","Elis","Syracuse","Herakleia","Gortyn","Chalkis","Pylos","Pella","Naxos","Sicyon", + "Paros","Elis","Syracuse","Herakleia","Gortyn","Chalkis","Pylos","Pella","Naxos", "Larissa","Apollonia","Messene","Orchomenos","Ambracia","Kos","Knidos","Amphipolis", "Patras","Lamia","Nafplion","Apolyton"], "spyNames": ["Jason", "Helena", "Alexa", "Cletus", "Kassandra", "Andres", "Desdemona", "Anthea", "Aeneas", "Leander"] @@ -90,7 +90,7 @@ "outerColor": [9, 112, 84], "innerColor": [255,255,255], - "favouredReligion": "Taoism", + "favoredReligion": "Taoism", "uniqueName": "Art of War", "uniques": ["Great General provides double combat bonus", "[Great General] is earned [50]% faster"], "cities": ["Beijing","Shanghai","Guangzhou","Nanjing","Xian","Chengdu","Hangzhou","Tianjin","Macau","Shandong", @@ -128,7 +128,7 @@ "cities": ["Thebes","Memphis","Heliopolis","Elephantine","Alexandria","Pi-Ramesses","Giza","Byblos","Akhetaten", "Hieraconpolis","Abydos","Asyut","Avaris","Lisht","Buto","Edfu","Pithom","Busiris","Kahun","Athribis", "Mendes","Elashmunein","Tanis","Bubastis","Oryx","Sebennytus","Akhmin","Karnak","Luxor","El Kab","Armant", - "Balat","Ellahun","Hawara","Dashur","Damanhur","Ellahun","Abusir","Ellahun","Herakleopolis","Akoris", + "Balat","Ellahun","Hawara","Dashur","Damanhur","Abusir","Herakleopolis","Akoris", "Benihasan","Badari","Hermopolis","Amrah","Koptos","Ombos","Naqada","Semna","Soleb"], "spyNames": ["Refaat", "Heba", "Salah", "Ahmed", "Zakaria", "Bastet", "Ma'at", "Nebhet", "Tefenet", "Neuth"] }, @@ -452,7 +452,7 @@ "cities": ["Seoul","Busan","Jeonju","Daegu","Pyongyang","Kaesong","Suwon","Gwangju","Gangneung","Hamhung","Wonju","Ulsan", "Changwon","Andong","Gongju","Haeju","Cheongju","Mokpo","Dongducheon","Geoje","Suncheon","Jinju","Sangju", "Rason","Gyeongju","Chungju","Sacheon","Gimje","Anju"], - "spyNames": ["Kim", "Park", "Han", "Na", "Kong", "Yu", "Ahn", "Na", "Da", "Eun"] + "spyNames": ["Kim", "Park", "Han", "Na", "Kong", "Yu", "Ahn", "Da", "Eun"] }, { @@ -708,16 +708,7 @@ "introduction": "How are you? You stand before Pachacuti Inca Yupanqui.", "neutralHello": "How are you doing?", - "neutralLetsHearIt": ["Go on.","What do you say?","You may begin."], - "neutralNo": ["We absolutely refuse.","No!","I refuse."], - "neutralYes": ["Very good.","Of course, yes.","That is very good."], - "hateHello": "What do you want now?", - "hateLetsHearIt": ["Speak!","What do you say?","Go on."], - "hateNo": ["That is not possible!","We are not agreeing to that!","I beg your pardon?"], - "hateYes": ["That is fine.","That is good enough.","Very well..."], - - "afterPeace": "Viracocha has frowned upon our war, and has agreed to our peace agreements.", "tradeRequest": "The Incan people offer this fair trade.", "outerColor": [255,184,33], @@ -732,7 +723,7 @@ "Andahuaylas","Ica","Arequipa","Nasca","Atico","Juli","Chuito","Chuquiapo","Huanuco Pampa","Tamboccocha", "Huaras","Riobamba","Caxamalca","Sausa","Tambo Colorado","Huaca","Tumbes","Chan Chan","Sipan","Pachacamac", "Llactapata","Pisac","Kuelap","Pajaten","Chucuito","Choquequirao"], - "spyNames": ["Amaru", "Apichu", "Pariapichiu", "Puma", "Quenti", "Suyuntu", "Uturuncu", "Uturuncu", "Purutu", "Ozcollo"] + "spyNames": ["Amaru", "Apichu", "Pariapichiu", "Puma", "Quenti", "Suyuntu", "Uturuncu", "Purutu", "Ozcollo"] }, { "name": "Denmark", @@ -954,18 +945,10 @@ "defeated": "Vile ruler, know you have won this war in name alone. Your cities lie buried and your troops defeated. I have my own victory.", "introduction": "I am Boudicca, Queen of the Celts. Let no-one underestimate me!", "tradeRequest": "Let us join our forces together and reap the rewards.", - "afterPeace": "Well played, fellow warrior.", "neutralHello": "God has given good to you.", - "neutralLetsHearIt": ["We are all ears…","We are all ears…","Forward."], - "neutralNo": ["We must decline.","No.","We refuse."], - "neutralYes": ["Okay.","Sure, it shall be so.","Accepted."], "hateHello": "Well?", - "hateLetsHearIt": ["Forward! Before I change my mind!","And?","Speak!"], - "hateNo": ["That's unacceptable!","A thousand times no!","Never!"], - "hateYes": ["Eugh! Fine then…","Disgusting! Okay then…","But if I have to…"], - "outerColor": [12,75,25], "innerColor": [157,172,255], @@ -995,17 +978,10 @@ "defeated": "God and history will remember your actions this day. I hope you are ready for your impending judgment.", "introduction": "A thousand welcomes to our fair nation. I am Selassie, the Ras Tafari Makonnen and Emperor of Ethiopia, your humble servant.", "tradeRequest": "I request that you consider this offer between our two peoples. I believe it will do us both good.", - "afterPeace": "Today is the day on which we defeated our enemy. However, we shall only rejoice in our hearts, and in the spirit of heaven.", "neutralHello": "Welcome.", - "neutralLetsHearIt": ["Continue.","I am listening.","Yes?"], - "neutralNo": ["It is not right.","We oppose because it is not right.","But I feel the agreement is done."], - "neutralYes": ["Great.","An agreement has been reached.","Our heart and soul is very much satisfied."], "hateHello": "What do you want?", - "hateLetsHearIt": ["You said it.","What?","Continue."], - "hateNo": ["That is unacceptable.","You are not sure about it.","Please repeat for me."], - "hateYes": ["Fine, in my understanding.","It is clear.","It is clear."], "outerColor": [18, 66, 22], "innerColor": [255, 56, 56], @@ -1036,18 +1012,6 @@ "tradeRequest": "Friend, I believe I may have found a way to save us all! Look, look and accept my offering!", "neutralHello": "A fine day, it helps you.", -/* Not used by Unciv, and uncertain - "afterPeace": "", - - "neutralLetsHearIt": ["If you must show me."], - "neutralNo": ["No no, too much trouble.","No!","Not good enough."], - "neutralYes": ["Okay.","Fine.","Accepted."], - - "hateHello": "You.", - "hateLetsHearIt": ["Talk.","So?","Speak!"], - "hateNo": ["That's unacceptable!","A thousand times no!","Never!"], - "hateYes": ["Oh… Fine, okay."], -*/ "outerColor": [198, 141, 99], "innerColor": [24, 63, 66], "favoredReligion": "Christianity", @@ -1126,7 +1090,6 @@ }, { "name": "Lhasa", - "translatedName": "Lhasa", "adjective": ["tibetano"], "cityStateType": "Cultured", @@ -1250,7 +1213,6 @@ }, { "name": "Vancouver", - "translatedName": "Vancouver", "adjective": ["Vancouverite"], "cityStateType": "Maritime", diff --git a/android/assets/jsons/Civ V - Vanilla/Nations.json b/android/assets/jsons/Civ V - Vanilla/Nations.json index 5ddc6cf19e..9d22ce18b0 100644 --- a/android/assets/jsons/Civ V - Vanilla/Nations.json +++ b/android/assets/jsons/Civ V - Vanilla/Nations.json @@ -62,7 +62,7 @@ "uniques": ["[-50]% City-State Influence degradation", "City-State Influence recovers at twice the normal rate", "City-State territory always counts as friendly territory"], "cities": ["Athens","Sparta","Corinth","Argos","Knossos","Mycenae","Pharsalos","Ephesus","Halicarnassus","Rhodes", "Eretria","Pergamon","Miletos","Megara","Phocaea","Sicyon","Tiryns","Samos","Mytilene","Chios", - "Paros","Elis","Syracuse","Herakleia","Gortyn","Chalkis","Pylos","Pella","Naxos","Sicyon", + "Paros","Elis","Syracuse","Herakleia","Gortyn","Chalkis","Pylos","Pella","Naxos", "Larissa","Apollonia","Messene","Orchomenos","Ambracia","Kos","Knidos","Amphipolis", "Patras","Lamia","Nafplion","Apolyton"] }, @@ -120,7 +120,7 @@ "cities": ["Thebes","Memphis","Heliopolis","Elephantine","Alexandria","Pi-Ramesses","Giza","Byblos","Akhetaten", "Hieraconpolis","Abydos","Asyut","Avaris","Lisht","Buto","Edfu","Pithom","Busiris","Kahun","Athribis", "Mendes","Elashmunein","Tanis","Bubastis","Oryx","Sebennytus","Akhmin","Karnak","Luxor","El Kab","Armant", - "Balat","Ellahun","Hawara","Dashur","Damanhur","Ellahun","Abusir","Ellahun","Herakleopolis","Akoris", + "Balat","Ellahun","Hawara","Dashur","Damanhur","Abusir","Herakleopolis","Akoris", "Benihasan","Badari","Hermopolis","Amrah","Koptos","Ombos","Naqada","Semna","Soleb"] }, { @@ -658,16 +658,8 @@ "introduction": "How are you? You stand before Pachacuti Inca Yupanqui.", "neutralHello": "How are you doing?", - "neutralLetsHearIt": ["Go on.","What do you say?","You may begin."], - "neutralNo": ["We absolutely refuse.","No!","I refuse."], - "neutralYes": ["Very good.","Of course, yes.","That is very good."], "hateHello": "What do you want now?", - "hateLetsHearIt": ["Speak!","What do you say?","Go on."], - "hateNo": ["That is not possible!","We are not agreeing to that!","I beg your pardon?"], - "hateYes": ["That is fine.","That is good enough.","Very well..."], - - "afterPeace": "Viracocha has frowned upon our war, and has agreed to our peace agreements.", "tradeRequest": "The Incan people offer this fair trade.", "outerColor": [255,184,33], @@ -776,7 +768,6 @@ }, { "name": "Lhasa", - "translatedName": "Lhasa", "adjective": ["tibetano"], "cityStateType": "Cultured", @@ -900,7 +891,6 @@ }, { "name": "Vancouver", - "translatedName": "Vancouver", "adjective": ["Vancouverite"], "cityStateType": "Maritime", diff --git a/docs/Modders/Type-checking.md b/docs/Modders/Type-checking.md index 0a866af338..b36b26f097 100644 --- a/docs/Modders/Type-checking.md +++ b/docs/Modders/Type-checking.md @@ -35,6 +35,12 @@ Tada! Now Android Studio will recognize all Buildings.json files as belonging to "*/Units.json" ], "url": "https://raw.githubusercontent.com/yairm210/Unciv/master/docs/Modders/schemas/units.json" + }, + { + "fileMatch": [ + "*/Nations.json" + ], + "url": "https://raw.githubusercontent.com/yairm210/Unciv/master/docs/Modders/schemas/nations.json" } ] ``` diff --git a/docs/Modders/schemas/buildings.json b/docs/Modders/schemas/buildings.json index d0facbd3df..4773c70871 100644 --- a/docs/Modders/schemas/buildings.json +++ b/docs/Modders/schemas/buildings.json @@ -26,12 +26,12 @@ "percentStatBonus": { "$ref": "https://raw.githubusercontent.com/yairm210/Unciv/master/docs/Modders/schemas/stats.json" }, "specialistSlots": { "type": "object", - "additionalProperties": {"type": "integer"}, + "additionalProperties": { "type": "integer" }, "description": "How many specialists of each type does this building allow for. Key must be name of existing specialist." }, "greatPersonPoints": { "type": "object", - "additionalProperties": {"type": "integer"}, + "additionalProperties": { "type": "integer" }, "description": "Which Great Person Points this building generates per turn. Key must be name of Great Person unit." }, "hurryCostModifier": { "type": "number" }, @@ -55,7 +55,7 @@ "type": "string", "description": "For unique units: the name of the original unit that this unit replaces for the uniqueTo nation." }, - + "quote": { "type": "string", "description": "Quote that will be displayed for Wonders in the 'construction completed' popup" diff --git a/docs/Modders/schemas/color.json b/docs/Modders/schemas/color.json new file mode 100644 index 0000000000..87b56f5c34 --- /dev/null +++ b/docs/Modders/schemas/color.json @@ -0,0 +1,11 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema", + "type": "array", + "minLength": 3, + "maxLength": 3, + "items": { + "type": "integer", + "minimum": 0, + "maximum": 255 + } +} diff --git a/docs/Modders/schemas/nations.json b/docs/Modders/schemas/nations.json new file mode 100644 index 0000000000..e284bbc2da --- /dev/null +++ b/docs/Modders/schemas/nations.json @@ -0,0 +1,78 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema", + "type": "array", + "items": { + "type": "object", + "properties": { + "name": { "type": "string" }, + "leaderName": { "type": "string" }, + "adjective": { + "type": "array", + "items": { "type": "string" }, + "uniqueItems": true, + "description": "Currently not in use" + }, + "style": { "type": "string" }, + "cityStateType": { "type": "string" }, + "outerColor": { "$ref": "#/definitions/color" }, + "innerColor": { "$ref": "#/definitions/color" }, + + "preferredVictoryType": { "type": "string" }, + "startBias": { + "type": "array", + "items": { "type": "string" }, + "uniqueItems": true, + "description": "Types of tiles where the civ will be more likely to start" + }, + + "uniques": { "$ref": "https://raw.githubusercontent.com/yairm210/Unciv/master/docs/Modders/schemas/uniques.json" }, + + + // All of these are cosmetic + "introduction": { "type": "string" }, + "tradeRequest": { "type": "string" }, + "neutralHello": { "type": "string" }, + "hateHello": { "type": "string" }, + + "declaringWar": { "type": "string" }, + "attacked": { "type": "string" }, + "defeated": { "type": "string" }, + "startIntroPart1": { "type": "string" }, + "startIntroPart2": { "type": "string" }, + "cities": { + "type": "array", + "items": { "type": "string" }, + "uniqueItems": true, + }, + "spyNames": { + "type": "array", + "items": { "type": "string" }, + "uniqueItems": true, + }, + "favoredReligion": { "type": "string" }, + + "uniqueName": { "type": "string" }, + "uniqueText": { + "type": "string", + "description": "Freeform text that will be shown to users, overriding the list of uniques." + }, + "civilopediaText": { "$ref": "https://raw.githubusercontent.com/yairm210/Unciv/master/docs/Modders/schemas/civilopediaText.json" } + }, + "required": [ + "name", "outerColor" + ], + "additionalProperties": false, + "definitions": { + "color": { + "type": "array", + "minLength": 3, + "maxLength": 3, + "items": { + "type": "integer", + "minimum": 0, + "maximum": 255 + } + } + } + } +} diff --git a/docs/Modders/schemas/units.json b/docs/Modders/schemas/units.json index 8c0db317ab..b837cf0c72 100644 --- a/docs/Modders/schemas/units.json +++ b/docs/Modders/schemas/units.json @@ -52,11 +52,5 @@ "name", "unitType" ], "additionalProperties": false - }, - "definitions": { - "uniques": { - "type": "array", - "items": { "type": "string" } - } } }