Commit graph

546 commits

Author SHA1 Message Date
Kurt
33bdacebe8 Minor tweaks
Handle some compiler/extension suggestions
2020-04-12 16:07:59 -07:00
Kurt
e83f2a7dd0 Expand met location combobox
stupid long met location names in SW/SH; doesn't really hurt.
Not gonna measure all string lengths and dynamically stretch it -- not worth.
2020-04-12 13:26:35 -07:00
Kurt
30d21e4532 Extract out showdown set interface 2020-04-12 13:05:29 -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
80bedf2140 Add HomeTracker to list of hideable secrets 2020-03-21 10:56:15 -07:00
Kurt
68324847bb Update PKMEditor.cs 2020-03-17 10:35:30 -07:00
Kurt
f1beef872f Reorder origin mark returns
Co-Authored-By: Matt <sora10pls@users.noreply.github.com>
2020-03-17 10:34:23 -07:00
Kurt
a885f6b48f Clean up PID/EC auto-update
Now loads & saves version-less data fine

Co-Authored-By: lusamine <lusamine@users.noreply.github.com>
2020-03-13 19:56:53 -07:00
Kurt
4c226340fe Add shiny sprites, alcremie sprites & big sprites for all
Keeping the 30x40 for now; might change my mind later.
Kept the gmax sprites but they're unused.
2020-03-03 20:22:57 -08:00
Kurt
9b30bb8a2f Don't copy PID->EC if bad GenNumber
Reading raw uncaptured data from RAM
2020-02-29 10:55:30 -08:00
Kurt
66efbaf407 Add box manip for heal all slots 2020-02-17 19:28:20 -08:00
Kurt
fc9d0b4b24 Add hint for pkm with dummied moves
Closes #2716
2020-02-16 12:17:36 -08:00
Kurt
5c845a3875 Hide home tracker on non pk8 formats 2020-02-14 11:54:04 -08:00
Kurt
e8759ee538 Determine shiny as square if fateful && shiny
regardless of xor value result
gotta make those shinies pop ;)
ty anubis
2020-02-13 16:51:14 -08:00
Kurt
92b22b9f44
Fix HOME tracker value GUI character entry length
Closes #2705 
It's recommended that you NOT set a "random" value here; instead, let HOME regenerate one for you.
Clearing it still functions properly.
2020-02-13 10:52:19 -08:00
Kurt
6346444db7 Extract home tracker to interface 2020-02-12 18:52:48 -08:00
Kurt
e77fa205a0 Add tracker editor 2020-02-12 18:10:03 -08:00
Kurt
d260249b5e Apply met location before suggestion check
Closes #2667
2020-01-28 18:29:05 -08:00
Kurt
dd07126d83 Relocate level suggestions to EncounterSuggestion 2020-01-28 16:21:38 -08:00
Kurt
e40f739494 Update tab ordering
Closes #2665
2020-01-27 17:15:58 -08:00
Kurt
410fcee85b Sort sav sub-editors on load 2020-01-27 17:14:18 -08:00
Kurt
c301ce88ab Update Random to be a bit more thread safe
Random isn't thread safe; users of PKHeX.Core.dll might run multithreaded operations (see PKSM + ALM), so we need to have a thread-specific RNG available.

Thread Local get; to improve performance, save the random object locally whenever it is used more than once in the method.

https://docs.microsoft.com/en-us/dotnet/api/system.threading.threadlocal-1?redirectedfrom=MSDN&view=netframework-4.8
https://stackoverflow.com/questions/18333885/threadstatic-v-s-threadlocalt-is-generic-better-than-attribute/18337158#18337158
2020-01-25 21:49:52 -08:00
Kurt
b5d48bc14f Split up portions of CommonEdits
Cuts out about half the size; there's still a bunch of apply-value logic but it's not really big enough for a separate class.

