Sumerkind commited on
Commit
001d03c
Β·
verified Β·
1 Parent(s): e538a02

Kamu adalah ahli modding TheoTown

Browse files

Tujuan :
Membuat mod Stadium TheoTown yang:
Bertanding setiap akhir pekan
Hasil pertandingan acak (menang/kalah)
Menang β†’ kebahagiaan warga naik
Kalah β†’ kebahagiaan warga turun
Dampak ke warga nyata (influence happiness)

Files changed (6) hide show
  1. README.md +7 -4
  2. components/footer.js +41 -0
  3. components/header.js +47 -0
  4. index.html +88 -19
  5. script.js +95 -0
  6. style.css +22 -19
README.md CHANGED
@@ -1,10 +1,13 @@
1
  ---
2
- title: Stadium Showdown Modifier
3
- emoji: πŸ“š
4
- colorFrom: yellow
5
  colorTo: pink
 
6
  sdk: static
7
  pinned: false
 
 
8
  ---
9
 
10
- Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
 
1
  ---
2
+ title: Stadium Showdown Modifier 🏟️
3
+ colorFrom: gray
 
4
  colorTo: pink
5
+ emoji: 🐳
6
  sdk: static
7
  pinned: false
8
+ tags:
9
+ - deepsite-v3
10
  ---
11
 
