├── LICENSE.md ├── README.md ├── browserWarning.html ├── css ├── dark.css ├── main.css ├── outside.css ├── path.css ├── room.css ├── ship.css ├── space.css └── world.css ├── doc ├── Events.xlsx ├── Zones.txt └── translation.txt ├── favicon.ico ├── img ├── Logo1.jpg ├── adr.png ├── chrome.png ├── firefox.png ├── ie.png ├── opera.png └── safari.png ├── index.html ├── lang ├── cn │ ├── main.css │ ├── strings.js │ └── strings.po ├── fr │ ├── main.css │ ├── strings.js │ ├── strings.mo │ └── strings.po ├── jp │ ├── main.css │ └── strings.po └── langs.js ├── lib ├── base64.js ├── icu.js ├── jquery.color-2.1.2.min.js ├── jquery.event.move.js ├── jquery.event.swipe.js ├── jquery.min.js └── translate.js ├── mobileWarning.html ├── script ├── Button.js ├── engine.js ├── events.js ├── events │ ├── encounters.js │ ├── global.js │ ├── outside.js │ ├── room.js │ └── setpieces.js ├── header.js ├── localization.js ├── notifications.js ├── outside.js ├── path.js ├── prestige.js ├── room.js ├── scoring.js ├── ship.js ├── space.js ├── state_manager.js └── world.js └── tools └── po2js.py /LICENSE.md: -------------------------------------------------------------------------------- 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 | ADarkRoomAndroid 2 | ================ 3 | This is A port version of A Dark Room. The origin project is https://github.com/Continuities/adarkroom 4 | -------------------------------------------------------------------------------- /browserWarning.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | A Dark Room 5 | 24 | 25 | 26 |
27 | 28 |
29 | 30 | A Dark Room makes use of HTML5 and CSS3, which your current browser does not appear to support.
31 | Please update your browser for the best experience:
32 |
33 | Firefox 34 | Chrome 35 | Internet Explorer 36 | Opera 37 | Safari 38 |

