Skip to content

Commit

Permalink
Merge pull request #13 from evinjaff/generate-savefile
Browse files Browse the repository at this point in the history
Generate savefile
  • Loading branch information
evinjaff authored Jul 9, 2024
2 parents 13bb25a + ae152e4 commit 01c42b4
Show file tree
Hide file tree
Showing 101 changed files with 2,244 additions and 291 deletions.
18 changes: 18 additions & 0 deletions .github/workflows/docker-compose-complete.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: Complete Docker Compose of App

on:
push:
branches: [ $default-branch ]
pull_request:
branches: [ $default-branch ]

jobs:

build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Build the Docker image
run: docker-compose build
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -402,3 +402,7 @@ server/venv/
.DS_Store

server/egglocke/db.sqlite3

server/server-venv/

*.sqlite3
25 changes: 25 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
version: '3.8'

services:
pkhex:
build: ./pkhex
container_name: pkhex_container
hostname: pkhex_host
ports:
- "1234:1234"
networks:
app_network:

server:
build: ./server
container_name: server_container
hostname: server_host
ports:
- "8443:8443"
networks:
app_network:

networks:
app_network:
driver: bridge

3 changes: 1 addition & 2 deletions pkhex/dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ WORKDIR /source
# copy pkhex-egglocke folder to the container
COPY pkhex-egglocke .


# Install pkhex dependency
RUN dotnet restore pkhex-egglocke

Expand All @@ -24,4 +23,4 @@ ENV PORT 1234
EXPOSE 1234

WORKDIR /source/pkhex-egglocke
ENTRYPOINT ["dotnet", "run"]
ENTRYPOINT ["dotnet", "run", "-api"]
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using PKHeX.Core;

namespace pkhexEgglockeTests
{
Expand Down
55 changes: 55 additions & 0 deletions pkhex/pkhex-egglocke-tests/pkhex-egglocke-tests/SaveWriterTest.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
using PKHeX.Core;
using pkhexEgglocke;
using System.Reflection;

Expand Down Expand Up @@ -60,6 +61,60 @@ public void TestMassAddWorks()

}

[TestMethod]
public void TestNaturesSetCorrectifNotShiny()
{
SaveWriter sw = new SaveWriter(testConstants.JOHTO_PLUS_SOUL_SILVER_SAVE);

EggCreator ec = EggCreator.decodeJSON(testConstants.BLANK_GEN4_MAREEP_VALID, true);

sw.addEgg(ec, 1);

// get egg at box index 1
IList<PKM> boxData = sw.getBox();

Nature expectedNature = Nature.Adamant;

Assert.AreEqual(expectedNature, boxData[1].Nature);

}

[TestMethod]
public void TestNaturesSetCorrectifShiny()
{
SaveWriter sw = new SaveWriter(testConstants.JOHTO_PLUS_SOUL_SILVER_SAVE);

EggCreator ec = EggCreator.decodeJSON(testConstants.BLANK_GEN4_SHINY_MAREEP_VALID, true);

sw.addEgg(ec, 1);

// get egg at box index 1
IList<PKM> boxData = sw.getBox();

Nature expectedNature = Nature.Adamant;

Assert.AreEqual(expectedNature, boxData[1].Nature);

}

[TestMethod]
public void TestShinyCorrect()
{
SaveWriter sw = new SaveWriter(testConstants.JOHTO_PLUS_SOUL_SILVER_SAVE);

EggCreator ec = EggCreator.decodeJSON(testConstants.BLANK_GEN4_SHINY_MAREEP_VALID, true);

sw.addEgg(ec, 1);

// get egg at box index 1
IList<PKM> boxData = sw.getBox();

bool isShiny = boxData[1].IsShiny;

Assert.IsTrue(isShiny);

}


}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.8.0" />
<PackageReference Include="MSTest.TestAdapter" Version="3.1.1" />
<PackageReference Include="MSTest.TestFramework" Version="3.1.1" />
<PackageReference Include="PKHeX.Core" Version="24.7.3" />
</ItemGroup>

<ItemGroup>
Expand All @@ -26,17 +27,16 @@
<Using Include="Microsoft.VisualStudio.TestTools.UnitTesting" />
</ItemGroup>

<ItemGroup>
<Folder Include="testSources\" />
</ItemGroup>

<ItemGroup>
<None Update="testSources\emptySoulSilver.sav">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="testSources\LegendaryTrio.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="testSources\MareepShiny.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="testSources\Mareep.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public static class testConstants
// Gen 4 - Egg JSONs
public static string BLANK_GEN4_MAREEP_VALID => Path.Combine(Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), @"testSources"), "Mareep.json");
public static string BLANK_GEN4_LEGENDARY_TRIO => Path.Combine(Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), @"testSources"), "LegendaryTrio.json");

