mirror of
https://github.com/Walter-Sparrow/lunar-tear.git
synced 2026-07-02 05:43:41 +03:00
Implement remaining Memoirs preset management RPCs
This commit is contained in:
@@ -163,6 +163,9 @@ func ChangedTables(before, after *store.UserState) []string {
|
||||
if !mapsEqualStruct(before.PartsPresets, after.PartsPresets) {
|
||||
add("IUserPartsPreset")
|
||||
}
|
||||
if !mapsEqualStruct(before.PartsPresetTags, after.PartsPresetTags) {
|
||||
add("IUserPartsPresetTag")
|
||||
}
|
||||
if !mapsEqualStruct(before.PartsStatusSubs, after.PartsStatusSubs) {
|
||||
add("IUserPartsStatusSub")
|
||||
}
|
||||
@@ -419,6 +422,8 @@ func keyFieldsForTable(table string) []string {
|
||||
return []string{"userId", "partsGroupId"}
|
||||
case "IUserPartsPreset":
|
||||
return []string{"userId", "userPartsPresetNumber"}
|
||||
case "IUserPartsPresetTag":
|
||||
return []string{"userId", "userPartsPresetTagNumber"}
|
||||
case "IUserCageOrnamentReward":
|
||||
return []string{"userId", "cageOrnamentId"}
|
||||
case "IUserAutoSaleSettingDetail":
|
||||
|
||||
@@ -86,6 +86,10 @@ func init() {
|
||||
s, _ := utils.EncodeJSONMaps(sortedPartsPresetRecords(user)...)
|
||||
return s
|
||||
})
|
||||
register("IUserPartsPresetTag", func(user store.UserState) string {
|
||||
s, _ := utils.EncodeJSONMaps(sortedPartsPresetTagRecords(user)...)
|
||||
return s
|
||||
})
|
||||
register("IUserCostumeAwakenStatusUp", func(user store.UserState) string {
|
||||
s, _ := utils.EncodeJSONMaps(sortedCostumeAwakenStatusUpRecords(user)...)
|
||||
return s
|
||||
@@ -122,7 +126,6 @@ func init() {
|
||||
"IUserCostumeLevelBonusReleaseStatus",
|
||||
"IUserCostumeLotteryEffectAbility",
|
||||
"IUserCostumeLotteryEffectStatusUp",
|
||||
"IUserPartsPresetTag",
|
||||
)
|
||||
}
|
||||
|
||||
@@ -496,6 +499,25 @@ func sortedPartsPresetRecords(user store.UserState) []map[string]any {
|
||||
return records
|
||||
}
|
||||
|
||||
func sortedPartsPresetTagRecords(user store.UserState) []map[string]any {
|
||||
ids := make([]int, 0, len(user.PartsPresetTags))
|
||||
for id := range user.PartsPresetTags {
|
||||
ids = append(ids, int(id))
|
||||
}
|
||||
sort.Ints(ids)
|
||||
records := make([]map[string]any, 0, len(ids))
|
||||
for _, id := range ids {
|
||||
row := user.PartsPresetTags[int32(id)]
|
||||
records = append(records, map[string]any{
|
||||
"userId": user.UserId,
|
||||
"userPartsPresetTagNumber": row.UserPartsPresetTagNumber,
|
||||
"name": row.Name,
|
||||
"latestVersion": row.LatestVersion,
|
||||
})
|
||||
}
|
||||
return records
|
||||
}
|
||||
|
||||
func sortedPartsStatusSubRecords(user store.UserState) []map[string]any {
|
||||
keys := make([]store.PartsStatusSubKey, 0, len(user.PartsStatusSubs))
|
||||
for k := range user.PartsStatusSubs {
|
||||
|
||||
Reference in New Issue
Block a user