First initial commit

This commit is contained in:
2025-09-23 12:34:08 +00:00
commit 5b7e133d76
29 changed files with 7541 additions and 0 deletions

View File

@@ -0,0 +1,11 @@
{
"permissions": {
"allow": [
"WebFetch(domain:oldschool.runescape.wiki)",
"Bash(npx create-next-app:*)",
"Bash(npm run dev:*)"
],
"deny": [],
"ask": []
}
}

41
osrs-grid-master/.gitignore vendored Normal file
View File

@@ -0,0 +1,41 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
# dependencies
/node_modules
/.pnp
.pnp.*
.yarn/*
!.yarn/patches
!.yarn/plugins
!.yarn/releases
!.yarn/versions
# testing
/coverage
# next.js
/.next/
/out/
# production
/build
# misc
.DS_Store
*.pem
# debug
npm-debug.log*
yarn-debug.log*
yarn-error.log*
.pnpm-debug.log*
# env files (can opt-in for committing if needed)
.env*
# vercel
.vercel
# typescript
*.tsbuildinfo
next-env.d.ts

View File

@@ -0,0 +1,36 @@
This is a [Next.js](https://nextjs.org) project bootstrapped with [`create-next-app`](https://nextjs.org/docs/app/api-reference/cli/create-next-app).
## Getting Started
First, run the development server:
```bash
npm run dev
# or
yarn dev
# or
pnpm dev
# or
bun dev
```
Open [http://localhost:3000](http://localhost:3000) with your browser to see the result.
You can start editing the page by modifying `app/page.tsx`. The page auto-updates as you edit the file.
This project uses [`next/font`](https://nextjs.org/docs/app/building-your-application/optimizing/fonts) to automatically optimize and load [Geist](https://vercel.com/font), a new font family for Vercel.
## Learn More
To learn more about Next.js, take a look at the following resources:
- [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js features and API.
- [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial.
You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js) - your feedback and contributions are welcome!
## Deploy on Vercel
The easiest way to deploy your Next.js app is to use the [Vercel Platform](https://vercel.com/new?utm_medium=default-template&filter=next.js&utm_source=create-next-app&utm_campaign=create-next-app-readme) from the creators of Next.js.
Check out our [Next.js deployment documentation](https://nextjs.org/docs/app/building-your-application/deploying) for more details.

View File

@@ -0,0 +1,502 @@
{
"nice-ladder-travels": {
"username": "",
"passphrase": "nice-ladder-travels",
"tasks": [
{
"id": "0-0",
"title": "First Steps",
"description": "Complete Tutorial Island",
"difficulty": "easy",
"points": 1,
"completed": false,
"row": 0,
"col": 0
},
{
"id": "0-1",
"title": "Combat Ready",
"description": "Reach 10 Attack",
"difficulty": "easy",
"points": 1,
"completed": false,
"row": 0,
"col": 1
},
{
"id": "0-2",
"title": "Magic Apprentice",
"description": "Reach 10 Magic",
"difficulty": "easy",
"points": 1,
"completed": false,
"row": 0,
"col": 2
},
{
"id": "0-3",
"title": "Archer Training",
"description": "Reach 10 Ranged",
"difficulty": "easy",
"points": 1,
"completed": false,
"row": 0,
"col": 3
},
{
"id": "0-4",
"title": "Prayer Novice",
"description": "Reach 10 Prayer",
"difficulty": "easy",
"points": 1,
"completed": false,
"row": 0,
"col": 4
},
{
"id": "0-5",
"title": "Crafting Start",
"description": "Reach 10 Crafting",
"difficulty": "easy",
"points": 1,
"completed": false,
"row": 0,
"col": 5
},
{
"id": "0-6",
"title": "Cook's Assistant",
"description": "Complete Cook's Assistant quest",
"difficulty": "easy",
"points": 2,
"completed": false,
"row": 0,
"col": 6
},
{
"id": "1-0",
"title": "Quest Points",
"description": "Earn 10 Quest Points",
"difficulty": "easy",
"points": 2,
"completed": false,
"row": 1,
"col": 0
},
{
"id": "1-1",
"title": "Combat Training",
"description": "Reach 20 Attack",
"difficulty": "medium",
"points": 2,
"completed": false,
"row": 1,
"col": 1
},
{
"id": "1-2",
"title": "Mage Training",
"description": "Reach 20 Magic",
"difficulty": "medium",
"points": 2,
"completed": false,
"row": 1,
"col": 2
},
{
"id": "1-3",
"title": "Archer Progress",
"description": "Reach 20 Ranged",
"difficulty": "medium",
"points": 2,
"completed": false,
"row": 1,
"col": 3
},
{
"id": "1-4",
"title": "Holy Training",
"description": "Reach 20 Prayer",
"difficulty": "medium",
"points": 2,
"completed": false,
"row": 1,
"col": 4
},
{
"id": "1-5",
"title": "Artisan Skills",
"description": "Reach 20 Crafting",
"difficulty": "medium",
"points": 2,
"completed": false,
"row": 1,
"col": 5
},
{
"id": "1-6",
"title": "Demon Slayer",
"description": "Complete Demon Slayer quest",
"difficulty": "medium",
"points": 3,
"completed": false,
"row": 1,
"col": 6
},
{
"id": "2-0",
"title": "Quest Master",
"description": "Earn 25 Quest Points",
"difficulty": "medium",
"points": 3,
"completed": false,
"row": 2,
"col": 0
},
{
"id": "2-1",
"title": "Warrior",
"description": "Reach 30 Attack",
"difficulty": "medium",
"points": 3,
"completed": false,
"row": 2,
"col": 1
},
{
"id": "2-2",
"title": "Wizard",
"description": "Reach 30 Magic",
"difficulty": "medium",
"points": 3,
"completed": false,
"row": 2,
"col": 2
},
{
"id": "2-3",
"title": "Marksman",
"description": "Reach 30 Ranged",
"difficulty": "medium",
"points": 3,
"completed": false,
"row": 2,
"col": 3
},
{
"id": "2-4",
"title": "Devout",
"description": "Reach 30 Prayer",
"difficulty": "medium",
"points": 3,
"completed": false,
"row": 2,
"col": 4
},
{
"id": "2-5",
"title": "Artisan",
"description": "Reach 30 Crafting",
"difficulty": "medium",
"points": 3,
"completed": false,
"row": 2,
"col": 5
},
{
"id": "2-6",
"title": "Vampire Slayer",
"description": "Complete Vampire Slayer quest",
"difficulty": "medium",
"points": 3,
"completed": false,
"row": 2,
"col": 6
},
{
"id": "3-0",
"title": "Quest Veteran",
"description": "Earn 50 Quest Points",
"difficulty": "hard",
"points": 4,
"completed": false,
"row": 3,
"col": 0
},
{
"id": "3-1",
"title": "Elite Warrior",
"description": "Reach 40 Attack",
"difficulty": "hard",
"points": 4,
"completed": false,
"row": 3,
"col": 1
},
{
"id": "3-2",
"title": "Elite Mage",
"description": "Reach 40 Magic",
"difficulty": "hard",
"points": 4,
"completed": false,
"row": 3,
"col": 2
},
{
"id": "3-3",
"title": "Elite Archer",
"description": "Reach 40 Ranged",
"difficulty": "hard",
"points": 4,
"completed": false,
"row": 3,
"col": 3
},
{
"id": "3-4",
"title": "High Priest",
"description": "Reach 43 Prayer",
"difficulty": "hard",
"points": 4,
"completed": false,
"row": 3,
"col": 4
},
{
"id": "3-5",
"title": "Master Crafter",
"description": "Reach 40 Crafting",
"difficulty": "hard",
"points": 4,
"completed": false,
"row": 3,
"col": 5
},
{
"id": "3-6",
"title": "Dragon Slayer",
"description": "Complete Dragon Slayer I",
"difficulty": "hard",
"points": 5,
"completed": false,
"row": 3,
"col": 6
},
{
"id": "4-0",
"title": "Quest Champion",
"description": "Earn 100 Quest Points",
"difficulty": "hard",
"points": 5,
"completed": false,
"row": 4,
"col": 0
},
{
"id": "4-1",
"title": "Rune Warrior",
"description": "Reach 50 Attack",
"difficulty": "hard",
"points": 5,
"completed": false,
"row": 4,
"col": 1
},
{
"id": "4-2",
"title": "High Mage",
"description": "Reach 50 Magic",
"difficulty": "hard",
"points": 5,
"completed": false,
"row": 4,
"col": 2
},
{
"id": "4-3",
"title": "Master Archer",
"description": "Reach 50 Ranged",
"difficulty": "hard",
"points": 5,
"completed": false,
"row": 4,
"col": 3
},
{
"id": "4-4",
"title": "Prayer Master",
"description": "Reach 50 Prayer",
"difficulty": "hard",
"points": 5,
"completed": false,
"row": 4,
"col": 4
},
{
"id": "4-5",
"title": "Craft Master",
"description": "Reach 50 Crafting",
"difficulty": "hard",
"points": 5,
"completed": false,
"row": 4,
"col": 5
},
{
"id": "4-6",
"title": "Barrows Gloves",
"description": "Complete Recipe for Disaster",
"difficulty": "expert",
"points": 8,
"completed": false,
"row": 4,
"col": 6
},
{
"id": "5-0",
"title": "Quest Legend",
"description": "Earn 150 Quest Points",
"difficulty": "expert",
"points": 6,
"completed": false,
"row": 5,
"col": 0
},
{
"id": "5-1",
"title": "Dragon Warrior",
"description": "Reach 60 Attack",
"difficulty": "expert",
"points": 6,
"completed": false,
"row": 5,
"col": 1
},
{
"id": "5-2",
"title": "Ancient Mage",
"description": "Reach 60 Magic",
"difficulty": "expert",
"points": 6,
"completed": false,
"row": 5,
"col": 2
},
{
"id": "5-3",
"title": "Expert Archer",
"description": "Reach 60 Ranged",
"difficulty": "expert",
"points": 6,
"completed": false,
"row": 5,
"col": 3
},
{
"id": "5-4",
"title": "Holy Master",
"description": "Reach 60 Prayer",
"difficulty": "expert",
"points": 6,
"completed": false,
"row": 5,
"col": 4
},
{
"id": "5-5",
"title": "Elite Crafter",
"description": "Reach 60 Crafting",
"difficulty": "expert",
"points": 6,
"completed": false,
"row": 5,
"col": 5
},
{
"id": "5-6",
"title": "Fire Cape",
"description": "Obtain Fire Cape from Fight Caves",
"difficulty": "expert",
"points": 10,
"completed": false,
"row": 5,
"col": 6
},
{
"id": "6-0",
"title": "Quest Grandmaster",
"description": "Earn 200 Quest Points",
"difficulty": "expert",
"points": 8,
"completed": false,
"row": 6,
"col": 0
},
{
"id": "6-1",
"title": "Whip Master",
"description": "Reach 70 Attack",
"difficulty": "expert",
"points": 8,
"completed": false,
"row": 6,
"col": 1
},
{
"id": "6-2",
"title": "Arcane Master",
"description": "Reach 70 Magic",
"difficulty": "expert",
"points": 8,
"completed": false,
"row": 6,
"col": 2
},
{
"id": "6-3",
"title": "Legendary Archer",
"description": "Reach 70 Ranged",
"difficulty": "expert",
"points": 8,
"completed": false,
"row": 6,
"col": 3
},
{
"id": "6-4",
"title": "Divine Master",
"description": "Reach 70 Prayer",
"difficulty": "expert",
"points": 8,
"completed": false,
"row": 6,
"col": 4
},
{
"id": "6-5",
"title": "Legendary Crafter",
"description": "Reach 70 Crafting",
"difficulty": "expert",
"points": 8,
"completed": false,
"row": 6,
"col": 5
},
{
"id": "6-6",
"title": "ToA Completion",
"description": "Complete Tombs of Amascut",
"difficulty": "expert",
"points": 15,
"completed": false,
"row": 6,
"col": 6
}
],
"totalPoints": 0,
"completedRows": [],
"completedCols": [],
"lastUpdated": "2025-09-23T12:24:55.517Z"
}
}

View File

@@ -0,0 +1,25 @@
import { dirname } from "path";
import { fileURLToPath } from "url";
import { FlatCompat } from "@eslint/eslintrc";
const __filename = fileURLToPath(import.meta.url);
const __dirname = dirname(__filename);
const compat = new FlatCompat({
baseDirectory: __dirname,
});
const eslintConfig = [
...compat.extends("next/core-web-vitals", "next/typescript"),
{
ignores: [
"node_modules/**",
".next/**",
"out/**",
"build/**",
"next-env.d.ts",
],
},
];
export default eslintConfig;

View File

@@ -0,0 +1,7 @@
import type { NextConfig } from "next";
const nextConfig: NextConfig = {
/* config options here */
};
export default nextConfig;