Rename BallRandomizer->BallApplicator
2020-01-25 16:47:44 -08:00
Kurt
225d5d0698 Refresh PP on applying suggested moves
Closes #2655
pretty sure the FieldsLoaded is preventing the pp refresh, so just manually do it
2020-01-22 09:24:25 -08:00
Kurt
f3a9a9d7c2 Misc nullable handling update for winforms
Didn't enable it; there's some side effects from properties that used to be null in PKHeX.Core
there's probably more, but just handling a few.
Closes #2642
2020-01-18 13:27:48 -08:00
Kurt
df1d317861 Add block dump/import
Can do block swaps with other saves (fashion block is d224f9ac) -- export the block and import it to another save!
2020-01-13 19:04:21 -08:00
Kurt
2e16fb058c Show form arguments in gen6/7
Clamp form argument load to current list bounds (used to throw arg range exception if invalid)
2020-01-13 17:09:03 -08:00
Kurt
5a20dc707d Rewrite encounter suggestions
Don't clone legality templates, and keep suggested information minimal -- this isn't automod
2020-01-12 19:40:36 -08:00
Kurt
eaeebea923 Remove another method shortcut
EncounterSuggestion needs a facelift anyway
2020-01-12 17:00:03 -08:00
Kurt
bbd1aff5fe Add new lengths
new format still crashes as block absolute index is now different
should do a different way of loading blocks (key instead of index)
2020-01-09 08:17:41 -08:00
Kurt
0dd4d1fe7a Remove unnecessary casts 2020-01-06 17:50:18 -08:00
Kurt
87fbdf8222 Add Click PP label (not max) to refresh PP counts
https://github.com/kwsch/PKHeX/issues/2603#issuecomment-570754419
2020-01-03 20:07:56 -08:00
Kurt
90dabf5b87 Restore original background if hover-glow not done
Closes #2616
2020-01-03 19:46:04 -08:00
Kurt
26b4c991cb Split Friendship and Form layout panels
Closes #2569
hax form change update trigger from validated->textchanged

might be a little annoying to see the layout/order change, but it should
be better as stuff is now visually chunked.
2019-12-26 14:52:50 -08:00
Kurt
60d12e330c Handle bad gender values when loading
0/1/2 normally; I could just copy the genderless symbol for '3' as well
but eh
2019-12-26 14:27:17 -08:00
Kurt
97c3c6b610 Add raid/den detail browser
Hold alt when hitting activate all to dump instead
I've seen DenType=5 Event=2 for at least one raid so far... not sure if
the event/rare properties are accurate.
2019-12-23 23:30:21 -08:00
Kurt
9285dc5b52 Reduce width of formArg & flowlayoutpanel
Closes #2569
-2 combobox width
-15 flowlayoutpanel width (two of them)

I assume this works. Please let me know! The width was capped out on my
machine; the different scaled users might be off by a pixel (too big),
which makes it appear invisible because it can't render it in the
too-small space
2019-12-09 21:24:06 -08:00
Kurt
8acb336d51 Use enum for species comparisons
slightly easier to read with named values
2019-12-08 17:39:19 -08:00
Kurt
5ddd59c9aa Fix runerigus/yamask partial load fail
320 is max hp (31IV 252EV), is this just -60 from max HP (threshold to
evolve at?)
might need some more research to see what is going on with this

only trycatch in release builds; was confused until I stepped thru and
saw the crash
2019-12-08 00:03:08 -08:00
Kurt
c2dd2c9145 Sync missing content
see previous commit, lol
2019-12-07 15:15:35 -08:00
Kurt
a178418c3d Fix clone to all slots behavior 2019-12-07 13:56:00 -08:00
Kurt
99a884c56e Add click nature label to copy other nature
For those who are annoyed that ShowdownSet does not import to Nature,
sure, you can do that with just one click now

(it's not overwritten automatically, just in case the event the
encounter is fixed nature)
2019-12-03 20:12:13 -08:00
Kurt
20f3552e39 Add vc origin sprite
ty @sora10pls