12
+ # Welcome to your new DeepSite project!
13
+ This project was created with [DeepSite](https://huggingface.co/deepsite).
components/footer.js ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ class CustomFooter extends HTMLElement {
2
+ connectedCallback() {
3
+ this.attachShadow({ mode: 'open' });
4
+ this.shadowRoot.innerHTML = `
5
+ <style>
6
+ footer {
7
+ background-color: #1e293b;
8
+ color: #e2e8f0;
9
+ }
10
+ .footer-link:hover {
11
+ color: #818cf8;
12
+ }
13
+ </style>
14
+ <footer class="py-8 px-6 mt-12">
15
+ <div class="container mx-auto">
16
+ <div class="flex flex-col md:flex-row justify-between items-center">
17
+ <div class="mb-4 md:mb-0">
18
+ <p class="text-sm">Β© 2023 Stadium Showdown Mod. All rights reserved.</p>
19
+ <p class="text-xs text-gray-400 mt-1">For TheoTown game modding community</p>
20
+ </div>
21
+ <div class="flex space-x-4">
22
+ <a href="#" class="footer-link text-sm flex items-center">
23
+ <i data-feather="github" class="w-4 h-4 mr-1"></i>
24
+ GitHub
25
+ </a>
26
+ <a href="#" class="footer-link text-sm flex items-center">
27
+ <i data-feather="twitter" class="w-4 h-4 mr-1"></i>
28
+ Twitter
29
+ </a>
30
+ <a href="#" class="footer-link text-sm flex items-center">
31
+ <i data-feather="mail" class="w-4 h-4 mr-1"></i>
32
+ Contact
33
+ </a>
34
+ </div>
35
+ </div>
36
+ </div>
37
+ </footer>
38
+ `;
39
+ }
40
+ }
41
+ customElements.define('custom-footer', CustomFooter);
components/header.js ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ class CustomHeader extends HTMLElement {
2
+ connectedCallback() {
3
+ this.attachShadow({ mode: 'open' });
4
+ this.shadowRoot.innerHTML = `
5
+ <style>
6
+ header {
7
+ background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
8
+ color: white;
9
+ box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
10
+ }
11
+ .nav-link:hover {
12
+ opacity: 0.9;
13
+ transform: translateY(-2px);
14
+ }
15
+ .nav-link {
16
+ transition: all 0.2s ease;
17
+ }
18
+ </style>
19
+ <header class="py-4 px-6">
20
+ <div class="container mx-auto flex justify-between items-center">
21
+ <div class="flex items-center space-x-2">
22
+ <i data-feather="award" class="w-8 h-8"></i>
23
+ <h1 class="text-xl font-bold">Stadium Showdown</h1>
24
+ </div>
25
+ <nav class="hidden md:flex space-x-6">
26
+ <a href="#" class="nav-link flex items-center">
27
+ <i data-feather="home" class="w-4 h-4 mr-1"></i>
28
+ Home
29
+ </a>
30
+ <a href="#" class="nav-link flex items-center">
31
+ <i data-feather="settings" class="w-4 h-4 mr-1"></i>
32
+ Settings
33
+ </a>
34
+ <a href="#" class="nav-link flex items-center">
35
+ <i data-feather="help-circle" class="w-4 h-4 mr-1"></i>
36
+ Help
37
+ </a>
38
+ </nav>
39
+ <button class="md:hidden">
40
+ <i data-feather="menu" class="w-6 h-6"></i>
41
+ </button>
42
+ </div>
43
+ </header>
44
+ `;
45
+ }
46
+ }
47
+ customElements.define('custom-header', CustomHeader);
index.html CHANGED
@@ -1,19 +1,88 @@
1
- <!doctype html>
2
- <html>
3
- <head>
4
- <meta charset="utf-8" />
5
- <meta name="viewport" content="width=device-width" />
6
- <title>My static Space</title>
7
- <link rel="stylesheet" href="style.css" />
8
- </head>
9
- <body>
10
- <div class="card">
11
- <h1>Welcome to your static Space!</h1>
12
- <p>You can modify this app directly by editing <i>index.html</i> in the Files and versions tab.</p>
13
- <p>
14
- Also don't forget to check the
15
- <a href="https://huggingface.co/docs/hub/spaces" target="_blank">Spaces documentation</a>.
16
- </p>
17
- </div>
18
- </body>
19
- </html>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>Stadium Showdown Modifier</title>
7
+ <link rel="stylesheet" href="style.css">
8
+ <script src="https://cdn.tailwindcss.com"></script>
9
+ <script src="https://cdn.jsdelivr.net/npm/feather-icons/dist/feather.min.js"></script>
10
+ <script src="https://unpkg.com/feather-icons"></script>
11
+ </head>
12
+ <body class="bg-gray-100 min-h-screen">
13
+ <custom-header></custom-header>
14
+
15
+ <main class="container mx-auto px-4 py-8">
16
+ <div class="max-w-4xl mx-auto bg-white rounded-xl shadow-md overflow-hidden">
17
+ <div class="p-8">
18
+ <div class="flex flex-col items-center mb-8">
19
+ <i data-feather="award" class="w-16 h-16 text-yellow-500"></i>
20
+ <h1 class="text-3xl font-bold text-gray-800 mt-4">Stadium Showdown Mod</h1>
21
+ <p class="text-gray-600 mt-2">Weekly matches that influence your city's happiness</p>
22
+ </div>
23
+
24
+ <div class="grid grid-cols-1 md:grid-cols-2 gap-6">
25
+ <div class="bg-blue-50 p-6 rounded-lg">
26
+ <div class="flex items-center mb-4">
27
+ <i data-feather="calendar" class="w-6 h-6 text-blue-500 mr-2"></i>
28
+ <h2 class="text-xl font-semibold text-gray-800">Match Schedule</h2>
29
+ </div>
30
+ <p class="text-gray-700">Matches occur every weekend with random outcomes.</p>
31
+ <div class="mt-4 p-4 bg-blue-100 rounded">
32
+ <p class="font-medium text-blue-800">Next match: <span id="next-match" class="font-bold">Loading...</span></p>
33
+ </div>
34
+ </div>
35
+
36
+ <div class="bg-green-50 p-6 rounded-lg">
37
+ <div class="flex items-center mb-4">
38
+ <i data-feather="smile" class="w-6 h-6 text-green-500 mr-2"></i>
39
+ <h2 class="text-xl font-semibold text-gray-800">Happiness Impact</h2>
40
+ </div>
41
+ <p class="text-gray-700">Match results directly affect your citizens' happiness:</p>
42
+ <ul class="mt-2 space-y-1">
43
+ <li class="flex items-center">
44
+ <i data-feather="thumbs-up" class="w-4 h-4 text-green-500 mr-2"></i>
45
+ <span>Win: +15% happiness</span>
46
+ </li>
47
+ <li class="flex items-center">
48
+ <i data-feather="thumbs-down" class="w-4 h-4 text-red-500 mr-2"></i>
49
+ <span>Loss: -10% happiness</span>
50
+ </li>
51
+ </ul>
52
+ </div>
53
+ </div>
54
+
55
+ <div class="mt-8 bg-gray-50 p-6 rounded-lg">
56
+ <h2 class="text-xl font-semibold text-gray-800 mb-4">Simulate Next Match</h2>
57
+ <button id="simulate-btn" class="bg-purple-600 hover:bg-purple-700 text-white font-bold py-3 px-6 rounded-lg transition duration-200 flex items-center">
58
+ <i data-feather="play" class="w-5 h-5 mr-2"></i>
59
+ Run Simulation
60
+ </button>
61
+ <div id="result-container" class="mt-4 hidden">
62
+ <div class="p-4 rounded-lg">
63
+ <h3 class="text-lg font-medium mb-2">Match Result:</h3>
64
+ <p id="match-result" class="text-lg"></p>
65
+ <p id="happiness-impact" class="mt-2"></p>
66
+ </div>
67
+ </div>
68
+ </div>
69
+
70
+ <div class="mt-8">
71
+ <h2 class="text-xl font-semibold text-gray-800 mb-4">Recent Matches</h2>
72
+ <div id="match-history" class="space-y-2">
73
+ <!-- Match history will be populated here -->
74
+ </div>
75
+ </div>
76
+ </div>
77
+ </div>
78
+ </main>
79
+
80
+ <custom-footer></custom-footer>
81
+
82
+ <script src="components/header.js"></script>
83
+ <script src="components/footer.js"></script>
84
+ <script src="script.js"></script>
85
+ <script>feather.replace();</script>
86
+ <script src="https://huggingface.co/deepsite/deepsite-badge.js"></script>
87
+ </body>
88
+ </html>
script.js ADDED
@@ -0,0 +1,95 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ document.addEventListener('DOMContentLoaded', function() {
2
+ // Initialize match history from localStorage or create empty array
3
+ let matchHistory = JSON.parse(localStorage.getItem('stadiumModHistory')) || [];
4
+
5
+ // Set next match date (always next Saturday)
6
+ const today = new Date();
7
+ const nextSaturday = new Date(today);
8
+ nextSaturday.setDate(today.getDate() + (6 - today.getDay() + 7) % 7);
9
+ document.getElementById('next-match').textContent = nextSaturday.toLocaleDateString('en-US', {
10
+ weekday: 'long',
11
+ month: 'long',
12
+ day: 'numeric'
13
+ });
14
+
15
+ // Display match history
16
+ renderMatchHistory();
17
+
18
+ // Simulation button
19
+ document.getElementById('simulate-btn').addEventListener('click', function() {
20
+ simulateMatch();
21
+ });
22
+
23
+ function simulateMatch() {
24
+ const resultContainer = document.getElementById('result-container');
25
+ const matchResult = document.getElementById('match-result');
26
+ const happinessImpact = document.getElementById('happiness-impact');
27
+
28
+ // Random result (60% chance to win, 40% to lose)
29
+ const isWin = Math.random() < 0.6;
30
+ const resultText = isWin ? "πŸ† Your team won!" : "😞 Your team lost...";
31
+ const impactText = isWin ?
32
+ "Citizens are celebrating! Happiness increased by 15%." :
33
+ "Citizens are disappointed. Happiness decreased by 10%.";
34
+
35
+ // Add to match history
36
+ const matchEntry = {
37
+ date: new Date().toLocaleDateString(),
38
+ result: isWin ? 'win' : 'loss',
39
+ happinessChange: isWin ? 15 : -10
40
+ };
41
+
42
+ matchHistory.unshift(matchEntry);
43
+ localStorage.setItem('stadiumModHistory', JSON.stringify(matchHistory));
44
+
45
+ // Display result
46
+ matchResult.textContent = resultText;
47
+ happinessImpact.textContent = impactText;
48
+ resultContainer.className = isWin ?
49
+ 'mt-4 p-4 rounded-lg win-animation' :
50
+ 'mt-4 p-4 rounded-lg loss-animation';
51
+ resultContainer.classList.remove('hidden');
52
+
53
+ // Update history display
54
+ renderMatchHistory();
55
+
56
+ // Disable button temporarily
57
+ const btn = document.getElementById('simulate-btn');
58
+ btn.disabled = true;
59
+ setTimeout(() => {
60
+ btn.disabled = false;
61
+ }, 3000);
62
+ }
63
+
64
+ function renderMatchHistory() {
65
+ const container = document.getElementById('match-history');
66
+ container.innerHTML = '';
67
+
68
+ if (matchHistory.length === 0) {
69
+ container.innerHTML = '<p class="text-gray-500">No matches played yet</p>';
70
+ return;
71
+ }
72
+
73
+ matchHistory.forEach(match => {
74
+ const matchEl = document.createElement('div');
75
+ matchEl.className = `match-item p-3 rounded-lg flex justify-between items-center ${
76
+ match.result === 'win' ? 'bg-green-50' : 'bg-red-50'
77
+ }`;
78
+
79
+ matchEl.innerHTML = `
80
+ <div class="flex items-center">
81
+ <i data-feather="${match.result === 'win' ? 'thumbs-up' : 'thumbs-down'}"
82
+ class="w-4 h-4 mr-2 ${match.result === 'win' ? 'text-green-500' : 'text-red-500'}"></i>
83
+ <span class="font-medium">${match.date}</span>
84
+ </div>
85
+ <span class="${match.result === 'win' ? 'text-green-600' : 'text-red-600'} font-bold">
86
+ ${match.result === 'win' ? '+' : ''}${match.happinessChange}% happiness
87
+ </span>
88
+ `;
89
+
90
+ container.appendChild(matchEl);
91
+ });
92
+
93
+ feather.replace();
94
+ }
95
+ });
style.css CHANGED
@@ -1,28 +1,31 @@
1
- body {
2
- padding: 2rem;
3
- font-family: -apple-system, BlinkMacSystemFont, "Arial", sans-serif;
 
4
  }
5
 
6
- h1 {
7
- font-size: 16px;
8
- margin-top: 0;
9
  }
10
 
11
- p {
12
- color: rgb(107, 114, 128);
13
- font-size: 15px;
14
- margin-bottom: 10px;
15
- margin-top: 5px;
16
  }
17
 
18
- .card {
19
- max-width: 620px;
20
- margin: 0 auto;
21
- padding: 16px;
22
- border: 1px solid lightgray;
23
- border-radius: 16px;
24
  }
25
 
26
- .card p:last-child {
27
- margin-bottom: 0;
28
  }
 
 
 
 
 
 
 
 
1
+ /* Custom animations */
2
+ @keyframes pulse {
3
+ 0%, 100% { transform: scale(1); }
4
+ 50% { transform: scale(1.05); }
5
  }
6
 
7
+ .win-animation {
8
+ animation: pulse 1.5s ease-in-out;
9
+ background-color: rgba(74, 222, 128, 0.1);
10
  }
11
 
12
+ .loss-animation {
13
+ animation: pulse 1.5s ease-in-out;
14
+ background-color: rgba(248, 113, 113, 0.1);
 
 
15
  }
16
 
17
+ /* Match history item styling */
18
+ .match-item {
19
+ transition: all 0.3s ease;
 
 
 
20
  }
21
 
22
+ .match-item:hover {
23
+ transform: translateX(4px);
24
  }
25
+
26
+ /* Responsive adjustments */
27
+ @media (max-width: 640px) {
28
+ .match-details {
29
+ flex-direction: column;
30
+ }
31
+ }