mirror of
https://github.com/doublespeakgames/adarkroom.git
synced 2026-05-28 00:01:54 +08:00
@@ -1,17 +1,17 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>A Dark Room</name>
|
||||
<comment></comment>
|
||||
<projects>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.wst.jsdt.core.javascriptValidator</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>org.eclipse.wst.jsdt.core.jsNature</nature>
|
||||
</natures>
|
||||
</projectDescription>
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>A Dark Room</name>
|
||||
<comment></comment>
|
||||
<projects>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.wst.jsdt.core.javascriptValidator</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>org.eclipse.wst.jsdt.core.jsNature</nature>
|
||||
</natures>
|
||||
</projectDescription>
|
||||
|
||||
+42
-42
@@ -1,43 +1,43 @@
|
||||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<title>A Dark Room</title>
|
||||
<style>
|
||||
body {
|
||||
background-color: #000000;
|
||||
color: #FFFFFF;
|
||||
}
|
||||
a {
|
||||
color: #FFFFFF;
|
||||
}
|
||||
div {
|
||||
width: 960px;
|
||||
margin: auto;
|
||||
text-align: center;
|
||||
margin-top: 20px;
|
||||
}
|
||||
.browser {
|
||||
width:102.4px;
|
||||
height:102.4px;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<center>
|
||||
<img src="img/Logo1.jpg" />
|
||||
<div>
|
||||
<strong>
|
||||
A Dark Room makes use of HTML5 and CSS3, which your current browser does not appear to support.<br/>
|
||||
Please <a href="http://browsehappy.com">update your browser</a> for the best experience:<br/>
|
||||
</strong>
|
||||
<a href='http://www.mozilla.org/en-US/firefox/new/'><img class="browser" src='img/firefox.png' alt='Firefox' title='Firefox' /></a>
|
||||
<a href='https://www.google.com/intl/en/chrome/browser/'><img class="browser" src='img/chrome.png' alt='Chrome' title='Chrome' /></a>
|
||||
<a href='http://windows.microsoft.com/en-CA/internet-explorer/download-ie'><img class="browser" src='img/ie.png' alt='Internet Explorer' title='Internet Explorer' /></a>
|
||||
<a href='http://www.opera.com/computer'><img class="browser" src='img/opera.png' alt='Opera' title='Opera' /></a>
|
||||
<a href='http://www.apple.com/safari/'><img class="browser" src='img/safari.png' alt='Safari' title='Safari' /></a>
|
||||
<br/><br/>
|
||||
Or you can <a href='index.html?ignorebrowser=true'>play anyway</a>, but it probably won't work!
|
||||
</div>
|
||||
</center>
|
||||
</body>
|
||||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<title>A Dark Room</title>
|
||||
<style>
|
||||
body {
|
||||
background-color: #000000;
|
||||
color: #FFFFFF;
|
||||
}
|
||||
a {
|
||||
color: #FFFFFF;
|
||||
}
|
||||
div {
|
||||
width: 960px;
|
||||
margin: auto;
|
||||
text-align: center;
|
||||
margin-top: 20px;
|
||||
}
|
||||
.browser {
|
||||
width:102.4px;
|
||||
height:102.4px;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<center>
|
||||
<img src="img/Logo1.jpg" />
|
||||
<div>
|
||||
<strong>
|
||||
A Dark Room makes use of HTML5 and CSS3, which your current browser does not appear to support.<br/>
|
||||
Please <a href="http://browsehappy.com">update your browser</a> for the best experience:<br/>
|
||||
</strong>
|
||||
<a href='http://www.mozilla.org/en-US/firefox/new/'><img class="browser" src='img/firefox.png' alt='Firefox' title='Firefox' /></a>
|
||||
<a href='https://www.google.com/intl/en/chrome/browser/'><img class="browser" src='img/chrome.png' alt='Chrome' title='Chrome' /></a>
|
||||
<a href='http://windows.microsoft.com/en-CA/internet-explorer/download-ie'><img class="browser" src='img/ie.png' alt='Internet Explorer' title='Internet Explorer' /></a>
|
||||
<a href='http://www.opera.com/computer'><img class="browser" src='img/opera.png' alt='Opera' title='Opera' /></a>
|
||||
<a href='http://www.apple.com/safari/'><img class="browser" src='img/safari.png' alt='Safari' title='Safari' /></a>
|
||||
<br/><br/>
|
||||
Or you can <a href='index.html?ignorebrowser=true'>play anyway</a>, but it probably won't work!
|
||||
</div>
|
||||
</center>
|
||||
</body>
|
||||
</html>
|
||||
+584
-584
File diff suppressed because it is too large
Load Diff
+63
-63
@@ -1,64 +1,64 @@
|
||||
div#village {
|
||||
position: absolute;
|
||||
top: 0px;
|
||||
right: 0px;
|
||||
border: 1px solid black;
|
||||
cursor: default;
|
||||
padding: 5px 10px;
|
||||
width: 200px;
|
||||
}
|
||||
|
||||
div#population {
|
||||
position: absolute;
|
||||
top: -13px;
|
||||
right: 10px;
|
||||
background-color: white;
|
||||
}
|
||||
|
||||
.noHuts #population {
|
||||
display: none;
|
||||
}
|
||||
|
||||
div#village:before {
|
||||
position: absolute;
|
||||
background: white;
|
||||
content: "village";
|
||||
left: 8px;
|
||||
top: -13px;
|
||||
}
|
||||
|
||||
div#village.noHuts:before {
|
||||
content: "forest";
|
||||
}
|
||||
|
||||
div#workers {
|
||||
position:absolute;
|
||||
top: -4px;
|
||||
left: 160px;
|
||||
width: 150px;
|
||||
}
|
||||
|
||||
.workerRow > .row_val {
|
||||
position: relative;
|
||||
padding-right: 20px;
|
||||
-webkit-touch-callout: none;
|
||||
-webkit-user-select: none;
|
||||
-khtml-user-select: none;
|
||||
-moz-user-select: none;
|
||||
-ms-user-select: none;
|
||||
user-select: none;
|
||||
}
|
||||
|
||||
.workerRow {
|
||||
position: relative;
|
||||
margin: 10px 0px;
|
||||
cursor: default;
|
||||
}
|
||||
|
||||
.workerRow .tooltip {
|
||||
width: 150px;
|
||||
}
|
||||
|
||||
div.storeRow div.tooltip {
|
||||
width: 160px;
|
||||
div#village {
|
||||
position: absolute;
|
||||
top: 0px;
|
||||
right: 0px;
|
||||
border: 1px solid black;
|
||||
cursor: default;
|
||||
padding: 5px 10px;
|
||||
width: 200px;
|
||||
}
|
||||
|
||||
div#population {
|
||||
position: absolute;
|
||||
top: -13px;
|
||||
right: 10px;
|
||||
background-color: white;
|
||||
}
|
||||
|
||||
.noHuts #population {
|
||||
display: none;
|
||||
}
|
||||
|
||||
div#village:before {
|
||||
position: absolute;
|
||||
background: white;
|
||||
content: "village";
|
||||
left: 8px;
|
||||
top: -13px;
|
||||
}
|
||||
|
||||
div#village.noHuts:before {
|
||||
content: "forest";
|
||||
}
|
||||
|
||||
div#workers {
|
||||
position:absolute;
|
||||
top: -4px;
|
||||
left: 160px;
|
||||
width: 150px;
|
||||
}
|
||||
|
||||
.workerRow > .row_val {
|
||||
position: relative;
|
||||
padding-right: 20px;
|
||||
-webkit-touch-callout: none;
|
||||
-webkit-user-select: none;
|
||||
-khtml-user-select: none;
|
||||
-moz-user-select: none;
|
||||
-ms-user-select: none;
|
||||
user-select: none;
|
||||
}
|
||||
|
||||
.workerRow {
|
||||
position: relative;
|
||||
margin: 10px 0px;
|
||||
cursor: default;
|
||||
}
|
||||
|
||||
.workerRow .tooltip {
|
||||
width: 150px;
|
||||
}
|
||||
|
||||
div.storeRow div.tooltip {
|
||||
width: 160px;
|
||||
}
|
||||
+65
-65
@@ -1,66 +1,66 @@
|
||||
#outfitting {
|
||||
position: relative;
|
||||
border: 1px solid black;
|
||||
width: 200px;
|
||||
margin-bottom: 20px;
|
||||
padding: 5px 10px;
|
||||
}
|
||||
|
||||
div#outfitting:before {
|
||||
position: absolute;
|
||||
content: "supplies";
|
||||
top: -13px;
|
||||
background-color: white;
|
||||
}
|
||||
|
||||
div.outfitRow {
|
||||
position: relative;
|
||||
cursor: default;
|
||||
margin: 10px -30px 10px 0px;
|
||||
}
|
||||
|
||||
div.outfitRow > .row_val {
|
||||
padding-right: 30px;
|
||||
-webkit-touch-callout: none;
|
||||
-webkit-user-select: none;
|
||||
-khtml-user-select: none;
|
||||
-moz-user-select: none;
|
||||
-ms-user-select: none;
|
||||
user-select: none;
|
||||
}
|
||||
|
||||
div.outfitRow .tooltip {
|
||||
width: 150px;
|
||||
}
|
||||
|
||||
div#bagspace {
|
||||
background-color: white;
|
||||
position: absolute;
|
||||
top:-13px;
|
||||
right: 10px;
|
||||
}
|
||||
|
||||
div#perks {
|
||||
position: absolute;
|
||||
top: 0px;
|
||||
right: 0px;
|
||||
border: 1px solid black;
|
||||
cursor: default;
|
||||
padding: 5px 10px;
|
||||
width: 200px;
|
||||
}
|
||||
|
||||
div#perks:before {
|
||||
position: absolute;
|
||||
content: "perks";
|
||||
top: -13px;
|
||||
background-color: white;
|
||||
}
|
||||
|
||||
div.perkRow {
|
||||
position: relative;
|
||||
}
|
||||
|
||||
div.perkRow .row_key {
|
||||
float: none;
|
||||
#outfitting {
|
||||
position: relative;
|
||||
border: 1px solid black;
|
||||
width: 200px;
|
||||
margin-bottom: 20px;
|
||||
padding: 5px 10px;
|
||||
}
|
||||
|
||||
div#outfitting:before {
|
||||
position: absolute;
|
||||
content: "supplies";
|
||||
top: -13px;
|
||||
background-color: white;
|
||||
}
|
||||
|
||||
div.outfitRow {
|
||||
position: relative;
|
||||
cursor: default;
|
||||
margin: 10px -30px 10px 0px;
|
||||
}
|
||||
|
||||
div.outfitRow > .row_val {
|
||||
padding-right: 30px;
|
||||
-webkit-touch-callout: none;
|
||||
-webkit-user-select: none;
|
||||
-khtml-user-select: none;
|
||||
-moz-user-select: none;
|
||||
-ms-user-select: none;
|
||||
user-select: none;
|
||||
}
|
||||
|
||||
div.outfitRow .tooltip {
|
||||
width: 150px;
|
||||
}
|
||||
|
||||
div#bagspace {
|
||||
background-color: white;
|
||||
position: absolute;
|
||||
top:-13px;
|
||||
right: 10px;
|
||||
}
|
||||
|
||||
div#perks {
|
||||
position: absolute;
|
||||
top: 0px;
|
||||
right: 0px;
|
||||
border: 1px solid black;
|
||||
cursor: default;
|
||||
padding: 5px 10px;
|
||||
width: 200px;
|
||||
}
|
||||
|
||||
div#perks:before {
|
||||
position: absolute;
|
||||
content: "perks";
|
||||
top: -13px;
|
||||
background-color: white;
|
||||
}
|
||||
|
||||
div.perkRow {
|
||||
position: relative;
|
||||
}
|
||||
|
||||
div.perkRow .row_key {
|
||||
float: none;
|
||||
}
|
||||
+78
-78
@@ -1,79 +1,79 @@
|
||||
div#buildBtns {
|
||||
position: absolute;
|
||||
top: 50px;
|
||||
left: 0px;
|
||||
}
|
||||
|
||||
div#buildBtns:before {
|
||||
content: "build:";
|
||||
position: relative;
|
||||
top: -5px;
|
||||
}
|
||||
|
||||
div#craftBtns {
|
||||
position: absolute;
|
||||
top: 50px;
|
||||
left: 150px;
|
||||
}
|
||||
|
||||
div#craftBtns:before {
|
||||
content: "craft:";
|
||||
position: relative;
|
||||
top: -5px;
|
||||
}
|
||||
|
||||
div#buyBtns {
|
||||
position: absolute;
|
||||
top: 50px;
|
||||
left: 300px;
|
||||
}
|
||||
|
||||
div#buyBtns:before {
|
||||
content: "buy:";
|
||||
position: relative;
|
||||
top: -5px;
|
||||
}
|
||||
|
||||
div#storesContainer {
|
||||
position: absolute;
|
||||
top: 0px;
|
||||
right: 0px;
|
||||
}
|
||||
|
||||
div#stores {
|
||||
position: relative;
|
||||
border: 1px solid black;
|
||||
cursor: default;
|
||||
padding: 5px 10px;
|
||||
width: 200px;
|
||||
}
|
||||
|
||||
div.storeRow {
|
||||
position: relative;
|
||||
}
|
||||
|
||||
div#stores:before {
|
||||
position: absolute;
|
||||
background: white;
|
||||
content: "stores";
|
||||
left: 8px;
|
||||
top: -13px;
|
||||
}
|
||||
|
||||
div#weapons {
|
||||
margin-top: 15px;
|
||||
position: relative;
|
||||
right: 0px;
|
||||
border: 1px solid black;
|
||||
cursor: default;
|
||||
padding: 5px 10px;
|
||||
width: 200px;
|
||||
}
|
||||
|
||||
div#weapons:before {
|
||||
position: absolute;
|
||||
background: white;
|
||||
content: "weapons";
|
||||
left: 8px;
|
||||
top: -13px;
|
||||
div#buildBtns {
|
||||
position: absolute;
|
||||
top: 50px;
|
||||
left: 0px;
|
||||
}
|
||||
|
||||
div#buildBtns:before {
|
||||
content: "build:";
|
||||
position: relative;
|
||||
top: -5px;
|
||||
}
|
||||
|
||||
div#craftBtns {
|
||||
position: absolute;
|
||||
top: 50px;
|
||||
left: 150px;
|
||||
}
|
||||
|
||||
div#craftBtns:before {
|
||||
content: "craft:";
|
||||
position: relative;
|
||||
top: -5px;
|
||||
}
|
||||
|
||||
div#buyBtns {
|
||||
position: absolute;
|
||||
top: 50px;
|
||||
left: 300px;
|
||||
}
|
||||
|
||||
div#buyBtns:before {
|
||||
content: "buy:";
|
||||
position: relative;
|
||||
top: -5px;
|
||||
}
|
||||
|
||||
div#storesContainer {
|
||||
position: absolute;
|
||||
top: 0px;
|
||||
right: 0px;
|
||||
}
|
||||
|
||||
div#stores {
|
||||
position: relative;
|
||||
border: 1px solid black;
|
||||
cursor: default;
|
||||
padding: 5px 10px;
|
||||
width: 200px;
|
||||
}
|
||||
|
||||
div.storeRow {
|
||||
position: relative;
|
||||
}
|
||||
|
||||
div#stores:before {
|
||||
position: absolute;
|
||||
background: white;
|
||||
content: "stores";
|
||||
left: 8px;
|
||||
top: -13px;
|
||||
}
|
||||
|
||||
div#weapons {
|
||||
margin-top: 15px;
|
||||
position: relative;
|
||||
right: 0px;
|
||||
border: 1px solid black;
|
||||
cursor: default;
|
||||
padding: 5px 10px;
|
||||
width: 200px;
|
||||
}
|
||||
|
||||
div#weapons:before {
|
||||
position: absolute;
|
||||
background: white;
|
||||
content: "weapons";
|
||||
left: 8px;
|
||||
top: -13px;
|
||||
}
|
||||
+8
-8
@@ -1,8 +1,8 @@
|
||||
div#hullRow {
|
||||
width: 70px;
|
||||
}
|
||||
|
||||
div#engineRow {
|
||||
width: 70px;
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
div#hullRow {
|
||||
width: 70px;
|
||||
}
|
||||
|
||||
div#engineRow {
|
||||
width: 70px;
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
+154
-154
@@ -1,154 +1,154 @@
|
||||
@-ms-keyframes spin {
|
||||
0% {
|
||||
-ms-transform: rotate(0deg);
|
||||
-webkit-transform: rotate(0deg);
|
||||
-moz-transform: rotate(0deg);
|
||||
transform:rotate(0deg);
|
||||
}
|
||||
100% {
|
||||
-ms-transform: rotate(360deg);
|
||||
-webkit-transform: rotate(360deg);
|
||||
-moz-transform: rotate(360deg);
|
||||
transform:rotate(360deg);
|
||||
}
|
||||
}
|
||||
|
||||
@-webkit-keyframes spin {
|
||||
0% {
|
||||
-ms-transform: rotate(0deg);
|
||||
-webkit-transform: rotate(0deg);
|
||||
-moz-transform: rotate(0deg);
|
||||
transform:rotate(0deg);
|
||||
}
|
||||
100% {
|
||||
-ms-transform: rotate(360deg);
|
||||
-webkit-transform: rotate(360deg);
|
||||
-moz-transform: rotate(360deg);
|
||||
transform:rotate(360deg);
|
||||
}
|
||||
}
|
||||
|
||||
@-moz-keyframes spin {
|
||||
0% {
|
||||
-ms-transform: rotate(0deg);
|
||||
-webkit-transform: rotate(0deg);
|
||||
-moz-transform: rotate(0deg);
|
||||
transform:rotate(0deg);
|
||||
}
|
||||
100% {
|
||||
-ms-transform: rotate(360deg);
|
||||
-webkit-transform: rotate(360deg);
|
||||
-moz-transform: rotate(360deg);
|
||||
transform:rotate(360deg);
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes spin {
|
||||
0% {
|
||||
-ms-transform: rotate(0deg);
|
||||
-webkit-transform: rotate(0deg);
|
||||
-moz-transform: rotate(0deg);
|
||||
transform:rotate(0deg);
|
||||
}
|
||||
100% {
|
||||
-ms-transform: rotate(360deg);
|
||||
-webkit-transform: rotate(360deg);
|
||||
-moz-transform: rotate(360deg);
|
||||
transform:rotate(360deg);
|
||||
}
|
||||
}
|
||||
|
||||
#spacePanel {
|
||||
float: none !important;
|
||||
position: absolute !important;
|
||||
top: -700px;
|
||||
left: 0px;
|
||||
}
|
||||
|
||||
#starsContainer {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
position: absolute;
|
||||
top: 0px;
|
||||
left: 0px;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
#stars, #starsBack {
|
||||
position: absolute;
|
||||
z-index: -1;
|
||||
left: 0px;
|
||||
}
|
||||
|
||||
#stars > div, #starsBack > div {
|
||||
position: relative;
|
||||
height: 3000px;
|
||||
width: 3000px;
|
||||
color: white;
|
||||
}
|
||||
|
||||
#starsBack {
|
||||
opacity: 0.5;
|
||||
}
|
||||
|
||||
.star {
|
||||
position: absolute;
|
||||
}
|
||||
|
||||
#ship {
|
||||
cursor: default;
|
||||
position: absolute;
|
||||
margin-top: -10px;
|
||||
margin-left: -7.5px;
|
||||
}
|
||||
|
||||
#theEnd {
|
||||
position: relative;
|
||||
cursor: default;
|
||||
top: 200px;
|
||||
margin-left: -220px;
|
||||
text-align: center;
|
||||
font-size: 24px;
|
||||
font-weight: bold;
|
||||
opacity: 0;
|
||||
color: white;
|
||||
}
|
||||
|
||||
.asteroid {
|
||||
cursor: default;
|
||||
position: absolute;
|
||||
top: -40px;
|
||||
left: 350px;
|
||||
-webkit-animation: 1s linear 0s normal none infinite spin;
|
||||
-moz-animation: 1s linear 0s normal none infinite spin;
|
||||
-ms-animation: 1s linear 0s normal none infinite spin;
|
||||
animation: 1s linear 0s normal none infinite spin;
|
||||
font-size: 32px;
|
||||
}
|
||||
|
||||
#hullRemaining {
|
||||
width: 70px;
|
||||
position: absolute;
|
||||
top: 0px;
|
||||
left: 0px;
|
||||
}
|
||||
|
||||
.centerCont {
|
||||
padding-top:10%;
|
||||
}
|
||||
|
||||
.endGame {
|
||||
font-size:48px;
|
||||
color:#FFFFFF;
|
||||
opacity:0;
|
||||
position:relative;
|
||||
}
|
||||
|
||||
.endGameRestart {
|
||||
font-size: 32px;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.endGameRestart:hover {
|
||||
text-decoration: underline;
|
||||
}
|
||||
@-ms-keyframes spin {
|
||||
0% {
|
||||
-ms-transform: rotate(0deg);
|
||||
-webkit-transform: rotate(0deg);
|
||||
-moz-transform: rotate(0deg);
|
||||
transform:rotate(0deg);
|
||||
}
|
||||
100% {
|
||||
-ms-transform: rotate(360deg);
|
||||
-webkit-transform: rotate(360deg);
|
||||
-moz-transform: rotate(360deg);
|
||||
transform:rotate(360deg);
|
||||
}
|
||||
}
|
||||
|
||||
@-webkit-keyframes spin {
|
||||
0% {
|
||||
-ms-transform: rotate(0deg);
|
||||
-webkit-transform: rotate(0deg);
|
||||
-moz-transform: rotate(0deg);
|
||||
transform:rotate(0deg);
|
||||
}
|
||||
100% {
|
||||
-ms-transform: rotate(360deg);
|
||||
-webkit-transform: rotate(360deg);
|
||||
-moz-transform: rotate(360deg);
|
||||
transform:rotate(360deg);
|
||||
}
|
||||
}
|
||||
|
||||
@-moz-keyframes spin {
|
||||
0% {
|
||||
-ms-transform: rotate(0deg);
|
||||
-webkit-transform: rotate(0deg);
|
||||
-moz-transform: rotate(0deg);
|
||||
transform:rotate(0deg);
|
||||
}
|
||||
100% {
|
||||
-ms-transform: rotate(360deg);
|
||||
-webkit-transform: rotate(360deg);
|
||||
-moz-transform: rotate(360deg);
|
||||
transform:rotate(360deg);
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes spin {
|
||||
0% {
|
||||
-ms-transform: rotate(0deg);
|
||||
-webkit-transform: rotate(0deg);
|
||||
-moz-transform: rotate(0deg);
|
||||
transform:rotate(0deg);
|
||||
}
|
||||
100% {
|
||||
-ms-transform: rotate(360deg);
|
||||
-webkit-transform: rotate(360deg);
|
||||
-moz-transform: rotate(360deg);
|
||||
transform:rotate(360deg);
|
||||
}
|
||||
}
|
||||
|
||||
#spacePanel {
|
||||
float: none !important;
|
||||
position: absolute !important;
|
||||
top: -700px;
|
||||
left: 0px;
|
||||
}
|
||||
|
||||
#starsContainer {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
position: absolute;
|
||||
top: 0px;
|
||||
left: 0px;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
#stars, #starsBack {
|
||||
position: absolute;
|
||||
z-index: -1;
|
||||
left: 0px;
|
||||
}
|
||||
|
||||
#stars > div, #starsBack > div {
|
||||
position: relative;
|
||||
height: 3000px;
|
||||
width: 3000px;
|
||||
color: white;
|
||||
}
|
||||
|
||||
#starsBack {
|
||||
opacity: 0.5;
|
||||
}
|
||||
|
||||
.star {
|
||||
position: absolute;
|
||||
}
|
||||
|
||||
#ship {
|
||||
cursor: default;
|
||||
position: absolute;
|
||||
margin-top: -10px;
|
||||
margin-left: -7.5px;
|
||||
}
|
||||
|
||||
#theEnd {
|
||||
position: relative;
|
||||
cursor: default;
|
||||
top: 200px;
|
||||
margin-left: -220px;
|
||||
text-align: center;
|
||||
font-size: 24px;
|
||||
font-weight: bold;
|
||||
opacity: 0;
|
||||
color: white;
|
||||
}
|
||||
|
||||
.asteroid {
|
||||
cursor: default;
|
||||
position: absolute;
|
||||
top: -40px;
|
||||
left: 350px;
|
||||
-webkit-animation: 1s linear 0s normal none infinite spin;
|
||||
-moz-animation: 1s linear 0s normal none infinite spin;
|
||||
-ms-animation: 1s linear 0s normal none infinite spin;
|
||||
animation: 1s linear 0s normal none infinite spin;
|
||||
font-size: 32px;
|
||||
}
|
||||
|
||||
#hullRemaining {
|
||||
width: 70px;
|
||||
position: absolute;
|
||||
top: 0px;
|
||||
left: 0px;
|
||||
}
|
||||
|
||||
.centerCont {
|
||||
padding-top:10%;
|
||||
}
|
||||
|
||||
.endGame {
|
||||
font-size:48px;
|
||||
color:#FFFFFF;
|
||||
opacity:0;
|
||||
position:relative;
|
||||
}
|
||||
|
||||
.endGameRestart {
|
||||
font-size: 32px;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.endGameRestart:hover {
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
+73
-73
@@ -1,74 +1,74 @@
|
||||
#worldOuter {
|
||||
position: relative;
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
#map {
|
||||
position: relative;
|
||||
font-family: "Courier New", Courier, monospace;
|
||||
border: 1px solid black;
|
||||
overflow: hidden;
|
||||
display: inline-block;
|
||||
line-height: 10px;
|
||||
letter-spacing: 1px;
|
||||
color: #999;
|
||||
cursor: default;
|
||||
-webkit-touch-callout: none;
|
||||
-webkit-user-select: none;
|
||||
-khtml-user-select: none;
|
||||
-moz-user-select: none;
|
||||
-ms-user-select: none;
|
||||
user-select: none;
|
||||
}
|
||||
|
||||
#map .landmark {
|
||||
position: relative;
|
||||
font-weight: bold;
|
||||
color: black;
|
||||
line-height: 0px; /* Hack to prevent the boldness from increasing the row's line-height. I hope it works in all browsers... */
|
||||
}
|
||||
|
||||
#bagspace-world {
|
||||
border: 1px solid black;
|
||||
height: 62px;
|
||||
margin-bottom: 5px;
|
||||
margin-top: 13px;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
#bagspace-world > div {
|
||||
padding: 6px 4px;
|
||||
}
|
||||
|
||||
#backpackTitle {
|
||||
position: absolute;
|
||||
top: 0px;
|
||||
left: 10px;
|
||||
background-color: white;
|
||||
z-index: 1;
|
||||
}
|
||||
|
||||
#backpackSpace {
|
||||
position: absolute;
|
||||
top: 0px;
|
||||
right: 10px;
|
||||
background-color: white;
|
||||
z-index: 1;
|
||||
}
|
||||
|
||||
#healthCounter {
|
||||
position: absolute;
|
||||
top: 0px;
|
||||
left: 80px;
|
||||
background-color: white;
|
||||
z-index: 1;
|
||||
}
|
||||
|
||||
div.supplyItem {
|
||||
display: inline-block;
|
||||
border: 1px solid #999;
|
||||
float: left;
|
||||
margin: 0px 5px 6px 0px;
|
||||
padding: 0 5px;
|
||||
cursor: default;
|
||||
#worldOuter {
|
||||
position: relative;
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
#map {
|
||||
position: relative;
|
||||
font-family: "Courier New", Courier, monospace;
|
||||
border: 1px solid black;
|
||||
overflow: hidden;
|
||||
display: inline-block;
|
||||
line-height: 10px;
|
||||
letter-spacing: 1px;
|
||||
color: #999;
|
||||
cursor: default;
|
||||
-webkit-touch-callout: none;
|
||||
-webkit-user-select: none;
|
||||
-khtml-user-select: none;
|
||||
-moz-user-select: none;
|
||||
-ms-user-select: none;
|
||||
user-select: none;
|
||||
}
|
||||
|
||||
#map .landmark {
|
||||
position: relative;
|
||||
font-weight: bold;
|
||||
color: black;
|
||||
line-height: 0px; /* Hack to prevent the boldness from increasing the row's line-height. I hope it works in all browsers... */
|
||||
}
|
||||
|
||||
#bagspace-world {
|
||||
border: 1px solid black;
|
||||
height: 62px;
|
||||
margin-bottom: 5px;
|
||||
margin-top: 13px;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
#bagspace-world > div {
|
||||
padding: 6px 4px;
|
||||
}
|
||||
|
||||
#backpackTitle {
|
||||
position: absolute;
|
||||
top: 0px;
|
||||
left: 10px;
|
||||
background-color: white;
|
||||
z-index: 1;
|
||||
}
|
||||
|
||||
#backpackSpace {
|
||||
position: absolute;
|
||||
top: 0px;
|
||||
right: 10px;
|
||||
background-color: white;
|
||||
z-index: 1;
|
||||
}
|
||||
|
||||
#healthCounter {
|
||||
position: absolute;
|
||||
top: 0px;
|
||||
left: 80px;
|
||||
background-color: white;
|
||||
z-index: 1;
|
||||
}
|
||||
|
||||
div.supplyItem {
|
||||
display: inline-block;
|
||||
border: 1px solid #999;
|
||||
float: left;
|
||||
margin: 0px 5px 6px 0px;
|
||||
padding: 0 5px;
|
||||
cursor: default;
|
||||
}
|
||||
+4
-4
@@ -1,5 +1,5 @@
|
||||
Radius Enemy DPS Player DPS Enemy HP Player HP
|
||||
=====================================================================
|
||||
< 10 1 1 5 10
|
||||
< 20 3 3 10 15-20
|
||||
Radius Enemy DPS Player DPS Enemy HP Player HP
|
||||
=====================================================================
|
||||
< 10 1 1 5 10
|
||||
< 20 3 3 10 15-20
|
||||
< 30 6 4 20 30-40
|
||||
+112
-112
@@ -1,112 +1,112 @@
|
||||
<!DOCTYPE html>
|
||||
<html itemscope itemtype="http://schema.org/CreativeWork">
|
||||
<head>
|
||||
<meta charset="UTF-8"/>
|
||||
<!--
|
||||
A Dark Room (v1.4)
|
||||
==================
|
||||
|
||||
A minimalist text adventure by Michael Townsend and all his friends.
|
||||
Inspired by Candy Box (http://candies.aniwey.net/)
|
||||
Contribute on GitHub! (https://github.com/Continuities/adarkroom/)
|
||||
-->
|
||||
<title>A Dark Room</title>
|
||||
<meta itemprop="description" name="description" property="og:description" content="A minimalist text adventure">
|
||||
<meta itemprop="image" property="og:image" content="img/adr.png" />
|
||||
<meta itemprop="name" property="og:title" content="A Dark Room" />
|
||||
<link rel="shortcut icon" href="favicon.ico" />
|
||||
<link rel="image_src" href="img/adr.png" />
|
||||
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.1/jquery.min.js"></script>
|
||||
<script src="https://www.dropbox.com/static/api/dropbox-datastores-1.1-latest.js" type="text/javascript"></script>
|
||||
<script>
|
||||
if(!window.jQuery) {
|
||||
document.write('<script src="lib/jquery.min.js"><\/script>')
|
||||
}
|
||||
</script>
|
||||
<script src="lib/jquery.color-2.1.2.min.js"></script>
|
||||
<script src="lib/jquery.event.move.js"></script>
|
||||
<script src="lib/jquery.event.swipe.js"></script>
|
||||
<script src="lib/base64.js"></script>
|
||||
<script src="lib/translate.js"></script>
|
||||
|
||||
<script src="lang/langs.js"></script>
|
||||
|
||||
<script>
|
||||
// try to read "lang" param's from url
|
||||
var lang = decodeURIComponent((new RegExp('[?|&]lang=' + '([^&;]+?)(&|#|;|$)').exec(location.search)||[,""])[1].replace(/\+/g, '%20'))||null;
|
||||
// if no language requested, try to read it from local storage
|
||||
if(!lang){
|
||||
try {
|
||||
lang = localStorage.lang;
|
||||
} catch(e) {}
|
||||
}
|
||||
// if a language different than english requested, load all translations
|
||||
if(lang && lang != 'en'){
|
||||
document.write('<script src="lang/'+lang+'/strings.js"><\/script>');
|
||||
document.write('<link rel="stylesheet" type="text/css" href="lang/'+lang+'/main.css" \/>');
|
||||
}
|
||||
</script>
|
||||
|
||||
<script src="script/Button.js"></script>
|
||||
<script src="script/engine.js"></script>
|
||||
<script src="script/state_manager.js"></script>
|
||||
<script src="script/header.js"></script>
|
||||
<script src="script/notifications.js"></script>
|
||||
<script src="script/events.js"></script>
|
||||
<script src="script/dropbox.js"></script>
|
||||
<script src="script/room.js"></script>
|
||||
<script src="script/outside.js"></script>
|
||||
<script src="script/world.js"></script>
|
||||
<script src="script/path.js"></script>
|
||||
<script src="script/ship.js"></script>
|
||||
<script src="script/space.js"></script>
|
||||
<script src="script/prestige.js"></script>
|
||||
<script src="script/scoring.js"></script>
|
||||
<!-- Event modules -->
|
||||
<script src="script/events/global.js"></script>
|
||||
<script src="script/events/room.js"></script>
|
||||
<script src="script/events/outside.js"></script>
|
||||
<script src="script/events/encounters.js"></script>
|
||||
<script src="script/events/setpieces.js"></script>
|
||||
|
||||
<script type='text/javascript'>
|
||||
var oldIE = false;
|
||||
</script>
|
||||
<!--[if lt IE 9]>
|
||||
<script type="text/javascript">oldIE = true;</script>
|
||||
<![endif]-->
|
||||
|
||||
<link rel="stylesheet" type="text/css" href="css/main.css" />
|
||||
<link rel="stylesheet" type="text/css" href="css/room.css" />
|
||||
<link rel="stylesheet" type="text/css" href="css/outside.css" />
|
||||
<link rel="stylesheet" type="text/css" href="css/path.css" />
|
||||
<link rel="stylesheet" type="text/css" href="css/world.css" />
|
||||
<link rel="stylesheet" type="text/css" href="css/ship.css" />
|
||||
<link rel="stylesheet" type="text/css" href="css/space.css" />
|
||||
|
||||
<script src="script/localization.js"></script>
|
||||
<!-- Google Analytics -->
|
||||
<script>
|
||||
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
|
||||
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
|
||||
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
|
||||
})(window,document,'script','http://www.google-analytics.com/analytics.js','ga');
|
||||
|
||||
ga('create', 'UA-41314886-1', 'doublespeakgames.com');
|
||||
ga('send', 'pageview');
|
||||
</script>
|
||||
|
||||
</head>
|
||||
<body>
|
||||
<div id="wrapper">
|
||||
<div id="saveNotify"><script>document.write(_("saved."));</script></div>
|
||||
<div id="content">
|
||||
<div id="outerSlider">
|
||||
<div id="main">
|
||||
<div id="header"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
<!DOCTYPE html>
|
||||
<html itemscope itemtype="http://schema.org/CreativeWork">
|
||||
<head>
|
||||
<meta charset="UTF-8"/>
|
||||
<!--
|
||||
A Dark Room (v1.4)
|
||||
==================
|
||||
|
||||
A minimalist text adventure by Michael Townsend and all his friends.
|
||||
Inspired by Candy Box (http://candies.aniwey.net/)
|
||||
Contribute on GitHub! (https://github.com/Continuities/adarkroom/)
|
||||
-->
|
||||
<title>A Dark Room</title>
|
||||
<meta itemprop="description" name="description" property="og:description" content="A minimalist text adventure">
|
||||
<meta itemprop="image" property="og:image" content="img/adr.png" />
|
||||
<meta itemprop="name" property="og:title" content="A Dark Room" />
|
||||
<link rel="shortcut icon" href="favicon.ico" />
|
||||
<link rel="image_src" href="img/adr.png" />
|
||||
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.1/jquery.min.js"></script>
|
||||
<script src="https://www.dropbox.com/static/api/dropbox-datastores-1.1-latest.js" type="text/javascript"></script>
|
||||
<script>
|
||||
if(!window.jQuery) {
|
||||
document.write('<script src="lib/jquery.min.js"><\/script>')
|
||||
}
|
||||
</script>
|
||||
<script src="lib/jquery.color-2.1.2.min.js"></script>
|
||||
<script src="lib/jquery.event.move.js"></script>
|
||||
<script src="lib/jquery.event.swipe.js"></script>
|
||||
<script src="lib/base64.js"></script>
|
||||
<script src="lib/translate.js"></script>
|
||||
|
||||
<script src="lang/langs.js"></script>
|
||||
|
||||
<script>
|
||||
// try to read "lang" param's from url
|
||||
var lang = decodeURIComponent((new RegExp('[?|&]lang=' + '([^&;]+?)(&|#|;|$)').exec(location.search)||[,""])[1].replace(/\+/g, '%20'))||null;
|
||||
// if no language requested, try to read it from local storage
|
||||
if(!lang){
|
||||
try {
|
||||
lang = localStorage.lang;
|
||||
} catch(e) {}
|
||||
}
|
||||
// if a language different than english requested, load all translations
|
||||
if(lang && lang != 'en'){
|
||||
document.write('<script src="lang/'+lang+'/strings.js"><\/script>');
|
||||
document.write('<link rel="stylesheet" type="text/css" href="lang/'+lang+'/main.css" \/>');
|
||||
}
|
||||
</script>
|
||||
|
||||
<script src="script/Button.js"></script>
|
||||
<script src="script/engine.js"></script>
|
||||
<script src="script/state_manager.js"></script>
|
||||
<script src="script/header.js"></script>
|
||||
<script src="script/notifications.js"></script>
|
||||
<script src="script/events.js"></script>
|
||||
<script src="script/dropbox.js"></script>
|
||||
<script src="script/room.js"></script>
|
||||
<script src="script/outside.js"></script>
|
||||
<script src="script/world.js"></script>
|
||||
<script src="script/path.js"></script>
|
||||
<script src="script/ship.js"></script>
|
||||
<script src="script/space.js"></script>
|
||||
<script src="script/prestige.js"></script>
|
||||
<script src="script/scoring.js"></script>
|
||||
<!-- Event modules -->
|
||||
<script src="script/events/global.js"></script>
|
||||
<script src="script/events/room.js"></script>
|
||||
<script src="script/events/outside.js"></script>
|
||||
<script src="script/events/encounters.js"></script>
|
||||
<script src="script/events/setpieces.js"></script>
|
||||
|
||||
<script type='text/javascript'>
|
||||
var oldIE = false;
|
||||
</script>
|
||||
<!--[if lt IE 9]>
|
||||
<script type="text/javascript">oldIE = true;</script>
|
||||
<![endif]-->
|
||||
|
||||
<link rel="stylesheet" type="text/css" href="css/main.css" />
|
||||
<link rel="stylesheet" type="text/css" href="css/room.css" />
|
||||
<link rel="stylesheet" type="text/css" href="css/outside.css" />
|
||||
<link rel="stylesheet" type="text/css" href="css/path.css" />
|
||||
<link rel="stylesheet" type="text/css" href="css/world.css" />
|
||||
<link rel="stylesheet" type="text/css" href="css/ship.css" />
|
||||
<link rel="stylesheet" type="text/css" href="css/space.css" />
|
||||
|
||||
<script src="script/localization.js"></script>
|
||||
<!-- Google Analytics -->
|
||||
<script>
|
||||
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
|
||||
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
|
||||
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
|
||||
})(window,document,'script','http://www.google-analytics.com/analytics.js','ga');
|
||||
|
||||
ga('create', 'UA-41314886-1', 'doublespeakgames.com');
|
||||
ga('send', 'pageview');
|
||||
</script>
|
||||
|
||||
</head>
|
||||
<body>
|
||||
<div id="wrapper">
|
||||
<div id="saveNotify"><script>document.write(_("saved."));</script></div>
|
||||
<div id="content">
|
||||
<div id="outerSlider">
|
||||
<div id="main">
|
||||
<div id="header"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
+1
-1
File diff suppressed because one or more lines are too long
+34
-34
@@ -1,34 +1,34 @@
|
||||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<title>A Dark Room</title>
|
||||
<style>
|
||||
body {
|
||||
background-color: #000000;
|
||||
color: #FFFFFF;
|
||||
}
|
||||
a {
|
||||
color: #FFFFFF;
|
||||
}
|
||||
div {
|
||||
width: 960px;
|
||||
margin: auto;
|
||||
text-align: center;
|
||||
margin-top: 20px;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<center>
|
||||
<img src="img/Logo1.jpg" />
|
||||
<div>
|
||||
<strong>
|
||||
A Dark Room isn't really mobile-friendly, and it requires arrow keys.<br/>
|
||||
Sorry about that!<br/>
|
||||
</strong><br/>
|
||||
Of course you can <a href='index.html?ignorebrowser=true'>play anyway</a>, but it probably won't work!<br/><br/>
|
||||
A Dark Room is now native on iOS! Get it on the <a href="https://itunes.apple.com/us/app/a-dark-room/id736683061?mt=8">App Store</a>.
|
||||
</div>
|
||||
</center>
|
||||
</body>
|
||||
</html>
|
||||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<title>A Dark Room</title>
|
||||
<style>
|
||||
body {
|
||||
background-color: #000000;
|
||||
color: #FFFFFF;
|
||||
}
|
||||
a {
|
||||
color: #FFFFFF;
|
||||
}
|
||||
div {
|
||||
width: 960px;
|
||||
margin: auto;
|
||||
text-align: center;
|
||||
margin-top: 20px;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<center>
|
||||
<img src="img/Logo1.jpg" />
|
||||
<div>
|
||||
<strong>
|
||||
A Dark Room isn't really mobile-friendly, and it requires arrow keys.<br/>
|
||||
Sorry about that!<br/>
|
||||
</strong><br/>
|
||||
Of course you can <a href='index.html?ignorebrowser=true'>play anyway</a>, but it probably won't work!<br/><br/>
|
||||
A Dark Room is now native on iOS! Get it on the <a href="https://itunes.apple.com/us/app/a-dark-room/id736683061?mt=8">App Store</a>.
|
||||
</div>
|
||||
</center>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
+85
-85
@@ -1,86 +1,86 @@
|
||||
var Button = {
|
||||
Button: function(options) {
|
||||
if(typeof options.cooldown == 'number') {
|
||||
this.data_cooldown = options.cooldown;
|
||||
}
|
||||
this.data_remaining = 0;
|
||||
if(typeof options.click == 'function') {
|
||||
this.data_handler = options.click;
|
||||
}
|
||||
|
||||
var el = $('<div>')
|
||||
.attr('id', typeof(options.id) != 'undefined' ? options.id : "BTN_" + Engine.getGuid())
|
||||
.addClass('button')
|
||||
.text(typeof(options.text) != 'undefined' ? options.text : "button")
|
||||
.click(function() {
|
||||
if(!$(this).hasClass('disabled')) {
|
||||
Button.cooldown($(this));
|
||||
$(this).data("handler")($(this));
|
||||
}
|
||||
})
|
||||
.data("handler", typeof options.click == 'function' ? options.click : function() { Engine.log("click"); })
|
||||
.data("remaining", 0)
|
||||
.data("cooldown", typeof options.cooldown == 'number' ? options.cooldown : 0);
|
||||
|
||||
el.append($("<div>").addClass('cooldown'));
|
||||
|
||||
if(options.cost) {
|
||||
var ttPos = options.ttPos ? options.ttPos : "bottom right";
|
||||
var costTooltip = $('<div>').addClass('tooltip ' + ttPos);
|
||||
for(var k in options.cost) {
|
||||
$("<div>").addClass('row_key').text(_(k)).appendTo(costTooltip);
|
||||
$("<div>").addClass('row_val').text(options.cost[k]).appendTo(costTooltip);
|
||||
}
|
||||
if(costTooltip.children().length > 0) {
|
||||
costTooltip.appendTo(el);
|
||||
}
|
||||
}
|
||||
|
||||
if(options.width) {
|
||||
el.css('width', options.width);
|
||||
}
|
||||
|
||||
return el;
|
||||
},
|
||||
|
||||
setDisabled: function(btn, disabled) {
|
||||
if(btn) {
|
||||
if(!disabled && !btn.data('onCooldown')) {
|
||||
btn.removeClass('disabled');
|
||||
} else if(disabled) {
|
||||
btn.addClass('disabled');
|
||||
}
|
||||
btn.data('disabled', disabled);
|
||||
}
|
||||
},
|
||||
|
||||
isDisabled: function(btn) {
|
||||
if(btn) {
|
||||
return btn.data('disabled') === true;
|
||||
}
|
||||
return false;
|
||||
},
|
||||
|
||||
cooldown: function(btn) {
|
||||
var cd = btn.data("cooldown");
|
||||
if(cd > 0) {
|
||||
$('div.cooldown', btn).stop(true, true).width("100%").animate({width: '0%'}, cd * 1000, 'linear', function() {
|
||||
var b = $(this).closest('.button');
|
||||
b.data('onCooldown', false);
|
||||
if(!b.data('disabled')) {
|
||||
b.removeClass('disabled');
|
||||
}
|
||||
});
|
||||
btn.addClass('disabled');
|
||||
btn.data('onCooldown', true);
|
||||
}
|
||||
},
|
||||
|
||||
clearCooldown: function(btn) {
|
||||
$('div.cooldown', btn).stop(true, true);
|
||||
btn.data('onCooldown', false);
|
||||
if(!btn.data('disabled')) {
|
||||
btn.removeClass('disabled');
|
||||
}
|
||||
}
|
||||
var Button = {
|
||||
Button: function(options) {
|
||||
if(typeof options.cooldown == 'number') {
|
||||
this.data_cooldown = options.cooldown;
|
||||
}
|
||||
this.data_remaining = 0;
|
||||
if(typeof options.click == 'function') {
|
||||
this.data_handler = options.click;
|
||||
}
|
||||
|
||||
var el = $('<div>')
|
||||
.attr('id', typeof(options.id) != 'undefined' ? options.id : "BTN_" + Engine.getGuid())
|
||||
.addClass('button')
|
||||
.text(typeof(options.text) != 'undefined' ? options.text : "button")
|
||||
.click(function() {
|
||||
if(!$(this).hasClass('disabled')) {
|
||||
Button.cooldown($(this));
|
||||
$(this).data("handler")($(this));
|
||||
}
|
||||
})
|
||||
.data("handler", typeof options.click == 'function' ? options.click : function() { Engine.log("click"); })
|
||||
.data("remaining", 0)
|
||||
.data("cooldown", typeof options.cooldown == 'number' ? options.cooldown : 0);
|
||||
|
||||
el.append($("<div>").addClass('cooldown'));
|
||||
|
||||
if(options.cost) {
|
||||
var ttPos = options.ttPos ? options.ttPos : "bottom right";
|
||||
var costTooltip = $('<div>').addClass('tooltip ' + ttPos);
|
||||
for(var k in options.cost) {
|
||||
$("<div>").addClass('row_key').text(_(k)).appendTo(costTooltip);
|
||||
$("<div>").addClass('row_val').text(options.cost[k]).appendTo(costTooltip);
|
||||
}
|
||||
if(costTooltip.children().length > 0) {
|
||||
costTooltip.appendTo(el);
|
||||
}
|
||||
}
|
||||
|
||||
if(options.width) {
|
||||
el.css('width', options.width);
|
||||
}
|
||||
|
||||
return el;
|
||||
},
|
||||
|
||||
setDisabled: function(btn, disabled) {
|
||||
if(btn) {
|
||||
if(!disabled && !btn.data('onCooldown')) {
|
||||
btn.removeClass('disabled');
|
||||
} else if(disabled) {
|
||||
btn.addClass('disabled');
|
||||
}
|
||||
btn.data('disabled', disabled);
|
||||
}
|
||||
},
|
||||
|
||||
isDisabled: function(btn) {
|
||||
if(btn) {
|
||||
return btn.data('disabled') === true;
|
||||
}
|
||||
return false;
|
||||
},
|
||||
|
||||
cooldown: function(btn) {
|
||||
var cd = btn.data("cooldown");
|
||||
if(cd > 0) {
|
||||
$('div.cooldown', btn).stop(true, true).width("100%").animate({width: '0%'}, cd * 1000, 'linear', function() {
|
||||
var b = $(this).closest('.button');
|
||||
b.data('onCooldown', false);
|
||||
if(!b.data('disabled')) {
|
||||
b.removeClass('disabled');
|
||||
}
|
||||
});
|
||||
btn.addClass('disabled');
|
||||
btn.data('onCooldown', true);
|
||||
}
|
||||
},
|
||||
|
||||
clearCooldown: function(btn) {
|
||||
$('div.cooldown', btn).stop(true, true);
|
||||
btn.data('onCooldown', false);
|
||||
if(!btn.data('disabled')) {
|
||||
btn.removeClass('disabled');
|
||||
}
|
||||
}
|
||||
};
|
||||
+361
-361
@@ -1,362 +1,362 @@
|
||||
(function (Engine, Events, Dropbox, $) {
|
||||
|
||||
/**
|
||||
* Module that enables a save of the gamestate to the dropbox datastore
|
||||
* @see https://www.dropbox.com/developers/datastore
|
||||
*
|
||||
* The dropbox datastore (dbds) connector lets you save your data to your own dropbox datastore
|
||||
* without jamming files to it.
|
||||
*
|
||||
* This connector uses the game engines own base64 encoder.
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
if (!Engine) { return false; } // Game Engine not available
|
||||
if (!Dropbox) { return false; } // Dropbox Connector not available
|
||||
|
||||
var DropboxConnector = {
|
||||
|
||||
options: {
|
||||
log: false,
|
||||
key: 'q7vyvfsakyfmp3o',
|
||||
table: 'adarkroom'
|
||||
},
|
||||
|
||||
client: false,
|
||||
table: false,
|
||||
dropboxAccount: false,
|
||||
savegameKey: false,
|
||||
savegames: {0: null, 1: null, 2: null, 3: null, 4: null},
|
||||
|
||||
init: function (options) {
|
||||
this.options = $.extend(
|
||||
this.options,
|
||||
options
|
||||
);
|
||||
|
||||
this._log = this.options.log;
|
||||
|
||||
this.client = new Dropbox.Client({key: DropboxConnector.options.key});
|
||||
this.connectToDropbox(false);
|
||||
|
||||
return this;
|
||||
},
|
||||
|
||||
startDropbox: function () {
|
||||
if (!DropboxConnector.client || !DropboxConnector.table) {
|
||||
DropboxConnector.startDropboxConnectEvent();
|
||||
} else {
|
||||
DropboxConnector.startDropboxImportEvent();
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* ******
|
||||
* Events
|
||||
* ******
|
||||
*/
|
||||
|
||||
startDropboxConnectEvent: function () {
|
||||
Events.startEvent({
|
||||
title: _('Dropbox connection'),
|
||||
scenes: {
|
||||
start: {
|
||||
text: [_('connect game to dropbox local storage')],
|
||||
buttons: {
|
||||
'connect': {
|
||||
text: _('connect'),
|
||||
nextScene: 'end',
|
||||
onChoose: function () {
|
||||
DropboxConnector.connectToDropbox(DropboxConnector.startDropboxImportEvent);
|
||||
}
|
||||
},
|
||||
'cancel': {
|
||||
text: _('cancel'),
|
||||
nextScene: 'end'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
startDropboxImportEvent: function () {
|
||||
Events.startEvent({
|
||||
title: _('Dropbox Export / Import'),
|
||||
scenes: {
|
||||
start: {
|
||||
text: [_('export or import save data to dropbox datastorage'),
|
||||
_('your are connected to dropbox with account / email ') + DropboxConnector.dropboxAccount],
|
||||
buttons: {
|
||||
'save': {
|
||||
text: _('save'),
|
||||
nextScene: {1: 'saveToSlot'}
|
||||
},
|
||||
'load': {
|
||||
text: _('load'),
|
||||
nextScene: {1: 'loadFromSlot'},
|
||||
onChoose: DropboxConnector.loadGamesFromDropbox
|
||||
},
|
||||
'signout': {
|
||||
text: _('signout'),
|
||||
nextScene: 'end',
|
||||
onChoose: DropboxConnector.signout
|
||||
},
|
||||
'cancel': {
|
||||
text: _('cancel'),
|
||||
nextScene: 'end'
|
||||
}
|
||||
}
|
||||
},
|
||||
saveToSlot: {
|
||||
text: [_('choose one slot to save to')],
|
||||
buttons: (function () {
|
||||
var buttons = {};
|
||||
|
||||
$.each(DropboxConnector.savegames, function (n, savegame) {
|
||||
buttons['savegame' + n] = {
|
||||
text: _('save to slot') + n + ' ' + (savegame ? DropboxConnector.prepareSaveDate(savegame.get('timestamp')) : 'empty'),
|
||||
nextScene: 'end',
|
||||
onChoose: function () {
|
||||
DropboxConnector.log('Save to slot ' + n + ' initiated');
|
||||
// timeout prevents error due to fade out animation of the previous event
|
||||
window.setTimeout(function () {
|
||||
DropboxConnector.log('Save to slot ' + n);
|
||||
DropboxConnector.saveGameToDropbox(n, DropboxConnector.savedtoDropboxEvent);
|
||||
}, 1000);
|
||||
}
|
||||
};
|
||||
});
|
||||
|
||||
buttons.cancel = {
|
||||
text: _('cancel'),
|
||||
nextScene: 'end'
|
||||
};
|
||||
|
||||
return buttons;
|
||||
}())
|
||||
},
|
||||
loadFromSlot: {
|
||||
text: [_('choose one slot to load from')],
|
||||
buttons: (function () {
|
||||
var buttons = {};
|
||||
|
||||
$.each(DropboxConnector.savegames, function (n, savegame) {
|
||||
if (savegame) {
|
||||
buttons['savegame' + n] = {
|
||||
text: _('load from slot') + n + ' ' + DropboxConnector.prepareSaveDate(savegame.get('timestamp')),
|
||||
nextScene: 'end',
|
||||
onChoose: function () {
|
||||
DropboxConnector.log('Load from slot ' + n + ' initiated');
|
||||
// timeout prevents error due to fade out animation of the previous event
|
||||
window.setTimeout(function () {
|
||||
DropboxConnector.log('Load from slot ' + n);
|
||||
DropboxConnector.loadGameFromDropbox(n);
|
||||
}, 1000);
|
||||
}
|
||||
};
|
||||
}
|
||||
});
|
||||
|
||||
buttons.cancel = {
|
||||
text: _('cancel'),
|
||||
nextScene: 'end'
|
||||
};
|
||||
|
||||
return buttons;
|
||||
}())
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
savedtoDropboxEvent: function (success) {
|
||||
Events.startEvent({
|
||||
title: _('Dropbox Export / Import'),
|
||||
scenes: {
|
||||
start: {
|
||||
text: success ? [_('successfully saved to dropbox datastorage')] :
|
||||
[_('error while saving to dropbox datastorage')],
|
||||
buttons: {
|
||||
'ok': {
|
||||
text: _('ok'),
|
||||
nextScene: 'end'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* ***************
|
||||
* functional code
|
||||
* ***************
|
||||
*/
|
||||
|
||||
/**
|
||||
* Initiate dropbox connection
|
||||
*
|
||||
* @param interactive
|
||||
* @param callback
|
||||
*/
|
||||
connectToDropbox: function (interactive, callback) {
|
||||
|
||||
DropboxConnector.log('start dropbox');
|
||||
|
||||
var client = this.client;
|
||||
|
||||
client.authenticate({interactive: interactive}, function (error) {
|
||||
if (error) {
|
||||
DropboxConnector.log('Dropbox Authentication error: ' + error);
|
||||
}
|
||||
});
|
||||
|
||||
if (client.isAuthenticated()) {
|
||||
|
||||
var datastoreManager = client.getDatastoreManager();
|
||||
datastoreManager.openDefaultDatastore(function (error, datastore) {
|
||||
if (error) {
|
||||
DropboxConnector.log('Error opening default datastore: ' + error);
|
||||
} else {
|
||||
DropboxConnector.table = datastore.getTable(DropboxConnector.options.table);
|
||||
DropboxConnector.loadGamesFromDropbox();
|
||||
|
||||
DropboxConnector.log(DropboxConnector.client.credentials());
|
||||
|
||||
DropboxConnector.client.getAccountInfo({}, function (error, info) {
|
||||
if (!error) {
|
||||
DropboxConnector.dropboxAccount = info.email;
|
||||
}
|
||||
});
|
||||
|
||||
DropboxConnector.log("Got savegames", DropboxConnector.savegames);
|
||||
|
||||
if (typeof callback === "function") {
|
||||
callback.call(DropboxConnector.table);
|
||||
}
|
||||
}
|
||||
});
|
||||
} else {
|
||||
DropboxConnector.log('Not connected to dropbox.');
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Requests your savegames fom dbds
|
||||
*
|
||||
* @returns {*}
|
||||
*/
|
||||
loadGamesFromDropbox: function () {
|
||||
var savegames = DropboxConnector.savegames;
|
||||
|
||||
$.each(savegames, function (n) {
|
||||
var results = DropboxConnector.table.query({savegameId: DropboxConnector.prepareSavegameID(n)});
|
||||
savegames[n] = results[0];
|
||||
});
|
||||
|
||||
return savegames;
|
||||
},
|
||||
|
||||
/**
|
||||
* Imports a gamestate of a given slotnumber to your game
|
||||
*
|
||||
* @param slotnumber
|
||||
*/
|
||||
loadGameFromDropbox: function (slotnumber) {
|
||||
|
||||
var table = DropboxConnector.table;
|
||||
var id = DropboxConnector.prepareSavegameID(slotnumber);
|
||||
var results = table.query({savegameId: id});
|
||||
var record = results[0];
|
||||
|
||||
if (record && record.get('gameState')) {
|
||||
Engine.import64(record.get('gameState'));
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Saves a gamestate to a given slot in dbds
|
||||
*
|
||||
* @param slotnumber
|
||||
* @param callback
|
||||
*/
|
||||
saveGameToDropbox: function (slotnumber, callback) {
|
||||
|
||||
var table = DropboxConnector.table;
|
||||
var record = null;
|
||||
var success = false;
|
||||
var id = DropboxConnector.prepareSavegameID(slotnumber);
|
||||
|
||||
var saveGame = {
|
||||
gameState: Engine.generateExport64(),
|
||||
timestamp: new Date().getTime()
|
||||
};
|
||||
|
||||
if (DropboxConnector.savegames[slotnumber]) { // slot aleady used -> overwrite
|
||||
record = DropboxConnector.savegames[slotnumber];
|
||||
try {
|
||||
record.update(saveGame);
|
||||
DropboxConnector.log("Updated savegame ", slotnumber);
|
||||
success = true;
|
||||
} catch (e) {
|
||||
success = false;
|
||||
}
|
||||
|
||||
} else {
|
||||
saveGame.savegameId = id;
|
||||
try {
|
||||
record = table.insert(saveGame);
|
||||
DropboxConnector.log("Inserted savegame ", record.getId());
|
||||
success = true;
|
||||
} catch (e) {
|
||||
success = false;
|
||||
}
|
||||
}
|
||||
if (typeof callback === "function") {
|
||||
callback(success);
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Terminates the connection to your db account
|
||||
*/
|
||||
signout: function () {
|
||||
DropboxConnector.client.signOut({}, function (error) {
|
||||
if (error) {
|
||||
alert('Error while logout from dropbox');
|
||||
} else {
|
||||
alert('Successfully signed out.');
|
||||
DropboxConnector.client = null;
|
||||
DropboxConnector.savegames = null;
|
||||
DropboxConnector.dropboxAccount = null;
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* **************
|
||||
* Helper methods
|
||||
* **************
|
||||
*/
|
||||
|
||||
prepareSavegameID: function (slotnumber) {
|
||||
return 'adarkroom_savegame_' + slotnumber;
|
||||
},
|
||||
|
||||
prepareSaveDate: function (timestamp) {
|
||||
var date = new Date(timestamp);
|
||||
return date.toLocaleDateString() + ' ' + date.toLocaleTimeString();
|
||||
},
|
||||
|
||||
log: function () {
|
||||
if (this._log) {
|
||||
console.log(arguments);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
Engine.Dropbox = DropboxConnector;
|
||||
|
||||
(function (Engine, Events, Dropbox, $) {
|
||||
|
||||
/**
|
||||
* Module that enables a save of the gamestate to the dropbox datastore
|
||||
* @see https://www.dropbox.com/developers/datastore
|
||||
*
|
||||
* The dropbox datastore (dbds) connector lets you save your data to your own dropbox datastore
|
||||
* without jamming files to it.
|
||||
*
|
||||
* This connector uses the game engines own base64 encoder.
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
if (!Engine) { return false; } // Game Engine not available
|
||||
if (!Dropbox) { return false; } // Dropbox Connector not available
|
||||
|
||||
var DropboxConnector = {
|
||||
|
||||
options: {
|
||||
log: false,
|
||||
key: 'q7vyvfsakyfmp3o',
|
||||
table: 'adarkroom'
|
||||
},
|
||||
|
||||
client: false,
|
||||
table: false,
|
||||
dropboxAccount: false,
|
||||
savegameKey: false,
|
||||
savegames: {0: null, 1: null, 2: null, 3: null, 4: null},
|
||||
|
||||
init: function (options) {
|
||||
this.options = $.extend(
|
||||
this.options,
|
||||
options
|
||||
);
|
||||
|
||||
this._log = this.options.log;
|
||||
|
||||
this.client = new Dropbox.Client({key: DropboxConnector.options.key});
|
||||
this.connectToDropbox(false);
|
||||
|
||||
return this;
|
||||
},
|
||||
|
||||
startDropbox: function () {
|
||||
if (!DropboxConnector.client || !DropboxConnector.table) {
|
||||
DropboxConnector.startDropboxConnectEvent();
|
||||
} else {
|
||||
DropboxConnector.startDropboxImportEvent();
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* ******
|
||||
* Events
|
||||
* ******
|
||||
*/
|
||||
|
||||
startDropboxConnectEvent: function () {
|
||||
Events.startEvent({
|
||||
title: _('Dropbox connection'),
|
||||
scenes: {
|
||||
start: {
|
||||
text: [_('connect game to dropbox local storage')],
|
||||
buttons: {
|
||||
'connect': {
|
||||
text: _('connect'),
|
||||
nextScene: 'end',
|
||||
onChoose: function () {
|
||||
DropboxConnector.connectToDropbox(DropboxConnector.startDropboxImportEvent);
|
||||
}
|
||||
},
|
||||
'cancel': {
|
||||
text: _('cancel'),
|
||||
nextScene: 'end'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
startDropboxImportEvent: function () {
|
||||
Events.startEvent({
|
||||
title: _('Dropbox Export / Import'),
|
||||
scenes: {
|
||||
start: {
|
||||
text: [_('export or import save data to dropbox datastorage'),
|
||||
_('your are connected to dropbox with account / email ') + DropboxConnector.dropboxAccount],
|
||||
buttons: {
|
||||
'save': {
|
||||
text: _('save'),
|
||||
nextScene: {1: 'saveToSlot'}
|
||||
},
|
||||
'load': {
|
||||
text: _('load'),
|
||||
nextScene: {1: 'loadFromSlot'},
|
||||
onChoose: DropboxConnector.loadGamesFromDropbox
|
||||
},
|
||||
'signout': {
|
||||
text: _('signout'),
|
||||
nextScene: 'end',
|
||||
onChoose: DropboxConnector.signout
|
||||
},
|
||||
'cancel': {
|
||||
text: _('cancel'),
|
||||
nextScene: 'end'
|
||||
}
|
||||
}
|
||||
},
|
||||
saveToSlot: {
|
||||
text: [_('choose one slot to save to')],
|
||||
buttons: (function () {
|
||||
var buttons = {};
|
||||
|
||||
$.each(DropboxConnector.savegames, function (n, savegame) {
|
||||
buttons['savegame' + n] = {
|
||||
text: _('save to slot') + n + ' ' + (savegame ? DropboxConnector.prepareSaveDate(savegame.get('timestamp')) : 'empty'),
|
||||
nextScene: 'end',
|
||||
onChoose: function () {
|
||||
DropboxConnector.log('Save to slot ' + n + ' initiated');
|
||||
// timeout prevents error due to fade out animation of the previous event
|
||||
window.setTimeout(function () {
|
||||
DropboxConnector.log('Save to slot ' + n);
|
||||
DropboxConnector.saveGameToDropbox(n, DropboxConnector.savedtoDropboxEvent);
|
||||
}, 1000);
|
||||
}
|
||||
};
|
||||
});
|
||||
|
||||
buttons.cancel = {
|
||||
text: _('cancel'),
|
||||
nextScene: 'end'
|
||||
};
|
||||
|
||||
return buttons;
|
||||
}())
|
||||
},
|
||||
loadFromSlot: {
|
||||
text: [_('choose one slot to load from')],
|
||||
buttons: (function () {
|
||||
var buttons = {};
|
||||
|
||||
$.each(DropboxConnector.savegames, function (n, savegame) {
|
||||
if (savegame) {
|
||||
buttons['savegame' + n] = {
|
||||
text: _('load from slot') + n + ' ' + DropboxConnector.prepareSaveDate(savegame.get('timestamp')),
|
||||
nextScene: 'end',
|
||||
onChoose: function () {
|
||||
DropboxConnector.log('Load from slot ' + n + ' initiated');
|
||||
// timeout prevents error due to fade out animation of the previous event
|
||||
window.setTimeout(function () {
|
||||
DropboxConnector.log('Load from slot ' + n);
|
||||
DropboxConnector.loadGameFromDropbox(n);
|
||||
}, 1000);
|
||||
}
|
||||
};
|
||||
}
|
||||
});
|
||||
|
||||
buttons.cancel = {
|
||||
text: _('cancel'),
|
||||
nextScene: 'end'
|
||||
};
|
||||
|
||||
return buttons;
|
||||
}())
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
savedtoDropboxEvent: function (success) {
|
||||
Events.startEvent({
|
||||
title: _('Dropbox Export / Import'),
|
||||
scenes: {
|
||||
start: {
|
||||
text: success ? [_('successfully saved to dropbox datastorage')] :
|
||||
[_('error while saving to dropbox datastorage')],
|
||||
buttons: {
|
||||
'ok': {
|
||||
text: _('ok'),
|
||||
nextScene: 'end'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* ***************
|
||||
* functional code
|
||||
* ***************
|
||||
*/
|
||||
|
||||
/**
|
||||
* Initiate dropbox connection
|
||||
*
|
||||
* @param interactive
|
||||
* @param callback
|
||||
*/
|
||||
connectToDropbox: function (interactive, callback) {
|
||||
|
||||
DropboxConnector.log('start dropbox');
|
||||
|
||||
var client = this.client;
|
||||
|
||||
client.authenticate({interactive: interactive}, function (error) {
|
||||
if (error) {
|
||||
DropboxConnector.log('Dropbox Authentication error: ' + error);
|
||||
}
|
||||
});
|
||||
|
||||
if (client.isAuthenticated()) {
|
||||
|
||||
var datastoreManager = client.getDatastoreManager();
|
||||
datastoreManager.openDefaultDatastore(function (error, datastore) {
|
||||
if (error) {
|
||||
DropboxConnector.log('Error opening default datastore: ' + error);
|
||||
} else {
|
||||
DropboxConnector.table = datastore.getTable(DropboxConnector.options.table);
|
||||
DropboxConnector.loadGamesFromDropbox();
|
||||
|
||||
DropboxConnector.log(DropboxConnector.client.credentials());
|
||||
|
||||
DropboxConnector.client.getAccountInfo({}, function (error, info) {
|
||||
if (!error) {
|
||||
DropboxConnector.dropboxAccount = info.email;
|
||||
}
|
||||
});
|
||||
|
||||
DropboxConnector.log("Got savegames", DropboxConnector.savegames);
|
||||
|
||||
if (typeof callback === "function") {
|
||||
callback.call(DropboxConnector.table);
|
||||
}
|
||||
}
|
||||
});
|
||||
} else {
|
||||
DropboxConnector.log('Not connected to dropbox.');
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Requests your savegames fom dbds
|
||||
*
|
||||
* @returns {*}
|
||||
*/
|
||||
loadGamesFromDropbox: function () {
|
||||
var savegames = DropboxConnector.savegames;
|
||||
|
||||
$.each(savegames, function (n) {
|
||||
var results = DropboxConnector.table.query({savegameId: DropboxConnector.prepareSavegameID(n)});
|
||||
savegames[n] = results[0];
|
||||
});
|
||||
|
||||
return savegames;
|
||||
},
|
||||
|
||||
/**
|
||||
* Imports a gamestate of a given slotnumber to your game
|
||||
*
|
||||
* @param slotnumber
|
||||
*/
|
||||
loadGameFromDropbox: function (slotnumber) {
|
||||
|
||||
var table = DropboxConnector.table;
|
||||
var id = DropboxConnector.prepareSavegameID(slotnumber);
|
||||
var results = table.query({savegameId: id});
|
||||
var record = results[0];
|
||||
|
||||
if (record && record.get('gameState')) {
|
||||
Engine.import64(record.get('gameState'));
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Saves a gamestate to a given slot in dbds
|
||||
*
|
||||
* @param slotnumber
|
||||
* @param callback
|
||||
*/
|
||||
saveGameToDropbox: function (slotnumber, callback) {
|
||||
|
||||
var table = DropboxConnector.table;
|
||||
var record = null;
|
||||
var success = false;
|
||||
var id = DropboxConnector.prepareSavegameID(slotnumber);
|
||||
|
||||
var saveGame = {
|
||||
gameState: Engine.generateExport64(),
|
||||
timestamp: new Date().getTime()
|
||||
};
|
||||
|
||||
if (DropboxConnector.savegames[slotnumber]) { // slot aleady used -> overwrite
|
||||
record = DropboxConnector.savegames[slotnumber];
|
||||
try {
|
||||
record.update(saveGame);
|
||||
DropboxConnector.log("Updated savegame ", slotnumber);
|
||||
success = true;
|
||||
} catch (e) {
|
||||
success = false;
|
||||
}
|
||||
|
||||
} else {
|
||||
saveGame.savegameId = id;
|
||||
try {
|
||||
record = table.insert(saveGame);
|
||||
DropboxConnector.log("Inserted savegame ", record.getId());
|
||||
success = true;
|
||||
} catch (e) {
|
||||
success = false;
|
||||
}
|
||||
}
|
||||
if (typeof callback === "function") {
|
||||
callback(success);
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Terminates the connection to your db account
|
||||
*/
|
||||
signout: function () {
|
||||
DropboxConnector.client.signOut({}, function (error) {
|
||||
if (error) {
|
||||
alert('Error while logout from dropbox');
|
||||
} else {
|
||||
alert('Successfully signed out.');
|
||||
DropboxConnector.client = null;
|
||||
DropboxConnector.savegames = null;
|
||||
DropboxConnector.dropboxAccount = null;
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* **************
|
||||
* Helper methods
|
||||
* **************
|
||||
*/
|
||||
|
||||
prepareSavegameID: function (slotnumber) {
|
||||
return 'adarkroom_savegame_' + slotnumber;
|
||||
},
|
||||
|
||||
prepareSaveDate: function (timestamp) {
|
||||
var date = new Date(timestamp);
|
||||
return date.toLocaleDateString() + ' ' + date.toLocaleTimeString();
|
||||
},
|
||||
|
||||
log: function () {
|
||||
if (this._log) {
|
||||
console.log(arguments);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
Engine.Dropbox = DropboxConnector;
|
||||
|
||||
})(Engine, Events, Dropbox, jQuery);
|
||||
+43
-4
@@ -605,30 +605,42 @@
|
||||
switch(e.which) {
|
||||
case 38: // Up
|
||||
case 87:
|
||||
if(Engine.activeModule == Outside || Engine.activeModule == Path) {
|
||||
Engine.activeModule.scrollSidebar('up');
|
||||
}
|
||||
Engine.log('up');
|
||||
break;
|
||||
case 40: // Down
|
||||
case 83:
|
||||
if (Engine.activeModule == Outside || Engine.activeModule == Path) {
|
||||
Engine.activeModule.scrollSidebar('down');
|
||||
}
|
||||
Engine.log('down');
|
||||
break;
|
||||
case 37: // Left
|
||||
case 65:
|
||||
if(Engine.activeModule == Ship && Path.tab)
|
||||
Engine.travelTo(Path);
|
||||
else if(Engine.activeModule == Path && Outside.tab)
|
||||
else if(Engine.activeModule == Path && Outside.tab){
|
||||
Engine.activeModule.scrollSidebar('left', true);
|
||||
Engine.travelTo(Outside);
|
||||
else if(Engine.activeModule == Outside && Room.tab)
|
||||
}else if(Engine.activeModule == Outside && Room.tab){
|
||||
Engine.activeModule.scrollSidebar('left', true);
|
||||
Engine.travelTo(Room);
|
||||
}
|
||||
Engine.log('left');
|
||||
break;
|
||||
case 39: // Right
|
||||
case 68:
|
||||
if(Engine.activeModule == Room && Outside.tab)
|
||||
Engine.travelTo(Outside);
|
||||
else if(Engine.activeModule == Outside && Path.tab)
|
||||
else if(Engine.activeModule == Outside && Path.tab){
|
||||
Engine.activeModule.scrollSidebar('right', true);
|
||||
Engine.travelTo(Path);
|
||||
else if(Engine.activeModule == Path && Ship.tab)
|
||||
}else if(Engine.activeModule == Path && Ship.tab){
|
||||
Engine.activeModule.scrollSidebar('right', true);
|
||||
Engine.travelTo(Ship);
|
||||
}
|
||||
Engine.log('right');
|
||||
break;
|
||||
}
|
||||
@@ -718,6 +730,33 @@
|
||||
|
||||
})();
|
||||
|
||||
function inView(dir, elem){
|
||||
|
||||
var scTop = $('#main').offset().top;
|
||||
var scBot = scTop + $('#main').height();
|
||||
|
||||
var elTop = elem.offset().top;
|
||||
var elBot = elTop + elem.height();
|
||||
|
||||
if( dir == 'up' ){
|
||||
// STOP MOVING IF BOTTOM OF ELEMENT IS VISIBLE IN SCREEN
|
||||
return ( elBot < scBot );
|
||||
}else if( dir == 'down' ){
|
||||
return ( elTop > scTop );
|
||||
}else{
|
||||
return ( ( elBot <= scBot ) && ( elTop >= scTop ) );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function scrollByX(elem, x){
|
||||
|
||||
var elTop = parseInt( elem.css('top'), 10 );
|
||||
elem.css( 'top', ( elTop + x ) + "px" );
|
||||
|
||||
}
|
||||
|
||||
|
||||
//create jQuery Callbacks() to handle object events
|
||||
$.Dispatch = function( id ) {
|
||||
var callbacks, topic = id && Engine.topics[ id ];
|
||||
|
||||
+400
-400
@@ -1,400 +1,400 @@
|
||||
/**
|
||||
* Events that can occur when wandering around the world
|
||||
**/
|
||||
Events.Encounters = [
|
||||
/* Tier 1 */
|
||||
{ /* Snarling Beast */
|
||||
title: _('A Snarling Beast'),
|
||||
isAvailable: function() {
|
||||
return World.getDistance() <= 10 && World.getTerrain() == World.TILE.FOREST;
|
||||
},
|
||||
scenes: {
|
||||
'start': {
|
||||
combat: true,
|
||||
enemy: 'snarling beast',
|
||||
enemyName: _('snarling beast'),
|
||||
deathMessage: _('the snarling beast is dead'),
|
||||
chara: 'B',
|
||||
damage: 1,
|
||||
hit: 0.8,
|
||||
attackDelay: 1,
|
||||
health: 5,
|
||||
loot: {
|
||||
'fur': {
|
||||
min: 1,
|
||||
max: 3,
|
||||
chance: 1
|
||||
},
|
||||
'meat': {
|
||||
min: 1,
|
||||
max: 3,
|
||||
chance: 1
|
||||
},
|
||||
'teeth': {
|
||||
min: 1,
|
||||
max: 3,
|
||||
chance: 0.8
|
||||
}
|
||||
},
|
||||
notification: _('a snarling beast leaps out of the underbrush')
|
||||
}
|
||||
}
|
||||
},
|
||||
{ /* Gaunt Man */
|
||||
title: _('A Gaunt Man'),
|
||||
isAvailable: function() {
|
||||
return World.getDistance() <= 10 && World.getTerrain() == World.TILE.BARRENS;
|
||||
},
|
||||
scenes: {
|
||||
'start': {
|
||||
combat: true,
|
||||
enemy: 'gaunt man',
|
||||
enemyName: _('gaunt man'),
|
||||
deathMessage: _('the gaunt man is dead'),
|
||||
chara: 'G',
|
||||
damage: 2,
|
||||
hit: 0.8,
|
||||
attackDelay: 2,
|
||||
health: 6,
|
||||
loot: {
|
||||
'cloth': {
|
||||
min: 1,
|
||||
max: 3,
|
||||
chance: 0.8
|
||||
},
|
||||
'teeth': {
|
||||
min: 1,
|
||||
max: 2,
|
||||
chance: 0.8
|
||||
},
|
||||
'leather': {
|
||||
min: 1,
|
||||
max: 2,
|
||||
chance: 0.5
|
||||
}
|
||||
},
|
||||
notification: _('a gaunt man approaches, a crazed look in his eye')
|
||||
}
|
||||
}
|
||||
},
|
||||
{ /* Strange Bird */
|
||||
title: _('A Strange Bird'),
|
||||
isAvailable: function() {
|
||||
return World.getDistance() <= 10 && World.getTerrain() == World.TILE.FIELD;
|
||||
},
|
||||
scenes: {
|
||||
'start': {
|
||||
combat: true,
|
||||
enemy: 'strange bird',
|
||||
enemyName: _('strange bird'),
|
||||
deathMessage: _('the strange bird is dead'),
|
||||
chara: 'B',
|
||||
damage: 3,
|
||||
hit: 0.8,
|
||||
attackDelay: 2,
|
||||
health: 4,
|
||||
loot: {
|
||||
'scales': {
|
||||
min: 1,
|
||||
max: 3,
|
||||
chance: 0.8
|
||||
},
|
||||
'teeth': {
|
||||
min: 1,
|
||||
max: 2,
|
||||
chance: 0.5
|
||||
},
|
||||
'meat': {
|
||||
min: 1,
|
||||
max: 3,
|
||||
chance: 0.8
|
||||
}
|
||||
},
|
||||
notification: _('a strange looking bird speeds across the plains')
|
||||
}
|
||||
}
|
||||
},
|
||||
/* Tier 2*/
|
||||
{ /* Shivering Man */
|
||||
title: _('A Shivering Man'),
|
||||
isAvailable: function() {
|
||||
return World.getDistance() > 10 && World.getDistance() <= 20 && World.getTerrain() == World.TILE.BARRENS;
|
||||
},
|
||||
scenes: {
|
||||
'start': {
|
||||
combat: true,
|
||||
enemy: 'shivering man',
|
||||
enemyName: _('shivering man'),
|
||||
deathMessage: _('the shivering man is dead'),
|
||||
chara: 'S',
|
||||
damage: 5,
|
||||
hit: 0.5,
|
||||
attackDelay: 1,
|
||||
health: 20,
|
||||
loot: {
|
||||
'cloth': {
|
||||
min: 1,
|
||||
max: 1,
|
||||
chance: 0.2
|
||||
},
|
||||
'teeth': {
|
||||
min: 1,
|
||||
max: 2,
|
||||
chance: 0.8
|
||||
},
|
||||
'leather': {
|
||||
min: 1,
|
||||
max: 1,
|
||||
chance: 0.2
|
||||
},
|
||||
'medicine': {
|
||||
min: 1,
|
||||
max: 3,
|
||||
chance: 0.7
|
||||
}
|
||||
},
|
||||
notification: _('a shivering man approaches and attacks with surprising strength')
|
||||
}
|
||||
}
|
||||
},
|
||||
{ /* Man-eater */
|
||||
title: _('A Man-Eater'),
|
||||
isAvailable: function() {
|
||||
return World.getDistance() > 10 && World.getDistance() <= 20 && World.getTerrain() == World.TILE.FOREST;
|
||||
},
|
||||
scenes: {
|
||||
'start': {
|
||||
combat: true,
|
||||
enemy: 'man-eater',
|
||||
enemyName: _('man-eater'),
|
||||
deathMessage: _('the man-eater is dead'),
|
||||
chara: 'E',
|
||||
damage: 3,
|
||||
hit: 0.8,
|
||||
attackDelay: 1,
|
||||
health: 25,
|
||||
loot: {
|
||||
'fur': {
|
||||
min: 5,
|
||||
max: 10,
|
||||
chance: 1
|
||||
},
|
||||
'meat': {
|
||||
min: 5,
|
||||
max: 10,
|
||||
chance: 1
|
||||
},
|
||||
'teeth': {
|
||||
min: 5,
|
||||
max: 10,
|
||||
chance: 0.8
|
||||
}
|
||||
},
|
||||
notification: _('a large creature attacks, claws freshly bloodied')
|
||||
}
|
||||
}
|
||||
},
|
||||
{ /* Scavenger */
|
||||
title: _('A Scavenger'),
|
||||
isAvailable: function() {
|
||||
return World.getDistance() > 10 && World.getDistance() <= 20 && World.getTerrain() == World.TILE.BARRENS;
|
||||
},
|
||||
scenes: {
|
||||
'start': {
|
||||
combat: true,
|
||||
enemy: 'scavenger',
|
||||
enemyName: _('scavenger'),
|
||||
deathMessage: _('the scavenger is dead'),
|
||||
chara: 'S',
|
||||
damage: 4,
|
||||
hit: 0.8,
|
||||
attackDelay: 2,
|
||||
health: 30,
|
||||
loot: {
|
||||
'cloth': {
|
||||
min: 5,
|
||||
max: 10,
|
||||
chance: 0.8
|
||||
},
|
||||
'leather': {
|
||||
min: 5,
|
||||
max: 10,
|
||||
chance: 0.8
|
||||
},
|
||||
'iron': {
|
||||
min: 1,
|
||||
max: 5,
|
||||
chance: 0.5
|
||||
},
|
||||
'medicine': {
|
||||
min: 1,
|
||||
max: 2,
|
||||
chance: 0.1
|
||||
}
|
||||
},
|
||||
notification: _('a scavenger draws close, hoping for an easy score')
|
||||
}
|
||||
}
|
||||
},
|
||||
{ /* Huge Lizard */
|
||||
title: _('A Huge Lizard'),
|
||||
isAvailable: function() {
|
||||
return World.getDistance() > 10 && World.getDistance() <= 20 && World.getTerrain() == World.TILE.FIELD;
|
||||
},
|
||||
scenes: {
|
||||
'start': {
|
||||
combat: true,
|
||||
enemy: 'lizard',
|
||||
enemyName: _('lizard'),
|
||||
deathMessage: _('the lizard is dead'),
|
||||
chara: 'L',
|
||||
damage: 5,
|
||||
hit: 0.8,
|
||||
attackDelay: 2,
|
||||
health: 20,
|
||||
loot: {
|
||||
'scales': {
|
||||
min: 5,
|
||||
max: 10,
|
||||
chance: 0.8
|
||||
},
|
||||
'teeth': {
|
||||
min: 5,
|
||||
max: 10,
|
||||
chance: 0.5
|
||||
},
|
||||
'meat': {
|
||||
min: 5,
|
||||
max: 10,
|
||||
chance: 0.8
|
||||
}
|
||||
},
|
||||
notification: _('the grass thrashes wildly as a huge lizard pushes through')
|
||||
}
|
||||
}
|
||||
},
|
||||
/* Tier 3*/
|
||||
{ /* Feral Terror */
|
||||
title: _('A Feral Terror'),
|
||||
isAvailable: function() {
|
||||
return World.getDistance() > 20 && World.getTerrain() == World.TILE.FOREST;
|
||||
},
|
||||
scenes: {
|
||||
'start': {
|
||||
combat: true,
|
||||
enemy: 'feral terror',
|
||||
enemyName: _('feral terror'),
|
||||
deathMessage: _('the feral terror is dead'),
|
||||
chara: 'F',
|
||||
damage: 6,
|
||||
hit: 0.8,
|
||||
attackDelay: 1,
|
||||
health: 45,
|
||||
loot: {
|
||||
'fur': {
|
||||
min: 5,
|
||||
max: 10,
|
||||
chance: 1
|
||||
},
|
||||
'meat': {
|
||||
min: 5,
|
||||
max: 10,
|
||||
chance: 1
|
||||
},
|
||||
'teeth': {
|
||||
min: 5,
|
||||
max: 10,
|
||||
chance: 0.8
|
||||
}
|
||||
},
|
||||
notification: _('a beast, wilder than imagining, erupts out of the foliage')
|
||||
}
|
||||
}
|
||||
},
|
||||
{ /* Soldier */
|
||||
title: _('A Soldier'),
|
||||
isAvailable: function() {
|
||||
return World.getDistance() > 20 && World.getTerrain() == World.TILE.BARRENS;
|
||||
},
|
||||
scenes: {
|
||||
'start': {
|
||||
combat: true,
|
||||
enemy: 'soldier',
|
||||
enemyName: _('soldier'),
|
||||
deathMessage: _('the soldier is dead'),
|
||||
ranged: true,
|
||||
chara: 'D',
|
||||
damage: 8,
|
||||
hit: 0.8,
|
||||
attackDelay: 2,
|
||||
health: 50,
|
||||
loot: {
|
||||
'cloth': {
|
||||
min: 5,
|
||||
max: 10,
|
||||
chance: 0.8
|
||||
},
|
||||
'bullets': {
|
||||
min: 1,
|
||||
max: 5,
|
||||
chance: 0.5
|
||||
},
|
||||
'rifle': {
|
||||
min: 1,
|
||||
max: 1,
|
||||
chance: 0.2
|
||||
},
|
||||
'medicine': {
|
||||
min: 1,
|
||||
max: 2,
|
||||
chance: 0.1
|
||||
}
|
||||
},
|
||||
notification: _('a soldier opens fire from across the desert')
|
||||
}
|
||||
}
|
||||
},
|
||||
{ /* Sniper */
|
||||
title: _('A Sniper'),
|
||||
isAvailable: function() {
|
||||
return World.getDistance() > 20 && World.getTerrain() == World.TILE.FIELD;
|
||||
},
|
||||
scenes: {
|
||||
'start': {
|
||||
combat: true,
|
||||
enemy: 'sniper',
|
||||
enemyName: _('sniper'),
|
||||
deathMessage: _('the sniper is dead'),
|
||||
chara: 'S',
|
||||
damage: 15,
|
||||
hit: 0.8,
|
||||
attackDelay: 4,
|
||||
health: 30,
|
||||
ranged: true,
|
||||
loot: {
|
||||
'cloth': {
|
||||
min: 5,
|
||||
max: 10,
|
||||
chance: 0.8
|
||||
},
|
||||
'bullets': {
|
||||
min: 1,
|
||||
max: 5,
|
||||
chance: 0.5
|
||||
},
|
||||
'rifle': {
|
||||
min: 1,
|
||||
max: 1,
|
||||
chance: 0.2
|
||||
},
|
||||
'medicine': {
|
||||
min: 1,
|
||||
max: 2,
|
||||
chance: 0.1
|
||||
}
|
||||
},
|
||||
notification: _('a shot rings out, from somewhere in the long grass')
|
||||
}
|
||||
}
|
||||
}
|
||||
];
|
||||
/**
|
||||
* Events that can occur when wandering around the world
|
||||
**/
|
||||
Events.Encounters = [
|
||||
/* Tier 1 */
|
||||
{ /* Snarling Beast */
|
||||
title: _('A Snarling Beast'),
|
||||
isAvailable: function() {
|
||||
return World.getDistance() <= 10 && World.getTerrain() == World.TILE.FOREST;
|
||||
},
|
||||
scenes: {
|
||||
'start': {
|
||||
combat: true,
|
||||
enemy: 'snarling beast',
|
||||
enemyName: _('snarling beast'),
|
||||
deathMessage: _('the snarling beast is dead'),
|
||||
chara: 'B',
|
||||
damage: 1,
|
||||
hit: 0.8,
|
||||
attackDelay: 1,
|
||||
health: 5,
|
||||
loot: {
|
||||
'fur': {
|
||||
min: 1,
|
||||
max: 3,
|
||||
chance: 1
|
||||
},
|
||||
'meat': {
|
||||
min: 1,
|
||||
max: 3,
|
||||
chance: 1
|
||||
},
|
||||
'teeth': {
|
||||
min: 1,
|
||||
max: 3,
|
||||
chance: 0.8
|
||||
}
|
||||
},
|
||||
notification: _('a snarling beast leaps out of the underbrush')
|
||||
}
|
||||
}
|
||||
},
|
||||
{ /* Gaunt Man */
|
||||
title: _('A Gaunt Man'),
|
||||
isAvailable: function() {
|
||||
return World.getDistance() <= 10 && World.getTerrain() == World.TILE.BARRENS;
|
||||
},
|
||||
scenes: {
|
||||
'start': {
|
||||
combat: true,
|
||||
enemy: 'gaunt man',
|
||||
enemyName: _('gaunt man'),
|
||||
deathMessage: _('the gaunt man is dead'),
|
||||
chara: 'G',
|
||||
damage: 2,
|
||||
hit: 0.8,
|
||||
attackDelay: 2,
|
||||
health: 6,
|
||||
loot: {
|
||||
'cloth': {
|
||||
min: 1,
|
||||
max: 3,
|
||||
chance: 0.8
|
||||
},
|
||||
'teeth': {
|
||||
min: 1,
|
||||
max: 2,
|
||||
chance: 0.8
|
||||
},
|
||||
'leather': {
|
||||
min: 1,
|
||||
max: 2,
|
||||
chance: 0.5
|
||||
}
|
||||
},
|
||||
notification: _('a gaunt man approaches, a crazed look in his eye')
|
||||
}
|
||||
}
|
||||
},
|
||||
{ /* Strange Bird */
|
||||
title: _('A Strange Bird'),
|
||||
isAvailable: function() {
|
||||
return World.getDistance() <= 10 && World.getTerrain() == World.TILE.FIELD;
|
||||
},
|
||||
scenes: {
|
||||
'start': {
|
||||
combat: true,
|
||||
enemy: 'strange bird',
|
||||
enemyName: _('strange bird'),
|
||||
deathMessage: _('the strange bird is dead'),
|
||||
chara: 'B',
|
||||
damage: 3,
|
||||
hit: 0.8,
|
||||
attackDelay: 2,
|
||||
health: 4,
|
||||
loot: {
|
||||
'scales': {
|
||||
min: 1,
|
||||
max: 3,
|
||||
chance: 0.8
|
||||
},
|
||||
'teeth': {
|
||||
min: 1,
|
||||
max: 2,
|
||||
chance: 0.5
|
||||
},
|
||||
'meat': {
|
||||
min: 1,
|
||||
max: 3,
|
||||
chance: 0.8
|
||||
}
|
||||
},
|
||||
notification: _('a strange looking bird speeds across the plains')
|
||||
}
|
||||
}
|
||||
},
|
||||
/* Tier 2*/
|
||||
{ /* Shivering Man */
|
||||
title: _('A Shivering Man'),
|
||||
isAvailable: function() {
|
||||
return World.getDistance() > 10 && World.getDistance() <= 20 && World.getTerrain() == World.TILE.BARRENS;
|
||||
},
|
||||
scenes: {
|
||||
'start': {
|
||||
combat: true,
|
||||
enemy: 'shivering man',
|
||||
enemyName: _('shivering man'),
|
||||
deathMessage: _('the shivering man is dead'),
|
||||
chara: 'S',
|
||||
damage: 5,
|
||||
hit: 0.5,
|
||||
attackDelay: 1,
|
||||
health: 20,
|
||||
loot: {
|
||||
'cloth': {
|
||||
min: 1,
|
||||
max: 1,
|
||||
chance: 0.2
|
||||
},
|
||||
'teeth': {
|
||||
min: 1,
|
||||
max: 2,
|
||||
chance: 0.8
|
||||
},
|
||||
'leather': {
|
||||
min: 1,
|
||||
max: 1,
|
||||
chance: 0.2
|
||||
},
|
||||
'medicine': {
|
||||
min: 1,
|
||||
max: 3,
|
||||
chance: 0.7
|
||||
}
|
||||
},
|
||||
notification: _('a shivering man approaches and attacks with surprising strength')
|
||||
}
|
||||
}
|
||||
},
|
||||
{ /* Man-eater */
|
||||
title: _('A Man-Eater'),
|
||||
isAvailable: function() {
|
||||
return World.getDistance() > 10 && World.getDistance() <= 20 && World.getTerrain() == World.TILE.FOREST;
|
||||
},
|
||||
scenes: {
|
||||
'start': {
|
||||
combat: true,
|
||||
enemy: 'man-eater',
|
||||
enemyName: _('man-eater'),
|
||||
deathMessage: _('the man-eater is dead'),
|
||||
chara: 'E',
|
||||
damage: 3,
|
||||
hit: 0.8,
|
||||
attackDelay: 1,
|
||||
health: 25,
|
||||
loot: {
|
||||
'fur': {
|
||||
min: 5,
|
||||
max: 10,
|
||||
chance: 1
|
||||
},
|
||||
'meat': {
|
||||
min: 5,
|
||||
max: 10,
|
||||
chance: 1
|
||||
},
|
||||
'teeth': {
|
||||
min: 5,
|
||||
max: 10,
|
||||
chance: 0.8
|
||||
}
|
||||
},
|
||||
notification: _('a large creature attacks, claws freshly bloodied')
|
||||
}
|
||||
}
|
||||
},
|
||||
{ /* Scavenger */
|
||||
title: _('A Scavenger'),
|
||||
isAvailable: function() {
|
||||
return World.getDistance() > 10 && World.getDistance() <= 20 && World.getTerrain() == World.TILE.BARRENS;
|
||||
},
|
||||
scenes: {
|
||||
'start': {
|
||||
combat: true,
|
||||
enemy: 'scavenger',
|
||||
enemyName: _('scavenger'),
|
||||
deathMessage: _('the scavenger is dead'),
|
||||
chara: 'S',
|
||||
damage: 4,
|
||||
hit: 0.8,
|
||||
attackDelay: 2,
|
||||
health: 30,
|
||||
loot: {
|
||||
'cloth': {
|
||||
min: 5,
|
||||
max: 10,
|
||||
chance: 0.8
|
||||
},
|
||||
'leather': {
|
||||
min: 5,
|
||||
max: 10,
|
||||
chance: 0.8
|
||||
},
|
||||
'iron': {
|
||||
min: 1,
|
||||
max: 5,
|
||||
chance: 0.5
|
||||
},
|
||||
'medicine': {
|
||||
min: 1,
|
||||
max: 2,
|
||||
chance: 0.1
|
||||
}
|
||||
},
|
||||
notification: _('a scavenger draws close, hoping for an easy score')
|
||||
}
|
||||
}
|
||||
},
|
||||
{ /* Huge Lizard */
|
||||
title: _('A Huge Lizard'),
|
||||
isAvailable: function() {
|
||||
return World.getDistance() > 10 && World.getDistance() <= 20 && World.getTerrain() == World.TILE.FIELD;
|
||||
},
|
||||
scenes: {
|
||||
'start': {
|
||||
combat: true,
|
||||
enemy: 'lizard',
|
||||
enemyName: _('lizard'),
|
||||
deathMessage: _('the lizard is dead'),
|
||||
chara: 'L',
|
||||
damage: 5,
|
||||
hit: 0.8,
|
||||
attackDelay: 2,
|
||||
health: 20,
|
||||
loot: {
|
||||
'scales': {
|
||||
min: 5,
|
||||
max: 10,
|
||||
chance: 0.8
|
||||
},
|
||||
'teeth': {
|
||||
min: 5,
|
||||
max: 10,
|
||||
chance: 0.5
|
||||
},
|
||||
'meat': {
|
||||
min: 5,
|
||||
max: 10,
|
||||
chance: 0.8
|
||||
}
|
||||
},
|
||||
notification: _('the grass thrashes wildly as a huge lizard pushes through')
|
||||
}
|
||||
}
|
||||
},
|
||||
/* Tier 3*/
|
||||
{ /* Feral Terror */
|
||||
title: _('A Feral Terror'),
|
||||
isAvailable: function() {
|
||||
return World.getDistance() > 20 && World.getTerrain() == World.TILE.FOREST;
|
||||
},
|
||||
scenes: {
|
||||
'start': {
|
||||
combat: true,
|
||||
enemy: 'feral terror',
|
||||
enemyName: _('feral terror'),
|
||||
deathMessage: _('the feral terror is dead'),
|
||||
chara: 'F',
|
||||
damage: 6,
|
||||
hit: 0.8,
|
||||
attackDelay: 1,
|
||||
health: 45,
|
||||
loot: {
|
||||
'fur': {
|
||||
min: 5,
|
||||
max: 10,
|
||||
chance: 1
|
||||
},
|
||||
'meat': {
|
||||
min: 5,
|
||||
max: 10,
|
||||
chance: 1
|
||||
},
|
||||
'teeth': {
|
||||
min: 5,
|
||||
max: 10,
|
||||
chance: 0.8
|
||||
}
|
||||
},
|
||||
notification: _('a beast, wilder than imagining, erupts out of the foliage')
|
||||
}
|
||||
}
|
||||
},
|
||||
{ /* Soldier */
|
||||
title: _('A Soldier'),
|
||||
isAvailable: function() {
|
||||
return World.getDistance() > 20 && World.getTerrain() == World.TILE.BARRENS;
|
||||
},
|
||||
scenes: {
|
||||
'start': {
|
||||
combat: true,
|
||||
enemy: 'soldier',
|
||||
enemyName: _('soldier'),
|
||||
deathMessage: _('the soldier is dead'),
|
||||
ranged: true,
|
||||
chara: 'D',
|
||||
damage: 8,
|
||||
hit: 0.8,
|
||||
attackDelay: 2,
|
||||
health: 50,
|
||||
loot: {
|
||||
'cloth': {
|
||||
min: 5,
|
||||
max: 10,
|
||||
chance: 0.8
|
||||
},
|
||||
'bullets': {
|
||||
min: 1,
|
||||
max: 5,
|
||||
chance: 0.5
|
||||
},
|
||||
'rifle': {
|
||||
min: 1,
|
||||
max: 1,
|
||||
chance: 0.2
|
||||
},
|
||||
'medicine': {
|
||||
min: 1,
|
||||
max: 2,
|
||||
chance: 0.1
|
||||
}
|
||||
},
|
||||
notification: _('a soldier opens fire from across the desert')
|
||||
}
|
||||
}
|
||||
},
|
||||
{ /* Sniper */
|
||||
title: _('A Sniper'),
|
||||
isAvailable: function() {
|
||||
return World.getDistance() > 20 && World.getTerrain() == World.TILE.FIELD;
|
||||
},
|
||||
scenes: {
|
||||
'start': {
|
||||
combat: true,
|
||||
enemy: 'sniper',
|
||||
enemyName: _('sniper'),
|
||||
deathMessage: _('the sniper is dead'),
|
||||
chara: 'S',
|
||||
damage: 15,
|
||||
hit: 0.8,
|
||||
attackDelay: 4,
|
||||
health: 30,
|
||||
ranged: true,
|
||||
loot: {
|
||||
'cloth': {
|
||||
min: 5,
|
||||
max: 10,
|
||||
chance: 0.8
|
||||
},
|
||||
'bullets': {
|
||||
min: 1,
|
||||
max: 5,
|
||||
chance: 0.5
|
||||
},
|
||||
'rifle': {
|
||||
min: 1,
|
||||
max: 1,
|
||||
chance: 0.2
|
||||
},
|
||||
'medicine': {
|
||||
min: 1,
|
||||
max: 2,
|
||||
chance: 0.1
|
||||
}
|
||||
},
|
||||
notification: _('a shot rings out, from somewhere in the long grass')
|
||||
}
|
||||
}
|
||||
}
|
||||
];
|
||||
|
||||
+66
-66
@@ -1,66 +1,66 @@
|
||||
/**
|
||||
* Events that can occur when any module is active (Except World. It's special.)
|
||||
**/
|
||||
Events.Global = [
|
||||
{ /* The Thief */
|
||||
title: _('The Thief'),
|
||||
isAvailable: function() {
|
||||
return (Engine.activeModule == Room || Engine.activeModule == Outside) && $SM.get('game.thieves') == 1;
|
||||
},
|
||||
scenes: {
|
||||
'start': {
|
||||
text: [
|
||||
_('the villagers haul a filthy man out of the store room.'),
|
||||
_("say his folk have been skimming the supplies."),
|
||||
_('say he should be strung up as an example.')
|
||||
],
|
||||
notification: _('a thief is caught'),
|
||||
blink: true,
|
||||
buttons: {
|
||||
'kill': {
|
||||
text: _('hang him'),
|
||||
nextScene: {1: 'hang'}
|
||||
},
|
||||
'spare': {
|
||||
text: _('spare him'),
|
||||
nextScene: {1: 'spare'}
|
||||
}
|
||||
}
|
||||
},
|
||||
'hang': {
|
||||
text: [
|
||||
_('the villagers hang the thief high in front of the store room.'),
|
||||
_('the point is made. in the next few days, the missing supplies are returned.')
|
||||
],
|
||||
onLoad: function() {
|
||||
$SM.set('game.thieves', 2);
|
||||
$SM.remove('income.thieves');
|
||||
$SM.addM('stores', $SM.get('game.stolen'));
|
||||
},
|
||||
buttons: {
|
||||
'leave': {
|
||||
text: _('leave'),
|
||||
nextScene: 'end'
|
||||
}
|
||||
}
|
||||
},
|
||||
'spare': {
|
||||
text: [
|
||||
_("the man says he's grateful. says he won't come around any more."),
|
||||
_("shares what he knows about sneaking before he goes.")
|
||||
],
|
||||
onLoad: function() {
|
||||
$SM.set('game.thieves', 2);
|
||||
$SM.remove('income.thieves');
|
||||
$SM.addPerk('stealthy');
|
||||
},
|
||||
buttons: {
|
||||
'leave': {
|
||||
text: _('leave'),
|
||||
nextScene: 'end'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
];
|
||||
/**
|
||||
* Events that can occur when any module is active (Except World. It's special.)
|
||||
**/
|
||||
Events.Global = [
|
||||
{ /* The Thief */
|
||||
title: _('The Thief'),
|
||||
isAvailable: function() {
|
||||
return (Engine.activeModule == Room || Engine.activeModule == Outside) && $SM.get('game.thieves') == 1;
|
||||
},
|
||||
scenes: {
|
||||
'start': {
|
||||
text: [
|
||||
_('the villagers haul a filthy man out of the store room.'),
|
||||
_("say his folk have been skimming the supplies."),
|
||||
_('say he should be strung up as an example.')
|
||||
],
|
||||
notification: _('a thief is caught'),
|
||||
blink: true,
|
||||
buttons: {
|
||||
'kill': {
|
||||
text: _('hang him'),
|
||||
nextScene: {1: 'hang'}
|
||||
},
|
||||
'spare': {
|
||||
text: _('spare him'),
|
||||
nextScene: {1: 'spare'}
|
||||
}
|
||||
}
|
||||
},
|
||||
'hang': {
|
||||
text: [
|
||||
_('the villagers hang the thief high in front of the store room.'),
|
||||
_('the point is made. in the next few days, the missing supplies are returned.')
|
||||
],
|
||||
onLoad: function() {
|
||||
$SM.set('game.thieves', 2);
|
||||
$SM.remove('income.thieves');
|
||||
$SM.addM('stores', $SM.get('game.stolen'));
|
||||
},
|
||||
buttons: {
|
||||
'leave': {
|
||||
text: _('leave'),
|
||||
nextScene: 'end'
|
||||
}
|
||||
}
|
||||
},
|
||||
'spare': {
|
||||
text: [
|
||||
_("the man says he's grateful. says he won't come around any more."),
|
||||
_("shares what he knows about sneaking before he goes.")
|
||||
],
|
||||
onLoad: function() {
|
||||
$SM.set('game.thieves', 2);
|
||||
$SM.remove('income.thieves');
|
||||
$SM.addPerk('stealthy');
|
||||
},
|
||||
buttons: {
|
||||
'leave': {
|
||||
text: _('leave'),
|
||||
nextScene: 'end'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
];
|
||||
|
||||
+3574
-3574
File diff suppressed because it is too large
Load Diff
+27
-27
@@ -1,28 +1,28 @@
|
||||
/**
|
||||
* Module that takes care of header buttons
|
||||
*/
|
||||
var Header = {
|
||||
|
||||
init: function(options) {
|
||||
this.options = $.extend(
|
||||
this.options,
|
||||
options
|
||||
);
|
||||
},
|
||||
|
||||
options: {}, // Nothing for now
|
||||
|
||||
canTravel: function() {
|
||||
return $('div#header div.headerButton').length > 1;
|
||||
},
|
||||
|
||||
addLocation: function(text, id, module) {
|
||||
return $('<div>').attr('id', "location_" + id)
|
||||
.addClass('headerButton')
|
||||
.text(text).click(function() {
|
||||
if(Header.canTravel()) {
|
||||
Engine.travelTo(module);
|
||||
}
|
||||
}).appendTo($('div#header'));
|
||||
}
|
||||
/**
|
||||
* Module that takes care of header buttons
|
||||
*/
|
||||
var Header = {
|
||||
|
||||
init: function(options) {
|
||||
this.options = $.extend(
|
||||
this.options,
|
||||
options
|
||||
);
|
||||
},
|
||||
|
||||
options: {}, // Nothing for now
|
||||
|
||||
canTravel: function() {
|
||||
return $('div#header div.headerButton').length > 1;
|
||||
},
|
||||
|
||||
addLocation: function(text, id, module) {
|
||||
return $('<div>').attr('id', "location_" + id)
|
||||
.addClass('headerButton')
|
||||
.text(text).click(function() {
|
||||
if(Header.canTravel()) {
|
||||
Engine.travelTo(module);
|
||||
}
|
||||
}).appendTo($('div#header'));
|
||||
}
|
||||
};
|
||||
+34
-1
@@ -4,6 +4,7 @@
|
||||
var Outside = {
|
||||
name: _("Outside"),
|
||||
|
||||
_STORES_OFFSET: 0,
|
||||
_GATHER_DELAY: 60,
|
||||
_TRAPS_DELAY: 90,
|
||||
_POP_DELAY: [0.5, 3],
|
||||
@@ -439,7 +440,7 @@ var Outside = {
|
||||
this.setTitle();
|
||||
|
||||
if(!ignoreStores && Engine.activeModule === Outside && village.children().length > 1) {
|
||||
$('#storesContainer').css({top: village.height() + 26 + 'px'});
|
||||
$('#storesContainer').css({top: village.height() + 26 + Outside._STORES_OFFSET + 'px'});
|
||||
}
|
||||
},
|
||||
|
||||
@@ -610,6 +611,38 @@ var Outside = {
|
||||
Outside.updateVillage();
|
||||
Outside.updateWorkersView();
|
||||
Outside.updateVillageIncome();
|
||||
};
|
||||
},
|
||||
|
||||
scrollSidebar: function(direction, reset) {
|
||||
|
||||
if( typeof reset != "undefined" ){
|
||||
$('#village').css('top', '0px');
|
||||
$('#storesContainer').css('top', '224px');
|
||||
Outside._STORES_OFFSET = 0;
|
||||
return false;
|
||||
}
|
||||
|
||||
var momentum = 10;
|
||||
|
||||
// If they hit up, we scroll everything down
|
||||
if( direction == 'up' )
|
||||
momentum = momentum * -1;
|
||||
|
||||
/* Let's stop scrolling if the top or bottom bound is in the viewport, based on direction */
|
||||
if( direction == 'down' && inView( direction, $('#village') ) ){
|
||||
|
||||
return false;
|
||||
|
||||
}else if( direction == 'up' && inView( direction, $('#storesContainer') ) ){
|
||||
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
scrollByX( $('#village'), momentum );
|
||||
scrollByX( $('#storesContainer'), momentum );
|
||||
Outside._STORES_OFFSET += momentum;
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
+32
-2
@@ -1,7 +1,7 @@
|
||||
var Path = {
|
||||
|
||||
DEFAULT_BAG_SPACE: 10,
|
||||
|
||||
_STORES_OFFSET: 0,
|
||||
// Everything not in this list weighs 1
|
||||
Weight: {
|
||||
'bone spear': 2,
|
||||
@@ -116,7 +116,7 @@ var Path = {
|
||||
}
|
||||
|
||||
if(!ignoreStores && Engine.activeModule === Path) {
|
||||
$('#storesContainer').css({top: perks.height() + 26 + 'px'});
|
||||
$('#storesContainer').css({top: perks.height() + 26 + Path._STORES_OFFSET + 'px'});
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -312,6 +312,36 @@ var Path = {
|
||||
handleStateUpdates: function(e){
|
||||
if(e.category == 'character' && e.stateName.indexOf('character.perks') === 0 && Engine.activeModule == Path){
|
||||
Path.updatePerks();
|
||||
};
|
||||
},
|
||||
|
||||
scrollSidebar: function(direction, reset){
|
||||
|
||||
if( typeof reset != "undefined" ){
|
||||
$('#perks').css('top', '0px');
|
||||
$('#storesContainer').css('top', '206px');
|
||||
Path._STORES_OFFSET = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
var momentum = 10;
|
||||
|
||||
if( direction == 'up' )
|
||||
momentum = momentum * -1
|
||||
|
||||
if( direction == 'down' && inView( direction, $('#perks') ) ){
|
||||
|
||||
return false;
|
||||
|
||||
}else if( direction == 'up' && inView( direction, $('#storesContainer') ) ){
|
||||
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
scrollByX( $('#perks'), momentum );
|
||||
scrollByX( $('#storesContainer'), momentum );
|
||||
Path._STORES_OFFSET += momentum;
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
+173
-173
@@ -1,174 +1,174 @@
|
||||
/**
|
||||
* Module that registers the starship!
|
||||
*/
|
||||
var Ship = {
|
||||
LIFTOFF_COOLDOWN: 120,
|
||||
ALLOY_PER_HULL: 1,
|
||||
ALLOY_PER_THRUSTER: 1,
|
||||
BASE_HULL: 0,
|
||||
BASE_THRUSTERS: 1,
|
||||
|
||||
name: _("Ship"),
|
||||
init: function(options) {
|
||||
this.options = $.extend(
|
||||
this.options,
|
||||
options
|
||||
);
|
||||
|
||||
if(!$SM.get('features.location.spaceShip')) {
|
||||
$SM.set('features.location.spaceShip', true);
|
||||
$SM.setM('game.spaceShip', {
|
||||
hull: Ship.BASE_HULL,
|
||||
thrusters: Ship.BASE_THRUSTERS
|
||||
});
|
||||
}
|
||||
|
||||
// Create the Ship tab
|
||||
this.tab = Header.addLocation(_("An Old Starship"), "ship", Ship);
|
||||
|
||||
// Create the Ship panel
|
||||
this.panel = $('<div>').attr('id', "shipPanel")
|
||||
.addClass('location')
|
||||
.appendTo('div#locationSlider');
|
||||
|
||||
Engine.updateSlider();
|
||||
|
||||
// Draw the hull label
|
||||
var hullRow = $('<div>').attr('id', 'hullRow').appendTo('div#shipPanel');
|
||||
$('<div>').addClass('row_key').text(_('hull:')).appendTo(hullRow);
|
||||
$('<div>').addClass('row_val').text($SM.get('game.spaceShip.hull')).appendTo(hullRow);
|
||||
$('<div>').addClass('clear').appendTo(hullRow);
|
||||
|
||||
// Draw the thrusters label
|
||||
var engineRow = $('<div>').attr('id', 'engineRow').appendTo('div#shipPanel');
|
||||
$('<div>').addClass('row_key').text(_('engine:')).appendTo(engineRow);
|
||||
$('<div>').addClass('row_val').text($SM.get('game.spaceShip.thrusters')).appendTo(engineRow);
|
||||
$('<div>').addClass('clear').appendTo(engineRow);
|
||||
|
||||
// Draw the reinforce button
|
||||
new Button.Button({
|
||||
id: 'reinforceButton',
|
||||
text: _('reinforce hull'),
|
||||
click: Ship.reinforceHull,
|
||||
width: '100px',
|
||||
cost: {'alien alloy': Ship.ALLOY_PER_HULL}
|
||||
}).appendTo('div#shipPanel');
|
||||
|
||||
// Draw the engine button
|
||||
new Button.Button({
|
||||
id: 'engineButton',
|
||||
text: _('upgrade engine'),
|
||||
click: Ship.upgradeEngine,
|
||||
width: '100px',
|
||||
cost: {'alien alloy': Ship.ALLOY_PER_THRUSTER}
|
||||
}).appendTo('div#shipPanel');
|
||||
|
||||
// Draw the lift off button
|
||||
var b = new Button.Button({
|
||||
id: 'liftoffButton',
|
||||
text: _('lift off'),
|
||||
click: Ship.checkLiftOff,
|
||||
width: '100px',
|
||||
cooldown: Ship.LIFTOFF_COOLDOWN
|
||||
}).appendTo('div#shipPanel');
|
||||
|
||||
if($SM.get('game.spaceShip.hull') <= 0) {
|
||||
Button.setDisabled(b, true);
|
||||
}
|
||||
|
||||
// Init Space
|
||||
Space.init();
|
||||
|
||||
//subscribe to stateUpdates
|
||||
$.Dispatch('stateUpdate').subscribe(Ship.handleStateUpdates);
|
||||
},
|
||||
|
||||
options: {}, // Nothing for now
|
||||
|
||||
onArrival: function(transition_diff) {
|
||||
Ship.setTitle();
|
||||
if(!$SM.get('game.spaceShip.seenShip')) {
|
||||
Notifications.notify(Ship, _('somewhere above the debris cloud, the wanderer fleet hovers. been on this rock too long.'));
|
||||
$SM.set('game.spaceShip.seenShip', true);
|
||||
}
|
||||
|
||||
Engine.moveStoresView(null, transition_diff);
|
||||
},
|
||||
|
||||
setTitle: function() {
|
||||
if(Engine.activeModule == this) {
|
||||
document.title = "An Old Starship";
|
||||
}
|
||||
},
|
||||
|
||||
reinforceHull: function() {
|
||||
if($SM.get('stores["alien alloy"]', true) < Ship.ALLOY_PER_HULL) {
|
||||
Notifications.notify(Ship, _("not enough alien alloy"));
|
||||
return false;
|
||||
}
|
||||
$SM.add('stores["alien alloy"]', -Ship.ALLOY_PER_HULL);
|
||||
$SM.add('game.spaceShip.hull', 1);
|
||||
if($SM.get('game.spaceShip.hull') > 0) {
|
||||
Button.setDisabled($('#liftoffButton', Ship.panel), false);
|
||||
}
|
||||
$('#hullRow .row_val', Ship.panel).text($SM.get('game.spaceShip.hull'));
|
||||
},
|
||||
|
||||
upgradeEngine: function() {
|
||||
if($SM.get('stores["alien alloy"]', true) < Ship.ALLOY_PER_THRUSTER) {
|
||||
Notifications.notify(Ship, _("not enough alien alloy"));
|
||||
return false;
|
||||
}
|
||||
$SM.add('stores["alien alloy"]', -Ship.ALLOY_PER_THRUSTER);
|
||||
$SM.add('game.spaceShip.thrusters', 1);
|
||||
$('#engineRow .row_val', Ship.panel).text($SM.get('game.spaceShip.thrusters'));
|
||||
},
|
||||
|
||||
getMaxHull: function() {
|
||||
return $SM.get('game.spaceShip.hull');
|
||||
},
|
||||
|
||||
checkLiftOff: function() {
|
||||
if(!$SM.get('game.spaceShip.seenWarning')) {
|
||||
Events.startEvent({
|
||||
title: _('Ready to Leave?'),
|
||||
scenes: {
|
||||
'start': {
|
||||
text: [
|
||||
_("time to get out of this place. won't be coming back.")
|
||||
],
|
||||
buttons: {
|
||||
'fly': {
|
||||
text: _('lift off'),
|
||||
onChoose: function() {
|
||||
$SM.set('game.spaceShip.seenWarning', true);
|
||||
Ship.liftOff();
|
||||
},
|
||||
nextScene: 'end'
|
||||
},
|
||||
'wait': {
|
||||
text: _('linger'),
|
||||
onChoose: function() {
|
||||
Button.clearCooldown($('#liftoffButton'));
|
||||
},
|
||||
nextScene: 'end'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
} else {
|
||||
Ship.liftOff();
|
||||
}
|
||||
},
|
||||
|
||||
liftOff: function () {
|
||||
$('#outerSlider').animate({top: '700px'}, 300);
|
||||
Space.onArrival();
|
||||
Engine.activeModule = Space;
|
||||
},
|
||||
|
||||
handleStateUpdates: function(e){
|
||||
|
||||
}
|
||||
/**
|
||||
* Module that registers the starship!
|
||||
*/
|
||||
var Ship = {
|
||||
LIFTOFF_COOLDOWN: 120,
|
||||
ALLOY_PER_HULL: 1,
|
||||
ALLOY_PER_THRUSTER: 1,
|
||||
BASE_HULL: 0,
|
||||
BASE_THRUSTERS: 1,
|
||||
|
||||
name: _("Ship"),
|
||||
init: function(options) {
|
||||
this.options = $.extend(
|
||||
this.options,
|
||||
options
|
||||
);
|
||||
|
||||
if(!$SM.get('features.location.spaceShip')) {
|
||||
$SM.set('features.location.spaceShip', true);
|
||||
$SM.setM('game.spaceShip', {
|
||||
hull: Ship.BASE_HULL,
|
||||
thrusters: Ship.BASE_THRUSTERS
|
||||
});
|
||||
}
|
||||
|
||||
// Create the Ship tab
|
||||
this.tab = Header.addLocation(_("An Old Starship"), "ship", Ship);
|
||||
|
||||
// Create the Ship panel
|
||||
this.panel = $('<div>').attr('id', "shipPanel")
|
||||
.addClass('location')
|
||||
.appendTo('div#locationSlider');
|
||||
|
||||
Engine.updateSlider();
|
||||
|
||||
// Draw the hull label
|
||||
var hullRow = $('<div>').attr('id', 'hullRow').appendTo('div#shipPanel');
|
||||
$('<div>').addClass('row_key').text(_('hull:')).appendTo(hullRow);
|
||||
$('<div>').addClass('row_val').text($SM.get('game.spaceShip.hull')).appendTo(hullRow);
|
||||
$('<div>').addClass('clear').appendTo(hullRow);
|
||||
|
||||
// Draw the thrusters label
|
||||
var engineRow = $('<div>').attr('id', 'engineRow').appendTo('div#shipPanel');
|
||||
$('<div>').addClass('row_key').text(_('engine:')).appendTo(engineRow);
|
||||
$('<div>').addClass('row_val').text($SM.get('game.spaceShip.thrusters')).appendTo(engineRow);
|
||||
$('<div>').addClass('clear').appendTo(engineRow);
|
||||
|
||||
// Draw the reinforce button
|
||||
new Button.Button({
|
||||
id: 'reinforceButton',
|
||||
text: _('reinforce hull'),
|
||||
click: Ship.reinforceHull,
|
||||
width: '100px',
|
||||
cost: {'alien alloy': Ship.ALLOY_PER_HULL}
|
||||
}).appendTo('div#shipPanel');
|
||||
|
||||
// Draw the engine button
|
||||
new Button.Button({
|
||||
id: 'engineButton',
|
||||
text: _('upgrade engine'),
|
||||
click: Ship.upgradeEngine,
|
||||
width: '100px',
|
||||
cost: {'alien alloy': Ship.ALLOY_PER_THRUSTER}
|
||||
}).appendTo('div#shipPanel');
|
||||
|
||||
// Draw the lift off button
|
||||
var b = new Button.Button({
|
||||
id: 'liftoffButton',
|
||||
text: _('lift off'),
|
||||
click: Ship.checkLiftOff,
|
||||
width: '100px',
|
||||
cooldown: Ship.LIFTOFF_COOLDOWN
|
||||
}).appendTo('div#shipPanel');
|
||||
|
||||
if($SM.get('game.spaceShip.hull') <= 0) {
|
||||
Button.setDisabled(b, true);
|
||||
}
|
||||
|
||||
// Init Space
|
||||
Space.init();
|
||||
|
||||
//subscribe to stateUpdates
|
||||
$.Dispatch('stateUpdate').subscribe(Ship.handleStateUpdates);
|
||||
},
|
||||
|
||||
options: {}, // Nothing for now
|
||||
|
||||
onArrival: function(transition_diff) {
|
||||
Ship.setTitle();
|
||||
if(!$SM.get('game.spaceShip.seenShip')) {
|
||||
Notifications.notify(Ship, _('somewhere above the debris cloud, the wanderer fleet hovers. been on this rock too long.'));
|
||||
$SM.set('game.spaceShip.seenShip', true);
|
||||
}
|
||||
|
||||
Engine.moveStoresView(null, transition_diff);
|
||||
},
|
||||
|
||||
setTitle: function() {
|
||||
if(Engine.activeModule == this) {
|
||||
document.title = "An Old Starship";
|
||||
}
|
||||
},
|
||||
|
||||
reinforceHull: function() {
|
||||
if($SM.get('stores["alien alloy"]', true) < Ship.ALLOY_PER_HULL) {
|
||||
Notifications.notify(Ship, _("not enough alien alloy"));
|
||||
return false;
|
||||
}
|
||||
$SM.add('stores["alien alloy"]', -Ship.ALLOY_PER_HULL);
|
||||
$SM.add('game.spaceShip.hull', 1);
|
||||
if($SM.get('game.spaceShip.hull') > 0) {
|
||||
Button.setDisabled($('#liftoffButton', Ship.panel), false);
|
||||
}
|
||||
$('#hullRow .row_val', Ship.panel).text($SM.get('game.spaceShip.hull'));
|
||||
},
|
||||
|
||||
upgradeEngine: function() {
|
||||
if($SM.get('stores["alien alloy"]', true) < Ship.ALLOY_PER_THRUSTER) {
|
||||
Notifications.notify(Ship, _("not enough alien alloy"));
|
||||
return false;
|
||||
}
|
||||
$SM.add('stores["alien alloy"]', -Ship.ALLOY_PER_THRUSTER);
|
||||
$SM.add('game.spaceShip.thrusters', 1);
|
||||
$('#engineRow .row_val', Ship.panel).text($SM.get('game.spaceShip.thrusters'));
|
||||
},
|
||||
|
||||
getMaxHull: function() {
|
||||
return $SM.get('game.spaceShip.hull');
|
||||
},
|
||||
|
||||
checkLiftOff: function() {
|
||||
if(!$SM.get('game.spaceShip.seenWarning')) {
|
||||
Events.startEvent({
|
||||
title: _('Ready to Leave?'),
|
||||
scenes: {
|
||||
'start': {
|
||||
text: [
|
||||
_("time to get out of this place. won't be coming back.")
|
||||
],
|
||||
buttons: {
|
||||
'fly': {
|
||||
text: _('lift off'),
|
||||
onChoose: function() {
|
||||
$SM.set('game.spaceShip.seenWarning', true);
|
||||
Ship.liftOff();
|
||||
},
|
||||
nextScene: 'end'
|
||||
},
|
||||
'wait': {
|
||||
text: _('linger'),
|
||||
onChoose: function() {
|
||||
Button.clearCooldown($('#liftoffButton'));
|
||||
},
|
||||
nextScene: 'end'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
} else {
|
||||
Ship.liftOff();
|
||||
}
|
||||
},
|
||||
|
||||
liftOff: function () {
|
||||
$('#outerSlider').animate({top: '700px'}, 300);
|
||||
Space.onArrival();
|
||||
Engine.activeModule = Space;
|
||||
},
|
||||
|
||||
handleStateUpdates: function(e){
|
||||
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user