done i guess
This commit is contained in:
34
.gitea/workflows/deploy.yaml
Normal file
34
.gitea/workflows/deploy.yaml
Normal file
@@ -0,0 +1,34 @@
|
||||
name: Upload to PageUp (NoName Pages)
|
||||
|
||||
on: workflow_dispatch
|
||||
|
||||
# This is an edid of what tags wrote for wcv3 with parts of nonamesoftlander by me
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
name: Checkout code
|
||||
|
||||
- name: Setup Node.JS
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: 22
|
||||
|
||||
- name: Install Dependencies
|
||||
run: npm ci
|
||||
|
||||
- name: Build site
|
||||
run: npm run build
|
||||
|
||||
# Now the fun part.. uploading it to pageup
|
||||
- run: cd dist && tar -czf archive.tar.gz -C . . || true
|
||||
- name: Upload to PageUp
|
||||
run: |
|
||||
echo "Uploading..."
|
||||
curl -v -F "file=@dist/archive.tar.gz" -F "name=youcorp-sim" https://pages.nnsoft.xyz/upload | tee response.html
|
||||
echo ""
|
||||
echo "Server responded with:"
|
||||
cat response.html
|
||||
- run: echo "I am done with this"
|
||||
24
.gitignore
vendored
Normal file
24
.gitignore
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
# Logs
|
||||
logs
|
||||
*.log
|
||||
npm-debug.log*
|
||||
yarn-debug.log*
|
||||
yarn-error.log*
|
||||
pnpm-debug.log*
|
||||
lerna-debug.log*
|
||||
|
||||
node_modules
|
||||
dist
|
||||
dist-ssr
|
||||
*.local
|
||||
|
||||
# Editor directories and files
|
||||
.vscode/*
|
||||
!.vscode/extensions.json
|
||||
.idea
|
||||
.DS_Store
|
||||
*.suo
|
||||
*.ntvs*
|
||||
*.njsproj
|
||||
*.sln
|
||||
*.sw?
|
||||
3
.vscode/extensions.json
vendored
Normal file
3
.vscode/extensions.json
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"recommendations": ["svelte.svelte-vscode"]
|
||||
}
|
||||
13
index.html
Normal file
13
index.html
Normal file
@@ -0,0 +1,13 @@
|
||||
<!doctype html>
|
||||
<html lang="en" class="text-gray-100 bg-gray-900 font-display transition-all">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>YouCompany Simulator</title>
|
||||
</head>
|
||||
<body>
|
||||
<div id="app"></div>
|
||||
<script type="module" src="/src/main.ts"></script>
|
||||
</body>
|
||||
</html>
|
||||
1513
package-lock.json
generated
Normal file
1513
package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
28
package.json
Normal file
28
package.json
Normal file
@@ -0,0 +1,28 @@
|
||||
{
|
||||
"name": "youcorp-sim",
|
||||
"private": true,
|
||||
"version": "0.0.0",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"dev": "vite",
|
||||
"build": "vite build",
|
||||
"preview": "vite preview",
|
||||
"check": "svelte-check --tsconfig ./tsconfig.app.json && tsc -p tsconfig.node.json"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@sveltejs/vite-plugin-svelte": "^6.2.1",
|
||||
"@tsconfig/svelte": "^5.0.6",
|
||||
"@types/node": "^24.10.1",
|
||||
"svelte": "^5.43.8",
|
||||
"svelte-check": "^4.3.4",
|
||||
"typescript": "~5.9.3",
|
||||
"vite": "npm:rolldown-vite@7.2.5"
|
||||
},
|
||||
"overrides": {
|
||||
"vite": "npm:rolldown-vite@7.2.5"
|
||||
},
|
||||
"dependencies": {
|
||||
"@tailwindcss/vite": "^4.1.17",
|
||||
"tailwindcss": "^4.1.17"
|
||||
}
|
||||
}
|
||||
1
public/vite.svg
Normal file
1
public/vite.svg
Normal file
@@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="iconify iconify--logos" width="31.88" height="32" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 257"><defs><linearGradient id="IconifyId1813088fe1fbc01fb466" x1="-.828%" x2="57.636%" y1="7.652%" y2="78.411%"><stop offset="0%" stop-color="#41D1FF"></stop><stop offset="100%" stop-color="#BD34FE"></stop></linearGradient><linearGradient id="IconifyId1813088fe1fbc01fb467" x1="43.376%" x2="50.316%" y1="2.242%" y2="89.03%"><stop offset="0%" stop-color="#FFEA83"></stop><stop offset="8.333%" stop-color="#FFDD35"></stop><stop offset="100%" stop-color="#FFA800"></stop></linearGradient></defs><path fill="url(#IconifyId1813088fe1fbc01fb466)" d="M255.153 37.938L134.897 252.976c-2.483 4.44-8.862 4.466-11.382.048L.875 37.958c-2.746-4.814 1.371-10.646 6.827-9.67l120.385 21.517a6.537 6.537 0 0 0 2.322-.004l117.867-21.483c5.438-.991 9.574 4.796 6.877 9.62Z"></path><path fill="url(#IconifyId1813088fe1fbc01fb467)" d="M185.432.063L96.44 17.501a3.268 3.268 0 0 0-2.634 3.014l-5.474 92.456a3.268 3.268 0 0 0 3.997 3.378l24.777-5.718c2.318-.535 4.413 1.507 3.936 3.838l-7.361 36.047c-.495 2.426 1.782 4.5 4.151 3.78l15.304-4.649c2.372-.72 4.652 1.36 4.15 3.788l-11.698 56.621c-.732 3.542 3.979 5.473 5.943 2.437l1.313-2.028l72.516-144.72c1.215-2.423-.88-5.186-3.54-4.672l-25.505 4.922c-2.396.462-4.435-1.77-3.759-4.114l16.646-57.705c.677-2.35-1.37-4.583-3.769-4.113Z"></path></svg>
|
||||
|
After Width: | Height: | Size: 1.5 KiB |
12
src/App.svelte
Normal file
12
src/App.svelte
Normal file
@@ -0,0 +1,12 @@
|
||||
<script lang="ts">
|
||||
import "./app.css";
|
||||
import data from "./lib/data.svelte";
|
||||
import Game from "./pages/Game.svelte";
|
||||
import Title from "./pages/Title.svelte";
|
||||
</script>
|
||||
|
||||
{#if data.savedata.stage > 0}
|
||||
<Title />
|
||||
{:else}
|
||||
<Game />
|
||||
{/if}
|
||||
7
src/app.css
Normal file
7
src/app.css
Normal file
@@ -0,0 +1,7 @@
|
||||
@import url('https://fonts.googleapis.com/css2?family=Montserrat:ital,wght@0,100..900;1,100..900&display=swap');
|
||||
@import "tailwindcss";
|
||||
|
||||
@theme {
|
||||
--font-display: "Montserrat", sans-serif;
|
||||
/* --font-bold: "Montserrat Bold", sans-serif; */
|
||||
}
|
||||
41
src/components/Button.svelte
Normal file
41
src/components/Button.svelte
Normal file
@@ -0,0 +1,41 @@
|
||||
<script lang="ts">
|
||||
import data from "../lib/data.svelte";
|
||||
|
||||
let { text, money = 0, subtitle, goal = false, onclicked }: {
|
||||
text: string
|
||||
money: number,
|
||||
subtitle?: string,
|
||||
goal?: boolean,
|
||||
onclicked?: () => void
|
||||
} = $props();
|
||||
</script>
|
||||
|
||||
<button
|
||||
disabled={money < 0 && data.savedata.money + money < 0}
|
||||
class="
|
||||
aspect-square h-48
|
||||
{goal
|
||||
? `text-black ${money < 0 && data.savedata.money + money < 0 ? "bg-red-200" : "bg-amber-200"} outline-amber-600`
|
||||
: `${money < 0 && data.savedata.money + money < 0 ? "bg-slate-700" : "bg-gray-600"} outline-gray-500 shadow-gray-700`
|
||||
}
|
||||
rounded-2xl p-4 flex flex-col hover:outline-4
|
||||
{money < 0 && data.savedata.money + money < 0 ? "cursor-not-allowed" : "cursor-pointer"}
|
||||
hover:shadow-xl"
|
||||
onclick={() => {
|
||||
data.savedata.money += money;
|
||||
if (onclicked != null) {
|
||||
onclicked();
|
||||
}
|
||||
data.save();
|
||||
}}
|
||||
>
|
||||
<div class="grow"></div>
|
||||
<span class="text-xl text-center text-wrap">{text}</span>
|
||||
<span class="text-xs {goal ? "text-gray-800" : "text-gray-300"}">{subtitle}</span>
|
||||
{#if money > 0}
|
||||
<span class="text-md text-green-400">+ {money}zł</span>
|
||||
{:else if money < 0}
|
||||
<span class="text-md text-red-400">- {money*-1}zł</span>
|
||||
{/if}
|
||||
<div class="grow"></div>
|
||||
</button>
|
||||
11
src/components/Counter.svelte
Normal file
11
src/components/Counter.svelte
Normal file
@@ -0,0 +1,11 @@
|
||||
<script lang="ts">
|
||||
let { title, count }: {
|
||||
title: string,
|
||||
count: string
|
||||
} = $props();
|
||||
</script>
|
||||
|
||||
<div class="flex flex-col">
|
||||
<h4 class="text-md font-bold">{title}</h4>
|
||||
<h6 class="text-sm ml-1 overflow-clip">{count}</h6>
|
||||
</div>
|
||||
82
src/lib/data.svelte.ts
Normal file
82
src/lib/data.svelte.ts
Normal file
@@ -0,0 +1,82 @@
|
||||
type SaveData = {
|
||||
money: number;
|
||||
time: number;
|
||||
stage: number;
|
||||
|
||||
// Stage 1
|
||||
buttons: number;
|
||||
buttonAppeal: number;
|
||||
wojteks: number;
|
||||
wojtekTimeout: number;
|
||||
|
||||
// Stage 2
|
||||
scientists: number;
|
||||
scientistTimeout: number;
|
||||
research: number;
|
||||
creatures: number;
|
||||
creatureTimeout: number;
|
||||
bustChance: number;
|
||||
busted: boolean;
|
||||
}
|
||||
|
||||
class Data {
|
||||
public savedata: SaveData = $state({} as SaveData);
|
||||
public hasSave: boolean = $state(false);
|
||||
|
||||
private setDefault() {
|
||||
this.savedata = {
|
||||
money: 0,
|
||||
time: 0,
|
||||
stage: 0,
|
||||
buttons: 0,
|
||||
buttonAppeal: 0,
|
||||
wojteks: 0,
|
||||
wojtekTimeout: 0,
|
||||
|
||||
scientists: 0,
|
||||
scientistTimeout: 0,
|
||||
research: 0,
|
||||
creatures: 0,
|
||||
creatureTimeout: 0,
|
||||
bustChance: 0,
|
||||
busted: false
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Load from LocalStorage
|
||||
*/
|
||||
public load() {
|
||||
const read = localStorage.getItem("savedata");
|
||||
if (read == null) {
|
||||
return;
|
||||
}
|
||||
this.savedata = JSON.parse(read);
|
||||
this.hasSave = true;
|
||||
}
|
||||
|
||||
/**
|
||||
* save
|
||||
*/
|
||||
public save() {
|
||||
localStorage.setItem("savedata", JSON.stringify(this.savedata));
|
||||
}
|
||||
|
||||
/**
|
||||
* reset
|
||||
*/
|
||||
public reset() {
|
||||
this.hasSave = false;
|
||||
this.setDefault();
|
||||
this.save();
|
||||
}
|
||||
|
||||
constructor() {
|
||||
this.setDefault();
|
||||
this.load();
|
||||
}
|
||||
}
|
||||
|
||||
const data = new Data();
|
||||
|
||||
export default data;
|
||||
9
src/main.ts
Normal file
9
src/main.ts
Normal file
@@ -0,0 +1,9 @@
|
||||
import { mount } from 'svelte'
|
||||
import './app.css'
|
||||
import App from './App.svelte'
|
||||
|
||||
const app = mount(App, {
|
||||
target: document.getElementById('app')!,
|
||||
})
|
||||
|
||||
export default app
|
||||
110
src/pages/Game.svelte
Normal file
110
src/pages/Game.svelte
Normal file
@@ -0,0 +1,110 @@
|
||||
<script lang="ts">
|
||||
import { onMount } from "svelte";
|
||||
import Button from "../components/Button.svelte";
|
||||
import Counter from "../components/Counter.svelte";
|
||||
import data from "../lib/data.svelte";
|
||||
|
||||
const StageNames: string[] = [
|
||||
"Home, awful home",
|
||||
"Fluffy sidetrack",
|
||||
"Space fastination",
|
||||
"Back to roots"
|
||||
];
|
||||
const SceneryNames: string[] = [
|
||||
"Imagine YouPiter's room",
|
||||
"Imagine insides of YouBioLab",
|
||||
"Imagine insides of a Space Traffic Control room",
|
||||
"Imagine being on Jupiter's surface"
|
||||
];
|
||||
|
||||
onMount(async () => {
|
||||
while (true) {
|
||||
if (data.savedata.busted) {
|
||||
alert("You've been busted by the feds! Run over!");
|
||||
data.reset();
|
||||
}
|
||||
switch (data.savedata.stage) {
|
||||
// Stage 1
|
||||
case 0:
|
||||
for (let i = 0; data.savedata.buttons > i; i++) {
|
||||
// Sell button based on appeal (random float <= appeal)
|
||||
if (Math.random() <= data.savedata.buttonAppeal) {
|
||||
data.savedata.buttons--;
|
||||
data.savedata.money += 110;
|
||||
data.save();
|
||||
}
|
||||
}
|
||||
if (data.savedata.wojtekTimeout > 3) {
|
||||
const count = Math.min(Math.max(data.savedata.money % 80, 0), data.savedata.wojteks);
|
||||
data.savedata.money -= count * 80;
|
||||
data.savedata.buttons += count;
|
||||
data.savedata.wojtekTimeout = 0;
|
||||
} else {
|
||||
data.savedata.wojtekTimeout++;
|
||||
}
|
||||
|
||||
// Stage 2
|
||||
// case 1:
|
||||
// if (data.savedata.scientistTimeout >= 6) {
|
||||
// data.savedata.research += data.savedata.scientists * Math.random() * 0.02;
|
||||
// data.savedata.scientistTimeout = 0;
|
||||
// data.save();
|
||||
// } else {
|
||||
// data.savedata.scientistTimeout++;
|
||||
// }
|
||||
}
|
||||
data.savedata.time++;
|
||||
data.save();
|
||||
await new Promise(resolve => setTimeout(resolve, 1000));
|
||||
}
|
||||
})
|
||||
</script>
|
||||
|
||||
<main class="flex flex-col">
|
||||
<header class="flex flex-row justify-between m-2 px-4 p-2 rounded-2xl bg-gray-800">
|
||||
<div class="flex flex-row gap-4">
|
||||
<h2 class="my-auto">
|
||||
<span class="font-bold text-2xl">Stage {data.savedata.stage + 1}:</span>
|
||||
<span class="text-xl ml-2">
|
||||
{StageNames[data.savedata.stage]}
|
||||
</span>
|
||||
</h2>
|
||||
{#if data.savedata.stage == 0}
|
||||
<Counter title="Buttons" count={data.savedata.buttons.toString()} />
|
||||
<Counter title="Button appeal" count={Math.floor(data.savedata.buttonAppeal * 100) + "%"} />
|
||||
<Counter title="Wojteks" count={data.savedata.wojteks.toString()} />
|
||||
{:else if data.savedata.stage == 1}
|
||||
<Counter title="Scientists" count={data.savedata.scientists.toString()} />
|
||||
{/if}
|
||||
</div>
|
||||
<h2 class="my-auto font-sans">{data.savedata.money} zł</h2>
|
||||
</header>
|
||||
<div class="bg-black aspect-video m-auto my-10 w-1/2 flex">
|
||||
<p class="text-2xl m-auto">[{SceneryNames[data.savedata.stage]}]</p>
|
||||
</div>
|
||||
<div class="bg-gray-800 flex flex-row overflow-x-auto rounded-2xl m-4 p-4 gap-5">
|
||||
{#if data.savedata.stage == 0}
|
||||
<Button text="Sell lemonade" money={5}/>
|
||||
<Button text="Manufacture The Button" money={-80} onclicked={() => {data.savedata.buttons++}}/>
|
||||
<Button text="Write firmware" money={-30} subtitle="Slighly multiplies appeal" onclicked={() => {data.savedata.buttonAppeal *= 1.1}}/>
|
||||
<Button text="Spread the word" money={-10} subtitle="Slightly increases appeal" onclicked={() => {data.savedata.buttonAppeal+= Math.random() * 0.002}}></Button>
|
||||
<Button text="Advertize The Button" money={-10000} subtitle="Hire ex-Apple Ad people; majorly increases appeal" onclicked={() => {data.savedata.buttonAppeal += 0.2137}}></Button>
|
||||
<Button text="Hire a Wojtek" money={-200} subtitle="Produces button on his own if can buy parts" onclicked={() => {data.savedata.wojteks++}}></Button>
|
||||
<div class="grow"></div>
|
||||
<Button text="Build YouBioLab" money={-100000} goal={true} subtitle="Experiment on fluffy beings" onclicked={() => {data.savedata.stage++}}></Button>
|
||||
<!-- {:else if data.savedata.stage == 1}
|
||||
<Button text="Commit tax fraud" money={600} subtitle="Commit tax fraud at the risk of failing the run" />
|
||||
<Button text="Prompt ChatGPT" money={-800} subtitle="Mildly increase research at the cost of halucinated findings" />
|
||||
<Button text="Hire scientist" money={-14000} subtitle="Slowly researches" />
|
||||
<Button text="Commit patent fraud" money={500} subtitle="Earn a bunch of reaserch at a cost of high bust chance" />
|
||||
<div class="grow"></div>
|
||||
<Button text="Buy out NASA" money={420420420} subtitle="It's time to establish the Jupiter base" /> -->
|
||||
<!-- Only added this for completeness sake
|
||||
{:else if data.savedata.stage == 3}
|
||||
<div class="grow"></div>
|
||||
<Button text="Manufacture The Button" money={0} goal={true} onclicked={whatever to finish} />
|
||||
<div class="grow"></div>
|
||||
-->
|
||||
{/if}
|
||||
</div>
|
||||
</main>
|
||||
22
src/pages/Title.svelte
Normal file
22
src/pages/Title.svelte
Normal file
@@ -0,0 +1,22 @@
|
||||
<script>
|
||||
import Counter from "../components/Counter.svelte";
|
||||
import data from "../lib/data.svelte";
|
||||
</script>
|
||||
|
||||
<main class="flex align-middle h-svh">
|
||||
<div class="rounded-4xl m-auto p-5 flex flex-col bg-gray-800">
|
||||
<h2 class="text-center text-5xl">You have completed the demo</h2>
|
||||
<hr class="my-5">
|
||||
<h5 class="text-2xl">Sadly the rest of the stages ahd to be taken out of the demo due to time constrains. Hope you enjoyed!</h5>
|
||||
<div class="mt-7 flex flex-col mx-auto scale-125">
|
||||
<Counter title="Wojteks" count={data.savedata.wojteks.toString()} />
|
||||
<Counter title="Money" count={data.savedata.money + "zł"} />
|
||||
<Counter title="Time" count={data.savedata.time + " seconds (ticks)"} />
|
||||
</div>
|
||||
<div class="m-auto mt-10">
|
||||
<button class="rounded-2xl text-xl bg-red-600 p-1 hover:scale-110">Wipe save</button>
|
||||
</div>
|
||||
<p>everything took about 3 hours to make</p>
|
||||
<p>PS: The leftovers from the rest are in the <a class="text-sky-300" href="https://hazzy.nonamesoft.xyz/ghostfox/youcomp-sim">source code</a></p>
|
||||
</div>
|
||||
</main>
|
||||
8
svelte.config.js
Normal file
8
svelte.config.js
Normal file
@@ -0,0 +1,8 @@
|
||||
import { vitePreprocess } from '@sveltejs/vite-plugin-svelte'
|
||||
|
||||
/** @type {import("@sveltejs/vite-plugin-svelte").SvelteConfig} */
|
||||
export default {
|
||||
// Consult https://svelte.dev/docs#compile-time-svelte-preprocess
|
||||
// for more information about preprocessors
|
||||
preprocess: vitePreprocess(),
|
||||
}
|
||||
21
tsconfig.app.json
Normal file
21
tsconfig.app.json
Normal file
@@ -0,0 +1,21 @@
|
||||
{
|
||||
"extends": "@tsconfig/svelte/tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"tsBuildInfoFile": "./node_modules/.tmp/tsconfig.app.tsbuildinfo",
|
||||
"target": "ES2022",
|
||||
"useDefineForClassFields": true,
|
||||
"module": "ESNext",
|
||||
"types": ["svelte", "vite/client"],
|
||||
"noEmit": true,
|
||||
/**
|
||||
* Typecheck JS in `.svelte` and `.js` files by default.
|
||||
* Disable checkJs if you'd like to use dynamic types in JS.
|
||||
* Note that setting allowJs false does not prevent the use
|
||||
* of JS in `.svelte` files.
|
||||
*/
|
||||
"allowJs": true,
|
||||
"checkJs": true,
|
||||
"moduleDetection": "force"
|
||||
},
|
||||
"include": ["src/**/*.ts", "src/**/*.js", "src/**/*.svelte"]
|
||||
}
|
||||
7
tsconfig.json
Normal file
7
tsconfig.json
Normal file
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"files": [],
|
||||
"references": [
|
||||
{ "path": "./tsconfig.app.json" },
|
||||
{ "path": "./tsconfig.node.json" }
|
||||
]
|
||||
}
|
||||
26
tsconfig.node.json
Normal file
26
tsconfig.node.json
Normal file
@@ -0,0 +1,26 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"tsBuildInfoFile": "./node_modules/.tmp/tsconfig.node.tsbuildinfo",
|
||||
"target": "ES2023",
|
||||
"lib": ["ES2023"],
|
||||
"module": "ESNext",
|
||||
"types": ["node"],
|
||||
"skipLibCheck": true,
|
||||
|
||||
/* Bundler mode */
|
||||
"moduleResolution": "bundler",
|
||||
"allowImportingTsExtensions": true,
|
||||
"verbatimModuleSyntax": true,
|
||||
"moduleDetection": "force",
|
||||
"noEmit": true,
|
||||
|
||||
/* Linting */
|
||||
"strict": true,
|
||||
"noUnusedLocals": true,
|
||||
"noUnusedParameters": true,
|
||||
"erasableSyntaxOnly": true,
|
||||
"noFallthroughCasesInSwitch": true,
|
||||
"noUncheckedSideEffectImports": true
|
||||
},
|
||||
"include": ["vite.config.ts"]
|
||||
}
|
||||
8
vite.config.ts
Normal file
8
vite.config.ts
Normal file
@@ -0,0 +1,8 @@
|
||||
import { defineConfig } from 'vite'
|
||||
import { svelte } from '@sveltejs/vite-plugin-svelte'
|
||||
import tailwindcss from '@tailwindcss/vite'
|
||||
|
||||
// https://vite.dev/config/
|
||||
export default defineConfig({
|
||||
plugins: [svelte(), tailwindcss()],
|
||||
})
|
||||
Reference in New Issue
Block a user