back_recharge
lvxinran 2020-06-15 18:20:16 +08:00
commit 014e56d37d
9 changed files with 72 additions and 41 deletions

View File

@ -215,7 +215,7 @@ function BattleMain.Execute(args, fightData, optionData)
Random.SetSeed(args.seed)
BattleLogic.Init(fightData, optionData, _maxRound)
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)
end
BattleLogic.StartOrder()

View File

@ -10,13 +10,14 @@ import org.slf4j.LoggerFactory;
import java.io.File;
import java.io.IOException;
import java.util.concurrent.atomic.AtomicInteger;
public class CheckFight {
private static final Logger LOGGER = LoggerFactory.getLogger(CheckFight.class);
private ThreadLocal<LuaValue> localTransCoderObj = new ThreadLocal<LuaValue>();
private ThreadLocal<Integer> localVersion = new ThreadLocal<>();
// private String luaFileName = null;
private CheckFight(){}
@ -29,7 +30,7 @@ public class CheckFight {
return CheckFight.Instance.instance;
}
private int hotFixVersion = 0;
private AtomicInteger hotFixVersion = new AtomicInteger();
static class LuaHotFixBean{
private int version;
@ -42,21 +43,22 @@ public class CheckFight {
public void luaHotFix(){
LuaHotFixBean luaHotFixBean = STableManager.getJsonFilePathInJsonConf("lua-hotfix.json", LuaHotFixBean.class);
if(luaHotFixBean!=null && hotFixVersion < luaHotFixBean.getVersion()){
LOGGER.info("the curhotFixVersion={},the new hotFixVersion={} will hotfix ",hotFixVersion,luaHotFixBean.getVersion());
init();
if(luaHotFixBean!=null && hotFixVersion.get() < luaHotFixBean.getVersion()){
LOGGER.info("the curhotFixVersion={},the new hotFixVersion={} will hotfix ",hotFixVersion.get(),luaHotFixBean.getVersion());
//init();
LOGGER.info("the luahotfix done");
hotFixVersion = luaHotFixBean.getVersion();
hotFixVersion.set(luaHotFixBean.getVersion());
//tofix 不是原子操作
this.localTransCoderObj = new ThreadLocal<LuaValue>();
}
}
public void init(){
LuaHotFixBean luaHotFixBean = STableManager.getJsonFilePathInJsonConf("lua-hotfix.json", LuaHotFixBean.class);
if(luaHotFixBean!=null) {
hotFixVersion = luaHotFixBean.getVersion();
}
}
// public void init(){
// LuaHotFixBean luaHotFixBean = STableManager.getJsonFilePathInJsonConf("lua-hotfix.json", LuaHotFixBean.class);
// if(luaHotFixBean!=null) {
// hotFixVersion = luaHotFixBean.getVersion();
// }
// }
public static String getPath(String prefixDir, String... filePath) throws IOException {
@ -117,13 +119,14 @@ public class CheckFight {
public LuaValue getTransCoderObj(){
LuaValue transCoderObj = localTransCoderObj.get();
if(transCoderObj == null){
if(transCoderObj == null||localVersion.get()!=hotFixVersion.get()){
String luaFileName = null;
try {
luaFileName = getPath("luafight/BattleMain.lua");
} catch (IOException e) {
e.printStackTrace();
}
localVersion.set( hotFixVersion.get());
Globals globals = JsePlatform.debugGlobals();
transCoderObj = globals.loadfile(luaFileName).call();
localTransCoderObj.set(transCoderObj);

View File

@ -2,6 +2,7 @@ package com.ljsd.jieling.config.clazzStaticCfg;
import com.ljsd.jieling.logic.hero.HeroLogic;
import config.SArenaRobotConfig;
import config.SCHero;
import config.SWorkShopTechnology;
import manager.AbstractClassStaticConfig;
import manager.STableManager;
@ -25,6 +26,10 @@ public class SArenaRobotStaticConfig extends AbstractClassStaticConfig {
int heroLevel = sArenaRobotConfig.getRobotLevel();
Map<Integer,Integer> starHeroMap = new HashMap<>();
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);
sArenaRobotConfig.setBreakId(heroBreakId);
sArenaRobotConfig.setStarOfHeroMap(starHeroMap);

View File

@ -123,8 +123,8 @@ public class EndExpeditionBattleRequest extends BaseHandler<Expedition.EndExpedi
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
Set<CommonProto.ExpeditionNodeInfo> nodeInfos = ExpeditionLogic.openLay(user,nodeInfo.getLay(),nodeId);

View File

@ -5,6 +5,7 @@ import com.ljsd.jieling.core.HandlerLogicThread;
import com.ljsd.jieling.exception.ErrorCode;
import com.ljsd.jieling.exception.ErrorCodeException;
import com.ljsd.jieling.handler.BaseHandler;
import com.ljsd.jieling.logic.GlobalDataManaager;
import com.ljsd.jieling.logic.dao.*;
import com.ljsd.jieling.logic.dao.root.User;
import com.ljsd.jieling.logic.expedition.ExpeditionLogic;
@ -18,6 +19,7 @@ import com.ljsd.jieling.util.MessageUtil;
import config.SExpeditionSetting;
import config.SGlobalSystemConfig;
import manager.STableManager;
import util.TimeUtils;
import java.util.ArrayList;
import java.util.List;
@ -83,6 +85,13 @@ public class GetExpeditionRequestHandler extends BaseHandler<Expedition.GetExped
soulEquipList.add(CBean2Proto.getEquipProto(equipInfo));
}
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);
}

View File

@ -71,25 +71,29 @@ public class HeroNodeGetInfoRequestHandler extends BaseHandler<Expedition.HeroNo
Map<String, Hero> heroMapTemp = user.getExpeditionManager().getHeroMapTemp(nodeId);
if(heroMapTemp.size()==0){
SExpeditionRecruitConfig sExpeditionRecruitConfig = STableManager.getConfig(SExpeditionRecruitConfig.class).get(sExpeditionNodeConfig.getPoolId());
if(sExpeditionRecruitConfig!=null) {
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("试炼节点英雄掉落失败");
}
int poolId = sExpeditionNodeConfig.getPoolId();
TreeSet<Integer> randomTid = ExpeditionLogic.getRandomTid(poolId, recruitTime);
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);
}
}
}
heroMapTemp = user.getExpeditionManager().getHeroMapTemp(nodeId);
heroMapTemp.forEach((s, hero) -> {

View File

@ -221,7 +221,8 @@ public class ItemLogic {
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);
}
@ -229,7 +230,7 @@ public class ItemLogic {
int[][] dropItems = new int[1][];
dropItems[0] = new int[2];
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);
sendUseAndPriceItemMessage(iSession, msgId, drop);
}

View File

@ -1,5 +1,6 @@
package com.ljsd.jieling.thread.task;
import com.ljsd.GameApplication;
import com.ljsd.jieling.config.reportData.DataMessageUtils;
import org.springframework.stereotype.Component;
@ -13,6 +14,9 @@ public class DataReportTask extends Thread {
}
@Override
public void run() {
if(GameApplication.serverProperties.isDebug()){
return;
}
while (true) {
DataMessageUtils.manageData();
}

View File

@ -6,6 +6,7 @@ import com.ljsd.jieling.config.clazzStaticCfg.MapStaticConfig;
import com.ljsd.jieling.core.GlobalsDef;
import com.ljsd.jieling.core.VipPrivilegeType;
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.Global;
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,
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);
int itemType =getItemType(sItem);
switch (itemType) {
case GlobalItemType.SOUL_MARK:
case GlobalItemType.ITEM:
putcountMap(itemId,MathUtils.numRount((itemNum * dropRatio)) , itemMap);
break;
return itemMap;
case GlobalItemType.CARD:
putcountMap(itemId, itemNum, cardMap);
break;
return cardMap;
case GlobalItemType.EQUIP:
case GlobalItemType.ESPECIAL_EQUIP:
case GlobalItemType.JEWEL:
putcountMap(itemId, itemNum, equipMap);
break;
return equipMap;
case GlobalItemType.RANDOM_ITME:
putcountMap(itemId, itemNum, randomMap);
break;
return randomMap;
default:
break;
LOGGER.error("新增类型请通知后端");
return new HashMap<>();
}
}