Commit a9774626 authored by Mike Koch's avatar Mike Koch 💬

Merge branch '70-sniper-assassin' into 'master'

Sniper Assassin

See merge request !48
parents 999a4037 e7cbd02a

Too many changes to show.

To preserve performance only 1000 of 1000+ files are displayed.

......@@ -8,4 +8,5 @@ abstract class MissionType {
const BONUS_EPISODE = "Bonus Episode";
const PATIENT_ZERO = "Patient Zero";
const ELUSIVE_TARGET = "Elusive Target";
const SNIPER_ASSASSIN = "Sniper Assassin";
}
\ No newline at end of file
......@@ -3,11 +3,13 @@
namespace Controllers;
use BusinessLogic\MissionType;
use BusinessLogic\UserRole;
use Controllers\ViewModels\NodeNoteViewModel;
use Controllers\ViewModels\NodeWithNotesViewModel;
use Controllers\ViewModels\Sidebar\CategoryViewModel;
use Controllers\ViewModels\Sidebar\TopLevelCategoryViewModel;
use DataAccess\Models\Mission;
use DataAccess\Models\Node;
use DataAccess\Models\NodeCategory;
use DataAccess\Models\NodeNote;
......@@ -37,6 +39,9 @@ class NodeController {
}
public function getNodesForMission(int $missionid, string $difficulty, bool $distinctOnly = false, bool $searchableOnly = false): array {
/* @var $mission Mission */
$mission = $this->entityManager->getRepository(Mission::class)->findOneBy(['id' => $missionid]);
$nodesWithNotes = $this->nodeRepository->findByMissionAndDifficulty($missionid, $difficulty);
$groups = [
......@@ -45,7 +50,8 @@ class NodeController {
'Navigation' => new TopLevelCategoryViewModel('Navigation'),
];
$nodeCategories = $this->nodeCategoryRepository->findBy([], ['order' => 'ASC']);
$forSniperAssassin = $mission->getMissionType() === MissionType::SNIPER_ASSASSIN;
$nodeCategories = $this->nodeCategoryRepository->findBy(['forMission' => !$forSniperAssassin, 'forSniperAssassin' => $forSniperAssassin ], ['order' => 'ASC']);
foreach ($nodeCategories as $nodeCategory) {
/* @var $nodeCategory NodeCategory */
$categoryViewModel = new CategoryViewModel();
......
......@@ -29,6 +29,16 @@ class Game {
*/
public $tagline;
/**
* @ORM\Column(type="string")
*/
public $type;
/**
* @ORM\Column(type="string")
*/
public $icon;
/**
* @return mixed
*/
......@@ -84,4 +94,32 @@ class Game {
public function setTagline(string $tagline): void {
$this->tagline = $tagline;
}
/**
* @return mixed
*/
public function getType() {
return $this->type;
}
/**
* @param mixed $type
*/
public function setType($type): void {
$this->type = $type;
}
/**
* @return mixed
*/
public function getIcon() {
return $this->icon;
}
/**
* @param mixed $icon
*/
public function setIcon($icon): void {
$this->icon = $icon;
}
}
\ No newline at end of file
......@@ -81,6 +81,16 @@ class NodeCategory {
*/
public $collapsible;
/**
* @ORM\Column(type="boolean", name="for_mission")
*/
public $forMission;
/**
* @ORM\Column(type="boolean", name="for_sniper_assassin")
*/
public $forSniperAssassin;
/**
* @return mixed
*/
......@@ -276,4 +286,32 @@ class NodeCategory {
public function setCollapsible($collapsible): void {
$this->collapsible = $collapsible;
}
/**
* @return mixed
*/
public function getForMission() {
return $this->forMission;
}
/**
* @param mixed $forMission
*/
public function setForMission($forMission): void {
$this->forMission = $forMission;
}
/**
* @return mixed
*/
public function getForSniperAssassin() {
return $this->forSniperAssassin;
}
/**
* @param mixed $forSniperAssassin
*/
public function setForSniperAssassin($forSniperAssassin): void {
$this->forSniperAssassin = $forSniperAssassin;
}
}
\ No newline at end of file
......@@ -18,6 +18,7 @@ class GameMapViewModel extends BaseModel {
public $missionType;
public $missionSlug;
public $tileLocation;
public $icon;
public $difficulty;
public $mapCenterLongitude;
......@@ -53,4 +54,12 @@ class GameMapViewModel extends BaseModel {
$this->tileLocation = "jpg/elusive-targets/{$this->missionSlug}.jpg";
return;
}
public function setIcon() {
$this->icon = str_replace(' ', '-', mb_strtolower($this->missionType));
if ($this->missionType === MissionType::BONUS_EPISODE || $this->missionType === MissionType::PATIENT_ZERO) {
$this->icon = 'mission';
}
}
}
\ No newline at end of file
......@@ -14,6 +14,12 @@ class GameViewModel extends BaseModel {
/* @var $tagline string */
public $tagline;
/* @var $type string */
public $type;
/* @var $icon string */
public $icon;
/* @var $locations LocationViewModel[] */
public $locations;
}
\ No newline at end of file
......@@ -29,6 +29,9 @@ class MissionViewModel extends BaseModel {
/* @var $tileLocation string */
public $tileLocation;
/* @var $icon string */
public $icon;
public function setTileLocation() {
if ($this->missionType !== MissionType::ELUSIVE_TARGET) {
$this->tileLocation = "{$this->pngBackgroundFileExtension}/mission-thumbnails/{$this->game}/{$this->slug}.{$this->pngBackgroundFileExtension}";
......@@ -43,4 +46,12 @@ class MissionViewModel extends BaseModel {
$this->tileLocation = "jpg/elusive-targets/{$this->slug}.jpg";
return;
}
public function setIcon() {
$this->icon = str_replace(' ', '-', mb_strtolower($this->missionType));
if ($this->missionType === MissionType::BONUS_EPISODE || $this->missionType === MissionType::PATIENT_ZERO) {
$this->icon = 'mission';
}
}
}
\ No newline at end of file
......@@ -46,4 +46,8 @@ REM gdal2tiles.py -l -p raster -z 4-6 -w none "E:\Users\mkoch\Downloads\H2 Maps\
REM gdal2tiles.py -l -p raster -z 4-6 -w none "E:\Users\mkoch\Downloads\H2 Maps\Sgail\6.png" "E:\Users\mkoch\Downloads\H2 Maps\Sgail\tiles\6"
REM gdal2tiles.py -l -p raster -z 4-6 -w none "E:\Users\mkoch\Downloads\H2 Maps\Sgail\7.png" "E:\Users\mkoch\Downloads\H2 Maps\Sgail\tiles\7"
REM gdal2tiles.py -l -p raster -z 4-6 -w none "E:\Users\mkoch\Downloads\H2 Maps\Sgail\8.png" "E:\Users\mkoch\Downloads\H2 Maps\Sgail\tiles\8"
gdal2tiles.py -l -p raster -z 4-6 -w none "C:\Users\mkoch\Desktop\H2 Maps\IsleOfSgail\-99.png" "C:\Users\mkoch\Desktop\H2 Maps\IsleOfSgail\tiles\-99"
\ No newline at end of file
REM gdal2tiles.py -l -p raster -z 4-6 -w none "C:\Users\mkoch\Desktop\H2 Maps\IsleOfSgail\-99.png" "C:\Users\mkoch\Desktop\H2 Maps\IsleOfSgail\tiles\-99"
REM Sniper Assassin
gdal2tiles.py -l -p raster -z 4-6 -w none "D:\Downloads\sniper_hawk.png" "D:\Downloads\sniper_hawk"
gdal2tiles.py -l -p raster -z 4-6 -w none "D:\Downloads\sniper_seagull.png" "D:\Downloads\sniper_seagull"
\ No newline at end of file
<?php
use Phinx\Migration\AbstractMigration;
class AddTypeToGames extends AbstractMigration {
public function up() {
$this->table('games')
->addColumn('type', 'string')
->addColumn('icon', 'string')
->update();
$this->execute("UPDATE `games` SET `type` = 'Campaign', `icon` = 'campaign'");
}
public function down() {
$this->table('games')
->removeColumn('type')
->removeColumn('icon')
->update();
}
}
<?php
use Phinx\Migration\AbstractMigration;
class AddSniperAssassinGame extends AbstractMigration {
public function change() {
$this->table('games')
->insert([
[
'slug' => 'sniper-assassin',
'full_name' => 'Sniper Assassin',
'tagline' => 'Sniper Assassin',
'type' => 'Game Mode',
'icon' => 'sniper-assassin'