Merge branch 'master' of 60.1.1.230:backend/jieling_server
# Conflicts: # serverlogic/src/main/java/com/ljsd/jieling/globals/BIReason.java # tablemanager/src/main/java/config/SEquipConfig.javaback_recharge
commit
8372da1907
|
@ -1,11 +1,15 @@
|
||||||
package com.ljsd.jieling.config.clazzStaticCfg;
|
package com.ljsd.jieling.config.clazzStaticCfg;
|
||||||
|
|
||||||
import com.ljsd.jieling.util.ItemUtil;
|
import com.ljsd.jieling.util.ItemUtil;
|
||||||
|
import config.SEquipConfig;
|
||||||
import config.SRewardGroup;
|
import config.SRewardGroup;
|
||||||
import config.SRewardItem;
|
import config.SRewardItem;
|
||||||
import manager.AbstractClassStaticConfig;
|
import manager.AbstractClassStaticConfig;
|
||||||
|
import manager.STableManager;
|
||||||
import manager.Table;
|
import manager.Table;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -15,12 +19,13 @@ import java.util.Set;
|
||||||
*/
|
*/
|
||||||
public class ItemStaticConfig extends AbstractClassStaticConfig {
|
public class ItemStaticConfig extends AbstractClassStaticConfig {
|
||||||
|
|
||||||
|
private Map<Integer,Map<Integer,Integer>> euipTppes;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void registConfigs(Set<String> registConfigs) {
|
public void registConfigs(Set<String> registConfigs) {
|
||||||
registConfigs.add(SRewardItem.class.getAnnotation(Table.class).name());
|
registConfigs.add(SRewardItem.class.getAnnotation(Table.class).name());
|
||||||
registConfigs.add(SRewardGroup.class.getAnnotation(Table.class).name());
|
registConfigs.add(SRewardGroup.class.getAnnotation(Table.class).name());
|
||||||
|
registConfigs.add(SEquipConfig.class.getAnnotation(Table.class).name());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -31,5 +36,30 @@ public class ItemStaticConfig extends AbstractClassStaticConfig {
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
LOGGER.error("SRewardItem|SRewardGroup init fail");
|
LOGGER.error("SRewardItem|SRewardGroup init fail");
|
||||||
}
|
}
|
||||||
|
try {
|
||||||
|
euipTppes = new HashMap<>();
|
||||||
|
Map<Integer, SEquipConfig> config = STableManager.getConfig(SEquipConfig.class);
|
||||||
|
config.forEach((k,v)->{
|
||||||
|
int type = v.getPosition();
|
||||||
|
Map<Integer, Integer> orDefault = euipTppes.getOrDefault(type, new HashMap<>());
|
||||||
|
orDefault.putIfAbsent(v.getStar(),k);
|
||||||
|
euipTppes.putIfAbsent(type,orDefault);
|
||||||
|
});
|
||||||
|
}catch (Exception e){
|
||||||
|
LOGGER.error("exception");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Map<Integer, Map<Integer, Integer>> getEuipTppes() {
|
||||||
|
return euipTppes;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getEquipByStar(int type, int star){
|
||||||
|
Map<Integer, Integer> integerIntegerMap = euipTppes.get(type);
|
||||||
|
if(null == integerIntegerMap){
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
return integerIntegerMap.getOrDefault(star,0);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -114,9 +114,13 @@ public interface BIReason {
|
||||||
int EXPEDITION_BOX_REWARD = 65;//猎妖之路宝箱奖励
|
int EXPEDITION_BOX_REWARD = 65;//猎妖之路宝箱奖励
|
||||||
int EXPEDITION_DROP_REWARD = 66;//猎妖之路奖励
|
int EXPEDITION_DROP_REWARD = 66;//猎妖之路奖励
|
||||||
|
|
||||||
|
|
||||||
int UNLOAD_SOUL_REWARD = 67;//猎妖之路奖励
|
int UNLOAD_SOUL_REWARD = 67;//猎妖之路奖励
|
||||||
|
|
||||||
|
|
||||||
|
int COMPLEX_EQUIP = 68;//合成装备
|
||||||
|
|
||||||
|
|
||||||
int ADVENTURE_UPLEVEL_CONSUME = 1000;//秘境升级
|
int ADVENTURE_UPLEVEL_CONSUME = 1000;//秘境升级
|
||||||
int SECRETBOX_CONSUME = 1001;//秘盒抽卡
|
int SECRETBOX_CONSUME = 1001;//秘盒抽卡
|
||||||
int DECOMPOSE_ITEM_CONSUME = 1002;//分解道具消耗
|
int DECOMPOSE_ITEM_CONSUME = 1002;//分解道具消耗
|
||||||
|
@ -211,6 +215,12 @@ public interface BIReason {
|
||||||
|
|
||||||
int CHAMPIONM_EXCHANGE_CONSUME = 1050;//巅峰赛兑换
|
int CHAMPIONM_EXCHANGE_CONSUME = 1050;//巅峰赛兑换
|
||||||
|
|
||||||
|
int COMPLEX_EQUIP_CONSUME = 1051; //合成英雄
|
||||||
|
|
||||||
|
int SOUL_EQUIP_WEAR_CONSUME = 1052;// 穿魂印消耗
|
||||||
|
|
||||||
|
int SOUL_EQUIP_MERGE_CONSUME = 1054;// 合成魂印消耗
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,194 @@
|
||||||
|
package com.ljsd.jieling.handler.equip;
|
||||||
|
|
||||||
|
import com.ljsd.jieling.config.clazzStaticCfg.ItemStaticConfig;
|
||||||
|
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.Equip;
|
||||||
|
import com.ljsd.jieling.logic.dao.UserManager;
|
||||||
|
import com.ljsd.jieling.logic.dao.root.User;
|
||||||
|
import com.ljsd.jieling.logic.hero.HeroLogic;
|
||||||
|
import com.ljsd.jieling.logic.item.ItemLogic;
|
||||||
|
import com.ljsd.jieling.network.session.ISession;
|
||||||
|
import com.ljsd.jieling.protocols.CommonProto;
|
||||||
|
import com.ljsd.jieling.protocols.HeroInfoProto;
|
||||||
|
import com.ljsd.jieling.protocols.MessageTypeProto;
|
||||||
|
import com.ljsd.jieling.util.CBean2Proto;
|
||||||
|
import com.ljsd.jieling.util.ItemUtil;
|
||||||
|
import com.ljsd.jieling.util.MessageUtil;
|
||||||
|
import config.SEquipStarsConfig;
|
||||||
|
import manager.STableManager;
|
||||||
|
|
||||||
|
import java.util.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Description: 合成装备
|
||||||
|
* Author: zsx
|
||||||
|
* CreateDate: 2020/4/2 15:48
|
||||||
|
*/
|
||||||
|
public class ComplexEquipHandler extends BaseHandler<HeroInfoProto.ComplexEquipRequest> {
|
||||||
|
@Override
|
||||||
|
public MessageTypeProto.MessageType getMessageCode() {
|
||||||
|
return MessageTypeProto.MessageType.EQUIP_COMPLEX_REQUEST;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void processWithProto(ISession iSession, HeroInfoProto.ComplexEquipRequest proto) throws Exception {
|
||||||
|
|
||||||
|
int uid = iSession.getUid();
|
||||||
|
User user = UserManager.getUser(uid);
|
||||||
|
if (user == null) {
|
||||||
|
throw new ErrorCodeException(ErrorCode.UNKNOWN);
|
||||||
|
}
|
||||||
|
if (proto.getStar() != 0) {//手动合成
|
||||||
|
//check param and cnf
|
||||||
|
if (proto.getNum() <= 0) {
|
||||||
|
throw new ErrorCodeException(ErrorCode.SERVER_DEFINE);
|
||||||
|
}
|
||||||
|
int needStar = proto.getStar() - 1;
|
||||||
|
if (needStar <= 0) {
|
||||||
|
throw new ErrorCodeException(ErrorCode.CFG_NULL);
|
||||||
|
}
|
||||||
|
int targetEquip = STableManager.getFigureConfig(ItemStaticConfig.class).getEquipByStar(proto.getType(), proto.getStar());
|
||||||
|
if (targetEquip == 0) {
|
||||||
|
throw new ErrorCodeException(ErrorCode.CFG_NULL);
|
||||||
|
}
|
||||||
|
int equipId = STableManager.getFigureConfig(ItemStaticConfig.class).getEquipByStar(proto.getType(), needStar);
|
||||||
|
if (equipId == 0) {
|
||||||
|
throw new ErrorCodeException(ErrorCode.CFG_NULL);
|
||||||
|
}
|
||||||
|
Set<String> equipByIDs = ItemLogic.getEquipByID(user, equipId);
|
||||||
|
|
||||||
|
SEquipStarsConfig sEquipStarsConfig = STableManager.getConfig(SEquipStarsConfig.class).get(needStar);
|
||||||
|
if (null == sEquipStarsConfig) {
|
||||||
|
throw new ErrorCodeException(ErrorCode.CFG_NULL);
|
||||||
|
}
|
||||||
|
SEquipStarsConfig sTargetEquipStarsConfig = STableManager.getConfig(SEquipStarsConfig.class).get(proto.getStar());
|
||||||
|
if (null == sTargetEquipStarsConfig) {
|
||||||
|
throw new ErrorCodeException(ErrorCode.CFG_NULL);
|
||||||
|
}
|
||||||
|
int needcount = sEquipStarsConfig.getRankupCount();
|
||||||
|
if (equipByIDs.size() / needcount < proto.getNum()) {
|
||||||
|
//数据不够
|
||||||
|
throw new ErrorCodeException(ErrorCode.UNKNOWN);
|
||||||
|
}
|
||||||
|
|
||||||
|
//check cost
|
||||||
|
Map<Integer, Integer> consumeMap = new HashMap<>();
|
||||||
|
for (int i = 0; i < proto.getNum(); i++) {
|
||||||
|
int[][] sumConsume = sTargetEquipStarsConfig.getRankupResources();
|
||||||
|
HeroLogic.getInstance().combinedAttribute(sumConsume, consumeMap);
|
||||||
|
}
|
||||||
|
boolean enough = ItemUtil.itemCost(user, consumeMap, BIReason.COMPLEX_EQUIP_CONSUME, 0);
|
||||||
|
if (!enough) {
|
||||||
|
throw new ErrorCodeException(ErrorCode.ITEM_NOT_ENOUGH);
|
||||||
|
}
|
||||||
|
|
||||||
|
//drop
|
||||||
|
int[][] dropItems = new int[1][];
|
||||||
|
dropItems[0] = new int[2];
|
||||||
|
dropItems[0][0] = targetEquip;
|
||||||
|
dropItems[0][1] = proto.getNum();
|
||||||
|
CommonProto.Drop.Builder drop = ItemUtil.drop(user, dropItems, BIReason.COMPLEX_EQUIP);
|
||||||
|
HeroInfoProto.ComplexEquipResponse.Builder response = HeroInfoProto.ComplexEquipResponse.newBuilder();
|
||||||
|
|
||||||
|
//remove hero
|
||||||
|
int i = 1;
|
||||||
|
for (String id : equipByIDs) {
|
||||||
|
if (i > proto.getNum() * needcount) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
response.addEquipIds(id);
|
||||||
|
user.getEquipManager().remove(id);
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
response.setDrop(drop);
|
||||||
|
MessageUtil.sendMessage(iSession, 1, MessageTypeProto.MessageType.EQUIP_COMPLEX_RESPONSE_VALUE, response.build(), true);
|
||||||
|
|
||||||
|
} else {
|
||||||
|
|
||||||
|
Map<Integer, Map<Integer, Integer>> euipTppes = STableManager.getFigureConfig(ItemStaticConfig.class).getEuipTppes();
|
||||||
|
Map<Integer, Integer> integerIntegerMap = new TreeMap<>(euipTppes.getOrDefault(proto.getType(), new HashMap<>()));
|
||||||
|
|
||||||
|
Set<String> equipadds =new HashSet<>();
|
||||||
|
Map<Integer, Integer> consumeMap = new HashMap<>();
|
||||||
|
List< CommonProto.Equip> equips = new LinkedList<>();
|
||||||
|
Set<String> newids = new HashSet<>();
|
||||||
|
for (Map.Entry<Integer, Integer> entry : integerIntegerMap.entrySet()) {
|
||||||
|
//star conf
|
||||||
|
int targetstar = entry.getKey()+1;
|
||||||
|
SEquipStarsConfig sTargetEquipStarsConfig = STableManager.getConfig(SEquipStarsConfig.class).get(targetstar);
|
||||||
|
if (null == sTargetEquipStarsConfig) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
SEquipStarsConfig sEquipStarsConfig = STableManager.getConfig(SEquipStarsConfig.class).get(entry.getKey());
|
||||||
|
if (null == sEquipStarsConfig) {
|
||||||
|
throw new ErrorCodeException(ErrorCode.CFG_NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
int targetEquipId = STableManager.getFigureConfig(ItemStaticConfig.class).getEquipByStar(proto.getType(), targetstar);
|
||||||
|
if (targetEquipId == 0) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
int equipId = STableManager.getFigureConfig(ItemStaticConfig.class).getEquipByStar(proto.getType(),entry.getKey());
|
||||||
|
if (equipId == 0) {
|
||||||
|
throw new ErrorCodeException(ErrorCode.CFG_NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
TreeSet<String> equipByIDs = ItemLogic.getEquipByID(user, equipId);
|
||||||
|
int canConNum =equipByIDs.size()/sEquipStarsConfig.getRankupCount();
|
||||||
|
if(canConNum<=0){
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
//check cost
|
||||||
|
boolean enough;
|
||||||
|
int needcount=0;
|
||||||
|
|
||||||
|
for (int i = 0; i < canConNum; i++) {
|
||||||
|
int[][] sumConsume = sEquipStarsConfig.getRankupResources();
|
||||||
|
Map<Integer, Integer> consumeMapTem = new HashMap<>();
|
||||||
|
HeroLogic.getInstance().combinedAttribute(sumConsume, consumeMapTem);
|
||||||
|
enough = ItemUtil.checkCost(user, consumeMapTem);
|
||||||
|
if (!enough) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
//生成装备 混合消耗
|
||||||
|
Equip equip = new Equip(user.getId(),targetEquipId);
|
||||||
|
user.getEquipManager().addEquip(user,equip);
|
||||||
|
newids.add(equip.getId());//后面合成可能会被删除
|
||||||
|
|
||||||
|
needcount += sEquipStarsConfig.getRankupCount();
|
||||||
|
HeroLogic.getInstance().combinedAttribute(sumConsume, consumeMap);
|
||||||
|
}
|
||||||
|
|
||||||
|
//消耗装备
|
||||||
|
int i = 1;
|
||||||
|
for (String id : equipByIDs.descendingSet()) {
|
||||||
|
if (i > needcount) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if(!newids.contains(id)){
|
||||||
|
equipadds.add(id);
|
||||||
|
}else {
|
||||||
|
newids.remove(id);
|
||||||
|
}
|
||||||
|
user.getEquipManager().remove(id);
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (String id:newids) {
|
||||||
|
equips.add(CBean2Proto.getEquipProto( user.getEquipManager().getEquipMap().get(id)));
|
||||||
|
}
|
||||||
|
ItemUtil.itemCost(user, consumeMap, BIReason.COMPLEX_EQUIP_CONSUME, 0);
|
||||||
|
CommonProto.Drop.Builder drop = CommonProto.Drop.newBuilder().addAllEquipId(equips);
|
||||||
|
HeroInfoProto.ComplexEquipResponse.Builder response = HeroInfoProto.ComplexEquipResponse.newBuilder();
|
||||||
|
response.addAllEquipIds(equipadds);
|
||||||
|
response.setDrop(drop);
|
||||||
|
System.out.print(response.build().toString());
|
||||||
|
MessageUtil.sendMessage(iSession, 1, MessageTypeProto.MessageType.EQUIP_COMPLEX_RESPONSE_VALUE, response.build(), true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,21 @@
|
||||||
|
package com.ljsd.jieling.handler.equip;
|
||||||
|
|
||||||
|
import com.ljsd.jieling.handler.BaseHandler;
|
||||||
|
import com.ljsd.jieling.logic.hero.HeroLogic;
|
||||||
|
import com.ljsd.jieling.network.session.ISession;
|
||||||
|
import com.ljsd.jieling.protocols.HeroInfoProto;
|
||||||
|
import com.ljsd.jieling.protocols.MessageTypeProto;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
@Component
|
||||||
|
public class SoulMergeHandler extends BaseHandler<HeroInfoProto.MergeSoulRequest> {
|
||||||
|
@Override
|
||||||
|
public MessageTypeProto.MessageType getMessageCode() {
|
||||||
|
return MessageTypeProto.MessageType.SOUL_MERGE_REQUEST;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void processWithProto(ISession iSession, HeroInfoProto.MergeSoulRequest proto) throws Exception {
|
||||||
|
HeroLogic.mergeSoul(iSession,proto.getTargetId(),proto.getSoulIdList());
|
||||||
|
}
|
||||||
|
}
|
|
@ -65,7 +65,9 @@ public class HotfixUtil implements IEventHandler {
|
||||||
}
|
}
|
||||||
LOGGER.debug("HotfixUtil->currVerion={},version={}", currVerion, version);
|
LOGGER.debug("HotfixUtil->currVerion={},version={}", currVerion, version);
|
||||||
|
|
||||||
|
if (SysUtil.isWindows()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//版本发生了变化,热更新
|
//版本发生了变化,热更新
|
||||||
|
|
|
@ -62,7 +62,7 @@ public class ActivityLogic implements IEventHandler{
|
||||||
public void flushEveryDay(User user, PlayerInfoProto.FivePlayerUpdateIndication.Builder fBuilder) throws Exception {
|
public void flushEveryDay(User user, PlayerInfoProto.FivePlayerUpdateIndication.Builder fBuilder) throws Exception {
|
||||||
|
|
||||||
//跟新签到天数
|
//跟新签到天数
|
||||||
if (!TimeUtils.isSameMonthFiveWithNow(user.getPlayerInfoManager().getOffLineTime())) {
|
if (user.getPlayerInfoManager().getOffLineTime()!=0&&!TimeUtils.isSameMonthFiveWithNow(user.getPlayerInfoManager().getOffLineTime())) {
|
||||||
user.getPlayerInfoManager().setSign(0);
|
user.getPlayerInfoManager().setSign(0);
|
||||||
user.getPlayerInfoManager().setSignTotay(0);
|
user.getPlayerInfoManager().setSignTotay(0);
|
||||||
} else if (user.getPlayerInfoManager().getSignTotay() == 1) {
|
} else if (user.getPlayerInfoManager().getSignTotay() == 1) {
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
package com.ljsd.jieling.logic.activity;
|
package com.ljsd.jieling.logic.activity;
|
||||||
|
|
||||||
import com.ljsd.jieling.core.GlobalsDef;
|
import com.ljsd.jieling.core.GlobalsDef;
|
||||||
|
import com.ljsd.jieling.core.VipPrivilegeType;
|
||||||
import com.ljsd.jieling.db.redis.RedisKey;
|
import com.ljsd.jieling.db.redis.RedisKey;
|
||||||
import com.ljsd.jieling.db.redis.RedisUtil;
|
import com.ljsd.jieling.db.redis.RedisUtil;
|
||||||
import com.ljsd.jieling.globals.Global;
|
import com.ljsd.jieling.globals.Global;
|
||||||
|
@ -12,6 +13,7 @@ import com.ljsd.jieling.logic.dao.ActivityProgressInfo;
|
||||||
import com.ljsd.jieling.logic.dao.UserManager;
|
import com.ljsd.jieling.logic.dao.UserManager;
|
||||||
import com.ljsd.jieling.logic.dao.root.User;
|
import com.ljsd.jieling.logic.dao.root.User;
|
||||||
import com.ljsd.jieling.logic.mail.MailLogic;
|
import com.ljsd.jieling.logic.mail.MailLogic;
|
||||||
|
import com.ljsd.jieling.logic.player.PlayerLogic;
|
||||||
import com.ljsd.jieling.logic.rank.RankContext;
|
import com.ljsd.jieling.logic.rank.RankContext;
|
||||||
import com.ljsd.jieling.logic.rank.RankEnum;
|
import com.ljsd.jieling.logic.rank.RankEnum;
|
||||||
import com.ljsd.jieling.logic.rank.rankImpl.AbstractRank;
|
import com.ljsd.jieling.logic.rank.rankImpl.AbstractRank;
|
||||||
|
@ -40,6 +42,11 @@ public class LimitRandomCardActivity extends AbstractActivity {
|
||||||
Poster.getPoster().listenEvent(this,RandomCardEvent.class);
|
Poster.getPoster().listenEvent(this,RandomCardEvent.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void initActivity(User user){
|
||||||
|
user.getPlayerInfoManager().clearVipCount(VipPrivilegeType.TIME_RANDOM_FREE);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onEvent(IEvent event) throws Exception {
|
public void onEvent(IEvent event) throws Exception {
|
||||||
if(! (event instanceof RandomCardEvent) ){
|
if(! (event instanceof RandomCardEvent) ){
|
||||||
|
|
|
@ -61,7 +61,7 @@ public class Hero extends MongoBase {
|
||||||
this.star = initStar;
|
this.star = initStar;
|
||||||
this.equipByPositionMap = new HashMap<>();
|
this.equipByPositionMap = new HashMap<>();
|
||||||
this.soulEquipByPositionMap = new HashMap<>();
|
this.soulEquipByPositionMap = new HashMap<>();
|
||||||
|
this.especialEquipLevel = 1;
|
||||||
if(initStar!=scHero.getStar()){
|
if(initStar!=scHero.getStar()){
|
||||||
Map<Integer, SCHeroRankUpConfig> scHeroRankUpConfigByType = STableManager.getFigureConfig(HeroStaticConfig.class).getScHeroRankUpConfigByShow(GlobalsDef.UP_STAR_TYPE,scHero.getStar());
|
Map<Integer, SCHeroRankUpConfig> scHeroRankUpConfigByType = STableManager.getFigureConfig(HeroStaticConfig.class).getScHeroRankUpConfigByShow(GlobalsDef.UP_STAR_TYPE,scHero.getStar());
|
||||||
if(scHeroRankUpConfigByType!=null) {
|
if(scHeroRankUpConfigByType!=null) {
|
||||||
|
|
|
@ -333,6 +333,11 @@ public class PlayerManager extends MongoBase {
|
||||||
updateString("vipInfo", vipInfo);
|
updateString("vipInfo", vipInfo);
|
||||||
setHadTakeDailyBoxVip(-1);
|
setHadTakeDailyBoxVip(-1);
|
||||||
}
|
}
|
||||||
|
public void clearVipCount(int priviliageId){
|
||||||
|
vipInfo.put(priviliageId,new VipInfo());
|
||||||
|
updateString("vipInfo", vipInfo);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
public void addVipInfo(int privilageId){
|
public void addVipInfo(int privilageId){
|
||||||
SPrivilegeTypeConfig config = SPrivilegeTypeConfig.getsPrivilegeTypeConfigMap().get(privilageId);
|
SPrivilegeTypeConfig config = SPrivilegeTypeConfig.getsPrivilegeTypeConfigMap().get(privilageId);
|
||||||
|
@ -340,19 +345,22 @@ public class PlayerManager extends MongoBase {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
long maxTime;
|
long maxTime;
|
||||||
if(config.getContinueTime()==0){
|
VipInfo newVipInfo = new VipInfo();
|
||||||
maxTime = 0;
|
if(config.getContinueTime()!=null){
|
||||||
}else{
|
|
||||||
if(vipInfo.containsKey(privilageId)){
|
if(vipInfo.containsKey(privilageId)){
|
||||||
|
if(config.getContinueTime()[1]==1&&TimeUtils.now()/1000<vipInfo.get(privilageId).getEffectTime()){
|
||||||
|
return;
|
||||||
|
}
|
||||||
maxTime = TimeUtils.now()/1000>vipInfo.get(privilageId).getEffectTime()?(TimeUtils.now()/1000):vipInfo.get(privilageId).getEffectTime();
|
maxTime = TimeUtils.now()/1000>vipInfo.get(privilageId).getEffectTime()?(TimeUtils.now()/1000):vipInfo.get(privilageId).getEffectTime();
|
||||||
maxTime = maxTime+config.getContinueTime();
|
maxTime = maxTime+config.getContinueTime()[0];
|
||||||
}else {
|
}else {
|
||||||
maxTime = TimeUtils.now()/1000+config.getContinueTime();
|
maxTime = TimeUtils.now()/1000+config.getContinueTime()[0];
|
||||||
}
|
}
|
||||||
maxTime = (int)(TimeUtils.getLastOrUnderHour(maxTime*1000,5,true)/1000);
|
maxTime = (int)(TimeUtils.getLastOrUnderHour(maxTime*1000,5,true)/1000);
|
||||||
|
newVipInfo.setEffectTime((int)maxTime);
|
||||||
}
|
}
|
||||||
vipInfo.put(privilageId,new VipInfo(0,(int)maxTime));
|
this.vipInfo.put(privilageId,newVipInfo);
|
||||||
updateString("vipInfo", vipInfo);
|
updateString("vipInfo", this.vipInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void removeVipPriviliageId(int privilageId){
|
public void removeVipPriviliageId(int privilageId){
|
||||||
|
|
|
@ -246,7 +246,7 @@ public class RechargeInfo extends MongoBase{
|
||||||
|
|
||||||
public void setMonthSaveAmt(int monthSaveAmt) {
|
public void setMonthSaveAmt(int monthSaveAmt) {
|
||||||
this.monthSaveAmt = monthSaveAmt;
|
this.monthSaveAmt = monthSaveAmt;
|
||||||
updateString("monthSaveAmt",smonthSaveAmt);
|
updateString("monthSaveAmt",monthSaveAmt);
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getSmonthSaveAmt() {
|
public int getSmonthSaveAmt() {
|
||||||
|
|
|
@ -819,23 +819,30 @@ public class HeroLogic{
|
||||||
int templateId = hero.getTemplateId();
|
int templateId = hero.getTemplateId();
|
||||||
SCHero scHero = SCHero.getsCHero().get(templateId);
|
SCHero scHero = SCHero.getsCHero().get(templateId);
|
||||||
SHeroLevlConfig sHeroLevlConfig = SHeroLevlConfig.getsCHero().get(hero.getLevel());
|
SHeroLevlConfig sHeroLevlConfig = SHeroLevlConfig.getsCHero().get(hero.getLevel());
|
||||||
float characterLevelPara = sHeroLevlConfig.getCharacterLevelPara();
|
int[][] characterLevelPara = sHeroLevlConfig.getCharacterLevelPara();
|
||||||
Map<Integer, Float> paraForHero = getParaForHero(hero);
|
Map<Integer, Object> paraForHero = getParaForHero(hero);
|
||||||
Map<Integer,Float> baseValueMap = new HashMap<>();
|
Map<Integer,Float> baseValueMap = new HashMap<>();
|
||||||
baseValueMap.put(GlobalsDef.HP_TYPE,getBaseValueByType(scHero,GlobalsDef.HP_TYPE));
|
baseValueMap.put(GlobalsDef.HP_TYPE,getBaseValueByType(scHero,GlobalsDef.HP_TYPE));
|
||||||
baseValueMap.put(GlobalsDef.ATTACK_TYPE,getBaseValueByType(scHero,GlobalsDef.ATTACK_TYPE));
|
baseValueMap.put(GlobalsDef.ATTACK_TYPE,getBaseValueByType(scHero,GlobalsDef.ATTACK_TYPE));
|
||||||
baseValueMap.put(GlobalsDef.PHYSICAL_DEFENCE_TYPE,getBaseValueByType(scHero,GlobalsDef.PHYSICAL_DEFENCE_TYPE));
|
baseValueMap.put(GlobalsDef.PHYSICAL_DEFENCE_TYPE,getBaseValueByType(scHero,GlobalsDef.PHYSICAL_DEFENCE_TYPE));
|
||||||
baseValueMap.put(GlobalsDef.MAGIC_DEFENCE_TYPE,getBaseValueByType(scHero,GlobalsDef.MAGIC_DEFENCE_TYPE));
|
baseValueMap.put(GlobalsDef.MAGIC_DEFENCE_TYPE,getBaseValueByType(scHero,GlobalsDef.MAGIC_DEFENCE_TYPE));
|
||||||
baseValueMap.put(GlobalsDef.SPEED_TYPE,getBaseValueByType(scHero,GlobalsDef.SPEED_TYPE));
|
|
||||||
for(Map.Entry<Integer,Float> item : baseValueMap.entrySet()){
|
for(Map.Entry<Integer,Float> item : baseValueMap.entrySet()){
|
||||||
Integer attributeType = item.getKey();
|
Integer attributeType = item.getKey();
|
||||||
Float heroBaseValue = item.getValue();
|
Float heroBaseValue = item.getValue();
|
||||||
if(attributeType == GlobalsDef.SPEED_TYPE){
|
int[] levelAttr = Arrays.stream(characterLevelPara).filter(param -> param[0] == attributeType).findFirst().get();
|
||||||
result.put (attributeType,(int)(heroBaseValue * sHeroLevlConfig.getSpeedLevelPara() + STableManager.getFigureConfig(CommonStaticConfig.class).getGameSetting().calSpeed(heroBaseValue, hero.getBreakId())));
|
float value = heroBaseValue + levelAttr[1];
|
||||||
}else{
|
int[][] rankUpParam = (int[][]) paraForHero.get(GlobalsDef.RANKUP_PARA_TYPE);
|
||||||
result.put(attributeType,(int)(heroBaseValue * ( 1 + paraForHero.get(GlobalsDef.RANKUP_PARA_TYPE)/10000.f) * characterLevelPara + heroBaseValue * paraForHero.get(GlobalsDef.BREAK_PARA_TYPE)/10000.f));
|
if(rankUpParam!=null){
|
||||||
|
int[] rankAttr = Arrays.stream(rankUpParam).filter(param -> param[0] == attributeType).findFirst().get();
|
||||||
|
value = value *(rankAttr[2] == 0 ? 1 : (rankAttr[2] / 10000.f))+rankAttr[1];
|
||||||
|
}
|
||||||
|
int[][] breakParam = (int[][]) paraForHero.get(GlobalsDef.BREAK_PARA_TYPE);
|
||||||
|
if(breakParam!=null){
|
||||||
|
int[] breakAttr = Arrays.stream(breakParam).filter(param -> param[0] == attributeType).findFirst().get();
|
||||||
|
value += breakAttr[1];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
result.put(attributeType,(int)value);
|
||||||
}
|
}
|
||||||
if(!isForce){
|
if(!isForce){
|
||||||
Map<Integer, Integer> secondaryFactorMap = scHero.getSecondaryFactorMap();
|
Map<Integer, Integer> secondaryFactorMap = scHero.getSecondaryFactorMap();
|
||||||
|
@ -850,22 +857,30 @@ public class HeroLogic{
|
||||||
Map<Integer,Integer> result = new HashMap<>();
|
Map<Integer,Integer> result = new HashMap<>();
|
||||||
SCHero scHero = SCHero.getsCHero().get(templateId);
|
SCHero scHero = SCHero.getsCHero().get(templateId);
|
||||||
SHeroLevlConfig sHeroLevlConfig = SHeroLevlConfig.getsCHero().get(heroLevl);
|
SHeroLevlConfig sHeroLevlConfig = SHeroLevlConfig.getsCHero().get(heroLevl);
|
||||||
float characterLevelPara = sHeroLevlConfig.getCharacterLevelPara();
|
int[][] characterLevelPara = sHeroLevlConfig.getCharacterLevelPara();
|
||||||
Map<Integer, Float> paraForHero = getParaForRobotHero(scHero,heroLevl,templateId);
|
Map<Integer, Object> paraForHero = getParaForRobotHero(scHero,heroLevl,templateId);
|
||||||
Map<Integer,Float> baseValueMap = new HashMap<>();
|
Map<Integer,Float> baseValueMap = new HashMap<>();
|
||||||
baseValueMap.put(GlobalsDef.HP_TYPE,getBaseValueByType(scHero,GlobalsDef.HP_TYPE));
|
baseValueMap.put(GlobalsDef.HP_TYPE,getBaseValueByType(scHero,GlobalsDef.HP_TYPE));
|
||||||
baseValueMap.put(GlobalsDef.ATTACK_TYPE,getBaseValueByType(scHero,GlobalsDef.ATTACK_TYPE));
|
baseValueMap.put(GlobalsDef.ATTACK_TYPE,getBaseValueByType(scHero,GlobalsDef.ATTACK_TYPE));
|
||||||
baseValueMap.put(GlobalsDef.PHYSICAL_DEFENCE_TYPE,getBaseValueByType(scHero,GlobalsDef.PHYSICAL_DEFENCE_TYPE));
|
baseValueMap.put(GlobalsDef.PHYSICAL_DEFENCE_TYPE,getBaseValueByType(scHero,GlobalsDef.PHYSICAL_DEFENCE_TYPE));
|
||||||
baseValueMap.put(GlobalsDef.MAGIC_DEFENCE_TYPE,getBaseValueByType(scHero,GlobalsDef.MAGIC_DEFENCE_TYPE));
|
baseValueMap.put(GlobalsDef.MAGIC_DEFENCE_TYPE,getBaseValueByType(scHero,GlobalsDef.MAGIC_DEFENCE_TYPE));
|
||||||
baseValueMap.put(GlobalsDef.SPEED_TYPE,getBaseValueByType(scHero,GlobalsDef.SPEED_TYPE));
|
|
||||||
for(Map.Entry<Integer,Float> item : baseValueMap.entrySet()){
|
for(Map.Entry<Integer,Float> item : baseValueMap.entrySet()){
|
||||||
Integer attributeType = item.getKey();
|
Integer attributeType = item.getKey();
|
||||||
Float heroBaseValue = item.getValue();
|
Float heroBaseValue = item.getValue();
|
||||||
if(attributeType == GlobalsDef.SPEED_TYPE){
|
int[] levelAttr = Arrays.stream(characterLevelPara).filter(param -> param[0] == attributeType).findFirst().get();
|
||||||
result.put (attributeType,(int)(heroBaseValue * sHeroLevlConfig.getSpeedLevelPara() + STableManager.getFigureConfig(CommonStaticConfig.class).getGameSetting().calSpeed(heroBaseValue, heroBreakId)));
|
float value = heroBaseValue + levelAttr[1];
|
||||||
}else{
|
int[][] rankUpParam = (int[][]) paraForHero.get(GlobalsDef.RANKUP_PARA_TYPE);
|
||||||
result.put(attributeType,(int)(heroBaseValue * ( 1 + paraForHero.get(GlobalsDef.RANKUP_PARA_TYPE)/10000.f) * characterLevelPara + heroBaseValue * paraForHero.get(GlobalsDef.BREAK_PARA_TYPE)/10000.f));
|
if(rankUpParam!=null){
|
||||||
|
int[] rankAttr = Arrays.stream(rankUpParam).filter(param -> param[0] == attributeType).findFirst().get();
|
||||||
|
value *= rankAttr[1] == 0 ? 1 : rankAttr[1] / 10000.f+rankAttr[2];
|
||||||
}
|
}
|
||||||
|
int[][] breakParam = (int[][]) paraForHero.get(GlobalsDef.BREAK_PARA_TYPE);
|
||||||
|
if(breakParam!=null){
|
||||||
|
int[] breakAttr = Arrays.stream(breakParam).filter(param -> param[0] == attributeType).findFirst().get();
|
||||||
|
value += breakAttr[1];
|
||||||
|
}
|
||||||
|
|
||||||
|
result.put(attributeType,(int)value);
|
||||||
}
|
}
|
||||||
if(!isForce){
|
if(!isForce){
|
||||||
Map<Integer, Integer> secondaryFactorMap = scHero.getSecondaryFactorMap();
|
Map<Integer, Integer> secondaryFactorMap = scHero.getSecondaryFactorMap();
|
||||||
|
@ -894,11 +909,12 @@ public class HeroLogic{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
private Map<Integer,Float> getParaRate(SCHero scHero,int heroStar,int heroLevel,int heroBreakId){
|
private Map<Integer,Object> getParaRate(SCHero scHero,int heroStar,int heroLevel,int heroBreakId){
|
||||||
Map<Integer,Float> result = new HashMap<>(2);
|
// System.out.println(scHero.getId());
|
||||||
float rankupPara =0.0f;
|
Map<Integer,Object> result = new HashMap<>(2);
|
||||||
|
Object rankupPara=null;
|
||||||
//突破系数
|
//突破系数
|
||||||
float breakPara = 0.0f;
|
Object breakPara=null;
|
||||||
Map<Integer, SCHeroRankUpConfig> scHeroRankUpConfigByTypeOfStar = STableManager.getFigureConfig(HeroStaticConfig.class).getScHeroRankUpConfigByType(GlobalsDef.UP_STAR_TYPE,scHero.getStar());
|
Map<Integer, SCHeroRankUpConfig> scHeroRankUpConfigByTypeOfStar = STableManager.getFigureConfig(HeroStaticConfig.class).getScHeroRankUpConfigByType(GlobalsDef.UP_STAR_TYPE,scHero.getStar());
|
||||||
if(scHeroRankUpConfigByTypeOfStar!= null){
|
if(scHeroRankUpConfigByTypeOfStar!= null){
|
||||||
SCHeroRankUpConfig scHeroRankUpConfig = scHeroRankUpConfigByTypeOfStar.get(heroStar-1);
|
SCHeroRankUpConfig scHeroRankUpConfig = scHeroRankUpConfigByTypeOfStar.get(heroStar-1);
|
||||||
|
@ -914,7 +930,8 @@ public class HeroLogic{
|
||||||
|
|
||||||
Map<Integer, SCHeroRankUpConfig> scHeroRankUpConfigByTypOfBreak = STableManager.getFigureConfig(HeroStaticConfig.class).getScHeroRankUpConfigByType(GlobalsDef.BREAK_TYPE,scHero.getStar());
|
Map<Integer, SCHeroRankUpConfig> scHeroRankUpConfigByTypOfBreak = STableManager.getFigureConfig(HeroStaticConfig.class).getScHeroRankUpConfigByType(GlobalsDef.BREAK_TYPE,scHero.getStar());
|
||||||
for( SCHeroRankUpConfig scHeroRankUpConfigTmp :scHeroRankUpConfigByTypOfBreak.values()){
|
for( SCHeroRankUpConfig scHeroRankUpConfigTmp :scHeroRankUpConfigByTypOfBreak.values()){
|
||||||
if( heroLevel >= scHeroRankUpConfigTmp.getLimitLevel() && heroBreakId>= scHeroRankUpConfigTmp.getId() && breakPara< scHeroRankUpConfigTmp.getRankupPara()){
|
// && breakPara< scHeroRankUpConfigTmp.getRankupPara()
|
||||||
|
if( heroLevel >= scHeroRankUpConfigTmp.getLimitLevel() && heroBreakId>= scHeroRankUpConfigTmp.getId() ){
|
||||||
breakPara = scHeroRankUpConfigTmp.getRankupPara();
|
breakPara = scHeroRankUpConfigTmp.getRankupPara();
|
||||||
}
|
}
|
||||||
if(heroLevel < scHeroRankUpConfigTmp.getOpenLevel()){
|
if(heroLevel < scHeroRankUpConfigTmp.getOpenLevel()){
|
||||||
|
@ -926,13 +943,13 @@ public class HeroLogic{
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
private Map<Integer,Float> getParaForHero(Hero hero){
|
private Map<Integer,Object> getParaForHero(Hero hero){
|
||||||
SCHero scHero = SCHero.getsCHero().get(hero.getTemplateId());
|
SCHero scHero = SCHero.getsCHero().get(hero.getTemplateId());
|
||||||
return getParaRate(scHero, hero.getStar(), hero.getLevel(), hero.getBreakId());
|
return getParaRate(scHero, hero.getStar(), hero.getLevel(), hero.getBreakId());
|
||||||
}
|
}
|
||||||
|
|
||||||
//todo
|
//todo
|
||||||
private Map<Integer,Float> getParaForRobotHero(SCHero scHero,int level,int breakId){
|
private Map<Integer,Object> getParaForRobotHero(SCHero scHero,int level,int breakId){
|
||||||
return getParaRate(scHero, scHero.getStar(),level, breakId);
|
return getParaRate(scHero, scHero.getStar(),level, breakId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -990,10 +1007,18 @@ public class HeroLogic{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//法宝技能
|
//法宝技能
|
||||||
int especialEquip = hero.getEspecialEquipLevel();
|
int[] equipTalismana = tempHero.getEquipTalismana();
|
||||||
if(especialEquip>=0){
|
if(hero.getStar()<equipTalismana[0]){
|
||||||
|
return sb;
|
||||||
}
|
}
|
||||||
|
int especialEquipLevel = hero.getEspecialEquipLevel();
|
||||||
|
int especialEquipId = equipTalismana[1];
|
||||||
|
Map<Integer,SEquipTalismana> sEquipTalismana = SEquipTalismana.equipTalismanaStarMap.get(especialEquipId);
|
||||||
|
sEquipTalismana.forEach((k,v)->{
|
||||||
|
if(k<especialEquipLevel&&v.getOpenSkillRules()!=null){
|
||||||
|
Arrays.stream(v.getOpenSkillRules()).forEach(i->sb.append(i).append(DIVISION));
|
||||||
|
}
|
||||||
|
});
|
||||||
return sb;
|
return sb;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1990,8 +2015,8 @@ public class HeroLogic{
|
||||||
User user = UserManager.getUser(uid);
|
User user = UserManager.getUser(uid);
|
||||||
String heroId = optHeroSoul.getHeroId();
|
String heroId = optHeroSoul.getHeroId();
|
||||||
Hero hero = user.getHeroManager().getHero(heroId);
|
Hero hero = user.getHeroManager().getHero(heroId);
|
||||||
Map<Integer, Integer> soulEquipByPositionMap = hero.getSoulEquipByPositionMap();
|
checkAllowedOptSoul(user,hero.getLevel());
|
||||||
checkAllowedWear(user,soulEquipByPositionMap,optHeroSoul.getSoulEquipIdsList(),unload);
|
checkAllowedWear(user,hero.getTemplateId(),optHeroSoul.getSoulEquipIdsList(),unload);
|
||||||
optHeroSoul.getSoulEquipIdsList().forEach(e->{
|
optHeroSoul.getSoulEquipIdsList().forEach(e->{
|
||||||
hero.updateSoulEquipPositionMap(e.getPosition(),e.getEquipId());
|
hero.updateSoulEquipPositionMap(e.getPosition(),e.getEquipId());
|
||||||
});
|
});
|
||||||
|
@ -1999,7 +2024,61 @@ public class HeroLogic{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void checkAllowedWear(User user, Map<Integer, Integer> soulEquipByPositionMap, List<HeroInfoProto.SoulEquipPos> soulEquipIdsList, HeroInfoProto.OptHeroSoul unload) {
|
private void checkAllowedWear(User user,int targetHeroTid,List<HeroInfoProto.SoulEquipPos> soulEquipIdsList, HeroInfoProto.OptHeroSoul unload) throws Exception {
|
||||||
|
|
||||||
|
List<Integer> equids = new ArrayList<>();
|
||||||
|
soulEquipIdsList.forEach(e->equids.add(e.getEquipId()));
|
||||||
|
List<Integer> unloadSoulIds = new ArrayList<>();
|
||||||
|
if(unload!=null){
|
||||||
|
List<HeroInfoProto.SoulEquipPos> soulEquipIdsListUnload = unload.getSoulEquipIdsList();
|
||||||
|
soulEquipIdsListUnload.forEach(e->{
|
||||||
|
equids.remove(e.getEquipId());
|
||||||
|
unloadSoulIds.add(e.getEquipId());
|
||||||
|
});
|
||||||
|
}
|
||||||
|
//是否魂印能被本英雄佩戴
|
||||||
|
//是否只能一名武将佩戴
|
||||||
|
Map<String, Hero> heroMap = user.getHeroManager().getHeroMap();
|
||||||
|
Set<Integer> cacheIds = new HashSet<>();
|
||||||
|
for(HeroInfoProto.SoulEquipPos item:soulEquipIdsList){
|
||||||
|
int equipId = item.getEquipId();
|
||||||
|
SEquipConfig sEquipConfig = STableManager.getConfig(SEquipConfig.class).get(equipId);
|
||||||
|
if(sEquipConfig.getRangeHeroTids()!=null && !sEquipConfig.getRangeHeroTids().contains(targetHeroTid)){
|
||||||
|
throw new ErrorCodeException(ErrorCode.SERVER_DEFINE);
|
||||||
|
}
|
||||||
|
if(sEquipConfig.getLimit()==1){
|
||||||
|
if(cacheIds.isEmpty()){
|
||||||
|
heroMap.values().forEach(hero->{
|
||||||
|
cacheIds.addAll(hero.getSoulEquipByPositionMap().values());
|
||||||
|
});
|
||||||
|
cacheIds.removeAll(unloadSoulIds);
|
||||||
|
}
|
||||||
|
if(cacheIds.contains(equipId)){
|
||||||
|
cacheIds.add(equipId);
|
||||||
|
throw new ErrorCodeException(ErrorCode.SERVER_DEFINE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if(!equids.isEmpty()){
|
||||||
|
Map<Integer,Integer> itemCost = new HashMap<>();
|
||||||
|
equids.forEach(e->{
|
||||||
|
itemCost.put(e,1);
|
||||||
|
});
|
||||||
|
boolean b = ItemUtil.itemCost(user, itemCost, BIReason.SOUL_EQUIP_WEAR_CONSUME, targetHeroTid);
|
||||||
|
if(!b){
|
||||||
|
throw new ErrorCodeException(ErrorCode.ITEM_NOT_ENOUGH);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(unload!=null){
|
||||||
|
Hero hero = user.getHeroManager().getHero(unload.getHeroId());
|
||||||
|
List<HeroInfoProto.SoulEquipPos> soulEquipIdsListUnload = unload.getSoulEquipIdsList();
|
||||||
|
soulEquipIdsListUnload.forEach(e->{
|
||||||
|
hero.removeSoulEquip(e.getPosition());
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -2007,7 +2086,37 @@ public class HeroLogic{
|
||||||
public static void mergeSoul(ISession session, int targetId, List<Integer> soulIdList) throws Exception {
|
public static void mergeSoul(ISession session, int targetId, List<Integer> soulIdList) throws Exception {
|
||||||
int uid = session.getUid();
|
int uid = session.getUid();
|
||||||
User user = UserManager.getUser(uid);
|
User user = UserManager.getUser(uid);
|
||||||
STableManager.getConfig(SEquipConfig.class).get(targetId);
|
SEquipConfig sEquipConfig = STableManager.getConfig(SEquipConfig.class).get(targetId);
|
||||||
|
int[][] resource = sEquipConfig.getResource();
|
||||||
|
|
||||||
|
Map<Integer,Integer> itemTemplateCost = new HashMap<>();
|
||||||
|
Map<Integer,Integer> itemReallyCost = new HashMap<>();
|
||||||
|
soulIdList.forEach(e->{
|
||||||
|
|
||||||
|
itemTemplateCost.put( STableManager.getConfig(SEquipConfig.class).get(e).getQuality(),itemTemplateCost.getOrDefault( STableManager.getConfig(SEquipConfig.class).get(e).getQuality(),0)+1);
|
||||||
|
itemReallyCost.put(e,itemReallyCost.getOrDefault(e,0)+1);
|
||||||
|
});
|
||||||
|
Arrays.stream(resource).forEach(item->{
|
||||||
|
itemReallyCost.put(item[0],itemReallyCost.getOrDefault(item[0],0)+item[1]);
|
||||||
|
});
|
||||||
|
int[][] formula = sEquipConfig.getFormula();
|
||||||
|
for(int[] item : formula){
|
||||||
|
if(itemTemplateCost.getOrDefault(item[0],0)!=item[1]){
|
||||||
|
throw new ErrorCodeException(ErrorCode.ITEM_NOT_ENOUGH);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
boolean b = ItemUtil.itemCost(user, itemReallyCost, BIReason.SOUL_EQUIP_MERGE_CONSUME, targetId);
|
||||||
|
if(!b){
|
||||||
|
throw new ErrorCodeException(ErrorCode.ITEM_NOT_ENOUGH);
|
||||||
|
}
|
||||||
|
int[][] drop = new int[1][];
|
||||||
|
drop[0] = new int[2];
|
||||||
|
drop[0][0] = targetId;
|
||||||
|
drop[0][1] = 1;
|
||||||
|
CommonProto.Drop.Builder dropBuilder = ItemUtil.drop(user, drop, 1);
|
||||||
|
|
||||||
|
HeroInfoProto.MergeSoulResponse build = HeroInfoProto.MergeSoulResponse.newBuilder().setDrop(dropBuilder).build();
|
||||||
|
MessageUtil.sendMessage(session,1, MessageTypeProto.MessageType.SOUL_MERGE_RESPONSE_VALUE,build,true);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2031,4 +2140,18 @@ public class HeroLogic{
|
||||||
MessageUtil.sendMessage(iSession,1, MessageTypeProto.MessageType.SOUL_EQUIP_UNLOAD_OPT_RESPONSE_VALUE,null,true);
|
MessageUtil.sendMessage(iSession,1, MessageTypeProto.MessageType.SOUL_EQUIP_UNLOAD_OPT_RESPONSE_VALUE,null,true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static void checkAllowedOptSoul(User user,int heroLevel) throws ErrorCodeException {
|
||||||
|
SGameSetting gameSetting = STableManager.getFigureConfig(CommonStaticConfig.class).getGameSetting();
|
||||||
|
int[][] equipSignUnlock = gameSetting.getEquipSignUnlock();
|
||||||
|
for(int[] item : equipSignUnlock){
|
||||||
|
if(item[0] == 1 && user.getPlayerInfoManager().getLevel()<item[1]){
|
||||||
|
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
|
||||||
|
}
|
||||||
|
if(item[0] == 2 && heroLevel<item[1]){
|
||||||
|
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -411,6 +411,9 @@ public class ItemLogic {
|
||||||
|
|
||||||
int especialEquipId = scHero.getEquipTalismana()[1];
|
int especialEquipId = scHero.getEquipTalismana()[1];
|
||||||
SEquipTalismana sEquipTalismana = SEquipTalismana.equipTalismanaStarMap.get(especialEquipId).get(hero.getEspecialEquipLevel());
|
SEquipTalismana sEquipTalismana = SEquipTalismana.equipTalismanaStarMap.get(especialEquipId).get(hero.getEspecialEquipLevel());
|
||||||
|
if(sEquipTalismana!=null&&sEquipTalismana.getRankupBasicMaterial()==null){
|
||||||
|
throw new ErrorCodeException(ErrorCode.newDefineCode("法宝已最大等级"));
|
||||||
|
}
|
||||||
boolean b = ItemUtil.itemCost(user, sEquipTalismana.getRankupBasicMaterial(), BIReason.ESPECIAL_EQUIP_UP_LEVEL_CONSUME, 1);
|
boolean b = ItemUtil.itemCost(user, sEquipTalismana.getRankupBasicMaterial(), BIReason.ESPECIAL_EQUIP_UP_LEVEL_CONSUME, 1);
|
||||||
if(b){
|
if(b){
|
||||||
hero.updateEspecial(hero.getEspecialEquipLevel()+1);
|
hero.updateEspecial(hero.getEspecialEquipLevel()+1);
|
||||||
|
@ -520,4 +523,17 @@ public class ItemLogic {
|
||||||
ItemLogUtil.addLogQueue(itemLog);
|
ItemLogUtil.addLogQueue(itemLog);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取指定装备的所有装备 过滤掉已穿戴
|
||||||
|
* @param user
|
||||||
|
* @param equipid
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static TreeSet<String> getEquipByID(User user, int equipid) {
|
||||||
|
TreeSet<String> equiplist = new TreeSet<>();
|
||||||
|
user.getEquipManager().getEquipMap().entrySet().stream().filter(stringEquipEntry ->
|
||||||
|
StringUtil.isEmpty(stringEquipEntry.getValue().getHeroId()) && stringEquipEntry.getValue().getEquipId() == equipid
|
||||||
|
).forEach(stringEquipEntry -> equiplist.add(stringEquipEntry.getKey()));
|
||||||
|
return equiplist;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -900,12 +900,11 @@ public class PlayerLogic {
|
||||||
PlayerManager playerInfoManager = user.getPlayerInfoManager();
|
PlayerManager playerInfoManager = user.getPlayerInfoManager();
|
||||||
RechargeInfo rechargeInfo = playerInfoManager.getRechargeInfo();
|
RechargeInfo rechargeInfo = playerInfoManager.getRechargeInfo();
|
||||||
STableManager.getConfig(SMonthcardConfig.class).forEach((integer, sMonthcardConfig) -> {
|
STableManager.getConfig(SMonthcardConfig.class).forEach((integer, sMonthcardConfig) -> {
|
||||||
|
int time = playerInfoManager.getMonthCard().getOrDefault(integer,0);
|
||||||
int state = playerInfoManager.getMonthCardDailyTake().contains(integer)?1:0;
|
int state = playerInfoManager.getMonthCardDailyTake().contains(integer)?1:0;
|
||||||
int saveAmt = integer==1?rechargeInfo.getMonthSaveAmt():rechargeInfo.getSmonthSaveAmt();
|
int saveAmt = integer==1?rechargeInfo.getMonthSaveAmt():rechargeInfo.getSmonthSaveAmt();
|
||||||
int time = playerInfoManager.getMonthCard().getOrDefault(integer,0);
|
|
||||||
cardInfos.add(CommonProto.MonthCardInfo.newBuilder().setId(integer).setEndingTime(time).setState(state).setTotleAmt(saveAmt).build());
|
cardInfos.add(CommonProto.MonthCardInfo.newBuilder().setId(integer).setEndingTime(time).setState(state).setTotleAmt(saveAmt).build());
|
||||||
});
|
});
|
||||||
|
|
||||||
return cardInfos;
|
return cardInfos;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -268,8 +268,6 @@ public class SessionManager implements INetSession<ISession>, INetReceived<ISess
|
||||||
return 0;
|
return 0;
|
||||||
}*/
|
}*/
|
||||||
int index = packetNetData.getIndex();
|
int index = packetNetData.getIndex();
|
||||||
LOGGER.info("the uid={},the msg={} is processing,the index={},the sessionIndex={}", iSession.getUid(), MessageTypeProto.MessageType.valueOf(packetNetData.getMsgId()), index, iSession.getIndex());
|
|
||||||
|
|
||||||
|
|
||||||
if (iSession.getIndex() >= index) {
|
if (iSession.getIndex() >= index) {
|
||||||
byte[] message = iSession.getCacheMessage(index);
|
byte[] message = iSession.getCacheMessage(index);
|
||||||
|
|
|
@ -475,6 +475,7 @@ public class ItemUtil {
|
||||||
SItem sItem = SItem.getsItemMap().get(itemId);
|
SItem sItem = SItem.getsItemMap().get(itemId);
|
||||||
int itemType =getItemType(sItem);
|
int itemType =getItemType(sItem);
|
||||||
switch (itemType) {
|
switch (itemType) {
|
||||||
|
case GlobalItemType.SOUL_MARK:
|
||||||
case GlobalItemType.ITEM:
|
case GlobalItemType.ITEM:
|
||||||
putcountMap(itemId,MathUtils.numRount((itemNum * dropRatio)) , itemMap);
|
putcountMap(itemId,MathUtils.numRount((itemNum * dropRatio)) , itemMap);
|
||||||
break;
|
break;
|
||||||
|
@ -483,7 +484,7 @@ public class ItemUtil {
|
||||||
break;
|
break;
|
||||||
case GlobalItemType.EQUIP:
|
case GlobalItemType.EQUIP:
|
||||||
case GlobalItemType.ESPECIAL_EQUIP:
|
case GlobalItemType.ESPECIAL_EQUIP:
|
||||||
case GlobalItemType.SOUL_MARK:
|
|
||||||
putcountMap(itemId, itemNum, equipMap);
|
putcountMap(itemId, itemNum, equipMap);
|
||||||
break;
|
break;
|
||||||
case GlobalItemType.RANDOM_ITME:
|
case GlobalItemType.RANDOM_ITME:
|
||||||
|
|
|
@ -9,7 +9,7 @@ public class SCHeroRankUpConfig implements BaseConfig{
|
||||||
|
|
||||||
private int type;
|
private int type;
|
||||||
|
|
||||||
private float rankupPara;
|
private int[][] rankupPara;
|
||||||
|
|
||||||
private int limitLevel;
|
private int limitLevel;
|
||||||
|
|
||||||
|
@ -27,6 +27,8 @@ public class SCHeroRankUpConfig implements BaseConfig{
|
||||||
|
|
||||||
private int[][] sumConsume;
|
private int[][] sumConsume;
|
||||||
|
|
||||||
|
private int judgeClass;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void init() throws Exception {
|
public void init() throws Exception {
|
||||||
}
|
}
|
||||||
|
@ -41,7 +43,7 @@ public class SCHeroRankUpConfig implements BaseConfig{
|
||||||
return type;
|
return type;
|
||||||
}
|
}
|
||||||
|
|
||||||
public float getRankupPara() {
|
public int[][] getRankupPara() {
|
||||||
return rankupPara;
|
return rankupPara;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -39,17 +39,33 @@ public class SEquipConfig implements BaseConfig {
|
||||||
|
|
||||||
private int score;
|
private int score;
|
||||||
|
|
||||||
|
|
||||||
private int[] range;
|
private int[] range;
|
||||||
|
|
||||||
private Set<Integer> rangeHeroTids;
|
private Set<Integer> rangeHeroTids;
|
||||||
|
|
||||||
|
private int star;
|
||||||
|
|
||||||
|
private int[][] resource;
|
||||||
|
private int[][] formula;
|
||||||
|
|
||||||
|
private int limit;
|
||||||
|
|
||||||
|
private int passiveSkill;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void init() throws Exception {
|
public void init() throws Exception {
|
||||||
Map<Integer, SEquipConfig> config = STableManager.getConfig(SEquipConfig.class);
|
Map<Integer, SEquipConfig> config = STableManager.getConfig(SEquipConfig.class);
|
||||||
config.forEach((k,v)->{
|
config.forEach((k,v)->{
|
||||||
Set<Integer> rangeTemp = new HashSet<>();
|
if(v.getRange()!=null && v.getRange().length>0 && v.getRange()[0]!=0){
|
||||||
Arrays.stream(v.getRange()).forEach(e->rangeTemp.add(e));
|
Set<Integer> rangeTemp = new HashSet<>();
|
||||||
v.setRangeHeroTids(rangeTemp);
|
Arrays.stream(v.getRange()).forEach(e->rangeTemp.add(e));
|
||||||
|
v.setRangeHeroTids(rangeTemp);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -108,6 +124,7 @@ public class SEquipConfig implements BaseConfig {
|
||||||
|
|
||||||
public int getIfShow(){return ifShow; }
|
public int getIfShow(){return ifShow; }
|
||||||
|
|
||||||
|
|
||||||
public Set<Integer> getRangeHeroTids() {
|
public Set<Integer> getRangeHeroTids() {
|
||||||
return rangeHeroTids;
|
return rangeHeroTids;
|
||||||
}
|
}
|
||||||
|
@ -120,4 +137,27 @@ public class SEquipConfig implements BaseConfig {
|
||||||
public int[] getRange() {
|
public int[] getRange() {
|
||||||
return range;
|
return range;
|
||||||
}
|
}
|
||||||
|
public int getStar() {
|
||||||
|
return star;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setStar(int star) {
|
||||||
|
this.star = star;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int[][] getResource() {
|
||||||
|
return resource;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int[][] getFormula() {
|
||||||
|
return formula;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getLimit() {
|
||||||
|
return limit;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getPassiveSkill() {
|
||||||
|
return passiveSkill;
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -0,0 +1,37 @@
|
||||||
|
package config;
|
||||||
|
|
||||||
|
import manager.STableManager;
|
||||||
|
import manager.Table;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
@Table(name ="EquipStarsConfig")
|
||||||
|
public class SEquipStarsConfig implements BaseConfig {
|
||||||
|
|
||||||
|
private int id;
|
||||||
|
|
||||||
|
private int rankupCount;
|
||||||
|
|
||||||
|
private int[][] rankupResources;
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void init() throws Exception {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public int getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getRankupCount() {
|
||||||
|
return rankupCount;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int[][] getRankupResources() {
|
||||||
|
return rankupResources;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -105,7 +105,7 @@ public class SGameSetting implements BaseConfig {
|
||||||
|
|
||||||
private int[] equipTalismanaUnlock;
|
private int[] equipTalismanaUnlock;
|
||||||
|
|
||||||
private int[] equipSignUnlock;
|
private int[][] equipSignUnlock;
|
||||||
|
|
||||||
private int[] heroReturn;
|
private int[] heroReturn;
|
||||||
|
|
||||||
|
@ -312,7 +312,7 @@ public class SGameSetting implements BaseConfig {
|
||||||
return equipTalismanaUnlock;
|
return equipTalismanaUnlock;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int[] getEquipSignUnlock() {
|
public int[][] getEquipSignUnlock() {
|
||||||
return equipSignUnlock;
|
return equipSignUnlock;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -14,7 +14,7 @@ public class SHeroLevlConfig implements BaseConfig{
|
||||||
|
|
||||||
private int level;
|
private int level;
|
||||||
|
|
||||||
private float characterLevelPara;
|
private int[][] characterLevelPara;
|
||||||
|
|
||||||
private float speedLevelPara;
|
private float speedLevelPara;
|
||||||
|
|
||||||
|
@ -47,7 +47,7 @@ public class SHeroLevlConfig implements BaseConfig{
|
||||||
return sHeroLevlConfigMap;
|
return sHeroLevlConfigMap;
|
||||||
}
|
}
|
||||||
|
|
||||||
public float getCharacterLevelPara() {
|
public int[][] getCharacterLevelPara() {
|
||||||
return characterLevelPara;
|
return characterLevelPara;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -24,7 +24,7 @@ public class SPrivilegeTypeConfig implements BaseConfig {
|
||||||
|
|
||||||
private int[][] condition;
|
private int[][] condition;
|
||||||
|
|
||||||
private int continueTime;
|
private int[] continueTime;
|
||||||
|
|
||||||
private static Map<Integer,SPrivilegeTypeConfig> sPrivilegeTypeConfigMap;
|
private static Map<Integer,SPrivilegeTypeConfig> sPrivilegeTypeConfigMap;
|
||||||
|
|
||||||
|
@ -84,7 +84,7 @@ public class SPrivilegeTypeConfig implements BaseConfig {
|
||||||
return condition;
|
return condition;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getContinueTime() {
|
public int[] getContinueTime() {
|
||||||
return continueTime;
|
return continueTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue