Implement unique key generation for weapon grants to prevent overwrites

This commit is contained in:
Ilya Groshev
2026-04-16 16:07:56 +03:00
parent cbc052c3ed
commit ef8a241a0a
5 changed files with 27 additions and 13 deletions
+4 -3
View File
@@ -42,9 +42,10 @@ func init() {
})
register("IUserGem", func(user store.UserState) string {
s, _ := encodeJSONRecords(&EntityIUserGem{
UserId: user.UserId,
PaidGem: user.Gem.PaidGem,
FreeGem: user.Gem.FreeGem,
UserId: user.UserId,
PaidGem: user.Gem.PaidGem,
FreeGem: user.Gem.FreeGem,
LatestVersion: gametime.NowMillis(),
})
return s
})
@@ -115,6 +115,9 @@ func FirstEntranceClientTableMap(user store.UserState) map[string]string {
"IUserParts",
"IUserWeaponNote",
"IUserWeaponStory",
"IUserWeaponSkill",
"IUserWeaponAbility",
"IUserWeaponAwaken",
"IUserCostumeActiveSkill",
"IUserDeckTypeNote",
} {
+6 -5
View File
@@ -107,12 +107,13 @@ type EntityIUserStatus struct {
LatestVersion int64 // Key(5)
}
// EntityIUserGem mirrors EntityIUserGem [Key(0..2)].
// EntityIUserGem mirrors EntityIUserGem [Key(0..3)].
type EntityIUserGem struct {
_msgpack struct{} `msgpack:",asArray"`
UserId int64 `json:"userId"` // Key(0)
PaidGem int32 `json:"paidGem"` // Key(1)
FreeGem int32 `json:"freeGem"` // Key(2)
_msgpack struct{} `msgpack:",asArray"`
UserId int64 `json:"userId"` // Key(0)
PaidGem int32 `json:"paidGem"` // Key(1)
FreeGem int32 `json:"freeGem"` // Key(2)
LatestVersion int64 `json:"latestVersion"` // Key(3)
}
// EntityIUserProfile mirrors EntityIUserProfile [Key(0..7)].