Commit graph

91 commits

Author SHA1 Message Date
Kurt
7c380a29c3 Make sort skip delegate more general 2019-04-29 17:20:16 -07:00
Kurt
a481757b45 Relocate CheckEncrypted to PKX
PKX references within the method; no dependence on anything in
PKMConverter
2019-04-16 22:51:01 -07:00
Kurt
5a53c2490a Simplify expression, emit inner error messages
existing logic had been overwriting the inner error messages with the
generic fail message

Remove backwards conversion precondition check; the ConvertPKM method
has no branches that allow conversion so it'll naturally fail -- end
result is the same with less upfront logic.
2019-04-16 22:38:50 -07:00
Matt
7e553155e1 Fix PKM conversion prompt order (#2285) 2019-04-16 10:54:29 -07:00
Kurt
0fdd9d98e6 Fix xmldoc typo 2019-04-14 09:04:40 -07:00
Kurt
f4740bbe52 Capture reused variables 2019-04-09 20:58:19 -07:00
Kurt
c7a610b02b Fix typo in method names
Transferrable->Transferable
2019-03-28 21:44:06 -07:00
Kurt
bc5ed2d218 Misc reductions
Removes empty trashbyte array allocation (less objects)
Change int[] to byte[] (less filesize/mem) (-256*6)
Change int[] to ushort[], precompute reverse table in saved space
removes dictionary lookup for array index fetch (faster, less memory, no
temp obj allocations!)

could make the ushort[] arrays into byte[] by changing them to be value
shifts? Not worth saving filesize for cpu.
2019-03-22 18:42:03 -07:00
Kurt
b1ead9e630 Split StringConverter into smaller pieces
reduces loading time (don't have to allocate conversion arrays when
launching a gen7 game), and separates things to easier to manage
locations

reworks gen3 string encode/decode, no longer does 3->4->5 and 5->4->3;
instead goes straight to the end result without an intermediary format.

String sanitization should probably be broken up rather than reused, oh
well.
2019-03-20 21:50:44 -07:00
Kurt
9f7f9f9e75 Use glyph dictionary instead of creating 19 strings
muh optimization
2019-03-16 20:15:12 -07:00
Kurt
99baca5f5e Use min parameter count
PK2 doesn't like getting passed null for the byte[] parameter (rightly
so); don't depend on the src code order having the first constructor
being the one with the least arguments

fix it in pk1/2 so that the first constructor has the least args, anyway
2019-03-16 20:04:44 -07:00
Kurt
8a08d32dff Simplify pkm constructors
remove Identifier param. 99% of the time, identifier is not provided,
resulting in a useless call

