mirror of
https://github.com/Mezeporta/Erupe.git
synced 2026-03-22 07:32:32 +01:00
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:
@@ -1,18 +1,21 @@
|
||||
package mhfpacket
|
||||
|
||||
import (
|
||||
"errors"
|
||||
|
||||
"erupe-ce/common/byteframe"
|
||||
"erupe-ce/network"
|
||||
"erupe-ce/network/clientctx"
|
||||
)
|
||||
|
||||
// MsgMhfAddUdPoint represents the MSG_MHF_ADD_UD_POINT
|
||||
//
|
||||
// Sent by the client after completing a Diva Defense quest to report earned points.
|
||||
// RE'd from ZZ DLL putAdd_ud_point (FUN_114fd490): the client sums 11 point
|
||||
// category accumulators into QuestPoints, and computes BonusPoints from the
|
||||
// kiju prayer song multiplier applied to the base categories.
|
||||
type MsgMhfAddUdPoint struct {
|
||||
AckHandle uint32
|
||||
Unk1 uint32
|
||||
Unk2 uint32
|
||||
AckHandle uint32
|
||||
QuestPoints uint32 // Total points earned from the quest (sum of all categories)
|
||||
BonusPoints uint32 // Extra points from kiju/prayer song multiplier
|
||||
}
|
||||
|
||||
// Opcode returns the ID associated with this packet type.
|
||||
@@ -23,13 +26,15 @@ func (m *MsgMhfAddUdPoint) Opcode() network.PacketID {
|
||||
// Parse parses the packet from binary
|
||||
func (m *MsgMhfAddUdPoint) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
|
||||
m.AckHandle = bf.ReadUint32()
|
||||
m.Unk1 = bf.ReadUint32()
|
||||
m.Unk2 = bf.ReadUint32()
|
||||
// TODO: Parse is a stub — field meanings unknown
|
||||
m.QuestPoints = bf.ReadUint32()
|
||||
m.BonusPoints = bf.ReadUint32()
|
||||
return nil
|
||||
}
|
||||
|
||||
// Build builds a binary packet from the current data.
|
||||
func (m *MsgMhfAddUdPoint) Build(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
|
||||
return errors.New("NOT IMPLEMENTED")
|
||||
bf.WriteUint32(m.AckHandle)
|
||||
bf.WriteUint32(m.QuestPoints)
|
||||
bf.WriteUint32(m.BonusPoints)
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -7,10 +7,14 @@ import (
|
||||
)
|
||||
|
||||
// MsgMhfAddUdTacticsPoint represents the MSG_MHF_ADD_UD_TACTICS_POINT
|
||||
//
|
||||
// Sent during Diva Defense interception phase to report tactics points.
|
||||
// RE'd from ZZ DLL putAdd_ud_tactics_point (FUN_114fe9c0): QuestID is read
|
||||
// from a character data field, TacticsPoints is the accumulated tactics value.
|
||||
type MsgMhfAddUdTacticsPoint struct {
|
||||
AckHandle uint32
|
||||
Unk0 uint16
|
||||
Unk1 uint32
|
||||
AckHandle uint32
|
||||
QuestID uint16 // Quest/character identifier from savedata
|
||||
TacticsPoints uint32 // Accumulated tactics interception points
|
||||
}
|
||||
|
||||
// Opcode returns the ID associated with this packet type.
|
||||
@@ -21,15 +25,15 @@ func (m *MsgMhfAddUdTacticsPoint) Opcode() network.PacketID {
|
||||
// Parse parses the packet from binary
|
||||
func (m *MsgMhfAddUdTacticsPoint) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
|
||||
m.AckHandle = bf.ReadUint32()
|
||||
m.Unk0 = bf.ReadUint16()
|
||||
m.Unk1 = bf.ReadUint32()
|
||||
m.QuestID = bf.ReadUint16()
|
||||
m.TacticsPoints = bf.ReadUint32()
|
||||
return nil
|
||||
}
|
||||
|
||||
// Build builds a binary packet from the current data.
|
||||
func (m *MsgMhfAddUdTacticsPoint) Build(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
|
||||
bf.WriteUint32(m.AckHandle)
|
||||
bf.WriteUint16(m.Unk0)
|
||||
bf.WriteUint32(m.Unk1)
|
||||
bf.WriteUint16(m.QuestID)
|
||||
bf.WriteUint32(m.TacticsPoints)
|
||||
return nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user