Commit graph

606 commits

Author SHA1 Message Date
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