mirror of
https://github.com/Mezeporta/Erupe.git
synced 2026-03-22 07:32:32 +01:00
feat(campaign): implement Event Tent campaign system
Adds the full campaign/event-tent feature: Packet layer: - MsgMhfApplyCampaign: Unk0/Unk1/Unk2 → CampaignID/Code (null-terminated 16-byte string) - MsgMhfAcquireItem: Unk0/Length/Unk1 → RewardIDs []uint32 - MsgMhfEnumerateItem: remove Unk0/Unk1 (RE'd: zeroed + always-2, ignored) - MsgMhfStateCampaign: Unk1 → NullPadding (RE'd: always zero) - MsgMhfTransferItem: Unk0/Unk1/Unk2 → QuestID/ItemType/Quantity (RE'd) Handler layer (handlers_campaign.go): - handleMsgMhfEnumerateCampaign: reads campaigns, categories, links from DB; prefix moved into pascal string slot 3 of each event entry (RE confirmed 3-section response format — removes spurious intermediate section) - handleMsgMhfStateCampaign: returns stamp count and redeemable flag - handleMsgMhfApplyCampaign: validates and records code redemption - handleMsgMhfEnumerateItem: lists rewards gated by stamp count - handleMsgMhfAcquireItem: marks rewards as claimed - handleMsgMhfTransferItem: records campaign quest completion (item_type=9) Quest gating (handlers_quest.go): - makeEventQuest: for QuestTypeSpecialTool, check campaign stamp count and deadline before allowing the quest (WriteBool true/false) Database: - 0010_campaign.sql: 8-table schema (campaigns, categories, links, rewards, claimed, state, codes, quest) - CampaignDemo.sql: community-researched live game campaign data
This commit is contained in:
@@ -11,9 +11,7 @@ import (
|
||||
// MsgMhfAcquireItem represents the MSG_MHF_ACQUIRE_ITEM
|
||||
type MsgMhfAcquireItem struct {
|
||||
AckHandle uint32
|
||||
Unk0 uint16
|
||||
Length uint16
|
||||
Unk1 []uint32
|
||||
RewardIDs []uint32
|
||||
}
|
||||
|
||||
// Opcode returns the ID associated with this packet type.
|
||||
@@ -24,10 +22,10 @@ func (m *MsgMhfAcquireItem) Opcode() network.PacketID {
|
||||
// Parse parses the packet from binary
|
||||
func (m *MsgMhfAcquireItem) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
|
||||
m.AckHandle = bf.ReadUint32()
|
||||
m.Unk0 = bf.ReadUint16()
|
||||
m.Length = bf.ReadUint16()
|
||||
for i := 0; i < int(m.Length); i++ {
|
||||
m.Unk1 = append(m.Unk1, bf.ReadUint32())
|
||||
bf.ReadUint16() // Zeroed
|
||||
ids := bf.ReadUint16()
|
||||
for i := uint16(0); i < ids; i++ {
|
||||
m.RewardIDs = append(m.RewardIDs, bf.ReadUint32())
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ package mhfpacket
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"erupe-ce/common/bfutil"
|
||||
"erupe-ce/common/byteframe"
|
||||
"erupe-ce/network"
|
||||
"erupe-ce/network/clientctx"
|
||||
@@ -9,10 +10,9 @@ import (
|
||||
|
||||
// MsgMhfApplyCampaign represents the MSG_MHF_APPLY_CAMPAIGN
|
||||
type MsgMhfApplyCampaign struct {
|
||||
AckHandle uint32
|
||||
Unk0 uint32
|
||||
Unk1 uint16
|
||||
Unk2 []byte
|
||||
AckHandle uint32
|
||||
CampaignID uint32
|
||||
Code string
|
||||
}
|
||||
|
||||
// Opcode returns the ID associated with this packet type.
|
||||
@@ -23,9 +23,9 @@ func (m *MsgMhfApplyCampaign) Opcode() network.PacketID {
|
||||
// Parse parses the packet from binary
|
||||
func (m *MsgMhfApplyCampaign) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
|
||||
m.AckHandle = bf.ReadUint32()
|
||||
m.Unk0 = bf.ReadUint32()
|
||||
m.Unk1 = bf.ReadUint16()
|
||||
m.Unk2 = bf.ReadBytes(16)
|
||||
m.CampaignID = bf.ReadUint32()
|
||||
bf.ReadUint16() // Zeroed
|
||||
m.Code = string(bfutil.UpToNull(bf.ReadBytes(16)))
|
||||
return nil
|
||||
}
|
||||
|
||||
|
||||
@@ -11,8 +11,6 @@ import (
|
||||
// MsgMhfEnumerateItem represents the MSG_MHF_ENUMERATE_ITEM
|
||||
type MsgMhfEnumerateItem struct {
|
||||
AckHandle uint32
|
||||
Unk0 uint16
|
||||
Unk1 uint16
|
||||
CampaignID uint32
|
||||
}
|
||||
|
||||
@@ -24,8 +22,8 @@ func (m *MsgMhfEnumerateItem) Opcode() network.PacketID {
|
||||
// Parse parses the packet from binary
|
||||
func (m *MsgMhfEnumerateItem) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
|
||||
m.AckHandle = bf.ReadUint32()
|
||||
m.Unk0 = bf.ReadUint16()
|
||||
m.Unk1 = bf.ReadUint16()
|
||||
bf.ReadUint16() // Zeroed
|
||||
bf.ReadUint16() // Always 2
|
||||
m.CampaignID = bf.ReadUint32()
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -10,9 +10,9 @@ import (
|
||||
|
||||
// MsgMhfStateCampaign represents the MSG_MHF_STATE_CAMPAIGN
|
||||
type MsgMhfStateCampaign struct {
|
||||
AckHandle uint32
|
||||
CampaignID uint32
|
||||
Unk1 uint16
|
||||
AckHandle uint32
|
||||
CampaignID uint32
|
||||
NullPadding uint16
|
||||
}
|
||||
|
||||
// Opcode returns the ID associated with this packet type.
|
||||
@@ -24,7 +24,7 @@ func (m *MsgMhfStateCampaign) Opcode() network.PacketID {
|
||||
func (m *MsgMhfStateCampaign) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
|
||||
m.AckHandle = bf.ReadUint32()
|
||||
m.CampaignID = bf.ReadUint32()
|
||||
m.Unk1 = bf.ReadUint16()
|
||||
m.NullPadding = bf.ReadUint16() //0 in Z2
|
||||
return nil
|
||||
}
|
||||
|
||||
|
||||
@@ -11,12 +11,9 @@ import (
|
||||
// MsgMhfTransferItem represents the MSG_MHF_TRANSFER_ITEM
|
||||
type MsgMhfTransferItem struct {
|
||||
AckHandle uint32
|
||||
// looking at packets, these were static across sessions and did not actually
|
||||
// correlate with any item IDs that would make sense to get after quests so
|
||||
// I have no idea what this actually does
|
||||
Unk0 uint32
|
||||
Unk1 uint8
|
||||
Unk2 uint16
|
||||
QuestID uint32
|
||||
ItemType uint8
|
||||
Quantity uint16
|
||||
}
|
||||
|
||||
// Opcode returns the ID associated with this packet type.
|
||||
@@ -27,10 +24,10 @@ func (m *MsgMhfTransferItem) Opcode() network.PacketID {
|
||||
// Parse parses the packet from binary
|
||||
func (m *MsgMhfTransferItem) Parse(bf *byteframe.ByteFrame, ctx *clientctx.ClientContext) error {
|
||||
m.AckHandle = bf.ReadUint32()
|
||||
m.Unk0 = bf.ReadUint32()
|
||||
m.Unk1 = bf.ReadUint8()
|
||||
m.QuestID = bf.ReadUint32()
|
||||
m.ItemType = bf.ReadUint8()
|
||||
bf.ReadUint8() // Zeroed
|
||||
m.Unk2 = bf.ReadUint16()
|
||||
m.Quantity = bf.ReadUint16()
|
||||
return nil
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user