diff --git a/.gitignore b/.gitignore
index 28d54e6..379dd0a 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,2 +1,3 @@
.installed
database.db
+database.db-*
diff --git a/src/lib.php b/src/lib.php
index 7cacfe7..3fbc3b2 100644
--- a/src/lib.php
+++ b/src/lib.php
@@ -273,3 +273,23 @@ function get_town_by_xy(int $x, int $y): array|false
if ($query === false) return false;
return $query->fetchArray(SQLITE3_ASSOC);
}
+
+/**
+ * Get a town's data by it's ID.
+ */
+function get_town_by_id(int $id): array|false
+{
+ $query = db()->query('SELECT * FROM towns WHERE id = ? LIMIT 1;', [$id]);
+ if ($query === false) return false;
+ return $query->fetchArray(SQLITE3_ASSOC);
+}
+
+/**
+ * Get an item by it's ID.
+ */
+function get_item(int $id): array|false
+{
+ $query = db()->query('SELECT * FROM items WHERE id=? LIMIT 1;', [$id]);
+ if ($query === false) return false;
+ return $query->fetchArray(SQLITE3_ASSOC);
+}
diff --git a/src/towns.php b/src/towns.php
index b49f64a..ae18f33 100644
--- a/src/towns.php
+++ b/src/towns.php
@@ -28,343 +28,292 @@ function inn()
redirect('index.php');
} else {
$title = "Inn";
- $page = "Resting at the inn will refill your current HP, MP, and TP to their maximum levels.
\n";
- $page .= "A night's sleep at this Inn will cost you " . $townrow["innprice"] . " gold. Is that ok?
\n";
- $page .= "