Commit graph

48 commits

Author SHA1 Message Date
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
e9406599e0 Remove more unnecessary null checks 2020-04-16 13:11:27 -07:00
Kurt
3100471299 Strip out some unnecessary logic
notnull => no need to check for null manually
2020-04-16 12:58:48 -07:00
Kurt
8312c52cc1 Make Move[] readonly list
contract: don't modify the template movesets
mystery gift now exposes IRelearn, remove unnecessary type checks
2020-01-18 16:46:38 -08:00
Kurt
11978dab4f Make pgt ranger manaphy IsEgg true 2020-01-12 23:00:32 -08:00
Kurt
e21d108fb2 Split PokeCrypto from PKX
All logic in PokeCrypto is separate from the rest of the PKHeX.Core
library; makes it easy to just rip this portion out and reuse in other
projects without needing the entirety of PKHeX.Core logic

optimize out the CheckEncrypted to the actual path, separate methods.
Only usages of this method were with hardcoded Format values, so no
impact
2020-01-04 14:48:39 -08:00
Kurt
bfd9bf6b53 Simplify formchange calls
Don't use the dex chain for certain checks, it's unnecessary.
2019-12-28 19:00:01 -08:00
Kurt
827a7649c1 Export PCD/PGT as encrypted format
add Write method for writing the data outside the program; only use Data
if you know what you're doing!
2019-12-24 23:24:28 -08:00
Kurt
e8bdc34a18 Tweak gift generator
Yield ranger manaphy gift as possible (encmoveset generator)
Move ranger manaphy equals check to PGT
2019-11-28 10:42:24 -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
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
c5ebbbbe15 Minor clean
Magic number -> const usage
default(T) -> default (c#7.x feature)
remove some unused stuff
fix indentation in some spots
2019-09-10 22:07:50 -07:00
Kurt
ebc7c6ae29 Remove PKX.LCRNG method
Duplicate with RNG.LCRNG
reuse cryptarray for gen5 mysterygift r/w
2019-03-16 16:25:25 -07:00
Kurt
e79f46673c Refactoring iencounterable->pkm
SetPINGA{S}(pk, criteria) -> pid,iv, nature, gender, ability (stats
future?)
memes aside, this is where criteria data is forced

Split N encounterstatic (has fixed PID and special flag) from
EncounterStaticPID
2019-02-09 11:37:20 -08:00
Kurt
78ff441e8b Update iencounterable api with new criteria arg
rearrange some logic for clearer function (extract some methods)
2018-12-29 22:24:34 -08:00
Kurt
2d75e93ef0 Move encounter matching logic to iencounterable
generator logic is now clean
2018-12-27 01:00:08 -08:00
Kurt
cfbdb7c26c Add parameter-less constructors
Removes null check for hot path where data is actually provided
2018-11-21 14:15:48 -08:00
Kurt
d3ec969187 Style updates
split pcd/pgt
add more xmldoc
2018-08-09 21:53:39 -07:00
Kurt
c8563a3737 Respacening
Style guidelines, handle a bunch of files
no functional change
2018-07-26 19:34:27 -07:00
Kurt
5fbf132615 Add handling for pgt ranger manaphy
skip out on load if pgt
extract pgt pid gen method
set gender & PID if rangeregg since PID == 0 not 1.
Closes #2075
yay 5k!
2018-07-25 07:34:48 -07:00
Kurt
88b5277062 Misc mg gen fixes
Fixed gender PCD with dynamic PID needs to check gender validity (some
korean card had it)
Fixed wc3 generated force-hatching to unflag fateful for non-frlg and to
hatch on the designated game just in case

stuck on a PGF issue where ability doesn't match PID, need to revisit
that PID creation...
Card #: 0002 - がくえんさい×ポケモンプレゼント
2018-06-15 22:00:51 -07:00
Kurt
99005d8fc0 Refactoring
more discards & simplifications
2018-05-12 12:28:48 -07:00
Kurt
5a3c8f4147 Remove trailing whitespace 2018-05-12 08:41:29 -07:00
Kurt
a0eb658ef2 Extract minimum trainer information requirements
If one wanted to extend ConvertToPKM to other IEncounterables, this
would be the provided obj containing the receiver's info

allows pkm gen without a savefile, which is nice?
2018-03-28 15:55:19 -07:00
Kurt
93ca091eb8 Fix gen4 event location string name output
legalityanalysis spat out the unshifted value or none at all (bank 3000
was not returned)
2018-03-26 23:22:11 -07:00
Kurt
24982fe8c5 Misc simplifications 2018-02-28 21:05:50 -08:00
Kurt
c825d5919c Fix wc4->pgt crypt
array isn't encrypted in place (didn't use return value)
Closes #1835
2018-02-15 19:07:41 -08:00
Kurt
f1cd1d8b50 Fix pgt->pk4 obj usage
clone the data, don't reuse & tamper with pgt data...
thanks @ReignOfComputer !
2018-02-11 17:28:23 -08:00
Evan Dixon
5a4ddd685c Update Project Pokemon URLs in comment 2018-01-08 13:15:19 -06:00
Kurt
0f21fc2217 add location interface for verbose analysis output
indicates met location for transferred mons
most gen1/2 encounters won't show values due to the location not being
stored respective to the string tables (anyone wanna do a location remap
after initial load?)
2018-01-02 12:00:41 -08:00
Kurt
3445b46526 Remove unnecessary array cloning
new objects would always clone the input array; only clone on object
cloning (keep the original array reference on initial creation from
bytes)
2017-12-26 21:38:19 -08:00
Kurt
f1cabdfa25 Handle setting decrypted pgt pkm gift data 2017-12-11 10:13:08 -08:00
Kurt
6394dac19f Rework mysterygift pkm sprite generation
don't bother converting to pkm then generating the sprite off that; use
the overload with int/bool

