From c61782ff20c57a84165cf0e4dbeea9ca355675dc Mon Sep 17 00:00:00 2001 From: Dew Gaming Date: Thu, 8 Feb 2024 21:33:33 -0600 Subject: [PATCH] Added Shiny Hunt Phases page --- .../Controllers/ShinyHuntController.cs | 23 ++++ .../Shared/_FillCompletedShinyHunt.cshtml | 4 + .../Views/ShinyHunt/ShinyHuntPhases.cshtml | 111 ++++++++++++++++++ Pokedex/Pokedex/Views/User/ShinyHunts.cshtml | 9 +- Pokedex/Pokedex/wwwroot/css/shinyHunts.css | 7 +- 5 files changed, 152 insertions(+), 2 deletions(-) create mode 100644 Pokedex/Pokedex/Views/ShinyHunt/ShinyHuntPhases.cshtml diff --git a/Pokedex/Pokedex/Controllers/ShinyHuntController.cs b/Pokedex/Pokedex/Controllers/ShinyHuntController.cs index b93023a1..c339c46b 100644 --- a/Pokedex/Pokedex/Controllers/ShinyHuntController.cs +++ b/Pokedex/Pokedex/Controllers/ShinyHuntController.cs @@ -533,5 +533,28 @@ public IActionResult EditCompleteShinyHunt(EditShinyHuntViewModel shinyHunt) return this.RedirectToAction("ShinyHunts", "User"); } + + /// + /// Grabs all of the prior phases for a shiny hunt. + /// + /// The shiny hunt. + /// The shiny hunt phases page. + [HttpGet] + [Route("shiny_hunt_phases/{shinyHuntId:int}")] + public IActionResult ShinyHuntPhases(int shinyHuntId) + { + List shinyHunts = this.dataService.GetObjects(includes: "Pokemon, Mark, Pokeball, Sweet, Game, HuntingMethod"); + + ShinyHuntsViewModel model = new ShinyHuntsViewModel() + { + AllShinyHunts = shinyHunts.Where(x => x.PhaseOfHuntId == shinyHuntId).ToList(), + ShinyHunt = shinyHunts.Find(x => x.Id == shinyHuntId), + IsShared = true, + AppConfig = this.appConfig, + }; + + this.dataService.AddPageView("Shiny Hunt Phases Page", this.User.IsInRole("Owner")); + return this.View("ShinyHuntPhases", model); + } } } diff --git a/Pokedex/Pokedex/Views/Shared/_FillCompletedShinyHunt.cshtml b/Pokedex/Pokedex/Views/Shared/_FillCompletedShinyHunt.cshtml index 0bfa0641..5b021187 100644 --- a/Pokedex/Pokedex/Views/Shared/_FillCompletedShinyHunt.cshtml +++ b/Pokedex/Pokedex/Views/Shared/_FillCompletedShinyHunt.cshtml @@ -96,6 +96,10 @@
Modify Shiny + @if (@Model.AllShinyHunts.Where(x => x.PhaseOfHuntId == Model.ShinyHunt.Id).Count() > 0) + { + View Prior Phases + }
} \ No newline at end of file diff --git a/Pokedex/Pokedex/Views/ShinyHunt/ShinyHuntPhases.cshtml b/Pokedex/Pokedex/Views/ShinyHunt/ShinyHuntPhases.cshtml new file mode 100644 index 00000000..97b43245 --- /dev/null +++ b/Pokedex/Pokedex/Views/ShinyHunt/ShinyHuntPhases.cshtml @@ -0,0 +1,111 @@ +@model Pokedex.Models.ShinyHuntsViewModel; +@using System; +@{ + ViewBag.Title = "Shiny Hunts"; + ViewBag.Description = "Keep track of all of you current and successful shiny hunts!"; +} + +@section styles +{ + +} + +

Phases for @Model.ShinyHunt.Pokemon.Name@(!string.IsNullOrEmpty(Model.ShinyHunt.Pokemon.Nickname) ? string.Concat("(", Model.ShinyHunt.Pokemon.Nickname, ")"))

