Implement memoir sub-status system with level-based unlocks

This commit is contained in:
Ilya Groshev
2026-04-22 14:03:26 +03:00
parent 7828de031c
commit 4dc722c5d3
12 changed files with 228 additions and 1 deletions
@@ -161,6 +161,9 @@ func ChangedTables(before, after *store.UserState) []string {
if !mapsEqualStruct(before.PartsPresets, after.PartsPresets) {
add("IUserPartsPreset")
}
if !mapsEqualStruct(before.PartsStatusSubs, after.PartsStatusSubs) {
add("IUserPartsStatusSub")
}
if !mapsEqualStruct(before.CostumeActiveSkills, after.CostumeActiveSkills) {
add("IUserCostumeActiveSkill")
}
@@ -348,6 +351,8 @@ func keyFieldsForTable(table string) []string {
return []string{"userId", "userThoughtUuid"}
case "IUserParts":
return []string{"userId", "userPartsUuid"}
case "IUserPartsStatusSub":
return []string{"userId", "userPartsUuid", "statusIndex"}
case "IUserDeckCharacter":
return []string{"userId", "userDeckCharacterUuid"}
case "IUserDeck":
+33 -1
View File
@@ -114,12 +114,15 @@ func init() {
s, _ := utils.EncodeJSONMaps(SortedCostumeLotteryEffectPendingRecords(user)...)
return s
})
register("IUserPartsStatusSub", func(user store.UserState) string {
s, _ := utils.EncodeJSONMaps(sortedPartsStatusSubRecords(user)...)
return s
})
registerStatic(
"IUserCostumeLevelBonusReleaseStatus",
"IUserCostumeLotteryEffectAbility",
"IUserCostumeLotteryEffectStatusUp",
"IUserPartsPresetTag",
"IUserPartsStatusSub",
)
}
@@ -493,6 +496,35 @@ func sortedPartsPresetRecords(user store.UserState) []map[string]any {
return records
}
func sortedPartsStatusSubRecords(user store.UserState) []map[string]any {
keys := make([]store.PartsStatusSubKey, 0, len(user.PartsStatusSubs))
for k := range user.PartsStatusSubs {
keys = append(keys, k)
}
sort.Slice(keys, func(i, j int) bool {
if keys[i].UserPartsUuid != keys[j].UserPartsUuid {
return keys[i].UserPartsUuid < keys[j].UserPartsUuid
}
return keys[i].StatusIndex < keys[j].StatusIndex
})
records := make([]map[string]any, 0, len(keys))
for _, k := range keys {
row := user.PartsStatusSubs[k]
records = append(records, map[string]any{
"userId": user.UserId,
"userPartsUuid": row.UserPartsUuid,
"statusIndex": row.StatusIndex,
"partsStatusSubLotteryId": row.PartsStatusSubLotteryId,
"level": row.Level,
"statusKindType": row.StatusKindType,
"statusCalculationType": row.StatusCalculationType,
"statusChangeValue": row.StatusChangeValue,
"latestVersion": row.LatestVersion,
})
}
return records
}
func sortedCostumeActiveSkillRecords(user store.UserState) []map[string]any {
keys := sortedStringKeys(user.CostumeActiveSkills)
records := make([]map[string]any, 0, len(keys))