Merge branch 'dev_dh_Practice' into master_test_mcz_hardstage
# Conflicts: # serverlogic/src/main/java/com/ljsd/jieling/globals/BIReason.java # serverlogic/src/main/java/com/ljsd/jieling/util/CBean2Proto.javaback_recharge
commit
c509ed8444
|
@ -4,6 +4,7 @@ import com.google.gson.Gson;
|
|||
import com.ljsd.jieling.config.json.SDK37Constans;
|
||||
import com.ljsd.jieling.config.reportData.DataMessageUtils;
|
||||
import com.ljsd.jieling.logic.dao.root.User;
|
||||
import com.ljsd.jieling.logic.store.BuyGoodsNewLogic;
|
||||
import com.ljsd.jieling.util.MD5Util;
|
||||
import util.TimeUtils;
|
||||
|
||||
|
@ -38,7 +39,7 @@ public class Repot37EventUtil {
|
|||
report37RoleLeveBean.setRole_grade_u_time(TimeUtils.getTimeStamp(System.currentTimeMillis()));
|
||||
report37RoleLeveBean.setRole_grade_desc("null");
|
||||
report37RoleLeveBean.setBalance("null");//todo
|
||||
report37RoleLeveBean.setTotal_pay_amoun(String.valueOf(user.getPlayerInfoManager().getNewRechargeInfo().getRr()*100));
|
||||
report37RoleLeveBean.setTotal_pay_amoun(String.valueOf(BuyGoodsNewLogic.getAllAmount(user) *100));
|
||||
report37RoleLeveBean.setTotal_online_time(user.getPlayerInfoManager().getOnlineTime());
|
||||
report37RoleLeveBean.setGuild_id("");//todo
|
||||
report37RoleLeveBean.setGuild_name("0");//todo
|
||||
|
|
|
@ -330,4 +330,6 @@ public interface BIReason {
|
|||
int EQUIP_UPLEVEL_REWARD = 1093;//装备升星获得
|
||||
int TA_SUI_LING_XIAO = 1094;//踏碎凌霄
|
||||
int HARD_STAGE_GET = 1095;
|
||||
int UP_PRACTICE_LEVEL = 1100;//修行升级
|
||||
|
||||
}
|
|
@ -287,7 +287,7 @@ public class EndExpeditionBattleRequest extends BaseHandler<Expedition.EndExpedi
|
|||
throw new ErrorCodeException("试炼节点英雄掉落失败");
|
||||
}
|
||||
Hero hero1 = ExpeditionLogic.createRandomHero(user,hero,heroTid,level,-1,2);
|
||||
drop.addHero(CBean2Proto.getHero(hero1));
|
||||
drop.addHero(CBean2Proto.getHero(user,hero1));
|
||||
for(Integer equipId : hero1.getEquipByPositionMap().values()){
|
||||
drop.addEquipId(CBean2Proto.getEquipProto(equipId));
|
||||
}
|
||||
|
|
|
@ -76,7 +76,7 @@ public class GetExpeditionRequestHandler extends BaseHandler<Expedition.GetExped
|
|||
List<CommonProto.Hero> heroList = new ArrayList<>();
|
||||
Map<String, Hero> heroMap = user.getExpeditionManager().getHeroMap();
|
||||
for(Hero hero : heroMap.values()){
|
||||
heroList.add(CBean2Proto.getHero(hero));
|
||||
heroList.add(CBean2Proto.getHero(user,hero));
|
||||
}
|
||||
builder.addAllHeroList(heroList);
|
||||
Map<String, PropertyItem> equipMap = user.getExpeditionManager().getEquipMap();
|
||||
|
|
|
@ -110,7 +110,7 @@ public class HeroNodeGetInfoRequestHandler extends BaseHandler<Expedition.HeroNo
|
|||
// 英雄战力
|
||||
inner.setForce(HeroLogic.getInstance().calForce(heroNotBufferAttribute));
|
||||
// 英雄
|
||||
inner.setHero(CBean2Proto.getHero(hero));
|
||||
inner.setHero(CBean2Proto.getHero(user,hero));
|
||||
builder.addViewHeroInfo(inner);
|
||||
user.getExpeditionManager().getGHeroSet().add(hero.getTemplateId());
|
||||
});
|
||||
|
|
|
@ -100,7 +100,7 @@ public class HeroNodeRequestHandler extends BaseHandler<Expedition.HeroNodeReque
|
|||
}
|
||||
|
||||
|
||||
drop.addHero(CBean2Proto.getHero(hero));
|
||||
drop.addHero(CBean2Proto.getHero(user,hero));
|
||||
|
||||
//clear temp
|
||||
// user.getExpeditionManager().clearEquipToTemp();
|
||||
|
|
|
@ -112,7 +112,6 @@ public class GMRequestHandler extends BaseHandler{
|
|||
prarm1 = Integer.parseInt(commandArray[1]);
|
||||
if (prarm1 ==1){
|
||||
prarm3 = commandArray[2].replace(",","#");
|
||||
// prarm2 = Integer.parseInt(commandArray[2]);
|
||||
}else{
|
||||
if (gmCommandType == GlobalGm.RESET_USER_NAME){
|
||||
prarm3 = commandArray[2];
|
||||
|
@ -165,7 +164,7 @@ public class GMRequestHandler extends BaseHandler{
|
|||
}
|
||||
hero.setBreakId(breakId);
|
||||
}
|
||||
CommonProto.Hero finalHeroProto = CBean2Proto.getHero(hero);
|
||||
CommonProto.Hero finalHeroProto = CBean2Proto.getHero(cUser,hero);
|
||||
gmBuilder.setDrop(CommonProto.Drop.newBuilder().addHero(finalHeroProto).build());
|
||||
|
||||
break;
|
||||
|
@ -367,7 +366,7 @@ public class GMRequestHandler extends BaseHandler{
|
|||
heroTmp.setBreakId(scHeroRankUpConfigBreak.getId());
|
||||
}
|
||||
}
|
||||
gmBuilder.setDrop(CommonProto.Drop.newBuilder().addHero(CBean2Proto.getHero(heroTmp)).build());
|
||||
gmBuilder.setDrop(CommonProto.Drop.newBuilder().addHero(CBean2Proto.getHero(cUser,heroTmp)).build());
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -58,7 +58,7 @@ public class GetAllHerosHandler extends BaseHandler{
|
|||
}
|
||||
}
|
||||
}
|
||||
heroList.add(CBean2Proto.getHero(hero));
|
||||
heroList.add(CBean2Proto.getHero(user,hero));
|
||||
}
|
||||
boolean isSendFinish = false;
|
||||
int endIndex = startIndex + Global.SEND_CARD_COUNT;
|
||||
|
|
|
@ -205,7 +205,7 @@ public class GetPlayerInfoHandler extends BaseHandler{
|
|||
.setQuestionState(questState)
|
||||
.setSoulEquipPool(equipPool)
|
||||
.addAllPlayedMapTypes(mapManager.getPlayedMapType())
|
||||
.setAmount(newRechargeInfo.getRr())
|
||||
.setAmount(BuyGoodsNewLogic.getAllAmount(user))
|
||||
.setVipDaily(playerInfoManager.getHadTakeDailyBoxVip())
|
||||
.setMissingRefreshCount(vipPrivilageValue)
|
||||
.addAllMonthinfos(PlayerLogic.getInstance().getMonthCardInfo(user))
|
||||
|
@ -219,6 +219,8 @@ public class GetPlayerInfoHandler extends BaseHandler{
|
|||
.addAllUserMountList(CBean2Proto.getUserMountList(user))
|
||||
.addAllUserSkinList(CBean2Proto.getUserSkinList(user))
|
||||
.addAllUserTitleList(CBean2Proto.getUserTitleList(user))
|
||||
.setPracticeLevel(heroManager.getPracticeLevel())
|
||||
.addAllSealList(CBean2Proto.getPurpleMansionSealInfo(user))
|
||||
.build();
|
||||
ReportUtil.onReportEvent(user, ReportEventEnum.APP_LOGIN.getType());
|
||||
try {
|
||||
|
@ -227,14 +229,11 @@ public class GetPlayerInfoHandler extends BaseHandler{
|
|||
MessageUtil.sendIndicationMessage(iSession, 1, MessageTypeProto.MessageType.WorldLevelIndication_VALUE, PlayerInfoProto.WorldLevelIndication.newBuilder().setWorldLeve(GlobleSystemLogic.getGloableWorldLeveCache()).build(), true);
|
||||
MessageUtil.sendMessage(iSession, 1, MessageTypeProto.MessageType.GET_PLAYERINFO_RESPONSE_VALUE, getPlayerInfoResponse, true);
|
||||
|
||||
// DoFix.getInstance().loginFix(user);
|
||||
if(playerInfoManager.getIsdayFirst()==0){
|
||||
playerInfoManager.setIsdayFirst(1);
|
||||
}
|
||||
RedisUtil.getInstence().set(RedisKey.USER_LOGIN_URL + userId, RPCServerTask.userCallBackUrl);
|
||||
/*if(user.getPlayerInfoManager().getGuidePoints().get(1)!=-1){
|
||||
user.getPlayerInfoManager().updateGuidePoint(1,-1);
|
||||
}*/
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
|
|
@ -70,7 +70,7 @@ public class DoHeroChangeRequestHandler extends BaseHandler<HeroInfoProto.DoHer
|
|||
newHero.setEquipByPositionMap(hero.getEquipByPositionMap());
|
||||
newHero.setJewelInfo(hero.getJewelInfo());
|
||||
user.getHeroManager().addHero(newHero);
|
||||
drop.addHero(CBean2Proto.getHero(newHero));
|
||||
drop.addHero(CBean2Proto.getHero(user,newHero));
|
||||
//新头像
|
||||
SItem sItem = SItem.getsItemMap().get(hero.getChangeId());
|
||||
if(sItem != null){
|
||||
|
|
|
@ -0,0 +1,102 @@
|
|||
package com.ljsd.jieling.handler.hero;
|
||||
|
||||
import com.google.protobuf.GeneratedMessage;
|
||||
import com.ljsd.jieling.exception.ErrorCode;
|
||||
import com.ljsd.jieling.exception.ErrorCodeException;
|
||||
import com.ljsd.jieling.handler.BaseHandler;
|
||||
import com.ljsd.jieling.logic.dao.PurpleMansionSeal;
|
||||
import com.ljsd.jieling.logic.dao.UserManager;
|
||||
import com.ljsd.jieling.logic.dao.root.User;
|
||||
import com.ljsd.jieling.network.session.ISession;
|
||||
import com.ljsd.jieling.util.CBean2Proto;
|
||||
import com.ljsd.jieling.util.MessageUtil;
|
||||
import org.springframework.stereotype.Component;
|
||||
import rpc.protocols.CommonProto;
|
||||
import rpc.protocols.HeroInfoProto;
|
||||
import rpc.protocols.MessageTypeProto;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
/**
|
||||
* @Author hj
|
||||
* @Description 修改神印状态
|
||||
* 三种类型
|
||||
* 1: oldSealId != newSealId : 替换神印
|
||||
* 2: oldSealId == newSealId && newSealId.subId == subId : 卸载神印
|
||||
* 3: oldSealId == newSealId && newSealId.subId != subId : 替换神印英雄
|
||||
* @Date $ $
|
||||
* @Param $
|
||||
* @return $
|
||||
**/
|
||||
|
||||
@Component
|
||||
public class ReplacePurpleMansionSealHandler extends BaseHandler<HeroInfoProto.ReplacePurpleMansionSealRequest> {
|
||||
@Override
|
||||
public MessageTypeProto.MessageType getMessageCode() {
|
||||
return MessageTypeProto.MessageType.ReplacePurpleMansionSealRequest;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void processWithProto(ISession iSession, HeroInfoProto.ReplacePurpleMansionSealRequest proto) throws Exception {
|
||||
// 用户信息
|
||||
User user = UserManager.getUser(iSession.getUid());
|
||||
if (user == null) {
|
||||
throw new ErrorCodeException(ErrorCode.UNKNOWN);
|
||||
}
|
||||
|
||||
// 获取参数
|
||||
int oldSealId = proto.getOldSealId();
|
||||
int newSealId = proto.getNewSealId();
|
||||
String subId = proto.getSubId();
|
||||
|
||||
// 神印列表
|
||||
Map<Integer, PurpleMansionSeal> sealMap = user.getHeroManager().getPurpleMansionSeal();
|
||||
|
||||
// 替换神印
|
||||
if (oldSealId != newSealId){
|
||||
PurpleMansionSeal newSeal = sealMap.get(newSealId);
|
||||
if (newSeal == null){
|
||||
throw new ErrorCodeException("神印不存在!");
|
||||
}
|
||||
if (newSeal.getType() == 1 && (subId == null || "".equals(subId))){
|
||||
throw new ErrorCodeException("英雄id不能为空!");
|
||||
}
|
||||
// 旧神印状态修改
|
||||
PurpleMansionSeal oldSeal = sealMap.get(oldSealId);
|
||||
if (oldSeal != null){
|
||||
oldSeal.setState(0);
|
||||
user.getHeroManager().putPurpleMansionSeal(oldSeal);
|
||||
}
|
||||
|
||||
// 新神印状态修改
|
||||
newSeal.setState(1);
|
||||
// 附属英雄id修改,类型之后需要读表
|
||||
if (!newSeal.getSubId().equals(subId) && newSeal.getType() == 1){
|
||||
newSeal.setSubId(subId);
|
||||
}
|
||||
user.getHeroManager().putPurpleMansionSeal(newSeal);
|
||||
}
|
||||
// 相同神印
|
||||
else {
|
||||
PurpleMansionSeal seal = sealMap.get(newSealId);
|
||||
// 卸载神印
|
||||
if (seal.getSubId().equals(subId)){
|
||||
seal.setState(0);
|
||||
}
|
||||
// 替换英雄id
|
||||
else {
|
||||
if (seal.getType() != 1){
|
||||
throw new ErrorCodeException("神印类型错误!");
|
||||
}
|
||||
seal.setSubId(subId);
|
||||
}
|
||||
user.getHeroManager().putPurpleMansionSeal(seal);
|
||||
}
|
||||
|
||||
// 返回最新神印列表
|
||||
List<CommonProto.PurpleMansionSeal> sealInfo = CBean2Proto.getPurpleMansionSealInfo(user);
|
||||
HeroInfoProto.ReplacePrupleMansionSealResponse build = HeroInfoProto.ReplacePrupleMansionSealResponse.newBuilder().addAllSealList(sealInfo).build();
|
||||
|
||||
MessageUtil.sendMessage(iSession,1,MessageTypeProto.MessageType.ReplacePurpleMansionSealResponse_VALUE,build,true);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,96 @@
|
|||
package com.ljsd.jieling.handler.hero;
|
||||
|
||||
import com.google.protobuf.GeneratedMessage;
|
||||
import com.ljsd.jieling.exception.ErrorCode;
|
||||
import com.ljsd.jieling.exception.ErrorCodeException;
|
||||
import com.ljsd.jieling.globals.BIReason;
|
||||
import com.ljsd.jieling.handler.BaseHandler;
|
||||
import com.ljsd.jieling.logic.dao.PurpleMansionSeal;
|
||||
import com.ljsd.jieling.logic.dao.UserManager;
|
||||
import com.ljsd.jieling.logic.dao.root.User;
|
||||
import com.ljsd.jieling.logic.hardStage.HardStageLogic;
|
||||
import com.ljsd.jieling.network.session.ISession;
|
||||
import com.ljsd.jieling.util.CBean2Proto;
|
||||
import com.ljsd.jieling.util.ItemUtil;
|
||||
import com.ljsd.jieling.util.MessageUtil;
|
||||
import config.SXiuXian;
|
||||
import config.SXiuXianSkill;
|
||||
import manager.STableManager;
|
||||
import org.springframework.stereotype.Component;
|
||||
import rpc.protocols.CommonProto;
|
||||
import rpc.protocols.HeroInfoProto;
|
||||
import rpc.protocols.MessageTypeProto;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author hj
|
||||
* @Description 修行玩法,升级
|
||||
* @Date $ $
|
||||
* @Param $
|
||||
* @return $
|
||||
**/
|
||||
@Component
|
||||
public class UpPracticeLevelHandler extends BaseHandler<HeroInfoProto.UpPracticeLevelRequest> {
|
||||
|
||||
@Override
|
||||
public MessageTypeProto.MessageType getMessageCode() {
|
||||
return MessageTypeProto.MessageType.UpPracticeLevelRequest;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void processWithProto(ISession iSession, HeroInfoProto.UpPracticeLevelRequest proto) throws Exception {
|
||||
// 用户信息
|
||||
User user = UserManager.getUser(iSession.getUid());
|
||||
if (user == null) {
|
||||
throw new ErrorCodeException(ErrorCode.UNKNOWN);
|
||||
}
|
||||
|
||||
// 获取当前等级和之后的等级
|
||||
int level = user.getHeroManager().getPracticeLevel();
|
||||
if (level <= 0){
|
||||
level = 1;
|
||||
}
|
||||
|
||||
SXiuXian xiuXian = STableManager.getConfig(SXiuXian.class).get(level);
|
||||
SXiuXian xiuXian2 = STableManager.getConfig(SXiuXian.class).get(level+1);
|
||||
if (xiuXian == null || xiuXian2 == null){
|
||||
throw new ErrorCodeException("已修行至世间巅峰");
|
||||
}
|
||||
|
||||
// 山河社稷图的星星,先用等级代替,之后要改
|
||||
int star = HardStageLogic.getHardStageStarsSum(user);
|
||||
if (star < xiuXian.getNeedStarNum()){
|
||||
throw new ErrorCodeException("无法破境,请前往山河社稷图获取更多星星!");
|
||||
}
|
||||
|
||||
// 验证道具消耗
|
||||
boolean cost = ItemUtil.itemCost(user, xiuXian.getLevelUpCost(), BIReason.UP_PRACTICE_LEVEL, 0);
|
||||
if (!cost){
|
||||
throw new ErrorCodeException("道具不足!",ErrorCode.ITEM_NOT_ENOUGH);
|
||||
}
|
||||
|
||||
// 升级
|
||||
user.getHeroManager().setPracticeLevel(xiuXian2.getId());
|
||||
|
||||
// 添加技能
|
||||
if (xiuXian2.getTeamSkill() != null){
|
||||
for (int seal : xiuXian2.getTeamSkill()) {
|
||||
SXiuXianSkill xianSkill = STableManager.getConfig(SXiuXianSkill.class).get(seal);
|
||||
// 添加新神印
|
||||
PurpleMansionSeal purpleMansionSeal = new PurpleMansionSeal(seal, xianSkill.getType(),"",0);
|
||||
user.getHeroManager().putPurpleMansionSeal(purpleMansionSeal);
|
||||
}
|
||||
|
||||
// 推送神印信息
|
||||
List<CommonProto.PurpleMansionSeal> sealInfo = CBean2Proto.getPurpleMansionSealInfo(user);
|
||||
HeroInfoProto.PurpleMansionSealIndication build2 = HeroInfoProto.PurpleMansionSealIndication.newBuilder().addAllSealList(sealInfo).build();
|
||||
MessageUtil.sendIndicationMessage(iSession,1, MessageTypeProto.MessageType.PurpleMansionSealIndication_VALUE,build2,true);
|
||||
}
|
||||
|
||||
// 升级返回
|
||||
HeroInfoProto.UpPracticeLevelResponse build = HeroInfoProto.UpPracticeLevelResponse.newBuilder().setPracticeLevel(xiuXian2.getId()).build();
|
||||
MessageUtil.sendMessage(iSession,1, MessageTypeProto.MessageType.UpPracticeLevelResponse_VALUE,build,true);
|
||||
}
|
||||
|
||||
}
|
|
@ -1,6 +1,7 @@
|
|||
package com.ljsd.jieling.ktbeans.reportEvent;
|
||||
|
||||
import com.ljsd.jieling.logic.dao.root.User;
|
||||
import com.ljsd.jieling.logic.store.BuyGoodsNewLogic;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
|
@ -19,10 +20,10 @@ public class ChargeAmountEventHandler extends CommonEventHandler {
|
|||
Map<String, Object> setOnceProperties = new HashMap<>();
|
||||
|
||||
|
||||
setProperties.put("charge_amount",user.getPlayerInfoManager().getNewRechargeInfo().getRr());
|
||||
setProperties.put("charge_amount", BuyGoodsNewLogic.getAllAmount(user));
|
||||
setProperties.put("last_recharge_time",new Date());
|
||||
setOnceProperties.put("first_charge_time",new Date());
|
||||
setOnceProperties.put("first_charge_amount",user.getPlayerInfoManager().getNewRechargeInfo().getRr());
|
||||
setOnceProperties.put("first_charge_amount",BuyGoodsNewLogic.getAllAmount(user));
|
||||
userProperties.put(1,setProperties);
|
||||
userProperties.put(2,setOnceProperties);
|
||||
return userProperties;
|
||||
|
|
|
@ -7,10 +7,7 @@ import com.ljsd.jieling.logic.dao.root.User;
|
|||
import com.ljsd.jieling.logic.hero.HongMengAttributeEnum;
|
||||
import config.SSpecialConfig;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.*;
|
||||
|
||||
public class HeroManager extends MongoBase {
|
||||
|
||||
|
@ -22,7 +19,9 @@ public class HeroManager extends MongoBase {
|
|||
|
||||
private Map<Integer,Integer> mustRandomCount= new HashMap<>();
|
||||
|
||||
private Map<Integer,Integer> randomPoolInfo = new HashMap<>();//每个池子抽了多少次的信息
|
||||
//每个池子抽了多少次的信息
|
||||
private Map<Integer,Integer> randomPoolInfo = new HashMap<>();
|
||||
|
||||
private Map<Integer,Integer> heroHandBook = new HashMap<>();
|
||||
private Set<Integer> heroHandBookEnabled = new HashSet<>();
|
||||
|
||||
|
@ -51,6 +50,15 @@ public class HeroManager extends MongoBase {
|
|||
// 鸿蒙碑最大等级,添加限制,
|
||||
private Set<Integer> hongmengMaxLevel = new HashSet<>();
|
||||
|
||||
/**
|
||||
* 修行等级
|
||||
*/
|
||||
private int practiceLevel;
|
||||
/**
|
||||
* 紫府神印
|
||||
*/
|
||||
private Map<Integer,PurpleMansionSeal> purpleMansionSeal = new HashMap<>();
|
||||
|
||||
public void updateRandCount(int type,int count){
|
||||
updateString("totalCount." + type, count);
|
||||
totalCount.put(type,count);
|
||||
|
@ -262,5 +270,29 @@ public class HeroManager extends MongoBase {
|
|||
randomPoolInfo.put(poolId,randomPoolInfo.getOrDefault(poolId,0)+1);
|
||||
updateString("randomPoolInfo", randomPoolInfo);
|
||||
}
|
||||
|
||||
|
||||
public int getPracticeLevel() {
|
||||
return practiceLevel;
|
||||
}
|
||||
|
||||
public void setPracticeLevel(int practiceLevel) {
|
||||
this.practiceLevel = practiceLevel;
|
||||
updateString("practiceLevel", practiceLevel);
|
||||
}
|
||||
|
||||
public Map<Integer, PurpleMansionSeal> getPurpleMansionSeal() {
|
||||
return purpleMansionSeal;
|
||||
}
|
||||
|
||||
public void setPurpleMansionSeal(Map<Integer, PurpleMansionSeal> purpleMansionSeal) {
|
||||
this.purpleMansionSeal = purpleMansionSeal;
|
||||
updateString("purpleMansionSeal", purpleMansionSeal);
|
||||
}
|
||||
|
||||
public void putPurpleMansionSeal(PurpleMansionSeal seal) {
|
||||
purpleMansionSeal.put(seal.getSealId(),seal);
|
||||
updateString("purpleMansionSeal", purpleMansionSeal);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -73,8 +73,8 @@ public class PlayerManager extends MongoBase {
|
|||
|
||||
private Set<Integer> reds = new CopyOnWriteArraySet<>();
|
||||
|
||||
// private RechargeInfo rechargeInfo;
|
||||
private NewRechargeInfo newRechargeInfo = new NewRechargeInfo();
|
||||
private RechargeInfo rechargeInfo;
|
||||
private NewRechargeInfo newRechargeInfo;
|
||||
private Map<Integer,Integer> monthCard = new HashMap<>();//月卡信息
|
||||
private Set<Integer> monthCardDailyTake = new HashSet<>();
|
||||
|
||||
|
@ -467,9 +467,9 @@ public class PlayerManager extends MongoBase {
|
|||
removeString(getMongoKey() +".vipInfo."+privilageId);
|
||||
}
|
||||
|
||||
// public RechargeInfo getRechargeInfo() {
|
||||
// return rechargeInfo;
|
||||
// }
|
||||
public RechargeInfo getRechargeInfo() {
|
||||
return rechargeInfo;
|
||||
}
|
||||
//
|
||||
// public void setRechargeInfo(RechargeInfo rechargeInfo) {
|
||||
// rechargeInfo.init(this.getRootId(), getMongoKey()+".rechargeInfo");
|
||||
|
|
|
@ -0,0 +1,76 @@
|
|||
package com.ljsd.jieling.logic.dao;
|
||||
|
||||
/**
|
||||
* @Author hj
|
||||
* @Description //TODO $
|
||||
* @Date $ $
|
||||
* @Param $
|
||||
* @return $
|
||||
**/
|
||||
|
||||
import com.ljsd.common.mogodb.MongoBase;
|
||||
|
||||
public class PurpleMansionSeal extends MongoBase {
|
||||
|
||||
/**
|
||||
* 印章id
|
||||
*/
|
||||
private int sealId;
|
||||
/**
|
||||
* 印章类型
|
||||
*/
|
||||
private int type;
|
||||
/**
|
||||
* 附属id,英雄id
|
||||
*/
|
||||
private String subId;
|
||||
/**
|
||||
* 状态
|
||||
* 0:未使用
|
||||
* 1:已使用
|
||||
*/
|
||||
private int state;
|
||||
|
||||
public PurpleMansionSeal(int sealId, int type, String subId, int state) {
|
||||
this.sealId = sealId;
|
||||
this.type = type;
|
||||
this.subId = subId;
|
||||
this.state = state;
|
||||
}
|
||||
|
||||
public int getSealId() {
|
||||
return sealId;
|
||||
}
|
||||
|
||||
public void setSealId(int sealId) {
|
||||
this.sealId = sealId;
|
||||
updateString("sealId", sealId);
|
||||
}
|
||||
|
||||
public int getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType(int type) {
|
||||
this.type = type;
|
||||
updateString("type", type);
|
||||
}
|
||||
|
||||
public String getSubId() {
|
||||
return subId;
|
||||
}
|
||||
|
||||
public void setSubId(String subId) {
|
||||
this.subId = subId;
|
||||
updateString("subId", subId);
|
||||
}
|
||||
|
||||
public int getState() {
|
||||
return state;
|
||||
}
|
||||
|
||||
public void setState(int state) {
|
||||
this.state = state;
|
||||
updateString("state", state);
|
||||
}
|
||||
}
|
|
@ -1,15 +1,14 @@
|
|||
//package com.ljsd.jieling.logic.dao;
|
||||
package com.ljsd.jieling.logic.dao;
|
||||
|
||||
import com.ljsd.common.mogodb.MongoBase;
|
||||
import io.netty.util.internal.ConcurrentSet;
|
||||
import org.springframework.data.annotation.Transient;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
public class RechargeInfo extends MongoBase{
|
||||
//
|
||||
//import com.ljsd.common.mogodb.MongoBase;
|
||||
//import config.SRechargeCommodityConfig;
|
||||
//import io.netty.util.internal.ConcurrentSet;
|
||||
//import org.springframework.data.annotation.Transient;
|
||||
//
|
||||
//import java.util.*;
|
||||
//
|
||||
//public class RechargeInfo extends MongoBase{
|
||||
//
|
||||
// private double saveAmt;//累计充值
|
||||
private double saveAmt;//累计充值;
|
||||
//
|
||||
// private double monthSaveAmt ; //月卡累计总额
|
||||
// private double smonthSaveAmt ; //豪华月卡累计总额
|
||||
|
@ -144,9 +143,9 @@
|
|||
// }
|
||||
//
|
||||
//
|
||||
// public double getSaveAmt() {
|
||||
// return saveAmt;
|
||||
// }
|
||||
public double getSaveAmt() {
|
||||
return saveAmt;
|
||||
}
|
||||
//
|
||||
// public long getCreateTime() {
|
||||
// return createTime;
|
||||
|
@ -270,4 +269,4 @@
|
|||
// }
|
||||
//
|
||||
//
|
||||
//}
|
||||
}
|
||||
|
|
|
@ -29,7 +29,6 @@ import com.ljsd.jieling.logic.fight.passiveSkillCal.PassiveskillCalEnum;
|
|||
import com.ljsd.jieling.logic.item.ItemLogic;
|
||||
import com.ljsd.jieling.logic.mission.GameEvent;
|
||||
import com.ljsd.jieling.logic.player.PlayerLogic;
|
||||
import com.ljsd.jieling.network.server.ProtocolsManager;
|
||||
import com.ljsd.jieling.network.session.ISession;
|
||||
import com.ljsd.jieling.util.*;
|
||||
import config.*;
|
||||
|
@ -46,7 +45,6 @@ import java.util.*;
|
|||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
public class HeroLogic{
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(HeroLogic.class);
|
||||
|
@ -186,9 +184,10 @@ public class HeroLogic{
|
|||
if(type==4){
|
||||
Map<String, PropertyItem> equipMap = user.getEquipManager().getEquipMap();
|
||||
for(PropertyItem equipInfo: equipMap.values()){
|
||||
if(equipInfo instanceof Jewel)
|
||||
if(equipInfo instanceof Jewel) {
|
||||
equipList.add(CBean2Proto.getEquipProto(equipInfo));
|
||||
}
|
||||
}
|
||||
}else {
|
||||
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
|
||||
}
|
||||
|
@ -1445,27 +1444,14 @@ public class HeroLogic{
|
|||
skillList.addAll(tempHero.getPassiveSkills(1, hero.getBreakIdByHongMeng(user.getHeroManager())));
|
||||
skillList.addAll(tempHero.getPassiveSkills(2, hero.getStarBreakId()));
|
||||
}
|
||||
//装备没有技能不用计算
|
||||
// Map<Integer, Integer> equipByPositionMap = hero.getEquipByPositionMap();
|
||||
// if(!equipByPositionMap.isEmpty()){
|
||||
// Map<String, PropertyItem> equipMap = hero.getCreateType()==1?user.getExpeditionManager().getEquipMap():user.getEquipManager().getEquipMap();
|
||||
// for(Integer position : equipSkillPositionTemaplge){
|
||||
// Integer equipId = equipByPositionMap.get(position);
|
||||
// if(equipId==null){
|
||||
// continue;
|
||||
// }
|
||||
// int skillId = equipMap.get(equipId).getSkill();
|
||||
// if(skillId!=0){
|
||||
// skillList.add(skillId);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
//魂印
|
||||
Map<Integer, Integer> soulEquipByPositionMap = hero.getSoulEquipByPositionMap();
|
||||
Map<Integer, SEquipConfig> config = STableManager.getConfig(SEquipConfig.class);
|
||||
soulEquipByPositionMap.values().forEach(e->{
|
||||
Arrays.stream(config.get(e).getPassiveSkill()).forEach(skillList::add);
|
||||
});
|
||||
|
||||
//法宝技能
|
||||
int[] equipTalismana = tempHero.getEquipTalismana();
|
||||
if(equipTalismana.length<1 ||hero.getStar()<equipTalismana[0]){
|
||||
|
@ -1479,9 +1465,65 @@ public class HeroLogic{
|
|||
Arrays.stream(v.getOpenSkillRules()).forEach(i->skillList.add(i));
|
||||
}
|
||||
});
|
||||
|
||||
// 紫府神印技能
|
||||
Collection<PurpleMansionSeal> seals = user.getHeroManager().getPurpleMansionSeal().values();
|
||||
seals.forEach(v->{
|
||||
// 使用中神印
|
||||
if (v.getState() == 1){
|
||||
// 附身神印
|
||||
if (v.getType() == 1){
|
||||
if (v.getSubId().equals(hero.getId())){
|
||||
getPurpleMansionSealSkill(v.getSealId(),tempHero,skillList);
|
||||
}
|
||||
}
|
||||
// 通用神印
|
||||
else {
|
||||
getPurpleMansionSealSkill(v.getSealId(),tempHero,skillList);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
return skillList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取紫府神印技能
|
||||
* @param sealId
|
||||
* @param tempHero
|
||||
* @param skillList
|
||||
*/
|
||||
private void getPurpleMansionSealSkill(int sealId,SCHero tempHero,List<Integer> skillList){
|
||||
SXiuXianSkill xianSkill = STableManager.getConfig(SXiuXianSkill.class).get(sealId);
|
||||
// 技能数组转list
|
||||
int skillId = xianSkill.getSkillId();
|
||||
if (skillId <= 0){
|
||||
return;
|
||||
}
|
||||
// 适用范围
|
||||
int[] fitList = xianSkill.getFitList();
|
||||
switch (fitList[0]){
|
||||
case 0:
|
||||
// 不限
|
||||
skillList.add(skillId);
|
||||
break;
|
||||
case 1:
|
||||
// 阵营限制
|
||||
if (tempHero.getPropertyName() == fitList[1]){
|
||||
skillList.add(skillId);
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
// 职业限制
|
||||
if (tempHero.getProfession() == fitList[1]){
|
||||
skillList.add(skillId);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public void coverSkill(List<Integer> heroSkillList){
|
||||
Set<Integer> coverSkillIds = new HashSet<>();
|
||||
heroSkillList.forEach(skill->{
|
||||
|
@ -1676,6 +1718,15 @@ public class HeroLogic{
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 计算队伍战力
|
||||
* @param user
|
||||
* @param hero
|
||||
* @param isForce
|
||||
* @param teamId
|
||||
* @return
|
||||
*/
|
||||
public Map<Integer,Long> calHeroNotBufferAttribute(User user, Hero hero,boolean isForce,int teamId){
|
||||
Map<Integer, Long> heroAllAttribute = calHeroAllAttribute(user, hero,isForce);
|
||||
heroAllAttribute.put(HeroAttributeEnum.CurHP.getPropertyId(),heroAllAttribute.get(GlobalsDef.HP_TYPE));
|
||||
|
@ -1690,7 +1741,8 @@ public class HeroLogic{
|
|||
if(teamId!=0){
|
||||
int heroNum = user.getTeamPosManager().getTeamPosForHero().get(teamId).size();
|
||||
if(teamId==GlobalsDef.TRIAL_TEAM){
|
||||
heroNum = 5;//森罗环境固定为5
|
||||
//森罗环境固定为5
|
||||
heroNum = 5;
|
||||
}
|
||||
int[][] pokemonAttr = calPokemonAttribute(pokemonManager);
|
||||
for(int i = 0 ; i <pokemonAttr.length;i++){
|
||||
|
@ -1739,11 +1791,10 @@ public class HeroLogic{
|
|||
}
|
||||
combinedAttribute(SPlayerHeadIcon.getHeadIconMap().get(entry.getKey()).getUnlockProperty(),heroAllAttribute);
|
||||
}
|
||||
|
||||
//装备总战力评分
|
||||
int equipForce=0;
|
||||
boolean needRemove = false;
|
||||
Iterator<Map.Entry<Integer, Integer>> iterator = hero.getEquipByHongmengPositionMap(user.getHeroManager()).entrySet().iterator();
|
||||
// Map<Integer,Integer> suiteNumByIdMap = new HashMap<>();
|
||||
// 套装list初始化
|
||||
ArrayList<SEquipConfig> suiteNumList = new ArrayList<>();
|
||||
while (iterator.hasNext()){
|
||||
|
@ -1756,7 +1807,6 @@ public class HeroLogic{
|
|||
}
|
||||
combinedAttribute(propertyValueByIdMap,heroAllAttribute);
|
||||
equipForce+=sEquipConfig.getScore();
|
||||
// suiteNumByIdMap.put(sEquipConfig.getId(),suiteNumByIdMap.getOrDefault(sEquipConfig.getSuiteID(),0)+1);
|
||||
// 添加到套装list
|
||||
suiteNumList.add(sEquipConfig);
|
||||
}
|
||||
|
@ -1783,39 +1833,6 @@ public class HeroLogic{
|
|||
num-=1;
|
||||
}
|
||||
}
|
||||
// if(!suiteNumByIdMap.isEmpty()){
|
||||
// suiteNumByIdMap.forEach((suiteId,suiteNums)->{
|
||||
// SEquipSuiteConfig sEquipSuiteConfig =SEquipSuiteConfig.config.get(suiteId);
|
||||
// if( null!=sEquipSuiteConfig){
|
||||
// Map<Integer, Integer> suitePropertyMap = sEquipSuiteConfig.getSuiteMap().get(suiteNums);
|
||||
// if(suitePropertyMap!=null){
|
||||
// combinedAttribute(suitePropertyMap,heroAllAttribute);
|
||||
// }
|
||||
// }
|
||||
// });
|
||||
// }
|
||||
if(needRemove){
|
||||
AyyncWorker ayyncWorker = new AyyncWorker(user,true,user1 -> {
|
||||
Map<String, Hero> heroMap = user1.getHeroManager().getHeroMap();
|
||||
for(Hero heroTmp : heroMap.values()){
|
||||
Iterator<Map.Entry<Integer, Integer>> iterator1 = heroTmp.getEquipByHongmengPositionMap(user.getHeroManager()).entrySet().iterator();
|
||||
boolean isUpate = false;
|
||||
while (iterator1.hasNext()){
|
||||
Map.Entry<Integer, Integer> next = iterator1.next();
|
||||
Integer equipId = next.getValue();
|
||||
PropertyItem equip = equipMap.get(equipId);
|
||||
if(equip == null){
|
||||
iterator1.remove();
|
||||
isUpate = true;
|
||||
}
|
||||
}
|
||||
if(isUpate){
|
||||
heroTmp.setEquipByPositionMap(heroTmp.getEquipByHongmengPositionMap(user.getHeroManager()));
|
||||
}
|
||||
}
|
||||
});
|
||||
ProtocolsManager.getInstance().updateAyncWorker(ayyncWorker);
|
||||
}
|
||||
|
||||
//工坊科技树加成
|
||||
Map<Integer, Integer> techProfressionMap = user.getWorkShopController().getTechnologyMap().get(scHero.getProfession());
|
||||
|
@ -1897,13 +1914,9 @@ public class HeroLogic{
|
|||
}
|
||||
}
|
||||
if(levelProperty!=0){
|
||||
// System.out.println("宝器强化共鸣"+"......"+propertyToString(config.get(levelProperty).getProperty()));
|
||||
|
||||
combinedAttribute(config.get(levelProperty).getProperty(),heroAllAttribute);
|
||||
}
|
||||
if(buildLevelProperty!=0){
|
||||
// System.out.println("宝器精炼共鸣"+"......"+propertyToString(config.get(buildLevelProperty).getProperty()));
|
||||
|
||||
combinedAttribute(config.get(buildLevelProperty).getProperty(),heroAllAttribute);
|
||||
}
|
||||
}
|
||||
|
@ -1917,8 +1930,16 @@ public class HeroLogic{
|
|||
}
|
||||
});
|
||||
|
||||
// 修行等级属性加成
|
||||
Map<Integer, SXiuXian> xiuXianMap = STableManager.getConfig(SXiuXian.class);
|
||||
int practiceLevel = user.getHeroManager().getPracticeLevel();
|
||||
for (SXiuXian v : xiuXianMap.values()) {
|
||||
if (practiceLevel >= v.getId() && v.getTotalPros() != null){
|
||||
combinedAttribute(v.getTotalPros(),heroAllAttribute);
|
||||
}
|
||||
}
|
||||
|
||||
// //皮肤、称号加成
|
||||
// //皮肤、称号加成 -- 前端未实现,暂时注释
|
||||
// int decoration = user.getPlayerInfoManager().getDecoration();
|
||||
// int designation = user.getPlayerInfoManager().getDesignation();
|
||||
// if(decoration!=0&&SPlayerAppearance.sPlayerAppearanceMap.get(decoration)!=null){
|
||||
|
@ -1927,12 +1948,13 @@ public class HeroLogic{
|
|||
// combinedAttribute(SPlayerAppearance.sPlayerAppearanceMap.get(designation).getProperty(),heroAllAttribute);
|
||||
// }
|
||||
//
|
||||
// //坐骑加成
|
||||
// //坐骑加成 -- 前端未实现,暂时注释
|
||||
// if(user.getPlayerInfoManager().getRide()!=0){
|
||||
// int rideLevel = user.getPlayerInfoManager().getRideLevel();
|
||||
// int[][] property = SPlayerMountLevelUp.sPlayerMountLevelUpMap.get(rideLevel).getProperty();
|
||||
// combinedAttribute(property,heroAllAttribute);
|
||||
// }
|
||||
|
||||
//公会技能加成
|
||||
Map<Integer, Integer> guildSkill = user.getGuildMyInfo().getGuildSkill();
|
||||
if(guildSkill.containsKey(scHero.getProfession())){
|
||||
|
@ -1952,9 +1974,7 @@ public class HeroLogic{
|
|||
combinedAttribute(arraySkills,heroAllAttribute);
|
||||
}
|
||||
|
||||
|
||||
//阵营光环加成
|
||||
|
||||
if(teamId!=0){
|
||||
try {
|
||||
int[][] elementEffect = CombatLogic.getInstance().elementEffect(user,teamId);
|
||||
|
@ -1991,8 +2011,6 @@ public class HeroLogic{
|
|||
}
|
||||
});
|
||||
|
||||
|
||||
|
||||
if(!heroSkillAdMap.isEmpty()){
|
||||
combinedAttribute(heroSkillAdMap,heroAllAttribute);
|
||||
heroSkillAdMap.clear();
|
||||
|
@ -2046,14 +2064,6 @@ public class HeroLogic{
|
|||
return heroAllAttribute;
|
||||
}
|
||||
|
||||
private String propertyToString(int[][] property){
|
||||
StringBuilder builder = new StringBuilder();
|
||||
for(int[] pro:property){
|
||||
builder.append(pro[0]).append("#").append(pro[1]).append("\n");
|
||||
}
|
||||
return builder.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* 计算机器人英雄熟悉
|
||||
* @param scHero
|
||||
|
|
|
@ -625,7 +625,7 @@ public class PlayerLogic {
|
|||
builder.addEquip(CBean2Proto.getEquipProto(equipId));
|
||||
}
|
||||
builder.setForce(HeroLogic.getInstance().calForce(heroNotBufferAttribute));
|
||||
builder.setHero(CBean2Proto.getHero(hero));
|
||||
builder.setHero(CBean2Proto.getHero(userInMem,hero));
|
||||
Map<Integer, Integer> guildSkill = userInMem.getGuildMyInfo().getGuildSkill();
|
||||
int profession = SCHero.getsCHero().get(hero.getTemplateId()).getProfession();
|
||||
Integer skill = guildSkill.getOrDefault(profession, 0);
|
||||
|
|
|
@ -21,6 +21,7 @@ import com.ljsd.jieling.logic.activity.event.NewWelfareEvent;
|
|||
import com.ljsd.jieling.logic.activity.event.NewWelfareTypeEnum;
|
||||
import com.ljsd.jieling.logic.activity.event.Poster;
|
||||
import com.ljsd.jieling.logic.dao.PlayerManager;
|
||||
import com.ljsd.jieling.logic.dao.RechargeInfo;
|
||||
import com.ljsd.jieling.logic.dao.UserManager;
|
||||
import com.ljsd.jieling.logic.dao.VipInfo;
|
||||
import com.ljsd.jieling.logic.dao.root.User;
|
||||
|
@ -63,19 +64,31 @@ public class BuyGoodsNewLogic {
|
|||
return RechargeType.getHandler(type);
|
||||
}
|
||||
|
||||
|
||||
//获取充值总金额,结合前面的
|
||||
public static double getAllAmount(User user){
|
||||
PlayerManager playerInfoManager = user.getPlayerInfoManager();
|
||||
NewRechargeInfo newRechargeInfo = playerInfoManager.getNewRechargeInfo();
|
||||
RechargeInfo rechargeInfo = playerInfoManager.getRechargeInfo();
|
||||
double amount = newRechargeInfo.getRr();
|
||||
if(rechargeInfo!=null){
|
||||
amount+=rechargeInfo.getSaveAmt();
|
||||
}
|
||||
return amount;
|
||||
}
|
||||
/**
|
||||
* 登录刷新礼包
|
||||
*/
|
||||
public static boolean refreshWelfareState(User user) throws Exception {
|
||||
dailyRefresh(user);
|
||||
sendDailyMailReward(user);
|
||||
boolean needChange = false;
|
||||
List<AbstractWelfareBag> pAddList = new ArrayList<>();
|
||||
NewRechargeInfo info = user.getPlayerInfoManager().getNewRechargeInfo();
|
||||
if(info == null){
|
||||
info = new NewRechargeInfo();
|
||||
user.getPlayerInfoManager().setNewRechargeInfo(info);
|
||||
}
|
||||
dailyRefresh(user);
|
||||
sendDailyMailReward(user);
|
||||
boolean needChange = false;
|
||||
List<AbstractWelfareBag> pAddList = new ArrayList<>();
|
||||
for(Map.Entry<Integer,SRechargeCommodityNewConfig> entry : SRechargeCommodityNewConfig.configMap.entrySet()){
|
||||
//获取处理类
|
||||
RechargeHandler rechargeHandler = getRechargeHandler(entry.getValue().getOtype());
|
||||
|
@ -184,6 +197,9 @@ public class BuyGoodsNewLogic {
|
|||
sendGoodsByType(user,config,dropByBag);
|
||||
|
||||
if(config.getAccumulativeRecharge() == 1){
|
||||
if(info.getMaxSingleR() < price){
|
||||
info.setMaxSingleR(price);
|
||||
}
|
||||
info.setRr(MathUtils.doubleAdd(price,info.getRr()));
|
||||
//处理月卡
|
||||
user.getPlayerInfoManager().getMonthCard();
|
||||
|
@ -664,13 +680,17 @@ public class BuyGoodsNewLogic {
|
|||
return;
|
||||
}
|
||||
int popup = 0;
|
||||
boolean push = false;
|
||||
for(SPackPushConfig con : list){
|
||||
int bagId = judgePushCondition(user,con);
|
||||
//条件成功
|
||||
if(bagId > 0 && info.getNextPushTime() < System.currentTimeMillis()){
|
||||
popup = bagId;
|
||||
info.setNextPushTime(System.currentTimeMillis() + con.getcDTime() * TimeUtils.HOUR);
|
||||
createPushBag(bagId,user,num);
|
||||
boolean tempPush = createPushBag(bagId,user,num);
|
||||
if(!push){
|
||||
push = tempPush;
|
||||
}
|
||||
}
|
||||
}
|
||||
List<CommonProto.GiftGoodsInfo> goodsBagInfo = new ArrayList<>(SRechargeCommodityNewConfig.configMap.size());
|
||||
|
@ -679,8 +699,7 @@ public class BuyGoodsNewLogic {
|
|||
MessageUtil.sendIndicationMessage(session, 1, MessageTypeProto.MessageType.ALL_GIFTGOODS_INDICATION_VALUE, goodsBuild, true);
|
||||
if(popup != 0){
|
||||
if(isFiveStarBag(popup)){
|
||||
if(info.getTEMP_LIMIT()<info.FIVESTARLIMIT){
|
||||
info.setTEMP_LIMIT(info.getTEMP_LIMIT() + 1);
|
||||
if(push){
|
||||
PlayerInfoProto.PushWelfareResponse pushWelfareResponse = PlayerInfoProto.PushWelfareResponse.newBuilder().addId(popup).build();
|
||||
MessageUtil.sendIndicationMessage(session, 1, MessageTypeProto.MessageType.PUSH_WELFARE_RESPONSE.getNumber(), pushWelfareResponse, true);
|
||||
}
|
||||
|
@ -708,6 +727,11 @@ public class BuyGoodsNewLogic {
|
|||
if(level < scope[1]){
|
||||
return -1;
|
||||
}
|
||||
}else if(scope[0] == 7){
|
||||
double mxr = user.getPlayerInfoManager().getNewRechargeInfo().getMaxSingleR();
|
||||
if(mxr < scope[1]){
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
double rr = user.getPlayerInfoManager().getNewRechargeInfo().getRr();
|
||||
int index = 0;
|
||||
|
@ -807,7 +831,7 @@ public class BuyGoodsNewLogic {
|
|||
return;
|
||||
}
|
||||
info.setLastRefreshTime(System.currentTimeMillis());
|
||||
info.setTEMP_LIMIT(0);
|
||||
info.getTempLimitMap().clear();
|
||||
}
|
||||
|
||||
//是否属于五星成长礼
|
||||
|
@ -818,8 +842,18 @@ public class BuyGoodsNewLogic {
|
|||
return false;
|
||||
}
|
||||
|
||||
public static void createPushBag(int bagId,User user,int num){
|
||||
public static boolean createPushBag(int bagId,User user,int num){
|
||||
NewRechargeInfo info = user.getPlayerInfoManager().getNewRechargeInfo();
|
||||
if(info.getTempLimitMap().containsKey(bagId)){
|
||||
int nn = info.getTempLimitMap().get(bagId);
|
||||
if(nn >= info.FIVESTARLIMIT){
|
||||
return false;
|
||||
}else{
|
||||
info.getTempLimitMap().put(bagId,nn+num);
|
||||
}
|
||||
}else{
|
||||
info.getTempLimitMap().put(bagId,num);
|
||||
}
|
||||
if(isFiveStarBag(bagId) && info.getPushMap().get(bagId) != null){
|
||||
AbstractWelfareBag bag = info.getPushMap().get(bagId);
|
||||
bag.setLimit((bag.getLimit()+num)>info.FIVESTARLIMIT?info.FIVESTARLIMIT:(bag.getLimit()+num));
|
||||
|
@ -834,6 +868,7 @@ public class BuyGoodsNewLogic {
|
|||
bag.setLimit(num);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -559,7 +559,7 @@ public class StoreLogic implements IEventHandler {
|
|||
int[] buyRule = sStoreConfig.getBuyRule();
|
||||
if(buyRule!=null&&buyRule.length>0){
|
||||
//充值金额购买条件判断
|
||||
if(buyRule[0]==1&&playerInfoManager.getNewRechargeInfo().getRr()<buyRule[1]){
|
||||
if(buyRule[0]==1&&BuyGoodsNewLogic.getAllAmount(user)<buyRule[1]){
|
||||
return "充值金额不足,无权购买";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,6 +11,7 @@ import java.util.Map;
|
|||
public class NewRechargeInfo extends MongoBase {
|
||||
|
||||
private double rr;//累计充值
|
||||
private double maxSingleR;//单次最大充值金额
|
||||
|
||||
private double monthRr ; //月卡累计总额
|
||||
private double sMonthRr ; //豪华月卡累计总额
|
||||
|
@ -30,8 +31,8 @@ public class NewRechargeInfo extends MongoBase {
|
|||
private long nextPushTime; //上次推送时间
|
||||
|
||||
private long lastRefreshTime;
|
||||
private int TEMP_LIMIT = 0;
|
||||
public static int FIVESTARLIMIT = 2;//临时五星成长礼每天最多两次
|
||||
private Map<Integer,Integer> tempLimitMap = new HashMap<>();//五星成长礼每天购买次数
|
||||
|
||||
|
||||
public boolean checkOneGoodsIsOverTimeByPrivilege(int privilegeId){
|
||||
|
@ -259,15 +260,6 @@ public class NewRechargeInfo extends MongoBase {
|
|||
updateString("nextPushTime",nextPushTime);
|
||||
}
|
||||
|
||||
public int getTEMP_LIMIT() {
|
||||
return TEMP_LIMIT;
|
||||
}
|
||||
|
||||
public void setTEMP_LIMIT(int TEMP_LIMIT) {
|
||||
this.TEMP_LIMIT = TEMP_LIMIT;
|
||||
updateString("TEMP_LIMIT",TEMP_LIMIT);
|
||||
}
|
||||
|
||||
public long getLastRefreshTime() {
|
||||
return lastRefreshTime;
|
||||
}
|
||||
|
@ -276,4 +268,21 @@ public class NewRechargeInfo extends MongoBase {
|
|||
this.lastRefreshTime = lastRefreshTime;
|
||||
updateString("lastRefreshTime",lastRefreshTime);
|
||||
}
|
||||
|
||||
public double getMaxSingleR() {
|
||||
return maxSingleR;
|
||||
}
|
||||
|
||||
public void setMaxSingleR(double maxSingleR) {
|
||||
this.maxSingleR = maxSingleR;
|
||||
updateString("maxSingleR",maxSingleR);
|
||||
}
|
||||
|
||||
public Map<Integer, Integer> getTempLimitMap() {
|
||||
return tempLimitMap;
|
||||
}
|
||||
|
||||
public void setTempLimitMap(Map<Integer, Integer> tempLimitMap) {
|
||||
this.tempLimitMap = tempLimitMap;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -60,7 +60,7 @@ public class AbstractWelfareBag extends MongoBase{
|
|||
}
|
||||
}
|
||||
|
||||
public AbstractWelfareBag(int modId, int type, long startTime, long endTime, int limit, int dailyUpdate, int continueDays, boolean open, long lastBuyTime, int buyTimes, long refreshTime, int[] privilege, int timeType, String[][] condition, boolean isUserBuyRefresh) {
|
||||
public AbstractWelfareBag(int modId, int type, long startTime, long endTime, int limit, int dailyUpdate, int continueDays, boolean open, long lastBuyTime, int buyTimes, long refreshTime, int[] privilege, int timeType, String[][] condition, boolean isUserBuyRefresh,String mongoKey,int rootId) {
|
||||
this.modId = modId;
|
||||
this.type = type;
|
||||
this.startTime = startTime;
|
||||
|
@ -76,6 +76,8 @@ public class AbstractWelfareBag extends MongoBase{
|
|||
this.timeType = timeType;
|
||||
this.condition = condition;
|
||||
this.isUserBuyRefresh = isUserBuyRefresh;
|
||||
this.setMongoKey(mongoKey);
|
||||
this.setRootId(rootId);
|
||||
}
|
||||
|
||||
public boolean buy() {
|
||||
|
|
|
@ -41,7 +41,7 @@ public class PerpetualWelfareBag extends AbstractWelfareBag {
|
|||
}
|
||||
}
|
||||
|
||||
public PerpetualWelfareBag(int modId, int type, long startTime, long endTime, int limit, int dailyUpdate, int continueDays, boolean open, long lastBuyTime, int buyTimes, long refreshTime, int[] privilege, int timeType, String[][] condition, boolean isUserBuyRefresh) {
|
||||
super(modId, type, startTime, endTime, limit, dailyUpdate, continueDays, open, lastBuyTime, buyTimes, refreshTime, privilege, timeType, condition, isUserBuyRefresh);
|
||||
public PerpetualWelfareBag(int modId, int type, long startTime, long endTime, int limit, int dailyUpdate, int continueDays, boolean open, long lastBuyTime, int buyTimes, long refreshTime, int[] privilege, int timeType, String[][] condition, boolean isUserBuyRefresh,String mongoKey,int rootId) {
|
||||
super(modId, type, startTime, endTime, limit, dailyUpdate, continueDays, open, lastBuyTime, buyTimes, refreshTime, privilege, timeType, condition, isUserBuyRefresh,mongoKey,rootId);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,8 +19,8 @@ public class PushWelfareBag extends AbstractWelfareBag {
|
|||
user.getPlayerInfoManager().getNewRechargeInfo().addPush(this);
|
||||
}
|
||||
|
||||
public PushWelfareBag(int modId, int type, long startTime, long endTime, int limit, int dailyUpdate, int continueDays, boolean open, long lastBuyTime, int buyTimes, long refreshTime, int[] privilege, int timeType, String[][] condition, boolean isUserBuyRefresh) {
|
||||
super( modId, type, startTime, endTime, limit, dailyUpdate, continueDays, open, lastBuyTime, buyTimes, refreshTime, privilege, timeType, condition, isUserBuyRefresh);
|
||||
public PushWelfareBag(int modId, int type, long startTime, long endTime, int limit, int dailyUpdate, int continueDays, boolean open, long lastBuyTime, int buyTimes, long refreshTime, int[] privilege, int timeType, String[][] condition, boolean isUserBuyRefresh,String mongoKey,int rootId) {
|
||||
super( modId, type, startTime, endTime, limit, dailyUpdate, continueDays, open, lastBuyTime, buyTimes, refreshTime, privilege, timeType, condition, isUserBuyRefresh, mongoKey,rootId);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -50,9 +50,10 @@ public class ReceiveWelfareBag extends AbstractWelfareBag {
|
|||
}
|
||||
}
|
||||
|
||||
public ReceiveWelfareBag(int modId, int type, long startTime, long endTime, int limit, int dailyUpdate, int continueDays, boolean open, long lastBuyTime, int buyTimes, long refreshTime, int[] privilege, int timeType, String[][] condition, boolean isUserBuyRefresh, boolean bought) {
|
||||
super( modId, type, startTime, endTime, limit, dailyUpdate, continueDays, open, lastBuyTime, buyTimes, refreshTime, privilege, timeType, condition, isUserBuyRefresh);
|
||||
public ReceiveWelfareBag(int modId, int type, long startTime, long endTime, int limit, int dailyUpdate, int continueDays, boolean open, long lastBuyTime, int buyTimes, long refreshTime, int[] privilege, int timeType, String[][] condition, boolean isUserBuyRefresh, boolean bought,long getRewardTime,String mongoKey,int rootId) {
|
||||
super( modId, type, startTime, endTime, limit, dailyUpdate, continueDays, open, lastBuyTime, buyTimes, refreshTime, privilege, timeType, condition, isUserBuyRefresh,mongoKey,rootId);
|
||||
this.bought = bought;
|
||||
this.getRewardTime = getRewardTime;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -30,7 +30,7 @@ public class TimeLimitWelfareBag extends AbstractWelfareBag {
|
|||
}
|
||||
}
|
||||
|
||||
public TimeLimitWelfareBag(int modId, int type, long startTime, long endTime, int limit, int dailyUpdate, int continueDays, boolean open, long lastBuyTime, int buyTimes, long refreshTime, int[] privilege, int timeType, String[][] condition, boolean isUserBuyRefresh) {
|
||||
super(modId, type, startTime, endTime, limit, dailyUpdate, continueDays, open, lastBuyTime, buyTimes, refreshTime, privilege, timeType, condition, isUserBuyRefresh);
|
||||
public TimeLimitWelfareBag(int modId, int type, long startTime, long endTime, int limit, int dailyUpdate, int continueDays, boolean open, long lastBuyTime, int buyTimes, long refreshTime, int[] privilege, int timeType, String[][] condition, boolean isUserBuyRefresh,String mongoKey,int rootId) {
|
||||
super(modId, type, startTime, endTime, limit, dailyUpdate, continueDays, open, lastBuyTime, buyTimes, refreshTime, privilege, timeType, condition, isUserBuyRefresh,mongoKey,rootId);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -197,7 +197,7 @@ public class MinuteTask extends Thread {
|
|||
for(Map.Entry<Integer,GuildInfo> guildInfoEntry:guildInfoMap.entrySet()){
|
||||
RedisUtil.getInstence().del(RedisKey.getKey(RedisKey.GUILD_RED_PACKAGE_RANK,String.valueOf(guildInfoEntry.getKey()),false));
|
||||
guildInfoEntry.getValue().reSetFete();
|
||||
|
||||
LOGGER.info("{}更新公会祭祀完毕",guildInfoEntry.getValue().getName());
|
||||
SimpleTransaction transaction = SimpleTransaction.current();
|
||||
GuildInfo guildInfo = guildInfoEntry.getValue();
|
||||
Set<Integer> sendUids = new HashSet<>();
|
||||
|
@ -218,6 +218,8 @@ public class MinuteTask extends Thread {
|
|||
guildMyInfo.setGuildHelpReward(false);
|
||||
guildMyInfo.setGuildHelpTime(0);
|
||||
}
|
||||
LOGGER.info("{}更新公会援助完毕",guildInfoEntry.getValue().getName());
|
||||
|
||||
SimpleTransaction.remove();
|
||||
//处理公会援助信息
|
||||
|
||||
|
|
|
@ -23,6 +23,7 @@ import com.ljsd.fight.ArenaRecord;
|
|||
import rpc.protocols.CommonProto;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class CBean2Proto {
|
||||
|
||||
|
@ -204,7 +205,7 @@ public class CBean2Proto {
|
|||
return userMountLists;
|
||||
}
|
||||
|
||||
public static CommonProto.Hero getHero(Hero hero){
|
||||
public static CommonProto.Hero getHero(User user, Hero hero){
|
||||
List<CommonProto.SoulPos> soulPoss = new ArrayList<>();
|
||||
Map<Integer, Integer> soulEquipMap = hero.getSoulEquipByPositionMap();
|
||||
if(soulEquipMap!=null&&!soulEquipMap.isEmpty()){
|
||||
|
@ -215,6 +216,7 @@ public class CBean2Proto {
|
|||
soulPoss.add(builder.build());
|
||||
}
|
||||
}
|
||||
|
||||
return CommonProto.Hero
|
||||
.newBuilder()
|
||||
.setId(hero.getId())
|
||||
|
@ -232,6 +234,7 @@ public class CBean2Proto {
|
|||
.setCreatetype(hero.getCreateType())
|
||||
.setChangeId(hero.getChangeId())
|
||||
.setSkinId(hero.getSkin())
|
||||
.addAllSealIdList(getSealIdListByHero(user,hero))
|
||||
.build();
|
||||
}
|
||||
|
||||
|
@ -762,13 +765,13 @@ public class CBean2Proto {
|
|||
return builder.build();
|
||||
}
|
||||
|
||||
|
||||
public static CommonProto.TeamSimpleInfo getSimpleTeamInfoByHero(User user, Hero hero,int position){
|
||||
return CommonProto.TeamSimpleInfo.newBuilder().setHeroid(hero.getId()).setHeroTid(hero.getTemplateId()).setLevel(hero.getLevel(user.getHeroManager())).setStar(hero.getStar()).setPosition(position).setSkinId(hero.getSkin()).build();
|
||||
}
|
||||
public static CommonProto.TeamSimpleInfo getSimpleTeamInfoByPokeMon(Pokemon pokemon,int position){
|
||||
return CommonProto.TeamSimpleInfo.newBuilder().setHeroid(pokemon.getId()).setHeroTid(pokemon.getTmpId()).setLevel(pokemon.getLevel()).setStar(pokemon.getStar()).setPosition(position).build();
|
||||
}
|
||||
|
||||
public static CommonProto.HardStagePlayerInfo getHardStagePlayerInfo(ArenaRecord arenaRecord,int type)throws Exception{
|
||||
CommonProto.FightData fightDataProto = CommonProto.FightData.parseFrom(arenaRecord.getFightData());
|
||||
return CommonProto.HardStagePlayerInfo.newBuilder()
|
||||
|
@ -778,5 +781,44 @@ public class CBean2Proto {
|
|||
.setUserName(arenaRecord.getUserName())
|
||||
.setHeadFrame(arenaRecord.getHeadFrame())
|
||||
.setFightData(fightDataProto).setPower(arenaRecord.getAttackForce()).setType(type).build();
|
||||
|
||||
|
||||
/**
|
||||
* 获取紫府神印list by proto
|
||||
* @param user
|
||||
* @return
|
||||
*/
|
||||
public static List<CommonProto.PurpleMansionSeal> getPurpleMansionSealInfo(User user){
|
||||
ArrayList<CommonProto.PurpleMansionSeal> list = new ArrayList<>();
|
||||
user.getHeroManager().getPurpleMansionSeal().values().forEach(v->{
|
||||
CommonProto.PurpleMansionSeal seal = CommonProto.PurpleMansionSeal.newBuilder()
|
||||
.setId(v.getSealId())
|
||||
.setType(v.getType())
|
||||
.setSubId(v.getSubId())
|
||||
.setState(v.getState())
|
||||
.build();
|
||||
list.add(seal);
|
||||
});
|
||||
return list;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取英雄身上的神印id列表
|
||||
* @param user
|
||||
* @param hero
|
||||
* @return
|
||||
*/
|
||||
private static List<Integer> getSealIdListByHero(User user, Hero hero){
|
||||
ArrayList<Integer> list = new ArrayList<>();
|
||||
Collection<PurpleMansionSeal> values = user.getHeroManager().getPurpleMansionSeal().values();
|
||||
for (PurpleMansionSeal v : values) {
|
||||
if (v.getState() == 1){
|
||||
if (v.getType() == 1 && !v.getSubId().equals(hero.getId())){
|
||||
continue;
|
||||
}
|
||||
list.add(v.getSealId());
|
||||
}
|
||||
}
|
||||
return list;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -32,6 +32,7 @@ import com.ljsd.jieling.logic.item.ItemLogic;
|
|||
import com.ljsd.jieling.logic.mail.MailLogic;
|
||||
import com.ljsd.jieling.logic.mission.GameEvent;
|
||||
import com.ljsd.jieling.logic.player.PlayerLogic;
|
||||
import com.ljsd.jieling.logic.store.BuyGoodsNewLogic;
|
||||
import com.ljsd.jieling.network.session.ISession;
|
||||
import rpc.protocols.CommonProto;
|
||||
import rpc.protocols.MessageTypeProto;
|
||||
|
@ -838,6 +839,7 @@ public class ItemUtil {
|
|||
public static void userLevelUp(User user, long addExp) throws Exception {
|
||||
PlayerManager playerInfoManager = user.getPlayerInfoManager();
|
||||
if (addExp <= 0) {
|
||||
// 负值验证
|
||||
return;
|
||||
}
|
||||
int maxExp = SPlayerLevelConfig.getsPlayerLevelConfigMap().get(SPlayerLevelConfig.getsPlayerLevelConfigMap().size()).getExp();
|
||||
|
@ -846,6 +848,7 @@ public class ItemUtil {
|
|||
}
|
||||
int curExp = MathUtils.setBetweenWithMax(playerInfoManager.getExp() + (int)addExp, 0, maxExp);
|
||||
int oldLevel = playerInfoManager.getLevel();
|
||||
// 当前等级表配置
|
||||
SPlayerLevelConfig sPlayerLevelConfig = SPlayerLevelConfig.getsPlayerLevelConfigMap().get(oldLevel);
|
||||
int levelUpExp;
|
||||
if (sPlayerLevelConfig == null) {
|
||||
|
@ -1273,7 +1276,7 @@ public class ItemUtil {
|
|||
heroManager.addHero(hero);
|
||||
// 鸿蒙阵推送
|
||||
HeroLogic.getInstance().addOrUpdateHongmeng(OnlineUserManager.getSessionByUid(user.getId()));
|
||||
heroList.add(CBean2Proto.getHero(hero));
|
||||
heroList.add(CBean2Proto.getHero(user,hero));
|
||||
SCHero scHero = SCHero.getsCHero().get(hero.getTemplateId());
|
||||
if (scHero.getStar() >= SSpecialConfig.getIntegerValue(SSpecialConfig.lamp_lottery_content_parm)) { //策划资质改成星级
|
||||
String message = SErrorCodeEerverConfig.getI18NMessageNeedConvert("lamp_lottery_content", new Object[]{playerInfoManager.getNickName(), scHero.getStar(), scHero.getReadingName()},new int[]{0,0,1});
|
||||
|
@ -1658,6 +1661,10 @@ public class ItemUtil {
|
|||
}
|
||||
dropBuilder.addPokemon(CBean2Proto.getPokemon(pokemon));
|
||||
SSpiritAnimal animal = STableManager.getConfig(SSpiritAnimal.class).get(entry.getKey());
|
||||
// if(animal.getQuality()== 5){
|
||||
// ISession session = OnlineUserManager.getSessionByUid(user.getId());
|
||||
// BuyGoodsNewLogic.openPush(session,user,8,5,1);
|
||||
// }
|
||||
ReportUtil.onReportEvent(user,ReportEventEnum.GET_BEAST.getType(),entry.getKey(),animal.getQuality(),reason);
|
||||
if (animal.getQuality() >= SSpecialConfig.getIntegerValue(SSpecialConfig.ANIMAL_BROADCAST_QUALITY)&&reason!=BIReason.COMPOS_HERO_REWARD) { //策划资质改成星级
|
||||
String message = SErrorCodeEerverConfig.getI18NMessageNeedConvert("animal_get_broadcast_content", new Object[]{user.getPlayerInfoManager().getNickName(), animal.getName()},new int[]{0,1});
|
||||
|
|
|
@ -0,0 +1,61 @@
|
|||
package config;
|
||||
|
||||
import manager.STableManager;
|
||||
import manager.Table;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
@Table(name ="XiuXian")
|
||||
public class SXiuXian implements BaseConfig {
|
||||
|
||||
private int id;
|
||||
|
||||
private int realmId;
|
||||
|
||||
private int realmLevel;
|
||||
|
||||
private int[][] levelUpCost;
|
||||
|
||||
private int[][] totalPros;
|
||||
|
||||
private int needStarNum;
|
||||
|
||||
private int[] teamSkill;
|
||||
|
||||
|
||||
@Override
|
||||
public void init() throws Exception {
|
||||
|
||||
}
|
||||
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public int getRealmId() {
|
||||
return realmId;
|
||||
}
|
||||
|
||||
public int getRealmLevel() {
|
||||
return realmLevel;
|
||||
}
|
||||
|
||||
public int[][] getLevelUpCost() {
|
||||
return levelUpCost;
|
||||
}
|
||||
|
||||
public int[][] getTotalPros() {
|
||||
return totalPros;
|
||||
}
|
||||
|
||||
public int getNeedStarNum() {
|
||||
return needStarNum;
|
||||
}
|
||||
|
||||
public int[] getTeamSkill() {
|
||||
return teamSkill;
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,41 @@
|
|||
package config;
|
||||
|
||||
import manager.STableManager;
|
||||
import manager.Table;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
@Table(name ="XiuXianSkill")
|
||||
public class SXiuXianSkill implements BaseConfig {
|
||||
|
||||
private int id;
|
||||
|
||||
private int type;
|
||||
|
||||
private int[] fitList;
|
||||
|
||||
private int skillId;
|
||||
|
||||
@Override
|
||||
public void init() throws Exception {
|
||||
|
||||
}
|
||||
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public int getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public int[] getFitList() {
|
||||
return fitList;
|
||||
}
|
||||
|
||||
public int getSkillId() {
|
||||
return skillId;
|
||||
}
|
||||
}
|
|
@ -1,14 +1,12 @@
|
|||
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
|
||||
import org.apache.poi.ss.usermodel.*;
|
||||
import org.apache.poi.xssf.usermodel.XSSFCell;
|
||||
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
||||
|
||||
import java.io.*;
|
||||
import java.util.*;
|
||||
|
||||
public class ExcelUtils {
|
||||
private static boolean isWrite = true;
|
||||
private static String excelPath ="E:\\work\\data_execl\\master_en\\base_data\\"; //excel 文件
|
||||
private static String excelPath ="D:\\A-duhui\\project\\data_execl\\master_zh_c\\base_data\\"; //excel 文件
|
||||
// private static String excelPath ="D:/excel/0.94/data_execl/Map_data/"; //excel 文件
|
||||
private static String path = "conf/server/";
|
||||
private static Set<String> oldFileNames = new HashSet<>();
|
||||
|
@ -363,29 +361,16 @@ public class ExcelUtils {
|
|||
|
||||
//读取excel
|
||||
private static Workbook readExcel(String filePath) {
|
||||
Workbook wb = null;
|
||||
if (filePath == null) {
|
||||
return null;
|
||||
}
|
||||
String extString = filePath.substring(filePath.lastIndexOf("."));
|
||||
InputStream is;
|
||||
try {
|
||||
is = new FileInputStream(filePath);
|
||||
if (".xls".equals(extString)) {
|
||||
return wb = new HSSFWorkbook(is);
|
||||
} else if (".xlsx".equals(extString)) {
|
||||
wb = new XSSFWorkbook(is);
|
||||
return wb;
|
||||
} else {
|
||||
return wb = null;
|
||||
}
|
||||
|
||||
} catch (FileNotFoundException e) {
|
||||
e.printStackTrace();
|
||||
InputStream is = new FileInputStream(filePath);
|
||||
return WorkbookFactory.create(is);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return wb;
|
||||
return null;
|
||||
}
|
||||
|
||||
public static Object getCellFormatValue(Cell cell,Cell cellType) {
|
||||
|
|
Loading…
Reference in New Issue