summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Weipert <git@mail.dweipert.de>2024-01-08 15:10:10 +0100
committerDaniel Weipert <git@mail.dweipert.de>2024-01-08 15:10:10 +0100
commit82875448c485d26375ed6dea4e64e940f6e10f74 (patch)
treeff2580447429309824e7d64401ad75e7f756e45e
parentb21316248572cb27ed1f504529ad6680a473022e (diff)
gemini
-rw-r--r--src/Model/Building.php16
-rw-r--r--src/Model/Building/ClayPit.php7
-rw-r--r--src/Model/Building/Embassy.php7
-rw-r--r--src/Model/Building/Farm.php9
-rw-r--r--src/Model/Building/IronMine.php7
-rw-r--r--src/Model/Building/Marketplace.php7
-rw-r--r--src/Model/Building/Storage.php7
-rw-r--r--src/Model/Building/TownHall.php7
-rw-r--r--src/Model/Building/WoodCutter.php7
-rw-r--r--src/Model/Unit.php43
-rw-r--r--src/Model/Unit/Diplomat.php9
-rw-r--r--src/Model/Unit/Farmer.php9
-rw-r--r--src/Model/Unit/Merchant.php9
-rw-r--r--src/Model/Unit/Miner.php9
-rw-r--r--src/Model/Unit/PitWorker.php9
-rw-r--r--src/Model/Unit/WoodCutter.php9
-rw-r--r--src/gemini/Controller/Unit.php94
-rw-r--r--src/gemini/Controller/Village.php2
-rw-r--r--src/gemini/Gemini.php26
-rw-r--r--src/http/Controller/Village.php2
-rw-r--r--views/gemini/footer.twig5
-rw-r--r--views/gemini/send-units/01-units.twig3
-rw-r--r--views/gemini/send-units/02-villages.twig5
-rw-r--r--views/gemini/send-units/03-actions.twig5
-rw-r--r--views/gemini/storage.twig2
-rw-r--r--views/gemini/village.twig16
-rw-r--r--views/gemini/villages.twig9
-rw-r--r--views/http/villages.twig2
28 files changed, 289 insertions, 53 deletions
diff --git a/src/Model/Building.php b/src/Model/Building.php
index eefb4df..e42af03 100644
--- a/src/Model/Building.php
+++ b/src/Model/Building.php
@@ -18,7 +18,8 @@ class Building
public string $unitType;
public int $buildTimeFactor;
- public array $resourceRequirements;
+ public array $resourceRequirementsBase;
+ public array $resourceRequirementsFactor;
public array $buildingRequirements;
public array $techRequirements;
public int $maxLevel;
@@ -104,10 +105,15 @@ class Building
*/
public function getResourceRequirementsForLevel(int $level): array
{
- return array_map(
- fn ($resourceRequirement) => ceil(log($level * 2) * $resourceRequirement * $_ENV['BASE_BUILDING_RESOURCE_REQUIREMENT_FACTOR'] * $level),
- $this->resourceRequirements
- );
+ $resourceRequirements = [];
+ foreach (['wood', 'clay', 'iron'] as $resourceType) {
+ $base = $this->resourceRequirementsBase[$resourceType];
+ $factor = $this->resourceRequirementsFactor[$resourceType];
+
+ $resourceRequirements[$resourceType] = $base + ceil(log($level * 2) * $factor * $_ENV['BASE_BUILDING_RESOURCE_REQUIREMENT_FACTOR'] * $level);
+ }
+
+ return $resourceRequirements;
}
diff --git a/src/Model/Building/ClayPit.php b/src/Model/Building/ClayPit.php
index b4905eb..dfead72 100644
--- a/src/Model/Building/ClayPit.php
+++ b/src/Model/Building/ClayPit.php
@@ -8,7 +8,12 @@ class ClayPit extends ResourceGenerator
public int $buildTimeFactor = 1;
public int $maxLevel = 25;
- public array $resourceRequirements = [
+ public array $resourceRequirementsBase = [
+ 'wood' => 100,
+ 'clay' => 200,
+ 'iron' => 100,
+ ];
+ public array $resourceRequirementsFactor = [
'wood' => 1.0,
'clay' => 2.0,
'iron' => 1.0,
diff --git a/src/Model/Building/Embassy.php b/src/Model/Building/Embassy.php
index 3be1f7f..a8a1ec4 100644
--- a/src/Model/Building/Embassy.php
+++ b/src/Model/Building/Embassy.php
@@ -9,7 +9,12 @@ class Embassy extends Building
public int $buildTimeFactor = 1;
public int $maxLevel = 25;
- public array $resourceRequirements = [
+ public array $resourceRequirementsBase = [
+ 'wood' => 2500,
+ 'clay' => 2500,
+ 'iron' => 3000,
+ ];
+ public array $resourceRequirementsFactor = [
'wood' => 25.0,
'clay' => 25.0,
'iron' => 30.0,
diff --git a/src/Model/Building/Farm.php b/src/Model/Building/Farm.php
index 222d8cd..1a69c89 100644
--- a/src/Model/Building/Farm.php
+++ b/src/Model/Building/Farm.php
@@ -11,7 +11,12 @@ class Farm extends ResourceGenerator
public int $buildTimeFactor = 1;
public int $maxLevel = 25;
- public array $resourceRequirements = [
+ public array $resourceRequirementsBase = [
+ 'wood' => 100,
+ 'clay' => 100,
+ 'iron' => 100,
+ ];
+ public array $resourceRequirementsFactor = [
'wood' => 1.0,
'clay' => 1.0,
'iron' => 1.0,
@@ -22,7 +27,7 @@ class Farm extends ResourceGenerator
public function getResourceIncrementor(): int
{
$populationDemand = array_reduce(
- Village::getUnits($this->villageId, Village::FETCH_UNIT_RESIDENCE),
+ Village::getUnits($this->villageId, Village::FETCH_UNIT_RESIDENCE, Village::RETURN_UNIT_EXISTING),
function ($carry, Unit $unit) {
return $carry + $unit->getPopulationDemand();
}
diff --git a/src/Model/Building/IronMine.php b/src/Model/Building/IronMine.php
index d240e3a..8e70ee0 100644
--- a/src/Model/Building/IronMine.php
+++ b/src/Model/Building/IronMine.php
@@ -8,7 +8,12 @@ class IronMine extends ResourceGenerator
public int $buildTimeFactor = 1;
public int $maxLevel = 25;
- public array $resourceRequirements = [
+ public array $resourceRequirementsBase = [
+ 'wood' => 100,
+ 'clay' => 100,
+ 'iron' => 200,
+ ];
+ public array $resourceRequirementsFactor = [
'wood' => 1.0,
'clay' => 1.0,
'iron' => 2.0,
diff --git a/src/Model/Building/Marketplace.php b/src/Model/Building/Marketplace.php
index 714de0d..2d87379 100644
--- a/src/Model/Building/Marketplace.php
+++ b/src/Model/Building/Marketplace.php
@@ -9,7 +9,12 @@ class Marketplace extends Building
public int $buildTimeFactor = 1;
public int $maxLevel = 25;
- public array $resourceRequirements = [
+ public array $resourceRequirementsBase = [
+ 'wood' => 1000,
+ 'clay' => 1000,
+ 'iron' => 800,
+ ];
+ public array $resourceRequirementsFactor = [
'wood' => 10.0,
'clay' => 10.0,
'iron' => 8.0,
diff --git a/src/Model/Building/Storage.php b/src/Model/Building/Storage.php
index de2df92..d75b80d 100644
--- a/src/Model/Building/Storage.php
+++ b/src/Model/Building/Storage.php
@@ -10,7 +10,12 @@ class Storage extends Building
public int $buildTimeFactor = 1;
public int $maxLevel = 25;
- public array $resourceRequirements = [
+ public array $resourceRequirementsBase = [
+ 'wood' => 250,
+ 'clay' => 250,
+ 'iron' => 250,
+ ];
+ public array $resourceRequirementsFactor = [
'wood' => 1.0,
'clay' => 1.0,
'iron' => 1.0,
diff --git a/src/Model/Building/TownHall.php b/src/Model/Building/TownHall.php
index 608f083..33fd105 100644
--- a/src/Model/Building/TownHall.php
+++ b/src/Model/Building/TownHall.php
@@ -9,7 +9,12 @@ class TownHall extends Building
public int $buildTimeFactor = 1;
public int $maxLevel = 25;
- public array $resourceRequirements = [
+ public array $resourceRequirementsBase = [
+ 'wood' => 250,
+ 'clay' => 250,
+ 'iron' => 250,
+ ];
+ public array $resourceRequirementsFactor = [
'wood' => 1.0,
'clay' => 1.0,
'iron' => 1.0,
diff --git a/src/Model/Building/WoodCutter.php b/src/Model/Building/WoodCutter.php
index 726cdbc..6e1ce8c 100644
--- a/src/Model/Building/WoodCutter.php
+++ b/src/Model/Building/WoodCutter.php
@@ -8,7 +8,12 @@ class WoodCutter extends ResourceGenerator
public int $buildTimeFactor = 1;
public int $maxLevel = 25;
- public array $resourceRequirements = [
+ public array $resourceRequirementsBase = [
+ 'wood' => 200,
+ 'clay' => 100,
+ 'iron' => 100,
+ ];
+ public array $resourceRequirementsFactor = [
'wood' => 2.0,
'clay' => 1.0,
'iron' => 1.0,
diff --git a/src/Model/Unit.php b/src/Model/Unit.php
index d563682..206f5dd 100644
--- a/src/Model/Unit.php
+++ b/src/Model/Unit.php
@@ -22,7 +22,8 @@ class Unit
public string $buildingType;
public int $travelTime;
public int $populationDemandFactor;
- public array $resourceRequirements = [];
+ public array $resourceRequirementsBase = [];
+ public array $resourceRequirementsFactor = [];
public static function getEmpty(int $villageId, string $unitType): Unit
@@ -75,27 +76,29 @@ class Unit
['type' => $unit->type, 'id' => $unit->homeVillageId]
)->fetchColumn();
-
- return array_map(
- function ($resourceRequirement) use ($amount, $currentAmount, $building) {
- $r = 0;
- for ($i = 0; $i <= $amount; $i++) {
- $r += ceil(
- (
- pow(
- $_ENV['BASE_UNIT_RESOURCE_REQUIREMENT_BASE'],
- $currentAmount + 1
- )
- * $resourceRequirement * $_ENV['BASE_UNIT_RESOURCE_REQUIREMENT_FACTOR']
+ $resourceRequirements = [];
+ foreach (['wood', 'clay', 'iron', 'food'] as $resourceType) {
+ $base = $unit->resourceRequirementsBase[$resourceType];
+ $factor = $unit->resourceRequirementsFactor[$resourceType];
+
+ $r = $base;
+ for ($i = 0; $i <= $amount; $i++) {
+ $r += ceil(
+ (
+ pow(
+ $_ENV['BASE_UNIT_RESOURCE_REQUIREMENT_BASE'],
+ $currentAmount + 1
)
+ * $factor * $_ENV['BASE_UNIT_RESOURCE_REQUIREMENT_FACTOR']
+ )
/ ($building->level ?? 1)
- );
- }
+ );
+ }
- return $r;
- },
- $unit->resourceRequirements
- );
+ $resourceRequirements[$resourceType] = $r;
+ }
+
+ return $resourceRequirements;
}
public function getPopulationDemand(): int
@@ -144,7 +147,7 @@ class Unit
public static function getAmountResiding(string $unitType, int $villageId): int
{
$statement = DB::query(
- 'select SUM(amount) from village_units where type=:type and residence_village_id=:id',
+ 'select SUM(amount) from village_units where type=:type and residence_village_id=:id and is_traveling=false',
['type' => $unitType, 'id' => $villageId]
);
$result = $statement->fetch()['sum'];
diff --git a/src/Model/Unit/Diplomat.php b/src/Model/Unit/Diplomat.php
index e263cd3..baee88a 100644
--- a/src/Model/Unit/Diplomat.php
+++ b/src/Model/Unit/Diplomat.php
@@ -9,7 +9,14 @@ class Diplomat extends Unit
public string $buildingType = 'Embassy';
public int $travelTime = 1;
public int $populationDemandFactor = 1;
- public array $resourceRequirements = [
+
+ public array $resourceRequirementsBase = [
+ 'wood' => 500,
+ 'clay' => 500,
+ 'iron' => 500,
+ 'food' => 500,
+ ];
+ public array $resourceRequirementsFactor = [
'wood' => 5.0,
'clay' => 5.0,
'iron' => 5.0,
diff --git a/src/Model/Unit/Farmer.php b/src/Model/Unit/Farmer.php
index 8e3c1ea..5256bf1 100644
--- a/src/Model/Unit/Farmer.php
+++ b/src/Model/Unit/Farmer.php
@@ -9,7 +9,14 @@ class Farmer extends Unit
public string $buildingType = 'Farm';
public int $travelTime = 1;
public int $populationDemandFactor = 1;
- public array $resourceRequirements = [
+
+ public array $resourceRequirementsBase = [
+ 'wood' => 100,
+ 'clay' => 100,
+ 'iron' => 100,
+ 'food' => 0,
+ ];
+ public array $resourceRequirementsFactor = [
'wood' => 1.0,
'clay' => 1.0,
'iron' => 1.0,
diff --git a/src/Model/Unit/Merchant.php b/src/Model/Unit/Merchant.php
index 61e2090..8958d27 100644
--- a/src/Model/Unit/Merchant.php
+++ b/src/Model/Unit/Merchant.php
@@ -9,7 +9,14 @@ class Merchant extends Unit
public string $buildingType = 'Marketplace';
public int $travelTime = 1;
public int $populationDemandFactor = 1;
- public array $resourceRequirements = [
+
+ public array $resourceRequirementsBase = [
+ 'wood' => 200,
+ 'clay' => 200,
+ 'iron' => 200,
+ 'food' => 200,
+ ];
+ public array $resourceRequirementsFactor = [
'wood' => 2.0,
'clay' => 2.0,
'iron' => 2.0,
diff --git a/src/Model/Unit/Miner.php b/src/Model/Unit/Miner.php
index 2d246ef..06c6dda 100644
--- a/src/Model/Unit/Miner.php
+++ b/src/Model/Unit/Miner.php
@@ -9,7 +9,14 @@ class Miner extends Unit
public string $buildingType = 'IronMine';
public int $travelTime = 1;
public int $populationDemandFactor = 1;
- public array $resourceRequirements = [
+
+ public array $resourceRequirementsBase = [
+ 'wood' => 100,
+ 'clay' => 100,
+ 'iron' => 200,
+ 'food' => 200,
+ ];
+ public array $resourceRequirementsFactor = [
'wood' => 1.0,
'clay' => 1.0,
'iron' => 2.0,
diff --git a/src/Model/Unit/PitWorker.php b/src/Model/Unit/PitWorker.php
index d2a52c3..f2a27b6 100644
--- a/src/Model/Unit/PitWorker.php
+++ b/src/Model/Unit/PitWorker.php
@@ -9,7 +9,14 @@ class PitWorker extends Unit
public string $buildingType = 'ClayPit';
public int $travelTime = 1;
public int $populationDemandFactor = 1;
- public array $resourceRequirements = [
+
+ public array $resourceRequirementsBase = [
+ 'wood' => 100,
+ 'clay' => 200,
+ 'iron' => 100,
+ 'food' => 200,
+ ];
+ public array $resourceRequirementsFactor = [
'wood' => 1.0,
'clay' => 2.0,
'iron' => 1.0,
diff --git a/src/Model/Unit/WoodCutter.php b/src/Model/Unit/WoodCutter.php
index d8c2c42..02aea85 100644
--- a/src/Model/Unit/WoodCutter.php
+++ b/src/Model/Unit/WoodCutter.php
@@ -9,7 +9,14 @@ class WoodCutter extends Unit
public string $buildingType = 'WoodCutter';
public int $travelTime = 1;
public int $populationDemandFactor = 1;
- public array $resourceRequirements = [
+
+ public array $resourceRequirementsBase = [
+ 'wood' => 200,
+ 'clay' => 100,
+ 'iron' => 100,
+ 'food' => 200,
+ ];
+ public array $resourceRequirementsFactor = [
'wood' => 2.0,
'clay' => 1.0,
'iron' => 1.0,
diff --git a/src/gemini/Controller/Unit.php b/src/gemini/Controller/Unit.php
index c04079a..9aa6968 100644
--- a/src/gemini/Controller/Unit.php
+++ b/src/gemini/Controller/Unit.php
@@ -2,10 +2,13 @@
namespace App\gemini\Controller;
+use App\DB;
use App\Model\Event;
+use App\Model\Event\SendUnits;
use App\Model\Event\TrainUnits;
use App\Model\Unit as Model;
use App\Model\Village;
+use App\View;
use GeminiFoundation\Request;
use GeminiFoundation\Response;
use GeminiFoundation\Status;
@@ -57,4 +60,95 @@ class Unit
meta: "/village/{$village->x}/{$village->y}"
);
}
+
+ // #[Route(path: '/village/{x}/{y}/send-units', methods: ['POST'])]
+ public function sendUnits(Request $request): Response
+ {
+ $village = Village::getByCoordinates($request->get('x'), $request->get('y'));
+
+ $selectedUnit = $request->get('selectedUnit');
+ if (empty($selectedUnit)) {
+ return new Response(body: View::render('send-units/01-units.twig', [
+ 'village' => $village,
+ ]));
+ }
+
+ if (empty($request->get('selectedVillageX'))) {
+ return new Response(body: View::render('send-units/02-villages.twig', [
+ 'village' => $village,
+ 'villages' => DB::fetch(Village::class, "select * from villages where id!=:id", ['id' => $village->id]),
+ 'selectedUnit' => $selectedUnit,
+ ]));
+ }
+ $selectedVillage = Village::getByCoordinates($request->get('selectedVillageX'), $request->get('selectedVillageY'));
+
+ $selectedAction = $request->get('selectedAction');
+ if (empty($selectedAction)) {
+ return new Response(body: View::render('send-units/03-actions.twig', [
+ 'village' => $village,
+ 'selectedUnit' => $selectedUnit,
+ 'selectedVillage' => $selectedVillage,
+ ]));
+ }
+
+ $amount = intval($request->get('input'));
+ if (empty($amount)) {
+ return new Response(statusCode: Status::INPUT, meta: 'Amount');
+ }
+
+ $destination = $selectedVillage;
+
+ /**@var Model $unit*/
+ $unit = new (Model::resolveType($selectedUnit))();
+
+ $amountUnits = DB::query(
+ 'select amount from village_units where home_village_id=:home and residence_village_id=:home and type=:type',
+ ['home' => $village->id, 'type' => $selectedUnit]
+ )->fetchColumn();
+
+ if ($amountUnits - $amount > 0) {
+ $statement = DB::query(
+ <<<SQL
+ update village_units set amount=:amount where home_village_id=:home and residence_village_id=:home and type=:type
+ SQL,
+ ['amount' => $amountUnits - $amount, 'home' => $village->id, 'type' => $selectedUnit]
+ );
+ } else if ($amountUnits - $amount === 0) {
+ DB::query(
+ <<<SQL
+ delete from village_units where home_village_id=:home and residence_village_id=:home and type=:type
+ SQL,
+ ['home' => $village->id, 'type' => $selectedUnit]
+ );
+ }
+
+ DB::query(
+ 'insert into village_units (amount, type, home_village_id, residence_village_id, is_traveling) values (:amount, :type, :home, :home, true)',
+ ['amount' => $amount, 'type' => $selectedUnit, 'home' => $village->id]
+ );
+
+ // event
+ $event = new Event();
+ $event->time = (new \DateTime())->add(
+ \DateInterval::createFromDateString(
+ Model::getTravelTime($unit, Village::getDistance($village->x, $village->y, $destination->x, $destination->y))
+ . ' seconds'
+ )
+ );
+ $event->villageId = $village->id;
+ $sendUnitsEvent = new SendUnits();
+ $sendUnitsEvent->event = $event;
+ $sendUnitsEvent->type = $selectedAction;
+ $sendUnitsEvent->unit = $selectedUnit;
+ $sendUnitsEvent->amount = $amount;
+ $sendUnitsEvent->source = $village->id;
+ $sendUnitsEvent->destination = $destination->id;
+ $sendUnitsEvent->dbInsert();
+
+
+ return new Response(
+ statusCode: Status::REDIRECT_TEMPORARY,
+ meta: "/village/{$village->x}/{$village->y}"
+ );
+ }
}
diff --git a/src/gemini/Controller/Village.php b/src/gemini/Controller/Village.php
index 9b27561..85b9205 100644
--- a/src/gemini/Controller/Village.php
+++ b/src/gemini/Controller/Village.php
@@ -21,7 +21,7 @@ class Village
$villages = DB::fetch(
Model::class,
<<<SQL
- select * from villages
+ select *,villages.id from villages
join user_villages on villages.id = user_villages.village_id
where user_villages.user_id=:id
SQL,
diff --git a/src/gemini/Gemini.php b/src/gemini/Gemini.php
index 41b8716..507b962 100644
--- a/src/gemini/Gemini.php
+++ b/src/gemini/Gemini.php
@@ -103,6 +103,32 @@ class Gemini
$response = $unitController->train($request);
}
+ else if (preg_match('@village/(\d+)/(\d+)/send-units@', $request->getPath(), $routeMatch)) {
+ $request
+ ->set('x', $routeMatch[1])
+ ->set('y', $routeMatch[2]);
+
+ if (preg_match('@village/(\d+)/(\d+)/send-units/type/(\w+)$@', $request->getPath(), $routeMatch)) {
+ $request->set('selectedUnit', $routeMatch[3]);
+ }
+ else if (preg_match('@village/(\d+)/(\d+)/send-units/type/(\w+)/village/(\d+)/(\d+)$@', $request->getPath(), $routeMatch)) {
+ $request
+ ->set('selectedUnit', $routeMatch[3])
+ ->set('selectedVillageX', $routeMatch[4])
+ ->set('selectedVillageY', $routeMatch[5]);
+ }
+ else if (preg_match('@village/(\d+)/(\d+)/send-units/type/(\w+)/village/(\d+)/(\d+)/action/(\w+)$@', $request->getPath(), $routeMatch)) {
+ $request
+ ->set('selectedUnit', $routeMatch[3])
+ ->set('selectedVillageX', $routeMatch[4])
+ ->set('selectedVillageY', $routeMatch[5])
+ ->set('selectedAction', $routeMatch[6]);
+ }
+
+ $unitController = new Unit();
+ $response = $unitController->sendUnits($request);
+ }
+
else if (preg_match('@village/(\d+)/(\d+)@', $request->getPath(), $routeMatch)) {
$request
->set('x', $routeMatch[1])
diff --git a/src/http/Controller/Village.php b/src/http/Controller/Village.php
index cd38442..7b1f227 100644
--- a/src/http/Controller/Village.php
+++ b/src/http/Controller/Village.php
@@ -23,7 +23,7 @@ class Village
$villages = DB::fetch(
Model::class,
<<<SQL
- select * from villages
+ select *,villages.id from villages
join user_villages on villages.id = user_villages.village_id
where user_villages.user_id=:id
SQL,
diff --git a/views/gemini/footer.twig b/views/gemini/footer.twig
new file mode 100644
index 0000000..6784124
--- /dev/null
+++ b/views/gemini/footer.twig
@@ -0,0 +1,5 @@
+# _ _ _ _
+
+Logged in as {{ session.user.username }}
+
+Server Time: {{ 'now' | date('c') }}
diff --git a/views/gemini/send-units/01-units.twig b/views/gemini/send-units/01-units.twig
new file mode 100644
index 0000000..6996c3b
--- /dev/null
+++ b/views/gemini/send-units/01-units.twig
@@ -0,0 +1,3 @@
+{% for unit in village.getUnits(village.id, 1) %}
+=> /village/{{ village.x }}/{{ village.y }}/send-units/type/{{ unit.type }} {{ unit.type }}
+{% endfor %}
diff --git a/views/gemini/send-units/02-villages.twig b/views/gemini/send-units/02-villages.twig
new file mode 100644
index 0000000..80f5326
--- /dev/null
+++ b/views/gemini/send-units/02-villages.twig
@@ -0,0 +1,5 @@
+{{ selectedUnit }}
+
+{% for listVillage in villages %}
+=> /village/{{ village.x }}/{{ village.y }}/send-units/type/{{ selectedUnit }}/village/{{ listVillage.x }}/{{ listVillage.y }} {{ listVillage.name }} - {{ listVillage.x }} - {{ listVillage.y }}
+{% endfor %}
diff --git a/views/gemini/send-units/03-actions.twig b/views/gemini/send-units/03-actions.twig
new file mode 100644
index 0000000..2b0ed45
--- /dev/null
+++ b/views/gemini/send-units/03-actions.twig
@@ -0,0 +1,5 @@
+{{ selectedUnit }}
+{{ selectedVillage.name }} - {{ selectedVillage.x }} x {{ selectedVillage.y }}
+
+=> /village/{{ village.x }}/{{ village.y }}/send-units/type/{{ selectedUnit }}/village/{{ selectedVillage.x }}/{{ selectedVillage.y }}/action/Borrow Borrow
+=> /village/{{ village.x }}/{{ village.y }}/send-units/type/{{ selectedUnit }}/village/{{ selectedVillage.x }}/{{ selectedVillage.y }}/action/Gift Gift
diff --git a/views/gemini/storage.twig b/views/gemini/storage.twig
index c9ecd4f..2b02445 100644
--- a/views/gemini/storage.twig
+++ b/views/gemini/storage.twig
@@ -14,3 +14,5 @@ Clay: {{ village.clay }} / {{ village.getStorage(village.id).getResourceCapacity
Iron: {{ village.iron }} / {{ village.getStorage(village.id).getResourceCapacity('iron') }} - Increment: {{ village.getBuilding(village.id, 'IronMine').getResourceIncrementor() }}
Food: {{ village.food }} / {{ village.getStorage(village.id).getResourceCapacity('food') }} - Increment: {{ village.getBuilding(village.id, 'Farm').getResourceIncrementor() }}
Storage Capacity: {{ village.getStorage(village.id).getCapacity() }}
+
+{% include 'footer.twig' %}
diff --git a/views/gemini/village.twig b/views/gemini/village.twig
index 199f53a..d351eb6 100644
--- a/views/gemini/village.twig
+++ b/views/gemini/village.twig
@@ -90,6 +90,7 @@ Resources:
{% if village.canTrain(village, unit, 1) %}
=> /village/{{ village.x }}/{{ village.y }}/unit/{{ unit.type }}/create Train
{% endif %}
+=> /village/{{ village.x }}/{{ village.y }}/send-units/type/{{ unit.type }} Send
{% else %}
~traveling~
{% endif %}
@@ -116,21 +117,18 @@ Travel Time: {{ unit.getTravelTime(unit, village.getDistance(unit.getHomeVillage
# Send Units
-TODO
-* list possible units
-* list possible villages
-* send INPUT request for amount
+{% include 'send-units/01-units.twig' %}
# Send Resources
TODO
* list possible resource types
+=> /village/{{ village.x }}/{{ village.y }}/send-resources/type/wood Wood
+=> /village/{{ village.x }}/{{ village.y }}/send-resources/type/clay Clay
+=> /village/{{ village.x }}/{{ village.y }}/send-resources/type/iron Iron
+=> /village/{{ village.x }}/{{ village.y }}/send-resources/type/food Food
* list possible villages
* send INPUT request for amount
-
-Logged in as {{ session.user.username }}
-=> /logout Logout
-
-Server Time: {{ 'now' | date('c') }}
+{% include 'footer.twig' %}
diff --git a/views/gemini/villages.twig b/views/gemini/villages.twig
index 1c8eb82..fb0f606 100644
--- a/views/gemini/villages.twig
+++ b/views/gemini/villages.twig
@@ -1,3 +1,10 @@
+# Your villages
+
{% for village in villages %}
-=> /village/{{ village.x }}/{{ village.y }} {{ village.name }}
+=> /village/{{ village.x }}/{{ village.y }} {{ village.name }} - {{ village.x }} x {{ village.y }}
+Resources: {{ village.wood + village.clay + village.iron + village.food }} / {{ village.getStorage(village.id).getCapacity() }}
+Satisfaction: {{ village.satisfaction }}
+
{% endfor %}
+
+{% include 'footer.twig' %}
diff --git a/views/http/villages.twig b/views/http/villages.twig
index bdb87be..d4449cf 100644
--- a/views/http/villages.twig
+++ b/views/http/villages.twig
@@ -29,7 +29,7 @@
<td>{{ village.clay }}</td>
<td>{{ village.iron }}</td>
<td>{{ village.food }}</td>
- <td>{{ village.getStorage(village.id).getCapacity() * (25 / 100) }}</td>
+ <td>{{ village.getStorage(village.id).getCapacity() }}</td>
<td>{{ village.satisfaction }}</td>
</tr>
{% endfor %}