reorder for preference
2019-11-29 11:21:35 -08:00
Kurt
3c4e668d9a Add alcremie formArg gui
Closes #2538
Standardize nomenclature as FormArgument, add interface for those
exposing the property.
2019-11-29 10:44:52 -08:00
Kurt
65e2457762 Don't suggest relearn moves if not parsed correctly 2019-11-26 16:12:57 -08:00
Kurt
5435a5d93e Minor updates
Fix mark (ribbon) read for index > 64
Heal party stats on set detail import
Wipe HT Language for eggs/untraded
Extract BST total color logic
2019-11-25 17:32:10 -08:00
Archit Date
a05bed8f18 updated shiny indicator for xor0 (#2522) 2019-11-25 09:27:42 -08:00
Kurt
32d8225023 Fix drag slot equality check
prevents deleting party slots if a slot is dragged into its original
slot (X->X); Equals check only checked reference
2019-11-24 06:42:41 -08:00
Kurt
27754afea8 Fix box list width crunching
Closes #2477
2019-11-23 08:51:54 -08:00
Kurt
b6f2dd623e Fix external drag restoring of image
Closes #2476
2019-11-22 22:22:30 -08:00
Kurt
9e997f1613 Trycatch all clipboard set-text operations
Closes #2486
redirect to a common method in the event that setting to the clipboard
fails; the handling is now the same for all usages (trycatched and a
shared error message).
2019-11-22 21:23:00 -08:00
Kurt
a50169d3d2 Add shift-set shinyxor0 pid
Display xor value on hover, not gonna do alternate stars/square display
Closes #2482
2019-11-20 20:38:05 -08:00
Kurt
2aaa3763ee Fix record setting logic
Thanks @AnalogMan151 ! #2416
Fix method reference lol
2019-11-20 18:18:33 -08:00
Kurt
cca33fc0f9 Fix Technical Records box size
all goofed out under certain conditions
2019-11-18 17:42:59 -08:00
Kurt
7a77ca25f1 Show nature amps from statnature
Trigger update in stat pane when statnature is changed too
2019-11-17 16:00:23 -08:00
Ammako
2292c7eb1d Don't show notOT language on Gen. 6-7 (#2442) 2019-11-17 10:48:39 -08:00
Kurt
ac498fe643 Update box clamp
off by 1, gen6 battle box causes it to be out of range
2019-11-16 21:21:02 -08:00
Kurt
08aef9abc0 Increase program size if required for different DPI
Closes #2439
2019-11-16 21:03:24 -08:00
Kurt
f836a3dddb Fix Daycare slot display
was redirecting to party; party was removed

all that remains in the slot list the SAVEditor manages is the two
daycare slots.
Maybe it'll be better to have a popup form in the future, that way
multiple daycares can be shown as appropriate.

Closes #2433
2019-11-16 14:45:21 -08:00
Kurt
025cf69eeb Switch pkm export formats to party format
Now dumps party format bytes
Cons: more space
Pros: stats are retained, especially when users drag-drop.

Closes #2419
2019-11-16 14:03:25 -08:00
Kurt
627a236956 Add shift hotkey to apply current as TRs
no window popup required
2019-11-15 23:22:21 -08:00
Kurt
981ed9a253 Add technical record flag editor & api 2019-11-15 23:12:28 -08:00
Kurt
cefb56a749 Sword/Shield Update 2019-11-15 17:52:08 -08:00
Kurt
b8835facd5 Rename public "pkm" properties to non-lowercase
lowercase = local variable or private member
2019-10-27 12:57:04 -07:00
Kurt
39d11f5f2f Simplify font logic
dont bother trycatching stuff that shouldn't fail
2019-10-26 23:14:00 -07:00
Kurt
46640d48a3 Misc clean
un-nest classes,
move some logic to core,
update some get-only properties that return arrays to methods
2019-10-26 12:58:55 -07:00
Kurt
fcc993784b Rename abstract pkm inherited class names
leading underscore for a class name = pls no
2019-10-26 12:42:33 -07:00
Kurt
e3efa65160 Cleanup
handle messages for dirty cleaning :)
2019-10-26 12:33:58 -07:00
Kurt
5dcee4fb9a Set random moves if GetMoveSet yields invalid set
Closes #2406
No clean way to check for these edge scenarios, so just double check the
moveset and return random moves if we fail
2019-10-24 18:11:25 -07:00
Kurt
08a88b876f Dispose dialog forms after use 2019-10-19 20:33:37 -07:00
Kurt
d4ce0644c8 Simplify block property names
[...]Block -> [...]  since it's kinda redundant, we already know by its
type.
Rename offset ints that collide
2019-10-18 20:42:03 -07:00
Kurt
4302347366 Show missing editors
yay useless integer stores instead of checking if an interface is
implemented
2019-10-18 20:26:41 -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
72aee7540d Enable nullable for drawing project
Found one NRE: daycare slot graying
Found one missing reference: GO icon (due to netcore3 refactor)
2019-10-07 19:10:38 -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
d3b0c392b2 Minor tweaks
no functional change
2019-10-03 22:21:33 -07:00
Kurt
8d8adde2b1 sealed
sealedsealedsealedsealedsealedsealedsealedsealedsealedsealedsealedsealedsealedsealedsealedsealedsealedsealedsealedsealedsealedsealedsealedsealedsealedsealedsealedsealed
2019-10-03 19:09:02 -07:00
Kurt
e104436924 Extract out filename fetch logic 2019-10-03 18:35:33 -07:00
Kurt
08561236f7 Relocate content not associated to SAVEditor 2019-10-03 18:29:53 -07:00
Kurt
ffe3a4ba15 Relocate resource naming for sprite fetch to draw 2019-10-03 18:23:40 -07:00
Kurt
39eedb1db2 Make PCBinary a method instead of get prop 2019-10-03 17:45:19 -07:00
Kurt
43e8b08ba8 Dynamically generate slot grids
Gen1/2 INT: 20 slots => 4 wide x 5 high
Gen7lgpe: 25 slots => 5x5
otherwise: 6x5
(maintain 5 rows)

