feat(diva): implement Diva Defense point accumulation (#168)

RE'd putAdd_ud_point (FUN_114fd490) and putAdd_ud_tactics_point
(FUN_114fe9c0) from the ZZ client DLL via Ghidra decompilation.

MsgMhfAddUdPoint fields: QuestPoints (sum of 11 category accumulators
earned per quest) and BonusPoints (kiju prayer song multiplier extra).
MsgMhfAddUdTacticsPoint fields: QuestID and TacticsPoints.

Adds diva_points table (migration 0009) for per-character per-event
point tracking, with UPSERT-based atomic accumulation in the handler.
This commit is contained in:
Houmgaor
2026-03-18 12:09:44 +01:00
parent 61d85e749f
commit 792dcd5d91
10 changed files with 217 additions and 18 deletions

View File

@@ -1094,12 +1094,58 @@ func (m *mockRengokuRepo) GetRanking(_ uint32, _ uint32) ([]RengokuScore, error)
type mockDivaRepo struct {
events []DivaEvent
eventsErr error
// Point tracking for tests
points map[[2]uint32][2]int64 // [charID, eventID] -> [questPoints, bonusPoints]
addErr error
getErr error
totalErr error
}
func (m *mockDivaRepo) DeleteEvents() error { return nil }
func (m *mockDivaRepo) InsertEvent(_ uint32) error { return nil }
func (m *mockDivaRepo) GetEvents() ([]DivaEvent, error) { return m.events, m.eventsErr }
func (m *mockDivaRepo) AddPoints(charID, eventID, questPoints, bonusPoints uint32) error {
if m.addErr != nil {
return m.addErr
}
if m.points == nil {
m.points = make(map[[2]uint32][2]int64)
}
key := [2]uint32{charID, eventID}
cur := m.points[key]
cur[0] += int64(questPoints)
cur[1] += int64(bonusPoints)
m.points[key] = cur
return nil
}
func (m *mockDivaRepo) GetPoints(charID, eventID uint32) (int64, int64, error) {
if m.getErr != nil {
return 0, 0, m.getErr
}
if m.points == nil {
return 0, 0, nil
}
p := m.points[[2]uint32{charID, eventID}]
return p[0], p[1], nil
}
func (m *mockDivaRepo) GetTotalPoints(eventID uint32) (int64, int64, error) {
if m.totalErr != nil {
return 0, 0, m.totalErr
}
var tq, tb int64
for k, v := range m.points {
if k[1] == eventID {
tq += v[0]
tb += v[1]
}
}
return tq, tb, nil
}
// --- mockEventRepo ---
type mockEventRepo struct {