39 | Or you can play anyway, but it probably won't work! 40 |
41 |
42 | 43 | -------------------------------------------------------------------------------- /css/dark.css: -------------------------------------------------------------------------------- 1 | body { 2 | background-color: #272823; 3 | color: #EEE; 4 | } 5 | 6 | div.headerButton { 7 | border-left: 1px solid #EEE; 8 | } 9 | 10 | div#notifyGradient { 11 | background-color: #272823; 12 | background: -webkit-linear-gradient( rgba(39, 40, 35, 0) 0%, rgba(39, 40, 35, 1) 100% ); 13 | background: linear-gradient( rgba(39, 40, 35, 0) 0%, rgba(39, 40, 35, 1) 100% ); 14 | filter: alpha( Opacity=0, FinishOpacity=100, Style=1, StartX=0, StartY=0, FinishX=0, FinishY=500 ); 15 | } 16 | 17 | div#saveNotify { 18 | background: #272823; 19 | } 20 | 21 | .eventPanel:before { 22 | background-color: #272823; 23 | } 24 | 25 | .eventTitle:after { 26 | background-color: #272823; 27 | } 28 | 29 | div.tooltip { 30 | background-color: #111; 31 | border: 1px solid black; 32 | box-shadow: -1px 3px 2px #111; 33 | } 34 | 35 | div#population { 36 | background-color: #272823; 37 | } 38 | 39 | div#village:before { 40 | background: #272823; 41 | } 42 | 43 | div#village { 44 | border: 1px solid #EEE; 45 | } 46 | 47 | div#stores:before { 48 | background: #272823; 49 | } 50 | 51 | div#stores { 52 | border: 1px solid #EEE; 53 | } 54 | 55 | div#weapons:before { 56 | background: #272823; 57 | } 58 | 59 | div#weapons { 60 | border: 1px solid #EEE; 61 | } 62 | 63 | div#bagspace { 64 | background-color: #272823; 65 | } 66 | 67 | div#outfitting:before { 68 | background: #272823; 69 | } 70 | 71 | div#perks { 72 | border: 1px solid #EEE; 73 | } 74 | 75 | div#perks:before { 76 | background-color: #272823; 77 | } 78 | 79 | div#outfitting { 80 | border: 1px solid #EEE; 81 | } 82 | 83 | #bagspace-world { 84 | border: 1px solid #EEE; 85 | } 86 | 87 | div.supplyItem { 88 | border: 1px solid #EEE; 89 | } 90 | 91 | #backpackTitle { 92 | background-color: #272823; 93 | } 94 | 95 | #backpackSpace { 96 | background-color: #272823; 97 | } 98 | 99 | #healthCounter { 100 | background-color: #272823; 101 | } 102 | 103 | #map { 104 | border: 1px solid #EEE; 105 | } 106 | 107 | #map .landmark { 108 | color: #EEE; 109 | } 110 | 111 | #dropMenu { 112 | background: none repeat scroll 0 0 #272823; 113 | box-shadow: -1px 3px 2px #111; 114 | } 115 | 116 | div.button { 117 | border: 1px solid #EEE; 118 | } 119 | 120 | div.button.disabled, div.button.disabled:hover { 121 | border-color: #444; 122 | color: #444; 123 | } 124 | 125 | 126 | .upBtn:after, .upManyBtn:after { 127 | border-color: transparent transparent #272823; 128 | } 129 | 130 | .upBtn:before, .upManyBtn:before { 131 | border-color: transparent transparent #EEE; 132 | } 133 | 134 | .upBtn.disabled:before, .upManyBtn.disabled:before { 135 | border-color: transparent transparent #555; 136 | } 137 | 138 | .dnBtn:after, .dnManyBtn:after { 139 | border-color: #272823 transparent transparent; 140 | } 141 | 142 | .dnBtn:before, .dnManyBtn:before { 143 | border-color: #EEE transparent transparent; 144 | } 145 | 146 | .dnBtn.disabled:before, .dnManyBtn.disabled:before { 147 | border-color: #555 transparent transparent; 148 | } 149 | 150 | body.noMask .eventTitle { 151 | background-color: #EEE; 152 | color: #272823; 153 | } 154 | 155 | body.noMask .eventTitle:after { 156 | background-color: #EEE; 157 | } 158 | 159 | body.noMask .eventPanel { 160 | background-color: #EEE; 161 | } 162 | 163 | body.noMask #description { 164 | color: #272823; 165 | } 166 | 167 | body.noMask #buttons > .button { 168 | border: 1px solid #272823; 169 | color: #272823; 170 | } 171 | 172 | #stars > div, #starsBack > div { 173 | color: black; 174 | } 175 | 176 | .endGame { 177 | color:#272823; 178 | } 179 | 180 | #theEnd { 181 | color: #272823; 182 | } -------------------------------------------------------------------------------- /css/main.css: -------------------------------------------------------------------------------- 1 | /* Fonts */ 2 | body, .tooltip, select.menuBtn { 3 | font-family: "Times New Roman", Times, serif; 4 | font-size: 16px; 5 | font-weight: normal; 6 | line-height: normal; 7 | letter-spacing: normal; 8 | } 9 | 10 | html { 11 | height: 100%; 12 | } 13 | 14 | body { 15 | height: 100%; 16 | margin: 0; 17 | } 18 | 19 | ::selection{ 20 | background-color: transparent; 21 | } 22 | 23 | /* Framework stuff */ 24 | 25 | div.clear { 26 | clear: both; 27 | } 28 | 29 | div#wrapper { 30 | margin: auto; 31 | width: 700px; 32 | padding: 20px 0 0 220px; 33 | position: relative; 34 | } 35 | 36 | div#saveNotify { 37 | position: absolute; 38 | top: 20px; 39 | right: 0px; 40 | background: white; 41 | opacity: 0; 42 | } 43 | 44 | div#content { 45 | position: relative; 46 | overflow: hidden; 47 | height: 700px; 48 | } 49 | 50 | div#header { 51 | padding-bottom: 20px; 52 | height: 20px; 53 | } 54 | 55 | .menu { 56 | position: absolute; 57 | right: 10px; 58 | bottom: 10px; 59 | color: #666; 60 | } 61 | 62 | .menu span { 63 | cursor: pointer; 64 | float: right; 65 | margin-left: 20px; 66 | } 67 | 68 | .select-wrap { 69 | display: inline-block; 70 | overflow: hidden; 71 | height: 20px; 72 | } 73 | 74 | select.menuBtn { 75 | color: #666; 76 | border: none; 77 | cursor: pointer; 78 | margin: -1px -20px 0 0; 79 | background: transparent; 80 | } 81 | 82 | .menu span:hover { 83 | text-decoration: underline; 84 | } 85 | 86 | div.headerButton { 87 | font-size: 18px; 88 | cursor: pointer; 89 | float: left; 90 | border-left: 1px solid black; 91 | margin-left: 10px; 92 | padding-left: 10px; 93 | } 94 | 95 | div.headerButton:hover { 96 | text-decoration: underline; 97 | } 98 | 99 | div.headerButton:first-child { 100 | border-left: none; 101 | margin-left: 0px; 102 | padding-left: 0px; 103 | } 104 | 105 | div.headerButton.selected, div.headerButton.selected:hover { 106 | cursor: default; 107 | text-decoration: underline; 108 | } 109 | 110 | div#outerSlider { 111 | position: absolute; 112 | } 113 | 114 | div#outerSlider > div { 115 | position: relative; 116 | float: left; 117 | width: 700px; 118 | height: 700px; 119 | overflow: hidden; 120 | } 121 | 122 | div#locationSlider { 123 | position: absolute; 124 | } 125 | 126 | div.location { 127 | position: relative; 128 | float: left; 129 | width: 700px; 130 | } 131 | 132 | div.row_key { 133 | clear: both; 134 | float: left; 135 | } 136 | 137 | div.row_val { 138 | float: right; 139 | } 140 | 141 | /* Notifications */ 142 | 143 | div#notifications { 144 | position: absolute; 145 | top: 20px; 146 | left: 0px; 147 | height: 700px; 148 | width: 200px; 149 | overflow: hidden; 150 | } 151 | 152 | div#notifications div.notification { 153 | margin-bottom: 10px; 154 | } 155 | 156 | div#notifyGradient { 157 | position: absolute; 158 | top: 0px; 159 | left: 0px; 160 | height: 100%; 161 | width: 100%; 162 | background-color: white; 163 | background: -webkit-linear-gradient( 164 | rgba(255, 255, 255, 0) 0%, rgba(255, 255, 255, 1) 100% 165 | ); 166 | background: linear-gradient( 167 | rgba(255, 255, 255, 0) 0%, rgba(255, 255, 255, 1) 100% 168 | ); 169 | filter: alpha( 170 | Opacity=0, FinishOpacity=100, Style=1, StartX=0, StartY=0, FinishX=0, FinishY=500 171 | ); 172 | } 173 | 174 | /* Button */ 175 | 176 | div.button { 177 | position: relative; 178 | text-align: center; 179 | border: 1px solid black; 180 | width: 100px; 181 | margin-bottom: 5px; 182 | padding: 5px 10px; 183 | cursor: pointer; 184 | -webkit-touch-callout: none; 185 | -webkit-user-select: none; 186 | -khtml-user-select: none; 187 | -moz-user-select: none; 188 | -ms-user-select: none; 189 | user-select: none; 190 | } 191 | 192 | div.button:hover { 193 | text-decoration: underline; 194 | } 195 | 196 | div.button.disabled, div.button.disabled:hover { 197 | cursor: default; 198 | border-color: grey; 199 | color: grey; 200 | text-decoration: none; 201 | } 202 | 203 | div.button div.cooldown { 204 | position: absolute; 205 | top: 0px; 206 | left: 0px; 207 | z-index: -1; 208 | height: 100%; 209 | background-color: #DDDDDD; 210 | } 211 | 212 | /* Up/Down buttons. They're complicated! */ 213 | 214 | .upBtn, .dnBtn, .upManyBtn, .dnManyBtn { 215 | position: absolute; 216 | width: 14px; 217 | height: 15px; 218 | cursor: pointer; 219 | } 220 | 221 | .upBtn { 222 | right: -5px; 223 | } 224 | 225 | .dnBtn { 226 | right: -25px; 227 | } 228 | 229 | .upManyBtn { 230 | right: -45px; 231 | } 232 | 233 | .dnManyBtn { 234 | right: -65px; 235 | } 236 | 237 | .upBtn.disabled, .dnBtn.disabled, .upManyBtn.disabled, .dnManyBtn.disabled { 238 | cursor: default; 239 | } 240 | 241 | .upBtn { 242 | top: -2px; 243 | } 244 | 245 | .upManyBtn { 246 | top: -2px; 247 | } 248 | 249 | .upBtn:after, .upBtn:before, .upManyBtn:after, .upManyBtn:before { 250 | position: absolute; 251 | border: medium solid transparent; 252 | content: " "; 253 | height: 0; 254 | width: 0; 255 | bottom: 4px; 256 | } 257 | 258 | .upBtn:after, .upManyBtn:after { 259 | border-color: transparent transparent white; 260 | } 261 | 262 | .upBtn:before, .upManyBtn:before { 263 | border-color: transparent transparent black; 264 | } 265 | 266 | .upBtn.disabled:before, .upManyBtn.disabled:before { 267 | border-color: transparent transparent #999; 268 | } 269 | 270 | 271 | .dnBtn { 272 | bottom: -3px; 273 | } 274 | 275 | .dnManyBtn { 276 | bottom: -3px; 277 | } 278 | 279 | .dnBtn:after, .dnBtn:before, .dnManyBtn:after, .dnManyBtn:before { 280 | position: absolute; 281 | border: medium solid transparent; 282 | content: " "; 283 | height: 0; 284 | width: 0; 285 | top: 4px; 286 | } 287 | 288 | .upBtn:after, .dnBtn:after { 289 | border-width: 3px; 290 | left: 50%; 291 | margin-left: -3px; 292 | } 293 | 294 | .upBtn:before, .dnBtn:before, .upManyBtn:before, .dnManyBtn:before { 295 | border-width: 5px; 296 | left: 50%; 297 | margin-left: -5px; 298 | } 299 | 300 | .upManyBtn:after, .dnManyBtn:after { 301 | border-width: 2px; 302 | left: 50%; 303 | margin-left: -2px; 304 | } 305 | 306 | .dnBtn:after, .dnManyBtn:after { 307 | border-color: white transparent transparent; 308 | } 309 | 310 | .dnBtn:before, .dnManyBtn:before { 311 | border-color: black transparent transparent; 312 | } 313 | 314 | .dnBtn.disabled:before, .dnManyBtn.disabled:before { 315 | border-color: #999 transparent transparent; 316 | } 317 | 318 | div.button div.tooltip { 319 | width: 100px; 320 | } 321 | 322 | /* Tooltip */ 323 | 324 | div.tooltip { 325 | display: none; 326 | padding: 2px 5px; 327 | border: 1px solid black; 328 | position: absolute; 329 | box-shadow: -1px 3px 2px #666; 330 | background: white; 331 | z-index: 999; 332 | } 333 | 334 | .tooltip.bottom { 335 | top: 30px; 336 | } 337 | 338 | .tooltip.right { 339 | left: 2px; 340 | } 341 | 342 | .tooltip.left { 343 | right: 0px; 344 | } 345 | 346 | .tooltip.top { 347 | bottom: 20px; 348 | } 349 | 350 | *:hover > div.tooltip { 351 | display: block; 352 | } 353 | 354 | div.tooltip:hover { 355 | display: none !important; 356 | } 357 | 358 | .disabled:hover > div.tooltip, .button.free:hover > div.tooltip { 359 | display: none; 360 | } 361 | 362 | #event .button.disabled:hover > div.tooltip { 363 | display: block; 364 | } 365 | 366 | /* Events */ 367 | 368 | .eventPanel { 369 | background: none repeat scroll 0 0 white; 370 | border: 2px solid transparent; 371 | left: 250px; 372 | padding: 20px; 373 | position: absolute; 374 | top: 90px; 375 | width: 335px; 376 | z-index: 20; 377 | } 378 | 379 | body.noMask .eventPanel { 380 | background-color: black; 381 | } 382 | 383 | .eventPanel:before { 384 | background-color:white; 385 | opacity: 0.6; 386 | content: " "; 387 | height: 700px; 388 | left: -252px; 389 | position: absolute; 390 | top: -75px; 391 | width: 920px; 392 | z-index: -2; 393 | } 394 | 395 | body.noMask .eventPanel:before { 396 | opacity: 0; 397 | } 398 | 399 | .eventPanel:after { 400 | position: absolute; 401 | top: -2px; 402 | left: -2px; 403 | width: 100%; 404 | height: 100%; 405 | content: " "; 406 | border: 2px solid black; 407 | box-shadow: 5px 5px 5px #666666; 408 | z-index: -2; 409 | } 410 | 411 | body.noMask .eventPanel:after { 412 | border-color: white; 413 | } 414 | 415 | .eventPanel .button { 416 | float:left; 417 | margin-right: 20px; 418 | } 419 | 420 | body.noMask .eventPanel .button { 421 | border-color: white; 422 | color: white; 423 | } 424 | 425 | .eventTitle { 426 | display: inline-block; 427 | font-weight: bold; 428 | position: absolute; 429 | top: -12px; 430 | } 431 | 432 | body.noMask .eventTitle { 433 | color: white; 434 | } 435 | 436 | .eventTitle:after { 437 | background-color: white; 438 | bottom: 32%; 439 | content: " "; 440 | height: 5px; 441 | left: 0; 442 | position: absolute; 443 | width: 100%; 444 | z-index: -1; 445 | } 446 | 447 | body.noMask .eventTitle:after { 448 | background-color: black; 449 | } 450 | 451 | #description { 452 | position: relative; 453 | min-height: 100px; 454 | } 455 | 456 | #description textarea { 457 | width: 100%; 458 | height: 225px; 459 | } 460 | 461 | body.noMask #description { 462 | color: white; 463 | } 464 | 465 | #description > div { 466 | padding-bottom: 20px; 467 | } 468 | 469 | #buttons > .button { 470 | margin: 0 5px 5px; 471 | margin-right: 15px; 472 | } 473 | 474 | /* Combat! */ 475 | #description div.fighter { 476 | padding: 0px; 477 | position: absolute; 478 | bottom: 15px; 479 | } 480 | 481 | #wanderer { 482 | left: 25%; 483 | } 484 | 485 | #enemy { 486 | right: 25%; 487 | } 488 | 489 | .hp { 490 | position: absolute; 491 | top: -15px; 492 | margin-left: -50%; 493 | } 494 | 495 | #description .bullet { 496 | padding: 0px 20px 0px 20px; 497 | bottom: 25px; 498 | position: absolute; 499 | height: 1px; 500 | line-height: 1px; 501 | } 502 | 503 | .damageText { 504 | position: absolute; 505 | bottom: 15px; 506 | left: 50%; 507 | margin-left: -50%; 508 | } 509 | 510 | #lootButtons { 511 | padding-bottom: 0px !important; 512 | margin: 20px 0 0 5px; 513 | position: relative; 514 | } 515 | 516 | #lootButtons:before { 517 | content: "take:"; 518 | position: absolute; 519 | top: -25px; 520 | left: 0px; 521 | } 522 | 523 | #dropMenu { 524 | background: none repeat scroll 0 0 white; 525 | border: 1px solid black; 526 | position: absolute; 527 | z-index: 100; 528 | padding-top: 5px; 529 | text-align: left; 530 | box-shadow: -1px 3px 2px #666; 531 | cursor: default; 532 | } 533 | 534 | #dropMenu:before { 535 | content: "drop:"; 536 | border-bottom: 1px solid black; 537 | display: block; 538 | margin-bottom: 5px; 539 | padding: 0px 0px 5px 5px; 540 | } 541 | 542 | #dropMenu > div { 543 | padding: 0px 5px 5px 5px; 544 | cursor: pointer; 545 | } 546 | 547 | #dropMenu > div:hover { 548 | text-decoration: underline; 549 | } 550 | -------------------------------------------------------------------------------- /css/outside.css: -------------------------------------------------------------------------------- 1 | div#village { 2 | position: absolute; 3 | top: 0px; 4 | right: 0px; 5 | border: 1px solid black; 6 | cursor: default; 7 | padding: 5px 10px; 8 | width: 200px; 9 | } 10 | 11 | div#population { 12 | position: absolute; 13 | top: -13px; 14 | right: 10px; 15 | background-color: white; 16 | } 17 | 18 | .noHuts #population { 19 | display: none; 20 | } 21 | 22 | div#village:before { 23 | position: absolute; 24 | background: white; 25 | content: "village"; 26 | left: 8px; 27 | top: -13px; 28 | } 29 | 30 | div#village.noHuts:before { 31 | content: "forest"; 32 | } 33 | 34 | div#workers { 35 | position:absolute; 36 | top: -4px; 37 | left: 160px; 38 | width: 150px; 39 | } 40 | 41 | .workerRow > .row_val { 42 | position: relative; 43 | padding-right: 20px; 44 | -webkit-touch-callout: none; 45 | -webkit-user-select: none; 46 | -khtml-user-select: none; 47 | -moz-user-select: none; 48 | -ms-user-select: none; 49 | user-select: none; 50 | } 51 | 52 | .workerRow { 53 | position: relative; 54 | margin: 10px 0px; 55 | cursor: default; 56 | } 57 | 58 | .workerRow .tooltip { 59 | width: 150px; 60 | } 61 | 62 | div.storeRow div.tooltip { 63 | width: 160px; 64 | } -------------------------------------------------------------------------------- /css/path.css: -------------------------------------------------------------------------------- 1 | #outfitting { 2 | position: relative; 3 | border: 1px solid black; 4 | width: 200px; 5 | margin-bottom: 20px; 6 | padding: 5px 10px; 7 | } 8 | 9 | div#outfitting:before { 10 | position: absolute; 11 | content: "supplies"; 12 | top: -13px; 13 | background-color: white; 14 | } 15 | 16 | div.outfitRow { 17 | position: relative; 18 | cursor: default; 19 | margin: 10px -30px 10px 0px; 20 | } 21 | 22 | div.outfitRow > .row_val { 23 | padding-right: 30px; 24 | -webkit-touch-callout: none; 25 | -webkit-user-select: none; 26 | -khtml-user-select: none; 27 | -moz-user-select: none; 28 | -ms-user-select: none; 29 | user-select: none; 30 | } 31 | 32 | div.outfitRow .tooltip { 33 | width: 150px; 34 | } 35 | 36 | div#bagspace { 37 | background-color: white; 38 | position: absolute; 39 | top:-13px; 40 | right: 10px; 41 | } 42 | 43 | div#perks { 44 | position: absolute; 45 | top: 0px; 46 | right: 0px; 47 | border: 1px solid black; 48 | cursor: default; 49 | padding: 5px 10px; 50 | width: 200px; 51 | } 52 | 53 | div#perks:before { 54 | position: absolute; 55 | content: "perks"; 56 | top: -13px; 57 | background-color: white; 58 | } 59 | 60 | div.perkRow { 61 | position: relative; 62 | } 63 | 64 | div.perkRow .row_key { 65 | float: none; 66 | } -------------------------------------------------------------------------------- /css/room.css: -------------------------------------------------------------------------------- 1 | div#buildBtns { 2 | position: absolute; 3 | top: 50px; 4 | left: 0px; 5 | } 6 | 7 | div#buildBtns:before { 8 | content: "build:"; 9 | position: relative; 10 | top: -5px; 11 | } 12 | 13 | div#craftBtns { 14 | position: absolute; 15 | top: 50px; 16 | left: 150px; 17 | } 18 | 19 | div#craftBtns:before { 20 | content: "craft:"; 21 | position: relative; 22 | top: -5px; 23 | } 24 | 25 | div#buyBtns { 26 | position: absolute; 27 | top: 50px; 28 | left: 300px; 29 | } 30 | 31 | div#buyBtns:before { 32 | content: "buy:"; 33 | position: relative; 34 | top: -5px; 35 | } 36 | 37 | div#storesContainer { 38 | position: absolute; 39 | top: 0px; 40 | right: 0px; 41 | } 42 | 43 | div#stores { 44 | position: relative; 45 | border: 1px solid black; 46 | cursor: default; 47 | padding: 5px 10px; 48 | width: 200px; 49 | } 50 | 51 | div.storeRow { 52 | position: relative; 53 | } 54 | 55 | div#stores:before { 56 | position: absolute; 57 | background: white; 58 | content: "stores"; 59 | left: 8px; 60 | top: -13px; 61 | } 62 | 63 | div#weapons { 64 | margin-top: 15px; 65 | position: relative; 66 | right: 0px; 67 | border: 1px solid black; 68 | cursor: default; 69 | padding: 5px 10px; 70 | width: 200px; 71 | } 72 | 73 | div#weapons:before { 74 | position: absolute; 75 | background: white; 76 | content: "weapons"; 77 | left: 8px; 78 | top: -13px; 79 | } -------------------------------------------------------------------------------- /css/ship.css: -------------------------------------------------------------------------------- 1 | div#hullRow { 2 | width: 70px; 3 | } 4 | 5 | div#engineRow { 6 | width: 70px; 7 | margin-bottom: 20px; 8 | -------------------------------------------------------------------------------- /css/space.css: -------------------------------------------------------------------------------- 1 | @-ms-keyframes spin { 2 | 0% { 3 | -ms-transform: rotate(0deg); 4 | -webkit-transform: rotate(0deg); 5 | -moz-transform: rotate(0deg); 6 | transform:rotate(0deg); 7 | } 8 | 100% { 9 | -ms-transform: rotate(360deg); 10 | -webkit-transform: rotate(360deg); 11 | -moz-transform: rotate(360deg); 12 | transform:rotate(360deg); 13 | } 14 | } 15 | 16 | @-webkit-keyframes spin { 17 | 0% { 18 | -ms-transform: rotate(0deg); 19 | -webkit-transform: rotate(0deg); 20 | -moz-transform: rotate(0deg); 21 | transform:rotate(0deg); 22 | } 23 | 100% { 24 | -ms-transform: rotate(360deg); 25 | -webkit-transform: rotate(360deg); 26 | -moz-transform: rotate(360deg); 27 | transform:rotate(360deg); 28 | } 29 | } 30 | 31 | @-moz-keyframes spin { 32 | 0% { 33 | -ms-transform: rotate(0deg); 34 | -webkit-transform: rotate(0deg); 35 | -moz-transform: rotate(0deg); 36 | transform:rotate(0deg); 37 | } 38 | 100% { 39 | -ms-transform: rotate(360deg); 40 | -webkit-transform: rotate(360deg); 41 | -moz-transform: rotate(360deg); 42 | transform:rotate(360deg); 43 | } 44 | } 45 | 46 | @keyframes spin { 47 | 0% { 48 | -ms-transform: rotate(0deg); 49 | -webkit-transform: rotate(0deg); 50 | -moz-transform: rotate(0deg); 51 | transform:rotate(0deg); 52 | } 53 | 100% { 54 | -ms-transform: rotate(360deg); 55 | -webkit-transform: rotate(360deg); 56 | -moz-transform: rotate(360deg); 57 | transform:rotate(360deg); 58 | } 59 | } 60 | 61 | #spacePanel { 62 | float: none !important; 63 | position: absolute !important; 64 | top: -700px; 65 | left: 0px; 66 | } 67 | 68 | #starsContainer { 69 | width: 100%; 70 | height: 100%; 71 | position: absolute; 72 | top: 0px; 73 | left: 0px; 74 | overflow: hidden; 75 | } 76 | 77 | #stars, #starsBack { 78 | position: absolute; 79 | z-index: -1; 80 | left: 0px; 81 | } 82 | 83 | #stars > div, #starsBack > div { 84 | position: relative; 85 | height: 3000px; 86 | width: 3000px; 87 | color: white; 88 | } 89 | 90 | #starsBack { 91 | opacity: 0.5; 92 | } 93 | 94 | .star { 95 | position: absolute; 96 | } 97 | 98 | #ship { 99 | cursor: default; 100 | position: absolute; 101 | margin-top: -10px; 102 | margin-left: -7.5px; 103 | } 104 | 105 | #theEnd { 106 | position: relative; 107 | cursor: default; 108 | top: 200px; 109 | margin-left: -220px; 110 | text-align: center; 111 | font-size: 24px; 112 | font-weight: bold; 113 | opacity: 0; 114 | color: white; 115 | } 116 | 117 | .asteroid { 118 | cursor: default; 119 | position: absolute; 120 | top: -40px; 121 | left: 350px; 122 | -webkit-animation: 1s linear 0s normal none infinite spin; 123 | -moz-animation: 1s linear 0s normal none infinite spin; 124 | -ms-animation: 1s linear 0s normal none infinite spin; 125 | animation: 1s linear 0s normal none infinite spin; 126 | font-size: 32px; 127 | } 128 | 129 | #hullRemaining { 130 | width: 70px; 131 | position: absolute; 132 | top: 0px; 133 | left: 0px; 134 | } 135 | 136 | .centerCont { 137 | padding-top:10%; 138 | } 139 | 140 | .endGame { 141 | font-size:48px; 142 | color:#FFFFFF; 143 | opacity:0; 144 | position:relative; 145 | } 146 | 147 | .endGameRestart { 148 | font-size: 32px; 149 | cursor: pointer; 150 | } 151 | 152 | .endGameRestart:hover { 153 | text-decoration: underline; 154 | } 155 | -------------------------------------------------------------------------------- /css/world.css: -------------------------------------------------------------------------------- 1 | #worldOuter { 2 | position: relative; 3 | display: inline-block; 4 | } 5 | 6 | #map { 7 | position: relative; 8 | font-family: "Courier New", Courier, monospace; 9 | border: 1px solid black; 10 | overflow: hidden; 11 | display: inline-block; 12 | line-height: 10px; 13 | letter-spacing: 1px; 14 | color: #999; 15 | cursor: default; 16 | -webkit-touch-callout: none; 17 | -webkit-user-select: none; 18 | -khtml-user-select: none; 19 | -moz-user-select: none; 20 | -ms-user-select: none; 21 | user-select: none; 22 | } 23 | 24 | #map .landmark { 25 | position: relative; 26 | font-weight: bold; 27 | color: black; 28 | line-height: 0px; /* Hack to prevent the boldness from increasing the row's line-height. I hope it works in all browsers... */ 29 | } 30 | 31 | #bagspace-world { 32 | border: 1px solid black; 33 | height: 62px; 34 | margin-bottom: 5px; 35 | margin-top: 13px; 36 | overflow: hidden; 37 | } 38 | 39 | #bagspace-world > div { 40 | padding: 6px 4px; 41 | } 42 | 43 | #backpackTitle { 44 | position: absolute; 45 | top: 0px; 46 | left: 10px; 47 | background-color: white; 48 | z-index: 1; 49 | } 50 | 51 | #backpackSpace { 52 | position: absolute; 53 | top: 0px; 54 | right: 10px; 55 | background-color: white; 56 | z-index: 1; 57 | } 58 | 59 | #healthCounter { 60 | position: absolute; 61 | top: 0px; 62 | left: 80px; 63 | background-color: white; 64 | z-index: 1; 65 | } 66 | 67 | div.supplyItem { 68 | display: inline-block; 69 | border: 1px solid #999; 70 | float: left; 71 | margin: 0px 5px 6px 0px; 72 | padding: 0 5px; 73 | cursor: default; 74 | } -------------------------------------------------------------------------------- /doc/Events.xlsx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dragonstudio/ADarkRoomAndroid/5738ca43817aa929eefab2c95bd0a466fd568477/doc/Events.xlsx -------------------------------------------------------------------------------- /doc/Zones.txt: -------------------------------------------------------------------------------- 1 | Radius Enemy DPS Player DPS Enemy HP Player HP 2 | ===================================================================== 3 | < 10 1 1 5 10 4 | < 20 3 3 10 15-20 5 | < 30 6 4 20 30-40 -------------------------------------------------------------------------------- /doc/translation.txt: -------------------------------------------------------------------------------- 1 | 2 | HOWTO TRANSLATE 3 | =================== 4 | 5 | for people who doesn't need translation : 6 | - all strings sent to the page must go through the javascript function _() which will translate it. so please, if you add new strings, wrap them with _('') function. 7 | - if you want to add some strings in the css (using content), please, edit /script/localization.js too 8 | - thank you :) 9 | 10 | ADD A NEW LANGUAGE 11 | ====================== 12 | 13 | - copy the /lang/fr folder to /lang/{new_language} 14 | - open /lang/{new_language}/strings.po with a software like PoEdit (available on linux/mac/windows, no excuses) 15 | - translate ... 16 | - keep translating ... 17 | - finished ? sure ? 18 | - use the python script (/tools/po2js.py) to convert the po file to a js file 19 | - edit index.html and add the following script after '' (replace the path with your language) 20 | 21 | 26 | 27 | - if your sentence are too big and you need to update some css, overload it in /lang/{new_language}/main.css 28 | 29 | 30 | -------------------------------------------------------------------------------- /favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dragonstudio/ADarkRoomAndroid/5738ca43817aa929eefab2c95bd0a466fd568477/favicon.ico -------------------------------------------------------------------------------- /img/Logo1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dragonstudio/ADarkRoomAndroid/5738ca43817aa929eefab2c95bd0a466fd568477/img/Logo1.jpg -------------------------------------------------------------------------------- /img/adr.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dragonstudio/ADarkRoomAndroid/5738ca43817aa929eefab2c95bd0a466fd568477/img/adr.png -------------------------------------------------------------------------------- /img/chrome.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dragonstudio/ADarkRoomAndroid/5738ca43817aa929eefab2c95bd0a466fd568477/img/chrome.png -------------------------------------------------------------------------------- /img/firefox.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dragonstudio/ADarkRoomAndroid/5738ca43817aa929eefab2c95bd0a466fd568477/img/firefox.png -------------------------------------------------------------------------------- /img/ie.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dragonstudio/ADarkRoomAndroid/5738ca43817aa929eefab2c95bd0a466fd568477/img/ie.png -------------------------------------------------------------------------------- /img/opera.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dragonstudio/ADarkRoomAndroid/5738ca43817aa929eefab2c95bd0a466fd568477/img/opera.png -------------------------------------------------------------------------------- /img/safari.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dragonstudio/ADarkRoomAndroid/5738ca43817aa929eefab2c95bd0a466fd568477/img/safari.png -------------------------------------------------------------------------------- /index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 13 | A Dark Room 14 | 15 | 16 | 17 | 18 | 19 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 72 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 |
89 |
90 |
91 |
92 |
93 | 94 |
95 |
96 |
97 |
98 | 99 | 100 | -------------------------------------------------------------------------------- /lang/cn/main.css: -------------------------------------------------------------------------------- 1 | .button{width: 100px !important;} 2 | #outsidePanel .button{width: 115px !important;} 3 | .eventPanel .button {width: 122px !important;} 4 | -------------------------------------------------------------------------------- /lang/fr/main.css: -------------------------------------------------------------------------------- 1 | .button{width: 100px !important;} 2 | #outsidePanel .button{width: 115px !important;} 3 | .eventPanel .button {width: 122px !important;} -------------------------------------------------------------------------------- /lang/fr/strings.mo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dragonstudio/ADarkRoomAndroid/5738ca43817aa929eefab2c95bd0a466fd568477/lang/fr/strings.mo -------------------------------------------------------------------------------- /lang/jp/main.css: -------------------------------------------------------------------------------- 1 | .button{width: 100px !important;} 2 | #outsidePanel .button{width: 115px !important;} 3 | .eventPanel .button {width: 122px !important;} 4 | -------------------------------------------------------------------------------- /lang/langs.js: -------------------------------------------------------------------------------- 1 | var langs = { 2 | 'en':'english', 3 | 'fr':'français', 4 | 'cn':'简体中文', 5 | 'jp':'日本語' 6 | } 7 | -------------------------------------------------------------------------------- /lib/base64.js: -------------------------------------------------------------------------------- 1 | /** 2 | * 3 | * Base64 encode / decode 4 | * http://www.webtoolkit.info/ 5 | * 6 | **/ 7 | var Base64 = { 8 | 9 | // private property 10 | _keyStr : "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=", 11 | 12 | // public method for encoding 13 | encode : function (input) { 14 | var output = ""; 15 | var chr1, chr2, chr3, enc1, enc2, enc3, enc4; 16 | var i = 0; 17 | 18 | input = Base64._utf8_encode(input); 19 | 20 | while (i < input.length) { 21 | 22 | chr1 = input.charCodeAt(i++); 23 | chr2 = input.charCodeAt(i++); 24 | chr3 = input.charCodeAt(i++); 25 | 26 | enc1 = chr1 >> 2; 27 | enc2 = ((chr1 & 3) << 4) | (chr2 >> 4); 28 | enc3 = ((chr2 & 15) << 2) | (chr3 >> 6); 29 | enc4 = chr3 & 63; 30 | 31 | if (isNaN(chr2)) { 32 | enc3 = enc4 = 64; 33 | } else if (isNaN(chr3)) { 34 | enc4 = 64; 35 | } 36 | 37 | output = output + 38 | this._keyStr.charAt(enc1) + this._keyStr.charAt(enc2) + 39 | this._keyStr.charAt(enc3) + this._keyStr.charAt(enc4); 40 | 41 | } 42 | 43 | return output; 44 | }, 45 | 46 | // public method for decoding 47 | decode : function (input) { 48 | var output = ""; 49 | var chr1, chr2, chr3; 50 | var enc1, enc2, enc3, enc4; 51 | var i = 0; 52 | 53 | input = input.replace(/[^A-Za-z0-9\+\/\=]/g, ""); 54 | 55 | while (i < input.length) { 56 | 57 | enc1 = this._keyStr.indexOf(input.charAt(i++)); 58 | enc2 = this._keyStr.indexOf(input.charAt(i++)); 59 | enc3 = this._keyStr.indexOf(input.charAt(i++)); 60 | enc4 = this._keyStr.indexOf(input.charAt(i++)); 61 | 62 | chr1 = (enc1 << 2) | (enc2 >> 4); 63 | chr2 = ((enc2 & 15) << 4) | (enc3 >> 2); 64 | chr3 = ((enc3 & 3) << 6) | enc4; 65 | 66 | output = output + String.fromCharCode(chr1); 67 | 68 | if (enc3 != 64) { 69 | output = output + String.fromCharCode(chr2); 70 | } 71 | if (enc4 != 64) { 72 | output = output + String.fromCharCode(chr3); 73 | } 74 | 75 | } 76 | 77 | output = Base64._utf8_decode(output); 78 | 79 | return output; 80 | 81 | }, 82 | 83 | // private method for UTF-8 encoding 84 | _utf8_encode : function (string) { 85 | string = string.replace(/\r\n/g,"\n"); 86 | var utftext = ""; 87 | 88 | for (var n = 0; n < string.length; n++) { 89 | 90 | var c = string.charCodeAt(n); 91 | 92 | if (c < 128) { 93 | utftext += String.fromCharCode(c); 94 | } 95 | else if((c > 127) && (c < 2048)) { 96 | utftext += String.fromCharCode((c >> 6) | 192); 97 | utftext += String.fromCharCode((c & 63) | 128); 98 | } 99 | else { 100 | utftext += String.fromCharCode((c >> 12) | 224); 101 | utftext += String.fromCharCode(((c >> 6) & 63) | 128); 102 | utftext += String.fromCharCode((c & 63) | 128); 103 | } 104 | 105 | } 106 | 107 | return utftext; 108 | }, 109 | 110 | // private method for UTF-8 decoding 111 | _utf8_decode : function (utftext) { 112 | var string = ""; 113 | var i = 0; 114 | var c = c1 = c2 = 0; 115 | 116 | while ( i < utftext.length ) { 117 | 118 | c = utftext.charCodeAt(i); 119 | 120 | if (c < 128) { 121 | string += String.fromCharCode(c); 122 | i++; 123 | } 124 | else if((c > 191) && (c < 224)) { 125 | c2 = utftext.charCodeAt(i+1); 126 | string += String.fromCharCode(((c & 31) << 6) | (c2 & 63)); 127 | i += 2; 128 | } 129 | else { 130 | c2 = utftext.charCodeAt(i+1); 131 | c3 = utftext.charCodeAt(i+2); 132 | string += String.fromCharCode(((c & 15) << 12) | ((c2 & 63) << 6) | (c3 & 63)); 133 | i += 3; 134 | } 135 | 136 | } 137 | 138 | return string; 139 | } 140 | 141 | } -------------------------------------------------------------------------------- /lib/icu.js: -------------------------------------------------------------------------------- 1 | (function() { 2 | 3 | var dfs = {"am_pm":["AM","PM"],"day_name":["dimanche","lundi","mardi","mercredi","jeudi","vendredi","samedi"],"day_short":["dim.","lun.","mar.","mer.","jeu.","ven.","sam."],"era":["av. J.-C.","ap. J.-C."],"era_name":["avant Jésus-Christ","après Jésus-Christ"],"month_name":["janvier","février","mars","avril","mai","juin","juillet","août","septembre","octobre","novembre","décembre"],"month_short":["janv.","févr.","mars","avr.","mai","juin","juil.","août","sept.","oct.","nov.","déc."],"order_full":"DMY","order_long":"DMY","order_medium":"DMY","order_short":"DMY"}; 4 | var nfs = {"decimal_separator":",","grouping_separator":" ","minus":"-"}; 5 | var df = {SHORT_PADDED_CENTURY:function(d){if(d){return(((d.getDate()+101)+'').substring(1)+'/'+((d.getMonth()+101)+'').substring(1)+'/'+d.getFullYear());}},SHORT:function(d){if(d){return(((d.getDate()+101)+'').substring(1)+'/'+((d.getMonth()+101)+'').substring(1)+'/'+(d.getFullYear()+'').substring(2));}},SHORT_NOYEAR:function(d){if(d){return(((d.getDate()+101)+'').substring(1)+'/'+((d.getMonth()+101)+'').substring(1));}},SHORT_NODAY:function(d){if(d){return(((d.getMonth()+101)+'').substring(1)+'/'+(d.getFullYear()+'').substring(2));}},MEDIUM:function(d){if(d){return(d.getDate()+' '+dfs.month_short[d.getMonth()]+' '+d.getFullYear());}},MEDIUM_NOYEAR:function(d){if(d){return(d.getDate()+' '+dfs.month_short[d.getMonth()]);}},MEDIUM_WEEKDAY_NOYEAR:function(d){if(d){return(dfs.day_short[d.getDay()]+' '+d.getDate()+' '+dfs.month_short[d.getMonth()]);}},LONG_NODAY:function(d){if(d){return(dfs.month_name[d.getMonth()]+' '+d.getFullYear());}},LONG:function(d){if(d){return(d.getDate()+' '+dfs.month_name[d.getMonth()]+' '+d.getFullYear());}},FULL:function(d){if(d){return(dfs.day_name[d.getDay()]+' '+d.getDate()+' '+dfs.month_name[d.getMonth()]+' '+d.getFullYear());}}}; 6 | 7 | window.icu = window.icu || new Object(); 8 | var icu = window.icu; 9 | 10 | icu.getCountry = function() { return "" }; 11 | icu.getCountryName = function() { return "" }; 12 | icu.getDateFormat = function(formatCode) { var retVal = {}; retVal.format = df[formatCode]; return retVal; }; 13 | icu.getDateFormats = function() { return df; }; 14 | icu.getDateFormatSymbols = function() { return dfs; }; 15 | icu.getDecimalFormat = function(places) { var retVal = {}; retVal.format = function(n) { var ns = n < 0 ? Math.abs(n).toFixed(places) : n.toFixed(places); var ns2 = ns.split('.'); s = ns2[0]; var d = ns2[1]; var rgx = /(\d+)(\d{3})/;while(rgx.test(s)){s = s.replace(rgx, '$1' + nfs["grouping_separator"] + '$2');} return (n < 0 ? nfs["minus"] : "") + s + nfs["decimal_separator"] + d;}; return retVal; }; 16 | icu.getDecimalFormatSymbols = function() { return nfs; }; 17 | icu.getIntegerFormat = function() { var retVal = {}; retVal.format = function(i) { var s = i < 0 ? Math.abs(i).toString() : i.toString(); var rgx = /(\d+)(\d{3})/;while(rgx.test(s)){s = s.replace(rgx, '$1' + nfs["grouping_separator"] + '$2');} return i < 0 ? nfs["minus"] + s : s;}; return retVal; }; 18 | icu.getLanguage = function() { return "fr" }; 19 | icu.getLanguageName = function() { return "français" }; 20 | icu.getLocale = function() { return "fr" }; 21 | icu.getLocaleName = function() { return "français" }; 22 | 23 | })(); -------------------------------------------------------------------------------- /lib/jquery.color-2.1.2.min.js: -------------------------------------------------------------------------------- 1 | /*! jQuery Color v@2.1.2 http://github.com/jquery/jquery-color | jquery.org/license */ 2 | (function(a,b){function m(a,b,c){var d=h[b.type]||{};return a==null?c||!b.def?null:b.def:(a=d.floor?~~a:parseFloat(a),isNaN(a)?b.def:d.mod?(a+d.mod)%d.mod:0>a?0:d.max")[0],k,l=a.each;j.style.cssText="background-color:rgba(1,1,1,.5)",i.rgba=j.style.backgroundColor.indexOf("rgba")>-1,l(g,function(a,b){b.cache="_"+a,b.props.alpha={idx:3,type:"percent",def:1}}),f.fn=a.extend(f.prototype,{parse:function(c,d,e,h){if(c===b)return this._rgba=[null,null,null,null],this;if(c.jquery||c.nodeType)c=a(c).css(d),d=b;var i=this,j=a.type(c),o=this._rgba=[];d!==b&&(c=[c,d,e,h],j="array");if(j==="string")return this.parse(n(c)||k._default);if(j==="array")return l(g.rgba.props,function(a,b){o[b.idx]=m(c[b.idx],b)}),this;if(j==="object")return c instanceof f?l(g,function(a,b){c[b.cache]&&(i[b.cache]=c[b.cache].slice())}):l(g,function(b,d){var e=d.cache;l(d.props,function(a,b){if(!i[e]&&d.to){if(a==="alpha"||c[a]==null)return;i[e]=d.to(i._rgba)}i[e][b.idx]=m(c[a],b,!0)}),i[e]&&a.inArray(null,i[e].slice(0,3))<0&&(i[e][3]=1,d.from&&(i._rgba=d.from(i[e])))}),this},is:function(a){var b=f(a),c=!0,d=this;return l(g,function(a,e){var f,g=b[e.cache];return g&&(f=d[e.cache]||e.to&&e.to(d._rgba)||[],l(e.props,function(a,b){if(g[b.idx]!=null)return c=g[b.idx]===f[b.idx],c})),c}),c},_space:function(){var a=[],b=this;return l(g,function(c,d){b[d.cache]&&a.push(c)}),a.pop()},transition:function(a,b){var c=f(a),d=c._space(),e=g[d],i=this.alpha()===0?f("transparent"):this,j=i[e.cache]||e.to(i._rgba),k=j.slice();return c=c[e.cache],l(e.props,function(a,d){var e=d.idx,f=j[e],g=c[e],i=h[d.type]||{};if(g===null)return;f===null?k[e]=g:(i.mod&&(g-f>i.mod/2?f+=i.mod:f-g>i.mod/2&&(f-=i.mod)),k[e]=m((g-f)*b+f,d))}),this[d](k)},blend:function(b){if(this._rgba[3]===1)return this;var c=this._rgba.slice(),d=c.pop(),e=f(b)._rgba;return f(a.map(c,function(a,b){return(1-d)*e[b]+d*a}))},toRgbaString:function(){var b="rgba(",c=a.map(this._rgba,function(a,b){return a==null?b>2?1:0:a});return c[3]===1&&(c.pop(),b="rgb("),b+c.join()+")"},toHslaString:function(){var b="hsla(",c=a.map(this.hsla(),function(a,b){return a==null&&(a=b>2?1:0),b&&b<3&&(a=Math.round(a*100)+"%"),a});return c[3]===1&&(c.pop(),b="hsl("),b+c.join()+")"},toHexString:function(b){var c=this._rgba.slice(),d=c.pop();return b&&c.push(~~(d*255)),"#"+a.map(c,function(a){return a=(a||0).toString(16),a.length===1?"0"+a:a}).join("")},toString:function(){return this._rgba[3]===0?"transparent":this.toRgbaString()}}),f.fn.parse.prototype=f.fn,g.hsla.to=function(a){if(a[0]==null||a[1]==null||a[2]==null)return[null,null,null,a[3]];var b=a[0]/255,c=a[1]/255,d=a[2]/255,e=a[3],f=Math.max(b,c,d),g=Math.min(b,c,d),h=f-g,i=f+g,j=i*.5,k,l;return g===f?k=0:b===f?k=60*(c-d)/h+360:c===f?k=60*(d-b)/h+120:k=60*(b-c)/h+240,h===0?l=0:j<=.5?l=h/i:l=h/(2-i),[Math.round(k)%360,l,j,e==null?1:e]},g.hsla.from=function(a){if(a[0]==null||a[1]==null||a[2]==null)return[null,null,null,a[3]];var b=a[0]/360,c=a[1],d=a[2],e=a[3],f=d<=.5?d*(1+c):d+c-d*c,g=2*d-f;return[Math.round(o(g,f,b+1/3)*255),Math.round(o(g,f,b)*255),Math.round(o(g,f,b-1/3)*255),e]},l(g,function(c,e){var g=e.props,h=e.cache,i=e.to,j=e.from;f.fn[c]=function(c){i&&!this[h]&&(this[h]=i(this._rgba));if(c===b)return this[h].slice();var d,e=a.type(c),k=e==="array"||e==="object"?c:arguments,n=this[h].slice();return l(g,function(a,b){var c=k[e==="object"?a:b.idx];c==null&&(c=n[b.idx]),n[b.idx]=m(c,b)}),j?(d=f(j(n)),d[h]=n,d):f(n)},l(g,function(b,e){if(f.fn[b])return;f.fn[b]=function(f){var g=a.type(f),h=b==="alpha"?this._hsla?"hsla":"rgba":c,i=this[h](),j=i[e.idx],k;return g==="undefined"?j:(g==="function"&&(f=f.call(this,j),g=a.type(f)),f==null&&e.empty?this:(g==="string"&&(k=d.exec(f),k&&(f=j+parseFloat(k[2])*(k[1]==="+"?1:-1))),i[e.idx]=f,this[h](i)))}})}),f.hook=function(b){var c=b.split(" ");l(c,function(b,c){a.cssHooks[c]={set:function(b,d){var e,g,h="";if(d!=="transparent"&&(a.type(d)!=="string"||(e=n(d)))){d=f(e||d);if(!i.rgba&&d._rgba[3]!==1){g=c==="backgroundColor"?b.parentNode:b;while((h===""||h==="transparent")&&g&&g.style)try{h=a.css(g,"backgroundColor"),g=g.parentNode}catch(j){}d=d.blend(h&&h!=="transparent"?h:"_default")}d=d.toRgbaString()}try{b.style[c]=d}catch(j){}}},a.fx.step[c]=function(b){b.colorInit||(b.start=f(b.elem,c),b.end=f(b.end),b.colorInit=!0),a.cssHooks[c].set(b.elem,b.start.transition(b.end,b.pos))}})},f.hook(c),a.cssHooks.borderColor={expand:function(a){var b={};return l(["Top","Right","Bottom","Left"],function(c,d){b["border"+d+"Color"]=a}),b}},k=a.Color.names={aqua:"#00ffff",black:"#000000",blue:"#0000ff",fuchsia:"#ff00ff",gray:"#808080",green:"#008000",lime:"#00ff00",maroon:"#800000",navy:"#000080",olive:"#808000",purple:"#800080",red:"#ff0000",silver:"#c0c0c0",teal:"#008080",white:"#ffffff",yellow:"#ffff00",transparent:[null,null,null,0],_default:"#ffffff"}})(jQuery); -------------------------------------------------------------------------------- /lib/jquery.event.move.js: -------------------------------------------------------------------------------- 1 | // jquery.event.move 2 | // 3 | // 1.3.1 4 | // 5 | // Stephen Band 6 | // 7 | // Triggers 'movestart', 'move' and 'moveend' events after 8 | // mousemoves following a mousedown cross a distance threshold, 9 | // similar to the native 'dragstart', 'drag' and 'dragend' events. 10 | // Move events are throttled to animation frames. Move event objects 11 | // have the properties: 12 | // 13 | // pageX: 14 | // pageY: Page coordinates of pointer. 15 | // startX: 16 | // startY: Page coordinates of pointer at movestart. 17 | // distX: 18 | // distY: Distance the pointer has moved since movestart. 19 | // deltaX: 20 | // deltaY: Distance the finger has moved since last event. 21 | // velocityX: 22 | // velocityY: Average velocity over last few events. 23 | 24 | 25 | (function (module) { 26 | if (typeof define === 'function' && define.amd) { 27 | // AMD. Register as an anonymous module. 28 | define(['jquery'], module); 29 | } else { 30 | // Browser globals 31 | module(jQuery); 32 | } 33 | })(function(jQuery, undefined){ 34 | 35 | var // Number of pixels a pressed pointer travels before movestart 36 | // event is fired. 37 | threshold = 6, 38 | 39 | add = jQuery.event.add, 40 | 41 | remove = jQuery.event.remove, 42 | 43 | // Just sugar, so we can have arguments in the same order as 44 | // add and remove. 45 | trigger = function(node, type, data) { 46 | jQuery.event.trigger(type, data, node); 47 | }, 48 | 49 | // Shim for requestAnimationFrame, falling back to timer. See: 50 | // see http://paulirish.com/2011/requestanimationframe-for-smart-animating/ 51 | requestFrame = (function(){ 52 | return ( 53 | window.requestAnimationFrame || 54 | window.webkitRequestAnimationFrame || 55 | window.mozRequestAnimationFrame || 56 | window.oRequestAnimationFrame || 57 | window.msRequestAnimationFrame || 58 | function(fn, element){ 59 | return window.setTimeout(function(){ 60 | fn(); 61 | }, 25); 62 | } 63 | ); 64 | })(), 65 | 66 | ignoreTags = { 67 | textarea: true, 68 | input: true, 69 | select: true, 70 | button: true 71 | }, 72 | 73 | mouseevents = { 74 | move: 'mousemove', 75 | cancel: 'mouseup dragstart', 76 | end: 'mouseup' 77 | }, 78 | 79 | touchevents = { 80 | move: 'touchmove', 81 | cancel: 'touchend', 82 | end: 'touchend' 83 | }; 84 | 85 | 86 | // Constructors 87 | 88 | function Timer(fn){ 89 | var callback = fn, 90 | active = false, 91 | running = false; 92 | 93 | function trigger(time) { 94 | if (active){ 95 | callback(); 96 | requestFrame(trigger); 97 | running = true; 98 | active = false; 99 | } 100 | else { 101 | running = false; 102 | } 103 | } 104 | 105 | this.kick = function(fn) { 106 | active = true; 107 | if (!running) { trigger(); } 108 | }; 109 | 110 | this.end = function(fn) { 111 | var cb = callback; 112 | 113 | if (!fn) { return; } 114 | 115 | // If the timer is not running, simply call the end callback. 116 | if (!running) { 117 | fn(); 118 | } 119 | // If the timer is running, and has been kicked lately, then 120 | // queue up the current callback and the end callback, otherwise 121 | // just the end callback. 122 | else { 123 | callback = active ? 124 | function(){ cb(); fn(); } : 125 | fn ; 126 | 127 | active = true; 128 | } 129 | }; 130 | } 131 | 132 | 133 | // Functions 134 | 135 | function returnTrue() { 136 | return true; 137 | } 138 | 139 | function returnFalse() { 140 | return false; 141 | } 142 | 143 | function preventDefault(e) { 144 | e.preventDefault(); 145 | } 146 | 147 | function preventIgnoreTags(e) { 148 | // Don't prevent interaction with form elements. 149 | if (ignoreTags[ e.target.tagName.toLowerCase() ]) { return; } 150 | 151 | e.preventDefault(); 152 | } 153 | 154 | function isLeftButton(e) { 155 | // Ignore mousedowns on any button other than the left (or primary) 156 | // mouse button, or when a modifier key is pressed. 157 | return (e.which === 1 && !e.ctrlKey && !e.altKey); 158 | } 159 | 160 | function identifiedTouch(touchList, id) { 161 | var i, l; 162 | 163 | if (touchList.identifiedTouch) { 164 | return touchList.identifiedTouch(id); 165 | } 166 | 167 | // touchList.identifiedTouch() does not exist in 168 | // webkit yet… we must do the search ourselves... 169 | 170 | i = -1; 171 | l = touchList.length; 172 | 173 | while (++i < l) { 174 | if (touchList[i].identifier === id) { 175 | return touchList[i]; 176 | } 177 | } 178 | } 179 | 180 | function changedTouch(e, event) { 181 | var touch = identifiedTouch(e.changedTouches, event.identifier); 182 | 183 | // This isn't the touch you're looking for. 184 | if (!touch) { return; } 185 | 186 | // Chrome Android (at least) includes touches that have not 187 | // changed in e.changedTouches. That's a bit annoying. Check 188 | // that this touch has changed. 189 | if (touch.pageX === event.pageX && touch.pageY === event.pageY) { return; } 190 | 191 | return touch; 192 | } 193 | 194 | 195 | // Handlers that decide when the first movestart is triggered 196 | 197 | function mousedown(e){ 198 | var data; 199 | 200 | if (!isLeftButton(e)) { return; } 201 | 202 | data = { 203 | target: e.target, 204 | startX: e.pageX, 205 | startY: e.pageY, 206 | timeStamp: e.timeStamp 207 | }; 208 | 209 | add(document, mouseevents.move, mousemove, data); 210 | add(document, mouseevents.cancel, mouseend, data); 211 | } 212 | 213 | function mousemove(e){ 214 | var data = e.data; 215 | 216 | checkThreshold(e, data, e, removeMouse); 217 | } 218 | 219 | function mouseend(e) { 220 | removeMouse(); 221 | } 222 | 223 | function removeMouse() { 224 | remove(document, mouseevents.move, mousemove); 225 | remove(document, mouseevents.cancel, mouseend); 226 | } 227 | 228 | function touchstart(e) { 229 | var touch, template; 230 | 231 | // Don't get in the way of interaction with form elements. 232 | if (ignoreTags[ e.target.tagName.toLowerCase() ]) { return; } 233 | 234 | touch = e.changedTouches[0]; 235 | 236 | // iOS live updates the touch objects whereas Android gives us copies. 237 | // That means we can't trust the touchstart object to stay the same, 238 | // so we must copy the data. This object acts as a template for 239 | // movestart, move and moveend event objects. 240 | template = { 241 | target: touch.target, 242 | startX: touch.pageX, 243 | startY: touch.pageY, 244 | timeStamp: e.timeStamp, 245 | identifier: touch.identifier 246 | }; 247 | 248 | // Use the touch identifier as a namespace, so that we can later 249 | // remove handlers pertaining only to this touch. 250 | add(document, touchevents.move + '.' + touch.identifier, touchmove, template); 251 | add(document, touchevents.cancel + '.' + touch.identifier, touchend, template); 252 | } 253 | 254 | function touchmove(e){ 255 | var data = e.data, 256 | touch = changedTouch(e, data); 257 | 258 | if (!touch) { return; } 259 | 260 | checkThreshold(e, data, touch, removeTouch); 261 | } 262 | 263 | function touchend(e) { 264 | var template = e.data, 265 | touch = identifiedTouch(e.changedTouches, template.identifier); 266 | 267 | if (!touch) { return; } 268 | 269 | removeTouch(template.identifier); 270 | } 271 | 272 | function removeTouch(identifier) { 273 | remove(document, '.' + identifier, touchmove); 274 | remove(document, '.' + identifier, touchend); 275 | } 276 | 277 | 278 | // Logic for deciding when to trigger a movestart. 279 | 280 | function checkThreshold(e, template, touch, fn) { 281 | var distX = touch.pageX - template.startX, 282 | distY = touch.pageY - template.startY; 283 | 284 | // Do nothing if the threshold has not been crossed. 285 | if ((distX * distX) + (distY * distY) < (threshold * threshold)) { return; } 286 | 287 | triggerStart(e, template, touch, distX, distY, fn); 288 | } 289 | 290 | function handled() { 291 | // this._handled should return false once, and after return true. 292 | this._handled = returnTrue; 293 | return false; 294 | } 295 | 296 | function flagAsHandled(e) { 297 | e._handled(); 298 | } 299 | 300 | function triggerStart(e, template, touch, distX, distY, fn) { 301 | var node = template.target, 302 | touches, time; 303 | 304 | touches = e.targetTouches; 305 | time = e.timeStamp - template.timeStamp; 306 | 307 | // Create a movestart object with some special properties that 308 | // are passed only to the movestart handlers. 309 | template.type = 'movestart'; 310 | template.distX = distX; 311 | template.distY = distY; 312 | template.deltaX = distX; 313 | template.deltaY = distY; 314 | template.pageX = touch.pageX; 315 | template.pageY = touch.pageY; 316 | template.velocityX = distX / time; 317 | template.velocityY = distY / time; 318 | template.targetTouches = touches; 319 | template.finger = touches ? 320 | touches.length : 321 | 1 ; 322 | 323 | // The _handled method is fired to tell the default movestart 324 | // handler that one of the move events is bound. 325 | template._handled = handled; 326 | 327 | // Pass the touchmove event so it can be prevented if or when 328 | // movestart is handled. 329 | template._preventTouchmoveDefault = function() { 330 | e.preventDefault(); 331 | }; 332 | 333 | // Trigger the movestart event. 334 | trigger(template.target, template); 335 | 336 | // Unbind handlers that tracked the touch or mouse up till now. 337 | fn(template.identifier); 338 | } 339 | 340 | 341 | // Handlers that control what happens following a movestart 342 | 343 | function activeMousemove(e) { 344 | var event = e.data.event, 345 | timer = e.data.timer; 346 | 347 | updateEvent(event, e, e.timeStamp, timer); 348 | } 349 | 350 | function activeMouseend(e) { 351 | var event = e.data.event, 352 | timer = e.data.timer; 353 | 354 | removeActiveMouse(); 355 | 356 | endEvent(event, timer, function() { 357 | // Unbind the click suppressor, waiting until after mouseup 358 | // has been handled. 359 | setTimeout(function(){ 360 | remove(event.target, 'click', returnFalse); 361 | }, 0); 362 | }); 363 | } 364 | 365 | function removeActiveMouse(event) { 366 | remove(document, mouseevents.move, activeMousemove); 367 | remove(document, mouseevents.end, activeMouseend); 368 | } 369 | 370 | function activeTouchmove(e) { 371 | var event = e.data.event, 372 | timer = e.data.timer, 373 | touch = changedTouch(e, event); 374 | 375 | if (!touch) { return; } 376 | 377 | // Stop the interface from gesturing 378 | e.preventDefault(); 379 | 380 | event.targetTouches = e.targetTouches; 381 | updateEvent(event, touch, e.timeStamp, timer); 382 | } 383 | 384 | function activeTouchend(e) { 385 | var event = e.data.event, 386 | timer = e.data.timer, 387 | touch = identifiedTouch(e.changedTouches, event.identifier); 388 | 389 | // This isn't the touch you're looking for. 390 | if (!touch) { return; } 391 | 392 | removeActiveTouch(event); 393 | endEvent(event, timer); 394 | } 395 | 396 | function removeActiveTouch(event) { 397 | remove(document, '.' + event.identifier, activeTouchmove); 398 | remove(document, '.' + event.identifier, activeTouchend); 399 | } 400 | 401 | 402 | // Logic for triggering move and moveend events 403 | 404 | function updateEvent(event, touch, timeStamp, timer) { 405 | var time = timeStamp - event.timeStamp; 406 | 407 | event.type = 'move'; 408 | event.distX = touch.pageX - event.startX; 409 | event.distY = touch.pageY - event.startY; 410 | event.deltaX = touch.pageX - event.pageX; 411 | event.deltaY = touch.pageY - event.pageY; 412 | 413 | // Average the velocity of the last few events using a decay 414 | // curve to even out spurious jumps in values. 415 | event.velocityX = 0.3 * event.velocityX + 0.7 * event.deltaX / time; 416 | event.velocityY = 0.3 * event.velocityY + 0.7 * event.deltaY / time; 417 | event.pageX = touch.pageX; 418 | event.pageY = touch.pageY; 419 | 420 | timer.kick(); 421 | } 422 | 423 | function endEvent(event, timer, fn) { 424 | timer.end(function(){ 425 | event.type = 'moveend'; 426 | 427 | trigger(event.target, event); 428 | 429 | return fn && fn(); 430 | }); 431 | } 432 | 433 | 434 | // jQuery special event definition 435 | 436 | function setup(data, namespaces, eventHandle) { 437 | // Stop the node from being dragged 438 | //add(this, 'dragstart.move drag.move', preventDefault); 439 | 440 | // Prevent text selection and touch interface scrolling 441 | //add(this, 'mousedown.move', preventIgnoreTags); 442 | 443 | // Tell movestart default handler that we've handled this 444 | add(this, 'movestart.move', flagAsHandled); 445 | 446 | // Don't bind to the DOM. For speed. 447 | return true; 448 | } 449 | 450 | function teardown(namespaces) { 451 | remove(this, 'dragstart drag', preventDefault); 452 | remove(this, 'mousedown touchstart', preventIgnoreTags); 453 | remove(this, 'movestart', flagAsHandled); 454 | 455 | // Don't bind to the DOM. For speed. 456 | return true; 457 | } 458 | 459 | function addMethod(handleObj) { 460 | // We're not interested in preventing defaults for handlers that 461 | // come from internal move or moveend bindings 462 | if (handleObj.namespace === "move" || handleObj.namespace === "moveend") { 463 | return; 464 | } 465 | 466 | // Stop the node from being dragged 467 | add(this, 'dragstart.' + handleObj.guid + ' drag.' + handleObj.guid, preventDefault, undefined, handleObj.selector); 468 | 469 | // Prevent text selection and touch interface scrolling 470 | add(this, 'mousedown.' + handleObj.guid, preventIgnoreTags, undefined, handleObj.selector); 471 | } 472 | 473 | function removeMethod(handleObj) { 474 | if (handleObj.namespace === "move" || handleObj.namespace === "moveend") { 475 | return; 476 | } 477 | 478 | remove(this, 'dragstart.' + handleObj.guid + ' drag.' + handleObj.guid); 479 | remove(this, 'mousedown.' + handleObj.guid); 480 | } 481 | 482 | jQuery.event.special.movestart = { 483 | setup: setup, 484 | teardown: teardown, 485 | add: addMethod, 486 | remove: removeMethod, 487 | 488 | _default: function(e) { 489 | var template, data; 490 | 491 | // If no move events were bound to any ancestors of this 492 | // target, high tail it out of here. 493 | if (!e._handled()) { return; } 494 | 495 | template = { 496 | target: e.target, 497 | startX: e.startX, 498 | startY: e.startY, 499 | pageX: e.pageX, 500 | pageY: e.pageY, 501 | distX: e.distX, 502 | distY: e.distY, 503 | deltaX: e.deltaX, 504 | deltaY: e.deltaY, 505 | velocityX: e.velocityX, 506 | velocityY: e.velocityY, 507 | timeStamp: e.timeStamp, 508 | identifier: e.identifier, 509 | targetTouches: e.targetTouches, 510 | finger: e.finger 511 | }; 512 | 513 | data = { 514 | event: template, 515 | timer: new Timer(function(time){ 516 | trigger(e.target, template); 517 | }) 518 | }; 519 | 520 | if (e.identifier === undefined) { 521 | // We're dealing with a mouse 522 | // Stop clicks from propagating during a move 523 | add(e.target, 'click', returnFalse); 524 | add(document, mouseevents.move, activeMousemove, data); 525 | add(document, mouseevents.end, activeMouseend, data); 526 | } 527 | else { 528 | // We're dealing with a touch. Stop touchmove doing 529 | // anything defaulty. 530 | e._preventTouchmoveDefault(); 531 | add(document, touchevents.move + '.' + e.identifier, activeTouchmove, data); 532 | add(document, touchevents.end + '.' + e.identifier, activeTouchend, data); 533 | } 534 | } 535 | }; 536 | 537 | jQuery.event.special.move = { 538 | setup: function() { 539 | // Bind a noop to movestart. Why? It's the movestart 540 | // setup that decides whether other move events are fired. 541 | add(this, 'movestart.move', jQuery.noop); 542 | }, 543 | 544 | teardown: function() { 545 | remove(this, 'movestart.move', jQuery.noop); 546 | } 547 | }; 548 | 549 | jQuery.event.special.moveend = { 550 | setup: function() { 551 | // Bind a noop to movestart. Why? It's the movestart 552 | // setup that decides whether other move events are fired. 553 | add(this, 'movestart.moveend', jQuery.noop); 554 | }, 555 | 556 | teardown: function() { 557 | remove(this, 'movestart.moveend', jQuery.noop); 558 | } 559 | }; 560 | 561 | add(document, 'mousedown.move', mousedown); 562 | add(document, 'touchstart.move', touchstart); 563 | 564 | // Make jQuery copy touch event properties over to the jQuery event 565 | // object, if they are not already listed. But only do the ones we 566 | // really need. IE7/8 do not have Array#indexOf(), but nor do they 567 | // have touch events, so let's assume we can ignore them. 568 | if (typeof Array.prototype.indexOf === 'function') { 569 | (function(jQuery, undefined){ 570 | var props = ["changedTouches", "targetTouches"], 571 | l = props.length; 572 | 573 | while (l--) { 574 | if (jQuery.event.props.indexOf(props[l]) === -1) { 575 | jQuery.event.props.push(props[l]); 576 | } 577 | } 578 | })(jQuery); 579 | }; 580 | }); 581 | -------------------------------------------------------------------------------- /lib/jquery.event.swipe.js: -------------------------------------------------------------------------------- 1 | // jQuery.event.swipe 2 | // 0.5 3 | // Stephen Band 4 | 5 | // Dependencies 6 | // jQuery.event.move 1.2 7 | 8 | // One of swipeleft, swiperight, swipeup or swipedown is triggered on 9 | // moveend, when the move has covered a threshold ratio of the dimension 10 | // of the target node, or has gone really fast. Threshold and velocity 11 | // sensitivity changed with: 12 | // 13 | // jQuery.event.special.swipe.settings.threshold 14 | // jQuery.event.special.swipe.settings.sensitivity 15 | 16 | (function (module) { 17 | if (typeof define === 'function' && define.amd) { 18 | // AMD. Register as an anonymous module. 19 | define(['jquery'], module); 20 | } else { 21 | // Browser globals 22 | module(jQuery); 23 | } 24 | })(function(jQuery, undefined){ 25 | var add = jQuery.event.add, 26 | 27 | remove = jQuery.event.remove, 28 | 29 | // Just sugar, so we can have arguments in the same order as 30 | // add and remove. 31 | trigger = function(node, type, data) { 32 | jQuery.event.trigger(type, data, node); 33 | }, 34 | 35 | settings = { 36 | // Ratio of distance over target finger must travel to be 37 | // considered a swipe. 38 | threshold: 0.4, 39 | // Faster fingers can travel shorter distances to be considered 40 | // swipes. 'sensitivity' controls how much. Bigger is shorter. 41 | sensitivity: 6 42 | }; 43 | 44 | function moveend(e) { 45 | var w, h, event; 46 | 47 | w = e.target.offsetWidth; 48 | h = e.target.offsetHeight; 49 | 50 | // Copy over some useful properties from the move event 51 | event = { 52 | distX: e.distX, 53 | distY: e.distY, 54 | velocityX: e.velocityX, 55 | velocityY: e.velocityY, 56 | finger: e.finger 57 | }; 58 | 59 | // Find out which of the four directions was swiped 60 | if (e.distX > e.distY) { 61 | if (e.distX > -e.distY) { 62 | if (e.distX/w > settings.threshold || e.velocityX * e.distX/w * settings.sensitivity > 1) { 63 | event.type = 'swiperight'; 64 | trigger(e.currentTarget, event); 65 | } 66 | } 67 | else { 68 | if (-e.distY/h > settings.threshold || e.velocityY * e.distY/w * settings.sensitivity > 1) { 69 | event.type = 'swipeup'; 70 | trigger(e.currentTarget, event); 71 | } 72 | } 73 | } 74 | else { 75 | if (e.distX > -e.distY) { 76 | if (e.distY/h > settings.threshold || e.velocityY * e.distY/w * settings.sensitivity > 1) { 77 | event.type = 'swipedown'; 78 | trigger(e.currentTarget, event); 79 | } 80 | } 81 | else { 82 | if (-e.distX/w > settings.threshold || e.velocityX * e.distX/w * settings.sensitivity > 1) { 83 | event.type = 'swipeleft'; 84 | trigger(e.currentTarget, event); 85 | } 86 | } 87 | } 88 | } 89 | 90 | function getData(node) { 91 | var data = jQuery.data(node, 'event_swipe'); 92 | 93 | if (!data) { 94 | data = { count: 0 }; 95 | jQuery.data(node, 'event_swipe', data); 96 | } 97 | 98 | return data; 99 | } 100 | 101 | jQuery.event.special.swipe = 102 | jQuery.event.special.swipeleft = 103 | jQuery.event.special.swiperight = 104 | jQuery.event.special.swipeup = 105 | jQuery.event.special.swipedown = { 106 | setup: function( data, namespaces, eventHandle ) { 107 | var data = getData(this); 108 | 109 | // If another swipe event is already setup, don't setup again. 110 | if (data.count++ > 0) { return; } 111 | 112 | add(this, 'moveend', moveend); 113 | 114 | return true; 115 | }, 116 | 117 | teardown: function() { 118 | var data = getData(this); 119 | 120 | // If another swipe event is still setup, don't teardown. 121 | if (--data.count > 0) { return; } 122 | 123 | remove(this, 'moveend', moveend); 124 | 125 | return true; 126 | }, 127 | 128 | settings: settings 129 | }; 130 | }); -------------------------------------------------------------------------------- /lib/translate.js: -------------------------------------------------------------------------------- 1 | (function() { 2 | 3 | var translate = function(text) 4 | { 5 | var xlate = translateLookup(text); 6 | 7 | if (typeof xlate == "function") 8 | { 9 | xlate = xlate.apply(this, arguments); 10 | } 11 | else if (arguments.length > 1) 12 | { 13 | var aps = Array.prototype.slice; 14 | var args = aps.call( arguments, 1 ); 15 | 16 | xlate = formatter(xlate, args); 17 | } 18 | 19 | return xlate; 20 | }; 21 | 22 | // I want it available explicity as well as via the object 23 | translate.translate = translate; 24 | 25 | //from https://gist.github.com/776196 via http://davedash.com/2010/11/19/pythonic-string-formatting-in-javascript/ 26 | var defaultFormatter = (function() { 27 | var re = /\{([^}]+)\}/g; 28 | return function(s, args) { 29 | return s.replace(re, function(_, match){ return args[match]; }); 30 | }; 31 | }()); 32 | var formatter = defaultFormatter; 33 | translate.setFormatter = function(newFormatter) 34 | { 35 | formatter = newFormatter; 36 | }; 37 | 38 | translate.format = function() 39 | { 40 | var aps = Array.prototype.slice; 41 | var s = arguments[0]; 42 | var args = aps.call( arguments, 1 ); 43 | 44 | return formatter(s, args); 45 | }; 46 | 47 | var dynoTrans = null; 48 | translate.setDynamicTranslator = function(newDynoTrans) 49 | { 50 | dynoTrans = newDynoTrans; 51 | }; 52 | 53 | var translation = null; 54 | translate.setTranslation = function(newTranslation) 55 | { 56 | translation = newTranslation; 57 | }; 58 | 59 | function translateLookup(target) 60 | { 61 | if (translation == null || target == null) 62 | { 63 | return target; 64 | } 65 | 66 | if (target in translation == false) 67 | { 68 | if (dynoTrans != null) 69 | { 70 | return dynoTrans(target); 71 | } 72 | return target; 73 | } 74 | 75 | var result = translation[target]; 76 | if (result == null) 77 | { 78 | return target; 79 | } 80 | 81 | return result; 82 | }; 83 | 84 | window._ = translate; 85 | 86 | })(); 87 | -------------------------------------------------------------------------------- /mobileWarning.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | A Dark Room 5 | 20 | 21 | 22 |
23 | 24 |
25 | 26 | A Dark Room isn't really mobile-friendly, and it requires arrow keys.
27 | Sorry about that!
28 |

29 | Of course you can play anyway, but it probably won't work!

30 | A Dark Room is now native on iOS! Get it on the App Store. 31 |
32 |
33 | 34 | 35 | -------------------------------------------------------------------------------- /script/Button.js: -------------------------------------------------------------------------------- 1 | var Button = { 2 | Button: function(options) { 3 | if(typeof options.cooldown == 'number') { 4 | this.data_cooldown = options.cooldown; 5 | } 6 | this.data_remaining = 0; 7 | if(typeof options.click == 'function') { 8 | this.data_handler = options.click; 9 | } 10 | 11 | var el = $('
') 12 | .attr('id', typeof(options.id) != 'undefined' ? options.id : "BTN_" + Engine.getGuid()) 13 | .addClass('button') 14 | .text(typeof(options.text) != 'undefined' ? options.text : "button") 15 | .click(function() { 16 | if(!$(this).hasClass('disabled')) { 17 | Button.cooldown($(this)); 18 | $(this).data("handler")($(this)); 19 | } 20 | }) 21 | .data("handler", typeof options.click == 'function' ? options.click : function() { Engine.log("click"); }) 22 | .data("remaining", 0) 23 | .data("cooldown", typeof options.cooldown == 'number' ? options.cooldown : 0); 24 | 25 | el.append($("
").addClass('cooldown')); 26 | 27 | if(options.cost) { 28 | var ttPos = options.ttPos ? options.ttPos : "bottom right"; 29 | var costTooltip = $('
').addClass('tooltip ' + ttPos); 30 | for(var k in options.cost) { 31 | $("
").addClass('row_key').text(_(k)).appendTo(costTooltip); 32 | $("
").addClass('row_val').text(options.cost[k]).appendTo(costTooltip); 33 | } 34 | if(costTooltip.children().length > 0) { 35 | costTooltip.appendTo(el); 36 | } 37 | } 38 | 39 | if(options.width) { 40 | el.css('width', options.width); 41 | } 42 | 43 | return el; 44 | }, 45 | 46 | setDisabled: function(btn, disabled) { 47 | if(btn) { 48 | if(!disabled && !btn.data('onCooldown')) { 49 | btn.removeClass('disabled'); 50 | } else if(disabled) { 51 | btn.addClass('disabled'); 52 | } 53 | btn.data('disabled', disabled); 54 | } 55 | }, 56 | 57 | isDisabled: function(btn) { 58 | if(btn) { 59 | return btn.data('disabled') === true; 60 | } 61 | return false; 62 | }, 63 | 64 | cooldown: function(btn) { 65 | var cd = btn.data("cooldown"); 66 | if(cd > 0) { 67 | $('div.cooldown', btn).stop(true, true).width("100%").animate({width: '0%'}, cd * 1000, 'linear', function() { 68 | var b = $(this).closest('.button'); 69 | b.data('onCooldown', false); 70 | if(!b.data('disabled')) { 71 | b.removeClass('disabled'); 72 | } 73 | }); 74 | btn.addClass('disabled'); 75 | btn.data('onCooldown', true); 76 | } 77 | }, 78 | 79 | clearCooldown: function(btn) { 80 | $('div.cooldown', btn).stop(true, true); 81 | btn.data('onCooldown', false); 82 | if(!btn.data('disabled')) { 83 | btn.removeClass('disabled'); 84 | } 85 | } 86 | }; -------------------------------------------------------------------------------- /script/events/encounters.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Events that can occur when wandering around the world 3 | **/ 4 | Events.Encounters = [ 5 | /* Tier 1 */ 6 | { /* Snarling Beast */ 7 | title: _('A Snarling Beast'), 8 | isAvailable: function() { 9 | return World.getDistance() <= 10 && World.getTerrain() == World.TILE.FOREST; 10 | }, 11 | scenes: { 12 | 'start': { 13 | combat: true, 14 | enemy: 'snarling beast', 15 | enemyName: _('snarling beast'), 16 | deathMessage: _('the snarling beast is dead'), 17 | chara: 'B', 18 | damage: 1, 19 | hit: 0.8, 20 | attackDelay: 1, 21 | health: 5, 22 | loot: { 23 | 'fur': { 24 | min: 1, 25 | max: 3, 26 | chance: 1 27 | }, 28 | 'meat': { 29 | min: 1, 30 | max: 3, 31 | chance: 1 32 | }, 33 | 'teeth': { 34 | min: 1, 35 | max: 3, 36 | chance: 0.8 37 | } 38 | }, 39 | notification: _('a snarling beast leaps out of the underbrush') 40 | } 41 | } 42 | }, 43 | { /* Gaunt Man */ 44 | title: _('A Gaunt Man'), 45 | isAvailable: function() { 46 | return World.getDistance() <= 10 && World.getTerrain() == World.TILE.BARRENS; 47 | }, 48 | scenes: { 49 | 'start': { 50 | combat: true, 51 | enemy: 'gaunt man', 52 | enemyName: _('gaunt man'), 53 | deathMessage: _('the gaunt man is dead'), 54 | chara: 'G', 55 | damage: 2, 56 | hit: 0.8, 57 | attackDelay: 2, 58 | health: 6, 59 | loot: { 60 | 'cloth': { 61 | min: 1, 62 | max: 3, 63 | chance: 0.8 64 | }, 65 | 'teeth': { 66 | min: 1, 67 | max: 2, 68 | chance: 0.8 69 | }, 70 | 'leather': { 71 | min: 1, 72 | max: 2, 73 | chance: 0.5 74 | } 75 | }, 76 | notification: _('a gaunt man approaches, a crazed look in his eye') 77 | } 78 | } 79 | }, 80 | { /* Strange Bird */ 81 | title: _('A Strange Bird'), 82 | isAvailable: function() { 83 | return World.getDistance() <= 10 && World.getTerrain() == World.TILE.FIELD; 84 | }, 85 | scenes: { 86 | 'start': { 87 | combat: true, 88 | enemy: 'strange bird', 89 | enemyName: _('strange bird'), 90 | deathMessage: _('the strange bird is dead'), 91 | chara: 'B', 92 | damage: 3, 93 | hit: 0.8, 94 | attackDelay: 2, 95 | health: 4, 96 | loot: { 97 | 'scales': { 98 | min: 1, 99 | max: 3, 100 | chance: 0.8 101 | }, 102 | 'teeth': { 103 | min: 1, 104 | max: 2, 105 | chance: 0.5 106 | }, 107 | 'meat': { 108 | min: 1, 109 | max: 3, 110 | chance: 0.8 111 | } 112 | }, 113 | notification: _('a strange looking bird speeds across the plains') 114 | } 115 | } 116 | }, 117 | /* Tier 2*/ 118 | { /* Shivering Man */ 119 | title: _('A Shivering Man'), 120 | isAvailable: function() { 121 | return World.getDistance() > 10 && World.getDistance() <= 20 && World.getTerrain() == World.TILE.BARRENS; 122 | }, 123 | scenes: { 124 | 'start': { 125 | combat: true, 126 | enemy: 'shivering man', 127 | enemyName: _('shivering man'), 128 | deathMessage: _('the shivering man is dead'), 129 | chara: 'S', 130 | damage: 5, 131 | hit: 0.5, 132 | attackDelay: 1, 133 | health: 20, 134 | loot: { 135 | 'cloth': { 136 | min: 1, 137 | max: 1, 138 | chance: 0.2 139 | }, 140 | 'teeth': { 141 | min: 1, 142 | max: 2, 143 | chance: 0.8 144 | }, 145 | 'leather': { 146 | min: 1, 147 | max: 1, 148 | chance: 0.2 149 | }, 150 | 'medicine': { 151 | min: 1, 152 | max: 3, 153 | chance: 0.7 154 | } 155 | }, 156 | notification: _('a shivering man approaches and attacks with surprising strength') 157 | } 158 | } 159 | }, 160 | { /* Man-eater */ 161 | title: _('A Man-Eater'), 162 | isAvailable: function() { 163 | return World.getDistance() > 10 && World.getDistance() <= 20 && World.getTerrain() == World.TILE.FOREST; 164 | }, 165 | scenes: { 166 | 'start': { 167 | combat: true, 168 | enemy: 'man-eater', 169 | enemyName: _('man-eater'), 170 | deathMessage: _('the man-eater is dead'), 171 | chara: 'E', 172 | damage: 3, 173 | hit: 0.8, 174 | attackDelay: 1, 175 | health: 25, 176 | loot: { 177 | 'fur': { 178 | min: 5, 179 | max: 10, 180 | chance: 1 181 | }, 182 | 'meat': { 183 | min: 5, 184 | max: 10, 185 | chance: 1 186 | }, 187 | 'teeth': { 188 | min: 5, 189 | max: 10, 190 | chance: 0.8 191 | } 192 | }, 193 | notification: _('a large creature attacks, claws freshly bloodied') 194 | } 195 | } 196 | }, 197 | { /* Scavenger */ 198 | title: _('A Scavenger'), 199 | isAvailable: function() { 200 | return World.getDistance() > 10 && World.getDistance() <= 20 && World.getTerrain() == World.TILE.BARRENS; 201 | }, 202 | scenes: { 203 | 'start': { 204 | combat: true, 205 | enemy: 'scavenger', 206 | enemyName: _('scavenger'), 207 | deathMessage: _('the scavenger is dead'), 208 | chara: 'S', 209 | damage: 4, 210 | hit: 0.8, 211 | attackDelay: 2, 212 | health: 30, 213 | loot: { 214 | 'cloth': { 215 | min: 5, 216 | max: 10, 217 | chance: 0.8 218 | }, 219 | 'leather': { 220 | min: 5, 221 | max: 10, 222 | chance: 0.8 223 | }, 224 | 'iron': { 225 | min: 1, 226 | max: 5, 227 | chance: 0.5 228 | }, 229 | 'medicine': { 230 | min: 1, 231 | max: 2, 232 | chance: 0.1 233 | } 234 | }, 235 | notification: _('a scavenger draws close, hoping for an easy score') 236 | } 237 | } 238 | }, 239 | { /* Huge Lizard */ 240 | title: _('A Huge Lizard'), 241 | isAvailable: function() { 242 | return World.getDistance() > 10 && World.getDistance() <= 20 && World.getTerrain() == World.TILE.FIELD; 243 | }, 244 | scenes: { 245 | 'start': { 246 | combat: true, 247 | enemy: 'lizard', 248 | enemyName: _('lizard'), 249 | deathMessage: _('the lizard is dead'), 250 | chara: 'L', 251 | damage: 5, 252 | hit: 0.8, 253 | attackDelay: 2, 254 | health: 20, 255 | loot: { 256 | 'scales': { 257 | min: 5, 258 | max: 10, 259 | chance: 0.8 260 | }, 261 | 'teeth': { 262 | min: 5, 263 | max: 10, 264 | chance: 0.5 265 | }, 266 | 'meat': { 267 | min: 5, 268 | max: 10, 269 | chance: 0.8 270 | } 271 | }, 272 | notification: _('the grass thrashes wildly as a huge lizard pushes through') 273 | } 274 | } 275 | }, 276 | /* Tier 3*/ 277 | { /* Feral Terror */ 278 | title: _('A Feral Terror'), 279 | isAvailable: function() { 280 | return World.getDistance() > 20 && World.getTerrain() == World.TILE.FOREST; 281 | }, 282 | scenes: { 283 | 'start': { 284 | combat: true, 285 | enemy: 'feral terror', 286 | enemyName: _('feral terror'), 287 | deathMessage: _('the feral terror is dead'), 288 | chara: 'F', 289 | damage: 6, 290 | hit: 0.8, 291 | attackDelay: 1, 292 | health: 45, 293 | loot: { 294 | 'fur': { 295 | min: 5, 296 | max: 10, 297 | chance: 1 298 | }, 299 | 'meat': { 300 | min: 5, 301 | max: 10, 302 | chance: 1 303 | }, 304 | 'teeth': { 305 | min: 5, 306 | max: 10, 307 | chance: 0.8 308 | } 309 | }, 310 | notification: _('a beast, wilder than imagining, erupts out of the foliage') 311 | } 312 | } 313 | }, 314 | { /* Soldier */ 315 | title: _('A Soldier'), 316 | isAvailable: function() { 317 | return World.getDistance() > 20 && World.getTerrain() == World.TILE.BARRENS; 318 | }, 319 | scenes: { 320 | 'start': { 321 | combat: true, 322 | enemy: 'soldier', 323 | enemyName: _('soldier'), 324 | deathMessage: _('the soldier is dead'), 325 | ranged: true, 326 | chara: 'D', 327 | damage: 8, 328 | hit: 0.8, 329 | attackDelay: 2, 330 | health: 50, 331 | loot: { 332 | 'cloth': { 333 | min: 5, 334 | max: 10, 335 | chance: 0.8 336 | }, 337 | 'bullets': { 338 | min: 1, 339 | max: 5, 340 | chance: 0.5 341 | }, 342 | 'rifle': { 343 | min: 1, 344 | max: 1, 345 | chance: 0.2 346 | }, 347 | 'medicine': { 348 | min: 1, 349 | max: 2, 350 | chance: 0.1 351 | } 352 | }, 353 | notification: _('a soldier opens fire from across the desert') 354 | } 355 | } 356 | }, 357 | { /* Sniper */ 358 | title: _('A Sniper'), 359 | isAvailable: function() { 360 | return World.getDistance() > 20 && World.getTerrain() == World.TILE.FIELD; 361 | }, 362 | scenes: { 363 | 'start': { 364 | combat: true, 365 | enemy: 'sniper', 366 | enemyName: _('sniper'), 367 | deathMessage: _('the sniper is dead'), 368 | chara: 'S', 369 | damage: 15, 370 | hit: 0.8, 371 | attackDelay: 4, 372 | health: 30, 373 | ranged: true, 374 | loot: { 375 | 'cloth': { 376 | min: 5, 377 | max: 10, 378 | chance: 0.8 379 | }, 380 | 'bullets': { 381 | min: 1, 382 | max: 5, 383 | chance: 0.5 384 | }, 385 | 'rifle': { 386 | min: 1, 387 | max: 1, 388 | chance: 0.2 389 | }, 390 | 'medicine': { 391 | min: 1, 392 | max: 2, 393 | chance: 0.1 394 | } 395 | }, 396 | notification: _('a shot rings out, from somewhere in the long grass') 397 | } 398 | } 399 | } 400 | ]; 401 | -------------------------------------------------------------------------------- /script/events/global.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Events that can occur when any module is active (Except World. It's special.) 3 | **/ 4 | Events.Global = [ 5 | { /* The Thief */ 6 | title: _('The Thief'), 7 | isAvailable: function() { 8 | return (Engine.activeModule == Room || Engine.activeModule == Outside) && $SM.get('game.thieves') == 1; 9 | }, 10 | scenes: { 11 | 'start': { 12 | text: [ 13 | _('the villagers haul a filthy man out of the store room.'), 14 | _("say his folk have been skimming the supplies."), 15 | _('say he should be strung up as an example.') 16 | ], 17 | notification: _('a thief is caught'), 18 | buttons: { 19 | 'kill': { 20 | text: _('hang him'), 21 | nextScene: {1: 'hang'} 22 | }, 23 | 'spare': { 24 | text: _('spare him'), 25 | nextScene: {1: 'spare'} 26 | } 27 | } 28 | }, 29 | 'hang': { 30 | text: [ 31 | _('the villagers hang the thief high in front of the store room.'), 32 | _('the point is made. in the next few days, the missing supplies are returned.') 33 | ], 34 | onLoad: function() { 35 | $SM.set('game.thieves', 2); 36 | $SM.remove('income.thieves'); 37 | $SM.addM('stores', $SM.get('game.stolen')); 38 | }, 39 | buttons: { 40 | 'leave': { 41 | text: _('leave'), 42 | nextScene: 'end' 43 | } 44 | } 45 | }, 46 | 'spare': { 47 | text: [ 48 | _("the man says he's grateful. says he won't come around any more."), 49 | _("shares what he knows about sneaking before he goes.") 50 | ], 51 | onLoad: function() { 52 | $SM.set('game.thieves', 2); 53 | $SM.remove('income.thieves'); 54 | $SM.addPerk('stealthy'); 55 | }, 56 | buttons: { 57 | 'leave': { 58 | text: _('leave'), 59 | nextScene: 'end' 60 | } 61 | } 62 | } 63 | } 64 | } 65 | ]; -------------------------------------------------------------------------------- /script/events/outside.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Events that can occur when the Outside module is active 3 | **/ 4 | Events.Outside = [ 5 | { /* Ruined traps */ 6 | title: _('A Ruined Trap'), 7 | isAvailable: function() { 8 | return Engine.activeModule == Outside && $SM.get('game.buildings["trap"]', true) > 0; 9 | }, 10 | scenes: { 11 | 'start': { 12 | text: [ 13 | _('some of the traps have been torn apart.'), 14 | _('large prints lead away, into the forest.') 15 | ], 16 | onLoad: function() { 17 | var numWrecked = Math.floor(Math.random() * $SM.get('game.buildings["trap"]', true)) + 1; 18 | $SM.add('game.buildings["trap"]', -numWrecked); 19 | Outside.updateVillage(); 20 | Outside.updateTrapButton(); 21 | }, 22 | notification: _('some traps have been destroyed'), 23 | buttons: { 24 | 'track': { 25 | text: _('track them'), 26 | nextScene: {0.5: 'nothing', 1: 'catch'} 27 | }, 28 | 'ignore': { 29 | text: _('ignore them'), 30 | nextScene: 'end' 31 | } 32 | } 33 | }, 34 | 'nothing': { 35 | text: [ 36 | _('the tracks disappear after just a few minutes.'), 37 | _('the forest is silent.') 38 | ], 39 | buttons: { 40 | 'end': { 41 | text: _('go home'), 42 | nextScene: 'end' 43 | } 44 | } 45 | }, 46 | 'catch': { 47 | text: [ 48 | _('not far from the village lies a large beast, its fur matted with blood.'), 49 | _('it puts up little resistance before the knife.') 50 | ], 51 | reward: { 52 | fur: 100, 53 | meat: 100, 54 | teeth: 10 55 | }, 56 | buttons: { 57 | 'end': { 58 | text: _('go home'), 59 | nextScene: 'end' 60 | } 61 | } 62 | } 63 | } 64 | }, 65 | 66 | { /* Sickness */ 67 | title: _('Sickness'), 68 | isAvailable: function() { 69 | return Engine.activeModule == Outside && 70 | $SM.get('game.population', true) > 10 && 71 | $SM.get('game.population', true) < 50 && 72 | $SM.get('stores.medicine', true) > 0; 73 | }, 74 | scenes: { 75 | 'start': { 76 | text: [ 77 | _('a sickness is spreading through the village.'), 78 | _('medicine is needed immediately.') 79 | ], 80 | buttons: { 81 | 'heal': { 82 | text: _('1 medicine'), 83 | cost: { 'medicine' : 1 }, 84 | nextScene: {1: 'healed'} 85 | }, 86 | 'ignore': { 87 | text: _('ignore it'), 88 | nextScene: {1: 'death'} 89 | } 90 | } 91 | }, 92 | 'healed': { 93 | text: [ 94 | _('the sickness is cured in time.') 95 | ], 96 | buttons: { 97 | 'end': { 98 | text: _('go home'), 99 | nextScene: 'end' 100 | } 101 | } 102 | }, 103 | 'death': { 104 | text: [ 105 | _('the sickness spreads through the village.'), 106 | _('the days are spent with burials.'), 107 | _('the nights are rent with screams.') 108 | ], 109 | onLoad: function() { 110 | var numKilled = Math.floor(Math.random() * 20) + 1; 111 | Outside.killVillagers(numKilled); 112 | }, 113 | buttons: { 114 | 'end': { 115 | text: _('go home'), 116 | nextScene: 'end' 117 | } 118 | } 119 | } 120 | } 121 | }, 122 | 123 | { /* Plague */ 124 | title: _('Plague'), 125 | isAvailable: function() { 126 | return Engine.activeModule == Outside && $SM.get('game.population', true) > 50 && $SM.get('stores.medicine', true) > 0; 127 | }, 128 | scenes: { 129 | 'start': { 130 | text: [ 131 | _('a terrible plague is fast spreading through the village.'), 132 | _('medicine is needed immediately.') 133 | ], 134 | buttons: { 135 | 'heal': { 136 | text: _('5 medicine'), 137 | cost: { 'medicine' : 5 }, 138 | nextScene: {1: 'healed'} 139 | }, 140 | 'ignore': { 141 | text: _('do nothing'), 142 | nextScene: {1: 'death'} 143 | } 144 | } 145 | }, 146 | 'healed': { 147 | text: [ 148 | _('the plague is kept from spreading.'), 149 | _('only a few die.'), 150 | _('the rest bury them.') 151 | ], 152 | onLoad: function() { 153 | var numKilled = Math.floor(Math.random() * 5) + 2; 154 | Outside.killVillagers(numKilled); 155 | }, 156 | buttons: { 157 | 'end': { 158 | text: _('go home'), 159 | nextScene: 'end' 160 | } 161 | } 162 | }, 163 | 'death': { 164 | text: [ 165 | _('the plague rips through the village.'), 166 | _('the nights are rent with screams.'), 167 | _('the only hope is a quick death.') 168 | ], 169 | onLoad: function() { 170 | var numKilled = Math.floor(Math.random() * 80) + 10; 171 | Outside.killVillagers(numKilled); 172 | }, 173 | buttons: { 174 | 'end': { 175 | text: _('go home'), 176 | nextScene: 'end' 177 | } 178 | } 179 | } 180 | } 181 | }, 182 | 183 | { /* Beast attack */ 184 | title: _('A Beast Attack'), 185 | isAvailable: function() { 186 | return Engine.activeModule == Outside && $SM.get('game.population', true) > 0; 187 | }, 188 | scenes: { 189 | 'start': { 190 | text: [ 191 | _('a pack of snarling beasts pours out of the trees.'), 192 | _('the fight is short and bloody, but the beasts are repelled.'), 193 | _('the villagers retreat to mourn the dead.') 194 | ], 195 | onLoad: function() { 196 | var numKilled = Math.floor(Math.random() * 10) + 1; 197 | Outside.killVillagers(numKilled); 198 | }, 199 | reward: { 200 | fur: 100, 201 | meat: 100, 202 | teeth: 10 203 | }, 204 | buttons: { 205 | 'end': { 206 | text: _('go home'), 207 | nextScene: 'end' 208 | } 209 | } 210 | } 211 | } 212 | }, 213 | 214 | { /* Soldier attack */ 215 | title: _('A Military Raid'), 216 | isAvailable: function() { 217 | return Engine.activeModule == Outside && $SM.get('game.population', true) > 0 && $SM.get('game.cityCleared');; 218 | }, 219 | scenes: { 220 | 'start': { 221 | text: [ 222 | _('a gunshot rings through the trees.'), 223 | _('well armed men charge out of the forest, firing into the crowd.'), 224 | _('after a skirmish they are driven away, but not without losses.') 225 | ], 226 | onLoad: function() { 227 | var numKilled = Math.floor(Math.random() * 40) + 1; 228 | Outside.killVillagers(numKilled); 229 | }, 230 | reward: { 231 | bullets: 10, 232 | 'cured meat': 50 233 | }, 234 | buttons: { 235 | 'end': { 236 | text: _('go home'), 237 | nextScene: 'end' 238 | } 239 | } 240 | } 241 | } 242 | } 243 | ]; 244 | -------------------------------------------------------------------------------- /script/events/room.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Events that can occur when the Room module is active 3 | **/ 4 | Events.Room = [ 5 | { /* The Nomad -- Merchant */ 6 | title: _('The Nomad'), 7 | isAvailable: function() { 8 | return Engine.activeModule == Room && $SM.get('stores.fur', true) > 0; 9 | }, 10 | scenes: { 11 | 'start': { 12 | text: [ 13 | _('a nomad shuffles into view, laden with makeshift bags bound with rough twine.'), 14 | _("won't say from where he came, but it's clear that he's not staying.") 15 | ], 16 | notification: _('a nomad arrives, looking to trade'), 17 | buttons: { 18 | 'buyScales': { 19 | text: _('buy scales'), 20 | cost: { 'fur': 100 }, 21 | reward: { 'scales': 1 } 22 | }, 23 | 'buyTeeth': { 24 | text: _('buy teeth'), 25 | cost: { 'fur': 200 }, 26 | reward: { 'teeth': 1 } 27 | }, 28 | 'buyBait': { 29 | text: _('buy bait'), 30 | cost: { 'fur': 5 }, 31 | reward: { 'bait': 1 }, 32 | notification: _('traps are more effective with bait.') 33 | }, 34 | 'buyCompass': { 35 | available: function() { 36 | return $SM.get('stores.compass', true) < 1; 37 | }, 38 | text: _('buy compass'), 39 | cost: { fur: 300, scales: 15, teeth: 5 }, 40 | reward: { 'compass': 1 }, 41 | notification: _('the old compass is dented and dusty, but it looks to work.'), 42 | onChoose: Path.openPath 43 | }, 44 | 'goodbye': { 45 | text: _('say goodbye'), 46 | nextScene: 'end' 47 | } 48 | } 49 | } 50 | } 51 | }, { /* Noises Outside -- gain wood/fur */ 52 | title: _('Noises'), 53 | isAvailable: function() { 54 | return Engine.activeModule == Room && $SM.get('stores.wood'); 55 | }, 56 | scenes: { 57 | 'start': { 58 | text: [ 59 | _('through the walls, shuffling noises can be heard.'), 60 | _("can't tell what they're up to.") 61 | ], 62 | notification: _('strange noises can be heard through the walls'), 63 | buttons: { 64 | 'investigate': { 65 | text: _('investigate'), 66 | nextScene: { 0.3: 'stuff', 1: 'nothing' } 67 | }, 68 | 'ignore': { 69 | text: _('ignore them'), 70 | nextScene: 'end' 71 | } 72 | } 73 | }, 74 | 'nothing': { 75 | text: [ 76 | _('vague shapes move, just out of sight.'), 77 | _('the sounds stop.') 78 | ], 79 | buttons: { 80 | 'backinside': { 81 | text: _('go back inside'), 82 | nextScene: 'end' 83 | } 84 | } 85 | }, 86 | 'stuff': { 87 | reward: { wood: 100, fur: 10 }, 88 | text: [ 89 | _('a bundle of sticks lies just beyond the threshold, wrapped in coarse furs.'), 90 | _('the night is silent.') 91 | ], 92 | buttons: { 93 | 'backinside': { 94 | text: _('go back inside'), 95 | nextScene: 'end' 96 | } 97 | } 98 | } 99 | } 100 | }, 101 | { /* Noises Inside -- trade wood for better good */ 102 | title: _('Noises'), 103 | isAvailable: function() { 104 | return Engine.activeModule == Room && $SM.get('stores.wood'); 105 | }, 106 | scenes: { 107 | start: { 108 | text: [ 109 | _('scratching noises can be heard from the store room.'), 110 | _('something\'s in there.') 111 | ], 112 | notification: _('something\'s in the store room'), 113 | buttons: { 114 | 'investigate': { 115 | text: _('investigate'), 116 | nextScene: { 0.5: 'scales', 0.8: 'teeth', 1: 'cloth' } 117 | }, 118 | 'ignore': { 119 | text: _('ignore them'), 120 | nextScene: 'end' 121 | } 122 | } 123 | }, 124 | scales: { 125 | text: [ 126 | _('some wood is missing.'), 127 | _('the ground is littered with small scales') 128 | ], 129 | onLoad: function() { 130 | var numWood = $SM.get('stores.wood', true); 131 | numWood = Math.floor(numWood * 0.1); 132 | if(numWood == 0) numWood = 1; 133 | var numScales = Math.floor(numWood / 5); 134 | if(numScales == 0) numScales = 1; 135 | $SM.addM('stores', {'wood': -numWood, 'scales': numScales}); 136 | }, 137 | buttons: { 138 | 'leave': { 139 | text: _('leave'), 140 | nextScene: 'end' 141 | } 142 | } 143 | }, 144 | teeth: { 145 | text: [ 146 | _('some wood is missing.'), 147 | _('the ground is littered with small teeth') 148 | ], 149 | onLoad: function() { 150 | var numWood = $SM.get('stores.wood', true); 151 | numWood = Math.floor(numWood * 0.1); 152 | if(numWood == 0) numWood = 1; 153 | var numTeeth = Math.floor(numWood / 5); 154 | if(numTeeth == 0) numTeeth = 1; 155 | $SM.addM('stores', {'wood': -numWood, 'teeth': numTeeth}); 156 | }, 157 | buttons: { 158 | 'leave': { 159 | text: _('leave'), 160 | nextScene: 'end' 161 | } 162 | } 163 | }, 164 | cloth: { 165 | text: [ 166 | _('some wood is missing.'), 167 | _('the ground is littered with scraps of cloth') 168 | ], 169 | onLoad: function() { 170 | var numWood = $SM.get('stores.wood', true); 171 | numWood = Math.floor(numWood * 0.1); 172 | if(numWood == 0) numWood = 1; 173 | var numCloth = Math.floor(numWood / 5); 174 | if(numCloth == 0) numCloth = 1; 175 | $SM.addM('stores', {'wood': -numWood, 'cloth': numCloth}); 176 | }, 177 | buttons: { 178 | 'leave': { 179 | text: _('leave'), 180 | nextScene: 'end' 181 | } 182 | } 183 | } 184 | } 185 | }, 186 | { /* The Beggar -- trade fur for better good */ 187 | title: _('The Beggar'), 188 | isAvailable: function() { 189 | return Engine.activeModule == Room && $SM.get('stores.fur'); 190 | }, 191 | scenes: { 192 | start: { 193 | text: [ 194 | _('a beggar arrives.'), 195 | _('asks for any spare furs to keep him warm at night.') 196 | ], 197 | notification: _('a beggar arrives'), 198 | buttons: { 199 | '50furs': { 200 | text: _('give 50'), 201 | cost: {fur: 50}, 202 | nextScene: { 0.5: 'scales', 0.8: 'teeth', 1: 'cloth' } 203 | }, 204 | '100furs': { 205 | text: _('give 100'), 206 | cost: {fur: 100}, 207 | nextScene: { 0.5: 'teeth', 0.8: 'scales', 1: 'cloth' } 208 | }, 209 | 'deny': { 210 | text: _('turn him away'), 211 | nextScene: 'end' 212 | } 213 | } 214 | }, 215 | scales: { 216 | reward: { scales: 20 }, 217 | text: [ 218 | _('the beggar expresses his thanks.'), 219 | _('leaves a pile of small scales behind.') 220 | ], 221 | buttons: { 222 | 'leave': { 223 | text: _('say goodbye'), 224 | nextScene: 'end' 225 | } 226 | } 227 | }, 228 | teeth: { 229 | reward: { teeth: 20 }, 230 | text: [ 231 | _('the beggar expresses his thanks.'), 232 | _('leaves a pile of small teeth behind.') 233 | ], 234 | buttons: { 235 | 'leave': { 236 | text: _('say goodbye'), 237 | nextScene: 'end' 238 | } 239 | } 240 | }, 241 | cloth: { 242 | reward: { cloth: 20 }, 243 | text: [ 244 | _('the beggar expresses his thanks.'), 245 | _('leaves some scraps of cloth behind.') 246 | ], 247 | buttons: { 248 | 'leave': { 249 | text: _('say goodbye'), 250 | nextScene: 'end' 251 | } 252 | } 253 | } 254 | } 255 | }, 256 | 257 | { /* Mysterious Wanderer -- wood gambling */ 258 | title: _('The Mysterious Wanderer'), 259 | isAvailable: function() { 260 | return Engine.activeModule == Room && $SM.get('stores.wood'); 261 | }, 262 | scenes: { 263 | start: { 264 | text: [ 265 | _('a wanderer arrives with an empty cart. says if he leaves with wood, he\'ll be back with more.'), 266 | _("builder's not sure he's to be trusted.") 267 | ], 268 | notification: _('a mysterious wanderer arrives'), 269 | buttons: { 270 | '100wood': { 271 | text: _('give 100'), 272 | cost: {wood: 100}, 273 | nextScene: { 1: '100wood'} 274 | }, 275 | '500wood': { 276 | text: _('give 500'), 277 | cost: {wood: 500}, 278 | nextScene: { 1: '500wood' } 279 | }, 280 | 'deny': { 281 | text: _('turn him away'), 282 | nextScene: 'end' 283 | } 284 | } 285 | }, 286 | '100wood': { 287 | text: [ 288 | _('the wanderer leaves, cart loaded with wood') 289 | ], 290 | onLoad: function() { 291 | if(Math.random() < 0.5) { 292 | setTimeout(function() { 293 | $SM.add('stores.wood', 300); 294 | Notifications.notify(Room, _('the mysterious wanderer returns, cart piled high with wood.')); 295 | }, 60 * 1000); 296 | } 297 | }, 298 | buttons: { 299 | 'leave': { 300 | text: _('say goodbye'), 301 | nextScene: 'end' 302 | } 303 | } 304 | }, 305 | '500wood': { 306 | text: [ 307 | _('the wanderer leaves, cart loaded with wood') 308 | ], 309 | onLoad: function() { 310 | if(Math.random() < 0.3) { 311 | setTimeout(function() { 312 | $SM.add('stores.wood', 1500); 313 | Notifications.notify(Room, _('the mysterious wanderer returns, cart piled high with wood.')); 314 | }, 60 * 1000); 315 | } 316 | }, 317 | buttons: { 318 | 'leave': { 319 | text: _('say goodbye'), 320 | nextScene: 'end' 321 | } 322 | } 323 | } 324 | } 325 | }, 326 | 327 | { /* Mysterious Wanderer -- fur gambling */ 328 | title: _('The Mysterious Wanderer'), 329 | isAvailable: function() { 330 | return Engine.activeModule == Room && $SM.get('stores.fur'); 331 | }, 332 | scenes: { 333 | start: { 334 | text: [ 335 | _('a wanderer arrives with an empty cart. says if she leaves with furs, she\'ll be back with more.'), 336 | _("builder's not sure she's to be trusted.") 337 | ], 338 | notification: _('a mysterious wanderer arrives'), 339 | buttons: { 340 | '100fur': { 341 | text: _('give 100'), 342 | cost: {fur: 100}, 343 | nextScene: { 1: '100fur'} 344 | }, 345 | '500fur': { 346 | text: _('give 500'), 347 | cost: {fur: 500}, 348 | nextScene: { 1: '500fur' } 349 | }, 350 | 'deny': { 351 | text: _('turn her away'), 352 | nextScene: 'end' 353 | } 354 | } 355 | }, 356 | '100fur': { 357 | text: [ 358 | _('the wanderer leaves, cart loaded with furs') 359 | ], 360 | onLoad: function() { 361 | if(Math.random() < 0.5) { 362 | setTimeout(function() { 363 | $SM.add('stores.fur', 300); 364 | Notifications.notify(Room, _('the mysterious wanderer returns, cart piled high with furs.')); 365 | }, 60 * 1000); 366 | } 367 | }, 368 | buttons: { 369 | 'leave': { 370 | text: _('say goodbye'), 371 | nextScene: 'end' 372 | } 373 | } 374 | }, 375 | '500fur': { 376 | text: [ 377 | _('the wanderer leaves, cart loaded with furs') 378 | ], 379 | onLoad: function() { 380 | if(Math.random() < 0.3) { 381 | setTimeout(function() { 382 | $SM.add('stores.fur', 1500); 383 | Notifications.notify(Room, _('the mysterious wanderer returns, cart piled high with furs.')); 384 | }, 60 * 1000); 385 | } 386 | }, 387 | buttons: { 388 | 'leave': { 389 | text: _('say goodbye'), 390 | nextScene: 'end' 391 | } 392 | } 393 | } 394 | } 395 | }, 396 | 397 | { /* The Scout -- Map Merchant */ 398 | title: _('The Scout'), 399 | isAvailable: function() { 400 | return Engine.activeModule == Room && $SM.get('features.location.world'); 401 | }, 402 | scenes: { 403 | 'start': { 404 | text: [ 405 | _("the scout says she's been all over."), 406 | _("willing to talk about it, for a price.") 407 | ], 408 | notification: _('a scout stops for the night'), 409 | buttons: { 410 | 'buyMap': { 411 | text: _('buy map'), 412 | cost: { 'fur': 200, 'scales': 10 }, 413 | notification: _('the map uncovers a bit of the world'), 414 | onChoose: World.applyMap 415 | }, 416 | 'learn': { 417 | text: _('learn scouting'), 418 | cost: { 'fur': 1000, 'scales': 50, 'teeth': 20 }, 419 | available: function() { 420 | return !$SM.hasPerk('scout'); 421 | }, 422 | onChoose: function() { 423 | $SM.addPerk('scout'); 424 | } 425 | }, 426 | 'leave': { 427 | text: _('say goodbye'), 428 | nextScene: 'end' 429 | } 430 | } 431 | } 432 | } 433 | }, 434 | 435 | { /* The Wandering Master */ 436 | title: _('The Master'), 437 | isAvailable: function() { 438 | return Engine.activeModule == Room && $SM.get('features.location.world'); 439 | }, 440 | scenes: { 441 | 'start': { 442 | text: [ 443 | _('an old wanderer arrives.'), 444 | _('he smiles warmly and asks for lodgings for the night.') 445 | ], 446 | notification: _('an old wanderer arrives'), 447 | buttons: { 448 | 'agree': { 449 | text: _('agree'), 450 | cost: { 451 | 'cured meat': 100, 452 | 'fur': 100, 453 | 'torch': 1 454 | }, 455 | nextScene: {1: 'agree'} 456 | }, 457 | 'deny': { 458 | text: _('turn him away'), 459 | nextScene: 'end' 460 | } 461 | } 462 | }, 463 | 'agree': { 464 | text: [ 465 | _('in exchange, the wanderer offers his wisdom.') 466 | ], 467 | buttons: { 468 | 'evasion': { 469 | text: _('evasion'), 470 | available: function() { 471 | return !$SM.hasPerk('evasive'); 472 | }, 473 | onChoose: function() { 474 | $SM.addPerk('evasive'); 475 | }, 476 | nextScene: 'end' 477 | }, 478 | 'precision': { 479 | text: _('precision'), 480 | available: function() { 481 | return !$SM.hasPerk('precise'); 482 | }, 483 | onChoose: function() { 484 | $SM.addPerk('precise'); 485 | }, 486 | nextScene: 'end' 487 | }, 488 | 'force': { 489 | text: _('force'), 490 | available: function() { 491 | return !$SM.hasPerk('barbarian'); 492 | }, 493 | onChoose: function() { 494 | $SM.addPerk('barbarian'); 495 | }, 496 | nextScene: 'end' 497 | }, 498 | 'nothing': { 499 | text: _('nothing'), 500 | nextScene: 'end' 501 | } 502 | } 503 | } 504 | } 505 | }, 506 | 507 | { /* The Sick Man */ 508 | title: _('The Sick Man'), 509 | isAvailable: function() { 510 | return Engine.activeModule == Room && $SM.get('stores.medicine', true) > 0; 511 | }, 512 | scenes: { 513 | 'start': { 514 | text: [ 515 | _("a man hobbles up, coughing."), 516 | _("he begs for medicine.") 517 | ], 518 | notification: _('a sick man hobbles up'), 519 | buttons: { 520 | 'help': { 521 | text: _('give 1 medicine'), 522 | cost: { 'medicine': 1 }, 523 | notification: _('the man swallows the medicine eagerly'), 524 | nextScene: { 0.1: 'alloy', 0.3: 'cells', 0.5: 'scales', 1.0: 'nothing' } 525 | }, 526 | 'ignore': { 527 | text: _('tell him to leave'), 528 | nextScene: 'end' 529 | } 530 | } 531 | }, 532 | 'alloy': { 533 | text: [ 534 | _("the man is thankful."), 535 | _('he leaves a reward.'), 536 | _('some weird metal he picked up on his travels.') 537 | ], 538 | onLoad: function() { 539 | $SM.add('stores["alien alloy"]', 1); 540 | }, 541 | buttons: { 542 | 'bye': { 543 | text: _('say goodbye'), 544 | nextScene: 'end' 545 | } 546 | } 547 | }, 548 | 'cells': { 549 | text: [ 550 | _("the man is thankful."), 551 | _('he leaves a reward.'), 552 | _('some weird glowing boxes he picked up on his travels.') 553 | ], 554 | onLoad: function() { 555 | $SM.add('stores["energy cell"]', 3); 556 | }, 557 | buttons: { 558 | 'bye': { 559 | text: _('say goodbye'), 560 | nextScene: 'end' 561 | } 562 | } 563 | }, 564 | 'scales': { 565 | text: [ 566 | _("the man is thankful."), 567 | _('he leaves a reward.'), 568 | _('all he has are some scales.') 569 | ], 570 | onLoad: function() { 571 | $SM.add('stores.scales', 5); 572 | }, 573 | buttons: { 574 | 'bye': { 575 | text: _('say goodbye'), 576 | nextScene: 'end' 577 | } 578 | } 579 | }, 580 | 'nothing': { 581 | text: [ 582 | _("the man expresses his thanks and hobbles off.") 583 | ], 584 | buttons: { 585 | 'bye': { 586 | text: _('say goodbye'), 587 | nextScene: 'end' 588 | } 589 | } 590 | } 591 | } 592 | } 593 | ]; 594 | -------------------------------------------------------------------------------- /script/header.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Module that takes care of header buttons 3 | */ 4 | var Header = { 5 | 6 | init: function(options) { 7 | this.options = $.extend( 8 | this.options, 9 | options 10 | ); 11 | }, 12 | 13 | options: {}, // Nothing for now 14 | 15 | canTravel: function() { 16 | return $('div#header div.headerButton').length > 1; 17 | }, 18 | 19 | addLocation: function(text, id, module) { 20 | return $('
').attr('id', "location_" + id) 21 | .addClass('headerButton') 22 | .text(text).click(function() { 23 | if(Header.canTravel()) { 24 | Engine.travelTo(module); 25 | } 26 | }).appendTo($('div#header')); 27 | } 28 | }; -------------------------------------------------------------------------------- /script/localization.js: -------------------------------------------------------------------------------- 1 | (function(){ 2 | //only used for poedit to find translatable strings 3 | var keywords = [ _('saved.'), _('wood'),_('builder'),_('teeth'),_('meat'),_('fur'), _('alien alloy'), _('bullets'), 4 | _('charm'),_('leather'),_('iron'), _('steel'), _('coal'), _('enegy cell'), 5 | _('torch'),_('medicine'),_('hunter'),_('trapper'),_('tanner'), _('grenade'), _('bolas'), 6 | _("charcutier"),_('iron miner'),_('coal miner'), _('sulphur miner'), _('armourer'), 7 | _('steelworker'),_('bait'),_('cured meat'), _('scales'), _('compass'), _('laser rifle'), 8 | _('gatherer'),_('cloth'), _('scales'), _('cured meat'), _('thieves'), 9 | _('not enough fur'), _('not enough wood'), _('not enough coal'), _('not enough iron'), _('not enough steel'), _('baited trap'), 10 | _('not enough scales'),_('not enough cloth'), _('not enough teeth'), _('not enough leather'), 11 | _('the compass points east.'), _('the compass points west.'), _('the compass points north.'), _('the compass points south.'), 12 | _('the compass points northeast.'), _('the compass points northwest.'), _('the compass points southeast.'), _('the compass points southwest.')]; 13 | delete keywords; 14 | 15 | //translate text in css by overriding attributes 16 | $("