├── .gitattributes ├── .gitignore ├── Dockerfile ├── LICENSE ├── README.md ├── buildEvolve.js ├── buildEvolveDebug.js ├── buildWiki.js ├── buildWikiDebug.js ├── evolve ├── evolve.css ├── evolve.js └── main.js ├── evolved-light.ico ├── evolved.ico ├── font ├── weathericons-regular-webfont.eot ├── weathericons-regular-webfont.svg ├── weathericons-regular-webfont.ttf ├── weathericons-regular-webfont.woff └── weathericons-regular-webfont.woff2 ├── index.html ├── lib ├── blocking-resource.png ├── blocking-stack.png ├── buefy.min.0.9.22.css ├── cat.png ├── copper-miner.png ├── cryptojs.min.js ├── dog.png ├── html5sortable.min.js ├── less.3.9.min.js ├── lz-string.min.js ├── mine.png ├── noise.png ├── weather-icons-wind.min.css └── weather-icons.min.css ├── package-lock.json ├── package.json ├── save.html ├── src ├── achieve.js ├── actions.js ├── arpa.js ├── civics.js ├── debug.js ├── edenic.js ├── events.js ├── evolve.less ├── functions.js ├── governor.js ├── index.js ├── industry.js ├── jobs.js ├── locale.js ├── main.js ├── portal.js ├── prod.js ├── races.js ├── resets.js ├── resources.js ├── seasons.js ├── space.js ├── tech.js ├── truepath.js ├── vars.js └── wiki │ ├── achieve.js │ ├── arpa.js │ ├── basics.js │ ├── blood.js │ ├── challenges.js │ ├── change.js │ ├── combat.js │ ├── crispr.js │ ├── events.js │ ├── faq.js │ ├── functions.js │ ├── gameplay.js │ ├── government.js │ ├── governor.js │ ├── hell.js │ ├── init.js │ ├── mechanics.js │ ├── p_res.js │ ├── perks.js │ ├── planets.js │ ├── prestige.js │ ├── projects.js │ ├── resets.js │ ├── search.js │ ├── species.js │ ├── structures.js │ ├── structuresIndex.js │ ├── tech.js │ ├── universes.js │ ├── wiki.js │ └── wiki.less ├── strings ├── checkStrings.py ├── convert zh-CN to zh-TW using opencc.py ├── readme.md ├── strings.cs-CZ.json ├── strings.de-DE.json ├── strings.es-ES.json ├── strings.im-PL.json ├── strings.it-IT.json ├── strings.json ├── strings.ko-KR.json ├── strings.pl-PL.json ├── strings.pt-BR.json ├── strings.ru-RU.json ├── strings.zh-CN.json ├── strings.zh-TW.json └── updateStrings.py ├── wiki.html └── wiki ├── wiki.css └── wiki.js /.gitattributes: -------------------------------------------------------------------------------- 1 | evolve/* -diff 2 | evolve/evolve.js diff 3 | wiki/* -diff 4 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *~ 2 | *# 3 | .* 4 | update.*.json 5 | strings/last-strings.json 6 | node_modules/* 7 | docs 8 | dist 9 | *.map -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | # Global ARGs 2 | ARG BUILDER_IMAGE=node:16.20 3 | ARG NGINX_IMAGE=nginx:1.26.1-alpine 4 | ARG WORKSPACE=/workspace 5 | ARG WEB_PATH=/usr/share/nginx/html 6 | 7 | # Builder 8 | FROM $BUILDER_IMAGE as builder 9 | ARG WORKSPACE 10 | 11 | WORKDIR $WORKSPACE 12 | COPY ./ $WORKSPACE/ 13 | RUN npm install \ 14 | && npm run build \ 15 | && rm -rf dist \ 16 | && mkdir dist \ 17 | && cp -r *.html *.ico LICENSE evolve lib font strings wiki dist 18 | 19 | # Web server 20 | FROM $NGINX_IMAGE 21 | ARG WORKSPACE 22 | ARG WEB_PATH 23 | 24 | COPY --from=builder $WORKSPACE/dist $WEB_PATH 25 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Mozilla Public License Version 2.0 2 | ================================== 3 | 4 | 1. Definitions 5 | -------------- 6 | 7 | 1.1. "Contributor" 8 | means each individual or legal entity that creates, contributes to 9 | the creation of, or owns Covered Software. 10 | 11 | 1.2. "Contributor Version" 12 | means the combination of the Contributions of others (if any) used 13 | by a Contributor and that particular Contributor's Contribution. 14 | 15 | 1.3. "Contribution" 16 | means Covered Software of a particular Contributor. 17 | 18 | 1.4. "Covered Software" 19 | means Source Code Form to which the initial Contributor has attached 20 | the notice in Exhibit A, the Executable Form of such Source Code 21 | Form, and Modifications of such Source Code Form, in each case 22 | including portions thereof. 23 | 24 | 1.5. "Incompatible With Secondary Licenses" 25 | means 26 | 27 | (a) that the initial Contributor has attached the notice described 28 | in Exhibit B to the Covered Software; or 29 | 30 | (b) that the Covered Software was made available under the terms of 31 | version 1.1 or earlier of the License, but not also under the 32 | terms of a Secondary License. 33 | 34 | 1.6. "Executable Form" 35 | means any form of the work other than Source Code Form. 36 | 37 | 1.7. "Larger Work" 38 | means a work that combines Covered Software with other material, in 39 | a separate file or files, that is not Covered Software. 40 | 41 | 1.8. "License" 42 | means this document. 43 | 44 | 1.9. "Licensable" 45 | means having the right to grant, to the maximum extent possible, 46 | whether at the time of the initial grant or subsequently, any and 47 | all of the rights conveyed by this License. 48 | 49 | 1.10. "Modifications" 50 | means any of the following: 51 | 52 | (a) any file in Source Code Form that results from an addition to, 53 | deletion from, or modification of the contents of Covered 54 | Software; or 55 | 56 | (b) any new file in Source Code Form that contains any Covered 57 | Software. 58 | 59 | 1.11. "Patent Claims" of a Contributor 60 | means any patent claim(s), including without limitation, method, 61 | process, and apparatus claims, in any patent Licensable by such 62 | Contributor that would be infringed, but for the grant of the 63 | License, by the making, using, selling, offering for sale, having 64 | made, import, or transfer of either its Contributions or its 65 | Contributor Version. 66 | 67 | 1.12. "Secondary License" 68 | means either the GNU General Public License, Version 2.0, the GNU 69 | Lesser General Public License, Version 2.1, the GNU Affero General 70 | Public License, Version 3.0, or any later versions of those 71 | licenses. 72 | 73 | 1.13. "Source Code Form" 74 | means the form of the work preferred for making modifications. 75 | 76 | 1.14. "You" (or "Your") 77 | means an individual or a legal entity exercising rights under this 78 | License. For legal entities, "You" includes any entity that 79 | controls, is controlled by, or is under common control with You. For 80 | purposes of this definition, "control" means (a) the power, direct 81 | or indirect, to cause the direction or management of such entity, 82 | whether by contract or otherwise, or (b) ownership of more than 83 | fifty percent (50%) of the outstanding shares or beneficial 84 | ownership of such entity. 85 | 86 | 2. License Grants and Conditions 87 | -------------------------------- 88 | 89 | 2.1. Grants 90 | 91 | Each Contributor hereby grants You a world-wide, royalty-free, 92 | non-exclusive license: 93 | 94 | (a) under intellectual property rights (other than patent or trademark) 95 | Licensable by such Contributor to use, reproduce, make available, 96 | modify, display, perform, distribute, and otherwise exploit its 97 | Contributions, either on an unmodified basis, with Modifications, or 98 | as part of a Larger Work; and 99 | 100 | (b) under Patent Claims of such Contributor to make, use, sell, offer 101 | for sale, have made, import, and otherwise transfer either its 102 | Contributions or its Contributor Version. 103 | 104 | 2.2. Effective Date 105 | 106 | The licenses granted in Section 2.1 with respect to any Contribution 107 | become effective for each Contribution on the date the Contributor first 108 | distributes such Contribution. 109 | 110 | 2.3. Limitations on Grant Scope 111 | 112 | The licenses granted in this Section 2 are the only rights granted under 113 | this License. No additional rights or licenses will be implied from the 114 | distribution or licensing of Covered Software under this License. 115 | Notwithstanding Section 2.1(b) above, no patent license is granted by a 116 | Contributor: 117 | 118 | (a) for any code that a Contributor has removed from Covered Software; 119 | or 120 | 121 | (b) for infringements caused by: (i) Your and any other third party's 122 | modifications of Covered Software, or (ii) the combination of its 123 | Contributions with other software (except as part of its Contributor 124 | Version); or 125 | 126 | (c) under Patent Claims infringed by Covered Software in the absence of 127 | its Contributions. 128 | 129 | This License does not grant any rights in the trademarks, service marks, 130 | or logos of any Contributor (except as may be necessary to comply with 131 | the notice requirements in Section 3.4). 132 | 133 | 2.4. Subsequent Licenses 134 | 135 | No Contributor makes additional grants as a result of Your choice to 136 | distribute the Covered Software under a subsequent version of this 137 | License (see Section 10.2) or under the terms of a Secondary License (if 138 | permitted under the terms of Section 3.3). 139 | 140 | 2.5. Representation 141 | 142 | Each Contributor represents that the Contributor believes its 143 | Contributions are its original creation(s) or it has sufficient rights 144 | to grant the rights to its Contributions conveyed by this License. 145 | 146 | 2.6. Fair Use 147 | 148 | This License is not intended to limit any rights You have under 149 | applicable copyright doctrines of fair use, fair dealing, or other 150 | equivalents. 151 | 152 | 2.7. Conditions 153 | 154 | Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted 155 | in Section 2.1. 156 | 157 | 3. Responsibilities 158 | ------------------- 159 | 160 | 3.1. Distribution of Source Form 161 | 162 | All distribution of Covered Software in Source Code Form, including any 163 | Modifications that You create or to which You contribute, must be under 164 | the terms of this License. You must inform recipients that the Source 165 | Code Form of the Covered Software is governed by the terms of this 166 | License, and how they can obtain a copy of this License. You may not 167 | attempt to alter or restrict the recipients' rights in the Source Code 168 | Form. 169 | 170 | 3.2. Distribution of Executable Form 171 | 172 | If You distribute Covered Software in Executable Form then: 173 | 174 | (a) such Covered Software must also be made available in Source Code 175 | Form, as described in Section 3.1, and You must inform recipients of 176 | the Executable Form how they can obtain a copy of such Source Code 177 | Form by reasonable means in a timely manner, at a charge no more 178 | than the cost of distribution to the recipient; and 179 | 180 | (b) You may distribute such Executable Form under the terms of this 181 | License, or sublicense it under different terms, provided that the 182 | license for the Executable Form does not attempt to limit or alter 183 | the recipients' rights in the Source Code Form under this License. 184 | 185 | 3.3. Distribution of a Larger Work 186 | 187 | You may create and distribute a Larger Work under terms of Your choice, 188 | provided that You also comply with the requirements of this License for 189 | the Covered Software. If the Larger Work is a combination of Covered 190 | Software with a work governed by one or more Secondary Licenses, and the 191 | Covered Software is not Incompatible With Secondary Licenses, this 192 | License permits You to additionally distribute such Covered Software 193 | under the terms of such Secondary License(s), so that the recipient of 194 | the Larger Work may, at their option, further distribute the Covered 195 | Software under the terms of either this License or such Secondary 196 | License(s). 197 | 198 | 3.4. Notices 199 | 200 | You may not remove or alter the substance of any license notices 201 | (including copyright notices, patent notices, disclaimers of warranty, 202 | or limitations of liability) contained within the Source Code Form of 203 | the Covered Software, except that You may alter any license notices to 204 | the extent required to remedy known factual inaccuracies. 205 | 206 | 3.5. Application of Additional Terms 207 | 208 | You may choose to offer, and to charge a fee for, warranty, support, 209 | indemnity or liability obligations to one or more recipients of Covered 210 | Software. However, You may do so only on Your own behalf, and not on 211 | behalf of any Contributor. You must make it absolutely clear that any 212 | such warranty, support, indemnity, or liability obligation is offered by 213 | You alone, and You hereby agree to indemnify every Contributor for any 214 | liability incurred by such Contributor as a result of warranty, support, 215 | indemnity or liability terms You offer. You may include additional 216 | disclaimers of warranty and limitations of liability specific to any 217 | jurisdiction. 218 | 219 | 4. Inability to Comply Due to Statute or Regulation 220 | --------------------------------------------------- 221 | 222 | If it is impossible for You to comply with any of the terms of this 223 | License with respect to some or all of the Covered Software due to 224 | statute, judicial order, or regulation then You must: (a) comply with 225 | the terms of this License to the maximum extent possible; and (b) 226 | describe the limitations and the code they affect. Such description must 227 | be placed in a text file included with all distributions of the Covered 228 | Software under this License. Except to the extent prohibited by statute 229 | or regulation, such description must be sufficiently detailed for a 230 | recipient of ordinary skill to be able to understand it. 231 | 232 | 5. Termination 233 | -------------- 234 | 235 | 5.1. The rights granted under this License will terminate automatically 236 | if You fail to comply with any of its terms. However, if You become 237 | compliant, then the rights granted under this License from a particular 238 | Contributor are reinstated (a) provisionally, unless and until such 239 | Contributor explicitly and finally terminates Your grants, and (b) on an 240 | ongoing basis, if such Contributor fails to notify You of the 241 | non-compliance by some reasonable means prior to 60 days after You have 242 | come back into compliance. Moreover, Your grants from a particular 243 | Contributor are reinstated on an ongoing basis if such Contributor 244 | notifies You of the non-compliance by some reasonable means, this is the 245 | first time You have received notice of non-compliance with this License 246 | from such Contributor, and You become compliant prior to 30 days after 247 | Your receipt of the notice. 248 | 249 | 5.2. If You initiate litigation against any entity by asserting a patent 250 | infringement claim (excluding declaratory judgment actions, 251 | counter-claims, and cross-claims) alleging that a Contributor Version 252 | directly or indirectly infringes any patent, then the rights granted to 253 | You by any and all Contributors for the Covered Software under Section 254 | 2.1 of this License shall terminate. 255 | 256 | 5.3. In the event of termination under Sections 5.1 or 5.2 above, all 257 | end user license agreements (excluding distributors and resellers) which 258 | have been validly granted by You or Your distributors under this License 259 | prior to termination shall survive termination. 260 | 261 | ************************************************************************ 262 | * * 263 | * 6. Disclaimer of Warranty * 264 | * ------------------------- * 265 | * * 266 | * Covered Software is provided under this License on an "as is" * 267 | * basis, without warranty of any kind, either expressed, implied, or * 268 | * statutory, including, without limitation, warranties that the * 269 | * Covered Software is free of defects, merchantable, fit for a * 270 | * particular purpose or non-infringing. The entire risk as to the * 271 | * quality and performance of the Covered Software is with You. * 272 | * Should any Covered Software prove defective in any respect, You * 273 | * (not any Contributor) assume the cost of any necessary servicing, * 274 | * repair, or correction. This disclaimer of warranty constitutes an * 275 | * essential part of this License. No use of any Covered Software is * 276 | * authorized under this License except under this disclaimer. * 277 | * * 278 | ************************************************************************ 279 | 280 | ************************************************************************ 281 | * * 282 | * 7. Limitation of Liability * 283 | * -------------------------- * 284 | * * 285 | * Under no circumstances and under no legal theory, whether tort * 286 | * (including negligence), contract, or otherwise, shall any * 287 | * Contributor, or anyone who distributes Covered Software as * 288 | * permitted above, be liable to You for any direct, indirect, * 289 | * special, incidental, or consequential damages of any character * 290 | * including, without limitation, damages for lost profits, loss of * 291 | * goodwill, work stoppage, computer failure or malfunction, or any * 292 | * and all other commercial damages or losses, even if such party * 293 | * shall have been informed of the possibility of such damages. This * 294 | * limitation of liability shall not apply to liability for death or * 295 | * personal injury resulting from such party's negligence to the * 296 | * extent applicable law prohibits such limitation. Some * 297 | * jurisdictions do not allow the exclusion or limitation of * 298 | * incidental or consequential damages, so this exclusion and * 299 | * limitation may not apply to You. * 300 | * * 301 | ************************************************************************ 302 | 303 | 8. Litigation 304 | ------------- 305 | 306 | Any litigation relating to this License may be brought only in the 307 | courts of a jurisdiction where the defendant maintains its principal 308 | place of business and such litigation shall be governed by laws of that 309 | jurisdiction, without reference to its conflict-of-law provisions. 310 | Nothing in this Section shall prevent a party's ability to bring 311 | cross-claims or counter-claims. 312 | 313 | 9. Miscellaneous 314 | ---------------- 315 | 316 | This License represents the complete agreement concerning the subject 317 | matter hereof. If any provision of this License is held to be 318 | unenforceable, such provision shall be reformed only to the extent 319 | necessary to make it enforceable. Any law or regulation which provides 320 | that the language of a contract shall be construed against the drafter 321 | shall not be used to construe this License against a Contributor. 322 | 323 | 10. Versions of the License 324 | --------------------------- 325 | 326 | 10.1. New Versions 327 | 328 | Mozilla Foundation is the license steward. Except as provided in Section 329 | 10.3, no one other than the license steward has the right to modify or 330 | publish new versions of this License. Each version will be given a 331 | distinguishing version number. 332 | 333 | 10.2. Effect of New Versions 334 | 335 | You may distribute the Covered Software under the terms of the version 336 | of the License under which You originally received the Covered Software, 337 | or under the terms of any subsequent version published by the license 338 | steward. 339 | 340 | 10.3. Modified Versions 341 | 342 | If you create software not governed by this License, and you want to 343 | create a new license for such software, you may create and use a 344 | modified version of this License if you rename the license and remove 345 | any references to the name of the license steward (except to note that 346 | such modified license differs from this License). 347 | 348 | 10.4. Distributing Source Code Form that is Incompatible With Secondary 349 | Licenses 350 | 351 | If You choose to distribute Source Code Form that is Incompatible With 352 | Secondary Licenses under the terms of this version of the License, the 353 | notice described in Exhibit B of this License must be attached. 354 | 355 | Exhibit A - Source Code Form License Notice 356 | ------------------------------------------- 357 | 358 | This Source Code Form is subject to the terms of the Mozilla Public 359 | License, v. 2.0. If a copy of the MPL was not distributed with this 360 | file, You can obtain one at http://mozilla.org/MPL/2.0/. 361 | 362 | If it is not possible or desirable to put the notice in a particular 363 | file, then You may include the notice in a location (such as a LICENSE 364 | file in a relevant directory) where a recipient would be likely to look 365 | for such a notice. 366 | 367 | You may add additional accurate notices of copyright ownership. 368 | 369 | Exhibit B - "Incompatible With Secondary Licenses" Notice 370 | --------------------------------------------------------- 371 | 372 | This Source Code Form is "Incompatible With Secondary Licenses", as 373 | defined by the Mozilla Public License, v. 2.0. 374 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Evolve 2 | 3 | ## Play 4 | 5 | https://pmotschmann.github.io/Evolve/ 6 | 7 | ## About 8 | 9 | An incremental game about evolving a civilization from primordial ooze into a space faring empire. 10 | Evolve combines elements of a clicker with an idler and has lots of micromanagement. 11 | 12 | What will you evolve into? 13 | 14 | ## Submitting Issues 15 | If you think you have discovered a bug or have some other issue with the game then you can open an issue here on Github. 16 | Please do not open Github issues to ask gameplay questions, use Reddit or Discord for that. 17 | Links for both can be found in the footer of the game. 18 | 19 | ## Contributing a Language file 20 | If you are interested in a contributing a new language for Evolve the process is fairly straight forward (although a bit tedious). 21 | 22 | Make a copy of strings/strings.json and name the copy as strings/strings.\.json (EX: strings.es_US.json). The locale format is the language alpha-2 code joined with the country alpha-2 code. 23 | 24 | The strings are stored in a json format and will look like this: 25 | ``` 26 | "job_farmer_desc": "Farmers create food to feed your population. Each farmer generates %0 food per second.", 27 | ``` 28 | If you are unfamiliar with json the first part is a **key** and cannot be altered, **do not translate or modify the key in any way**. The second part is the string to be translated. Many game strings use **tokens** (**%0**, **%1**, **%2**, etc) to represent game values, as such these tokens must remain in the final translated string. Their position can be moved accordingly, the number represents a specific value and not its position in the string. 29 | 30 | To enable your language translation in the game you must add it to the locales constant in locale.js (bottom of the file). 31 | 32 | Once you feel your translation file is ready send a pull request with it to the Evolve main branch. 33 | 34 | 35 | ## Contributing to the game 36 | Bug fixes, additional translations, themes, or UI improvements can simply be submitted as pull requests; once reviewed and accepted they will be merged into the main game branch. If you want to contribute a new feature it can not arbitrarily make something easier without making something else harder. If your new feature idea simply makes the game easier it will not be accepted. 37 | 38 | All pull requests should be based off current dev branch. 39 | The dev branch is either master or named after its version number. 40 | Please check the current game version and what branches are available before contributing. 41 | Pull requests should not contain the JS/CSS files generated by the build. 42 | 43 | ## CSS Changes 44 | Evolve uses LESS to build its CSS, you can not just edit the minified CSS file. You must instead edit src/evolve.less then use the less compiler to rebuild the CSS file. 45 | 46 | ## Build Commands 47 | Assuming you configured your build environment correctly the game can be built, deployed to GitHub Pages or launched using 48 | ``` 49 | # Builds everything on Linux 50 | npm run build 51 | # Builds everything on Windows 52 | npm run build-win 53 | # Builds the game bundle 54 | npm run evolve 55 | # Builds the CSS file for the game on Linux 56 | npm run evolve-less 57 | # Builds the CSS file for the game on Windows 58 | npm run evolve-less-win 59 | # Builds the wiki bundle 60 | npm run wiki 61 | # Builds the Wiki CSS file on Linux 62 | npm run wiki-less 63 | # Builds the Wiki CSS file on Windows 64 | npm run wiki-less-win 65 | # Launches the game server locally on localhost:4400 66 | npm run serve 67 | # Deploys the game to GitHub Pages on Linux (requires forking) 68 | npm run deploy 69 | # Deploys the game to GitHub Pages on Windows (requires forking) 70 | npm run deploy-win 71 | ``` 72 | 73 | ## Docker 74 | If you already have a Docker environment set up and want to run an evolve server using Docker, you can execute the following command to build a Docker image for the evolve server. 75 | 76 | ``` 77 | # Build evolve server image 78 | docker build . -t evolve 79 | 80 | # Run evolve server. Default address: http://localhost:8080/ 81 | docker run --name evolve -p 8080:80 -d evolve 82 | ``` 83 | -------------------------------------------------------------------------------- /buildEvolve.js: -------------------------------------------------------------------------------- 1 | require("esbuild") 2 | .build({ 3 | logLevel: "info", 4 | entryPoints: ["./src/main.js"], 5 | bundle: true, 6 | minify: true, 7 | outfile: "evolve/main.js", 8 | }) 9 | .catch(() => process.exit(1)); 10 | -------------------------------------------------------------------------------- /buildEvolveDebug.js: -------------------------------------------------------------------------------- 1 | require("esbuild") 2 | .build({ 3 | logLevel: "debug", 4 | entryPoints: ["./src/main.js"], 5 | bundle: true, 6 | minify: false, 7 | sourcemap : true, 8 | outfile: "evolve/main.js", 9 | }) 10 | .catch(() => process.exit(1)); 11 | -------------------------------------------------------------------------------- /buildWiki.js: -------------------------------------------------------------------------------- 1 | require("esbuild") 2 | .build({ 3 | logLevel: "info", 4 | entryPoints: ["./src/wiki/wiki.js"], 5 | bundle: true, 6 | minify: true, 7 | outfile: "wiki/wiki.js", 8 | }) 9 | .catch(() => process.exit(1)); 10 | -------------------------------------------------------------------------------- /buildWikiDebug.js: -------------------------------------------------------------------------------- 1 | require("esbuild") 2 | .build({ 3 | logLevel: "debug", 4 | entryPoints: ["./src/wiki/wiki.js"], 5 | bundle: true, 6 | minify: false, 7 | sourcemap : true, 8 | outfile: "wiki/wiki.js", 9 | }) 10 | .catch(() => process.exit(1)); 11 | -------------------------------------------------------------------------------- /evolve/evolve.js: -------------------------------------------------------------------------------- 1 | const loopN = 80; // Store 80 samples of jitter history (10-20 seconds) 2 | var loopInterval; // Target fastLoop interval with millisecond precision 3 | var loopHist; // Sliding window of recent timer skew history 4 | var loopIdx = 0; // Next index in loopHist[] 5 | var loopSkew; // Sum of all entries in loopHist[] 6 | var loopTargTs; // Target time for next timer to fire 7 | var timerId; // For clearing the timer 8 | var loopRun; // Safety guarantee against race condition in timer clear (possibly unnecessary) 9 | 10 | self.addEventListener('message', function(e){ 11 | const data = e.data; 12 | switch (data.loop) { 13 | case 'start': 14 | loopInterval = data.period; 15 | loopHist = new Array(loopN).fill(0); 16 | loopSkew = 0; 17 | loopRun = true; 18 | loopTargTs = performance.now() + loopInterval; 19 | timerId = setTimeout(lowDriftTimer, loopInterval); 20 | break; 21 | case 'clear': 22 | loopRun = false; 23 | clearTimeout(timerId); 24 | break; 25 | }; 26 | }, false); 27 | 28 | function lowDriftTimer(){ 29 | const ts = performance.now(); 30 | const jitter = ts - loopTargTs; 31 | let periods = 1; 32 | 33 | if (jitter > loopInterval){ 34 | // High error mode: run multiple fastLoop calls at once 35 | periods += Math.floor(jitter / loopInterval); 36 | 37 | // Slowly discard skew history in case it's related to the cause of high skew 38 | loopSkew -= loopHist[loopIdx]; 39 | loopHist[loopIdx] = 0; 40 | 41 | // Create new baseline timestamp due to high drift 42 | loopTargTs = ts + loopInterval; 43 | } 44 | else { 45 | // Accumulate skew history normally 46 | loopSkew += jitter - loopHist[loopIdx]; 47 | loopHist[loopIdx] = jitter; 48 | 49 | // Use existing baseline timestamp 50 | loopTargTs += loopInterval; 51 | } 52 | 53 | // Cancel out recent skew to center jitter near zero 54 | const timeout = (loopTargTs - ts) - (loopSkew / loopN); 55 | 56 | // Paranoid: in case clearTimeout does not take effect before the event loop calls 57 | // the scheduled timeout for lowDriftTimer, these timeouts will continue forever 58 | if (loopRun){ 59 | timerId = setTimeout(lowDriftTimer, timeout); 60 | } 61 | 62 | // Not wrapped in if(loopRun): the game loop has separate pause state tracking 63 | self.postMessage({ loop: 'main', periods: periods }); 64 | 65 | if (++loopIdx === loopN){ loopIdx = 0; } 66 | } 67 | -------------------------------------------------------------------------------- /evolved-light.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pmotschmann/Evolve/9aff5f2add288aa11fd13b7f45c5cf1b8a79b1ae/evolved-light.ico -------------------------------------------------------------------------------- /evolved.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pmotschmann/Evolve/9aff5f2add288aa11fd13b7f45c5cf1b8a79b1ae/evolved.ico -------------------------------------------------------------------------------- /font/weathericons-regular-webfont.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pmotschmann/Evolve/9aff5f2add288aa11fd13b7f45c5cf1b8a79b1ae/font/weathericons-regular-webfont.eot -------------------------------------------------------------------------------- /font/weathericons-regular-webfont.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pmotschmann/Evolve/9aff5f2add288aa11fd13b7f45c5cf1b8a79b1ae/font/weathericons-regular-webfont.ttf -------------------------------------------------------------------------------- /font/weathericons-regular-webfont.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pmotschmann/Evolve/9aff5f2add288aa11fd13b7f45c5cf1b8a79b1ae/font/weathericons-regular-webfont.woff -------------------------------------------------------------------------------- /font/weathericons-regular-webfont.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pmotschmann/Evolve/9aff5f2add288aa11fd13b7f45c5cf1b8a79b1ae/font/weathericons-regular-webfont.woff2 -------------------------------------------------------------------------------- /index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Evolve 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 54 |
55 | 56 | 57 | 63 | 64 | 65 | -------------------------------------------------------------------------------- /lib/blocking-resource.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pmotschmann/Evolve/9aff5f2add288aa11fd13b7f45c5cf1b8a79b1ae/lib/blocking-resource.png -------------------------------------------------------------------------------- /lib/blocking-stack.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pmotschmann/Evolve/9aff5f2add288aa11fd13b7f45c5cf1b8a79b1ae/lib/blocking-stack.png -------------------------------------------------------------------------------- /lib/cat.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pmotschmann/Evolve/9aff5f2add288aa11fd13b7f45c5cf1b8a79b1ae/lib/cat.png -------------------------------------------------------------------------------- /lib/copper-miner.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pmotschmann/Evolve/9aff5f2add288aa11fd13b7f45c5cf1b8a79b1ae/lib/copper-miner.png -------------------------------------------------------------------------------- /lib/dog.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pmotschmann/Evolve/9aff5f2add288aa11fd13b7f45c5cf1b8a79b1ae/lib/dog.png -------------------------------------------------------------------------------- /lib/html5sortable.min.js: -------------------------------------------------------------------------------- 1 | var sortable=function(){"use strict";function c(e,t,n){if(void 0===n)return e&&e.h5s&&e.h5s.data&&e.h5s.data[t];e.h5s=e.h5s||{},e.h5s.data=e.h5s.data||{},e.h5s.data[t]=n}var d=function(e,t){if(!(e instanceof NodeList||e instanceof HTMLCollection||e instanceof Array))throw new Error("You must provide a nodeList/HTMLCollection/Array of elements to be filtered.");return"string"!=typeof t?Array.from(e):Array.from(e).filter(function(e){return 1===e.nodeType&&e.matches(t)})},u=new Map,t=function(){function e(){this._config=new Map,this._placeholder=void 0,this._data=new Map}return Object.defineProperty(e.prototype,"config",{get:function(){var n={};return this._config.forEach(function(e,t){n[t]=e}),n},set:function(e){if("object"!=typeof e)throw new Error("You must provide a valid configuration object to the config setter.");var t=Object.assign({},e);this._config=new Map(Object.entries(t))},enumerable:!0,configurable:!0}),e.prototype.setConfig=function(e,t){if(!this._config.has(e))throw new Error("Trying to set invalid configuration item: "+e);this._config.set(e,t)},e.prototype.getConfig=function(e){if(!this._config.has(e))throw new Error("Invalid configuration item requested: "+e);return this._config.get(e)},Object.defineProperty(e.prototype,"placeholder",{get:function(){return this._placeholder},set:function(e){if(!(e instanceof HTMLElement)&&null!==e)throw new Error("A placeholder must be an html element or null.");this._placeholder=e},enumerable:!0,configurable:!0}),e.prototype.setData=function(e,t){if("string"!=typeof e)throw new Error("The key must be a string.");this._data.set(e,t)},e.prototype.getData=function(e){if("string"!=typeof e)throw new Error("The key must be a string.");return this._data.get(e)},e.prototype.deleteData=function(e){if("string"!=typeof e)throw new Error("The key must be a string.");return this._data.delete(e)},e}(),p=function(e){if(!(e instanceof HTMLElement))throw new Error("Please provide a sortable to the store function.");return u.has(e)||u.set(e,new t),u.get(e)};function a(e,t,n){if(e instanceof Array)for(var r=0;r':t=document.createElement("div")),"string"==typeof n&&(r=t.classList).add.apply(r,n.split(" ")),t},b=function(e){if(!(e instanceof HTMLElement))throw new Error("You must provide a valid dom element");var n=window.getComputedStyle(e);return["height","padding-top","padding-bottom"].map(function(e){var t=parseInt(n.getPropertyValue(e),10);return isNaN(t)?0:t}).reduce(function(e,t){return e+t})},s=function(e,t){if(!(e instanceof Array))throw new Error("You must provide a Array of HTMLElements to be filtered.");return"string"!=typeof t?e:e.filter(function(e){return e.querySelector(t)instanceof HTMLElement||e.shadowRoot&&e.shadowRoot.querySelector(t)instanceof HTMLElement}).map(function(e){return e.querySelector(t)||e.shadowRoot&&e.shadowRoot.querySelector(t)})},T=function(e){return e.composedPath&&e.composedPath()[0]||e.target},f=function(e,t,n){return{element:e,posX:n.pageX-t.left,posY:n.pageY-t.top}},L=function(e,t,n){if(!(e instanceof Event))throw new Error("setDragImage requires a DragEvent as the first argument.");if(!(t instanceof HTMLElement))throw new Error("setDragImage requires the dragged element as the second argument.");if(n||(n=f),e.dataTransfer&&e.dataTransfer.setDragImage){var r=n(t,m(t),e);if(!(r.element instanceof HTMLElement)||"number"!=typeof r.posX||"number"!=typeof r.posY)throw new Error("The customDragImage function you provided must return and object with the properties element[string], posX[integer], posY[integer].");e.dataTransfer.effectAllowed="copyMove",e.dataTransfer.setData("text/plain",T(e).id),e.dataTransfer.setDragImage(r.element,r.posX,r.posY)}},C=function(e,t){if(!0===e.isSortable){var n=p(e).getConfig("acceptFrom");if(null!==n&&!1!==n&&"string"!=typeof n)throw new Error('HTML5Sortable: Wrong argument, "acceptFrom" must be "null", "false", or a valid selector string.');if(null!==n)return!1!==n&&0=parseInt(r.maxItems)&&D.parentElement!==n||(e.preventDefault(),e.stopPropagation(),e.dataTransfer.dropEffect=!0===p(n).getConfig("copy")?"copy":"move",o(n,t,e.pageY))}};a(t.concat(s),"dragover",r),a(t.concat(s),"dragenter",r)}),e)}return X.destroy=function(e){var t,n,r,o;n=c(t=e,"opts")||{},r=d(t.children,n.items),o=s(r,n.handle),i(t,"dragover"),i(t,"dragenter"),i(t,"drop"),F(t),i(o,"mousedown"),P(r),N(r)},X.enable=function(e){z(e)},X.disable=function(e){var t,n,r,o;n=c(t=e,"opts"),r=d(t.children,n.items),o=s(r,n.handle),l(t,"aria-dropeffect","none"),c(t,"_disabled","true"),l(o,"draggable","false"),i(o,"mousedown")},X.__testing={_data:c,_removeItemEvents:P,_removeItemData:N,_removeSortableData:F},X}(); 2 | //# sourceMappingURL=html5sortable.min.js.map 3 | -------------------------------------------------------------------------------- /lib/lz-string.min.js: -------------------------------------------------------------------------------- 1 | var LZString=function(){function o(o,r){if(!t[o]){t[o]={};for(var n=0;ne;e++){var s=r.charCodeAt(e);n[2*e]=s>>>8,n[2*e+1]=s%256}return n},decompressFromUint8Array:function(o){if(null===o||void 0===o)return i.decompress(o);for(var n=new Array(o.length/2),e=0,t=n.length;t>e;e++)n[e]=256*o[2*e]+o[2*e+1];var s=[];return n.forEach(function(o){s.push(r(o))}),i.decompress(s.join(""))},compressToEncodedURIComponent:function(o){return null==o?"":i._compress(o,6,function(o){return e.charAt(o)})},decompressFromEncodedURIComponent:function(r){return null==r?"":""==r?null:(r=r.replace(/ /g,"+"),i._decompress(r.length,32,function(n){return o(e,r.charAt(n))}))},compress:function(o){return i._compress(o,16,function(o){return r(o)})},_compress:function(o,r,n){if(null==o)return"";var e,t,i,s={},p={},u="",c="",a="",l=2,f=3,h=2,d=[],m=0,v=0;for(i=0;ie;e++)m<<=1,v==r-1?(v=0,d.push(n(m)),m=0):v++;for(t=a.charCodeAt(0),e=0;8>e;e++)m=m<<1|1&t,v==r-1?(v=0,d.push(n(m)),m=0):v++,t>>=1}else{for(t=1,e=0;h>e;e++)m=m<<1|t,v==r-1?(v=0,d.push(n(m)),m=0):v++,t=0;for(t=a.charCodeAt(0),e=0;16>e;e++)m=m<<1|1&t,v==r-1?(v=0,d.push(n(m)),m=0):v++,t>>=1}l--,0==l&&(l=Math.pow(2,h),h++),delete p[a]}else for(t=s[a],e=0;h>e;e++)m=m<<1|1&t,v==r-1?(v=0,d.push(n(m)),m=0):v++,t>>=1;l--,0==l&&(l=Math.pow(2,h),h++),s[c]=f++,a=String(u)}if(""!==a){if(Object.prototype.hasOwnProperty.call(p,a)){if(a.charCodeAt(0)<256){for(e=0;h>e;e++)m<<=1,v==r-1?(v=0,d.push(n(m)),m=0):v++;for(t=a.charCodeAt(0),e=0;8>e;e++)m=m<<1|1&t,v==r-1?(v=0,d.push(n(m)),m=0):v++,t>>=1}else{for(t=1,e=0;h>e;e++)m=m<<1|t,v==r-1?(v=0,d.push(n(m)),m=0):v++,t=0;for(t=a.charCodeAt(0),e=0;16>e;e++)m=m<<1|1&t,v==r-1?(v=0,d.push(n(m)),m=0):v++,t>>=1}l--,0==l&&(l=Math.pow(2,h),h++),delete p[a]}else for(t=s[a],e=0;h>e;e++)m=m<<1|1&t,v==r-1?(v=0,d.push(n(m)),m=0):v++,t>>=1;l--,0==l&&(l=Math.pow(2,h),h++)}for(t=2,e=0;h>e;e++)m=m<<1|1&t,v==r-1?(v=0,d.push(n(m)),m=0):v++,t>>=1;for(;;){if(m<<=1,v==r-1){d.push(n(m));break}v++}return d.join("")},decompress:function(o){return null==o?"":""==o?null:i._decompress(o.length,32768,function(r){return o.charCodeAt(r)})},_decompress:function(o,n,e){var t,i,s,p,u,c,a,l,f=[],h=4,d=4,m=3,v="",w=[],A={val:e(0),position:n,index:1};for(i=0;3>i;i+=1)f[i]=i;for(p=0,c=Math.pow(2,2),a=1;a!=c;)u=A.val&A.position,A.position>>=1,0==A.position&&(A.position=n,A.val=e(A.index++)),p|=(u>0?1:0)*a,a<<=1;switch(t=p){case 0:for(p=0,c=Math.pow(2,8),a=1;a!=c;)u=A.val&A.position,A.position>>=1,0==A.position&&(A.position=n,A.val=e(A.index++)),p|=(u>0?1:0)*a,a<<=1;l=r(p);break;case 1:for(p=0,c=Math.pow(2,16),a=1;a!=c;)u=A.val&A.position,A.position>>=1,0==A.position&&(A.position=n,A.val=e(A.index++)),p|=(u>0?1:0)*a,a<<=1;l=r(p);break;case 2:return""}for(f[3]=l,s=l,w.push(l);;){if(A.index>o)return"";for(p=0,c=Math.pow(2,m),a=1;a!=c;)u=A.val&A.position,A.position>>=1,0==A.position&&(A.position=n,A.val=e(A.index++)),p|=(u>0?1:0)*a,a<<=1;switch(l=p){case 0:for(p=0,c=Math.pow(2,8),a=1;a!=c;)u=A.val&A.position,A.position>>=1,0==A.position&&(A.position=n,A.val=e(A.index++)),p|=(u>0?1:0)*a,a<<=1;f[d++]=r(p),l=d-1,h--;break;case 1:for(p=0,c=Math.pow(2,16),a=1;a!=c;)u=A.val&A.position,A.position>>=1,0==A.position&&(A.position=n,A.val=e(A.index++)),p|=(u>0?1:0)*a,a<<=1;f[d++]=r(p),l=d-1,h--;break;case 2:return w.join("")}if(0==h&&(h=Math.pow(2,m),m++),f[l])v=f[l];else{if(l!==d)return null;v=s+s.charAt(0)}w.push(v),f[d++]=s+v.charAt(0),h--,s=v,0==h&&(h=Math.pow(2,m),m++)}}};return i}();"function"==typeof define&&define.amd?define(function(){return LZString}):"undefined"!=typeof module&&null!=module&&(module.exports=LZString); -------------------------------------------------------------------------------- /lib/mine.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pmotschmann/Evolve/9aff5f2add288aa11fd13b7f45c5cf1b8a79b1ae/lib/mine.png -------------------------------------------------------------------------------- /lib/noise.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pmotschmann/Evolve/9aff5f2add288aa11fd13b7f45c5cf1b8a79b1ae/lib/noise.png -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "evolveidle", 3 | "version": "1.4.8", 4 | "description": "Evolve Idle", 5 | "private": true, 6 | "scripts": { 7 | "build": "npm run evolve && npm run evolve-less && npm run wiki && npm run wiki-less", 8 | "build-debug": "npm run evolve-debug && npm run evolve-less && npm run wiki-debug && npm run wiki-less", 9 | "build-win": "npm run evolve && npm run evolve-less-win && npm run wiki && npm run wiki-less-win", 10 | "build-debug-win": "npm run evolve-debug && npm run evolve-less-win && npm run wiki-debug && npm run wiki-less-win", 11 | "evolve": "node buildEvolve.js", 12 | "evolve-debug": "node buildEvolveDebug.js", 13 | "evolve-less": "lessc src/evolve.less evolve/evolve-unminified.css && csso -i evolve/evolve-unminified.css -o evolve/evolve.css && rm evolve/evolve-unminified.css", 14 | "evolve-less-win": "lessc src/evolve.less evolve/evolve-unminified.css && csso -i evolve/evolve-unminified.css -o evolve/evolve.css && del evolve\\evolve-unminified.css", 15 | "wiki": "node buildWiki.js", 16 | "wiki-debug": "node buildWikiDebug.js", 17 | "wiki-less": "lessc src/wiki/wiki.less wiki/wiki-unminified.css && csso -i wiki/wiki-unminified.css -o wiki/wiki.css && rm wiki/wiki-unminified.css", 18 | "wiki-less-win": "lessc src/wiki/wiki.less wiki/wiki-unminified.css && csso -i wiki/wiki-unminified.css -o wiki/wiki.css && del wiki\\wiki-unminified.css", 19 | "serve": "servehere -c", 20 | "deploy": "rm -rf dist && mkdir dist && cp -r *.html *.ico LICENSE evolve lib font strings wiki dist && gh-pages -d dist", 21 | "deploy-win": "(rmdir /S /Q dist || echo recreating dist) && mkdir dist && xcopy /E /I evolve dist\\evolve && xcopy /E /I font dist\\font && xcopy /E /I lib dist\\lib && xcopy /E /I strings dist\\strings && xcopy /E /I wiki dist\\wiki && copy *.html dist && copy *.ico dist && copy LICENSE dist && gh-pages -d dist" 22 | }, 23 | "repository": { 24 | "type": "git", 25 | "url": "git+https://github.com/pmotschmann/Evolve.git" 26 | }, 27 | "keywords": [ 28 | "Evolve" 29 | ], 30 | "author": "Peter Motschmann", 31 | "license": "MPL-2.0", 32 | "bugs": { 33 | "url": "https://github.com/pmotschmann/Evolve/issues" 34 | }, 35 | "homepage": "https://github.com/pmotschmann/Evolve#readme", 36 | "devDependencies": { 37 | "csso-cli": "^4.0.2", 38 | "ini": "^1.3.8", 39 | "less": "^3.13.0", 40 | "servehere": "^1.7.0", 41 | "gh-pages": "^6.1.1" 42 | }, 43 | "dependencies": { 44 | "esbuild": "0.25.0", 45 | "node": "^16.1.0", 46 | "npmcli": "^1.2.2" 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /save.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Evolve Save String 5 | 6 | 7 | 8 | 14 | 15 | 16 | 17 | 32 | 33 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /src/debug.js: -------------------------------------------------------------------------------- 1 | import { global, breakdown } from './vars.js'; 2 | import { deepClone, adjustCosts, messageQueue } from './functions.js'; 3 | import { races, traits } from './races.js'; 4 | import { craftCost, tradeRatio, atomic_mass, tradeBuyPrice, tradeSellPrice } from './resources.js'; 5 | import { actions, checkAffordable } from './actions.js'; 6 | import { fuel_adjust, int_fuel_adjust } from './space.js'; 7 | import { shipCosts } from './truepath.js'; 8 | import { f_rate } from './industry.js'; 9 | import { armyRating } from './civics.js'; 10 | import { alevel } from './achieve.js'; 11 | import { loc } from './locale.js'; 12 | 13 | export function enableDebug(){ 14 | if (global.settings.expose){ 15 | window.evolve = { 16 | actions: deepClone(actions), 17 | races: deepClone(races), 18 | traits: deepClone(traits), 19 | tradeRatio: deepClone(tradeRatio), 20 | craftCost: deepClone(craftCost(true)), 21 | atomic_mass: deepClone(atomic_mass), 22 | f_rate: deepClone(f_rate), 23 | checkAffordable: deepClone(checkAffordable), 24 | adjustCosts: deepClone(adjustCosts), 25 | armyRating: deepClone(armyRating), 26 | tradeBuyPrice: deepClone(tradeBuyPrice), 27 | tradeSellPrice: deepClone(tradeSellPrice), 28 | fuel_adjust: deepClone(fuel_adjust), 29 | int_fuel_adjust: deepClone(int_fuel_adjust), 30 | alevel: deepClone(alevel), 31 | messageQueue: deepClone(messageQueue), 32 | loc: deepClone(loc), 33 | shipCosts: deepClone(shipCosts), 34 | updateDebugData: deepClone(updateDebugData), 35 | global: {}, 36 | breakdown: {}, 37 | }; 38 | } 39 | } 40 | 41 | export function updateDebugData(){ 42 | if (global.settings.expose){ 43 | window.evolve.global = deepClone(global); 44 | window.evolve.craftCost = deepClone(craftCost(true)), 45 | window.evolve.breakdown = deepClone(breakdown); 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /src/locale.js: -------------------------------------------------------------------------------- 1 | import { global, save } from './vars.js'; 2 | 3 | let strings; 4 | getString(global.settings.locale); 5 | 6 | export function loc(key, variables) { 7 | let string = strings[key]; 8 | if (!string) { 9 | if (global.settings.expose){ 10 | console.error(`string ${key} not found`); 11 | console.log(strings); 12 | } 13 | return key; 14 | } 15 | if (variables) { 16 | if(variables instanceof Array) { 17 | for (let i = 0; i < variables.length; i++){ 18 | let re = new RegExp(`%${i}(?!\\d)`, "g"); 19 | if(!re.exec(string)){ 20 | if (global.settings.expose){ 21 | console.error(`"%${i}" was not found in the string "${key}" to be replace by "${variables[i]}"`); 22 | } 23 | continue; 24 | } 25 | string = string.replace(re, variables[i]); 26 | } 27 | let re = new RegExp("%\\d+(?!\\d)", 'g'); 28 | const results = string.match(re); 29 | if(results && global.settings.expose){ 30 | console.error(`${results} was found in the string, but there is no variables to make the replacement`); 31 | } 32 | } 33 | else { 34 | if (global.settings.expose){ 35 | console.error('"variables" need be a instance of "Array"'); 36 | } 37 | } 38 | } 39 | return string; 40 | } 41 | 42 | function getString(locale) { 43 | $.ajaxSetup({ async: false }); 44 | 45 | let defaultString; 46 | $.getJSON("strings/strings.json", (data) => { defaultString = data; }); 47 | 48 | if (locale != "en-US"){ 49 | let localeString; 50 | try { 51 | $.getJSON(`strings/strings.${locale}.json`, (data) => { localeString = data; }) 52 | } 53 | catch (e) { 54 | console.error(e,e.stack); 55 | } 56 | const defSize = defaultString.length; 57 | 58 | if (localeString) { 59 | Object.assign(defaultString, localeString); 60 | } 61 | 62 | if(defaultString.length != defSize && global.settings.expose){ 63 | console.error(`string.${locale}.json has extra keys.`); 64 | } 65 | } 66 | let string_pack = save.getItem('string_pack') || false; 67 | if (string_pack && global.settings.sPackOn){ 68 | let themeString; 69 | try { 70 | themeString = JSON.parse(LZString.decompressFromUTF16(string_pack)); 71 | } 72 | catch (e) { 73 | console.error(e,e.stack); 74 | } 75 | const defSize = defaultString.length; 76 | 77 | if (themeString) { 78 | Object.assign(defaultString, themeString); 79 | } 80 | 81 | if (defaultString.length != defSize && global.settings.expose){ 82 | console.error(`string pack has extra keys.`); 83 | } 84 | } 85 | 86 | $.ajaxSetup({ async: true }); 87 | strings = defaultString; 88 | } 89 | 90 | export const locales = { 91 | 'en-US': 'English (US)', 92 | 'es-ES': 'Spanish (ESP)', 93 | 'pt-BR': 'Português (BR)', 94 | 'de-DE': 'Deutsch', 95 | 'it-IT': 'Italiano', 96 | 'ru-RU': 'Русский', 97 | 'cs-CZ': 'Čeština', 98 | 'pl-PL': 'Polski', 99 | 'zh-CN': '简体中文', 100 | 'zh-TW': '繁體中文', 101 | 'ko-KR': '한국어', 102 | 'im-PL': 'Igpay-Atinlay' 103 | }; 104 | -------------------------------------------------------------------------------- /src/wiki/arpa.js: -------------------------------------------------------------------------------- 1 | import { clearElement } from './../functions.js'; 2 | import { projectsPage } from './projects.js'; 3 | import { crisprPage } from './crispr.js'; 4 | import { bloodPage } from './blood.js'; 5 | 6 | export function arpaPage(zone){ 7 | let content = $(`#content`); 8 | clearElement(content); 9 | 10 | switch (zone){ 11 | case 'projects': 12 | projectsPage(content); 13 | break; 14 | case 'genetics': 15 | //geneticsPage(content); 16 | break; 17 | case 'crispr': 18 | crisprPage(content); 19 | break; 20 | case 'blood': 21 | bloodPage(content); 22 | break; 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/wiki/basics.js: -------------------------------------------------------------------------------- 1 | import { loc } from './../locale.js'; 2 | import { infoBoxBuilder } from './functions.js'; 3 | 4 | export function basicsPage(content){ 5 | infoBoxBuilder(content,{ name: 'start', template: 'basics', paragraphs: 2, h_level: 2 }); 6 | 7 | infoBoxBuilder(content,{ name: 'prehistoric', template: 'basics', paragraphs: 14, break: [2,6,13], h_level: 2, 8 | para_data: { 9 | 3: [loc(`resource_RNA_name`),loc(`resource_DNA_name`)], 10 | 4: [loc(`evo_organelles_title`),loc(`resource_RNA_name`),loc(`evo_nucleus_title`),loc(`resource_DNA_name`)], 11 | 5: [loc(`evo_membrane_title`),loc(`evo_eukaryotic_title`),loc(`evo_mitochondria_title`)], 12 | 7: [loc('genelab_genus')], 13 | 8: [3], 14 | 13: [loc('evo_sentience_title')], 15 | }, 16 | data_link: { 17 | 7: ['wiki.html#races-species'] 18 | } 19 | }); 20 | 21 | infoBoxBuilder(content,{ name: 'civilization', template: 'basics', paragraphs: 14, break: [2,8,13], h_level: 2, 22 | para_data: { 23 | 3: [loc(`tab_civics`)], 24 | 4: [loc(`resource_Food_name`),loc(`job_farmer`),loc(`job_hunter`)], 25 | 5: ['*'], 26 | 8: [loc(`resource_Food_name`)], 27 | 9: [loc(`resource_Food_name`),loc(`hunger`)], 28 | 10: [loc(`resource_Food_name`)], 29 | 11: [loc(`resource_Food_name`)], 30 | 12: [loc(`resource_Food_name`)], 31 | 13: [loc(`resource_Knowledge_name`)], 32 | 14: [loc(`resource_Knowledge_name`),loc(`city_university`)] 33 | } 34 | }); 35 | 36 | infoBoxBuilder(content,{ name: 'government', template: 'basics', paragraphs: 8, break: [4], h_level: 2, 37 | para_data: { 38 | 1: [loc(`tech_government`),loc(`tab_civics`),loc(`govern_anarchy`)], 39 | 2: [loc(`tech_government`),loc(`govern_anarchy`)], 40 | 3: [loc(`tech_government`)], 41 | 4: [loc('morale')], 42 | 5: [loc('morale')], 43 | 6: [loc('morale'),loc('job_entertainer'),loc('morale_stress')], 44 | 7: [loc('morale_tax'),loc('morale')], 45 | 8: [25,100] 46 | } 47 | }); 48 | 49 | infoBoxBuilder(content,{ name: 'mad', template: 'basics', paragraphs: 4, h_level: 2, 50 | para_data: { 51 | 1: [loc(`wiki_resets_mad`)], 52 | 2: [loc(`wiki_basics_mad_reset`),loc(`tab_civics`),loc(`tab_military`)], 53 | 3: [loc(`tab_space`)], 54 | }, 55 | data_link: { 56 | 2: ['wiki.html#resets-prestige'] 57 | } 58 | }); 59 | } 60 | -------------------------------------------------------------------------------- /src/wiki/blood.js: -------------------------------------------------------------------------------- 1 | import { global } from './../vars.js'; 2 | import { loc } from './../locale.js'; 3 | import { vBind } from './../functions.js'; 4 | import { bloodPool } from './../arpa.js'; 5 | import { sideMenu } from './functions.js'; 6 | 7 | export function bloodPage(content){ 8 | content.append(`
${loc('wiki_arpa_blood')}
`); 9 | 10 | let mainContent = $(`
`); 11 | let crisprContent = sideMenu('create',mainContent); 12 | content.append(mainContent); 13 | 14 | Object.keys(bloodPool).forEach(function (trait){ 15 | let id = bloodPool[trait].id.split('-'); 16 | let info = $(`
`); 17 | crisprContent.append(info); 18 | bloodDesc(info,trait); 19 | sideMenu('add',`blood-prestige`,id[1],bloodPool[trait].title); 20 | }); 21 | } 22 | 23 | var bloodTrees = {}; 24 | Object.keys(bloodPool).forEach(function (blood){ 25 | let infusion = bloodPool[blood]; 26 | if (!bloodTrees[infusion.grant[0]]){ 27 | bloodTrees[infusion.grant[0]] = {}; 28 | } 29 | let text = typeof bloodPool[blood].title === 'string' ? bloodPool[blood].title : bloodPool[blood].title(); 30 | bloodTrees[infusion.grant[0]][infusion.grant[1]] = { 31 | name: blood 32 | }; 33 | }); 34 | 35 | function bloodDesc(info,trait){ 36 | let owned = global.blood[bloodPool[trait].grant[0]] && global.blood[bloodPool[trait].grant[0]] >= bloodPool[trait].grant[1] ? true : false; 37 | 38 | info.append(`

${bloodPool[trait].title}

${owned ? `${loc('wiki_arpa_purchased')}` : ``}${loc(`wiki_arpa_blood_${bloodPool[trait].grant[0]}`)}: ${bloodPool[trait].grant[1]}
`); 39 | 40 | let stats = $(`
`); 41 | info.append(stats); 42 | 43 | stats.append(`
${bloodPool[trait].desc}
`); 44 | 45 | let costs = $(`
`); 46 | stats.append(costs); 47 | Object.keys(bloodPool[trait].cost).forEach(function(res){ 48 | let label = loc(`resource_${res}_name`); 49 | if (bloodPool[trait].grant[1] === '*'){ 50 | costs.append(`
${label}: {{ r.${res}.cost }}
`); 51 | } 52 | else { 53 | let res_cost = bloodPool[trait].cost[res](); 54 | if (res_cost > 0){ 55 | costs.append(`
${label}: ${res_cost}
`); 56 | } 57 | } 58 | }); 59 | 60 | if (Object.keys(bloodPool[trait].reqs).length > 0 || bloodPool[trait].hasOwnProperty('condition')){ 61 | let reqs = $(`
${loc('wiki_arpa_crispr_req')}
`); 62 | info.append(reqs); 63 | 64 | let comma = false; 65 | if (Object.keys(bloodPool[trait].reqs).length > 0){ 66 | Object.keys(bloodPool[trait].reqs).forEach(function (req){ 67 | let color = global.blood[req] && global.blood[req] >= bloodPool[trait].reqs[req] ? 'success' : 'danger'; 68 | reqs.append(`${comma ? `, ` : ``}${loc(`wiki_arpa_blood_${req}`)} ${bloodPool[trait].reqs[req]}`); 69 | comma = true; 70 | }); 71 | } 72 | if (bloodPool[trait].hasOwnProperty('condition')){ 73 | let color = global.genes['blood'] && global.genes.blood >= 3 ? 'success' : 'danger'; 74 | reqs.append(`${comma ? `, ` : ``}${loc(`wiki_arpa_crispr_blood`)} 3`); 75 | } 76 | } 77 | 78 | if (bloodPool[trait].grant[1] === '*'){ 79 | addCalcInputs(info,trait); 80 | } 81 | } 82 | 83 | function addCalcInputs(parent,key){ 84 | let inputs = { 85 | owned: 0, 86 | }; 87 | let resources = {}; 88 | 89 | let action = bloodPool[key]; 90 | inputs.real_owned = global.blood[key] ? global.blood[key] : 0; 91 | 92 | let cost = action.cost; 93 | Object.keys(cost).forEach(function (res){ 94 | resources[res] = {}; 95 | }); 96 | 97 | //Functions to update costs and cost creeps 98 | let updateCosts = function(){ 99 | Object.keys(resources).forEach(function (res){ 100 | let new_cost = cost[res] ? cost[res](inputs.owned - inputs.real_owned) : 0; 101 | resources[res].vis = new_cost > 0 ? true : false; 102 | resources[res].cost = new_cost; 103 | }); 104 | }; 105 | updateCosts(); 106 | 107 | //Add calculator inputs 108 | parent.append($(` 109 |
110 |
111 |
${loc('wiki_calc_level')} -+
112 |
113 |
114 | 115 |
116 |
117 | `)); 118 | 119 | vBind({ 120 | el: `#${key}`, 121 | data: { 122 | i: inputs, 123 | r: resources 124 | }, 125 | methods: { 126 | val(type){ 127 | inputs[type] = Math.round(inputs[type]); 128 | if (inputs[type] && inputs[type] < 0){ 129 | inputs[type] = 0; 130 | } 131 | updateCosts(); 132 | }, 133 | less(type){ 134 | if (inputs[type] > 0){ 135 | inputs[type]--; 136 | } 137 | }, 138 | more(type){ 139 | inputs[type]++; 140 | }, 141 | importInputs(){ 142 | inputs.owned = inputs.real_owned; 143 | } 144 | } 145 | }); 146 | } -------------------------------------------------------------------------------- /src/wiki/combat.js: -------------------------------------------------------------------------------- 1 | import { loc } from './../locale.js'; 2 | import { sideMenu, infoBoxBuilder } from './functions.js'; 3 | 4 | export function combatPage(content){ 5 | let mainContent = sideMenu('create',content); 6 | 7 | infoBoxBuilder(mainContent,{ name: 'basics', template: 'combat', label: loc('wiki_combat_basics'), paragraphs: 4, h_level: 2}); 8 | sideMenu('add',`combat-gameplay`,`basics`,loc('wiki_combat_basics')); 9 | 10 | infoBoxBuilder(mainContent,{ name: 'campaign', template: 'combat', label: loc('wiki_combat_campaign'), paragraphs: 14, break: [5,11], h_level: 2, 11 | para_data: { 12 | 1: [5, loc('civics_garrison_tactic_ambush'), loc('civics_garrison_tactic_raid'), loc('civics_garrison_tactic_pillage'), loc('civics_garrison_tactic_assault'), loc('civics_garrison_tactic_siege')], 13 | 3: [loc('civics_garrison_tactic_ambush')], 14 | 4: [loc('civics_garrison_tactic_siege'), 20], 15 | 11: ['0%', '50%'], 16 | 12: [50], 17 | 13: ['50%', '100%'], 18 | 14: ['50%'], 19 | } 20 | }); 21 | sideMenu('add',`combat-gameplay`,`campaign`,loc('wiki_combat_campaign')); 22 | 23 | infoBoxBuilder(mainContent,{ name: 'loot', template: 'combat', label: loc('wiki_combat_loot'), paragraphs: 30, break: [3,5,10,13,16,19,22,26,27,28,29,30], h_level: 2, 24 | para_data: { 25 | 2: [3, loc('civics_garrison_campaign'), loc('civics_gov_eco_rate'), loc('civics_garrison_battalion')], 26 | 3: [loc('civics_garrison_campaign')], 27 | 4: [4, loc('wiki_combat_loot_money'), loc('wiki_combat_loot_basic'), loc('wiki_combat_loot_common'), loc('wiki_combat_loot_rare')], 28 | 5: [loc('wiki_combat_loot_basic'), loc('resource_Food_name'), loc('resource_Lumber_name'), loc('resource_Stone_name')], 29 | 6: [loc('wiki_combat_loot_common'), loc('resource_Copper_name'), loc('resource_Iron_name'), loc('resource_Aluminium_name'), loc('resource_Coal_name')], 30 | 7: [loc('wiki_combat_loot_rare'), loc('resource_Cement_name'), loc('resource_Steel_name')], 31 | 8: [loc('wiki_universe_magic'), loc('wiki_combat_loot_rare'), loc('resource_Crystal_name'), loc('trait_terrifying_name') , loc('resource_Titanium_name')], 32 | 9: [loc('wiki_combat_loot_money')], 33 | 10: [loc('civics_garrison_tactic_ambush'),3,loc('wiki_combat_loot_money'),loc('wiki_combat_loot_basic'),loc('wiki_combat_loot_common')], 34 | 11: [loc('trait_beast_of_burden_name'),loc('wiki_combat_loot_money'),loc('wiki_combat_loot_basic'),loc('wiki_combat_loot_common')], 35 | 12: [5], 36 | 13: [loc('civics_garrison_tactic_raid'),4,loc('wiki_combat_loot_money'),loc('wiki_combat_loot_basic'),loc('wiki_combat_loot_common'),loc('wiki_combat_loot_rare')], 37 | 14: [loc('trait_beast_of_burden_name'),loc('wiki_combat_loot_money'),loc('wiki_combat_loot_basic'),loc('wiki_combat_loot_common'),loc('wiki_combat_loot_rare')], 38 | 15: [10], 39 | 16: [loc('civics_garrison_tactic_pillage'),5,loc('wiki_combat_loot_money'),loc('wiki_combat_loot_basic'),loc('wiki_combat_loot_common'),loc('wiki_combat_loot_rare')], 40 | 17: [loc('trait_beast_of_burden_name'),loc('wiki_combat_loot_money'),loc('wiki_combat_loot_basic'),loc('wiki_combat_loot_common'),loc('wiki_combat_loot_rare')], 41 | 18: [25], 42 | 19: [loc('civics_garrison_tactic_assault'),5,loc('wiki_combat_loot_money'),loc('wiki_combat_loot_basic'),loc('wiki_combat_loot_common'),loc('wiki_combat_loot_rare')], 43 | 20: [loc('trait_beast_of_burden_name'),loc('wiki_combat_loot_money'),loc('wiki_combat_loot_basic'),loc('wiki_combat_loot_common'),loc('wiki_combat_loot_rare')], 44 | 21: [50], 45 | 22: [loc('civics_garrison_tactic_siege'),5,loc('wiki_combat_loot_money'),loc('wiki_combat_loot_basic'),loc('wiki_combat_loot_common'),loc('wiki_combat_loot_rare')], 46 | 23: [loc('trait_beast_of_burden_name'),loc('wiki_combat_loot_money'),loc('wiki_combat_loot_basic'),loc('wiki_combat_loot_common'),loc('wiki_combat_loot_rare')], 47 | 24: [loc('civics_garrison_tactic_siege')], 48 | 25: [999], 49 | 28: [`base loot * log(looters + 1)`], 50 | 29: [loc('civics_gov_eco_rate')], 51 | 30: [`floor(loot * economic rating / 100)`] 52 | }, 53 | data_color: { 54 | 5: ['warning','caution','caution','caution'], 55 | 6: ['warning','caution','caution','caution','caution'], 56 | 7: ['warning','caution','caution'], 57 | 8: ['warning','warning','caution','warning','caution'], 58 | 10: ['warning','warning','caution','caution','caution'], 59 | 11: ['warning','caution','caution','caution'], 60 | 13: ['warning','warning','caution','caution','caution','caution'], 61 | 14: ['warning','caution','caution','caution','caution'], 62 | 16: ['warning','warning','caution','caution','caution','caution'], 63 | 17: ['warning','caution','caution','caution','caution'], 64 | 19: ['warning','warning','caution','caution','caution','caution'], 65 | 20: ['warning','caution','caution','caution','caution'], 66 | 22: ['warning','warning','caution','caution','caution','caution'], 67 | 23: ['warning','caution','caution','caution','caution'], 68 | 28: ['advanced'], 69 | 30: ['advanced'], 70 | } 71 | }); 72 | sideMenu('add',`combat-gameplay`,`loot`,loc('wiki_combat_loot')); 73 | 74 | 75 | 76 | } 77 | -------------------------------------------------------------------------------- /src/wiki/crispr.js: -------------------------------------------------------------------------------- 1 | import { global } from './../vars.js'; 2 | import { loc } from './../locale.js'; 3 | import { genePool } from './../arpa.js'; 4 | import { sideMenu } from './functions.js'; 5 | 6 | export function crisprPage(content){ 7 | content.append(`
${loc('wiki_arpa_crispr')}
`); 8 | 9 | let mainContent = $(`
`); 10 | let crisprContent = sideMenu('create',mainContent); 11 | content.append(mainContent); 12 | 13 | Object.keys(genePool).forEach(function (gene){ 14 | let id = genePool[gene].id.split('-'); 15 | let info = $(`
`); 16 | crisprContent.append(info); 17 | geneDesc(info,gene); 18 | sideMenu('add',`crispr-prestige`,id[1],genePool[gene].title); 19 | }); 20 | } 21 | 22 | const specialRequirements = { 23 | universal: [ 24 | { 25 | title: loc(`wiki_tech_special_universe_not`,[loc(`universe_standard`)]), 26 | color: global.race.universe !== 'standard', 27 | link: 'wiki.html#universes-gameplay-standard' 28 | } 29 | ], 30 | standard: [ 31 | { 32 | title: loc(`wiki_tech_special_universe_not`,[loc(`universe_standard`)]), 33 | color: global.race.universe !== 'standard', 34 | link: 'wiki.html#universes-gameplay-standard' 35 | } 36 | ], 37 | ancients: [ 38 | { 39 | title: loc(`wiki_arpa_crispr_special_ancients`), 40 | color: global.genes['old_gods'] ? true : false, 41 | link: 'wiki.html#resets-prestige-intro' 42 | } 43 | ], 44 | bleeding_effect: [ 45 | { 46 | title: loc(`wiki_tech_special_universe`,[loc(`universe_antimatter`)]), 47 | color: global.race.universe === 'antimatter', 48 | link: 'wiki.html#universes-gameplay-antimatter' 49 | } 50 | ], 51 | blood_remembrance: [ 52 | { 53 | title: loc(`wiki_arpa_crispr_special_blood_remembrance`), 54 | color: global.prestige.Blood_Stone.count >= 1, 55 | link: 'wiki.html#resources-prestige-blood' 56 | } 57 | ] 58 | } 59 | 60 | var crisprTrees = {}; 61 | Object.keys(genePool).forEach(function (gene){ 62 | let crispr = genePool[gene]; 63 | if (!crisprTrees[crispr.grant[0]]){ 64 | crisprTrees[crispr.grant[0]] = {}; 65 | } 66 | let text = typeof genePool[gene].title === 'string' ? genePool[gene].title : genePool[gene].title(); 67 | crisprTrees[crispr.grant[0]][crispr.grant[1]] = { 68 | name: gene 69 | }; 70 | }); 71 | 72 | function geneDesc(info,gene){ 73 | let owned = global.genes[genePool[gene].grant[0]] && global.genes[genePool[gene].grant[0]] >= genePool[gene].grant[1] ? true : false; 74 | 75 | info.append(`

${genePool[gene].title}

${owned ? `${loc('wiki_arpa_purchased')}` : ``}${loc(`wiki_arpa_crispr_${genePool[gene].grant[0]}`)}: ${genePool[gene].grant[1]}
`); 76 | 77 | let stats = $(`
`); 78 | info.append(stats); 79 | 80 | stats.append(`
${genePool[gene].desc}
`); 81 | 82 | let costs = $(`
`); 83 | stats.append(costs); 84 | Object.keys(genePool[gene].cost).forEach(function(res){ 85 | let res_cost = genePool[gene].cost[res](); 86 | if (res_cost > 0){ 87 | if (res === 'Plasmid' && global.race.universe === 'antimatter'){ 88 | res = 'AntiPlasmid'; 89 | } 90 | let label = loc(`resource_${res}_name`); 91 | costs.append(`
${label}: ${res_cost}
`); 92 | } 93 | }); 94 | 95 | if (Object.keys(genePool[gene].reqs).length > 0){ 96 | let reqs = $(`
${loc('wiki_arpa_crispr_req')}
`); 97 | info.append(reqs); 98 | 99 | let comma = false; 100 | Object.keys(genePool[gene].reqs).forEach(function (req){ 101 | let color = global.genes[req] && global.genes[req] >= genePool[gene].reqs[req] ? 'success' : 'danger'; 102 | reqs.append(`${comma ? `, ` : ``}${loc(`wiki_arpa_crispr_${req}`)} ${genePool[gene].reqs[req]}`); 103 | comma = true; 104 | }); 105 | } 106 | if (specialRequirements.hasOwnProperty(gene)){ 107 | let comma = false; 108 | let specialReq = $(`
${loc('wiki_arpa_crispr_req_extra')}
`); 109 | info.append(specialReq); 110 | Object.keys(specialRequirements[gene]).forEach(function (req){ 111 | let color = specialRequirements[gene][req].color ? 'success' : 'danger'; 112 | let text = specialRequirements[gene][req].link ? `${specialRequirements[gene][req].title}` : specialRequirements[gene][req].title; 113 | specialReq.append(`${comma ? `, ` : ``}${text}`); 114 | 115 | comma = true; 116 | }); 117 | } 118 | } -------------------------------------------------------------------------------- /src/wiki/faq.js: -------------------------------------------------------------------------------- 1 | import { global } from './../vars.js'; 2 | import { loc } from './../locale.js'; 3 | import { clearElement } from './../functions.js'; 4 | import { races } from './../races.js'; 5 | 6 | export function faqPage(){ 7 | let content = $(`#content`); 8 | clearElement(content); 9 | 10 | let questions = [ 11 | 'update','hotkeys','sethotkeys','offline','moonphase','orbital','lumber','farm', 12 | 'steel','aluminium','titanium','titanium_balorg','polymer','mythril','neutronium', 13 | 'adamantite','infernite','graphene','stanene','aerogel','crates','soft_reset', 14 | 'hard_reset','combat','morale','stress','genetic_decay','cache','aphrodisiac', 15 | 'religion','tax_riots','race','weather','sundial','plasmid','plasmid_keep','plasmid_earn', 16 | 'crispr','creep','phage','phage_earn','phage_benefit','anti_plasmids','temple', 17 | 'temple_break','demonic','celestial','mastery','challenges','perks','feats','support', 18 | 'micro','valdi','quantum','quantum_level','exotic','soul_gem','soul_gem_spend', 19 | 'hell_patrol','surveyors','defense','infusion','dark_energy' 20 | ]; 21 | 22 | let values = { 23 | neutronium: [races[global.race.species].solar.gas_moon], 24 | }; 25 | 26 | for (let i=0; i`); 28 | content.append(qna); 29 | let tokens = []; 30 | if (values.hasOwnProperty(questions[i])){ 31 | tokens = values[questions[i]]; 32 | } 33 | 34 | qna.append(`

${loc(`wiki_faq_q_${questions[i]}`)}

`); 35 | qna.append(`
${loc(`wiki_faq_a_${questions[i]}`,tokens)}
`); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /src/wiki/functions.js: -------------------------------------------------------------------------------- 1 | import { global, sizeApproximation } from './../vars.js'; 2 | import { loc } from './../locale.js'; 3 | import { clearElement, vBind, adjustCosts } from './../functions.js'; 4 | import { actions } from './../actions.js'; 5 | import { planetName } from './../space.js'; 6 | 7 | export function headerBoxBuilder(parent,args,box){ 8 | if (!args.hasOwnProperty('h_level')){ 9 | args['h_level'] = 2; 10 | } 11 | args['header'] = true; 12 | return infoBoxBuilder(parent,args,box); 13 | } 14 | 15 | export function infoBoxBuilder(parent,args,box){ 16 | if (!args.hasOwnProperty('name')){ return; } 17 | if (!args.hasOwnProperty('template')){ return; } 18 | if (!args.hasOwnProperty('paragraphs')){ args['paragraphs'] = 0; } 19 | if (!args.hasOwnProperty('text')){ args['text'] = {}; } 20 | if (!args.hasOwnProperty('rawtext')){ args['rawtext'] = {}; } 21 | if (!args.hasOwnProperty('para_data')){ args['para_data'] = {}; } 22 | if (!args.hasOwnProperty('data_color')){ args['data_color'] = {}; } 23 | if (!args.hasOwnProperty('data_link')){ args['data_link'] = {}; } 24 | if (!args.hasOwnProperty('h_level')){ args['h_level'] = 3; } 25 | if (!args.hasOwnProperty('h_extra')){ args['h_extra'] = false; } 26 | if (!args.hasOwnProperty('header')){ args['header'] = false; } 27 | if (!args.hasOwnProperty('full')){ args['full'] = false; } 28 | if (!args.hasOwnProperty('break')){ args['break'] = false; } 29 | if (!args.hasOwnProperty('default_color')){ args['default_color'] = 'warning'; } 30 | if (!args.hasOwnProperty('examples')){ args['examples'] = false; } 31 | if (!args.hasOwnProperty('vue')){ args['vue'] = false; } 32 | 33 | let info = false; 34 | if (box){ 35 | info = box; 36 | } 37 | else { 38 | info = $(``); 39 | if (args['h_level'] && args.h_extra){ 40 | info.append(`
${args['label'] ? args['label'] : loc(`wiki_${args.template}_${args.name}`)}${args.h_extra}
`); 41 | } 42 | else if (args['h_level']){ 43 | info.append(`${args['label'] ? args['label'] : loc(`wiki_${args.template}_${args.name}`)}`); 44 | } 45 | } 46 | 47 | let ranges = [{s: 1, e: args.break ? args.break[0] - 1 : args.paragraphs}]; 48 | 49 | if (args.break){ 50 | for (let i=0; i`); 58 | for (let i=range.s; i<=range.e; i++){ 59 | if ((args.text[i] || args.rawtext[i] || args.para_data[i]) && Array.isArray(args.para_data[i])){ 60 | let inputs = args.para_data[i]; 61 | if (args.data_link[i] && Array.isArray(args.data_link[i])){ 62 | for (let j=0; j${inputs[j]}`; 65 | } 66 | } 67 | } 68 | let color_list = args.data_color[i] && Array.isArray(args.data_color[i]) ? args.data_color[i] : args.para_data[i].map(x => args.default_color); 69 | for (let j=0; j${inputs[j]}`; 72 | } 73 | } 74 | let string = args.rawtext[i] ? args.rawtext[i] : (loc(args.text[i] ? args.text[i] : `wiki_${args.template}_${args.name}_para${i}`,inputs)); 75 | para.append(`${string}`); 76 | } 77 | else { 78 | let string = args.rawtext[i] ? args.rawtext[i] : (loc(args.text[i] ? args.text[i] : `wiki_${args.template}_${args.name}_para${i}`)); 79 | para.append(`${string}`); 80 | } 81 | } 82 | info.append(para); 83 | }); 84 | 85 | if (args.examples){ 86 | info.append($(`
${loc(`wiki_examples`)}
`)); 87 | 88 | args.examples.forEach(function(example){ 89 | info.append($(`
- ${example}
`)); 90 | }); 91 | } 92 | 93 | if (!box){ 94 | parent.append(info); 95 | } 96 | 97 | if (args['vue']){ 98 | args.vue['el'] = `#${args.name}InfoBox`; 99 | vBind(args.vue); 100 | } 101 | 102 | return info; 103 | } 104 | 105 | export function actionDesc(info, c_action, extended, isStruct){ 106 | let title = typeof c_action.title === 'string' ? c_action.title : c_action.title(); 107 | if (extended){ 108 | info.append(`

${title}

${extended}
`); 109 | } 110 | else if (!isStruct){ 111 | let owned = global.tech[c_action.grant[0]] && global.tech[c_action.grant[0]] >= c_action.grant[1]; 112 | info.append(`

${title}

${owned ? `${loc('wiki_arpa_purchased')}` : ``}${loc(`wiki_tech_tree_${c_action.grant[0]}`)}: ${c_action.grant[1]}
`); 113 | } 114 | else { 115 | info.append(`

${title}

`); 116 | } 117 | 118 | let desc = typeof c_action.desc === 'string' ? c_action.desc : c_action.desc(true); 119 | if (desc !== title){ 120 | info.append(`
${desc}
`); 121 | } 122 | 123 | let stats = $(`
`); 124 | 125 | let hasEffect = false; 126 | if (c_action.hasOwnProperty('effect')){ 127 | if (isStruct){ 128 | let effect = typeof c_action.effect === 'string' ? c_action.effect : false; 129 | if (effect !== false){ 130 | stats.append(`
${effect}
`); 131 | } 132 | else { 133 | stats.append(`
`); 134 | } 135 | hasEffect = true; 136 | } 137 | else { 138 | let effect = typeof c_action.effect === 'string' ? c_action.effect : c_action.effect(true); 139 | if (effect !== false){ 140 | stats.append(`
${effect}
`); 141 | hasEffect = true; 142 | } 143 | } 144 | info.append(stats); 145 | } 146 | 147 | if (c_action.hasOwnProperty('cost')){ 148 | let costs = adjustCosts(c_action, true); 149 | let cost = hasEffect ? $(`
`) : $(`
`); 150 | let costCreep = ``; 151 | if (isStruct){ 152 | cost.append($(`

${loc('wiki_calc_cost')}

`)); 153 | costCreep = $(`

${loc('wiki_calc_cost_creep')}

`); 154 | } 155 | let render = false; 156 | 157 | let addCost = function(res,res_cost,label,color,structBypass){ 158 | if (isStruct){ 159 | cost.append($(`
${label}{{ r.${res}.cost }}
`)); 160 | costCreep.append($(`
{{ r.${res}.creep }}
`)); 161 | render = true; 162 | } 163 | else if (res_cost > 0){ 164 | cost.append($(`
${label}${sizeApproximation(res_cost,1)}
`)); 165 | render = true; 166 | } 167 | }; 168 | 169 | let color = 'has-text-success'; 170 | Object.keys(costs).forEach(function (res){ 171 | if (res === 'Structs'){ 172 | let structs = costs[res](); 173 | Object.keys(structs).forEach(function (region){ 174 | Object.keys(structs[region]).forEach(function (struct){ 175 | let res_cost = structs[region][struct].hasOwnProperty('on') ? structs[region][struct].on : structs[region][struct].count; 176 | 177 | let label = ''; 178 | if (structs[region][struct].hasOwnProperty('s')){ 179 | let sector = structs[region][struct].s; 180 | label = typeof actions[region][sector][struct].title === 'string' ? actions[region][sector][struct].title : actions[region][sector][struct].title(); 181 | } 182 | else { 183 | label = typeof actions[region][struct].title === 'string' ? actions[region][struct].title : actions[region][struct].title(); 184 | } 185 | cost.append($(`
${label}: ${res_cost}
`)); 186 | if (isStruct){ 187 | costCreep.append($(`
${loc('wiki_calc_none')}
`)); 188 | } 189 | render = true; 190 | }); 191 | }); 192 | } 193 | else if (['Plasmid','Phage','Dark','Harmony','AICore','Artifact','Blood_Stone','AntiPlasmid'].includes(res)){ 194 | let resName = res; 195 | if (res === 'Plasmid' && global.race.universe === 'antimatter'){ 196 | resName = 'AntiPlasmid'; 197 | } 198 | addCost(res,costs[res](),loc(`resource_${resName}_name`) + ': ',color); 199 | } 200 | else if (res === 'Supply'){ 201 | addCost(res,costs[res](),loc(`resource_${res}_name`) + ': ',color); 202 | } 203 | else if (res === 'Custom'){ 204 | cost.append($(`
${costs[res]().label}
`)); 205 | render = true; 206 | } 207 | else if (res !== 'Morale' && res !== 'Army' && res !== 'Bool' && res !== 'Troops'){ 208 | let f_res = res === 'Species' ? global.race.species : res; 209 | let label = f_res === 'Money' ? '$' : (res === 'HellArmy' ? loc('fortress_troops') : global.resource[f_res].name) + ': '; 210 | label = label.replace("_", " "); 211 | addCost(res,costs[res](),label,color); 212 | } 213 | }); 214 | 215 | if (render){ 216 | if (!c_action.hasOwnProperty('effect')){ 217 | info.append(stats); 218 | } 219 | stats.append(cost); 220 | if (isStruct){ 221 | stats.append(costCreep); 222 | } 223 | } 224 | } 225 | } 226 | 227 | export function bindScroll(elm, target){ 228 | elm.click(function(){ 229 | window.location.hash = `#${target}`; 230 | document.getElementById(target).scrollIntoView({ 231 | block: 'start', 232 | behavior: 'smooth' 233 | }); 234 | }); 235 | } 236 | 237 | export function sideMenu(action,arg1,arg2,arg3){ 238 | if (action === 'create'){ 239 | let content = arg1 ? (typeof arg1 === 'string' ? $(`#${arg1}`) : arg1) : $(`#content`); 240 | clearElement(content); 241 | content.addClass('flex'); 242 | let mainContent = $(`
`); 243 | let sideContent = $(`
`); 244 | let sideMenu = $(`
    `); 245 | content.append(mainContent); 246 | content.append(sideContent); 247 | sideContent.append(sideMenu); 248 | return mainContent; 249 | } 250 | else if (action === 'gap'){ 251 | let li = $(`
  • `); 252 | $(`#sideContent ul`).append(li); 253 | } 254 | else { 255 | let anchor = $(`${arg3}`); 256 | let li = $(`
  • `); 257 | li.append(anchor); 258 | $(`#sideContent ul`).append(li); 259 | bindScroll(anchor, arg2); 260 | } 261 | 262 | } 263 | 264 | export function subSideMenu(action,arg1,arg2,arg3){ 265 | sideMenu(action,arg1,arg2,`ᄂ` + arg3); 266 | } 267 | 268 | export function getSolarName(planet) { 269 | if (['moon','belt'].includes(planet)){ 270 | return loc('space_'+planet+'_info_name'); 271 | } 272 | else if (['kuiper'].includes(planet)){ 273 | return loc('space_'+planet+'_title'); 274 | } 275 | 276 | return planetName()[planet]; 277 | } 278 | 279 | export function createRevealSection(info,id,type,insert){ 280 | let reveal = $(`
    `); 281 | info.append(reveal); 282 | reveal.append(`{{ vis | label }}`); 283 | let section = $(``); 284 | reveal.append(section); 285 | 286 | let modSection = document.getElementById(id + type + 'Section'); 287 | let modDisplay = { vis: false }; 288 | 289 | vBind({ 290 | el: `#${id}${type}Button`, 291 | data: modDisplay, 292 | methods: { 293 | show(){ 294 | if (modSection.style.display === 'block'){ 295 | modSection.style.display = 'none'; 296 | modDisplay.vis = false; 297 | } 298 | else { 299 | modSection.style.display = 'block'; 300 | modDisplay.vis = true; 301 | } 302 | } 303 | }, 304 | filters: { 305 | label(vis){ 306 | return vis ? loc(`wiki_reveal_hide`,[insert]) : loc(`wiki_reveal_show`,[insert]); 307 | } 308 | } 309 | }); 310 | 311 | return section; 312 | } 313 | 314 | export function createCalcSection(info,id,type,insert){ 315 | insert = insert || loc(`wiki_calc_insert_` + type); 316 | let calc = $(`
    `); 317 | info.append(calc); 318 | calc.append(`{{ vis | label }}`); 319 | let section = $(``); 320 | calc.append(section); 321 | 322 | let modSection = document.getElementById(id + type + 'Section'); 323 | let modDisplay = { vis: false }; 324 | 325 | vBind({ 326 | el: `#${id}${type}Button`, 327 | data: modDisplay, 328 | methods: { 329 | show(){ 330 | if (modSection.style.display === 'block'){ 331 | modSection.style.display = 'none'; 332 | modDisplay.vis = false; 333 | } 334 | else { 335 | modSection.style.display = 'block'; 336 | modDisplay.vis = true; 337 | } 338 | } 339 | }, 340 | filters: { 341 | label(vis){ 342 | return vis ? loc(`wiki_calc_hide`,[insert]) : loc(`wiki_calc_show`,[insert]); 343 | } 344 | } 345 | }); 346 | 347 | return section; 348 | } 349 | 350 | export function resourceName(res){ 351 | return global?.resource?.[res]?.name || loc(`resource_${res}_name`); 352 | } -------------------------------------------------------------------------------- /src/wiki/gameplay.js: -------------------------------------------------------------------------------- 1 | import { clearElement } from './../functions.js'; 2 | import { basicsPage } from './basics.js'; 3 | import { mechanicsPage } from './mechanics.js'; 4 | import { govPage } from './government.js'; 5 | import { governPage } from './governor.js'; 6 | import { combatPage } from './combat.js'; 7 | import { challengesPage } from './challenges.js'; 8 | import { resetsPage } from './resets.js'; 9 | import { planetsPage } from './planets.js'; 10 | import { universePage } from './universes.js'; 11 | import { hellPage } from './hell.js'; 12 | 13 | export function gamePlayPage(zone){ 14 | let content = $(`#content`); 15 | clearElement(content); 16 | 17 | switch (zone){ 18 | case 'basics': 19 | basicsPage(content); 20 | break; 21 | case 'mechanics': 22 | mechanicsPage(content); 23 | break; 24 | case 'government': 25 | govPage(content); 26 | break; 27 | case 'governor': 28 | governPage(content); 29 | break; 30 | case 'combat': 31 | combatPage(content); 32 | break; 33 | case 'challenges': 34 | challengesPage(content); 35 | break; 36 | case 'resets': 37 | resetsPage(content); 38 | break; 39 | case 'planets': 40 | planetsPage(content); 41 | break; 42 | case 'universes': 43 | universePage(content); 44 | break; 45 | case 'hell': 46 | hellPage(content); 47 | break; 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /src/wiki/government.js: -------------------------------------------------------------------------------- 1 | import { global } from './../vars.js'; 2 | import { loc } from './../locale.js'; 3 | import { govActive } from './../governor.js'; 4 | import { sideMenu, infoBoxBuilder, resourceName } from './functions.js'; 5 | 6 | export function govPage(content){ 7 | let mainContent = sideMenu('create',content); 8 | 9 | infoBoxBuilder(mainContent,{ name: 'info', template: 'government', label: loc('tab_gov'), paragraphs: 8, break: [3,6], h_level: 2, 10 | para_data: { 11 | 2: [loc('govern_anarchy')], 12 | 3: [loc('civics_revolution')], 13 | 4: [loc('civics_revolution')], 14 | 5: [1000] 15 | }, 16 | data_color: { 2: ['caution'] } 17 | }); 18 | sideMenu('add',`government-gameplay`,`info`,loc('tab_gov')); 19 | 20 | let govs = { 21 | anarchy: { 22 | paragraphs: 5, 23 | break: [2,5], 24 | para_data: { 25 | 2: [10], 26 | 3: ['10th','0.25%','1/2'] 27 | } 28 | }, 29 | autocracy: { 30 | paragraphs: 4, 31 | break: [2,4], 32 | para_data: { 33 | 2: [`{{ b | line2(g) }}%`,'25%'], 34 | 3: ['18%',loc('tech_electricity'),'10%',loc('tech_virtual_reality')] 35 | }, 36 | vue: { 37 | filters: { 38 | line2(b,g){ return b ? (g ? 50 : 40) : (g ? 40 : 35); }, 39 | } 40 | } 41 | }, 42 | democracy: { 43 | paragraphs: 6, 44 | break: [2,5], 45 | para_data: { 46 | 2: [loc('job_entertainer'),`{{ b | line2(g) }}%`], 47 | 3: [loc('job_entertainer')], 48 | 4: [`{{ b | line4a(g) }}%`,loc('tech_electricity'),`{{ b | line4b(g) }}%`,loc('tech_virtual_reality')], 49 | 5: [`{{ g | line5 }}%`], 50 | 6: [ 51 | loc('job_farmer'),loc('job_lumberjack'),loc('job_quarry_worker'),loc('job_miner'),loc('job_crystal_miner'), 52 | loc('job_coal_miner'),loc('job_cement_worker'),loc('job_professor'),loc('job_scientist'),loc('soldiers') 53 | ] 54 | }, 55 | vue: { 56 | filters: { 57 | line2(b,g){ return b ? (g ? 30 : 25) : 20; }, 58 | line4a(b,g){ return b ? (g ? 35 : 30) : 25; }, 59 | line4b(b,g){ return b ? (g ? 40 : 35) : 30; }, 60 | line5(g){ return g ? 1 : 5; }, 61 | } 62 | } 63 | }, 64 | oligarchy: { 65 | paragraphs: 5, 66 | break: [2,4,5], 67 | para_data: { 68 | 2: ['5%',`{{ b | line2(g) }}%`], 69 | 3: ['2%',loc('tech_electricity'),loc('tech_virtual_reality')], 70 | 4: ['45%'], 71 | 5: ['0.5%','20%'] 72 | }, 73 | vue: { 74 | filters: { 75 | line2(b,g){ return b ? (g ? 35 : 25) : (g ? 25 : 20); }, 76 | } 77 | } 78 | }, 79 | theocracy: { 80 | paragraphs: 7, 81 | break: [2,6,7], 82 | para_data: { 83 | 2: [`{{ b | line2(g) }}%`], 84 | 3: [`{{ g | line3 }}%`], 85 | 4: ['50%'], 86 | 6: ['40%',loc('tech_virtual_reality'),'25%',loc('tech_metaphysics')] 87 | }, 88 | vue: { 89 | filters: { 90 | line2(b,g){ return b ? (g ? 14 : 13) : 12; }, 91 | line3(g){ return g ? 10 : 25; }, 92 | } 93 | } 94 | }, 95 | republic: { 96 | paragraphs: 7, 97 | break: [2,5,6], 98 | para_data: { 99 | 2: [`{{ b | line2(g) }}%`], 100 | 3: [`{{ b | line3(g) }}%`], 101 | 5: [`{{ b | line5a(g) }}%`,loc('tech_virtual_reality'),`{{ b | line5b(g) }}%`,loc('tech_metaphysics')], 102 | 6: ['30%'], 103 | 7: [30,90], 104 | }, 105 | vue: { 106 | filters: { 107 | line2(b,g){ return b ? (g ? 40 : 30) : (g ? 30 : 25); }, 108 | line3(b,g){ return b ? (g ? 30 : 25) : 20; }, 109 | line5a(b,g){ return b ? (g ? 40 : 35) : 30; }, 110 | line5b(b,g){ return b ? (g ? 50 : 45) : 40; }, 111 | } 112 | } 113 | }, 114 | socialist: { 115 | paragraphs: 6, 116 | break: [2,6], 117 | para_data: { 118 | 2: [`{{ b | line2(g) }}%`], 119 | 3: [`{{ b | line3(g) }}%`], 120 | 4: ['10%'], 121 | 5: [`{{ b | line5(g) }}%`], 122 | 6: [`{{ b | line6a(g) }}%`,loc('tech_virtual_reality'),`{{ b | line6b(g) }}%`,loc('tech_metaphysics')] 123 | }, 124 | vue: { 125 | filters: { 126 | line2(b,g){ return b ? (g ? 45 : 40) : 35; }, 127 | line3(b,g){ return b ? (g ? 15 : 12) : (g ? 12 : 10); }, 128 | line5(b,g){ return b ? (g ? 5 : 15) : (g ? 10 : 20); }, 129 | line6a(b,g){ return b ? (g ? 52 : 47) : 42; }, 130 | line6b(b,g){ return b ? (g ? 60 : 55) : 50; }, 131 | } 132 | } 133 | }, 134 | corpocracy: { 135 | paragraphs: 9, 136 | break: [2,8,9], 137 | para_data: { 138 | 2: ['50%'], 139 | 3: [`{{ b | line3(g) }}%`], 140 | 4: [`{{ b | line4(g) }}%`], 141 | 5: [`{{ b | line5(g) }}%`], 142 | 6: ['10%'], 143 | 7: [`{{ b | line7(g) }}%`], 144 | 8: ['5%',loc('tech_virtual_reality')], 145 | 9: [`{{ b | line9(g) }}%`,loc('tech_metaphysics')] 146 | }, 147 | vue: { 148 | filters: { 149 | line3(b,g){ return b ? (g ? 250 : 220) : (g ? 220 : 200); }, 150 | line4(b,g){ return b ? (g ? 190 : 160) : (g ? 175 : 150); }, 151 | line5(b,g){ return b ? (g ? 125 : 110) : (g ? 110 : 100); }, 152 | line7(b,g){ return b ? (g ? 40 : 35) : 30; }, 153 | line9(b,g){ return b ? (g ? 50 : 45) : 40; }, 154 | } 155 | } 156 | }, 157 | technocracy: { 158 | paragraphs: 5, 159 | break: [2,4], 160 | para_data: { 161 | 2: ['8%'], 162 | 3: [`{{ b | line3(g) }}%`], 163 | 4: ['2%'], 164 | 5: ['1%',loc('tech_virtual_reality'),loc('tech_metaphysics')] 165 | }, 166 | vue: { 167 | filters: { 168 | line3(b,g){ return b ? (g ? 25 : 15) : (g ? 18 : 10); }, 169 | } 170 | } 171 | }, 172 | federation: { 173 | paragraphs: 7, 174 | break: [2,5,6], 175 | para_data: { 176 | 2: ['3%'], 177 | 4: ['25%'], 178 | 5: [`{{ b | line5(g) }}%`], 179 | 6: ['25%',`{{ b | line6(g) }}%`], 180 | 7: [`{{ b | line7a(g) }}%`,loc('tech_virtual_reality'),`{{ b | line7b(g) }}%`,loc('tech_metaphysics')] 181 | }, 182 | vue: { 183 | filters: { 184 | line5(b,g){ return b ? (g ? 18 : 12) : (g ? 12 : 10); }, 185 | line6(b,g){ return b ? (g ? 36 : 34) : 32; }, 186 | line7a(b,g){ return b ? (g ? 40 : 38) : 36; }, 187 | line7b(b,g){ return b ? (g ? 44 : 42) : 40; }, 188 | } 189 | } 190 | }, 191 | magocracy: { 192 | paragraphs: 5, 193 | break: [2,3,5], 194 | para_data: { 195 | 2: [`{{ b | line2(g) }}%`], 196 | 3: [`{{ b | line3(g) }}%`], 197 | 4: [`{{ b | line4a(g) }}%`,loc('tech_virtual_reality'),`{{ b | line4b(g) }}%`,loc('tech_metaphysics')] 198 | }, 199 | vue: { 200 | filters: { 201 | line2(b,g){ return b ? (g ? 40 : 30) : (g ? 30 : 25); }, 202 | line3(b,g){ return b ? (g ? 35 : 30) : 25; }, 203 | line4a(b,g){ return b ? (g ? 50 : 45) : 40 }, 204 | line4b(b,g){ return b ? (g ? 60 : 55) : 50; }, 205 | } 206 | } 207 | }, 208 | dictator: { 209 | paragraphs: 6, 210 | break: [2,5,6], 211 | para_data: { 212 | 2: [`{{ b | line2(g) }}%`], 213 | 3: [`{{ b | line3(g) }}%`], 214 | 4: [`{{ b | line4(g) }}%`, resourceName('Lumber'),resourceName('Stone'),resourceName('Furs'),resourceName('Copper'),resourceName('Iron'),resourceName('Aluminium'),resourceName('Cement'),resourceName('Coal')], 215 | 5: [`{{ b | line5a(g) }}%`, loc('tech_virtual_reality'), `{{ b | line5b(g) }}%`, loc('tech_metaphysics')] 216 | }, 217 | vue: { 218 | filters: { 219 | line2(b,g){ return b ? (g ? 15 : 25) : (g ? 25 : 30); }, 220 | line3(b,g){ return b ? (g ? 13 : 12) : 10; }, 221 | line4(b,g){ return b ? (g ? 8 : 6) : 4; }, 222 | line5a(b,g){ return b ? (g ? 15 : 14) : 12; }, 223 | line5b(b,g){ return b ? (g ? 10 : 8) : 6; }, 224 | } 225 | } 226 | } 227 | }; 228 | 229 | Object.keys(govs).forEach(function (gov){ 230 | infoBoxBuilder(mainContent,{ name: gov, template: 'government', label: loc(`govern_${gov}`), paragraphs: govs[gov].paragraphs, break: govs[gov].break, h_level: 2, 231 | text: govs[gov].hasOwnProperty('text') ? govs[gov].text : { 232 | 1: `govern_${gov}_desc` 233 | }, 234 | para_data: govs[gov].hasOwnProperty('para_data') ? govs[gov].para_data : {}, 235 | para_color: govs[gov].hasOwnProperty('para_color') ? govs[gov].para_color : {}, 236 | vue: { 237 | data: { g: govActive('organizer',0), b: govBoost() }, 238 | filters: govs[gov]?.vue?.filters || {} 239 | }, 240 | h_extra: govs[gov]?.vue ? `
    ${loc(`governor_bureaucrat`)}${loc(`arpa_genepool_bureaucratic_efficiency_title`)}
    ` : false, 241 | }); 242 | sideMenu('add',`government-gameplay`,gov,loc(`govern_${gov}`)); 243 | }); 244 | } 245 | 246 | export function govBoost(rank){ 247 | if (typeof(rank) === 'undefined'){ rank = 3; } 248 | return global?.genes?.hasOwnProperty('governor') && global?.genes?.governor >= rank ? true : false; 249 | } 250 | -------------------------------------------------------------------------------- /src/wiki/governor.js: -------------------------------------------------------------------------------- 1 | import { loc } from './../locale.js'; 2 | import { sideMenu, subSideMenu, infoBoxBuilder } from './functions.js'; 3 | import { govBoost } from './government.js'; 4 | import { gmen, gov_traits, gov_tasks } from './../governor.js'; 5 | import { hoovedRename } from './../functions.js'; 6 | import { hoovedReskin } from './../races.js'; 7 | 8 | export function governPage(content){ 9 | let mainContent = sideMenu('create',content); 10 | 11 | { 12 | let govern = infoBoxBuilder(mainContent,{ name: 'intro', template: 'governor', label: loc('governor'), paragraphs: 4, h_level: 2, 13 | para_data: { 14 | 1: [loc('arpa_genepool_governance_title')], 15 | 2: [Object.keys(gmen).length] 16 | }, 17 | data_link: { 18 | 1: ['wiki.html#crispr-prestige-governance'] 19 | } 20 | }); 21 | sideMenu('add',`governor-gameplay`,`intro`,loc('governor')); 22 | 23 | Object.keys(gmen).forEach(function (gov){ 24 | infoBoxBuilder(govern,{ name: gov, template: 'government', label: loc(`governor_${gov}`), paragraphs: 2, break: [2], h_level: 3, 25 | text: { 26 | 1: `governor_${gov}_desc` 27 | }, 28 | rawtext: { 29 | 2: `{{ b | desc }}` 30 | }, 31 | vue: { 32 | data: { b: govBoost(gov === 'bureaucrat' ? 2 : 3) }, 33 | filters: { 34 | desc(b){ 35 | let desc = ''; 36 | Object.keys(gmen[gov].traits).forEach(function (t){ 37 | desc += (gov_traits[t].hasOwnProperty('effect') ? gov_traits[t].effect(b,{isWiki: true}) : '') + ' '; 38 | }); 39 | return desc;; 40 | } 41 | } 42 | }, 43 | h_extra: `
    ${loc(gov === 'bureaucrat' ? `arpa_genepool_civil_service_title` : `arpa_genepool_bureaucratic_efficiency_title`)}
    `, 44 | }); 45 | subSideMenu('add',`governor-gameplay`,gov,loc(`governor_${gov}`)); 46 | }); 47 | } 48 | 49 | sideMenu('gap'); 50 | 51 | { 52 | let govern = infoBoxBuilder(mainContent,{ name: 'task', template: 'governor', paragraphs: 2, h_level: 2, 53 | para_data: { 54 | 2: [3,loc('governor_bureaucrat'),4], 55 | 3: [Object.keys(gov_tasks).length] 56 | } 57 | }); 58 | sideMenu('add',`governor-gameplay`,`task`,loc('wiki_governor_task')); 59 | 60 | { 61 | let task = 'tax'; 62 | infoBoxBuilder(govern,{ name: task, template: 'government', label: loc(`gov_task_${task}`), paragraphs: 3, break: [3], h_level: 3, 63 | text: { 64 | 1: `wiki_governor_task_${task}1`, 65 | 2: `wiki_governor_task_${task}2`, 66 | 3: `wiki_governor_task_unlock` 67 | }, 68 | para_data: { 69 | 3: [loc(`tech_tax_rates`)], 70 | }, 71 | data_link: { 72 | 3: ['wiki.html#civilized-tech-tax_rates'] 73 | } 74 | }); 75 | subSideMenu('add',`governor-gameplay`,task,loc(`gov_task_${task}`)); 76 | } 77 | 78 | { 79 | let task = 'storage'; 80 | infoBoxBuilder(govern,{ name: task, template: 'government', label: loc(`gov_task_${task}`), paragraphs: 3, break: [3], h_level: 3, 81 | text: { 82 | 1: `wiki_governor_task_${task}1`, 83 | 2: `wiki_governor_task_${task}2`, 84 | 3: `wiki_governor_task_unlock` 85 | }, 86 | para_data: { 87 | 3: [loc(`tech_containerization`)], 88 | }, 89 | data_link: { 90 | 3: ['wiki.html#civilized-tech-containerization'] 91 | } 92 | }); 93 | subSideMenu('add',`governor-gameplay`,task,loc(`gov_task_${task}`)); 94 | } 95 | 96 | { 97 | let task = 'bal_storage'; 98 | infoBoxBuilder(govern,{ name: task, template: 'government', label: loc(`gov_task_${task}`), paragraphs: 4, break: [4], h_level: 3, 99 | text: { 100 | 1: `wiki_governor_task_${task}1`, 101 | 2: `wiki_governor_task_${task}2`, 102 | 3: `wiki_governor_task_${task}3`, 103 | 4: `wiki_governor_task_unlock` 104 | }, 105 | para_data: { 106 | 4: [loc(`tech_containerization`)], 107 | }, 108 | data_link: { 109 | 4: ['wiki.html#civilized-tech-containerization'] 110 | } 111 | }); 112 | subSideMenu('add',`governor-gameplay`,task,loc(`gov_task_${task}`)); 113 | } 114 | 115 | { 116 | let task = 'combo_storage'; 117 | infoBoxBuilder(govern,{ name: task, template: 'government', label: loc(`gov_task_${task}`), paragraphs: 3, break: [2,3], h_level: 3, 118 | text: { 119 | 1: `wiki_governor_task_${task}1`, 120 | 2: `wiki_governor_task_unlock`, 121 | 3: `wiki_governor_task_upgrade` 122 | }, 123 | para_data: { 124 | 2: [loc(`tech_containerization`)], 125 | 3: [loc(`arpa_genepool_bureaucratic_efficiency_title`)] 126 | }, 127 | data_link: { 128 | 2: ['wiki.html#civilized-tech-containerization'], 129 | 3: ['wiki.html#crispr-prestige-bureaucratic_efficiency'] 130 | } 131 | }); 132 | subSideMenu('add',`governor-gameplay`,task,loc(`gov_task_${task}`)); 133 | } 134 | 135 | { 136 | let task = 'merc'; 137 | infoBoxBuilder(govern,{ name: task, template: 'government', label: loc(`gov_task_${task}`), paragraphs: 4, break: [4], h_level: 3, 138 | text: { 139 | 1: `wiki_governor_task_${task}1`, 140 | 2: `wiki_governor_task_${task}2`, 141 | 3: `wiki_governor_task_${task}3`, 142 | 4: `wiki_governor_task_unlock` 143 | }, 144 | para_data: { 145 | 4: [loc(`tech_mercs`)], 146 | }, 147 | data_link: { 148 | 4: ['wiki.html#civilized-tech-mercs'] 149 | } 150 | }); 151 | subSideMenu('add',`governor-gameplay`,task,loc(`gov_task_${task}`)); 152 | } 153 | 154 | { 155 | let task = 'spy'; 156 | infoBoxBuilder(govern,{ name: task, template: 'government', label: loc(`gov_task_${task}`), paragraphs: 3, break: [2,3], h_level: 3, 157 | text: { 158 | 1: `wiki_governor_task_${task}1`, 159 | 2: `wiki_governor_task_unlock`, 160 | 3: `wiki_governor_task_disabled` 161 | }, 162 | para_data: { 163 | 2: [loc(`tech_spy`)], 164 | 3: [loc(`tech_unification`)], 165 | }, 166 | data_link: { 167 | 2: ['wiki.html#civilized-tech-spy'], 168 | 3: ['wiki.html#early_space-tech-unification2'] 169 | } 170 | }); 171 | subSideMenu('add',`governor-gameplay`,task,loc(`gov_task_${task}`)); 172 | } 173 | 174 | { 175 | let task = 'spyop'; 176 | infoBoxBuilder(govern,{ name: task, template: 'government', label: loc(`gov_task_${task}`), paragraphs: 8, break: [2,3,4,5,6,7,8], h_level: 3, 177 | text: { 178 | 1: `wiki_governor_task_${task}1`, 179 | 2: `wiki_governor_task_${task}2`, 180 | 3: `wiki_governor_task_${task}3`, 181 | 4: `wiki_governor_task_${task}3`, 182 | 5: `wiki_governor_task_${task}4`, 183 | 6: `wiki_governor_task_${task}5`, 184 | 7: `wiki_governor_task_unlock`, 185 | 8: `wiki_governor_task_disabled` 186 | }, 187 | para_data: { 188 | 2: [1,loc(`civics_spy_sabotage`)], 189 | 3: [2,loc(`civics_spy_influence`)], 190 | 4: [3,loc(`civics_spy_incite`)], 191 | 6: [loc(`civics_spy_sabotage`),loc(`civics_spy_incite`),loc(`civics_spy_influence`)], 192 | 7: [loc(`tech_espionage`)], 193 | 8: [loc(`tech_unification`)], 194 | }, 195 | data_link: { 196 | 6: ['wiki.html#civilized-tech-spy'], 197 | 7: ['wiki.html#early_space-tech-unification2'] 198 | } 199 | }); 200 | subSideMenu('add',`governor-gameplay`,task,loc(`gov_task_${task}`)); 201 | } 202 | 203 | { 204 | let task = 'combo_spy'; 205 | infoBoxBuilder(govern,{ name: task, template: 'government', label: loc(`gov_task_${task}`), paragraphs: 3, break: [2,3], h_level: 3, 206 | text: { 207 | 1: `wiki_governor_task_${task}1`, 208 | 2: `wiki_governor_task_unlock`, 209 | 3: `wiki_governor_task_upgrade` 210 | }, 211 | para_data: { 212 | 2: [loc(`tech_espionage`)], 213 | 3: [loc(`arpa_genepool_bureaucratic_efficiency_title`)] 214 | }, 215 | data_link: { 216 | 2: ['wiki.html#civilized-tech-spy'], 217 | 3: ['wiki.html#crispr-prestige-bureaucratic_efficiency'] 218 | } 219 | }); 220 | subSideMenu('add',`governor-gameplay`,task,loc(`gov_task_${task}`)); 221 | } 222 | 223 | { 224 | let task = 'slave'; 225 | infoBoxBuilder(govern,{ name: task, template: 'government', label: loc(`gov_task_${task}`,[loc(`resource_Slave_name`)]), paragraphs: 2, break: [2], h_level: 3, 226 | text: { 227 | 1: `wiki_governor_task_${task}1`, 228 | 2: `wiki_governor_task_trait` 229 | }, 230 | para_data: { 231 | 2: [loc(`trait_slaver_name`)], 232 | }, 233 | data_link: { 234 | 2: ['wiki.html#traits-species-major_slaver'] 235 | } 236 | }); 237 | subSideMenu('add',`governor-gameplay`,task,loc(`gov_task_${task}`,[loc(`resource_Slave_name`)])); 238 | } 239 | 240 | { 241 | let task = 'sacrifice'; 242 | infoBoxBuilder(govern,{ name: task, template: 'government', label: loc(`gov_task_${task}`), paragraphs: 2, break: [2], h_level: 3, 243 | text: { 244 | 1: `wiki_governor_task_${task}1`, 245 | 2: `wiki_governor_task_trait` 246 | }, 247 | para_data: { 248 | 2: [loc(`trait_cannibalize_name`)], 249 | }, 250 | data_link: { 251 | 2: ['wiki.html#traits-species-major_cannibalize'] 252 | } 253 | }); 254 | subSideMenu('add',`governor-gameplay`,task,loc(`gov_task_${task}`)); 255 | } 256 | 257 | { 258 | let task = 'horseshoe'; 259 | infoBoxBuilder(govern,{ name: task, template: 'government', label: loc(`gov_task_${task}`), paragraphs: 2, break: [2], h_level: 3, 260 | text: { 261 | 1: `wiki_governor_task_${task}1`, 262 | 2: `wiki_governor_task_trait` 263 | }, 264 | para_data: { 265 | 1: [loc(`city_${hoovedRename(true)}`,[hoovedRename(false)]),hoovedRename(false)], 266 | 2: [hoovedReskin(false)], 267 | }, 268 | data_link: { 269 | 2: ['wiki.html#traits-species-major_hooved'] 270 | } 271 | }); 272 | subSideMenu('add',`governor-gameplay`,task,loc(`city_${hoovedRename(true)}`,[hoovedRename(false)])); 273 | } 274 | 275 | { 276 | let task = 'trash'; 277 | infoBoxBuilder(govern,{ name: task, template: 'government', label: loc(`gov_task_${task}`), paragraphs: 7, break: [3,5,7], h_level: 3, 278 | text: { 279 | 1: `wiki_governor_task_${task}1`, 280 | 2: `wiki_governor_task_${task}2`, 281 | 3: `wiki_governor_task_${task}3`, 282 | 4: `wiki_governor_task_${task}3min`, 283 | 5: `wiki_governor_task_${task}3a`, 284 | 6: `wiki_governor_task_${task}3max`, 285 | 7: `wiki_governor_task_${task}4` 286 | }, 287 | para_data: { 288 | 7: [loc(`interstellar_mass_ejector`)], 289 | }, 290 | data_link: { 291 | 7: ['wiki.html#interstellar-structures-mass_ejector'] 292 | } 293 | }); 294 | subSideMenu('add',`governor-gameplay`,task,loc(`gov_task_${task}`)); 295 | } 296 | 297 | { 298 | let task = 'mech'; 299 | infoBoxBuilder(govern,{ name: task, template: 'government', label: loc(`gov_task_${task}`), paragraphs: 4, break: [4], h_level: 3, 300 | text: { 301 | 1: `wiki_governor_task_${task}1`, 302 | 2: `wiki_governor_task_${task}2`, 303 | 3: `wiki_governor_task_${task}3`, 304 | 4: `wiki_governor_task_${task}4` 305 | }, 306 | para_data: { 307 | 4: [1,loc(`wiki_resets_infusion`),loc(`portal_spire_name`)], 308 | }, 309 | data_link: { 310 | 4: [false,'wiki.html#resets-prestige-infusion','wiki.html#hell-structures-spire'] 311 | } 312 | }); 313 | subSideMenu('add',`governor-gameplay`,task,loc(`gov_task_${task}`)); 314 | } 315 | } 316 | } 317 | -------------------------------------------------------------------------------- /src/wiki/init.js: -------------------------------------------------------------------------------- 1 | import { } from './../achieve.js'; 2 | import { defineResources } from './../resources.js'; 3 | 4 | defineResources(true); 5 | -------------------------------------------------------------------------------- /src/wiki/perks.js: -------------------------------------------------------------------------------- 1 | import { perkList } from './../achieve.js'; 2 | import { sideMenu } from './functions.js'; 3 | 4 | export function perksPage(content){ 5 | let mainContent = $(`
    `); 6 | let perkContent = sideMenu('create',mainContent); 7 | content.append(mainContent); 8 | 9 | Object.keys(perkList).forEach(function (perk){ 10 | perkDesc(perkContent, perk); 11 | sideMenu('add',`perks-prestige`,`${perk}`,perkList[perk].name); 12 | }); 13 | } 14 | 15 | function perkDesc(content, perk){ 16 | let perkbox = $(`
    `); 17 | if (perkList[perk].hasOwnProperty('group')){ 18 | let gperk = $(`
    ${perkList[perk].name}
    `); 19 | perkList[perk].group.forEach(function(subperk){ 20 | gperk.append($(`
    ${subperk.desc(true)}
    `)); 21 | }); 22 | perkbox.append(gperk); 23 | } 24 | else { 25 | perkbox.append($(`
    ${perkList[perk].name}
    ${perkList[perk].desc(true)}
    `)); 26 | } 27 | if (perkList[perk].notes.length > 0){ 28 | let notes = $(`
    `); 29 | perkList[perk].notes.forEach(function(note){ 30 | notes.append(`
    ${note}
    `); 31 | }); 32 | perkbox.append(notes); 33 | } 34 | content.append(perkbox); 35 | } -------------------------------------------------------------------------------- /src/wiki/planets.js: -------------------------------------------------------------------------------- 1 | import { global } from './../vars.js'; 2 | import { loc } from './../locale.js'; 3 | import { planetTraits, biomes } from './../races.js'; 4 | import { headerBoxBuilder, infoBoxBuilder } from './functions.js'; 5 | 6 | export function planetsPage(content) { 7 | let info = $('
    '); 8 | 9 | let intro = headerBoxBuilder(content,{ name: 'planet', template: 'planet', paragraphs: 4, full: true, 10 | para_data: { 11 | 2: [365,'25%'], 12 | 3: [4], 13 | 4: ['200-600'] 14 | } 15 | }); 16 | infoBoxBuilder(content,{ name: 'geology', template: 'planet', label: loc('wiki_menu_planets'), paragraphs: 4, h_level: 2, 17 | para_data: { 18 | 2: [2], 19 | 3: ['-10%','+19%'], 20 | 4: [7,'+44%'] 21 | } 22 | },intro); 23 | 24 | let planetInfo = infoForFeature(biomes, $(`

    ${loc('wiki_planet_biome')}

    `)); 25 | let planetTraitsInfo = infoForFeature(planetTraits, $(`

    ${loc('wiki_planet_trait')}

    `)); 26 | info.append(planetInfo); 27 | info.append(planetTraitsInfo); 28 | content.append(info); 29 | } 30 | 31 | const extraInfo = { 32 | oceanic: ['trait','genus'], 33 | forest: ['genus'], 34 | desert: ['trait','genus'], 35 | volcanic: ['weather','genus'], 36 | tundra: ['weather','genus'], 37 | savanna: ['condition'], 38 | swamp: ['trait','trait2','genus','condition'], 39 | ashland: ['weather','trait','genus','condition'], 40 | taiga: ['weather','genus','condition'], 41 | hellscape: ['weather','genus','universe'], 42 | eden: ['geology', 'genus','universe'], 43 | stormy: ['trait'], 44 | ozone: ['trait'], 45 | trashed: ['trait'], 46 | elliptical: ['trait'], 47 | flare: ['event'], 48 | unstable: ['trait','event'], 49 | permafrost: ['trait'], 50 | retrograde: ['trait'], 51 | kamikaze: ['trait',{l:'death', v:[100]}] 52 | }; 53 | 54 | function infoForFeature(planetFeatures, content) { 55 | Object.keys(planetFeatures).forEach(function (planetFeatureName) { 56 | let planetFeature = planetFeatures[planetFeatureName]; 57 | let info = $(`
    `); 58 | content.append(info); 59 | 60 | info.append(`

    ${planetFeature.label}

    `); 61 | info.append(`
    ${planetFeature.desc}
    `); 62 | 63 | let modifiers = $(`
    `); 64 | if (planetFeature['vars'] && planetFeature['wiki']) { 65 | for (let i=0; i${loc(`wiki_planet_${planetFeatureName}${i}`,[formatBonusNumber(planetFeature.vars()[i], type)])}
    `)); 68 | } 69 | } 70 | info.append(modifiers); 71 | 72 | if (extraInfo[planetFeatureName]){ 73 | extraInfo[planetFeatureName].forEach(function (label){ 74 | if (typeof(label) === 'object'){ 75 | info.append($(`
    ${loc(`wiki_planet_${planetFeatureName}_${label.l}`,label.v)}
    `)); 76 | } 77 | else { 78 | info.append($(`
    ${loc(`wiki_planet_${planetFeatureName}_${label}`)}
    `)); 79 | } 80 | }); 81 | } 82 | }); 83 | return content; 84 | } 85 | 86 | export function formatBonusNumber(num, style) { 87 | let modRes = num - 1 * (style === 'percent' || style === 'inverted' ? 1 : 0); 88 | if (style === 'inverted' || style === 'inverted-decimal'){ 89 | modRes *= -1; 90 | if (style === 'inverted'){ 91 | style = 'percent'; 92 | } 93 | else { 94 | style = 'decimal'; 95 | } 96 | } 97 | let modResText = (modRes >= 0 ? '+' : '') + modRes.toLocaleString(global.settings.locale, { style: style, maximumFractionDigits: 2 }); 98 | let textColor = modRes >= 0 ? 'success' : 'danger'; 99 | let modResTextColored = `${modResText}`; 100 | return modResTextColored; 101 | } -------------------------------------------------------------------------------- /src/wiki/prestige.js: -------------------------------------------------------------------------------- 1 | import { clearElement } from './../functions.js'; 2 | import { crisprPage } from './crispr.js'; 3 | import { bloodPage } from './blood.js'; 4 | import { pResPage } from './p_res.js'; 5 | import { resetsPage } from './resets.js'; 6 | import { perksPage } from './perks.js'; 7 | 8 | export function prestigePage(zone){ 9 | let content = $(`#content`); 10 | clearElement(content); 11 | 12 | switch (zone){ 13 | case 'resets': 14 | resetsPage(content); 15 | break; 16 | case 'resources': 17 | pResPage(content); 18 | break; 19 | case 'crispr': 20 | crisprPage(content); 21 | break; 22 | case 'blood': 23 | bloodPage(content); 24 | break; 25 | case 'perks': 26 | perksPage(content); 27 | break; 28 | } 29 | } -------------------------------------------------------------------------------- /src/wiki/projects.js: -------------------------------------------------------------------------------- 1 | import { global, sizeApproximation } from './../vars.js'; 2 | import { loc } from './../locale.js'; 3 | import { vBind } from './../functions.js'; 4 | import { arpaProjects, arpaAdjustCosts } from './../arpa.js'; 5 | import { sideMenu } from './functions.js'; 6 | 7 | const extraInformation = { 8 | launch_facility: [loc('wiki_arpa_project_launch_facility')], 9 | monument: [monumentExtra(),loc('wiki_arpa_project_monument_random'),loc('wiki_arpa_project_monument_exceptions')], 10 | railway: [loc('wiki_arpa_project_railway_homeless',[3,7,11,17,25,38,59,100,225])], 11 | roid_eject: [loc('wiki_arpa_project_roid_eject')], 12 | tp_depot: [loc('wiki_arpa_project_depot')], 13 | nexus: [loc('wiki_arpa_project_magic')], 14 | syphon: [loc('wiki_arpa_project_magic')] 15 | }; 16 | 17 | export function projectsPage(content){ 18 | content.append(`
    ${loc('wiki_arpa_projects')}
    `); 19 | 20 | let mainContent = $(`
    `); 21 | let projectContent = sideMenu('create',mainContent); 22 | content.append(mainContent); 23 | 24 | Object.keys(arpaProjects).forEach(function (project){ 25 | let info = $(`
    `); 26 | projectContent.append(info); 27 | projectDesc(info,project); 28 | sideMenu('add',`projects-arpa`,project,typeof arpaProjects[project].title === 'string' ? arpaProjects[project].title : arpaProjects[project].title(true)); 29 | }); 30 | } 31 | 32 | function projectDesc(info,project){ 33 | let title = typeof arpaProjects[project].title === 'string' ? arpaProjects[project].title : arpaProjects[project].title(true); 34 | info.append(`

    ${title}

    `); 35 | 36 | let stats = $(`
    `); 37 | info.append(stats); 38 | 39 | stats.append(`
    ${typeof arpaProjects[project].desc === 'string' ? arpaProjects[project].desc : arpaProjects[project].desc()}
    `); 40 | stats.append(`
    ${typeof arpaProjects[project].effect === 'string' ? arpaProjects[project].effect : arpaProjects[project].effect()}
    `); 41 | 42 | if (extraInformation[project]){ 43 | let extra = $(`
    `); 44 | info.append(extra); 45 | addInformation(extra,project); 46 | } 47 | addCosts(info,project); 48 | } 49 | 50 | function addInformation(parent,key){ 51 | let extra = $(`
    `); 52 | parent.append(extra); 53 | if (extraInformation.hasOwnProperty(key)){ 54 | for (let i=0; i${extraInformation[key][i]}`); 56 | } 57 | } 58 | } 59 | 60 | function addCosts(parent,key){ 61 | let inputs = { 62 | owned: 0, 63 | creepVis: true, 64 | extra: { 65 | creative: false 66 | } 67 | }; 68 | let resources = {}; 69 | 70 | switch (key){ 71 | case 'monument': 72 | inputs.extra.m_type = 'Obelisk'; 73 | break; 74 | case 'launch_facility': 75 | inputs.creepVis = false; 76 | break; 77 | } 78 | 79 | let action = arpaProjects[key]; 80 | inputs.real_owned = global.arpa[key] ? global.arpa[key].rank : 0; 81 | 82 | let costContain = $(`
    `); 83 | parent.append(costContain); 84 | let costs = $(`

    ${loc('wiki_calc_cost')}

    `); 85 | let costCreep = $(`

    ${loc('wiki_calc_cost_creep')}

    `); 86 | costContain.append(costs); 87 | costContain.append(costCreep); 88 | 89 | let cost = action.cost; 90 | Object.keys(arpaAdjustCosts(cost)).forEach(function (res){ 91 | resources[res] = {}; 92 | let label = res === 'Money' ? '$' : global.resource[res].name + ': '; 93 | costs.append($(`
    ${label}{{ r.${res}.cost }}
    `)); 94 | costCreep.append($(`
    {{ r.${res}.creep }}
    `)); 95 | }); 96 | 97 | //Functions to update costs and cost creeps 98 | let updateCosts = function(){ 99 | let new_costs = arpaAdjustCosts(cost,inputs.owned - inputs.real_owned,inputs.extra); 100 | Object.keys(resources).forEach(function (res){ 101 | let new_cost = new_costs[res] ? new_costs[res](inputs.owned - inputs.real_owned,inputs.extra) : 0; 102 | resources[res].vis = new_cost > 0 ? true : false; 103 | resources[res].cost = sizeApproximation(new_cost,1); 104 | }); 105 | }; 106 | updateCosts(); 107 | 108 | let updateCostCreep = function(){ 109 | if (key !== 'launch_facility'){ 110 | let upper = arpaAdjustCosts(cost,100,inputs.extra); 111 | let lower = arpaAdjustCosts(cost,99,inputs.extra); 112 | Object.keys(resources).forEach(function (res){ 113 | if (upper[res]){ 114 | resources[res].creep = +(upper[res](100,inputs.extra) / lower[res](99,inputs.extra)).toFixed(4); 115 | } 116 | }); 117 | } 118 | }; 119 | updateCostCreep(); 120 | 121 | //Add calculator inputs 122 | let calcInputs = ` 123 |
    124 |
    `; 125 | if (key !== 'launch_facility'){ 126 | calcInputs += ` 127 |
    ${loc('wiki_calc_level')} -+
    `; 128 | } 129 | if (key === 'monument'){ 130 | calcInputs += ` 131 |
    ${loc('wiki_calc_m_type')} 132 | 136 | {{ 'Obelisk' | monumentLabel }} 137 | {{ 'Statue' | monumentLabel }} 138 | {{ 'Sculpture' | monumentLabel }} 139 | {{ 'Monolith' | monumentLabel }} 140 | {{ 'Pillar' | monumentLabel }} 141 | {{ 'Megalith' | monumentLabel }} 142 |
    143 | `; 144 | } 145 | calcInputs += ` 146 |
    ${loc('trait_creative_name')}
    147 |
    148 |
    149 | 150 |
    151 |
    152 | `; 153 | parent.append($(calcInputs)); 154 | 155 | vBind({ 156 | el: `#${key}`, 157 | data: { 158 | i: inputs, 159 | r: resources 160 | }, 161 | methods: { 162 | val(type){ 163 | inputs[type] = Math.round(inputs[type]); 164 | if (inputs[type] && inputs[type] < 0){ 165 | inputs[type] = 0; 166 | } 167 | updateCosts(); 168 | }, 169 | less(type){ 170 | if (inputs[type] > 0){ 171 | inputs[type]--; 172 | } 173 | }, 174 | more(type){ 175 | inputs[type]++; 176 | }, 177 | pickMonument(type){ 178 | inputs.extra.m_type = type; 179 | updateCosts(); 180 | updateCostCreep(); 181 | }, 182 | update(){ 183 | updateCosts(); 184 | updateCostCreep(); 185 | }, 186 | importInputs(){ 187 | if (key !== 'launch_facility'){ 188 | inputs.owned = inputs.real_owned; 189 | } 190 | inputs.extra.creative = global.race['creative'] ? true : false; 191 | if (key === 'monument' && global.arpa['m_type']){ 192 | inputs.extra.m_type = global.arpa.m_type; 193 | } 194 | } 195 | }, 196 | filters: { 197 | monumentLabel(type){ 198 | switch(type){ 199 | case 'Obelisk': 200 | return loc('arpa_project_monument_obelisk'); 201 | case 'Statue': 202 | return loc('arpa_project_monument_statue'); 203 | case 'Sculpture': 204 | return loc('arpa_project_monument_sculpture'); 205 | case 'Monolith': 206 | return loc('arpa_project_monument_monolith'); 207 | case 'Pillar': 208 | return loc('arpa_project_monument_pillar'); 209 | case 'Megalith': 210 | return loc('arpa_project_monument_megalith'); 211 | } 212 | } 213 | } 214 | }); 215 | } 216 | 217 | function monumentExtra(){ 218 | let monuments = [ 219 | loc('arpa_project_monument_obelisk'), 220 | loc('arpa_project_monument_statue'), 221 | loc('arpa_project_monument_sculpture'), 222 | loc('arpa_project_monument_monolith'), 223 | loc('arpa_project_monument_pillar'), 224 | loc('arpa_project_monument_megalith') 225 | ]; 226 | let materials = [ 227 | loc('resource_Stone_name'), 228 | loc('resource_Aluminium_name'), 229 | loc('resource_Steel_name'), 230 | loc('resource_Cement_name'), 231 | loc('resource_Bones_name'), 232 | loc('resource_Crystal_name'), 233 | ]; 234 | let desc = `
    ${loc('wiki_arpa_project_monument',[monuments.length, monuments.join(", ")])}
    `; 235 | for (let i=0; i${loc('wiki_arpa_project_monument_type',[ 237 | `${monuments[i]}`, 238 | `${materials[i]}` 239 | ])}`; 240 | } 241 | return desc; 242 | } -------------------------------------------------------------------------------- /src/wiki/resets.js: -------------------------------------------------------------------------------- 1 | import { loc } from './../locale.js'; 2 | import { universe_types } from './../space.js'; 3 | import { infoBoxBuilder, sideMenu, createCalcSection } from './functions.js'; 4 | import { prestigeCalc } from './p_res.js'; 5 | import { massCalc } from './mechanics.js'; 6 | 7 | export function resetsPage(content){ 8 | let mainContent = sideMenu('create',content); 9 | 10 | let resets = ['mad','bioseed','blackhole','vacuum','ascension','cataclysm','terraform','infusion','apotheosis','ai','matrix','retired','eden']; 11 | let reset_labels = resets.map(x => `${loc(`wiki_resets_${x}`)}`); 12 | 13 | infoBoxBuilder(mainContent,{ name: 'intro', template: 'resets', paragraphs: 3, h_level: 2, 14 | para_data: { 1: [resets.length, reset_labels.slice(0, -1).join(', ') + `, & ${reset_labels[reset_labels.length - 1]}`] }, 15 | data_color: { 1: ['warning','plain'] } 16 | }); 17 | sideMenu('add',`resets-prestige`,'intro',loc('wiki_menu_intro')); 18 | 19 | // MAD 20 | let section = infoBoxBuilder(mainContent,{ name: 'mad', template: 'resets', paragraphs: 9, break: [6,9], h_level: 2, 21 | para_data: { 22 | 3: [loc('wiki_p_res_plasmids')], 23 | 4: [loc('tech_rocketry'),loc('tech_mad')], 24 | 5: [loc('tab_civics'),loc('tab_military')], 25 | 6: [loc('wiki_p_res_plasmids')], 26 | 7: [loc('wiki_p_res_plasmids')], 27 | 9: [loc('wiki_resets_mad')] 28 | }, 29 | data_color: { 30 | 3: ['danger'], 31 | 6: ['danger'], 32 | 7: ['danger'] 33 | } 34 | }); 35 | section = createCalcSection(section,'mad','gain'); 36 | prestigeCalc(section,'plasmid',false,'mad'); 37 | sideMenu('add',`resets-prestige`,'mad',loc('wiki_resets_mad')); 38 | 39 | // Bioseed 40 | section = infoBoxBuilder(mainContent,{ name: 'bioseed', template: 'resets', paragraphs: 12, break: [5,8,12], h_level: 2, 41 | para_data: { 42 | 2: [loc('tech_genesis_ship')], 43 | 3: [loc('wiki_p_res_plasmids'),loc('wiki_p_res_phage')], 44 | 4: [loc('wiki_p_res_plasmids')], 45 | 5: [loc('tech_genesis_ship'),loc('tech_star_dock')], 46 | 6: [loc('tech_interstellar'),loc('tech_star_dock')], 47 | 7: [loc('tech_genesis_ship')], 48 | 9: [loc('tech_interstellar'),loc('star_dock_probe_desc')], 49 | 10: [loc('wiki_planet_planet')], 50 | 12: [loc('wiki_resets_bioseed')] 51 | }, 52 | data_color: { 53 | 3: ['danger','danger'], 54 | 4: ['danger'] 55 | }, 56 | data_link: { 10: ['wiki.html#planets-gameplay'] } 57 | }); 58 | section = createCalcSection(section,'bioseed','gain'); 59 | prestigeCalc(section,'plasmid',false,'bioseed'); 60 | prestigeCalc(section,'phage',false,'bioseed'); 61 | sideMenu('add',`resets-prestige`,'bioseed',loc('wiki_resets_bioseed')); 62 | 63 | // Blackhole 64 | let universes = []; 65 | Object.keys(universe_types).forEach(function (universe){ 66 | universes.push(universe); 67 | }); 68 | let universe_labels = universes.map(x => `${loc(`universe_${x}`)}`); 69 | 70 | section = infoBoxBuilder(mainContent,{ name: 'blackhole', template: 'resets', paragraphs: 12, break: [3,6,9,12], h_level: 2, 71 | para_data: { 72 | 2: [loc('wiki_p_res_plasmids'),loc('wiki_p_res_phage'),loc('wiki_p_res_dark')], 73 | 3: [loc('tech_dist_stellar_engine')], 74 | 4: [loc('tech_mass_ejector'),loc('wiki_resets_blackhole_exotic'),0.025,loc('resource_Elerium_name'),loc('resource_Infernite_name')], 75 | 5: [loc('wiki_p_res_dark')], 76 | 6: [loc('wiki_resets_blackhole_exotic'),loc('tech_exotic_infusion')], 77 | 7: [10,loc('wiki_hell_soul_gem')], 78 | 8: [loc('tech_stabilize_blackhole'),loc('wiki_resets_blackhole_exotic')], 79 | 10: [universes.length, universe_labels.slice(0, -1).join(', ') + `, ${loc('or')} ${universe_labels[universe_labels.length - 1]}`], 80 | 12: [loc('wiki_resets_blackhole')] 81 | }, 82 | data_color: { 83 | 2: ['danger','danger','danger'], 84 | 4: ['warning','warning','warning','caution','caution'], 85 | 5: ['danger'], 86 | 7: ['warning','caution'], 87 | 10: ['warning','plain'] 88 | } 89 | }); 90 | let subSection = createCalcSection(section,'bigbang','gain'); 91 | prestigeCalc(subSection,'plasmid',false,'bigbang'); 92 | prestigeCalc(subSection,'phage',false,'bigbang'); 93 | prestigeCalc(subSection,'dark',false,'bigbang'); 94 | subSection = createCalcSection(section,'eject','mass'); 95 | massCalc(subSection); 96 | sideMenu('add',`resets-prestige`,'blackhole',loc('wiki_resets_blackhole')); 97 | 98 | // Vacuum Collapse 99 | section = infoBoxBuilder(mainContent,{ name: 'vacuum', template: 'resets', paragraphs: 10, break: [4,8,10], h_level: 2, 100 | para_data: { 101 | 4: [80], 102 | 6: [loc('arpa_syphon_damage')], 103 | 7: [80], 104 | 8: [loc('wiki_p_res_plasmids'),loc('wiki_p_res_phage'),loc('wiki_p_res_dark')], 105 | 9: [loc('wiki_p_res_dark')], 106 | 10: [loc('wiki_resets_vacuum')], 107 | }, 108 | data_color: { 109 | 6: ['danger'], 110 | 8: ['danger','danger','danger'], 111 | 9: ['danger'], 112 | } 113 | }); 114 | section = createCalcSection(section,'vacuum','gain'); 115 | prestigeCalc(section,'plasmid',false,'vacuum'); 116 | prestigeCalc(section,'phage',false,'vacuum'); 117 | prestigeCalc(section,'dark','vacuum','vacuum'); 118 | sideMenu('add',`resets-prestige`,'vacuum',loc('wiki_resets_vacuum')); 119 | 120 | // Ascension 121 | section = infoBoxBuilder(mainContent,{ name: 'ascension', template: 'resets', paragraphs: 10, break: [3,5,7,10], h_level: 2, 122 | para_data: { 123 | 2: [loc('wiki_p_res_plasmids'),loc('wiki_p_res_phage'),loc('wiki_p_res_harmony')], 124 | 3: [loc('interstellar_ascension_machine'),'10,000',loc('interstellar_thermal_collector')], 125 | 4: [100,25], 126 | 7: [`+2%`], 127 | 8: [`+2`,`+5%`,`+10%`], 128 | 10: [loc('wiki_resets_ascension')] 129 | }, 130 | data_color: { 131 | 2: ['danger','danger','danger'], 132 | } 133 | }); 134 | section = createCalcSection(section,'ascend','gain'); 135 | prestigeCalc(section,'plasmid',false,'ascend'); 136 | prestigeCalc(section,'phage',false,'ascend'); 137 | prestigeCalc(section,'harmony',false,'ascend'); 138 | sideMenu('add',`resets-prestige`,'ascension',loc('wiki_resets_ascension')); 139 | 140 | // Cataclysm 141 | section = infoBoxBuilder(mainContent,{ name: 'cataclysm', template: 'resets', paragraphs: 10, break: [4,7,10], h_level: 2, 142 | para_data: { 143 | 1: [loc('planet_unstable')], 144 | 2: [loc('tech_world_collider')], 145 | 3: [loc('tech_dial_it_to_11'),loc('tech_limit_collider')], 146 | 6: [loc('wiki_p_res_plasmids'),loc('wiki_p_res_phage')], 147 | 10: [loc('wiki_resets_cataclysm')] 148 | }, 149 | data_color: { 150 | 6: ['danger','danger'] 151 | } 152 | }); 153 | section = createCalcSection(section,'cataclysm','gain'); 154 | prestigeCalc(section,'plasmid',false,'cataclysm'); 155 | prestigeCalc(section,'phage',false,'cataclysm'); 156 | sideMenu('add',`resets-prestige`,'cataclysm',loc('wiki_resets_cataclysm')); 157 | 158 | // Terraform 159 | section = infoBoxBuilder(mainContent,{ name: 'terraform', template: 'resets', paragraphs: 19, break: [3,6,7,10,12,19], h_level: 2, 160 | para_data: { 161 | 1: [loc('wiki_resets_terraform'),loc(`evo_challenge_orbit_decay`)], 162 | 2: [loc('wiki_resets_ascension')], 163 | 3: [loc('wiki_p_res_plasmids'),loc('wiki_p_res_phage'),loc('wiki_p_res_harmony')], 164 | 7: [loc('achieve_lamentis_name')], 165 | 8: [1], 166 | 10: [loc('rejuvenated')], 167 | 13: ['10%'], 168 | 14: ['5%'], 169 | 16: ['2%','50%'], 170 | 17: ['50%'], 171 | 19: [loc('wiki_resets_terraform')], 172 | } 173 | }); 174 | section = createCalcSection(section,'terraform','gain'); 175 | prestigeCalc(section,'plasmid',false,'terraform'); 176 | prestigeCalc(section,'phage',false,'terraform'); 177 | prestigeCalc(section,'harmony',false,'terraform'); 178 | sideMenu('add',`resets-prestige`,'terraform',loc('wiki_resets_terraform')); 179 | 180 | // Demonic Infusion 181 | section = infoBoxBuilder(mainContent,{ name: 'infusion', template: 'resets', paragraphs: 8, break: [4,8], h_level: 2, 182 | para_data: { 183 | 2: [loc('resource_Artifact_name')], 184 | 5: [loc('resource_Demonic_Essence_name')], 185 | 6: [loc('resource_Demonic_Essence_name')], 186 | 7: [loc('achieve_corrupted_name')], 187 | 8: [loc('wiki_resets_infusion')], 188 | }, 189 | data_color: { 190 | 2: ['danger'], 191 | 7: ['caution'] 192 | } 193 | }); 194 | section = createCalcSection(section,'descend','gain'); 195 | prestigeCalc(section,'artifact',false,'descend'); 196 | sideMenu('add',`resets-prestige`,'infusion',loc('wiki_resets_infusion')); 197 | 198 | // Apotheosis 199 | section = infoBoxBuilder(mainContent,{ name: 'apotheosis', template: 'resets', paragraphs: 7, break: [4,6,7], h_level: 2, 200 | para_data: { 201 | 2: [loc('resource_Supercoiled_name')], 202 | 3: [1,loc('resource_Plasmid_name')], 203 | 4: [50,loc('resource_Demonic_Essence_name'),loc(`tab_eden`)], 204 | 5: [loc('wiki_resets_infusion')], 205 | 6: [9], 206 | 7: [loc('wiki_resets_apotheosis')], 207 | }, 208 | data_color: { 209 | 2: ['danger'], 210 | 3: ['warning','danger'], 211 | } 212 | }); 213 | section = createCalcSection(section,'apotheosis','gain'); 214 | prestigeCalc(section,'supercoiled',false,'apotheosis'); 215 | sideMenu('add',`resets-prestige`,'apotheosis',loc('wiki_resets_apotheosis')); 216 | 217 | // AI Appoc 218 | section = infoBoxBuilder(mainContent,{ name: 'ai', template: 'resets', paragraphs: 8, break: [3,6,7,8], h_level: 2, 219 | para_data: { 220 | 2: [loc('evo_challenge_truepath')], 221 | 3: [loc('space_ai_core'),loc('wiki_resets_ai_drift'),'100%'], 222 | 4: [loc('tech_protocol66')], 223 | 5: [loc('space_ai_colonist_title'),loc('space_decoder_title'),loc('space_shock_trooper_title'),loc('space_tank_title')], 224 | 6: [loc('wiki_resets_ai'),loc('wiki_p_res_plasmids'),loc('wiki_p_res_phage'),loc('wiki_p_res_ai_core')], 225 | 7: [loc('genelab_genus_synthetic')], 226 | 8: [loc('wiki_resets_ai')], 227 | }, 228 | data_color: { 229 | 6: ['warning','danger','danger','danger'], 230 | }, 231 | data_link: { 232 | 2: ['wiki.html#challenges-gameplay-scenarios_truepath'], 233 | 3: ['wiki.html#space-tp_structures-ai_core'], 234 | 4: ['wiki.html#solar-tp_tech-protocol66'], 235 | 5: ['#space-tp_structures-ai_colonist','#space-tp_structures-decoder','#space-tp_structures-shock_trooper','#space-tp_structures-tank'], 236 | } 237 | }); 238 | section = createCalcSection(section,'ai','gain'); 239 | prestigeCalc(section,'plasmid',false,'ai'); 240 | prestigeCalc(section,'phage',false,'ai'); 241 | prestigeCalc(section,'cores',false,'ai'); 242 | sideMenu('add',`resets-prestige`,'ai',loc('wiki_resets_ai')); 243 | 244 | // Matrix 245 | section = infoBoxBuilder(mainContent,{ name: 'matrix', template: 'resets', paragraphs: 6, break: [3,5,6], h_level: 2, 246 | para_data: { 247 | 2: [loc('evo_challenge_truepath')], 248 | 3: [loc('tau_star_ringworld')], 249 | 5: [loc('wiki_resets_matrix'),loc('wiki_p_res_plasmids'),loc('wiki_p_res_phage'),loc('civics_servants')], 250 | 6: [loc('wiki_resets_matrix')], 251 | }, 252 | data_color: { 253 | 5: ['warning','danger','danger','danger'], 254 | }, 255 | data_link: { 256 | 2: ['wiki.html#challenges-gameplay-scenarios_truepath'], 257 | 3: ['wiki.html#tauceti-structures-ringworld'], 258 | } 259 | }); 260 | section = createCalcSection(section,'matrix','gain'); 261 | prestigeCalc(section,'plasmid',false,'matrix'); 262 | prestigeCalc(section,'phage',false,'matrix'); 263 | sideMenu('add',`resets-prestige`,'matrix',loc('wiki_resets_matrix')); 264 | 265 | // Retirement 266 | section = infoBoxBuilder(mainContent,{ name: 'retired', template: 'resets', paragraphs: 6, break: [3,5,6], h_level: 2, 267 | para_data: { 268 | 2: [loc('evo_challenge_truepath')], 269 | 3: [loc('tech_matrioshka_brain'),loc('tech_ignition_device')], 270 | 5: [loc('wiki_resets_retired'),loc('wiki_p_res_plasmids'),loc('wiki_p_res_phage'),loc('civics_servants')], 271 | 6: [loc('wiki_resets_retired')], 272 | }, 273 | data_color: { 274 | 5: ['warning','danger','danger','danger'], 275 | }, 276 | data_link: { 277 | 2: ['wiki.html#challenges-gameplay-scenarios_truepath'], 278 | 3: ['wiki.html#tauceti-structures-matrioshka_brain','wiki.html#tauceti-structures-ignition_device'], 279 | } 280 | }); 281 | section = createCalcSection(section,'retired','gain'); 282 | prestigeCalc(section,'plasmid',false,'retired'); 283 | prestigeCalc(section,'phage',false,'retired'); 284 | sideMenu('add',`resets-prestige`,'retired',loc('wiki_resets_retired')); 285 | 286 | // Garden of Eden 287 | section = infoBoxBuilder(mainContent,{ name: 'eden', template: 'resets', paragraphs: 6, break: [3,5,6], h_level: 2, 288 | para_data: { 289 | 2: [loc('evo_challenge_lone_survivor')], 290 | 3: [loc('tau_star_ringworld')], 291 | 4: [loc('tau_star_goe_facility')], 292 | 5: [loc('wiki_resets_eden'),loc('wiki_p_res_plasmids'),loc('wiki_p_res_phage'),loc('civics_servants')], 293 | 6: [loc('wiki_resets_eden')], 294 | }, 295 | data_color: { 296 | 5: ['warning','danger','danger','danger'], 297 | }, 298 | data_link: { 299 | 2: ['wiki.html#challenges-gameplay-scenarios_truepath'], 300 | 3: ['wiki.html#tauceti-structures-ringworld'], 301 | 4: ['wiki.html#tauceti-structures-goe_facility'], 302 | } 303 | }); 304 | section = createCalcSection(section,'eden','gain'); 305 | prestigeCalc(section,'plasmid',false,'eden'); 306 | prestigeCalc(section,'phage',false,'eden'); 307 | sideMenu('add',`resets-prestige`,'eden',loc('wiki_resets_eden')); 308 | } 309 | -------------------------------------------------------------------------------- /src/wiki/search.js: -------------------------------------------------------------------------------- 1 | import { loc } from './../locale.js'; 2 | import { clearElement } from './../functions.js'; 3 | import { faqPage } from './faq.js'; 4 | import { basicsPage } from './basics.js'; 5 | import { mechanicsPage } from './mechanics.js'; 6 | import { govPage } from './government.js'; 7 | import { governPage } from './governor.js'; 8 | import { combatPage } from './combat.js'; 9 | import { challengesPage } from './challenges.js'; 10 | import { resetsPage } from './resets.js'; 11 | import { planetsPage } from './planets.js'; 12 | import { universePage } from './universes.js'; 13 | import { hellPage } from './hell.js'; 14 | import { pResPage } from './p_res.js'; 15 | import { perksPage } from './perks.js'; 16 | import { mainEventsPage, minorEventsPage, progressEventsPage, specialEventsPage} from './events.js'; 17 | import { racesPage, traitsPage } from './species.js'; 18 | import { structuresIndex } from './structuresIndex.js'; 19 | import { renderTechPage } from './tech.js'; 20 | import { projectsPage } from './projects.js'; 21 | import { crisprPage } from './crispr.js'; 22 | import { bloodPage } from './blood.js'; 23 | import { achievePage, featPage } from './achieve.js'; 24 | import { changeList } from './change.js'; 25 | 26 | let content; 27 | let fakecontent; 28 | let earlyExit = false; 29 | const pages = [ 30 | [faqPage, false, "faq", undefined], 31 | [basicsPage, false, "gameplay", "basics"], 32 | [mechanicsPage, true, "gameplay", "mechanics"], 33 | [govPage, true, "gameplay", "government"], 34 | [governPage, true, "gameplay", "governor"], 35 | [combatPage, true, "gameplay", "combat"], 36 | [challengesPage, false, "gameplay", "challenges"], 37 | [resetsPage, true, "gameplay", "resets"], 38 | [planetsPage, false, "gameplay", "planets"], 39 | [universePage, true, "gameplay", "universes"], 40 | [hellPage, true, "gameplay", "hell"], 41 | [pResPage, true, "prestige", "resources"], 42 | [perksPage, true, "prestige", "perks"], 43 | [mainEventsPage, true, "events", "major"], 44 | [minorEventsPage, true, "events", "minor"], 45 | [progressEventsPage, true, "events", "progress"], 46 | [specialEventsPage, true, "events", "special"], 47 | [racesPage, true, "species", "races"], 48 | [traitsPage, true, "species", "traits"], 49 | [structuresIndex, false, "structures", "prehistoric"], 50 | [structuresIndex, false, "structures", "planetary"], 51 | [structuresIndex, false, "structures", "space"], 52 | [structuresIndex, false, "structures", "interstellar"], 53 | [structuresIndex, false, "structures", "intergalactic"], 54 | [structuresIndex, false, "structures", "hell"], 55 | [renderTechPage, false, "tech", "prehistoric"], 56 | [renderTechPage, false, "tech", "civilized"], 57 | [renderTechPage, false, "tech", "discovery"], 58 | [renderTechPage, false, "tech", "industrialized"], 59 | [renderTechPage, false, "tech", "globalized"], 60 | [renderTechPage, false, "tech", "early_space"], 61 | [renderTechPage, false, "tech", "deep_space"], 62 | [renderTechPage, false, "tech", "interstellar"], 63 | [renderTechPage, false, "tech", "tech_intergalactic"], 64 | [renderTechPage, false, "tech", "dimensional"], 65 | [structuresIndex, false, "tp_structures", "tp_prehistoric"], 66 | [structuresIndex, false, "tp_structures", "tp_planetary"], 67 | [structuresIndex, false, "tp_structures", "tp_space"], 68 | [structuresIndex, false, "tp_structures", "tp_tauceti"], 69 | [renderTechPage, false, "tp_tech", "tp_prehistoric"], 70 | [renderTechPage, false, "tp_tech", "tp_civilized"], 71 | [renderTechPage, false, "tp_tech", "tp_discovery"], 72 | [renderTechPage, false, "tp_tech", "tp_industrialized"], 73 | [renderTechPage, false, "tp_tech", "tp_globalized"], 74 | [renderTechPage, false, "tp_tech", "tp_early_space"], 75 | [renderTechPage, false, "tp_tech", "tp_deep_space"], 76 | [renderTechPage, false, "tp_tech", "solar"], 77 | [renderTechPage, false, "tp_tech", "tp_tauceti"], 78 | [crisprPage, true, "arpa", "crispr"], 79 | [projectsPage, true, "arpa", "projects"], 80 | [bloodPage, true, "arpa", "blood"], 81 | [achievePage, false, "achievements", "achievements"], 82 | [featPage, false, "achievements", "feats"], 83 | [changeList, false, "changelog", "changelog"] 84 | ]; 85 | let sections = { 86 | faq: [], gameplay: [], prestige: [], events: [], species: [], structures: [], 87 | tech: [], tp_structures: [], tp_tech: [], arpa: [], achievements: [], changelog: [] 88 | }; 89 | let index = { 90 | faq: [], gameplay: [], prestige: [], events: [], species: [], structures: [], 91 | tech: [], tp_structures: [], tp_tech: [], arpa: [], achievements: [], changelog: [] 92 | }; 93 | function indexPage(page){ 94 | if(pages[page][1]){ 95 | pages[page][0](fakecontent); 96 | let v = $("#sideContent a"); 97 | for(let i = 0; i < v.length; i++) index[pages[page][2]].push([v[i].innerText, v[i].getAttribute("href"), pages[page][3]]); 98 | fakecontent.empty(); 99 | } else { 100 | if(pages[page][0] === faqPage){ 101 | faqPage(); 102 | let v = $(".question h2"); 103 | for(let i = 0; i < v.length; i++) index["faq"].push([v[i].innerText, `wiki.html#question-faq-${v[i].id}`]); 104 | } else if(pages[page][0] === basicsPage){ 105 | basicsPage(fakecontent); 106 | let v = $(".header.has-text-warning"); 107 | for(let i = 0; i < v.length; i++) index["gameplay"].push([v[i].innerText, `wiki.html#basics-gameplay-${v[i].innerText.toLowerCase().replaceAll(' ', '_')}`, "basics"]); 108 | } else if(pages[page][0] === challengesPage){ 109 | challengesPage(fakecontent); 110 | let v = $("#sideContent a"); 111 | for(let i = 0; i < v.length; i++) index["gameplay"].push([v[i].innerText.replaceAll('ᄂ', ''), v[i].getAttribute("href"), "challenges"]); 112 | } else if(pages[page][0] === planetsPage){ 113 | planetsPage(fakecontent); 114 | let v = $("h4"); 115 | for(let i = 0; i < v.length; i++) index["gameplay"].push([v[i].innerText, "wiki.html#planets-gameplay", "planets"]); 116 | } else if(pages[page][0] === structuresIndex){ 117 | if(pages[page][2] === "tp_structures"){ 118 | let v = structuresIndex[pages[page][3].substring(3)]; 119 | for(let i = 0; i < v.length; i++) index["tp_structures"].push([v[i][0], "wiki.html#" + v[i][1], pages[page][3]]); 120 | } else { 121 | let v = structuresIndex[pages[page][3]]; 122 | for(let i = 0; i < v.length; i++) index["structures"].push([v[i][0], "wiki.html#" + v[i][1], pages[page][3]]); 123 | } 124 | } else if(pages[page][0] === renderTechPage){ 125 | if(pages[page][2] === "tp_tech"){ 126 | renderTechPage(pages[page][3], "truepath"); 127 | let v = $("#sideContent a"); 128 | for(let i = 0; i < v.length; i++) index[pages[page][2]].push([v[i].innerText, v[i].getAttribute("href"), pages[page][3]]); 129 | } else { 130 | renderTechPage(pages[page][3], "standard"); 131 | let v = $("#sideContent a"); 132 | for(let i = 0; i < v.length; i++) index[pages[page][2]].push([v[i].innerText, v[i].getAttribute("href"), pages[page][3]]); 133 | } 134 | } else if(pages[page][0] === achievePage){ 135 | achievePage(); 136 | let v = $(".achievement .achieve"); 137 | for(let i = 0; i < v.length; i++) index[pages[page][2]].push([v[i].innerText, "wiki.html#list-achievements", pages[page][3]]); 138 | } else if(pages[page][0] === featPage){ 139 | featPage(); 140 | let v = $(".achievement .achieve"); 141 | for(let i = 0; i < v.length; i++) index[pages[page][2]].push([v[i].innerText, "wiki.html#feats-achievements", pages[page][3]]); 142 | } else if(pages[page][0] === changeList){ 143 | for(let i = 0; i < changeList.length; i++){ 144 | index["changelog"].push([changeList[i].version, `wiki.html#version-changelog-${changeList[i].version.replaceAll('.', '_')}`, changeList[i].version]); 145 | index["changelog"].push([changeList[i].date, `wiki.html#version-changelog-${changeList[i].version.replaceAll('.', '_')}`, changeList[i].version]); 146 | for(let k = 0; k < changeList[i].changes.length; k++){ 147 | index["changelog"].push([changeList[i].changes[k], `wiki.html#version-changelog-${changeList[i].version.replaceAll('.', '_')}`, changeList[i].version]); 148 | } 149 | } 150 | } 151 | fakecontent.empty(); 152 | } 153 | } 154 | export function cancelSearchIndexing(){ 155 | earlyExit = true; 156 | } 157 | function indexWiki(){ 158 | for(const k of Object.keys(index)) index[k] = []; 159 | content.attr("id", ""); 160 | content.append(``); 161 | fakecontent = $("#content"); 162 | earlyExit = false; 163 | async function nonLockingLoop(indexingIndex = 0){ 164 | if(earlyExit){ 165 | fakecontent.remove(); 166 | content.attr("id", "content"); 167 | return; 168 | } 169 | if(indexingIndex < pages.length){ 170 | setTimeout(() => { 171 | indexPage(indexingIndex); 172 | nonLockingLoop(++indexingIndex); 173 | }, 0); 174 | } else { 175 | fakecontent.remove(); 176 | content.attr("id", "content"); 177 | } 178 | } 179 | nonLockingLoop(); 180 | } 181 | 182 | function processSearch(input){ 183 | for(const k of Object.keys(sections)) sections[k] = []; 184 | if(input.val().length){ 185 | let expression = new RegExp(input.val(), "gi"); 186 | 187 | for(const k of Object.keys(index)){ 188 | for(let i = 0; i < index[k].length; i++){ 189 | if(index[k][i][0].match(expression) !== null){ 190 | sections[k].push(index[k][i]); 191 | } 192 | } 193 | } 194 | } 195 | updateResults(); 196 | } 197 | function updateResults(){ 198 | for(const k of Object.keys(sections)){ 199 | let element = $("#searchResult-" + k); 200 | clearElement(element); 201 | if(sections[k].length === 0){ 202 | element.append(`

    ${loc('wiki_search_placeholder')}

    `); 203 | } else { 204 | let headers = []; 205 | for(const v of sections[k]){ 206 | if(v[2] !== undefined){ 207 | if(!headers.includes(v[2])){ 208 | headers.push(v[2]); 209 | if((v[2].match(/\./gi) || []).length > 1){ 210 | element.append(`

    v${v[2]}

    `); 211 | } else { 212 | element.append(`

    ${loc("wiki_menu_" + (v[2].includes("tp_") ? v[2].substring(3) : v[2].includes("tech_") ? v[2].substring(5) : v[2]))}

    `); 213 | } 214 | } 215 | if((v[2].match(/\./gi) || []).length > 1){ 216 | $(`#changelog-entry-${v[2].replaceAll('.', '_')}`).append(`

    ${v[0]}

    `); 217 | } else { 218 | $(`#${v[2]}`).append(`

    ${v[0]}

    `); 219 | } 220 | } else { 221 | element.append(`

    ${v[0]}

    `); 222 | } 223 | } 224 | } 225 | } 226 | } 227 | export function search(){ 228 | content = $("#content"); 229 | clearElement(content); 230 | content.append( 231 | ` 232 |
    233 | ${loc('wiki_menu_search')} 234 |
    235 | 236 |
    237 |
    238 | ` 239 | ); 240 | let input = $("#searchInput"); 241 | input.parent().on('input', ':text', _ => processSearch(input)); 242 | indexWiki(); 243 | for(const k of Object.keys(sections)){ 244 | content.append(`

    ${loc('wiki_menu_' + k)}

    `); 245 | } 246 | updateResults(content); 247 | } 248 | -------------------------------------------------------------------------------- /src/wiki/species.js: -------------------------------------------------------------------------------- 1 | import { global } from './../vars.js'; 2 | import { loc } from './../locale.js'; 3 | import { clearElement, popover, getEaster, getHalloween, getTraitDesc } from './../functions.js'; 4 | import { races, traits, genus_def, traitSkin } from './../races.js'; 5 | import { ascendLab } from './../space.js'; 6 | import { actions } from './../actions.js'; 7 | import { sideMenu } from './functions.js'; 8 | import { customRaceMechanics } from './mechanics.js'; 9 | 10 | const hallowed = getHalloween(); 11 | 12 | export function speciesPage(zone){ 13 | let content = $(`#content`); 14 | clearElement(content); 15 | 16 | switch (zone){ 17 | case 'races': 18 | racesPage(content); 19 | break; 20 | case 'traits': 21 | traitsPage(content); 22 | break; 23 | case 'custom': 24 | customPage(content); 25 | break; 26 | } 27 | } 28 | 29 | export function customPage(content) { 30 | customRaceMechanics(content,true); 31 | let lab = $(`
    `); 32 | content.append(lab); 33 | ascendLab(false,lab); 34 | } 35 | 36 | const evolutionPath = { 37 | angelic: ['phagocytosis', 'mammals', 'celestial'], 38 | aquatic: ['phagocytosis', 'aquatic'], 39 | avian: ['phagocytosis', 'eggshell', 'endothermic'], 40 | carnivore: ['phagocytosis', 'mammals', 'animalism', 'carnivore'], 41 | demonic: ['phagocytosis', 'mammals', 'demonic'], 42 | eldritch: ['phagocytosis', 'eldritch'], 43 | fey: ['phagocytosis', 'fey'], 44 | fungi: ['chitin'], 45 | giant: ['phagocytosis', 'mammals', 'gigantism'], 46 | heat: ['phagocytosis', 'heat'], 47 | herbivore: ['phagocytosis', 'mammals', 'animalism', 'herbivore'], 48 | humanoid: ['phagocytosis', 'mammals', 'humanoid'], 49 | insectoid: ['phagocytosis', 'athropods'], 50 | plant: ['chloroplasts'], 51 | polar: ['phagocytosis', 'polar'], 52 | reptilian: ['phagocytosis', 'eggshell', 'ectothermic'], 53 | sand: ['phagocytosis', 'sand'], 54 | small: ['phagocytosis', 'mammals', 'dwarfism'], 55 | synthetic: ['exterminate'], 56 | }; 57 | 58 | Object.keys(evolutionPath).forEach(function (key) { 59 | evolutionPath[key] = evolutionPath[key].map(function (s) { return typeof actions.evolution[s].title === 'function' ? actions.evolution[s].title() : actions.evolution[s].title; }).join(' -> '); 60 | }); 61 | 62 | export function racesPage(content){ 63 | content = sideMenu('create',content); 64 | 65 | let genus_trank_pri = (global.stats.achieve['pathfinder'] && global.stats.achieve.pathfinder.l >= 4) ? 2 : 1; 66 | let genus_trank_sec = (global.stats.achieve['pathfinder'] && global.stats.achieve.pathfinder.l >= 4) ? 1 : 0.5; 67 | let list = []; 68 | Object.keys(races).forEach(function (race){ 69 | if ((race === 'custom' && !global.custom.hasOwnProperty('race0')) 70 | || (race === 'hybrid' && !global.custom.hasOwnProperty('race1')) 71 | || race === 'protoplasm'){ 72 | return; 73 | } 74 | 75 | let info = $(`
    `); 76 | content.append(info); 77 | 78 | let typeList = []; 79 | let genusListing = ``; 80 | if (races[race].type === 'hybrid'){ 81 | typeList = races[race].hybrid; 82 | } 83 | else { 84 | typeList.push(races[race].type); 85 | } 86 | 87 | typeList.forEach(function (gType){ 88 | genusListing += `${loc(`genelab_genus_${gType}`)}`; 89 | }); 90 | 91 | info.append(`

    ${races[race].name}

    ${genusListing}
    `); 92 | info.append(`
    ${typeof races[race].desc === 'string' ? races[race].desc : races[race].desc()}
    `); 93 | 94 | let traitList = []; 95 | let extraTraits = extraTraitList(race); 96 | 97 | let genes = $(`
    `); 98 | let firstType = true; // For hybrids, arbitrarily display one type as primary and the other as secondary 99 | 100 | (typeList.includes('carnivore') && typeList.includes('herbivore') ? ['omnivore'] : typeList).forEach(function (gType){ 101 | if (race !== 'hellspawn'){ 102 | Object.keys(genus_def[gType].traits).sort().forEach(function (trait){ 103 | let id = `raceTrait${race}${trait}`; 104 | let color = races[race].fanaticism === trait ? 'danger' : 'caution'; 105 | genes.append(`${traitSkin('name', trait, race)}`); 106 | traitList.push({ t: trait, r: firstType ? genus_trank_pri : genus_trank_sec}); 107 | }); 108 | } 109 | firstType = false; 110 | }); 111 | 112 | Object.keys(races[race].traits).sort().forEach(function (trait){ 113 | if (hallowed.active && ((race === 'tortoisan' && trait === 'slow') || (race === 'unicorn' && trait === 'rainbow'))){ 114 | return; 115 | } 116 | let id = `raceTrait${race}${trait}`; 117 | let color = races[race].fanaticism === trait ? 'danger' : 'info'; 118 | genes.append(`${traitSkin('name', trait, race)}`); 119 | traitList.push({ t: trait, r: races[race].traits[trait] }); 120 | }); 121 | for (let i=0; i${traitSkin('name', extraTraits[i].t, race)}`); 125 | traitList.push(extraTraits[i]); 126 | } 127 | info.append(genes); 128 | list.push(race); 129 | 130 | typeList.forEach(function (gType){ 131 | popover(`genus${race}${gType}`,$(`
    ${loc(`genelab_genus_${gType}_desc`)}

    ${evolutionPath[gType]}
    `),{ wide: true, classes: 'w25' }); 132 | }); 133 | 134 | for (let i=0; i`); 137 | 138 | getTraitDesc(desc, traitList[i].t, { 139 | fanatic: traitList[i].t === races[race].fanaticism ? races[race].name : false, 140 | trank: traitList[i].r, 141 | rpage: true, 142 | wiki: true, 143 | species: race 144 | }); 145 | 146 | popover(id,desc,{ wide: true, classes: 'w25' }); 147 | } 148 | }); 149 | 150 | list.sort((a,b) => races[a].name < races[b].name ? -1 : 1).forEach(function(race){ 151 | sideMenu('add',`races-species`,race,races[race].name); 152 | }); 153 | } 154 | 155 | function extraTraitList(race){ 156 | const date = new Date(); 157 | const easter = getEaster(); 158 | switch (race){ 159 | case 'wolven': 160 | return easter.active ? [{t: 'hyper', r: 1},{t: 'fast_growth', r: 1},{t: 'rainbow', r: 1},{t: 'optimistic', r: 1}] : []; 161 | case 'vulpine': 162 | return easter.active ? [{t: 'cannibalize', r: 1},{t: 'rage', r: 1},{t: 'blood_thirst', r: 1},{t: 'sticky', r: 1}] : []; 163 | case 'elven': 164 | return date.getMonth() === 11 && date.getDate() >= 17 ? [{t: 'slaver', r: 2},{t: 'resourceful', r: 0.5},{t: 'small', r: 0.25}] : []; 165 | case 'capybara': 166 | return date.getMonth() === 11 && date.getDate() >= 17 ? [{t: 'beast_of_burden', r: 1},{t: 'pack_rat', r: 0.5},{t: 'musical', r: 0.25}] : []; 167 | case 'centaur': 168 | return date.getMonth() === 11 && date.getDate() >= 17 ? [{t: 'beast_of_burden', r: 1},{t: 'curious', r: 0.5},{t: 'blissful', r: 0.25}] : []; 169 | case 'wendigo': 170 | return date.getMonth() === 11 && date.getDate() >= 17 ? [{t: 'immoral', r: 3},{t: 'cannibalize', r: 0.5},{t: 'claws', r: 0.25}] : []; 171 | case 'yeti': 172 | return date.getMonth() === 11 && date.getDate() >= 17 ? [{t: 'scavenger', r: 3},{t: 'regenerative', r: 0.5},{t: 'musical', r: 0.25}] : []; 173 | case 'entish': 174 | return date.getMonth() === 11 && date.getDate() >= 17 ? [{t: 'photosynth', r: 3},{t: 'optimistic', r: 0.5},{t: 'armored', r: 0.25}] : []; 175 | case 'human': 176 | return hallowed.active ? [{t: 'anthropophagite', r: 1}, {t: 'cannibalize', r: 2}, {t: 'infectious', r: 3}] : []; 177 | case 'tortoisan': 178 | return hallowed.active ? [{t: 'hyper', r: 0.25}, {t: 'swift', r: 0.5}, {t: 'infiltrator', r: 1}] : []; 179 | case 'unicorn': 180 | return hallowed.active ? [{t: 'gloomy', r: 1}, {t: 'darkness', r: 1}] : []; 181 | default: 182 | return []; 183 | } 184 | } 185 | 186 | export function traitsPage(content){ 187 | content = sideMenu('create',content); 188 | 189 | let types = [['genus','major'],['minor'],['special']]; 190 | for (let i=0; i traitSkin('name',a).localeCompare(traitSkin('name',b)) ).forEach(function (trait){ 192 | if (types[i].includes(traits[trait].type)){ 193 | let info = $(`
    `); 194 | content.append(info); 195 | getTraitDesc(info, trait, { tpage: true, wiki: true }); 196 | sideMenu('add',`traits-species`,`${traits[trait].type}_${trait}`,traitSkin('name',trait)); 197 | } 198 | }); 199 | } 200 | } 201 | -------------------------------------------------------------------------------- /src/wiki/universes.js: -------------------------------------------------------------------------------- 1 | import { loc } from './../locale.js'; 2 | import { universe_types } from './../space.js'; 3 | import { darkEffect } from './../functions.js'; 4 | import { infoBoxBuilder } from './functions.js'; 5 | import { sideMenu } from './functions.js'; 6 | 7 | export function universePage(content){ 8 | let mainContent = sideMenu('create',content); 9 | 10 | let universes = []; 11 | Object.keys(universe_types).forEach(function (universe){ 12 | universes.push(universe); 13 | }); 14 | let universe_labels = universes.map(x => `${loc(`universe_${x}`)}`); 15 | 16 | infoBoxBuilder(mainContent,{ name: 'intro', template: 'universe', paragraphs: 3, break: [2], h_level: 2, 17 | para_data: { 18 | 1: [universes.length, universe_labels.slice(0, -1).join(', ') + `, ${loc('or')} ${universe_labels[universe_labels.length - 1]}`], 19 | 2: [loc(`universe_standard`)], 20 | 3: [loc(`wiki_resets_blackhole`)] 21 | }, 22 | data_color: { 23 | 1: ['warning','plain'], 24 | 2: ['caution'] 25 | }, 26 | data_link: { 27 | 3: ['wiki.html#resets-gameplay-blackhole'] 28 | } 29 | }); 30 | sideMenu('add',`universes-gameplay`,'intro',loc('wiki_menu_intro')); 31 | 32 | infoBoxBuilder(mainContent,{ name: 'standard', template: 'universe', paragraphs: 3, break: [2], h_level: 2, 33 | para_data: { 34 | 1: [loc(`universe_standard`)], 35 | 2: [loc('wiki_p_res_dark')], 36 | 3: [loc('wiki_p_res_dark'),+((darkEffect('standard',false,true) - 1) * 100).toFixed(3) + '%'] 37 | }, 38 | data_color: { 39 | 1: ['caution'] 40 | } 41 | }); 42 | sideMenu('add',`universes-gameplay`,'standard',loc('wiki_universe_standard')); 43 | 44 | let heavy_space = +((1.25 + (0.5 * darkEffect('heavy',false,true)) - 1) * 100).toFixed(3) + '%'; 45 | let heavy_int = +((1.2 + (0.3 * darkEffect('heavy',false,true)) - 1) * 100).toFixed(3) + '%'; 46 | infoBoxBuilder(mainContent,{ name: 'heavy', template: 'universe', paragraphs: 9, break: [5,8], h_level: 2, 47 | para_data: { 48 | 1: [universe_types.heavy.desc], 49 | 2: [loc('resource_Oil_name'),loc('resource_Helium_3_name'),loc('resource_Deuterium_name')], 50 | 3: [loc('tab_space'),'75%'], 51 | 4: [loc('tab_interstellar'),loc('tab_galactic'),'50%'], 52 | 5: [loc('wiki_universe_heavy')], 53 | 6: ['5%',loc('resource_Plasmid_plural_name'),loc('resource_Phage_name'),loc('resource_Dark_name')], 54 | 7: [loc('resource_Harmony_name'),'20%'], 55 | 8: [loc('wiki_p_res_dark')], 56 | 9: [loc('wiki_p_res_dark'),heavy_space,heavy_int] 57 | }, 58 | data_color: { 59 | 1: ['plain'] 60 | }, 61 | data_link: { 62 | 6: ['plain','wiki.html#resources-prestige-plasmids','wiki.html#resources-prestige-phage','wiki.html#resources-prestige-dark'], 63 | 7: ['wiki.html#resources-prestige-harmony','plain'] 64 | } 65 | }); 66 | sideMenu('add',`universes-gameplay`,'heavy',loc('wiki_universe_heavy')); 67 | 68 | infoBoxBuilder(mainContent,{ name: 'antimatter', template: 'universe', paragraphs: 9, break: [3,6,8], h_level: 2, 69 | para_data: { 70 | 1: [loc(`universe_antimatter`)], 71 | 2: [loc('resource_AntiPlasmid_plural_name'),loc('resource_Plasmid_plural_name')], 72 | 3: [loc('evo_challenge_plasmid'),loc('evo_challenge_mastery')], 73 | 4: ['50%'], 74 | 5: ['50%','6%'], 75 | 7: ['10%'], 76 | 8: [loc('wiki_p_res_dark')], 77 | 9: [loc('wiki_p_res_dark'),+((darkEffect('antimatter',false,true) - 1) * 100).toFixed(3) + '%'] 78 | }, 79 | data_color: { 80 | 1: ['caution'] 81 | }, 82 | data_link: { 83 | 2: ['wiki.html#resources-prestige-antiplasmids','wiki.html#resources-prestige-plasmids'] 84 | } 85 | }); 86 | sideMenu('add',`universes-gameplay`,'antimatter',loc('wiki_universe_antimatter')); 87 | 88 | infoBoxBuilder(mainContent,{ name: 'evil', template: 'universe', paragraphs: 7, break: [2,5], h_level: 2, 89 | para_data: { 90 | 2: [loc('trait_evil_name')], 91 | 3: [loc('trait_evil_name')], 92 | 4: [loc('biome_hellscape_name'),loc('biome_eden_name')], 93 | 5: [loc('wiki_p_res_dark')], 94 | 7: [loc('wiki_p_res_dark'),+((darkEffect('evil',false,true) - 1) * 100).toFixed(3) + '%'] 95 | } 96 | }); 97 | sideMenu('add',`universes-gameplay`,'evil',loc('wiki_universe_evil')); 98 | 99 | infoBoxBuilder(mainContent,{ name: 'micro', template: 'universe', paragraphs: 6, break: [2,4], h_level: 2, 100 | para_data: { 101 | 1: ['75%'], 102 | 4: [loc('wiki_p_res_dark')], 103 | 5: [loc('wiki_p_res_dark'),darkEffect('micro',false,true),darkEffect('micro',true,true)], 104 | 6: ['1.005'] 105 | } 106 | }); 107 | sideMenu('add',`universes-gameplay`,'micro',loc('wiki_universe_micro')); 108 | 109 | infoBoxBuilder(mainContent,{ name: 'magic', template: 'universe', paragraphs: 8, break: [4,7], h_level: 2, 110 | para_data: { 111 | 6: [80], 112 | 7: [loc('wiki_p_res_dark')], 113 | 8: [loc('wiki_p_res_dark'),+((darkEffect('magic',false,true) - 1) * 100).toFixed(3) + '%'], 114 | } 115 | }); 116 | sideMenu('add',`universes-gameplay`,'magic',loc('wiki_universe_magic')); 117 | } 118 | -------------------------------------------------------------------------------- /src/wiki/wiki.js: -------------------------------------------------------------------------------- 1 | import { global, setGlobal, save } from './../vars.js'; 2 | import { loc } from './../locale.js'; 3 | import {} from './init.js'; 4 | import {} from './../achieve.js'; 5 | import { vBind, clearElement, tagEvent } from './../functions.js'; 6 | import { faqPage } from './faq.js'; 7 | import { speciesPage } from './species.js'; 8 | import { planetsPage } from './planets.js'; 9 | import { renderStructurePage } from './structures.js'; 10 | import { renderTechPage } from './tech.js'; 11 | import { renderAchievePage } from './achieve.js'; 12 | import { gamePlayPage } from './gameplay.js'; 13 | import { prestigePage } from './prestige.js'; 14 | import { eventsPage } from './events.js'; 15 | import { arpaPage } from './arpa.js'; 16 | import { changeLog } from './change.js'; 17 | import { cancelSearchIndexing, search } from './search.js'; 18 | 19 | $('body').empty(); 20 | initPage(); 21 | 22 | function initPage(){ 23 | $('body').append($(`

    ${loc('wiki_menu_evolve')}

    `)); 24 | 25 | let wiki = $(`
    `) 26 | $('body').append(wiki); 27 | 28 | let menu = $(``); 29 | wiki.append(menu); 30 | 31 | let menuItems = [ 32 | { 33 | key: 'intro', 34 | }, 35 | { 36 | key: 'faq', 37 | }, 38 | { 39 | key: 'gameplay', 40 | submenu: [ 41 | { key: 'basics' }, 42 | { key: 'mechanics' }, 43 | { key: 'government' }, 44 | { key: 'governor' }, 45 | { key: 'combat' }, 46 | { key: 'challenges' }, 47 | { key: 'resets' }, 48 | { key: 'planets' }, 49 | { key: 'universes' }, 50 | { key: 'hell' } 51 | ] 52 | }, 53 | { 54 | key: 'prestige', 55 | submenu: [ 56 | { key: 'resets' }, 57 | { key: 'resources' }, 58 | { key: 'crispr' }, 59 | { key: 'blood' }, 60 | { key: 'perks' } 61 | ] 62 | }, 63 | { 64 | key: 'events', 65 | submenu: [ 66 | { key: 'major' }, 67 | { key: 'minor' }, 68 | { key: 'progress' }, 69 | { key: 'special' } 70 | ] 71 | }, 72 | { 73 | key: 'species', 74 | submenu: [ 75 | { key: 'races' }, 76 | { key: 'traits' }, 77 | { key: 'custom' } 78 | ] 79 | }, 80 | { 81 | key: 'structures', 82 | submenu: [ 83 | { key: 'prehistoric' }, 84 | { key: 'planetary' }, 85 | { key: 'space' }, 86 | { key: 'interstellar' }, 87 | { key: 'intergalactic' }, 88 | { key: 'hell' }, 89 | { key: 'edenic' } 90 | ] 91 | }, 92 | { 93 | key: 'tech', 94 | submenu: [ 95 | { key: 'primitive' }, 96 | { key: 'civilized' }, 97 | { key: 'discovery' }, 98 | { key: 'industrialized' }, 99 | { key: 'globalized' }, 100 | { key: 'early_space' }, 101 | { key: 'deep_space' }, 102 | { key: 'interstellar' }, 103 | { key: 'intergalactic' }, 104 | { key: 'dimensional' }, 105 | { key: 'existential' } 106 | ] 107 | }, 108 | { 109 | key: 'tp_structures', 110 | submenu: [ 111 | { key: 'prehistoric' }, 112 | { key: 'planetary' }, 113 | { key: 'space' }, 114 | { key: 'tauceti' } 115 | ] 116 | }, 117 | { 118 | key: 'tp_tech', 119 | submenu: [ 120 | { key: 'primitive' }, 121 | { key: 'civilized' }, 122 | { key: 'discovery' }, 123 | { key: 'industrialized' }, 124 | { key: 'globalized' }, 125 | { key: 'early_space' }, 126 | { key: 'deep_space' }, 127 | { key: 'solar' }, 128 | { key: 'tauceti' } 129 | ] 130 | }, 131 | { 132 | key: 'arpa', 133 | submenu: [ 134 | { key: 'projects' }, 135 | //{ key: 'genetics' }, 136 | { key: 'crispr' }, 137 | { key: 'blood' } 138 | ] 139 | }, 140 | { 141 | key: 'achievements', 142 | submenu: [ 143 | { key: 'list' }, 144 | { key: 'feats' } 145 | ] 146 | }, 147 | { 148 | key: 'changelog', 149 | }, 150 | { 151 | key: 'search', 152 | } 153 | ]; 154 | 155 | let wikiMenu = ``; 158 | menu.append(wikiMenu); 159 | 160 | var menuData = {}; 161 | vBind({ 162 | el: `#menu`, 163 | data: menuData, 164 | methods: { 165 | loadPage(main,sub){ 166 | menuDispatch(main,sub); 167 | } 168 | } 169 | }); 170 | 171 | let content = $(`
    `); 172 | wiki.append(content); 173 | 174 | if (window.location.hash){ 175 | let hash = window.location.hash.substring(1).split('-'); 176 | if (hash.length > 1){ 177 | hash.length > 2 ? menuDispatch(hash[1],hash[0],hash[2]) : menuDispatch(hash[1],hash[0]); 178 | } 179 | else { 180 | menuDispatch(hash[0]); 181 | } 182 | } 183 | else { 184 | mainPage(); 185 | } 186 | } 187 | 188 | async function menuDispatch(main,sub,frag){ 189 | if(window.location.hash === "#search" && main !== "search"){ 190 | const until = (condition) => { 191 | const poll = resolve => condition() ? resolve() : setTimeout(_ => poll(resolve), 16); 192 | return new Promise(poll); 193 | } 194 | cancelSearchIndexing(); 195 | await until(_ => $(".temp-indexer").length === 0); 196 | } 197 | 198 | $(`#content`).removeClass('flex'); 199 | 200 | var global_data = save.getItem('evolved') || false; 201 | if (global_data){ 202 | setGlobal(JSON.parse(LZString.decompressFromUTF16(global_data))); 203 | } 204 | 205 | tagEvent('page_view',{ page_title: `Evolve Wiki - ${main}` }); 206 | 207 | switch (main){ 208 | case 'intro': 209 | mainPage(); 210 | window.location.hash = `#${main}`; 211 | break; 212 | 213 | case 'faq': 214 | faqPage(); 215 | setWindowHash(main,sub,frag); 216 | break; 217 | 218 | case 'gameplay': 219 | gamePlayPage(sub); 220 | setWindowHash(main,sub,frag); 221 | break; 222 | 223 | case 'prestige': 224 | prestigePage(sub); 225 | setWindowHash(main,sub,frag); 226 | break; 227 | 228 | case 'events': 229 | eventsPage(sub); 230 | setWindowHash(main,sub,frag); 231 | break; 232 | 233 | case 'species': 234 | switch (sub){ 235 | case 'planets': 236 | planetsPage(); 237 | break; 238 | default: 239 | speciesPage(sub); 240 | break; 241 | } 242 | setWindowHash(main,sub,frag); 243 | break; 244 | 245 | case 'structures': 246 | renderStructurePage(sub,'standard'); 247 | setWindowHash(main,sub,frag); 248 | break; 249 | 250 | case 'tech': 251 | renderTechPage(sub,'standard'); 252 | setWindowHash(main,sub,frag); 253 | break; 254 | 255 | case 'tp_structures': 256 | renderStructurePage(sub,'truepath'); 257 | setWindowHash(main,sub,frag); 258 | break; 259 | 260 | case 'tp_tech': 261 | renderTechPage(sub,'truepath'); 262 | setWindowHash(main,sub,frag); 263 | break; 264 | 265 | case 'arpa': 266 | arpaPage(sub); 267 | setWindowHash(main,sub,frag); 268 | break; 269 | 270 | case 'achievements': 271 | switch (sub){ 272 | case 'tracker': 273 | //loadTracker(); 274 | break; 275 | default: 276 | renderAchievePage(sub); 277 | break; 278 | } 279 | setWindowHash(main,sub,frag); 280 | break; 281 | 282 | case 'changelog': 283 | changeLog(); 284 | setWindowHash(main, sub, frag); 285 | break; 286 | 287 | case 'search': 288 | search(); 289 | window.location.hash = `#${main}`; 290 | break; 291 | } 292 | } 293 | 294 | function setWindowHash(main,sub,frag){ 295 | if (typeof frag === 'undefined'){ 296 | if(sub){ 297 | window.location.hash = `#${sub}-${main}`; 298 | } else { 299 | window.location.hash = `#${main}`; 300 | } 301 | } 302 | else { 303 | window.location.hash = `#${sub}-${main}-${frag}`; 304 | setTimeout(function(){ 305 | document.getElementById(frag).scrollIntoView({ 306 | block: 'start', 307 | behavior: 'smooth' 308 | }); 309 | }, 125); 310 | 311 | } 312 | } 313 | 314 | function buiildMenu(items,set,parent){ 315 | let hash = window.location.hash ? window.location.hash.substring(1).split('-') : false; 316 | 317 | let menu = ``; 318 | for (let i=0; i 1 && hash[1] === items[i].key) ? ` :active="true" expanded` : ''; 322 | menu = menu + ``; 323 | menu = menu + buiildMenu(items[i].submenu,false,items[i].key); 324 | menu = menu + ``; 325 | } 326 | else { 327 | let active = (!hash && set && i === 0) || (hash && hash[0] === items[i].key) ? ` :active="true"` : ''; 328 | let args = parent ? `'${parent}','${items[i].key}'` : `'${items[i].key}',false`; 329 | menu = menu + `` 330 | } 331 | } 332 | return menu; 333 | } 334 | 335 | function mainPage(){ 336 | let content = $(`#content`); 337 | clearElement(content); 338 | 339 | let contribute = `${['Beorseder','Rodrigodd','Volch','Condoslime','Yarukishi'].join(', ').replace(/, ([^,]*)$/, `, & $1`)}`; 340 | 341 | let version = global['beta'] ? `beta v${global.version}.${global.beta}` : 'v'+global.version; 342 | content.append(`
    ${loc(`wiki_main_title`)} - ${version}
    `); 343 | content.append(`
    ${loc(`wiki_main_author`,['Demagorddon'])}
    `); 344 | content.append(`
    ${loc(`wiki_main_spoiler`)}
    `); 345 | content.append(`
    ${loc(`wiki_main_blurb`)}
    `); 346 | content.append(`
    ${loc(`wiki_main_contribution`,[contribute])}
    `); 347 | content.append(`
    ${loc(`wiki_resources`)}
    `); 348 | 349 | let list = $(`
      `); 350 | content.append(list); 351 | 352 | list.append(`
    • ${loc(`wiki_resources_begin_guide`)} ${loc(`wiki_resources_by`,['GreyCat'])}
    • `); 353 | list.append(`
    • ${loc(`wiki_resources_tracker`)} ${loc(`wiki_resources_by`,['Karsen777'])}
    • `); 354 | //list.append(`
    • ${loc(`wiki_resources_hell_sim`)} ${loc(`wiki_resources_by`,['Jotun'])}
    • `); 355 | } 356 | -------------------------------------------------------------------------------- /src/wiki/wiki.less: -------------------------------------------------------------------------------- 1 | html { 2 | overflow-y: auto; 3 | } 4 | 5 | span, div { 6 | -moz-user-select: initial; 7 | -khtml-user-select: initial; 8 | -webkit-user-select: initial; 9 | -ms-user-select: initial; 10 | user-select: initial; 11 | cursor: default; 12 | } 13 | 14 | .main { 15 | overflow-y: initial; 16 | } 17 | 18 | #sideContent.sticky { 19 | height: 95vh; 20 | 21 | li.gap { 22 | margin-top:1rem; 23 | } 24 | } 25 | 26 | .wiki { 27 | display: flex; 28 | margin: 0 1rem; 29 | padding-top: 1rem; 30 | 31 | .mainMenu { 32 | margin-left: .5rem; 33 | width: 10rem; 34 | 35 | .sticky { 36 | height: ~"calc(100vh - 1rem)"; 37 | } 38 | 39 | .menu-list { 40 | li { 41 | cursor: pointer; 42 | span { 43 | cursor: pointer; 44 | } 45 | } 46 | } 47 | } 48 | 49 | .mainContent { 50 | margin-left: 1rem; 51 | flex: 1; 52 | 53 | .b-tabs:not(:last-child){ 54 | margin-bottom: 0; 55 | } 56 | } 57 | 58 | .paragraph { 59 | margin: 0 1rem 1rem 0; 60 | } 61 | 62 | .header { 63 | margin: 0.25rem 0 1rem; 64 | } 65 | .achievements.header { 66 | margin: 1rem 0 0.25rem; 67 | } 68 | 69 | .menu-label { 70 | font-size: 1rem; 71 | } 72 | 73 | .infoBox { 74 | max-width: 50rem; 75 | margin-bottom: .5rem; 76 | margin-right: .5rem; 77 | padding: .25rem .5rem; 78 | border: .0625rem solid; 79 | 80 | span[role=button] { 81 | cursor: pointer; 82 | } 83 | 84 | span.row { 85 | display: block; 86 | } 87 | 88 | &.wide { 89 | max-width: 100%; 90 | margin-right: 0; 91 | } 92 | 93 | h2 { 94 | margin-bottom: .25rem; 95 | border-bottom: .0625rem solid; 96 | } 97 | 98 | div { 99 | margin-bottom: .5rem; 100 | clear: both; 101 | } 102 | 103 | li { 104 | list-style-position: inside; 105 | } 106 | 107 | .type { 108 | display: flex; 109 | justify-content: space-between; 110 | > span:nth-child(1) { 111 | display: block; 112 | text-align: left; 113 | } 114 | > span:nth-child(2) { 115 | display: block; 116 | text-align: right; 117 | > span:nth-child(2) { 118 | margin-left: .5rem; 119 | margin-right: .5rem; 120 | } 121 | } 122 | } 123 | 124 | .itemlist { 125 | span { 126 | display: inline-block; 127 | margin-right: 1rem; 128 | } 129 | } 130 | 131 | .propList { 132 | display: flex; 133 | flex-wrap: wrap; 134 | justify-content: space-between; 135 | > div { 136 | margin-right: 1rem; 137 | } 138 | } 139 | 140 | .stats { 141 | display: flex; 142 | justify-content: space-between; 143 | border-top: .0625rem solid; 144 | margin-top: .5rem; 145 | padding-top: .5rem; 146 | 147 | .effect { 148 | width: 70%; 149 | } 150 | 151 | .cost { 152 | width: 30%; 153 | } 154 | 155 | .right { 156 | margin-left: .5rem; 157 | padding-left: .5rem; 158 | border-left: .0625rem solid; 159 | } 160 | } 161 | 162 | .reqs { 163 | span:not(:first-child):not(.subreqs) { 164 | margin-left: 0.5rem; 165 | } 166 | } 167 | 168 | .extra { 169 | border-top: .0625rem solid; 170 | margin-top: .5rem; 171 | padding-top: .5rem; 172 | 173 | .calcButton button { 174 | height: 1.5rem; 175 | } 176 | } 177 | 178 | div.aTable { 179 | columns: 2; 180 | span { 181 | display: flex; 182 | } 183 | } 184 | 185 | .para { 186 | > span { 187 | margin-right: .25rem; 188 | } 189 | } 190 | 191 | .infoSummary { 192 | display: inline-grid; 193 | text-align: left; 194 | max-width: 18rem; 195 | border-radius: .25rem; 196 | line-height: 1.3125rem; 197 | margin-right: 1rem; 198 | } 199 | 200 | &.col2 { 201 | display: flex; 202 | flex-wrap: wrap; 203 | align-content: space-between; 204 | > h2, 205 | > h3, 206 | > h4 { 207 | width: 100%; 208 | } 209 | > div { 210 | width: 50%; 211 | } 212 | } 213 | 214 | &.sk1 { 215 | div:first-of-type { 216 | width: 100%; 217 | } 218 | } 219 | } 220 | 221 | .question { 222 | h2 { 223 | margin-bottom: .25rem; 224 | text-decoration: underline; 225 | } 226 | margin-bottom: .75rem; 227 | } 228 | 229 | .achieveList { 230 | display: flex; 231 | flex-wrap: wrap; 232 | .achievement { 233 | display: inline-flex; 234 | justify-content: space-between; 235 | width: 23rem; 236 | margin-right: 1rem; 237 | :first-child { 238 | width: initial; 239 | } 240 | span.achieve { 241 | display: block; 242 | } 243 | span.icons { 244 | display: block; 245 | text-align: right; 246 | } 247 | p.flair { 248 | display: inline; 249 | position: initial; 250 | line-height: 1rem; 251 | } 252 | } 253 | } 254 | 255 | .duelList { 256 | display: flex; 257 | flex-flow: wrap; 258 | 259 | .itemlist { 260 | display: flex; 261 | } 262 | 263 | .listSide { 264 | min-width: 30rem; 265 | width: 50%; 266 | border: .0625rem solid; 267 | text-align: center; 268 | 269 | .infoBox { 270 | list-style: none; 271 | text-align: left; 272 | margin: 0.5rem; 273 | } 274 | 275 | @media only screen and (max-width: 74.5rem){ 276 | width: 100%; 277 | .infoBox { 278 | max-width: 100%; 279 | } 280 | } 281 | } 282 | } 283 | 284 | .flexed { 285 | display: flex; 286 | flex-wrap: wrap; 287 | justify-content: space-between; 288 | > span { 289 | text-align: left; 290 | width: 4rem; 291 | display: block; 292 | margin: 0 .5rem; 293 | padding: 0 .5rem; 294 | } 295 | .wide { 296 | width: 6.9375rem; 297 | } 298 | .wide10 { 299 | width: 10rem; 300 | } 301 | .swide { 302 | width: 12rem; 303 | } 304 | &.wide { 305 | width: 40rem; 306 | } 307 | } 308 | 309 | .flex { 310 | display: flex; 311 | } 312 | 313 | .flexInfo { 314 | display: flex; 315 | justify-content: space-between; 316 | > :nth-child(2){ 317 | margin: .25rem 1rem 0; 318 | } 319 | } 320 | 321 | ul.disc { 322 | list-style: disc; 323 | margin-left: 1.25rem; 324 | } 325 | 326 | .tbl { 327 | display: table; 328 | .trow { 329 | display: table-row; 330 | .tcell { 331 | display: table-cell; 332 | padding-right: 0.75rem; 333 | min-width: 5rem; 334 | } 335 | .tcell:last-child { 336 | padding-right: 0; 337 | } 338 | .eggsol, 339 | .totsol { 340 | cursor: pointer; 341 | padding-bottom: .5rem; 342 | } 343 | } 344 | } 345 | 346 | .reveal { 347 | cursor: pointer; 348 | margin-bottom: .5rem; 349 | } 350 | .calcInput { 351 | width: 7.5rem; 352 | display: inline-block; 353 | height: 1.25rem; 354 | margin-bottom: .5rem; 355 | text-align: center; 356 | 357 | input { 358 | height: 1.25rem; 359 | line-height: 1.25rem; 360 | text-align: center; 361 | } 362 | 363 | .dropdown button { 364 | height: 1.25rem; 365 | padding: 0 .75rem; 366 | } 367 | 368 | .calcInputButton { 369 | height: 1.25rem; 370 | padding: 0 .25rem; 371 | margin: 0; 372 | } 373 | } 374 | .calcButton{ 375 | margin-bottom: 1rem; 376 | } 377 | } 378 | 379 | .main>div.popper.wide.w25, 380 | body .modal>div.popper.wide.w25 { 381 | max-width: 25rem; 382 | } 383 | 384 | html.dark, 385 | html.night, 386 | html.redgreen, 387 | html.darkNight, 388 | html.gruvboxDark, 389 | html.orangeSoda, 390 | html.dracula { 391 | .menu-label { 392 | color: #ffa500 !important; 393 | } 394 | .iclr2 { 395 | color: #fff; 396 | } 397 | .iclr3 { 398 | color: #cd7f32; 399 | } 400 | .iclr4 { 401 | color: #c0c0c0; 402 | } 403 | .iclr5 { 404 | color: #d4af37; 405 | } 406 | } 407 | 408 | html.light, 409 | html.gruvboxLight { 410 | .menu-label { 411 | color: #966100 !important; 412 | } 413 | .iclr2 { 414 | color: #000; 415 | } 416 | .iclr3 { 417 | color: #cd7f32; 418 | } 419 | .iclr4 { 420 | color: #c0c0c0; 421 | } 422 | .iclr5 { 423 | color: #d4af37; 424 | } 425 | } 426 | -------------------------------------------------------------------------------- /strings/checkStrings.py: -------------------------------------------------------------------------------- 1 | import json 2 | import sys 3 | import os.path as path 4 | import re 5 | 6 | print() 7 | 8 | check_tags = True 9 | check_tokens = True 10 | check_leading_space = True 11 | check_periods = True 12 | check_numbers = True 13 | 14 | def led_spaces(str): 15 | return len(str) - len(str.lstrip(' ')) 16 | 17 | if len(sys.argv) < 2: 18 | print("inform locale key (example 'python checkString.py pt-BR')") 19 | else: 20 | locale = sys.argv[1] 21 | 22 | if not path.isfile('strings.{}.json'.format(locale)): 23 | print("'strings.{}.json' not found. Create it before calling this script.".format(locale)) 24 | exit() 25 | 26 | with open('strings.json', encoding='utf-8') as default_file, \ 27 | open('strings.{}.json'.format(locale), encoding='utf-8') as loc_file: 28 | defstr = json.load(default_file) 29 | 30 | json_regex = re.compile(r'"(?P.+)"\s*:\s"(?P.*)"\s*$') 31 | period_count = re.compile(r'(\.(\D|$))|。') 32 | tokens_regex = re.compile(r'%\d+(?!\d)') 33 | numbers_regex = re.compile(r'\d+') 34 | 35 | for (nl, line) in enumerate(loc_file): 36 | line = line.strip() 37 | if line == '{' or line == '}' or len(line) == 0: 38 | continue 39 | 40 | if line[-1] == ',': 41 | line = line[:-1] 42 | 43 | line = re.search(json_regex, line) 44 | 45 | if line == None: 46 | print('failed parse line {}'.format(nl+1)) 47 | continue 48 | line = line.groupdict() 49 | 50 | if not line['key'] in defstr: 51 | print("key '{}' is not found in string.json, from line {}".format(line['key'], nl)) 52 | continue 53 | else: 54 | defline = defstr[line['key']] 55 | 56 | if check_tags: 57 | if line['value'][0:6] == "TRANS:": 58 | print("key '{}' is marked with tag 'TRANS:', from line {}".format(line['key'], nl)) 59 | if line['value'][0:7] == "CHANGE:": 60 | print("key '{}' is marked with tag 'CHANGE:', from line {}".format(line['key'], nl)) 61 | 62 | if check_tokens: 63 | tcdef = len(tokens_regex.findall(defline)) 64 | tcloc = len(tokens_regex.findall(line['value'])) 65 | if tcdef != tcloc: 66 | print("Number of tokens (like %0) number differ (def: {} != loc: {}), in key '{}', line {}" \ 67 | .format(tcdef, tcloc, line['key'], nl+1)) 68 | 69 | if check_leading_space: 70 | leddef = led_spaces(defline) 71 | ledloc = led_spaces(line['value']) 72 | if leddef != ledloc: 73 | print("leading spaces differ (def: {} != loc: {}), in key '{}', line {}".format(leddef, ledloc, line['key'], nl+1)) 74 | 75 | if check_periods: 76 | pcdef = len(period_count.findall(defline)) 77 | pcloc = len(period_count.findall(line['value'])) 78 | if pcdef != pcloc: 79 | print("periods number differ (def: {} != loc: {}), in key '{}', line {}" \ 80 | .format(pcdef, pcloc, line['key'], nl+1)) 81 | 82 | if check_numbers: 83 | pcdef = numbers_regex.findall(defline) 84 | pcloc = numbers_regex.findall(line['value']) 85 | if sorted(pcdef) != sorted(pcloc): 86 | print("Numbers differ (def: {} != loc: {}), in key '{}', line {}" \ 87 | .format(pcdef, pcloc, line['key'], nl+1)) -------------------------------------------------------------------------------- /strings/convert zh-CN to zh-TW using opencc.py: -------------------------------------------------------------------------------- 1 | # pip install opencc-python-reimplemented 2 | from opencc import OpenCC 3 | 4 | 5 | with open('strings.zh-CN.json', 'r', encoding='utf-8') as f: 6 | zh_CN = f.read() 7 | # convert zh_CN to zh_TW 8 | zh_TW = OpenCC('s2tw').convert(zh_CN) 9 | with open('strings.zh-TW_autotranslated.json', 'w', encoding='utf-8') as f: 10 | f.write(zh_TW) 11 | -------------------------------------------------------------------------------- /strings/readme.md: -------------------------------------------------------------------------------- 1 | # Translation tools 2 | 3 | There are two python scripts to help to translate the strings.json file: updateStrings.py and checkStrings.py. 4 | 5 | ## updateStrings.py 6 | 7 | ```shell 8 | python updateStrings.py 9 | ``` 10 | 11 | This script reads the strings.json and strings.\.json, and overwrite its contents, putting the keys in the same order as those in strings.json. This doesn't write the keys that are not in strings.json in the output (show as deleted keys count in the shell), and add a 'TRANS:' in the start of every value which key is in strings.json but not was in strings.\.json. 12 | 13 | If there is a last-strings.json file, it will be used to keep track of changes in keys values, which will be format as 'CHANGE:\~FROM:\~TO:\'. In the end of the operation, the strings.json contents will be again copied to last-strings.json. 14 | 15 | ## checkStrings.py 16 | 17 | ```shell 18 | python checkStrings.py 19 | ``` 20 | This script reads the strings.json and string.\.json files and outputs every line that: 21 | - is out of json format 22 | - the value is marked with tag 'TRANS:' or 'CHANGE:' 23 | - the number of periods (.) in the strings.json differs from strings.\.json. The translation does not need to have the same number of periods, but this helps find phrases that end with periods that were forgotten in the translation 24 | - the number of leading spaces (spaces before the first character) in the strings.json differs from strings.\.json 25 | - the number of tokens (like %0) in the strings.json differs from strings.\.json 26 | - the numbers in the strings.json differ from strings.\.json 27 | 28 | You can disable some of the checks if you open the script and change the values to ```True``` or ```False```: 29 | ```python 30 | check_tags = True 31 | check_tokens = True 32 | check_leading_space = True 33 | check_periods = True 34 | check_numbers = True 35 | ``` 36 | -------------------------------------------------------------------------------- /strings/updateStrings.py: -------------------------------------------------------------------------------- 1 | import json 2 | from shutil import copyfile 3 | import sys 4 | import os.path as path 5 | 6 | print() 7 | 8 | if len(sys.argv) < 2: 9 | print("inform locale key (python updateString.py )") 10 | else: 11 | locale = sys.argv[1] 12 | 13 | if not path.isfile('strings.{}.json'.format(locale)): 14 | print("'strings.{}.json' not found.\nCreate that file with a line write '{{ }}' if need.".format(locale)) 15 | exit() 16 | 17 | with open('strings.json', encoding='utf-8') as default_file, \ 18 | open('strings.{}.json'.format(locale), 'r+', encoding='utf-8') as loc_file:#, \ 19 | 20 | try: 21 | default_strings = json.load(default_file) 22 | except: 23 | print("the 'strings.json' file is a malformed json file.") 24 | exit() 25 | 26 | try: 27 | locale_strings = json.load(loc_file) 28 | except: 29 | print("the 'strings.{}.json' file is a malformed json file.".format(locale)) 30 | exit() 31 | 32 | if path.isfile('last-strings.json'.format(locale)): 33 | last_file = open('last-strings.json', encoding='utf-8') 34 | try: 35 | last_strings = json.load(last_file) 36 | except: 37 | print("the last-strings.json was a malformed json file.") 38 | last_strings = None 39 | last_file.close(); 40 | else: 41 | last_strings = None 42 | 43 | writing = {} 44 | 45 | trans_count = 0 46 | change_count = 0 47 | 48 | for key in default_strings: 49 | if key in locale_strings: 50 | if locale_strings[key][0:6] == "TRANS:": 51 | writing[key] = "TRANS:" + default_strings[key] 52 | trans_count+=1 53 | elif last_strings is not None and key in last_strings and default_strings[key] != last_strings[key]: 54 | writing[key] = "CHANGE:" + locale_strings[key] + "~FROM:{}~TO:{}".format(last_strings[key], default_strings[key]) 55 | change_count+=1 56 | else: 57 | writing[key] = locale_strings[key] 58 | del locale_strings[key] 59 | else: 60 | writing[key] = "TRANS:" + default_strings[key] 61 | trans_count+=1 62 | 63 | print("{} values are marked with tag 'CHANGE:'".format(change_count)) 64 | print("{} values are marked with tag 'TRANS:'".format(trans_count)) 65 | if len(locale_strings) > 0: 66 | print("{} keys was deleted: ".format(len(locale_strings))) 67 | for key in locale_strings: 68 | print(key) 69 | else: 70 | print("0 keys was deleted.".format(len(locale_strings))) 71 | 72 | loc_file.seek(0,0); 73 | loc_file.truncate(0); 74 | json.dump(writing, loc_file, ensure_ascii=False, indent=2) 75 | 76 | copyfile("strings.json", "last-strings.json"); 77 | -------------------------------------------------------------------------------- /wiki.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Evolve Wiki 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 50 |
      51 | 52 | 58 | 59 | 60 | -------------------------------------------------------------------------------- /wiki/wiki.css: -------------------------------------------------------------------------------- 1 | html{overflow-y:auto}div,span{-moz-user-select:initial;-khtml-user-select:initial;-webkit-user-select:initial;-ms-user-select:initial;user-select:initial;cursor:default}.main{overflow-y:initial}#sideContent.sticky{height:95vh}#sideContent.sticky li.gap{margin-top:1rem}.wiki{display:flex;margin:0 1rem;padding-top:1rem}.wiki .mainMenu{margin-left:.5rem;width:10rem}.wiki .mainMenu .sticky{height:calc(100vh - 1rem)}.wiki .infoBox span[role=button],.wiki .mainMenu .menu-list li,.wiki .mainMenu .menu-list li span{cursor:pointer}.wiki .mainContent{margin-left:1rem;flex:1}.wiki .mainContent .b-tabs:not(:last-child){margin-bottom:0}.wiki .paragraph{margin:0 1rem 1rem 0}.wiki .header{margin:.25rem 0 1rem}.wiki .achievements.header{margin:1rem 0 .25rem}.wiki .menu-label{font-size:1rem}.wiki .infoBox{max-width:50rem;margin-bottom:.5rem;margin-right:.5rem;padding:.25rem .5rem;border:.0625rem solid}.wiki .infoBox span.row{display:block}.wiki .infoBox.wide{max-width:100%;margin-right:0}.wiki .infoBox h2{margin-bottom:.25rem;border-bottom:.0625rem solid}.wiki .infoBox div{margin-bottom:.5rem;clear:both}.wiki .infoBox li{list-style-position:inside}.wiki .infoBox .type{display:flex;justify-content:space-between}.wiki .infoBox .type>span:nth-child(1){display:block;text-align:left}.wiki .infoBox .type>span:nth-child(2){display:block;text-align:right}.wiki .infoBox .type>span:nth-child(2)>span:nth-child(2){margin-left:.5rem;margin-right:.5rem}.wiki .infoBox .itemlist span{display:inline-block;margin-right:1rem}.wiki .infoBox .propList{display:flex;flex-wrap:wrap;justify-content:space-between}.wiki .infoBox .propList>div{margin-right:1rem}.wiki .infoBox .stats{display:flex;justify-content:space-between;border-top:.0625rem solid;margin-top:.5rem;padding-top:.5rem}.wiki .infoBox .stats .effect{width:70%}.wiki .infoBox .stats .cost{width:30%}.wiki .infoBox .stats .right{margin-left:.5rem;padding-left:.5rem;border-left:.0625rem solid}.wiki .infoBox .reqs span:not(:first-child):not(.subreqs){margin-left:.5rem}.wiki .infoBox .extra{border-top:.0625rem solid;margin-top:.5rem;padding-top:.5rem}.wiki .infoBox .extra .calcButton button{height:1.5rem}.wiki .infoBox div.aTable{columns:2}.wiki .infoBox div.aTable span{display:flex}.wiki .infoBox .para>span{margin-right:.25rem}.wiki .infoBox .infoSummary{display:inline-grid;text-align:left;max-width:18rem;border-radius:.25rem;line-height:1.3125rem;margin-right:1rem}.wiki .infoBox.col2{display:flex;flex-wrap:wrap;align-content:space-between}.wiki .infoBox.col2>h2,.wiki .infoBox.col2>h3,.wiki .infoBox.col2>h4{width:100%}.wiki .infoBox.col2>div{width:50%}.wiki .infoBox.sk1 div:first-of-type{width:100%}.wiki .question{margin-bottom:.75rem}.wiki .question h2{margin-bottom:.25rem;text-decoration:underline}.wiki .achieveList{display:flex;flex-wrap:wrap}.wiki .achieveList .achievement{display:inline-flex;justify-content:space-between;width:23rem;margin-right:1rem}.wiki .achieveList .achievement :first-child{width:initial}.wiki .achieveList .achievement span.achieve{display:block}.wiki .achieveList .achievement span.icons{display:block;text-align:right}.wiki .achieveList .achievement p.flair{display:inline;position:initial;line-height:1rem}.wiki .duelList{display:flex;flex-flow:wrap}.wiki .duelList .itemlist{display:flex}.wiki .duelList .listSide{min-width:30rem;width:50%;border:.0625rem solid;text-align:center}.wiki .duelList .listSide .infoBox{list-style:none;text-align:left;margin:.5rem}@media only screen and (max-width:74.5rem){.wiki .duelList .listSide{width:100%}.wiki .duelList .listSide .infoBox{max-width:100%}}.wiki .flexed{display:flex;flex-wrap:wrap;justify-content:space-between}.wiki .flexed>span{text-align:left;width:4rem;display:block;margin:0 .5rem;padding:0 .5rem}.wiki .flexed .wide{width:6.9375rem}.wiki .flexed .wide10{width:10rem}.wiki .flexed .swide{width:12rem}.wiki .flexed.wide{width:40rem}.wiki .flex{display:flex}.wiki .flexInfo{display:flex;justify-content:space-between}.wiki .flexInfo>:nth-child(2){margin:.25rem 1rem 0}.wiki ul.disc{list-style:disc;margin-left:1.25rem}.wiki .tbl{display:table}.wiki .tbl .trow{display:table-row}.wiki .tbl .trow .tcell{display:table-cell;padding-right:.75rem;min-width:5rem}.wiki .tbl .trow .tcell:last-child{padding-right:0}.wiki .tbl .trow .eggsol,.wiki .tbl .trow .totsol{cursor:pointer;padding-bottom:.5rem}.wiki .reveal{cursor:pointer;margin-bottom:.5rem}.wiki .calcInput{width:7.5rem;display:inline-block;height:1.25rem;margin-bottom:.5rem;text-align:center}.wiki .calcInput input{height:1.25rem;line-height:1.25rem;text-align:center}.wiki .calcInput .dropdown button{height:1.25rem;padding:0 .75rem}.wiki .calcInput .calcInputButton{height:1.25rem;padding:0 .25rem;margin:0}.wiki .calcButton{margin-bottom:1rem}.main>div.popper.wide.w25,body .modal>div.popper.wide.w25{max-width:25rem}html.dark .menu-label,html.darkNight .menu-label,html.dracula .menu-label,html.gruvboxDark .menu-label,html.night .menu-label,html.orangeSoda .menu-label,html.redgreen .menu-label{color:orange!important}html.dark .iclr2,html.darkNight .iclr2,html.dracula .iclr2,html.gruvboxDark .iclr2,html.night .iclr2,html.orangeSoda .iclr2,html.redgreen .iclr2{color:#fff}html.dark .iclr3,html.darkNight .iclr3,html.dracula .iclr3,html.gruvboxDark .iclr3,html.night .iclr3,html.orangeSoda .iclr3,html.redgreen .iclr3{color:#cd7f32}html.dark .iclr4,html.darkNight .iclr4,html.dracula .iclr4,html.gruvboxDark .iclr4,html.night .iclr4,html.orangeSoda .iclr4,html.redgreen .iclr4{color:silver}html.dark .iclr5,html.darkNight .iclr5,html.dracula .iclr5,html.gruvboxDark .iclr5,html.night .iclr5,html.orangeSoda .iclr5,html.redgreen .iclr5{color:#d4af37}html.gruvboxLight .menu-label,html.light .menu-label{color:#966100!important}html.gruvboxLight .iclr2,html.light .iclr2{color:#000}html.gruvboxLight .iclr3,html.light .iclr3{color:#cd7f32}html.gruvboxLight .iclr4,html.light .iclr4{color:silver}html.gruvboxLight .iclr5,html.light .iclr5{color:#d4af37} --------------------------------------------------------------------------------