5694
osrs-grid-master/package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,27 @@
{
"name": "osrs-grid-master",
"version": "0.1.0",
"private": true,
"scripts": {
"dev": "next dev --turbopack",
"build": "next build --turbopack",
"start": "next start",
"lint": "eslint"
},
"dependencies": {
"react": "19.1.0",
"react-dom": "19.1.0",
"next": "15.5.3"
},
"devDependencies": {
"typescript": "^5",
"@types/node": "^20",
"@types/react": "^19",
"@types/react-dom": "^19",
"@tailwindcss/postcss": "^4",
"tailwindcss": "^4",
"eslint": "^9",
"eslint-config-next": "15.5.3",
"@eslint/eslintrc": "^3"
}
}

View File

@@ -0,0 +1,5 @@
const config = {
plugins: ["@tailwindcss/postcss"],
};
export default config;

View File

@@ -0,0 +1 @@
<svg fill="none" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg"><path d="M14.5 13.5V5.41a1 1 0 0 0-.3-.7L9.8.29A1 1 0 0 0 9.08 0H1.5v13.5A2.5 2.5 0 0 0 4 16h8a2.5 2.5 0 0 0 2.5-2.5m-1.5 0v-7H8v-5H3v12a1 1 0 0 0 1 1h8a1 1 0 0 0 1-1M9.5 5V2.12L12.38 5zM5.13 5h-.62v1.25h2.12V5zm-.62 3h7.12v1.25H4.5zm.62 3h-.62v1.25h7.12V11z" clip-rule="evenodd" fill="#666" fill-rule="evenodd"/></svg>

After

Width:  |  Height:  |  Size: 391 B

View File

@@ -0,0 +1 @@
<svg fill="none" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><g clip-path="url(#a)"><path fill-rule="evenodd" clip-rule="evenodd" d="M10.27 14.1a6.5 6.5 0 0 0 3.67-3.45q-1.24.21-2.7.34-.31 1.83-.97 3.1M8 16A8 8 0 1 0 8 0a8 8 0 0 0 0 16m.48-1.52a7 7 0 0 1-.96 0H7.5a4 4 0 0 1-.84-1.32q-.38-.89-.63-2.08a40 40 0 0 0 3.92 0q-.25 1.2-.63 2.08a4 4 0 0 1-.84 1.31zm2.94-4.76q1.66-.15 2.95-.43a7 7 0 0 0 0-2.58q-1.3-.27-2.95-.43a18 18 0 0 1 0 3.44m-1.27-3.54a17 17 0 0 1 0 3.64 39 39 0 0 1-4.3 0 17 17 0 0 1 0-3.64 39 39 0 0 1 4.3 0m1.1-1.17q1.45.13 2.69.34a6.5 6.5 0 0 0-3.67-3.44q.65 1.26.98 3.1M8.48 1.5l.01.02q.41.37.84 1.31.38.89.63 2.08a40 40 0 0 0-3.92 0q.25-1.2.63-2.08a4 4 0 0 1 .85-1.32 7 7 0 0 1 .96 0m-2.75.4a6.5 6.5 0 0 0-3.67 3.44 29 29 0 0 1 2.7-.34q.31-1.83.97-3.1M4.58 6.28q-1.66.16-2.95.43a7 7 0 0 0 0 2.58q1.3.27 2.95.43a18 18 0 0 1 0-3.44m.17 4.71q-1.45-.12-2.69-.34a6.5 6.5 0 0 0 3.67 3.44q-.65-1.27-.98-3.1" fill="#666"/></g><defs><clipPath id="a"><path fill="#fff" d="M0 0h16v16H0z"/></clipPath></defs></svg>

