Merge branch 'master' of http://60.1.1.230/backend/jieling_server
commit
014e56d37d
|
@ -215,7 +215,7 @@ function BattleMain.Execute(args, fightData, optionData)
|
||||||
Random.SetSeed(args.seed)
|
Random.SetSeed(args.seed)
|
||||||
BattleLogic.Init(fightData, optionData, _maxRound)
|
BattleLogic.Init(fightData, optionData, _maxRound)
|
||||||
BattleLogic.Type = _type
|
BattleLogic.Type = _type
|
||||||
if _type == 9 or _type == 10 or _type == 11 then
|
if _type == 9 or _type == 10 or _type == 11 then
|
||||||
AddRecord(fightData)
|
AddRecord(fightData)
|
||||||
end
|
end
|
||||||
BattleLogic.StartOrder()
|
BattleLogic.StartOrder()
|
||||||
|
|
|
@ -10,13 +10,14 @@ import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.util.concurrent.atomic.AtomicInteger;
|
||||||
|
|
||||||
public class CheckFight {
|
public class CheckFight {
|
||||||
|
|
||||||
private static final Logger LOGGER = LoggerFactory.getLogger(CheckFight.class);
|
private static final Logger LOGGER = LoggerFactory.getLogger(CheckFight.class);
|
||||||
|
|
||||||
private ThreadLocal<LuaValue> localTransCoderObj = new ThreadLocal<LuaValue>();
|
private ThreadLocal<LuaValue> localTransCoderObj = new ThreadLocal<LuaValue>();
|
||||||
|
private ThreadLocal<Integer> localVersion = new ThreadLocal<>();
|
||||||
// private String luaFileName = null;
|
// private String luaFileName = null;
|
||||||
|
|
||||||
private CheckFight(){}
|
private CheckFight(){}
|
||||||
|
@ -29,7 +30,7 @@ public class CheckFight {
|
||||||
return CheckFight.Instance.instance;
|
return CheckFight.Instance.instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
private int hotFixVersion = 0;
|
private AtomicInteger hotFixVersion = new AtomicInteger();
|
||||||
|
|
||||||
static class LuaHotFixBean{
|
static class LuaHotFixBean{
|
||||||
private int version;
|
private int version;
|
||||||
|
@ -42,21 +43,22 @@ public class CheckFight {
|
||||||
|
|
||||||
public void luaHotFix(){
|
public void luaHotFix(){
|
||||||
LuaHotFixBean luaHotFixBean = STableManager.getJsonFilePathInJsonConf("lua-hotfix.json", LuaHotFixBean.class);
|
LuaHotFixBean luaHotFixBean = STableManager.getJsonFilePathInJsonConf("lua-hotfix.json", LuaHotFixBean.class);
|
||||||
if(luaHotFixBean!=null && hotFixVersion < luaHotFixBean.getVersion()){
|
if(luaHotFixBean!=null && hotFixVersion.get() < luaHotFixBean.getVersion()){
|
||||||
LOGGER.info("the curhotFixVersion={},the new hotFixVersion={} will hotfix ",hotFixVersion,luaHotFixBean.getVersion());
|
LOGGER.info("the curhotFixVersion={},the new hotFixVersion={} will hotfix ",hotFixVersion.get(),luaHotFixBean.getVersion());
|
||||||
init();
|
//init();
|
||||||
LOGGER.info("the luahotfix done");
|
LOGGER.info("the luahotfix done");
|
||||||
hotFixVersion = luaHotFixBean.getVersion();
|
hotFixVersion.set(luaHotFixBean.getVersion());
|
||||||
|
//tofix 不是原子操作
|
||||||
this.localTransCoderObj = new ThreadLocal<LuaValue>();
|
this.localTransCoderObj = new ThreadLocal<LuaValue>();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void init(){
|
// public void init(){
|
||||||
LuaHotFixBean luaHotFixBean = STableManager.getJsonFilePathInJsonConf("lua-hotfix.json", LuaHotFixBean.class);
|
// LuaHotFixBean luaHotFixBean = STableManager.getJsonFilePathInJsonConf("lua-hotfix.json", LuaHotFixBean.class);
|
||||||
if(luaHotFixBean!=null) {
|
// if(luaHotFixBean!=null) {
|
||||||
hotFixVersion = luaHotFixBean.getVersion();
|
// hotFixVersion = luaHotFixBean.getVersion();
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
|
||||||
|
|
||||||
public static String getPath(String prefixDir, String... filePath) throws IOException {
|
public static String getPath(String prefixDir, String... filePath) throws IOException {
|
||||||
|
@ -117,13 +119,14 @@ public class CheckFight {
|
||||||
|
|
||||||
public LuaValue getTransCoderObj(){
|
public LuaValue getTransCoderObj(){
|
||||||
LuaValue transCoderObj = localTransCoderObj.get();
|
LuaValue transCoderObj = localTransCoderObj.get();
|
||||||
if(transCoderObj == null){
|
if(transCoderObj == null||localVersion.get()!=hotFixVersion.get()){
|
||||||
String luaFileName = null;
|
String luaFileName = null;
|
||||||
try {
|
try {
|
||||||
luaFileName = getPath("luafight/BattleMain.lua");
|
luaFileName = getPath("luafight/BattleMain.lua");
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
localVersion.set( hotFixVersion.get());
|
||||||
Globals globals = JsePlatform.debugGlobals();
|
Globals globals = JsePlatform.debugGlobals();
|
||||||
transCoderObj = globals.loadfile(luaFileName).call();
|
transCoderObj = globals.loadfile(luaFileName).call();
|
||||||
localTransCoderObj.set(transCoderObj);
|
localTransCoderObj.set(transCoderObj);
|
||||||
|
|
|
@ -2,6 +2,7 @@ package com.ljsd.jieling.config.clazzStaticCfg;
|
||||||
|
|
||||||
import com.ljsd.jieling.logic.hero.HeroLogic;
|
import com.ljsd.jieling.logic.hero.HeroLogic;
|
||||||
import config.SArenaRobotConfig;
|
import config.SArenaRobotConfig;
|
||||||
|
import config.SCHero;
|
||||||
import config.SWorkShopTechnology;
|
import config.SWorkShopTechnology;
|
||||||
import manager.AbstractClassStaticConfig;
|
import manager.AbstractClassStaticConfig;
|
||||||
import manager.STableManager;
|
import manager.STableManager;
|
||||||
|
@ -25,6 +26,10 @@ public class SArenaRobotStaticConfig extends AbstractClassStaticConfig {
|
||||||
int heroLevel = sArenaRobotConfig.getRobotLevel();
|
int heroLevel = sArenaRobotConfig.getRobotLevel();
|
||||||
Map<Integer,Integer> starHeroMap = new HashMap<>();
|
Map<Integer,Integer> starHeroMap = new HashMap<>();
|
||||||
for(Integer heroTid :heroList){
|
for(Integer heroTid :heroList){
|
||||||
|
SCHero scHero = SCHero.getsCHero().get(heroTid);
|
||||||
|
if(null ==scHero){
|
||||||
|
throw new IllegalArgumentException("sArenaRobotConfig id "+sArenaRobotConfig.getId()+"机器人英雄模板id找不到 heroTid:"+heroTid);
|
||||||
|
}
|
||||||
int heroBreakId = HeroLogic.getInstance().calRobotStarByLevel(heroTid, heroLevel,starHeroMap);
|
int heroBreakId = HeroLogic.getInstance().calRobotStarByLevel(heroTid, heroLevel,starHeroMap);
|
||||||
sArenaRobotConfig.setBreakId(heroBreakId);
|
sArenaRobotConfig.setBreakId(heroBreakId);
|
||||||
sArenaRobotConfig.setStarOfHeroMap(starHeroMap);
|
sArenaRobotConfig.setStarOfHeroMap(starHeroMap);
|
||||||
|
|
|
@ -123,8 +123,8 @@ public class EndExpeditionBattleRequest extends BaseHandler<Expedition.EndExpedi
|
||||||
|
|
||||||
if (resultCode != 1) {
|
if (resultCode != 1) {
|
||||||
|
|
||||||
if (nodeInfo.getType() == ExpeditionLogic.NODETYPE_GREED) {
|
if (nodeInfo.getType() == ExpeditionLogic.NODETYPE_GREED||(expeditionManager.getExpeditionLeve()>2&&nodeInfo.getType() == ExpeditionLogic.NODETYPE_BOSS)) {
|
||||||
|
//贪婪节点只有1次战斗机会,若战斗失败后敌人将会逃走,玩家视为通过此节点
|
||||||
//updata node
|
//updata node
|
||||||
Set<CommonProto.ExpeditionNodeInfo> nodeInfos = ExpeditionLogic.openLay(user,nodeInfo.getLay(),nodeId);
|
Set<CommonProto.ExpeditionNodeInfo> nodeInfos = ExpeditionLogic.openLay(user,nodeInfo.getLay(),nodeId);
|
||||||
|
|
||||||
|
|
|
@ -5,6 +5,7 @@ import com.ljsd.jieling.core.HandlerLogicThread;
|
||||||
import com.ljsd.jieling.exception.ErrorCode;
|
import com.ljsd.jieling.exception.ErrorCode;
|
||||||
import com.ljsd.jieling.exception.ErrorCodeException;
|
import com.ljsd.jieling.exception.ErrorCodeException;
|
||||||
import com.ljsd.jieling.handler.BaseHandler;
|
import com.ljsd.jieling.handler.BaseHandler;
|
||||||
|
import com.ljsd.jieling.logic.GlobalDataManaager;
|
||||||
import com.ljsd.jieling.logic.dao.*;
|
import com.ljsd.jieling.logic.dao.*;
|
||||||
import com.ljsd.jieling.logic.dao.root.User;
|
import com.ljsd.jieling.logic.dao.root.User;
|
||||||
import com.ljsd.jieling.logic.expedition.ExpeditionLogic;
|
import com.ljsd.jieling.logic.expedition.ExpeditionLogic;
|
||||||
|
@ -18,6 +19,7 @@ import com.ljsd.jieling.util.MessageUtil;
|
||||||
import config.SExpeditionSetting;
|
import config.SExpeditionSetting;
|
||||||
import config.SGlobalSystemConfig;
|
import config.SGlobalSystemConfig;
|
||||||
import manager.STableManager;
|
import manager.STableManager;
|
||||||
|
import util.TimeUtils;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -83,6 +85,13 @@ public class GetExpeditionRequestHandler extends BaseHandler<Expedition.GetExped
|
||||||
soulEquipList.add(CBean2Proto.getEquipProto(equipInfo));
|
soulEquipList.add(CBean2Proto.getEquipProto(equipInfo));
|
||||||
}
|
}
|
||||||
builder.addAllEquip(soulEquipList);
|
builder.addAllEquip(soulEquipList);
|
||||||
|
|
||||||
|
|
||||||
|
TimeControllerOfFunction timeControllerOfFunction = GlobalDataManaager.getInstance().getTimeControllerOfFunctionByFunctinoType(FunctionIdEnum.Expedition);
|
||||||
|
if( null != timeControllerOfFunction){
|
||||||
|
builder.setStartTime((int)(timeControllerOfFunction.getStartTime()/1000));
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
MessageUtil.sendMessage(iSession, 1, MessageTypeProto.MessageType.EXPEDITION_GET_EXPEDITION_RESONSE_VALUE, builder.build(), true);
|
MessageUtil.sendMessage(iSession, 1, MessageTypeProto.MessageType.EXPEDITION_GET_EXPEDITION_RESONSE_VALUE, builder.build(), true);
|
||||||
}
|
}
|
||||||
|
|
|
@ -71,25 +71,29 @@ public class HeroNodeGetInfoRequestHandler extends BaseHandler<Expedition.HeroNo
|
||||||
|
|
||||||
Map<String, Hero> heroMapTemp = user.getExpeditionManager().getHeroMapTemp(nodeId);
|
Map<String, Hero> heroMapTemp = user.getExpeditionManager().getHeroMapTemp(nodeId);
|
||||||
if(heroMapTemp.size()==0){
|
if(heroMapTemp.size()==0){
|
||||||
SExpeditionRecruitConfig sExpeditionRecruitConfig = STableManager.getConfig(SExpeditionRecruitConfig.class).get(sExpeditionNodeConfig.getPoolId());
|
int poolId = sExpeditionNodeConfig.getPoolId();
|
||||||
if(sExpeditionRecruitConfig!=null) {
|
TreeSet<Integer> randomTid = ExpeditionLogic.getRandomTid(poolId, recruitTime);
|
||||||
int i = sExpeditionRecruitConfig.getHeroId();
|
|
||||||
//获取最大战力hero
|
|
||||||
String maxforceHero = user.getPlayerInfoManager().getMaxforceHero();
|
|
||||||
if (StringUtil.isEmpty(maxforceHero)) {
|
|
||||||
HeroLogic.getInstance().calTeamTotalForce(user, 1, false);
|
|
||||||
maxforceHero = user.getPlayerInfoManager().getMaxforceHero();
|
|
||||||
}
|
|
||||||
Hero hero = user.getHeroManager().getHeroMap().get(maxforceHero);
|
|
||||||
if (hero == null) {
|
|
||||||
throw new ErrorCodeException("试炼节点英雄掉落失败");
|
|
||||||
}
|
|
||||||
|
|
||||||
for (int j = 0; j < recruitTime; j++) {
|
//获取最大战力hero
|
||||||
|
String maxforceHero = user.getPlayerInfoManager().getMaxforceHero();
|
||||||
|
if (StringUtil.isEmpty(maxforceHero)) {
|
||||||
|
HeroLogic.getInstance().calTeamTotalForce(user, 1, false);
|
||||||
|
maxforceHero = user.getPlayerInfoManager().getMaxforceHero();
|
||||||
|
}
|
||||||
|
Hero hero = user.getHeroManager().getHeroMap().get(maxforceHero);
|
||||||
|
if (hero == null) {
|
||||||
|
throw new ErrorCodeException("招募节点英雄掉落失败");
|
||||||
|
}
|
||||||
|
|
||||||
|
for (Integer integer:randomTid) {
|
||||||
|
SExpeditionRecruitConfig sExpeditionRecruitConfig = STableManager.getConfig(SExpeditionRecruitConfig.class).get(integer);
|
||||||
|
if(sExpeditionRecruitConfig!=null) {
|
||||||
|
int i = sExpeditionRecruitConfig.getHeroId();
|
||||||
ExpeditionLogic.createHero(i, uid, hero, nodeId);
|
ExpeditionLogic.createHero(i, uid, hero, nodeId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
heroMapTemp = user.getExpeditionManager().getHeroMapTemp(nodeId);
|
heroMapTemp = user.getExpeditionManager().getHeroMapTemp(nodeId);
|
||||||
heroMapTemp.forEach((s, hero) -> {
|
heroMapTemp.forEach((s, hero) -> {
|
||||||
|
|
|
@ -221,7 +221,8 @@ public class ItemLogic {
|
||||||
throw new ErrorCodeException(ErrorCode.ITEM_NOT_ENOUGH);
|
throw new ErrorCodeException(ErrorCode.ITEM_NOT_ENOUGH);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!itemMap.containsKey(itemId)&&!cardMap.containsKey(itemId)&&!equipMap.containsKey(itemId)&&!randomMap.containsKey(itemId)){
|
Map<Integer, Integer> mapRe = ItemUtil.getMapRe(itemId, itemMap, cardMap, equipMap, randomMap);
|
||||||
|
if(!mapRe.containsKey(itemId)){
|
||||||
throw new ErrorCodeException(ErrorCode.SERVER_DEFINE);
|
throw new ErrorCodeException(ErrorCode.SERVER_DEFINE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -229,7 +230,7 @@ public class ItemLogic {
|
||||||
int[][] dropItems = new int[1][];
|
int[][] dropItems = new int[1][];
|
||||||
dropItems[0] = new int[2];
|
dropItems[0] = new int[2];
|
||||||
dropItems[0][0] = itemId;
|
dropItems[0][0] = itemId;
|
||||||
dropItems[0][1] = num;
|
dropItems[0][1] = num*mapRe.get(itemId);
|
||||||
CommonProto.Drop.Builder drop = ItemUtil.drop(user, dropItems, BIReason.USER_ITEM);
|
CommonProto.Drop.Builder drop = ItemUtil.drop(user, dropItems, BIReason.USER_ITEM);
|
||||||
sendUseAndPriceItemMessage(iSession, msgId, drop);
|
sendUseAndPriceItemMessage(iSession, msgId, drop);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package com.ljsd.jieling.thread.task;
|
package com.ljsd.jieling.thread.task;
|
||||||
|
|
||||||
|
import com.ljsd.GameApplication;
|
||||||
import com.ljsd.jieling.config.reportData.DataMessageUtils;
|
import com.ljsd.jieling.config.reportData.DataMessageUtils;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
@ -13,6 +14,9 @@ public class DataReportTask extends Thread {
|
||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
|
if(GameApplication.serverProperties.isDebug()){
|
||||||
|
return;
|
||||||
|
}
|
||||||
while (true) {
|
while (true) {
|
||||||
DataMessageUtils.manageData();
|
DataMessageUtils.manageData();
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,6 +6,7 @@ import com.ljsd.jieling.config.clazzStaticCfg.MapStaticConfig;
|
||||||
import com.ljsd.jieling.core.GlobalsDef;
|
import com.ljsd.jieling.core.GlobalsDef;
|
||||||
import com.ljsd.jieling.core.VipPrivilegeType;
|
import com.ljsd.jieling.core.VipPrivilegeType;
|
||||||
import com.ljsd.jieling.dataReport.reportBeans_37.Repot37EventUtil;
|
import com.ljsd.jieling.dataReport.reportBeans_37.Repot37EventUtil;
|
||||||
|
import com.ljsd.jieling.exception.ErrorCodeException;
|
||||||
import com.ljsd.jieling.globals.BIReason;
|
import com.ljsd.jieling.globals.BIReason;
|
||||||
import com.ljsd.jieling.globals.Global;
|
import com.ljsd.jieling.globals.Global;
|
||||||
import com.ljsd.jieling.globals.GlobalItemType;
|
import com.ljsd.jieling.globals.GlobalItemType;
|
||||||
|
@ -476,26 +477,30 @@ public class ItemUtil {
|
||||||
|
|
||||||
private static void getMap(int itemId ,int itemNum, Map<Integer, Integer> itemMap,
|
private static void getMap(int itemId ,int itemNum, Map<Integer, Integer> itemMap,
|
||||||
Map<Integer, Integer> cardMap,Map<Integer,Integer> equipMap ,Map<Integer,Integer> randomMap,float dropRatio) {
|
Map<Integer, Integer> cardMap,Map<Integer,Integer> equipMap ,Map<Integer,Integer> randomMap,float dropRatio) {
|
||||||
|
Map<Integer, Integer> mapRe = getMapRe(itemId, itemMap, cardMap, equipMap, randomMap);
|
||||||
|
putcountMap(itemId,MathUtils.numRount((itemNum * dropRatio)) , mapRe);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Map<Integer, Integer> getMapRe(int itemId, Map<Integer, Integer> itemMap,
|
||||||
|
Map<Integer, Integer> cardMap,Map<Integer,Integer> equipMap ,Map<Integer,Integer> randomMap) {
|
||||||
|
|
||||||
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.SOUL_MARK:
|
||||||
case GlobalItemType.ITEM:
|
case GlobalItemType.ITEM:
|
||||||
putcountMap(itemId,MathUtils.numRount((itemNum * dropRatio)) , itemMap);
|
return itemMap;
|
||||||
break;
|
|
||||||
case GlobalItemType.CARD:
|
case GlobalItemType.CARD:
|
||||||
putcountMap(itemId, itemNum, cardMap);
|
return cardMap;
|
||||||
break;
|
|
||||||
case GlobalItemType.EQUIP:
|
case GlobalItemType.EQUIP:
|
||||||
case GlobalItemType.ESPECIAL_EQUIP:
|
case GlobalItemType.ESPECIAL_EQUIP:
|
||||||
case GlobalItemType.JEWEL:
|
case GlobalItemType.JEWEL:
|
||||||
putcountMap(itemId, itemNum, equipMap);
|
return equipMap;
|
||||||
break;
|
|
||||||
case GlobalItemType.RANDOM_ITME:
|
case GlobalItemType.RANDOM_ITME:
|
||||||
putcountMap(itemId, itemNum, randomMap);
|
return randomMap;
|
||||||
break;
|
|
||||||
default:
|
default:
|
||||||
break;
|
LOGGER.error("新增类型请通知后端");
|
||||||
|
return new HashMap<>();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue