pre cw with probe and a bunch script to read game behavior
This commit is contained in:
1 parent
5120219ae2
commit
da8a32f60d
310 files changed
+219693
-872
No files matched your search
@@ -0,0 +1,59 @@
|
||||
package gameserver
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
|
||||
"gac-hkrpg-go/internal/common"
|
||||
)
|
||||
|
||||
type peakBattleRules struct {
|
||||
ClientVersion string `json:"client_version"`
|
||||
Source struct {
|
||||
AssemblySHA256 string `json:"assembly_sha256"`
|
||||
CaptureSHA256 string `json:"capture_sha256"`
|
||||
} `json:"source"`
|
||||
TurnLimits map[string]uint32 `json:"turn_limits"`
|
||||
}
|
||||
|
||||
func (r peakBattleRules) limit(stage PeakStageData, event uint32) (uint32, error) {
|
||||
name := "ChallengePeak_Mob_Turn_Limit"
|
||||
if stage.IsBoss {
|
||||
name = "ChallengePeak_Boss_Turn_Limit"
|
||||
if stage.HardEventID != 0 && event == stage.HardEventID {
|
||||
name = "ChallengePeak_HardBoss_Turn_Limit"
|
||||
}
|
||||
}
|
||||
limit := r.TurnLimits[name]
|
||||
if limit == 0 {
|
||||
return 0, fmt.Errorf("missing native Peak constant %s", name)
|
||||
}
|
||||
return limit, nil
|
||||
}
|
||||
|
||||
func setPeakBattleConfig(s *Session, avatars []uint32, peakID, eventID uint32, buffs []uint32) error {
|
||||
raw, err := common.ReadResourceFile("resources/PeakBattleConfig.json")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
var rules peakBattleRules
|
||||
if err := json.Unmarshal(raw, &rules); err != nil {
|
||||
return err
|
||||
}
|
||||
cfg, err := common.LoadRuntimeConfig()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if rules.ClientVersion != cfg.ClientVersion || len(rules.Source.AssemblySHA256) != 64 || len(rules.Source.CaptureSHA256) != 64 {
|
||||
return fmt.Errorf("Peak rules require matching Client version and capture provenance")
|
||||
}
|
||||
stage, ok := getChallengeData().Peak[itoa(int(peakID))]
|
||||
if !ok || (eventID != stage.EventID && (stage.HardEventID == 0 || eventID != stage.HardEventID)) {
|
||||
return fmt.Errorf("Peak %d has no matching event %d", peakID, eventID)
|
||||
}
|
||||
limit, err := rules.limit(stage, eventID)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return setChallengeBattleConfigWithLimit(s, avatars, peakID, eventID, buffs, common.BattleTypeAA, limit)
|
||||
}
|
||||
Reference in new issue
Block a user