public static string BLANK_GEN4_SHINY_MAREEP_VALID => Path.Combine(Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), @"testSources"), "MareepShiny.json");

// Gen 6 - Omega Ruby Save File
public static string BLANK_OMEGARUBY_SAVE => Path.Combine(Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), @"testSources"), "emptyOmegaRuby.sav");
Expand Down
Original file line number Diff line number Diff line change
@@ -1,47 +1,50 @@
[
{
"dexNumber": 483,
"ball": 2,
"language": 1,
"ability": 28,
"nature": 1,
"OT": "Dawn",
"OTGender": 1,
"nickname": "Dialga",
"IV": [ 31, 31, 31, 31, 31, 31 ],
"EV": [ 0, 0, 0, 0, 0, 0 ],
"moves": [ 425, 262 ],
"movespp": [ 30, 40 ]

},
{
"dexNumber": 484,
"ball": 2,
"language": 1,
"ability": 30,
"nature": 1,
"OT": "Dawn",
"OTGender": 1,
"nickname": "Palkia",
"IV": [ 31, 31, 31, 31, 31, 31 ],
"EV": [ 0, 0, 0, 0, 0, 0 ],
"moves": [ 425, 262 ],
"movespp": [ 30, 40 ]

},
{
"dexNumber": 487,
"ball": 2,
"language": 1,
"ability": 5,
"nature": 1,
"OT": "Dawn",
"OTGender": 1,
"nickname": "Giratina",
"IV": [ 31, 31, 31, 31, 31, 31 ],
"EV": [ 0, 0, 0, 0, 0, 0 ],
"moves": [ 425, 262 ],
"movespp": [ 30, 40 ]

}
{
"dexNumber": 483,
"ball": 2,
"language": 1,
"ability": 28,
"nature": 3,
"heldItem": 135,
"OT": "Dawn",
"OTGender": 1,
"nickname": "Dialga",
"IV": [ 31, 31, 31, 31, 31, 31 ],
"EV": [ 252, 252, 0, 0, 0, 0 ],
"moves": [ 425, 262 ],
"movespp": [ 30, 40 ],
"isShiny": true
},
{
"dexNumber": 484,
"ball": 2,
"language": 1,
"ability": 28,
"nature": 3,
"heldItem": 135,
"OT": "Dawn",
"OTGender": 1,
"nickname": "Palkia",
"IV": [ 31, 31, 31, 31, 31, 31 ],
"EV": [ 252, 252, 0, 0, 0, 0 ],
"moves": [ 425, 262 ],
"movespp": [ 30, 40 ],
"isShiny": true
},
{
"dexNumber": 487,
"ball": 2,
"language": 1,
"ability": 28,
"nature": 3,
"heldItem": 135,
"OT": "Dawn",
"OTGender": 1,
"nickname": "Giratina",
"IV": [ 31, 31, 31, 31, 31, 31 ],
"EV": [ 252, 252, 0, 0, 0, 0 ],
"moves": [ 425, 262 ],
"movespp": [ 30, 40 ],
"isShiny": true
}
]
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
{
"dexNumber": 179,
"ball": 2,
"language": 1,
"ability":9,
"nature": 1,
"OT": "Dawn",
"OTGender": 1,
"nickname": "WLW",
"IV": [ 31, 31, 31, 31, 31, 31 ],
"EV": [ 0, 0, 0, 0, 0, 0 ],
"moves": [ 425, 262 ],
"movespp": [ 30, 40 ]

"dexNumber": 179,
"ball": 2,
"language": 1,
"ability": 99,
"nature": 3,
"OT": "Red",
"OTGender": 1,
"nickname": "sheepy2",
"IV": [ 31, 31, 31, 31, 31, 31 ],
"EV": [ 252, 252, 0, 0, 0, 0 ],
"moves": [ 344, 1, 124, 26 ],
"movespp": [ 0, 0, 0, 0 ],
"heldItem": 135,
"isShiny": false
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"dexNumber": 179,
"ball": 2,
"language": 1,
"ability": 99,
"nature": 3,
"OT": "Red",
"OTGender": 1,
"nickname": "sheepy2",
"IV": [ 31, 31, 31, 31, 31, 31 ],
"EV": [ 252, 252, 0, 0, 0, 0 ],
"moves": [ 344, 1, 124, 26 ],
"movespp": [ 0, 0, 0, 0 ],
"heldItem": 135,
"isShiny": true
}
Loading

0 comments on commit 01c42b4

Please sign in to comment.