-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add missing sovereignties notifications for entosis capture started a…
…nd command node event started. (#97)
- Loading branch information
Showing
16 changed files
with
566 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
89 changes: 89 additions & 0 deletions
89
src/Notifications/Sovereignties/Discord/EntosisCaptureStarted.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of SeAT | ||
* | ||
* Copyright (C) 2015 to present Leon Jacobs | ||
* | ||
* This program is free software; you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation; either version 2 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License along | ||
* with this program; if not, write to the Free Software Foundation, Inc., | ||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. | ||
*/ | ||
|
||
namespace Seat\Notifications\Notifications\Sovereignties\Discord; | ||
|
||
use Seat\Eveapi\Models\Character\CharacterNotification; | ||
use Seat\Eveapi\Models\Sde\InvType; | ||
use Seat\Eveapi\Models\Sde\SolarSystem; | ||
use Seat\Notifications\Notifications\AbstractDiscordNotification; | ||
use Seat\Notifications\Services\Discord\Messages\DiscordEmbed; | ||
use Seat\Notifications\Services\Discord\Messages\DiscordEmbedField; | ||
use Seat\Notifications\Services\Discord\Messages\DiscordMessage; | ||
use Seat\Notifications\Traits\NotificationTools; | ||
|
||
/** | ||
* Class EntosisCaptureStarted. | ||
* | ||
* @package Seat\Notifications\Notifications\Sovereignties\Discord | ||
*/ | ||
class EntosisCaptureStarted extends AbstractDiscordNotification | ||
{ | ||
use NotificationTools; | ||
|
||
/** | ||
* @var \Seat\Eveapi\Models\Character\CharacterNotification | ||
*/ | ||
private $notification; | ||
|
||
/** | ||
* Constructor. | ||
* | ||
* @param \Seat\Eveapi\Models\Character\CharacterNotification $notification | ||
*/ | ||
public function __construct(CharacterNotification $notification) | ||
{ | ||
$this->notification = $notification; | ||
} | ||
|
||
/** | ||
* @param DiscordMessage $message | ||
* @param $notifiable | ||
*/ | ||
public function populateMessage(DiscordMessage $message, $notifiable) | ||
{ | ||
$message | ||
->content('A sovereignty structure is beeing captured!') | ||
->embed(function (DiscordEmbed $embed) { | ||
$embed->timestamp($this->notification->timestamp); | ||
$embed->author('SeAT Sovereignty Health', asset('web/img/favico/apple-icon-180x180.png')); | ||
|
||
$embed->field(function (DiscordEmbedField $field) { | ||
$system = SolarSystem::find($this->notification->text['solarSystemID']); | ||
|
||
$field->name('System') | ||
->value($this->zKillBoardToDiscordLink( | ||
'system', | ||
$system->itemID, | ||
sprintf('%s (%s)', $system->itemName, number_format($system->security, 2)))); | ||
}); | ||
|
||
$embed->field(function (DiscordEmbedField $field) { | ||
$structure = InvType::find($this->notification->text['structureTypeID']); | ||
|
||
$field->name('Structure') | ||
->value($structure->typeName); | ||
}); | ||
}) | ||
->error(); | ||
} | ||
} |
86 changes: 86 additions & 0 deletions
86
src/Notifications/Sovereignties/Discord/SovCommandNodeEventStarted.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of SeAT | ||
* | ||
* Copyright (C) 2015 to present Leon Jacobs | ||
* | ||
* This program is free software; you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation; either version 2 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License along | ||
* with this program; if not, write to the Free Software Foundation, Inc., | ||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. | ||
*/ | ||
|
||
namespace Seat\Notifications\Notifications\Sovereignties\Discord; | ||
|
||
use Seat\Eveapi\Models\Character\CharacterNotification; | ||
use Seat\Eveapi\Models\Sde\SolarSystem; | ||
use Seat\Notifications\Notifications\AbstractDiscordNotification; | ||
use Seat\Notifications\Services\Discord\Messages\DiscordEmbed; | ||
use Seat\Notifications\Services\Discord\Messages\DiscordEmbedField; | ||
use Seat\Notifications\Services\Discord\Messages\DiscordMessage; | ||
use Seat\Notifications\Traits\NotificationTools; | ||
|
||
/** | ||
* Class SovCommandNodeEventStarted. | ||
* | ||
* @package Seat\Notifications\Notifications\Sovereignties\Discord | ||
*/ | ||
class SovCommandNodeEventStarted extends AbstractDiscordNotification | ||
{ | ||
use NotificationTools; | ||
|
||
/** | ||
* @var \Seat\Eveapi\Models\Character\CharacterNotification | ||
*/ | ||
private $notification; | ||
|
||
/** | ||
* Constructor. | ||
* | ||
* @param \Seat\Eveapi\Models\Character\CharacterNotification $notification | ||
*/ | ||
public function __construct(CharacterNotification $notification) | ||
{ | ||
$this->notification = $notification; | ||
} | ||
|
||
/** | ||
* @param DiscordMessage $message | ||
* @param $notifiable | ||
*/ | ||
public function populateMessage(DiscordMessage $message, $notifiable) | ||
{ | ||
$message | ||
->content('A sovereignty command node event started!') | ||
->embed(function (DiscordEmbed $embed) { | ||
$embed->timestamp($this->notification->timestamp); | ||
$embed->author('SeAT Sovereignty Health', asset('web/img/favico/apple-icon-180x180.png')); | ||
|
||
$embed->field(function (DiscordEmbedField $field) { | ||
$system = SolarSystem::find($this->notification->text['solarSystemID']); | ||
|
||
$field->name('System') | ||
->value($this->zKillBoardToDiscordLink( | ||
'system', | ||
$system->itemID, | ||
sprintf('%s (%s)', $system->itemName, number_format($system->security, 2)))); | ||
}); | ||
|
||
$embed->field(function (DiscordEmbedField $field) { | ||
$field->name('Structure') | ||
->value($this->campaignEventType($this->notification->text['campaignEventType'])); | ||
}); | ||
}) | ||
->warning(); | ||
} | ||
} |
83 changes: 83 additions & 0 deletions
83
src/Notifications/Sovereignties/Mail/EntosisCaptureStarted.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of SeAT | ||
* | ||
* Copyright (C) 2015 to present Leon Jacobs | ||
* | ||
* This program is free software; you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation; either version 2 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License along | ||
* with this program; if not, write to the Free Software Foundation, Inc., | ||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. | ||
*/ | ||
|
||
namespace Seat\Notifications\Notifications\Sovereignties\Mail; | ||
|
||
use Illuminate\Notifications\Messages\MailMessage; | ||
use Seat\Eveapi\Models\Character\CharacterNotification; | ||
use Seat\Eveapi\Models\Sde\InvType; | ||
use Seat\Eveapi\Models\Sde\MapDenormalize; | ||
use Seat\Notifications\Notifications\AbstractMailNotification; | ||
use Seat\Notifications\Traits\NotificationTools; | ||
|
||
/** | ||
* Class EntosisCaptureStarted. | ||
* | ||
* @package Seat\Notifications\Notifications\Sovereignties | ||
*/ | ||
class EntosisCaptureStarted extends AbstractMailNotification | ||
{ | ||
use NotificationTools; | ||
|
||
/** | ||
* @var \Seat\Eveapi\Models\Character\CharacterNotification | ||
*/ | ||
private $notification; | ||
|
||
/** | ||
* Constructor. | ||
* | ||
* @param \Seat\Eveapi\Models\Character\CharacterNotification $notification | ||
*/ | ||
public function __construct(CharacterNotification $notification) | ||
{ | ||
$this->notification = $notification; | ||
} | ||
|
||
/** | ||
* @param $notifiable | ||
* @return \Illuminate\Notifications\Messages\MailMessage | ||
*/ | ||
public function toMail($notifiable) | ||
{ | ||
$type = InvType::find($this->notification->text['structureTypeID']); | ||
|
||
$system = MapDenormalize::find($this->notification->text['solarSystemID']); | ||
|
||
return (new MailMessage) | ||
->subject('Sovereignty Structure is being captured notification!') | ||
->line( | ||
sprintf('A sovereignty structure is being captured (%s)!', $type->typeName)) | ||
->action( | ||
sprintf('System : %s (%s)', $system->itemName, number_format($system->security, 2)), | ||
sprintf('https://zkillboard.com/%s/%d', 'system', $system->itemID)); | ||
} | ||
|
||
/** | ||
* @param $notifiable | ||
* @return array | ||
*/ | ||
public function toArray($notifiable) | ||
{ | ||
return $this->notification->text; | ||
} | ||
} |
80 changes: 80 additions & 0 deletions
80
src/Notifications/Sovereignties/Mail/SovCommandNodeEventStarted.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of SeAT | ||
* | ||
* Copyright (C) 2015 to present Leon Jacobs | ||
* | ||
* This program is free software; you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation; either version 2 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License along | ||
* with this program; if not, write to the Free Software Foundation, Inc., | ||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. | ||
*/ | ||
|
||
namespace Seat\Notifications\Notifications\Sovereignties\Mail; | ||
|
||
use Illuminate\Notifications\Messages\MailMessage; | ||
use Seat\Eveapi\Models\Character\CharacterNotification; | ||
use Seat\Eveapi\Models\Sde\MapDenormalize; | ||
use Seat\Notifications\Notifications\AbstractMailNotification; | ||
use Seat\Notifications\Traits\NotificationTools; | ||
|
||
/** | ||
* Class SovCommandNodeEventStarted. | ||
* | ||
* @package Seat\Notifications\Notifications\Sovereignties | ||
*/ | ||
class SovCommandNodeEventStarted extends AbstractMailNotification | ||
{ | ||
use NotificationTools; | ||
|
||
/** | ||
* @var \Seat\Eveapi\Models\Character\CharacterNotification | ||
*/ | ||
private $notification; | ||
|
||
/** | ||
* Constructor. | ||
* | ||
* @param \Seat\Eveapi\Models\Character\CharacterNotification $notification | ||
*/ | ||
public function __construct(CharacterNotification $notification) | ||
{ | ||
$this->notification = $notification; | ||
} | ||
|
||
/** | ||
* @param $notifiable | ||
* @return \Illuminate\Notifications\Messages\MailMessage | ||
*/ | ||
public function toMail($notifiable) | ||
{ | ||
$system = MapDenormalize::find($this->notification->text['solarSystemID']); | ||
|
||
return (new MailMessage) | ||
->subject('Sovereignty Command Node event started!') | ||
->line( | ||
sprintf('A sovereignty command node event started (%s)!', $this->campaignEventType($this->notification->text['campaignEventType']))) | ||
->action( | ||
sprintf('System : %s (%s)', $system->itemName, number_format($system->security, 2)), | ||
sprintf('https://zkillboard.com/%s/%d', 'system', $system->itemID)); | ||
} | ||
|
||
/** | ||
* @param $notifiable | ||
* @return array | ||
*/ | ||
public function toArray($notifiable) | ||
{ | ||
return $this->notification->text; | ||
} | ||
} |
Oops, something went wrong.