Update GaCy-GO
This commit is contained in:
1 parent
da8a32f60d
commit
0cbe460e49
345 files changed
+98202
-77559
No files matched your search
@@ -4,7 +4,6 @@ import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"gac-hkrpg-go/internal/common"
|
||||
"os"
|
||||
"sort"
|
||||
"sync"
|
||||
|
||||
@@ -60,18 +59,19 @@ type StageBattleData struct {
|
||||
}
|
||||
|
||||
type PeakStageData struct {
|
||||
Entrance uint32 `json:"-"`
|
||||
Group uint32 `json:"-"`
|
||||
GroupID uint32 `json:"-"`
|
||||
Buffs []uint32 `json:"-"`
|
||||
HardBuffs []uint32 `json:"-"`
|
||||
EventID uint32 `json:"event_id"`
|
||||
HardEventID uint32 `json:"hard_event_id"`
|
||||
MonsterID uint32 `json:"monster_id"`
|
||||
DefaultBuff uint32 `json:"default_buff"`
|
||||
IsBoss bool `json:"is_boss"`
|
||||
Targets []uint32 `json:"targets"`
|
||||
HardTarget uint32 `json:"hard_target"`
|
||||
SceneResourceError string `json:"-"`
|
||||
Entrance uint32 `json:"-"`
|
||||
Group uint32 `json:"-"`
|
||||
GroupID uint32 `json:"-"`
|
||||
Buffs []uint32 `json:"-"`
|
||||
HardBuffs []uint32 `json:"-"`
|
||||
EventID uint32 `json:"event_id"`
|
||||
HardEventID uint32 `json:"hard_event_id"`
|
||||
MonsterID uint32 `json:"monster_id"`
|
||||
DefaultBuff uint32 `json:"default_buff"`
|
||||
IsBoss bool `json:"is_boss"`
|
||||
Targets []uint32 `json:"targets"`
|
||||
HardTarget uint32 `json:"hard_target"`
|
||||
}
|
||||
|
||||
var (
|
||||
@@ -81,7 +81,7 @@ var (
|
||||
|
||||
func getChallengeData() *ChallengeDataConfig {
|
||||
challengeOnce.Do(func() {
|
||||
raw, err := os.ReadFile("challenge_data.json")
|
||||
raw, err := common.ReadResourceFile("challenge_data.json")
|
||||
if err != nil {
|
||||
Log("challenge_data.json not found!")
|
||||
return
|
||||
@@ -241,6 +241,7 @@ func loadPeakResources(data *ChallengeDataConfig) {
|
||||
}
|
||||
}
|
||||
}
|
||||
applyPeakSceneOverrides(data)
|
||||
}
|
||||
|
||||
func lastResourceID(ids []uint32) uint32 {
|
||||
@@ -388,7 +389,6 @@ func init() {
|
||||
|
||||
handle("GetChallengePeakData", func(s *Session, req *goproto.GetChallengePeakDataCsReq, rsp *goproto.GetChallengePeakDataScRsp) error {
|
||||
rsp.Retcode = 0
|
||||
rsp.CurrentPeakGroupId = 1
|
||||
|
||||
cd := getChallengeData()
|
||||
type stageEntry struct {
|
||||
@@ -401,30 +401,44 @@ func init() {
|
||||
if _, err := fmt.Sscanf(k, "%d", &id); err != nil {
|
||||
continue
|
||||
}
|
||||
g := id / 100
|
||||
g := stage.GroupID
|
||||
if g == 0 {
|
||||
continue
|
||||
}
|
||||
groups[g] = append(groups[g], stageEntry{id, stage})
|
||||
}
|
||||
|
||||
if len(groups) == 0 {
|
||||
peakGroup := &goproto.ChallengePeakGroup{
|
||||
PeakGroupId: 1,
|
||||
ObtainedStars: 9,
|
||||
CountOfPeaks: 3,
|
||||
DisableHardMode: false,
|
||||
TakenStarRewards: []uint32{1, 2, 3, 4, 5, 6, 7, 8, 9},
|
||||
}
|
||||
for peakID := uint32(1); peakID <= 3; peakID++ {
|
||||
peakGroup.Peaks = append(peakGroup.Peaks, &goproto.ChallengePeak{
|
||||
PeakId: peakID,
|
||||
HasPassed: true,
|
||||
FinishedTargetList: []uint32{1, 2, 3, 4, 5},
|
||||
})
|
||||
}
|
||||
rsp.ChallengePeakGroups = append(rsp.ChallengePeakGroups, peakGroup)
|
||||
// Never replace a missing catalog with a fabricated round: doing so
|
||||
// silently discards a valid Srtool choice and advertises wrong rooms.
|
||||
rsp.Retcode = uint32(goproto.Retcode_RET_CHALLENGE_NOT_EXIST)
|
||||
PacketLog("PEAK_DATA rejected: no resource-backed AA groups")
|
||||
return nil
|
||||
}
|
||||
|
||||
groupIDs := sortedU32Keys2(groups)
|
||||
if len(groupIDs) != 0 {
|
||||
rsp.CurrentPeakGroupId = groupIDs[0]
|
||||
}
|
||||
if selection, err := common.ReadAARoundSelection(); err != nil {
|
||||
SceneDebugLog("[PEAK] failed to read Srtool AA round selection: %v", err)
|
||||
} else if selection != nil {
|
||||
if _, exists := groups[selection.PeakGroupID]; exists {
|
||||
rsp.CurrentPeakGroupId = selection.PeakGroupID
|
||||
SceneDebugLog("[PEAK] Srtool selected AA round: group=%d", selection.PeakGroupID)
|
||||
} else {
|
||||
SceneDebugLog("[PEAK] Srtool AA round %d is missing from the loaded Client challenge data", selection.PeakGroupID)
|
||||
}
|
||||
}
|
||||
// Selection changes made in Srtool apply after leaving the existing
|
||||
// challenge. A data refresh during reconnect must not change the active
|
||||
// round underneath a running/settled Peak session.
|
||||
if run := s.ChallengeRun; run != nil && run.Peak {
|
||||
if stage, exists := cd.Peak[itoa(int(run.ID))]; exists && stage.GroupID != 0 {
|
||||
rsp.CurrentPeakGroupId = stage.GroupID
|
||||
}
|
||||
}
|
||||
PacketLog(fmt.Sprintf("PEAK_DATA current_group=%d groups=%d active_run=%t", rsp.CurrentPeakGroupId, len(groups), s.ChallengeRun != nil))
|
||||
for _, groupID := range groupIDs {
|
||||
stages := groups[groupID]
|
||||
sort.Slice(stages, func(i, j int) bool { return stages[i].id < stages[j].id })
|
||||
@@ -502,6 +516,13 @@ func init() {
|
||||
for _, schedule := range cw.ActivitySchedules() {
|
||||
add(schedule.ModuleID, schedule.ActivityID)
|
||||
}
|
||||
previews, err := common.LoadPreviewActivitySchedules()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
for _, schedule := range previews {
|
||||
add(schedule.ModuleID, schedule.PanelID)
|
||||
}
|
||||
return nil
|
||||
})
|
||||
}
|
||||
Reference in new issue
Block a user