Server side simulator using v8 (loads *.js so far)

This commit is contained in:
Eric Fredricksen
2010-07-14 16:48:17 -07:00
parent b8007c8273
commit 3bd9e90edc
3 changed files with 96 additions and 6 deletions
+1 -2
View File
@@ -1083,7 +1083,7 @@ function LoadGame(sheet) {
$.each([Plots,Quests], function () {
this.rows().find("input:checkbox").not(':last').attr("checked", "true");
});
Log('Loaded game: ' + name);
Log('Loaded game: ' + game.Traits.Name);
if (!game.elapsed)
Brag('start');
StartTimer();
@@ -1099,7 +1099,6 @@ $(window).unload(function (event) {
SaveGame();
});
function GameSaveName() {
if (!game.saveName) {
game.saveName = Get(Traits, 'Name');
+5 -4
View File
@@ -67,7 +67,7 @@ function fill(e, a, n) {
}
}
$(document).ready(function () {
function NewGuyFormLoad() {
fill("#races", K.Races, "Race");
fill("#classes", K.Klasses, "Class");
@@ -83,8 +83,8 @@ $(document).ready(function () {
if (!$("#Name").text()) {
GenClick();
$("#Name")[0].focus();
$("#Name")[0].select();
$("#Name").focus();
$("#Name").select();
}
seed = new Alea();
@@ -92,9 +92,10 @@ $(document).ready(function () {
if (window.location.href.indexOf("?sold") > 0)
sold(); // TODO: cheesy
});
}
$(document).ready(NewGuyFormLoad);
/* Multiplayer:
function TNewGuyForm_ParseSoldResponse(body) {
+90
View File
@@ -0,0 +1,90 @@
//!/usr/bin/env v8
function noop() {}
function nada() { return {}; }
var document = {
addEventListener: noop,
createElement: function () {
return {
style: {},
getElementsByTagName: nada,
appendChild: noop,
};
},
documentElement: {
insertBefore: noop,
removeChild: noop,
},
getElementById: nada,
createComment: noop,
createDocumentFragment: nada,
};
var window = {
location: {href: "#Woogle"},
localStorage: {
getItem: function(key) {
return JSON.stringify({Woogle: {
Traits: {
Name: "Woogle"
}
}});
},
setItem: function (key, value) {
},
removeItem: function (key) {
}
},
document: document,
addEventListener: noop,
};
var location = window.location;
/*
var $ = function () {
return {
click: noop,
keypress: noop,
ready: noop,
unload: noop,
bind: noop,
text: noop,
appendTo: noop,
attr: noop,
focus: noop,
select: noop,
};
};
$.each = function (collection, callback) {
isArray: function( obj ) {
return toString.call(obj) === "[object Array]";
},
};
*/
var navigator = { userAgent: "V8 Shell" };
var alert = function (m) { print("ALERT: " + m); };
function loadSheet(name) {
return { name: "bob" };
}
var storage = {
removeItem: function () {}
};
var randseed = function () {};
load("jquery.js");
var $ = window.$;
load("config.js");
load("newguy.js");
//NewGuyFormLoad();
load("main.js");
//FormCreate();