+ +
+ @foreach (var shinyHunt in Model.AllShinyHunts) + { +
+
+
+
+ @if (shinyHunt.HasShinyCharm) + { + + } + @if (shinyHunt.Mark != null) + { + + } + @if (shinyHunt.IsAlpha) + { + + } + @if (shinyHunt.Pokeball != null) + { + + } + @if (shinyHunt.Gender == "Male" || shinyHunt.Gender == "Female") + { + + } + @if (shinyHunt.DirectHOMETransfer) + { + + } + @if (shinyHunt.Sweet != null) + { + + } +
+ + @if (shinyHunt.Pokemon.HasGenderDifference) + { + @shinyHunt.Pokemon.Name Shiny Image + } + else + { + @shinyHunt.Pokemon.Name Shiny Image + } + +
+
+

+ @shinyHunt.Pokemon.Name + @if (shinyHunt.Nickname != null) + { + @string.Concat(" (", shinyHunt.Nickname, ")") + } +

+

Game: @shinyHunt.Game.Name

+

Hunting Method: @shinyHunt.HuntingMethod.Name

+ @if (@shinyHunt.TotalEncounters > 0) + { + @if (@shinyHunt.CurrentPhaseEncounters > 0 && @shinyHunt.CurrentPhaseEncounters != @shinyHunt.TotalEncounters) + { + if (@shinyHunt.HuntingMethodId == 4 || @shinyHunt.HuntingMethodId == 5) + { +

Last Phase Eggs: @shinyHunt.CurrentPhaseEncounters

+ } + else + { +

Last Phase Encounters: @shinyHunt.CurrentPhaseEncounters

+ } + } + if (@shinyHunt.HuntingMethodId == 4 || @shinyHunt.HuntingMethodId == 5 ) + { +

Total Eggs: @shinyHunt.TotalEncounters

+ } + else + { +

Total Encounters: @shinyHunt.TotalEncounters

+ } + } + @if (@shinyHunt.Phases > 1) + { +

Total Phases: @shinyHunt.Phases

+ } +

Date of Capture: @shinyHunt.DateOfCapture.ToString("MMMM d, yyyy")

+ @if (@shinyHunt.SparklingPowerLevel > 0) + { +

Sparkling Power Level: @shinyHunt.SparklingPowerLevel

+ } + @if (@shinyHunt.PhaseOfHunt != null) + { +

Found While Hunting: @shinyHunt.PhaseOfHunt.Pokemon.Name

+ } +
+
+
+ } +
\ No newline at end of file diff --git a/Pokedex/Pokedex/Views/User/ShinyHunts.cshtml b/Pokedex/Pokedex/Views/User/ShinyHunts.cshtml index 5fa96689..bbd3c96c 100644 --- a/Pokedex/Pokedex/Views/User/ShinyHunts.cshtml +++ b/Pokedex/Pokedex/Views/User/ShinyHunts.cshtml @@ -113,7 +113,14 @@ } - @s.Pokemon.Name Shiny Image + @if (Model.IsShared) + { + @s.Pokemon.Name Shiny Image + } + else + { + @s.Pokemon.Name Shiny Image + }
diff --git a/Pokedex/Pokedex/wwwroot/css/shinyHunts.css b/Pokedex/Pokedex/wwwroot/css/shinyHunts.css index 9e79fa27..44ff1de5 100644 --- a/Pokedex/Pokedex/wwwroot/css/shinyHunts.css +++ b/Pokedex/Pokedex/wwwroot/css/shinyHunts.css @@ -52,12 +52,17 @@ .shinyFoundButtons a, .huntUncapturedButtons a, .huntUncapturedButtons button, -.huntCapturedButtons a, +.huntCapturedButtons a:not(.phasesButton), .huntCapturedButtons button, .encounterButtons button { width: 49%; } +.phasesButton { + margin-top: 5px; + width: 99%; +} + .shinyHuntButtons a { margin-bottom: 5px; }