summaryrefslogtreecommitdiff
path: root/src/EventRunner.php
diff options
context:
space:
mode:
authorDaniel Weipert <git@mail.dweipert.de>2024-01-11 13:15:02 +0100
committerDaniel Weipert <git@mail.dweipert.de>2024-01-11 13:15:02 +0100
commit09caff2b2a06d1f8ac8203567035a21c612165f9 (patch)
tree999be04ff0a418a33e438be9befc8c9297e383f4 /src/EventRunner.php
parent6301f63bd348109b8693a922f02e16d49205a8fd (diff)
send resources
Diffstat (limited to 'src/EventRunner.php')
-rw-r--r--src/EventRunner.php36
1 files changed, 36 insertions, 0 deletions
diff --git a/src/EventRunner.php b/src/EventRunner.php
index 2f2fd8b..e4bdb40 100644
--- a/src/EventRunner.php
+++ b/src/EventRunner.php
@@ -9,6 +9,8 @@ use App\Model\Building\IronMine;
use App\Model\Building\ResourceGenerator;
use App\Model\Building\Storage;
use App\Model\Building\WoodCutter;
+use App\Model\Event\SendResources;
+use App\Model\Event\SendResourcesCarriers;
use App\Model\Event\SendUnits;
use App\Model\Event\TrainUnits;
use App\Model\Event\UpgradeBuilding;
@@ -71,6 +73,40 @@ class EventRunner
$event->dbDelete();
}
+ # Send Resources
+
+ $results = DB::query(<<<SQL
+ select * from events
+ inner join events_send_resources as event
+ on events.id = event.event_id
+ where events.time < now()
+ SQL)->fetchAll();
+
+ foreach ($results as $row) {
+ /**@var SendResources $event*/
+ $event = DB::convertToModel(SendResources::class, $row);
+ $event();
+
+ $event->dbDelete();
+ }
+
+ # Send Resources Carriers
+
+ $results = DB::query(<<<SQL
+ select * from events
+ inner join events_send_resources_carriers as event
+ on events.id = event.event_id
+ where events.time < now()
+ SQL)->fetchAll();
+
+ foreach ($results as $row) {
+ /**@var SendResourcesCarriers $event*/
+ $event = DB::convertToModel(SendResourcesCarriers::class, $row);
+ $event();
+
+ $event->dbDelete();
+ }
+
// Resources