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

+30 -10
View File
@@ -46,22 +46,34 @@ func cwSpotlightChoices(c *common.CurrencyWarsCatalog, run *pb.MPIMAEMCEFH) (*pb
used[r.RoleId] = true
}
}
var ids []uint32
var ids, safeIDs []uint32
for id, row := range rows {
if run.IsOverlock && !row.IsOCEffective {
continue
}
compatible := false
compatible, hasUsedRole := false, false
for _, role := range row.SuitableRoles {
if owned[role] && !used[role] {
compatible = true
break
}
if owned[role] && used[role] {
hasUsedRole = true
}
}
if compatible {
ids = append(ids, id)
if !hasUsedRole {
safeIDs = append(safeIDs, id)
}
}
}
// The Client can offer every compatible owned role, including one with an
// existing binding. Prefer options without such roles when available so a
// valid-looking selection cannot be rejected as a duplicate. This is a
// server offer policy, not a claim about the original selection algorithm.
if len(safeIDs) > 0 {
ids = safeIDs
}
sort.Slice(ids, func(i, j int) bool { return ids[i] < ids[j] })
if len(ids) == 0 {
return nil, fmt.Errorf("CW no compatible Spotlight choices for owned roles")
@@ -116,11 +128,16 @@ func cwSelectSpotlight(c *common.CurrencyWarsCatalog, run *pb.MPIMAEMCEFH, selec
return nil, fmt.Errorf("CW Spotlight role is incompatible")
}
player, team, _ := cwComponents(run)
owned := false
for _, r := range team.GridGameRoleList {
owned = owned || r.Id == selection.RoleId
if player == nil || team == nil {
return nil, fmt.Errorf("CW Spotlight player or team missing")
}
if !owned {
var owned *pb.CDEAABODKCP
for _, r := range team.GridGameRoleList {
if r.Id == selection.RoleId && (owned == nil || r.RoleStar > owned.RoleStar || r.RoleStar == owned.RoleStar && r.UniqueId < owned.UniqueId) {
owned = r
}
}
if owned == nil {
return nil, fmt.Errorf("CW Spotlight role not owned")
}
cwEnsureSpotlights(run)
@@ -134,7 +151,10 @@ func cwSelectSpotlight(c *common.CurrencyWarsCatalog, run *pb.MPIMAEMCEFH, selec
if e != nil {
return nil, e
}
item := &pb.FMBACDOFCAL{UniqueId: uid, IHHNLLAJAGB: row.ID, RoleId: selection.RoleId}
// AddOrUpdate shuffles proto fields into the binding record; MDNAGANGNKK
// becomes RoleUniqueID, RoleId remains the configuration ID. Native
// GetActiveSpotLightBindingByRoleId + binding constructor corroborate it.
item := &pb.FMBACDOFCAL{UniqueId: uid, IHHNLLAJAGB: row.ID, RoleId: selection.RoleId, MDNAGANGNKK: owned.UniqueId}
state.FNNEPMAPOOF = append(state.FNNEPMAPOOF, item)
stage, node := cwStage(run)
if stage == nil || node == nil || !node.HPNNLMBHOPF {
@@ -158,7 +178,7 @@ func cwSelectSpotlight(c *common.CurrencyWarsCatalog, run *pb.MPIMAEMCEFH, selec
}
func init() {
handle("GridFightSpotLightEnter", func(s *Session, _ *pb.GridFightSpotLightEnterCsReq, rsp *pb.GridFightSpotLightEnterScRsp) error {
cwHandle("GridFightSpotLightEnter", func(s *Session, _ *pb.GridFightSpotLightEnterCsReq, rsp *pb.GridFightSpotLightEnterScRsp) error {
rsp.Retcode = uint32(pb.Retcode_RET_GRID_FIGHT_CONF_MISS)
c, data, e := cwPreparingData(s)
if e != nil {
@@ -185,7 +205,7 @@ func init() {
if e = s.saveCurrencyWarsData(data, c); e != nil {
return nil
}
if e = s.Send(cwNotify(&pb.KFNCAIHIHCM{MNLCHEJKDHO: &pb.KFNCAIHIHCM_FMIGOKIDKJL{FMIGOKIDKJL: pending}})); e != nil {
if e = cwSend(s, cwNotify(&pb.KFNCAIHIHCM{MNLCHEJKDHO: &pb.KFNCAIHIHCM_FMIGOKIDKJL{FMIGOKIDKJL: pending}})); e != nil {
return e
}
rsp.Retcode = 0