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>
<html itemscope itemtype="http://schema.org/CreativeWork">
<head>
<meta charset="UTF-8"/>
<!--
A Dark Room (v1.4)
==================
@@ -25,6 +26,24 @@
<script src="lib/jquery.event.move.js"></script>
<script src="lib/jquery.event.swipe.js"></script>
<script src="lib/base64.js"></script>
<script src="lib/translate.js"></script>
<script>
// try to read "lang" param's from url
var lang = decodeURIComponent((new RegExp('[?|&]lang=' + '([^&;]+?)(&|#|;|$)').exec(location.search)||[,""])[1].replace(/\+/g, '%20'))||null;
// if no language requested, try to read it from local storage
if(!lang){
try {
lang = localStorage.lang;
} catch(e) {}
}
// if a language different than english requested, load all translations
if(lang && lang != 'en'){
document.write('<script src="lang/'+lang+'/strings.js"><\/script>');
document.write('<link rel="stylesheet" type="text/css" href="lang/'+'lang'+'/main.css" \/>');
}
</script>
<script src="script/Button.js"></script>
<script src="script/engine.js"></script>
<script src="script/state_manager.js"></script>
@@ -37,8 +56,8 @@
<script src="script/path.js"></script>
<script src="script/ship.js"></script>
<script src="script/space.js"></script>
<script src="script/prestige.js"></script>
<script src="script/scoring.js"></script>
<script src="script/prestige.js"></script>
<script src="script/scoring.js"></script>
<!-- Event modules -->
<script src="script/events/global.js"></script>
<script src="script/events/room.js"></script>
@@ -61,6 +80,7 @@
<link rel="stylesheet" type="text/css" href="css/ship.css" />
<link rel="stylesheet" type="text/css" href="css/space.css" />
<script src="script/localization.js"></script>
<!-- Google Analytics -->
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
@@ -75,7 +95,7 @@
</head>
<body>
<div id="wrapper">
<div id="saveNotify">saved.</div>
<div id="saveNotify"><script>document.write(_("saved."));</script></div>
<div id="content">
<div id="outerSlider">
<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 costTooltip = $('<div>').addClass('tooltip ' + ttPos);
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);
}
if(costTooltip.children().length > 0) {
+108 -69
View File
@@ -17,48 +17,59 @@ var Engine = {
Perks: {
'boxer': {
desc: 'punches do more damage',
notify: 'learned to throw punches with purpose'
name: _('boxer'),
desc: _('punches do more damage'),
notify: _('learned to throw punches with purpose')
},
'martial artist': {
desc: 'punches do even more damage.',
notify: 'learned to fight quite effectively without weapons'
name: _('martial artist'),
desc: _('punches do even more damage.'),
notify: _('learned to fight quite effectively without weapons')
},
'unarmed master': {
desc: 'punch twice as fast, and with even more force',
notify: 'learned to strike faster without weapons'
name: _('unarmed master'),
desc: _('punch twice as fast, and with even more force'),
notify: _('learned to strike faster without weapons')
},
'barbarian': {
desc: 'melee weapons deal more damage',
notify: 'learned to swing weapons with force'
name: _('barbarian'),
desc: _('melee weapons deal more damage'),
notify: _('learned to swing weapons with force')
},
'slow metabolism': {
desc: 'go twice as far without eating',
notify: 'learned how to ignore the hunger'
name: _('slow metabolism'),
desc: _('go twice as far without eating'),
notify: _('learned how to ignore the hunger')
},
'desert rat': {
desc: 'go twice as far without drinking',
notify: 'learned to love the dry air'
name: _('desert rat'),
desc: _('go twice as far without drinking'),
notify: _('learned to love the dry air')
},
'evasive': {
desc: 'dodge attacks more effectively',
notify: "learned to be where they're not"
name: _('evasive'),
desc: _('dodge attacks more effectively'),
notify: _("learned to be where they're not")
},
'precise': {
desc: 'land blows more often',
notify: 'learned to predict their movement'
name: _('precise'),
desc: _('land blows more often'),
notify: _('learned to predict their movement')
},
'scout': {
desc: 'see farther',
notify: 'learned to look ahead'
name: _('scout'),
desc: _('see farther'),
notify: _('learned to look ahead')
},
'stealthy': {
desc: 'better avoid conflict in the wild',
notify: 'learned how not to be seen'
name: _('stealthy'),
desc: _('better avoid conflict in the wild'),
notify: _('learned how not to be seen')
},
'gastronome': {
desc: 'restore more health when eating',
notify: 'learned to make the most of food'
name: _('gastronome'),
desc: _('restore more health when eating'),
notify: _('learned to make the most of food')
}
},
@@ -100,35 +111,45 @@ var Engine = {
.addClass('menu')
.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>')
.addClass('lightsOff menuBtn')
.text('lights off.')
.text(_('lights off.'))
.click(Engine.turnLightsOff)
.appendTo(menu);
$('<span>')
.addClass('menuBtn')
.text('restart.')
.text(_('restart.'))
.click(Engine.confirmDelete)
.appendTo(menu);
$('<span>')
.addClass('menuBtn')
.text('share.')
.text(_('share.'))
.click(Engine.share)
.appendTo(menu);
$('<span>')
.addClass('menuBtn')
.text('save.')
.text(_('save.'))
.click(Engine.exportImport)
.appendTo(menu);
$('<span>')
.addClass('menuBtn')
.text('app store.')
.text(_('app store.'))
.click(function() { window.open('https://itunes.apple.com/us/app/a-dark-room/id736683061'); })
.appendTo(menu);
.appendTo(menu);
// Register keypress handlers
$('body').off('keydown').keydown(Engine.keyDown);
@@ -159,6 +180,7 @@ var Engine = {
Ship.init();
}
Engine.saveLanguage();
Engine.travelTo(Room);
},
@@ -203,55 +225,55 @@ var Engine = {
},
exportImport: function() {
Events.startEvent({
Events.startEvent({
title: 'Export / Import',
scenes: {
start: {
text: ['export or import save data, for backing up',
'or migrating computers'],
text: [_('export or import save data, for backing up'),
_('or migrating computers')],
buttons: {
'export': {
text: 'export',
text: _('export'),
onChoose: Engine.export64
},
'import': {
text: 'import',
text: _('import'),
nextScene: {1: 'confirm'},
},
'cancel': {
text: 'cancel',
text: _('cancel'),
nextScene: 'end'
}
}
},
'confirm': {
text: ['are you sure?',
'if the code is invalid, all data will be lost.',
'this is irreversible.'],
text: [_('are you sure?'),
_('if the code is invalid, all data will be lost.'),
_('this is irreversible.')],
buttons: {
'yes': {
text: 'yes',
text: _('yes'),
nextScene: {1: 'inputImport'},
onChoose: Engine.enableSelection
},
'no': {
text: 'no',
text: _('no'),
nextScene: 'end'
}
}
},
'inputImport': {
text: ['put the save code here.'],
text: [_('put the save code here.')],
textarea: '',
buttons: {
'okay': {
text: 'okay',
text: _('import'),
nextScene: 'end',
onChoose: Engine.import64
},
'cancel': {
text: 'cancel',
nextScene: 'end'
text: _('cancel'),
nextScene: 'end'
}
}
}
@@ -267,23 +289,23 @@ var Engine = {
string64 = string64.replace(/\n/g, '');
Engine.enableSelection();
Events.startEvent({
title: 'Export',
title: _('Export'),
scenes: {
start: {
text: ['save this.'],
text: [_('save this.')],
textarea: string64,
buttons: {
'done': {
text: 'got it',
'done': {
text: _('got it'),
nextScene: 'end',
onChoose: Engine.disableSelection
onChoose: Engine.disableSelection
}
}
}
}
});
},
import64: function(string64) {
Engine.disableSelection();
string64 = string64.replace(/\s/g, '');
@@ -291,7 +313,7 @@ var Engine = {
string64 = string64.replace(/\n/g, '');
var decodedSave = Base64.decode(string64);
localStorage.gameState = decodedSave;
location.reload();
location.reload();
},
event: function(cat, act) {
@@ -302,18 +324,18 @@ var Engine = {
confirmDelete: function() {
Events.startEvent({
title: 'Restart?',
title: _('Restart?'),
scenes: {
start: {
text: ['restart the game?'],
text: [_('restart the game?')],
buttons: {
'yes': {
text: 'yes',
text: _('yes'),
nextScene: 'end',
onChoose: Engine.deleteSave
},
'no': {
text: 'no',
text: _('no'),
nextScene: 'end'
}
}
@@ -336,41 +358,41 @@ var Engine = {
share: function() {
Events.startEvent({
title: 'Share',
title: _('Share'),
scenes: {
start: {
text: ['bring your friends.'],
text: [_('bring your friends.')],
buttons: {
'facebook': {
text: 'facebook',
text: _('facebook'),
nextScene: 'end',
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');
}
},
'google': {
text:'google+',
text:_('google+'),
nextScene: 'end',
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');
}
},
'twitter': {
text: 'twitter',
text: _('twitter'),
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');
},
nextScene: 'end'
},
'reddit': {
text: 'reddit',
text: _('reddit'),
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');
},
nextScene: 'end'
},
'close': {
text: 'close',
text: _('close'),
nextScene: 'end'
}
}
@@ -404,16 +426,16 @@ var Engine = {
if (darkCss == null) {
$('head').append('<link rel="stylesheet" href="css/dark.css" type="text/css" title="darkenLights" />');
Engine.turnLightsOff;
$('.lightsOff').text('lights on.');
$('.lightsOff').text(_('lights on.'));
}
else if (darkCss.disabled) {
darkCss.disabled = false;
$('.lightsOff').text('lights on.');
$('.lightsOff').text(_('lights on.'));
}
else {
$("#darkenLights").attr("disabled", "disabled");
darkCss.disabled = true;
$('.lightsOff').text('lights off.');
$('.lightsOff').text(_('lights off.'));
}
},
@@ -506,7 +528,8 @@ var Engine = {
},
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) {
@@ -586,17 +609,33 @@ var Engine = {
},
disableSelection: function() {
document.onselectstart = function() {return false;} // this is for IE
document.onmousedown = function() {return false;} // this is for the rest
document.onselectstart = function() {return false;}; // this is for IE
document.onmousedown = function() {return false;}; // this is for the rest
},
enableSelection: function() {
document.onselectstart = function() {return true;}
document.onmousedown = function() {return true;}
document.onselectstart = function() {return true;};
document.onmousedown = function() {return true;};
},
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({
id: 'eat',
text: 'eat meat',
text: _('eat meat'),
cooldown: cooldown,
click: Events.eatMeat,
cost: { 'cured meat': 1 }
@@ -143,7 +143,7 @@ var Events = {
var btn = new Button.Button({
id: 'meds',
text: 'use meds',
text: _('use meds'),
cooldown: cooldown,
click: Events.useMeds,
cost: { 'medicine': 1 }
@@ -453,7 +453,7 @@ var Events = {
var btns = $('#buttons', Events.eventPanel());
desc.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);
@@ -471,7 +471,7 @@ var Events = {
Events.endEvent();
}
},
text: 'leave'
text: _('leave')
}).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;
new Button.Button({
id: 'loot_' + k.replace(' ', '-'),
text: k + ' [' + num + ']',
text: _(k) + ' [' + num + ']',
click: Events.getLoot
}).data('numLeft', num).appendTo(lootButtons);
}
@@ -518,11 +518,11 @@ var Events = {
if(lootBtn.length > 0) {
var curNum = lootBtn.data('numLeft');
curNum += num;
lootBtn.text(thing + ' [' + curNum + ']').data('numLeft', curNum);
lootBtn.text(_(thing) + ' [' + curNum + ']').data('numLeft', curNum);
} else {
new Button.Button({
id: 'loot_' + thing.replace(' ', '-'),
text: thing + ' [' + num + ']',
text: _(thing) + ' [' + num + ']',
click: Events.getLoot
}).data('numLeft', num).insertBefore($('.clear', lootButtons));
}
@@ -550,7 +550,7 @@ var Events = {
});
} else {
// #dropMenu gets removed by this.
btn.text(name + ' [' + num + ']');
btn.text(_(name) + ' [' + num + ']');
}
var curNum = Path.outfit[name];
curNum = typeof curNum == 'number' ? curNum : 0;
@@ -578,7 +578,7 @@ var Events = {
}
if(numToDrop > 0) {
var dropRow = $('<div>').attr('id', 'drop_' + k.replace(' ', '-'))
.text(k + ' x' + numToDrop)
.text(_(k) + ' x' + numToDrop)
.data('thing', k)
.data('num', numToDrop)
.click(Events.dropStuff);
@@ -595,7 +595,7 @@ var Events = {
},
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);
return fighter;
},
@@ -809,7 +809,7 @@ var Events = {
Engine.keyLock = false;
// Force refocus on the body. I hate you, IE.
$('body').focus();
});
});
},
handleStateUpdates: function(e){
+48 -28
View File
@@ -4,7 +4,7 @@
Events.Encounters = [
/* Tier 1 */
{ /* Snarling Beast */
title: 'A Snarling Beast',
title: _('A Snarling Beast'),
isAvailable: function() {
return World.getDistance() <= 10 && World.getTerrain() == World.TILE.FOREST;
},
@@ -12,6 +12,8 @@ Events.Encounters = [
'start': {
combat: true,
enemy: 'snarling beast',
enemyName: _('snarling beast'),
deathMessage: _('the snarling beast is dead'),
chara: 'B',
damage: 1,
hit: 0.8,
@@ -34,12 +36,12 @@ Events.Encounters = [
chance: 0.8
}
},
notification: 'a snarling beast leaps out of the underbrush'
notification: _('a snarling beast leaps out of the underbrush')
}
}
},
{ /* Gaunt Man */
title: 'A Gaunt Man',
title: _('A Gaunt Man'),
isAvailable: function() {
return World.getDistance() <= 10 && World.getTerrain() == World.TILE.BARRENS;
},
@@ -47,6 +49,8 @@ Events.Encounters = [
'start': {
combat: true,
enemy: 'gaunt man',
enemyName: _('gaunt man'),
deathMessage: _('the gaunt man is dead'),
chara: 'G',
damage: 2,
hit: 0.8,
@@ -69,19 +73,21 @@ Events.Encounters = [
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 */
title: 'A Strange Bird',
title: _('A Strange Bird'),
isAvailable: function() {
return World.getDistance() <= 10 && World.getTerrain() == World.TILE.FIELD;
},
scenes: {
'start': {
combat: true,
enemy: 'strange bird',
enemy: 'strange bird',
enemyName: _('strange bird'),
deathMessage: _('the strange bird is dead'),
chara: 'B',
damage: 3,
hit: 0.8,
@@ -104,20 +110,22 @@ Events.Encounters = [
chance: 0.8
}
},
notification: 'a strange looking bird speeds across the plains'
notification: _('a strange looking bird speeds across the plains')
}
}
},
/* Tier 2*/
{ /* Shivering Man */
title: 'A Shivering Man',
title: _('A Shivering Man'),
isAvailable: function() {
return World.getDistance() > 10 && World.getDistance() <= 20 && World.getTerrain() == World.TILE.BARRENS;
},
scenes: {
'start': {
combat: true,
enemy: 'shivering man',
enemy: 'shivering man',
enemyName: _('shivering man'),
deathMessage: _('the shivering man is dead'),
chara: 'S',
damage: 5,
hit: 0.5,
@@ -145,19 +153,21 @@ Events.Encounters = [
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 */
title: 'A Man-Eater',
title: _('A Man-Eater'),
isAvailable: function() {
return World.getDistance() > 10 && World.getDistance() <= 20 && World.getTerrain() == World.TILE.FOREST;
},
scenes: {
'start': {
combat: true,
enemy: 'man-eater',
enemy: 'man-eater',
enemyName: _('man-eater'),
deathMessage: _('the man-eater is dead'),
chara: 'E',
damage: 3,
hit: 0.8,
@@ -180,19 +190,21 @@ Events.Encounters = [
chance: 0.8
}
},
notification: 'a large creature attacks, claws freshly bloodied'
notification: _('a large creature attacks, claws freshly bloodied')
}
}
},
{ /* Scavenger */
title: 'A Scavenger',
title: _('A Scavenger'),
isAvailable: function() {
return World.getDistance() > 10 && World.getDistance() <= 20 && World.getTerrain() == World.TILE.BARRENS;
},
scenes: {
'start': {
combat: true,
enemy: 'scavenger',
enemy: 'scavenger',
enemyName: _('scavenger'),
deathMessage: _('the scavenger is dead'),
chara: 'S',
damage: 4,
hit: 0.8,
@@ -220,19 +232,21 @@ Events.Encounters = [
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 */
title: 'A Huge Lizard',
title: _('A Huge Lizard'),
isAvailable: function() {
return World.getDistance() > 10 && World.getDistance() <= 20 && World.getTerrain() == World.TILE.FIELD;
},
scenes: {
'start': {
combat: true,
enemy: 'lizard',
enemy: 'lizard',
enemyName: _('lizard'),
deathMessage: _('the lizard is dead'),
chara: 'L',
damage: 5,
hit: 0.8,
@@ -255,20 +269,22 @@ Events.Encounters = [
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*/
{ /* Feral Terror */
title: 'A Feral Terror',
title: _('A Feral Terror'),
isAvailable: function() {
return World.getDistance() > 20 && World.getTerrain() == World.TILE.FOREST;
},
scenes: {
'start': {
combat: true,
enemy: 'feral terror',
enemy: 'feral terror',
enemyName: _('feral terror'),
deathMessage: _('the feral terror is dead'),
chara: 'F',
damage: 6,
hit: 0.8,
@@ -291,19 +307,21 @@ Events.Encounters = [
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 */
title: 'A Soldier',
title: _('A Soldier'),
isAvailable: function() {
return World.getDistance() > 20 && World.getTerrain() == World.TILE.BARRENS;
},
scenes: {
'start': {
combat: true,
enemy: 'soldier',
enemy: 'soldier',
enemyName: _('soldier'),
deathMessage: _('the soldier is dead'),
ranged: true,
chara: 'D',
damage: 8,
@@ -332,19 +350,21 @@ Events.Encounters = [
chance: 0.1
}
},
notification: 'a soldier opens fire from across the desert'
notification: _('a soldier opens fire from across the desert')
}
}
},
{ /* Sniper */
title: 'A Sniper',
title: _('A Sniper'),
isAvailable: function() {
return World.getDistance() > 20 && World.getTerrain() == World.TILE.FIELD;
},
scenes: {
'start': {
combat: true,
enemy: 'sniper',
enemy: 'sniper',
enemyName: _('sniper'),
deathMessage: _('the sniper is dead'),
chara: 'S',
damage: 15,
hit: 0.8,
@@ -373,7 +393,7 @@ Events.Encounters = [
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 = [
{ /* The Thief */
title: 'The Thief',
title: _('The Thief'),
isAvailable: function() {
return (Engine.activeModule == Room || Engine.activeModule == Outside) && $SM.get('game.thieves') == 1;
},
scenes: {
'start': {
text: [
'the villagers haul a filthy man out of the store room.',
"say his folk have been skimming the supplies.",
'say he should be strung up as an example.'
_('the villagers haul a filthy man out of the store room.'),
_("say his folk have been skimming the supplies."),
_('say he should be strung up as an example.')
],
notification: 'a thief is caught',
notification: _('a thief is caught'),
buttons: {
'kill': {
text: 'hang him',
text: _('hang him'),
nextScene: {1: 'hang'}
},
'spare': {
text: 'spare him',
text: _('spare him'),
nextScene: {1: 'spare'}
}
}
},
'hang': {
text: [
'the villagers hang the thief high in front of the store room.',
'the point is made. in the next few days, the missing supplies are returned.'
_('the villagers hang the thief high in front of the store room.'),
_('the point is made. in the next few days, the missing supplies are returned.')
],
onLoad: function() {
$SM.set('game.thieves', 2);
@@ -38,15 +38,15 @@ Events.Global = [
},
buttons: {
'leave': {
text: 'leave',
text: _('leave'),
nextScene: 'end'
}
}
},
'spare': {
text: [
"the man says he's grateful. says he won't come around any more.",
"shares what he knows about sneaking before he goes."
_("the man says he's grateful. says he won't come around any more."),
_("shares what he knows about sneaking before he goes.")
],
onLoad: function() {
$SM.set('game.thieves', 2);
@@ -55,7 +55,7 @@ Events.Global = [
},
buttons: {
'leave': {
text: 'leave',
text: _('leave'),
nextScene: 'end'
}
}
+46 -46
View File
@@ -3,15 +3,15 @@
**/
Events.Outside = [
{ /* Ruined traps */
title: 'A Ruined Trap',
title: _('A Ruined Trap'),
isAvailable: function() {
return Engine.activeModule == Outside && $SM.get('game.buildings["trap"]', true) > 0;
},
scenes: {
'start': {
text: [
'some of the traps have been torn apart.',
'large prints lead away, into the forest.'
_('some of the traps have been torn apart.'),
_('large prints lead away, into the forest.')
],
onLoad: function() {
var numWrecked = Math.floor(Math.random() * $SM.get('game.buildings["trap"]', true)) + 1;
@@ -19,34 +19,34 @@ Events.Outside = [
Outside.updateVillage();
Outside.updateTrapButton();
},
notification: 'some traps have been destroyed',
notification: _('some traps have been destroyed'),
buttons: {
'track': {
text: 'track them',
text: _('track them'),
nextScene: {0.5: 'nothing', 1: 'catch'}
},
'ignore': {
text: 'ignore them',
text: _('ignore them'),
nextScene: 'end'
}
}
},
'nothing': {
text: [
'the tracks disappear after just a few minutes.',
'the forest is silent.'
_('the tracks disappear after just a few minutes.'),
_('the forest is silent.')
],
buttons: {
'end': {
text: 'go home',
text: _('go home'),
nextScene: 'end'
}
}
},
'catch': {
text: [
'not far from the village lies a large beast, its fur matted with blood.',
'it puts up little resistance before the knife.'
_('not far from the village lies a large beast, its fur matted with blood.'),
_('it puts up little resistance before the knife.')
],
reward: {
fur: 100,
@@ -55,7 +55,7 @@ Events.Outside = [
},
buttons: {
'end': {
text: 'go home',
text: _('go home'),
nextScene: 'end'
}
}
@@ -64,7 +64,7 @@ Events.Outside = [
},
{ /* Sickness */
title: 'Sickness',
title: _('Sickness'),
isAvailable: function() {
return Engine.activeModule == Outside &&
$SM.get('game.population', true) > 10 &&
@@ -74,37 +74,37 @@ Events.Outside = [
scenes: {
'start': {
text: [
'a sickness is spreading through the village.',
'medicine is needed immediately.'
_('a sickness is spreading through the village.'),
_('medicine is needed immediately.')
],
buttons: {
'heal': {
text: '1 medicine',
text: _('1 medicine'),
cost: { 'medicine' : 1 },
nextScene: {1: 'healed'}
},
'ignore': {
text: 'ignore it',
text: _('ignore it'),
nextScene: {1: 'death'}
}
}
},
'healed': {
text: [
'the sickness is cured in time.'
_('the sickness is cured in time.')
],
buttons: {
'end': {
text: 'go home',
text: _('go home'),
nextScene: 'end'
}
}
},
'death': {
text: [
'the sickness spreads through the village.',
'the days are spent with burials.',
'the nights are rent with screams.'
_('the sickness spreads through the village.'),
_('the days are spent with burials.'),
_('the nights are rent with screams.')
],
onLoad: function() {
var numKilled = Math.floor(Math.random() * 20) + 1;
@@ -112,7 +112,7 @@ Events.Outside = [
},
buttons: {
'end': {
text: 'go home',
text: _('go home'),
nextScene: 'end'
}
}
@@ -121,33 +121,33 @@ Events.Outside = [
},
{ /* Plague */
title: 'Plague',
title: _('Plague'),
isAvailable: function() {
return Engine.activeModule == Outside && $SM.get('game.population', true) > 50 && $SM.get('stores.medicine', true) > 0;
},
scenes: {
'start': {
text: [
'a terrible plague is fast spreading through the village.',
'medicine is needed immediately.'
_('a terrible plague is fast spreading through the village.'),
_('medicine is needed immediately.')
],
buttons: {
'heal': {
text: '5 medicine',
text: _('5 medicine'),
cost: { 'medicine' : 5 },
nextScene: {1: 'healed'}
},
'ignore': {
text: 'do nothing',
text: _('do nothing'),
nextScene: {1: 'death'}
}
}
},
'healed': {
text: [
'the plague is kept from spreading.',
'only a few die.',
'the rest bury them.'
_('the plague is kept from spreading.'),
_('only a few die.'),
_('the rest bury them.')
],
onLoad: function() {
var numKilled = Math.floor(Math.random() * 5) + 2;
@@ -155,16 +155,16 @@ Events.Outside = [
},
buttons: {
'end': {
text: 'go home',
text: _('go home'),
nextScene: 'end'
}
}
},
'death': {
text: [
'the plague rips through the village.',
'the nights are rent with screams.',
'the only hope is a quick death.'
_('the plague rips through the village.'),
_('the nights are rent with screams.'),
_('the only hope is a quick death.')
],
onLoad: function() {
var numKilled = Math.floor(Math.random() * 80) + 10;
@@ -172,7 +172,7 @@ Events.Outside = [
},
buttons: {
'end': {
text: 'go home',
text: _('go home'),
nextScene: 'end'
}
}
@@ -181,16 +181,16 @@ Events.Outside = [
},
{ /* Beast attack */
title: 'A Beast Attack',
title: _('A Beast Attack'),
isAvailable: function() {
return Engine.activeModule == Outside && $SM.get('game.population', true) > 0;
},
scenes: {
'start': {
text: [
'a pack of snarling beasts pours out of the trees.',
'the fight is short and bloody, but the beasts are repelled.',
'the villagers retreat to mourn the dead.'
_('a pack of snarling beasts pours out of the trees.'),
_('the fight is short and bloody, but the beasts are repelled.'),
_('the villagers retreat to mourn the dead.')
],
onLoad: function() {
var numKilled = Math.floor(Math.random() * 10) + 1;
@@ -203,7 +203,7 @@ Events.Outside = [
},
buttons: {
'end': {
text: 'go home',
text: _('go home'),
nextScene: 'end'
}
}
@@ -212,16 +212,16 @@ Events.Outside = [
},
{ /* Soldier attack */
title: 'A Military Raid',
title: _('A Military Raid'),
isAvailable: function() {
return Engine.activeModule == Outside && $SM.get('game.population', true) > 0 && $SM.get('game.cityCleared');;
},
scenes: {
'start': {
text: [
'a gunshot rings through the trees.',
'well armed men charge out of the forest, firing into the crowd.',
'after a skirmish they are driven away, but not without losses.'
_('a gunshot rings through the trees.'),
_('well armed men charge out of the forest, firing into the crowd.'),
_('after a skirmish they are driven away, but not without losses.')
],
onLoad: function() {
var numKilled = Math.floor(Math.random() * 40) + 1;
@@ -233,7 +233,7 @@ Events.Outside = [
},
buttons: {
'end': {
text: 'go home',
text: _('go home'),
nextScene: 'end'
}
}
+120 -120
View File
@@ -3,82 +3,82 @@
**/
Events.Room = [
{ /* The Nomad -- Merchant */
title: 'The Nomad',
title: _('The Nomad'),
isAvailable: function() {
return Engine.activeModule == Room && $SM.get('stores.fur', true) > 0;
},
scenes: {
'start': {
text: [
'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."
_('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.")
],
notification: 'a nomad arrives, looking to trade',
notification: _('a nomad arrives, looking to trade'),
buttons: {
'buyScales': {
text: 'buy scales',
text: _('buy scales'),
cost: { 'fur': 100 },
reward: { 'scales': 1 }
},
'buyTeeth': {
text: 'buy teeth',
text: _('buy teeth'),
cost: { 'fur': 200 },
reward: { 'teeth': 1 }
},
'buyBait': {
text: 'buy bait',
text: _('buy bait'),
cost: { 'fur': 5 },
reward: { 'bait': 1 },
notification: 'traps are more effective with bait.'
notification: _('traps are more effective with bait.')
},
'buyCompass': {
available: function() {
return $SM.get('stores.compass', true) < 1;
},
text: 'buy compass',
text: _('buy compass'),
cost: { fur: 300, scales: 15, teeth: 5 },
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
},
'goodbye': {
text: 'say goodbye',
text: _('say goodbye'),
nextScene: 'end'
}
}
}
}
}, { /* Noises Outside -- gain wood/fur */
title: 'Noises',
title: _('Noises'),
isAvailable: function() {
return Engine.activeModule == Room && $SM.get('stores.wood');
},
scenes: {
'start': {
text: [
'through the walls, shuffling noises can be heard.',
"can't tell what they're up to."
_('through the walls, shuffling noises can be heard.'),
_("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: {
'investigate': {
text: 'investigate',
text: _('investigate'),
nextScene: { 0.3: 'stuff', 1: 'nothing' }
},
'ignore': {
text: 'ignore them',
text: _('ignore them'),
nextScene: 'end'
}
}
},
'nothing': {
text: [
'vague shapes move, just out of sight.',
'the sounds stop.'
_('vague shapes move, just out of sight.'),
_('the sounds stop.')
],
buttons: {
'backinside': {
text: 'go back inside',
text: _('go back inside'),
nextScene: 'end'
}
}
@@ -86,12 +86,12 @@ Events.Room = [
'stuff': {
reward: { wood: 100, fur: 10 },
text: [
'a bundle of sticks lies just beyond the threshold, wrapped in coarse furs.',
'the night is silent.'
_('a bundle of sticks lies just beyond the threshold, wrapped in coarse furs.'),
_('the night is silent.')
],
buttons: {
'backinside': {
text: 'go back inside',
text: _('go back inside'),
nextScene: 'end'
}
}
@@ -99,32 +99,32 @@ Events.Room = [
}
},
{ /* Noises Inside -- trade wood for better good */
title: 'Noises',
title: _('Noises'),
isAvailable: function() {
return Engine.activeModule == Room && $SM.get('stores.wood');
},
scenes: {
start: {
text: [
'scratching noises can be heard from the store room.',
'something\'s in there.'
_('scratching noises can be heard from the store room.'),
_('something\'s in there.')
],
notification: 'something\'s in the store room',
notification: _('something\'s in the store room'),
buttons: {
'investigate': {
text: 'investigate',
text: _('investigate'),
nextScene: { 0.5: 'scales', 0.8: 'teeth', 1: 'cloth' }
},
'ignore': {
text: 'ignore them',
text: _('ignore them'),
nextScene: 'end'
}
}
},
scales: {
text: [
'some wood is missing.',
'the ground is littered with small scales'
_('some wood is missing.'),
_('the ground is littered with small scales')
],
onLoad: function() {
var numWood = $SM.get('stores.wood', true);
@@ -136,15 +136,15 @@ Events.Room = [
},
buttons: {
'leave': {
text: 'leave',
text: _('leave'),
nextScene: 'end'
}
}
},
teeth: {
text: [
'some wood is missing.',
'the ground is littered with small teeth'
_('some wood is missing.'),
_('the ground is littered with small teeth')
],
onLoad: function() {
var numWood = $SM.get('stores.wood', true);
@@ -156,15 +156,15 @@ Events.Room = [
},
buttons: {
'leave': {
text: 'leave',
text: _('leave'),
nextScene: 'end'
}
}
},
cloth: {
text: [
'some wood is missing.',
'the ground is littered with scraps of cloth'
_('some wood is missing.'),
_('the ground is littered with scraps of cloth')
],
onLoad: function() {
var numWood = $SM.get('stores.wood', true);
@@ -176,7 +176,7 @@ Events.Room = [
},
buttons: {
'leave': {
text: 'leave',
text: _('leave'),
nextScene: 'end'
}
}
@@ -184,30 +184,30 @@ Events.Room = [
}
},
{ /* The Beggar -- trade fur for better good */
title: 'The Beggar',
title: _('The Beggar'),
isAvailable: function() {
return Engine.activeModule == Room && $SM.get('stores.fur');
},
scenes: {
start: {
text: [
'a beggar arrives.',
'asks for any spare furs to keep him warm at night.'
_('a beggar arrives.'),
_('asks for any spare furs to keep him warm at night.')
],
notification: 'a beggar arrives',
notification: _('a beggar arrives'),
buttons: {
'50furs': {
text: 'give 50',
text: _('give 50'),
cost: {fur: 50},
nextScene: { 0.5: 'scales', 0.8: 'teeth', 1: 'cloth' }
},
'100furs': {
text: 'give 100',
text: _('give 100'),
cost: {fur: 100},
nextScene: { 0.5: 'teeth', 0.8: 'scales', 1: 'cloth' }
},
'deny': {
text: 'turn him away',
text: _('turn him away'),
nextScene: 'end'
}
}
@@ -215,12 +215,12 @@ Events.Room = [
scales: {
reward: { scales: 20 },
text: [
'the beggar expresses his thanks.',
'leaves a pile of small scales behind.'
_('the beggar expresses his thanks.'),
_('leaves a pile of small scales behind.')
],
buttons: {
'leave': {
text: 'say goodbye',
text: _('say goodbye'),
nextScene: 'end'
}
}
@@ -228,12 +228,12 @@ Events.Room = [
teeth: {
reward: { teeth: 20 },
text: [
'the beggar expresses his thanks.',
'leaves a pile of small teeth behind.'
_('the beggar expresses his thanks.'),
_('leaves a pile of small teeth behind.')
],
buttons: {
'leave': {
text: 'say goodbye',
text: _('say goodbye'),
nextScene: 'end'
}
}
@@ -241,12 +241,12 @@ Events.Room = [
cloth: {
reward: { cloth: 20 },
text: [
'the beggar expresses his thanks.',
'leaves some scraps of cloth behind.'
_('the beggar expresses his thanks.'),
_('leaves some scraps of cloth behind.')
],
buttons: {
'leave': {
text: 'say goodbye',
text: _('say goodbye'),
nextScene: 'end'
}
}
@@ -255,68 +255,68 @@ Events.Room = [
},
{ /* Mysterious Wanderer -- wood gambling */
title: 'The Mysterious Wanderer',
title: _('The Mysterious Wanderer'),
isAvailable: function() {
return Engine.activeModule == Room && $SM.get('stores.wood');
},
scenes: {
start: {
text: [
'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."
_('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.")
],
notification: 'a mysterious wanderer arrives',
notification: _('a mysterious wanderer arrives'),
buttons: {
'100wood': {
text: 'give 100',
text: _('give 100'),
cost: {wood: 100},
nextScene: { 1: '100wood'}
},
'500wood': {
text: 'give 500',
text: _('give 500'),
cost: {wood: 500},
nextScene: { 1: '500wood' }
},
'deny': {
text: 'turn him away',
text: _('turn him away'),
nextScene: 'end'
}
}
},
'100wood': {
text: [
'the wanderer leaves, cart loaded with wood'
_('the wanderer leaves, cart loaded with wood')
],
onLoad: function() {
if(Math.random() < 0.5) {
setTimeout(function() {
$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);
}
},
buttons: {
'leave': {
text: 'say goodbye',
text: _('say goodbye'),
nextScene: 'end'
}
}
},
'500wood': {
text: [
'the wanderer leaves, cart loaded with wood'
_('the wanderer leaves, cart loaded with wood')
],
onLoad: function() {
if(Math.random() < 0.3) {
setTimeout(function() {
$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);
}
},
buttons: {
'leave': {
text: 'say goodbye',
text: _('say goodbye'),
nextScene: 'end'
}
}
@@ -325,68 +325,68 @@ Events.Room = [
},
{ /* Mysterious Wanderer -- fur gambling */
title: 'The Mysterious Wanderer',
title: _('The Mysterious Wanderer'),
isAvailable: function() {
return Engine.activeModule == Room && $SM.get('stores.fur');
},
scenes: {
start: {
text: [
'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."
_('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.")
],
notification: 'a mysterious wanderer arrives',
notification: _('a mysterious wanderer arrives'),
buttons: {
'100fur': {
text: 'give 100',
text: _('give 100'),
cost: {fur: 100},
nextScene: { 1: '100fur'}
},
'500fur': {
text: 'give 500',
text: _('give 500'),
cost: {fur: 500},
nextScene: { 1: '500fur' }
},
'deny': {
text: 'turn her away',
text: _('turn her away'),
nextScene: 'end'
}
}
},
'100fur': {
text: [
'the wanderer leaves, cart loaded with furs'
_('the wanderer leaves, cart loaded with furs')
],
onLoad: function() {
if(Math.random() < 0.5) {
setTimeout(function() {
$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);
}
},
buttons: {
'leave': {
text: 'say goodbye',
text: _('say goodbye'),
nextScene: 'end'
}
}
},
'500fur': {
text: [
'the wanderer leaves, cart loaded with furs'
_('the wanderer leaves, cart loaded with furs')
],
onLoad: function() {
if(Math.random() < 0.3) {
setTimeout(function() {
$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);
}
},
buttons: {
'leave': {
text: 'say goodbye',
text: _('say goodbye'),
nextScene: 'end'
}
}
@@ -395,26 +395,26 @@ Events.Room = [
},
{ /* The Scout -- Map Merchant */
title: 'The Scout',
title: _('The Scout'),
isAvailable: function() {
return Engine.activeModule == Room && $SM.get('features.location.world');
},
scenes: {
'start': {
text: [
"the scout says she's been all over.",
"willing to talk about it, for a price."
_("the scout says she's been all over."),
_("willing to talk about it, for a price.")
],
notification: 'a scout stops for the night',
notification: _('a scout stops for the night'),
buttons: {
'buyMap': {
text: 'buy map',
text: _('buy map'),
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
},
'learn': {
text: 'learn scouting',
text: _('learn scouting'),
cost: { 'fur': 1000, 'scales': 50, 'teeth': 20 },
available: function() {
return !$SM.hasPerk('scout');
@@ -424,7 +424,7 @@ Events.Room = [
}
},
'leave': {
text: 'say goodbye',
text: _('say goodbye'),
nextScene: 'end'
}
}
@@ -433,20 +433,20 @@ Events.Room = [
},
{ /* The Wandering Master */
title: 'The Master',
title: _('The Master'),
isAvailable: function() {
return Engine.activeModule == Room && $SM.get('features.location.world');
},
scenes: {
'start': {
text: [
'an old wanderer arrives.',
'he smiles warmly and asks for lodgings for the night.'
_('an old wanderer arrives.'),
_('he smiles warmly and asks for lodgings for the night.')
],
notification: 'an old wanderer arrives',
notification: _('an old wanderer arrives'),
buttons: {
'agree': {
text: 'agree',
text: _('agree'),
cost: {
'cured meat': 100,
'fur': 100,
@@ -455,18 +455,18 @@ Events.Room = [
nextScene: {1: 'agree'}
},
'deny': {
text: 'turn him away',
text: _('turn him away'),
nextScene: 'end'
}
}
},
'agree': {
text: [
'in exchange, the wanderer offers his wisdom.'
_('in exchange, the wanderer offers his wisdom.')
],
buttons: {
'evasion': {
text: 'evasion',
text: _('evasion'),
available: function() {
return !$SM.hasPerk('evasive');
},
@@ -476,7 +476,7 @@ Events.Room = [
nextScene: 'end'
},
'precision': {
text: 'precision',
text: _('precision'),
available: function() {
return !$SM.hasPerk('precise');
},
@@ -486,7 +486,7 @@ Events.Room = [
nextScene: 'end'
},
'force': {
text: 'force',
text: _('force'),
available: function() {
return !$SM.hasPerk('barbarian');
},
@@ -496,7 +496,7 @@ Events.Room = [
nextScene: 'end'
},
'nothing': {
text: 'nothing',
text: _('nothing'),
nextScene: 'end'
}
}
@@ -505,85 +505,85 @@ Events.Room = [
},
{ /* The Sick Man */
title: 'The Sick Man',
title: _('The Sick Man'),
isAvailable: function() {
return Engine.activeModule == Room && $SM.get('stores.medicine', true) > 0;
},
scenes: {
'start': {
text: [
"a man hobbles up, coughing.",
"he begs for medicine."
_("a man hobbles up, coughing."),
_("he begs for medicine.")
],
notification: 'a sick man hobbles up',
notification: _('a sick man hobbles up'),
buttons: {
'help': {
text: 'give 1 medicine',
text: _('give 1 medicine'),
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' }
},
'ignore': {
text: 'tell him to leave',
text: _('tell him to leave'),
nextScene: 'end'
}
}
},
'alloy': {
text: [
"the man is thankful.",
'he leaves a reward.',
'some weird metal he picked up on his travels.'
_("the man is thankful."),
_('he leaves a reward.'),
_('some weird metal he picked up on his travels.')
],
onLoad: function() {
$SM.add('stores["alien alloy"]', 1);
},
buttons: {
'bye': {
text: 'say goodbye',
text: _('say goodbye'),
nextScene: 'end'
}
}
},
'cells': {
text: [
"the man is thankful.",
'he leaves a reward.',
'some weird glowing boxes he picked up on his travels.'
_("the man is thankful."),
_('he leaves a reward.'),
_('some weird glowing boxes he picked up on his travels.')
],
onLoad: function() {
$SM.add('stores["energy cell"]', 3);
},
buttons: {
'bye': {
text: 'say goodbye',
text: _('say goodbye'),
nextScene: 'end'
}
}
},
'scales': {
text: [
"the man is thankful.",
'he leaves a reward.',
'all he has are some scales.'
_("the man is thankful."),
_('he leaves a reward.'),
_('all he has are some scales.')
],
onLoad: function() {
$SM.add('stores.scales', 5);
},
buttons: {
'bye': {
text: 'say goodbye',
text: _('say goodbye'),
nextScene: 'end'
}
}
},
'nothing': {
text: [
"the man expresses his thanks and hobbles off."
_("the man expresses his thanks and hobbles off.")
],
buttons: {
'bye': {
text: 'say goodbye',
text: _('say goodbye'),
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
*/
var Outside = {
name: "Outside",
name: _("Outside"),
_GATHER_DELAY: 60,
_TRAPS_DELAY: 90,
@@ -10,12 +10,14 @@ var Outside = {
_INCOME: {
'gatherer': {
name: _('gatherer'),
delay: 10,
stores: {
'wood': 1
}
},
'hunter': {
name: _('hunter'),
delay: 10,
stores: {
'fur': 0.5,
@@ -23,6 +25,7 @@ var Outside = {
}
},
'trapper': {
name: _('trapper'),
delay: 10,
stores: {
'meat': -1,
@@ -30,6 +33,7 @@ var Outside = {
}
},
'tanner': {
name: _('tanner'),
delay: 10,
stores: {
'fur': -5,
@@ -37,6 +41,7 @@ var Outside = {
}
},
'charcutier': {
name: _('charcutier'),
delay: 10,
stores: {
'meat': -5,
@@ -45,6 +50,7 @@ var Outside = {
}
},
'iron miner': {
name: _('iron miner'),
delay: 10,
stores: {
'cured meat': -1,
@@ -52,6 +58,7 @@ var Outside = {
}
},
'coal miner': {
name: _('coal miner'),
delay: 10,
stores: {
'cured meat': -1,
@@ -59,6 +66,7 @@ var Outside = {
}
},
'sulphur miner': {
name: _('sulphur miner'),
delay: 10,
stores: {
'cured meat': -1,
@@ -66,6 +74,7 @@ var Outside = {
}
},
'steelworker': {
name: _('steelworker'),
delay: 10,
stores: {
'iron': -1,
@@ -74,6 +83,7 @@ var Outside = {
}
},
'armourer': {
name: _('armourer'),
delay: 10,
stores: {
'steel': -1,
@@ -87,32 +97,32 @@ var Outside = {
{
rollUnder: 0.5,
name: 'fur',
message: 'scraps of fur'
message: _('scraps of fur')
},
{
rollUnder: 0.75,
name: 'meat',
message: 'bits of meat'
message: _('bits of meat')
},
{
rollUnder: 0.85,
name: 'scales',
message: 'strange scales'
message: _('strange scales')
},
{
rollUnder: 0.93,
name: 'teeth',
message: 'scattered teeth'
message: _('scattered teeth')
},
{
rollUnder: 0.995,
name: 'cloth',
message: 'tattered cloth'
message: _('tattered cloth')
},
{
rollUnder: 1.0,
name: 'charm',
message: 'a crudely made charm'
message: _('a crudely made charm')
}
],
@@ -128,7 +138,7 @@ var Outside = {
}
// 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
this.panel = $('<div>').attr('id', "outsidePanel")
@@ -153,7 +163,7 @@ var Outside = {
// Create the gather button
new Button.Button({
id: 'gatherButton',
text: "gather wood",
text: _("gather wood"),
click: Outside.gatherWood,
cooldown: Outside._GATHER_DELAY,
width: '80px'
@@ -170,15 +180,15 @@ var Outside = {
var num = Math.floor(Math.random()*(space/2) + space/2);
if(num == 0) 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) {
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) {
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) {
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 {
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);
$SM.add('game.population', num);
@@ -215,11 +225,11 @@ var Outside = {
updateWorkersView: function() {
var workers = $('div#workers');
// If our population is 0 and we don't already have a workers view,
// there's nothing to do here.
// If our population is 0 and we don't already have a workers view,
// there's nothing to do here.
if(!workers.length && $SM.get('game.population') == 0) return;
var needsAppend = false;
if(workers.length == 0) {
needsAppend = true;
@@ -299,16 +309,19 @@ var Outside = {
return num;
},
makeWorkerRow: function(name, num) {
makeWorkerRow: function(key, num) {
name = Outside._INCOME[key].name;
if(!name) name = key;
var row = $('<div>')
.attr('id', 'workers_row_' + name.replace(' ','-'))
.attr('key', key)
.attr('id', 'workers_row_' + key.replace(' ','-'))
.addClass('workerRow');
$('<div>').addClass('row_key').text(name).appendTo(row);
var val = $('<div>').addClass('row_val').appendTo(row);
$('<span>').text(num).appendTo(val);
if(name != 'gatherer') {
if(key != 'gatherer') {
$('<div>').addClass('upManyBtn').appendTo(val).click([10], Outside.increaseWorker);
$('<div>').addClass('upBtn').appendTo(val).click([1], Outside.increaseWorker);
$('<div>').addClass('dnBtn').appendTo(val).click([1], Outside.decreaseWorker);
@@ -318,10 +331,10 @@ var Outside = {
$('<div>').addClass('clear').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) {
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);
r.appendTo(tooltip);
}
@@ -330,7 +343,7 @@ var Outside = {
},
increaseWorker: function(btn) {
var worker = $(this).closest('.workerRow').children('.row_key').text();
var worker = $(this).closest('.workerRow').attr('key');
if(Outside.getNumGatherers() > 0) {
var increaseAmt = Math.min(Outside.getNumGatherers(), btn.data);
Engine.log('increasing ' + worker + ' by ' + increaseAmt);
@@ -339,7 +352,7 @@ var Outside = {
},
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) {
var decreaseAmt = Math.min($SM.get('game.workers["'+worker+'"]') || 0, btn.data);
Engine.log('decreasing ' + worker + ' by ' + decreaseAmt);
@@ -352,7 +365,7 @@ var Outside = {
var row = $('div#' + id, village);
if(row.length == 0 && num > 0) {
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('clear').appendTo(row);
var curPrev = null;
@@ -473,7 +486,7 @@ var Outside = {
stores[store] = income.stores[store] * num;
if(curIncome[store] != stores[store]) needsUpdate = true;
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);
row.appendTo(tooltip);
}
@@ -494,7 +507,7 @@ var Outside = {
if(btn.length == 0) {
new Button.Button({
id: 'trapsButton',
text: "check traps",
text: _("check traps"),
click: Outside.checkTraps,
cooldown: Outside._TRAPS_DELAY,
width: '80px'
@@ -513,17 +526,17 @@ var Outside = {
var numHuts = $SM.get('game.buildings["hut"]', true);
var title;
if(numHuts == 0) {
title = "A Silent Forest";
title = _("A Silent Forest");
} else if(numHuts == 1) {
title = "A Lonely Hut";
title = _("A Lonely Hut");
} else if(numHuts <= 4) {
title = "A Tiny Village";
title = _("A Tiny Village");
} else if(numHuts <= 8) {
title = "A Modest Village";
title = _("A Modest Village");
} else if(numHuts <= 14) {
title = "A Large Village";
title = _("A Large Village");
} else {
title = "A Raucous Village";
title = _("A Raucous Village");
}
if(Engine.activeModule == this) {
@@ -535,7 +548,7 @@ var Outside = {
onArrival: function(transition_diff) {
Outside.setTitle();
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);
}
Outside.updateTrapButton();
@@ -545,7 +558,7 @@ var Outside = {
},
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;
$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++) {
if(len > 1 && i > 0 && i < len - 1) {
s += ", ";
} else if(len > 1 && i == len - 1) {
s += " and ";
s += _(" and ");
}
s += msg[i];
}
+22 -21
View File
@@ -26,7 +26,7 @@ var Path = {
World.init();
// 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
this.panel = $('<div>').attr('id', "pathPanel")
@@ -40,7 +40,7 @@ var Path = {
// Add the embark button
new Button.Button({
id: 'embarkButton',
text: "embark",
text: _("embark"),
click: Path.embark,
width: '80px',
cooldown: World.DEATH_COOLDOWN
@@ -57,7 +57,7 @@ var Path = {
openPath: function() {
Path.init();
Engine.event('progress', 'path');
Notifications.notify(Room, 'the compass points ' + World.dir);
Notifications.notify(Room, _('the compass points ' + World.dir));
},
getWeight: function(thing) {
@@ -106,7 +106,7 @@ var Path = {
var r = $('#' + id);
if($SM.get('character.perks["'+k+'"]') && r.length == 0) {
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);
}
}
@@ -129,17 +129,17 @@ var Path = {
}
// Add the armour row
var armour = "none";
var armour = _("none");
if($SM.get('stores["s armour"]', true) > 0)
armour = "steel";
armour = _("steel");
else if($SM.get('stores["i armour"]', true) > 0)
armour = "iron";
armour = _("iron");
else if($SM.get('stores["l armour"]', true) > 0)
armour = "leather";
armour = _("leather");
var aRow = $('#armourRow');
if(aRow.length == 0) {
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('clear').appendTo(aRow);
} else {
@@ -150,7 +150,7 @@ var Path = {
var wRow = $('#waterRow');
if(wRow.length == 0) {
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('clear').appendTo(wRow);
} else {
@@ -183,7 +183,7 @@ var Path = {
if((store.type == 'tool' || store.type == 'weapon') && have > 0) {
total += num * Path.getWeight(k);
if(row.length == 0) {
row = Path.createOutfittingRow(k, num);
row = Path.createOutfittingRow(k, num, store.name);
var curPrev = null;
outfit.children().each(function(i) {
@@ -226,7 +226,7 @@ var Path = {
}
// 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) {
Button.setDisabled($('#embarkButton'), false);
@@ -235,8 +235,9 @@ var Path = {
}
},
createOutfittingRow: function(name, num) {
var row = $('<div>').attr('id', 'outfit_row_' + name.replace(' ', '-')).addClass('outfitRow');
createOutfittingRow: function(key, num, name) {
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);
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('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);
$('<div>').addClass('row_key').text('weight').appendTo(tt);
$('<div>').addClass('row_val').text(Path.getWeight(name)).appendTo(tt);
$('<div>').addClass('row_key').text('available').appendTo(tt);
$('<div>').addClass('row_key').text(_('weight')).appendTo(tt);
$('<div>').addClass('row_val').text(Path.getWeight(key)).appendTo(tt);
$('<div>').addClass('row_key').text(_('available')).appendTo(tt);
$('<div>').addClass('row_val').addClass('numAvailable').text(numAvailable).appendTo(tt);
return row;
},
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);
var cur = Path.outfit[supply];
cur = typeof cur == 'number' ? cur : 0;
@@ -272,7 +273,7 @@ var Path = {
},
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);
var cur = Path.outfit[supply];
cur = typeof cur == 'number' ? cur : 0;
@@ -291,7 +292,7 @@ var Path = {
},
setTitle: function() {
document.title = 'A Dusty Path';
document.title = _('A Dusty Path');
},
embark: function() {
+103 -79
View File
@@ -15,11 +15,12 @@ var Room = {
Craftables: {
'trap': {
name: _('trap'),
button: null,
maximum: 10,
availableMsg: 'builder says she can make traps to catch any creatures might still be alive out there',
buildMsg: 'more traps to catch more creatures',
maxMsg: "more traps won't help now",
availableMsg: _('builder says she can make traps to catch any creatures might still be alive out there'),
buildMsg: _('more traps to catch more creatures'),
maxMsg: _("more traps won't help now"),
type: 'building',
cost: function() {
var n = $SM.get('game.buildings["trap"]', true);
@@ -29,10 +30,11 @@ var Room = {
}
},
'cart': {
name: _('cart'),
button: null,
maximum: 1,
availableMsg: 'builder says she can make a cart for carrying wood',
buildMsg: 'the rickety cart will carry more wood from the forest',
availableMsg: _('builder says she can make a cart for carrying wood'),
buildMsg: _('the rickety cart will carry more wood from the forest'),
type: 'building',
cost: function() {
return {
@@ -41,11 +43,12 @@ var Room = {
}
},
'hut': {
name: _('hut'),
button: null,
maximum: 20,
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.',
maxMsg: 'no more room for huts.',
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.'),
maxMsg: _('no more room for huts.'),
type: 'building',
cost: function() {
var n = $SM.get('game.buildings["hut"]', true);
@@ -55,10 +58,11 @@ var Room = {
}
},
'lodge': {
name: _('lodge'),
button: null,
maximum: 1,
availableMsg: 'villagers could help hunt, given the means',
buildMsg: 'the hunting lodge stands in the forest, a ways out of town',
availableMsg: _('villagers could help hunt, given the means'),
buildMsg: _('the hunting lodge stands in the forest, a ways out of town'),
type: 'building',
cost: function() {
return {
@@ -69,10 +73,11 @@ var Room = {
}
},
'trading post': {
name: _('trading post'),
button: null,
maximum: 1,
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",
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"),
type: 'building',
cost: function() {
return {
@@ -82,10 +87,11 @@ var Room = {
}
},
'tannery': {
name: _('tannery'),
button: null,
maximum: 1,
availableMsg: "builder says leather could be useful. says the villagers could make it.",
buildMsg: 'tannery goes up quick, on the edge of the village',
availableMsg: _("builder says leather could be useful. says the villagers could make it."),
buildMsg: _('tannery goes up quick, on the edge of the village'),
type: 'building',
cost: function() {
return {
@@ -95,10 +101,11 @@ var Room = {
}
},
'smokehouse': {
name: _('smokehouse'),
button: null,
maximum: 1,
availableMsg: "should cure the meat, or it'll spoil. builder says she can fix something up.",
buildMsg: 'builder finishes the smokehouse. she looks hungry.',
availableMsg: _("should cure the meat, or it'll spoil. builder says she can fix something up."),
buildMsg: _('builder finishes the smokehouse. she looks hungry.'),
type: 'building',
cost: function() {
return {
@@ -108,10 +115,11 @@ var Room = {
}
},
'workshop': {
name: _('workshop'),
button: null,
maximum: 1,
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",
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"),
type: 'building',
cost: function() {
return {
@@ -122,10 +130,11 @@ var Room = {
}
},
'steelworks': {
name: _('steelworks'),
button: null,
maximum: 1,
availableMsg: "builder says the villagers could make steel, given the tools",
buildMsg: "a haze falls over the village as the steelworks fires up",
availableMsg: _("builder says the villagers could make steel, given the tools"),
buildMsg: _("a haze falls over the village as the steelworks fires up"),
type: 'building',
cost: function() {
return {
@@ -136,10 +145,11 @@ var Room = {
}
},
'armoury': {
name: _('armoury'),
button: null,
maximum: 1,
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.",
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."),
type: 'building',
cost: function() {
return {
@@ -150,9 +160,10 @@ var Room = {
}
},
'torch': {
name: _('torch'),
button: null,
type: 'tool',
buildMsg: 'a torch to keep the dark away',
buildMsg: _('a torch to keep the dark away'),
cost: function() {
return {
'wood': 1,
@@ -161,10 +172,11 @@ var Room = {
}
},
'waterskin': {
name: _('waterskin'),
button: null,
type: 'upgrade',
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() {
return {
'leather': 50
@@ -172,10 +184,11 @@ var Room = {
}
},
'cask': {
name: _('cask'),
button: null,
type: 'upgrade',
maximum: 1,
buildMsg: 'the cask holds enough water for longer expeditions',
buildMsg: _('the cask holds enough water for longer expeditions'),
cost: function() {
return {
'leather': 100,
@@ -184,10 +197,11 @@ var Room = {
}
},
'water tank': {
name: _('water tank'),
button: null,
type: 'upgrade',
maximum: 1,
buildMsg: 'never go thirsty again',
buildMsg: _('never go thirsty again'),
cost: function() {
return {
'iron': 100,
@@ -196,9 +210,10 @@ var Room = {
}
},
'bone spear': {
name: _('bone spear'),
button: null,
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() {
return {
'wood': 100,
@@ -207,10 +222,11 @@ var Room = {
}
},
'rucksack': {
name: _('rucksack'),
button: null,
type: 'upgrade',
maximum: 1,
buildMsg: 'carrying more means longer expeditions to the wilds',
buildMsg: _('carrying more means longer expeditions to the wilds'),
cost: function() {
return {
'leather': 200
@@ -218,10 +234,11 @@ var Room = {
}
},
'wagon': {
name: _('wagon'),
button: null,
type: 'upgrade',
maximum: 1,
buildMsg: 'the wagon can carry a lot of supplies',
buildMsg: _('the wagon can carry a lot of supplies'),
cost: function() {
return {
'wood': 500,
@@ -230,10 +247,11 @@ var Room = {
}
},
'convoy': {
name: _('convoy'),
button: null,
type: 'upgrade',
maximum: 1,
buildMsg: 'the convoy can haul mostly everything',
buildMsg: _('the convoy can haul mostly everything'),
cost: function() {
return {
'wood': 1000,
@@ -243,9 +261,10 @@ var Room = {
}
},
'l armour': {
name: _('l armour'),
type: 'upgrade',
maximum: 1,
buildMsg: "leather's not strong. better than rags, though.",
buildMsg: _("leather's not strong. better than rags, though."),
cost: function() {
return {
'leather': 200,
@@ -254,9 +273,10 @@ var Room = {
}
},
'i armour': {
name: _('i armour'),
type: 'upgrade',
maximum: 1,
buildMsg: "iron's stronger than leather",
buildMsg: _("iron's stronger than leather"),
cost: function() {
return {
'leather': 200,
@@ -265,9 +285,10 @@ var Room = {
}
},
's armour': {
name: _('s armour'),
type: 'upgrade',
maximum: 1,
buildMsg: "steel's stronger than iron",
buildMsg: _("steel's stronger than iron"),
cost: function() {
return {
'leather': 200,
@@ -276,9 +297,10 @@ var Room = {
}
},
'iron sword': {
name: _('iron sword'),
button: null,
type: 'weapon',
buildMsg: "sword is sharp. good protection out in the wilds.",
buildMsg: _("sword is sharp. good protection out in the wilds."),
cost: function() {
return {
'wood': 200,
@@ -288,9 +310,10 @@ var Room = {
}
},
'steel sword': {
name: _('steel sword'),
button: null,
type: 'weapon',
buildMsg: "the steel is strong, and the blade true.",
buildMsg: _("the steel is strong, and the blade true."),
cost: function() {
return {
'wood': 500,
@@ -300,8 +323,9 @@ var Room = {
}
},
'rifle': {
name: _('rifle'),
type: 'weapon',
buildMsg: "black powder and bullets, like the old days.",
buildMsg: _("black powder and bullets, like the old days."),
cost: function() {
return {
'wood': 200,
@@ -433,7 +457,7 @@ var Room = {
}
},
name: "Room",
name: _("Room"),
init: function(options) {
this.options = $.extend(
this.options,
@@ -457,7 +481,7 @@ var Room = {
// 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
this.panel = $('<div>')
@@ -470,7 +494,7 @@ var Room = {
// Create the light button
new Button.Button({
id: 'lightButton',
text: 'light fire',
text: _('light fire'),
click: Room.lightFire,
cooldown: Room._STOKE_COOLDOWN,
width: '80px',
@@ -480,7 +504,7 @@ var Room = {
// Create the stoke button
new Button.Button({
id: 'stokeButton',
text: "stoke fire",
text: _("stoke fire"),
click: Room.stokeFire,
cooldown: Room._STOKE_COOLDOWN,
width: '80px',
@@ -516,9 +540,9 @@ var Room = {
setTimeout(Room.unlockForest, Room._NEED_WOOD_DELAY);
}
setTimeout($SM.collectIncome, 1000);
Notifications.notify(Room, "the room is " + Room.temperature.text);
Notifications.notify(Room, "the fire is " + Room.fire.text);
Notifications.notify(Room, _("the room is {0}", Room.temperature.text));
Notifications.notify(Room, _("the fire is {0}", Room.fire.text));
},
options: {}, // Nothing for now
@@ -526,8 +550,8 @@ var Room = {
onArrival: function(transition_diff) {
Room.setTitle();
if(Room.changed) {
Notifications.notify(Room, "the fire is " + Room.fire.text);
Notifications.notify(Room, "the room is " + Room.temperature.text);
Notifications.notify(Room, _("the fire is {0}", Room.fire.text));
Notifications.notify(Room, _("the room is {0}", Room.temperature.text));
Room.changed = false;
}
if($SM.get('game.builder.level') == 3) {
@@ -537,7 +561,7 @@ var Room = {
stores: {'wood' : 2 }
});
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);
@@ -552,11 +576,11 @@ var Room = {
}
return null;
},
Freezing: { value: 0, text: 'freezing' },
Cold: { value: 1, text: 'cold' },
Mild: { value: 2, text: 'mild' },
Warm: { value: 3, text: 'warm' },
Hot: { value: 4, text: 'hot' }
Freezing: { value: 0, text: _('freezing') },
Cold: { value: 1, text: _('cold') },
Mild: { value: 2, text: _('mild') },
Warm: { value: 3, text: _('warm') },
Hot: { value: 4, text: _('hot') }
},
FireEnum: {
@@ -568,15 +592,15 @@ var Room = {
}
return null;
},
Dead: { value: 0, text: 'dead' },
Smoldering: { value: 1, text: 'smoldering' },
Flickering: { value: 2, text: 'flickering' },
Burning: { value: 3, text: 'burning' },
Roaring: { value: 4, text: 'roaring' }
Dead: { value: 0, text: _('dead') },
Smoldering: { value: 1, text: _('smoldering') },
Flickering: { value: 2, text: _('flickering') },
Burning: { value: 3, text: _('burning') },
Roaring: { value: 4, text: _('roaring') }
},
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) {
document.title = title;
}
@@ -614,7 +638,7 @@ var Room = {
lightFire: function() {
var wood = $SM.get('stores.wood');
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'));
return;
} else if(wood > 4) {
@@ -627,7 +651,7 @@ var Room = {
stokeFire: function() {
var wood = $SM.get('stores.wood');
if(wood === 0) {
Notifications.notify(Room, "the wood has run out");
Notifications.notify(Room, _("the wood has run out"));
Button.clearCooldown($('#stokeButton.button'));
return;
}
@@ -644,10 +668,10 @@ var Room = {
if(Engine.activeModule != Room) {
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) {
$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);
}
window.clearTimeout(Room._fireTimer);
@@ -660,7 +684,7 @@ var Room = {
var wood = $SM.get('stores.wood');
if(Room.fire.value <= Room.FireEnum.Flickering.value &&
$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);
Room.fire = Room.FireEnum.fromInt(Room.fire.value + 1);
}
@@ -675,11 +699,11 @@ var Room = {
var old = Room.temperature.value;
if(Room.temperature.value > 0 && Room.temperature.value > Room.fire.value) {
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) {
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) {
Room.changed = true;
@@ -690,15 +714,15 @@ var Room = {
unlockForest: function() {
$SM.set('stores.wood', 4);
Outside.init();
Notifications.notify(Room, "the wind howls outside");
Notifications.notify(Room, "the wood is running out");
Notifications.notify(Room, _("the wind howls outside"));
Notifications.notify(Room, _("the wood is running out"));
Engine.event('progress', 'outside');
},
updateBuilderState: function() {
var lBuilder = $SM.get('game.builder.level');
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);
setTimeout(Room.unlockForest, Room._NEED_WOOD_DELAY);
}
@@ -706,10 +730,10 @@ var Room = {
var msg = "";
switch(lBuilder) {
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;
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;
}
Notifications.notify(Room, msg);
@@ -782,7 +806,7 @@ var Room = {
if(row.length == 0 && num > 0) {
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('clear').appendTo(row);
var curPrev = null;
@@ -835,7 +859,7 @@ var Room = {
var income = $SM.get('income["'+incomeSource+'"]');
for(var store in income.stores) {
if(store == storeName && income.stores[store] != 0) {
$('<div>').addClass('row_key').text(incomeSource).appendTo(tt);
$('<div>').addClass('row_key').text(_(incomeSource)).appendTo(tt);
$('<div>')
.addClass('row_val')
.text(Engine.getIncomeMsg(income.stores[store], income.delay))
@@ -863,7 +887,7 @@ var Room = {
for(var k in cost) {
var have = $SM.get('stores["'+k+'"]', true);
if(have < cost[k]) {
Notifications.notify(Room, "not enough " + k);
Notifications.notify(Room, _("not enough " + k));
return false;
} else {
storeMod[k] = have - cost[k];
@@ -883,7 +907,7 @@ var Room = {
build: function(buildBtn) {
var thing = $(buildBtn).attr('buildThing');
if(Room.temperature.value <= Room.TempEnum.Cold.value) {
Notifications.notify(Room, "builder just shivers");
Notifications.notify(Room, _("builder just shivers"));
return false;
}
var craftable = Room.Craftables[thing];
@@ -911,7 +935,7 @@ var Room = {
for(var k in cost) {
var have = $SM.get('stores["'+k+'"]', true);
if(have < cost[k]) {
Notifications.notify(Room, "not enough " + k);
Notifications.notify(Room, _("not enough "+k));
return false;
} else {
storeMod[k] = have - cost[k];
@@ -944,7 +968,7 @@ var Room = {
}
if($SM.get('game.builder.level') < 4) return false;
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();
//show button if one has already been built
@@ -1013,7 +1037,7 @@ var Room = {
craftable.button = new Button.Button({
id: 'build_' + k,
cost: craftable.cost(),
text: k,
text: _(k),
click: Room.build,
width: '80px',
ttPos: loc.children().length > 10 ? 'top right' : 'bottom right'
@@ -1025,7 +1049,7 @@ var Room = {
costTooltip.empty();
var cost = craftable.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);
}
if(max && !craftable.button.hasClass('disabled')) {
@@ -1047,7 +1071,7 @@ var Room = {
good.button = new Button.Button({
id: 'build_' + k,
cost: good.cost(),
text: k,
text: _(k),
click: Room.buy,
width: '80px'
}).css('opacity', 0).attr('buildThing', k).appendTo(buySection).animate({opacity:1}, 300, 'linear');
@@ -1058,7 +1082,7 @@ var Room = {
costTooltip.empty();
var cost = good.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);
}
if(max && !good.button.hasClass('disabled')) {
+14 -14
View File
@@ -8,7 +8,7 @@ var Ship = {
BASE_HULL: 0,
BASE_THRUSTERS: 1,
name: "Ship",
name: _("Ship"),
init: function(options) {
this.options = $.extend(
this.options,
@@ -24,7 +24,7 @@ var Ship = {
}
// 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
this.panel = $('<div>').attr('id', "shipPanel")
@@ -35,20 +35,20 @@ var Ship = {
// Draw the hull label
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('clear').appendTo(hullRow);
// Draw the thrusters label
var engineRow = $('<div>').attr('id', 'engineRow').appendTo('div#shipPanel');
$('<div>').addClass('row_key').text('engine:').appendTo(engineRow);
$('<div>').addClass('row_key').text(_('engine:')).appendTo(engineRow);
$('<div>').addClass('row_val').text($SM.get('game.spaceShip.thrusters')).appendTo(engineRow);
$('<div>').addClass('clear').appendTo(engineRow);
// Draw the reinforce button
new Button.Button({
id: 'reinforceButton',
text: 'reinforce hull',
text: _('reinforce hull'),
click: Ship.reinforceHull,
width: '100px',
cost: {'alien alloy': Ship.ALLOY_PER_HULL}
@@ -57,7 +57,7 @@ var Ship = {
// Draw the engine button
new Button.Button({
id: 'engineButton',
text: 'upgrade engine',
text: _('upgrade engine'),
click: Ship.upgradeEngine,
width: '100px',
cost: {'alien alloy': Ship.ALLOY_PER_THRUSTER}
@@ -66,7 +66,7 @@ var Ship = {
// Draw the lift off button
var b = new Button.Button({
id: 'liftoffButton',
text: 'lift off',
text: _('lift off'),
click: Ship.checkLiftOff,
width: '100px',
cooldown: Ship.LIFTOFF_COOLDOWN
@@ -88,7 +88,7 @@ var Ship = {
onArrival: function(transition_diff) {
Ship.setTitle();
if(!$SM.get('game.spaceShip.seenShip')) {
Notifications.notify(Ship, 'somewhere above the debris cloud, the wanderer fleet hovers. been on this rock too long.');
Notifications.notify(Ship, _('somewhere above the debris cloud, the wanderer fleet hovers. been on this rock too long.'));
$SM.set('game.spaceShip.seenShip', true);
}
@@ -103,7 +103,7 @@ var Ship = {
reinforceHull: function() {
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;
}
$SM.add('stores["alien alloy"]', -Ship.ALLOY_PER_HULL);
@@ -116,7 +116,7 @@ var Ship = {
upgradeEngine: function() {
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;
}
$SM.add('stores["alien alloy"]', -Ship.ALLOY_PER_THRUSTER);
@@ -131,15 +131,15 @@ var Ship = {
checkLiftOff: function() {
if(!$SM.get('game.spaceShip.seenWarning')) {
Events.startEvent({
title: 'Ready to Leave?',
title: _('Ready to Leave?'),
scenes: {
'start': {
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: {
'fly': {
text: 'lift off',
text: _('lift off'),
onChoose: function() {
$SM.set('game.spaceShip.seenWarning', true);
Ship.liftOff();
@@ -147,7 +147,7 @@ var Ship = {
nextScene: 'end'
},
'wait': {
text: 'linger',
text: _('linger'),
onChoose: function() {
Button.clearCooldown($('#liftoffButton'));
},
+10 -10
View File
@@ -39,7 +39,7 @@ var Space = {
// Create the hull display
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);
//subscribe to stateUpdates
@@ -73,17 +73,17 @@ var Space = {
if(Engine.activeModule == this) {
var t;
if(Space.altitude < 10) {
t = "Troposphere";
t = _("Troposphere");
} else if(Space.altitude < 20) {
t = "Stratosphere";
t = _("Stratosphere");
} else if(Space.altitude < 30) {
t = "Mesosphere";
t = _("Mesosphere");
} else if(Space.altitude < 45) {
t = "Thermosphere";
t = _("Thermosphere");
} else if(Space.altitude < 60){
t = "Exosphere";
t = _("Exosphere");
} else {
t = "Space";
t = _("Space");
}
document.title = t;
}
@@ -418,14 +418,14 @@ var Space = {
.appendTo('body');
$('<span>')
.addClass('endGame')
.text('score for this game: ' + Score.calculateScore())
.text(_('score for this game: {0}', Score.calculateScore()))
.appendTo('.centerCont')
.animate({opacity:1},1500);
$('<br />')
.appendTo('.centerCont');
$('<span>')
.addClass('endGame')
.text('total score: ' + Prestige.get().score)
.text(_('total score: {0}', Prestige.get().score))
.appendTo('.centerCont')
.animate({opacity:1},1500);
$('<br />')
@@ -436,7 +436,7 @@ var Space = {
$('#content, #notifications').remove();
$('<span>')
.addClass('endGame endGameRestart')
.text('restart.')
.text(_('restart.'))
.click(Engine.confirmDelete)
.appendTo('.centerCont')
.animate({opacity:1},1500);
+46 -46
View File
@@ -43,58 +43,58 @@ var World = {
Weapons: {
'fists': {
verb: 'punch',
verb: _('punch'),
type: 'unarmed',
damage: 1,
cooldown: 2
},
'bone spear': {
verb: 'stab',
verb: _('stab'),
type: 'melee',
damage: 2,
cooldown: 2
},
'iron sword': {
verb: 'swing',
verb: _('swing'),
type: 'melee',
damage: 4,
cooldown: 2
},
'steel sword': {
verb: 'slash',
verb: _('slash'),
type: 'melee',
damage: 6,
cooldown: 2
},
'bayonet': {
verb: 'thrust',
verb: _('thrust'),
type: 'melee',
damage: 8,
cooldown: 2
},
'rifle': {
verb: 'shoot',
verb: _('shoot'),
type: 'ranged',
damage: 5,
cooldown: 1,
cost: { 'bullets': 1 }
},
'laser rifle': {
verb: 'blast',
verb: _('blast'),
type: 'ranged',
damage: 8,
cooldown: 1,
cost: { 'energy cell': 1 }
},
'grenade': {
verb: 'lob',
verb: _('lob'),
type: 'ranged',
damage: 15,
cooldown: 5,
cost: { 'grenade': 1 }
},
'bolas': {
verb: 'tangle',
verb: _('tangle'),
type: 'ranged',
damage: 'stun',
cooldown: 15,
@@ -116,22 +116,22 @@ var World = {
World.TILE_PROBS[World.TILE.BARRENS] = 0.5;
// Setpiece definitions
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.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.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.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.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.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.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.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.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.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.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.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')};
// Only add the cache if there is prestige data
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') {
@@ -247,7 +247,7 @@ var World = {
water = World.createItemDiv('water', World.water);
water.prependTo(supplies);
} else if(World.water > 0) {
$('div#supply_water', supplies).text('water:' + World.water);
$('div#supply_water', supplies).text(_('water:{0}' , World.water));
} else {
water.remove();
}
@@ -267,21 +267,21 @@ var World = {
item.appendTo(supplies);
}
} else if(num > 0) {
$('div#' + item.attr('id'), supplies).text(k + ':' + num);
$('div#' + item.attr('id'), supplies).text(_(k) + ':' + num);
} else {
item.remove();
}
}
// Update label
var t = 'pockets';
var t = _('pockets');
if($SM.get('stores.rucksack', true) > 0) {
t = 'rucksack';
t = _('rucksack');
}
$('#backpackTitle').text(t);
// 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) {
@@ -298,14 +298,14 @@ var World = {
if(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) {
var div = $('<div>').attr('id', 'supply_' + name.replace(' ', '-'))
.addClass('supplyItem')
.text(name + ':' + num);
.text(_('{0}:{1}',_(name), num));
return div;
},
@@ -340,9 +340,9 @@ var World = {
World.doSpace();
if(World.checkDanger()) {
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 {
Notifications.notify(World, 'safer here');
Notifications.notify(World, _('safer here'));
}
}
},
@@ -442,12 +442,12 @@ var World = {
var num = Path.outfit['cured meat'];
num--;
if(num == 0) {
Notifications.notify(World, 'the meat has run out');
Notifications.notify(World, _('the meat has run out'));
} else if(num < 0) {
// Starvation! Hooray!
num = 0;
if(!World.starvation) {
Notifications.notify(World, 'starvation sets in');
Notifications.notify(World, _('starvation sets in'));
World.starvation = true;
} else {
$SM.set('character.starved', $SM.get('character.starved', true));
@@ -472,11 +472,11 @@ var World = {
var water = World.water;
water--;
if(water == 0) {
Notifications.notify(World, 'there is no more water');
Notifications.notify(World, _('there is no more water'));
} else if(water < 0) {
water = 0;
if(!World.thirst) {
Notifications.notify(World, 'the thirst becomes unbearable');
Notifications.notify(World, _('the thirst becomes unbearable'));
World.thirst = true;
} else {
$SM.set('character.dehydrated', $SM.get('character.dehydrated', true));
@@ -549,30 +549,30 @@ var World = {
case World.TILE.FOREST:
switch(newTile) {
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;
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;
case World.TILE.FIELD:
switch(newTile) {
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;
case World.TILE.BARRENS:
msg = "the grasses thin. soon, only dust remains.";
msg = _("the grasses thin. soon, only dust remains.");
break;
}
break;
case World.TILE.BARRENS:
switch(newTile) {
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;
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;
@@ -774,12 +774,12 @@ var World = {
ttClass += " bottom";
}
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]) {
var c = World.state.map[i][j];
switch(c) {
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;
default:
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.keyLock = true;
// Dead! Discard any world changes and go home
Notifications.notify(World, 'the world fades');
Notifications.notify(World, _('the world fades'));
World.state = null;
Path.outfit = {};
$('#outerSlider').animate({opacity: '0'}, 600, 'linear', function() {
@@ -909,7 +909,7 @@ var World = {
},
useOutpost: function() {
Notifications.notify(null, 'water replenished');
Notifications.notify(null, _('water replenished'));
World.setWater(World.getMaxWater());
// Mark this outpost as used
World.usedOutposts[World.curPos[0] + ',' + World.curPos[1]] = true;
@@ -936,7 +936,7 @@ var World = {
},
setTitle: function() {
document.title = 'A Barren World';
document.title = _('A Barren World');
},
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()