mirror of
https://github.com/doublespeakgames/adarkroom.git
synced 2026-06-23 21:02:31 +08:00
add enable god mode function
This commit is contained in:
@@ -823,6 +823,117 @@
|
|||||||
|
|
||||||
return setTimeout(callback, timeout);
|
return setTimeout(callback, timeout);
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
enableGodMode: function() {
|
||||||
|
// open up all section
|
||||||
|
if(!Outside.tab) {
|
||||||
|
Outside.init();
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!Path.tab) {
|
||||||
|
Path.init();
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!Ship.tab) {
|
||||||
|
Ship.init();
|
||||||
|
}
|
||||||
|
|
||||||
|
// add all remaining craftables and goods
|
||||||
|
var buildSection = $('#buildBtns');
|
||||||
|
if (buildSection.length === 0) {
|
||||||
|
buildSection = $('<div>').attr({ 'id': 'buildBtns', 'data-legend': _('build:') }).css('opacity', 0);
|
||||||
|
buildSection.appendTo('div#roomPanel').animate({ opacity: 1 }, 300, 'linear');
|
||||||
|
}
|
||||||
|
var craftSection = $('#craftBtns');
|
||||||
|
if (craftSection.length === 0) {
|
||||||
|
craftSection = $('<div>').attr({ 'id': 'craftBtns', 'data-legend': _('craft:') }).css('opacity', 0);
|
||||||
|
craftSection.appendTo('div#roomPanel').animate({ opacity: 1 }, 300, 'linear');
|
||||||
|
}
|
||||||
|
|
||||||
|
var buySection = $('#buyBtns');
|
||||||
|
if (buySection.length === 0) {
|
||||||
|
buySection = $('<div>').attr({ 'id': 'buyBtns', 'data-legend': _('buy:') }).css('opacity', 0);
|
||||||
|
buySection.appendTo('div#roomPanel').animate({ opacity: 1 }, 300, 'linear');
|
||||||
|
}
|
||||||
|
|
||||||
|
for (var k in Room.Craftables) {
|
||||||
|
craftable = Room.Craftables[k];
|
||||||
|
if (craftable.button == null) {
|
||||||
|
var loc = Room.needsWorkshop(craftable.type) ? craftSection : buildSection;
|
||||||
|
craftable.button = new Button.Button({
|
||||||
|
id: 'build_' + k,
|
||||||
|
cost: craftable.cost(),
|
||||||
|
text: _(k),
|
||||||
|
click: Room.build,
|
||||||
|
width: '80px',
|
||||||
|
ttPos: loc.children().length > 10 ? 'top right' : 'bottom right'
|
||||||
|
}).css('opacity', 0).attr('buildThing', k).appendTo(loc).animate({ opacity: 1 }, 300, 'linear');
|
||||||
|
}
|
||||||
|
|
||||||
|
var max = $SM.num(k, craftable) + 1 > craftable.maximum;
|
||||||
|
if (max) {
|
||||||
|
Button.setDisabled(craftable.button, true);
|
||||||
|
} else {
|
||||||
|
Button.setDisabled(craftable.button, false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (var g in Room.TradeGoods) {
|
||||||
|
good = Room.TradeGoods[g];
|
||||||
|
if (good.button == null) {
|
||||||
|
good.button = new Button.Button({
|
||||||
|
id: 'build_' + g,
|
||||||
|
cost: good.cost(),
|
||||||
|
text: _(g),
|
||||||
|
click: Room.buy,
|
||||||
|
width: '80px',
|
||||||
|
ttPos: buySection.children().length > 10 ? 'top right' : 'bottom right'
|
||||||
|
}).css('opacity', 0).attr('buildThing', g).appendTo(buySection).animate({ opacity: 1 }, 300, 'linear');
|
||||||
|
}
|
||||||
|
|
||||||
|
var goodsMax = $SM.num(g, good) + 1 > good.maximum;
|
||||||
|
if (goodsMax) {
|
||||||
|
Button.setDisabled(good.button, true);
|
||||||
|
} else {
|
||||||
|
Button.setDisabled(good.button, false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// remove all cooldowns
|
||||||
|
$('.button').each(function (i, el) {
|
||||||
|
$(el).off('click');
|
||||||
|
$(el).click(function() {
|
||||||
|
$(this).data("handler")($(this));
|
||||||
|
})
|
||||||
|
});
|
||||||
|
|
||||||
|
// set water/health
|
||||||
|
Path.DEFAULT_BAG_SPACE = 1000;
|
||||||
|
World.BASE_WATER = 1000;
|
||||||
|
World.BASE_HEALTH = 1000;
|
||||||
|
World.setHp(1000);
|
||||||
|
|
||||||
|
// add all perks
|
||||||
|
for (var key in Engine.Perks) {
|
||||||
|
$SM.addPerk(key);
|
||||||
|
}
|
||||||
|
|
||||||
|
// give 100000 of all stores
|
||||||
|
Prestige.storesMap.forEach(function (e) {
|
||||||
|
State.stores[e.store] = 100000;
|
||||||
|
});
|
||||||
|
for (var key in Room.TradeGoods) {
|
||||||
|
State.stores[key] = 100000;
|
||||||
|
}
|
||||||
|
|
||||||
|
// set world map mask to reveal entire map
|
||||||
|
for(var j = 0; j <= World.RADIUS * 2; j++) {
|
||||||
|
for(var i = 0; i <= World.RADIUS * 2; i++) {
|
||||||
|
State.game.world.mask[i][j] = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user