Fix new account can't load codex datas

This commit is contained in:
ShiroSaki 2022-05-24 13:20:58 +08:00 committed by Melledy
parent 9e8b6eff09
commit c8a7aea78b
2 changed files with 10 additions and 2 deletions

View File

@ -187,7 +187,7 @@ public class Player {
this.birthday = new PlayerBirthday(); this.birthday = new PlayerBirthday();
this.rewardedLevels = new HashSet<>(); this.rewardedLevels = new HashSet<>();
this.moonCardGetTimes = new HashSet<>(); this.moonCardGetTimes = new HashSet<>();
this.codex = new PlayerCodex(); this.codex = new PlayerCodex(this);
this.shopLimit = new ArrayList<>(); this.shopLimit = new ArrayList<>();
this.expeditionInfo = new HashMap<>(); this.expeditionInfo = new HashMap<>();
@ -208,7 +208,7 @@ public class Player {
this.signature = ""; this.signature = "";
this.teamManager = new TeamManager(this); this.teamManager = new TeamManager(this);
this.birthday = new PlayerBirthday(); this.birthday = new PlayerBirthday();
this.codex = new PlayerCodex(); this.codex = new PlayerCodex(this);
this.setProperty(PlayerProperty.PROP_PLAYER_LEVEL, 1); this.setProperty(PlayerProperty.PROP_PLAYER_LEVEL, 1);
this.setProperty(PlayerProperty.PROP_IS_SPRING_AUTO_USE, 1); this.setProperty(PlayerProperty.PROP_IS_SPRING_AUTO_USE, 1);
this.setProperty(PlayerProperty.PROP_SPRING_AUTO_USE_PERCENT, 50); this.setProperty(PlayerProperty.PROP_SPRING_AUTO_USE_PERCENT, 50);
@ -1174,6 +1174,9 @@ public class Player {
if (this.getTeamManager() == null) { if (this.getTeamManager() == null) {
this.teamManager = new TeamManager(this); this.teamManager = new TeamManager(this);
} }
if (this.getCodex() == null) {
this.codex = new PlayerCodex(this);
}
if (this.getProfile().getUid() == 0) { if (this.getProfile().getUid() == 0) {
this.getProfile().syncWithCharacter(this); this.getProfile().syncWithCharacter(this);
} }

View File

@ -39,6 +39,11 @@ public class PlayerCodex {
this.unlockedReliquarySuitCodex = new HashSet<>(); this.unlockedReliquarySuitCodex = new HashSet<>();
} }
public PlayerCodex(Player player){
this();
this.player = player;
}
public void setPlayer(Player player) { public void setPlayer(Player player) {
this.player = player; this.player = player;
} }