Skip to content

handlers: unit operations — fusion, evolution, selling, and favourites - #34

Open
Seltraeh wants to merge 4 commits into
decompfrontier:devfrom
Seltraeh:split/05-units
Open

handlers: unit operations — fusion, evolution, selling, and favourites#34
Seltraeh wants to merge 4 commits into
decompfrontier:devfrom
Seltraeh:split/05-units

Conversation

@Seltraeh

@Seltraeh Seltraeh commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

handlers: unit operations — fusion, evolution, selling, and favourites

Branch: split/05-units
Base: dev
Merge position: 05 of 13

Part of the PR #28 split. Each PR branches from dev and contains only its
own changes, so this diff is exactly one subsystem. The set is designed to be
merged in numeric order; merging all 13 reproduces PR #28 byte for byte
(verified against tree 79a4e065).

Later PRs in the series touch Handlers.hpp, GmeControllerHandlers.cpp and
UserInfo.cpp too, so once earlier ones land this branch may need a rebase.
Those conflicts are always additions on both sides — keep both. Maintainer
edits are enabled, so feel free to push the rebase directly to this branch.

Largest PR in the series at ~790 lines, but it's four independent handlers sharing one helper.

What's included

Handler Request Purpose
UnitMix Mw08CIg2 XP fusion with Great/Super multipliers, zel debit, full reinforcement + team payload
UnitEvo 0gUSE84e Evolve, preserving IMP stats
UnitSell Ri3uTq9b Delete rows, credit zel
UnitFavorite 2p9LHCNh Persist lock flag

UnitEvo emits all five response fields including the original MST id. Omitting it crashes the client during the evolution animation.

The important bit

All three destructive handlers call returnEquippedSpheres() before their DELETE. Equipped spheres are owned items; deleting the unit row without returning them first destroys them silently with no player feedback. This is why the PR is sequenced after Items — the helper writes to user_items.

Splitting further

If ~790 lines is too much in one pass, this divides cleanly into UnitMix+UnitEvo (~600) and UnitSell+UnitFavorite (~190). They share nothing beyond the helper. Happy to split on request.

Verification

Fuse, evolve and sell a unit with spheres equipped; confirm the spheres reappear in the warehouse each time.

Implements the four unit management operations.

UnitMix fuses fodder units for XP with the Great and Super success
multipliers, debits zel and returns the full reinforcement and team payload.
UnitEvo evolves a unit, preserving IMP stats and emitting all five response
fields including the original MST id, without which the client crashes during
the evolution animation. UnitSell deletes rows and credits zel. UnitFavorite
persists the lock flag, and UserInfo reports it back so locks survive a
reload.

All three destructive handlers call returnEquippedSpheres() before their
DELETE. Equipped spheres are owned items; deleting the unit row without
returning them first destroys them with no feedback to the player.
split/03-schema-foundation collapses the duplicate stat columns in user_units
onto one column per concept -- unit_lvl / base_rec / ext_rec, with add_heal
and limit_over_heal renamed to add_rec / limit_over_rec. UnitEvo and UnitMix
read and write those columns, so they move with it or break on rebase.

Only the SQL text and row["col"] lookups change. The packet field names are
the client's own vocabulary (FriendInfo and ReinforcementInfo genuinely say
base_heal where UserUnitInfo says base_rec, both carried from IDA), so lines
like rd.base_heal = br["base_rec"] are correct: packet field left, column
right. See the split/03 commit for the full reasoning.
split/03-schema-foundation stops persisting fe_bp and fe_max_usable_bp: they
were stored as the literal constants 100 and 200 and never computed from or
consumed by anything, with Frontier Evolution unimplemented. UnitEvo and
UnitMix only ever selected those columns to copy them straight back into the
response packet, so the reads go with the columns or the SELECTs break.

The packet fields themselves are untouched -- the client still receives both
keys, now defaulting to 0. Only the round trip through the database is gone.
split/03-schema-foundation drops user_units.leader_skill_id as species data.
UnitEvo already used targetMst->leader_skill_id; UnitMix was the only reader
of the stored copy and now takes it from baseMstData, which it already held
for element/exp_pattern/max_lv.

The packet field is untouched -- the client still receives the key.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant