初始化道具修改

back_recharge
lvxinran 2020-10-19 23:17:48 +08:00
parent b89fd738ca
commit 0a838fffcd
2 changed files with 21 additions and 12 deletions

View File

@ -30,6 +30,7 @@ import com.ljsd.jieling.util.CBean2Proto;
import com.ljsd.jieling.util.ItemUtil;
import com.ljsd.jieling.util.MessageUtil;
import config.SChallengeConfig;
import config.SGameSetting;
import config.SMazeTreasureSetting;
import config.SRechargeCommodityConfig;
import manager.STableManager;
@ -38,10 +39,7 @@ import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
import util.TimeUtils;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.*;
@Component
public class GetPlayerInfoHandler extends BaseHandler{
@ -150,8 +148,19 @@ public class GetPlayerInfoHandler extends BaseHandler{
List<CommonProto.GiftGoodsInfo> goodsBagInfo = new ArrayList<>(SRechargeCommodityConfig.rechargeCommodityConfigMap.size());
BuyGoodsLogic.getGoodsBagInfo(userId,goodsBagInfo,true);
int vipPrivilageValue = user.getPlayerInfoManager().getVipPrivilageValue(SMazeTreasureSetting.sMazeTreasureSetting.getRefreshVIP());
if(user.getItemManager().getItemMap().containsKey(97)){
ItemUtil.drop(user,new int[][]{{97,1}}, BIReason.SERVER_UPDATE_REWARD);
SGameSetting setting = STableManager.getConfig(SGameSetting.class).get(1);
if(setting!=null&&setting.getBornItem().length>0){
Map<Integer, Integer> map = ItemUtil.arrayToMap(setting.getBornItem());
Set<Integer> remove = new HashSet<>(map.keySet());
remove.removeAll(user.getItemManager().getItemMap().keySet());
remove.forEach(n->{
try {
System.out.println("n = " + n);
user.getItemManager().newItem(n, 0);
}catch (Exception e){
e.printStackTrace();
}
});
}
PlayerInfoProto.GetPlayerInfoResponse getPlayerInfoResponse
= PlayerInfoProto.GetPlayerInfoResponse.newBuilder()

View File

@ -273,9 +273,9 @@ public class JourneyMap {
SFreeTravel travelConfig = SFreeTravel.journeyMapByMapId.get(mapId);
int[] consume = travelConfig.getConsume();
Map<Integer, Integer> map = ItemUtil.arrayToMap(new int[][]{consume});
// if(!ItemUtil.checkCost(user,map)){
// throw new ErrorCodeException(ErrorCode.ITEM_NOT_ENOUGH);
// }
if(!ItemUtil.checkCost(user,map)){
throw new ErrorCodeException(ErrorCode.ITEM_NOT_ENOUGH);
}
int diceNum = pathInfo.getDiceNum();
List<Integer> randomNum = new ArrayList<>();
@ -296,13 +296,13 @@ public class JourneyMap {
//取总点数和最大格子数,算出走的步数
diceAmount =Math.min(diceAmount,pathInfo.getAllPathInfo().length-pathInfo.getCurrentPath());
diceAmount = 1;
// diceAmount = 1;
if(diceAmount==0){
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
}
randomNum.clear();
randomNum.add(1);
// randomNum.clear();
// randomNum.add(1);
pathInfo.setCurrentPath(pathInfo.getCurrentPath()+diceAmount);
Path arrivePath = pathInfo.getAllPathInfo()[pathInfo.getCurrentPath() - 1];
int mapPointId = arrivePath.getMapPointId();