Commit graph

822 commits

Author SHA1 Message Date
Kurt
4e6a38189b Force validation differently for met location list changes
Startup, load gen5 save file.
Immediately load a pk3; met location is converted to Poketransfer
When data is prepared, the validation fails and the selectedvalue is reset to 0
Future selectedvalue sets will work

Just force validation when we change the list, so that future value sets work.
Weird winforms quirk
https://stackoverflow.com/questions/14624129/setting-combobox-droppeddown-false-resets-selected-item
2021-09-17 19:20:24 -07:00
Kurt
02af45cb30 Add LGPE to block editor
thanks for nobody noticing this yet :)
2021-09-16 14:06:52 -07:00
Kurt
80d1712b72 Mark stuff with enums, remove unused arrays
Fix shuffled comments for FormInfo
Remove unnecessary Reset on ctor, all fields are already the default
2021-09-07 20:57:19 -07:00
Kurt
28e7473f1a Condense some expressions 2021-08-22 01:26:28 -07:00
Kurt
bedc52943e Trailing commas
No functional change
2021-08-20 13:49:20 -07:00
sora10pls
803fe84f04 Add form strings for Eiscue, Morpeko, and Zacian/Zamazenta
Ice Face, Full Belly Mode, and Hero of Many Battles (strings trimmed where appropriate)
2021-08-07 13:22:14 -04:00
Kurt
c77543584e Widen pkm form dropdowns
Removes the hax form ID specifying; just use batch commands to mod the slot for out of bounds values.
2021-08-06 22:04:11 -07:00
Kurt
c784a0d992 Fix value -> gui
previous commits changed interface to byte; combo binding uses ints for value
2021-08-02 20:43:32 -07:00
Kurt
1efebe51d3 Simplify Country/Region/ConsoleRegion to byte from int
Only exists in gen6/7 games.
2021-08-02 19:43:57 -07:00
Kurt
4ec60916c1 Minor refactoring for pkmeditor GUI
Cleans up some interactions to be a little more obvious
2021-07-30 18:05:17 -07:00
Kurt
9215cc129b Allow readonly slots to be dragged out from
Show hand symbol on all draggable slots
Still disallow swap operation for readonly slots.
2021-07-24 00:16:51 -07:00
Kurt
b265c349ca Remove unnecessary null check
No paths into the method are null parameters
2021-07-21 00:58:30 -07:00
Kurt
5615d24c9c Fix conditional PID->EC copy on UpdateShiny
Should check 3-5, not 1-5, as VC transfers have separate ECs.
Replace the .Visible check; if the control isn't on the current tab page, it might report itself as invisible, and not update the text.
2021-07-16 08:40:53 -07:00
Kurt
6bed33f7f1 Minor tweaks 2021-07-15 20:40:00 -07:00
Kurt
3fa311f6ed Misc tweaks
more annotations - all bool->out ? are annotated now
fix gender symbol inversion (forgot to set text)
extract some methods to reduce nesting
2021-07-06 08:42:15 -07:00
Kurt
5a769312fd Finish renaming EncounterType->GroundTile
Update the localization for GroundTile for english (and Italian, which is untranslated)
2021-07-03 23:25:09 -07:00
Kurt
103aa9aa4b
Revise EncounterArea and EncounterType for clarity (#3228)
EncounterArea now stores a more specific type'd array for encounter slots. Better iteration and less casting, as the nonspecific `Slots` fetch is rarely referenced.

EncounterType renamed to GroundTile to reflect how it actually works in Gen4. Was previously an ambiguous field that was clarified a little; we can describe it a little better now. Keep the GUI the same to not scare the end users.

Change Trash Byte properties to get/set a Span. Trash Byte legality checking easier on the garbage collector?
2021-06-29 20:58:06 -07:00
Kurt
3e7775fc44
Track a PKM's Box,Slot,StorageFlags,Identifier metadata separately (#3222)
* Track a PKM's Box,Slot,StorageFlags,Identifier metadata separately

Don't store within the object, track the slot origin data separately.

Batch editing now pre-filters if using Box/Slot/Identifier logic; split up mods/filters as they're starting to get pretty hefty.

- Requesting a Box Data report now shows all slots in the save file (party, misc)
- Can now exclude backup saves from database search via toggle (separate from settings preventing load entirely)
- Replace some linq usages with direct code

* Remove WasLink virtual in PKM

Inline any logic, since we now have encounter objects to indicate matching, rather than the proto-legality logic checking properties of a PKM.

* Use Fateful to directly check gen5 mysterygift origins

No other encounter types in gen5 apply Fateful

* Simplify double ball comparison

Used to be separate for deferral cases, now no longer needed to be separate.

* Grab move/relearn reference and update locally

Fix relearn move identifier

* Inline defog HM transfer preference check

HasMove is faster than getting moves & checking contains. Skips allocation by setting values directly.

* Extract more met location metadata checks: WasBredEgg

* Replace Console.Write* with Debug.Write*

There's no console output UI, so don't include them in release builds.

* Inline WasGiftEgg, WasEvent, and WasEventEgg logic

Adios legality tags that aren't entirely correct for the specific format. Just put the computations in EncounterFinder.
2021-06-22 20:23:48 -07:00
Kurt
1bd1c287fa Centralize gender label text/color update calls 2021-06-22 20:06:05 -07:00
Kurt
8bac5c259a Trycatch sound stop, only stop if a sound has been played
Closes #3224

mono's impl of soundplayer is different, hence the need to be a little safer here.
bdd772531d/mcs/class/System/System.Media/SoundPlayer.cs (L255)
https://referencesource.microsoft.com/#System/sys/system/Media/SoundPlayer.cs,455
2021-06-22 17:06:30 -07:00
Kurt
035584dc7c Extract templating from EditPKMUtil, rename methods 2021-06-07 20:02:57 -07:00
Kurt
3764e60b37 Show extra details for exported legality results (debug only)
same as encdb showing full encounter details, spit them out here too.
2021-06-03 17:59:53 -07:00
Kurt
138501da2f Minor clean
Condense some expressions
Use less linq
Rename some fields
2021-05-29 15:31:47 -07:00
Kurt
2c820bfbe9 Minor tweaks 2021-05-18 13:29:55 -07:00
Kurt
50b15cd740 Use range/index
More in line with modernizing the codebase with latest c# syntax

improve web-qr decode speed slightly (no linq skiptake)
get money/coin mask without a temporary string (lol performance)
2021-05-14 15:30:55 -07:00
Kurt
d340642b09 Minor perf improvements 2021-05-10 01:01:45 -07:00
Kurt
cea2edb3e9 Add controls in one action
reduces the amount of control redraws
2021-05-09 12:10:32 -07:00
Kurt
7bc733c900 Update SK2 language coercion
Closes #3194
Exports are fine, imports with an ambiguous language (can be either JPN or INT) while illegal don't result in the above branches passing it.

Inputs with <=6 chars for OT&Nick will be ambiguous; PKM editor.
2021-04-11 20:50:34 -07:00
Kurt
0d45075d4b
Rewrite settings handling; enhance some user experiences (#3193)
- Settings now stored as json next to exe
- Settings now exposes all legality checking setttings that can be changed
- Slot hovering now can play cries in MGDB/PKMDB/etc, not just the main boxes.
- Enhanced hover text for mystery gifts and encounters that have movesets
- Show recently loaded save files in ctrl-f browser
- Toggle auto-load savefile setting to be none/detect-latest/last-loaded
- Custom extensions & extra backup paths can now be configured directly in the json settings
- Settings editor now uses propertygrid & tabs.
2021-04-11 18:09:54 -07:00
Kurt
4dea69e068 Fix met location list misbehavior
PKM Editor is so spaghetti anyway
2021-04-10 10:30:10 -07:00
Kurt
bfd581e89d Rearrange daycare for 68x56 layout 2021-04-09 17:20:42 -07:00
Kurt
c7b997865c Minor clean 2021-04-09 14:52:49 -07:00
Kurt
ecf1f361fe Show encounter's full details on hover (mgdb/encdb)
Won't work neatly for Mystery Gift types since those aren't record types.
2021-04-04 12:05:00 -07:00
Kurt
d6dc8a0410 fix signed g7id display
>2^31 would show a negative G7SID, no more!
2021-03-20 19:38:01 -07:00
Kurt
e547a9cf63 Extract report generation from LegalityAnalysis object functions
Can replace the default functionality with your own formatter, I guess.
2021-03-20 13:21:04 -07:00
Kurt
33e2c64721 Split SAV3 into version classes
Begone are the version-switch cases for value fetching.
2021-03-15 23:51:58 -07:00
Kurt
6bce4eea14 Minor clean
Annotations (nullable), some switch cases for readability
2021-03-14 16:16:55 -07:00
Kurt
4f6258e492 Add direct object editing for accessor type saves 2021-03-14 16:14:15 -07:00
Kurt
9e4f1d11cc Show misc encounter details on hover 2021-03-07 12:35:26 -08:00
Kurt
d4be8aa7be Update PKMEditor.cs 2021-02-10 14:02:25 -08:00
Kurt
b0fac2dd34 Update PKMEditor.cs 2021-02-09 08:46:03 -08:00
Kurt
666a1805ba Relocate formargument logic 2021-02-08 20:42:19 -08:00
Kurt
ff7817a749 Create FormArgument extension logic 2021-02-08 20:39:46 -08:00
Kurt
37cb15749e Update FormArgument handling for gen6/7
Disassociate pk4/pk6 backing byte[] when converting to pk5|pk7, as we no longer make a copy of the byte[] in the pkm's constructor.

Change UpdatePKM to include isParty, as we want it optional to update FormArgument too.

Change FormArgument saving to be handled by FormConverter; kinda not really good to have it there, but nothing else is handling FormArgument values.

Expand IFormArgument to have all FormArgument values exposed. "Maximum" is furfrou only.
PK6: Max is in the "FormArgument" u32, and the remain/elapsed is in party stats (hence the reverting when boxed)
PK7: u8 remain, u8 elapsed, u8 max, u8 unused.
PK8: assumedly the same as PK7, given the disassembly hints that it's the same as past games (even though Furfrou and Hoopa are not in SWSH).
2021-02-08 20:26:53 -08:00
Kurt
a0351efc81 Show preview tooltip in mgdb view
Show card header to differentiate gifts
2021-02-07 08:32:01 -08:00
Kurt
a2d5d7d769 Show preview for encounter database slots on hover 2021-02-06 22:33:13 -08:00
Kurt
a7f65554ad Update formarg handling 2021-02-05 16:52:46 -08:00
Kurt
ceb14c8468 Add consistent ctrl/alt modifiers for IV/EV/AV
Closes #3132
2021-01-20 22:09:25 -08:00
Kurt
803b8675fe Rework batrev current slot handling
Show all slots even if they're uninitialized. Empty first slots but present second slots caused errors on init.
2021-01-20 20:29:26 -08:00
Kurt
d805167e7c Save battle version value on value change 2021-01-18 18:18:42 -08:00
Kurt
6566b0ed1f Add Pokedex flag properties
Closes #2954 ; can set directly from propertygrid already, but might as well clean things up a little bit to match the disassembly logic.

Open the simple editor center parent rather than next-form-position
2021-01-09 23:27:22 -08:00
Kurt
cc43550357 Simplify more expressions 2021-01-04 17:31:43 -08:00
Kurt
cdcbc3750b Update PKMEditor.cs 2021-01-02 12:46:46 -08:00
Kurt
d02dd29e83 More version-location shenanigans
Should be behaving correctly for gen!2=>gen2 now
2021-01-02 10:35:48 -08:00
Kurt
09089da14e Use more expression return style
Reduces indentation & bracketing, a bit more concise
2021-01-01 17:08:49 -08:00
Kurt
813180453e Delete duplicate HT bit fetch method
Make expression methods
2021-01-01 16:39:33 -08:00
Kurt
7523e0e200 Make ContestStat fields byte (from int) 2021-01-01 13:39:08 -08:00
Kurt
d66486ac29 More pkm.form visibility/initialize tweaks
Gen7 started up showing a form=-1 marshadow, initialize the combobox with an empty string since we no longer set formlist if it has none
label/combobox visibility should be managed by gen2 flowlayout case below
2021-01-01 11:29:20 -08:00
Kurt
fb008be6a6 Condense some more expressions 2020-12-31 23:13:27 -08:00
Kurt
989c4314ae Hide formarg control when not present for format
Set initial visibility state to false for startup anyways; parent usercontrol should get set invisible by PKMEditor during its setup-format logic.
2020-12-31 15:15:22 -08:00
Kurt
d0d7895fa5 Only refresh localized data sources if needed (generation)
Faster same-type savefile loading
2020-12-31 15:10:37 -08:00
Kurt
ec4358372a Finish implementing form-argument control behavior 2020-12-30 00:32:17 -08:00
Kurt
de840f40d4 Invert some "!is" to "is not" 2020-12-29 00:58:08 -08:00
Kurt
6502c9df33 Condense some expressions, extract static class 2020-12-28 21:42:54 -08:00
Kurt
a124168e87 Make FormArg editing a complex control
Shows a dropdown for alcremie only, and a number entry for everything else.

See 771086a222 for initial implementation; I don't want the lag anymore lol
2020-12-28 11:51:25 -08:00
Kurt
7298910f04 Simplify some logic
The save editor buttons were originally checked for visibility in order to determine if we should hide the groupbox completely. This didn't work if the groupbox wasn't being displayed (get visibility checks if it is currently rendered, in addition to can be shown). So the "enabled" state was used to determine if it should be shown.

Now that we have the "Blocks" raw editing always being shown, the GroupBox will always be shown. Can just set the visibility directly, rather than doing the workaround.

Make the hall of fame editors slightly less SaveFile_type-specific.
2020-12-28 10:26:08 -08:00
Kurt
ee5349ff98 moar is or 2020-12-25 12:30:26 -08:00
Kurt
4d0108331a Move LegalityAnalysis derived movesets out of class
LegalityAnalysis just does the analysis; no need to do unnecessary suggestion logic inside the object.
2020-12-24 16:36:50 -08:00
Kurt
43dd390f21 Split IContestStats, mark trades as records 2020-12-24 00:06:40 -08:00
Kurt
7e4eb86e93 c#9 is not sugar 2020-12-22 21:24:41 -08:00
Kurt
997e0751f3 Minor clean
Handle remainder of c#9 sugar
Fix some spelling mistakes
2020-12-21 23:37:07 -08:00
Kurt
514b60b447 Merge type check with usage in if statements
if x is y with z property true, then :D
2020-12-21 22:33:48 -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
6f7602f2ad Change signatures to use readonly if possible
Extract get/set team methods for battle video
2020-12-05 06:09:33 -08:00
Kurt
e72c80613e Extract metadata/state tracking from SaveFile obj 2020-12-05 05:36:23 -08:00
Kurt
9b178fefe2 Xmldoc, minor tweaks
Move form-info logic from FormConverter to AltFormInfo; now FormConverter is entirely form=>string[]
Add a bunch of xmldoc
Make pogo no-end-date cmp agaisnt UTCnow rather than local now.
2020-11-27 11:51:02 -08:00
Kurt
038903a2f9 Update BoxMenuStrip.cs
Co-Authored-By: Lusamine <30205550+Lusamine@users.noreply.github.com>
2020-11-19 15:59:33 -08:00
Lusamine
6a91dfbaba
Fix parsing SID error (#3090) 2020-11-19 15:38:56 -08:00
Kurt
81110b4231 Upgrade netcore build to NET 5.0
keep with the times, kids

handle some compiler messages
2020-11-14 08:20:48 -08:00
Kurt
df5ebd1f54 Minor clean
Resolve some messages
2020-11-11 21:01:41 -08:00
Kurt
23e765e550 Add opening for rental team dumps
Dunno why anyone would want these, lol
Closes #3074
2020-11-03 20:12:42 -08:00
Kurt
28767df0fb Split gamesync details to interface 2020-10-31 11:43:57 -07:00
Kurt
80a5d8e451 Remove layer null check
Move to the place that triggered the null
2020-10-30 19:56:16 -07:00
ReignOfComputer
3767a61171
Fix Stat Tooltips (#3057)
Was only updating based on Stat Nature?
2020-10-27 09:18:12 -07:00
Kurt
9e380fdcde Update sprite on gmax field change 2020-10-25 13:47:42 -07:00
Kurt
9264150b2b Add shiny1 batch editor, add ctrl-shiny (1)
GUI: Ctrl click star to get shiny1, shift click for shiny0, any-click to get random

make Alt click modify the SID instead of PID

add SetShinySID shiny type
2020-10-25 10:42:48 -07:00
Kurt
3e1bc1f59d Show extra slots in the "Other" tab 2020-10-24 14:57:53 -07:00
Kurt
bc33c87c6c Add click handler for crown raids
oops
hotfixing exe soon
2020-10-24 12:28:59 -07:00
Kurt
8a2a25fde1 Update data structures for Crown Tundra
Adds a wild area Raid den detail editor like mainland/armor raids.
2020-10-24 11:09:29 -07:00
Kurt
cce4707604
Enable nullable for winforms csproj (#3037)
Handle all warnings
obviously the usage of null! could potentially be avoided if the object init wasn't such garbage, but here we are with years of old junk and lack of abstraction in the GUI project
2020-10-18 11:02:39 -07:00
Kurt
7a01b1249c Minor clean
Handle more messages, add more xmldoc
2020-10-18 09:43:41 -07:00
Kurt
3686ee9ec4 Set suggested Encounter Type on Met Location click too
Closes #3010
2020-10-08 15:01:23 -07:00
Kurt
61dc9a45ae Revise Shadow state detection
Closes #3012
2020-10-06 22:36:27 -07:00
Kurt
d4452ce3af SK2 coerce to load to a hint language
This format won't be supported cleanly, so let's just try to allow language detection to work as best as it can without storing metadata in the SK2 bytes.
2020-10-04 14:42:48 -07:00
Kurt
6938d2f94d Split VivillonTables into two classes
Indicate that the content is for 3DS specific logic
Reduce restriction for parameters requiring IGeoTrack => IRegionOrigin
2020-10-04 14:15:13 -07:00
Kurt
09c6359e3a Add flexibility for SK2 imports
Check language character table for English vs Japanese when loading for a destination
2020-10-04 10:25:34 -07:00
Kurt
f8de9fe1bf Minor tweaks
now that stadium saves all expose registered teams, can just call from the parent class
rental sk2's have no TID; add that to the requirement to not get flagged for missing OT
2020-10-04 09:26:15 -07:00
Kurt
7efaa5ab71 Minor clean
collapse some expressions
handle some compiler messages
2020-10-03 18:59:36 -07:00
Kurt
816f24e3db Add Misc pkm array viewer for Stadium saves
Readonly slots

Things could be expanded on to use interfaces and wrappers for a "SlotReference" and properties for readonly.

But that's kinda unnecessary
2020-10-03 18:22:29 -07:00
Kurt
52a67f2425 Add Stadium2 Support
Introducing a new PKM format: SK2
Split ICaughtData2 off of PK2 so it can be shared with SK2 when type-checks occur
Add conversion for PK2<->SK2
Split the split-buffer handling for GBPKM to GBPKML (what a name), so that I can reuse shared accessor logic for SK2.
2020-10-02 18:08:40 -07:00
Kurt
22f37910f0 Remove unnecessary single-member interfaces 2020-09-27 18:19:28 -07:00
Kurt
2b7e06e217 Refactoring
Extract some logic, suppress some compiler messages
2020-09-18 22:11:13 -07:00
Kurt
7a1c438b74 Minor tweaks
add method to randomize AVs from interface extension method
revise stat presence check to check ATK since HP is stored in gen1 format
2020-09-17 18:13:08 -07:00
soopercool101
1a1cfbda4a
Fix Hidden Power Power calculations (and add to UI) (#2989)
* Fix broken hidden power power calculation

* Fix broken Gen 2 Hidden Power calculation

* Add parentheses

* WIP UI

* Finalize UI, only show on gens 1-5

* Inline some logic to reduce allocations

* Add unit tests for both hidden power calculation cases

Co-authored-by: Kurt <kaphotics@gmail.com>
2020-09-14 20:06:11 -07:00
Kurt
01fb233e48 Minor tweaks
Extract some interfaces
Suppress some warning messages with commented reasons if appropriate
2020-09-09 12:47:24 -07:00
Kurt
5d3bc289b6 seal hunting
Mark things as sealed as they shouldn't be inherited from or overriden in a derived class.
2020-09-07 13:51:13 -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
b7211000b0 Split Country/Region/ConsoleRegion from ITrainerInfo
Only present in mainline gen6/7 game pairs, so it's not wise to have it for all games
2020-07-31 13:53:42 -07:00
Kurt
27f15d2f20 Split Country/Region/ConsoleRegion to interface 2020-07-31 11:17:31 -07:00
Kurt
a221a27074 Click version/battleversion -> dropdown combobox
User error help
2020-07-25 09:58:21 -07:00
Kurt
65ecd3ca9a Sync missing change 2020-07-18 20:07:55 -05:00
Kurt
705822c965 Abstract some gen1/2 encounter types from their parent class 2020-07-18 15:36:30 -05:00
Kurt
523edecf7b Get actual value rather than magic index
logic doesn't really work for gen2/3, so gate it behind gen4+ format only
2020-07-06 17:32:40 -05:00
Kurt
993673f0de Minor clean
no functional change
2020-06-27 23:36:53 -05:00
Kurt
4f7845547e Minor clean
Remove met location dynamic sizing for C/XD (already resized for SWSH)
add some xmldoc comments
rename some parameters
2020-06-20 18:23:03 -05:00
Kurt
d6c5c6071d Hide armor raids when not available 2020-06-19 19:56:24 -05:00
Kurt
86a9711cc1 Show xor & tsv on gen3-5
TSV/PSV was never abused during these gens, but whatever, show the raw details.
Closes #2868
2020-06-19 18:59:00 -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
ce3f887a97 Handle dragdrop from zip (win explorer) 2020-06-16 21:53:24 -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
bfef634a1a Set shiny type regardless of format
Don't loop if not required to loop
2020-06-12 11:45:56 -07:00
Kurt
afa368823e Minor clean
handle some compiler messages
2020-05-26 16:59:47 -07:00
Kurt
460062a07c add generic sav block editor 2020-04-26 16:23:06 -07:00
Kurt
b8814d2448 Split GG into LGPE (GP/GE), GG (LGPE||GO)
Update usages
2020-04-16 12:48:18 -07:00
Kurt
ee1cfa8912 Hanle some compiler messages 2020-04-14 10:52:19 -07:00
Kurt
49e4fd396d Remove some unnecessary null checks 2020-04-14 10:08:56 -07:00
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
Kurt
f2ac29ff4e Relocate some logic
slightly reduces savefile.cs footprint
2019-07-05 22:02:29 -07:00
Kurt
39b837c252 Fix boxeditor show wallpaper
Closes #2334 ty @sora10pls
was unnoticed for >2y lol

parameter is expecting box index, not the wallpaper index
2019-06-25 17:50:09 -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
1b028198ad
Split gen5-7 saves with inheritance (#2319)
refer to pull request comments for summary
2019-06-08 19:56:11 -07:00
Kurt
0007904cb4 Allow party only forms in party/bbox/daycare
Closes #2317 thanks @iiippppk !
2019-06-06 19:53:11 -07:00
Kurt
de774ed131 readonly ComboItem
create once, never modified after
2019-06-01 19:12:41 -07:00
Kurt
9cdbc46740 Relocate apply basic template out of gui 2019-05-29 22:40:39 -07:00
Kurt
5879cc8a18 Extract some pkm gui logic
probably won't stay this way if things are eventually rewritten; too
much business logic in the pkmeditor.cs, would need a ton of abstraction
2019-05-29 21:35:52 -07:00
Kurt
b5b4b67263 Fix template IVs getting overwritten on startup
Closes #2296
setting datasource triggers a changed event, which updates IVs
set flag to indicate this isn't the user doing this change
2019-05-05 12:57:56 -07:00
Kurt
706a9f2555 Disallow setting EVs for pb7 via label click shortcut
apply AVs instead
2019-04-29 17:35:31 -07:00
Kurt
9861128b63 Minor img processing update
Extract magic pixel shifting numbers for layering imgs -- SWSH will
likely use the large boxsprites, as hinted by LGPE's upsizing.
Remove new[] color array creation, just pass byte values
break up glowedges into steps
2019-04-22 22:25:14 -07:00
Kurt
95267afb2d Add bulk check to Checksums button
Hold control to have the Bulk Legality analysis spit out its results to
the clipboard.
2019-04-14 09:08:33 -07:00
Kurt
e6fd8560ee Only show reset key value for int/ko saves
e1a3c8edb3 (commitcomment-32979627)
2019-03-31 16:59:01 -07:00
Kurt
e1a3c8edb3 Add RTC reset, allows game to define on continue
Closes #2273 , thanks @SatoMew !
2019-03-30 12:34:51 -07:00
Kurt
bb8cf5d3d8 Simplify get/decrypt pkm access 2019-03-29 19:43:33 -07:00
Kurt
5dcf2f4dc8 Use enum instead of nullable bool tristate 2019-03-29 17:52:26 -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
9ca4ef1e09 Move pkx hidden power logic to HiddenPower.cs 2019-03-16 12:07:22 -07: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
d3dd4fb2a5 Track slot modified count on sort/delete/mod
Sorting will always show multiples of boxcount since it repositions
empty slots
2019-02-20 17:59:54 -08:00
Kurt
98b21eaaa8 Add clone deletion quick action
kinda slow, if a save has 900 mons, it has to check 900*900 which is
O(n^2), takes a few seconds
as opposed to just doing a hashset checking contains, would be O(n)
gotta do some fun stuff to make it faster
2019-02-18 17:00:16 -08:00
Kurt
9171055fd4 Add box sort by encounter type
grabs encounter name and orders by that (Egg/Static/Wild etc)
2019-02-18 15:34:55 -08:00
Kurt
dab2300cc5 Flip gender colors
oops
extract config line load
2019-02-17 21:17:16 -08:00
Kurt
956f5ce499 Trycatch color settings load
updates in the future might break, be defensive
2019-02-17 15:13:56 -08:00