Implement hunting AP and progress, event tasks, exchanges, games, stories and actions; connect battle and reward handling. Add CashShop plugin and installation, server purchases and entitlements, recharge rules and plugin version metadata. Distribute binary calendars independently; cache GameData in memory and fix single-connection query deadlocks. Improve automatic login and recovery diagnostics; document configuration and release flows.
40 lines
961 B
Go
40 lines
961 B
Go
package commerce
|
|
|
|
import "bd2server/internal/server/wire"
|
|
|
|
type PackInfoHandler struct {
|
|
World attendanceHandler
|
|
Claims *ClearPackages
|
|
}
|
|
|
|
func (h PackInfoHandler) Handle(path string, request []byte) (int, []byte, bool, error) {
|
|
if path != "/PackInfo" {
|
|
return 0, nil, false, nil
|
|
}
|
|
code, response, handled, err := h.World.Handle(path, request)
|
|
if err != nil || !handled {
|
|
return code, response, handled, err
|
|
}
|
|
pack, evil, err := h.Claims.RewardDBInfos()
|
|
if err != nil {
|
|
return code, nil, true, err
|
|
}
|
|
var result []byte
|
|
err = wire.Walk(response, func(field wire.Field) error {
|
|
if field.Number != 3 && field.Number != 4 {
|
|
result = append(result, response[field.Start:field.End]...)
|
|
}
|
|
return nil
|
|
})
|
|
if err != nil {
|
|
return code, nil, true, err
|
|
}
|
|
for _, info := range pack {
|
|
result = wire.AppendBytes(result, 3, info)
|
|
}
|
|
for _, info := range evil {
|
|
result = wire.AppendBytes(result, 4, info)
|
|
}
|
|
return code, result, true, nil
|
|
}
|