39 lines
858 B
Go
39 lines
858 B
Go
package world
|
|
|
|
import (
|
|
"bd2server/internal/server/todayquest"
|
|
"fmt"
|
|
)
|
|
|
|
func (s *Service) AttachTodayQuests(service *todayquest.Service) error {
|
|
if service == nil {
|
|
return fmt.Errorf("world: nil commission service")
|
|
}
|
|
s.todayQuests = service
|
|
return nil
|
|
}
|
|
|
|
// NPCController checks whether any owned pack has completed its main story,
|
|
// rather than requiring completion of the board's own pack.
|
|
func (s *Service) CommissionPackUnlocked(pack int) bool {
|
|
if !s.packUnlocked(pack) || s.storyCatalog == nil {
|
|
return false
|
|
}
|
|
for id, design := range s.storyCatalog.Packs {
|
|
if !s.packUnlocked(id) || len(design.MainQuestIDs) == 0 {
|
|
continue
|
|
}
|
|
complete := true
|
|
for _, quest := range design.MainQuestIDs {
|
|
if !s.state.QuestCleared(quest, id, 0) {
|
|
complete = false
|
|
break
|
|
}
|
|
}
|
|
if complete {
|
|
return true
|
|
}
|
|
}
|
|
return false
|
|
}
|