diff --git a/admin.php b/admin.php
index a7a4cff..15d1eb0 100644
--- a/admin.php
+++ b/admin.php
@@ -646,6 +646,13 @@ if ($_SERVER["REQUEST_METHOD"] === "POST" && isset($_POST["action"]) && $_POST["
$bonus_destruction = (int)$_POST["bonus_destruction"];
$bonus_capture = (int)$_POST["bonus_capture"];
$grid_data = $_POST["grid_data"];
+
+ $cost_resource_id = !empty($_POST["cost_resource_id"]) ? (int)$_POST["cost_resource_id"] : null;
+ $cost_amount = (int)$_POST["cost_amount"];
+ $destruction_resource_id = !empty($_POST["destruction_resource_id"]) ? (int)$_POST["destruction_resource_id"] : null;
+ $destruction_amount = (int)$_POST["destruction_amount"];
+ $capture_resource_id = !empty($_POST["capture_resource_id"]) ? (int)$_POST["capture_resource_id"] : null;
+ $capture_amount = (int)$_POST["capture_amount"];
$image_url = null;
if ($id > 0) {
@@ -665,11 +672,11 @@ if ($_SERVER["REQUEST_METHOD"] === "POST" && isset($_POST["action"]) && $_POST["
}
if ($id > 0) {
- $stmt = $db->prepare("UPDATE units SET name = ?, slug = ?, faction_id = ?, can_be_destroyed = ?, can_be_captured = ?, points_per_hit = ?, bonus_destruction = ?, bonus_capture = ?, grid_data = ?, image_url = ? WHERE id = ?");
- $stmt->execute([$name, $slug, $faction_id, $can_be_destroyed, $can_be_captured, $points_per_hit, $bonus_destruction, $bonus_capture, $grid_data, $image_url, $id]);
+ $stmt = $db->prepare("UPDATE units SET name = ?, slug = ?, faction_id = ?, can_be_destroyed = ?, can_be_captured = ?, points_per_hit = ?, bonus_destruction = ?, bonus_capture = ?, grid_data = ?, image_url = ?, cost_resource_id = ?, cost_amount = ?, destruction_resource_id = ?, destruction_amount = ?, capture_resource_id = ?, capture_amount = ? WHERE id = ?");
+ $stmt->execute([$name, $slug, $faction_id, $can_be_destroyed, $can_be_captured, $points_per_hit, $bonus_destruction, $bonus_capture, $grid_data, $image_url, $cost_resource_id, $cost_amount, $destruction_resource_id, $destruction_amount, $capture_resource_id, $capture_amount, $id]);
} else {
- $stmt = $db->prepare("INSERT INTO units (name, slug, faction_id, can_be_destroyed, can_be_captured, points_per_hit, bonus_destruction, bonus_capture, grid_data, image_url) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)");
- $stmt->execute([$name, $slug, $faction_id, $can_be_destroyed, $can_be_captured, $points_per_hit, $bonus_destruction, $bonus_capture, $grid_data, $image_url]);
+ $stmt = $db->prepare("INSERT INTO units (name, slug, faction_id, can_be_destroyed, can_be_captured, points_per_hit, bonus_destruction, bonus_capture, grid_data, image_url, cost_resource_id, cost_amount, destruction_resource_id, destruction_amount, capture_resource_id, capture_amount) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)");
+ $stmt->execute([$name, $slug, $faction_id, $can_be_destroyed, $can_be_captured, $points_per_hit, $bonus_destruction, $bonus_capture, $grid_data, $image_url, $cost_resource_id, $cost_amount, $destruction_resource_id, $destruction_amount, $capture_resource_id, $capture_amount]);
$id = $db->lastInsertId();
}
@@ -797,6 +804,54 @@ elseif ($tab === "units") {