Commit graph

207 commits

Author SHA1 Message Date
Kurt
d225f3391a Split up DataUtil to separate files
ya i know there's already a localizeutil class, whatever
2020-12-21 19:13:18 -08:00
Kurt
98be0f6739 Target type'd new 2020-12-21 17:17:56 -08:00
Kurt
62018cce1a Unify concepts with different names
AltForm & Form & Forme => Form
GenNumber & Generation => Generation

Extract out SpeciesForm interface, and re-add IGeneration

For those using PKHeX as a dependency, this should be a pretty straightforward manual replacement... GenNumber and AltForm should be quick find-replace`s.
2020-12-10 20:42:30 -08:00
Kurt
ce17fd4050 Minor tweaks
Enc static 4 should check met location, since locations are flexible for roamers
Simplify expressions
Disallow 0 moves in "needed moves" list.
2020-11-19 15:34:06 -08:00
Kurt
df5ebd1f54 Minor clean
Resolve some messages
2020-11-11 21:01:41 -08:00
Kurt
7cb6ee0060 Move some static arrays closer to where they're used
Split EvolutionRestrictions to its own class
Can probably refine things further to clamp down access to these arrays
2020-11-02 13:11:51 -08:00
Kurt
5fa4ddd4a2 Update internal data sources for Crown Tundra
Co-Authored-By: Matt <17801814+sora10pls@users.noreply.github.com>
Co-Authored-By: ReignOfComputer <2667537+ReignOfComputer@users.noreply.github.com>
2020-10-24 11:11:05 -07:00
Kurt
fe433f3859 Update Legality Binaries for Crown Tundra
Co-Authored-By: SciresM <8676005+SciresM@users.noreply.github.com>
2020-10-24 10:54:19 -07:00
Kurt
fe7a4df17e Clean out some gb era version flagging 2020-10-06 20:05:38 -07:00
Kurt
af357587f9 Add Pocket Monsters Stadium support
https://projectpokemon.org/home/forums/topic/38108-gen-1-pokemon-stadium-save-file-structure/

untested, need to find a save file somewhere??
2020-09-30 12:45:41 -07: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
9191f023a3 Minor clean
Nullability annotations and some logic simplification
2020-09-06 11:24:54 -07:00
Kurt
cf9e5ec37f Minor refactoring
Change Ability array to IReadOnlyList, add method to check ability index in personal data
Suppress some message warnings
Change EvolutionChain short-circuit for VC to jump from gen6 directly down to gen2. There aren't any notradeback 1 situations, so a notradeback1 will always start with g=1, so no need for the other if-continue.

Simplify pk5 conversion
2020-09-06 10:53:13 -07:00
Kurt
c2ec4d55e4 Minor clean
Add some xmldoc, remove some empty lines, move some small logic pieces to a better spot
2020-09-03 14:28:51 -07:00
Kurt
75da70069c Remove access to modified captured variable
Get the variable rather than indexing into the array each time

Simplify some expressions in sav7 for readability
Make SAV_EventFlags use comboitem explicitly by type rather than an anonymous type with same member names
2020-08-30 15:48:11 -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
Kurt
5a78c5799c Fix text formatting for G5 Victory road met location string
Noticed on a separate fork ; should have a space before the (
2020-08-26 19:50:48 -07:00
Kurt
12d9397c8c Split GO from "GG" gameversion
Make Gen7b as the combined ver for that expression
2020-08-06 18:24:20 -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
e4092e64df Relocate gen3 ereader berry logic 2020-07-18 22:51:55 -05:00
Kurt
36dd5ece21 Initial Isle of Armor support
Co-Authored-By: sciresm <sciresm@users.noreply.github.com>
Co-Authored-By: Matt <sora10pls@users.noreply.github.com>
Co-Authored-By: Archit Date <architdate@gmail.com>
2020-06-19 18:51:15 -05:00
Kurt
2cdb5d26db Clean up some method signatures
rename things to be a little more consistent in naming conventions
2020-06-16 21:46:22 -05:00
Kurt
8a0295e4e9 Minor clean
GetLanguageIndex never returns <0
2020-04-23 20:54:20 -07:00
Kurt
b8814d2448 Split GG into LGPE (GP/GE), GG (LGPE||GO)
Update usages
2020-04-16 12:48:18 -07:00
Kurt
270d984130 Minor clean
Remove unnecessary null checks
Mark some methods with nullable type
2020-04-04 19:30:50 -07:00
Kurt
98cd28d5d3
Swap string differentiation for HOME gifts
30018 is used by the gift; original fake WC's that EventsGallery created used the 40086 (now fixed on their repo)
2180608ed2
2020-03-16 12:05:33 -07:00
Kurt
3aaf318035 Update event database, handle HOME gifts horribly 2020-03-14 14:22:45 -07:00
Kurt
ffa70e7626 Move files
no functional change, just putting stuff in a more appropriate folder
2020-01-25 17:22:20 -08:00
Kurt
c730dfa1ba Remove empty ushort[1], improve item combo fetch
held item list now allocates less (concat arrays instead of ienumerables)
item list already prunes out of range items, so simplify data source fetch
simplify item list prune (return as list, so we can call RemoveAll instead of Where.ToList)
2020-01-24 23:29:45 -08:00
Kurt
843330a375 Remove unnecessary null checks
this is a null free project /s
dont provide null, else u deserve to get an exception
2020-01-18 16:57:25 -08:00
Kurt
0002f1d1ad Grab CXD location if encounter is COLO or XD 2019-12-31 12:15:48 -08:00
Kurt
5e1fd36b96 Account for memory feeling off-by-one bug
If the feeling is zero the game's string formatter will treat it as
null, and will newline before the period.

Gen6 (if I recall correctly) had "it was happy" as index 0
Gen8 (new) has "it was happy" as index 1, with 0 being invalid-bad.

Slice the array differently for gen8 to include the empty line as index
0.

Closes #2549 , ty @crzyc && @architdate for testing index 0 :)
2019-12-08 18:56:37 -08:00
Kurt
0dcd9b744a Include swsh held items to valid items list
Closes #2518
2019-11-24 22:34:51 -08:00
Kurt
256de0380f Swap order of vc1/vc2 in version dropdown
Closes #2464
2019-11-19 08:42:31 -08:00
Kurt
cefb56a749 Sword/Shield Update 2019-11-15 17:52:08 -08:00
Kurt
ba593800d8 Keep text/value as get properties
Needed for binding in winforms, oops
2019-10-27 12:47:09 -07:00
Kurt
9401b7a790 More readonly struct tweaks
help dat compiler
minor clean elsewhere
2019-10-26 23:18:25 -07:00
Kurt
e3efa65160 Cleanup
handle messages for dirty cleaning :)
2019-10-26 12:33:58 -07: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
4baf745af8 Use some c#8 sugar
static local functions
switch expressions
using usings :)

nullable next?
2019-10-07 18:40:09 -07:00
Kurt
87f43a47d8 Bump lang version to 8
some lang upgrades
2019-10-04 20:10:50 -07:00
Kurt
8d8adde2b1 sealed
sealedsealedsealedsealedsealedsealedsealedsealedsealedsealedsealedsealedsealedsealedsealedsealedsealedsealedsealedsealedsealedsealedsealedsealedsealedsealedsealedsealed
2019-10-03 19:09:02 -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
b41f2a3062 Extract logic from PKX
Extract Species Name logic to SpeciesName
Extract Language logic to Language
Remove FormConverter wrapper for string[] fetch
Rearrange some logic to more appropriate locations, update access
modifiers / types
Move some pkm array methods to arrayutil, make generic

PKX.GetVCLanguage was a dupe of _K12.GuessedLanguage() so just expose
the method

PKX is now back to pkm data manip only
2019-09-18 19:58:23 -07:00
Kurt
0fe42a1db3 Minor tweaks
no functional change
2019-09-14 11:48:07 -07:00
Kurt
7424cf6fb0 Remove GSC/C differentiation in PK2
Allows for no adjusting the game group
2019-07-28 13:26:39 -07:00
Kurt
3f4f02cee1 Add string quality tests
Expect no duplicates in met locations, items, or moves. These are arrays
with common duplicate strings (poor localizations).

Should help futureproof / help implementation for this type of err:

https://projectpokemon.org/home/forums/topic/53818-these-events-are-flagged/
2019-07-08 22:05:59 -07:00
Kurt
4eb3f8529b Filter Species & Moves for legal combobox display
LGPE will missingno your pokemon if it's not a Kanto/M&M, or one of its
moves is not obtainable. For the user's benefit, filter down these
sources to the non-baddata list.

Item filtering and ball filtering might be something to think about for
the future, but not much benefit vs effort.
2019-06-29 08:19:01 -07:00
Kurt
cbd039b18c Extract datasource filtered lists to object
GameInfo has been the storage for the current Game Language environment
When using GameInfo, only one environment is tracked at a time, which is
initialized by the PKM editor (items, moves). Rework things to allow
multiple filtered sources to exist, and keep the filtering logic in
PKHeX.Core for reuse in other programs... ;)
2019-06-22 10:50:32 -07:00
Kurt
de774ed131 readonly ComboItem
create once, never modified after
2019-06-01 19:12:41 -07:00
Kurt
a9152d36a4 Minor tweaks
make some enums non-int (in favor of byte etc)
return current nickname if desired
clamp nature top bound too
2019-05-29 22:40:07 -07:00
Kurt
55189a6967 Extract most common location numbers to class 2019-05-10 20:46:49 -07:00
Kurt
520c9da5c9 Update string loading
Remove usage of linq for sorting, use array.sort for in-place sorting.
Wasteful creating temp sorted buffers then enumerating them to dump into
the list.
2019-04-29 21:55:43 -07:00
Kurt
1a343c3b21 Add more xmldoc 2019-04-09 20:57:44 -07:00
Kurt
82a40cb965 Misc updates
add comboitem list to string[]
add regions list as cached comboitem list
lock resource cache on fetch
extract alola time list generating
2019-03-18 21:34:21 -07:00
Kurt
5765ce8229 Extract gc version IDs to separate logic 2019-03-16 16:48:38 -07:00
Kurt
e8ade4dd63 Add swsh placeholders
no point adding for legality until much closer to game release
2019-02-27 06:37:11 -08:00
Kurt
202f911d45 Tidy up comboitem fetch naming 2019-02-15 11:47:35 -08:00
Kurt
d1f6a5a3ff Misc clean
no functional change
2019-02-15 11:46:46 -08:00
Kurt
858760fa28 Misc updates
relocate program language enum
test that test case is proper
move getcompatible & gettemplate to core
remove catch rate changing for pk1 (catchrate editor now used instead)
2019-02-15 00:50:23 -08:00
Kurt
304203262d Add species & ability enumerations
remove hardcoded 810 in unit test, add ability test too
2019-02-10 21:28:32 -08:00
Kurt
383d4b7700 "" -> string.Empty
be explicit that the string is empty rather than possibly missing
disallow encrypted export for BK4 (they're not encrypted), removes type
check
simplify replaceall in showdownset (don't call ReplaceAll 4x, just get
valid chars and rebuild)
simplify get ribbon sprite name (precompute ToLower and appended values
2019-02-07 21:40:20 -08:00
Kurt
59b41937e1 Misc variable name changes
readability++
2019-02-06 23:28:02 -08:00
Kurt
29253ed636 More cleaning 2019-02-03 20:28:03 -08:00
Kurt
aa022fad40 Misc refactoring
remove some null usages, return an empty array instead
reduce as arg
2019-02-01 23:08:03 -08:00
Kurt
8652677a79 Misc tweaks
showdownset: contains char instead of string
gameinfo: static readonly array instead of redefining new on update
legality: order of operation / value reuse / simplification / comments
pkx: compare char instead of single character string
header/footer: move assignment into method as an out instead of ref
2019-01-20 21:55:28 -08:00
Kurt
d62a69a6a7 Misc fixes
Provide gen1/2 gb only version origin fetch for personal/moves ty
shadowmario (i assume this fixes things)
make listbox use ingame font for special characters

2f6e30bb3c (r31924945)
ty @pmarkive
2019-01-13 18:12:31 -08:00
Kurt
174eb81986 Fix xmldoc comment 2019-01-05 15:36:44 -08:00
Kurt
c2422d6927 Misc updates
possibly gonna update the iencounterable api for criteria
check/enforcement, rather than just generating random encounter data.
2018-12-29 22:19:44 -08:00
Kurt
75d2b8d0bc Split out location bank fetch
Getting a little congested in one method
2018-12-22 14:45:47 -08:00
Kurt
f7cf96be65 Add version name fetch
only for pkm game IDs that have already been localized; not game
groupings.
use version name long description if hide-savefile details is enabled.
2018-12-22 13:16:16 -08:00
Kurt
24e5f70144 Differentiate colo card key
Closes #2212
2018-12-20 15:23:57 -08:00
Kurt
2c1717a409 Misc updates
extract programlanguage to enum
fix parse fail for settings' version; old syntax fails to parse
delete unused file from recent pull
2018-12-10 20:48:21 -08:00
Kurt
71f1e6238a Misc fixes 2018-11-23 10:15:49 -08:00
Kurt
f358c0e4cf Handle all deviating met location string versions 2018-11-22 10:11:51 -08:00
Kurt
43ffde0918 Differentiate past gen moves with same names
Not sure if there'll be ones for other languages, hopefully not.

dupe checker:

var langs = new string[] {"en", "ja", "ko", "es", "it", "de", "fr",
"zh"};
foreach (var l in langs)
{
var names = new GameStrings(l).itemlist;
var dupe = names
.Select((z, i) => new {Index = i, Value = z})
.GroupBy(z => z.Value)
.Where(z => z.Key != "???")
.Where(z => z.Key != "???")
.Where(z => z.Key != "(?)")
.Where(z => z.Count() >= 2)
.ToArray();
if (dupe.Length == 0)
continue;

l.Dump();
dupe.Dump();
}
2018-11-16 15:15:42 -08:00
Kurt
95c5ce08d5 Fix movepool suggestion for go transfers
needed dict references
2018-11-15 17:37:25 -08:00
Kurt
adb6b345be Treat GameVersion.GO like other GG vers 2018-11-14 17:40:11 -08:00
Kurt
6495dc41af Add move/enc/loc references 2018-11-11 22:49:17 -08:00
Kurt
98ebf4c5cb Add sort pointer repointing
LGPE uses a list of pkm for boxes, and has pointers indicating where
each party member is at
need some logic for handling the sorting. Had suspected this a while
back so this pre-work came in handy (untested tho)

make eventflags offset ptr virtual, I might end up doing things
differently for event flags
2018-11-10 21:04:24 -08:00
Kurt
fe989d48fe Misc prep updates
Update comments / xmldoc
Add a savefile storage compressor (ie array[] with empty interstitials
-> list); return true if the compression moved anything (repopulate
views), and the count of occupied slots in the list.
Add saveblock base class; I haven't really liked how SAV6/7 do all the
logic; I'll still expose properties that will then point to a saveblock.
Cuts down clutter.
Add template Dex manipulator, with gen6/7 implementations
Speculate sequential gp/ge gameversion IDs
2018-11-01 15:38:09 -07:00
Kurt
b7acb7fa1d Add memory rarity table 2018-10-12 17:45:52 -07:00
Kurt
9ded3333d0 Correctly identify Basement Key
welcome back, "Red Scale (HG/SS) (OR/AS)"
thanks @sora10pls for finding this
2018-09-12 21:27:25 -07:00
Kurt
53216333e6 Misc updates
extract final pkm manipulation logic from pkm editor
add xmldoc to boxmanipulator, add utility class for enum->manip fetching
fix xmldoc referencing removed enum member
relocate boxmanip overview logic to utility class
move SAVPaths file pointer to Main for reuse #2109 , will add to
autodetect in a later commit
open/save dialog with extra extensions: ignore ones already present
2018-09-03 10:30:35 -07:00
Kurt
493bef75eb Misc updates
condense repeated logic
extract properties
extract reusable methods
2018-09-02 18:02:25 -07:00
Kurt
cc20bb38d7 misc updates
use arrays instead of list when capacity known
use enums for const decoration
remove unnecessary aliases
2018-09-01 19:55:08 -07:00
Kurt
4dc04cb4b9 Add pelago status value check + etc
0, [9,19] are set (didn't see 15), but there's also a switch case which
references all values 0-19.

these values are used by a 80 sbyte array (4*20) in the Resort.cro

remove usages of "goto case"
2018-08-27 20:44:26 -07:00
Kurt
4656909d98 Misc reorg
use shared class for pk1/2 setnotnicknamed
fix extendedeurope values (copypaste from extendedAmericas)
move ball out of verifiers, move nature/movetype with ball
2018-08-26 16:29:52 -07:00
Kurt
9dae7dad67 Misc updates
move encountertype datasource providing to core
fix rerolling EC not updating characteristic
remove some repeat logic calls
relocate geolocation name fetch to separate class, add tests to ensure
functionality, add languageID->country/region fetch method
2018-08-25 17:04:01 -07:00
Kurt
29f73993b1 Misc reorg
simplify gameinfo comments/return
move item1->item2 conversion to itemconverter

just general upkeep
2018-08-20 22:09:35 -07:00
Kurt
1486b7f14a Misc style & minor tweaks
Remove move combobox flicker hack (no longer necessary)
Add more Array.Empty usages
cache mysterygift sizes
seal some classes

no functionality changes
2018-08-02 20:11:42 -07:00
Kurt
f4bfdb8311 Remove unnecessary empty array allocations
yay net 4.6
read more: http://justinvp.com/2015/07/20/array-empty/
2018-08-01 18:30:51 -07:00
Kurt
d916be1020 Style updates 2018-07-29 13:27:48 -07:00
Kurt
0c5c9bc33c Misc clean / xmldoc updates
remove unused label in QR (use window Font)
escape & -> &amp; for xmldoc proper style
2018-07-21 19:20:11 -07:00
Kurt
cc509de83c Add lgpe properties 2018-07-14 21:55:45 -07:00
Kurt
6b7ba49cba Remove unnecessary logic
gamestrings: call but not value used
text.cs: use gamestrings method for auto-filtered, now removes korean in
Gen3 context
2018-07-14 16:53:14 -07:00
Kurt
5d20c79568 Add showdownset localization for slot previews
Localization only for game strings (not Ability/Nature/Stat/etc labels)
feels kinda goofy but it works
2018-07-13 19:13:25 -07:00
Kurt
04765ef411 Add more xmldoc
Covers all gameversion enum members (whew)
2018-07-12 16:55:24 -07:00
Kurt
d20706dd70 Update xmldoc
le lenny goes here
2018-07-11 19:19:19 -07:00
Kurt
e588565657 Refactoring
reduce pk3/ck3/xk3 logic, share AbilityBit property within _K3, and when
loading, type check (favored over hardcoding individual load cases)
pull some non-gui code from PKMEditor to core/etc for general data
fetching
2018-07-06 17:37:07 -07:00