Skip to content

Commit f04869d

Browse files
authored
Add missing sovereignties notifications for entosis capture started and command node event started. (#97)
1 parent 77150a7 commit f04869d

File tree

16 files changed

+566
-0
lines changed

16 files changed

+566
-0
lines changed

src/Config/notifications.alerts.php

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,14 @@
164164
'slack' => \Seat\Notifications\Notifications\Corporations\Slack\CorpAppNewMsg::class,
165165
],
166166
],
167+
'EntosisCaptureStarted' => [
168+
'label' => 'notifications::alerts.entosis_capture_started',
169+
'handlers' => [
170+
'discord' => \Seat\Notifications\Notifications\Sovereignties\Discord\EntosisCaptureStarted::class,
171+
'mail' => \Seat\Notifications\Notifications\Sovereignties\Mail\EntosisCaptureStarted::class,
172+
'slack' => \Seat\Notifications\Notifications\Sovereignties\Slack\EntosisCaptureStarted::class,
173+
],
174+
],
167175
'MoonminingExtractionFinished' => [
168176
'label' => 'notifications::alerts.moon_mining_extraction_finished',
169177
'handlers' => [
@@ -222,6 +230,14 @@
222230
'discord' => \Seat\Notifications\Notifications\Characters\Discord\ResearchMissionAvailableMsg::class,
223231
],
224232
],
233+
'SovCommandNodeEventStarted' => [
234+
'label' => 'notifications::alerts.sovereignty_command_node_event_started',
235+
'handlers' => [
236+
'discord' => \Seat\Notifications\Notifications\Sovereignties\Discord\SovCommandNodeEventStarted::class,
237+
'mail' => \Seat\Notifications\Notifications\Sovereignties\Mail\SovCommandNodeEventStarted::class,
238+
'slack' => \Seat\Notifications\Notifications\Sovereignties\Slack\SovCommandNodeEventStarted::class,
239+
],
240+
],
225241
'SovStructureDestroyed' => [
226242
'label' => 'notifications::alerts.sovereignty_structure_destroyed',
227243
'handlers' => [
Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
<?php
2+
3+
/*
4+
* This file is part of SeAT
5+
*
6+
* Copyright (C) 2015 to present Leon Jacobs
7+
*
8+
* This program is free software; you can redistribute it and/or modify
9+
* it under the terms of the GNU General Public License as published by
10+
* the Free Software Foundation; either version 2 of the License, or
11+
* (at your option) any later version.
12+
*
13+
* This program is distributed in the hope that it will be useful,
14+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
15+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16+
* GNU General Public License for more details.
17+
*
18+
* You should have received a copy of the GNU General Public License along
19+
* with this program; if not, write to the Free Software Foundation, Inc.,
20+
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
21+
*/
22+
23+
namespace Seat\Notifications\Notifications\Sovereignties\Discord;
24+
25+
use Seat\Eveapi\Models\Character\CharacterNotification;
26+
use Seat\Eveapi\Models\Sde\InvType;
27+
use Seat\Eveapi\Models\Sde\SolarSystem;
28+
use Seat\Notifications\Notifications\AbstractDiscordNotification;
29+
use Seat\Notifications\Services\Discord\Messages\DiscordEmbed;
30+
use Seat\Notifications\Services\Discord\Messages\DiscordEmbedField;
31+
use Seat\Notifications\Services\Discord\Messages\DiscordMessage;
32+
use Seat\Notifications\Traits\NotificationTools;
33+
34+
/**
35+
* Class EntosisCaptureStarted.
36+
*
37+
* @package Seat\Notifications\Notifications\Sovereignties\Discord
38+
*/
39+
class EntosisCaptureStarted extends AbstractDiscordNotification
40+
{
41+
use NotificationTools;
42+
43+
/**
44+
* @var \Seat\Eveapi\Models\Character\CharacterNotification
45+
*/
46+
private $notification;
47+
48+
/**
49+
* Constructor.
50+
*
51+
* @param \Seat\Eveapi\Models\Character\CharacterNotification $notification
52+
*/
53+
public function __construct(CharacterNotification $notification)
54+
{
55+
$this->notification = $notification;
56+
}
57+
58+
/**
59+
* @param DiscordMessage $message
60+
* @param $notifiable
61+
*/
62+
public function populateMessage(DiscordMessage $message, $notifiable)
63+
{
64+
$message
65+
->content('A sovereignty structure is beeing captured!')
66+
->embed(function (DiscordEmbed $embed) {
67+
$embed->timestamp($this->notification->timestamp);
68+
$embed->author('SeAT Sovereignty Health', asset('web/img/favico/apple-icon-180x180.png'));
69+
70+
$embed->field(function (DiscordEmbedField $field) {
71+
$system = SolarSystem::find($this->notification->text['solarSystemID']);
72+
73+
$field->name('System')
74+
->value($this->zKillBoardToDiscordLink(
75+
'system',
76+
$system->itemID,
77+
sprintf('%s (%s)', $system->itemName, number_format($system->security, 2))));
78+
});
79+
80+
$embed->field(function (DiscordEmbedField $field) {
81+
$structure = InvType::find($this->notification->text['structureTypeID']);
82+
83+
$field->name('Structure')
84+
->value($structure->typeName);
85+
});
86+
})
87+
->error();
88+
}
89+
}
Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
<?php
2+
3+
/*
4+
* This file is part of SeAT
5+
*
6+
* Copyright (C) 2015 to present Leon Jacobs
7+
*
8+
* This program is free software; you can redistribute it and/or modify
9+
* it under the terms of the GNU General Public License as published by
10+
* the Free Software Foundation; either version 2 of the License, or
11+
* (at your option) any later version.
12+
*
13+
* This program is distributed in the hope that it will be useful,
14+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
15+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16+
* GNU General Public License for more details.
17+
*
18+
* You should have received a copy of the GNU General Public License along
19+
* with this program; if not, write to the Free Software Foundation, Inc.,
20+
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
21+
*/
22+
23+
namespace Seat\Notifications\Notifications\Sovereignties\Discord;
24+
25+
use Seat\Eveapi\Models\Character\CharacterNotification;
26+
use Seat\Eveapi\Models\Sde\SolarSystem;
27+
use Seat\Notifications\Notifications\AbstractDiscordNotification;
28+
use Seat\Notifications\Services\Discord\Messages\DiscordEmbed;
29+
use Seat\Notifications\Services\Discord\Messages\DiscordEmbedField;
30+
use Seat\Notifications\Services\Discord\Messages\DiscordMessage;
31+
use Seat\Notifications\Traits\NotificationTools;
32+
33+
/**
34+
* Class SovCommandNodeEventStarted.
35+
*
36+
* @package Seat\Notifications\Notifications\Sovereignties\Discord
37+
*/
38+
class SovCommandNodeEventStarted extends AbstractDiscordNotification
39+
{
40+
use NotificationTools;
41+
42+
/**
43+
* @var \Seat\Eveapi\Models\Character\CharacterNotification
44+
*/
45+
private $notification;
46+
47+
/**
48+
* Constructor.
49+
*
50+
* @param \Seat\Eveapi\Models\Character\CharacterNotification $notification
51+
*/
52+
public function __construct(CharacterNotification $notification)
53+
{
54+
$this->notification = $notification;
55+
}
56+
57+
/**
58+
* @param DiscordMessage $message
59+
* @param $notifiable
60+
*/
61+
public function populateMessage(DiscordMessage $message, $notifiable)
62+
{
63+
$message
64+
->content('A sovereignty command node event started!')
65+
->embed(function (DiscordEmbed $embed) {
66+
$embed->timestamp($this->notification->timestamp);
67+
$embed->author('SeAT Sovereignty Health', asset('web/img/favico/apple-icon-180x180.png'));
68+
69+
$embed->field(function (DiscordEmbedField $field) {
70+
$system = SolarSystem::find($this->notification->text['solarSystemID']);
71+
72+
$field->name('System')
73+
->value($this->zKillBoardToDiscordLink(
74+
'system',
75+
$system->itemID,
76+
sprintf('%s (%s)', $system->itemName, number_format($system->security, 2))));
77+
});
78+
79+
$embed->field(function (DiscordEmbedField $field) {
80+
$field->name('Structure')
81+
->value($this->campaignEventType($this->notification->text['campaignEventType']));
82+
});
83+
})
84+
->warning();
85+
}
86+
}
Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
<?php
2+
3+
/*
4+
* This file is part of SeAT
5+
*
6+
* Copyright (C) 2015 to present Leon Jacobs
7+
*
8+
* This program is free software; you can redistribute it and/or modify
9+
* it under the terms of the GNU General Public License as published by
10+
* the Free Software Foundation; either version 2 of the License, or
11+
* (at your option) any later version.
12+
*
13+
* This program is distributed in the hope that it will be useful,
14+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
15+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16+
* GNU General Public License for more details.
17+
*
18+
* You should have received a copy of the GNU General Public License along
19+
* with this program; if not, write to the Free Software Foundation, Inc.,
20+
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
21+
*/
22+
23+
namespace Seat\Notifications\Notifications\Sovereignties\Mail;
24+
25+
use Illuminate\Notifications\Messages\MailMessage;
26+
use Seat\Eveapi\Models\Character\CharacterNotification;
27+
use Seat\Eveapi\Models\Sde\InvType;
28+
use Seat\Eveapi\Models\Sde\MapDenormalize;
29+
use Seat\Notifications\Notifications\AbstractMailNotification;
30+
use Seat\Notifications\Traits\NotificationTools;
31+
32+
/**
33+
* Class EntosisCaptureStarted.
34+
*
35+
* @package Seat\Notifications\Notifications\Sovereignties
36+
*/
37+
class EntosisCaptureStarted extends AbstractMailNotification
38+
{
39+
use NotificationTools;
40+
41+
/**
42+
* @var \Seat\Eveapi\Models\Character\CharacterNotification
43+
*/
44+
private $notification;
45+
46+
/**
47+
* Constructor.
48+
*
49+
* @param \Seat\Eveapi\Models\Character\CharacterNotification $notification
50+
*/
51+
public function __construct(CharacterNotification $notification)
52+
{
53+
$this->notification = $notification;
54+
}
55+
56+
/**
57+
* @param $notifiable
58+
* @return \Illuminate\Notifications\Messages\MailMessage
59+
*/
60+
public function toMail($notifiable)
61+
{
62+
$type = InvType::find($this->notification->text['structureTypeID']);
63+
64+
$system = MapDenormalize::find($this->notification->text['solarSystemID']);
65+
66+
return (new MailMessage)
67+
->subject('Sovereignty Structure is being captured notification!')
68+
->line(
69+
sprintf('A sovereignty structure is being captured (%s)!', $type->typeName))
70+
->action(
71+
sprintf('System : %s (%s)', $system->itemName, number_format($system->security, 2)),
72+
sprintf('https://zkillboard.com/%s/%d', 'system', $system->itemID));
73+
}
74+
75+
/**
76+
* @param $notifiable
77+
* @return array
78+
*/
79+
public function toArray($notifiable)
80+
{
81+
return $this->notification->text;
82+
}
83+
}
Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
<?php
2+
3+
/*
4+
* This file is part of SeAT
5+
*
6+
* Copyright (C) 2015 to present Leon Jacobs
7+
*
8+
* This program is free software; you can redistribute it and/or modify
9+
* it under the terms of the GNU General Public License as published by
10+
* the Free Software Foundation; either version 2 of the License, or
11+
* (at your option) any later version.
12+
*
13+
* This program is distributed in the hope that it will be useful,
14+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
15+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16+
* GNU General Public License for more details.
17+
*
18+
* You should have received a copy of the GNU General Public License along
19+
* with this program; if not, write to the Free Software Foundation, Inc.,
20+
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
21+
*/
22+
23+
namespace Seat\Notifications\Notifications\Sovereignties\Mail;
24+
25+
use Illuminate\Notifications\Messages\MailMessage;
26+
use Seat\Eveapi\Models\Character\CharacterNotification;
27+
use Seat\Eveapi\Models\Sde\MapDenormalize;
28+
use Seat\Notifications\Notifications\AbstractMailNotification;
29+
use Seat\Notifications\Traits\NotificationTools;
30+
31+
/**
32+
* Class SovCommandNodeEventStarted.
33+
*
34+
* @package Seat\Notifications\Notifications\Sovereignties
35+
*/
36+
class SovCommandNodeEventStarted extends AbstractMailNotification
37+
{
38+
use NotificationTools;
39+
40+
/**
41+
* @var \Seat\Eveapi\Models\Character\CharacterNotification
42+
*/
43+
private $notification;
44+
45+
/**
46+
* Constructor.
47+
*
48+
* @param \Seat\Eveapi\Models\Character\CharacterNotification $notification
49+
*/
50+
public function __construct(CharacterNotification $notification)
51+
{
52+
$this->notification = $notification;
53+
}
54+
55+
/**
56+
* @param $notifiable
57+
* @return \Illuminate\Notifications\Messages\MailMessage
58+
*/
59+
public function toMail($notifiable)
60+
{
61+
$system = MapDenormalize::find($this->notification->text['solarSystemID']);
62+
63+
return (new MailMessage)
64+
->subject('Sovereignty Command Node event started!')
65+
->line(
66+
sprintf('A sovereignty command node event started (%s)!', $this->campaignEventType($this->notification->text['campaignEventType'])))
67+
->action(
68+
sprintf('System : %s (%s)', $system->itemName, number_format($system->security, 2)),
69+
sprintf('https://zkillboard.com/%s/%d', 'system', $system->itemID));
70+
}
71+
72+
/**
73+
* @param $notifiable
74+
* @return array
75+
*/
76+
public function toArray($notifiable)
77+
{
78+
return $this->notification->text;
79+
}
80+
}

0 commit comments

Comments
 (0)