end result:
provide 'create new' and 'create from' constructors
2019-03-16 18:41:56 -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
fc10fd3d60 Simplify transfer xor, extract glyph conversion 2019-03-16 16:19:00 -07:00
Kurt
9ca4ef1e09 Move pkx hidden power logic to HiddenPower.cs 2019-03-16 12:07:22 -07:00
Kurt
174f9758a1
Fix gen1 hm index check
Closes #2266
2019-02-28 10:01:28 -08:00
Kurt
30e36579be Misc updates
add more xmldoc
revise some comments for clarity
redo a little bit of logic for perf
rename some methods for better description
2019-02-24 13:57:10 -08:00
Kurt
17f954b4e8 Xmldoc
Reorder to match parameter order
add more xmldoc
2019-02-23 14:57:35 -08:00
Kurt
a339cc9289 Extract pouch manipulation logic
add overloads for API syntactic sugar
make ItemConverter internal again
2019-02-22 22:48:34 -08:00
Kurt
05ba7c519c Misc simplifications
removed duplicate sorting GUI logic
extract grid fetch method
2019-02-21 23:17:50 -08:00
Kurt
c9e894a46d Misc reductions
hide setters for LegalInfo outside assembly (shouldn't overwrite the
stored values)
update GenNumber to Gen* if appropriate; GenNumber checks for first Gen*
to match, is a little more explicit and quicker than calling twice when
checking a range
2019-02-21 20:41:04 -08:00
Kurt
d1f6a5a3ff Misc clean
no functional change
2019-02-15 11:46:46 -08:00
Kurt
c67b774e1e use enum to decorate rather than comments 2019-02-14 18:12:25 -08:00
Kurt
684191772f Misc refactoring (showdownset null)
Set default values to prevent any properties from being null
extract ClearNickname logic for hot path & reusable method
extract item conversion and move to appropriate logic class
2019-02-11 21:49:05 -08:00
Kurt
a39f917f84 Simplify expression
ternary with a null check and long method signature is pretty ugly
2019-02-09 23:22:22 -08:00
Kurt
54ba9a0312 Update file->open for pb7 filtering
add pb7 to pkm extension list, ignore it in gen7 (sm/usum), update gg
filtering (allow pb7, not bk7)
add comments indicating format source game
2019-02-09 20:33:37 -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
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
6bd0e87ea3 Fix copyto discarding elements
don't continue; instead seek forward
#2235 part 1, need surgery for part 2 (starter/locked prevents writing
data to the slot, but the slot can still be swapped)
2019-01-08 16:45:16 -08:00
Kurt
0c9b760470 Move GetIV to pkm, misc simplifications
remove linq for characteristic calc (get max IV) and others
remove some reliance on new[] for iv/ev
pk5 replace bitmagic with property get->set copy for cleanliness
2019-01-05 10:51:41 -08:00
Kurt
2d774ac7cc Allow dynamic default savefile type load
Make extrabytes a pkm property (don't mutate array pls)
reconfigure startup loading to only initialize after initial load of sav
& pkm (using blanks if not provided)
2018-12-19 22:10:32 -08:00
Kurt
ea07b9636d Speed up pkm data present check for pk3 format
see
6dbeb24b6f

ensure bad egg flag isn't set, and the species flag is set.
2018-12-15 19:37:19 -08:00
Kurt
efb9b7eba2 Misc cleanup
removes clickonce logic/reference
2018-12-10 20:32:08 -08:00
Kurt
cb8585f423 Minor optimization
2d array -> 1d
skip copy by cloning instead
eliminate %24 (number is 0-31) by duplicating 0-7 as 24-31

dropping a modulo, >1 bounds check, and a half loop unroll should be
less cpu cycles :)
2018-12-03 23:12:54 -08:00
Kurt
cc59c3cbe8 Remove variable naming hiding
new property named Stats
update sav7b/pb7 to delete unused handling trainer parameters too
2018-12-03 20:59:48 -08:00
Kurt
76a2e4f527 Add AltForm parameter to exp/level fetch
Starter Pikachu & Eevee have different growth rates than their base
forms (seriously WHY?)

remove old api surface in PKX as a breaking change as adding the
parameter is necessary.
2018-11-26 16:55:16 -08:00
Kurt
f358c0e4cf Handle all deviating met location string versions 2018-11-22 10:11:51 -08:00
Kurt
ba1a7c2bcf Fix broken tests
rework getblank for version specific
2018-11-19 16:14:49 -08:00
Kurt
6a0a6aa82a Add methods for 7b quirks
nidoran m/f when sanitized with the old way show the gender symbols as
'?'
2018-11-14 22:51:53 -08:00
Kurt
2fb698805d Use latest personal table as master 2018-11-13 19:20:37 -08:00
Kurt
181e75818c Use agreed upon lgpe starter forme name
Thanks @Marty-D !
2018-11-13 19:20:21 -08:00
Kurt
28fec9882b Add pkm variant for beluga 2018-11-13 19:10:31 -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
8f9cc6cd7e Fix xmldoc ampersands 2018-10-31 13:52:09 -07:00
Kurt
39f98a4a94 Misc qol updates
Check max case for level first, then iterate upwards (eliminates inner
if)
change wc* nature to sbyte (update comparisons, 0xFF too magic-y)
use Rand.Next(x) instead of (0, x)
2018-10-27 21:59:31 -07:00
Kurt
90f1d0cb09 Misc cleanup 2018-09-29 12:22:13 -07:00
Kurt
e0e628844f Update copyto protection
skip over write protected slots (locked/team), may eventually weaken the
GUI to allow modding boxdata with locked slots (which will be skipped).
2018-09-24 19:43:59 -07:00
Kurt
7715d7e14f Add boolean OrderByCustom overload
Closes #2125 ; final sorting is skipped as bool only yields two groups
instead of many, resulting in a preferentially poor sort result
2018-09-20 17:29:55 -07:00