mirror of
https://github.com/Walter-Sparrow/lunar-tear.git
synced 2026-07-02 05:43:41 +03:00
Implement memoir sub-status system with level-based unlocks
This commit is contained in:
@@ -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":
|
||||
|
||||
@@ -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))
|
||||
|
||||
Reference in New Issue
Block a user