Commit graph

78 commits

Author SHA1 Message Date
Kurt
d47bb1d297
Update .NET Runtime to .NET 8.0 (#4082)
With the new version of Visual Studio bringing C# 12, we can revise our logic for better readability as well as use new methods/APIs introduced in the .NET 8.0 BCL.
2023-12-03 20:13:20 -08:00
Kurt
88830e0d00
Update from .NET Framework 4.6 to .NET 7 (#3729)
Updates from net46->net7, dropping support for mono in favor of using the latest runtime (along with the performance/API improvements). Releases will be posted as 64bit only for now.

Refactors a good amount of internal API methods to be more performant and more customizable for future updates & fixes.

Adds functionality for Batch Editor commands to `>`, `<` and <=/>=

TID/SID properties renamed to TID16/SID16 for clarity; other properties exposed for Gen7 / display variants.

Main window has a new layout to account for DPI scaling (8 point grid)

Fixed: Tatsugiri and Paldean Tauros now output Showdown form names as Showdown expects
Changed: Gen9 species now interact based on the confirmed National Dex IDs (closes #3724)
Fixed: Pokedex set all no longer clears species with unavailable non-base forms (closes #3720)
Changed: Hyper Training suggestions now apply for level 50 in SV. (closes #3714)
Fixed: B2/W2 hatched egg met locations exclusive to specific versions are now explicitly checked (closes #3691)
Added: Properties for ribbon/mark count (closes #3659)
Fixed: Traded SV eggs are now checked correctly (closes #3692)
2023-01-21 20:02:33 -08:00
Kurt
186b2f2396 Update dependencies 2022-10-25 13:24:37 -07:00
Kurt
ba53f4a7bc Extract common csproj properties 2022-10-15 17:09:54 -07:00
Kurt
5875d76468 Update 22.09.13 2022-09-12 23:55:30 -07:00
Kurt
9166d0eb64
Refactoring: Move Source (Legality) (#3560)
Rewrites a good amount of legality APIs pertaining to:
* Legal moves that can be learned
* Evolution chains & cross-generation paths
* Memory validation with forgotten moves

In generation 8, there are 3 separate contexts an entity can exist in: SW/SH, BD/SP, and LA. Not every entity can cross between them, and not every entity from generation 7 can exist in generation 8 (Gogoat, etc). By creating class models representing the restrictions to cross each boundary, we are able to better track and validate data.

The old implementation of validating moves was greedy: it would iterate for all generations and evolutions, and build a full list of every move that can be learned, storing it on the heap. Now, we check one game group at a time to see if the entity can learn a move that hasn't yet been validated. End result is an algorithm that requires 0 allocation, and a smaller/quicker search space.

The old implementation of storing move parses was inefficient; for each move that was parsed, a new object is created and adjusted depending on the parse. Now, move parse results are `struct` and store the move parse contiguously in memory. End result is faster parsing and 0 memory allocation.

* `PersonalTable` objects have been improved with new API methods to check if a species+form can exist in the game.
* `IEncounterTemplate` objects have been improved to indicate the `EntityContext` they originate in (similar to `Generation`).
* Some APIs have been extended to accept `Span<T>` instead of Array/IEnumerable
2022-08-03 16:15:27 -07:00
BlackShark
7e7b2bb2d3
Improved IsOldPkhexCorePresent (#3541) 2022-06-27 22:32:03 -07:00
Kurt
fc754b346b
File scoped namespaces (#3529)
[Language Reference](https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/proposals/csharp-10.0/file-scoped-namespaces)

Updates all the files, one less level of indentation.

Some small changes were made to API surfaces, renaming `PKM pkm` -> `PKM pk`, and `LegalityAnalysis.pkm` -> `LegalityAnalysis.Entity`
2022-06-18 11:04:24 -07:00
Kurt
e4794efbfe
Split up csproj PropertyGroup for nuget metadata (#3492) 2022-05-07 17:30:42 -07:00
Kurt
88ddc5822e c#10: readonly record structs
Reduces some boilerplate constructors/equality compares
2021-12-04 18:32:35 -08:00
Kurt
2f5e2016bc
Only use the TreatWarningsAsErrors for debug build (#3237)
* Update PKHeX.Core.csproj
2021-08-04 00:13:58 -07:00
Kurt
f46bda3f75 Condense some expressions, parameter names
Enable warnings as errors, so that future pull requests can't submit nullable warning content
2021-07-31 22:38:04 -07:00
Kurt
50b15cd740 Use range/index
More in line with modernizing the codebase with latest c# syntax

improve web-qr decode speed slightly (no linq skiptake)
get money/coin mask without a temporary string (lol performance)
2021-05-14 15:30:55 -07:00
Kurt
43af6322e8 Clean up csproj's
no functional change
yay wildcards
2021-05-09 12:57:26 -07:00
Kurt
c67e01849a Extract 3ds chinese glyph remapping, only do on 3DS games
Optimize some functions within gen7zh for perf (no linq, no allocation)
2021-04-18 18:29:02 -07:00
Kurt
d0258fa2f7 Add gs/c resources 2021-04-04 22:14:17 -07:00
Kurt
0626b0c29b
Add Breeding move ordering logic, and use in legality analysis (#3183)
* Initial bred moveset validation logic

Unpeel the inheritance via recursion and permitted moves

* Volt tackle considerations

* Optimize out empty slot skips

* Add tests, fix off-by-one's

* Require all base moves if empty slot in moveset

* Add test to prove failure per Anubis' provided test

* Tweak enum labels for easier debugging

When two enums share the same underlying value, the ToString/name of the value may be either of the two (or the last defined one, in my debugging). Just give it a separate magic value.

* Fix recursion oopsie

Also check for scenario where no-base-moves but not enough moves to push base moves out

* Add Crystal tutor checks

* Add specialized gen2 verification method

Game loops through father's moves and pushes in one iteration, rather than checking by type.

* Add another case with returning base move

* Add push-out requirement for re-added base moves

* Minor tweaks

Condense tests, fix another off-by-one noticed when creating tests

* Disallow inherited parent levelup moves

Disallow volt tackle on Gen2/R/S

* Split MoveBreed into generation specific classes

Gen2 behaves slightly different from Gen3/4, which behaves slightly different from Gen5... and Gen6 behaves differently too.

Add some xmldoc as the api is starting to solidify

* Add method overload that returns the parse

Verify that the parse order is as expected

* Add reordering suggestion logic

Try sorting first, then go nuclear with rebuilding.

* Return base moves if complete fail

* Set base moves when generating eggs, only.

* Use breed logic to check for egg ordering legality

Don't bother helping for split-breed species
2021-04-04 18:30:01 -07:00
Kurt
5f8e2b13c5 Simplify headbutt tree pivot check
See the EncounterSlotDumper with the memoization logic & json tree listing.

Simplifies things a lot, and improves checking speed. Unreachable trees are now treated the same as no-trees maps.

ez 1.5KB reduction in file size :P
2021-01-22 19:20:18 -08:00
Kurt
4a3a8dd090 Add japanese blue encounter tables (unique to jp_blue)
When creating a new pk1 for the slot->pkm, get it as a pk1-japanese.
Export the gameversion when in pk1/2 format (same as VC).
2021-01-08 11:29:00 -08:00
Kurt
6d030831ab Bump PKHeX.Core to C#9 language version
Add FrameworkUtil.cs which is compiled if the build isn't net5+, needed to support init setters & records
2020-12-21 16:52:11 -08:00
Kurt
9b178fefe2 Xmldoc, minor tweaks
Move form-info logic from FormConverter to AltFormInfo; now FormConverter is entirely form=>string[]
Add a bunch of xmldoc
Make pogo no-end-date cmp agaisnt UTCnow rather than local now.
2020-11-27 11:51:02 -08:00
Kurt
37782f0ce4 Consolidate EncounterTrade1 level objects
Adds Nickname checks, thanks @ShadowMario3 for grabbing these into separate text files from Bulbapedia.

I reordered all the encounters to match Bulbapedia; each level is denoted if different if it can be sourced from RBY.
2020-11-22 16:19:03 -08:00
Kurt
ad9e9ddfa0 Relocate go encounter maintenance outside of pkhex.core
PKHeX.Core now accepts generated pkl binaries from PoGoEncounterTool (PGET).

Refer to pporg's repo. This will be treated like event data; occasionally updated.
2020-11-14 12:51:24 -08:00
Egzon
4b1a9a89da
Add support for reading and editing Underground Items (#2987)
Adds a sub-editor with localized support for editing Underground Items.
2020-09-13 14:55:50 -07:00
Kurt
6ee7a8724b
Offload EncounterSlot loading logic to reduce complexity (#2980)
* Rework gen1 slot loading

Slot templates are precomputed from ROM data and just loaded straight in, with tight coupling to the encounter area (grouped by slot types).

* Revise fuzzy met check for underleveled wild evos

Example: Level 23 poliwhirl in RBY as a level 50 poliwhirl, will assume the chain is 25-50 for poliwhirl (as poliwag evolves at 25). Instead of revising the origin chain, just ignore the evo min level in the comparison.

Previous commit fixed it for gen1.

* Rework gen2-4 slot loading

Gen4 not finished, Type Encounter data and some edge encounters not recognizing yet...

* Add feebas slots for old/good encounters

* Begin moving properties

Great news! Gen5-7 need to be de-dumbed like Gen1-4.

Then I can remove the bang (!) on the Area accessor and ensure that it's never null!

* Split off XD pokespot slot encounter table type

* Set area in constructor

* Deduplicate g3 roaming encounters

* Deduplicate xd encounter locations (rebattle)

Only difference is met location; no need to create 500 extra encounter objects. A simple contains check is ok (rarely in gen3 format).

* Make all slots have a readonly reference to their parent area

* Minor clean

* Remove "Safari" slot type flag

Can be determined via other means (generation-location), allows us to reduce the size of SlotType member to a byte

Output of slot binaries didn't preserve the Safari flag anyway.

* Update SlotType.cs

* Handle type encounters correctly

* Merge safari area into regular xy area

* Merge dexnav accessor logic

* fix some logic so that tests pass again

rearrange g5 dw init to be done outside of static constructor (initializer instead)
PIDGenerator: friend safari slots now generate with required flawless IV count

* Add cianwood tentacool gift encounter

* Remove unnecessary abstractions

Fake area just returned a slot; since Slots have a non-null reference to the area, we can just return the slot and use the API to grab a list of possible slots for the chain.

Increase restrictiveness of location/type get-set operations

* Minor tweaks, pass parameters

DexNav observed state isn't necessary to use, only need to see if it's possible to dexnav. Now that we have metadata for slots, we can.

* Remove unused legality tables
2020-08-30 10:23:22 -07:00
Regnum
9e40fa132f
Improved Pokewalker Editing (#2958)
* Added PokeWalker Courses, Watts, and Steps editing

* Use util method for getting bitflags

* Keep old cheat method

Change signature so that the default value passed is to unlock all; can pass 0 instead to lock all

* Pass reference to derived sav4-type object

Wev'e already type-tested once, capture the reference and pass it into the appropriate load/save methods.

* Add control anchoring for window resizing

Also widen the labels for localization (longer strings possibly)
2020-08-01 09:20:13 -07:00
Kurt
fe0ef71e67 Add zh flag names for emerald
Closes #2848

Co-Authored-By: hard <kamisama6866@users.noreply.github.com>
2020-06-11 09:29:01 -07:00
Kurt
dc5af9ea57 Add zh frlg event flags
Closes #2844
Closes #2843 via prior commit

Co-Authored-By: kamisama6866 <kamisama6866@users.noreply.github.com>
2020-05-28 22:06:33 -07:00
Kurt
940a9cb269 Add zh rs event flags
Closes #2843

Co-Authored-By: kamisama6866 <kamisama6866@users.noreply.github.com>
2020-05-28 14:48:44 -07:00
Kurt
f4952faa6f Add zh2 trade localization
ye it's different from the zh strings, resulting in different nick/OT

ty @Lusamine !

add another gyarados location while we're here
2020-03-21 10:48:26 -07:00
XxPhoenix1996xX
d66d761d3c
Update Spanish Translation (#2795)
* Update lang_es.txt

* Create flags_gg_es.txt

* Update PKHeX.Core.csproj
2020-03-20 11:42:58 -07:00
Yurical
a4e579c49b
Update Korean translation (#2680) 2020-02-04 07:36:40 -08:00
Kurt
9b062bc770 Remove unused legality check strings
Fix spanish translation messages not being loaded
2020-01-25 17:37:47 -08:00
Kurt
852bd2af20 Relocate gui-only text files to WinForms project
Split up the DataUtil method to load text files so that the caching
functionality can be reused
2020-01-03 15:53:48 -08:00
Matt
6f1611f360 Add Gen 4-6 Starter Event Constants (#2608) 2019-12-28 17:39:46 -08:00
Kurt
5a1bffb2ba Split wild encounters for crossover & weather
Certain Mark values (ribbon) are only obtainable if the encounter was
obtained in some weather (I really hope there's no crossover cases for
this), and non-symbol encounters can't wander to another zone.

I wonder if you can wander from one zone with one exclusive weather, to
another zone, and get an 'unobtainable' mark (with the new zone's
weather) on the crossover mon's weather. yikes lmao
2019-11-27 22:46:14 -08:00
Kurt
cefb56a749 Sword/Shield Update 2019-11-15 17:52:08 -08:00
Kurt
02420d3e93
PKHeX.Core Nullable cleanup (#2401)
* Handle some nullable cases

Refactor MysteryGift into a second abstract class (backed by a byte array, or fake data)
Make some classes have explicit constructors instead of { } initialization

* Handle bits more obviously without null

* Make SaveFile.BAK explicitly readonly again

* merge constructor methods to have readonly fields

* Inline some properties

* More nullable handling

* Rearrange box actions

define straightforward classes to not have any null properties

* Make extrabyte reference array immutable

* Move tooltip creation to designer

* Rearrange some logic to reduce nesting

* Cache generated fonts
* Split mystery gift album purpose
* Handle more tooltips
* Disallow null setters
* Don't capture RNG object, only type enum

* Unify learnset objects
Now have readonly properties which are never null
don't new() empty learnsets (>800 Learnset objects no longer created,
total of 2400 objects since we also new() a move & level array)
optimize g1/2 reader for early abort case

* Access rewrite
Initialize blocks in a separate object, and get via that object
removes a couple hundred "might be null" warnings since blocks are now readonly getters
some block references have been relocated, but interfaces should expose all that's needed
put HoF6 controls in a groupbox, and disable

* Readonly personal data
* IVs non nullable for mystery gift
* Explicitly initialize forced encounter moves
* Make shadow objects readonly & non-null
Put murkrow fix in binary data resource, instead of on startup
* Assign dex form fetch on constructor
Fixes legality parsing edge cases
also handle cxd parse for valid; exit before exception is thrown in FrameGenerator

* Remove unnecessary null checks
* Keep empty value until init
SetPouch sets the value to an actual one during load, but whatever

* Readonly team lock data
* Readonly locks
Put locked encounters at bottom (favor unlocked)

* Mail readonly data / offset
Rearrange some call flow and pass defaults
Add fake classes for SaveDataEditor mocking
Always party size, no need to check twice in stat editor
use a fake save file as initial data for savedata editor, and for
gamedata (wow i found a usage)
constrain eventwork editor to struct variable types (uint, int, etc),
thus preventing null assignment errors
2019-10-16 18:47:31 -07:00
Kurt
87f43a47d8 Bump lang version to 8
some lang upgrades
2019-10-04 20:10:50 -07:00
Kurt
ab0b8979e9
Add swsh content placeholders (#2392)
placeholder content until real data is dumped
2019-09-23 16:56:47 -07:00
Kurt
5140350ceb Bump to net standard 2 2019-05-13 22:33:24 -07:00
ReignOfComputer
9d6127dfc2 Fix C# 7.2 Build Error (#2303)
Explicitly target LangVersion 7.2.
2019-05-13 15:35:19 -07:00
Evan Dixon
1ccbddd442
Merge pull request #2276 from kwsch/nupkg-license
Add NuGet metadata
2019-04-01 19:47:55 -05:00
Kurt
61bf82e2bd Add gs event flags
https://projectpokemon.org/home/forums/topic/49717-pkhex-flag-editing/?tab=comments#comment-240804

via pret repo; looks like 2000 event flags, and 0x100 event
consts/work-vals (byte)
add more rebattle toggles
2019-03-05 23:06:05 -08:00
Dixon, Evan
8f8e8020b7 Add NuGet metadata 2019-02-07 17:39:15 -06:00
Kurt
0da3fd2aec Add resource include references for new fr xlation
#2206
2018-12-20 20:34:51 -08:00
Kurt
58080f36c9 Add WB7 and legality detection logic
Derived from WC7 with minor alterations (dynamic OT/Nickname which is
stored in the Full data). Since the 0x108 is not stored in the save
file, just keep the full data around.
2018-11-21 12:24:41 -08:00
Kurt
43a9d4eb99 Add gg evolution tree
turns out it was totally needed; am glad I didn't do the silly stuff of
past gen evo tables (gen6/7 is just raw evo data)
2018-11-15 17:34:54 -08:00
Kurt
1827b32d8f Add init function for wc7 gg files
pretty sure these will pop up soon as the pball plus doesn't send the
mew itself
2018-11-11 13:09:04 -08:00
Kurt
70a6cd9421 Remove untranslatable content
sav6 recently added trainer appearance editor, prior commits removed pt
translation (only official ingame translations)
2018-08-13 19:24:49 -07:00