-
Notifications
You must be signed in to change notification settings - Fork 6
db: ordered migrations, user_items table, and shared inventory helpers #32
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: dev
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -86,6 +86,11 @@ PacketInterfaceFor<::UserTeamInfo>::fields() | |
| .update = true, | ||
| .insert = true, | ||
| }), | ||
| // The client's gem HUD reads brave_coin (03UGMHxF), so dev wires the gems | ||
| // column here on purpose (the "BraveCoin" readParam setter name is a red | ||
| // herring for this client). Do NOT point this at a real brave_coin column | ||
| // — that zeroed the HUD and broke gems. Kept mapped to `gems` with | ||
| // paid_gems/free_gems so every gem field the client might read shows gems. | ||
| field<&::UserTeamInfo::brave_coin>("gems", { | ||
| .read = true, | ||
| .update = true, | ||
|
|
@@ -96,6 +101,35 @@ PacketInterfaceFor<::UserTeamInfo>::fields() | |
| .update = true, | ||
| .insert = true, | ||
| }), | ||
| field<&::UserTeamInfo::summon_ticket>("summon_tickets", { | ||
| .read = true, | ||
| }), | ||
| field<&::UserTeamInfo::rainbow_coin>("rainbow_coins", { | ||
| .read = true, | ||
| }), | ||
| field<&::UserTeamInfo::colosseum_ticket>("colosseum_tickets", { | ||
| .read = true, | ||
| }), | ||
| field<&::UserTeamInfo::brave_points_total>("total_brave_points", { | ||
| .read = true, | ||
| }), | ||
| field<&::UserTeamInfo::current_brave_points>("avail_brave_points", { | ||
| .read = true, | ||
| }), | ||
| field<&::UserTeamInfo::want_gift>("want_gift", { | ||
| .read = true, | ||
| }), | ||
| // Send the single `gems` column to BOTH gem fields. The HUD reads FREE | ||
| // gems (92uj7oXB) — it was being sent as 0, which is why the balance | ||
| // never updated (while zel, whose field IS read, did). The summon/paid | ||
| // path reads PAID gems (d37CaiX1) — the user could summon earlier when | ||
| // only paid was populated, so keep it set too. A captured production | ||
| // team_info has both populated (free=10000, paid=20000); mirroring one | ||
| // column to both keeps display + summon working without double-counting | ||
| // (the HUD shows free, not the sum). | ||
| field<&::UserTeamInfo::free_gems>("gems", { | ||
| .read = true, | ||
| }), | ||
| field<&::UserTeamInfo::paid_gems>("gems", { | ||
| .read = true, | ||
| }), | ||
|
|
@@ -129,7 +163,7 @@ PacketInterfaceFor<::UserUnitInfo>::fields() | |
| .update = true, | ||
| .insert = true, | ||
| }), | ||
| field<&::UserUnitInfo::unit_lvl>("unit_lvl", { | ||
| field<&::UserUnitInfo::unit_lvl>("unit_lv", { | ||
| .read = true, | ||
| .update = true, | ||
| .insert = true, | ||
|
|
@@ -149,6 +183,9 @@ PacketInterfaceFor<::UserUnitInfo>::fields() | |
| .update = true, | ||
| .insert = true, | ||
| }), | ||
| // base_rec is INTEGER NOT NULL with NO default, so the INSERT must keep | ||
| // providing it (INSERT OR IGNORE silently drops the row otherwise). Read | ||
| // stays on the canonical column; addUserUnit writes it. | ||
| field<&::UserUnitInfo::base_rec>("base_rec", { | ||
| .read = true, | ||
| .update = true, | ||
|
|
@@ -169,7 +206,7 @@ PacketInterfaceFor<::UserUnitInfo>::fields() | |
| .update = true, | ||
| .insert = true, | ||
| }), | ||
| field<&::UserUnitInfo::ext_rec>("ext_rec", { | ||
| field<&::UserUnitInfo::ext_rec>("ext_heal", { | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why the rename? |
||
| .read = true, | ||
| .update = true, | ||
| .insert = true, | ||
|
|
@@ -194,6 +231,27 @@ PacketInterfaceFor<::UserUnitInfo>::fields() | |
| .update = true, | ||
| .insert = true, | ||
| }), | ||
| // Extras the read/display path was missing — mapped to the quests mirror | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. i actually dont agree with adding everything here - it introduces bloat for example, do we really need to add fe_bp? or leader_skill_id? for each of these fields, we should only add them under 2 conditiions (this applies to every single other field as well)
|
||
| // columns the unit handlers write, so units keep full stats/level/element | ||
| // across a UserInfo reload (previously lost to column defaults). | ||
| field<&::UserUnitInfo::exp>("exp", { .read = true, .update = true, .insert = true, }), | ||
| field<&::UserUnitInfo::total_exp>("total_exp", { .read = true, .update = true, .insert = true, }), | ||
| field<&::UserUnitInfo::add_hp>("add_hp", { .read = true, .update = true, .insert = true, }), | ||
| field<&::UserUnitInfo::add_atk>("add_atk", { .read = true, .update = true, .insert = true, }), | ||
| field<&::UserUnitInfo::add_def>("add_def", { .read = true, .update = true, .insert = true, }), | ||
| field<&::UserUnitInfo::add_rec>("add_heal", { .read = true, .update = true, .insert = true, }), | ||
| field<&::UserUnitInfo::limit_over_hp>("limit_over_hp", { .read = true, .update = true, .insert = true, }), | ||
| field<&::UserUnitInfo::limit_over_atk>("limit_over_atk", { .read = true, .update = true, .insert = true, }), | ||
| field<&::UserUnitInfo::limit_over_def>("limit_over_def", { .read = true, .update = true, .insert = true, }), | ||
| field<&::UserUnitInfo::limit_over_rec>("limit_over_heal", { .read = true, .update = true, .insert = true, }), | ||
| field<&::UserUnitInfo::element>("element", { .read = true, .update = true, .insert = true, }), | ||
| field<&::UserUnitInfo::leader_skill_id>("leader_skill_id", { .read = true, .update = true, .insert = true, }), | ||
| field<&::UserUnitInfo::fe_bp>("fe_bp", { .read = true, .update = true, .insert = true, }), | ||
| field<&::UserUnitInfo::fe_max_usable_bp>("fe_max_usable_bp", { .read = true, .update = true, .insert = true, }), | ||
| field<&::UserUnitInfo::equipitem_id>("eqip_item_id", { .read = true, .update = true, .insert = true, }), | ||
| field<&::UserUnitInfo::equipitem_frame_id>("eqip_item_frame_id", { .read = true, .update = true, .insert = true, }), | ||
| field<&::UserUnitInfo::equipitem_id2>("eqip_item_id2", { .read = true, .update = true, .insert = true, }), | ||
| field<&::UserUnitInfo::equipitem_frame_id2>("eqip_item_frame_id2", { .read = true, .update = true, .insert = true, }), | ||
| field<&::UserUnitInfo::is_new>("new", { | ||
| .read = true, | ||
| .update = true, | ||
|
|
@@ -226,6 +284,37 @@ PacketInterfaceFor<::UserUnitDictionary>::fields() | |
| }; | ||
| } | ||
|
|
||
| /*! | ||
| * Database mapping for owned item stacks stored in user_items. | ||
| */ | ||
| template <> | ||
| inline PacketInterfaceFor<::UserWarehouseInfo>::Fields | ||
| PacketInterfaceFor<::UserWarehouseInfo>::fields() | ||
| { | ||
| return { | ||
| field<&::UserWarehouseInfo::instance_id>("instance_id", { | ||
| .read = true, | ||
| }), | ||
| field<&::UserWarehouseInfo::item_id>("item_id", { | ||
| .read = true, | ||
| .insert = true, | ||
| }), | ||
| field<&::UserWarehouseInfo::item_num>("item_num", { | ||
| .read = true, | ||
| .update = true, | ||
| .insert = true, | ||
| }), | ||
| field<&::UserWarehouseInfo::favorite_flg>("favorite_flg", { | ||
| .read = true, | ||
| .update = true, | ||
| }), | ||
| field<&::UserWarehouseInfo::disp_order>("disp_order", { | ||
| .read = true, | ||
| .update = true, | ||
| }), | ||
| }; | ||
| } | ||
|
|
||
| /*! | ||
| * Database mapping for party deck slots stored in user_decks. | ||
| */ | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I dont understand why this exists, a lot of it seems like duplicates of user units.