This commit is contained in:
Michael
2014-05-19 12:44:30 -04:00
24 changed files with 4388 additions and 912 deletions
+29
View File
@@ -0,0 +1,29 @@
HOWTO TRANSLATE
===================
for people who doesn't need translation :
- all strings sent to the page must go through the javascript function _() which will translate it. so please, if you add new strings, wrap them with _('') function.
- if you want to add some strings in the css (using content), please, edit /script/localization.js too
- thank you :)
ADD A NEW LANGUAGE
======================
- copy the /lang/fr folder to /lang/{new_language}
- open /lang/{new_language}/strings.po with a software like PoEdit (available on linux/mac/windows, no excuses)
- translate ...
- keep translating ...
- finished ? sure ?
- use the python script (/tools/po2js.py) to convert the po file to a js file
- edit index.html and add the following script after '<script src="lib/translate.js"></script>' (replace the path with your language)
<script>
//load language
document.write('<script src="lang/fr/strings.js"><\/script>');
document.write('<link rel="stylesheet" type="text/css" href="lang/fr/main.css" \/>');
</script>
- if your sentence are too big and you need to update some css, overload it in /lang/{new_language}/main.css
+23 -3
View File
@@ -1,6 +1,7 @@
<!DOCTYPE html> <!DOCTYPE html>
<html itemscope itemtype="http://schema.org/CreativeWork"> <html itemscope itemtype="http://schema.org/CreativeWork">
<head> <head>
<meta charset="UTF-8"/>
<!-- <!--
A Dark Room (v1.4) A Dark Room (v1.4)
================== ==================
@@ -25,6 +26,24 @@
<script src="lib/jquery.event.move.js"></script> <script src="lib/jquery.event.move.js"></script>
<script src="lib/jquery.event.swipe.js"></script> <script src="lib/jquery.event.swipe.js"></script>
<script src="lib/base64.js"></script> <script src="lib/base64.js"></script>
<script src="lib/translate.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/Button.js"></script>
<script src="script/engine.js"></script> <script src="script/engine.js"></script>
<script src="script/state_manager.js"></script> <script src="script/state_manager.js"></script>
@@ -37,8 +56,8 @@
<script src="script/path.js"></script> <script src="script/path.js"></script>
<script src="script/ship.js"></script> <script src="script/ship.js"></script>
<script src="script/space.js"></script> <script src="script/space.js"></script>
<script src="script/prestige.js"></script> <script src="script/prestige.js"></script>
<script src="script/scoring.js"></script> <script src="script/scoring.js"></script>
<!-- Event modules --> <!-- Event modules -->
<script src="script/events/global.js"></script> <script src="script/events/global.js"></script>
<script src="script/events/room.js"></script> <script src="script/events/room.js"></script>
@@ -61,6 +80,7 @@
<link rel="stylesheet" type="text/css" href="css/ship.css" /> <link rel="stylesheet" type="text/css" href="css/ship.css" />
<link rel="stylesheet" type="text/css" href="css/space.css" /> <link rel="stylesheet" type="text/css" href="css/space.css" />
<script src="script/localization.js"></script>
<!-- Google Analytics --> <!-- Google Analytics -->
<script> <script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
@@ -75,7 +95,7 @@
</head> </head>
<body> <body>
<div id="wrapper"> <div id="wrapper">
<div id="saveNotify">saved.</div> <div id="saveNotify"><script>document.write(_("saved."));</script></div>
<div id="content"> <div id="content">
<div id="outerSlider"> <div id="outerSlider">
<div id="main"> <div id="main">
+3
View File
@@ -0,0 +1,3 @@
.button{width: 100px !important;}
#outsidePanel .button{width: 115px !important;}
.eventPanel .button {width: 122px !important;}
File diff suppressed because one or more lines are too long
Binary file not shown.
+3132
View File
File diff suppressed because it is too large Load Diff
+23
View File
@@ -0,0 +1,23 @@
(function() {
var dfs = {"am_pm":["AM","PM"],"day_name":["dimanche","lundi","mardi","mercredi","jeudi","vendredi","samedi"],"day_short":["dim.","lun.","mar.","mer.","jeu.","ven.","sam."],"era":["av. J.-C.","ap. J.-C."],"era_name":["avant Jésus-Christ","après Jésus-Christ"],"month_name":["janvier","février","mars","avril","mai","juin","juillet","août","septembre","octobre","novembre","décembre"],"month_short":["janv.","févr.","mars","avr.","mai","juin","juil.","août","sept.","oct.","nov.","déc."],"order_full":"DMY","order_long":"DMY","order_medium":"DMY","order_short":"DMY"};
var nfs = {"decimal_separator":",","grouping_separator":" ","minus":"-"};
var df = {SHORT_PADDED_CENTURY:function(d){if(d){return(((d.getDate()+101)+'').substring(1)+'/'+((d.getMonth()+101)+'').substring(1)+'/'+d.getFullYear());}},SHORT:function(d){if(d){return(((d.getDate()+101)+'').substring(1)+'/'+((d.getMonth()+101)+'').substring(1)+'/'+(d.getFullYear()+'').substring(2));}},SHORT_NOYEAR:function(d){if(d){return(((d.getDate()+101)+'').substring(1)+'/'+((d.getMonth()+101)+'').substring(1));}},SHORT_NODAY:function(d){if(d){return(((d.getMonth()+101)+'').substring(1)+'/'+(d.getFullYear()+'').substring(2));}},MEDIUM:function(d){if(d){return(d.getDate()+' '+dfs.month_short[d.getMonth()]+' '+d.getFullYear());}},MEDIUM_NOYEAR:function(d){if(d){return(d.getDate()+' '+dfs.month_short[d.getMonth()]);}},MEDIUM_WEEKDAY_NOYEAR:function(d){if(d){return(dfs.day_short[d.getDay()]+' '+d.getDate()+' '+dfs.month_short[d.getMonth()]);}},LONG_NODAY:function(d){if(d){return(dfs.month_name[d.getMonth()]+' '+d.getFullYear());}},LONG:function(d){if(d){return(d.getDate()+' '+dfs.month_name[d.getMonth()]+' '+d.getFullYear());}},FULL:function(d){if(d){return(dfs.day_name[d.getDay()]+' '+d.getDate()+' '+dfs.month_name[d.getMonth()]+' '+d.getFullYear());}}};
window.icu = window.icu || new Object();
var icu = window.icu;
icu.getCountry = function() { return "" };
icu.getCountryName = function() { return "" };
icu.getDateFormat = function(formatCode) { var retVal = {}; retVal.format = df[formatCode]; return retVal; };
icu.getDateFormats = function() { return df; };
icu.getDateFormatSymbols = function() { return dfs; };
icu.getDecimalFormat = function(places) { var retVal = {}; retVal.format = function(n) { var ns = n < 0 ? Math.abs(n).toFixed(places) : n.toFixed(places); var ns2 = ns.split('.'); s = ns2[0]; var d = ns2[1]; var rgx = /(\d+)(\d{3})/;while(rgx.test(s)){s = s.replace(rgx, '$1' + nfs["grouping_separator"] + '$2');} return (n < 0 ? nfs["minus"] : "") + s + nfs["decimal_separator"] + d;}; return retVal; };
icu.getDecimalFormatSymbols = function() { return nfs; };
icu.getIntegerFormat = function() { var retVal = {}; retVal.format = function(i) { var s = i < 0 ? Math.abs(i).toString() : i.toString(); var rgx = /(\d+)(\d{3})/;while(rgx.test(s)){s = s.replace(rgx, '$1' + nfs["grouping_separator"] + '$2');} return i < 0 ? nfs["minus"] + s : s;}; return retVal; };
icu.getLanguage = function() { return "fr" };
icu.getLanguageName = function() { return "français" };
icu.getLocale = function() { return "fr" };
icu.getLocaleName = function() { return "français" };
})();
+86
View File
@@ -0,0 +1,86 @@
(function() {
var translate = function(text)
{
var xlate = translateLookup(text);
if (typeof xlate == "function")
{
xlate = xlate.apply(this, arguments);
}
else if (arguments.length > 1)
{
var aps = Array.prototype.slice;
var args = aps.call( arguments, 1 );
xlate = formatter(xlate, args);
}
return xlate;
};
// I want it available explicity as well as via the object
translate.translate = translate;
//from https://gist.github.com/776196 via http://davedash.com/2010/11/19/pythonic-string-formatting-in-javascript/
var defaultFormatter = (function() {
var re = /\{([^}]+)\}/g;
return function(s, args) {
return s.replace(re, function(_, match){ return args[match]; });
};
}());
var formatter = defaultFormatter;
translate.setFormatter = function(newFormatter)
{
formatter = newFormatter;
};
translate.format = function()
{
var aps = Array.prototype.slice;
var s = arguments[0];
var args = aps.call( arguments, 1 );
return formatter(s, args);
};
var dynoTrans = null;
translate.setDynamicTranslator = function(newDynoTrans)
{
dynoTrans = newDynoTrans;
};
var translation = null;
translate.setTranslation = function(newTranslation)
{
translation = newTranslation;
};
function translateLookup(target)
{
if (translation == null || target == null)
{
return target;
}
if (target in translation == false)
{
if (dynoTrans != null)
{
return dynoTrans(target);
}
return target;
}
var result = translation[target];
if (result == null)
{
return target;
}
return result;
};
window._ = translate;
})();
+1 -1
View File
@@ -28,7 +28,7 @@ var Button = {
var ttPos = options.ttPos ? options.ttPos : "bottom right"; var ttPos = options.ttPos ? options.ttPos : "bottom right";
var costTooltip = $('<div>').addClass('tooltip ' + ttPos); var costTooltip = $('<div>').addClass('tooltip ' + ttPos);
for(var k in options.cost) { for(var k in options.cost) {
$("<div>").addClass('row_key').text(k).appendTo(costTooltip); $("<div>").addClass('row_key').text(_(k)).appendTo(costTooltip);
$("<div>").addClass('row_val').text(options.cost[k]).appendTo(costTooltip); $("<div>").addClass('row_val').text(options.cost[k]).appendTo(costTooltip);
} }
if(costTooltip.children().length > 0) { if(costTooltip.children().length > 0) {
+108 -69
View File
@@ -17,48 +17,59 @@ var Engine = {
Perks: { Perks: {
'boxer': { 'boxer': {
desc: 'punches do more damage', name: _('boxer'),
notify: 'learned to throw punches with purpose' desc: _('punches do more damage'),
notify: _('learned to throw punches with purpose')
}, },
'martial artist': { 'martial artist': {
desc: 'punches do even more damage.', name: _('martial artist'),
notify: 'learned to fight quite effectively without weapons' desc: _('punches do even more damage.'),
notify: _('learned to fight quite effectively without weapons')
}, },
'unarmed master': { 'unarmed master': {
desc: 'punch twice as fast, and with even more force', name: _('unarmed master'),
notify: 'learned to strike faster without weapons' desc: _('punch twice as fast, and with even more force'),
notify: _('learned to strike faster without weapons')
}, },
'barbarian': { 'barbarian': {
desc: 'melee weapons deal more damage', name: _('barbarian'),
notify: 'learned to swing weapons with force' desc: _('melee weapons deal more damage'),
notify: _('learned to swing weapons with force')
}, },
'slow metabolism': { 'slow metabolism': {
desc: 'go twice as far without eating', name: _('slow metabolism'),
notify: 'learned how to ignore the hunger' desc: _('go twice as far without eating'),
notify: _('learned how to ignore the hunger')
}, },
'desert rat': { 'desert rat': {
desc: 'go twice as far without drinking', name: _('desert rat'),
notify: 'learned to love the dry air' desc: _('go twice as far without drinking'),
notify: _('learned to love the dry air')
}, },
'evasive': { 'evasive': {
desc: 'dodge attacks more effectively', name: _('evasive'),
notify: "learned to be where they're not" desc: _('dodge attacks more effectively'),
notify: _("learned to be where they're not")
}, },
'precise': { 'precise': {
desc: 'land blows more often', name: _('precise'),
notify: 'learned to predict their movement' desc: _('land blows more often'),
notify: _('learned to predict their movement')
}, },
'scout': { 'scout': {
desc: 'see farther', name: _('scout'),
notify: 'learned to look ahead' desc: _('see farther'),
notify: _('learned to look ahead')
}, },
'stealthy': { 'stealthy': {
desc: 'better avoid conflict in the wild', name: _('stealthy'),
notify: 'learned how not to be seen' desc: _('better avoid conflict in the wild'),
notify: _('learned how not to be seen')
}, },
'gastronome': { 'gastronome': {
desc: 'restore more health when eating', name: _('gastronome'),
notify: 'learned to make the most of food' desc: _('restore more health when eating'),
notify: _('learned to make the most of food')
} }
}, },
@@ -100,35 +111,45 @@ var Engine = {
.addClass('menu') .addClass('menu')
.appendTo('body'); .appendTo('body');
$('<select>')
.addClass('menuBtn')
.append($('<option>').text("choose your language"))
.append($('<option>').text("English").val("en"))
.append($('<option>').text("Français").val("fr"))
.change(Engine.switchLanguage)
.appendTo(menu);
$('<span>') $('<span>')
.addClass('lightsOff menuBtn') .addClass('lightsOff menuBtn')
.text('lights off.') .text(_('lights off.'))
.click(Engine.turnLightsOff) .click(Engine.turnLightsOff)
.appendTo(menu); .appendTo(menu);
$('<span>') $('<span>')
.addClass('menuBtn') .addClass('menuBtn')
.text('restart.') .text(_('restart.'))
.click(Engine.confirmDelete) .click(Engine.confirmDelete)
.appendTo(menu); .appendTo(menu);
$('<span>') $('<span>')
.addClass('menuBtn') .addClass('menuBtn')
.text('share.') .text(_('share.'))
.click(Engine.share) .click(Engine.share)
.appendTo(menu); .appendTo(menu);
$('<span>') $('<span>')
.addClass('menuBtn') .addClass('menuBtn')
.text('save.') .text(_('save.'))
.click(Engine.exportImport) .click(Engine.exportImport)
.appendTo(menu); .appendTo(menu);
$('<span>') $('<span>')
.addClass('menuBtn') .addClass('menuBtn')
.text('app store.') .text(_('app store.'))
.click(function() { window.open('https://itunes.apple.com/us/app/a-dark-room/id736683061'); }) .click(function() { window.open('https://itunes.apple.com/us/app/a-dark-room/id736683061'); })
.appendTo(menu); .appendTo(menu);
// Register keypress handlers // Register keypress handlers
$('body').off('keydown').keydown(Engine.keyDown); $('body').off('keydown').keydown(Engine.keyDown);
@@ -159,6 +180,7 @@ var Engine = {
Ship.init(); Ship.init();
} }
Engine.saveLanguage();
Engine.travelTo(Room); Engine.travelTo(Room);
}, },
@@ -203,55 +225,55 @@ var Engine = {
}, },
exportImport: function() { exportImport: function() {
Events.startEvent({ Events.startEvent({
title: 'Export / Import', title: 'Export / Import',
scenes: { scenes: {
start: { start: {
text: ['export or import save data, for backing up', text: [_('export or import save data, for backing up'),
'or migrating computers'], _('or migrating computers')],
buttons: { buttons: {
'export': { 'export': {
text: 'export', text: _('export'),
onChoose: Engine.export64 onChoose: Engine.export64
}, },
'import': { 'import': {
text: 'import', text: _('import'),
nextScene: {1: 'confirm'}, nextScene: {1: 'confirm'},
}, },
'cancel': { 'cancel': {
text: 'cancel', text: _('cancel'),
nextScene: 'end' nextScene: 'end'
} }
} }
}, },
'confirm': { 'confirm': {
text: ['are you sure?', text: [_('are you sure?'),
'if the code is invalid, all data will be lost.', _('if the code is invalid, all data will be lost.'),
'this is irreversible.'], _('this is irreversible.')],
buttons: { buttons: {
'yes': { 'yes': {
text: 'yes', text: _('yes'),
nextScene: {1: 'inputImport'}, nextScene: {1: 'inputImport'},
onChoose: Engine.enableSelection onChoose: Engine.enableSelection
}, },
'no': { 'no': {
text: 'no', text: _('no'),
nextScene: 'end' nextScene: 'end'
} }
} }
}, },
'inputImport': { 'inputImport': {
text: ['put the save code here.'], text: [_('put the save code here.')],
textarea: '', textarea: '',
buttons: { buttons: {
'okay': { 'okay': {
text: 'okay', text: _('import'),
nextScene: 'end', nextScene: 'end',
onChoose: Engine.import64 onChoose: Engine.import64
}, },
'cancel': { 'cancel': {
text: 'cancel', text: _('cancel'),
nextScene: 'end' nextScene: 'end'
} }
} }
} }
@@ -267,23 +289,23 @@ var Engine = {
string64 = string64.replace(/\n/g, ''); string64 = string64.replace(/\n/g, '');
Engine.enableSelection(); Engine.enableSelection();
Events.startEvent({ Events.startEvent({
title: 'Export', title: _('Export'),
scenes: { scenes: {
start: { start: {
text: ['save this.'], text: [_('save this.')],
textarea: string64, textarea: string64,
buttons: { buttons: {
'done': { 'done': {
text: 'got it', text: _('got it'),
nextScene: 'end', nextScene: 'end',
onChoose: Engine.disableSelection onChoose: Engine.disableSelection
} }
} }
} }
} }
}); });
}, },
import64: function(string64) { import64: function(string64) {
Engine.disableSelection(); Engine.disableSelection();
string64 = string64.replace(/\s/g, ''); string64 = string64.replace(/\s/g, '');
@@ -291,7 +313,7 @@ var Engine = {
string64 = string64.replace(/\n/g, ''); string64 = string64.replace(/\n/g, '');
var decodedSave = Base64.decode(string64); var decodedSave = Base64.decode(string64);
localStorage.gameState = decodedSave; localStorage.gameState = decodedSave;
location.reload(); location.reload();
}, },
event: function(cat, act) { event: function(cat, act) {
@@ -302,18 +324,18 @@ var Engine = {
confirmDelete: function() { confirmDelete: function() {
Events.startEvent({ Events.startEvent({
title: 'Restart?', title: _('Restart?'),
scenes: { scenes: {
start: { start: {
text: ['restart the game?'], text: [_('restart the game?')],
buttons: { buttons: {
'yes': { 'yes': {
text: 'yes', text: _('yes'),
nextScene: 'end', nextScene: 'end',
onChoose: Engine.deleteSave onChoose: Engine.deleteSave
}, },
'no': { 'no': {
text: 'no', text: _('no'),
nextScene: 'end' nextScene: 'end'
} }
} }
@@ -336,41 +358,41 @@ var Engine = {
share: function() { share: function() {
Events.startEvent({ Events.startEvent({
title: 'Share', title: _('Share'),
scenes: { scenes: {
start: { start: {
text: ['bring your friends.'], text: [_('bring your friends.')],
buttons: { buttons: {
'facebook': { 'facebook': {
text: 'facebook', text: _('facebook'),
nextScene: 'end', nextScene: 'end',
onChoose: function() { onChoose: function() {
window.open('https://www.facebook.com/sharer/sharer.php?u=' + Engine.SITE_URL, 'sharer', 'width=626,height=436,location=no,menubar=no,resizable=no,scrollbars=no,status=no,toolbar=no'); window.open('https://www.facebook.com/sharer/sharer.php?u=' + Engine.SITE_URL, 'sharer', 'width=626,height=436,location=no,menubar=no,resizable=no,scrollbars=no,status=no,toolbar=no');
} }
}, },
'google': { 'google': {
text:'google+', text:_('google+'),
nextScene: 'end', nextScene: 'end',
onChoose: function() { onChoose: function() {
window.open('https://plus.google.com/share?url=' + Engine.SITE_URL, 'sharer', 'width=480,height=436,location=no,menubar=no,resizable=no,scrollbars=no,status=no,toolbar=no'); window.open('https://plus.google.com/share?url=' + Engine.SITE_URL, 'sharer', 'width=480,height=436,location=no,menubar=no,resizable=no,scrollbars=no,status=no,toolbar=no');
} }
}, },
'twitter': { 'twitter': {
text: 'twitter', text: _('twitter'),
onChoose: function() { onChoose: function() {
window.open('https://twitter.com/intent/tweet?text=A%20Dark%20Room&url=' + Engine.SITE_URL, 'sharer', 'width=660,height=260,location=no,menubar=no,resizable=no,scrollbars=yes,status=no,toolbar=no'); window.open('https://twitter.com/intent/tweet?text=A%20Dark%20Room&url=' + Engine.SITE_URL, 'sharer', 'width=660,height=260,location=no,menubar=no,resizable=no,scrollbars=yes,status=no,toolbar=no');
}, },
nextScene: 'end' nextScene: 'end'
}, },
'reddit': { 'reddit': {
text: 'reddit', text: _('reddit'),
onChoose: function() { onChoose: function() {
window.open('http://www.reddit.com/submit?url=' + Engine.SITE_URL, 'sharer', 'width=960,height=700,location=no,menubar=no,resizable=no,scrollbars=yes,status=no,toolbar=no'); window.open('http://www.reddit.com/submit?url=' + Engine.SITE_URL, 'sharer', 'width=960,height=700,location=no,menubar=no,resizable=no,scrollbars=yes,status=no,toolbar=no');
}, },
nextScene: 'end' nextScene: 'end'
}, },
'close': { 'close': {
text: 'close', text: _('close'),
nextScene: 'end' nextScene: 'end'
} }
} }
@@ -404,16 +426,16 @@ var Engine = {
if (darkCss == null) { if (darkCss == null) {
$('head').append('<link rel="stylesheet" href="css/dark.css" type="text/css" title="darkenLights" />'); $('head').append('<link rel="stylesheet" href="css/dark.css" type="text/css" title="darkenLights" />');
Engine.turnLightsOff; Engine.turnLightsOff;
$('.lightsOff').text('lights on.'); $('.lightsOff').text(_('lights on.'));
} }
else if (darkCss.disabled) { else if (darkCss.disabled) {
darkCss.disabled = false; darkCss.disabled = false;
$('.lightsOff').text('lights on.'); $('.lightsOff').text(_('lights on.'));
} }
else { else {
$("#darkenLights").attr("disabled", "disabled"); $("#darkenLights").attr("disabled", "disabled");
darkCss.disabled = true; darkCss.disabled = true;
$('.lightsOff').text('lights off.'); $('.lightsOff').text(_('lights off.'));
} }
}, },
@@ -506,7 +528,8 @@ var Engine = {
}, },
getIncomeMsg: function(num, delay) { getIncomeMsg: function(num, delay) {
return (num > 0 ? "+" : "") + num + " per " + delay + "s"; return _("{0} per {1}s", (num > 0 ? "+" : "") + num, delay);
//return (num > 0 ? "+" : "") + num + " per " + delay + "s";
}, },
keyDown: function(e) { keyDown: function(e) {
@@ -586,17 +609,33 @@ var Engine = {
}, },
disableSelection: function() { disableSelection: function() {
document.onselectstart = function() {return false;} // this is for IE document.onselectstart = function() {return false;}; // this is for IE
document.onmousedown = function() {return false;} // this is for the rest document.onmousedown = function() {return false;}; // this is for the rest
}, },
enableSelection: function() { enableSelection: function() {
document.onselectstart = function() {return true;} document.onselectstart = function() {return true;};
document.onmousedown = function() {return true;} document.onmousedown = function() {return true;};
}, },
handleStateUpdates: function(e){ handleStateUpdates: function(e){
},
switchLanguage: function(dom){
var lang = $(this).val();
if(document.location.href.search(/[\?\&]lang=[a-z]+/) != -1){
document.location.href = document.location.href.replace( /([\?\&]lang=)([a-z]+)/gi , "$1"+lang );
}else{
document.location.href = document.location.href + ( (document.location.href.search(/\?/) != -1 )?"&":"?") + "lang="+lang;
}
},
saveLanguage: function(){
var lang = decodeURIComponent((new RegExp('[?|&]lang=' + '([^&;]+?)(&|#|;|$)').exec(location.search)||[,""])[1].replace(/\+/g, '%20'))||null;
if(lang && typeof Storage != 'undefined' && localStorage) {
localStorage.lang = lang;
}
} }
}; };
+11 -11
View File
@@ -123,7 +123,7 @@ var Events = {
var btn = new Button.Button({ var btn = new Button.Button({
id: 'eat', id: 'eat',
text: 'eat meat', text: _('eat meat'),
cooldown: cooldown, cooldown: cooldown,
click: Events.eatMeat, click: Events.eatMeat,
cost: { 'cured meat': 1 } cost: { 'cured meat': 1 }
@@ -143,7 +143,7 @@ var Events = {
var btn = new Button.Button({ var btn = new Button.Button({
id: 'meds', id: 'meds',
text: 'use meds', text: _('use meds'),
cooldown: cooldown, cooldown: cooldown,
click: Events.useMeds, click: Events.useMeds,
cost: { 'medicine': 1 } cost: { 'medicine': 1 }
@@ -453,7 +453,7 @@ var Events = {
var btns = $('#buttons', Events.eventPanel()); var btns = $('#buttons', Events.eventPanel());
desc.empty(); desc.empty();
btns.empty(); btns.empty();
$('<div>').text('the ' + scene.enemy + (scene.plural ? ' are' : ' is') + ' dead.').appendTo(desc); $('<div>').text(scene.deathMessage).appendTo(desc);
Events.drawLoot(scene.loot); Events.drawLoot(scene.loot);
@@ -471,7 +471,7 @@ var Events = {
Events.endEvent(); Events.endEvent();
} }
}, },
text: 'leave' text: _('leave')
}).appendTo(btns); }).appendTo(btns);
Events.createEatMeatButton(0).appendTo(btns); Events.createEatMeatButton(0).appendTo(btns);
@@ -495,7 +495,7 @@ var Events = {
var num = Math.floor(Math.random() * (loot.max - loot.min)) + loot.min; var num = Math.floor(Math.random() * (loot.max - loot.min)) + loot.min;
new Button.Button({ new Button.Button({
id: 'loot_' + k.replace(' ', '-'), id: 'loot_' + k.replace(' ', '-'),
text: k + ' [' + num + ']', text: _(k) + ' [' + num + ']',
click: Events.getLoot click: Events.getLoot
}).data('numLeft', num).appendTo(lootButtons); }).data('numLeft', num).appendTo(lootButtons);
} }
@@ -518,11 +518,11 @@ var Events = {
if(lootBtn.length > 0) { if(lootBtn.length > 0) {
var curNum = lootBtn.data('numLeft'); var curNum = lootBtn.data('numLeft');
curNum += num; curNum += num;
lootBtn.text(thing + ' [' + curNum + ']').data('numLeft', curNum); lootBtn.text(_(thing) + ' [' + curNum + ']').data('numLeft', curNum);
} else { } else {
new Button.Button({ new Button.Button({
id: 'loot_' + thing.replace(' ', '-'), id: 'loot_' + thing.replace(' ', '-'),
text: thing + ' [' + num + ']', text: _(thing) + ' [' + num + ']',
click: Events.getLoot click: Events.getLoot
}).data('numLeft', num).insertBefore($('.clear', lootButtons)); }).data('numLeft', num).insertBefore($('.clear', lootButtons));
} }
@@ -550,7 +550,7 @@ var Events = {
}); });
} else { } else {
// #dropMenu gets removed by this. // #dropMenu gets removed by this.
btn.text(name + ' [' + num + ']'); btn.text(_(name) + ' [' + num + ']');
} }
var curNum = Path.outfit[name]; var curNum = Path.outfit[name];
curNum = typeof curNum == 'number' ? curNum : 0; curNum = typeof curNum == 'number' ? curNum : 0;
@@ -578,7 +578,7 @@ var Events = {
} }
if(numToDrop > 0) { if(numToDrop > 0) {
var dropRow = $('<div>').attr('id', 'drop_' + k.replace(' ', '-')) var dropRow = $('<div>').attr('id', 'drop_' + k.replace(' ', '-'))
.text(k + ' x' + numToDrop) .text(_(k) + ' x' + numToDrop)
.data('thing', k) .data('thing', k)
.data('num', numToDrop) .data('num', numToDrop)
.click(Events.dropStuff); .click(Events.dropStuff);
@@ -595,7 +595,7 @@ var Events = {
}, },
createFighterDiv: function(chara, hp, maxhp) { createFighterDiv: function(chara, hp, maxhp) {
var fighter = $('<div>').addClass('fighter').text(chara).data('hp', hp).data('maxHp', maxhp); var fighter = $('<div>').addClass('fighter').text(_(chara)).data('hp', hp).data('maxHp', maxhp).data('refname',chara);
$('<div>').addClass('hp').text(hp+'/'+maxhp).appendTo(fighter); $('<div>').addClass('hp').text(hp+'/'+maxhp).appendTo(fighter);
return fighter; return fighter;
}, },
@@ -809,7 +809,7 @@ var Events = {
Engine.keyLock = false; Engine.keyLock = false;
// Force refocus on the body. I hate you, IE. // Force refocus on the body. I hate you, IE.
$('body').focus(); $('body').focus();
}); });
}, },
handleStateUpdates: function(e){ handleStateUpdates: function(e){
+48 -28
View File
@@ -4,7 +4,7 @@
Events.Encounters = [ Events.Encounters = [
/* Tier 1 */ /* Tier 1 */
{ /* Snarling Beast */ { /* Snarling Beast */
title: 'A Snarling Beast', title: _('A Snarling Beast'),
isAvailable: function() { isAvailable: function() {
return World.getDistance() <= 10 && World.getTerrain() == World.TILE.FOREST; return World.getDistance() <= 10 && World.getTerrain() == World.TILE.FOREST;
}, },
@@ -12,6 +12,8 @@ Events.Encounters = [
'start': { 'start': {
combat: true, combat: true,
enemy: 'snarling beast', enemy: 'snarling beast',
enemyName: _('snarling beast'),
deathMessage: _('the snarling beast is dead'),
chara: 'B', chara: 'B',
damage: 1, damage: 1,
hit: 0.8, hit: 0.8,
@@ -34,12 +36,12 @@ Events.Encounters = [
chance: 0.8 chance: 0.8
} }
}, },
notification: 'a snarling beast leaps out of the underbrush' notification: _('a snarling beast leaps out of the underbrush')
} }
} }
}, },
{ /* Gaunt Man */ { /* Gaunt Man */
title: 'A Gaunt Man', title: _('A Gaunt Man'),
isAvailable: function() { isAvailable: function() {
return World.getDistance() <= 10 && World.getTerrain() == World.TILE.BARRENS; return World.getDistance() <= 10 && World.getTerrain() == World.TILE.BARRENS;
}, },
@@ -47,6 +49,8 @@ Events.Encounters = [
'start': { 'start': {
combat: true, combat: true,
enemy: 'gaunt man', enemy: 'gaunt man',
enemyName: _('gaunt man'),
deathMessage: _('the gaunt man is dead'),
chara: 'G', chara: 'G',
damage: 2, damage: 2,
hit: 0.8, hit: 0.8,
@@ -69,19 +73,21 @@ Events.Encounters = [
chance: 0.5 chance: 0.5
} }
}, },
notification: 'a gaunt man approaches, a crazed look in his eye' notification: _('a gaunt man approaches, a crazed look in his eye')
} }
} }
}, },
{ /* Strange Bird */ { /* Strange Bird */
title: 'A Strange Bird', title: _('A Strange Bird'),
isAvailable: function() { isAvailable: function() {
return World.getDistance() <= 10 && World.getTerrain() == World.TILE.FIELD; return World.getDistance() <= 10 && World.getTerrain() == World.TILE.FIELD;
}, },
scenes: { scenes: {
'start': { 'start': {
combat: true, combat: true,
enemy: 'strange bird', enemy: 'strange bird',
enemyName: _('strange bird'),
deathMessage: _('the strange bird is dead'),
chara: 'B', chara: 'B',
damage: 3, damage: 3,
hit: 0.8, hit: 0.8,
@@ -104,20 +110,22 @@ Events.Encounters = [
chance: 0.8 chance: 0.8
} }
}, },
notification: 'a strange looking bird speeds across the plains' notification: _('a strange looking bird speeds across the plains')
} }
} }
}, },
/* Tier 2*/ /* Tier 2*/
{ /* Shivering Man */ { /* Shivering Man */
title: 'A Shivering Man', title: _('A Shivering Man'),
isAvailable: function() { isAvailable: function() {
return World.getDistance() > 10 && World.getDistance() <= 20 && World.getTerrain() == World.TILE.BARRENS; return World.getDistance() > 10 && World.getDistance() <= 20 && World.getTerrain() == World.TILE.BARRENS;
}, },
scenes: { scenes: {
'start': { 'start': {
combat: true, combat: true,
enemy: 'shivering man', enemy: 'shivering man',
enemyName: _('shivering man'),
deathMessage: _('the shivering man is dead'),
chara: 'S', chara: 'S',
damage: 5, damage: 5,
hit: 0.5, hit: 0.5,
@@ -145,19 +153,21 @@ Events.Encounters = [
chance: 0.7 chance: 0.7
} }
}, },
notification: 'a shivering man approaches and attacks with surprising strength' notification: _('a shivering man approaches and attacks with surprising strength')
} }
} }
}, },
{ /* Man-eater */ { /* Man-eater */
title: 'A Man-Eater', title: _('A Man-Eater'),
isAvailable: function() { isAvailable: function() {
return World.getDistance() > 10 && World.getDistance() <= 20 && World.getTerrain() == World.TILE.FOREST; return World.getDistance() > 10 && World.getDistance() <= 20 && World.getTerrain() == World.TILE.FOREST;
}, },
scenes: { scenes: {
'start': { 'start': {
combat: true, combat: true,
enemy: 'man-eater', enemy: 'man-eater',
enemyName: _('man-eater'),
deathMessage: _('the man-eater is dead'),
chara: 'E', chara: 'E',
damage: 3, damage: 3,
hit: 0.8, hit: 0.8,
@@ -180,19 +190,21 @@ Events.Encounters = [
chance: 0.8 chance: 0.8
} }
}, },
notification: 'a large creature attacks, claws freshly bloodied' notification: _('a large creature attacks, claws freshly bloodied')
} }
} }
}, },
{ /* Scavenger */ { /* Scavenger */
title: 'A Scavenger', title: _('A Scavenger'),
isAvailable: function() { isAvailable: function() {
return World.getDistance() > 10 && World.getDistance() <= 20 && World.getTerrain() == World.TILE.BARRENS; return World.getDistance() > 10 && World.getDistance() <= 20 && World.getTerrain() == World.TILE.BARRENS;
}, },
scenes: { scenes: {
'start': { 'start': {
combat: true, combat: true,
enemy: 'scavenger', enemy: 'scavenger',
enemyName: _('scavenger'),
deathMessage: _('the scavenger is dead'),
chara: 'S', chara: 'S',
damage: 4, damage: 4,
hit: 0.8, hit: 0.8,
@@ -220,19 +232,21 @@ Events.Encounters = [
chance: 0.1 chance: 0.1
} }
}, },
notification: 'a scavenger draws close, hoping for an easy score' notification: _('a scavenger draws close, hoping for an easy score')
} }
} }
}, },
{ /* Huge Lizard */ { /* Huge Lizard */
title: 'A Huge Lizard', title: _('A Huge Lizard'),
isAvailable: function() { isAvailable: function() {
return World.getDistance() > 10 && World.getDistance() <= 20 && World.getTerrain() == World.TILE.FIELD; return World.getDistance() > 10 && World.getDistance() <= 20 && World.getTerrain() == World.TILE.FIELD;
}, },
scenes: { scenes: {
'start': { 'start': {
combat: true, combat: true,
enemy: 'lizard', enemy: 'lizard',
enemyName: _('lizard'),
deathMessage: _('the lizard is dead'),
chara: 'L', chara: 'L',
damage: 5, damage: 5,
hit: 0.8, hit: 0.8,
@@ -255,20 +269,22 @@ Events.Encounters = [
chance: 0.8 chance: 0.8
} }
}, },
notification: 'the grass thrashes wildly as a huge lizard pushes through' notification: _('the grass thrashes wildly as a huge lizard pushes through')
} }
} }
}, },
/* Tier 3*/ /* Tier 3*/
{ /* Feral Terror */ { /* Feral Terror */
title: 'A Feral Terror', title: _('A Feral Terror'),
isAvailable: function() { isAvailable: function() {
return World.getDistance() > 20 && World.getTerrain() == World.TILE.FOREST; return World.getDistance() > 20 && World.getTerrain() == World.TILE.FOREST;
}, },
scenes: { scenes: {
'start': { 'start': {
combat: true, combat: true,
enemy: 'feral terror', enemy: 'feral terror',
enemyName: _('feral terror'),
deathMessage: _('the feral terror is dead'),
chara: 'F', chara: 'F',
damage: 6, damage: 6,
hit: 0.8, hit: 0.8,
@@ -291,19 +307,21 @@ Events.Encounters = [
chance: 0.8 chance: 0.8
} }
}, },
notification: 'a beast, wilder than imagining, erupts out of the foliage' notification: _('a beast, wilder than imagining, erupts out of the foliage')
} }
} }
}, },
{ /* Soldier */ { /* Soldier */
title: 'A Soldier', title: _('A Soldier'),
isAvailable: function() { isAvailable: function() {
return World.getDistance() > 20 && World.getTerrain() == World.TILE.BARRENS; return World.getDistance() > 20 && World.getTerrain() == World.TILE.BARRENS;
}, },
scenes: { scenes: {
'start': { 'start': {
combat: true, combat: true,
enemy: 'soldier', enemy: 'soldier',
enemyName: _('soldier'),
deathMessage: _('the soldier is dead'),
ranged: true, ranged: true,
chara: 'D', chara: 'D',
damage: 8, damage: 8,
@@ -332,19 +350,21 @@ Events.Encounters = [
chance: 0.1 chance: 0.1
} }
}, },
notification: 'a soldier opens fire from across the desert' notification: _('a soldier opens fire from across the desert')
} }
} }
}, },
{ /* Sniper */ { /* Sniper */
title: 'A Sniper', title: _('A Sniper'),
isAvailable: function() { isAvailable: function() {
return World.getDistance() > 20 && World.getTerrain() == World.TILE.FIELD; return World.getDistance() > 20 && World.getTerrain() == World.TILE.FIELD;
}, },
scenes: { scenes: {
'start': { 'start': {
combat: true, combat: true,
enemy: 'sniper', enemy: 'sniper',
enemyName: _('sniper'),
deathMessage: _('the sniper is dead'),
chara: 'S', chara: 'S',
damage: 15, damage: 15,
hit: 0.8, hit: 0.8,
@@ -373,7 +393,7 @@ Events.Encounters = [
chance: 0.1 chance: 0.1
} }
}, },
notification: 'a shot rings out, from somewhere in the long grass' notification: _('a shot rings out, from somewhere in the long grass')
} }
} }
} }
+13 -13
View File
@@ -3,33 +3,33 @@
**/ **/
Events.Global = [ Events.Global = [
{ /* The Thief */ { /* The Thief */
title: 'The Thief', title: _('The Thief'),
isAvailable: function() { isAvailable: function() {
return (Engine.activeModule == Room || Engine.activeModule == Outside) && $SM.get('game.thieves') == 1; return (Engine.activeModule == Room || Engine.activeModule == Outside) && $SM.get('game.thieves') == 1;
}, },
scenes: { scenes: {
'start': { 'start': {
text: [ text: [
'the villagers haul a filthy man out of the store room.', _('the villagers haul a filthy man out of the store room.'),
"say his folk have been skimming the supplies.", _("say his folk have been skimming the supplies."),
'say he should be strung up as an example.' _('say he should be strung up as an example.')
], ],
notification: 'a thief is caught', notification: _('a thief is caught'),
buttons: { buttons: {
'kill': { 'kill': {
text: 'hang him', text: _('hang him'),
nextScene: {1: 'hang'} nextScene: {1: 'hang'}
}, },
'spare': { 'spare': {
text: 'spare him', text: _('spare him'),
nextScene: {1: 'spare'} nextScene: {1: 'spare'}
} }
} }
}, },
'hang': { 'hang': {
text: [ text: [
'the villagers hang the thief high in front of the store room.', _('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.' _('the point is made. in the next few days, the missing supplies are returned.')
], ],
onLoad: function() { onLoad: function() {
$SM.set('game.thieves', 2); $SM.set('game.thieves', 2);
@@ -38,15 +38,15 @@ Events.Global = [
}, },
buttons: { buttons: {
'leave': { 'leave': {
text: 'leave', text: _('leave'),
nextScene: 'end' nextScene: 'end'
} }
} }
}, },
'spare': { 'spare': {
text: [ text: [
"the man says he's grateful. says he won't come around any more.", _("the man says he's grateful. says he won't come around any more."),
"shares what he knows about sneaking before he goes." _("shares what he knows about sneaking before he goes.")
], ],
onLoad: function() { onLoad: function() {
$SM.set('game.thieves', 2); $SM.set('game.thieves', 2);
@@ -55,7 +55,7 @@ Events.Global = [
}, },
buttons: { buttons: {
'leave': { 'leave': {
text: 'leave', text: _('leave'),
nextScene: 'end' nextScene: 'end'
} }
} }
+46 -46
View File
@@ -3,15 +3,15 @@
**/ **/
Events.Outside = [ Events.Outside = [
{ /* Ruined traps */ { /* Ruined traps */
title: 'A Ruined Trap', title: _('A Ruined Trap'),
isAvailable: function() { isAvailable: function() {
return Engine.activeModule == Outside && $SM.get('game.buildings["trap"]', true) > 0; return Engine.activeModule == Outside && $SM.get('game.buildings["trap"]', true) > 0;
}, },
scenes: { scenes: {
'start': { 'start': {
text: [ text: [
'some of the traps have been torn apart.', _('some of the traps have been torn apart.'),
'large prints lead away, into the forest.' _('large prints lead away, into the forest.')
], ],
onLoad: function() { onLoad: function() {
var numWrecked = Math.floor(Math.random() * $SM.get('game.buildings["trap"]', true)) + 1; var numWrecked = Math.floor(Math.random() * $SM.get('game.buildings["trap"]', true)) + 1;
@@ -19,34 +19,34 @@ Events.Outside = [
Outside.updateVillage(); Outside.updateVillage();
Outside.updateTrapButton(); Outside.updateTrapButton();
}, },
notification: 'some traps have been destroyed', notification: _('some traps have been destroyed'),
buttons: { buttons: {
'track': { 'track': {
text: 'track them', text: _('track them'),
nextScene: {0.5: 'nothing', 1: 'catch'} nextScene: {0.5: 'nothing', 1: 'catch'}
}, },
'ignore': { 'ignore': {
text: 'ignore them', text: _('ignore them'),
nextScene: 'end' nextScene: 'end'
} }
} }
}, },
'nothing': { 'nothing': {
text: [ text: [
'the tracks disappear after just a few minutes.', _('the tracks disappear after just a few minutes.'),
'the forest is silent.' _('the forest is silent.')
], ],
buttons: { buttons: {
'end': { 'end': {
text: 'go home', text: _('go home'),
nextScene: 'end' nextScene: 'end'
} }
} }
}, },
'catch': { 'catch': {
text: [ text: [
'not far from the village lies a large beast, its fur matted with blood.', _('not far from the village lies a large beast, its fur matted with blood.'),
'it puts up little resistance before the knife.' _('it puts up little resistance before the knife.')
], ],
reward: { reward: {
fur: 100, fur: 100,
@@ -55,7 +55,7 @@ Events.Outside = [
}, },
buttons: { buttons: {
'end': { 'end': {
text: 'go home', text: _('go home'),
nextScene: 'end' nextScene: 'end'
} }
} }
@@ -64,7 +64,7 @@ Events.Outside = [
}, },
{ /* Sickness */ { /* Sickness */
title: 'Sickness', title: _('Sickness'),
isAvailable: function() { isAvailable: function() {
return Engine.activeModule == Outside && return Engine.activeModule == Outside &&
$SM.get('game.population', true) > 10 && $SM.get('game.population', true) > 10 &&
@@ -74,37 +74,37 @@ Events.Outside = [
scenes: { scenes: {
'start': { 'start': {
text: [ text: [
'a sickness is spreading through the village.', _('a sickness is spreading through the village.'),
'medicine is needed immediately.' _('medicine is needed immediately.')
], ],
buttons: { buttons: {
'heal': { 'heal': {
text: '1 medicine', text: _('1 medicine'),
cost: { 'medicine' : 1 }, cost: { 'medicine' : 1 },
nextScene: {1: 'healed'} nextScene: {1: 'healed'}
}, },
'ignore': { 'ignore': {
text: 'ignore it', text: _('ignore it'),
nextScene: {1: 'death'} nextScene: {1: 'death'}
} }
} }
}, },
'healed': { 'healed': {
text: [ text: [
'the sickness is cured in time.' _('the sickness is cured in time.')
], ],
buttons: { buttons: {
'end': { 'end': {
text: 'go home', text: _('go home'),
nextScene: 'end' nextScene: 'end'
} }
} }
}, },
'death': { 'death': {
text: [ text: [
'the sickness spreads through the village.', _('the sickness spreads through the village.'),
'the days are spent with burials.', _('the days are spent with burials.'),
'the nights are rent with screams.' _('the nights are rent with screams.')
], ],
onLoad: function() { onLoad: function() {
var numKilled = Math.floor(Math.random() * 20) + 1; var numKilled = Math.floor(Math.random() * 20) + 1;
@@ -112,7 +112,7 @@ Events.Outside = [
}, },
buttons: { buttons: {
'end': { 'end': {
text: 'go home', text: _('go home'),
nextScene: 'end' nextScene: 'end'
} }
} }
@@ -121,33 +121,33 @@ Events.Outside = [
}, },
{ /* Plague */ { /* Plague */
title: 'Plague', title: _('Plague'),
isAvailable: function() { isAvailable: function() {
return Engine.activeModule == Outside && $SM.get('game.population', true) > 50 && $SM.get('stores.medicine', true) > 0; return Engine.activeModule == Outside && $SM.get('game.population', true) > 50 && $SM.get('stores.medicine', true) > 0;
}, },
scenes: { scenes: {
'start': { 'start': {
text: [ text: [
'a terrible plague is fast spreading through the village.', _('a terrible plague is fast spreading through the village.'),
'medicine is needed immediately.' _('medicine is needed immediately.')
], ],
buttons: { buttons: {
'heal': { 'heal': {
text: '5 medicine', text: _('5 medicine'),
cost: { 'medicine' : 5 }, cost: { 'medicine' : 5 },
nextScene: {1: 'healed'} nextScene: {1: 'healed'}
}, },
'ignore': { 'ignore': {
text: 'do nothing', text: _('do nothing'),
nextScene: {1: 'death'} nextScene: {1: 'death'}
} }
} }
}, },
'healed': { 'healed': {
text: [ text: [
'the plague is kept from spreading.', _('the plague is kept from spreading.'),
'only a few die.', _('only a few die.'),
'the rest bury them.' _('the rest bury them.')
], ],
onLoad: function() { onLoad: function() {
var numKilled = Math.floor(Math.random() * 5) + 2; var numKilled = Math.floor(Math.random() * 5) + 2;
@@ -155,16 +155,16 @@ Events.Outside = [
}, },
buttons: { buttons: {
'end': { 'end': {
text: 'go home', text: _('go home'),
nextScene: 'end' nextScene: 'end'
} }
} }
}, },
'death': { 'death': {
text: [ text: [
'the plague rips through the village.', _('the plague rips through the village.'),
'the nights are rent with screams.', _('the nights are rent with screams.'),
'the only hope is a quick death.' _('the only hope is a quick death.')
], ],
onLoad: function() { onLoad: function() {
var numKilled = Math.floor(Math.random() * 80) + 10; var numKilled = Math.floor(Math.random() * 80) + 10;
@@ -172,7 +172,7 @@ Events.Outside = [
}, },
buttons: { buttons: {
'end': { 'end': {
text: 'go home', text: _('go home'),
nextScene: 'end' nextScene: 'end'
} }
} }
@@ -181,16 +181,16 @@ Events.Outside = [
}, },
{ /* Beast attack */ { /* Beast attack */
title: 'A Beast Attack', title: _('A Beast Attack'),
isAvailable: function() { isAvailable: function() {
return Engine.activeModule == Outside && $SM.get('game.population', true) > 0; return Engine.activeModule == Outside && $SM.get('game.population', true) > 0;
}, },
scenes: { scenes: {
'start': { 'start': {
text: [ text: [
'a pack of snarling beasts pours out of the trees.', _('a pack of snarling beasts pours out of the trees.'),
'the fight is short and bloody, but the beasts are repelled.', _('the fight is short and bloody, but the beasts are repelled.'),
'the villagers retreat to mourn the dead.' _('the villagers retreat to mourn the dead.')
], ],
onLoad: function() { onLoad: function() {
var numKilled = Math.floor(Math.random() * 10) + 1; var numKilled = Math.floor(Math.random() * 10) + 1;
@@ -203,7 +203,7 @@ Events.Outside = [
}, },
buttons: { buttons: {
'end': { 'end': {
text: 'go home', text: _('go home'),
nextScene: 'end' nextScene: 'end'
} }
} }
@@ -212,16 +212,16 @@ Events.Outside = [
}, },
{ /* Soldier attack */ { /* Soldier attack */
title: 'A Military Raid', title: _('A Military Raid'),
isAvailable: function() { isAvailable: function() {
return Engine.activeModule == Outside && $SM.get('game.population', true) > 0 && $SM.get('game.cityCleared');; return Engine.activeModule == Outside && $SM.get('game.population', true) > 0 && $SM.get('game.cityCleared');;
}, },
scenes: { scenes: {
'start': { 'start': {
text: [ text: [
'a gunshot rings through the trees.', _('a gunshot rings through the trees.'),
'well armed men charge out of the forest, firing into the crowd.', _('well armed men charge out of the forest, firing into the crowd.'),
'after a skirmish they are driven away, but not without losses.' _('after a skirmish they are driven away, but not without losses.')
], ],
onLoad: function() { onLoad: function() {
var numKilled = Math.floor(Math.random() * 40) + 1; var numKilled = Math.floor(Math.random() * 40) + 1;
@@ -233,7 +233,7 @@ Events.Outside = [
}, },
buttons: { buttons: {
'end': { 'end': {
text: 'go home', text: _('go home'),
nextScene: 'end' nextScene: 'end'
} }
} }
+120 -120
View File
@@ -3,82 +3,82 @@
**/ **/
Events.Room = [ Events.Room = [
{ /* The Nomad -- Merchant */ { /* The Nomad -- Merchant */
title: 'The Nomad', title: _('The Nomad'),
isAvailable: function() { isAvailable: function() {
return Engine.activeModule == Room && $SM.get('stores.fur', true) > 0; return Engine.activeModule == Room && $SM.get('stores.fur', true) > 0;
}, },
scenes: { scenes: {
'start': { 'start': {
text: [ text: [
'a nomad shuffles into view, laden with makeshift bags bound with rough twine.', _('a nomad shuffles into view, laden with makeshift bags bound with rough twine.'),
"won't say from where he came, but it's clear that he's not staying." _("won't say from where he came, but it's clear that he's not staying.")
], ],
notification: 'a nomad arrives, looking to trade', notification: _('a nomad arrives, looking to trade'),
buttons: { buttons: {
'buyScales': { 'buyScales': {
text: 'buy scales', text: _('buy scales'),
cost: { 'fur': 100 }, cost: { 'fur': 100 },
reward: { 'scales': 1 } reward: { 'scales': 1 }
}, },
'buyTeeth': { 'buyTeeth': {
text: 'buy teeth', text: _('buy teeth'),
cost: { 'fur': 200 }, cost: { 'fur': 200 },
reward: { 'teeth': 1 } reward: { 'teeth': 1 }
}, },
'buyBait': { 'buyBait': {
text: 'buy bait', text: _('buy bait'),
cost: { 'fur': 5 }, cost: { 'fur': 5 },
reward: { 'bait': 1 }, reward: { 'bait': 1 },
notification: 'traps are more effective with bait.' notification: _('traps are more effective with bait.')
}, },
'buyCompass': { 'buyCompass': {
available: function() { available: function() {
return $SM.get('stores.compass', true) < 1; return $SM.get('stores.compass', true) < 1;
}, },
text: 'buy compass', text: _('buy compass'),
cost: { fur: 300, scales: 15, teeth: 5 }, cost: { fur: 300, scales: 15, teeth: 5 },
reward: { 'compass': 1 }, reward: { 'compass': 1 },
notification: 'the old compass is dented and dusty, but it looks to work.', notification: _('the old compass is dented and dusty, but it looks to work.'),
onChoose: Path.openPath onChoose: Path.openPath
}, },
'goodbye': { 'goodbye': {
text: 'say goodbye', text: _('say goodbye'),
nextScene: 'end' nextScene: 'end'
} }
} }
} }
} }
}, { /* Noises Outside -- gain wood/fur */ }, { /* Noises Outside -- gain wood/fur */
title: 'Noises', title: _('Noises'),
isAvailable: function() { isAvailable: function() {
return Engine.activeModule == Room && $SM.get('stores.wood'); return Engine.activeModule == Room && $SM.get('stores.wood');
}, },
scenes: { scenes: {
'start': { 'start': {
text: [ text: [
'through the walls, shuffling noises can be heard.', _('through the walls, shuffling noises can be heard.'),
"can't tell what they're up to." _("can't tell what they're up to.")
], ],
notification: 'strange noises can be heard through the walls', notification: _('strange noises can be heard through the walls'),
buttons: { buttons: {
'investigate': { 'investigate': {
text: 'investigate', text: _('investigate'),
nextScene: { 0.3: 'stuff', 1: 'nothing' } nextScene: { 0.3: 'stuff', 1: 'nothing' }
}, },
'ignore': { 'ignore': {
text: 'ignore them', text: _('ignore them'),
nextScene: 'end' nextScene: 'end'
} }
} }
}, },
'nothing': { 'nothing': {
text: [ text: [
'vague shapes move, just out of sight.', _('vague shapes move, just out of sight.'),
'the sounds stop.' _('the sounds stop.')
], ],
buttons: { buttons: {
'backinside': { 'backinside': {
text: 'go back inside', text: _('go back inside'),
nextScene: 'end' nextScene: 'end'
} }
} }
@@ -86,12 +86,12 @@ Events.Room = [
'stuff': { 'stuff': {
reward: { wood: 100, fur: 10 }, reward: { wood: 100, fur: 10 },
text: [ text: [
'a bundle of sticks lies just beyond the threshold, wrapped in coarse furs.', _('a bundle of sticks lies just beyond the threshold, wrapped in coarse furs.'),
'the night is silent.' _('the night is silent.')
], ],
buttons: { buttons: {
'backinside': { 'backinside': {
text: 'go back inside', text: _('go back inside'),
nextScene: 'end' nextScene: 'end'
} }
} }
@@ -99,32 +99,32 @@ Events.Room = [
} }
}, },
{ /* Noises Inside -- trade wood for better good */ { /* Noises Inside -- trade wood for better good */
title: 'Noises', title: _('Noises'),
isAvailable: function() { isAvailable: function() {
return Engine.activeModule == Room && $SM.get('stores.wood'); return Engine.activeModule == Room && $SM.get('stores.wood');
}, },
scenes: { scenes: {
start: { start: {
text: [ text: [
'scratching noises can be heard from the store room.', _('scratching noises can be heard from the store room.'),
'something\'s in there.' _('something\'s in there.')
], ],
notification: 'something\'s in the store room', notification: _('something\'s in the store room'),
buttons: { buttons: {
'investigate': { 'investigate': {
text: 'investigate', text: _('investigate'),
nextScene: { 0.5: 'scales', 0.8: 'teeth', 1: 'cloth' } nextScene: { 0.5: 'scales', 0.8: 'teeth', 1: 'cloth' }
}, },
'ignore': { 'ignore': {
text: 'ignore them', text: _('ignore them'),
nextScene: 'end' nextScene: 'end'
} }
} }
}, },
scales: { scales: {
text: [ text: [
'some wood is missing.', _('some wood is missing.'),
'the ground is littered with small scales' _('the ground is littered with small scales')
], ],
onLoad: function() { onLoad: function() {
var numWood = $SM.get('stores.wood', true); var numWood = $SM.get('stores.wood', true);
@@ -136,15 +136,15 @@ Events.Room = [
}, },
buttons: { buttons: {
'leave': { 'leave': {
text: 'leave', text: _('leave'),
nextScene: 'end' nextScene: 'end'
} }
} }
}, },
teeth: { teeth: {
text: [ text: [
'some wood is missing.', _('some wood is missing.'),
'the ground is littered with small teeth' _('the ground is littered with small teeth')
], ],
onLoad: function() { onLoad: function() {
var numWood = $SM.get('stores.wood', true); var numWood = $SM.get('stores.wood', true);
@@ -156,15 +156,15 @@ Events.Room = [
}, },
buttons: { buttons: {
'leave': { 'leave': {
text: 'leave', text: _('leave'),
nextScene: 'end' nextScene: 'end'
} }
} }
}, },
cloth: { cloth: {
text: [ text: [
'some wood is missing.', _('some wood is missing.'),
'the ground is littered with scraps of cloth' _('the ground is littered with scraps of cloth')
], ],
onLoad: function() { onLoad: function() {
var numWood = $SM.get('stores.wood', true); var numWood = $SM.get('stores.wood', true);
@@ -176,7 +176,7 @@ Events.Room = [
}, },
buttons: { buttons: {
'leave': { 'leave': {
text: 'leave', text: _('leave'),
nextScene: 'end' nextScene: 'end'
} }
} }
@@ -184,30 +184,30 @@ Events.Room = [
} }
}, },
{ /* The Beggar -- trade fur for better good */ { /* The Beggar -- trade fur for better good */
title: 'The Beggar', title: _('The Beggar'),
isAvailable: function() { isAvailable: function() {
return Engine.activeModule == Room && $SM.get('stores.fur'); return Engine.activeModule == Room && $SM.get('stores.fur');
}, },
scenes: { scenes: {
start: { start: {
text: [ text: [
'a beggar arrives.', _('a beggar arrives.'),
'asks for any spare furs to keep him warm at night.' _('asks for any spare furs to keep him warm at night.')
], ],
notification: 'a beggar arrives', notification: _('a beggar arrives'),
buttons: { buttons: {
'50furs': { '50furs': {
text: 'give 50', text: _('give 50'),
cost: {fur: 50}, cost: {fur: 50},
nextScene: { 0.5: 'scales', 0.8: 'teeth', 1: 'cloth' } nextScene: { 0.5: 'scales', 0.8: 'teeth', 1: 'cloth' }
}, },
'100furs': { '100furs': {
text: 'give 100', text: _('give 100'),
cost: {fur: 100}, cost: {fur: 100},
nextScene: { 0.5: 'teeth', 0.8: 'scales', 1: 'cloth' } nextScene: { 0.5: 'teeth', 0.8: 'scales', 1: 'cloth' }
}, },
'deny': { 'deny': {
text: 'turn him away', text: _('turn him away'),
nextScene: 'end' nextScene: 'end'
} }
} }
@@ -215,12 +215,12 @@ Events.Room = [
scales: { scales: {
reward: { scales: 20 }, reward: { scales: 20 },
text: [ text: [
'the beggar expresses his thanks.', _('the beggar expresses his thanks.'),
'leaves a pile of small scales behind.' _('leaves a pile of small scales behind.')
], ],
buttons: { buttons: {
'leave': { 'leave': {
text: 'say goodbye', text: _('say goodbye'),
nextScene: 'end' nextScene: 'end'
} }
} }
@@ -228,12 +228,12 @@ Events.Room = [
teeth: { teeth: {
reward: { teeth: 20 }, reward: { teeth: 20 },
text: [ text: [
'the beggar expresses his thanks.', _('the beggar expresses his thanks.'),
'leaves a pile of small teeth behind.' _('leaves a pile of small teeth behind.')
], ],
buttons: { buttons: {
'leave': { 'leave': {
text: 'say goodbye', text: _('say goodbye'),
nextScene: 'end' nextScene: 'end'
} }
} }
@@ -241,12 +241,12 @@ Events.Room = [
cloth: { cloth: {
reward: { cloth: 20 }, reward: { cloth: 20 },
text: [ text: [
'the beggar expresses his thanks.', _('the beggar expresses his thanks.'),
'leaves some scraps of cloth behind.' _('leaves some scraps of cloth behind.')
], ],
buttons: { buttons: {
'leave': { 'leave': {
text: 'say goodbye', text: _('say goodbye'),
nextScene: 'end' nextScene: 'end'
} }
} }
@@ -255,68 +255,68 @@ Events.Room = [
}, },
{ /* Mysterious Wanderer -- wood gambling */ { /* Mysterious Wanderer -- wood gambling */
title: 'The Mysterious Wanderer', title: _('The Mysterious Wanderer'),
isAvailable: function() { isAvailable: function() {
return Engine.activeModule == Room && $SM.get('stores.wood'); return Engine.activeModule == Room && $SM.get('stores.wood');
}, },
scenes: { scenes: {
start: { start: {
text: [ text: [
'a wanderer arrives with an empty cart. says if he leaves with wood, he\'ll be back with more.', _('a wanderer arrives with an empty cart. says if he leaves with wood, he\'ll be back with more.'),
"builder's not sure he's to be trusted." _("builder's not sure he's to be trusted.")
], ],
notification: 'a mysterious wanderer arrives', notification: _('a mysterious wanderer arrives'),
buttons: { buttons: {
'100wood': { '100wood': {
text: 'give 100', text: _('give 100'),
cost: {wood: 100}, cost: {wood: 100},
nextScene: { 1: '100wood'} nextScene: { 1: '100wood'}
}, },
'500wood': { '500wood': {
text: 'give 500', text: _('give 500'),
cost: {wood: 500}, cost: {wood: 500},
nextScene: { 1: '500wood' } nextScene: { 1: '500wood' }
}, },
'deny': { 'deny': {
text: 'turn him away', text: _('turn him away'),
nextScene: 'end' nextScene: 'end'
} }
} }
}, },
'100wood': { '100wood': {
text: [ text: [
'the wanderer leaves, cart loaded with wood' _('the wanderer leaves, cart loaded with wood')
], ],
onLoad: function() { onLoad: function() {
if(Math.random() < 0.5) { if(Math.random() < 0.5) {
setTimeout(function() { setTimeout(function() {
$SM.add('stores.wood', 300); $SM.add('stores.wood', 300);
Notifications.notify(Room, 'the mysterious wanderer returns, cart piled high with wood.'); Notifications.notify(Room, _('the mysterious wanderer returns, cart piled high with wood.'));
}, 60 * 1000); }, 60 * 1000);
} }
}, },
buttons: { buttons: {
'leave': { 'leave': {
text: 'say goodbye', text: _('say goodbye'),
nextScene: 'end' nextScene: 'end'
} }
} }
}, },
'500wood': { '500wood': {
text: [ text: [
'the wanderer leaves, cart loaded with wood' _('the wanderer leaves, cart loaded with wood')
], ],
onLoad: function() { onLoad: function() {
if(Math.random() < 0.3) { if(Math.random() < 0.3) {
setTimeout(function() { setTimeout(function() {
$SM.add('stores.wood', 1500); $SM.add('stores.wood', 1500);
Notifications.notify(Room, 'the mysterious wanderer returns, cart piled high with wood.'); Notifications.notify(Room, _('the mysterious wanderer returns, cart piled high with wood.'));
}, 60 * 1000); }, 60 * 1000);
} }
}, },
buttons: { buttons: {
'leave': { 'leave': {
text: 'say goodbye', text: _('say goodbye'),
nextScene: 'end' nextScene: 'end'
} }
} }
@@ -325,68 +325,68 @@ Events.Room = [
}, },
{ /* Mysterious Wanderer -- fur gambling */ { /* Mysterious Wanderer -- fur gambling */
title: 'The Mysterious Wanderer', title: _('The Mysterious Wanderer'),
isAvailable: function() { isAvailable: function() {
return Engine.activeModule == Room && $SM.get('stores.fur'); return Engine.activeModule == Room && $SM.get('stores.fur');
}, },
scenes: { scenes: {
start: { start: {
text: [ text: [
'a wanderer arrives with an empty cart. says if she leaves with furs, she\'ll be back with more.', _('a wanderer arrives with an empty cart. says if she leaves with furs, she\'ll be back with more.'),
"builder's not sure she's to be trusted." _("builder's not sure she's to be trusted.")
], ],
notification: 'a mysterious wanderer arrives', notification: _('a mysterious wanderer arrives'),
buttons: { buttons: {
'100fur': { '100fur': {
text: 'give 100', text: _('give 100'),
cost: {fur: 100}, cost: {fur: 100},
nextScene: { 1: '100fur'} nextScene: { 1: '100fur'}
}, },
'500fur': { '500fur': {
text: 'give 500', text: _('give 500'),
cost: {fur: 500}, cost: {fur: 500},
nextScene: { 1: '500fur' } nextScene: { 1: '500fur' }
}, },
'deny': { 'deny': {
text: 'turn her away', text: _('turn her away'),
nextScene: 'end' nextScene: 'end'
} }
} }
}, },
'100fur': { '100fur': {
text: [ text: [
'the wanderer leaves, cart loaded with furs' _('the wanderer leaves, cart loaded with furs')
], ],
onLoad: function() { onLoad: function() {
if(Math.random() < 0.5) { if(Math.random() < 0.5) {
setTimeout(function() { setTimeout(function() {
$SM.add('stores.fur', 300); $SM.add('stores.fur', 300);
Notifications.notify(Room, 'the mysterious wanderer returns, cart piled high with furs.'); Notifications.notify(Room, _('the mysterious wanderer returns, cart piled high with furs.'));
}, 60 * 1000); }, 60 * 1000);
} }
}, },
buttons: { buttons: {
'leave': { 'leave': {
text: 'say goodbye', text: _('say goodbye'),
nextScene: 'end' nextScene: 'end'
} }
} }
}, },
'500fur': { '500fur': {
text: [ text: [
'the wanderer leaves, cart loaded with furs' _('the wanderer leaves, cart loaded with furs')
], ],
onLoad: function() { onLoad: function() {
if(Math.random() < 0.3) { if(Math.random() < 0.3) {
setTimeout(function() { setTimeout(function() {
$SM.add('stores.fur', 1500); $SM.add('stores.fur', 1500);
Notifications.notify(Room, 'the mysterious wanderer returns, cart piled high with furs.'); Notifications.notify(Room, _('the mysterious wanderer returns, cart piled high with furs.'));
}, 60 * 1000); }, 60 * 1000);
} }
}, },
buttons: { buttons: {
'leave': { 'leave': {
text: 'say goodbye', text: _('say goodbye'),
nextScene: 'end' nextScene: 'end'
} }
} }
@@ -395,26 +395,26 @@ Events.Room = [
}, },
{ /* The Scout -- Map Merchant */ { /* The Scout -- Map Merchant */
title: 'The Scout', title: _('The Scout'),
isAvailable: function() { isAvailable: function() {
return Engine.activeModule == Room && $SM.get('features.location.world'); return Engine.activeModule == Room && $SM.get('features.location.world');
}, },
scenes: { scenes: {
'start': { 'start': {
text: [ text: [
"the scout says she's been all over.", _("the scout says she's been all over."),
"willing to talk about it, for a price." _("willing to talk about it, for a price.")
], ],
notification: 'a scout stops for the night', notification: _('a scout stops for the night'),
buttons: { buttons: {
'buyMap': { 'buyMap': {
text: 'buy map', text: _('buy map'),
cost: { 'fur': 200, 'scales': 10 }, cost: { 'fur': 200, 'scales': 10 },
notification: 'the map uncovers a bit of the world', notification: _('the map uncovers a bit of the world'),
onChoose: World.applyMap onChoose: World.applyMap
}, },
'learn': { 'learn': {
text: 'learn scouting', text: _('learn scouting'),
cost: { 'fur': 1000, 'scales': 50, 'teeth': 20 }, cost: { 'fur': 1000, 'scales': 50, 'teeth': 20 },
available: function() { available: function() {
return !$SM.hasPerk('scout'); return !$SM.hasPerk('scout');
@@ -424,7 +424,7 @@ Events.Room = [
} }
}, },
'leave': { 'leave': {
text: 'say goodbye', text: _('say goodbye'),
nextScene: 'end' nextScene: 'end'
} }
} }
@@ -433,20 +433,20 @@ Events.Room = [
}, },
{ /* The Wandering Master */ { /* The Wandering Master */
title: 'The Master', title: _('The Master'),
isAvailable: function() { isAvailable: function() {
return Engine.activeModule == Room && $SM.get('features.location.world'); return Engine.activeModule == Room && $SM.get('features.location.world');
}, },
scenes: { scenes: {
'start': { 'start': {
text: [ text: [
'an old wanderer arrives.', _('an old wanderer arrives.'),
'he smiles warmly and asks for lodgings for the night.' _('he smiles warmly and asks for lodgings for the night.')
], ],
notification: 'an old wanderer arrives', notification: _('an old wanderer arrives'),
buttons: { buttons: {
'agree': { 'agree': {
text: 'agree', text: _('agree'),
cost: { cost: {
'cured meat': 100, 'cured meat': 100,
'fur': 100, 'fur': 100,
@@ -455,18 +455,18 @@ Events.Room = [
nextScene: {1: 'agree'} nextScene: {1: 'agree'}
}, },
'deny': { 'deny': {
text: 'turn him away', text: _('turn him away'),
nextScene: 'end' nextScene: 'end'
} }
} }
}, },
'agree': { 'agree': {
text: [ text: [
'in exchange, the wanderer offers his wisdom.' _('in exchange, the wanderer offers his wisdom.')
], ],
buttons: { buttons: {
'evasion': { 'evasion': {
text: 'evasion', text: _('evasion'),
available: function() { available: function() {
return !$SM.hasPerk('evasive'); return !$SM.hasPerk('evasive');
}, },
@@ -476,7 +476,7 @@ Events.Room = [
nextScene: 'end' nextScene: 'end'
}, },
'precision': { 'precision': {
text: 'precision', text: _('precision'),
available: function() { available: function() {
return !$SM.hasPerk('precise'); return !$SM.hasPerk('precise');
}, },
@@ -486,7 +486,7 @@ Events.Room = [
nextScene: 'end' nextScene: 'end'
}, },
'force': { 'force': {
text: 'force', text: _('force'),
available: function() { available: function() {
return !$SM.hasPerk('barbarian'); return !$SM.hasPerk('barbarian');
}, },
@@ -496,7 +496,7 @@ Events.Room = [
nextScene: 'end' nextScene: 'end'
}, },
'nothing': { 'nothing': {
text: 'nothing', text: _('nothing'),
nextScene: 'end' nextScene: 'end'
} }
} }
@@ -505,85 +505,85 @@ Events.Room = [
}, },
{ /* The Sick Man */ { /* The Sick Man */
title: 'The Sick Man', title: _('The Sick Man'),
isAvailable: function() { isAvailable: function() {
return Engine.activeModule == Room && $SM.get('stores.medicine', true) > 0; return Engine.activeModule == Room && $SM.get('stores.medicine', true) > 0;
}, },
scenes: { scenes: {
'start': { 'start': {
text: [ text: [
"a man hobbles up, coughing.", _("a man hobbles up, coughing."),
"he begs for medicine." _("he begs for medicine.")
], ],
notification: 'a sick man hobbles up', notification: _('a sick man hobbles up'),
buttons: { buttons: {
'help': { 'help': {
text: 'give 1 medicine', text: _('give 1 medicine'),
cost: { 'medicine': 1 }, cost: { 'medicine': 1 },
notification: 'the man swallows the medicine eagerly', notification: _('the man swallows the medicine eagerly'),
nextScene: { 0.1: 'alloy', 0.3: 'cells', 0.5: 'scales', 1.0: 'nothing' } nextScene: { 0.1: 'alloy', 0.3: 'cells', 0.5: 'scales', 1.0: 'nothing' }
}, },
'ignore': { 'ignore': {
text: 'tell him to leave', text: _('tell him to leave'),
nextScene: 'end' nextScene: 'end'
} }
} }
}, },
'alloy': { 'alloy': {
text: [ text: [
"the man is thankful.", _("the man is thankful."),
'he leaves a reward.', _('he leaves a reward.'),
'some weird metal he picked up on his travels.' _('some weird metal he picked up on his travels.')
], ],
onLoad: function() { onLoad: function() {
$SM.add('stores["alien alloy"]', 1); $SM.add('stores["alien alloy"]', 1);
}, },
buttons: { buttons: {
'bye': { 'bye': {
text: 'say goodbye', text: _('say goodbye'),
nextScene: 'end' nextScene: 'end'
} }
} }
}, },
'cells': { 'cells': {
text: [ text: [
"the man is thankful.", _("the man is thankful."),
'he leaves a reward.', _('he leaves a reward.'),
'some weird glowing boxes he picked up on his travels.' _('some weird glowing boxes he picked up on his travels.')
], ],
onLoad: function() { onLoad: function() {
$SM.add('stores["energy cell"]', 3); $SM.add('stores["energy cell"]', 3);
}, },
buttons: { buttons: {
'bye': { 'bye': {
text: 'say goodbye', text: _('say goodbye'),
nextScene: 'end' nextScene: 'end'
} }
} }
}, },
'scales': { 'scales': {
text: [ text: [
"the man is thankful.", _("the man is thankful."),
'he leaves a reward.', _('he leaves a reward.'),
'all he has are some scales.' _('all he has are some scales.')
], ],
onLoad: function() { onLoad: function() {
$SM.add('stores.scales', 5); $SM.add('stores.scales', 5);
}, },
buttons: { buttons: {
'bye': { 'bye': {
text: 'say goodbye', text: _('say goodbye'),
nextScene: 'end' nextScene: 'end'
} }
} }
}, },
'nothing': { 'nothing': {
text: [ text: [
"the man expresses his thanks and hobbles off." _("the man expresses his thanks and hobbles off.")
], ],
buttons: { buttons: {
'bye': { 'bye': {
text: 'say goodbye', text: _('say goodbye'),
nextScene: 'end' nextScene: 'end'
} }
} }
+413 -413
View File
File diff suppressed because it is too large Load Diff
+27
View File
@@ -0,0 +1,27 @@
(function(){
//only used for poedit to find translatable strings
var keywords = [ _('saved.'), _('wood'),_('builder'),_('teeth'),_('meat'),_('fur'), _('alien alloy'), _('bullets'),
_('charm'),_('leather'),_('iron'), _('steel'), _('coal'), _('enegy cell'),
_('torch'),_('medicine'),_('hunter'),_('trapper'),_('tanner'),
_("charcutier"),_('iron miner'),_('coal miner'), _('sulphur miner'), _('armourer'),
_('steelworker'),_('bait'),_('cured meat'), _('scales'), _('compass'), _('laser rifle'),
_('gatherer'),_('cloth'), _('scales'), _('cured meat'), _('thieves'),
_('not enough fur'), _('not enough wood'), _('not enough coal'), _('not enough iron'), _('not enough steel'), _('baited trap'),
_('not enough scales'), _('not enough teeth'), _('not enough leather'),
_('the compass points east.'), _('the compass points west.'), _('the compass points north.'), _('the compass points south.'),
_('the compass points northeast.'), _('the compass points northwest.'), _('the compass points southeast.'), _('the compass points southwest.')];
delete keywords;
//translate text in css by overriding attributes
$("<style>").text('\
div#stores:before{ content: \''+ _("stores") + '\'}\
div#weapons:before{ content: \''+ _("weapons") + '\'}\
div#buildBtns:before{ content: \''+ _("build:") + '\'}\
div#craftBtns:before{ content: \''+ _("craft:") + '\'}\
div#buyBtns:before{ content: \''+ _("buy:") + '\'}\
div#outfitting:before{ content: \''+ _("supplies:") + '\'}\
div#perks:before{ content: \''+ _("perks:") + '\'}\
div#lootButtons:before { content: \''+ _("take:") + '\'}\
div#village:before{ content: \''+_('forest')+'\'}\
').appendTo($('head'));
})();
+51 -38
View File
@@ -2,7 +2,7 @@
* Module that registers the outdoors functionality * Module that registers the outdoors functionality
*/ */
var Outside = { var Outside = {
name: "Outside", name: _("Outside"),
_GATHER_DELAY: 60, _GATHER_DELAY: 60,
_TRAPS_DELAY: 90, _TRAPS_DELAY: 90,
@@ -10,12 +10,14 @@ var Outside = {
_INCOME: { _INCOME: {
'gatherer': { 'gatherer': {
name: _('gatherer'),
delay: 10, delay: 10,
stores: { stores: {
'wood': 1 'wood': 1
} }
}, },
'hunter': { 'hunter': {
name: _('hunter'),
delay: 10, delay: 10,
stores: { stores: {
'fur': 0.5, 'fur': 0.5,
@@ -23,6 +25,7 @@ var Outside = {
} }
}, },
'trapper': { 'trapper': {
name: _('trapper'),
delay: 10, delay: 10,
stores: { stores: {
'meat': -1, 'meat': -1,
@@ -30,6 +33,7 @@ var Outside = {
} }
}, },
'tanner': { 'tanner': {
name: _('tanner'),
delay: 10, delay: 10,
stores: { stores: {
'fur': -5, 'fur': -5,
@@ -37,6 +41,7 @@ var Outside = {
} }
}, },
'charcutier': { 'charcutier': {
name: _('charcutier'),
delay: 10, delay: 10,
stores: { stores: {
'meat': -5, 'meat': -5,
@@ -45,6 +50,7 @@ var Outside = {
} }
}, },
'iron miner': { 'iron miner': {
name: _('iron miner'),
delay: 10, delay: 10,
stores: { stores: {
'cured meat': -1, 'cured meat': -1,
@@ -52,6 +58,7 @@ var Outside = {
} }
}, },
'coal miner': { 'coal miner': {
name: _('coal miner'),
delay: 10, delay: 10,
stores: { stores: {
'cured meat': -1, 'cured meat': -1,
@@ -59,6 +66,7 @@ var Outside = {
} }
}, },
'sulphur miner': { 'sulphur miner': {
name: _('sulphur miner'),
delay: 10, delay: 10,
stores: { stores: {
'cured meat': -1, 'cured meat': -1,
@@ -66,6 +74,7 @@ var Outside = {
} }
}, },
'steelworker': { 'steelworker': {
name: _('steelworker'),
delay: 10, delay: 10,
stores: { stores: {
'iron': -1, 'iron': -1,
@@ -74,6 +83,7 @@ var Outside = {
} }
}, },
'armourer': { 'armourer': {
name: _('armourer'),
delay: 10, delay: 10,
stores: { stores: {
'steel': -1, 'steel': -1,
@@ -87,32 +97,32 @@ var Outside = {
{ {
rollUnder: 0.5, rollUnder: 0.5,
name: 'fur', name: 'fur',
message: 'scraps of fur' message: _('scraps of fur')
}, },
{ {
rollUnder: 0.75, rollUnder: 0.75,
name: 'meat', name: 'meat',
message: 'bits of meat' message: _('bits of meat')
}, },
{ {
rollUnder: 0.85, rollUnder: 0.85,
name: 'scales', name: 'scales',
message: 'strange scales' message: _('strange scales')
}, },
{ {
rollUnder: 0.93, rollUnder: 0.93,
name: 'teeth', name: 'teeth',
message: 'scattered teeth' message: _('scattered teeth')
}, },
{ {
rollUnder: 0.995, rollUnder: 0.995,
name: 'cloth', name: 'cloth',
message: 'tattered cloth' message: _('tattered cloth')
}, },
{ {
rollUnder: 1.0, rollUnder: 1.0,
name: 'charm', name: 'charm',
message: 'a crudely made charm' message: _('a crudely made charm')
} }
], ],
@@ -128,7 +138,7 @@ var Outside = {
} }
// Create the outside tab // Create the outside tab
this.tab = Header.addLocation("A Silent Forest", "outside", Outside); this.tab = Header.addLocation(_("A Silent Forest"), "outside", Outside);
// Create the Outside panel // Create the Outside panel
this.panel = $('<div>').attr('id', "outsidePanel") this.panel = $('<div>').attr('id', "outsidePanel")
@@ -153,7 +163,7 @@ var Outside = {
// Create the gather button // Create the gather button
new Button.Button({ new Button.Button({
id: 'gatherButton', id: 'gatherButton',
text: "gather wood", text: _("gather wood"),
click: Outside.gatherWood, click: Outside.gatherWood,
cooldown: Outside._GATHER_DELAY, cooldown: Outside._GATHER_DELAY,
width: '80px' width: '80px'
@@ -170,15 +180,15 @@ var Outside = {
var num = Math.floor(Math.random()*(space/2) + space/2); var num = Math.floor(Math.random()*(space/2) + space/2);
if(num == 0) num = 1; if(num == 0) num = 1;
if(num == 1) { if(num == 1) {
Notifications.notify(null, 'a stranger arrives in the night'); Notifications.notify(null, _('a stranger arrives in the night'));
} else if(num < 5) { } else if(num < 5) {
Notifications.notify(null, 'a weathered family takes up in one of the huts.'); Notifications.notify(null, _('a weathered family takes up in one of the huts.'));
} else if(num < 10) { } else if(num < 10) {
Notifications.notify(null, 'a small group arrives, all dust and bones.'); Notifications.notify(null, _('a small group arrives, all dust and bones.'));
} else if(num < 30) { } else if(num < 30) {
Notifications.notify(null, 'a convoy lurches in, equal parts worry and hope.'); Notifications.notify(null, _('a convoy lurches in, equal parts worry and hope.'));
} else { } else {
Notifications.notify(null, "the town's booming. word does get around."); Notifications.notify(null, _("the town's booming. word does get around."));
} }
Engine.log('population increased by ' + num); Engine.log('population increased by ' + num);
$SM.add('game.population', num); $SM.add('game.population', num);
@@ -215,11 +225,11 @@ var Outside = {
updateWorkersView: function() { updateWorkersView: function() {
var workers = $('div#workers'); var workers = $('div#workers');
// If our population is 0 and we don't already have a workers view, // If our population is 0 and we don't already have a workers view,
// there's nothing to do here. // there's nothing to do here.
if(!workers.length && $SM.get('game.population') == 0) return; if(!workers.length && $SM.get('game.population') == 0) return;
var needsAppend = false; var needsAppend = false;
if(workers.length == 0) { if(workers.length == 0) {
needsAppend = true; needsAppend = true;
@@ -299,16 +309,19 @@ var Outside = {
return num; return num;
}, },
makeWorkerRow: function(name, num) { makeWorkerRow: function(key, num) {
name = Outside._INCOME[key].name;
if(!name) name = key;
var row = $('<div>') var row = $('<div>')
.attr('id', 'workers_row_' + name.replace(' ','-')) .attr('key', key)
.attr('id', 'workers_row_' + key.replace(' ','-'))
.addClass('workerRow'); .addClass('workerRow');
$('<div>').addClass('row_key').text(name).appendTo(row); $('<div>').addClass('row_key').text(name).appendTo(row);
var val = $('<div>').addClass('row_val').appendTo(row); var val = $('<div>').addClass('row_val').appendTo(row);
$('<span>').text(num).appendTo(val); $('<span>').text(num).appendTo(val);
if(name != 'gatherer') { if(key != 'gatherer') {
$('<div>').addClass('upManyBtn').appendTo(val).click([10], Outside.increaseWorker); $('<div>').addClass('upManyBtn').appendTo(val).click([10], Outside.increaseWorker);
$('<div>').addClass('upBtn').appendTo(val).click([1], Outside.increaseWorker); $('<div>').addClass('upBtn').appendTo(val).click([1], Outside.increaseWorker);
$('<div>').addClass('dnBtn').appendTo(val).click([1], Outside.decreaseWorker); $('<div>').addClass('dnBtn').appendTo(val).click([1], Outside.decreaseWorker);
@@ -318,10 +331,10 @@ var Outside = {
$('<div>').addClass('clear').appendTo(row); $('<div>').addClass('clear').appendTo(row);
var tooltip = $('<div>').addClass('tooltip bottom right').appendTo(row); var tooltip = $('<div>').addClass('tooltip bottom right').appendTo(row);
var income = Outside._INCOME[name]; var income = Outside._INCOME[key];
for(var s in income.stores) { for(var s in income.stores) {
var r = $('<div>').addClass('storeRow'); var r = $('<div>').addClass('storeRow');
$('<div>').addClass('row_key').text(s).appendTo(r); $('<div>').addClass('row_key').text(_(s)).appendTo(r);
$('<div>').addClass('row_val').text(Engine.getIncomeMsg(income.stores[s], income.delay)).appendTo(r); $('<div>').addClass('row_val').text(Engine.getIncomeMsg(income.stores[s], income.delay)).appendTo(r);
r.appendTo(tooltip); r.appendTo(tooltip);
} }
@@ -330,7 +343,7 @@ var Outside = {
}, },
increaseWorker: function(btn) { increaseWorker: function(btn) {
var worker = $(this).closest('.workerRow').children('.row_key').text(); var worker = $(this).closest('.workerRow').attr('key');
if(Outside.getNumGatherers() > 0) { if(Outside.getNumGatherers() > 0) {
var increaseAmt = Math.min(Outside.getNumGatherers(), btn.data); var increaseAmt = Math.min(Outside.getNumGatherers(), btn.data);
Engine.log('increasing ' + worker + ' by ' + increaseAmt); Engine.log('increasing ' + worker + ' by ' + increaseAmt);
@@ -339,7 +352,7 @@ var Outside = {
}, },
decreaseWorker: function(btn) { decreaseWorker: function(btn) {
var worker = $(this).closest('.workerRow').children('.row_key').text(); var worker = $(this).closest('.workerRow').attr('key');
if($SM.get('game.workers["'+worker+'"]') > 0) { if($SM.get('game.workers["'+worker+'"]') > 0) {
var decreaseAmt = Math.min($SM.get('game.workers["'+worker+'"]') || 0, btn.data); var decreaseAmt = Math.min($SM.get('game.workers["'+worker+'"]') || 0, btn.data);
Engine.log('decreasing ' + worker + ' by ' + decreaseAmt); Engine.log('decreasing ' + worker + ' by ' + decreaseAmt);
@@ -352,7 +365,7 @@ var Outside = {
var row = $('div#' + id, village); var row = $('div#' + id, village);
if(row.length == 0 && num > 0) { if(row.length == 0 && num > 0) {
row = $('<div>').attr('id', id).addClass('storeRow'); row = $('<div>').attr('id', id).addClass('storeRow');
$('<div>').addClass('row_key').text(name).appendTo(row); $('<div>').addClass('row_key').text(_(name)).appendTo(row);
$('<div>').addClass('row_val').text(num).appendTo(row); $('<div>').addClass('row_val').text(num).appendTo(row);
$('<div>').addClass('clear').appendTo(row); $('<div>').addClass('clear').appendTo(row);
var curPrev = null; var curPrev = null;
@@ -473,7 +486,7 @@ var Outside = {
stores[store] = income.stores[store] * num; stores[store] = income.stores[store] * num;
if(curIncome[store] != stores[store]) needsUpdate = true; if(curIncome[store] != stores[store]) needsUpdate = true;
var row = $('<div>').addClass('storeRow'); var row = $('<div>').addClass('storeRow');
$('<div>').addClass('row_key').text(store).appendTo(row); $('<div>').addClass('row_key').text(_(store)).appendTo(row);
$('<div>').addClass('row_val').text(Engine.getIncomeMsg(stores[store], income.delay)).appendTo(row); $('<div>').addClass('row_val').text(Engine.getIncomeMsg(stores[store], income.delay)).appendTo(row);
row.appendTo(tooltip); row.appendTo(tooltip);
} }
@@ -494,7 +507,7 @@ var Outside = {
if(btn.length == 0) { if(btn.length == 0) {
new Button.Button({ new Button.Button({
id: 'trapsButton', id: 'trapsButton',
text: "check traps", text: _("check traps"),
click: Outside.checkTraps, click: Outside.checkTraps,
cooldown: Outside._TRAPS_DELAY, cooldown: Outside._TRAPS_DELAY,
width: '80px' width: '80px'
@@ -513,17 +526,17 @@ var Outside = {
var numHuts = $SM.get('game.buildings["hut"]', true); var numHuts = $SM.get('game.buildings["hut"]', true);
var title; var title;
if(numHuts == 0) { if(numHuts == 0) {
title = "A Silent Forest"; title = _("A Silent Forest");
} else if(numHuts == 1) { } else if(numHuts == 1) {
title = "A Lonely Hut"; title = _("A Lonely Hut");
} else if(numHuts <= 4) { } else if(numHuts <= 4) {
title = "A Tiny Village"; title = _("A Tiny Village");
} else if(numHuts <= 8) { } else if(numHuts <= 8) {
title = "A Modest Village"; title = _("A Modest Village");
} else if(numHuts <= 14) { } else if(numHuts <= 14) {
title = "A Large Village"; title = _("A Large Village");
} else { } else {
title = "A Raucous Village"; title = _("A Raucous Village");
} }
if(Engine.activeModule == this) { if(Engine.activeModule == this) {
@@ -535,7 +548,7 @@ var Outside = {
onArrival: function(transition_diff) { onArrival: function(transition_diff) {
Outside.setTitle(); Outside.setTitle();
if(!$SM.get('game.outside.seenForest')) { if(!$SM.get('game.outside.seenForest')) {
Notifications.notify(Outside, "the sky is grey and the wind blows relentlessly"); Notifications.notify(Outside, _("the sky is grey and the wind blows relentlessly"));
$SM.set('game.outside.seenForest', true); $SM.set('game.outside.seenForest', true);
} }
Outside.updateTrapButton(); Outside.updateTrapButton();
@@ -545,7 +558,7 @@ var Outside = {
}, },
gatherWood: function() { gatherWood: function() {
Notifications.notify(Outside, "dry brush and dead branches litter the forest floor"); Notifications.notify(Outside, _("dry brush and dead branches litter the forest floor"));
var gatherAmt = $SM.get('game.buildings["cart"]', true) > 0 ? 50 : 10; var gatherAmt = $SM.get('game.buildings["cart"]', true) > 0 ? 50 : 10;
$SM.add('stores.wood', gatherAmt); $SM.add('stores.wood', gatherAmt);
}, },
@@ -571,12 +584,12 @@ var Outside = {
} }
} }
} }
var s = 'the traps contain '; var s = _('the traps contain ');
for(var i = 0, len = msg.length; i < len; i++) { for(var i = 0, len = msg.length; i < len; i++) {
if(len > 1 && i > 0 && i < len - 1) { if(len > 1 && i > 0 && i < len - 1) {
s += ", "; s += ", ";
} else if(len > 1 && i == len - 1) { } else if(len > 1 && i == len - 1) {
s += " and "; s += _(" and ");
} }
s += msg[i]; s += msg[i];
} }
+22 -21
View File
@@ -26,7 +26,7 @@ var Path = {
World.init(); World.init();
// Create the path tab // Create the path tab
this.tab = Header.addLocation("A Dusty Path", "path", Path); this.tab = Header.addLocation(_("A Dusty Path"), "path", Path);
// Create the Path panel // Create the Path panel
this.panel = $('<div>').attr('id', "pathPanel") this.panel = $('<div>').attr('id', "pathPanel")
@@ -40,7 +40,7 @@ var Path = {
// Add the embark button // Add the embark button
new Button.Button({ new Button.Button({
id: 'embarkButton', id: 'embarkButton',
text: "embark", text: _("embark"),
click: Path.embark, click: Path.embark,
width: '80px', width: '80px',
cooldown: World.DEATH_COOLDOWN cooldown: World.DEATH_COOLDOWN
@@ -57,7 +57,7 @@ var Path = {
openPath: function() { openPath: function() {
Path.init(); Path.init();
Engine.event('progress', 'path'); Engine.event('progress', 'path');
Notifications.notify(Room, 'the compass points ' + World.dir); Notifications.notify(Room, _('the compass points ' + World.dir));
}, },
getWeight: function(thing) { getWeight: function(thing) {
@@ -106,7 +106,7 @@ var Path = {
var r = $('#' + id); var r = $('#' + id);
if($SM.get('character.perks["'+k+'"]') && r.length == 0) { if($SM.get('character.perks["'+k+'"]') && r.length == 0) {
r = $('<div>').attr('id', id).addClass('perkRow').appendTo(perks); r = $('<div>').attr('id', id).addClass('perkRow').appendTo(perks);
$('<div>').addClass('row_key').text(k).appendTo(r); $('<div>').addClass('row_key').text(_(k)).appendTo(r);
$('<div>').addClass('tooltip bottom right').text(Engine.Perks[k].desc).appendTo(r); $('<div>').addClass('tooltip bottom right').text(Engine.Perks[k].desc).appendTo(r);
} }
} }
@@ -129,17 +129,17 @@ var Path = {
} }
// Add the armour row // Add the armour row
var armour = "none"; var armour = _("none");
if($SM.get('stores["s armour"]', true) > 0) if($SM.get('stores["s armour"]', true) > 0)
armour = "steel"; armour = _("steel");
else if($SM.get('stores["i armour"]', true) > 0) else if($SM.get('stores["i armour"]', true) > 0)
armour = "iron"; armour = _("iron");
else if($SM.get('stores["l armour"]', true) > 0) else if($SM.get('stores["l armour"]', true) > 0)
armour = "leather"; armour = _("leather");
var aRow = $('#armourRow'); var aRow = $('#armourRow');
if(aRow.length == 0) { if(aRow.length == 0) {
aRow = $('<div>').attr('id', 'armourRow').addClass('outfitRow').prependTo(outfit); aRow = $('<div>').attr('id', 'armourRow').addClass('outfitRow').prependTo(outfit);
$('<div>').addClass('row_key').text('armour').appendTo(aRow); $('<div>').addClass('row_key').text(_('armour')).appendTo(aRow);
$('<div>').addClass('row_val').text(armour).appendTo(aRow); $('<div>').addClass('row_val').text(armour).appendTo(aRow);
$('<div>').addClass('clear').appendTo(aRow); $('<div>').addClass('clear').appendTo(aRow);
} else { } else {
@@ -150,7 +150,7 @@ var Path = {
var wRow = $('#waterRow'); var wRow = $('#waterRow');
if(wRow.length == 0) { if(wRow.length == 0) {
wRow = $('<div>').attr('id', 'waterRow').addClass('outfitRow').insertAfter(aRow); wRow = $('<div>').attr('id', 'waterRow').addClass('outfitRow').insertAfter(aRow);
$('<div>').addClass('row_key').text('water').appendTo(wRow); $('<div>').addClass('row_key').text(_('water')).appendTo(wRow);
$('<div>').addClass('row_val').text(World.getMaxWater()).appendTo(wRow); $('<div>').addClass('row_val').text(World.getMaxWater()).appendTo(wRow);
$('<div>').addClass('clear').appendTo(wRow); $('<div>').addClass('clear').appendTo(wRow);
} else { } else {
@@ -183,7 +183,7 @@ var Path = {
if((store.type == 'tool' || store.type == 'weapon') && have > 0) { if((store.type == 'tool' || store.type == 'weapon') && have > 0) {
total += num * Path.getWeight(k); total += num * Path.getWeight(k);
if(row.length == 0) { if(row.length == 0) {
row = Path.createOutfittingRow(k, num); row = Path.createOutfittingRow(k, num, store.name);
var curPrev = null; var curPrev = null;
outfit.children().each(function(i) { outfit.children().each(function(i) {
@@ -226,7 +226,7 @@ var Path = {
} }
// Update bagspace // Update bagspace
$('#bagspace').text('free ' + Math.floor(Path.getCapacity() - total) + '/' + Path.getCapacity()); $('#bagspace').text(_('free {0}/{1}', Math.floor(Path.getCapacity() - total) , Path.getCapacity()));
if(Path.outfit['cured meat'] > 0) { if(Path.outfit['cured meat'] > 0) {
Button.setDisabled($('#embarkButton'), false); Button.setDisabled($('#embarkButton'), false);
@@ -235,8 +235,9 @@ var Path = {
} }
}, },
createOutfittingRow: function(name, num) { createOutfittingRow: function(key, num, name) {
var row = $('<div>').attr('id', 'outfit_row_' + name.replace(' ', '-')).addClass('outfitRow'); if(!name) name = _(key);
var row = $('<div>').attr('id', 'outfit_row_' + key.replace(' ', '-')).addClass('outfitRow').attr('key',key);
$('<div>').addClass('row_key').text(name).appendTo(row); $('<div>').addClass('row_key').text(name).appendTo(row);
var val = $('<div>').addClass('row_val').appendTo(row); var val = $('<div>').addClass('row_val').appendTo(row);
@@ -247,18 +248,18 @@ var Path = {
$('<div>').addClass('dnManyBtn').appendTo(val).click([10], Path.decreaseSupply); $('<div>').addClass('dnManyBtn').appendTo(val).click([10], Path.decreaseSupply);
$('<div>').addClass('clear').appendTo(row); $('<div>').addClass('clear').appendTo(row);
var numAvailable = $SM.get('stores["'+name+'"]', true); var numAvailable = $SM.get('stores["'+key+'"]', true);
var tt = $('<div>').addClass('tooltip bottom right').appendTo(row); var tt = $('<div>').addClass('tooltip bottom right').appendTo(row);
$('<div>').addClass('row_key').text('weight').appendTo(tt); $('<div>').addClass('row_key').text(_('weight')).appendTo(tt);
$('<div>').addClass('row_val').text(Path.getWeight(name)).appendTo(tt); $('<div>').addClass('row_val').text(Path.getWeight(key)).appendTo(tt);
$('<div>').addClass('row_key').text('available').appendTo(tt); $('<div>').addClass('row_key').text(_('available')).appendTo(tt);
$('<div>').addClass('row_val').addClass('numAvailable').text(numAvailable).appendTo(tt); $('<div>').addClass('row_val').addClass('numAvailable').text(numAvailable).appendTo(tt);
return row; return row;
}, },
increaseSupply: function(btn) { increaseSupply: function(btn) {
var supply = $(this).closest('.outfitRow').children('.row_key').text().replace('-', ' '); var supply = $(this).closest('.outfitRow').attr('key');
Engine.log('increasing ' + supply + ' by up to ' + btn.data); Engine.log('increasing ' + supply + ' by up to ' + btn.data);
var cur = Path.outfit[supply]; var cur = Path.outfit[supply];
cur = typeof cur == 'number' ? cur : 0; cur = typeof cur == 'number' ? cur : 0;
@@ -272,7 +273,7 @@ var Path = {
}, },
decreaseSupply: function(btn) { decreaseSupply: function(btn) {
var supply = $(this).closest('.outfitRow').children('.row_key').text().replace('-', ' '); var supply = $(this).closest('.outfitRow').attr('key');
Engine.log('decreasing ' + supply + ' by up to ' + btn.data); Engine.log('decreasing ' + supply + ' by up to ' + btn.data);
var cur = Path.outfit[supply]; var cur = Path.outfit[supply];
cur = typeof cur == 'number' ? cur : 0; cur = typeof cur == 'number' ? cur : 0;
@@ -291,7 +292,7 @@ var Path = {
}, },
setTitle: function() { setTitle: function() {
document.title = 'A Dusty Path'; document.title = _('A Dusty Path');
}, },
embark: function() { embark: function() {
+103 -79
View File
@@ -15,11 +15,12 @@ var Room = {
Craftables: { Craftables: {
'trap': { 'trap': {
name: _('trap'),
button: null, button: null,
maximum: 10, maximum: 10,
availableMsg: 'builder says she can make traps to catch any creatures might still be alive out there', availableMsg: _('builder says she can make traps to catch any creatures might still be alive out there'),
buildMsg: 'more traps to catch more creatures', buildMsg: _('more traps to catch more creatures'),
maxMsg: "more traps won't help now", maxMsg: _("more traps won't help now"),
type: 'building', type: 'building',
cost: function() { cost: function() {
var n = $SM.get('game.buildings["trap"]', true); var n = $SM.get('game.buildings["trap"]', true);
@@ -29,10 +30,11 @@ var Room = {
} }
}, },
'cart': { 'cart': {
name: _('cart'),
button: null, button: null,
maximum: 1, maximum: 1,
availableMsg: 'builder says she can make a cart for carrying wood', availableMsg: _('builder says she can make a cart for carrying wood'),
buildMsg: 'the rickety cart will carry more wood from the forest', buildMsg: _('the rickety cart will carry more wood from the forest'),
type: 'building', type: 'building',
cost: function() { cost: function() {
return { return {
@@ -41,11 +43,12 @@ var Room = {
} }
}, },
'hut': { 'hut': {
name: _('hut'),
button: null, button: null,
maximum: 20, maximum: 20,
availableMsg: "builder says there are more wanderers. says they'll work, too.", availableMsg: _("builder says there are more wanderers. says they'll work, too."),
buildMsg: 'builder puts up a hut, out in the forest. says word will get around.', buildMsg: _('builder puts up a hut, out in the forest. says word will get around.'),
maxMsg: 'no more room for huts.', maxMsg: _('no more room for huts.'),
type: 'building', type: 'building',
cost: function() { cost: function() {
var n = $SM.get('game.buildings["hut"]', true); var n = $SM.get('game.buildings["hut"]', true);
@@ -55,10 +58,11 @@ var Room = {
} }
}, },
'lodge': { 'lodge': {
name: _('lodge'),
button: null, button: null,
maximum: 1, maximum: 1,
availableMsg: 'villagers could help hunt, given the means', availableMsg: _('villagers could help hunt, given the means'),
buildMsg: 'the hunting lodge stands in the forest, a ways out of town', buildMsg: _('the hunting lodge stands in the forest, a ways out of town'),
type: 'building', type: 'building',
cost: function() { cost: function() {
return { return {
@@ -69,10 +73,11 @@ var Room = {
} }
}, },
'trading post': { 'trading post': {
name: _('trading post'),
button: null, button: null,
maximum: 1, maximum: 1,
availableMsg: "a trading post would make commerce easier", availableMsg: _("a trading post would make commerce easier"),
buildMsg: "now the nomads have a place to set up shop, they might stick around a while", buildMsg: _("now the nomads have a place to set up shop, they might stick around a while"),
type: 'building', type: 'building',
cost: function() { cost: function() {
return { return {
@@ -82,10 +87,11 @@ var Room = {
} }
}, },
'tannery': { 'tannery': {
name: _('tannery'),
button: null, button: null,
maximum: 1, maximum: 1,
availableMsg: "builder says leather could be useful. says the villagers could make it.", availableMsg: _("builder says leather could be useful. says the villagers could make it."),
buildMsg: 'tannery goes up quick, on the edge of the village', buildMsg: _('tannery goes up quick, on the edge of the village'),
type: 'building', type: 'building',
cost: function() { cost: function() {
return { return {
@@ -95,10 +101,11 @@ var Room = {
} }
}, },
'smokehouse': { 'smokehouse': {
name: _('smokehouse'),
button: null, button: null,
maximum: 1, maximum: 1,
availableMsg: "should cure the meat, or it'll spoil. builder says she can fix something up.", availableMsg: _("should cure the meat, or it'll spoil. builder says she can fix something up."),
buildMsg: 'builder finishes the smokehouse. she looks hungry.', buildMsg: _('builder finishes the smokehouse. she looks hungry.'),
type: 'building', type: 'building',
cost: function() { cost: function() {
return { return {
@@ -108,10 +115,11 @@ var Room = {
} }
}, },
'workshop': { 'workshop': {
name: _('workshop'),
button: null, button: null,
maximum: 1, maximum: 1,
availableMsg: "builder says she could make finer things, if she had the tools", availableMsg: _("builder says she could make finer things, if she had the tools"),
buildMsg: "workshop's finally ready. builder's excited to get to it", buildMsg: _("workshop's finally ready. builder's excited to get to it"),
type: 'building', type: 'building',
cost: function() { cost: function() {
return { return {
@@ -122,10 +130,11 @@ var Room = {
} }
}, },
'steelworks': { 'steelworks': {
name: _('steelworks'),
button: null, button: null,
maximum: 1, maximum: 1,
availableMsg: "builder says the villagers could make steel, given the tools", availableMsg: _("builder says the villagers could make steel, given the tools"),
buildMsg: "a haze falls over the village as the steelworks fires up", buildMsg: _("a haze falls over the village as the steelworks fires up"),
type: 'building', type: 'building',
cost: function() { cost: function() {
return { return {
@@ -136,10 +145,11 @@ var Room = {
} }
}, },
'armoury': { 'armoury': {
name: _('armoury'),
button: null, button: null,
maximum: 1, maximum: 1,
availableMsg: "builder says it'd be useful to have a steady source of bullets", availableMsg: _("builder says it'd be useful to have a steady source of bullets"),
buildMsg: "armoury's done, welcoming back the weapons of the past.", buildMsg: _("armoury's done, welcoming back the weapons of the past."),
type: 'building', type: 'building',
cost: function() { cost: function() {
return { return {
@@ -150,9 +160,10 @@ var Room = {
} }
}, },
'torch': { 'torch': {
name: _('torch'),
button: null, button: null,
type: 'tool', type: 'tool',
buildMsg: 'a torch to keep the dark away', buildMsg: _('a torch to keep the dark away'),
cost: function() { cost: function() {
return { return {
'wood': 1, 'wood': 1,
@@ -161,10 +172,11 @@ var Room = {
} }
}, },
'waterskin': { 'waterskin': {
name: _('waterskin'),
button: null, button: null,
type: 'upgrade', type: 'upgrade',
maximum: 1, maximum: 1,
buildMsg: 'this waterskin\'ll hold a bit of water, at least', buildMsg: _('this waterskin\'ll hold a bit of water, at least'),
cost: function() { cost: function() {
return { return {
'leather': 50 'leather': 50
@@ -172,10 +184,11 @@ var Room = {
} }
}, },
'cask': { 'cask': {
name: _('cask'),
button: null, button: null,
type: 'upgrade', type: 'upgrade',
maximum: 1, maximum: 1,
buildMsg: 'the cask holds enough water for longer expeditions', buildMsg: _('the cask holds enough water for longer expeditions'),
cost: function() { cost: function() {
return { return {
'leather': 100, 'leather': 100,
@@ -184,10 +197,11 @@ var Room = {
} }
}, },
'water tank': { 'water tank': {
name: _('water tank'),
button: null, button: null,
type: 'upgrade', type: 'upgrade',
maximum: 1, maximum: 1,
buildMsg: 'never go thirsty again', buildMsg: _('never go thirsty again'),
cost: function() { cost: function() {
return { return {
'iron': 100, 'iron': 100,
@@ -196,9 +210,10 @@ var Room = {
} }
}, },
'bone spear': { 'bone spear': {
name: _('bone spear'),
button: null, button: null,
type: 'weapon', type: 'weapon',
buildMsg: "this spear's not elegant, but it's pretty good at stabbing", buildMsg: _("this spear's not elegant, but it's pretty good at stabbing"),
cost: function() { cost: function() {
return { return {
'wood': 100, 'wood': 100,
@@ -207,10 +222,11 @@ var Room = {
} }
}, },
'rucksack': { 'rucksack': {
name: _('rucksack'),
button: null, button: null,
type: 'upgrade', type: 'upgrade',
maximum: 1, maximum: 1,
buildMsg: 'carrying more means longer expeditions to the wilds', buildMsg: _('carrying more means longer expeditions to the wilds'),
cost: function() { cost: function() {
return { return {
'leather': 200 'leather': 200
@@ -218,10 +234,11 @@ var Room = {
} }
}, },
'wagon': { 'wagon': {
name: _('wagon'),
button: null, button: null,
type: 'upgrade', type: 'upgrade',
maximum: 1, maximum: 1,
buildMsg: 'the wagon can carry a lot of supplies', buildMsg: _('the wagon can carry a lot of supplies'),
cost: function() { cost: function() {
return { return {
'wood': 500, 'wood': 500,
@@ -230,10 +247,11 @@ var Room = {
} }
}, },
'convoy': { 'convoy': {
name: _('convoy'),
button: null, button: null,
type: 'upgrade', type: 'upgrade',
maximum: 1, maximum: 1,
buildMsg: 'the convoy can haul mostly everything', buildMsg: _('the convoy can haul mostly everything'),
cost: function() { cost: function() {
return { return {
'wood': 1000, 'wood': 1000,
@@ -243,9 +261,10 @@ var Room = {
} }
}, },
'l armour': { 'l armour': {
name: _('l armour'),
type: 'upgrade', type: 'upgrade',
maximum: 1, maximum: 1,
buildMsg: "leather's not strong. better than rags, though.", buildMsg: _("leather's not strong. better than rags, though."),
cost: function() { cost: function() {
return { return {
'leather': 200, 'leather': 200,
@@ -254,9 +273,10 @@ var Room = {
} }
}, },
'i armour': { 'i armour': {
name: _('i armour'),
type: 'upgrade', type: 'upgrade',
maximum: 1, maximum: 1,
buildMsg: "iron's stronger than leather", buildMsg: _("iron's stronger than leather"),
cost: function() { cost: function() {
return { return {
'leather': 200, 'leather': 200,
@@ -265,9 +285,10 @@ var Room = {
} }
}, },
's armour': { 's armour': {
name: _('s armour'),
type: 'upgrade', type: 'upgrade',
maximum: 1, maximum: 1,
buildMsg: "steel's stronger than iron", buildMsg: _("steel's stronger than iron"),
cost: function() { cost: function() {
return { return {
'leather': 200, 'leather': 200,
@@ -276,9 +297,10 @@ var Room = {
} }
}, },
'iron sword': { 'iron sword': {
name: _('iron sword'),
button: null, button: null,
type: 'weapon', type: 'weapon',
buildMsg: "sword is sharp. good protection out in the wilds.", buildMsg: _("sword is sharp. good protection out in the wilds."),
cost: function() { cost: function() {
return { return {
'wood': 200, 'wood': 200,
@@ -288,9 +310,10 @@ var Room = {
} }
}, },
'steel sword': { 'steel sword': {
name: _('steel sword'),
button: null, button: null,
type: 'weapon', type: 'weapon',
buildMsg: "the steel is strong, and the blade true.", buildMsg: _("the steel is strong, and the blade true."),
cost: function() { cost: function() {
return { return {
'wood': 500, 'wood': 500,
@@ -300,8 +323,9 @@ var Room = {
} }
}, },
'rifle': { 'rifle': {
name: _('rifle'),
type: 'weapon', type: 'weapon',
buildMsg: "black powder and bullets, like the old days.", buildMsg: _("black powder and bullets, like the old days."),
cost: function() { cost: function() {
return { return {
'wood': 200, 'wood': 200,
@@ -433,7 +457,7 @@ var Room = {
} }
}, },
name: "Room", name: _("Room"),
init: function(options) { init: function(options) {
this.options = $.extend( this.options = $.extend(
this.options, this.options,
@@ -457,7 +481,7 @@ var Room = {
// Create the room tab // Create the room tab
this.tab = Header.addLocation("A Dark Room", "room", Room); this.tab = Header.addLocation(_("A Dark Room"), "room", Room);
// Create the Room panel // Create the Room panel
this.panel = $('<div>') this.panel = $('<div>')
@@ -470,7 +494,7 @@ var Room = {
// Create the light button // Create the light button
new Button.Button({ new Button.Button({
id: 'lightButton', id: 'lightButton',
text: 'light fire', text: _('light fire'),
click: Room.lightFire, click: Room.lightFire,
cooldown: Room._STOKE_COOLDOWN, cooldown: Room._STOKE_COOLDOWN,
width: '80px', width: '80px',
@@ -480,7 +504,7 @@ var Room = {
// Create the stoke button // Create the stoke button
new Button.Button({ new Button.Button({
id: 'stokeButton', id: 'stokeButton',
text: "stoke fire", text: _("stoke fire"),
click: Room.stokeFire, click: Room.stokeFire,
cooldown: Room._STOKE_COOLDOWN, cooldown: Room._STOKE_COOLDOWN,
width: '80px', width: '80px',
@@ -516,9 +540,9 @@ var Room = {
setTimeout(Room.unlockForest, Room._NEED_WOOD_DELAY); setTimeout(Room.unlockForest, Room._NEED_WOOD_DELAY);
} }
setTimeout($SM.collectIncome, 1000); setTimeout($SM.collectIncome, 1000);
Notifications.notify(Room, "the room is " + Room.temperature.text); Notifications.notify(Room, _("the room is {0}", Room.temperature.text));
Notifications.notify(Room, "the fire is " + Room.fire.text); Notifications.notify(Room, _("the fire is {0}", Room.fire.text));
}, },
options: {}, // Nothing for now options: {}, // Nothing for now
@@ -526,8 +550,8 @@ var Room = {
onArrival: function(transition_diff) { onArrival: function(transition_diff) {
Room.setTitle(); Room.setTitle();
if(Room.changed) { if(Room.changed) {
Notifications.notify(Room, "the fire is " + Room.fire.text); Notifications.notify(Room, _("the fire is {0}", Room.fire.text));
Notifications.notify(Room, "the room is " + Room.temperature.text); Notifications.notify(Room, _("the room is {0}", Room.temperature.text));
Room.changed = false; Room.changed = false;
} }
if($SM.get('game.builder.level') == 3) { if($SM.get('game.builder.level') == 3) {
@@ -537,7 +561,7 @@ var Room = {
stores: {'wood' : 2 } stores: {'wood' : 2 }
}); });
Room.updateIncomeView(); Room.updateIncomeView();
Notifications.notify(Room, "the stranger is standing by the fire. she says she can help. says she builds things."); Notifications.notify(Room, _("the stranger is standing by the fire. she says she can help. says she builds things."));
} }
Engine.moveStoresView(null, transition_diff); Engine.moveStoresView(null, transition_diff);
@@ -552,11 +576,11 @@ var Room = {
} }
return null; return null;
}, },
Freezing: { value: 0, text: 'freezing' }, Freezing: { value: 0, text: _('freezing') },
Cold: { value: 1, text: 'cold' }, Cold: { value: 1, text: _('cold') },
Mild: { value: 2, text: 'mild' }, Mild: { value: 2, text: _('mild') },
Warm: { value: 3, text: 'warm' }, Warm: { value: 3, text: _('warm') },
Hot: { value: 4, text: 'hot' } Hot: { value: 4, text: _('hot') }
}, },
FireEnum: { FireEnum: {
@@ -568,15 +592,15 @@ var Room = {
} }
return null; return null;
}, },
Dead: { value: 0, text: 'dead' }, Dead: { value: 0, text: _('dead') },
Smoldering: { value: 1, text: 'smoldering' }, Smoldering: { value: 1, text: _('smoldering') },
Flickering: { value: 2, text: 'flickering' }, Flickering: { value: 2, text: _('flickering') },
Burning: { value: 3, text: 'burning' }, Burning: { value: 3, text: _('burning') },
Roaring: { value: 4, text: 'roaring' } Roaring: { value: 4, text: _('roaring') }
}, },
setTitle: function() { setTitle: function() {
var title = Room.fire.value < 2 ? "A Dark Room" : "A Firelit Room"; var title = Room.fire.value < 2 ? _("A Dark Room") : _("A Firelit Room");
if(Engine.activeModule == this) { if(Engine.activeModule == this) {
document.title = title; document.title = title;
} }
@@ -614,7 +638,7 @@ var Room = {
lightFire: function() { lightFire: function() {
var wood = $SM.get('stores.wood'); var wood = $SM.get('stores.wood');
if(wood < 5) { if(wood < 5) {
Notifications.notify(Room, "not enough wood to get the fire going"); Notifications.notify(Room, _("not enough wood to get the fire going"));
Button.clearCooldown($('#lightButton.button')); Button.clearCooldown($('#lightButton.button'));
return; return;
} else if(wood > 4) { } else if(wood > 4) {
@@ -627,7 +651,7 @@ var Room = {
stokeFire: function() { stokeFire: function() {
var wood = $SM.get('stores.wood'); var wood = $SM.get('stores.wood');
if(wood === 0) { if(wood === 0) {
Notifications.notify(Room, "the wood has run out"); Notifications.notify(Room, _("the wood has run out"));
Button.clearCooldown($('#stokeButton.button')); Button.clearCooldown($('#stokeButton.button'));
return; return;
} }
@@ -644,10 +668,10 @@ var Room = {
if(Engine.activeModule != Room) { if(Engine.activeModule != Room) {
Room.changed = true; Room.changed = true;
} }
Notifications.notify(Room, "the fire is " + Room.fire.text, true); Notifications.notify(Room, _("the fire is {0}", Room.fire.text), true);
if(Room.fire.value > 1 && $SM.get('game.builder.level') < 0) { if(Room.fire.value > 1 && $SM.get('game.builder.level') < 0) {
$SM.set('game.builder.level', 0); $SM.set('game.builder.level', 0);
Notifications.notify(Room, "the light from the fire spills from the windows, out into the dark"); Notifications.notify(Room, _("the light from the fire spills from the windows, out into the dark"));
setTimeout(Room.updateBuilderState, Room._BUILDER_STATE_DELAY); setTimeout(Room.updateBuilderState, Room._BUILDER_STATE_DELAY);
} }
window.clearTimeout(Room._fireTimer); window.clearTimeout(Room._fireTimer);
@@ -660,7 +684,7 @@ var Room = {
var wood = $SM.get('stores.wood'); var wood = $SM.get('stores.wood');
if(Room.fire.value <= Room.FireEnum.Flickering.value && if(Room.fire.value <= Room.FireEnum.Flickering.value &&
$SM.get('game.builder.level') > 3 && wood > 0) { $SM.get('game.builder.level') > 3 && wood > 0) {
Notifications.notify(Room, "builder stokes the fire", true); Notifications.notify(Room, _("builder stokes the fire"), true);
$SM.set('stores.wood', wood - 1); $SM.set('stores.wood', wood - 1);
Room.fire = Room.FireEnum.fromInt(Room.fire.value + 1); Room.fire = Room.FireEnum.fromInt(Room.fire.value + 1);
} }
@@ -675,11 +699,11 @@ var Room = {
var old = Room.temperature.value; var old = Room.temperature.value;
if(Room.temperature.value > 0 && Room.temperature.value > Room.fire.value) { if(Room.temperature.value > 0 && Room.temperature.value > Room.fire.value) {
Room.temperature = Room.TempEnum.fromInt(Room.temperature.value - 1); Room.temperature = Room.TempEnum.fromInt(Room.temperature.value - 1);
Notifications.notify(Room, "the room is " + Room.temperature.text, true); Notifications.notify(Room, _("the room is {0}" , Room.temperature.text), true);
} }
if(Room.temperature.value < 4 && Room.temperature.value < Room.fire.value) { if(Room.temperature.value < 4 && Room.temperature.value < Room.fire.value) {
Room.temperature = Room.TempEnum.fromInt(Room.temperature.value + 1); Room.temperature = Room.TempEnum.fromInt(Room.temperature.value + 1);
Notifications.notify(Room, "the room is " + Room.temperature.text, true); Notifications.notify(Room, _("the room is {0}" , Room.temperature.text), true);
} }
if(Room.temperature.value != old) { if(Room.temperature.value != old) {
Room.changed = true; Room.changed = true;
@@ -690,15 +714,15 @@ var Room = {
unlockForest: function() { unlockForest: function() {
$SM.set('stores.wood', 4); $SM.set('stores.wood', 4);
Outside.init(); Outside.init();
Notifications.notify(Room, "the wind howls outside"); Notifications.notify(Room, _("the wind howls outside"));
Notifications.notify(Room, "the wood is running out"); Notifications.notify(Room, _("the wood is running out"));
Engine.event('progress', 'outside'); Engine.event('progress', 'outside');
}, },
updateBuilderState: function() { updateBuilderState: function() {
var lBuilder = $SM.get('game.builder.level'); var lBuilder = $SM.get('game.builder.level');
if(lBuilder == 0) { if(lBuilder == 0) {
Notifications.notify(Room, "a ragged stranger stumbles through the door and collapses in the corner"); Notifications.notify(Room, _("a ragged stranger stumbles through the door and collapses in the corner"));
lBuilder = $SM.setget('game.builder.level', 1); lBuilder = $SM.setget('game.builder.level', 1);
setTimeout(Room.unlockForest, Room._NEED_WOOD_DELAY); setTimeout(Room.unlockForest, Room._NEED_WOOD_DELAY);
} }
@@ -706,10 +730,10 @@ var Room = {
var msg = ""; var msg = "";
switch(lBuilder) { switch(lBuilder) {
case 1: case 1:
msg = "the stranger shivers, and mumbles quietly. her words are unintelligible."; msg = _("the stranger shivers, and mumbles quietly. her words are unintelligible.");
break; break;
case 2: case 2:
msg = "the stranger in the corner stops shivering. her breathing calms."; msg = _("the stranger in the corner stops shivering. her breathing calms.");
break; break;
} }
Notifications.notify(Room, msg); Notifications.notify(Room, msg);
@@ -782,7 +806,7 @@ var Room = {
if(row.length == 0 && num > 0) { if(row.length == 0 && num > 0) {
row = $('<div>').attr('id', id).addClass('storeRow'); row = $('<div>').attr('id', id).addClass('storeRow');
$('<div>').addClass('row_key').text(k).appendTo(row); $('<div>').addClass('row_key').text(_(k)).appendTo(row);
$('<div>').addClass('row_val').text(Math.floor(num)).appendTo(row); $('<div>').addClass('row_val').text(Math.floor(num)).appendTo(row);
$('<div>').addClass('clear').appendTo(row); $('<div>').addClass('clear').appendTo(row);
var curPrev = null; var curPrev = null;
@@ -835,7 +859,7 @@ var Room = {
var income = $SM.get('income["'+incomeSource+'"]'); var income = $SM.get('income["'+incomeSource+'"]');
for(var store in income.stores) { for(var store in income.stores) {
if(store == storeName && income.stores[store] != 0) { if(store == storeName && income.stores[store] != 0) {
$('<div>').addClass('row_key').text(incomeSource).appendTo(tt); $('<div>').addClass('row_key').text(_(incomeSource)).appendTo(tt);
$('<div>') $('<div>')
.addClass('row_val') .addClass('row_val')
.text(Engine.getIncomeMsg(income.stores[store], income.delay)) .text(Engine.getIncomeMsg(income.stores[store], income.delay))
@@ -863,7 +887,7 @@ var Room = {
for(var k in cost) { for(var k in cost) {
var have = $SM.get('stores["'+k+'"]', true); var have = $SM.get('stores["'+k+'"]', true);
if(have < cost[k]) { if(have < cost[k]) {
Notifications.notify(Room, "not enough " + k); Notifications.notify(Room, _("not enough " + k));
return false; return false;
} else { } else {
storeMod[k] = have - cost[k]; storeMod[k] = have - cost[k];
@@ -883,7 +907,7 @@ var Room = {
build: function(buildBtn) { build: function(buildBtn) {
var thing = $(buildBtn).attr('buildThing'); var thing = $(buildBtn).attr('buildThing');
if(Room.temperature.value <= Room.TempEnum.Cold.value) { if(Room.temperature.value <= Room.TempEnum.Cold.value) {
Notifications.notify(Room, "builder just shivers"); Notifications.notify(Room, _("builder just shivers"));
return false; return false;
} }
var craftable = Room.Craftables[thing]; var craftable = Room.Craftables[thing];
@@ -911,7 +935,7 @@ var Room = {
for(var k in cost) { for(var k in cost) {
var have = $SM.get('stores["'+k+'"]', true); var have = $SM.get('stores["'+k+'"]', true);
if(have < cost[k]) { if(have < cost[k]) {
Notifications.notify(Room, "not enough " + k); Notifications.notify(Room, _("not enough "+k));
return false; return false;
} else { } else {
storeMod[k] = have - cost[k]; storeMod[k] = have - cost[k];
@@ -944,7 +968,7 @@ var Room = {
} }
if($SM.get('game.builder.level') < 4) return false; if($SM.get('game.builder.level') < 4) return false;
var craftable = Room.Craftables[thing]; var craftable = Room.Craftables[thing];
if(Room.needsWorkshop(craftable.type) && $SM.get('game.buildings["workshop"]', true) == 0) return false; if(Room.needsWorkshop(craftable.type) && $SM.get('game.buildings["'+'workshop'+'"]', true) == 0) return false;
var cost = craftable.cost(); var cost = craftable.cost();
//show button if one has already been built //show button if one has already been built
@@ -1013,7 +1037,7 @@ var Room = {
craftable.button = new Button.Button({ craftable.button = new Button.Button({
id: 'build_' + k, id: 'build_' + k,
cost: craftable.cost(), cost: craftable.cost(),
text: k, text: _(k),
click: Room.build, click: Room.build,
width: '80px', width: '80px',
ttPos: loc.children().length > 10 ? 'top right' : 'bottom right' ttPos: loc.children().length > 10 ? 'top right' : 'bottom right'
@@ -1025,7 +1049,7 @@ var Room = {
costTooltip.empty(); costTooltip.empty();
var cost = craftable.cost(); var cost = craftable.cost();
for(var k in cost) { for(var k in cost) {
$("<div>").addClass('row_key').text(k).appendTo(costTooltip); $("<div>").addClass('row_key').text(_(k)).appendTo(costTooltip);
$("<div>").addClass('row_val').text(cost[k]).appendTo(costTooltip); $("<div>").addClass('row_val').text(cost[k]).appendTo(costTooltip);
} }
if(max && !craftable.button.hasClass('disabled')) { if(max && !craftable.button.hasClass('disabled')) {
@@ -1047,7 +1071,7 @@ var Room = {
good.button = new Button.Button({ good.button = new Button.Button({
id: 'build_' + k, id: 'build_' + k,
cost: good.cost(), cost: good.cost(),
text: k, text: _(k),
click: Room.buy, click: Room.buy,
width: '80px' width: '80px'
}).css('opacity', 0).attr('buildThing', k).appendTo(buySection).animate({opacity:1}, 300, 'linear'); }).css('opacity', 0).attr('buildThing', k).appendTo(buySection).animate({opacity:1}, 300, 'linear');
@@ -1058,7 +1082,7 @@ var Room = {
costTooltip.empty(); costTooltip.empty();
var cost = good.cost(); var cost = good.cost();
for(var k in cost) { for(var k in cost) {
$("<div>").addClass('row_key').text(k).appendTo(costTooltip); $("<div>").addClass('row_key').text(_(k)).appendTo(costTooltip);
$("<div>").addClass('row_val').text(cost[k]).appendTo(costTooltip); $("<div>").addClass('row_val').text(cost[k]).appendTo(costTooltip);
} }
if(max && !good.button.hasClass('disabled')) { if(max && !good.button.hasClass('disabled')) {
+14 -14
View File
@@ -8,7 +8,7 @@ var Ship = {
BASE_HULL: 0, BASE_HULL: 0,
BASE_THRUSTERS: 1, BASE_THRUSTERS: 1,
name: "Ship", name: _("Ship"),
init: function(options) { init: function(options) {
this.options = $.extend( this.options = $.extend(
this.options, this.options,
@@ -24,7 +24,7 @@ var Ship = {
} }
// Create the Ship tab // Create the Ship tab
this.tab = Header.addLocation("An Old Starship", "ship", Ship); this.tab = Header.addLocation(_("An Old Starship"), "ship", Ship);
// Create the Ship panel // Create the Ship panel
this.panel = $('<div>').attr('id', "shipPanel") this.panel = $('<div>').attr('id', "shipPanel")
@@ -35,20 +35,20 @@ var Ship = {
// Draw the hull label // Draw the hull label
var hullRow = $('<div>').attr('id', 'hullRow').appendTo('div#shipPanel'); var hullRow = $('<div>').attr('id', 'hullRow').appendTo('div#shipPanel');
$('<div>').addClass('row_key').text('hull:').appendTo(hullRow); $('<div>').addClass('row_key').text(_('hull:')).appendTo(hullRow);
$('<div>').addClass('row_val').text($SM.get('game.spaceShip.hull')).appendTo(hullRow); $('<div>').addClass('row_val').text($SM.get('game.spaceShip.hull')).appendTo(hullRow);
$('<div>').addClass('clear').appendTo(hullRow); $('<div>').addClass('clear').appendTo(hullRow);
// Draw the thrusters label // Draw the thrusters label
var engineRow = $('<div>').attr('id', 'engineRow').appendTo('div#shipPanel'); var engineRow = $('<div>').attr('id', 'engineRow').appendTo('div#shipPanel');
$('<div>').addClass('row_key').text('engine:').appendTo(engineRow); $('<div>').addClass('row_key').text(_('engine:')).appendTo(engineRow);
$('<div>').addClass('row_val').text($SM.get('game.spaceShip.thrusters')).appendTo(engineRow); $('<div>').addClass('row_val').text($SM.get('game.spaceShip.thrusters')).appendTo(engineRow);
$('<div>').addClass('clear').appendTo(engineRow); $('<div>').addClass('clear').appendTo(engineRow);
// Draw the reinforce button // Draw the reinforce button
new Button.Button({ new Button.Button({
id: 'reinforceButton', id: 'reinforceButton',
text: 'reinforce hull', text: _('reinforce hull'),
click: Ship.reinforceHull, click: Ship.reinforceHull,
width: '100px', width: '100px',
cost: {'alien alloy': Ship.ALLOY_PER_HULL} cost: {'alien alloy': Ship.ALLOY_PER_HULL}
@@ -57,7 +57,7 @@ var Ship = {
// Draw the engine button // Draw the engine button
new Button.Button({ new Button.Button({
id: 'engineButton', id: 'engineButton',
text: 'upgrade engine', text: _('upgrade engine'),
click: Ship.upgradeEngine, click: Ship.upgradeEngine,
width: '100px', width: '100px',
cost: {'alien alloy': Ship.ALLOY_PER_THRUSTER} cost: {'alien alloy': Ship.ALLOY_PER_THRUSTER}
@@ -66,7 +66,7 @@ var Ship = {
// Draw the lift off button // Draw the lift off button
var b = new Button.Button({ var b = new Button.Button({
id: 'liftoffButton', id: 'liftoffButton',
text: 'lift off', text: _('lift off'),
click: Ship.checkLiftOff, click: Ship.checkLiftOff,
width: '100px', width: '100px',
cooldown: Ship.LIFTOFF_COOLDOWN cooldown: Ship.LIFTOFF_COOLDOWN
@@ -88,7 +88,7 @@ var Ship = {
onArrival: function(transition_diff) { onArrival: function(transition_diff) {
Ship.setTitle(); Ship.setTitle();
if(!$SM.get('game.spaceShip.seenShip')) { if(!$SM.get('game.spaceShip.seenShip')) {
Notifications.notify(Ship, 'somewhere above the debris cloud, the wanderer fleet hovers. been on this rock too long.'); Notifications.notify(Ship, _('somewhere above the debris cloud, the wanderer fleet hovers. been on this rock too long.'));
$SM.set('game.spaceShip.seenShip', true); $SM.set('game.spaceShip.seenShip', true);
} }
@@ -103,7 +103,7 @@ var Ship = {
reinforceHull: function() { reinforceHull: function() {
if($SM.get('stores["alien alloy"]', true) < Ship.ALLOY_PER_HULL) { if($SM.get('stores["alien alloy"]', true) < Ship.ALLOY_PER_HULL) {
Notifications.notify(Ship, "not enough alien alloy"); Notifications.notify(Ship, _("not enough alien alloy"));
return false; return false;
} }
$SM.add('stores["alien alloy"]', -Ship.ALLOY_PER_HULL); $SM.add('stores["alien alloy"]', -Ship.ALLOY_PER_HULL);
@@ -116,7 +116,7 @@ var Ship = {
upgradeEngine: function() { upgradeEngine: function() {
if($SM.get('stores["alien alloy"]', true) < Ship.ALLOY_PER_THRUSTER) { if($SM.get('stores["alien alloy"]', true) < Ship.ALLOY_PER_THRUSTER) {
Notifications.notify(Ship, "not enough alien alloy"); Notifications.notify(Ship, _("not enough alien alloy"));
return false; return false;
} }
$SM.add('stores["alien alloy"]', -Ship.ALLOY_PER_THRUSTER); $SM.add('stores["alien alloy"]', -Ship.ALLOY_PER_THRUSTER);
@@ -131,15 +131,15 @@ var Ship = {
checkLiftOff: function() { checkLiftOff: function() {
if(!$SM.get('game.spaceShip.seenWarning')) { if(!$SM.get('game.spaceShip.seenWarning')) {
Events.startEvent({ Events.startEvent({
title: 'Ready to Leave?', title: _('Ready to Leave?'),
scenes: { scenes: {
'start': { 'start': {
text: [ text: [
"time to get out of this place. won't be coming back." _("time to get out of this place. won't be coming back.")
], ],
buttons: { buttons: {
'fly': { 'fly': {
text: 'lift off', text: _('lift off'),
onChoose: function() { onChoose: function() {
$SM.set('game.spaceShip.seenWarning', true); $SM.set('game.spaceShip.seenWarning', true);
Ship.liftOff(); Ship.liftOff();
@@ -147,7 +147,7 @@ var Ship = {
nextScene: 'end' nextScene: 'end'
}, },
'wait': { 'wait': {
text: 'linger', text: _('linger'),
onChoose: function() { onChoose: function() {
Button.clearCooldown($('#liftoffButton')); Button.clearCooldown($('#liftoffButton'));
}, },
+10 -10
View File
@@ -39,7 +39,7 @@ var Space = {
// Create the hull display // Create the hull display
var h = $('<div>').attr('id', 'hullRemaining').appendTo(this.panel); var h = $('<div>').attr('id', 'hullRemaining').appendTo(this.panel);
$('<div>').addClass('row_key').text('hull: ').appendTo(h); $('<div>').addClass('row_key').text(_('hull: ')).appendTo(h);
$('<div>').addClass('row_val').appendTo(h); $('<div>').addClass('row_val').appendTo(h);
//subscribe to stateUpdates //subscribe to stateUpdates
@@ -73,17 +73,17 @@ var Space = {
if(Engine.activeModule == this) { if(Engine.activeModule == this) {
var t; var t;
if(Space.altitude < 10) { if(Space.altitude < 10) {
t = "Troposphere"; t = _("Troposphere");
} else if(Space.altitude < 20) { } else if(Space.altitude < 20) {
t = "Stratosphere"; t = _("Stratosphere");
} else if(Space.altitude < 30) { } else if(Space.altitude < 30) {
t = "Mesosphere"; t = _("Mesosphere");
} else if(Space.altitude < 45) { } else if(Space.altitude < 45) {
t = "Thermosphere"; t = _("Thermosphere");
} else if(Space.altitude < 60){ } else if(Space.altitude < 60){
t = "Exosphere"; t = _("Exosphere");
} else { } else {
t = "Space"; t = _("Space");
} }
document.title = t; document.title = t;
} }
@@ -418,14 +418,14 @@ var Space = {
.appendTo('body'); .appendTo('body');
$('<span>') $('<span>')
.addClass('endGame') .addClass('endGame')
.text('score for this game: ' + Score.calculateScore()) .text(_('score for this game: {0}', Score.calculateScore()))
.appendTo('.centerCont') .appendTo('.centerCont')
.animate({opacity:1},1500); .animate({opacity:1},1500);
$('<br />') $('<br />')
.appendTo('.centerCont'); .appendTo('.centerCont');
$('<span>') $('<span>')
.addClass('endGame') .addClass('endGame')
.text('total score: ' + Prestige.get().score) .text(_('total score: {0}', Prestige.get().score))
.appendTo('.centerCont') .appendTo('.centerCont')
.animate({opacity:1},1500); .animate({opacity:1},1500);
$('<br />') $('<br />')
@@ -436,7 +436,7 @@ var Space = {
$('#content, #notifications').remove(); $('#content, #notifications').remove();
$('<span>') $('<span>')
.addClass('endGame endGameRestart') .addClass('endGame endGameRestart')
.text('restart.') .text(_('restart.'))
.click(Engine.confirmDelete) .click(Engine.confirmDelete)
.appendTo('.centerCont') .appendTo('.centerCont')
.animate({opacity:1},1500); .animate({opacity:1},1500);
+46 -46
View File
@@ -43,58 +43,58 @@ var World = {
Weapons: { Weapons: {
'fists': { 'fists': {
verb: 'punch', verb: _('punch'),
type: 'unarmed', type: 'unarmed',
damage: 1, damage: 1,
cooldown: 2 cooldown: 2
}, },
'bone spear': { 'bone spear': {
verb: 'stab', verb: _('stab'),
type: 'melee', type: 'melee',
damage: 2, damage: 2,
cooldown: 2 cooldown: 2
}, },
'iron sword': { 'iron sword': {
verb: 'swing', verb: _('swing'),
type: 'melee', type: 'melee',
damage: 4, damage: 4,
cooldown: 2 cooldown: 2
}, },
'steel sword': { 'steel sword': {
verb: 'slash', verb: _('slash'),
type: 'melee', type: 'melee',
damage: 6, damage: 6,
cooldown: 2 cooldown: 2
}, },
'bayonet': { 'bayonet': {
verb: 'thrust', verb: _('thrust'),
type: 'melee', type: 'melee',
damage: 8, damage: 8,
cooldown: 2 cooldown: 2
}, },
'rifle': { 'rifle': {
verb: 'shoot', verb: _('shoot'),
type: 'ranged', type: 'ranged',
damage: 5, damage: 5,
cooldown: 1, cooldown: 1,
cost: { 'bullets': 1 } cost: { 'bullets': 1 }
}, },
'laser rifle': { 'laser rifle': {
verb: 'blast', verb: _('blast'),
type: 'ranged', type: 'ranged',
damage: 8, damage: 8,
cooldown: 1, cooldown: 1,
cost: { 'energy cell': 1 } cost: { 'energy cell': 1 }
}, },
'grenade': { 'grenade': {
verb: 'lob', verb: _('lob'),
type: 'ranged', type: 'ranged',
damage: 15, damage: 15,
cooldown: 5, cooldown: 5,
cost: { 'grenade': 1 } cost: { 'grenade': 1 }
}, },
'bolas': { 'bolas': {
verb: 'tangle', verb: _('tangle'),
type: 'ranged', type: 'ranged',
damage: 'stun', damage: 'stun',
cooldown: 15, cooldown: 15,
@@ -116,22 +116,22 @@ var World = {
World.TILE_PROBS[World.TILE.BARRENS] = 0.5; World.TILE_PROBS[World.TILE.BARRENS] = 0.5;
// Setpiece definitions // Setpiece definitions
World.LANDMARKS[World.TILE.OUTPOST] = { num: 0, minRadius: 0, maxRadius: 0, scene: 'outpost', label: 'An&nbsp;Outpost' }; World.LANDMARKS[World.TILE.OUTPOST] = { num: 0, minRadius: 0, maxRadius: 0, scene: 'outpost', label: _('An&nbsp;Outpost') };
World.LANDMARKS[World.TILE.IRON_MINE] = { num: 1, minRadius: 5, maxRadius: 5, scene: 'ironmine', label: 'Iron&nbsp;Mine' }; World.LANDMARKS[World.TILE.IRON_MINE] = { num: 1, minRadius: 5, maxRadius: 5, scene: 'ironmine', label: _('Iron&nbsp;Mine') };
World.LANDMARKS[World.TILE.COAL_MINE] = { num: 1, minRadius: 10, maxRadius: 10, scene: 'coalmine', label: 'Coal&nbsp;Mine' }; World.LANDMARKS[World.TILE.COAL_MINE] = { num: 1, minRadius: 10, maxRadius: 10, scene: 'coalmine', label: _('Coal&nbsp;Mine') };
World.LANDMARKS[World.TILE.SULPHUR_MINE] = { num: 1, minRadius: 20, maxRadius: 20, scene: 'sulphurmine', label: 'Sulphur&nbsp;Mine' }; World.LANDMARKS[World.TILE.SULPHUR_MINE] = { num: 1, minRadius: 20, maxRadius: 20, scene: 'sulphurmine', label: _('Sulphur&nbsp;Mine') };
World.LANDMARKS[World.TILE.HOUSE] = { num: 10, minRadius: 0, maxRadius: World.RADIUS * 1.5, scene: 'house', label: 'An&nbsp;Old&nbsp;House' }; World.LANDMARKS[World.TILE.HOUSE] = { num: 10, minRadius: 0, maxRadius: World.RADIUS * 1.5, scene: 'house', label: _('An&nbsp;Old&nbsp;House') };
World.LANDMARKS[World.TILE.CAVE] = { num: 5, minRadius: 3, maxRadius: 10, scene: 'cave', label: 'A&nbsp;Damp&nbsp;Cave' }; World.LANDMARKS[World.TILE.CAVE] = { num: 5, minRadius: 3, maxRadius: 10, scene: 'cave', label: _('A&nbsp;Damp&nbsp;Cave') };
World.LANDMARKS[World.TILE.TOWN] = { num: 10, minRadius: 10, maxRadius: 20, scene: 'town', label: 'An&nbsp;Abandoned&nbsp;Town' }; World.LANDMARKS[World.TILE.TOWN] = { num: 10, minRadius: 10, maxRadius: 20, scene: 'town', label: _('An&nbsp;Abandoned&nbsp;Town') };
World.LANDMARKS[World.TILE.CITY] = { num: 20, minRadius: 20, maxRadius: World.RADIUS * 1.5, scene: 'city', label: 'A&nbsp;Ruined&nbsp;City' }; World.LANDMARKS[World.TILE.CITY] = { num: 20, minRadius: 20, maxRadius: World.RADIUS * 1.5, scene: 'city', label: _('A&nbsp;Ruined&nbsp;City') };
World.LANDMARKS[World.TILE.SHIP] = { num: 1, minRadius: 28, maxRadius: 28, scene: 'ship', label: 'A&nbsp;Crashed&nbsp;Starship'}; World.LANDMARKS[World.TILE.SHIP] = { num: 1, minRadius: 28, maxRadius: 28, scene: 'ship', label: _('A&nbsp;Crashed&nbsp;Starship')};
World.LANDMARKS[World.TILE.BOREHOLE] = { num: 10, minRadius: 15, maxRadius: World.RADIUS * 1.5, scene: 'borehole', label: 'A&nbsp;Borehole'}; World.LANDMARKS[World.TILE.BOREHOLE] = { num: 10, minRadius: 15, maxRadius: World.RADIUS * 1.5, scene: 'borehole', label: _('A&nbsp;Borehole')};
World.LANDMARKS[World.TILE.BATTLEFIELD] = { num: 5, minRadius: 18, maxRadius: World.RADIUS * 1.5, scene: 'battlefield', label: 'A&nbsp;Battlefield'}; World.LANDMARKS[World.TILE.BATTLEFIELD] = { num: 5, minRadius: 18, maxRadius: World.RADIUS * 1.5, scene: 'battlefield', label: _('A&nbsp;Battlefield')};
World.LANDMARKS[World.TILE.SWAMP] = { num: 1, minRadius: 15, maxRadius: World.RADIUS * 1.5, scene: 'swamp', label: 'A&nbsp;Murky&nbsp;Swamp'}; World.LANDMARKS[World.TILE.SWAMP] = { num: 1, minRadius: 15, maxRadius: World.RADIUS * 1.5, scene: 'swamp', label: _('A&nbsp;Murky&nbsp;Swamp')};
// Only add the cache if there is prestige data // Only add the cache if there is prestige data
if($SM.get('previous.stores')) { if($SM.get('previous.stores')) {
World.LANDMARKS[World.TILE.CACHE] = { num: 1, minRadius: 10, maxRadius: World.RADIUS * 1.5, scene: 'cache', label: 'A&nbsp;Destroyed&nbsp;Village'}; World.LANDMARKS[World.TILE.CACHE] = { num: 1, minRadius: 10, maxRadius: World.RADIUS * 1.5, scene: 'cache', label: _('A&nbsp;Destroyed&nbsp;Village')};
} }
if(typeof $SM.get('features.location.world') == 'undefined') { if(typeof $SM.get('features.location.world') == 'undefined') {
@@ -247,7 +247,7 @@ var World = {
water = World.createItemDiv('water', World.water); water = World.createItemDiv('water', World.water);
water.prependTo(supplies); water.prependTo(supplies);
} else if(World.water > 0) { } else if(World.water > 0) {
$('div#supply_water', supplies).text('water:' + World.water); $('div#supply_water', supplies).text(_('water:{0}' , World.water));
} else { } else {
water.remove(); water.remove();
} }
@@ -267,21 +267,21 @@ var World = {
item.appendTo(supplies); item.appendTo(supplies);
} }
} else if(num > 0) { } else if(num > 0) {
$('div#' + item.attr('id'), supplies).text(k + ':' + num); $('div#' + item.attr('id'), supplies).text(_(k) + ':' + num);
} else { } else {
item.remove(); item.remove();
} }
} }
// Update label // Update label
var t = 'pockets'; var t = _('pockets');
if($SM.get('stores.rucksack', true) > 0) { if($SM.get('stores.rucksack', true) > 0) {
t = 'rucksack'; t = _('rucksack');
} }
$('#backpackTitle').text(t); $('#backpackTitle').text(t);
// Update bagspace // Update bagspace
$('#backpackSpace').text('free ' + Math.floor(Path.getCapacity() - total) + '/' + Path.getCapacity()); $('#backpackSpace').text(_('free {0}/{1}', Math.floor(Path.getCapacity() - total) , Path.getCapacity()));
}, },
setWater: function(w) { setWater: function(w) {
@@ -298,14 +298,14 @@ var World = {
if(World.health > World.getMaxHealth()) { if(World.health > World.getMaxHealth()) {
World.health = World.getMaxHealth(); World.health = World.getMaxHealth();
} }
$('#healthCounter').text('hp: ' + World.health + '/' + World.getMaxHealth()); $('#healthCounter').text(_('hp: {0}/{1}', World.health , World.getMaxHealth()));
} }
}, },
createItemDiv: function(name, num) { createItemDiv: function(name, num) {
var div = $('<div>').attr('id', 'supply_' + name.replace(' ', '-')) var div = $('<div>').attr('id', 'supply_' + name.replace(' ', '-'))
.addClass('supplyItem') .addClass('supplyItem')
.text(name + ':' + num); .text(_('{0}:{1}',_(name), num));
return div; return div;
}, },
@@ -340,9 +340,9 @@ var World = {
World.doSpace(); World.doSpace();
if(World.checkDanger()) { if(World.checkDanger()) {
if(World.danger) { if(World.danger) {
Notifications.notify(World, 'dangerous to be this far from the village without proper protection'); Notifications.notify(World, _('dangerous to be this far from the village without proper protection'));
} else { } else {
Notifications.notify(World, 'safer here'); Notifications.notify(World, _('safer here'));
} }
} }
}, },
@@ -442,12 +442,12 @@ var World = {
var num = Path.outfit['cured meat']; var num = Path.outfit['cured meat'];
num--; num--;
if(num == 0) { if(num == 0) {
Notifications.notify(World, 'the meat has run out'); Notifications.notify(World, _('the meat has run out'));
} else if(num < 0) { } else if(num < 0) {
// Starvation! Hooray! // Starvation! Hooray!
num = 0; num = 0;
if(!World.starvation) { if(!World.starvation) {
Notifications.notify(World, 'starvation sets in'); Notifications.notify(World, _('starvation sets in'));
World.starvation = true; World.starvation = true;
} else { } else {
$SM.set('character.starved', $SM.get('character.starved', true)); $SM.set('character.starved', $SM.get('character.starved', true));
@@ -472,11 +472,11 @@ var World = {
var water = World.water; var water = World.water;
water--; water--;
if(water == 0) { if(water == 0) {
Notifications.notify(World, 'there is no more water'); Notifications.notify(World, _('there is no more water'));
} else if(water < 0) { } else if(water < 0) {
water = 0; water = 0;
if(!World.thirst) { if(!World.thirst) {
Notifications.notify(World, 'the thirst becomes unbearable'); Notifications.notify(World, _('the thirst becomes unbearable'));
World.thirst = true; World.thirst = true;
} else { } else {
$SM.set('character.dehydrated', $SM.get('character.dehydrated', true)); $SM.set('character.dehydrated', $SM.get('character.dehydrated', true));
@@ -549,30 +549,30 @@ var World = {
case World.TILE.FOREST: case World.TILE.FOREST:
switch(newTile) { switch(newTile) {
case World.TILE.FIELD: case World.TILE.FIELD:
msg = "the trees yield to dry grass. the yellowed brush rustles in the wind."; msg = _("the trees yield to dry grass. the yellowed brush rustles in the wind.");
break; break;
case World.TILE.BARRENS: case World.TILE.BARRENS:
msg = "the trees are gone. parched earth and blowing dust are poor replacements."; msg = _("the trees are gone. parched earth and blowing dust are poor replacements.");
break; break;
} }
break; break;
case World.TILE.FIELD: case World.TILE.FIELD:
switch(newTile) { switch(newTile) {
case World.TILE.FOREST: case World.TILE.FOREST:
msg = "trees loom on the horizon. grasses gradually yield to a forest floor of dry branches and fallen leaves."; msg = _("trees loom on the horizon. grasses gradually yield to a forest floor of dry branches and fallen leaves.");
break; break;
case World.TILE.BARRENS: case World.TILE.BARRENS:
msg = "the grasses thin. soon, only dust remains."; msg = _("the grasses thin. soon, only dust remains.");
break; break;
} }
break; break;
case World.TILE.BARRENS: case World.TILE.BARRENS:
switch(newTile) { switch(newTile) {
case World.TILE.FIELD: case World.TILE.FIELD:
msg = "the barrens break at a sea of dying grass, swaying in the arid breeze."; msg = _("the barrens break at a sea of dying grass, swaying in the arid breeze.");
break; break;
case World.TILE.FOREST: case World.TILE.FOREST:
msg = "a wall of gnarled trees rises from the dust. their branches twist into a skeletal canopy overhead."; msg = _("a wall of gnarled trees rises from the dust. their branches twist into a skeletal canopy overhead.");
break; break;
} }
break; break;
@@ -774,12 +774,12 @@ var World = {
ttClass += " bottom"; ttClass += " bottom";
} }
if(World.curPos[0] == i && World.curPos[1] == j) { if(World.curPos[0] == i && World.curPos[1] == j) {
mapString += '<span class="landmark">@<div class="tooltip ' + ttClass + '">Wanderer</div></span>'; mapString += '<span class="landmark">@<div class="tooltip ' + ttClass + '">'+_('Wanderer')+'</div></span>';
} else if(World.state.mask[i][j]) { } else if(World.state.mask[i][j]) {
var c = World.state.map[i][j]; var c = World.state.map[i][j];
switch(c) { switch(c) {
case World.TILE.VILLAGE: case World.TILE.VILLAGE:
mapString += '<span class="landmark">' + c + '<div class="tooltip' + ttClass + '">The&nbsp;Village</div></span>'; mapString += '<span class="landmark">' + c + '<div class="tooltip' + ttClass + '">'+_('The&nbsp;Village')+'</div></span>';
break; break;
default: default:
if(typeof World.LANDMARKS[c] != 'undefined' && (c != World.TILE.OUTPOST || !World.outpostUsed(i, j))) { if(typeof World.LANDMARKS[c] != 'undefined' && (c != World.TILE.OUTPOST || !World.outpostUsed(i, j))) {
@@ -808,7 +808,7 @@ var World = {
Engine.event('game event', 'death'); Engine.event('game event', 'death');
Engine.keyLock = true; Engine.keyLock = true;
// Dead! Discard any world changes and go home // Dead! Discard any world changes and go home
Notifications.notify(World, 'the world fades'); Notifications.notify(World, _('the world fades'));
World.state = null; World.state = null;
Path.outfit = {}; Path.outfit = {};
$('#outerSlider').animate({opacity: '0'}, 600, 'linear', function() { $('#outerSlider').animate({opacity: '0'}, 600, 'linear', function() {
@@ -909,7 +909,7 @@ var World = {
}, },
useOutpost: function() { useOutpost: function() {
Notifications.notify(null, 'water replenished'); Notifications.notify(null, _('water replenished'));
World.setWater(World.getMaxWater()); World.setWater(World.getMaxWater());
// Mark this outpost as used // Mark this outpost as used
World.usedOutposts[World.curPos[0] + ',' + World.curPos[1]] = true; World.usedOutposts[World.curPos[0] + ',' + World.curPos[1]] = true;
@@ -936,7 +936,7 @@ var World = {
}, },
setTitle: function() { setTitle: function() {
document.title = 'A Barren World'; document.title = _('A Barren World');
}, },
copyPos: function(pos) { copyPos: function(pos) {
Executable
+58
View File
@@ -0,0 +1,58 @@
#!/usr/bin/python
#
# convert .po to .js
#
import json
import optparse
import os
import polib
import re
import string
import sys
parser = optparse.OptionParser(usage="usage: %prog [options] pofile...")
parser.add_option("--callback", default="_.setTranslation", dest="callback", help="callback function to call with data")
parser.add_option("--quiet", action="store_false", default=True, dest="verbose", help="don't print status messages to stdout")
(options, args) = parser.parse_args()
if args == None or len(args) == 0:
print("ERROR: you must specify at least one po file to translate");
sys.exit(1)
paramFix = re.compile("(\\(([0-9])\\))")
for srcfile in args:
destfile = os.path.splitext(srcfile)[0] + ".js"
if options.verbose:
print("INFO: converting %s to %s" % (srcfile, destfile))
xlate_map = {}
po = polib.pofile(srcfile, autodetect_encoding=False, encoding="utf-8", wrapwidth=-1)
for entry in po:
if entry.obsolete or entry.msgstr == '' or entry.msgstr == entry.msgid:
continue
xlate_map[entry.msgid] = entry.msgstr;
dest = open(destfile, "w")
dest.write(options.callback);
dest.write("(");
encoder = json.JSONEncoder()
for part in encoder.iterencode(xlate_map):
if part.startswith('"function('):
dest.write(part[1:-1]);
else:
dest.write(part);
dest.write(");\n")
dest.close()