removes sav/pkm dependency for generating gift descriptions, and
standardizes the names a little. maybe a PKMBase interface would be
useful...
2017-11-18 11:34:23 -08:00
Kurt
4a6ea19a31 Cleanup 2017-11-06 17:12:59 -08:00
Kamron Batman
83e06b4436 Adds WC4 support. 2017-11-06 16:26:34 -08:00
Kurt
a46e56c917 Add xmldoc for mystery gift class names
refactor pattern checking to simpler representation, add null abort when
extension is not provided.
2017-10-23 15:45:58 -07:00
Kurt
515a694afa Add LanguageID enum
no functional change, just less-magic-numbers for easier to understand
src
2017-10-22 21:01:08 -07:00
Kurt
a93a3897b3 Cache pgt/pk4 when read from gift file
speeds up repeat accessing (legality checks and mgdb opening)
2017-09-29 22:40:35 -07:00
Kurt
47dcb56090 Misc fixes
static-wild encounter g4 collision (abra gift), closes #1390
off by one pokepuff strings
unshuffle bk4 ribbons
pgt bad sanity events now auto-sanitized
2017-08-10 20:51:27 -07:00
Kurt
80196f75ef Refactoring
split Core.PKX into smaller classes, only StringConverter is exposed for
outside namespaces
2017-07-31 23:03:51 -07:00
Kurt
ee29b4a31f Reorder mysterygift 5+ egg generating logic
Closes #1331 where IsEgg was checked before it was set
handle legality cases (set nickname & flag)
2017-07-13 21:05:20 -07:00
Kurt
f15333ea6c Update speciesname fetch usages to be gen sensitive 2017-06-20 22:53:39 -07:00
Kurt
a16aa827e4 Add mysterygift version receivability check for PCD
Closes #1242
2017-06-17 23:09:00 -07:00
Kurt
3f38b123a3 Refactoring
mostly renaming things, includes a little bit of added sugar and
splitting methods to simplify the codebase.

all methods are now PascalCase
2017-06-17 18:37:19 -07:00
Kurt
9e3ee6eacb Update gen4 gift PIDIV checks
fix method1 PIDIV creation, check for antishiny manaphy gift
2017-06-15 18:34:03 -07:00
Kurt
f674d45854 Misc changes
Properly handle egg hatch counters for generated mystery gifts, as well
as HT friendship for gen6+
fetch form specific (friendship doesn't change but abilities fetch
species specific data later, so just fetch once up front). Do not depend
on save file as SAV7 importing PGF may have different abilities
allocated
Pad buttons for folder popup
fix double Japanese/International error message for importing jpk1<->pk1
2017-05-16 20:34:24 -07:00
Kurt
a70a4d5e3f Switch to c# 7 get/set expressions
Add gen5 battle box locked flags
no functional change otherwise, just shorter
2017-05-12 20:32:43 -07:00
Evan Dixon
52c4fbbe97 Converted PKHeX.Core to .Net Standard
Refactored and rearranged things as needed to allow the change
2017-05-11 23:34:18 -05:00
Renamed from PKHeX/MysteryGifts/PGT.cs (Browse further)