@Override public void onLoad(HumanEntity humanEntity) { int[] levels = GameServerAssist.getYellowVipTemplateManager().getLevelUpRewardKeys(); levelUpRewardState = new int[levels.length]; for (int i = 0; i < levelUpRewardState.length; i++) { levelUpRewardState[i] = YellowVipRewardState.CANNOT_GET.getIndex(); } HumanYellowVipRewardStateInfo yellowVipRewardInfo = humanEntity.getBuilder().getYellowVipRewardState(); if (yellowVipRewardInfo == null) { return; } this.dailyRewardState = yellowVipRewardInfo.getDailyRewardState(); this.yearVipDailyRewardState = yellowVipRewardInfo.getYearVipDailyRewardState(); int size = levelUpRewardState.length > yellowVipRewardInfo.getLevelUpRewardStateCount() ? yellowVipRewardInfo.getLevelUpRewardStateCount() : levelUpRewardState.length; if (this.getYellowVipLevel() > 0) { this.onceRewardState = yellowVipRewardInfo.getOnceRewardState(); for (int i = 0; i < size; i++) { levelUpRewardState[i] = yellowVipRewardInfo.getLevelUpRewardState(i); } } }
private HumanYellowVipRewardStateEntity convertToEntity() { HumanYellowVipRewardStateInfo.Builder builder = HumanYellowVipRewardStateInfo.newBuilder(); builder.setHumanGuid(human.getHumanGuid()); builder.setDailyRewardState(dailyRewardState); builder.setYearVipDailyRewardState(yearVipDailyRewardState); builder.setOnceRewardState(onceRewardState); for (Integer state : levelUpRewardState) { builder.addLevelUpRewardState(state); } return new HumanYellowVipRewardStateEntity(builder); }