/** 领取黄钻每日礼包 */
 public void receiveDailyReward() {
   if (this.getYellowVipDailyRewardState() != YellowVipRewardState.CAN_GET.getIndex()) {
     return;
   }
   int yellowVipLevel = this.getYellowVipLevel();
   if (yellowVipLevel <= 0) {
     return;
   }
   YellowVipDailyRewardTemplate template =
       GameServerAssist.getYellowVipTemplateManager()
           .getYellowVipDailyRewardTemplate(human.getLevel());
   if (template == null) {
     return;
   }
   int maxRewardLevel = template.getVipCoin().size();
   int rewardIndex = yellowVipLevel >= maxRewardLevel ? maxRewardLevel - 1 : yellowVipLevel - 1;
   human
       .getWallet()
       .addMoney(
           CurrencyType.COIN,
           template.getVipCoin().get(rewardIndex),
           true,
           MoneyLogReason.YELLOW_VIP_DAILY_REWARD,
           "");
   dailyRewardState = YellowVipRewardState.HAS_GOT.getIndex();
   cache.addUpdate(human.getHumanGuid(), convertToEntity());
   GCUpdateYellowVipRewardState gcMsg = new GCUpdateYellowVipRewardState();
   gcMsg.setRewardType(YellowVipRewardType.DAILY_REWARD.getIndex());
   gcMsg.setRewardState(new int[] {dailyRewardState});
   human.sendMessage(gcMsg);
 }
 /** 领取年费黄钻每日礼包 */
 public void receiveYearVipDailyReward() {
   if (this.getYearYellowVipRewardState() != YellowVipRewardState.CAN_GET.getIndex()) {
     return;
   }
   YearYellowVipRewardTemplate template =
       GameServerAssist.getYellowVipTemplateManager().getYearYellowVipRewardTemplate();
   if (human.getBagManager().getFreeSize(BagType.MAIN_BAG) < 2) {
     human.sendErrorMessage(LangConstants.BAG_FREE_UNIT_NOT_ENOUGH);
     return;
   }
   human
       .getBagManager()
       .putItems(
           BagType.MAIN_BAG,
           template.getItemId1(),
           template.getItemCount1(),
           ItemLogReason.YEAR_YELLOW_VIP_DAILY_REWARD,
           "");
   human
       .getBagManager()
       .putItems(
           BagType.MAIN_BAG,
           template.getItemId2(),
           template.getItemCount2(),
           ItemLogReason.YEAR_YELLOW_VIP_DAILY_REWARD,
           "");
   yearVipDailyRewardState = YellowVipRewardState.HAS_GOT.getIndex();
   cache.addUpdate(human.getHumanGuid(), convertToEntity());
   GCUpdateYellowVipRewardState gcMsg = new GCUpdateYellowVipRewardState();
   gcMsg.setRewardType(YellowVipRewardType.YEAR_VIP_REWARD.getIndex());
   gcMsg.setRewardState(new int[] {yearVipDailyRewardState});
   human.sendMessage(gcMsg);
 }
 /** 领取黄钻新手礼包 */
 public void receiveOnceReward() {
   if (getYellowVipOnceRewardState() != YellowVipRewardState.CAN_GET.getIndex()) {
     return;
   }
   int itemId = GameServerAssist.getYellowVipTemplateManager().getOnceRewardItemId();
   Item rewardItem = ItemFactory.creatNewItem(human, itemId);
   if (rewardItem == null) {
     return;
   }
   int itemCount = 1;
   if (rewardItem.getType() == ItemDetailType.VIRTUAL_SPREE.getIndex()) {
     SpreeTemplate spreeTemplate =
         GameServerAssist.getSpreeTemplateManager().getSpreeTemplate(itemId);
     if (spreeTemplate == null) {
       return;
     }
     itemCount =
         spreeTemplate.getItems().size() < spreeTemplate.getItemCount()
             ? spreeTemplate.getItems().size()
             : spreeTemplate.getItemCount();
   }
   if (human.getBagManager().getFreeSize(BagType.MAIN_BAG) < itemCount) {
     human.sendErrorMessage(LangConstants.BAG_FREE_UNIT_NOT_ENOUGH);
     return;
   }
   human
       .getBagManager()
       .putItems(BagType.MAIN_BAG, itemId, 1, ItemLogReason.YELLOW_VIP_ONCE_REWARD, "");
   onceRewardState = YellowVipRewardState.HAS_GOT.getIndex();
   cache.addUpdate(human.getHumanGuid(), convertToEntity());
   GCUpdateYellowVipRewardState gcMsg = new GCUpdateYellowVipRewardState();
   gcMsg.setRewardType(YellowVipRewardType.ONCE_REWARD.getIndex());
   gcMsg.setRewardState(new int[] {onceRewardState});
   human.sendMessage(gcMsg);
 }
 /**
  * 获取黄钻每日礼包领取状态
  *
  * @return
  */
 public int getYellowVipDailyRewardState() {
   int yellowVipLevel = getYellowVipLevel();
   if (dailyRewardState == YellowVipRewardState.HAS_GOT.getIndex()) {
     return dailyRewardState;
   } else if (yellowVipLevel > 0) {
     return YellowVipRewardState.CAN_GET.getIndex();
   } else {
     return YellowVipRewardState.CANNOT_GET.getIndex();
   }
 }
 private void updateLevelUpRewardState() {
   if (this.getYellowVipLevel() > 0) {
     int[] levels = GameServerAssist.getYellowVipTemplateManager().getLevelUpRewardKeys();
     int humanLevel = human.getLevel();
     for (int i = 0; i < levels.length; i++) {
       if (humanLevel >= levels[i]
           && levelUpRewardState[i] != YellowVipRewardState.HAS_GOT.getIndex()) {
         levelUpRewardState[i] = YellowVipRewardState.CAN_GET.getIndex();
       }
     }
   }
 }
 /**
  * 获取年费黄钻每日礼包领取状态
  *
  * @return
  */
 public int getYearYellowVipRewardState() {
   IntPropertyCacheSet propertySet =
       human.getPropertyManager().getIntPropertySet(PropertyType.HUMAN_INT_PROPERTY);
   int yellowVipLevel = propertySet.getPropertyValue(HumanIntProperty.YELLOW_VIP_LEVEL);
   int isYearYellowVip = propertySet.getPropertyValue(HumanIntProperty.IS_YEAR_YELLOW_VIP);
   if (yearVipDailyRewardState == YellowVipRewardState.HAS_GOT.getIndex()) {
     return yearVipDailyRewardState;
   } else if (isYearYellowVip > 0 && yellowVipLevel > 0) {
     return YellowVipRewardState.CAN_GET.getIndex();
   } else {
     return YellowVipRewardState.CANNOT_GET.getIndex();
   }
 }
 public void receiveLevelUpReward(int rewardIndex) {
   if (rewardIndex < 0 || rewardIndex > levelUpRewardState.length - 1) {
     return;
   }
   if (levelUpRewardState[rewardIndex] != YellowVipRewardState.CAN_GET.getIndex()) {
     return;
   }
   int[] levels = GameServerAssist.getYellowVipTemplateManager().getLevelUpRewardKeys();
   if (human.getLevel() < levels[rewardIndex]) {
     return;
   }
   if (human.getBagManager().getFreeSize(BagType.MAIN_BAG) < 1) {
     human.sendErrorMessage(LangConstants.BAG_FREE_UNIT_NOT_ENOUGH);
     return;
   }
   YellowVipLevelUpRewardTemplate template =
       GameServerAssist.getYellowVipTemplateManager()
           .getYellowVipLevelUpRewardTemplate(levels[rewardIndex]);
   human
       .getWallet()
       .addMoney(
           CurrencyType.COIN,
           template.getCoin(),
           true,
           MoneyLogReason.YELLOW_VIP_LEVEL_UP_REWARD,
           "");
   human
       .getBagManager()
       .putItems(
           BagType.MAIN_BAG,
           template.getItemId(),
           template.getItemCount(),
           ItemLogReason.YELLOW_VIP_LEVEL_UP_REWARD,
           "");
   levelUpRewardState[rewardIndex] = YellowVipRewardState.HAS_GOT.getIndex();
   cache.addUpdate(human.getHumanGuid(), convertToEntity());
   GCUpdateYellowVipRewardState gcMsg = new GCUpdateYellowVipRewardState();
   gcMsg.setRewardType(YellowVipRewardType.LEVEL_UP_REWARD.getIndex());
   gcMsg.setRewardState(levelUpRewardState);
   human.sendMessage(gcMsg);
 }
 @Override
 public void onEvent(IEvent event) {
   int[] levels = GameServerAssist.getYellowVipTemplateManager().getLevelUpRewardKeys();
   if (this.getYellowVipLevel() > 0) {
     int humanLevel = human.getLevel();
     boolean isUpdate = false;
     for (int i = 0; i < levels.length; i++) {
       if (humanLevel >= levels[i]
           && levelUpRewardState[i] != YellowVipRewardState.HAS_GOT.getIndex()) {
         levelUpRewardState[i] = YellowVipRewardState.CAN_GET.getIndex();
         isUpdate = true;
       }
     }
     if (isUpdate) {
       GCUpdateYellowVipRewardState gcMsg = new GCUpdateYellowVipRewardState();
       gcMsg.setRewardType(YellowVipRewardType.LEVEL_UP_REWARD.getIndex());
       gcMsg.setRewardState(levelUpRewardState);
       human.sendMessage(gcMsg);
     }
   }
 }