feat(all): add hunting and events, commerce and rewards, binary calendars, GameData caching and login diagnostics
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.
This commit is contained in:
@@ -4,11 +4,8 @@ package schedule
|
||||
|
||||
import (
|
||||
"bd2server/internal/server/versionconfig"
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
"math"
|
||||
"os"
|
||||
|
||||
"bd2server/internal/server/wire"
|
||||
)
|
||||
@@ -44,23 +41,6 @@ type Service struct {
|
||||
Regular []RegularSeason `json:"regular"`
|
||||
}
|
||||
|
||||
// Load reads this server's versioned calendar policy. It does not infer live
|
||||
// official seasons from today's clock or from static reward design tables.
|
||||
func Load(path string) (*Service, error) {
|
||||
raw, err := os.ReadFile(path)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("schedule: read seed: %w", err)
|
||||
}
|
||||
var s Service
|
||||
if err := json.Unmarshal(raw, &s); err != nil {
|
||||
return nil, fmt.Errorf("schedule: decode seed: %w", err)
|
||||
}
|
||||
if err := s.Validate(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &s, nil
|
||||
}
|
||||
|
||||
func (s *Service) Validate() error {
|
||||
if s == nil || s.Version != versionconfig.State() || s.CalculateMilliseconds == 0 || s.CalculateMilliseconds > math.MaxInt32 || len(s.Contents) == 0 {
|
||||
return errors.New("schedule: invalid calendar version/calculation interval")
|
||||
|
||||
Reference in New Issue
Block a user