Commit graph

14 commits

Author SHA1 Message Date
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
147b676d8c Misc api accessibility tweaks
disable GeneratePKMs from throwing an exception (it's a testing flag,
not to leak out if someone wants a debug dll I guess)
expose FixedGenderFromBiGender
expose ribbon interfaces
2019-01-26 14:48:32 -08: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
3fd21db51e Style & function extracting 2018-07-29 16:39:15 -07:00
Kurt
c8563a3737 Respacening
Style guidelines, handle a bunch of files
no functional change
2018-07-26 19:34:27 -07:00
Kurt
d19705f5a9 Fix incorrectly ordered name<->bitindex
names have sinnoh second not first

https://projectpokemon.org/home/forums/topic/46377-invalid-invalid-ribbons-record/
2018-07-26 17:12:27 -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
6abd2a22a4 Add oras contest master ribbon affection check
Each contest victory requires a contest participation; each
participation gives 20 OT affection (not current trainer!)
Thanks @WyrXIII , @JusLi, @Cresceda !
2018-03-26 16:42:18 -07:00
Kurt
c5655166bf Add shared pk3/xk3/ck3 class
standard generation 3 pkm content & interactions
generic inter-converter (more efficient than reflection)

update conversion methods; specific format conversion is now in the
object's src file now.

may be worth doing for gen4 pk4<->bk4
2018-02-03 12:42:06 -08:00
Kurt
6a054fa7f5 Fix r2 ribbon checks
Closes #1276
if there's any stragglers just report back in that thread
2017-06-26 22:18:42 -07:00
Kurt
9b76d9b214 Next round of ribbon checking
Returned messages are slightly misleading since missing/invalid are
mixed together with the static method.

#1250
~322 lines to check ribbons, on top of the interface abstraction... so
much required... kinda understandable as there's over 100 ribbons to
check.
2017-06-20 21:57:03 -07:00
Kurt
6921a2ebee Initial ribbon refactor
remove legality check's use of reflection which checked individual
properties; add interfaces to interact with the ribbons of each PKM
type. With this, every ribbon attribute is accessible via its
corresponding interface (cast)

will have to add checks for individual interfaces as per #1250

I didn't feel like adding much documentation, is pretty straightforward.
Cast a pkm object to the desired ribbon set; if not null, can access
ribbons regardless of pkm format.
2017-06-19 21:43:44 -07:00