fixed lots of bugs
This commit is contained in:
@@ -221,6 +221,15 @@ func get(c *fiber.Ctx) error {
|
||||
}
|
||||
|
||||
userProfileDegree := utils.BuildUserProfileDegree(userid, user)
|
||||
decoDegree := map[string]any{}
|
||||
for k, v := range userProfileDegree {
|
||||
entry := v.(map[string]any)
|
||||
decoDegree[k] = map[string]any{
|
||||
"decoFrameId": entry["userId"],
|
||||
"profileDegreeType": entry["profileDegreeType"],
|
||||
"degreeId": entry["degreeId"],
|
||||
}
|
||||
}
|
||||
|
||||
charProfileL2d := map[string][]int{}
|
||||
if cpMap, ok := m["masterCharacterProfileLive2dMap"].(map[string]any); ok {
|
||||
@@ -346,114 +355,6 @@ func get(c *fiber.Ctx) error {
|
||||
}
|
||||
}
|
||||
|
||||
leaderSitId := fmt.Sprintf("%v", mainDeck["leader"])
|
||||
leaderEntry, _ := charSituationMap[leaderSitId].(map[string]any)
|
||||
leaderCharId := any(nil)
|
||||
if leaderEntry != nil {
|
||||
leaderCharId = leaderEntry["characterId"]
|
||||
}
|
||||
leaderCharIdStr := fmt.Sprintf("%v", leaderCharId)
|
||||
|
||||
decos, _ := user["decos"].(map[string]any)
|
||||
if decos == nil {
|
||||
decos = map[string]any{}
|
||||
}
|
||||
|
||||
decoSit, _ := decos["situation"].(map[string]any)
|
||||
decoSitId := any(1)
|
||||
decoSitStatus := any("normal")
|
||||
if decoSit != nil {
|
||||
decoSitId = decoSit["situationId"]
|
||||
decoSitStatus = decoSit["situationStatus"]
|
||||
}
|
||||
|
||||
decoL2d, _ := decos["live2d"].(map[string]any)
|
||||
l2dCharId := leaderCharId
|
||||
l2dCostumeId := any(nil)
|
||||
if wc[leaderCharIdStr] != nil {
|
||||
l2dCostumeId = wc[leaderCharIdStr].(map[string]any)["costumeId"]
|
||||
}
|
||||
l2dMotionId := any(nil)
|
||||
if decoL2dMap, ok := m["masterDecoCharacterLive2dMotionMap"].(map[string]any); ok {
|
||||
var firstMotion map[string]any
|
||||
for _, v := range decoL2dMap["entries"].(map[string]any) {
|
||||
mot := v.(map[string]any)
|
||||
if fmt.Sprintf("%v", mot["characterId"]) == leaderCharIdStr {
|
||||
if firstMotion == nil || mot["seq"].(float64) < firstMotion["seq"].(float64) {
|
||||
firstMotion = mot
|
||||
}
|
||||
}
|
||||
}
|
||||
if firstMotion != nil {
|
||||
l2dMotionId = firstMotion["motionId"]
|
||||
}
|
||||
}
|
||||
if decoL2d != nil {
|
||||
if v, ok := decoL2d["characterId"]; ok {
|
||||
l2dCharId = v
|
||||
}
|
||||
if v, ok := decoL2d["costumeId"]; ok {
|
||||
l2dCostumeId = v
|
||||
}
|
||||
if v, ok := decoL2d["motionId"]; ok {
|
||||
l2dMotionId = v
|
||||
}
|
||||
}
|
||||
|
||||
deco3d, _ := decos["3d"].(map[string]any)
|
||||
d3dCharId := leaderCharId
|
||||
d3dDressId := any(nil)
|
||||
d3dHairstyleId := any(nil)
|
||||
if wc[leaderCharIdStr] != nil {
|
||||
d3dDressId = wc[leaderCharIdStr].(map[string]any)["dressId"]
|
||||
d3dHairstyleId = wc[leaderCharIdStr].(map[string]any)["hairstyleId"]
|
||||
}
|
||||
d3dMotionId := any(nil)
|
||||
if em3Map, ok := m["masterEnableCharacter3dMotionTypeMap"].(map[string]any); ok {
|
||||
if charEntry, ok := em3Map["entries"].(map[string]any)[leaderCharIdStr].(map[string]any); ok {
|
||||
if decoEntry, ok := charEntry["entries"].(map[string]any)["deco"].(map[string]any); ok {
|
||||
if entries, ok := decoEntry["entries"].([]any); ok {
|
||||
var first map[string]any
|
||||
for _, e := range entries {
|
||||
entry := e.(map[string]any)
|
||||
if first == nil || entry["seq"].(float64) < first["seq"].(float64) {
|
||||
first = entry
|
||||
}
|
||||
}
|
||||
if first != nil {
|
||||
d3dMotionId = first["motionId"]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if deco3d != nil {
|
||||
if v, ok := deco3d["characterId"]; ok {
|
||||
d3dCharId = v
|
||||
}
|
||||
if v, ok := deco3d["dressId"]; ok {
|
||||
d3dDressId = v
|
||||
}
|
||||
if v, ok := deco3d["hairstyleId"]; ok {
|
||||
d3dHairstyleId = v
|
||||
}
|
||||
if v, ok := deco3d["motionId"]; ok {
|
||||
d3dMotionId = v
|
||||
}
|
||||
}
|
||||
|
||||
frameId := any(1)
|
||||
if v, ok := decos["frameId"]; ok {
|
||||
frameId = v
|
||||
}
|
||||
framepins, _ := decos["framepins"].([]any)
|
||||
getPin := func(i int) any {
|
||||
if framepins != nil && i < len(framepins) {
|
||||
return framepins[i]
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
musicScore, _ := user["musicScore"].(map[string]any)
|
||||
if musicScore == nil {
|
||||
musicScore = map[string]any{}
|
||||
@@ -493,11 +394,6 @@ func get(c *fiber.Ctx) error {
|
||||
}
|
||||
}
|
||||
|
||||
decoEffectId := any(1)
|
||||
if v, ok := decos["effect"]; ok {
|
||||
decoEffectId = v
|
||||
}
|
||||
|
||||
digestSeen := map[any]bool{}
|
||||
var digestEntries []any
|
||||
if dsList, ok := m["masterDigestStoryDetailList"].(map[string]any); ok {
|
||||
@@ -547,8 +443,10 @@ func get(c *fiber.Ctx) error {
|
||||
"introduction": user["introduction"], "tutorialEndedAt": fmt.Sprintf("%v", user["tutorialEndedAt"]),
|
||||
},
|
||||
"userGamedata": map[string]any{
|
||||
"userId": userId, "rank": user["rank"], "exp": user["exp"],
|
||||
"coin": fmt.Sprintf("%v", user["coin"]), "mainDeck": user["mainDeck"],
|
||||
"userId": userId,
|
||||
"rank": user["rank"],
|
||||
"exp": user["exp"],
|
||||
"coin": fmt.Sprintf("%v", user["coin"]), "mainDeck": user["mainDeck"],
|
||||
"paidStar": user["paidStar"], "freeStar": user["freeStar"], "seal": user["seal"],
|
||||
"degree": user["degree"].([]any)[0],
|
||||
"publishTotalDeckPowerFlg": user["publishTotalDeckPowerFlg"],
|
||||
@@ -739,7 +637,7 @@ func get(c *fiber.Ctx) error {
|
||||
return map[string]any{"entries": result}
|
||||
}(),
|
||||
"userLiveBoostRecoveryItemList": nil,
|
||||
"userHighScoreMusicRating": nil,
|
||||
"userHighScoreRating": nil,
|
||||
"userHighScoreMusicRatingMap": nil,
|
||||
"userSeason": map[string]any{"seasonId": seasonId},
|
||||
"userQualifyTournamentMusicScoreMap": nil,
|
||||
@@ -753,8 +651,8 @@ func get(c *fiber.Ctx) error {
|
||||
}
|
||||
return map[string]any{"entries": entries}
|
||||
}(),
|
||||
"userMiracleTicketMap": map[string]any{"entries": []any{}},
|
||||
"userMiracleTicketExchangesMap": map[string]any{"entries": []any{}},
|
||||
"userMiracleTicketMap": map[string]any{"entries": map[string]any{}},
|
||||
"userMiracleTicketExchangesMap": map[string]any{"entries": map[string]any{}},
|
||||
"userMultiDisconnectionBadPenalty": nil,
|
||||
"userSpecialLotteryDrawResultMap": nil,
|
||||
"userMusicScoreMap": map[string]any{"entries": musicScoreEntries},
|
||||
@@ -846,47 +744,7 @@ func get(c *fiber.Ctx) error {
|
||||
"userDecoFrameInventoryMap": map[string]any{"entries": decoFrameEntries},
|
||||
"userDecoPinsInventoryMap": map[string]any{"entries": decoPinsEntries},
|
||||
"userDecoEffectInventoryMap": map[string]any{"entries": decoEffectEntries},
|
||||
"userDecoEquipment": map[string]any{
|
||||
"userDecoCharacterSituation": map[string]any{
|
||||
"userId": userid, "situationId": decoSitId, "situationStatus": decoSitStatus,
|
||||
},
|
||||
"userDecoCharacterLive2d": map[string]any{
|
||||
"userId": userid, "characterId": l2dCharId, "costumeId": l2dCostumeId,
|
||||
"motionId": l2dMotionId, "backgroundId": func() any {
|
||||
if decoL2d != nil {
|
||||
if v, ok := decoL2d["backgroundId"]; ok {
|
||||
return v
|
||||
}
|
||||
}
|
||||
return 1
|
||||
}(),
|
||||
},
|
||||
"userDecoCharacter3d": map[string]any{
|
||||
"userId": userid, "characterId": d3dCharId, "dressId": d3dDressId,
|
||||
"hairstyleId": d3dHairstyleId, "motionId": d3dMotionId,
|
||||
"backgroundId": func() any {
|
||||
if deco3d != nil {
|
||||
if v, ok := deco3d["backgroundId"]; ok {
|
||||
return v
|
||||
}
|
||||
}
|
||||
return 11
|
||||
}(),
|
||||
},
|
||||
"userDecoFramePins": map[string]any{
|
||||
"userId": userid, "decoFrameId": frameId,
|
||||
"decoPinsId1": getPin(0), "decoPinsId2": getPin(1),
|
||||
"decoPinsId3": getPin(2), "decoPinsId4": getPin(3), "decoPinsId5": getPin(4),
|
||||
},
|
||||
"userDecoDegreeMap": map[string]any{"entries": userProfileDegree},
|
||||
"userDecoAppealMap": map[string]any{},
|
||||
"userDecoSetting": map[string]any{
|
||||
"useProfileSettingDegree": user["useProfileSettingDegree"],
|
||||
"useProfileSettingSituation": user["useProfileSettingSituation"],
|
||||
"selectedCharacterType": user["selectedCharacterType"],
|
||||
},
|
||||
"userDecoEffect": map[string]any{"userId": userid, "decoEffectId": decoEffectId},
|
||||
},
|
||||
"userDecoEquipment": utils.BuildDecoEquipment(userid, user, m),
|
||||
"userMusicVideoListMap": func() map[string]any {
|
||||
result := map[string]any{}
|
||||
if mvlm, ok := m["masterMusicVideoListMap"].(map[string]any); ok {
|
||||
@@ -968,7 +826,8 @@ func get(c *fiber.Ctx) error {
|
||||
result := map[string]any{}
|
||||
if cdm, ok := m["masterCostume3dDressMap"].(map[string]any); ok {
|
||||
for id := range cdm["entries"].(map[string]any) {
|
||||
result[id] = map[string]any{"costume3dDressId": id, "status": "obtained"}
|
||||
idInt, _ := strconv.Atoi(id)
|
||||
result[id] = map[string]any{"costume3dDressId": idInt, "status": "obtained"}
|
||||
}
|
||||
}
|
||||
return map[string]any{"entries": result}
|
||||
@@ -977,7 +836,8 @@ func get(c *fiber.Ctx) error {
|
||||
result := map[string]any{}
|
||||
if chm, ok := m["masterCostume3dHairstyleMap"].(map[string]any); ok {
|
||||
for id := range chm["entries"].(map[string]any) {
|
||||
result[id] = map[string]any{"costume3dHairstyleId": id, "status": "obtained"}
|
||||
idInt, _ := strconv.Atoi(id)
|
||||
result[id] = map[string]any{"costume3dHairstyleId": idInt, "status": "obtained"}
|
||||
}
|
||||
}
|
||||
return map[string]any{"entries": result}
|
||||
@@ -1053,11 +913,13 @@ func get(c *fiber.Ctx) error {
|
||||
|
||||
encoded, err := pbutil.Encode("SuiteUserGetResponse", data)
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
return c.Status(500).SendString(err.Error())
|
||||
}
|
||||
|
||||
encrypted, err := utils.Encrypt(encoded)
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
return c.Status(500).SendString(err.Error())
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user