Update GaCy-GO

This commit is contained in:
CAtlas0784 committed 2026-10-28 18:54:43 +07:00
1 parent da8a32f60d
commit 0cbe460e49
345 files changed
+98202 -77559

No files matched your search

+89 -29
View File
@@ -91,6 +91,20 @@ func finishCurrencyWarsBattle(s *Session, req *pb.PVEBattleResultCsReq, current
if stage == nil || node == nil || player == nil || team == nil || shop == nil || node.StageId != req.StageId {
return fmt.Errorf("CW settlement components differ")
}
// Encounter penalties belong to the selected offer, not the route node's
// base display rule. Validate against the battle we actually issued before
// using that rule for HP/rewards or selecting the next transition.
penaltyID := node.IFIIOIIKJHO
if layer := stage.GetIMPNAHBCADN().GetMPOBBIPMNNJ(); layer != nil && len(layer.BPDABHGFBFO) > 0 {
selected, e := cwSelectedEnemyBranch(layer)
if e != nil {
return e
}
penaltyID = selected.IFIIOIIKJHO
if current.GetEIGMKOJOEEI().GetIFIIOIIKJHO() != penaltyID {
return fmt.Errorf("CW selected Encounter penalty differs from issued battle")
}
}
transitions, err := cwNodeTransitions(catalog)
if err != nil {
return err
@@ -98,33 +112,32 @@ func finishCurrencyWarsBattle(s *Session, req *pb.PVEBattleResultCsReq, current
var transition *cwNodeTransition
for i := range transitions {
t := &transitions[i]
if t.Route == stage.EMOHLJHPOPC && t.Chapter == stage.DCAHJELNJNP && t.Section == stage.SectionId && t.Stage == node.StageId && t.Penalty == node.IFIIOIIKJHO && t.Division == run.DivisionId && t.Overclock == run.IsOverlock {
if t.Route == stage.EMOHLJHPOPC && t.Chapter == stage.DCAHJELNJNP && t.Section == stage.SectionId && t.Stage == node.StageId && t.Penalty == penaltyID && t.Division == run.DivisionId && t.Overclock == run.IsOverlock {
if transition != nil {
return fmt.Errorf("CW transition duplicated")
}
transition = t
}
}
if transition == nil {
return fmt.Errorf("CW next node recipe not captured")
}
nextLevel := new(pb.AINFNFIDGFF)
nextPending := new(pb.CHCHAJIANIM)
if err = proto.Unmarshal(transition.LevelWire, nextLevel); err != nil {
return err
}
if err = proto.Unmarshal(transition.PendingWire, nextPending); err != nil {
return err
}
if nextLevel.IMPNAHBCADN == nil || nextPending.GetNNDGEJFLGGF() == nil {
return fmt.Errorf("CW next node recipe incomplete")
}
found := false
for _, n := range stage.OOMMIIKPHBC {
found = found || (n.DCAHJELNJNP == nextLevel.DCAHJELNJNP && n.SectionId == nextLevel.SectionId)
}
if !found {
return fmt.Errorf("CW next node outside route")
if transition != nil {
if err = proto.Unmarshal(transition.LevelWire, nextLevel); err != nil {
return err
}
if err = proto.Unmarshal(transition.PendingWire, nextPending); err != nil {
return err
}
if nextLevel.IMPNAHBCADN == nil || nextPending.GetNNDGEJFLGGF() == nil {
return fmt.Errorf("CW next node recipe incomplete")
}
found := false
for _, n := range stage.OOMMIIKPHBC {
found = found || (n.DCAHJELNJNP == nextLevel.DCAHJELNJNP && n.SectionId == nextLevel.SectionId)
}
if !found {
return fmt.Errorf("CW next node outside route")
}
}
raw, err := common.ReadResourceFile("resources/CurrencyWarsSettlementRules.json")
if err != nil {
@@ -146,17 +159,30 @@ func finishCurrencyWarsBattle(s *Session, req *pb.PVEBattleResultCsReq, current
}
penaltyIndex := -1
for i, p := range rules.Penalties {
if p.ID == node.IFIIOIIKJHO {
if p.ID == penaltyID {
if penaltyIndex >= 0 {
return fmt.Errorf("CW penalty duplicated")
}
penaltyIndex = i
}
}
if penaltyIndex < 0 {
return fmt.Errorf("CW target penalty row not captured")
var penalty common.CurrencyWarsReferencePenalty
if penaltyIndex >= 0 {
p := rules.Penalties[penaltyIndex]
penalty = common.CurrencyWarsReferencePenalty{ID: p.ID, ThresholdPosition: p.ThresholdPosition, ThresholdFailPlayerHPPenalty: p.ThresholdFailPlayerHPPenalty, ThresholdPassBasicPlayerHPPenalty: p.ThresholdPassBasicPlayerHPPenalty, ProgressPenaltyCoefficient: p.ProgressPenaltyCoefficient}
} else {
// Preserve the proven current-Client captures above. Newly constructed
// nodes use the separately labelled, revision-gated reference table.
reference, e := common.LoadCurrencyWarsReferencePenalties(catalog)
if e != nil {
return e
}
var ok bool
penalty, ok = reference[penaltyID]
if !ok {
return fmt.Errorf("CW target penalty %d has no reference row", penaltyID)
}
}
penalty := rules.Penalties[penaltyIndex]
if player.PPKKHHNEOHB > math.MaxInt32 || player.GridFightLineupHp > player.PPKKHHNEOHB {
return fmt.Errorf("CW HP cannot be represented in settlement")
}
@@ -266,15 +292,48 @@ func finishCurrencyWarsBattle(s *Session, req *pb.PVEBattleResultCsReq, current
damage.EEGPILJDLBG = append(damage.EEGPILJDLBG, &pb.PLFKMENCDMM{RoleId: role.RoleId, RoleStar: role.RoleStar, TotalDamage: total, DIGNECHKINI: uint64(role.Pos) > uint64(frontMax)})
}
oldChapter, oldSection := stage.DCAHJELNJNP, stage.SectionId
stage.DCAHJELNJNP = nextLevel.DCAHJELNJNP
stage.SectionId = nextLevel.SectionId
stage.IMPNAHBCADN = proto.Clone(nextLevel.IMPNAHBCADN).(*pb.NCKOKDHNJDC)
run.FMIGOKIDKJL = nextPending
var nextNotify *pb.GridFightSyncUpdateResultScNotify
if transition != nil {
stage.DCAHJELNJNP = nextLevel.DCAHJELNJNP
stage.SectionId = nextLevel.SectionId
stage.IMPNAHBCADN = proto.Clone(nextLevel.IMPNAHBCADN).(*pb.NCKOKDHNJDC)
run.FMIGOKIDKJL = nextPending
nextNotify = cwNotify(&pb.KFNCAIHIHCM{MNLCHEJKDHO: &pb.KFNCAIHIHCM_OOICHLAMNIG{OOICHLAMNIG: nextLevel}}, &pb.KFNCAIHIHCM{MNLCHEJKDHO: &pb.KFNCAIHIHCM_FMIGOKIDKJL{FMIGOKIDKJL: nextPending}})
} else {
// A battle has no pending action to allocate from. The persisted CAS
// revision is monotonic and also backs Bonfire entry queue allocation.
if revision >= math.MaxUint32 {
return fmt.Errorf("CW settlement queue exhausted")
}
run.FMIGOKIDKJL = &pb.CHCHAJIANIM{QueuePosition: uint32(revision)}
nextNotify, err = cwAdvanceRouteNode(catalog, run)
if err != nil {
return err
}
// The allocation seed is not a Client pending action, so it must not
// produce a synthetic FinishPendingAction notification.
for _, group := range nextNotify.GCPNIHHBGGD {
kept := group.JKPJFKCBIEM[:0]
for _, update := range group.JKPJFKCBIEM {
if update.GetPMFBIGLPJJA() != uint32(revision) {
kept = append(kept, update)
}
}
group.JKPJFKCBIEM = kept
}
}
runtime, err := cwApplyBonfireEnemyRules(catalog, run, nil)
if err != nil {
return err
}
if runtime.Rules["PetPalStarDown"] != 0 && stage.GetIMPNAHBCADN().GetMPOBBIPMNNJ() != nil {
nextNotify.GCPNIHHBGGD = append(nextNotify.GCPNIHHBGGD, cwNotify(&pb.KFNCAIHIHCM{MNLCHEJKDHO: &pb.KFNCAIHIHCM_OOICHLAMNIG{OOICHLAMNIG: &pb.AINFNFIDGFF{DCAHJELNJNP: stage.DCAHJELNJNP, SectionId: stage.SectionId, IMPNAHBCADN: stage.IMPNAHBCADN}}}).GCPNIHHBGGD...)
}
player.GAJGBBFELEL = &pb.GMBMNFLMKPI{IBCPAKJAPFF: pb.KMJNPEMPNMC_KMJNPEMPNMC_AEINKINPAFL, LMICDNNABNM: pb.GGNKDLAHAGH_GGNKDLAHAGH_FHOHPFBDNOH}
end := &pb.GridFightEndBattleStageNotify{DCAHJELNJNP: oldChapter, SectionId: oldSection, EMOHLJHPOPC: stage.EMOHLJHPOPC, HFLPDCJDIAC: progress, OAHFCPPIMLF: penalty.ThresholdPosition, CBHJKFNCDAD: perfect,
JPKHBELGHCG: previousStreak, OCCOHKIMGCN: player.GDAKCOICIDA, CLFNPMGHMFC: basicGold, DMNILJEGICO: interest, OGLOCDMNNIM: streakGold, ODJEBDNBLLC: previousHP, PAGPKOKMDBK: player.GridFightLineupHp, LKCJAPIGEND: player.PPKKHHNEOHB, NKBIDLBLONC: damage, HMKOKACNHJH: hpChanges,
AEOCOGHMEBG: &pb.GEEMFDBDMDH{PBMAHOJBAGG: uint32(gain), EDCLIPCEHAO: &pb.NFPLDMFCLHA{Level: previousLevel, Exp: previousExp, KDBMPKJKAKI: previousRow.LevelUpExp}, LHIAODNJIIC: &pb.NFPLDMFCLHA{Level: plan.Level, Exp: plan.Exp, KDBMPKJKAKI: row.LevelUpExp}}}
if err = s.saveCurrencyWarsData(data, catalog); err != nil {
if err = s.saveCurrencyWarsDataWithRuntime(data, catalog, runtime); err != nil {
return err
}
CURRENT_BATTLE.Delete(s.Token) // Duplicate uploads cannot award again.
@@ -285,7 +344,8 @@ func finishCurrencyWarsBattle(s *Session, req *pb.PVEBattleResultCsReq, current
if err = s.Send(end); err != nil {
return err
}
if err = s.Send(cwNotify(&pb.KFNCAIHIHCM{MNLCHEJKDHO: &pb.KFNCAIHIHCM_OOICHLAMNIG{OOICHLAMNIG: nextLevel}}, &pb.KFNCAIHIHCM{MNLCHEJKDHO: &pb.KFNCAIHIHCM_JOMFJHOCHJP{JOMFJHOCHJP: player.GAJGBBFELEL}}, &pb.KFNCAIHIHCM{MNLCHEJKDHO: &pb.KFNCAIHIHCM_FMIGOKIDKJL{FMIGOKIDKJL: nextPending}})); err != nil {
nextNotify.GCPNIHHBGGD = append(nextNotify.GCPNIHHBGGD, cwNotify(&pb.KFNCAIHIHCM{MNLCHEJKDHO: &pb.KFNCAIHIHCM_JOMFJHOCHJP{JOMFJHOCHJP: player.GAJGBBFELEL}}).GCPNIHHBGGD...)
if err = s.Send(nextNotify); err != nil {
return err
}
PacketLog(fmt.Sprintf("CW_SETTLEMENT saved battle=%d progress=%d gold=%d basic=%d interest=%d streak=%d exp=%d next=%d/%d revision=%d", req.BattleId, progress, player.Gold, basicGold, interest, streakGold, plan.Exp, stage.DCAHJELNJNP, stage.SectionId, s.currencyWarsRevision))