Skip to content

Instantly share code, notes, and snippets.

@romualdr
Last active November 12, 2019 01:22
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save romualdr/92f78c79bfa0d3c2f537953f3e7ded4b to your computer and use it in GitHub Desktop.
Save romualdr/92f78c79bfa0d3c2f537953f3e7ded4b to your computer and use it in GitHub Desktop.
DevShop trainer - apply before clicking on "start"
clearInterval(window.cheatInterval)
window._getNewPerson = getNewPerson
window._go = go
window._applyItem = applyItem
;(function () {
function everyOneIsAwesome() {
Object.values(game.People).forEach((person) => {
person.keyboardLevel = 100
person.seatLevel = 100
person.selfStarterLevel = 9
person.observantLevel = 9
person.selfStartNow = 9
person.observantNow = 9
person.skills = {
ba: { level: 20 },
dev: { level: 20 },
test: { level: 20 },
}
if (!person.busy)
personFree(person)
})
}
function stoleItem(itemCode, disableDuration) {
let item = Object.values(game.StoreItems).find((item) => item.code === itemCode)
if (!item) {
drawMessage(`[Cheat] Unable to find ${itemCode}`)
return null
}
// Add a shallow clone of the item (not the item itself)
let clone = Object.assign({}, item)
if (disableDuration) {
clone.code = ItemCode.statue2
clone.activeDuration = 0
clone._removeCheat = () => {
clone.code = itemCode
}
}
clone.id = nextId()
game.Items["i" + clone.id] = clone;
drawMessage(`[Cheat] You stole ${clone.name} ${clone.icon}. Nice!`);
drawInboxItem("i" + clone.id, clone);
return clone
}
function buyNewProjects() {
if (window._disabledCheatAutoProject)
return
const untookProjects = Object.values(game.Stories).filter((story) => story.status === "lead" && !story.busy)
const free = Object.values(game.People).filter((people) => !people.busy)
if (untookProjects.length > free.length)
return
const missing = free.length - untookProjects.length
console.log(`Creating ${missing} projects ...`);
[...Array(missing).keys()].forEach(() => getNewLead())
}
function cheatLoop() {
if (!game || window._disabledCheat) return
buyNewProjects()
everyOneIsAwesome()
}
function give(person, itemCode, disableDuration) {
const item = stoleItem(itemCode, disableDuration)
if (item)
doIt(`p${person.id}`, `i${item.id}`)
}
function defaultObjects(person) {
give(person, ItemCode.coffeemachine, true)
give(person, ItemCode.dog, true)
give(person, ItemCode.poster, true)
give(person, ItemCode.statue2, true)
give(person, ItemCode.statue, true)
give(person, ItemCode.crystalball, true)
}
//
// Cheat API
//
window.disableCheat = function () {
window._disabledCheat = !window._disabledCheat
}
window.disableAutoProject = function () {
window._disabledCheatAutoProject = !window._disabledCheatAutoProject
}
window.cheats = {}
window.cheats.give = give
window.cheats.giveAll = function (itemCode, disableDuration) {
Object.values(game.People).forEach((person) => {
const busy = person.busy
person.busy = false
window.cheats.give(person, itemCode, disableDuration)
person.body = busy
})
}
window.cheats.stole = function (itemCode, disableDuration) {
stoleItem(itemCode, disableDuration)
}
//
// Override default functions
//
window.getNewPerson = function (type) {
const bak = Object.values(game.People)
window._getNewPerson(type)
if (!window._disabledCheat) {
const people = Object.values(game.People)
// No one was created
if (bak.length === people.length)
return
const person = people[people.length - 1]
// Stole a dog
defaultObjects(person)
everyOneIsAwesome()
personFree(person)
if (window._disabledCheatAutoProject)
window.disableAutoProject()
}
}
window.go = function () {
console.log('Cheat activated')
window.disableAutoProject()
// Remove this line or disable cheat (window.cheats.disableCheat()) to avoid extra fast running
testMode = !window._disabledCheat
window._go()
game.PointPrice = !window._disabledCheat ? 1000 : game.PointPrice
testMode = 0
defaultObjects(Object.values(game.People)[0])
}
window.applyItem = function (person, item) {
window._applyItem(person, item)
if (item._removeCheat) {
item._removeCheat()
}
}
// Start the cheat loop
window.cheatInterval = setInterval(() => requestAnimationFrame(cheatLoop), 1000)
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment