diff options
Diffstat (limited to 'src/EventRunner.php')
-rw-r--r-- | src/EventRunner.php | 36 |
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 |