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.
36 lines
1.1 KiB
Go
36 lines
1.1 KiB
Go
package world
|
|
|
|
import "fmt"
|
|
|
|
func (s *Service) AttachHuntingGround(provider interface{ EnsureForPack(int) ([]byte, error) }) error {
|
|
if provider == nil {
|
|
return fmt.Errorf("world: missing hunting ground provider")
|
|
}
|
|
s.huntingGround = provider
|
|
return nil
|
|
}
|
|
|
|
// HuntingEligibility follows the hunting tutorial: hard/extreme grounds need
|
|
// completion of the same story difficulty, independently of the last hunt boss.
|
|
func (s *Service) HuntingEligibility(pack int, difficulty uint64) error {
|
|
if difficulty > 2 || !s.packUnlocked(pack) {
|
|
return fmt.Errorf("world: hunting pack or difficulty locked")
|
|
}
|
|
if difficulty == 0 {
|
|
return nil
|
|
}
|
|
if s.storyCatalog == nil {
|
|
return fmt.Errorf("world: hunting story design unavailable")
|
|
}
|
|
d, ok := s.storyCatalog.Packs[pack]
|
|
if !ok || len(d.MainQuestIDs) == 0 || !s.questDifficulties[pack][int(difficulty)] {
|
|
return fmt.Errorf("world: hunting difficulty unavailable")
|
|
}
|
|
for _, id := range d.MainQuestIDs {
|
|
if !s.state.QuestCleared(id, pack, int(difficulty)) {
|
|
return fmt.Errorf("world: hunting requires completed story difficulty")
|
|
}
|
|
}
|
|
return nil
|
|
}
|