Skip to content

Commit

Permalink
Add missing sovereignties notifications for entosis capture started a…
Browse files Browse the repository at this point in the history
…nd command node event started. (#97)
  • Loading branch information
zenobio93 authored Jan 30, 2024
1 parent 77150a7 commit f04869d
Show file tree
Hide file tree
Showing 16 changed files with 566 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/Config/notifications.alerts.php
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,14 @@
'slack' => \Seat\Notifications\Notifications\Corporations\Slack\CorpAppNewMsg::class,
],
],
'EntosisCaptureStarted' => [
'label' => 'notifications::alerts.entosis_capture_started',
'handlers' => [
'discord' => \Seat\Notifications\Notifications\Sovereignties\Discord\EntosisCaptureStarted::class,
'mail' => \Seat\Notifications\Notifications\Sovereignties\Mail\EntosisCaptureStarted::class,
'slack' => \Seat\Notifications\Notifications\Sovereignties\Slack\EntosisCaptureStarted::class,
],
],
'MoonminingExtractionFinished' => [
'label' => 'notifications::alerts.moon_mining_extraction_finished',
'handlers' => [
Expand Down Expand Up @@ -222,6 +230,14 @@
'discord' => \Seat\Notifications\Notifications\Characters\Discord\ResearchMissionAvailableMsg::class,
],
],
'SovCommandNodeEventStarted' => [
'label' => 'notifications::alerts.sovereignty_command_node_event_started',
'handlers' => [
'discord' => \Seat\Notifications\Notifications\Sovereignties\Discord\SovCommandNodeEventStarted::class,
'mail' => \Seat\Notifications\Notifications\Sovereignties\Mail\SovCommandNodeEventStarted::class,
'slack' => \Seat\Notifications\Notifications\Sovereignties\Slack\SovCommandNodeEventStarted::class,
],
],
'SovStructureDestroyed' => [
'label' => 'notifications::alerts.sovereignty_structure_destroyed',
'handlers' => [
Expand Down
89 changes: 89 additions & 0 deletions src/Notifications/Sovereignties/Discord/EntosisCaptureStarted.php
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();
}
}
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 src/Notifications/Sovereignties/Mail/EntosisCaptureStarted.php
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;
}
}
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;
}
}
Loading

0 comments on commit f04869d

Please sign in to comment.