After

Width:  |  Height:  |  Size: 1.0 KiB

View File

@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 394 80"><path fill="#000" d="M262 0h68.5v12.7h-27.2v66.6h-13.6V12.7H262V0ZM149 0v12.7H94v20.4h44.3v12.6H94v21h55v12.6H80.5V0h68.7zm34.3 0h-17.8l63.8 79.4h17.9l-32-39.7 32-39.6h-17.9l-23 28.6-23-28.6zm18.3 56.7-9-11-27.1 33.7h17.8l18.3-22.7z"/><path fill="#000" d="M81 79.3 17 0H0v79.3h13.6V17l50.2 62.3H81Zm252.6-.4c-1 0-1.8-.4-2.5-1s-1.1-1.6-1.1-2.6.3-1.8 1-2.5 1.6-1 2.6-1 1.8.3 2.5 1a3.4 3.4 0 0 1 .6 4.3 3.7 3.7 0 0 1-3 1.8zm23.2-33.5h6v23.3c0 2.1-.4 4-1.3 5.5a9.1 9.1 0 0 1-3.8 3.5c-1.6.8-3.5 1.3-5.7 1.3-2 0-3.7-.4-5.3-1s-2.8-1.8-3.7-3.2c-.9-1.3-1.4-3-1.4-5h6c.1.8.3 1.6.7 2.2s1 1.2 1.6 1.5c.7.4 1.5.5 2.4.5 1 0 1.8-.2 2.4-.6a4 4 0 0 0 1.6-1.8c.3-.8.5-1.8.5-3V45.5zm30.9 9.1a4.4 4.4 0 0 0-2-3.3 7.5 7.5 0 0 0-4.3-1.1c-1.3 0-2.4.2-3.3.5-.9.4-1.6 1-2 1.6a3.5 3.5 0 0 0-.3 4c.3.5.7.9 1.3 1.2l1.8 1 2 .5 3.2.8c1.3.3 2.5.7 3.7 1.2a13 13 0 0 1 3.2 1.8 8.1 8.1 0 0 1 3 6.5c0 2-.5 3.7-1.5 5.1a10 10 0 0 1-4.4 3.5c-1.8.8-4.1 1.2-6.8 1.2-2.6 0-4.9-.4-6.8-1.2-2-.8-3.4-2-4.5-3.5a10 10 0 0 1-1.7-5.6h6a5 5 0 0 0 3.5 4.6c1 .4 2.2.6 3.4.6 1.3 0 2.5-.2 3.5-.6 1-.4 1.8-1 2.4-1.7a4 4 0 0 0 .8-2.4c0-.9-.2-1.6-.7-2.2a11 11 0 0 0-2.1-1.4l-3.2-1-3.8-1c-2.8-.7-5-1.7-6.6-3.2a7.2 7.2 0 0 1-2.4-5.7 8 8 0 0 1 1.7-5 10 10 0 0 1 4.3-3.5c2-.8 4-1.2 6.4-1.2 2.3 0 4.4.4 6.2 1.2 1.8.8 3.2 2 4.3 3.4 1 1.4 1.5 3 1.5 5h-5.8z"/></svg>

After

Width:  |  Height:  |  Size: 1.3 KiB

View File

@@ -0,0 +1 @@
<svg fill="none" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1155 1000"><path d="m577.3 0 577.4 1000H0z" fill="#fff"/></svg>

After

Width:  |  Height:  |  Size: 128 B

View File

@@ -0,0 +1 @@
<svg fill="none" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><path fill-rule="evenodd" clip-rule="evenodd" d="M1.5 2.5h13v10a1 1 0 0 1-1 1h-11a1 1 0 0 1-1-1zM0 1h16v11.5a2.5 2.5 0 0 1-2.5 2.5h-11A2.5 2.5 0 0 1 0 12.5zm3.75 4.5a.75.75 0 1 0 0-1.5.75.75 0 0 0 0 1.5M7 4.75a.75.75 0 1 1-1.5 0 .75.75 0 0 1 1.5 0m1.75.75a.75.75 0 1 0 0-1.5.75.75 0 0 0 0 1.5" fill="#666"/></svg>

After

Width:  |  Height:  |  Size: 385 B

View File

@@ -0,0 +1,35 @@
import { NextRequest, NextResponse } from 'next/server';
export async function GET(request: NextRequest) {
const { searchParams } = new URL(request.url);
const username = searchParams.get('username');
if (!username) {
return NextResponse.json({ error: 'Username is required' }, { status: 400 });
}
try {
const response = await fetch(
`https://secure.runescape.com/m=hiscore_oldschool/index_lite.ws?player=${encodeURIComponent(username)}`,
{
headers: {
'User-Agent': 'OSRS Grid Master Tracker',
},
}
);
if (!response.ok) {
return NextResponse.json({ error: 'Player not found' }, { status: 404 });
}
const data = await response.text();
return new NextResponse(data, {
headers: {
'Content-Type': 'text/plain',
},
});
} catch (error) {
console.error('Error fetching hiscores:', error);
return NextResponse.json({ error: 'Failed to fetch player data' }, { status: 500 });
}
}

View File

