fix: improve endgame clock and gameplay stability
This commit is contained in:
1 parent
ce6aabfc55
commit
658298ee86
46 files changed
+1915
-99
No files matched your search
+32
-31
@@ -835,35 +835,42 @@ func apiCommand(w http.ResponseWriter, r *http.Request) {
|
||||
success = false
|
||||
|
||||
case "/max":
|
||||
for _, av := range data.Avatars {
|
||||
av.Level = 80
|
||||
av.Promotion = 6
|
||||
av.Data.Rank = 6
|
||||
count, err := common.MaxAvatarProgress()
|
||||
if err != nil {
|
||||
output, success = "Cannot update avatars: "+err.Error(), false
|
||||
} else {
|
||||
output = fmt.Sprintf("All %d avatars saved at Level 80, Rank 6. Reconnect the game to load the change.", count)
|
||||
}
|
||||
output = fmt.Sprintf("[OK] All %d avatars set to Level 80, Rank 6.", len(data.Avatars))
|
||||
|
||||
case "/teleport", "/scene":
|
||||
if len(parts) > 1 {
|
||||
planeID, _ := strconv.ParseUint(parts[1], 10, 32)
|
||||
if planeID != 0 {
|
||||
data.Scene.PlaneID = uint32(planeID)
|
||||
output = fmt.Sprintf("[OK] Teleported to PlaneID %d.", planeID)
|
||||
}
|
||||
if len(parts) > 2 {
|
||||
floorID, _ := strconv.ParseUint(parts[2], 10, 32)
|
||||
if floorID != 0 {
|
||||
data.Scene.FloorID = uint32(floorID)
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if len(parts) < 2 || len(parts) > 3 {
|
||||
output = "Usage: /teleport <plane_id> [floor_id]"
|
||||
success = false
|
||||
break
|
||||
}
|
||||
planeID, parseErr := strconv.ParseUint(parts[1], 10, 32)
|
||||
if parseErr != nil || planeID == 0 {
|
||||
output, success = "Invalid plane ID.", false
|
||||
break
|
||||
}
|
||||
var floorID uint64
|
||||
if len(parts) == 3 {
|
||||
floorID, parseErr = strconv.ParseUint(parts[2], 10, 32)
|
||||
if parseErr != nil || floorID == 0 {
|
||||
output, success = "Invalid floor ID.", false
|
||||
break
|
||||
}
|
||||
}
|
||||
data.Scene.PlaneID = uint32(planeID)
|
||||
if floorID != 0 {
|
||||
data.Scene.FloorID = uint32(floorID)
|
||||
}
|
||||
output = fmt.Sprintf("Scene saved for plane %d. Reconnect the game to load the change.", planeID)
|
||||
|
||||
case "/clear":
|
||||
if len(parts) > 1 && parts[1] == "lineup" {
|
||||
data.Lineups = make(map[uint32]uint32)
|
||||
output = "[OK] Active lineup cleared."
|
||||
if len(parts) == 2 && strings.EqualFold(parts[1], "lineup") {
|
||||
output = "The active lineup cannot be empty. Change your team in the game."
|
||||
success = false
|
||||
} else {
|
||||
output = "Usage: /clear lineup"
|
||||
success = false
|
||||
@@ -989,8 +996,8 @@ func apiCommand(w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
|
||||
case "/help":
|
||||
output = "/faketime [status|off|Unix seconds|RFC3339 with timezone] - Set game calendar time\n"
|
||||
output += "Available GM Commands:\n /max - Set all avatars to Max Lv.80 E6\n /teleport <plane_id> [floor_id] - Set scene\n /avatar <id> <level> [rank] - Modify avatar\n /clear lineup - Clear active lineup slots\n /unlockall warp [all|avatar|lightcone|off] - Toggle unlocked gacha banners\n /reload banner - Reload banner configurations"
|
||||
output = "/faketime [status|off|window <begin Unix seconds> <end Unix seconds>|Unix seconds|RFC3339 with timezone] - Set game calendar time\n"
|
||||
output += "Available GM Commands:\n /max - Set all avatars to Max Lv.80 E6\n /teleport <plane_id> [floor_id] - Set scene\n /avatar <id> <level> [rank] - Modify avatar\n /unlockall warp [all|avatar|lightcone|off] - Toggle unlocked gacha banners\n /reload banner - Reload banner configurations"
|
||||
|
||||
default:
|
||||
output = fmt.Sprintf("Unknown command: %s", cmd)
|
||||
@@ -1007,14 +1014,8 @@ func apiCommand(w http.ResponseWriter, r *http.Request) {
|
||||
output = err.Error()
|
||||
}
|
||||
}
|
||||
} else if success && rootCmd != "/help" && rootCmd != "/avatar" {
|
||||
raw, err := json.MarshalIndent(data, "", " ")
|
||||
if err == nil {
|
||||
err = os.WriteFile("freesr-data.json", raw, 0o644)
|
||||
}
|
||||
if err == nil {
|
||||
err = data.SavePersistentChecked()
|
||||
}
|
||||
} else if success && rootCmd != "/help" && rootCmd != "/avatar" && rootCmd != "/max" {
|
||||
err := data.SavePersistentChecked()
|
||||
if err != nil {
|
||||
success = false
|
||||
output = err.Error()
|
||||
|
||||
Reference in new issue
Block a user