Database(s): 6x11

Could probably wrap the initialization logic (grabbing savefile, etc)
but works for now

This is all in prep for box sprite resizing (56x68 as evident by lgpe
sprites); figured I'd add some display flexibility to handle prior games
with non-30/box layouts.

shave off a couple pixels for popup box view to make the edges of the
box directly at the edge (-2 bot, -1 right side)
2019-10-02 20:04:12 -07:00
Kurt
c2d5d0cd42
Add .NET Core 3.0 build option for WinForms project (#2396)
* Move pkhex.drawing calls out of form constructors

designer doesn't like it; if Main can't be designed then there's some
call that it can't process for whatever reason

* Add netcore3 targeting

Closes #2198 by adding a netcore3 build option
Closes #2391 by retaining designer functionality and net46 builds
2019-10-01 18:12:08 -07:00
Kurt
94baab1c45
Split off image generation to separate project (#2395)
With the approaching games, PKM sprites are a different size from the 3DS era (as already hinted by LGPE, which has 56x68). It'll be a little easier to manage with this portion of the library walled off from the rest of the codebase.

Eventually the net46 target will use fody or something to merge in these extra dependency dll's automatically to not disturb the usual exe/dll experience.
2019-09-29 09:47:06 -07:00
Kurt
7db0657711 Fix context view/set/delete action
oops, dunno what commit broke it
2019-09-28 19:29:15 -07:00
Kurt
f47382e34f Fix GetUnderlyingControl call from ContextMenuStrip
https://projectpokemon.org/home/forums/topic/55096-unhandled-exception-error-pkmdb/?tab=comments#comment-249235
had recently moved the contextmenu to the designer, event handler has
sender as the ContextMenuStrip

use recursion -> while loop so that the input can be any of the 3 cases;
it'll drill down until it gets a picturebox or none.
make generic for giggles, update usages so Array.IndexOf uses
picturebox[] instead of object[]
2019-09-24 18:14:15 -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
7819c16792 Use slice operation instead of linq chain
Reuse IsRangeAll for smdemo detect
reset dragdrop on dropping folder (early returned)
2019-09-23 15:13:22 -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
02f36655a0 Reload box data cache on resetting slots
clear box and other calls to ResetSlots weren't reloading with the NEW
modified pkms.
2019-09-09 20:23:18 -07:00
Kurt
6d8ff992e2
Clean up / fix external drag in (#2383)
* stash

* Consolidate some logic
2019-09-03 19:54:41 -07:00
Kurt
11bc9f064f Make slots visible after resetting
Had removed the Visible=true from the inner UpdateSlot call in the
refactor; place here.
2019-09-03 18:44:35 -07:00
Kurt
61bee67908 Misc fixes
revert HoF reads as they are stored outside the general/storage blocks
2019-09-02 20:25:38 -07:00
Kurt
b81a1e1e29 Refactoring
Increase abstraction for arbitrary slot get/set operations, and fracture
SAV4 behavior for each game type.

Adds: Undo/Redo of party slot changes
Fixes: Fixed Gen5 daycare slot 2 reading, and EXP reading
Fixes: Some slot color glitchiness
Fixed: Box layout editor now hides the flag label if no flags are
present
Fixed: Gen7 box flags are now shown (unknown purpose lol)
Changed: savefile objects are generally smaller (removed a few shared
offset fields)
2019-09-02 19:30:58 -07:00
Kurt
f0df115ccd Fix box load on uninitialized box load
Closes #2376
probably will be rewritten at a later time; am reworking the slot info
messaging for drag/drop/display
2019-08-23 18:03:10 -07:00
Kurt
bf6c25eca7 Break up SlotChangeManager logic
A little bit cleaner when the logic is separated
Keep an abstraction of BoxEdit to cache the current box contents.
Already fetched to show sprites; any future fetches (for preview text /
hover sprite) can reuse the already fetched pkm data.

Should probably rewrite this stuff completely, but effort better spent
elsewhere
2019-08-20 19:50:28 -07:00
Kurt
39f5500d8a Show summary tooltip on mouse enter
Thanks SadisticMystic for the suggestion!
2019-08-14 22:51:49 -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
a608e0b252 Minor clean
Remove some unnecessary properties from SaveFile
Enumerate checksum flag results for GC memcard checking
Remove unnecessary checks on savefile type
Add some documentation
Decapitalize some method parameters
2019-07-14 15:06:45 -07:00