@@ -0,0 +1,103 @@
import { NextRequest, NextResponse } from 'next/server';
import { promises as fs } from 'fs';
import path from 'path';
import { UserProgress } from '@/types/osrs';
const DATA_DIR = path.join(process.cwd(), 'data');
const PROGRESS_FILE = path.join(DATA_DIR, 'user-progress.json');
async function ensureDataDir() {
try {
await fs.access(DATA_DIR);
} catch {
await fs.mkdir(DATA_DIR, { recursive: true });
}
}
async function loadProgressData(): Promise<Record<string, UserProgress>> {
try {
await ensureDataDir();
const data = await fs.readFile(PROGRESS_FILE, 'utf-8');
return JSON.parse(data);
} catch {
return {};
}
}
async function saveProgressData(data: Record<string, UserProgress>) {
await ensureDataDir();
await fs.writeFile(PROGRESS_FILE, JSON.stringify(data, null, 2));
}
export async function GET(request: NextRequest) {
const { searchParams } = new URL(request.url);
const passphrase = searchParams.get('passphrase');
if (!passphrase) {
return NextResponse.json({ error: 'Passphrase is required' }, { status: 400 });
}
try {
const progressData = await loadProgressData();
const userProgress = progressData[passphrase];
if (!userProgress) {
return NextResponse.json({ error: 'Progress not found' }, { status: 404 });
}
return NextResponse.json(userProgress);
} catch (error) {
console.error('Error loading progress:', error);
return NextResponse.json({ error: 'Failed to load progress' }, { status: 500 });
}
}
export async function POST(request: NextRequest) {
try {
const body = await request.json();
const { passphrase, progress }: { passphrase: string; progress: UserProgress } = body;
if (!passphrase || !progress) {
return NextResponse.json({ error: 'Passphrase and progress are required' }, { status: 400 });
}
const progressData = await loadProgressData();
progressData[passphrase] = {
...progress,
passphrase,
lastUpdated: new Date().toISOString(),
};
await saveProgressData(progressData);
return NextResponse.json({ success: true, progress: progressData[passphrase] });
} catch (error) {
console.error('Error saving progress:', error);
return NextResponse.json({ error: 'Failed to save progress' }, { status: 500 });
}
}
export async function DELETE(request: NextRequest) {
const { searchParams } = new URL(request.url);
const passphrase = searchParams.get('passphrase');
if (!passphrase) {
return NextResponse.json({ error: 'Passphrase is required' }, { status: 400 });
}
try {
const progressData = await loadProgressData();
if (!progressData[passphrase]) {
return NextResponse.json({ error: 'Progress not found' }, { status: 404 });
}
delete progressData[passphrase];
await saveProgressData(progressData);
return NextResponse.json({ success: true });
} catch (error) {
console.error('Error deleting progress:', error);
return NextResponse.json({ error: 'Failed to delete progress' }, { status: 500 });
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

View File

@@ -0,0 +1,26 @@
@import "tailwindcss";
:root {
--background: #ffffff;
--foreground: #171717;
}
@theme inline {
--color-background: var(--background);
--color-foreground: var(--foreground);
--font-sans: var(--font-geist-sans);
--font-mono: var(--font-geist-mono);
}
@media (prefers-color-scheme: dark) {
:root {
--background: #0a0a0a;
--foreground: #ededed;
}
}
body {
background: var(--background);
color: var(--foreground);
font-family: Arial, Helvetica, sans-serif;
}

View File

@@ -0,0 +1,34 @@
import type { Metadata } from "next";
import { Geist, Geist_Mono } from "next/font/google";
import "./globals.css";
const geistSans = Geist({
variable: "--font-geist-sans",
subsets: ["latin"],
});
const geistMono = Geist_Mono({
variable: "--font-geist-mono",
subsets: ["latin"],
});
export const metadata: Metadata = {
title: "Create Next App",
description: "Generated by create next app",
};
export default function RootLayout({
children,
}: Readonly<{
children: React.ReactNode;
}>) {
return (
<html lang="en">
<body
className={`${geistSans.variable} ${geistMono.variable} antialiased`}
>
{children}
</body>
</html>
);
}

View File

@@ -0,0 +1,182 @@
'use client';
import { useState, useEffect } from 'react';
import CharacterLookup from '@/components/CharacterLookup';
import PassphraseLogin from '@/components/PassphraseLogin';
import GridMaster from '@/components/GridMaster';
import { UserProgress, OSRSHiscoreStats, GridTask } from '@/types/osrs';
import { defaultGridTasks } from '@/data/grid-tasks';
import { saveProgress, loadProgress } from '@/lib/progress-api';
export default function Home() {
const [currentPassphrase, setCurrentPassphrase] = useState<string>('');
const [userProgress, setUserProgress] = useState<UserProgress | null>(null);
const [currentPlayer, setCurrentPlayer] = useState<string>('');
const [playerStats, setPlayerStats] = useState<OSRSHiscoreStats | null>(null);
const [saving, setSaving] = useState(false);
useEffect(() => {
if (currentPassphrase) {
loadUserProgress();
}
}, [currentPassphrase]);
const loadUserProgress = async () => {
const progress = await loadProgress(currentPassphrase);
if (progress) {
setUserProgress(progress);
setCurrentPlayer(progress.username);
} else {
const newProgress: UserProgress = {
username: '',
passphrase: currentPassphrase,
tasks: defaultGridTasks,
totalPoints: 0,
completedRows: [],
completedCols: [],
lastUpdated: new Date().toISOString(),
};
setUserProgress(newProgress);
}
};
const handleLogin = (passphrase: string) => {
if (passphrase === '') {
setCurrentPassphrase('');
setUserProgress(null);
setCurrentPlayer('');
setPlayerStats(null);
} else {
setCurrentPassphrase(passphrase);
}
};
const handlePlayerFound = (username: string, stats: OSRSHiscoreStats) => {
setCurrentPlayer(username);
setPlayerStats(stats);
if (userProgress) {
const updatedProgress = {
...userProgress,
username,
};
setUserProgress(updatedProgress);
saveUserProgress(updatedProgress);
}
};
const saveUserProgress = async (progress: UserProgress) => {
if (!currentPassphrase) return;
setSaving(true);
await saveProgress(currentPassphrase, progress);
setSaving(false);
};
const handleTaskToggle = (taskId: string) => {
if (!userProgress) return;
const updatedTasks = userProgress.tasks.map(task =>
task.id === taskId ? { ...task, completed: !task.completed } : task
);
const getCompletedRows = (tasks: GridTask[]) => {
const completedRows: number[] = [];
for (let row = 0; row < 7; row++) {
const rowTasks = tasks.filter(task => task.row === row);
if (rowTasks.every(task => task.completed)) {
completedRows.push(row);
}
}
return completedRows;
};
const getCompletedCols = (tasks: GridTask[]) => {
const completedCols: number[] = [];
for (let col = 0; col < 7; col++) {
const colTasks = tasks.filter(task => task.col === col);
if (colTasks.every(task => task.completed)) {
completedCols.push(col);
}
}
return completedCols;
};
const getTotalPoints = (tasks: GridTask[]) => {
return tasks.reduce((total, task) => {
if (task.completed) {
return total + task.points;
}
return total;
}, 0);
};
const updatedProgress: UserProgress = {
...userProgress,
tasks: updatedTasks,
totalPoints: getTotalPoints(updatedTasks),
completedRows: getCompletedRows(updatedTasks),
completedCols: getCompletedCols(updatedTasks),
lastUpdated: new Date().toISOString(),
};
setUserProgress(updatedProgress);
saveUserProgress(updatedProgress);
};
return (
<div className="min-h-screen bg-gray-100 py-8">
<div className="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8">
<div className="text-center mb-8">
<h1 className="text-4xl font-bold text-gray-900 mb-2">
OSRS Grid Master Tracker
</h1>
<p className="text-lg text-gray-600">
Track your progress for the Grid Master event (Oct 15 - Nov 12, 2025)
</p>
{saving && (
<div className="mt-2 text-sm text-blue-600">
Saving progress...
</div>
)}
</div>
<div className="space-y-8">
{!currentPassphrase ? (
<PassphraseLogin onLogin={handleLogin} onGenerate={handleLogin} />
) : (
<>
<PassphraseLogin
onLogin={handleLogin}
onGenerate={handleLogin}
currentPassphrase={currentPassphrase}
/>
<CharacterLookup onPlayerFound={handlePlayerFound} />
{userProgress && (
<GridMaster
tasks={userProgress.tasks}
onTaskToggle={handleTaskToggle}
/>
)}
{currentPlayer && (
<div className="bg-white rounded-lg shadow-md p-6">
<h3 className="text-lg font-semibold text-gray-800 mb-2">
Current Player: {currentPlayer}
</h3>
{userProgress && (
<p className="text-gray-600">
Progress last updated: {new Date(userProgress.lastUpdated).toLocaleString()}
</p>
)}
</div>
)}
</>
)}
</div>
</div>
</div>
);
}

View File

@@ -0,0 +1,202 @@
'use client';
import { useState } from 'react';
import { OSRSHiscoreStats } from '@/types/osrs';
import { fetchPlayerStats } from '@/lib/osrs-api';
interface CharacterLookupProps {
onPlayerFound?: (username: string, stats: OSRSHiscoreStats) => void;
}
export default function CharacterLookup({ onPlayerFound }: CharacterLookupProps) {
const [username, setUsername] = useState('');
const [loading, setLoading] = useState(false);
const [stats, setStats] = useState<OSRSHiscoreStats | null>(null);
const [error, setError] = useState<string | null>(null);
const handleLookup = async (e: React.FormEvent) => {
e.preventDefault();
if (!username.trim()) return;
setLoading(true);
setError(null);
setStats(null);
const playerStats = await fetchPlayerStats(username.trim());
if (playerStats) {
setStats(playerStats);
onPlayerFound?.(username.trim(), playerStats);
} else {
setError('Player not found or error fetching data');
}
setLoading(false);
};
return (
<div className="bg-white rounded-lg shadow-md p-6">
<h2 className="text-2xl font-bold mb-4 text-gray-800">Character Lookup</h2>
<form onSubmit={handleLookup} className="mb-4">
<div className="flex gap-2">
<input
type="text"
value={username}
onChange={(e) => setUsername(e.target.value)}
placeholder="Enter OSRS username"
className="flex-1 px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500"
disabled={loading}
/>
<button
type="submit"
disabled={loading || !username.trim()}
className="px-6 py-2 bg-blue-600 text-white rounded-md hover:bg-blue-700 disabled:bg-gray-400 disabled:cursor-not-allowed"
>
{loading ? 'Loading...' : 'Lookup'}
</button>
</div>
</form>
{error && (
<div className="mb-4 p-3 bg-red-100 border border-red-300 text-red-700 rounded-md">
{error}
</div>
)}
{stats && (
<div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4">
<div className="bg-gray-50 p-4 rounded-lg">
<h3 className="font-semibold text-gray-800 mb-2">Combat Stats</h3>
<div className="space-y-1 text-sm">
<div className="flex justify-between">
<span>Attack:</span>
<span className="font-medium">{stats.attack.level}</span>
</div>
<div className="flex justify-between">
<span>Strength:</span>
<span className="font-medium">{stats.strength.level}</span>
</div>
<div className="flex justify-between">
<span>Defence:</span>
<span className="font-medium">{stats.defence.level}</span>
</div>
<div className="flex justify-between">
<span>Hitpoints:</span>
<span className="font-medium">{stats.hitpoints.level}</span>
</div>
<div className="flex justify-between">
<span>Ranged:</span>
<span className="font-medium">{stats.ranged.level}</span>
</div>
<div className="flex justify-between">
<span>Magic:</span>
<span className="font-medium">{stats.magic.level}</span>
</div>
<div className="flex justify-between">
<span>Prayer:</span>
<span className="font-medium">{stats.prayer.level}</span>
</div>
</div>
</div>
<div className="bg-gray-50 p-4 rounded-lg">
<h3 className="font-semibold text-gray-800 mb-2">Artisan Skills</h3>
<div className="space-y-1 text-sm">
<div className="flex justify-between">
<span>Cooking:</span>
<span className="font-medium">{stats.cooking.level}</span>
</div>
<div className="flex justify-between">
<span>Woodcutting:</span>
<span className="font-medium">{stats.woodcutting.level}</span>
</div>
<div className="flex justify-between">
<span>Fletching:</span>
<span className="font-medium">{stats.fletching.level}</span>
</div>
<div className="flex justify-between">
<span>Fishing:</span>
<span className="font-medium">{stats.fishing.level}</span>
</div>
<div className="flex justify-between">
<span>Firemaking:</span>
<span className="font-medium">{stats.firemaking.level}</span>
</div>
<div className="flex justify-between">
<span>Crafting:</span>
<span className="font-medium">{stats.crafting.level}</span>
</div>
<div className="flex justify-between">
<span>Smithing:</span>
<span className="font-medium">{stats.smithing.level}</span>
</div>
</div>
</div>
<div className="bg-gray-50 p-4 rounded-lg">
<h3 className="font-semibold text-gray-800 mb-2">Other Skills</h3>
<div className="space-y-1 text-sm">
<div className="flex justify-between">
<span>Mining:</span>
<span className="font-medium">{stats.mining.level}</span>
</div>
<div className="flex justify-between">
<span>Herblore:</span>
<span className="font-medium">{stats.herblore.level}</span>
</div>
<div className="flex justify-between">
<span>Agility:</span>
<span className="font-medium">{stats.agility.level}</span>
</div>
<div className="flex justify-between">
<span>Thieving:</span>
<span className="font-medium">{stats.thieving.level}</span>
</div>
<div className="flex justify-between">
<span>Slayer:</span>
<span className="font-medium">{stats.slayer.level}</span>
</div>
<div className="flex justify-between">
<span>Farming:</span>
<span className="font-medium">{stats.farming.level}</span>
</div>
<div className="flex justify-between">
<span>Runecraft:</span>
<span className="font-medium">{stats.runecraft.level}</span>
</div>
<div className="flex justify-between">
<span>Hunter:</span>
<span className="font-medium">{stats.hunter.level}</span>
</div>
<div className="flex justify-between">
<span>Construction:</span>
<span className="font-medium">{stats.construction.level}</span>
</div>
</div>
</div>
<div className="bg-blue-50 p-4 rounded-lg md:col-span-2 lg:col-span-3">
<h3 className="font-semibold text-gray-800 mb-2">Overall</h3>
<div className="flex justify-between items-center">
<span>Total Level:</span>
<span className="text-xl font-bold text-blue-600">{stats.overall.level}</span>
</div>
<div className="flex justify-between items-center">
<span>Total XP:</span>
<span className="text-lg font-semibold text-blue-600">
{stats.overall.xp.toLocaleString()}
</span>
</div>
<div className="flex justify-between items-center">
<span>Rank:</span>
<span className="text-lg font-semibold text-blue-600">
{stats.overall.rank > 0 ? stats.overall.rank.toLocaleString() : 'Unranked'}
</span>
</div>
</div>
</div>
)}
</div>
);
}

View File

@@ -0,0 +1,186 @@
'use client';
import { useState, useEffect } from 'react';
import { GridTask } from '@/types/osrs';
import { defaultGridTasks } from '@/data/grid-tasks';
interface GridMasterProps {
tasks?: GridTask[];
onTaskToggle?: (taskId: string) => void;
readonly?: boolean;
}
export default function GridMaster({ tasks = defaultGridTasks, onTaskToggle, readonly = false }: GridMasterProps) {
const [gridTasks, setGridTasks] = useState<GridTask[]>(tasks);
useEffect(() => {
setGridTasks(tasks);
}, [tasks]);
const handleTaskClick = (taskId: string) => {
if (readonly) return;
const updatedTasks = gridTasks.map(task =>
task.id === taskId ? { ...task, completed: !task.completed } : task
);
setGridTasks(updatedTasks);
onTaskToggle?.(taskId);
};
const getDifficultyColor = (difficulty: string) => {
switch (difficulty) {
case 'easy': return 'bg-green-100 border-green-300 text-green-800';
case 'medium': return 'bg-yellow-100 border-yellow-300 text-yellow-800';
case 'hard': return 'bg-orange-100 border-orange-300 text-orange-800';
case 'expert': return 'bg-red-100 border-red-300 text-red-800';
default: return 'bg-gray-100 border-gray-300 text-gray-800';
}
};
const getCompletedRows = () => {
const completedRows: number[] = [];
for (let row = 0; row < 7; row++) {
const rowTasks = gridTasks.filter(task => task.row === row);
if (rowTasks.every(task => task.completed)) {
completedRows.push(row);
}
}
return completedRows;
};
const getCompletedCols = () => {
const completedCols: number[] = [];
for (let col = 0; col < 7; col++) {
const colTasks = gridTasks.filter(task => task.col === col);
if (colTasks.every(task => task.completed)) {
completedCols.push(col);
}
}
return completedCols;
};
const getTotalPoints = () => {
return gridTasks.reduce((total, task) => {
if (task.completed) {
return total + task.points;
}
return total;
}, 0);
};
const completedRows = getCompletedRows();
const completedCols = getCompletedCols();
const totalPoints = getTotalPoints();
const completedTasks = gridTasks.filter(task => task.completed).length;
return (
<div className="bg-white rounded-lg shadow-md p-6">
<div className="mb-6">
<h2 className="text-2xl font-bold mb-2 text-gray-800">Grid Master Progress</h2>
<div className="flex flex-wrap gap-4 text-sm">
<div className="bg-blue-50 px-3 py-1 rounded-lg">
<span className="font-semibold text-blue-800">Total Points:</span>
<span className="ml-1 text-blue-900">{totalPoints}</span>
</div>
<div className="bg-green-50 px-3 py-1 rounded-lg">
<span className="font-semibold text-green-800">Completed Tasks:</span>
<span className="ml-1 text-green-900">{completedTasks}/49</span>
</div>
<div className="bg-purple-50 px-3 py-1 rounded-lg">
<span className="font-semibold text-purple-800">Complete Rows:</span>
<span className="ml-1 text-purple-900">{completedRows.length}</span>
</div>
<div className="bg-indigo-50 px-3 py-1 rounded-lg">
<span className="font-semibold text-indigo-800">Complete Columns:</span>
<span className="ml-1 text-indigo-900">{completedCols.length}</span>
</div>
</div>
</div>
<div className="grid grid-cols-7 gap-2 mb-4">
{Array.from({ length: 7 }, (_, row) =>
Array.from({ length: 7 }, (_, col) => {
const task = gridTasks.find(t => t.row === row && t.col === col);
if (!task) return null;
const isRowComplete = completedRows.includes(row);
const isColComplete = completedCols.includes(col);
const hasBonus = isRowComplete || isColComplete;
return (
<div
key={task.id}
onClick={() => handleTaskClick(task.id)}
className={`
relative p-3 border-2 rounded-lg transition-all duration-200
${task.completed ? 'bg-green-50 border-green-400' : getDifficultyColor(task.difficulty)}
${readonly ? 'cursor-default' : 'cursor-pointer hover:shadow-md'}
${hasBonus ? 'ring-2 ring-yellow-400 ring-opacity-60' : ''}
min-h-[120px] flex flex-col justify-between
`}
>
{task.completed && (
<div className="absolute top-1 right-1 text-green-600">
<svg className="w-5 h-5" fill="currentColor" viewBox="0 0 20 20">
<path fillRule="evenodd" d="M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z" clipRule="evenodd" />
</svg>
</div>
)}
{hasBonus && (
<div className="absolute top-1 left-1 text-yellow-500">
<svg className="w-4 h-4" fill="currentColor" viewBox="0 0 20 20">
<path d="M9.049 2.927c.3-.921 1.603-.921 1.902 0l1.07 3.292a1 1 0 00.95.69h3.462c.969 0 1.371 1.24.588 1.81l-2.8 2.034a1 1 0 00-.364 1.118l1.07 3.292c.3.921-.755 1.688-1.54 1.118l-2.8-2.034a1 1 0 00-1.175 0l-2.8 2.034c-.784.57-1.838-.197-1.539-1.118l1.07-3.292a1 1 0 00-.364-1.118L2.98 8.72c-.783-.57-.38-1.81.588-1.81h3.461a1 1 0 00.951-.69l1.07-3.292z" />
</svg>
</div>
)}
<div className="text-xs font-semibold mb-1 truncate" title={task.title}>
{task.title}
</div>
<div className="text-xs text-gray-600 mb-2 flex-1 leading-tight" title={task.description}>
{task.description}
</div>
<div className="flex justify-between items-center text-xs">
<span className={`px-2 py-1 rounded text-xs font-medium ${getDifficultyColor(task.difficulty)}`}>
{task.difficulty}
</span>
<span className="font-bold text-gray-700">
{task.points}pt{hasBonus ? ' +bonus' : ''}
</span>
</div>
</div>
);
})
)}
</div>
<div className="mt-4 text-sm text-gray-600">
<div className="flex flex-wrap gap-4 mb-2">
<div className="flex items-center gap-2">
<div className="w-3 h-3 bg-green-100 border border-green-300 rounded"></div>
<span>Easy (1-2 pts)</span>
</div>
<div className="flex items-center gap-2">
<div className="w-3 h-3 bg-yellow-100 border border-yellow-300 rounded"></div>
<span>Medium (2-3 pts)</span>
</div>
<div className="flex items-center gap-2">
<div className="w-3 h-3 bg-orange-100 border border-orange-300 rounded"></div>
<span>Hard (4-5 pts)</span>
</div>
<div className="flex items-center gap-2">
<div className="w-3 h-3 bg-red-100 border border-red-300 rounded"></div>
<span>Expert (6-15 pts)</span>
</div>
</div>
<p className="text-xs text-gray-500">
Complete full rows or columns for bonus rewards!
Tasks with the symbol are part of a completed line.
</p>
</div>
</div>
);
}

View File

@@ -0,0 +1,132 @@
'use client';
import { useState } from 'react';
import { generatePassphrase, validatePassphrase } from '@/lib/passphrase';
interface PassphraseLoginProps {
onLogin?: (passphrase: string) => void;
onGenerate?: (passphrase: string) => void;
currentPassphrase?: string;
}
export default function PassphraseLogin({ onLogin, onGenerate, currentPassphrase }: PassphraseLoginProps) {
const [passphrase, setPassphrase] = useState('');
const [error, setError] = useState<string | null>(null);
const [generatedPassphrase, setGeneratedPassphrase] = useState<string | null>(null);
const handleLogin = (e: React.FormEvent) => {
e.preventDefault();
if (!passphrase.trim()) return;
if (!validatePassphrase(passphrase.trim())) {
setError('Invalid passphrase format. Must be three words separated by hyphens (e.g., brave-dragon-flies)');
return;
}
setError(null);
onLogin?.(passphrase.trim());
};
const handleGenerate = () => {
const newPassphrase = generatePassphrase();
setGeneratedPassphrase(newPassphrase);
onGenerate?.(newPassphrase);
};
const handleStore = () => {
if (generatedPassphrase) {
onLogin?.(generatedPassphrase);
setGeneratedPassphrase(null);
}
};
if (currentPassphrase) {
return (
<div className="bg-green-50 border border-green-200 rounded-lg p-4">
<h3 className="text-lg font-semibold text-green-800 mb-2">Logged In</h3>
<p className="text-green-700 mb-3">
Your passphrase: <span className="font-mono font-semibold">{currentPassphrase}</span>
</p>
<button
onClick={() => onLogin?.('')}
className="px-4 py-2 bg-gray-600 text-white rounded-md hover:bg-gray-700"
>
Logout
</button>
</div>
);
}
return (
<div className="bg-white rounded-lg shadow-md p-6">
<h2 className="text-2xl font-bold mb-4 text-gray-800">Access Your Progress</h2>
<div className="space-y-6">
<div>
<h3 className="text-lg font-semibold mb-3 text-gray-700">Login with Existing Passphrase</h3>
<form onSubmit={handleLogin} className="space-y-3">
<input
type="text"
value={passphrase}
onChange={(e) => setPassphrase(e.target.value)}
placeholder="Enter your 3-word passphrase (e.g., brave-dragon-flies)"
className="w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 font-mono"
/>
{error && (
<div className="text-red-600 text-sm">{error}</div>
)}
<button
type="submit"
disabled={!passphrase.trim()}
className="w-full px-4 py-2 bg-blue-600 text-white rounded-md hover:bg-blue-700 disabled:bg-gray-400 disabled:cursor-not-allowed"
>
Login
</button>
</form>
</div>
<div className="border-t border-gray-200 pt-6">
<h3 className="text-lg font-semibold mb-3 text-gray-700">Create New Progress Tracker</h3>
<p className="text-gray-600 mb-4 text-sm">
Generate a new passphrase to start tracking your Grid Master progress. Save this passphrase to access your data later.
</p>
{!generatedPassphrase ? (
<button
onClick={handleGenerate}
className="w-full px-4 py-2 bg-green-600 text-white rounded-md hover:bg-green-700"
>
Generate New Passphrase
</button>
) : (
<div className="space-y-3">
<div className="bg-yellow-50 border border-yellow-200 rounded-lg p-4">
<p className="text-yellow-800 font-semibold mb-2">Your new passphrase:</p>
<p className="font-mono text-lg text-yellow-900 bg-yellow-100 px-3 py-2 rounded border">
{generatedPassphrase}
</p>
<p className="text-yellow-700 text-sm mt-2">
Save this passphrase! You'll need it to access your progress later.
</p>
</div>
<div className="flex gap-2">
<button
onClick={handleStore}
className="flex-1 px-4 py-2 bg-green-600 text-white rounded-md hover:bg-green-700"
>
Store & Continue
</button>
<button
onClick={() => setGeneratedPassphrase(null)}
className="px-4 py-2 bg-gray-600 text-white rounded-md hover:bg-gray-700"
>
Cancel
</button>
</div>
</div>
)}
</div>
</div>
</div>
);
}

View File

@@ -0,0 +1,66 @@
import { GridTask } from '@/types/osrs';
export const defaultGridTasks: GridTask[] = [
// Row 0
{ id: '0-0', title: 'First Steps', description: 'Complete Tutorial Island', difficulty: 'easy', points: 1, completed: false, row: 0, col: 0 },
{ id: '0-1', title: 'Combat Ready', description: 'Reach 10 Attack', difficulty: 'easy', points: 1, completed: false, row: 0, col: 1 },
{ id: '0-2', title: 'Magic Apprentice', description: 'Reach 10 Magic', difficulty: 'easy', points: 1, completed: false, row: 0, col: 2 },
{ id: '0-3', title: 'Archer Training', description: 'Reach 10 Ranged', difficulty: 'easy', points: 1, completed: false, row: 0, col: 3 },
{ id: '0-4', title: 'Prayer Novice', description: 'Reach 10 Prayer', difficulty: 'easy', points: 1, completed: false, row: 0, col: 4 },
{ id: '0-5', title: 'Crafting Start', description: 'Reach 10 Crafting', difficulty: 'easy', points: 1, completed: false, row: 0, col: 5 },
{ id: '0-6', title: 'Cook\'s Assistant', description: 'Complete Cook\'s Assistant quest', difficulty: 'easy', points: 2, completed: false, row: 0, col: 6 },
// Row 1
{ id: '1-0', title: 'Quest Points', description: 'Earn 10 Quest Points', difficulty: 'easy', points: 2, completed: false, row: 1, col: 0 },
{ id: '1-1', title: 'Combat Training', description: 'Reach 20 Attack', difficulty: 'medium', points: 2, completed: false, row: 1, col: 1 },
{ id: '1-2', title: 'Mage Training', description: 'Reach 20 Magic', difficulty: 'medium', points: 2, completed: false, row: 1, col: 2 },
{ id: '1-3', title: 'Archer Progress', description: 'Reach 20 Ranged', difficulty: 'medium', points: 2, completed: false, row: 1, col: 3 },
{ id: '1-4', title: 'Holy Training', description: 'Reach 20 Prayer', difficulty: 'medium', points: 2, completed: false, row: 1, col: 4 },
{ id: '1-5', title: 'Artisan Skills', description: 'Reach 20 Crafting', difficulty: 'medium', points: 2, completed: false, row: 1, col: 5 },
{ id: '1-6', title: 'Demon Slayer', description: 'Complete Demon Slayer quest', difficulty: 'medium', points: 3, completed: false, row: 1, col: 6 },
// Row 2
{ id: '2-0', title: 'Quest Master', description: 'Earn 25 Quest Points', difficulty: 'medium', points: 3, completed: false, row: 2, col: 0 },
{ id: '2-1', title: 'Warrior', description: 'Reach 30 Attack', difficulty: 'medium', points: 3, completed: false, row: 2, col: 1 },
{ id: '2-2', title: 'Wizard', description: 'Reach 30 Magic', difficulty: 'medium', points: 3, completed: false, row: 2, col: 2 },
{ id: '2-3', title: 'Marksman', description: 'Reach 30 Ranged', difficulty: 'medium', points: 3, completed: false, row: 2, col: 3 },
{ id: '2-4', title: 'Devout', description: 'Reach 30 Prayer', difficulty: 'medium', points: 3, completed: false, row: 2, col: 4 },
{ id: '2-5', title: 'Artisan', description: 'Reach 30 Crafting', difficulty: 'medium', points: 3, completed: false, row: 2, col: 5 },
{ id: '2-6', title: 'Vampire Slayer', description: 'Complete Vampire Slayer quest', difficulty: 'medium', points: 3, completed: false, row: 2, col: 6 },
// Row 3
{ id: '3-0', title: 'Quest Veteran', description: 'Earn 50 Quest Points', difficulty: 'hard', points: 4, completed: false, row: 3, col: 0 },
{ id: '3-1', title: 'Elite Warrior', description: 'Reach 40 Attack', difficulty: 'hard', points: 4, completed: false, row: 3, col: 1 },
{ id: '3-2', title: 'Elite Mage', description: 'Reach 40 Magic', difficulty: 'hard', points: 4, completed: false, row: 3, col: 2 },
{ id: '3-3', title: 'Elite Archer', description: 'Reach 40 Ranged', difficulty: 'hard', points: 4, completed: false, row: 3, col: 3 },
{ id: '3-4', title: 'High Priest', description: 'Reach 43 Prayer', difficulty: 'hard', points: 4, completed: false, row: 3, col: 4 },
{ id: '3-5', title: 'Master Crafter', description: 'Reach 40 Crafting', difficulty: 'hard', points: 4, completed: false, row: 3, col: 5 },
{ id: '3-6', title: 'Dragon Slayer', description: 'Complete Dragon Slayer I', difficulty: 'hard', points: 5, completed: false, row: 3, col: 6 },
// Row 4
{ id: '4-0', title: 'Quest Champion', description: 'Earn 100 Quest Points', difficulty: 'hard', points: 5, completed: false, row: 4, col: 0 },
{ id: '4-1', title: 'Rune Warrior', description: 'Reach 50 Attack', difficulty: 'hard', points: 5, completed: false, row: 4, col: 1 },
{ id: '4-2', title: 'High Mage', description: 'Reach 50 Magic', difficulty: 'hard', points: 5, completed: false, row: 4, col: 2 },
{ id: '4-3', title: 'Master Archer', description: 'Reach 50 Ranged', difficulty: 'hard', points: 5, completed: false, row: 4, col: 3 },
{ id: '4-4', title: 'Prayer Master', description: 'Reach 50 Prayer', difficulty: 'hard', points: 5, completed: false, row: 4, col: 4 },
{ id: '4-5', title: 'Craft Master', description: 'Reach 50 Crafting', difficulty: 'hard', points: 5, completed: false, row: 4, col: 5 },
{ id: '4-6', title: 'Barrows Gloves', description: 'Complete Recipe for Disaster', difficulty: 'expert', points: 8, completed: false, row: 4, col: 6 },
// Row 5
{ id: '5-0', title: 'Quest Legend', description: 'Earn 150 Quest Points', difficulty: 'expert', points: 6, completed: false, row: 5, col: 0 },
{ id: '5-1', title: 'Dragon Warrior', description: 'Reach 60 Attack', difficulty: 'expert', points: 6, completed: false, row: 5, col: 1 },
{ id: '5-2', title: 'Ancient Mage', description: 'Reach 60 Magic', difficulty: 'expert', points: 6, completed: false, row: 5, col: 2 },
{ id: '5-3', title: 'Expert Archer', description: 'Reach 60 Ranged', difficulty: 'expert', points: 6, completed: false, row: 5, col: 3 },
{ id: '5-4', title: 'Holy Master', description: 'Reach 60 Prayer', difficulty: 'expert', points: 6, completed: false, row: 5, col: 4 },
{ id: '5-5', title: 'Elite Crafter', description: 'Reach 60 Crafting', difficulty: 'expert', points: 6, completed: false, row: 5, col: 5 },
{ id: '5-6', title: 'Fire Cape', description: 'Obtain Fire Cape from Fight Caves', difficulty: 'expert', points: 10, completed: false, row: 5, col: 6 },
// Row 6
{ id: '6-0', title: 'Quest Grandmaster', description: 'Earn 200 Quest Points', difficulty: 'expert', points: 8, completed: false, row: 6, col: 0 },
{ id: '6-1', title: 'Whip Master', description: 'Reach 70 Attack', difficulty: 'expert', points: 8, completed: false, row: 6, col: 1 },
{ id: '6-2', title: 'Arcane Master', description: 'Reach 70 Magic', difficulty: 'expert', points: 8, completed: false, row: 6, col: 2 },
{ id: '6-3', title: 'Legendary Archer', description: 'Reach 70 Ranged', difficulty: 'expert', points: 8, completed: false, row: 6, col: 3 },
{ id: '6-4', title: 'Divine Master', description: 'Reach 70 Prayer', difficulty: 'expert', points: 8, completed: false, row: 6, col: 4 },
{ id: '6-5', title: 'Legendary Crafter', description: 'Reach 70 Crafting', difficulty: 'expert', points: 8, completed: false, row: 6, col: 5 },
{ id: '6-6', title: 'ToA Completion', description: 'Complete Tombs of Amascut', difficulty: 'expert', points: 15, completed: false, row: 6, col: 6 },
];

View File

@@ -0,0 +1,59 @@
import { OSRSHiscoreStats, SkillData } from '@/types/osrs';
const HISCORES_URL = 'https://secure.runescape.com/m=hiscore_oldschool/index_lite.ws?player=';
export async function fetchPlayerStats(username: string): Promise<OSRSHiscoreStats | null> {
try {
const response = await fetch(`/api/hiscores?username=${encodeURIComponent(username)}`);
if (!response.ok) {
throw new Error('Player not found');
}
const data = await response.text();
return parseHiscoreData(data);
} catch (error) {
console.error('Error fetching player stats:', error);
return null;
}
}
function parseHiscoreData(data: string): OSRSHiscoreStats {
const lines = data.trim().split('\n');
const parseSkill = (line: string): SkillData => {
const parts = line.split(',');
return {
rank: parseInt(parts[0]) || -1,
level: parseInt(parts[1]) || 1,
xp: parseInt(parts[2]) || 0,
};
};
return {
overall: parseSkill(lines[0]),
attack: parseSkill(lines[1]),
defence: parseSkill(lines[2]),
strength: parseSkill(lines[3]),
hitpoints: parseSkill(lines[4]),
ranged: parseSkill(lines[5]),
prayer: parseSkill(lines[6]),
magic: parseSkill(lines[7]),
cooking: parseSkill(lines[8]),
woodcutting: parseSkill(lines[9]),
fletching: parseSkill(lines[10]),
fishing: parseSkill(lines[11]),
firemaking: parseSkill(lines[12]),
crafting: parseSkill(lines[13]),
smithing: parseSkill(lines[14]),
mining: parseSkill(lines[15]),
herblore: parseSkill(lines[16]),
agility: parseSkill(lines[17]),
thieving: parseSkill(lines[18]),
slayer: parseSkill(lines[19]),
farming: parseSkill(lines[20]),
runecraft: parseSkill(lines[21]),
hunter: parseSkill(lines[22]),
construction: parseSkill(lines[23]),
};
}

View File

@@ -0,0 +1,37 @@
const adjectives = [
'brave', 'bright', 'calm', 'clever', 'cool', 'eager', 'fair', 'gentle', 'happy', 'kind',
'lively', 'lucky', 'merry', 'nice', 'polite', 'proud', 'quick', 'quiet', 'sharp', 'smart',
'smooth', 'strong', 'swift', 'wise', 'young', 'bold', 'wild', 'pure', 'tall', 'wide'
];
const nouns = [
'apple', 'badge', 'castle', 'dragon', 'eagle', 'flame', 'garden', 'hammer', 'island', 'jewel',
'knight', 'ladder', 'mountain', 'needle', 'ocean', 'palace', 'quest', 'river', 'sword', 'tower',
'unicorn', 'valley', 'wizard', 'crystal', 'bridge', 'shield', 'crown', 'treasure', 'forest', 'storm'
];
const verbs = [
'runs', 'jumps', 'flies', 'swims', 'climbs', 'dances', 'sings', 'laughs', 'shines', 'grows',
'helps', 'builds', 'creates', 'explores', 'discovers', 'protects', 'guides', 'travels', 'writes', 'dreams',
'fights', 'heals', 'teaches', 'learns', 'plays', 'works', 'thinks', 'speaks', 'listens', 'watches'
];
export function generatePassphrase(): string {
const adjective = adjectives[Math.floor(Math.random() * adjectives.length)];
const noun = nouns[Math.floor(Math.random() * nouns.length)];
const verb = verbs[Math.floor(Math.random() * verbs.length)];
return `${adjective}-${noun}-${verb}`;
}
export function validatePassphrase(passphrase: string): boolean {
const parts = passphrase.split('-');
if (parts.length !== 3) return false;
const [adjective, noun, verb] = parts;
return adjectives.includes(adjective) &&
nouns.includes(noun) &&
verbs.includes(verb);
}

View File

@@ -0,0 +1,46 @@
import { UserProgress } from '@/types/osrs';
export async function saveProgress(passphrase: string, progress: UserProgress): Promise<boolean> {
try {
const response = await fetch('/api/progress', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({ passphrase, progress }),
});
return response.ok;
} catch (error) {
console.error('Error saving progress:', error);
return false;
}
}
export async function loadProgress(passphrase: string): Promise<UserProgress | null> {
try {
const response = await fetch(`/api/progress?passphrase=${encodeURIComponent(passphrase)}`);
if (!response.ok) {
return null;
}
return await response.json();
} catch (error) {
console.error('Error loading progress:', error);
return null;
}
}
export async function deleteProgress(passphrase: string): Promise<boolean> {
try {
const response = await fetch(`/api/progress?passphrase=${encodeURIComponent(passphrase)}`, {
method: 'DELETE',
});
return response.ok;
} catch (error) {
console.error('Error deleting progress:', error);
return false;
}
}

View File

@@ -0,0 +1,53 @@
export interface OSRSHiscoreStats {
overall: SkillData;
attack: SkillData;
defence: SkillData;
strength: SkillData;
hitpoints: SkillData;
ranged: SkillData;
prayer: SkillData;
magic: SkillData;
cooking: SkillData;
woodcutting: SkillData;
fletching: SkillData;
fishing: SkillData;
firemaking: SkillData;
crafting: SkillData;
smithing: SkillData;
mining: SkillData;
herblore: SkillData;
agility: SkillData;
thieving: SkillData;
slayer: SkillData;
farming: SkillData;
runecraft: SkillData;
hunter: SkillData;
construction: SkillData;
}
export interface SkillData {
rank: number;
level: number;
xp: number;
}
export interface GridTask {
id: string;
title: string;
description: string;
difficulty: 'easy' | 'medium' | 'hard' | 'expert';
points: number;
completed: boolean;
row: number;
col: number;
}
export interface UserProgress {
username: string;
passphrase: string;
tasks: GridTask[];
totalPoints: number;
completedRows: number[];
completedCols: number[];
lastUpdated: string;
}

View File

@@ -0,0 +1,27 @@
{
"compilerOptions": {
"target": "ES2017",
"lib": ["dom", "dom.iterable", "esnext"],
"allowJs": true,
"skipLibCheck": true,
"strict": true,
"noEmit": true,
"esModuleInterop": true,
"module": "esnext",
"moduleResolution": "bundler",
"resolveJsonModule": true,
"isolatedModules": true,
"jsx": "preserve",
"incremental": true,
"plugins": [
{
"name": "next"
}
],
"paths": {
"@/*": ["./src/*"]
}
},
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"],
"exclude": ["node_modules"]
}