Compare commits

..

1 Commits

Author SHA1 Message Date
CI c07d6ac191 deploy 2025-06-03 05:47:31 +00:00
77 changed files with 317 additions and 8267 deletions
-16
View File
@@ -1,16 +0,0 @@
name: Build Vue
on:
release:
types: [published]
jobs:
build_vue:
runs-on: ubuntu-latest
name: Build Vue
steps:
- uses: actions/checkout@v2
- id: Build-Vue
uses: xRealNeon/VuePagesAction@1.0.1
with:
username: 'YouHaveTrouble'
reponame: 'GuildMaster'
token: ${{ secrets.GITHUB_TOKEN }}
-28
View File
@@ -1,28 +0,0 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*
node_modules
.DS_Store
dist
dist-ssr
coverage
*.local
/cypress/videos/
/cypress/screenshots/
# Editor directories and files
.vscode/*
!.vscode/extensions.json
.idea
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?
Symlink
+1
View File
@@ -0,0 +1 @@
index.html
-6
View File
@@ -1,6 +0,0 @@
<h1>Guild Master</h1>
<h2>Adventurer's guild management game</h2>
<p>It's a game where you manage an adventurer's guild. You can hire adventurers, assign them to quests to send them on adventures. </p>
<h3>How to play</h3>
Game is playable on <a href="https://guildmaster.yht.one/">guildmaster.yht.one</a> and is always automatically updated when new release is made.
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+106
View File
@@ -0,0 +1,106 @@
{
"ranks": {
"A": [
{
"title": "Ogre king",
"text": "Ogres have chosen a new king through democratic vote. They all voted for the strongest ogre."
},
{
"title": "Devilish dungeon",
"text": "New dungeon was discovered. It needs to be mapped and explored so lower rank adventurers can enter."
},
{
"title": "Eater of Worlds",
"text": "A giant worm emerged from the ground and appears to be consuming the ground itself."
}
],
"B": [
{
"title": "Undead horde",
"text": "Due to the spillage of necromancy potion at nearby graveyard we now have an undead army on our doorstep."
},
{
"title": "Runaway prisoner",
"text": "During the last prison guard strike a prisoner managed to escape. Bring them back to their cell."
},
{
"title": "The aristocrats",
"text": "Royalty wants an escort for one of their carriages."
}
],
"C": [
{
"title": "Scratchy, the butcher",
"text": "Scratchy turned evil and is terrorizing its victims. Put a stop to it!"
},
{
"title": "Hobgnoblin subjugation",
"text": "Gnoblins evolved and are back for vengeance."
},
{
"title": "Holy",
"text": "Gnoblins summoned their machine god and it started going haywire on everything around it. Destroy it!"
}
],
"D": [
{
"title": "Caravan escort",
"text": "Escort a merchant caravan."
},
{
"title": "Rare ore",
"text": "Obtain laudanium ore for town's blacksmith."
},
{
"title": "Demonic pests!",
"text": "Clear the fields from cabbage imps."
}
],
"E": [
{
"title": "Gnoblin subjugation",
"text": "Kill 3 gnoblins."
},
{
"title": "Phantom menace",
"text": "Exorcise ghosts out of someone's apartment."
},
{
"title": "Scratchy in peril",
"text": "Get Scratchy the cat from the tree safe onto the ground."
}
],
"F": [
{
"title": "Frog Frenzy",
"text": "Kill 10 demon frogs."
},
{
"title": "Rats!",
"text": "Get rid of the rats from someone's basement."
},
{
"title": "Herb gathering",
"text": "Collect medicinal herbs."
},
{
"title": "Big pile of rubble",
"text": "Tavern collapsed. Again. Help clean up the debris."
}
],
"S": [
{
"title": "The Demon King",
"text": "Demon King has awoken and is a threat to whole existence. Heroes needed."
},
{
"title": "Scratchy, Destruction Incarnate",
"text": "Scratchy was reborn as a machine of pure destruction and needs to be stopped."
},
{
"title": "Jiggly Jungle",
"text": "A jungle south began rapidly expanding and experts think arson is our only option."
}
]
}
}
Vendored
-1
View File
@@ -1 +0,0 @@
/// <reference types="vite/client" />
BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 31 KiB

BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 38 KiB

BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 42 KiB

BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 62 KiB

BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 126 KiB

BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 5.5 KiB

BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 304 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 92 KiB

Before

Width:  |  Height:  |  Size: 3.6 KiB

After

Width:  |  Height:  |  Size: 3.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 119 KiB

+15 -1
View File
@@ -8,12 +8,26 @@
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=EB+Garamond&display=swap" rel="stylesheet">
<link rel="manifest" href="/manifest.json" />
<meta name="description"
content="Guild Master is a browser game where you manage your own adventurer's guild!"/>
<meta property="twitter:title" content="Guild Master - Adventurer's guild management game"/>
<meta property="twitter:image" content="https://guildmaster.yht.one/img/app-icons/icon.png"/>
<meta property="twitter:description"
content="Guild Master is a browser game where you manage your own adventurer's guild!"/>
<meta property="og:title" content="Guild Master - Adventurer's guild management game"/>
<meta property="og:url" content="https://guildmaster.yht.one/"/>
<meta property="og:description"
content="Guild Master is a browser game where you manage your own adventurer's guild!"/>
<meta property="og:image" content="https://guildmaster.yht.one/img/app-icons/icon.png"/>
<script type="module" crossorigin src="/assets/index-981baea9.js"></script>
<link rel="stylesheet" href="/assets/index-87987ee1.css">
</head>
<body>
<div id="app"></div>
<noscript>
This is a javascript game. You need to enable javascript for it to work.
</noscript>
<script type="module" src="/src/main.ts"></script>
</body>
</html>
Executable
+59
View File
@@ -0,0 +1,59 @@
{
"name": "Guild Master - Adventurer's guild management game",
"short_name": "Guild Master",
"theme_color": "#3C2114",
"background_color": "#d9c8b3",
"display": "standalone",
"scope": "./",
"start_url": "./",
"icons": [
{
"src": "img/app-icons/icon-72x72.png",
"sizes": "72x72",
"type": "image/png",
"purpose": "maskable any"
},
{
"src": "img/app-icons/icon-96x96.png",
"sizes": "96x96",
"type": "image/png",
"purpose": "maskable any"
},
{
"src": "img/app-icons/icon-128x128.png",
"sizes": "128x128",
"type": "image/png",
"purpose": "maskable any"
},
{
"src": "img/app-icons/icon-144x144.png",
"sizes": "144x144",
"type": "image/png",
"purpose": "maskable any"
},
{
"src": "img/app-icons/icon-152x152.png",
"sizes": "152x152",
"type": "image/png",
"purpose": "maskable any"
},
{
"src": "img/app-icons/icon-192x192.png",
"sizes": "192x192",
"type": "image/png",
"purpose": "maskable any"
},
{
"src": "img/app-icons/icon-384x384.png",
"sizes": "384x384",
"type": "image/png",
"purpose": "maskable any"
},
{
"src": "img/app-icons/icon.png",
"sizes": "512x512",
"type": "image/png",
"purpose": "maskable any"
}
]
}
-6022
View File
File diff suppressed because it is too large Load Diff
-29
View File
@@ -1,29 +0,0 @@
{
"name": "adventurers-guild",
"version": "0.1.0",
"private": true,
"scripts": {
"dev": "vite",
"build": "run-p type-check build-only && cp -r CNAME dist/CNAME",
"preview": "vite preview",
"build-only": "vite build",
"type-check": "vue-tsc --noEmit"
},
"dependencies": {
"@vueuse/components": "^9.13.0",
"sass": "^1.59.3",
"vue": "^3.2.45",
"vue-router": "^4.1.6"
},
"devDependencies": {
"@types/node": "^18.11.12",
"@vitejs/plugin-vue": "^4.0.0",
"@vue/tsconfig": "^0.1.3",
"eslint": "^8.36.0",
"eslint-plugin-vue": "^9.9.0",
"npm-run-all": "^4.1.5",
"typescript": "~4.7.4",
"vite": "^4.0.0",
"vue-tsc": "^1.0.12"
}
}
-38
View File
@@ -1,38 +0,0 @@
[
{
"id": "rincewind-diskworld",
"name": "Rincewind",
"portrait": "/img/adventurers/rincewind.png",
"attackExponent": 1.09
},
{
"id": "fran-sword-isekai",
"name": "Fran",
"portrait": "/img/adventurers/fran.png",
"attackExponent": 1.115
},
{
"id": "kazuma-konosuba",
"name": "Kazuma",
"portrait": "/img/adventurers/kazuma.png",
"attackExponent": 1.1
},
{
"id": "rein-beast-tamer",
"name": "Rein",
"portrait": "/img/adventurers/rein.png",
"attackExponent": 1.1
},
{
"id": "momon-overlord",
"name": "Momon",
"portrait": "/img/adventurers/momon.png",
"attackExponent": 1.11
},
{
"id": "goblin-slayer",
"name": "Goblin Slayer",
"portrait": "/img/adventurers/goblin-slayer.png",
"attackExponent": 1.1
}
]
-14
View File
@@ -1,14 +0,0 @@
[
{
"title": "Ogre king",
"text": "Ogres have chosen a new king through democratic vote. They all voted for the strongest ogre."
},
{
"title": "Devilish dungeon",
"text": "New dungeon was discovered. It needs to be mapped and explored so lower rank adventurers can enter."
},
{
"title": "Eater of Worlds",
"text": "A giant worm emerged from the ground and appears to be consuming the ground itself."
}
]
-14
View File
@@ -1,14 +0,0 @@
[
{
"title": "Undead horde",
"text": "Due to the spillage of necromancy potion at nearby graveyard we now have an undead army on our doorstep."
},
{
"title": "Runaway prisoner",
"text": "During the last prison guard strike a prisoner managed to escape. Bring them back to their cell."
},
{
"title": "The aristocrats",
"text": "Royalty wants an escort for one of their carriages."
}
]
-14
View File
@@ -1,14 +0,0 @@
[
{
"title": "Scratchy, the butcher",
"text": "Scratchy turned evil and is terrorizing its victims. Put a stop to it!"
},
{
"title": "Hobgnoblin subjegation",
"text": "Gnoblins evolved and are back for vengeance."
},
{
"title": "Holy",
"text": "Gnoblins summoned their machine god and it started going haywire on everything around it. Destroy it!"
}
]
-14
View File
@@ -1,14 +0,0 @@
[
{
"title": "Caravan escort",
"text": "Escort a merchant caravan."
},
{
"title": "Rare ore",
"text": "Obtain laudanium ore for town's blacksmith."
},
{
"title": "Demonic pests!",
"text": "Clear the fields from cabbage imps."
}
]
-14
View File
@@ -1,14 +0,0 @@
[
{
"title": "Gnoblin subjegation",
"text": "Kill 3 gnoblins."
},
{
"title": "Phantom menace",
"text": "Exorcise ghosts out of someone's apartment."
},
{
"title": "Scratchy in peril",
"text": "Get Scratchy the cat from the tree safe onto the ground."
}
]
-18
View File
@@ -1,18 +0,0 @@
[
{
"title": "Frog Frenzy",
"text": "Kill 10 demon frogs."
},
{
"title": "Rats!",
"text": "Get rid of the rats from someone's basement."
},
{
"title": "Herb gathering",
"text": "Collect medicinal herbs."
},
{
"title": "Big pile of rubble",
"text": "Tavern collapsed. Again. Help clean up the debris."
}
]
-14
View File
@@ -1,14 +0,0 @@
[
{
"title": "The Demon King",
"text": "Demon King has awoken and is a threat to whole existence. Heroes needed."
},
{
"title": "Scratchy, Destruction Incarnate",
"text": "Scratchy was reborn as a machine of pure destruction and needs to be stopped."
},
{
"title": "Jiggly Jungle",
"text": "A jungle south began rapidly expanding and experts think arson is our only option."
}
]
Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 70 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 208 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 234 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 88 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 230 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 53 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.9 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.6 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.3 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.9 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 99 KiB

-1
View File
@@ -1 +0,0 @@
<svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><title>Discord</title><path d="M20.317 4.3698a19.7913 19.7913 0 00-4.8851-1.5152.0741.0741 0 00-.0785.0371c-.211.3753-.4447.8648-.6083 1.2495-1.8447-.2762-3.68-.2762-5.4868 0-.1636-.3933-.4058-.8742-.6177-1.2495a.077.077 0 00-.0785-.037 19.7363 19.7363 0 00-4.8852 1.515.0699.0699 0 00-.0321.0277C.5334 9.0458-.319 13.5799.0992 18.0578a.0824.0824 0 00.0312.0561c2.0528 1.5076 4.0413 2.4228 5.9929 3.0294a.0777.0777 0 00.0842-.0276c.4616-.6304.8731-1.2952 1.226-1.9942a.076.076 0 00-.0416-.1057c-.6528-.2476-1.2743-.5495-1.8722-.8923a.077.077 0 01-.0076-.1277c.1258-.0943.2517-.1923.3718-.2914a.0743.0743 0 01.0776-.0105c3.9278 1.7933 8.18 1.7933 12.0614 0a.0739.0739 0 01.0785.0095c.1202.099.246.1981.3728.2924a.077.077 0 01-.0066.1276 12.2986 12.2986 0 01-1.873.8914.0766.0766 0 00-.0407.1067c.3604.698.7719 1.3628 1.225 1.9932a.076.076 0 00.0842.0286c1.961-.6067 3.9495-1.5219 6.0023-3.0294a.077.077 0 00.0313-.0552c.5004-5.177-.8382-9.6739-3.5485-13.6604a.061.061 0 00-.0312-.0286zM8.02 15.3312c-1.1825 0-2.1569-1.0857-2.1569-2.419 0-1.3332.9555-2.4189 2.157-2.4189 1.2108 0 2.1757 1.0952 2.1568 2.419 0 1.3332-.9555 2.4189-2.1569 2.4189zm7.9748 0c-1.1825 0-2.1569-1.0857-2.1569-2.419 0-1.3332.9554-2.4189 2.1569-2.4189 1.2108 0 2.1757 1.0952 2.1568 2.419 0 1.3332-.946 2.4189-2.1568 2.4189Z"/></svg>

Before

Width:  |  Height:  |  Size: 1.3 KiB

-5
View File
@@ -1,5 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<svg width="800px" height="800px" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
<rect width="24" height="24" fill="none"/>
<path d="M12,2A10,10,0,0,0,8.84,21.5c.5.08.66-.23.66-.5V19.31C6.73,19.91,6.14,18,6.14,18A2.69,2.69,0,0,0,5,16.5c-.91-.62.07-.6.07-.6a2.1,2.1,0,0,1,1.53,1,2.15,2.15,0,0,0,2.91.83,2.16,2.16,0,0,1,.63-1.34C8,16.17,5.62,15.31,5.62,11.5a3.87,3.87,0,0,1,1-2.71,3.58,3.58,0,0,1,.1-2.64s.84-.27,2.75,1a9.63,9.63,0,0,1,5,0c1.91-1.29,2.75-1,2.75-1a3.58,3.58,0,0,1,.1,2.64,3.87,3.87,0,0,1,1,2.71c0,3.82-2.34,4.66-4.57,4.91a2.39,2.39,0,0,1,.69,1.85V21c0,.27.16.59.67.5A10,10,0,0,0,12,2Z"/>
</svg>

Before

Width:  |  Height:  |  Size: 660 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1018 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 947 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 68 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 200 KiB

-313
View File
@@ -1,313 +0,0 @@
<script setup lang="ts">
import {RouterLink, RouterView} from 'vue-router'</script>
<template>
<header>
<nav>
<RouterLink :to="{name: 'guild'}">Guild</RouterLink>
<RouterLink :to="{name: 'quests'}">Quests</RouterLink>
<RouterLink :to="{name: 'adventurers'}">Adventurers</RouterLink>
<RouterLink :to="{name: 'technical'}"><img class="icon" src="/img/icons/cog.svg" alt="Technical"></RouterLink>
</nav>
</header>
<RouterView
:guild="guild"
:adventurers="adventurers"
:quests="missives"
:lastRecruitTime="lastRecruitHandled"
@finalizeQuest="finalizeQuest($event)"
@wipeSave="resetSave()"
@recruitActionTaken="lastRecruitHandled = Number(new Date())"
/>
</template>
<script lang="ts">
import {defineComponent} from "vue";
import {Adventurer} from "@/classes/Adventurer";
import {getQuestWithRewards, Quest} from "@/classes/Quest";
import {Guild} from "@/classes/Guild";
import {getFromString, QuestRank} from "@/classes/QuestRank";
import {GameData, loadAvailableQuests, loadGame, saveGame} from "@/GameData";
import type {GuildUpgrade} from "@/classes/GuildUpgrade";
import {AdventurerCapacityUpgrade} from "@/classes/guildUpgrades/AdventurerCapacityUpgrade";
export default defineComponent({
name: "GuildView",
data: () => ({
guild: new Guild(1, 500),
lastQuestGot: {
S: null as null|number,
A: null as null|number,
B: null as null|number,
C: null as null|number,
D: null as null|number,
E: null as null|number,
F: null as null|number,
} as { [key: string]: null|number },
lastRecruitHandled: null as null|number,
adventurers: {} as { [key: string]: Adventurer },
quests: {} as { [key: string]: { [key: string]: Quest } },
missives: {
F: {} as { [key: string]: Quest },
E: {} as { [key: string]: Quest },
D: {} as { [key: string]: Quest },
C: {} as { [key: string]: Quest },
B: {} as { [key: string]: Quest },
A: {} as { [key: string]: Quest },
S: {} as { [key: string]: Quest },
} as { [key: string]: { [key: string]: Quest } },
}),
methods: {
async updateMissives() {
for (const missiveRank in this.missives) {
const rank = getFromString(missiveRank as QuestRank);
for (const missiveId in this.missives[rank.toString() as QuestRank]) {
const missive = this.missives[rank.toString()][missiveId];
if (missive.adventurers.length <= 0) {
missive.progressPoints = 0;
continue;
}
if (missive.progressPoints >= missive.maxProgress) continue;
for (const adventurerId in missive.adventurers) {
const adventurer = missive.adventurers[adventurerId];
const attack = adventurer.getAttack();
missive.progressPoints = Math.min(missive.progressPoints + attack, missive.maxProgress);
}
}
}
},
finalizeQuest(missive: Quest) {
missive.progressPoints = 0;
this.guild.gold += missive.goldReward;
for (const adventurerId in missive.adventurers) {
const adventurer = missive.adventurers[adventurerId];
adventurer.addExp(missive.expReward / missive.adventurers.length);
adventurer.busy = false;
}
missive.adventurers = [];
delete this.missives[missive.rank.toString() as QuestRank][missive.id];
},
getRandomQuest(rank: QuestRank): Quest | null {
const keys = Object.keys(this.quests[rank]);
if (keys.length <= 0) return null;
const questsForRank = this.quests[rank] as { [key: string]: Quest };
const randomId = keys.length * Math.random() << 0;
const randomIdString = keys[randomId] as string;
return getQuestWithRewards(questsForRank[randomIdString]);
},
createMissive(questToAdd: Quest, rank: QuestRank) {
const quest = JSON.parse(JSON.stringify(questToAdd));
const newId = Math.random().toString(16).slice(2).toString();
quest.id = newId;
this.missives[rank][newId] = quest;
},
loadGame() {
const saveData = loadGame();
if (saveData === null) return;
this.lastQuestGot = saveData.lastQuestGot;
const guildUpgrades = {} as { [key: string]: GuildUpgrade };
if (saveData.guild.adventurerCapacity) {
guildUpgrades.adventurerCapacity = new AdventurerCapacityUpgrade(saveData.guild.adventurerCapacity.level);
}
this.guild = new Guild(saveData.guild.level, saveData.guild.gold, guildUpgrades);
const adventurers = {} as { [key: string]: Adventurer };
for (const id in saveData.adventurers) {
const data = saveData.adventurers[id];
try {
const adventurer = new Adventurer(
data.id,
data.name,
data.portrait,
data.attackExponent ?? 1.1,
data.level ?? 1,
data.exp ?? 0
);
adventurer.busy = data.busy;
adventurers[data.id] = adventurer;
} catch (e) {}
}
this.adventurers = adventurers;
const missives = {} as { [key: string]: { [key: string]: Quest } };
for (const id in saveData.missives) {
const missiveRank = {} as { [key: string]: Quest }
for (const questId in saveData.missives[id]) {
const data = saveData.missives[id][questId];
const quest = new Quest(questId, getFromString(data.rank), data.title, data.text, data.maxProgress, data.expReward, data.goldReward);
quest.progressPoints = data.progressPoints;
if (data.adventurers.length > 0) {
quest.adventurers.push(this.adventurers[data.adventurers[0].id])
}
missiveRank[questId] = quest;
}
missives[id] = missiveRank;
}
this.missives = missives;
this.lastRecruitHandled = saveData.lastRecruitAction ?? 0;
},
resetSave() {
if (!confirm("You are about to wipe your save file. Are you sure?")) return;
window.localStorage.removeItem("savedGame");
window.location.reload();
}
},
async mounted() {
this.loadGame();
this.quests = await loadAvailableQuests();
setInterval(() => {
saveGame(new GameData(
this.guild,
this.adventurers,
this.missives,
this.lastQuestGot,
this.lastRecruitHandled
)
);
}, 10*1000)
setInterval(() => {
this.updateMissives();
const now = Number(new Date());
for (const id in this.lastQuestGot) {
const lastTime = this.lastQuestGot[getFromString(id as QuestRank)];
if (lastTime === null) this.lastQuestGot[getFromString(id as QuestRank)] = 0;
}
if (Number(now) - Number(this.lastQuestGot.F) >= 12 * 1000) {
this.lastQuestGot.F = now;
const keys = Object.keys(this.missives[QuestRank.F]);
if (keys.length >= 5) return;
const quest = this.getRandomQuest(QuestRank.F);
if (quest !== null) {
this.createMissive(quest, QuestRank.F);
}
}
if (this.guild.level < 2) return;
if (Number(now) - Number(this.lastQuestGot.E) >= 20 * 1000) {
this.lastQuestGot.E = now;
const keys = Object.keys(this.missives[QuestRank.E]);
if (keys.length >= 5) return;
const quest = this.getRandomQuest(QuestRank.E);
if (quest !== null) {
this.createMissive(quest, QuestRank.E);
}
}
if (this.guild.level < 3) return;
if (Number(now) - Number(this.lastQuestGot.D) >= 50 * 1000) {
this.lastQuestGot.D = now;
const keys = Object.keys(this.missives[QuestRank.D]);
if (keys.length >= 5) return;
const quest = this.getRandomQuest(QuestRank.D);
if (quest !== null) {
this.createMissive(quest, QuestRank.D);
}
}
if (this.guild.level < 4) return;
if (Number(now) - Number(this.lastQuestGot.C) >= 2 * 60 * 1000) {
this.lastQuestGot.C = now;
const keys = Object.keys(this.missives[QuestRank.C]);
if (keys.length >= 5) return;
const quest = this.getRandomQuest(QuestRank.C);
if (quest !== null) {
this.createMissive(quest, QuestRank.C);
}
}
if (this.guild.level < 5) return;
if (Number(now) - Number(this.lastQuestGot.B) >= 2 * 60 * 1000) {
this.lastQuestGot.B = now;
const keys = Object.keys(this.missives[QuestRank.B]);
if (keys.length >= 5) return;
const quest = this.getRandomQuest(QuestRank.B);
if (quest !== null) {
this.createMissive(quest, QuestRank.B);
}
}
if (this.guild.level < 6) return;
if (Number(now) - Number(this.lastQuestGot.A) >= 5 * 60 * 1000) {
this.lastQuestGot.A = now;
const keys = Object.keys(this.missives[QuestRank.A]);
if (keys.length >= 5) return;
const quest = this.getRandomQuest(QuestRank.A);
if (quest !== null) {
this.createMissive(quest, QuestRank.A);
}
}
if (this.guild.level < 6) return;
if (Number(now) - Number(this.lastQuestGot.S) >= 30 * 60 * 1000) {
this.lastQuestGot.S = now;
const keys = Object.keys(this.missives[QuestRank.S]);
if (keys.length >= 5) return;
const quest = this.getRandomQuest(QuestRank.S);
if (quest !== null) {
this.createMissive(quest, QuestRank.S);
}
}
}, 250);
}
})
</script>
<style lang="scss" scoped>
header {
line-height: 1;
max-height: 100vh;
display: flex;
flex-direction: row;
justify-content: center;
align-items: center;
}
nav {
width: max-content;
text-align: center;
display: flex;
flex-direction: row;
justify-content: center;
align-items: center;
flex-wrap: wrap;
gap: 1rem;
padding: 2rem;
background-size: 200px;
background-blend-mode: darken;
background-color: rgba(0, 0, 0, 0.65);
.icon {
width: 2rem;
height: 2rem;
fill: white;
filter: invert(1);
transform: translateY(0.35rem);
}
a {
font-size: 2rem;
color: #fff;
text-decoration: none;
&.router-link-active {
text-decoration: underline;
}
}
}
</style>
-113
View File
@@ -1,113 +0,0 @@
import type {Guild} from "@/classes/Guild";
import {Adventurer} from "@/classes/Adventurer";
import {Quest} from "@/classes/Quest";
import {getFromString, QuestRank} from "@/classes/QuestRank";
export class GameData {
guild: Guild;
adventurers: { [key: string]: Adventurer };
missives: { [key: string]: { [key: string]: Quest } };
lastQuestGot: { [key: string]: null | number };
lastRecruitAction: null | number;
constructor(guild: Guild, adventurers: { [key: string]: Adventurer }, missives: { [key: string]: { [key: string]: Quest } }, lastQuestGot: { [key: string]: null | number }, lastRecruitAction: null | number) {
this.guild = guild;
this.adventurers = adventurers;
this.missives = missives;
this.lastQuestGot = lastQuestGot;
this.lastRecruitAction = lastRecruitAction;
}
}
/**
* Save the game to local storage
*/
export function saveGame(
data: GameData
): void {
console.debug("Saving game...");
window.localStorage.setItem("savedGame", JSON.stringify({
guild: data.guild,
adventurers: data.adventurers,
missives: data.missives,
lastQuestGot: data.lastQuestGot,
lastRecruitAction: data.lastRecruitAction,
}));
}
export function loadGame(): GameData | null {
const savedGame = window.localStorage.getItem("savedGame");
if (!savedGame) return null;
console.debug("Loading game...");
const parsedGame = JSON.parse(savedGame);
return new GameData(
parsedGame.guild,
parsedGame.adventurers,
parsedGame.missives,
parsedGame.lastQuestGot,
parsedGame.lastRecruitAction
);
}
export async function loadAvailableQuests(): Promise<{ [key: string]: { [key: string]: Quest } }> {
const quests = {
S: {} as { [key: string]: Quest },
A: {} as { [key: string]: Quest },
B: {} as { [key: string]: Quest },
C: {} as { [key: string]: Quest },
D: {} as { [key: string]: Quest },
E: {} as { [key: string]: Quest },
F: {} as { [key: string]: Quest },
} as { [key: string]: { [key: string]: Quest } };
for (const rank in quests) {
const response = await fetch(`data/quests/Rank${rank}.json`);
if (response.status !== 200) {
console.error("Failed to load quests");
alert("Failed to load quests. Please try refreshing the page.");
return quests;
}
const questData = await response.json();
let id = 0;
for (const quest of questData) {
id++;
quests[rank.toString()][id] = new Quest(
id.toString(),
getFromString(rank as QuestRank),
quest.title,
quest.text,
1,
0,
0
);
}
}
return quests;
}
export async function loadAdventurersForHire(currentAdventurerIds: Array<string> = []): Promise<Array<Adventurer>> {
const response = await fetch("data/adventurers.json");
if (response.status !== 200) {
console.error("Failed to load adventurers");
alert("Failed to load adventurers. Please try refreshing the page.");
return [];
}
const adventurerData = await response.json();
const adventurers = [] as Array<Adventurer>;
for (const adventurer of adventurerData) {
if (currentAdventurerIds.includes(adventurer.id)) continue;
adventurers.push(new Adventurer(
adventurer.id,
adventurer.name,
adventurer.portrait,
adventurer.attackExponent,
adventurer.level,
adventurer.exp,
));
}
return adventurers;
}
-20
View File
@@ -1,20 +0,0 @@
:root {
}
body {
margin: 0;
padding: 0 0 10rem;
min-height: calc(100vh - 10rem);
font-family: 'EB Garamond', serif;
overflow-y: scroll;
user-select: none;
background-size: 30%;
background: rgba(87, 50, 20, 0.75) url("/img/background/panels/plaster.png") repeat;
background-blend-mode: darken;
}
#app {
width: 100%;
}
-91
View File
@@ -1,91 +0,0 @@
export class Adventurer {
id: string;
name: string;
portrait: string;
level: number;
exp: number;
attackExponent: number;
prestige: number;
busy: boolean;
constructor(
id: string,
name: string,
portrait: string,
attackExponent: number,
level: number = 1,
exp: number = 0,
prestige: number = 0
) {
this.id = id;
this.name = name;
this.portrait = portrait;
this.attackExponent = attackExponent;
this.level = level;
this.exp = exp;
this.prestige = prestige;
this.busy = false;
}
levelUp(): void {
this.exp = 0;
this.level += 1;
}
prestigeUp(): void {
this.level = 1;
this.exp = 0;
this.prestige += 1;
}
canLevelUp(): boolean {
if (this.level >= this.getMaxLevel()) return false;
return this.exp >= this.getNextLevelExpRequirement();
}
canPrestigeUp(): boolean {
if (this.level < getMaxLevelForPrestige(this.prestige)) return false;
return this.prestige < 5
}
getNextLevelExpRequirement(): number {
return this.level * 3;
}
/**
* Returns the percentage of exp to the next level
*/
getExpPercentage(): number {
return (this.exp / this.getNextLevelExpRequirement()) * 100;
}
addExp(exp: number): void {
if (this.isMaxLevel()) return;
this.exp += exp;
if (this.canLevelUp()) {
this.levelUp();
}
}
getAttack(): number {
const scalingFactor = Math.pow(1.05, this.level - 1);
return (2 * scalingFactor) * Math.pow(this.attackExponent, this.level - 1);
}
getDPS(): number {
return this.getAttack() * 4;
}
getMaxLevel(): number {
return getMaxLevelForPrestige(this.prestige);
}
isMaxLevel(): boolean {
return this.level >= this.getMaxLevel();
}
}
function getMaxLevelForPrestige(prestige: number): number {
return 25 + (prestige * 5);
}
-54
View File
@@ -1,54 +0,0 @@
import type {GuildUpgrade} from "@/classes/GuildUpgrade";
import {AdventurerCapacityUpgrade} from "@/classes/guildUpgrades/AdventurerCapacityUpgrade";
export class Guild {
gold: number;
level: number;
displayUpgradeCost: number|string;
upgradeCost: number|null = null;
adventurerCapacity: AdventurerCapacityUpgrade;
constructor(level: number, gold: number, upgrades: {[index:string]: GuildUpgrade} = {}) {
this.gold = gold;
this.level = level;
this.displayUpgradeCost = this.getUpgradeCost() ?? "Max level";
this.upgradeCost = this.getUpgradeCost();
this.adventurerCapacity = upgrades.adventurerCapacity as AdventurerCapacityUpgrade ?? new AdventurerCapacityUpgrade();
}
upgrade(): void {
const cost = this.getUpgradeCost();
if (cost === null) return;
if (this.gold < cost) return;
this.gold -= cost;
this.level += 1;
if (this.level >= 7) {
this.displayUpgradeCost = "Max level";
this.upgradeCost = null;
} else {
const newCost = this.getUpgradeCost();
if (newCost === null) return;
this.displayUpgradeCost = newCost;
this.upgradeCost = newCost;
}
}
getUpgradeCost(): number|null {
return upgradeCosts[this.level] ?? null;
}
isMaxLevel(): boolean {
return this.level >= 7;
}
}
const upgradeCosts = {
"1": 1000,
"2": 2500,
"3": 5000,
"4": 10000,
"5": 25000,
"6": 50000,
} as {[index:string]: number}
-7
View File
@@ -1,7 +0,0 @@
export class GuildUpgrade {
level: number = 1;
nextLevelCost: number | null = null;
guildLevelRequirement: number = 1;
}
-84
View File
@@ -1,84 +0,0 @@
import type {Adventurer} from "@/classes/Adventurer";
import {QuestRank} from "@/classes/QuestRank";
export class Quest {
id: string;
rank: QuestRank;
title: string;
text: string;
adventurers: Array<Adventurer>;
progressPoints: number;
maxProgress: number;
expReward: number;
goldReward: number;
constructor(id: string, rank: QuestRank, title: string, text: string, maxProgress: number, expReward: number, goldReward: number) {
this.id = id;
this.rank = rank;
this.title = title;
this.text = text;
this.maxProgress = maxProgress;
this.expReward = expReward;
this.goldReward = goldReward;
this.progressPoints = 0;
this.adventurers = [];
}
getPercentProgress(): number {
return Math.round(this.progressPoints / this.maxProgress * 100);
}
}
/**
* Generate rewards for a quest and return it
* @param quest
*/
export function getQuestWithRewards(quest: Quest) {
let maxProgress = 1;
switch (quest.rank) {
case QuestRank.S:
// at level 30 adventurers have ~6513 dps, this will take 30 seconds on level 30
maxProgress = 195390;
break;
case QuestRank.A:
// at level 25 adventurers have ~2051 dps, this will take 15 seconds on level 25
maxProgress = 30770;
break;
case QuestRank.B:
// at level 20 adventurers have ~645 dps, this will take 15 seconds on level 20
maxProgress = 9690;
break;
case QuestRank.C:
// at level 15 adventurers have ~203 dps, this will take 15 seconds on level 15
maxProgress = 3045;
break;
case QuestRank.D:
// at level 10 adventurers have ~64 dps, this will take 15 seconds on level 10
maxProgress = 960;
break;
case QuestRank.E:
// at level 5 adventurers have ~20 dps, this will take 15 seconds on level 5
maxProgress = 300;
break;
case QuestRank.F:
// at level 1 adventurers have ~8 dps, this will take 15 seconds on level 1
maxProgress = 120;
break;
}
let goldReward = Math.floor(maxProgress/6);
let expReward = Math.floor(Math.floor(maxProgress/120) - maxProgress/1000);
// add some randomness to the rewards
goldReward = Math.floor(randomNumberBetween(goldReward * 0.95, goldReward * 1.1));
expReward = Math.max(1, Math.floor(randomNumberBetween(expReward * 0.95, expReward * 1.2)));
return new Quest(quest.id, quest.rank, quest.title, quest.text, maxProgress, expReward, goldReward);
}
function randomNumberBetween(min: number, max: number) {
return Math.random() * (max - min) + min;
}
-13
View File
@@ -1,13 +0,0 @@
export enum QuestRank {
S = "S",
A = "A",
B = "B",
C = "C",
D = "D",
E = "E",
F = "F",
}
export function getFromString(string: keyof typeof QuestRank): QuestRank {
return QuestRank[string];
}
@@ -1,27 +0,0 @@
import {GuildUpgrade} from "@/classes/GuildUpgrade";
export class AdventurerCapacityUpgrade extends GuildUpgrade {
constructor(level: number = 1) {
super();
this.level = level;
this.nextLevelCost = this.getCostForLevel(this.level);
this.guildLevelRequirement = 1;
}
upgrade(): void {
this.level += 1;
this.nextLevelCost = this.getCostForLevel(this.level);
}
getCostForLevel(level: number): number {
const scalingFactor = Math.pow(1.25, level - 1);
return Math.floor(1500 * scalingFactor * Math.pow(level, 1.25));
}
/**
* Returns the number of adventurers the guild can have
*/
getAdventurerCapacity(): number {
return 1 + this.level ;
}
}
-52
View File
@@ -1,52 +0,0 @@
<template>
<div class="slots">
<button class="slot" v-for="adventurer in adventurers" :key="adventurer.id">
<AdventurerMiniComponent
:adventurer="currentAdventurer"
:all-adventurers="adventurers"
/>
</button>
</div>
</template>
<script lang="ts">
import {defineComponent, type PropType} from "vue";
import AdventurerMiniComponent from "@/components/AdventurerMiniComponent.vue";
import type {Adventurer} from "@/classes/Adventurer";
export default defineComponent({
name: "AdventurerList",
components: {AdventurerMiniComponent},
data: () => ({
currentAdventurer: null as Adventurer|null
}),
props: {
adventurers: {
type: Object as PropType<{[key: string]: Adventurer}>,
default() {
return {} as {[key: string]: Adventurer};
},
},
},
})
</script>
<style lang="scss" scoped>
.slots {
display: flex;
flex-direction: row;
flex-wrap: wrap;
justify-content: center;
align-items: center;
.slot {
padding: 0;
width: 5rem;
height: 5rem;
border: 2px solid #000;
background-color: rgba(0,0,0, 0.2);
cursor: pointer;
border-radius: 0.2rem;
}
}
</style>
-136
View File
@@ -1,136 +0,0 @@
<script setup lang="ts">
import { vOnClickOutside } from '@vueuse/components'
</script>
<template>
<AdventurerTile
v-if="adventurer"
:adventurer="adventurer"
@click="() => {
$emit('freeAdventurer', adventurer.id)
}"
/>
<article
class="select"
v-else
@click="() => {
if (Object.keys(allAdventurers).length <= 0) return;
selection = !selection;
}"
>
<span>+</span>
</article>
<div class="selection" v-if="selection" v-on-click-outside="closeSelect">
<button
class="slot"
v-for="adventurer in allAdventurers"
:key="adventurer.id"
:class="{busy: adventurer.busy}"
@click="() => {
if (adventurer.busy) return;
$emit('hireAdventurer', adventurer.id);
selection = false;
}"
>
<AdventurerTile
:adventurer="adventurer"
/>
</button>
</div>
</template>
<script lang="ts">
import {defineComponent, type PropType} from "vue";
import type {Adventurer} from "@/classes/Adventurer";
import AdventurerTile from "@/components/AdventurerTile.vue";
export default defineComponent({
name: "AdventurerMiniComponent",
components: {AdventurerTile},
emits: [ "freeAdventurer", "hireAdventurer" ],
data: () => {
return {
selection: false,
}
},
props: {
adventurer: {
type: Object as PropType<Adventurer|null|any>,
default() {
return null as Adventurer|null;
},
},
allAdventurers: {
type: Object as PropType<{[key: string]: Adventurer}>,
default() {
return {} as {[key: string]: Adventurer};
},
},
},
methods: {
print(a:string) {
console.log(a);
},
closeSelect() {
this.selection = false;
}
}
})
</script>
<style lang="scss" scoped>
.selection {
position: absolute;
bottom: 0;
left: 50%;
width: max-content;
max-width: 17rem;
transform: translateX(-50%) translateY(104%);
display: flex;
flex-direction: row;
justify-content: center;
align-items: center;
flex-wrap: wrap;
gap: 0.5rem;
padding: 0.5rem;
background-color: rgba(0,0,0, 0.2);
z-index: 2;
cursor: default;
max-height: 12rem;
overflow-y: auto;
.slot {
width: 5rem;
height: 5rem;
cursor: pointer;
padding: 0;
border-color: #000;
background-color: transparent;
background-blend-mode: darken;
transition: background-color 0.25s linear, filter 0.25s linear;
&.busy {
filter: grayscale(1);
background-color: rgba(0,0,0, 0.6);
&:hover {
cursor: not-allowed;
border-color: #000;
}
}
&:hover {
border-color: #fff;
}
img {
width: 100%;
height: 100%;
}
}
}
.select {
display: flex;
justify-content: center;
align-items: center;
width: 100%;
height: 100%;
font-size: 4.5rem;
}
</style>
-79
View File
@@ -1,79 +0,0 @@
<template>
<article
class="adventurer"
:title="adventurer.name + (adventurer.busy ? ' (busy)' : '')"
>
<img :src="adventurer.portrait" :alt="adventurer.name" draggable="false">
<div class="level" :title="adventurer.isMaxLevel() ? 'Max level' : ''">{{adventurer.level}}<span v-if="adventurer.isMaxLevel()"></span></div>
<div class="exp"></div>
</article>
</template>
<script lang="ts">
import type {Adventurer} from "@/classes/Adventurer";
import {defineComponent, type PropType } from "vue";
export default defineComponent({
name: "AdventurerTile",
props: {
adventurer: {
type: Object as PropType<Adventurer>,
default() {
return {} as Adventurer;
},
}
},
data: () => ({
expProgress: "0%",
}),
watch: {
adventurer: {
deep: true,
handler: function (adventurer: Adventurer) {
this.expProgress = adventurer.getExpPercentage() + "%";
},
}
},
mounted() {
if (this.adventurer === undefined) return;
this.expProgress = this.adventurer.getExpPercentage() + "%";
}
});
</script>
<style lang="scss" scoped>
.adventurer {
width: 100%;
height: 100%;
overflow: clip;
font-size: 5rem;
line-height: 1;
color: rgba(0,0,0, 0.75);
position: relative;
.level {
position: absolute;
top: 0;
left: 0;
font-size: 1rem;
min-width: 1rem;
background-color: rgba(0,0,0, 0.75);
border-bottom-right-radius: 0.2rem;
padding: 0.1rem;
color: #fff;
}
.exp {
position: absolute;
bottom: 0;
left: 0;
width: v-bind(expProgress);
height: 3.5%;
background-color: rgba(203, 33, 213, 0.75);
transition: width 1s linear;
}
img {
width: 100%;
height: 100%;
}
}
</style>
-76
View File
@@ -1,76 +0,0 @@
<template>
<div class="changelog">
<h1>Changelog</h1>
<div class="changelog-entry" v-for="release in releases">
<h2>Version {{ release.name }}</h2>
<pre>{{ release.body }}</pre>
</div>
</div>
</template>
<script lang="ts">
import {defineComponent} from "vue";
export default defineComponent({
name: "ChangelogComponent",
data: () => ({
releases: [] as Array<any>,
lastPage: 1,
}),
methods: {
async getReleases(page: number): Promise<void> {
const result = await fetch("https://api.github.com/repos/YouHaveTrouble/GuildMaster/releases?per_page=10")
.catch((e) => {
return null;
});
if (result === null) return;
const json = await result.json();
for (const release of json) {
const version = {} as any;
version.body = release.body.trim();
version.name = release.name;
if (release.body.length === 0) continue;
this.releases.push(version);
}
}
},
async mounted() {
this.getReleases(1);
}
});
</script>
<style lang="scss" scoped>
.changelog {
padding: 3rem;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
gap: 1rem;
max-width: 45rem;
h1 {
font-size: 3rem;
line-height: 1;
margin: 0;
text-align: center;
}
.changelog-entry {
width: 100%;
h2 {
margin: 0;
}
pre {
line-height: 1.2;
margin: 0;
white-space: pre-wrap;
font-family: 'EB Garamond', serif;
}
}
}
</style>
-252
View File
@@ -1,252 +0,0 @@
<template>
<article
class="missive"
:class="{done: missive.maxProgress <= missive.progressPoints}"
>
<div class="parchment">
<img src="/img/quests/backgrounds/dirty_paper.png" alt="parchment">
</div>
<div class="stain" v-if="stain">
<img src="/img/quests/overlays/water_stain.png" alt="stain">
</div>
<div class="drink-stain" v-if="drinkStain.exists">
<img src="/img/quests/overlays/drink_stain.png" alt="stain">
</div>
<h2>{{ missive.title }}</h2>
<p>{{ missive.text }}</p>
<div class="slots">
<button class="slot">
<AdventurerComponent
:adventurer="missive.adventurers[0]"
:all-adventurers="adventurers"
@hire-adventurer="(id) => {
adventurers[id].busy = true;
missive.adventurers[0] = adventurers[id];
}"
@free-adventurer="(id) => {
if (missive.progressPoints >= missive.maxProgress) return;
adventurers[id].busy = false;
missive.adventurers.splice(0, 1);
if (missive.adventurers.length <= 0) {
missive.progressPoints = 0;
}
}"
/>
</button>
</div>
<div class="progressWrap">
<span class="progress"></span>
<span class="percentage">{{ progressPercentage }}</span>
</div>
<h3>Rewards</h3>
<div class="rewards">
<span>Gold: <b>{{missive.goldReward}}</b></span>
<span>Exp: <b>{{missive.expReward}}</b></span>
</div>
</article>
</template>
<script lang="ts">
import type {Quest} from "@/classes/Quest";
import AdventurerComponent from "@/components/AdventurerMiniComponent.vue";
import type {Adventurer} from "@/classes/Adventurer";
import {defineComponent, type PropType} from "vue";
export default defineComponent({
name: "QuestMissive",
components: {AdventurerComponent},
props: {
missive: {
type: Object as PropType<Quest|any>,
default() {
return {} as Quest;
},
},
adventurers: {
type: Object as PropType<{[key: string]: Adventurer}>,
default() {
return {} as {[key: string]: Adventurer};
},
},
},
data: () => {
return {
progressPercentage: "0%",
stain: false,
drinkStain: {
exists: false,
offsetX: "0%",
offsetY: "0%",
},
}
},
methods: {
updateProgress() {
if (this.missive === undefined) return;
const progress = (this.missive.progressPoints / this.missive.maxProgress * 100).toFixed(2);
this.progressPercentage = `${progress}%`;
},
randomNumber(min: number, max: number) {
return Math.random() * (max - min) + min;
},
},
mounted() {
this.updateProgress();
this.stain = Math.random() < 0.35;
this.drinkStain.exists = Math.random() < 0.15;
if (this.drinkStain.exists) {
this.drinkStain.offsetX = `${this.randomNumber(-1, 1) * 100}%`;
this.drinkStain.offsetY = `${this.randomNumber(-1, 1) * 100}%`;
}
},
watch: {
missive: {
handler() {
this.updateProgress();
},
deep: true,
}
}
});
</script>
<style lang="scss" scoped>
.missive {
width: min(100%, 14rem);
text-align: center;
border: 2px solid #000;
padding: 0.5rem;
position: relative;
.parchment {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
z-index: -5;
overflow: hidden;
img {
width: 100%;
height: 100%;
object-fit: cover;
}
}
h2 {
font-size: 1.5rem;
line-height: 1;
}
h3 {
font-size: 1.15rem;
margin: 0;
}
.progressWrap {
width: 80%;
border: 1px solid #000;
margin: 0.5rem auto;
position: relative;
height: 1.25rem;
.progress {
position: absolute;
top: 0;
left: 0;
height: 100%;
display: block;
width: v-bind(progressPercentage);
background-color: rgba(0, 128, 0, 0.65);
transition: width 250ms linear;
}
.percentage {
position: absolute;
top: 0;
left: 0;
height: 100%;
display: flex;
align-items: center;
justify-content: center;
width: 100%;
}
}
.rewards {
display: flex;
flex-direction: row;
flex-wrap: wrap;
justify-content: center;
align-items: center;
gap: 1rem;
}
&.done {
cursor: pointer;
&::after {
position: absolute;
top: 0;
right: 0;
content: "";
font-size: 5rem;
color: green;
transform: translate(45%, -40%);
}
}
.slots {
display: flex;
flex-direction: row;
flex-wrap: wrap;
justify-content: center;
align-items: center;
.slot {
padding: 0;
width: 5rem;
height: 5rem;
border: 2px solid #000;
background-color: rgba(0, 0, 0, 0.2);
cursor: pointer;
border-radius: 0.2rem;
position: relative;
}
}
.stain {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-size: contain;
opacity: 1;
z-index: -4;
img {
width: 100%;
height: 100%;
object-fit: cover;
filter: grayscale(0.8);
}
}
.drink-stain {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
opacity: 0.45;
z-index: -1;
overflow: hidden;
display: flex;
justify-content: center;
align-items: center;
img {
width: 45%;
height: 35%;
filter: grayscale(0.8);
transform: translate(v-bind("drinkStain.offsetX"), v-bind("drinkStain.offsetY"));
}
}
}
</style>
-68
View File
@@ -1,68 +0,0 @@
<template>
<section class="upgrades">
<h2>Upgrades</h2>
<div class="upgrade">
<span>Adventurer capacity (level {{ guild.adventurerCapacity.level }})</span>
<button
v-if="guild.adventurerCapacity.nextLevelCost"
:disabled="guild.gold < guild.adventurerCapacity.nextLevelCost"
@click="upgradeAdventurerCapacity()"
>
Upgrade ({{guild.adventurerCapacity.nextLevelCost.toFixed(0)}} gold)
</button>
</div>
</section>
</template>
<script lang="ts">
import { Guild } from "@/classes/Guild";
import {defineComponent, type PropType} from "vue";
export default defineComponent({
name: "UpgradesList",
props: {
guild: {
type: Object as PropType<Guild>,
default() {
return new Guild(1, 0) as Guild;
}
}
},
methods: {
upgradeAdventurerCapacity(): void {
if (!this.guild.adventurerCapacity) return;
if (!this.guild.adventurerCapacity.nextLevelCost) return;
if (this.guild.gold < this.guild.adventurerCapacity.nextLevelCost) return;
this.guild.gold -= this.guild.adventurerCapacity.nextLevelCost;
this.guild.adventurerCapacity.upgrade();
}
}
});
</script>
<style lang="scss" scoped>
.upgrades {
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
gap: 1rem;
h2 {
font-size: 1.75rem;
margin: 2rem 0 0;
padding: 0;
}
.upgrade {
text-align: center;
font-size: 1.25rem;
font-weight: bold;
display: flex;
flex-direction: row;
flex-wrap: wrap;
width: min(25rem, 100%);
justify-content: center;
align-items: center;
gap: 1rem;
}
}
</style>
-11
View File
@@ -1,11 +0,0 @@
import { createApp } from 'vue'
import App from './App.vue'
import router from './router'
import './assets/main.css'
const app = createApp(App)
app.use(router)
app.mount('#app')
-30
View File
@@ -1,30 +0,0 @@
import {createRouter, createWebHashHistory} from 'vue-router'
import HomeView from '../views/HomeView.vue'
const router = createRouter({
history: createWebHashHistory(import.meta.env.BASE_URL),
routes: [
{
path: '/',
name: 'guild',
component: HomeView
},
{
path: '/quests',
name: 'quests',
component: () => import('../views/QuestView.vue')
},
{
path: '/adventurers',
name: 'adventurers',
component: () => import('../views/AdventurerView.vue')
},
{
path: '/technical',
name: 'technical',
component: () => import('../views/TechnicalView.vue')
}
]
})
export default router
-219
View File
@@ -1,219 +0,0 @@
<template>
<div class="adventurer-section">
<section class="recruit">
<h1>Applying adventurers</h1>
<div class="adventurers">
<div v-if="currentlyForHire">
<adventurer-tile class="hire-tile" :adventurer="currentlyForHire"/>
<div class="decision">
<span
title="Hire"
@click="hireAdventurer(currentlyForHire)"
:class="{disabled: Object.keys(adventurers).length >= guild.adventurerCapacity.getAdventurerCapacity()}"
>
</span>
<span
:title="Object.keys(adventurers).length > 0 ? 'Dismiss' : ''"
:class="{disabled: Object.keys(adventurers).length <= 0}"
@click="dismissAdventurer()"
>
</span>
</div>
</div>
<div v-else>
<span>Noone applied as of now. Check back later!</span>
</div>
</div>
</section>
<section class="collection">
<h1>Recruited adventurers ({{ Object.keys(adventurers).length }} / {{ guild.adventurerCapacity.getAdventurerCapacity() }})</h1>
<div class="adventurers">
<div class="adventurer-tile" v-for="adventurer in adventurers" :key="adventurer.id">
<AdventurerTile class="entry" :adventurer="adventurer" />
<b>{{ adventurer.name }}</b>
</div>
</div>
</section>
</div>
</template>
<script lang="ts">
import type {PropType} from "vue";
import {defineComponent} from "vue";
import AdventurerTile from "@/components/AdventurerTile.vue";
import type {Adventurer} from "@/classes/Adventurer";
import { loadAdventurersForHire } from "@/GameData";
import type {Guild} from "@/classes/Guild";
export default defineComponent({
name: "RecruitView",
components: {AdventurerTile},
data: () => {
return {
currentlyForHire: null as Adventurer|null,
adventurersForHire: [] as Array<Adventurer>,
}
},
props: {
guild: {
type: Object as PropType<Guild>,
default() {
return {} as Guild
},
},
adventurers: {
type: Object as PropType<{ [key: string]: Adventurer }>,
default() {
return {} as { [key: string]: Adventurer };
},
},
lastRecruitTime: {
type: Number as PropType<number>,
default() {
return 0;
}
},
},
methods: {
getRandomAdventurer(): Adventurer|null {
if (this.adventurersForHire.length <= 0) return null;
const randomId = this.adventurersForHire.length * Math.random() << 0;
return this.adventurersForHire[randomId];
},
getNewAdventurerForHire(): void {
const adventurer = this.getRandomAdventurer();
if (adventurer === null) {
this.currentlyForHire = null;
return;
}
if (this.adventurers[adventurer.id] != null) {
this.currentlyForHire = null;
return;
}
this.currentlyForHire = adventurer;
window.localStorage.setItem("currentlyForHire", adventurer.id);
},
hireAdventurer(adventurer: Adventurer|any): void {
if (Object.keys(this.adventurers).length >= this.guild.adventurerCapacity.getAdventurerCapacity()) return;
this.adventurers[adventurer.id] = adventurer;
this.currentlyForHire = null;
window.localStorage.removeItem("currentlyForHire");
this.$emit("recruitActionTaken", adventurer);
},
dismissAdventurer() {
if (Object.keys(this.adventurers).length <= 0) return;
this.currentlyForHire = null;
this.$emit("recruitActionTaken", null);
window.localStorage.removeItem("currentlyForHire");
}
},
async mounted() {
this.adventurersForHire = await loadAdventurersForHire(Object.keys(this.adventurers));
if (Object.keys(this.adventurers).length <= 0) {
this.currentlyForHire = this.adventurersForHire[0];
window.localStorage.setItem("currentlyForHire", this.adventurersForHire[0].id);
return;
}
const savedCurrentForHire = window.localStorage.getItem("currentlyForHire");
if (savedCurrentForHire !== null) {
for (const id in this.adventurersForHire) {
const adventurer = this.adventurersForHire[id];
if (adventurer.id === savedCurrentForHire) {
this.currentlyForHire = adventurer;
return;
}
}
}
const now = Number(new Date());
if (now - this.lastRecruitTime >= 1000 * 60 * 30 && this.currentlyForHire === null) {
this.getNewAdventurerForHire();
}
},
emits: ["recruitActionTaken"]
});
</script>
<style lang="scss" scoped>
.adventurer-section {
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
width: 100%;
section {
max-width: 1280px;
width: 100%;
text-align: center;
padding-block: 1rem;
}
h1 {
font-size: 2rem;
font-weight: bold;
margin: 0;
}
.adventurers {
display: flex;
flex-direction: row;
justify-content: center;
align-items: center;
flex-wrap: wrap;
gap: 1rem;
.adventurer-tile {
display: flex;
justify-content: center;
align-items: center;
flex-direction: column;
gap: 0.25rem;
font-size: 1.1rem;
.entry {
height: 7rem;
width: 7rem;
}
b {
line-height: 1;
text-align: center;
display: flex;
justify-content: center;
align-items: center;
width: 100%;
}
}
}
.decision {
display: flex;
flex-direction: row;
justify-content: center;
align-items: center;
font-size: 2rem;
gap: 1rem;
span {
cursor: pointer;
&:hover {
color: #fff;
}
&.disabled {
color: rgba(0,0,0, 0.5);
cursor: default;
}
}
}
.hire-tile {
width: 8rem;
height: 8rem;
}
}
</style>
-101
View File
@@ -1,101 +0,0 @@
<template>
<main>
<section class="title">
<h1>Guild Master</h1>
<h3>Adventurer's guild management game</h3>
<small>v{{version}}</small>
</section>
<section class="coffer">
<p>Coffer: {{guild.gold}} gold</p>
</section>
<section class="upgrade">
<p>Guild level: {{ guild.level }}</p>
<button :disabled="guild.upgradeCost ? guild.gold < guild.upgradeCost : true" @click="guild.upgrade()">
<span>Upgrade guild level</span><br>
<span>({{ guild.displayUpgradeCost }})</span>
</button>
</section>
<section class="upgrade">
<UpgradesList :guild="guild" />
</section>
<section class="upgrade">
<span class="wipe-save" @click="$emit('wipeSave')">Wipe your save data</span>
</section>
</main>
</template>
<script lang="ts">
import {defineComponent} from "vue";
import type {PropType} from "vue";
import {Guild} from "@/classes/Guild";
import {version} from "../../package.json"
import UpgradesList from "@/components/UpgradesList.vue";
export default defineComponent({
name: "GuildView",
components: {UpgradesList},
data: () => {
return {
version: version,
}
},
props: {
guild: {
type: Object as PropType<Guild>,
default: () => new Guild(1, 0) as Guild,
},
}
});
</script>
<style lang="scss">
.title {
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
padding: 2.5rem;
text-align: center;
gap: 0.5rem;
h1 {
font-size: 4rem;
line-height: 0.75;
margin: 0;
}
h3 {
margin: 0;
line-height: 0.9;
}
small {
font-size: 0.9rem;
font-weight: bold;
line-height: 0.25;
}
}
.coffer {
text-align: center;
p {
font-size: 1.5rem;
font-weight: bold;
}
}
.upgrade {
text-align: center;
.wipe-save {
display: inline-flex;
font-weight: bold;
margin-block: 1rem;
color: #d52121;
cursor: pointer;
}
p {
margin: 0;
font-size: 1.5rem;
font-weight: bold;
}
}
</style>
-162
View File
@@ -1,162 +0,0 @@
<template>
<div class="guild" v-if="guild.level >= 7 && Object.keys(quests.S).length > 0">
<h1>Rank S Quests</h1>
<section class="missives">
<QuestMissive
v-for="(missive, key, index) in quests.S"
:key="key"
:adventurers="adventurers"
:missive="missive"
@click="finalizeQuest(missive)"
/>
</section>
</div>
<div class="guild" v-if="guild.level >= 6 && Object.keys(quests.A).length > 0">
<h1>Rank A Quests</h1>
<section class="missives">
<QuestMissive
v-for="(missive, key, index) in quests.A"
:key="key"
:adventurers="adventurers"
:missive="missive"
@click="finalizeQuest(missive)"
/>
</section>
</div>
<div class="guild" v-if="guild.level >= 5 && Object.keys(quests.B).length > 0">
<h1>Rank B Quests</h1>
<section class="missives">
<QuestMissive
v-for="(missive, key, index) in quests.B"
:key="key"
:adventurers="adventurers"
:missive="missive"
@click="finalizeQuest(missive)"
/>
</section>
</div>
<div class="guild" v-if="guild.level >= 4 && Object.keys(quests.C).length > 0">
<h1>Rank C Quests</h1>
<section class="missives">
<QuestMissive
v-for="(missive, key, index) in quests.C"
:key="key"
:adventurers="adventurers"
:missive="missive"
@click="finalizeQuest(missive)"
/>
</section>
</div>
<div class="guild" v-if="guild.level >= 3 && Object.keys(quests.D).length > 0">
<h1>Rank D Quests</h1>
<section class="missives">
<QuestMissive
v-for="(missive, key, index) in quests.D"
:key="key"
:adventurers="adventurers"
:missive="missive"
@click="finalizeQuest((missive))"
/>
</section>
</div>
<div class="guild" v-if="guild.level >= 2 && Object.keys(quests.E).length > 0">
<h1>Rank E Quests</h1>
<section class="missives">
<QuestMissive
v-for="(missive, key, index) in quests.E"
:key="key"
:adventurers="adventurers"
:missive="missive"
@click="finalizeQuest(missive)"
/>
</section>
</div>
<div class="guild" v-if="Object.keys(quests.F).length > 0">
<h1>Rank F Quests</h1>
<section class="missives">
<QuestMissive
v-for="(missive, key, index) in quests.F"
:key="key"
:adventurers="adventurers"
:missive="missive"
@click="finalizeQuest(missive)"
/>
</section>
</div>
</template>
<script lang="ts">
import {defineComponent, type PropType} from "vue";
import AdventurerComponent from "@/components/AdventurerMiniComponent.vue";
import type {Adventurer} from "@/classes/Adventurer";
import type {Quest} from "@/classes/Quest";
import {Guild} from "@/classes/Guild";
import QuestMissive from "@/components/QuestMissive.vue";
export default defineComponent({
name: "QuestView",
components: {QuestMissive, AdventurerComponent},
props: {
guild: {
type: Object as PropType<Guild>,
default() {
return new Guild(1, 0);
},
},
adventurers: {
type: Object as PropType<{ [key: string]: Adventurer }>,
default() {
return {} as { [key: string]: Adventurer };
},
},
quests: {
type: Object as PropType<{ [key: string]: Quest }>,
default() {
return {} as { [key: string]: Quest };
},
},
lastRecruitTime: {
type: Number as PropType<number>,
default() {
return 0;
}
},
},
emits: [ 'finalizeQuest', 'wipeSave', 'recruitActionTaken'],
methods: {
// This is a workaround for vue not reporting Quest as Quest in v-for
finalizeQuest(quest: any|Quest): void {
if (quest.progressPoints < quest.maxProgress) return;
this.$emit('finalizeQuest', quest)
},
}
})
</script>
<style lang="scss" scoped>
.guild {
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
width: 100%;
padding-bottom: 0.5rem;
h1 {
font-size: 3rem;
text-align: center;
}
.missives {
display: flex;
flex-direction: row;
flex-wrap: wrap;
width: calc(100% - 2rem);
justify-content: center;
align-items: stretch;
padding-inline: 1rem;
gap: 1rem;
}
}
</style>
-63
View File
@@ -1,63 +0,0 @@
<template>
<section class="technical-view">
<h1>Socials</h1>
<div class="socials">
<a class="link" href="https://discord.gg/j8KK5dGBps"><img class="icon" src="/img/icons/discord.svg" alt="Discord" />Discord</a>
<a class="link" href="https://github.com/YouHaveTrouble/GuildMaster"><img class="icon" src="/img/icons/github.svg" alt="GitHub" />GitHub</a>
</div>
<ChangelogComponent/>
</section>
</template>
<script lang="ts">
import {defineComponent} from "vue";
import ChangelogComponent from "@/components/ChangelogComponent.vue";
export default defineComponent({
name: "TechnicalView",
components: {ChangelogComponent},
})
</script>
<style lang="scss" scoped>
.technical-view {
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
gap: 1rem;
padding-block: 1rem;
h1 {
font-size: 3rem;
line-height: 1;
margin: 0;
}
.socials {
display: flex;
flex-direction: row;
justify-content: center;
align-items: center;
gap: 1rem;
}
.link {
display: flex;
flex-direction: row;
justify-content: center;
align-items: center;
flex-wrap: wrap;
gap: 0.05rem;
text-decoration: underline;
font-size: 1.5rem;
color: #000;
font-weight: bold;
}
.icon {
width: 2rem;
height: 2rem;
}
}
</style>
-8
View File
@@ -1,8 +0,0 @@
{
"extends": "@vue/tsconfig/tsconfig.node.json",
"include": ["vite.config.*", "vitest.config.*", "cypress.config.*", "playwright.config.*"],
"compilerOptions": {
"composite": true,
"types": ["node"]
}
}
-16
View File
@@ -1,16 +0,0 @@
{
"extends": "@vue/tsconfig/tsconfig.web.json",
"include": ["env.d.ts", "src/**/*", "src/**/*.vue"],
"compilerOptions": {
"baseUrl": ".",
"paths": {
"@/*": ["./src/*"]
}
},
"references": [
{
"path": "./tsconfig.config.json"
}
]
}
-15
View File
@@ -1,15 +0,0 @@
import { fileURLToPath, URL } from 'node:url'
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
// https://vitejs.dev/config/
export default defineConfig({
plugins: [vue()],
resolve: {
alias: {
'@': fileURLToPath(new URL('./src', import.meta.url))
}
},
base: "/"
})