Ticket #3987: civselection_randomcivoption.patch
File civselection_randomcivoption.patch, 54.1 KB (added by , 8 years ago) |
---|
-
binaries/data/config/default.cfg
85 85 noautomipmap = true 86 86 novbo = false 87 87 noframebufferobject = false 88 randomcultures = true 88 89 89 90 ; Disable hardware cursors 90 91 nohwcursor = false -
binaries/data/mods/public/gui/civselect/civselect.js
1 2 // Globals 3 var g_CivData = {}; 4 var g_GroupingData = {}; 5 var g_GroupingChoice = "none"; 6 var g_Player = 0; 7 var g_Selected = { 8 "isGroup": false, 9 "code": "athen" 10 }; 11 var g_EmblemMargin = 8; 12 var g_HeaderEmblemSize = 80; 13 14 /** 15 * Run when UI Page loaded. 16 */ 17 function init (settings) 18 { 19 // Cache civ data 20 g_CivData = loadCivData(true); 21 22 g_Player = settings.player; 23 24 // If no civ passed, choose one at random 25 if (!settings.civ) 26 { 27 let num = Math.floor(Math.random() * Object.keys(g_CivData).length); 28 settings.civ = { 29 "codes": [ Object.keys(g_CivData)[num] ], 30 "grouped": false 31 }; 32 } 33 34 // Cache grouping data and create list 35 let grpList = [ "Ungrouped" ]; 36 let grpList_data = [ "nogroup" ]; 37 for (let grp of Engine.BuildDirEntList("simulation/data/civs/grouping/", "*.json", false)) 38 { 39 let data = Engine.ReadJSONFile(grp); 40 if (!data) 41 continue; 42 43 translateObjectKeys(data, ["ListEntry"]); 44 g_GroupingData[data.Code] = loadGroupingSchema(data.Folder, data.CivAttribute); 45 grpList.push(data.ListEntry); 46 grpList_data.push(data.Code); 47 } 48 49 let grpSel = Engine.GetGUIObjectByName("groupSelection"); 50 grpSel.list = grpList; 51 grpSel.list_data = grpList_data; 52 53 // Read civ choice from passed data 54 if (!settings.civ.grouped) 55 { 56 g_Selected.code = settings.civ.codes[0]; 57 grpSel.selected = 0; 58 selectCiv(g_Selected.code); 59 } 60 else 61 { 62 g_GroupingChoice = settings.civ.group.type; 63 g_Selected.isGroup = true; 64 if (settings.civ.group.code !== "all") 65 { 66 g_Selected.code = settings.civ.group.code; 67 grpSel.selected = grpSel.list_data.indexOf(g_GroupingChoice); 68 selectGroup(g_Selected.code); 69 } 70 else 71 { 72 grpSel.selected = 0; 73 selectAllCivs(); 74 } 75 } 76 Engine.GetGUIObjectByName("randomCultures").checked = Engine.ConfigDB_GetValue("user", "randomcultures") === "true"; 77 } 78 79 function chooseGrouping (choice) 80 { 81 Engine.GetGUIObjectByName("allUngrouped").hidden = !(choice === "nogroup"); 82 if (choice === "nogroup") 83 draw_ungrouped(); 84 else 85 draw_grouped(choice); 86 } 87 88 function draw_grouped (group) 89 { 90 let grp = 0; 91 let emb = 0; 92 let vOffset = 0; 93 g_GroupingChoice = group; 94 let grouping = g_GroupingData[group]; 95 for (let civ in g_CivData) 96 g_CivData[civ].embs = []; 97 for (let code in grouping) 98 { 99 // Pre-emptive check to make sure we have at least one emblem left 100 if (!Engine.GetGUIObjectByName("emblem["+emb+"]")) 101 break; 102 103 let grpObj = Engine.GetGUIObjectByName("civGroup["+grp+"]"); 104 if (grpObj === undefined) 105 { 106 error("There are more grouping choices available than can be supported by the current GUI layout"); 107 break; 108 } 109 110 let grpSize = grpObj.size; 111 grpSize.top = vOffset; 112 grpSize.left = (code === "groupless") ? g_EmblemMargin : g_HeaderEmblemSize-g_EmblemMargin; 113 grpObj.size = grpSize; 114 grpObj.hidden = false; 115 116 g_GroupingData[g_GroupingChoice][code].embs = []; 117 118 let grpHeading = Engine.GetGUIObjectByName("civGroup["+grp+"]_heading"); 119 grpHeading.caption = grouping[code].Name; 120 121 if (code !== "groupless") 122 { 123 let grpBtn = Engine.GetGUIObjectByName("emblem["+emb+"]_btn"); 124 setBtnFunc(grpBtn, selectGroup, [ code ]); 125 setEmbPos("emblem["+emb+"]", 0, vOffset+g_EmblemMargin); 126 setEmbSize("emblem["+emb+"]", g_HeaderEmblemSize); 127 128 let sprite = (code!==g_Selected.code) ? "grayscale:" : ""; 129 if (grouping[code].Emblem) 130 sprite += grouping[code].Emblem; 131 else 132 sprite += g_CivData[grouping[code].civlist[0]].Emblem; 133 Engine.GetGUIObjectByName("emblem["+emb+"]_img").sprite = "stretched:"+sprite; 134 Engine.GetGUIObjectByName("emblem["+emb+"]").hidden = false; 135 g_GroupingData[g_GroupingChoice][code].embs.push(emb); 136 ++emb; 137 } 138 139 let range = [ emb ]; 140 141 for (let civ of grouping[code].civlist) 142 { 143 let embImg = Engine.GetGUIObjectByName("emblem["+emb+"]_img"); 144 if (embImg === undefined) 145 { 146 error("There are not enough images in the current GUI layout to support that many civs"); 147 break; 148 } 149 g_CivData[civ].embs.push(emb); 150 g_GroupingData[g_GroupingChoice][code].embs.push(emb); 151 152 embImg.sprite = "stretched:"; 153 if (civ !== g_Selected.code && code !== g_Selected.code) 154 embImg.sprite += "grayscale:"; 155 embImg.sprite += g_CivData[civ].Emblem; 156 157 let embBtn = Engine.GetGUIObjectByName("emblem["+emb+"]_btn"); 158 setBtnFunc(embBtn, selectCiv, [ civ ]); 159 Engine.GetGUIObjectByName("emblem["+emb+"]").hidden = false; 160 emb++; 161 } 162 range[1] = emb - 1; 163 164 setEmbSize("emblem["+range[0]+"]", 58); 165 vOffset += grpHeading.size.bottom + 2; 166 vOffset += gridArrayRepeatedObjects("emblem[emb]", "emb", 4, range, vOffset, ((code==="groupless")?g_EmblemMargin:g_HeaderEmblemSize)); 167 vOffset += g_EmblemMargin * 2; 168 grp++; 169 } 170 hideRemaining("emblem[", emb, "]"); 171 hideRemaining("civGroup[", grp, "]"); 172 } 173 174 function draw_ungrouped () 175 { 176 setEmbSize("emblem[0]"); 177 gridArrayRepeatedObjects("emblem[emb]", "emb", 8); 178 let emb = 0; 179 for (let civ in g_CivData) 180 { 181 g_CivData[civ].embs = [ emb ]; 182 183 let embImg = Engine.GetGUIObjectByName("emblem["+emb+"]_img"); 184 if (embImg === undefined) 185 { 186 error("There are not enough images in the current GUI layout to support that many civs"); 187 break; 188 } 189 190 embImg.sprite = "stretched:"; 191 if (civ !== g_Selected.code) 192 embImg.sprite += "grayscale:"; 193 embImg.sprite += g_CivData[civ].Emblem; 194 195 let embBtn = Engine.GetGUIObjectByName("emblem["+emb+"]_btn"); 196 setBtnFunc(embBtn, selectCiv, [ civ ]); 197 Engine.GetGUIObjectByName("emblem["+emb+"]").hidden = false; 198 emb++; 199 } 200 hideRemaining("emblem[", emb, "]"); 201 hideRemaining("civGroup[", 0, "]"); 202 } 203 204 function selectCiv (code) 205 { 206 highlightEmblems(g_CivData[code].embs); 207 Engine.GetGUIObjectByName("allUngrouped_check").checked = false; 208 209 g_Selected.isGroup = false; 210 g_Selected.code = code; 211 212 let heading = Engine.GetGUIObjectByName("selected_heading"); 213 heading.caption = g_CivData[code].Name; 214 215 let civList = Engine.GetGUIObjectByName("selected_civs"); 216 civList.hidden = true; 217 218 let history = Engine.GetGUIObjectByName("selected_history"); 219 history.caption = g_CivData[code].History; 220 221 let size = history.parent.size; 222 size.top = 48; 223 history.parent.size = size; 224 history.parent.hidden = false; 225 226 let choice = Engine.GetGUIObjectByName("selected_text"); 227 choice.caption = sprintf(translate("You have selected the %(civname)s"), {"civname": g_CivData[code].Name}); 228 } 229 230 function selectGroup (code) 231 { 232 highlightEmblems(g_GroupingData[g_GroupingChoice][code].embs); 233 Engine.GetGUIObjectByName("allUngrouped_check").checked = false; 234 235 g_Selected.isGroup = true; 236 g_Selected.code = code; 237 238 let heading = Engine.GetGUIObjectByName("selected_heading"); 239 heading.caption = g_GroupingData[g_GroupingChoice][code].Name; 240 241 let civList = Engine.GetGUIObjectByName("selected_civs"); 242 civList.hidden = false; 243 civList.caption = ""; 244 let civCount = 0; 245 for (let civ of g_GroupingData[g_GroupingChoice][code].civlist) 246 { 247 civList.caption += g_CivData[civ].Name+"\n"; 248 civCount++; 249 } 250 251 let history = Engine.GetGUIObjectByName("selected_history"); 252 history.caption = g_GroupingData[g_GroupingChoice][code].History; 253 let size = history.parent.size; 254 size.top = 18 * civCount + 64; 255 history.parent.size = size; 256 history.parent.hidden = false; 257 258 let choice = Engine.GetGUIObjectByName("selected_text"); 259 if (g_GroupingData[g_GroupingChoice][code].Singular) 260 choice.caption = sprintf(translate("A random %(civGroup)s civ will be chosen."), { 261 "civGroup": g_GroupingData[g_GroupingChoice][code].Singular 262 }); 263 else 264 choice.caption = translate("A civ will be chosen at random from this group"); 265 } 266 267 function selectAllCivs () 268 { 269 Engine.GetGUIObjectByName("allUngrouped_check").checked = true; 270 271 let embs = []; 272 for (let i=0; ; ++i) 273 { 274 if (!Engine.GetGUIObjectByName("emblem["+i+"]")) 275 break; 276 embs.push(i); 277 } 278 highlightEmblems(embs); 279 280 g_Selected.isGroup = true; 281 g_Selected.code = "all"; 282 283 let heading = Engine.GetGUIObjectByName("selected_heading"); 284 heading.caption = sprintf(translate("Random %(civGroup)s"), { 285 "civGroup": translateWithContext("All Civs", "All") 286 }); 287 288 let civList = Engine.GetGUIObjectByName("selected_civs"); 289 civList.hidden = false; 290 civList.caption = ""; 291 let civCount = 0; 292 for (let civ in g_CivData) 293 { 294 civList.caption += g_CivData[civ].Name+"\n"; 295 civCount++; 296 } 297 298 let history = Engine.GetGUIObjectByName("selected_history"); 299 history.parent.hidden = true; 300 301 let choice = Engine.GetGUIObjectByName("selected_text"); 302 choice.caption = translate("A civ will be chosen at random"); 303 } 304 305 function highlightEmblems (embs = []) 306 { 307 for (let e=0; ; ++e) 308 { 309 if (!Engine.GetGUIObjectByName("emblem["+e+"]")) 310 return; 311 312 let embImg = Engine.GetGUIObjectByName("emblem["+e+"]_img"); 313 let sprite = embImg.sprite.split(":"); 314 embImg.sprite = "stretched:" + ((embs.indexOf(e)<0)?"grayscale:":"") + sprite.pop(); 315 } 316 } 317 318 function setBtnFunc (btn, func, vars = null) 319 { 320 btn.onPress = function () { func.apply(null, vars); }; 321 } 322 323 function randomCultures() 324 { 325 Engine.ConfigDB_CreateValue("user", "randomcultures", String(Engine.GetGUIObjectByName("randomCultures").checked)); 326 Engine.ConfigDB_SetChanges("user", true); 327 Engine.ConfigDB_WriteFile("user", "config/user.cfg"); 328 } 329 330 function returnCiv () 331 { 332 let code = g_Selected.code; 333 let civ = { 334 "codes": [ g_Selected.code ], 335 "grouped": false, 336 } 337 if (g_Selected.isGroup) 338 { 339 civ.codes = g_Selected.code == "all" ? Object.keys(g_CivData) : g_GroupingData[g_GroupingChoice][code].civlist; 340 civ.grouped = true; 341 civ.group = { 342 "caption": g_Selected.code === "all" ? "All" : g_GroupingData[g_GroupingChoice][code].Singular, 343 "code": g_Selected.code, 344 "type": g_GroupingChoice, 345 }; 346 } 347 Engine.PopGuiPageCB({ 348 "player": g_Player, 349 "civ": civ, 350 "randomCultures" : Engine.GetGUIObjectByName("randomCultures").checked 351 }); 352 } -
binaries/data/mods/public/gui/civselect/civselect.xml
1 <?xml version="1.0" encoding="utf-8"?> 2 3 <objects> 4 <script file="gui/common/functions_civinfo.js"/> 5 <script file="gui/common/functions_global_object.js"/> 6 <script file="gui/common/functions_repeat_positioning.js"/> 7 <script file="gui/common/functions_utility.js"/> 8 <script file="gui/civselect/helpers.js"/> 9 <script file="gui/civselect/civselect.js"/> 10 11 <!-- Add a translucent black background to fade out the match page --> 12 <object type="image" z="0" sprite="bkTranslucent"/> 13 14 <object type="image" style="ModernDialog" size="50%-488 50%-360 50%+488 50%+360"> 15 16 <object style="TitleText" type="text" size="50%-128 -18 50%+128 14"> 17 <translatableAttribute id="caption">Civilization Selection</translatableAttribute> 18 </object> 19 20 <object size="16 32 70%-8 100%-32"> 21 22 <!-- grouping selection --> 23 <object size="50% 0 100% 40"> 24 <object 25 name="groupSelectionHeading" 26 type="text" 27 font="sans-bold-16" 28 textcolor="white" 29 text_align="right" 30 size="0 2 100%-196 32" 31 > 32 <translatableAttribute id="caption">Group by:</translatableAttribute> 33 </object> 34 35 <object name="groupSelection" type="dropdown" style="ModernDropDown" size="100%-192 0 100% 26"> 36 <translatableAttribute id="tooltip">Choose how to group civs</translatableAttribute> 37 <action on="SelectionChange">chooseGrouping(this.list_data[this.selected]);</action> 38 </object> 39 </object> 40 41 <!-- draw space --> 42 <object type="image" size="0 40 100% 100%"> 43 44 <repeat count="32" var="em"> 45 <object name="emblem[em]" size="4 8 4+64 8+64"> 46 <object type="image" style="EmblemImage" name="emblem[em]_img"/> 47 <object type="button" style="EmblemButton" name="emblem[em]_btn"/> 48 </object> 49 </repeat> 50 51 <repeat count="12" var="g"> 52 <object size="8 8 100%-8 24+72+16" name="civGroup[g]"> 53 <object 54 name="civGroup[g]_heading" 55 type="text" 56 font="sans-16" 57 textcolor="white" 58 text_align="left" 59 size="2 0 50% 24" 60 > 61 <translatableAttribute id="caption">A group:</translatableAttribute> 62 </object> 63 <object sprite="ModernGoldLine" type="image" size="0 24 100% 25" /> 64 </object> 65 </repeat> 66 67 </object> 68 69 <object size="100%-96 100%-24 100% 100%" name="allUngrouped"> 70 <object type="checkbox" style="ModernTickBox" name="allUngrouped_check"> 71 <action on="Press">selectAllCivs();</action> 72 </object> 73 <object type="text" textcolor="white" size="24 0 100% 16" > 74 <translatableAttribute id="caption">Select All</translatableAttribute> 75 </object> 76 </object> 77 78 </object> 79 80 <object sprite="ModernDarkBoxGold" type="image" size="70%+8 32 100%-16 90%-70"> 81 82 <!-- Selection Details --> 83 <object 84 name="selected_heading" 85 type="text" 86 font="sans-bold-24" 87 textcolor="white" 88 text_align="center" 89 size="0 12 100% 40" 90 /> 91 92 <object 93 name="selected_civs" 94 type="text" 95 font="sans-16" 96 textcolor="white" 97 text_align="center" 98 size="4 44 100%-4 100%-4" 99 /> 100 101 <object size="8 48 100%-8 100%-8" type="image" sprite="ModernDarkBoxGold"> 102 <object 103 name="selected_history" 104 type="text" 105 font="sans-14" 106 textcolor="white" 107 text_align="center" 108 size="4 4 100%-4 100%-4" 109 /> 110 </object> 111 112 </object> 113 <object 114 name="selected_text" 115 type="text" 116 font="sans-12" 117 textcolor="green" 118 text_align="center" 119 text_valign="bottom" 120 size="70%+8 100%-64 100%-16 100%-48" 121 /> 122 123 <object size="90%-96 90%-34 120% 88%" name="optionRandomCultures"> 124 <object type="checkbox" style="ModernTickBox" name="randomCultures"> 125 <action on="Press">randomCultures();</action> 126 <translatableAttribute id="tooltip">Civilizations set to "Random All" will be chosen by culture.</translatableAttribute> 127 </object> 128 <object type="text" textcolor="white" size="25 0 40% 28" > 129 <translatableAttribute id="caption">Random Cultures</translatableAttribute> 130 </object> 131 </object> 132 133 <!-- Close the dialog --> 134 <object 135 type="button" 136 style="StoneButton" 137 size="70%+8 100%-44 85%-8 100%-16" 138 > 139 <translatableAttribute id="caption">Cancel</translatableAttribute> 140 <action on="Press"> 141 <![CDATA[ 142 Engine.PopGuiPage(); 143 ]]> 144 </action> 145 </object> 146 147 <object 148 type="button" 149 style="StoneButton" 150 size="85% 100%-44 100%-16 100%-16" 151 > 152 <translatableAttribute id="caption">Select</translatableAttribute> 153 <action on="Press"> 154 <![CDATA[ 155 returnCiv(); 156 ]]> 157 </action> 158 </object> 159 160 </object> 161 162 </objects> -
binaries/data/mods/public/gui/civselect/helpers.js
1 2 /** 3 * Arranges same-size `<repeat>`d objects in a grid. Automatically scales to object size. 4 * @param basename The base name of the object, such as "object[n]" or "object[a]_sub[b]" 5 * @param splitvar The var identifying the repeat count, without the square brackets 6 * @param vMargin The gap, in px, between the rows 7 * @param limit Array of limits, of the form `[ {from}, {to} ]`. If an empty array, then it will do all objects matching the basname 8 * @param vOffset Vertical offset from top of parent object to start drawing from 9 * @return The height difference between the top of the first element and the bottom of the last. 10 */ 11 function gridArrayRepeatedObjects (basename, splitvar="n", vMargin=0, limit=[], vOffset=0, hOffset=0) 12 { 13 basename = basename.split("["+splitvar+"]", 2); 14 15 if (limit.length == 0) 16 { 17 limit = [0, 0, 1]; 18 while (Engine.GetGUIObjectByName(basename.join("["+ (limit[1]+1) +"]"))) 19 { 20 ++limit[1]; 21 ++limit[2]; 22 } 23 } 24 else if (limit.length < 2) 25 { 26 error("Invalid limit arguments"); 27 return 0; 28 } 29 else 30 limit[2] = limit[1] - limit[0] + 1; 31 32 let firstObj = Engine.GetGUIObjectByName(basename.join("["+limit[0]+"]")); 33 let child = firstObj.getComputedSize(); 34 child.width = child.right - child.left; 35 child.height = child.bottom - child.top; 36 37 let parent = firstObj.parent.getComputedSize(); 38 parent.width = parent.right - parent.left - hOffset; 39 40 let rowLength = Math.floor(parent.width / child.width); 41 let hMargin = parent.width - child.width * rowLength; 42 hMargin = Math.round(hMargin / (rowLength + 1)); 43 44 child.width += hMargin; 45 child.height += vMargin; 46 47 let i = limit[0]; 48 for (let r = 0; r < Math.ceil(limit[2]/rowLength); ++r) 49 { 50 for (let c = 0; c < rowLength; ++c) 51 { 52 let newSize = new GUISize(); 53 newSize.left = c * child.width + hMargin + hOffset; 54 newSize.right = (c+1) * child.width + hOffset; 55 newSize.top = r * child.height + vMargin + vOffset; 56 newSize.bottom = (r+1) * child.height + vOffset; 57 Engine.GetGUIObjectByName(basename.join("["+ i++ +"]")).size = newSize; 58 59 if (i > limit[1]) 60 break; 61 } 62 } 63 64 var lastObj = Engine.GetGUIObjectByName(basename.join("["+(i-1)+"]")); 65 return (lastObj.size.bottom - firstObj.size.top); 66 } 67 68 /** 69 * Load Data about a grouping schema 70 * 71 * @param attr The JSON attribute in the Civ JSON files that lists which of the groups in this schema that civ belongs to 72 * @param folder The folder containing the groups of this schema 73 */ 74 function loadGroupingSchema (folder, attr) 75 { 76 let groupData = {}; 77 let groupless = []; 78 79 for (let code of Object.keys(g_CivData)) 80 { 81 let civ = g_CivData[code]; 82 let nogroup = true; 83 let groups = civ[attr] || []; 84 if (typeof groups === "string") 85 groups = [ groups ]; 86 87 for (let grp of groups) 88 { 89 if (groupData[grp] === undefined) 90 { 91 let data = Engine.ReadJSONFile("simulation/data/civs/"+folder+"/"+grp+".json"); 92 if (!data) 93 continue; 94 translateObjectKeys(data, ["Name", "Singular", "History"]); 95 96 groupData[grp] = data; 97 groupData[grp].civlist = []; 98 } 99 groupData[grp].civlist.push(code); 100 nogroup = false; 101 } 102 if (nogroup) 103 groupless.push(code); 104 } 105 if (groupless.length > 0) 106 groupData.groupless = { 107 "Name" : translateWithContext("Set of civs with no defined group", "Ungrouped"), 108 "Code" : "groupless", 109 "History" : "-", 110 "civlist": groupless 111 }; 112 return groupData; 113 } 114 115 function setEmbSize (objectName, length=128) 116 { 117 let objSize = Engine.GetGUIObjectByName(objectName).size; 118 objSize.right = objSize.left + length; 119 objSize.bottom = objSize.top + length; 120 Engine.GetGUIObjectByName(objectName).size = objSize; 121 } 122 123 function setEmbPos (objectName, x=0, y=0) 124 { 125 let objSize = Engine.GetGUIObjectByName(objectName).size; 126 let wid = objSize.right - objSize.left; 127 objSize.left = x; 128 objSize.top = y; 129 Engine.GetGUIObjectByName(objectName).size = objSize; 130 setEmbSize(objectName, wid); 131 } -
binaries/data/mods/public/gui/civselect/setup.xml
1 <?xml version="1.0" encoding="utf-8"?> 2 3 <setup> 4 5 6 7 </setup> -
binaries/data/mods/public/gui/civselect/sprites.xml
1 <?xml version="1.0" encoding="utf-8"?> 2 3 <sprites> 4 5 <sprite name="CivIconPress"> 6 <image 7 texture="session/portraits/emblems/states/click.png" 8 /> 9 </sprite> 10 11 </sprites> -
binaries/data/mods/public/gui/civselect/styles.xml
1 <?xml version="1.0" encoding="utf-8"?> 2 3 <styles> 4 5 <style name="EmblemButton" 6 sprite="" 7 sprite_over="CivIconOver" 8 sprite_pressed="CivIconPress" 9 size="0 0 100% 100%" 10 sound_pressed="audio/interface/ui/ui_button_click.ogg" 11 /> 12 13 <style name="EmblemImage" 14 sprite="stretched:pregame/shell/logo/wfg_logo_white.png" 15 size="0 0 100% 100%" 16 /> 17 18 <style name="HeroImage" 19 sprite="stretched:pregame/shell/logo/wfg_logo_white.png" 20 size="0 0 32 32" 21 /> 22 23 </styles> -
binaries/data/mods/public/gui/common/functions_repeat_positioning.js
1 /* 2 DESCRIPTION : Functions related to positioning UI elements 3 NOTES : 4 */ 5 6 /** 7 * Horizontally spaces same-width objects repeated with the `<repeat>` tag 8 * @param basename The base name of the object, such as "object[n]" or "object[a]_sub[b]" 9 * @param splitvar The var identifying the repeat count, without the square brackets 10 * @param margin The gap, in px, between the repeated objects 11 * @return The number of elements affected 12 */ 13 function horizSpaceRepeatedObjects (basename, splitvar="n", margin=0) 14 { 15 basename = basename.split("["+splitvar+"]", 2); 16 for (let c = 0;;) 17 { 18 let objObj = Engine.GetGUIObjectByName(basename.join("["+ c +"]")); 19 if (!objObj) 20 return c; 21 22 let objSize = objObj.size; 23 let objWidth = objSize.right - objSize.left; 24 objSize.left = c * (objWidth + margin) + margin; 25 objSize.right = ++c * (objWidth + margin); 26 objObj.size = objSize; 27 } 28 } 29 30 /** 31 * Horizontally fit objects repeated with the `<repeat>` tag within a parent object 32 * @param basename The base name of the object, such as "object[n]" or "object[a]_sub[b]" 33 * @param splitvar The var identifying the repeat count, without the square brackets 34 * @param margin The gap, in px, between the repeated objects 35 * @param limit The number of elements to fit 36 * @return The number of elements affected 37 */ 38 function horizFitRepeatedObjects (basename, splitvar="n", margin=0, limit=0) 39 { 40 basename = basename.split("["+splitvar+"]", 2); 41 42 var objObj; 43 if (limit == 0) 44 do 45 objObj = Engine.GetGUIObjectByName(basename.join("["+ ++limit +"]")); 46 while (objObj !== undefined) 47 48 for (let c = 0; c < limit; ++c) 49 { 50 objObj = Engine.GetGUIObjectByName(basename.join("["+ c +"]")); 51 let objSize = objObj.size; 52 objSize.rleft = c * (100/limit); 53 objSize.rright = (c+1) * (100/limit); 54 objSize.right = -margin; 55 objObj.size = objSize; 56 } 57 58 return limit; 59 } 60 61 /** 62 * Vertically spaces same-height objects repeated with the `<repeat>` tag 63 * @param basename The base name of the object, such as "object[n]" or "object[a]_sub[b]" 64 * @param splitvar The var identifying the repeat count, without the square brackets 65 * @param margin The gap, in px, between the repeated objects 66 * @return The number of elements affected 67 */ 68 function vertiSpaceRepeatedObjects (basename, splitvar="n", margin=0) 69 { 70 basename = basename.split("["+splitvar+"]", 2); 71 for (let c=0;;) 72 { 73 let objObj = Engine.GetGUIObjectByName(basename.join("["+ c +"]")); 74 if (!objObj) 75 return c; 76 77 let objSize = objObj.size; 78 let objHeight = objSize.bottom - objSize.top; 79 objSize.top = c * (objHeight + margin) + margin; 80 objSize.bottom = ++c * (objHeight + margin); 81 objObj.size = objSize; 82 } 83 } 84 85 /** 86 * Hide all repeated elements after a certain index 87 * @param prefix The part of the element name preceeding the index 88 * @param idx The index from which to start 89 * @param prefix The part of the element name after the index 90 */ 91 function hideRemaining(prefix, idx, suffix) 92 { 93 for (;; ++idx) 94 { 95 let obj = Engine.GetGUIObjectByName(prefix+idx+suffix); 96 if (!obj) 97 break; 98 obj.hidden = true; 99 } 100 } 101 No newline at end of file -
binaries/data/mods/public/gui/gamesetup/gamesetup.js
142 142 const g_RandomMap = '[color="' + g_ColorRandom + '"]' + translateWithContext("map type", "Random") + "[/color]"; 143 143 144 144 /** 145 * Placeholder item for the civ-dropdownlists.145 * Style for the random civ strings. 146 146 */ 147 const g_RandomCiv = '[color="' + g_ColorRandom + '"]' + translateWithContext("civilization", "Random") + '[/color]';147 const g_RandomCivStyle = ['[color="' + g_ColorRandom + '"]', '[/color]']; 148 148 149 149 /** 150 * 151 */ 152 var g_RandomCivObj = {}; 153 154 var g_RandomCultures = Engine.ConfigDB_GetValue("user", "randomcultures") === "true"; 155 156 /** 150 157 * Whether this is a single- or multiplayer match. 151 158 */ 152 159 var g_IsNetworked; … … 255 262 g_DefaultPlayerData = g_Settings.PlayerDefaults; 256 263 g_DefaultPlayerData.shift(); 257 264 for (let i in g_DefaultPlayerData) 258 g_DefaultPlayerData[i].Civ = "random"; 265 g_DefaultPlayerData[i].CivObj = { 266 "codes": [ g_DefaultPlayerData[i].Civ ], 267 "grouped": false 268 }; 269 270 g_RandomCivObj = { 271 "codes": Object.keys(g_CivData).filter(civ => g_CivData[civ].SelectableInGameSetup), 272 "grouped": true, 273 "group": { "type": "none", "code": "all", "caption": translateWithContext("All Civs", "All") } 274 }; 259 275 260 276 setTimeout(displayGamestateNotifications, 1000); 261 277 } … … 267 283 { 268 284 Engine.GetGUIObjectByName("cancelGame").tooltip = Engine.HasXmppClient() ? translate("Return to the lobby.") : translate("Return to the main menu."); 269 285 270 initCivNameList();271 286 initMapTypes(); 272 287 initMapFilters(); 273 288 … … 532 547 for (let i = 0; i < g_MaxPlayers; ++i) 533 548 { 534 549 Engine.GetGUIObjectByName("playerAssignment["+i+"]").hidden = true; 535 Engine.GetGUIObjectByName("playerCiv["+i+"]").hidden = true;536 550 Engine.GetGUIObjectByName("playerTeam["+i+"]").hidden = true; 537 551 } 538 552 … … 618 632 colorPicker.list_data = g_PlayerColors.map((color, index) => index); 619 633 colorPicker.selected = -1; 620 634 colorPicker.onSelectionChange = function() { selectPlayerColor(playerSlot, this.selected); }; 621 622 Engine.GetGUIObjectByName("playerCiv["+i+"]").onSelectionChange = function() {623 if ((this.selected != -1)&&(g_GameAttributes.mapType !== "scenario"))624 g_GameAttributes.settings.PlayerData[playerSlot].Civ = this.list_data[this.selected];625 626 updateGameAttributes();627 };628 635 } 629 636 } 630 637 … … 798 805 return undefined; 799 806 } 800 807 801 /** 802 * Initialize the dropdowns containing all selectable civs (including random). 803 */ 804 function initCivNameList() 808 function setCiv(args) 805 809 { 806 let civList = Object.keys(g_CivData).filter(civ => g_CivData[civ].SelectableInGameSetup).map(civ => ({ "name": g_CivData[civ].Name, "code": civ })).sort(sortNameIgnoreCase); 807 let civListNames = [g_RandomCiv].concat(civList.map(civ => civ.name)); 808 let civListCodes = ["random"].concat(civList.map(civ => civ.code)); 809 810 for (let i = 0; i < g_MaxPlayers; ++i) 811 { 812 let civ = Engine.GetGUIObjectByName("playerCiv["+i+"]"); 813 civ.list = civListNames; 814 civ.list_data = civListCodes; 815 civ.selected = 0; 816 } 810 g_GameAttributes.settings.PlayerData[args.player].CivObj = args.civ; 811 g_RandomCultures = args.randomCultures; 812 updateGameAttributes(); 817 813 } 818 814 819 815 /** … … 909 905 if (!g_IsNetworked) 910 906 mapSettings.CheatsEnabled = true; 911 907 912 // Replace unselectable civs with random civ908 // Filter out unselectable civs 913 909 let playerData = mapSettings.PlayerData; 914 910 if (playerData && g_GameAttributes.mapType != "scenario") 915 911 for (let i in playerData) 916 if (!g_CivData[playerData[i].Civ] || !g_CivData[playerData[i].Civ].SelectableInGameSetup) 917 playerData[i].Civ = "random"; 912 { 913 if (!playerData[i].CivObj) 914 continue; 915 playerData[i].CivObj.codes = playerData[i].CivObj.codes.filter((code) => {return g_CivData[code] && g_CivData[code].SelectableInGameSetup}); 916 if (playerData[i].CivObj.codes.length === 0) 917 playerData[i].CivObj = g_RandomCivObj; 918 } 918 919 919 920 // Apply map settings 920 921 let newMapData = loadMapData(mapName); … … 953 954 954 955 playerData.forEach((pData, index) => { 955 956 pData.Color = pData.Color || g_PlayerColors[index]; 956 pData.Civ = pData.Civ || "random";957 pData.CivObj = pData.CivObj ? pData.CivObj : (pData.Civ && pData.Civ !== "random" ? { "codes": [ pData.Civ ], "grouped": false } : g_RandomCivObj) 957 958 pData.AI = pData.AI || ""; 958 959 }); 959 960 … … 1236 1237 let cultures = Object.keys(g_CivData).filter(civ => g_CivData[civ].SelectableInGameSetup).map(civ => g_CivData[civ].Culture); 1237 1238 cultures = cultures.filter((culture, index) => cultures.indexOf(culture) === index); 1238 1239 1239 // Determine random civs and botnames1240 1240 for (let i in g_GameAttributes.settings.PlayerData) 1241 1241 { 1242 // Pick a random civ of a random culture 1243 let chosenCiv = g_GameAttributes.settings.PlayerData[i].Civ || "random"; 1244 if (chosenCiv == "random") 1242 // Determine civ 1243 let civs = g_GameAttributes.settings.PlayerData[i].CivObj.codes; 1244 let chosenCiv = civs[0]; 1245 1246 if (civs.length > 1) 1245 1247 { 1246 let culture = cultures[Math.floor(Math.random() * cultures.length)]; 1247 let civs = Object.keys(g_CivData).filter(civ => g_CivData[civ].Culture == culture); 1248 if (g_RandomCultures && g_GameAttributes.settings.PlayerData[i].CivObj.group.code == "all") 1249 { 1250 let culture = cultures[Math.floor(Math.random() * cultures.length)]; 1251 let civs = Object.keys(g_CivData).filter(civ => g_CivData[civ].Culture == culture); 1252 } 1248 1253 chosenCiv = civs[Math.floor(Math.random() * civs.length)]; 1249 1254 } 1255 1250 1256 g_GameAttributes.settings.PlayerData[i].Civ = chosenCiv; 1251 1257 1252 1258 // Pick one of the available botnames for the chosen civ … … 1408 1414 let pName = Engine.GetGUIObjectByName("playerName["+i+"]"); 1409 1415 let pAssignment = Engine.GetGUIObjectByName("playerAssignment["+i+"]"); 1410 1416 let pAssignmentText = Engine.GetGUIObjectByName("playerAssignmentText["+i+"]"); 1411 let pCiv = Engine.GetGUIObjectByName("playerCiv["+i+"]");1412 1417 let pCivText = Engine.GetGUIObjectByName("playerCivText["+i+"]"); 1413 1418 let pTeam = Engine.GetGUIObjectByName("playerTeam["+i+"]"); 1414 1419 let pTeamText = Engine.GetGUIObjectByName("playerTeamText["+i+"]"); … … 1423 1428 1424 1429 let team = getSetting(pData, pDefs, "Team"); 1425 1430 let civ = getSetting(pData, pDefs, "Civ"); 1431 let civObj = getSetting(pData, pDefs, "CivObj"); 1426 1432 1427 1433 pAssignmentText.caption = pAssignment.list[0] ? pAssignment.list[Math.max(0, pAssignment.selected)] : translate("Loading..."); 1428 pCivText.caption = civ == "random" ? g_RandomCiv : (g_CivData[civ] ? g_CivData[civ].Name : "Unknown"); 1434 1435 if (civObj) 1436 { 1437 if (civObj.grouped) 1438 pCivText.caption = g_RandomCivStyle[0] + sprintf(translate("Random %(civGroup)s"), {"civGroup": civObj.group.caption }) + g_RandomCivStyle[1]; 1439 else if (civObj.codes.length > 1) 1440 pCivText.caption = g_RandomCivStyle[0] + translateWithContext("Selection from a group of civilizations", "Arbitrary Selection") + g_RandomCivStyle[1]; 1441 else 1442 pCivText.caption = (g_CivData[civObj.codes[0]] ? g_CivData[civObj.codes[0]].Name : translateWithContext("Unnamed civilization", "Unknown")); 1443 } 1444 1429 1445 pTeamText.caption = (team !== undefined && team >= 0) ? team+1 : "-"; 1430 1431 pCiv.selected = civ ? pCiv.list_data.indexOf(civ) : 0;1432 1446 pTeam.selected = team !== undefined && team >= 0 ? team+1 : 0; 1433 1447 1434 1448 hideControl("playerAssignment["+i+"]", "playerAssignmentText["+i+"]", g_IsController); 1435 hideControl("playerCiv["+i+"]", "playerCivText["+i+"]", notScenario);1436 1449 hideControl("playerTeam["+i+"]", "playerTeamText["+i+"]", notScenario); 1450 Engine.GetGUIObjectByName("playerCivButton["+i+"]").hidden = !notScenario; 1437 1451 1438 1452 // Allow host to chose player colors on non-scenario maps 1439 1453 let pColorPicker = Engine.GetGUIObjectByName("playerColorPicker["+i+"]"); … … 1735 1749 // Swap civilizations if they aren't fixed 1736 1750 if (g_GameAttributes.mapType != "scenario") 1737 1751 { 1738 [g_GameAttributes.settings.PlayerData[playerID - 1].Civ , g_GameAttributes.settings.PlayerData[newSlot].Civ] =1739 [g_GameAttributes.settings.PlayerData[newSlot].Civ , g_GameAttributes.settings.PlayerData[playerID - 1].Civ];1752 [g_GameAttributes.settings.PlayerData[playerID - 1].CivObj, g_GameAttributes.settings.PlayerData[newSlot].CivObj] = 1753 [g_GameAttributes.settings.PlayerData[newSlot].CivObj, g_GameAttributes.settings.PlayerData[playerID - 1].CivObj]; 1740 1754 } 1741 1755 } 1742 1756 … … 1746 1760 g_PlayerAssignments[guid].player = newPlayerID; 1747 1761 1748 1762 g_GameAttributes.settings.PlayerData[newSlot].AI = ""; 1763 updateGameAttributes(); 1749 1764 } 1750 1765 1751 1766 function submitChatInput() … … 1816 1831 function resetCivilizations() 1817 1832 { 1818 1833 for (let i in g_GameAttributes.settings.PlayerData) 1819 g_GameAttributes.settings.PlayerData[i].Civ = "random";1834 g_GameAttributes.settings.PlayerData[i].CivObj = g_RandomCivObj; 1820 1835 1821 1836 updateGameAttributes(); 1822 1837 } -
binaries/data/mods/public/gui/gamesetup/gamesetup.xml
72 72 size="67.5%+93 0 67.5%+109 16" 73 73 tooltip_style="onscreenToolTip" 74 74 > 75 <translatableAttribute id="tooltip">Reset any civilizations that have been selected to the default ( random)</translatableAttribute>75 <translatableAttribute id="tooltip">Reset any civilizations that have been selected to the default (Random All)</translatableAttribute> 76 76 <action on="Press">resetCivilizations();</action> 77 77 </object> 78 78 <object name="playerTeamHeading" type="text" style="ModernLabelText" size="85%+15 0 100%-15 100%"> … … 100 100 > 101 101 <translatableAttribute id="tooltip">Configure AI settings.</translatableAttribute> 102 102 </object> 103 <object name="playerCiv[n]" type="dropdown" style="ModernDropDown" size="50%+69 2 85% 30" tooltip_style="onscreenToolTip"> 104 <translatableAttribute id="tooltip">Select player's civilization.</translatableAttribute> 103 <object name="playerCivText[n]" type="text" style="ModernLabelText" size="50%+65 0 85%-16 30"/> 104 105 <object name="playerCivButton[n]" 106 type="button" 107 sprite="ModernGear" 108 sprite_over="ModernGearHover" 109 sprite_pressed="ModernGearPressed" 110 size="85%-24 4 85% 28" 111 tooltip_style="onscreenToolTip" 112 > 113 <translatableAttribute id="tooltip">Select a civilisation</translatableAttribute> 114 <action on="Press"><![CDATA[ 115 let player = this.name.slice(16, -1); 116 Engine.PushGuiPage("page_civselect.xml", { 117 "player": player, 118 "civ": g_GameAttributes.settings.PlayerData[player].CivObj, 119 "callback": "setCiv" 120 }); 121 ]]></action> 105 122 </object> 106 <object name="playerCivText[n]" type="text" style="ModernLabelText" size="50%+65 0 85% 30"/>107 123 <object name="playerTeam[n]" type="dropdown" style="ModernDropDown" size="85%+5 2 100%-5 30" tooltip_style="onscreenToolTip"> 108 124 <translatableAttribute id="tooltip">Select player's team.</translatableAttribute> 109 125 </object> 126 110 127 <object name="playerTeamText[n]" type="text" style="ModernLabelText" size="85%+5 0 100%-5 100%"/> 111 128 </object> 112 129 </repeat> 113 130 </object> 114 131 </object> 132 115 133 <object size="24 64 100%-460 358" type="image" sprite="CoverFillDark" name="playerAssignmentsPanelCover" hidden="true"/> 134 116 135 <!-- Map selection --> 117 118 136 <object size="100%-425 355 100%-285 470" name="mapTypeTooltip"> 119 137 <object type="text" style="ModernRightLabelText" size="0 0 100% 30"> 120 138 <translatableAttribute id="caption">Map Type:</translatableAttribute> -
binaries/data/mods/public/gui/page_civselect.xml
1 <?xml version="1.0" encoding="utf-8"?> 2 <page> 3 <include>common/modern/setup.xml</include> 4 <include>common/modern/styles.xml</include> 5 <include>common/modern/sprites.xml</include> 6 7 <include>common/setup.xml</include> 8 <include>common/sprite1.xml</include> 9 <include>common/styles.xml</include> 10 <include>common/common_sprites.xml</include> 11 <include>common/common_styles.xml</include> 12 13 <include>civselect/styles.xml</include> 14 <include>civselect/sprites.xml</include> 15 <include>civselect/civselect.xml</include> 16 <!-- for some reason, the setup file has to be after in 17 order to get transparency to work properly for the tooltip... --> 18 <!-- <include>civselect/setup.xml</include>--> 19 </page> -
binaries/data/mods/public/simulation/data/civs/athen.json
1 1 { 2 2 "Code":"athen", 3 "Culture":"hele", 3 "Culture":[ "helle" ], 4 "Region":[ "medit", "europe" ], 4 5 "Name":"Athenians", 5 6 "Emblem":"session/portraits/emblems/emblem_athenians.png", 6 7 "History":"As the cradle of Western civilization and the birthplace of democracy, Athens was famed as a center for the arts, learning and philosophy. The Athenians were also powerful warriors, particularly at sea. At its peak, Athens dominated a large part of the Hellenic world for several decades.", -
binaries/data/mods/public/simulation/data/civs/brit.json
1 1 { 2 2 "Code": "brit", 3 "Culture": "celt", 3 "Culture":[ "celt" ], 4 "Region":[ "europe" ], 4 5 "Name": "Britons", 5 6 "Emblem": "session/portraits/emblems/emblem_britons.png", 6 7 "History": "The Britons were the Celtic tribes of the British Isles. Using chariots, longswordsmen and powerful melee soldiers, they staged fearesome revolts against Rome to protect their customs and interests. Also, they built thousands of unique structures such as hill forts, crannogs and brochs.", -
binaries/data/mods/public/simulation/data/civs/cart.json
1 1 { 2 2 "Code": "cart", 3 "Culture": "cart", 3 "Culture":[ ], 4 "Region":[ "africa", "medit" ], 4 5 "Name": "Carthaginians", 5 6 "Emblem": "session/portraits/emblems/emblem_carthaginians.png", 6 7 "History": "Carthage, a city-state in modern-day Tunisia, was a formidable force in the western Mediterranean, eventually taking over much of North Africa and modern-day Spain in the third century B.C. The sailors of Carthage were among the fiercest contenders on the high seas, and masters of naval trade. They deployed towered War Elephants on the battlefield to fearsome effect, and had defensive walls so strong, they were never breached.", -
binaries/data/mods/public/simulation/data/civs/cultures/celt.json
1 { 2 "Name" : "Celtic Tribes", 3 "Code" : "celt", 4 "History" : "At its peak (around 200 B.C.), the massive Celtic Empire spanned from Spain to Romania and Northern Italy to Scotland; although it wasn't a true empire because the Celtic people were not united by any form of government, but only in language and various social aspects. Their lack of any cohesion was probably the largest contributing factor to their ultimate submission to Rome by 100 A.D. The other contributing factors were their lack of armor and their inability to counter the mighty legions and siege weapons of Rome.", 5 "Singular" : "Celtic" 6 } -
binaries/data/mods/public/simulation/data/civs/cultures/egypt.json
1 { 2 "Name" : "The Egyptians", 3 "Code" : "egypt", 4 "History" : "-", 5 "Singular" : "Egyptian" 6 } -
binaries/data/mods/public/simulation/data/civs/cultures/helle.json
1 { 2 "Name" : "The Hellenes", 3 "Code" : "helle", 4 "History" : "The Hellenes were a people famous today for their architecture, fighting ability, and culture. The Hellenic peoples of the Dorian, Ionian, and Aeolian tribes swept into modern day Greece from 3000 B.C. to around 1100 B.C. in successive waves that eventually supplanted the previously established cultures of Mycenae and Minoan Crete. They were most active during the period of colonization that took place in the 7th and 6th centuries B.C., the Greco-Persian Wars (499-449 B.C.), the Peloponnesian War (431-404 B.C.), and the conquests of Alexander the Great (4th Century B.C.). Their civilization would endure until their final absorption by Rome in 146 B.C.", 5 "Singular" : "Hellenic" 6 } -
binaries/data/mods/public/simulation/data/civs/cultures/indian.json
1 { 2 "Name" : "The Indians", 3 "Code" : "indian", 4 "History" : "-", 5 "Singular" : "Indian" 6 } -
binaries/data/mods/public/simulation/data/civs/cultures/rome.json
1 { 2 "Name" : "The Romans", 3 "Code" : "rome", 4 "History" : "-", 5 "Singular" : "Roman" 6 } -
binaries/data/mods/public/simulation/data/civs/cultures/succe.json
1 { 2 "Name" : "The Successors", 3 "Code" : "succe", 4 "History" : "The Successor kingdoms were carved out from the short-lived Macedonian Empire built by Philip of Macedon and his son, Alexander the Great. The chief three kingdoms were Ptolomaic Egypt, the Seleucid Empire, and the Kingdom of Macedon. Together, they helped propel the Eastern Mediterranean and Middle East into the Hellenistic Age - a time of internecine warfare and technological and cultural advancement.", 5 "Singular" : "Successor" 6 } -
binaries/data/mods/public/simulation/data/civs/gaul.json
1 1 { 2 2 "Code": "gaul", 3 "Culture": "celt", 3 "Culture":[ "celt" ], 4 "Region":[ "europe" ], 4 5 "Name": "Gauls", 5 6 "Emblem": "session/portraits/emblems/emblem_celts.png", 6 7 "History": "The Gauls were the Celtic tribes of continental Europe. Dominated by a priestly class of Druids, they featured a sophisticated culture of advanced metalworking, agriculture, trade and even road engineering. With heavy infantry and cavalry, Gallic warriors valiantly resisted Caesar's campaign of conquest and Rome's authoritarian rule.", -
binaries/data/mods/public/simulation/data/civs/grouping/culture.json
1 { 2 "Code": "culture", 3 "CivAttribute": "Culture", 4 "ListEntry": "By Culture", 5 "Folder": "cultures" 6 } -
binaries/data/mods/public/simulation/data/civs/grouping/region.json
1 { 2 "Code": "region", 3 "CivAttribute": "Region", 4 "ListEntry": "By Geographic Region", 5 "Folder": "regions" 6 } -
binaries/data/mods/public/simulation/data/civs/iber.json
1 1 { 2 2 "Code": "iber", 3 "Culture": "iber", 3 "Culture":[ ], 4 "Region":[ "europe" ], 4 5 "Name": "Iberians", 5 6 "Emblem": "session/portraits/emblems/emblem_iberians.png", 6 7 "History": "The Iberians were a people of mysterious origins and language, with a strong tradition of horsemanship and metalworking. A relatively peaceful culture, they usually fought in other's battles only as mercenaries. However, they proved tenacious when Rome sought to take their land and freedom from them, and employed pioneering guerrilla tactics and flaming javelins as they fought back.", -
binaries/data/mods/public/simulation/data/civs/mace.json
1 1 { 2 2 "Code":"mace", 3 "Culture":"hele", 3 "Culture":[ "helle", "succe" ], 4 "Region":[ "medit", "europe" ], 4 5 "Name":"Macedonians", 5 6 "Emblem":"session/portraits/emblems/emblem_macedonians.png", 6 7 "History":"Macedonia was an ancient Greek kingdom, centered in the northeastern part of the Greek peninsula. Under the leadership of Alexander the Great, Macedonian forces and allies took over most of the world they knew, including Egypt, Persia and parts of the Indian subcontinent, allowing a diffusion of Hellenic and eastern cultures for years to come.", -
binaries/data/mods/public/simulation/data/civs/maur.json
1 1 { 2 2 "Code": "maur", 3 "Culture": "maur", 3 "Culture":[ ], 4 "Region":[ "asia" ], 4 5 "Name": "Mauryans", 5 6 "Emblem": "session/portraits/emblems/emblem_mauryans.png", 6 7 "History": "Founded in 322 B.C. by Chandragupta Maurya, the Mauryan Empire was the first to rule most of the Indian subcontinent, and was one of the largest and most populous empires of antiquity. Its military featured bowmen who used the long-range bamboo longbow, fierce female warriors, chariots, and thousands of armored war elephants. Its philosophers, especially the famous Acharya Chanakya, contributed to such varied fields such as economics, religion, diplomacy, warfare, and good governance. Under the rule of Ashoka the Great, the empire saw 40 years of peace, harmony, and prosperity.", -
binaries/data/mods/public/simulation/data/civs/pers.json
1 1 { 2 2 "Code": "pers", 3 "Culture": "pers", 3 "Culture":[ ], 4 "Region":[ "medit" ], 4 5 "Name": "Persians", 5 6 "Emblem": "session/portraits/emblems/emblem_persians.png", 6 7 "History": "The Persian Empire, when ruled by the Achaemenid dynasty, was one of the greatest empires of antiquity, stretching at its zenith from the Indus Valley in the east to Greece in the west. The Persians were the pioneers of empire-building of the ancient world, successfully imposing a centralized rule over various peoples with different customs, laws, religions and languages, and building a cosmopolitan army made up of contingents from each of these nations.", -
binaries/data/mods/public/simulation/data/civs/ptol.json
1 1 { 2 2 "Code":"ptol", 3 "Culture":"ptol", 3 "Culture":[ ], 4 "Region":[ "africa" ], 4 5 "Name":"Ptolemies", 5 6 "Emblem":"session/portraits/emblems/emblem_ptolemies.png", 6 7 "History":"The Ptolemaic dynasty was a Macedonian Greek royal family which ruled the Ptolemaic Empire in Egypt during the Hellenistic period. Their rule lasted for 275 years, from 305 BC to 30 BC. They were the last dynasty of ancient Egypt.", -
binaries/data/mods/public/simulation/data/civs/regions/africa.json
1 { 2 "Name" : "Africa", 3 "Code" : "africa", 4 "History" : "-", 5 "Singular" : "African", 6 "Emblem" : "session/portraits/emblems/grouping/region_africa.png" 7 } -
binaries/data/mods/public/simulation/data/civs/regions/asia.json
1 { 2 "Name" : "Asia", 3 "Code" : "asia", 4 "History" : "-", 5 "Singular" : "Asian", 6 "Emblem" : "session/portraits/emblems/grouping/region_asia.png" 7 } -
binaries/data/mods/public/simulation/data/civs/regions/europe.json
1 { 2 "Name" : "Europe", 3 "Code" : "europe", 4 "History" : "-", 5 "Singular" : "European", 6 "Emblem" : "session/portraits/emblems/grouping/region_europe.png" 7 } -
binaries/data/mods/public/simulation/data/civs/regions/medit.json
1 { 2 "Name" : "The Mediterranean", 3 "Code" : "medit", 4 "History" : "-", 5 "Singular" : "Mediterranean", 6 "Emblem" : "session/portraits/emblems/grouping/region_medi.png" 7 } -
binaries/data/mods/public/simulation/data/civs/rome.json
1 1 { 2 2 "Code": "rome", 3 "Culture": "rome", 3 "Culture":[ ], 4 "Region":[ "medit", "europe" ], 4 5 "Name": "Romans", 5 6 "Emblem": "session/portraits/emblems/emblem_romans.png", 6 7 "History": "The Romans controlled one of the largest empires of the ancient world, stretching at its peak from southern Scotland to the Sahara Desert, and containing between 60 million and 80 million inhabitants, one quarter of the Earth's population at that time. Rome also remained one of the strongest nations on earth for almost 800 years. The Romans were the supreme builders of the ancient world, excelled at siege warfare and had an exquisite infantry and navy.", -
binaries/data/mods/public/simulation/data/civs/sele.json
1 1 { 2 2 "Code":"sele", 3 "Culture":"sele", 3 "Culture":[ "succe" ], 4 "Region":[ "medit" ], 4 5 "Name":"Seleucids", 5 6 "Emblem":"session/portraits/emblems/emblem_seleucids.png", 6 7 "History":"The Macedonian-Greek dynasty that ruled most of Alexander's former empire.", -
binaries/data/mods/public/simulation/data/civs/spart.json
1 1 { 2 2 "Code":"spart", 3 "Culture":"hele", 3 "Culture":[ "helle" ], 4 "Region":[ "medit", "europe" ], 4 5 "Name":"Spartans", 5 6 "Emblem":"session/portraits/emblems/emblem_spartans.png", 6 7 "History":"Sparta was a prominent city-state in ancient Greece, and its dominant military power on land from circa 650 B.C. Spartan culture was obsessed with military training and excellence, with rigorous training for boys beginning at age seven. Thanks to its military might, Sparta led a coalition of Greek forces during the Greco-Persian Wars, and won over Athens in the Peloponnesian Wars, though at great cost.",