Skip to content
This repository has been archived by the owner on Mar 12, 2024. It is now read-only.

Commit

Permalink
fix traits table, some jo work
Browse files Browse the repository at this point in the history
  • Loading branch information
GreatNovaDragon committed Feb 22, 2024
1 parent ced9b9f commit 936150e
Show file tree
Hide file tree
Showing 7 changed files with 168 additions and 70 deletions.
12 changes: 4 additions & 8 deletions DBInitializer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -194,15 +194,13 @@ private static async Task TransferAbilities(ApplicationDbContext context, PokeAp
: Item.Name;
var Name_DE = Item.Names.FirstOrDefault(n => n.Language.Name == "de")?.Name;
var Effect = Item.EffectEntries.FirstOrDefault(n => n.Language.Name == "en") != null
? Item.EffectEntries.FirstOrDefault(n => n.Language.Name == "en").Effect.Replace("one stage", "2")
.Replace("two stages", "4").Replace("three stages", "6")
? Item.EffectEntries.FirstOrDefault(n => n.Language.Name == "en").Effect
: Item.FlavorTextEntries.FirstOrDefault(n => n.Language.Name == "en") != null
? Item.FlavorTextEntries.FirstOrDefault(n => n.Language.Name == "en").FlavorText
: "No Entry";

var ShortEffect = Item.EffectEntries.FirstOrDefault(n => n.Language.Name == "en") != null
? Item.EffectEntries.FirstOrDefault(n => n.Language.Name == "en").ShortEffect.Replace("one stage", "2")
.Replace("two stages", "4").Replace("three stages", "6")
? Item.EffectEntries.FirstOrDefault(n => n.Language.Name == "en").ShortEffect
: Item.FlavorTextEntries.FirstOrDefault(n => n.Language.Name == "en") != null
? Item.FlavorTextEntries.FirstOrDefault(n => n.Language.Name == "en").FlavorText
: "No Entry";
Expand Down Expand Up @@ -289,9 +287,8 @@ private static async Task TransferMoves(ApplicationDbContext context, PokeApiCli
? m.EffectEntries.FirstOrDefault(n => n.Language.Name == "de").Effect
: m.EffectEntries.FirstOrDefault(n => n.Language.Name == "en") != null
? m.EffectEntries.FirstOrDefault(n => n.Language.Name == "en").Effect
.Replace("$effect_chance", $"{m.EffectChance}").Replace("1/16", "gradD4")
.Replace("1/16", "gradD4")
.Replace("1/8", "(2*Grad)D4")
.Replace("user's max HP", "").Replace("max HP", "")
: m.FlavorTextEntries.FirstOrDefault(n => n.Language.Name == "en") != null
? m.FlavorTextEntries.FirstOrDefault(n => n.Language.Name == "en").FlavorText
: "No Data";
Expand All @@ -306,9 +303,8 @@ private static async Task TransferMoves(ApplicationDbContext context, PokeApiCli
? m.EffectEntries.FirstOrDefault(n => n.Language.Name == "de").ShortEffect
: m.EffectEntries.FirstOrDefault(n => n.Language.Name == "en") != null
? m.EffectEntries.FirstOrDefault(n => n.Language.Name == "en").ShortEffect
.Replace("$effect_chance", $"{m.EffectChance}").Replace("1/16", "gradD4")
.Replace("1/16", "gradD4")
.Replace("1/8", "(2*Grad)D4")
.Replace("user's max HP", "").Replace("max HP", "")
: m.FlavorTextEntries.FirstOrDefault(n => n.Language.Name == "en") != null
? m.FlavorTextEntries.FirstOrDefault(n => n.Language.Name == "en").FlavorText
: "No Data";
Expand Down
47 changes: 47 additions & 0 deletions Pages/LearnSet/Index.cshtml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
@page
@model pkmnWildLife.Pages.LearnSet.IndexModel

@{
ViewData["Title"] = "Index";
}

<h1>Index</h1>

<p>
<a asp-page="Create">Create New</a>
</p>
<table class="table">
<thead>
<tr>
<th>Who</th>
<th>What</th>

<th>
@Html.DisplayNameFor(model => model.Learnset[0].how)
</th>
<th>
@Html.DisplayNameFor(model => model.Learnset[0].level)
</th>
<th></th>
</tr>
</thead>
<tbody>
@foreach (var item in Model.Learnset) {
<tr>
<td>@item.mon.Name</td>
<td>@item.move.Name</td>
<td>
@Html.DisplayFor(modelItem => item.how)
</td>
<td>
@Html.DisplayFor(modelItem => item.level)
</td>
<td>
<a asp-page="./Edit" asp-route-id="@item.ID">Edit</a> |
<a asp-page="./Details" asp-route-id="@item.ID">Details</a> |
<a asp-page="./Delete" asp-route-id="@item.ID">Delete</a>
</td>
</tr>
}
</tbody>
</table>
28 changes: 28 additions & 0 deletions Pages/LearnSet/Index.cshtml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages;
using Microsoft.EntityFrameworkCore;
using pkmnWildLife.Data;

namespace pkmnWildLife.Pages.LearnSet
{
public class IndexModel : PageModel
{
private readonly pkmnWildLife.Data.ApplicationDbContext _context;

public IndexModel(pkmnWildLife.Data.ApplicationDbContext context)
{
_context = context;
}

public IList<Learnset> Learnset { get;set; } = default!;

public async Task OnGetAsync()
{
Learnset = await _context.Learnsets.ToListAsync();
}
}
}
87 changes: 87 additions & 0 deletions Pages/pokemon/listwithstats.cshtml
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
@page
@model IndexModel

@{
ViewData["Title"] = "Index";
ViewData["HeaderColor"] = "#f00";
}

<h1>Index</h1>

<p>
<a asp-page="Create">Create New</a>
</p>
<table id="pokedex" class="display">
<thead>
<tr>
<th style="display:none;"> Name en</th>

<th>
@Html.DisplayNameFor(model => model.Pokemon[0].Name)
</th>
<th>HP</th>
<th>ATK</th>
<th>DEF</th>
<th>SpATK</th>
<th>SpDEF</th>
<th>Speed</th>


<th>
Typen
</th>
</tr>
</thead>
<tbody>
@foreach (var item in Model.Pokemon.OrderBy(c => c.Dex))
{
<tr>
<td style="display:none;">@Html.DisplayFor(modelItem => item.Name) </td>
<td>
<a asp-page="./Details" asp-route-id="@item.ID">
@if (!string.IsNullOrEmpty(item.Form_DE))
{
@Html.Raw($"{item.Form_DE}")
}
else if (!string.IsNullOrEmpty(item.Form))
{
@Html.Raw($"{item.Form}")
}
else if (!string.IsNullOrEmpty(item.Name_DE))
{
@Html.Raw(item.Name_DE)
}
else
{
@Html.DisplayFor(modelItem => item.Name)
}


</a>
</td>

<td>@item.HEALTH</td>
<td>@item.ATK</td>
<td>@item.DEF</td>
<td>@item.SP_ATK</td>
<td>@item.SP_DEF</td>
<td>@item.SPEED</td>


<td style="display:none;">
@Html.Raw($"{item.Type1.Name}")
@if (item.Type2 != null)
{
@Html.Raw($"{item.Type2.Name}")
}
@Html.Raw($"{item.Type1.Name_DE}")
@if (item.Type2 != null)
{
@Html.Raw($"{item.Type2.Name_DE}")
}
</td>
</tr>
}
</tbody>
</table>

4 changes: 2 additions & 2 deletions Pages/traits/Index.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,15 @@
@Html.DisplayNameFor(model => model.Ability[0].Effect)
</th>
<th>
@Html.DisplayFor(model => model.Ability[0].Requirement)
@Html.DisplayNameFor(model => model.Ability[0].Requirement)
</th>
</tr>
</thead>
<tbody>
@foreach (var item in Model.Ability.OrderBy(item => item.Order))
{
<tr>
<td>
<td style="display: none">
@Html.DisplayFor(modelItem => item.Order)
</td>
<td>
Expand Down
Binary file modified app.db
Binary file not shown.
60 changes: 0 additions & 60 deletions wwwroot/css/w3.css
Original file line number Diff line number Diff line change
Expand Up @@ -180,38 +180,13 @@ textarea {
/* End extract */
html, body {
font-family: Verdana, sans-serif;
font-size: 15px;
line-height: 1.5
}

html {
overflow-x: hidden
}

h1 {
font-size: 36px
}

h2 {
font-size: 30px
}

h3 {
font-size: 24px
}

h4 {
font-size: 20px
}

h5 {
font-size: 18px
}

h6 {
font-size: 16px
}

.w3-serif {
font-family: serif
}
Expand Down Expand Up @@ -992,7 +967,6 @@ a {

.w3-code, .w3-codespan {
font-family: Consolas, "courier new";
font-size: 16px
}

.w3-code {
Expand Down Expand Up @@ -1195,41 +1169,7 @@ a {
filter: sepia(50%)
}

.w3-verytiny {
font-size: 8px !important
}

.w3-tiny {
font-size: 9px !important
}

.w3-small {
font-size: 12px !important
}

.w3-medium {
font-size: 15px !important
}

.w3-large {
font-size: 18px !important
}

.w3-xlarge {
font-size: 24px !important
}

.w3-xxlarge {
font-size: 36px !important
}

.w3-xxxlarge {
font-size: 48px !important
}

.w3-jumbo {
font-size: 64px !important
}

.w3-left-align {
text-align: left !important
Expand Down

0 comments on commit 936150e

Please sign in to comment.