feat(currency_wars): complete systems, settlement Rank SS, damage report, camera and recovery fixes
This commit is contained in:
1 parent
c008243f11
commit
0995055296
78 files changed
+33840
-9525
No files matched your search
@@ -116,7 +116,9 @@ func init() {
|
||||
rsp.Retcode = uint32(goproto.Retcode_RET_GRID_FIGHT_PARAM_NOT_MATCH)
|
||||
return nil
|
||||
}
|
||||
if revision != s.currencyWarsRevision {
|
||||
if s.currencyWarsRevision == 0 {
|
||||
s.currencyWarsRevision = revision
|
||||
} else if revision != s.currencyWarsRevision {
|
||||
rsp.Retcode = uint32(goproto.Retcode_RET_GRID_FIGHT_PARAM_NOT_MATCH)
|
||||
return nil
|
||||
}
|
||||
@@ -144,13 +146,16 @@ func init() {
|
||||
return nil
|
||||
}
|
||||
addedSpotlights := cwEnsureSpotlights(data.DHFOFLFCLAH)
|
||||
if len(groups) > 0 || addedSpotlights {
|
||||
if e = s.saveCurrencyWarsData(data, catalog); e != nil {
|
||||
runtime, _ := cwBonfireRuntime(catalog, data.DHFOFLFCLAH)
|
||||
cwSyncTraitComponent(catalog, data.DHFOFLFCLAH, runtime)
|
||||
recovered, _ := s.cwRecoverMissingPendingAction(data, catalog)
|
||||
if len(groups) > 0 || addedSpotlights || recovered {
|
||||
if e = s.saveCurrencyWarsDataWithRuntime(data, catalog, runtime); e != nil {
|
||||
return nil
|
||||
}
|
||||
// Resume is followed by GetData. Return the reconciled roster in
|
||||
// that snapshot, after the Client constructs its game session.
|
||||
PacketLog(fmt.Sprintf("CW_RESUME merged=%d revision=%d", len(groups), s.currencyWarsRevision))
|
||||
PacketLog(fmt.Sprintf("CW_RESUME merged=%d recovered=%t revision=%d", len(groups), recovered, s.currencyWarsRevision))
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -172,10 +177,74 @@ func init() {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
rsp.NFEDANFBIBE = &goproto.GAAMBBFPCHB{EndTime: *cfg.ActivitySchedule.EndTime}
|
||||
PacketLog(fmt.Sprintf("CYCLE_SCORE_REWARD_DATA end_time=%d score=0 bootstrap=true policy=activity_window", *cfg.ActivitySchedule.EndTime))
|
||||
rsp.NFEDANFBIBE = &goproto.GAAMBBFPCHB{
|
||||
EndTime: *cfg.ActivitySchedule.EndTime,
|
||||
}
|
||||
if cfg.ActivitySchedule.BeginTime != nil {
|
||||
rsp.NFEDANFBIBE.IFEPJHGNCOI = *cfg.ActivitySchedule.BeginTime
|
||||
}
|
||||
if scoreCatalog, err := common.LoadCurrencyWarsScore(nil); err == nil {
|
||||
rsp.NFEDANFBIBE.PMJGAJGIFOA = scoreCatalog.WeeklyCap
|
||||
for _, r := range scoreCatalog.WeeklyRanks {
|
||||
rsp.NFEDANFBIBE.OPLNKCOLCKJ = append(rsp.NFEDANFBIBE.OPLNKCOLCKJ, r.Rank)
|
||||
}
|
||||
}
|
||||
PacketLog(fmt.Sprintf("CYCLE_SCORE_REWARD_DATA end_time=%d weekly_cap=%d ranks=%d policy=score_catalog", *cfg.ActivitySchedule.EndTime, rsp.NFEDANFBIBE.PMJGAJGIFOA, len(rsp.NFEDANFBIBE.OPLNKCOLCKJ)))
|
||||
return nil
|
||||
})
|
||||
|
||||
handle("CycleScoreRewardTakeReward", func(s *Session, req *goproto.CycleScoreRewardTakeRewardCsReq, rsp *goproto.CycleScoreRewardTakeRewardScRsp) error {
|
||||
cfg, err := common.LoadRuntimeConfig()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
rsp.Reward = &goproto.ItemList{}
|
||||
if req != nil {
|
||||
rsp.NGKOFMBBGNL = append(rsp.NGKOFMBBGNL, req.JKCEBHFIENI...)
|
||||
}
|
||||
rsp.NFEDANFBIBE = &goproto.GAAMBBFPCHB{
|
||||
EndTime: *cfg.ActivitySchedule.EndTime,
|
||||
}
|
||||
if cfg.ActivitySchedule.BeginTime != nil {
|
||||
rsp.NFEDANFBIBE.IFEPJHGNCOI = *cfg.ActivitySchedule.BeginTime
|
||||
}
|
||||
if scoreCatalog, err := common.LoadCurrencyWarsScore(nil); err == nil {
|
||||
rsp.NFEDANFBIBE.PMJGAJGIFOA = scoreCatalog.WeeklyCap
|
||||
for _, r := range scoreCatalog.WeeklyRanks {
|
||||
rsp.NFEDANFBIBE.OPLNKCOLCKJ = append(rsp.NFEDANFBIBE.OPLNKCOLCKJ, r.Rank)
|
||||
}
|
||||
}
|
||||
rsp.Retcode = 0
|
||||
PacketLog(fmt.Sprintf("CYCLE_SCORE_REWARD_TAKE claims=%v", rsp.NGKOFMBBGNL))
|
||||
return nil
|
||||
})
|
||||
|
||||
cwHandle("GridFightTakeWeeklyReward", func(s *Session, req *goproto.GridFightTakeWeeklyRewardCsReq, rsp *goproto.GridFightTakeWeeklyRewardScRsp) error {
|
||||
cfg, err := common.LoadRuntimeConfig()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
rsp.Reward = &goproto.ItemList{}
|
||||
if req != nil {
|
||||
rsp.NGKOFMBBGNL = append(rsp.NGKOFMBBGNL, req.JKCEBHFIENI...)
|
||||
}
|
||||
rsp.MGBNEAHCDMA = &goproto.NDLNIKCCALK{
|
||||
EndTime: *cfg.ActivitySchedule.EndTime,
|
||||
}
|
||||
if cfg.ActivitySchedule.BeginTime != nil {
|
||||
rsp.MGBNEAHCDMA.IFEPJHGNCOI = *cfg.ActivitySchedule.BeginTime
|
||||
}
|
||||
if scoreCatalog, err := common.LoadCurrencyWarsScore(nil); err == nil {
|
||||
rsp.MGBNEAHCDMA.EDHKHJAPMKA = scoreCatalog.WeeklyCap
|
||||
for _, r := range scoreCatalog.WeeklyRanks {
|
||||
rsp.MGBNEAHCDMA.OPLNKCOLCKJ = append(rsp.MGBNEAHCDMA.OPLNKCOLCKJ, r.Rank)
|
||||
}
|
||||
}
|
||||
rsp.Retcode = 0
|
||||
PacketLog(fmt.Sprintf("CW_TAKE_WEEKLY_REWARD claims=%v", rsp.NGKOFMBBGNL))
|
||||
return nil
|
||||
})
|
||||
|
||||
// Bootstrap only. Keep the danger-family guard for every unsupported CW
|
||||
// operation; it must never receive a successful empty gameplay response.
|
||||
cwHandle("GridFightGetData", func(s *Session, req *goproto.GridFightGetDataCsReq, rsp *goproto.GridFightGetDataScRsp) error {
|
||||
@@ -188,10 +257,21 @@ func init() {
|
||||
return err
|
||||
}
|
||||
if saved != nil {
|
||||
proto.Merge(rsp, saved)
|
||||
s.currencyWarsRevision = revision
|
||||
s.currencyWarsOpen = saved.DHFOFLFCLAH != nil
|
||||
PacketLog(fmt.Sprintf("CW_GET_DATA restored=true revision=%d active_run=%t", revision, saved.DHFOFLFCLAH != nil))
|
||||
if saved.DHFOFLFCLAH != nil {
|
||||
runtime, _ := cwBonfireRuntime(catalog, saved.DHFOFLFCLAH)
|
||||
cwSyncTraitComponent(catalog, saved.DHFOFLFCLAH, runtime)
|
||||
if recovered, recErr := s.cwRecoverMissingPendingAction(saved, catalog); recErr != nil {
|
||||
PacketLog("CW_GET_DATA recovery failed: " + recErr.Error())
|
||||
} else if recovered {
|
||||
if err := s.saveCurrencyWarsDataWithRuntime(saved, catalog, runtime); err != nil {
|
||||
PacketLog("CW_GET_DATA save recovery failed: " + err.Error())
|
||||
}
|
||||
}
|
||||
}
|
||||
proto.Merge(rsp, saved)
|
||||
PacketLog(fmt.Sprintf("CW_GET_DATA restored=true revision=%d active_run=%t", s.currencyWarsRevision, saved.DHFOFLFCLAH != nil))
|
||||
return nil
|
||||
}
|
||||
s.currencyWarsRevision = 0
|
||||
@@ -204,3 +284,46 @@ func init() {
|
||||
return nil
|
||||
})
|
||||
}
|
||||
|
||||
// cwRecoverMissingPendingAction detects if an active run is in an interactive non-battle stage
|
||||
// (such as Supply) where a pending action was dropped or interrupted, and regenerates the offer.
|
||||
func (s *Session) cwRecoverMissingPendingAction(data *goproto.GridFightGetDataScRsp, catalog *common.CurrencyWarsCatalog) (bool, error) {
|
||||
if data == nil || data.DHFOFLFCLAH == nil {
|
||||
return false, nil
|
||||
}
|
||||
run := data.DHFOFLFCLAH
|
||||
stage, display := cwStage(run)
|
||||
if stage == nil || display == nil {
|
||||
return false, nil
|
||||
}
|
||||
name, err := catalog.NodeTypeName(display.CJCCMAACJDB)
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
if name == "Supply" && (run.FMIGOKIDKJL == nil || run.FMIGOKIDKJL.GetFIKAGBAEOAP() == nil) {
|
||||
offer, err := cwGenerateSupplyOffer(catalog, run)
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
queue := run.GetFMIGOKIDKJL().GetQueuePosition()
|
||||
if queue == 0 {
|
||||
queue = uint32(s.currencyWarsRevision + 1)
|
||||
}
|
||||
run.FMIGOKIDKJL = &goproto.CHCHAJIANIM{
|
||||
QueuePosition: queue,
|
||||
FGLIODAJFML: &goproto.CHCHAJIANIM_FIKAGBAEOAP{
|
||||
FIKAGBAEOAP: offer,
|
||||
},
|
||||
}
|
||||
player, _, _ := cwComponents(run)
|
||||
if player != nil {
|
||||
player.GAJGBBFELEL = &goproto.GMBMNFLMKPI{
|
||||
IBCPAKJAPFF: goproto.KMJNPEMPNMC_KMJNPEMPNMC_AEINKINPAFL,
|
||||
LMICDNNABNM: goproto.GGNKDLAHAGH_GGNKDLAHAGH_FHOHPFBDNOH,
|
||||
}
|
||||
}
|
||||
PacketLog(fmt.Sprintf("CW_RECOVER_SUPPLY restored pending offer queue=%d choices=%d", queue, len(offer.MFBAKLCBPCJ)))
|
||||
return true, nil
|
||||
}
|
||||
return false, nil
|
||||
}
|
||||
Reference in new issue
Block a user