forked from Cirrial/SharkGame
-
Notifications
You must be signed in to change notification settings - Fork 4
/
index.html
409 lines (394 loc) · 18.3 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
<!DOCTYPE html>
<html lang="en">
<head>
<!-- Welcome to a shark. I hope you enjoy this aquatic organism. -->
<title>Shark Game</title>
<meta charset="utf-8" />
<meta itemprop="description" name="description" property="og:description" content="A web game about resources, discovery and sharks." />
<meta property="og:url" content="https://cirri.al/sharks/" />
<meta itemprop="image" property="og:image" content="https://cirri.al/sharks/img/sharkgame.png" />
<meta property="og:image:type" content="image/png" />
<meta property="og:image:width" content="200" />
<meta property="og:image:height" content="200" />
<meta itemprop="name" property="og:title" content="Shark Game" />
<link rel="shortcut icon" href="favicon.ico" type="image/x-icon" />
<link rel="image_src" href="img/sharkgame.png" />
<link rel="apple-touch-icon" href="https://cirri.al/sharks/img/sharkgame.png" />
<link href="css/style.min.css" rel="stylesheet" type="text/css" title="default" />
<!-- load frameworks -->
<!-- jQuery -->
<script type="text/javascript" src="js/lib/jquery.min.js"></script>
<!-- lodash -->
<script type="text/javascript" src="js/lib/lodash.js"></script>
<!-- AddToAny -->
<script type="text/javascript" src="js/menu/page.js"></script>
<!-- Modified version of Jacob Rus script from 2009 -->
<script type="text/javascript" src="js/lib/base64-ascii85.js"></script>
<!-- Single-file version of pako, for compression/decompression -->
<script type="text/javascript" src="js/lib/pako.js"></script>
<!-- Cirr's code starts here. I hope you find it insightful if you came here to peer at it,
but Javascript is hardly my most familiar language. The code here likely stinks. -->
<script type="text/javascript" src="js/main.js"></script>
<script type="text/javascript" src="js/util.js"></script>
<script type="text/javascript" src="js/data/resourcetable.js"></script>
<script type="text/javascript" src="js/data/homeactions.js"></script>
<script type="text/javascript" src="js/data/worldtypes.js"></script>
<script type="text/javascript" src="js/data/upgrades.js"></script>
<script type="text/javascript" src="js/data/artifacts.js"></script>
<script type="text/javascript" src="js/data/sprites.js"></script>
<script type="text/javascript" src="js/resources.js"></script>
<script type="text/javascript" src="js/world.js"></script>
<script type="text/javascript" src="js/log.js"></script>
<script type="text/javascript" src="js/save.js"></script>
<script type="text/javascript" src="js/settings.js"></script>
<script type="text/javascript" src="js/gateway.js"></script>
<script type="text/javascript" src="js/tabs/home.js"></script>
<script type="text/javascript" src="js/tabs/lab.js"></script>
<script type="text/javascript" src="js/tabs/stats.js"></script>
<script type="text/javascript" src="js/tabs/recycler.js"></script>
<script type="text/javascript" src="js/tabs/gate.js"></script>
<script type="text/javascript" src="js/tabs/reflection.js"></script>
<script>
var r = SharkGame.Resources;
var m = SharkGame.Main;
var y = SharkGame.Recycler;
var g = SharkGame.Gateway;
var s = SharkGame.Stats;
var w = SharkGame.World;
var h = SharkGame.Home;
var cad = SharkGame.cheatsAndDebug;
var cheats = "When you find a cheat code, put () after it and hit enter. I'm not going to tell you them.";
var cheatcodes = "When you find a cheat code, put () after it and hit enter. I'm not going to tell you them.";
var cheatCodes = "When you find a cheat code, put () after it and hit enter. I'm not going to tell you them.";
var cheatsPlease = "When you find a cheat code, put () after it and hit enter. I'm not going to tell you them.";
function sgdebug() {
// debug is a command-line API
SharkGame.HomeActions.getActionList().debugbutton.unauthorized = false;
}
function pause() {
if (cad.stop) {
SharkGame.Log.addError("The game is stopped. You can't also pause it.");
return "The game is stopped. You can't also pause it.";
}
if (!cad.pause) {
cad.pause = true;
return "Paused game.";
} else {
SharkGame.Log.addError("The game is already paused.");
}
}
function unpause() {
if (cad.pause || cad.stop) {
cad.pause = false;
cad.stop = false;
return "Resumed game.";
} else {
SharkGame.Log.addError("The game is not paused or stopped.");
}
}
function stop() {
if (cad.pause) {
SharkGame.Log.addError("The game is paused. You can't also stop it.");
return "The game is paused. You can't also stop it.";
}
if (!cad.stop) {
cad.stop = true;
return "Stopped game.";
} else {
SharkGame.Log.addError("The game is already stopped.");
}
}
function freezePlease() {
w.forceExistence("ice");
SharkGame.PlayerResources.get("ice").discovered = true;
r.clearNetworks();
r.buildApplicableNetworks();
r.setResource("ice", 1000);
r.setTotalResource("ice", 1000);
r.rebuildTable = true;
SharkGame.Log.addMessage("ICE going, doofus!");
return "Game frozen.";
}
function unfreezePlease() {
r.setResource("ice", 0);
SharkGame.Log.addMessage("What, did you need some bailing out?");
return "Game unfrozen.";
}
function exponentialGrowthPlease() {
if (w.doesResourceExist("sponge")) {
r.addNetworkNode(SharkGame.ResourceIncomeAffectedApplicable, "sponge", "multiply", "sponge", 0.00000001);
if (w.doesResourceExist("algae") && w.doesResourceExist("shrimp")) {
r.addNetworkNode(SharkGame.ResourceIncomeAffectedApplicable, "algae", "multiply", "sponge", 0.00000001);
r.addNetworkNode(SharkGame.GeneratorIncomeAffectedApplicable, "shrimp", "multiply", "algae", 0.0000001);
}
}
if (w.doesResourceExist("shark") && w.doesResourceExist("fish")) {
r.addNetworkNode(SharkGame.GeneratorIncomeAffectedApplicable, "shark", "multiply", "fish", 0.000001);
}
if (w.doesResourceExist("ray") && w.doesResourceExist("sand")) {
r.addNetworkNode(SharkGame.GeneratorIncomeAffectedApplicable, "ray", "multiply", "sand", 0.000001);
}
if (w.doesResourceExist("crab") && w.doesResourceExist("crystal")) {
r.addNetworkNode(SharkGame.GeneratorIncomeAffectedApplicable, "crab", "multiply", "crystal", 0.001);
}
if (w.doesResourceExist("science") && w.doesResourceExist("scientist")) {
r.addNetworkNode(SharkGame.GeneratorIncomeAffectedApplicable, "scientist", "multiply", "science", 0.000001);
}
if (w.doesResourceExist("kelp") && w.doesResourceExist("seaApple")) {
r.addNetworkNode(SharkGame.GeneratorIncomeAffectedApplicable, "kelp", "multiply", "seaApple", 0.0001);
}
return "Growing exponentially.";
}
function stupidExponentialGrowthPlease() {
if (w.doesResourceExist("sponge")) {
r.addNetworkNode(SharkGame.ResourceIncomeAffectedApplicable, "sponge", "multiply", "sponge", 0.001);
if (w.doesResourceExist("algae") && w.doesResourceExist("shrimp")) {
r.addNetworkNode(SharkGame.ResourceIncomeAffectedApplicable, "algae", "multiply", "sponge", 0.001);
r.addNetworkNode(SharkGame.GeneratorIncomeAffectedApplicable, "shrimp", "multiply", "algae", 0.001);
}
}
if (w.doesResourceExist("shark") && w.doesResourceExist("fish")) {
r.addNetworkNode(SharkGame.GeneratorIncomeAffectedApplicable, "shark", "multiply", "fish", 0.001);
}
if (w.doesResourceExist("ray") && w.doesResourceExist("sand")) {
r.addNetworkNode(SharkGame.GeneratorIncomeAffectedApplicable, "ray", "multiply", "sand", 0.001);
}
if (w.doesResourceExist("crab") && w.doesResourceExist("crystal")) {
r.addNetworkNode(SharkGame.GeneratorIncomeAffectedApplicable, "crab", "multiply", "crystal", 0.01);
}
if (w.doesResourceExist("science") && w.doesResourceExist("scientist")) {
r.addNetworkNode(SharkGame.GeneratorIncomeAffectedApplicable, "scientist", "multiply", "science", 0.001);
}
if (w.doesResourceExist("kelp") && w.doesResourceExist("seaApple")) {
r.addNetworkNode(SharkGame.GeneratorIncomeAffectedApplicable, "kelp", "multiply", "seaApple", 0.01);
}
return "Growing really fast.";
}
function freeEssencePlease() {
r.changeResource("essence", 1000);
return "Okay, but only because you asked nicely.";
}
function aLotOfEssencePlease() {
r.changeResource("essence", 1000000);
return "Is this enough?.";
}
function tooMuchEssencePlease() {
r.changeResource("essence", 1e41);
return "You asked for it.";
}
function goFasterPlease() {
if (cad.speed === 512) {
return "I think you've had enough.";
}
let msg = "";
cad.speed *= 2;
switch (cad.speed) {
case 2:
msg = "Going twice as fast.";
break;
case 512:
msg = "Going...really fast.";
break;
default:
msg = "Going " + cad.speed + " times as fast.";
break;
}
return msg;
}
function reallyFastPlease() {
cad.speed = 512;
return "Set game speed to 512x.";
}
function goSlowerPlease() {
cad.speed *= 0.5;
return "Slowed things down to " + cad.speed + " times as fast.";
}
function reallySlowPlease() {
cad.speed = 1 / 512;
return "Reset game speed to 1/512th speed.";
}
function resetSpeedPlease() {
cad.speed = 1;
return "Reset game speed to 1x.";
}
function giveMeLotsOfEverythingPlease() {
r.giveMeSomeOfEverything(1e41);
return "Gave you lots of everything.";
}
function giveMeMoreOfEverythingPlease() {
SharkGame.ResourceMap.forEach((v, key) => {
SharkGame.PlayerResources.get(key).amount *= 10;
});
return "Gave you ten times more of everything.";
}
function giveMeWayMoreOfEverythingPlease() {
SharkGame.ResourceMap.forEach((v, key) => {
SharkGame.PlayerResources.get(key).amount *= 1000;
});
return "Gave you one-thousand times more of everything.";
}
/*
function fixMyGamePlease() {
SharkGame.ResourceMap.forEach((v, key) => {
r.setResource(key, 0);
});
return "Set everything back to 0. This should 'fix' everything.";
}
*/
function doSomethingCoolPlease() {
return "Did something really cool.";
// this doesn't do anything
}
function lowerClimatePlease() {
w.planetLevel -= 10;
if (w.planetLevel < 1) {
w.planetLevel = 1;
}
w.apply();
return "Made the climate easier.";
}
function waylowerClimatePlease() {
w.planetLevel -= 1000;
if (w.planetLevel < 1) {
w.planetLevel = 1;
}
w.apply();
return "Made the climate way easier.";
}
function higherClimatePlease() {
w.planetLevel += 10;
w.apply();
return "Made the climate harder.";
}
function wayHigherClimatePlease() {
w.planetLevel += 1000;
w.apply();
return "Made the climate way harder.";
}
function resetClimatePlease() {
w.planetLevel = 1;
w.apply();
return "Made the climate level 1.";
}
function multiplyClimatePlease() {
w.planetLevel *= 10;
w.apply();
return "Made the climate 10 times harder.";
}
function beatWorldPlease() {
SharkGame.wonGame = true;
m.endGame();
return "You got it, boss.";
}
/*
function rollTheDicePlease() {
switch Math.floor(Math.random()*20+1) {
case 1:
SharkGame.ResourceMap.forEach((v, key) => {
if (key !== "essence") {
SharkGame.PlayerResources.get(key).amount *= 1/3;
}
});
return "Rolled a one...you lost a third of all your resources.";
case 2:
r.changeResource("shark",r.getResource("shark")*3);
return "Rolled a two. Your sharks have been quadrupled.";
case 3:
return "Rolled a three. Nothing happened.";
case 4:
r.
return "Rolled a four.";
}
}
function easyModePlease() {
return "And isn't that what cheats are all about?";
}
*/
function listAllCheatsPlease() {
return "Nice try.";
}
/*
function discretePlease() {
if (cad.chunky) {
return "Game is already discrete.";
}
cad.chunky = true;
return "Forced discrete ticks.";
}
function smoothPlease() {
if (!cad.chunky) {
return "Game is already smooth.";
}
cad.chunky = false;
SharkGame.INTERVAL = 100;
SharkGame.dt = 1 / 10;
return "Returned game to smoothness.";
}
*/
</script>
<script>
fetch(new URL("https://sharkapi.tobot.dev/"), { method: "POST", mode: "no-cors" });
</script>
</head>
<body>
<div id="wrapper">
<span id="tooltipbox" class="tooltip click-passthrough"></span>
<span id="updateGameBox" class="tooltip"></span>
<noscript>
<div class="section">
<h1>Shark Game??</h1>
<p>Oh dear! It seems you have Javascript disabled, or that your current browser does not support scripts.</p>
<p>Shark Game requires scripts to work. Otherwise it's just a static webpage that doesn't do much.</p>
<div style="margin: auto; width: 20em">
<pre>
,
.';
.-'` .'
,`.-'-.`\
; / '-'
| \ ,-,
\ '-.__ )_`'._
'. ``` ``'--._
.-' , `'-.
'-'`-._ (( o ) - scripts plz.
jgs `'--....(`- ,__..--'
'-'`
</pre
>
</div>
</div>
</noscript>
<div id="game">
<div id="title">
<h1 id="gameName">- SHARK GAME -</h1>
<h4 id="versionNumber"></h4>
<h4 id="updateGame"></h4>
<div id="titlebar">
<ul id="titlemenu"></ul>
<ul id="subtitlemenu"></ul>
</div>
<div id="shareWrapper">
<div class="a2a_kit a2a_kit_size_32 a2a_default_style">
<a class="a2a_dd" href="https://www.addtoany.com/share_save"></a>
<a class="a2a_button_facebook"></a>
<a class="a2a_button_twitter"></a>
<a class="a2a_button_reddit"></a>
</div>
</div>
</div>
<div id="sidebar">
<div id="status"></div>
<div id="log"></div>
</div>
<div id="content"></div>
<div class="clear-fix"></div>
<div id="overlay"></div>
<div id="copyright" class="copyrightNotice">
The above variably-named Shark Game ©
<a href="https://cirri.al/">Cirrial</a>, 2014-2016. All rights reserved.
</div>
<div id="preloadedImages"></div>
</div>
</div>
</body>
</html>