From 0276d7d33c48fbf08e0d667940b1815af3f0fd15 Mon Sep 17 00:00:00 2001 From: LOQ Date: Thu, 27 Nov 2025 20:25:21 +0200 Subject: [PATCH 01/91] first commit --- html & js/manage.html | 11 +++++++++++ html & js/manage.js | 0 2 files changed, 11 insertions(+) create mode 100644 html & js/manage.html create mode 100644 html & js/manage.js diff --git a/html & js/manage.html b/html & js/manage.html new file mode 100644 index 0000000..5030173 --- /dev/null +++ b/html & js/manage.html @@ -0,0 +1,11 @@ + + + + + Manage Habitat + + + + + + \ No newline at end of file diff --git a/html & js/manage.js b/html & js/manage.js new file mode 100644 index 0000000..e69de29 From 2ed39bf54722ad231eb4dd9bac431fde939ef231 Mon Sep 17 00:00:00 2001 From: Sorathor Date: Sat, 29 Nov 2025 15:00:41 +0200 Subject: [PATCH 02/91] change the password --- setup-database.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/setup-database.py b/setup-database.py index 8e5aec0..90c5dd2 100644 --- a/setup-database.py +++ b/setup-database.py @@ -12,7 +12,7 @@ def setup_database(): # Connection details - UPDATE THESE DB_HOST = 'localhost' DB_USER = 'root' - DB_PASSWORD = 'Cde3xsw2' # <-- UPDATE WITH YOUR PASSWORD + DB_PASSWORD = '123456789' # <-- UPDATE WITH YOUR PASSWORD DB_NAME = 'creature_catcher' try: @@ -35,7 +35,7 @@ def setup_database(): # You can paste the SQL here or read from file # For now, let's read from the schema file try: - with open('creature_schema.sql', 'r') as f: + with open('Software2-Project\creature_schema.sql', 'r') as f: sql_content = f.read() # Split by semicolons and execute each statement From 398da4dc722fc359907f7636346bedefb8ef6b61 Mon Sep 17 00:00:00 2001 From: Sorathor Date: Sat, 29 Nov 2025 15:03:38 +0200 Subject: [PATCH 03/91] add frontend --- static/game.css | 70 ++++++++ static/game.js | 390 +++++++++++++++++++++++++++++++++++++++++++ templates/index.html | 101 +++++++++++ 3 files changed, 561 insertions(+) create mode 100644 static/game.css create mode 100644 static/game.js create mode 100644 templates/index.html diff --git a/static/game.css b/static/game.css new file mode 100644 index 0000000..252fab2 --- /dev/null +++ b/static/game.css @@ -0,0 +1,70 @@ +body { + padding: 20px; + line-height: 1.5; +} +.container { + max-width: 800px; + margin: 0 auto; +} +.page, +.hidden, +.popup.hidden { + display: none; +} +.page.active { + display: block; +} +.journal-grid { + display: grid; + grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); + gap: 15px; +} +.habitats-grid { + display: grid; + grid-template-columns: 1fr 1fr; + gap: 20px; + margin-bottom: 20px; +} +.popup { + position: fixed; + top: 0; + left: 0; + width: 100%; + height: 100%; + background: rgba(0, 0, 0, 0.5); + display: flex; + justify-content: center; + align-items: center; +} +.btn, +input { + width: 100%; + padding: 8px; + margin-bottom: 10px; + display: block; + font-size: 16px; +} +.popup-content { + background: white; + padding: 20px; + max-width: 400px; + text-align: center; +} +.creature-item { + padding: 5px 0; + cursor: pointer; +} +.journal-item { + text-align: center; + padding: 10px; +} +.journal-item img { + width: 100%; + height: auto; + margin-bottom: 5px; +} +h1, +h3 { + margin-bottom: 15px; + font-weight: normal; +} diff --git a/static/game.js b/static/game.js new file mode 100644 index 0000000..ed91d92 --- /dev/null +++ b/static/game.js @@ -0,0 +1,390 @@ +const usernameInput = document.getElementById("username"); + +let playerId = null; +let playerUsername = null; +let currentCompanions = []; +let currentWildCreatures = []; +let currentCompanionId = null; +let currentHabitatsData = null; + +function showPage(pageId) { + document.querySelectorAll(".page").forEach((page) => { + page.classList.remove("active"); + }); + document.getElementById(pageId).classList.add("active"); +} + +function showPopup(message) { + const popup = document.getElementById("popup"); + const popupMessage = document.getElementById("popupMessage"); + popupMessage.textContent = message; + popup.classList.remove("hidden"); +} + +function hidePopup() { + document.getElementById("popup").classList.add("hidden"); +} + +async function play() { + const username = usernameInput.value.trim(); + + if (!username) { + showPopup("Username required!", false); + return; + } + + try { + const response = await fetch("/login", { + method: "POST", + headers: { + "Content-Type": "application/json", + }, + body: JSON.stringify({ username }), + }); + + const data = await response.json(); + + if (data.success) { + playerId = data.player_id; + playerUsername = data.username; + + showPage("mainPage"); + } else { + showPopup("Login failed", false); + } + } catch (error) { + showPopup("Error: " + error, false); + } finally { + } +} + +async function loadExplorePage() { + showPage("explorePage"); + + try { + const response = await fetch(`/explore/start?player_id=${playerId}`); + const data = await response.json(); + + if (data.success && data.companions) { + currentCompanions = data.companions; + const companionList = document.getElementById("companionList"); + companionList.innerHTML = ""; + + data.companions.forEach((comp) => { + const btn = document.createElement("button"); + btn.className = "btn"; + btn.textContent = `${comp.nickname} (${comp.type})`; + btn.onclick = () => selectCompanion(comp.id); + companionList.appendChild(btn); + }); + + document.getElementById("companionSelection").classList.remove("hidden"); + document.getElementById("wildSelection").classList.add("hidden"); + } else { + showPopup( + data.messages ? data.messages.join("\n") : "Cannot explore", + false + ); + showPage("mainPage"); + } + } catch (error) { + showPopup("Error: " + error, false); + showPage("mainPage"); + } finally { + } +} + +async function selectCompanion(companionId) { + currentCompanionId = companionId; + + try { + const response = await fetch("/explore/encounter", { + method: "POST", + headers: { + "Content-Type": "application/json", + }, + body: JSON.stringify({ + player_id: playerId, + companion_id: companionId, + }), + }); + + const data = await response.json(); + + if (data.complete) { + showPopup("Congratulations! You've caught them all!", true); + showPage("mainPage"); + return; + } + + if (data.success && data.wild_creatures) { + currentWildCreatures = data.wild_creatures; + const wildList = document.getElementById("wildList"); + wildList.innerHTML = ""; + + data.wild_creatures.forEach((wild) => { + const btn = document.createElement("button"); + btn.className = "btn"; + btn.textContent = `${wild.name} (${wild.type}) - ${wild.status}`; + btn.onclick = () => catchCreature(wild.id, wild.effectiveness); + wildList.appendChild(btn); + }); + + document.getElementById("companionSelection").classList.add("hidden"); + document.getElementById("wildSelection").classList.remove("hidden"); + } + } catch (error) { + showPopup("Error: " + error, false); + } finally { + } +} + +async function catchCreature(wildCreatureId, effectiveness) { + try { + const response = await fetch("/explore/catch", { + method: "POST", + headers: { + "Content-Type": "application/json", + }, + body: JSON.stringify({ + player_id: playerId, + wild_creature_id: wildCreatureId, + companion_id: currentCompanionId, + effectiveness: effectiveness, + }), + }); + + const data = await response.json(); + + if (data.success) { + const message = data.caught + ? "Success! Creature caught!" + : "Failed! Creature escaped."; + showPopup(message, data.caught); + + setTimeout(() => { + hidePopup(); + showPage("mainPage"); + }, 2000); + } + } catch (error) { + showPopup("Error: " + error, false); + } finally { + } +} + +async function loadManagePage() { + showPage("managePage"); + + try { + const response = await fetch(`/habitats?player_id=${playerId}`); + const data = await response.json(); + + if (data.success) { + currentHabitatsData = data.habitats; + + for (let i = 1; i <= 4; i++) { + document.getElementById(`habitat${i}`).innerHTML = ""; + } + data.habitats.forEach((habitat) => { + const habitatEl = document.getElementById(`habitat${habitat.number}`); + + if (habitat.creatures && habitat.creatures.length > 0) { + habitat.creatures.forEach((creature) => { + const div = document.createElement("div"); + div.className = "creature-item"; + div.textContent = `${creature.nickname} (${creature.type})`; + div.onclick = () => moveCreature(creature.id, habitat.id); + habitatEl.appendChild(div); + }); + } else { + habitatEl.textContent = "(empty)"; + } + }); + + const unplacedEl = document.getElementById("unplacedList"); + unplacedEl.innerHTML = ""; + + if (data.unplaced && data.unplaced.length > 0) { + data.unplaced.forEach((creature) => { + const div = document.createElement("div"); + div.className = "creature-item"; + div.textContent = `${creature.nickname} (${creature.type})`; + div.onclick = () => moveCreature(creature.id, null); + unplacedEl.appendChild(div); + }); + } else { + unplacedEl.textContent = "(none)"; + } + } + } catch (error) { + showPopup("Error: " + error, false); + showPage("mainPage"); + } finally { + } +} + +async function moveCreature(creatureId) { + // Ask user hab + const targetHabitat = prompt("Move to habitat (1-4) or 0 for unplaced:"); + + if (targetHabitat === null) return; + + const targetNum = parseInt(targetHabitat); + + if (isNaN(targetNum) || targetNum < 0 || targetNum > 4) { + showPopup("Invalid habitat number", false); + return; + } + + let targetHabitatId = null; + if (targetNum > 0) { + const targetHab = currentHabitatsData.find((h) => h.number === targetNum); + if (targetHab) { + targetHabitatId = targetHab.id; + } + } + + try { + const response = await fetch("/move", { + method: "POST", + headers: { + "Content-Type": "application/json", + }, + body: JSON.stringify({ + player_id: playerId, + creature_id: creatureId, + target_habitat_id: targetHabitatId, + }), + }); + + const data = await response.json(); + + if (data.success) { + showPopup("Creature moved successfully!", true); + setTimeout(() => { + hidePopup(); + loadManagePage(); + }, 1000); + } else { + showPopup( + data.messages ? data.messages.join("\n") : "Move failed", + false + ); + } + } catch (error) { + showPopup("Error: " + error, false); + } finally { + } +} + +async function loadJournalPage() { + showPage("journalPage"); + + try { + const response = await fetch(`/journal?player_id=${playerId}`); + const data = await response.json(); + + if (data.success) { + const journalList = document.getElementById("journalList"); + journalList.innerHTML = ""; + + const discovered = data.discovered_count || 0; + const total = data.total_species || 16; + + const summary = document.createElement("div"); + summary.style.gridColumn = "1 / -1"; + summary.style.marginBottom = "20px"; + summary.textContent = `Discovered: ${discovered}/${total} species`; + journalList.appendChild(summary); + + if (data.creatures) { + data.creatures.forEach((creature) => { + const item = document.createElement("div"); + item.className = "journal-item"; + + if (creature.discovered) { + if (creature.image) { + const img = document.createElement("img"); + img.src = `${creature.image}`; + img.alt = creature.name; + item.appendChild(img); + } else { + const placeholder = document.createElement("div"); + placeholder.textContent = "No Image"; + placeholder.style.height = "100px"; + placeholder.style.display = "flex"; + placeholder.style.alignItems = "center"; + placeholder.style.justifyContent = "center"; + placeholder.style.border = "1px dashed #ffffffff"; + item.appendChild(placeholder); + } + + const info = document.createElement("p"); + info.innerHTML = `${creature.name}
(${creature.type})`; + item.appendChild(info); + } else { + const placeholder = document.createElement("div"); + placeholder.textContent = "?"; + placeholder.style.fontSize = "40px"; + placeholder.style.height = "100px"; + placeholder.style.display = "flex"; + placeholder.style.alignItems = "center"; + placeholder.style.justifyContent = "center"; + placeholder.style.background = "#000000"; + item.appendChild(placeholder); + + const info = document.createElement("p"); + info.textContent = "???"; + item.appendChild(info); + } + + journalList.appendChild(item); + }); + } + } + } catch (error) { + showPopup("Error: " + error, false); + showPage("mainPage"); + } finally { + } +} + +// action +usernameInput.addEventListener("keypress", (e) => { + if (e.key === "Enter") { + play(); + } +}); + +document.getElementById("loginBtn").addEventListener("click", play); +document + .getElementById("exploreBtn") + .addEventListener("click", loadExplorePage); +document.getElementById("manageBtn").addEventListener("click", loadManagePage); +document + .getElementById("journalBtn") + .addEventListener("click", loadJournalPage); +document.getElementById("exitBtn").addEventListener("click", () => { + if (confirm("Are you sure you want to exit?")) { + showPage("welcomePage"); + playerId = null; + playerUsername = null; + } +}); + +document.getElementById("wildBackBtn").addEventListener("click", () => { + if (!document.getElementById("wildSelection").classList.contains("hidden")) { + loadExplorePage(); + } else { + showPage("mainPage"); + } +}); + +document + .getElementById("manageBackBtn") + .addEventListener("click", () => showPage("mainPage")); +document + .getElementById("journalBackBtn") + .addEventListener("click", () => showPage("mainPage")); +document.getElementById("popupOkBtn").addEventListener("click", hidePopup); diff --git a/templates/index.html b/templates/index.html new file mode 100644 index 0000000..06cc602 --- /dev/null +++ b/templates/index.html @@ -0,0 +1,101 @@ + + + + + + Creature Capture + + + +
+ +
+

Welcome

+
+ + + +
+
+ + +
+

Main Page

+
+ + + + +
+
+ + +
+

Explore

+
+ +
+

Click companion:

+
+
+ + + +
+
+ + +
+

Manage

+
+
+
+

Habitat 1

+
+
+
+

Habitat 2

+
+
+
+

Habitat 3

+
+
+
+

Habitat 4

+
+
+
+
+

Unplaced

+
+
+
+ +
+ + +
+

View Journal

+
+
+
+ +
+ + + +
+ + + + From 707971b0ac054e6dc53f6283e511e081e664c4b0 Mon Sep 17 00:00:00 2001 From: Sorathor Date: Sat, 29 Nov 2025 15:03:56 +0200 Subject: [PATCH 04/91] core game logic and endpoint --- game.py | 452 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 452 insertions(+) create mode 100644 game.py diff --git a/game.py b/game.py new file mode 100644 index 0000000..a0ec556 --- /dev/null +++ b/game.py @@ -0,0 +1,452 @@ +from flask import Flask, render_template, request, jsonify, send_from_directory +from flask_cors import CORS +import random + +from creature_game import Database, Game, Player, Creature, PlayerCreature, Habitat + +app = Flask(__name__) +CORS(app) + +##connect database +def get_db(): + return Database( + host='localhost', + user='root', + password='123456789', + database='creature_catcher' + ) + + +@app.route('/') +def index(): + return render_template('index.html') + + +@app.route('/images/') +def serve_image(filename): + return send_from_directory('images', filename) + + +@app.route('/login', methods=['POST']) +def login(): + """Login or create player""" + data = request.json + username = data.get('username', '').strip() + + if not username: + return jsonify({'error': 'no username'}), 400 + + messages = [] + + try: + db = get_db() + game = Game(db) + + # Check if new player + existing_player = Player.get_by_username(db, username) + + if not existing_player: + messages.append(f"🌟 Creating new sanctuary for {username}...") + game.login_or_create(username) + starter = Creature.from_db(db, 1) + messages.append( + f"✨ You received your first creature: {starter.name} ({starter.type.name} type)!") + messages.append(f"📖 {starter.description}") + messages.append("") + messages.append(f"🏠 {starter.name} has been placed in Habitat 1") + messages.append("") + else: + game.login_or_create(username) + messages.append(f"👋 Welcome back to your sanctuary, {username}!") + messages.append("") + + return jsonify({ + 'success': True, + 'messages': messages, + 'player_id': game.player.id, + 'username': game.player.username + }) + + except Exception as e: + messages.append(f"❌ Error: {str(e)}") + return jsonify({'success': False, 'messages': messages}), 500 + +##explore +@app.route('/explore/start', methods=['GET']) +def explore_start(): + """Start exploration - show companions""" + player_id = request.args.get('player_id') + + try: + db = get_db() + player = Player.from_db(db, int(player_id)) + unplaced = player.get_unplaced_creatures(db) + + messages = [] + + # unplaced creatures + if unplaced: + messages.append("") + messages.append( + "⚠️ You have unplaced creatures! Place all creatures in habitats before exploring.") + messages.append(f"📦 {len(unplaced)} creature(s) need placement.") + messages.append("") + return jsonify({'success': False, 'messages': messages, 'error': 'unplaced'}) + + if not player.are_all_happy(db): + messages.append("") + messages.append( + "⚠️ Some creatures are unhappy! You must fix happiness before exploring.") + messages.append( + "Rearrange creatures in habitats or release unhappy ones.") + messages.append("") + return jsonify({'success': False, 'messages': messages, 'error': 'unhappy'}) + + # companions + habitats = player.get_habitats(db) + all_creatures = [] + for habitat in habitats: + all_creatures.extend(habitat.creatures) + + if not all_creatures: + messages.append("") + messages.append("❌ You have no creatures to take as companions!") + messages.append("") + return jsonify({'success': False, 'messages': messages, 'error': 'no_creatures'}) + + messages.append("") + messages.append("🎒 Choose a companion for exploration:") + for i, pc in enumerate(all_creatures, 1): + messages.append( + f" [{i}] {pc.nickname} ({pc.creature.type.name}) - Happiness: {pc.happiness}%") + messages.append("") + messages.append("Select companion (number):") + + companions_data = [{'id': pc.id, 'nickname': pc.nickname, + 'type': pc.creature.type.name} for pc in all_creatures] + + return jsonify({ + 'success': True, + 'messages': messages, + 'companions': companions_data + }) + + except Exception as e: + return jsonify({'error': str(e)}), 500 + + +@app.route('/explore/encounter', methods=['POST']) +def explore_encounter(): + """Encounter wild creatures""" + data = request.json + player_id = data.get('player_id') + companion_id = data.get('companion_id') + + if not player_id or not companion_id: + return jsonify({'error': 'Player ID and companion ID required'}), 400 + + try: + db = get_db() + player = Player.from_db(db, int(player_id)) + companion = PlayerCreature.from_db(db, int(companion_id)) + + messages = [] + messages.append("") + messages.append(f"🌿 {companion.nickname} joins you for exploration!") + messages.append("") + + # Check if all discovered + all_species = Creature.get_all(db) + discovered = player.get_discovered_species(db) + + if len(discovered) >= 16: + messages.append( + "🎊 ═══════════════════════════════════════════════════ 🎊") + messages.append(" 🌟 CONGRATULATIONS! YOU'VE CAUGHT THEM ALL! 🌟") + messages.append( + "🎊 ═══════════════════════════════════════════════════ 🎊") + messages.append("") + messages.append(" You've discovered all 16 creature species!") + messages.append(" Your sanctuary is complete!") + messages.append("") + return jsonify({'success': True, 'messages': messages, 'complete': True}) + + # undiscovered creatures + undiscovered = [c for c in all_species if c.id not in discovered] + num_to_show = min(3, len(undiscovered)) + wild_choices = random.sample(undiscovered, num_to_show) + + if num_to_show == 1: + messages.append("🔍 You encounter a wild creature:") + else: + messages.append(f"🔍 You encounter {num_to_show} wild creatures:") + + wild_data = [] + for i, wild in enumerate(wild_choices, 1): + effectiveness = companion.creature.type.get_effectiveness( + db, wild.type.id) + status = "✅ Strong" if effectiveness >= 2.0 else "🟡 Normal" if effectiveness >= 1.0 else "❌ Weak" + messages.append( + f" [{i}] {wild.name} ({wild.type.name}) - {status} attraction - ✨ NEW!") + messages.append(f" {wild.description}") + + wild_data.append({ + 'id': wild.id, + 'name': wild.name, + 'type': wild.type.name, + 'description': wild.description, + 'effectiveness': effectiveness, + 'status': status + }) + + messages.append("") + choice_range = f"1-{num_to_show}" if num_to_show > 1 else "1" + messages.append( + f"Which creature to approach? ({choice_range} or 0 to leave):") + + return jsonify({ + 'success': True, + 'messages': messages, + 'wild_creatures': wild_data, + 'companion_id': companion.id + }) + + except Exception as e: + return jsonify({'error': str(e)}), 500 + + +@app.route('/explore/catch', methods=['POST']) +def explore_catch(): + """Attempt to catch a creature""" + data = request.json + player_id = data.get('player_id') + wild_creature_id = data.get('wild_creature_id') + effectiveness = data.get('effectiveness', 1.0) + + if not player_id or not wild_creature_id: + return jsonify({'error': 'error'}), 400 + + try: + db = get_db() + player = Player.from_db(db, int(player_id)) + target = Creature.from_db(db, int(wild_creature_id)) + base_chance = 0.3 + modified_chance = min(0.95, base_chance * effectiveness) + + messages = [] + messages.append("") + messages.append(f"🎯 Attempting to attract {target.name}...") + messages.append(f" Base chance: 30%") + messages.append(f" Type multiplier: {effectiveness}x") + messages.append(f" Final chance: {int(modified_chance * 100)}%") + messages.append("") + + success = random.random() < modified_chance + + if success: + messages.append( + f"🎉 Success! {target.name} trusts you and joins your sanctuary!") + messages.append("") + player.catch_creature(db, target) + messages.append( + f"✨ {target.name} has been added to your unplaced creatures.") + messages.append("") + else: + messages.append( + f"😞 {target.name} was not convinced and fled. Better luck next time!") + messages.append("") + + return jsonify({ + 'success': True, + 'messages': messages, + 'caught': success, + 'creature_id': target.id + }) + + except Exception as e: + return jsonify({'error': str(e)}), 500 + + +@app.route('/habitats', methods=['GET']) +def view_habitats(): + """View habitats""" + player_id = request.args.get('player_id') + + if not player_id: + return jsonify({'error': 'Player ID required'}), 400 + + try: + db = get_db() + player = Player.from_db(db, int(player_id)) + habitats = player.get_habitats(db) + unplaced = player.get_unplaced_creatures(db) + + messages = [] + messages.append("") + messages.append("🏠 === SANCTUARY HABITATS ===") + messages.append("") + + habitat_data = [] + for habitat in habitats: + messages.append( + f"Habitat {habitat.number} ({len(habitat.creatures)}/{Habitat.MAX_SLOTS} creatures):") + creatures_list = [] + if habitat.creatures: + for i, cre in enumerate(habitat.creatures, 1): + emoji = "😊" if cre.happiness >= 70 else "😐" if cre.happiness >= 30 else "😢" + messages.append( + f" [{i}] {emoji} {cre.nickname} ({cre.creature.type.name}) - {cre.happiness}% happy") + creatures_list.append({ + 'id': cre.id, + 'nickname': cre.nickname, + 'type': cre.creature.type.name, + 'happiness': cre.happiness + }) + else: + messages.append(" (empty)") + messages.append("") + + habitat_data.append({ + 'id': habitat.id, + 'number': habitat.number, + 'creatures': creatures_list, + 'is_full': habitat.is_full() + }) + + messages.append(f"📦 Unplaced Creatures ({len(unplaced)}):") + unplaced_data = [] + if unplaced: + for i, pc in enumerate(unplaced, 1): + messages.append( + f" [{i}] {pc.nickname} ({pc.creature.type.name})") + unplaced_data.append({ + 'id': pc.id, + 'nickname': pc.nickname, + 'type': pc.creature.type.name + }) + else: + messages.append(" (none)") + messages.append("") + + return jsonify({ + 'success': True, + 'messages': messages, + 'habitats': habitat_data, + 'unplaced': unplaced_data + }) + + except Exception as e: + return jsonify({'error': 'error'}), 500 + + +@app.route('/journal', methods=['GET']) +def view_journal(): + """View field journal""" + player_id = request.args.get('player_id') + + if not player_id: + return jsonify({'error': 'Player ID required'}), 400 + + try: + db = get_db() + player = Player.from_db(db, int(player_id)) + discovered = player.get_discovered_species(db) + all_species = Creature.get_all(db) + + creatures_data = [] + for creature in all_species: + is_discovered = creature.id in discovered + creatures_data.append({ + 'id': creature.id, + 'name': creature.name if is_discovered else "???", + 'type': creature.type.name if is_discovered else "???", + 'description': creature.description if is_discovered else "Not yet discovered", + 'image': creature.image_path if is_discovered else None, + 'discovered': is_discovered + }) + + return jsonify({ + 'success': True, + 'creatures': creatures_data, + 'discovered_count': len(discovered), + 'total_species': len(all_species) + }) + + except Exception as e: + return jsonify({'error': str(e)}), 500 + + +@app.route('/move', methods=['POST']) +def move_creature(): + """Move a creature between habitats""" + data = request.json + player_id = data.get('player_id') + creature_id = data.get('creature_id') + target_habitat_id = data.get('target_habitat_id') + + if not player_id or not creature_id: + return jsonify({'error': 'error'}), 400 + + try: + db = get_db() + player = Player.from_db(db, int(player_id)) + creature = PlayerCreature.from_db(db, creature_id) + + if not creature or creature.player_id != player.id: + return jsonify({'error': 'Invalid creature'}), 400 + + messages = [] + + if target_habitat_id is None: + # Move to unplaced + db.execute_commit( + "UPDATE player_creatures SET habitat_id = NULL, habitat_slot = NULL WHERE id = %s", + (creature_id,) + ) + messages.append("") + messages.append( + f"✅ Moved {creature.nickname} to unplaced creatures") + messages.append("") + return jsonify({'success': True, 'messages': messages}) + else: + # Move to habitat + habitats = player.get_habitats(db) + target_habitat = None + for h in habitats: + if h.id == target_habitat_id: + target_habitat = h + break + + if not target_habitat: + return jsonify({'error': 'Invalid habitat'}), 400 + + if target_habitat.is_full(): + messages.append("") + messages.append(f"❌ Habitat {target_habitat.number} is full!") + messages.append("") + return jsonify({'success': False, 'messages': messages}) + + new_slot = len(target_habitat.creatures) + 1 + db.execute_commit( + "UPDATE player_creatures SET habitat_id = %s, habitat_slot = %s WHERE id = %s", + (target_habitat_id, new_slot, creature_id) + ) + + target_habitat.creatures.append(creature) + target_habitat.update_happiness(db) + + messages.append("") + messages.append( + f"✅ Moved {creature.nickname} to Habitat {target_habitat.number}") + messages.append( + f"Updated happiness for Habitat {target_habitat.number}") + messages.append("") + + return jsonify({'success': True, 'messages': messages}) + + except Exception as e: + return jsonify({'error': str(e)}), 500 + + +if __name__ == '__main__': + app.run(debug=True, host='127.0.0.1', port=8080) From d4de2a12ec00f73909275fcc4f86f28c09a3ee7f Mon Sep 17 00:00:00 2001 From: Sorathor Date: Sat, 29 Nov 2025 15:04:33 +0200 Subject: [PATCH 05/91] add compiled bytecode --- __pycache__/creature_game.cpython-312.pyc | Bin 0 -> 38785 bytes 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 __pycache__/creature_game.cpython-312.pyc diff --git a/__pycache__/creature_game.cpython-312.pyc b/__pycache__/creature_game.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..5c1aa31b712589f604b756802c191e2d2f3d65de GIT binary patch literal 38785 zcmdtL3v^rOeJ6PFB0vBn0KVV4;7bH4QWB}RD9IE_iPVF#M9Q*WW*`C-N%7?i&=L_a zb!L+em8db*v=NlpD=JNEYMia7(RCPwhp6WAd_SBrw;Heqaj%m+mRg^|MsvFBVlQE`0qaQPzF{rpq3e}Bf zjv3Dw$4qBTER}lHd?w44aVA^M9pqe@U*KHEw@?$gGd5R)%jC{+nemt9&UIzG)Pn|> zQWMKseE0n{ESXdFlisi6k7FL3=QaP-| zUFs^kRL60`teSIMUFC17#I~w9ceaqp!YUGB;|3P8E)l}M`NVf7hY*{~?y7WExvIZi z^OjaD?@Sp>S(`|SZ{AfeeUG$@>6HFk@sBf=NL%7AlhU54a#xLXD^rT^?n)^IT3hvB^>Qn0wso^bSvq8&9}jo*EY1o?ZOp@FYJx?(sTD zNBPO=v1!lCcn*(_PFyyAK;7?gsA2|})9dyQkGUP1nBmwYmEatWX^#whyfJOZ@POB$ zj_JC`oEP0OJ$v+B>O0`u)idFB@8Y}Tg+I><)cMs68@I%gV*Qi?< z(8U`~59)vhe~-QJZgAfC2I9Dp__jx|?EEUf+OP3zT`Ec~x{>%6k-q6UlA-((-@mPX zD<10S`sF;+oI}$S(@%K^cZ^-w;>d_;hbCy^raW#TW|(w(JeMZ~7n@|(v6y~f$SHW- z-k51%O7Khw1EWae(8cue^??Lphw;J^cw$Cc1?}u3W=sqRGHE^T(Lo^#4HUA;vyf+n z=b<6u$vt^tVAr{mXpQF_wdq{)dcVJvxNpSKQ~0y1l~0vMd=;oo!|SlvHK z>D^b{15;ji%rNNoVug&3-q8w0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| zyC`_Y?N|NO#HQBK3H;82XK$07WRjpTjo#mJpS;T5w|6eS45hg9%}cj0MJn+t8J+*g z?u+|Z>+C9qE`80wzQ3mPnekh3y$4g~V8fC^bo~bc$`u~zDWhnpO(OUwkgGS_p9P%3AN!RuKfO2QjDIdB^a5`p* z|GbMd4-Ac`-rkdm3;)Gs+}%T+zg>yCxY$7YWaYqx*y z%G}5t?%N?gc&<-8N8-TG767y{zk4kB z(sXdQFPQV$u-Q-Sb6yJ$g|HWJ+D+^QMH9-NI~q1uy-ygsX*qvmB!6otf9rDo_Spju z#lsPhqKguA{Jv$>Rv2jcef$asg2>us#agQjvWKkp6>C*IhzXZZg{?0}t@)3(a+X|n znNN?ymi8V*BTXww!^9s;dq8iAxz*9<*U9?|d8A`uLJ2nM!WR0pQv|JVQDhOOH}ZBO z(ldn@y6LcZRjbxD26jBgFH<(I8gg`pRSWphWqN*CcTS~yN%f&$ysG2?>-_BktUGTB&PRX8YYdm@H_<(>k%_`k4;Vp z-cCW75Jcd`Ryob5_`@-m=xvO=&y&a2He2QYmOg3KhZvARThN?^Tb8Y3{Xp5qGMXw(H*j%CFA93XESJkSv&Ev*UJQi`iCmwfC zvPZD@)MNVm_=GA~wf7MR@8b;>xWt??o>G0hUsb9yKH}hg+}fbp@rZ->@i|qmiV~Cm z@u>Q!PF3)TBY*WXMow#<_1)JLzo*R%8h3=XJAa|idyh1XM^+3+e?c#OVZ+H^P;5<$a}7xj4^)!Yv(mJYk-2fT{>YF%fx<_C__&P>e@GwJ>R1H*yP AJpcdz literal 0 HcmV?d00001 From 21f345efa049433f8a4b6282d6c768a9dc5c1fac Mon Sep 17 00:00:00 2001 From: Sorathor Date: Sat, 29 Nov 2025 16:08:21 +0200 Subject: [PATCH 06/91] add .gitattributes for CSS and JS file detection --- .gitattributes | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 .gitattributes diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..0fd85d1 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,2 @@ +*.css linguist-detectable=true +*.js linguist-detectable=true \ No newline at end of file From 72a2d65e50f070105226fd340c31c1c371c07b51 Mon Sep 17 00:00:00 2001 From: Sorathor Date: Sat, 29 Nov 2025 16:09:58 +0200 Subject: [PATCH 07/91] update .gitattributes to enhance language detection for CSS and JS files --- .gitattributes | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.gitattributes b/.gitattributes index 0fd85d1..3049028 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,2 +1,4 @@ *.css linguist-detectable=true -*.js linguist-detectable=true \ No newline at end of file +*.css linguist-language=css +*.js linguist-detectable=true +*.js linguist-language=js \ No newline at end of file From a41e01ca38d6ff640b4973553a43510e9f9dafee Mon Sep 17 00:00:00 2001 From: Sorathor Date: Sat, 29 Nov 2025 16:11:36 +0200 Subject: [PATCH 08/91] restore .gitattributes for CSS and JS file detection --- .gitattributes => static/.gitattributes | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename .gitattributes => static/.gitattributes (100%) diff --git a/.gitattributes b/static/.gitattributes similarity index 100% rename from .gitattributes rename to static/.gitattributes From 57f38afb0311832c852e0f9d6b7b22095bcdddd5 Mon Sep 17 00:00:00 2001 From: Sorathor Date: Sun, 30 Nov 2025 16:44:38 +0200 Subject: [PATCH 09/91] change dir --- .gitattributes | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 .gitattributes diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..3049028 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,4 @@ +*.css linguist-detectable=true +*.css linguist-language=css +*.js linguist-detectable=true +*.js linguist-language=js \ No newline at end of file From a43b85b9e37933f7c62f3063169de844cc149bfb Mon Sep 17 00:00:00 2001 From: Sorathor Date: Sun, 30 Nov 2025 16:46:02 +0200 Subject: [PATCH 10/91] remove .gitattributes file for CSS and JS language detection --- static/.gitattributes | 4 ---- 1 file changed, 4 deletions(-) delete mode 100644 static/.gitattributes diff --git a/static/.gitattributes b/static/.gitattributes deleted file mode 100644 index 3049028..0000000 --- a/static/.gitattributes +++ /dev/null @@ -1,4 +0,0 @@ -*.css linguist-detectable=true -*.css linguist-language=css -*.js linguist-detectable=true -*.js linguist-language=js \ No newline at end of file From b39b216f8113f155995f6b6b530e0868d73d14ce Mon Sep 17 00:00:00 2001 From: Sorathor Date: Sun, 30 Nov 2025 16:47:27 +0200 Subject: [PATCH 11/91] update .gitattributes to include SQL language detection --- .gitattributes | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.gitattributes b/.gitattributes index 3049028..76c605a 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,4 +1,6 @@ *.css linguist-detectable=true *.css linguist-language=css *.js linguist-detectable=true -*.js linguist-language=js \ No newline at end of file +*.js linguist-language=js +*.sql linguist-detectable=true +*.sql linguist-language=sql \ No newline at end of file From 4c6f5de3d25b492a9e670b770e3114f13fdc0afa Mon Sep 17 00:00:00 2001 From: thapanavin83-source Date: Mon, 1 Dec 2025 13:24:23 +0200 Subject: [PATCH 12/91] First commit --- project2/viewjournal.html | 144 ++++++++++++++++++++++++++++++++++++++ project2/viewjournal.js | 0 2 files changed, 144 insertions(+) create mode 100644 project2/viewjournal.html create mode 100644 project2/viewjournal.js diff --git a/project2/viewjournal.html b/project2/viewjournal.html new file mode 100644 index 0000000..9effe7d --- /dev/null +++ b/project2/viewjournal.html @@ -0,0 +1,144 @@ + + + + + + Field Journal + + + + + + +
+

FIELD JOURNAL

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
S.NNAMETYPEIMAGE
1SpriggleBloom
2CapycharaFlame
3ChromuttMetal
4Unknown (Not found yet)UnknownUnknown
5Unknown (Not found yet)UnknownUnknown
6GrandclamEarth
7BorealynxFrost
8Unknown (Not found yet)UnknownUnknown
9Unknown (Not found yet)UnknownUnknown
10PangostrikeThunderUnknown
11Unknown (Not found yet)UnknownUnknown
12GeckathystStone
13ShaduranToxic
14Unknown (Not found yet)UnknownUnknown
15Unknown (Not found yet)UnknownUnknown
16Unknown (Not found yet)UnknownUnknown
+
+ + + diff --git a/project2/viewjournal.js b/project2/viewjournal.js new file mode 100644 index 0000000..e69de29 From 24c64093c2b0fe513e2b61911363d01f0449b000 Mon Sep 17 00:00:00 2001 From: thapanavin83-source Date: Tue, 2 Dec 2025 11:19:40 +0200 Subject: [PATCH 13/91] First commit --- game.py | 4 +- project2/server.py | 22 +++ .../setup-database.py | 4 +- project2/viewjournal.html | 145 +----------------- project2/viewjournal.js | 34 ++++ 5 files changed, 67 insertions(+), 142 deletions(-) create mode 100644 project2/server.py rename setup-database.py => project2/setup-database.py (97%) diff --git a/game.py b/game.py index a0ec556..068cee9 100644 --- a/game.py +++ b/game.py @@ -10,9 +10,9 @@ ##connect database def get_db(): return Database( - host='localhost', + host='127.0.0.1', user='root', - password='123456789', + password='123', database='creature_catcher' ) diff --git a/project2/server.py b/project2/server.py new file mode 100644 index 0000000..56c92ba --- /dev/null +++ b/project2/server.py @@ -0,0 +1,22 @@ +from flask import Flask, request, jsonify +from flask_cors import CORS + +app = Flask(__name__) +CORS(app) + +import mysql.connector +@app.route('/journal', methods=['GET']) +def get_journal(): + db = mysql.connector.connect( + host="localhost", + user="root", + passwd="123", + database="creature_catcher" + ) + cursor = db.cursor() + cursor.execute("""SELECT a.id AS SN, a.name AS name, b.name AS type FROM creatures a LEFT JOIN types b ON a.id = b.id""") + result=cursor.fetchall() + print(result) + return jsonify(result) +if __name__ == '__main__': + app.run(debug=True) \ No newline at end of file diff --git a/setup-database.py b/project2/setup-database.py similarity index 97% rename from setup-database.py rename to project2/setup-database.py index 90c5dd2..009ee65 100644 --- a/setup-database.py +++ b/project2/setup-database.py @@ -12,7 +12,7 @@ def setup_database(): # Connection details - UPDATE THESE DB_HOST = 'localhost' DB_USER = 'root' - DB_PASSWORD = '123456789' # <-- UPDATE WITH YOUR PASSWORD + DB_PASSWORD = '123' # <-- UPDATE WITH YOUR PASSWORD DB_NAME = 'creature_catcher' try: @@ -22,7 +22,7 @@ def setup_database(): host=DB_HOST, user=DB_USER, password=DB_PASSWORD, - charset='utf8mb4' + database=DB_NAME ) with connection.cursor() as cursor: diff --git a/project2/viewjournal.html b/project2/viewjournal.html index 9effe7d..64a8158 100644 --- a/project2/viewjournal.html +++ b/project2/viewjournal.html @@ -1,144 +1,13 @@ - + - - + + Field Journal - - - + - -
-

FIELD JOURNAL

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
S.NNAMETYPEIMAGE
1SpriggleBloom
2CapycharaFlame
3ChromuttMetal
4Unknown (Not found yet)UnknownUnknown
5Unknown (Not found yet)UnknownUnknown
6GrandclamEarth
7BorealynxFrost
8Unknown (Not found yet)UnknownUnknown
9Unknown (Not found yet)UnknownUnknown
10PangostrikeThunderUnknown
11Unknown (Not found yet)UnknownUnknown
12GeckathystStone
13ShaduranToxic
14Unknown (Not found yet)UnknownUnknown
15Unknown (Not found yet)UnknownUnknown
16Unknown (Not found yet)UnknownUnknown
-
- +
- + + \ No newline at end of file diff --git a/project2/viewjournal.js b/project2/viewjournal.js index e69de29..da579dd 100644 --- a/project2/viewjournal.js +++ b/project2/viewjournal.js @@ -0,0 +1,34 @@ +async function get_data() { + const url = "http://127.0.0.1:5000/journal"; + const response = await fetch(url); + return await response.json(); +} + +function createRow(row) { + // row = [id, name, type] + const id = row[0]; + const name = row[1]; + const type = row[2]; + + const div = document.createElement("div"); + div.innerHTML = ` +

SN: ${id}

+

Name: ${name}

+

Type: ${type}

+
+ `; + return div; +} + +async function load_journal() { + const table = document.querySelector("#journal"); + + let data = await get_data(); // data = array of rows + + data.forEach(row => { + const item = createRow(row); + table.appendChild(item); + }); +} + +load_journal(); From 4fbd8484a2910bd3ee83a7918f6befbcfebc0132 Mon Sep 17 00:00:00 2001 From: thapanavin83-source Date: Tue, 2 Dec 2025 11:32:43 +0200 Subject: [PATCH 14/91] second commit --- project2/viewjournal.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/project2/viewjournal.js b/project2/viewjournal.js index da579dd..844a31a 100644 --- a/project2/viewjournal.js +++ b/project2/viewjournal.js @@ -5,7 +5,7 @@ async function get_data() { } function createRow(row) { - // row = [id, name, type] + const id = row[0]; const name = row[1]; const type = row[2]; @@ -23,7 +23,7 @@ function createRow(row) { async function load_journal() { const table = document.querySelector("#journal"); - let data = await get_data(); // data = array of rows + let data = await get_data(); data.forEach(row => { const item = createRow(row); From 4269f304600bdae45fa5e23f4397e5219d7eba91 Mon Sep 17 00:00:00 2001 From: fozia mumin Date: Tue, 2 Dec 2025 13:16:56 +0200 Subject: [PATCH 15/91] login.html --- loginpage/login.html | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 loginpage/login.html diff --git a/loginpage/login.html b/loginpage/login.html new file mode 100644 index 0000000..51617aa --- /dev/null +++ b/loginpage/login.html @@ -0,0 +1,24 @@ + + + + + + + Creaturecatch login + + + + +
+

Welcome to creature catch

+ + + +
+ + + \ No newline at end of file From b95a46288f83908649d586c657a117fd8e293c37 Mon Sep 17 00:00:00 2001 From: fozia mumin Date: Tue, 2 Dec 2025 13:21:36 +0200 Subject: [PATCH 16/91] login.c --- loginpage/login.css | 48 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 loginpage/login.css diff --git a/loginpage/login.css b/loginpage/login.css new file mode 100644 index 0000000..d2b4f96 --- /dev/null +++ b/loginpage/login.css @@ -0,0 +1,48 @@ +body{ + background:black; + font-family:geometric,sans-serif; + color:white; + display:flex; + justify-content:center; + align-items:center; + height:100vh; + margin:0; +} +.wrapper{ +text-align:centre; +} + + +.login-box{ + margin-top:20px; + display:flex; + flex-direction:column; + gap:20px; + width:250px; + margin-left:auto; + margin-right:auto; +} +h1 { + font-size: 48px; + font-weight: bold; + text-align: center; + background: linear-gradient(90deg, #4ade80, #22c55e); + +} + +.input{ + padding:10px; + border-radius:6px; + border:4px; + outline:none; + font-size:16px; +} +.btn{ + padding:10px; + background:green; + border-radius:6px; + border:none; + font-size:16px; + font-weight:bold; + cursor:pointer; +} From 8bf7a6cb29a8df337a02f80da4d00cc217fd0f2a Mon Sep 17 00:00:00 2001 From: fozia mumin Date: Tue, 2 Dec 2025 13:21:43 +0200 Subject: [PATCH 17/91] login.c --- loginpage/login.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 loginpage/login.js diff --git a/loginpage/login.js b/loginpage/login.js new file mode 100644 index 0000000..6fc3a14 --- /dev/null +++ b/loginpage/login.js @@ -0,0 +1,14 @@ +const btn =document.getElementById("enterBtn") +const username = document.getElementById("username") + + +btn.addEventListener("click",() => { + if(username.value.trim()=== ""){ + alert("please enter a username to continue,"); + }else{ + + + } + + +}); \ No newline at end of file From 90a8d2807a87ea09bd3c5a4a43e09734c1f02b9f Mon Sep 17 00:00:00 2001 From: fozia mumin Date: Tue, 2 Dec 2025 13:22:20 +0200 Subject: [PATCH 18/91] change pwd --- creature_game.py | 4 ++-- setup-database.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/creature_game.py b/creature_game.py index d147dad..53a1146 100644 --- a/creature_game.py +++ b/creature_game.py @@ -22,7 +22,7 @@ class Database: """Database connection handler""" - def __init__(self, host='localhost', user='root', password='', database='creature_catcher'): + def __init__(self, host='localhost', user='root', password='Faiza350', database='creature_catcher'): self.connection = pymysql.connect( host=host, user=user, @@ -659,7 +659,7 @@ def main_menu(self): db = Database( host='localhost', user='root', - password='Cde3xsw2', + password='Faiza350', database='creature_catcher' ) print("✅ Connected!\n") diff --git a/setup-database.py b/setup-database.py index 8e5aec0..7ad0f5d 100644 --- a/setup-database.py +++ b/setup-database.py @@ -12,7 +12,7 @@ def setup_database(): # Connection details - UPDATE THESE DB_HOST = 'localhost' DB_USER = 'root' - DB_PASSWORD = 'Cde3xsw2' # <-- UPDATE WITH YOUR PASSWORD + DB_PASSWORD = 'Faiza350' # <-- UPDATE WITH YOUR PASSWORD DB_NAME = 'creature_catcher' try: From 38c40c28047ed793297d14380527bd7a7b3496e8 Mon Sep 17 00:00:00 2001 From: fozia mumin Date: Tue, 2 Dec 2025 13:56:03 +0200 Subject: [PATCH 19/91] exit --- exitpage/exit.css | 20 ++++++++++++++++++++ exitpage/exit.js | 9 +++++++++ 2 files changed, 29 insertions(+) create mode 100644 exitpage/exit.css create mode 100644 exitpage/exit.js diff --git a/exitpage/exit.css b/exitpage/exit.css new file mode 100644 index 0000000..e9d6fda --- /dev/null +++ b/exitpage/exit.css @@ -0,0 +1,20 @@ +body{ + background:black; + font-family:geometric,sans-serif; + color:white; + display:flex; + justify-content:center; + align-items:center; + height:100vh; + margin:0; +} + +.btn{ + padding:10px; + background:green; + border-radius:6px; + border:none; + font-size:16px; + font-weight:bold; + cursor:pointer; +} diff --git a/exitpage/exit.js b/exitpage/exit.js new file mode 100644 index 0000000..697281c --- /dev/null +++ b/exitpage/exit.js @@ -0,0 +1,9 @@ +const playBtn = document.getElementById(playBtn) +playBtn.addEventListener("click",()=> { + + +window.location.href="login.html" + + + +) \ No newline at end of file From 8caaa78b13ec543804d951869cf5fb1d8d57c04e Mon Sep 17 00:00:00 2001 From: fozia mumin Date: Tue, 2 Dec 2025 14:00:37 +0200 Subject: [PATCH 20/91] add exit.html --- exitpage/exit.html | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 exitpage/exit.html diff --git a/exitpage/exit.html b/exitpage/exit.html new file mode 100644 index 0000000..57b5713 --- /dev/null +++ b/exitpage/exit.html @@ -0,0 +1,21 @@ + + + + + + + Creaturecatch login + + + + +
+

You have successfully logged out.

+

Thank you for playing creature catch.

+

Click play to play again.

+ + +
+ + + \ No newline at end of file From c7e7c3e81011ed610cd55bb1bf12ab1a52add487 Mon Sep 17 00:00:00 2001 From: maria Date: Tue, 2 Dec 2025 14:08:43 +0200 Subject: [PATCH 21/91] main page --- Project2-draft/Main-Paige.html | 18 ++++++++++++++++++ Project2-draft/exit.html | 10 ++++++++++ Project2-draft/explore-page.html | 10 ++++++++++ Project2-draft/front-page.html | 10 ++++++++++ Project2-draft/manage.html | 10 ++++++++++ Project2-draft/style.css | 28 ++++++++++++++++++++++++++++ Project2-draft/view-journal.html | 10 ++++++++++ creature_game.py | 4 ++-- setup-database.py | 2 +- 9 files changed, 99 insertions(+), 3 deletions(-) create mode 100644 Project2-draft/Main-Paige.html create mode 100644 Project2-draft/exit.html create mode 100644 Project2-draft/explore-page.html create mode 100644 Project2-draft/front-page.html create mode 100644 Project2-draft/manage.html create mode 100644 Project2-draft/style.css create mode 100644 Project2-draft/view-journal.html diff --git a/Project2-draft/Main-Paige.html b/Project2-draft/Main-Paige.html new file mode 100644 index 0000000..6adc8da --- /dev/null +++ b/Project2-draft/Main-Paige.html @@ -0,0 +1,18 @@ + + + + + Main Page + + + +

Main Page

+ +
    +
  • +
  • +
  • +
  • +
+ + diff --git a/Project2-draft/exit.html b/Project2-draft/exit.html new file mode 100644 index 0000000..6fbeaf6 --- /dev/null +++ b/Project2-draft/exit.html @@ -0,0 +1,10 @@ + + + + + Exit + + +

This is the Exit page

+ + \ No newline at end of file diff --git a/Project2-draft/explore-page.html b/Project2-draft/explore-page.html new file mode 100644 index 0000000..1f32e8b --- /dev/null +++ b/Project2-draft/explore-page.html @@ -0,0 +1,10 @@ + + + + + Explore + + + + + \ No newline at end of file diff --git a/Project2-draft/front-page.html b/Project2-draft/front-page.html new file mode 100644 index 0000000..49c854b --- /dev/null +++ b/Project2-draft/front-page.html @@ -0,0 +1,10 @@ + + + + + Front Page + + + + + \ No newline at end of file diff --git a/Project2-draft/manage.html b/Project2-draft/manage.html new file mode 100644 index 0000000..15d820e --- /dev/null +++ b/Project2-draft/manage.html @@ -0,0 +1,10 @@ + + + + + Manage + + + + + \ No newline at end of file diff --git a/Project2-draft/style.css b/Project2-draft/style.css new file mode 100644 index 0000000..9cc1ab5 --- /dev/null +++ b/Project2-draft/style.css @@ -0,0 +1,28 @@ + +ul { + list-style: none; + padding: 0; + margin: 0; +} + +body { + text-align: center; + background: sandybrown; +} + +button { + padding: 50px 550px; + margin: 8px; + width: 200px; + height: 50px; + font-size: 16px; + background-color: darkgreen; + color: white; + border: none; + border-radius: 5px; + cursor: pointer; +} + +button:hover { + background-color: darkolivegreen; +} diff --git a/Project2-draft/view-journal.html b/Project2-draft/view-journal.html new file mode 100644 index 0000000..7392ece --- /dev/null +++ b/Project2-draft/view-journal.html @@ -0,0 +1,10 @@ + + + + + View Journal + + + + + \ No newline at end of file diff --git a/creature_game.py b/creature_game.py index d147dad..12c1949 100644 --- a/creature_game.py +++ b/creature_game.py @@ -22,7 +22,7 @@ class Database: """Database connection handler""" - def __init__(self, host='localhost', user='root', password='', database='creature_catcher'): + def __init__(self, host='localhost', user='root', password='metropolia', database='creature_catcher'): self.connection = pymysql.connect( host=host, user=user, @@ -659,7 +659,7 @@ def main_menu(self): db = Database( host='localhost', user='root', - password='Cde3xsw2', + password='metropolia', database='creature_catcher' ) print("✅ Connected!\n") diff --git a/setup-database.py b/setup-database.py index 8e5aec0..de2260b 100644 --- a/setup-database.py +++ b/setup-database.py @@ -12,7 +12,7 @@ def setup_database(): # Connection details - UPDATE THESE DB_HOST = 'localhost' DB_USER = 'root' - DB_PASSWORD = 'Cde3xsw2' # <-- UPDATE WITH YOUR PASSWORD + DB_PASSWORD = 'metropolia' # <-- UPDATE WITH YOUR PASSWORD DB_NAME = 'creature_catcher' try: From 5c574f3f1d5244a3a1fb9277a203d03b5cac4b94 Mon Sep 17 00:00:00 2001 From: Sorathor Date: Tue, 2 Dec 2025 22:31:40 +0200 Subject: [PATCH 22/91] update compiled Python bytecode for creature_game --- __pycache__/creature_game.cpython-312.pyc | Bin 38785 -> 38788 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/__pycache__/creature_game.cpython-312.pyc b/__pycache__/creature_game.cpython-312.pyc index 5c1aa31b712589f604b756802c191e2d2f3d65de..6038810b9c480401090074828f187cef491c633e 100644 GIT binary patch delta 68 zcmZo%&(yM>iT5-wFBbz4L~`qAYHs9h;^yRVOU$fFG&VKZJb}BigQv(8C|hI(Bs5tj U7qE(K)|=AI$Y`^9)70~f09PXtTL1t6 delta 65 zcmZo!&(ye{iT5-wFBbz42=i-YDsJR$;$~#nJcGNkL+}=db4sdlMRB=Nkr_~4lVx%N TtH@@ Date: Tue, 2 Dec 2025 22:33:51 +0200 Subject: [PATCH 23/91] change the style of the welcome page like Fozia's one --- static/game.css | 26 ++++++++++++++++++++++++-- templates/index.html | 6 +++--- 2 files changed, 27 insertions(+), 5 deletions(-) diff --git a/static/game.css b/static/game.css index 252fab2..0e1f7cd 100644 --- a/static/game.css +++ b/static/game.css @@ -36,10 +36,32 @@ body { justify-content: center; align-items: center; } -.btn, +.btn { + width: 100%; + padding: 10px; + margin-bottom: 10px; + display: block; + font-size: 16px; + background: green; + border: none; + border-radius: 6px; + font-size: 16px; + font-weight: bold; + cursor: pointer; +} +.welcomeHeader { + font-size: 48px; + font-weight: bold; + text-align: center; + background: linear-gradient(90deg, #4ade80, #22c55e); +} input { width: 100%; - padding: 8px; + padding: 10px; + border-radius: 6px; + border: 4px; + outline: none; + font-size: 16px; margin-bottom: 10px; display: block; font-size: 16px; diff --git a/templates/index.html b/templates/index.html index 06cc602..5d05a6c 100644 --- a/templates/index.html +++ b/templates/index.html @@ -10,11 +10,11 @@
-

Welcome

+

Welcome to creature catch

- + - +
From 7caac44d3bc70afd5dee184f63fff63c25b6426e Mon Sep 17 00:00:00 2001 From: Sorathor Date: Tue, 2 Dec 2025 23:47:05 +0200 Subject: [PATCH 24/91] fix: correct header formatting and add exit page to index.html --- templates/index.html | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/templates/index.html b/templates/index.html index 5d05a6c..5ea2952 100644 --- a/templates/index.html +++ b/templates/index.html @@ -10,7 +10,7 @@
-

Welcome to creature catch

+

Welcome to creature catch

@@ -87,6 +87,14 @@

View Journal

+ +
+

You have successfully logged out.

+

Thank you for playing creature catch.

+

Click play to play again.

+ +
+