Files
Erupe/cmd/protbot/scenario/quest.go
Houmgaor 0e84377e21 feat(protbot): add headless MHF protocol bot as cmd/protbot
Copy MHBridge into the Erupe module as cmd/protbot/ so it can be
built, tested, and maintained alongside the server. The bot
implements the full sign → entrance → channel login flow and
supports lobby entry, chat, session setup, and quest enumeration.

The conn/ package keeps its own Blowfish crypto primitives to avoid
importing erupe-ce/config (which requires a config file at init).
2026-02-20 02:49:23 +01:00

32 lines
947 B
Go

package scenario
import (
"fmt"
"time"
"erupe-ce/cmd/protbot/protocol"
)
// EnumerateQuests sends MSG_MHF_ENUMERATE_QUEST and returns the raw quest list data.
func EnumerateQuests(ch *protocol.ChannelConn, world uint8, counter uint16) ([]byte, error) {
ack := ch.NextAckHandle()
pkt := protocol.BuildEnumerateQuestPacket(ack, world, counter, 0)
fmt.Printf("[quest] Sending MSG_MHF_ENUMERATE_QUEST (world=%d, counter=%d, ackHandle=%d)...\n",
world, counter, ack)
if err := ch.SendPacket(pkt); err != nil {
return nil, fmt.Errorf("enumerate quest send: %w", err)
}
resp, err := ch.WaitForAck(ack, 15*time.Second)
if err != nil {
return nil, fmt.Errorf("enumerate quest ack: %w", err)
}
if resp.ErrorCode != 0 {
return nil, fmt.Errorf("enumerate quest failed: error code %d", resp.ErrorCode)
}
fmt.Printf("[quest] ENUMERATE_QUEST ACK (error=%d, %d bytes data)\n",
resp.ErrorCode, len(resp.Data))
return resp.Data, nil
}