Merge branch 'master' into develop

lvxinran 2019-10-31 21:09:04 +08:00
commit 256099e1a1
43 changed files with 608 additions and 366 deletions

View File

@ -791,14 +791,14 @@ local effectList = {
end
end)
end,
--造成[a]*[b]%的伤害(真实伤害)(目标最大生命值伤害总上限为施法者5倍攻击
--造成[a]*[b]%的伤害(真实伤害)(目标最大生命值伤害总上限为施法者2.5倍攻击
--a[属性],b[float]
[48] = function(caster, target, args, interval)
local pro = args[1]
local d = args[2]
caster.Event:DispatchEvent(BattleEventName.RoleViewBullet, interval, target)
BattleLogic.WaitForTrigger(interval, function ()
BattleUtil.ApplyDamage(caster, target, min(floor(caster:GetRoleData(propertyList[pro])*d), floor(caster:GetRoleData(RoleDataName.Attack)*5)))
BattleUtil.ApplyDamage(caster, target, min(floor(caster:GetRoleData(propertyList[pro])*d), floor(caster:GetRoleData(RoleDataName.Attack)*2.5)))
end)
end,
--造成[a]%的[b]伤害,提升自身下个技能[c]%的伤害
@ -1222,7 +1222,7 @@ local effectList = {
end)
end
end,
--造成[a]%的[b]伤害,附带持续伤害,每秒造成目标最大生命值[c]%的真实伤害,持续[d]秒。(目标最大生命值伤害总上限为施法者5倍攻击
--造成[a]%的[b]伤害,附带持续伤害,每秒造成目标最大生命值[c]%的真实伤害,持续[d]秒。(目标最大生命值伤害总上限为施法者2.5倍攻击
--a[float],b[伤害类型],c[float],d[int]
[68] = function(caster, target, args, interval)
local f1 = args[1]
@ -1232,7 +1232,7 @@ local effectList = {
caster.Event:DispatchEvent(BattleEventName.RoleViewBullet, interval, target)
BattleLogic.WaitForTrigger(interval, function ()
BattleUtil.CalDamage(caster, target, dt, f1)
local dot = Buff.Create(caster, BuffName.DOT, f3, 1, 0, min(floor(target:GetRoleData(RoleDataName.MaxHp)*f2), floor(caster:GetRoleData(RoleDataName.Attack)*5)), 1)
local dot = Buff.Create(caster, BuffName.DOT, f3, 1, 0, min(floor(target:GetRoleData(RoleDataName.MaxHp)*f2), floor(caster:GetRoleData(RoleDataName.Attack)*2.5)), 1)
dot.isRealDamage = true
target:AddBuff(dot)
end)
@ -1557,7 +1557,7 @@ local effectList = {
end)
end)
end,
--施加[a]的[b]%护盾,持续[c]秒。护盾被击破时,对敌方全体造成最大生命值[d]%的伤害。(目标最大生命值伤害总上限为施法者5倍攻击
--施加[a]的[b]%护盾,持续[c]秒。护盾被击破时,对敌方全体造成最大生命值[d]%的伤害。(目标最大生命值伤害总上限为施法者2.5倍攻击
--a[属性],b[float],c[int],d[float]
[84] = function(caster, target, args, interval)
local pro1 = args[1]
@ -1570,7 +1570,7 @@ local effectList = {
if buff == shield and buff.framePass < buff.frameDuration then --护盾被击破
local arr = BattleUtil.ChooseTarget(target, 20000)
for i=1, #arr do
BattleUtil.ApplyDamage(target, arr[i], min(floor(arr[i]:GetRoleData(RoleDataName.MaxHp)*f3), caster:GetRoleData(RoleDataName.Attack)*5))
BattleUtil.ApplyDamage(target, arr[i], min(floor(arr[i]:GetRoleData(RoleDataName.MaxHp)*f3), caster:GetRoleData(RoleDataName.Attack)*2.5))
end
end
end

View File

@ -993,7 +993,7 @@ local passivityList = {
end
role.Event:AddEvent(BattleEventName.RoleHit, OnDamage)
end,
--造成暴击时,额外造成目标最大生命值[a]%的伤害。(目标最大生命值伤害总上限为施法者5倍攻击
--造成暴击时,额外造成目标最大生命值[a]%的伤害。(目标最大生命值伤害总上限为施法者2.5倍攻击
--a[float]
[56] = function(role, args)
local f1 = args[1]
@ -1004,7 +1004,7 @@ local passivityList = {
if lastTrigger > 1 then --加入限定避免循环触发
return
end
BattleUtil.ApplyDamage(role, defRole, math.min(floor(defRole:GetRoleData(RoleDataName.MaxHp) * f1), floor(role:GetRoleData(RoleDataName.Attack)*5)))
BattleUtil.ApplyDamage(role, defRole, math.min(floor(defRole:GetRoleData(RoleDataName.MaxHp) * f1), floor(role:GetRoleData(RoleDataName.Attack)*2.5)))
lastTrigger = 0
end
role.Event:AddEvent(BattleEventName.RoleCrit, OnRoleCrit)
@ -1242,7 +1242,7 @@ local passivityList = {
end
role.Event:AddEvent(BattleEventName.RoleBeHit, OnBeHit)
end,
--造成暴击时,额外造成目标最大生命值[a]%的伤害。造成伤害时,有[a]的概率立即造成攻击[b]%的伤害该伤害造成的暴击伤害不会触发额外最大生命值伤害。效果55+效果56目标最大生命值伤害总上限为施法者5倍攻击
--造成暴击时,额外造成目标最大生命值[a]%的伤害。造成伤害时,有[a]的概率立即造成攻击[b]%的伤害该伤害造成的暴击伤害不会触发额外最大生命值伤害。效果55+效果56目标最大生命值伤害总上限为施法者2.5倍攻击
--a[float],b[float],c[float]
[69] = function(role, args)
local f1 = args[1]
@ -1256,7 +1256,7 @@ local passivityList = {
return
end
if bCrit then
BattleUtil.ApplyDamage(role, defRole, math.min(floor(defRole:GetRoleData(RoleDataName.MaxHp) * f1), floor(role:GetRoleData(RoleDataName.Attack)*5)))
BattleUtil.ApplyDamage(role, defRole, math.min(floor(defRole:GetRoleData(RoleDataName.MaxHp) * f1), floor(role:GetRoleData(RoleDataName.Attack)*2.5)))
else
BattleUtil.RandomAction(f2, function ()
BattleUtil.ApplyDamage(role, defRole, floor(role:GetRoleData(RoleDataName.Attack) * f3))

View File

@ -169,8 +169,9 @@ function BattleLogic.StartOrder()
enemyTeamSkillList[i]=nil
end
for i=1, #fightData.enemyData[BattleLogic.CurOrder].teamSkill do
enemyTeamSkillList[i] = skillPool:Get()
enemyTeamSkillList[i]:Init(enemyTeamDummyRole, fightData.enemyData[BattleLogic.CurOrder].teamSkill[i], 0)
local skill = skillPool:Get()
skill:Init(enemyTeamDummyRole, fightData.enemyData[BattleLogic.CurOrder].teamSkill[i], 0)
enemyTeamSkillList[skill.cd] = skill
end
for i=1, #fightData.enemyData[BattleLogic.CurOrder].teamPassive do
for j=1, #fightData.enemyData[BattleLogic.CurOrder].teamPassive[i] do

View File

@ -271,13 +271,15 @@ function BattleUtil.CalDamage(atkRole, defRole, damageType, baseFactor, ignoreDe
(1 + atkRole:GetRoleData(RoleDataName.ElementDamageBocusFactor) - defRole:GetRoleData(elementDamageReduceFactor)))
--属性克制关系:光暗互克,地克风克水克火克地
local restrain = atkRole.element == 1 and defRole.element == 4 or
atkRole.element == 4 and defRole.element == 2 or
atkRole.element == 2 and defRole.element == 3 or
atkRole.element == 3 and defRole.element == 1 or
atkRole.element == 5 and defRole.element == 6 or
atkRole.element == 6 and defRole.element == 5
baseDamage = restrain and floor(max(baseDamage*1.5, 0.1*attack)) or floor(max(baseDamage, 0.1*attack))
local atkEle = atkRole.roleData.element
local defEle = defRole.roleData.element
local restrain = atkEle == 1 and defEle == 4 or
atkEle == 4 and defEle == 2 or
atkEle == 2 and defEle == 3 or
atkEle == 3 and defEle == 1 or
atkEle == 5 and defEle == 6 or
atkEle == 6 and defEle == 5
baseDamage = restrain and floor(max(baseDamage*1.25, 0.1*attack)) or floor(max(baseDamage, 0.1*attack))
for i=1, atkRole.exCalDmgList.size do
local func = atkRole.exCalDmgList.buffer[i]

View File

@ -41,7 +41,7 @@ local skillPool = BattleObjectPool.New(function ()
end)
function RoleLogic.New()
local instance = {uid=0,roleData=0,data=RoleData.New(),camp=0,name=0,roleType=0,aiIndex=1,position=0,sp=0,spPass=0,
local instance = {uid=0,roleData=0,data=RoleData.New(),camp=0,name=0,aiIndex=1,position=0,sp=0,spPass=0,
shield=BattleList.New(),
exCalDmgList=BattleList.New(),
proTranList=BattleList.New(),
@ -61,7 +61,6 @@ function RoleLogic:Init(uid, data, position)
self.camp = data.camp --阵营 0我方 1敌方
self.name = data.name
self.roleType = 1 --阵营 1普通 2Boss 3召唤物
self.shield:Clear() --护盾列表
self.exCalDmgList:Clear() --额外计算伤害列表

View File

@ -113,7 +113,6 @@ public class GameApplication {
CoreLogic.getInstance().checkCoreCdk();
ThriftPoolUtils.getInstance().initContext(configurableApplicationContext);
GlobalDataManaager.getInstance().whenServerStart(configurableApplicationContext);
HeroLogic.getInstance().afterSet();
URL resource = HeroLogic.class.getClassLoader().getResource("mingan.txt");
if(resource!=null){
LOGGER.info(resource.getFile());

View File

@ -38,11 +38,11 @@ public class CommonStaticConfig extends AbstractClassStaticConfig {
registConfigs.add(SGlobalSystemConfig.class.getAnnotation(Table.class).name());
registConfigs.add(SGuildSetting.class.getAnnotation(Table.class).name());
registConfigs.add(SWorkShopSetting.class.getAnnotation(Table.class).name());
registConfigs.add(SWorkShopSetting.class.getAnnotation(Table.class).name());
}
@Override
public void figureConfigs() {
gameSetting = new SGameSetting();
try {
Map<Integer, SGameSetting> config = STableManager.getConfig(SGameSetting.class);
@ -59,14 +59,14 @@ public class CommonStaticConfig extends AbstractClassStaticConfig {
notDelete.add(Global.STAMINA);
notDelete.addAll(gameSetting.getItemRecoveryMap().keySet());
} catch (Exception e) {
LOGGER.error("gamesetting init fail");
LOGGER.error("gamesetting init fail",e);
}
try {
SChallengeMapConfig sChallengeMapConfig = STableManager.getConfig(SChallengeMapConfig.class).get(11);
initPos = CellUtil.xy2Pos(sChallengeMapConfig.getPosition()[0], sChallengeMapConfig.getPosition()[1]);
} catch (Exception e) {
LOGGER.error("sChallengeMapConfig init fail");
LOGGER.error("sChallengeMapConfig init fail",e);
}
try {
@ -108,7 +108,7 @@ public class CommonStaticConfig extends AbstractClassStaticConfig {
sGlobalSystemConfigMapByTypeAndConditionMap = sGlobalSystemConfigMapByTypeAndConditionMapTmp;
} catch (Exception e) {
LOGGER.error("SGlobalSystemConfig init fail");
LOGGER.error("SGlobalSystemConfig init fail",e);
}
try {
@ -167,7 +167,7 @@ public class CommonStaticConfig extends AbstractClassStaticConfig {
}
} catch (Exception e) {
LOGGER.error("SWorkShopTechnology init fail");
LOGGER.error("SWorkShopTechnology init fail",e);
}

View File

@ -0,0 +1,47 @@
package com.ljsd.jieling.config.clazzStaticCfg;
import com.ljsd.jieling.logic.hero.HeroLogic;
import config.SArenaRobotConfig;
import config.SWorkShopTechnology;
import manager.AbstractClassStaticConfig;
import manager.STableManager;
import manager.Table;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
public class SArenaRobotStaticConfig extends AbstractClassStaticConfig {
@Override
public void registConfigs(Set<String> registConfigs) {
registConfigs.add(SArenaRobotConfig.class.getAnnotation(Table.class).name());
}
@Override
public void figureConfigs() {
Map<Integer, SArenaRobotConfig> integerSArenaRobotConfigMap = SArenaRobotConfig.getsArenaRobotConfigMap();
for(SArenaRobotConfig sArenaRobotConfig : integerSArenaRobotConfigMap.values()){
List<Integer> heroList = sArenaRobotConfig.getHeroList();
int heroLevel = sArenaRobotConfig.getRobotLevel();
Map<Integer,Integer> starHeroMap = new HashMap<>();
for(Integer heroTid :heroList){
int heroBreakId = HeroLogic.getInstance().calRobotStarByLevel(heroTid, heroLevel,starHeroMap);
sArenaRobotConfig.setBreakId(heroBreakId);
sArenaRobotConfig.setStarOfHeroMap(starHeroMap);
}
sArenaRobotConfig.setTotalForce(HeroLogic.getInstance().calRobotTotalForce(sArenaRobotConfig));
}
int[][] returnMaterials = STableManager.getFigureConfig(CommonStaticConfig.class).getGameSetting().getReturnMaterials();
Map<Integer, Map<Integer, SWorkShopTechnology>> sWorkTechMapByTechIdAndLevel = STableManager.getFigureConfig(CommonStaticConfig.class).getsWorkTechMapByTechIdAndLevelTmp();
for(Map<Integer, SWorkShopTechnology> item : sWorkTechMapByTechIdAndLevel.values()){
for(SWorkShopTechnology sWorkShopTechnology:item.values()){
if(sWorkShopTechnology.getWillReturn() == null){
continue;
}
HeroLogic.getInstance().calPercent(returnMaterials,sWorkShopTechnology.getWillReturn());
}
}
}
}

View File

@ -2,7 +2,6 @@ package com.ljsd.jieling.core;
import com.ljsd.GameApplication;
import com.ljsd.jieling.db.mongo.MongoUtil;
import com.ljsd.jieling.exception.ErrorCode;
import com.ljsd.jieling.exception.ErrorCodeException;
import com.ljsd.jieling.exception.ErrorUtil;
import com.ljsd.jieling.handler.BaseHandler;
@ -11,7 +10,6 @@ import com.ljsd.jieling.logic.OnlineUserManager;
import com.ljsd.jieling.logic.dao.MainLevelManager;
import com.ljsd.jieling.logic.dao.UserManager;
import com.ljsd.jieling.logic.dao.root.User;
import com.ljsd.jieling.logic.mission.event.MissionEventDistributor;
import com.ljsd.jieling.netty.cocdex.PacketNetData;
import com.ljsd.jieling.network.server.ProtocolsManager;
import com.ljsd.jieling.network.session.ISession;
@ -19,7 +17,6 @@ import com.ljsd.jieling.protocols.MessageTypeProto;
import com.ljsd.jieling.util.AyyncWorker;
import com.ljsd.jieling.util.MessageUtil;
import config.SChallengeConfig;
import config.SErrorCodeEerverConfig;
import config.SGlobalSystemConfig;
import config.SMainLevelConfig;
import manager.STableManager;
@ -157,7 +154,7 @@ public class HandlerLogicThread extends Thread{
transaction.commit();
if (msgId != MessageTypeProto.MessageType.GET_CHAT_MESSAGE_REQUEST_VALUE) {
long useTime = System.nanoTime() - curTimeMillis;
LOGGER.info("doWork->uid={},mType={},useTime={},;end", userId, MessageTypeProto.MessageType.valueOf(msgId), useTime);
LOGGER.info("doWork->uid={},mType={},useTime={},;end", userId, MessageTypeProto.MessageType.valueOf(msgId), useTime/1000_000);
}
}
@ -171,7 +168,7 @@ public class HandlerLogicThread extends Thread{
//内部codeErr统一处理
if(e instanceof ErrorCodeException){
int errCode = ErrorUtil.getExceptionErrorCodeValue(e);
LOGGER.error("\nuser:"+ session.getUid());
LOGGER.error("\nAn unusual ErrorCodeException occurred for the user::use"+ session.getUid());
if (errCode <= 0) {
//打印堆栈定位错误
LOGGER.error(ErrorUtil.getExceptionStackTraceFileLineAndMethod(e));

View File

@ -186,6 +186,7 @@ public class RedisKey {
public static final String MATCH_SERVER_INFO = "MATCH_SERVER_INFO";
public static final String LOGIC_SERVER_INFO = "LOGIC_SERVER_INFO";
public static final String BLOODY_SERVER_INFO = "BLOODY_SERVER_INFO";
public static final String SYSMSG = "SYSMSG";
public final static String CDKEY = "CDKEY";

View File

@ -713,12 +713,12 @@ public class RedisUtil {
}
//操作sortset score<<32+time
public void zsetAddOneOffsetByTime(String key, String uid, int score){
public void zsetAddOneOffsetByTime(String key, String value, int score){
for (int i = 0; i < MAX_TRY_TIMES; i++) {
try {
long s= (long)score<<40;
long sort = s+(0xFFFFFFFFFFL-(int)(System.currentTimeMillis()/1000));
redisTemplate.opsForZSet().add(key, uid, sort);
redisTemplate.opsForZSet().add(key, value, sort);
return;
} catch (Exception e) {
TimeUtils.sleep(FAILED_SLEEP);
@ -795,6 +795,18 @@ public class RedisUtil {
return null;
}
public Set<ZSetOperations.TypedTuple<String>> getZsetRangeWithScores(String type,String key, long start, long end){
String rkey = getKey(type, key);
for (int i = 0; i < MAX_TRY_TIMES; i++) {
try {
return redisTemplate.opsForZSet().rangeWithScores(rkey, start, end);
} catch (Exception e) {
TimeUtils.sleep(FAILED_SLEEP);
}
}
return null;
}
public Long getZSetreverseRank(String type,String key, String value){
String rkey = getKey(type,key);

View File

@ -27,8 +27,8 @@ public enum ErrorCode implements IErrorCode {
RELOGIN_CODE(-101, "重复登陆"),
KICK_USER_CODE(-102, "踢用户下线"),
SERVER_SELF_DEFINE(-1, "操作失败"),
SERVER_DEFINE(-1, "操作失败"),
CFG_NULL(-1, "配置不存在"),
UNKNOWN(0, "正在紧急修复中,请稍后再试"),
NAME_USE(1, "该名字已被使用"),
@ -138,18 +138,6 @@ public enum ErrorCode implements IErrorCode {
MAP_IN(105,"在地图探索中,不可以操作"),
HERO_LIVE_AGAIN(106,"英雄{0}秒后复活"),
;
private static final Set<Integer> CodeSet = new HashSet<>();
@ -190,12 +178,7 @@ public enum ErrorCode implements IErrorCode {
return errMsg;
}
private ErrorCode reDefineMsg(String errMsg) {
this.errMsg = errMsg;
return this;
}
public static ErrorCode newDefineCode(String errMsg) {
return SERVER_SELF_DEFINE.reDefineMsg(errMsg);
public static String newDefineCode(String errMsg) {
return errMsg;
}
}

View File

@ -14,6 +14,11 @@ public class ErrorCodeException extends Exception {
this.errorCode = errorCode;
}
public ErrorCodeException(String message) {
super(message);
errorCode = ErrorCode.SERVER_DEFINE;
}
public ErrorCodeException(ErrorCode errorCode, List<String> params) {
this.errorCode = errorCode;
this.params = params;
@ -56,7 +61,7 @@ public class ErrorCodeException extends Exception {
}
public String toString() {
return "[CODE: " + this.errorCode.code() + "][" + this.errorCode.message() + "] " + super.getMessage();
return "[CODE: " + this.errorCode.code() + "][" + this.errorCode.message() + "][" +((super.getMessage()==null)?"":super.getMessage())+ "][" +((params!=null&&params.size()!=0)?params.toString():"")+"] ";
}
public List<String> getParams() {

View File

@ -57,7 +57,7 @@ public interface Global {
int RENAME_SIZE_ERROR = 10003;
int SHOW_TIPS_ERROR = 20000;
//跑马灯状态
//跑马灯状态 需要配表
int LUCKY_LUCK = 1; //吉运
int DILIGENT = 2; //勤勉
int LUCKCAT = 3; //招财猫

View File

@ -3,6 +3,8 @@ package com.ljsd.jieling.handler;
import com.google.protobuf.GeneratedMessage;
import com.google.protobuf.InvalidProtocolBufferException;
import com.google.protobuf.Parser;
import com.ljsd.jieling.exception.ErrorCode;
import com.ljsd.jieling.exception.ErrorCodeException;
import com.ljsd.jieling.exception.LogicException;
import com.ljsd.jieling.netty.cocdex.PacketNetData;
import com.ljsd.jieling.network.session.ISession;
@ -42,7 +44,7 @@ public abstract class BaseHandler<T extends GeneratedMessage> {
} catch(NoSuchFieldException|SecurityException|IllegalAccessException|IllegalArgumentException|ExceptionInInitializerError|InvalidProtocolBufferException var5){
throw new LogicException("解析协议失败",var5);
}catch (Exception var4) {
if(null !=proto)
if(null !=proto&&!(var4 instanceof ErrorCodeException))
throw new LogicException("processWithProtoException\r\nprotoID:"+netData.getMsgId()+"\r\n"+proto.toString(),var4);
}
}

View File

@ -19,6 +19,7 @@ import com.ljsd.jieling.logic.player.PlayerLogic;
import com.ljsd.jieling.netty.cocdex.PacketNetData;
import com.ljsd.jieling.network.session.ISession;
import com.ljsd.jieling.protocols.CommonProto;
import com.ljsd.jieling.protocols.FightInfoProto;
import com.ljsd.jieling.protocols.MessageTypeProto;
import com.ljsd.jieling.protocols.PlayerInfoProto;
import com.ljsd.jieling.thrift.idl.RPCMatchRequestIFace;
@ -141,6 +142,9 @@ public class GMRequestHandler extends BaseHandler{
break;
}
}
MainLevelManager mainLevelManager = cUser.getMainLevelManager();
FightInfoProto.MainLevelFightUpdateIndication build = FightInfoProto.MainLevelFightUpdateIndication.newBuilder().setState(mainLevelManager.getState()).setFightId(mainLevelManager.getFightId()).build();
MessageUtil.sendIndicationMessage(iSession,1, MessageTypeProto.MessageType.MAIN_LEVEL_FIGHT_UPDATE_INDICATION_VALUE,build,true);
break;
case GlobalGm.ADOPT_FIGHT_BY_VALUE:
int fightId = cUser.getMainLevelManager().getFightId();
@ -167,6 +171,9 @@ public class GMRequestHandler extends BaseHandler{
}
fightId = sMainLevelConfig.getNextLevel();
}
mainLevelManager = cUser.getMainLevelManager();
build = FightInfoProto.MainLevelFightUpdateIndication.newBuilder().setState(mainLevelManager.getState()).setFightId(mainLevelManager.getFightId()).build();
MessageUtil.sendIndicationMessage(iSession,1, MessageTypeProto.MessageType.MAIN_LEVEL_FIGHT_UPDATE_INDICATION_VALUE,build,true);
break;
case GlobalGm.ONE_KEY_ITEM_OR_HERO:{

View File

@ -1826,9 +1826,12 @@ public class MapLogic {
fightEndResponse.setEnventDrop(drop);
fightEndResponse.setResult(resultCode);
fightEndResponse.build();
MainLevelManager mainLevelManager = user.getMainLevelManager();
FightInfoProto.MainLevelFightUpdateIndication build = FightInfoProto.MainLevelFightUpdateIndication.newBuilder().setState(mainLevelManager.getState()).setFightId(mainLevelManager.getFightId()).build();
MessageUtil.sendIndicationMessage(session,1, MessageTypeProto.MessageType.MAIN_LEVEL_FIGHT_UPDATE_INDICATION_VALUE,build,true);
MessageUtil.sendMessage(session, 1, messageType.getNumber(), fightEndResponse.build(), true);
String rankKey = RedisKey.getKey(RedisKey.MAINLEVEL_RANK, "", false);
RedisUtil.getInstence().zsetAddOne(rankKey, String.valueOf(user.getId()), fightId);
RedisUtil.getInstence().zsetAddOne(rankKey, String.valueOf(user.getId()), sMainLevelConfig.getVirtureId());
}
public void getMainLevelRankInfo(ISession session) throws Exception {
@ -1850,7 +1853,7 @@ public class MapLogic {
.setUid(uidTmp)
.setLevel(playerInfoManager.getLevel())
.setName(playerInfoManager.getNickName())
.setFightId(score)
.setFightId(SMainLevelConfig.sMainLevelConfigByVirtureIdMap.get(score).getVirtureId())
.setHead(playerInfoManager.getHead())
.setRank(rank++)
.setTotalForce(userTmp.getPlayerInfoManager().getMaxForce())
@ -1874,6 +1877,7 @@ public class MapLogic {
int uid = session.getUid();
for(CommonProto.MainLevelRankInfo.Builder builder1 : mainLevelRankInfoList){
builder1.setRank(rank++);
builder1.setFightId(SMainLevelConfig.sMainLevelConfigByVirtureIdMap.get(builder1.getFightId()).getId());
builder.addMainLevelRankInfo(builder1.build());
if(builder1.getUid() == uid){
myRank = builder1.getRank();
@ -1887,6 +1891,7 @@ public class MapLogic {
if(myRank==-1){
myRank= RedisUtil.getInstence().getZSetreverseRank(RedisKey.MAINLEVEL_RANK,"",Integer.toString(uid)).intValue();
}
score= SMainLevelConfig.sMainLevelConfigByVirtureIdMap.get(score).getId();
}
User user = UserManager.getUser(uid);
PlayerManager playerInfoManager = user.getPlayerInfoManager();

View File

@ -227,13 +227,12 @@ public class BehaviorUtil {
.build();
heroFightInfos.add(heroFightInfo);
}
CommonProto.FightTeamInfo fightTeamInfo = CommonProto.FightTeamInfo.
return CommonProto.FightTeamInfo.
newBuilder()
.addAllFightUnitList(heroFightInfos)
.setTeamSkillList(HeroLogic.getInstance().getPokenmonSkills(user,teamId))
.setTeamPassiveList(HeroLogic.getInstance().getPokenmonPassiveSkills(user,teamId))
.build();
return fightTeamInfo;
}
public static CommonProto.FightTeamInfo getRobotFightTeamInfo(SArenaRobotConfig sArenaRobotConfig) {
@ -245,7 +244,7 @@ public class BehaviorUtil {
Integer heroTid = item.getKey();
Integer heroStar = item.getValue();
SCHero scHero = SCHero.getsCHero().get(heroTid);
List<Integer> skillIds = scHero.getSkillListByStar().get(heroStar);
List<Integer> skillIds = scHero.getSkillListByStar(heroStar);
String heroSkill = HeroLogic.getInstance().getRobotHeroSkills(skillIds,skillSb).toString();
String property = HeroLogic.getInstance().getRobotHeroProperty(sArenaRobotConfig,scHero,propertySb).toString();
CommonProto.FightUnitInfo heroFightInfo = CommonProto.FightUnitInfo
@ -257,12 +256,12 @@ public class BehaviorUtil {
heroFightInfos.add(heroFightInfo);
}
CommonProto.FightTeamInfo fightTeamInfo = CommonProto.FightTeamInfo.
return CommonProto.FightTeamInfo.
newBuilder()
.addAllFightUnitList(heroFightInfos)
.setTeamSkillList(HeroLogic.getInstance().getRobotPokenmonSkills(sArenaRobotConfig))
.build();
return fightTeamInfo;
}
/**

View File

@ -1,20 +1,66 @@
package com.ljsd.jieling.kefu;
import com.google.gson.Gson;
import com.ljsd.GameApplication;
import com.ljsd.jieling.chat.logic.ChatLogic;
import com.ljsd.jieling.chat.messge.MessageCache;
import com.ljsd.jieling.db.redis.RedisKey;
import com.ljsd.jieling.db.redis.RedisUtil;
import com.ljsd.jieling.globals.Global;
import com.ljsd.jieling.network.server.ProtocolsManager;
import com.ljsd.jieling.protocols.ChatProto;
import com.ljsd.jieling.util.CBean2Proto;
import config.SSpecialConfig;
public class Cmd_sendmsg extends GmAbstract {
@Override
public boolean exec(String[] args) throws Exception {
if (args.length != 1) {
if (args.length < 3) {
return false;
}
String content = args[0];
ChatLogic.getInstance().sendSysChatMessage(content, Global.GMMSG, 0, 0, 0, 0, 0, 0);
int speed = Integer.valueOf(args[0]);
int multime = Integer.valueOf(args[1]);
double sendTime = args.length <= 3 ? 0 : Float.valueOf(args[2]);
StringBuilder stringBuilder = new StringBuilder();
for (int i = 3; i < args.length; i++) {
if (i != 3) {
stringBuilder.append(" ");
}
stringBuilder.append(args[i]);
}
String content = stringBuilder.toString();
Gson gson = new Gson();
ChatProto.ChatInfo.Builder chatInfo = ChatProto.ChatInfo.newBuilder();
chatInfo.setItemId(0);
chatInfo.setMessageId(0);
chatInfo.setTimes(System.currentTimeMillis());
chatInfo.setMsg(content);
chatInfo.setType(0);
chatInfo.setMessageType(Global.GMMSG);
if (speed <= 0) {
chatInfo.setSpeed(SSpecialConfig.getIntegerValue(SSpecialConfig.LAMP_TEXT_SPEED));
} else {
chatInfo.setSpeed(speed);
}
if (multime <= 0) {
chatInfo.setMultiple(1);
} else {
chatInfo.setMultiple(multime);
}
if (sendTime != 0f) {
String key = RedisKey.getKey(RedisKey.SYSMSG, "", false);
RedisUtil.getInstence().zsetAddOne(key, gson.toJson(chatInfo), sendTime);
} else {
long messageId = RedisUtil.getInstence().increment(GameApplication.serverId + RedisKey.CHAT_SYS_MSG_ID + GameApplication.serverId);
chatInfo.setMessageId(messageId);
MessageCache.addSystemMsg(chatInfo.build(), messageId);
}
return true;
}
}

View File

@ -59,9 +59,6 @@ public abstract class AbstractActivity implements IActivity, IEventHandler {
/**
*
*
* @param user
* @throws Exception
*/
@Override
public void onResume(User user) throws Exception {
@ -73,8 +70,6 @@ public abstract class AbstractActivity implements IActivity, IEventHandler {
/**
*
* @param user
* @throws Exception
*/
public void reSetValue(User user) throws Exception {
ActivityManager activityManager = user.getActivityManager();
@ -143,13 +138,13 @@ public abstract class AbstractActivity implements IActivity, IEventHandler {
//up miss
int[][] reward = sActivityRewardConfig.getReward();
CommonProto.Drop.Builder drop = ItemUtil.drop(user, reward, BIReason.TAKE_ACTIVITY_REWARD);
checkAndSetProgress(activityMission, activityProgressInfo, sActivityRewardConfig, missionId);
checkAndSetProgress(activityMission, activityProgressInfo, missionId);
SGlobalActivity sGlobalActivity = SGlobalActivity.getsGlobalActivityMap().get(id);
if(null!=sGlobalActivity&&ActivityLogic.getInstance().checkActivityMissionFinishAndTaked(id,activityMission)&&sGlobalActivity.getResetGrade()==1){
if (null != sGlobalActivity && ActivityLogic.getInstance().checkActivityMissionFinishAndTaked(id, activityMission) && sGlobalActivity.getResetGrade() == 1) {
reSetValue(user);
ActivityMission newmiss = user.getActivityManager().getActivityMissionMap().get(id);
sendActivityProgress(session, newmiss,null);
}else {
sendActivityProgress(session, newmiss, null);
} else {
sendActivityProgress(session, activityMission, Collections.singleton(missionId));
}
KtEventUtils.onKtEvent(user, ParamEventBean.UserActivityEvent, id, missionId);
@ -158,32 +153,49 @@ public abstract class AbstractActivity implements IActivity, IEventHandler {
return true;
}
/**
*
*/
void takeAllReward(ISession session) throws Exception {
User user = UserManager.getUser(session.getUid());
List<Integer> misssIds = new LinkedList<>();
List<int[][]> itemArrs = new LinkedList<>();
getAllMissRewards(user, session, itemArrs);
if (itemArrs.size() == 0)
return;
SGlobalActivity sGlobalActivity = SGlobalActivity.getsGlobalActivityMap().get(id);
if (null == sGlobalActivity)
throw new ErrorCodeException(ErrorCode.ITEM_NOT_ENOUGH);
String title = SErrorCodeEerverConfig.getI18NMessage("receive_activity_title", new Object[]{sGlobalActivity.getSesc()});
String content = SErrorCodeEerverConfig.getI18NMessage("receive_activity_txt", new Object[]{sGlobalActivity.getSesc()});
String mailReward = ItemUtil.getMailReward(itemArrs);
int nowTime = (int) (TimeUtils.now() / 1000);
MailLogic.getInstance().sendMail(user.getId(), title, content, mailReward, nowTime, Global.MAIL_EFFECTIVE_TIME);
}
public void getAllMissRewards(User user, ISession session, List<int[][]> itemAttrs) throws Exception {
List<Integer> misssIds = new LinkedList<>();
List<SActivityRewardConfig> cfgs = SActivityRewardConfig.getsActivityRewardConfigByActivityId(id);
if (null == cfgs) {
return;
throw new ErrorCodeException(ErrorCode.CFG_NULL);
}
for (SActivityRewardConfig sActivityRewardConfig : cfgs) {
misssIds.add(sActivityRewardConfig.getId());
}
//check state
ActivityManager activityManager = user.getActivityManager();
ActivityMission activityMission = activityManager.getActivityMissionMap().get(id);
if (activityMission == null || activityMission.getActivityState() != ActivityType.OPEN_STATE || activityMission.getOpenType() == 0) {
return;
}
List<int[][]> itemArrs = new LinkedList<>();
boolean isTake = false;
for (Integer missionId : misssIds) {
//check cfg
SActivityRewardConfig sActivityRewardConfig = SActivityRewardConfig.getsActivityRewardConfigByMissionId(missionId);
if (sActivityRewardConfig == null || sActivityRewardConfig.getActivityId() != id) {
continue;
}
//check state
ActivityManager activityManager = user.getActivityManager();
ActivityMission activityMission = activityManager.getActivityMissionMap().get(id);
if (activityMission == null || activityMission.getActivityState() != ActivityType.OPEN_STATE || activityMission.getOpenType() == 0) {
continue;
}
ActivityProgressInfo activityProgressInfo = activityMission.getActivityProgressInfoMap().get(missionId);
if (activityProgressInfo == null || activityProgressInfo.getState() == ActivityType.HAD_TAKED) {
continue;
@ -194,22 +206,25 @@ public abstract class AbstractActivity implements IActivity, IEventHandler {
}
//up miss
int[][] reward = sActivityRewardConfig.getReward();
itemArrs.add(reward);
itemAttrs.add(reward);
isTake = true;
}
if(itemArrs.size()==0)
if (!isTake) {
return;
}
SGlobalActivity sGlobalActivity = SGlobalActivity.getsGlobalActivityMap().get(id);
if (null == sGlobalActivity)
return;
String title = SErrorCodeEerverConfig.getI18NMessage("receive_activity_title", new Object[]{sGlobalActivity.getSesc()});
String content = SErrorCodeEerverConfig.getI18NMessage("receive_activity_txt", new Object[]{sGlobalActivity.getSesc()});
String mailReward = ItemUtil.getMailReward(itemArrs);
int nowTime = (int) (TimeUtils.now() / 1000);
MailLogic.getInstance().sendMail(user.getId(), title, content, mailReward, nowTime, Global.MAIL_EFFECTIVE_TIME);
if (null != sGlobalActivity && sGlobalActivity.getResetGrade() == 1) {
reSetValue(user);
getAllMissRewards(user, session, itemAttrs);
}
}
void checkAndSetProgress(ActivityMission activityMission, ActivityProgressInfo activityProgressInfo, SActivityRewardConfig sActivityRewardConfig, int missionId) {
/**
*
*/
private void checkAndSetProgress(ActivityMission activityMission, ActivityProgressInfo activityProgressInfo, int missionId) {
activityProgressInfo.setState(ActivityType.HAD_TAKED);
activityMission.updateProgressInfo(missionId, activityProgressInfo);
}
@ -222,10 +237,7 @@ public abstract class AbstractActivity implements IActivity, IEventHandler {
boolean takeRewardsProcess(ISession session, SActivityRewardConfig sActivityRewardConfig, ActivityProgressInfo activityProgressInfo) throws Exception {
int[][] values = sActivityRewardConfig.getValues();
int missionProgress = activityProgressInfo.getProgrss();
if (missionProgress < values[0][0]) {
return false;
}
return true;
return missionProgress >= values[0][0];
}
/**
@ -235,10 +247,7 @@ public abstract class AbstractActivity implements IActivity, IEventHandler {
int[][] values = sActivityRewardConfig.getValues();
User user = UserManager.getUser(session.getUid());
int value = user.getActivityManager().getActivityMissionMap().get(sActivityRewardConfig.getActivityId()).getValue();
if (value < values[0][0]) {
return false;
}
return true;
return value >= values[0][0];
}
void onActivityEndSelfWithDealReward(User user) throws Exception {
@ -250,7 +259,7 @@ public abstract class AbstractActivity implements IActivity, IEventHandler {
/**
*
*
*/
@Override
public void onActivityEnd() throws Exception {
@ -264,7 +273,6 @@ public abstract class AbstractActivity implements IActivity, IEventHandler {
public void onActivityEndOnMySelf(User user) throws Exception {
}
/**

View File

@ -69,28 +69,11 @@ public class TreasureActivity extends AbstractActivity {
private void takeTreasureReward(ISession session, User user, int activityId, int missionId) throws Exception {
int rewardResponseValue = MessageTypeProto.MessageType.TAKE_ACTIVITY_REWARD_RESPONSE_VALUE;
ActivityMission activityMission = user.getActivityManager().getActivityMissionMap().get(activityId);
PlayerManager playerInfoManager = user.getPlayerInfoManager();
int changeState = ActivityType.HAD_TAKED;
int hadBuyTreasure = playerInfoManager.getHadBuyTreasure();
if (hadBuyTreasure == 1) {
changeState = ActivityType.FINISH_TAKED;
}
int changeState = getChangerState(user);
List<int[][]> dropList = new ArrayList<>(2);
Set<Integer> missionIds = new HashSet<>();
// Set<Integer> missionIds = new HashSet<>();
if(missionId==-1){
for(int i = 1 ; i<=user.getPlayerInfoManager().getTreasureLevel();i++){
Map<Integer, ActivityProgressInfo> progressInfoMap = activityMission.getActivityProgressInfoMap();
int state =progressInfoMap.get(i).getState();
if(state==changeState||state==ActivityType.FINISH_TAKED) {
continue;
}
missionIds.add(i);
dropByState(dropList,state,changeState,i);
ActivityProgressInfo progressInfo = new ActivityProgressInfo(0,changeState);
activityMission.updateProgressInfo(i, progressInfo);
}
getAllTreasureRewards(user,activityMission,changeState,dropList);
}else{
int state = activityMission.getActivityProgressInfoMap().get(missionId).getState();
if(state==changeState||state==ActivityType.FINISH_TAKED){
@ -99,7 +82,7 @@ public class TreasureActivity extends AbstractActivity {
dropByState(dropList,state,changeState,missionId);
ActivityProgressInfo progressInfo = new ActivityProgressInfo(0,changeState);
activityMission.updateProgressInfo(missionId, progressInfo);
missionIds.add(missionId);
// missionIds.add(missionId);
}
// sendActivityProgress(session,activityMission,missionIds);
@ -205,4 +188,31 @@ public class TreasureActivity extends AbstractActivity {
}
}
private int getChangerState(User user){
PlayerManager playerInfoManager = user.getPlayerInfoManager();
int changeState = ActivityType.HAD_TAKED;
int hadBuyTreasure = playerInfoManager.getHadBuyTreasure();
if (hadBuyTreasure == 1) {
changeState = ActivityType.FINISH_TAKED;
}
return changeState;
}
private void getAllTreasureRewards(User user,ActivityMission activityMission,int changeState,List<int[][]> dropList){
for(int i = 1 ; i<=user.getPlayerInfoManager().getTreasureLevel();i++){
Map<Integer, ActivityProgressInfo> progressInfoMap = activityMission.getActivityProgressInfoMap();
int state =progressInfoMap.get(i).getState();
if(state==changeState||state==ActivityType.FINISH_TAKED) {
continue;
}
dropByState(dropList,state,changeState,i);
ActivityProgressInfo progressInfo = new ActivityProgressInfo(0,changeState);
activityMission.updateProgressInfo(i, progressInfo);
}
}
@Override
public void getAllMissRewards(User user, ISession session, List<int[][]> itemAttrs){
getAllTreasureRewards(user, user.getActivityManager().getActivityMissionMap().get(id), getChangerState(user), itemAttrs);
}
}

View File

@ -13,9 +13,7 @@ import manager.STableManager;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class Hero extends MongoBase {
@ -30,8 +28,6 @@ public class Hero extends MongoBase {
private int star;
private List<Integer> skillList;
private Map<Integer,String> equipByPositionMap;
private Map<Integer,String> soulEquipByPositionMap;
@ -63,14 +59,9 @@ public class Hero extends MongoBase {
this.templateId = scHero.getId();
this.level = 1;
this.star = initStar;
this.skillList = new ArrayList<>();
this.equipByPositionMap = new HashMap<>();
this.soulEquipByPositionMap = new HashMap<>();
this.especialEquip = "";
List<Integer> skillIds = scHero.getSkillListByStar().get(star);
if(skillIds!=null && !skillIds.isEmpty()){
this.skillList.addAll(skillIds);
}
if(initStar!=scHero.getStar()){
Map<Integer, SCHeroRankUpConfig> scHeroRankUpConfigByType = STableManager.getFigureConfig(HeroStaticConfig.class).getScHeroRankUpConfigByShow(GlobalsDef.UP_STAR_TYPE,scHero.getStar());
@ -89,17 +80,7 @@ public class Hero extends MongoBase {
public void upStar(int upStar) throws Exception {
SCHero scHero = SCHero.getsCHero().get(templateId);
this.star += upStar;
List<Integer> skillIds = scHero.getSkillListByStar().get(star);
if(skillIds!=null && !skillIds.isEmpty()){
if(this.skillList!=null){
skillList.clear();
}else{
this.skillList = new ArrayList<>();
}
this.skillList.addAll(skillIds);
}
updateString("star",star);
updateString("skillList",skillList);
}
@ -143,10 +124,6 @@ public class Hero extends MongoBase {
return star;
}
public List<Integer> getSkillList() {
return skillList;
}
public Map<Integer, String> getEquipByPositionMap() {
return equipByPositionMap;
}

View File

@ -68,7 +68,7 @@ public class MainLevelManager extends MongoBase {
updateString("lastTime",lastTime);
}
public void afterTakeStateReward(int hadTakeTimes,boolean needReset,int lastTakes){
public void afterTakeStateReward(boolean needReset,int lastTakes){
fightStateInfo.clear();
int now = (int)(System.currentTimeMillis()/1000);
SGameSetting gameSetting = STableManager.getFigureConfig(CommonStaticConfig.class).getGameSetting();

View File

@ -127,7 +127,7 @@ public class PlayerManager extends MongoBase {
}
public void setNickName(String nickName) throws Exception {
// updateString("nickName", nickName);
updateString("nickName", nickName);
this.nickName = nickName;
}

View File

@ -170,8 +170,11 @@ public class UserMissionManager extends MongoBase {
break;
case DAILY_MISSION_REWARD:{
dailyMissionIdsType.rewardMission((int)parm[0], missionTypeEnumListMap.get(GameMisionType.DAILYMISSION));
calCumulationDataResult(user,MissionType.FINSIH_DAYILY_TIMES,missionTypeEnumListMap,(int)parm[0]);
updateString("dailyMissionIdsType",dailyMissionIdsType);
if(!missionTypeEnumListMap.get(GameMisionType.DAILYMISSION).isEmpty()){
calCumulationDataResult(user,MissionType.FINSIH_DAYILY_TIMES,missionTypeEnumListMap,(int)parm[0]);
updateString("dailyMissionIdsType",dailyMissionIdsType);
}
}
break;
case TREASURE_MISSION_REWARD:{

View File

@ -151,7 +151,21 @@ public class GuildLogic {
Collection<GuildInfo> guildInfos = GuilidManager.recommandGuild(user);
Family.FamilyRecommandResponse.Builder builder = Family.FamilyRecommandResponse.newBuilder();
Map<Integer, GuildApply> applyGuildInfos = GuilidManager.getApplyGuildInfos(uid, 1);
int now =(int)(System.currentTimeMillis()/1000);
if(applyGuildInfos.size()>0){
Iterator<Map.Entry<Integer, GuildApply>> iterator = applyGuildInfos.entrySet().iterator();
while (iterator.hasNext()){
Map.Entry<Integer, GuildApply> next = iterator.next();
GuildApply guildApply = next.getValue();
if(now - guildApply.getCreateTime() > SGuildSetting.sGuildSetting.getApplyReserve()){
GuilidManager.removeOneApplyGuildInfos(guildApply.getGuildId(),guildApply.getId());
iterator.remove();
}
}
}
for(GuildInfo guildInfo : guildInfos){
builder.addFamilyRecomandInfo(Family.FamilyRecomandInfo.newBuilder().
setFamilyBaseInfo(CBean2Proto.getFamilyBaseInfo(guildInfo))
.setIsApply(applyGuildInfos.containsKey(guildInfo.getId())?1:0)
@ -273,9 +287,6 @@ public class GuildLogic {
}
RedisUtil.getInstence().expire(RedisKey.getKey(RedisKey.FAMILY_JOIN,String.valueOf(uid),false), TimeUtils.DAY);
addGuildLog(guildInfo.getId(),GuildDef.Log.JOIN,user.getPlayerInfoManager().getNickName());
PlayerInfoCache cache = RedisUtil.getInstence().getMapEntry(RedisKey.PLAYER_INFO_CACHE, "", String.valueOf(uid), PlayerInfoCache.class);
cache.setGuildPosition(GlobalsDef.MEMBER);
RedisUtil.getInstence().putMapEntry(RedisKey.PLAYER_INFO_CACHE,"",String.valueOf(uid),cache);
Family.FamilyJoinIndicaion build = Family.FamilyJoinIndicaion.newBuilder().setFamilyBaseInfo(CBean2Proto.getFamilyBaseInfo(guildInfo)).setFamilyUserInfo(CBean2Proto.getFamilyUserInfo(user, GlobalsDef.MEMBER)).build();
Family.FamilyJoinResponse response = Family.FamilyJoinResponse.newBuilder().setFamilyJoinIndicaion(build).build();
MessageUtil.sendMessage(session,1,msgId,response,true);
@ -488,6 +499,9 @@ public class GuildLogic {
}
guildInfo.addMembers(GlobalsDef.MEMBER,applyId);
targetUser.getPlayerInfoManager().setGuildId(guildInfo.getId());
PlayerInfoCache cache = RedisUtil.getInstence().getMapEntry(RedisKey.PLAYER_INFO_CACHE, "", String.valueOf(applyId), PlayerInfoCache.class);
cache.setGuildPosition(GlobalsDef.MEMBER);
RedisUtil.getInstence().putMapEntry(RedisKey.PLAYER_INFO_CACHE,"",String.valueOf(applyId),cache);
}catch (Exception e){
LOGGER.error("the exception={}",e);
}finally {
@ -798,6 +812,7 @@ public class GuildLogic {
case 4:
title = SErrorCodeEerverConfig.getI18NMessage("family_relieved_leader_title");
content = SErrorCodeEerverConfig.getI18NMessage("family_relieved_leader_txt");
position = 3;
break;
default:
break;

View File

@ -41,7 +41,6 @@ import util.StringUtil;
import util.TimeUtils;
import java.util.*;
import java.util.concurrent.TimeUnit;
public class CombatLogic {
private static final Logger LOGGER = LoggerFactory.getLogger(CombatLogic.class);
@ -221,77 +220,17 @@ public class CombatLogic {
}
public Map<Integer,CommonProto.Drop> getNewAdventureReward(User user,boolean sendMail) throws Exception {
MainLevelManager mainLevelManager = user.getMainLevelManager();
Map<Integer, Integer> fightStateInfo = user.getMainLevelManager().getFightStateInfo();
SGameSetting gameSetting = STableManager.getFigureConfig(CommonStaticConfig.class).getGameSetting();
int adventureRefresh = gameSetting.getAdventureRefresh();
int adventureOffline = gameSetting.getAdventureOffline()*60*60/adventureRefresh;
Map<Integer, Integer> baseItemMap = new HashMap<>();
Map<Integer, Integer> baseCardMap = new HashMap<>();
Map<Integer, Integer> baseEquipMap = new HashMap<>();
Map<Integer,Integer> baseRandomMap = new HashMap<>();
Map<Integer, Integer> randomItemMap = new HashMap<>();
Map<Integer, Integer> randomCardMap = new HashMap<>();
Map<Integer, Integer> randomEquipMap = new HashMap<>();
Map<Integer,Integer> randomRandomMap = new HashMap<>();
CommonProto.Drop.Builder baseBuilder = CommonProto.Drop.newBuilder();
CommonProto.Drop.Builder randomBuilder = CommonProto.Drop.newBuilder();
int takeTimes= 0;
for(Map.Entry<Integer,Integer> fightStateInfoItem : fightStateInfo.entrySet()){
Integer fightId = fightStateInfoItem.getKey();
Integer times = fightStateInfoItem.getValue();
SMainLevelConfig sMainLevelConfig = SMainLevelConfig.config.get(fightId);
int[] randomRewardMin = sMainLevelConfig.getRandomRewardMin();
ItemUtil.combineReward(user,randomRewardMin, times,baseItemMap,baseCardMap,baseEquipMap,baseRandomMap);
int timesTemp =times;
while (timesTemp-->0){
ItemUtil.combineReward(user,sMainLevelConfig.getRandomReward(), 1f,randomItemMap,randomCardMap,randomEquipMap,randomRandomMap);
}
takeTimes+=times;
}
int fightId = mainLevelManager.getFightId();
SMainLevelConfig targetMainLevelConfig = SMainLevelConfig.config.get(fightId);
int lastTime = mainLevelManager.getLastTime();
int now = (int) (System.currentTimeMillis() / 1000);
int times = (now - lastTime)/STableManager.getFigureConfig(CommonStaticConfig.class).getGameSetting().getAdventureRefresh();
int maxTimes = adventureOffline - takeTimes;
int lastTimeTakes=0;
if(maxTimes>0){
times = times > maxTimes?maxTimes:times;
takeTimes+=times;
int[] randomRewardMin = targetMainLevelConfig.getRandomRewardMin();
ItemUtil.combineReward(user,randomRewardMin, times,baseItemMap,baseCardMap,baseEquipMap,baseRandomMap);
int timesTemp =times;
while (timesTemp-->0){
ItemUtil.combineReward(user,targetMainLevelConfig.getRandomReward(), 1f,randomItemMap,randomCardMap,randomEquipMap,randomRandomMap);
}
lastTimeTakes=times;
}
if(sendMail){
if(!baseItemMap.isEmpty()){
int vipLevel = user.getPlayerInfoManager().getVipLevel();
String title = SErrorCodeEerverConfig.getI18NMessage("adventuren_reward_of_viplevel_title");
String content = SErrorCodeEerverConfig.getI18NMessage("adventuren_reward_of_viplevel_content",new Object[]{vipLevel});
String reward = ItemUtil.getReward(baseItemMap, baseCardMap, baseEquipMap, baseRandomMap);
String randomReward = ItemUtil.getReward(randomItemMap, randomCardMap, randomEquipMap, randomRandomMap);
if(randomReward.length()!=0){
reward = reward + "|" + randomReward;
}
MailLogic.getInstance().sendMail(user.getId(),title,content,reward,now,Global.MAIL_EFFECTIVE_TIME);
}
mainLevelManager.afterTakeStateReward(takeTimes,true,0);
return null;
}
mainLevelManager.afterTakeStateReward(takeTimes,maxTimes<=0,lastTimeTakes);
ItemUtil.drop(user,baseBuilder,baseItemMap,baseCardMap,baseEquipMap,baseRandomMap,BIReason.ADVENTURE_BASE_REWARD);
ItemUtil.drop(user,randomBuilder,randomItemMap,randomCardMap,randomEquipMap,randomRandomMap,BIReason.ADVENTURE_RANDOM_REWARDD);
GetNewAdventureData getNewAdventureData = new GetNewAdventureData(user, sendMail,false).invoke();
if (getNewAdventureData.is()) return null;
CommonProto.Drop.Builder baseBuilder = getNewAdventureData.getBaseBuilder();
CommonProto.Drop.Builder randomBuilder = getNewAdventureData.getRandomBuilder();
Map<Integer, CommonProto.Drop> result = new HashMap<>(2);
result.put(1,baseBuilder.build());
result.put(2,randomBuilder.build());
user.getUserMissionManager().onGameEvent(user,GameEvent.ADVENTURE_TAKEREWARD,1);
return result;
}
private Map<Integer,CommonProto.Drop> getNewAdventureFastReward(User user,int timeDuration) throws Exception {
MainLevelManager mainLevelManager = user.getMainLevelManager();
SGameSetting gameSetting = STableManager.getFigureConfig(CommonStaticConfig.class).getGameSetting();
@ -319,10 +258,10 @@ public class CombatLogic {
}
}
int[] randomRewardMin = targetMainLevelConfig.getRandomRewardMin();
ItemUtil.combineReward(user,randomRewardMin, times,baseItemMap,baseCardMap,baseEquipMap,baseRandomMap);
ItemUtil.combineReward(user,randomRewardMin, times,baseItemMap,baseCardMap,baseEquipMap,baseRandomMap,BIReason.ADVENTURE_BASE_REWARD);
int timesTemp =times;
while (timesTemp-->0){
ItemUtil.combineReward(user,targetMainLevelConfig.getRandomReward(), 1f,randomItemMap,randomCardMap,randomEquipMap,randomRandomMap);
ItemUtil.combineReward(user,targetMainLevelConfig.getRandomReward(), 1f,randomItemMap,randomCardMap,randomEquipMap,randomRandomMap,BIReason.ADVENTURE_RANDOM_REWARDD);
}
ItemUtil.drop(user,baseBuilder,baseItemMap,baseCardMap,baseEquipMap,baseRandomMap,BIReason.ADVENTURE_BASE_REWARD);
ItemUtil.drop(user,randomBuilder,randomItemMap,randomCardMap,randomEquipMap,randomRandomMap,BIReason.ADVENTURE_RANDOM_REWARDD);
@ -907,4 +846,111 @@ public class CombatLogic {
return result;
}
public static class GetNewAdventureData {
private boolean myResult;
private User user;
private boolean sendMail;
private boolean viewBaseReward;
private CommonProto.Drop.Builder baseBuilder;
private CommonProto.Drop.Builder randomBuilder;
private String rewardStr;
public GetNewAdventureData(User user, boolean sendMail,boolean viewBaseReward) {
this.user = user;
this.sendMail = sendMail;
this.viewBaseReward = viewBaseReward;
}
public boolean is() {
return myResult;
}
public CommonProto.Drop.Builder getBaseBuilder() {
return baseBuilder;
}
public CommonProto.Drop.Builder getRandomBuilder() {
return randomBuilder;
}
public String getRewardStr() {
return rewardStr;
}
public GetNewAdventureData invoke() throws Exception {
MainLevelManager mainLevelManager = user.getMainLevelManager();
Map<Integer, Integer> fightStateInfo = user.getMainLevelManager().getFightStateInfo();
SGameSetting gameSetting = STableManager.getFigureConfig(CommonStaticConfig.class).getGameSetting();
int adventureRefresh = gameSetting.getAdventureRefresh();
int adventureOffline = gameSetting.getAdventureOffline()*60*60/adventureRefresh;
Map<Integer, Integer> baseItemMap = new HashMap<>();
Map<Integer, Integer> baseCardMap = new HashMap<>();
Map<Integer, Integer> baseEquipMap = new HashMap<>();
Map<Integer,Integer> baseRandomMap = new HashMap<>();
Map<Integer, Integer> randomItemMap = new HashMap<>();
Map<Integer, Integer> randomCardMap = new HashMap<>();
Map<Integer, Integer> randomEquipMap = new HashMap<>();
Map<Integer,Integer> randomRandomMap = new HashMap<>();
baseBuilder = CommonProto.Drop.newBuilder();
randomBuilder = CommonProto.Drop.newBuilder();
int takeTimes= 0;
for(Map.Entry<Integer,Integer> fightStateInfoItem : fightStateInfo.entrySet()){
Integer fightId = fightStateInfoItem.getKey();
Integer times = fightStateInfoItem.getValue();
SMainLevelConfig sMainLevelConfig = SMainLevelConfig.config.get(fightId);
int[] randomRewardMin = sMainLevelConfig.getRandomRewardMin();
ItemUtil.combineReward(user,randomRewardMin, times,baseItemMap,baseCardMap,baseEquipMap,baseRandomMap,BIReason.ADVENTURE_BASE_REWARD);
int timesTemp =times;
while (!viewBaseReward&&timesTemp-->0){
ItemUtil.combineReward(user,sMainLevelConfig.getRandomReward(), 1f,randomItemMap,randomCardMap,randomEquipMap,randomRandomMap,BIReason.ADVENTURE_RANDOM_REWARDD);
}
takeTimes+=times;
}
int fightId = mainLevelManager.getFightId();
SMainLevelConfig targetMainLevelConfig = SMainLevelConfig.config.get(fightId);
int lastTime = mainLevelManager.getLastTime();
int now = (int) (System.currentTimeMillis() / 1000);
int times = (now - lastTime)/STableManager.getFigureConfig(CommonStaticConfig.class).getGameSetting().getAdventureRefresh();
int maxTimes = adventureOffline - takeTimes;
int lastTimeTakes=0;
boolean reset = maxTimes<times;
if(maxTimes>0){
times = times > maxTimes?maxTimes:times;
int[] randomRewardMin = targetMainLevelConfig.getRandomRewardMin();
ItemUtil.combineReward(user,randomRewardMin, times,baseItemMap,baseCardMap,baseEquipMap,baseRandomMap,BIReason.ADVENTURE_BASE_REWARD);
int timesTemp =times;
while (!viewBaseReward&&timesTemp-->0){
ItemUtil.combineReward(user,targetMainLevelConfig.getRandomReward(), 1f,randomItemMap,randomCardMap,randomEquipMap,randomRandomMap,BIReason.ADVENTURE_RANDOM_REWARDD);
}
lastTimeTakes=times;
}
if(viewBaseReward){
myResult = true;
rewardStr = ItemUtil.getReward(baseItemMap, baseCardMap, baseEquipMap, baseRandomMap);
return this;
}
if(sendMail){
if(!baseItemMap.isEmpty()){
int vipLevel = user.getPlayerInfoManager().getVipLevel();
String title = SErrorCodeEerverConfig.getI18NMessage("adventuren_reward_of_viplevel_title");
String content = SErrorCodeEerverConfig.getI18NMessage("adventuren_reward_of_viplevel_content",new Object[]{vipLevel});
String reward = ItemUtil.getReward(baseItemMap, baseCardMap, baseEquipMap, baseRandomMap);
String randomReward = ItemUtil.getReward(randomItemMap, randomCardMap, randomEquipMap, randomRandomMap);
if(randomReward.length()!=0){
reward = reward + "|" + randomReward;
}
MailLogic.getInstance().sendMail(user.getId(),title,content,reward,now, Global.MAIL_EFFECTIVE_TIME);
}
mainLevelManager.afterTakeStateReward(true,0);
myResult = true;
return this;
}
mainLevelManager.afterTakeStateReward(reset,lastTimeTakes);
ItemUtil.drop(user,baseBuilder,baseItemMap,baseCardMap,baseEquipMap,baseRandomMap, BIReason.ADVENTURE_BASE_REWARD);
ItemUtil.drop(user,randomBuilder,randomItemMap,randomCardMap,randomEquipMap,randomRandomMap,BIReason.ADVENTURE_RANDOM_REWARDD);
myResult = false;
return this;
}
}
}

View File

@ -862,7 +862,8 @@ public class HeroLogic {
public StringBuilder getHeroSkills(User user,Hero hero, StringBuilder sb){
for (Integer skillId : hero.getSkillList()) {
SCHero tempHero = SCHero.getsCHero().get(hero.getTemplateId());
for (Integer skillId : tempHero.getSkillListByStar(hero.getStar())) {
sb.append(skillId).append(DIVISION);
}
Map<Integer, String> equipByPositionMap = hero.getEquipByPositionMap();
@ -878,7 +879,6 @@ public class HeroLogic {
sb.append(skillId).append(DIVISION);
}
}
return sb;
}
//法宝技能
String especialEquipId = hero.getEspecialEquip();
@ -888,7 +888,7 @@ public class HeroLogic {
for(int skill:sEquipTalismana.getOpenSkillRules()){
sb.append(skill).append(DIVISION);
}
SCHero tempHero = SCHero.getsCHero().get(hero.getTemplateId());
int[][] specialSkill = sEquipTalismana.getSpecialSkill();
for(int i = 0 ; i < specialSkill.length;i++){
if(tempHero.getProfession()==specialSkill[i][0]){
@ -897,6 +897,8 @@ public class HeroLogic {
}
}
return sb;
}
@ -1166,20 +1168,22 @@ public class HeroLogic {
if(!StringUtil.isEmpty(especialEquip)){
Map<String, EspecialEquip> especialEquipMap = user.getEquipManager().getEspecialEquipMap();
int equipTempId = especialEquipMap.get(especialEquip).getEquipId();
int tempStar = especialEquipMap.get(especialEquip).getStar();
Map<Integer, Map<Integer, SEquipTalismana>> equipTalismanaMap = SEquipTalismana.equipTalismanaStarMap;
SEquipTalismana equipTali = equipTalismanaMap.get(equipTempId).get(tempStar);
combinedAttribute(equipTali.getProperty(),heroAllAttribute);
//法宝职业额外加成
SCHero tempHero = SCHero.getsCHero().get(hero.getTemplateId());
int[][] specialProperty = equipTali.getSpecialProperty();
for(int i = 0 ; i < specialProperty.length;i++){
if(tempHero.getProfession()==specialProperty[i][0]){
int [][] property = new int[1][];
property[0] = new int[]{specialProperty[i][1],specialProperty[i][2]};
combinedAttribute(property, heroAllAttribute);
EspecialEquip myEspecial = especialEquipMap.get(especialEquip);
if(myEspecial!=null){
int equipTempId = myEspecial.getEquipId();
int tempStar = myEspecial.getStar();
Map<Integer, Map<Integer, SEquipTalismana>> equipTalismanaMap = SEquipTalismana.equipTalismanaStarMap;
SEquipTalismana equipTali = equipTalismanaMap.get(equipTempId).get(tempStar);
combinedAttribute(equipTali.getProperty(),heroAllAttribute);
//法宝职业额外加成
SCHero tempHero = SCHero.getsCHero().get(hero.getTemplateId());
int[][] specialProperty = equipTali.getSpecialProperty();
for(int i = 0 ; i < specialProperty.length;i++){
if(tempHero.getProfession()==specialProperty[i][0]){
int [][] property = new int[1][];
property[0] = new int[]{specialProperty[i][1],specialProperty[i][2]};
combinedAttribute(property, heroAllAttribute);
}
}
}
}
@ -1600,14 +1604,14 @@ public class HeroLogic {
int composeNum = itemNum/sItem.getUsePerCount();
SGameSetting gameSetting = STableManager.getFigureConfig(CommonStaticConfig.class).getGameSetting();
if (composeNum <= 0 || composeNum > gameSetting.getHeroCompoundLimit()){
throw new ErrorCodeException(ErrorCode.UNKNOWN);
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
}
if (hasHeroNum + composeNum > gameSetting.getHeroNumlimit()){
throw new ErrorCodeException(ErrorCode.HERO_HERO_MAX);
}
boolean result = ItemUtil.checkCost(user, sItem, itemNum,BIReason.COMPOS_HERO_CONSUME,0);
if (!result){
throw new ErrorCodeException(ErrorCode.UNKNOWN);
throw new ErrorCodeException(ErrorCode.ITEM_NOT_ENOUGH);
}
Map<Integer,Integer> randomMap = new ConcurrentHashMap<>();
randomMap.put(itemId,composeNum);
@ -1815,33 +1819,6 @@ public class HeroLogic {
return totalForce;
}
public void afterSet() {
Map<Integer, SArenaRobotConfig> integerSArenaRobotConfigMap = SArenaRobotConfig.getsArenaRobotConfigMap();
for(SArenaRobotConfig sArenaRobotConfig : integerSArenaRobotConfigMap.values()){
List<Integer> heroList = sArenaRobotConfig.getHeroList();
int heroLevel = sArenaRobotConfig.getRobotLevel();
Map<Integer,Integer> starHeroMap = new HashMap<>();
for(Integer heroTid :heroList){
int heroBreakId = calRobotStarByLevel(heroTid, heroLevel,starHeroMap);
sArenaRobotConfig.setBreakId(heroBreakId);
sArenaRobotConfig.setStarOfHeroMap(starHeroMap);
}
sArenaRobotConfig.setTotalForce(calRobotTotalForce(sArenaRobotConfig));
}
int[][] returnMaterials = STableManager.getFigureConfig(CommonStaticConfig.class).getGameSetting().getReturnMaterials();
Map<Integer, Map<Integer, SWorkShopTechnology>> sWorkTechMapByTechIdAndLevel = STableManager.getFigureConfig(CommonStaticConfig.class).getsWorkTechMapByTechIdAndLevelTmp();
for(Map<Integer, SWorkShopTechnology> item : sWorkTechMapByTechIdAndLevel.values()){
for(SWorkShopTechnology sWorkShopTechnology:item.values()){
if(sWorkShopTechnology.getWillReturn() == null){
continue;
}
calPercent(returnMaterials,sWorkShopTechnology.getWillReturn());
}
}
}
public void calPercent(int[][] otherAttriMap,Map<Integer,Integer> heroAttributeMap){
for(int[] item : otherAttriMap){
int propertyId = item[0];

View File

@ -71,7 +71,7 @@ public class ItemLogic {
int[][] costItemArr = StringUtil.parseFiledInt2(cost.toString());
boolean result = ItemUtil.itemCost(user, costItemArr,BIReason.DECOMPOSE_ITEM_CONSUME,0);
if (!result){
throw new ErrorCodeException(ErrorCode.UNKNOWN);
throw new ErrorCodeException(ErrorCode.ITEM_NOT_ENOUGH);
}
CommonProto.Drop.Builder drop = ItemUtil.drop(user, StringUtil.parseFiledInt(reward.toString()), 1, 0,BIReason.DECOMPOS_ITEM_REWARD);
sendUseAndPriceItemMessage(iSession, msgId, drop);
@ -115,7 +115,7 @@ public class ItemLogic {
int uid = iSession.getUid();
User user = UserManager.getUser(uid);
if (itemList.size() == 0 ){
throw new ErrorCodeException(ErrorCode.UNKNOWN);
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
}
int openBoxLimits = STableManager.getFigureConfig(CommonStaticConfig.class).getGameSetting().getOpenBoxLimits();
for (CommonProto.Item item :itemList){
@ -144,7 +144,7 @@ public class ItemLogic {
int[][] costItemArr = StringUtil.parseFiledInt2(cost.toString());
boolean result = ItemUtil.itemCost(user, costItemArr,BIReason.USER_ITEM,0);
if (!result){
throw new ErrorCodeException(ErrorCode.UNKNOWN);
throw new ErrorCodeException(ErrorCode.ITEM_NOT_ENOUGH);
}
CommonProto.Drop.Builder drop = ItemUtil.drop(user,StringUtil.parseFiledInt(reward.toString()),1,0,BIReason.USER_ITEM);
sendUseAndPriceItemMessage(iSession, msgId, drop);
@ -329,7 +329,7 @@ public class ItemLogic {
}
}
ItemUtil.combineReward(user, StringUtil.parseFiledInt(reward.toString()),1,baseItemMap,baseCardMap,baseEquipMap,baseRandomMap);
ItemUtil.combineReward(user, StringUtil.parseFiledInt(reward.toString()),1,baseItemMap,baseCardMap,baseEquipMap,baseRandomMap,-1);
int reson = BIReason.DECOMPOS_HERO_REWARD;
if(null!=filterItem){

View File

@ -184,7 +184,7 @@ public class MailLogic {
MailManager mailManager = user.getMailManager();
Mail mail = mailManager.getMailMap().get(mailId);
if (mail == null){
throw new ErrorCodeException(ErrorCode.UNKNOWN);
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
}
if (mail.getMailItem()==null||mail.getMailItem().isEmpty()){
mail.setState(Global.MAIL_STATE_READ);
@ -205,7 +205,7 @@ public class MailLogic {
for (String mailId : mailIdsList){
Mail mail = mailManager.getMail(mailId);
if (mail == null){
throw new ErrorCodeException(ErrorCode.UNKNOWN);
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
}
if (mailItem.length() == 0){
mailItem = new StringBuilder(mail.getMailItem());
@ -224,7 +224,7 @@ public class MailLogic {
for (String mailId : mailIdsList){
Mail mail = mailManager.getMail(mailId);
if (mail == null){
throw new ErrorCodeException(ErrorCode.UNKNOWN);
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
}
mail.setState(Global.MAIL_DRAW_ST_GOT);
mail.setMailItem("");

View File

@ -141,7 +141,7 @@ public class PlayerLogic {
RedisUtil.getInstence().set(key, String.valueOf(uid),RedisKey.REDIS_OVER_FOREVER);
}else{
if (!teamPosManager.getTeamNames().containsKey(teamPosId)){
throw new ErrorCodeException(ErrorCode.UNKNOWN);
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
}
teamPosManager.getTeamNames().put(teamPosId,name);
}

View File

@ -336,7 +336,7 @@ public class StoreLogic {
int uid = iSession.getUid();
if (itemNum < 0|| itemNum >999){
LOGGER.info("buyStoreItem==> uid={},itemNum={}",uid,itemNum);
throw new ErrorCodeException(ErrorCode.UNKNOWN);
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
}
User user = UserManager.getUser(uid);
@ -474,13 +474,13 @@ public class StoreLogic {
Map<Integer, StoreInfo> storeInfoMap = storeManager.getStoreInfoMap();
if (!storeInfoMap.containsKey(storeId)){
LOGGER.info("handRefreStore==> uid={},storeId={}",uid,storeId);
throw new ErrorCodeException(ErrorCode.UNKNOWN);
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
}
StoreInfo storeInfo = storeInfoMap.get(storeId);
SStoreTypeConfig sStoreTypeConfig = SStoreTypeConfig.getsStoreTypeConfigMap().get(storeId);
if (sStoreTypeConfig.getIfManualRefresh() != 1){
LOGGER.info("handRefreStore==> uid={},storeId={},ifManualRefresh={}",uid,storeId,sStoreTypeConfig.getIfManualRefresh());
throw new ErrorCodeException(ErrorCode.UNKNOWN);
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
}
PlayerManager playerInfoManager = user.getPlayerInfoManager();
int refreshPrivilege = sStoreTypeConfig.getRefreshPrivilege();
@ -509,7 +509,7 @@ public class StoreLogic {
Map<Integer, StoreInfo> storeInfoMap = storeManager.getStoreInfoMap();
if (!storeInfoMap.containsKey(storeId)){
LOGGER.info("handRefreStore==> uid={},storeId={}",uid,storeId);
throw new ErrorCodeException(ErrorCode.UNKNOWN);
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
}
StoreInfo storeInfo = storeInfoMap.get(storeId);
SStoreTypeConfig sStoreTypeConfig = SStoreTypeConfig.getsStoreTypeConfigMap().get(storeId);
@ -517,7 +517,7 @@ public class StoreLogic {
int time = sStoreTypeConfig.getRefreshType()[1];
if (type == 1){
LOGGER.info("automaticRefreStore==>uid={},storeid={},type={}",uid,storeId,type);
throw new ErrorCodeException(ErrorCode.UNKNOWN);
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
}
Map<Integer, Integer> itemNumMap = null;
long nowTime = System.currentTimeMillis();

View File

@ -359,14 +359,20 @@ public class ProtocolsManager implements ProtocolsAbstract {
@Override
public void offLine(GameSession gameSession) {
LOGGER.info("player offLine ...");
ISession session = (ISession) gameSession;
LOGGER.info("player offLine ..{}",session.getUid());
synchronized (session) {
if (session.getUid() == 0) {
LOGGER.error("offLine->uid={}", session.getUid());
return;
}
if(session.getOfflineType() == ErrorCode.reloginCode){
return;
}
User user = UserManager.getUserInMem(session.getUid());
if(user == null){
LOGGER.info("the uid={},not in mem",session.getUid());
return;
}
KtEventUtils.onKtEvent(user, ParamEventBean.UserLoginOutEvent,1);
@ -377,10 +383,7 @@ public class ProtocolsManager implements ProtocolsAbstract {
GameMessageHandler.allChannels.remove(session.getCtx().channel());
}
if (session.getUid() == 0) {
LOGGER.error("offLine->uid={}", session.getUid());
return;
}
GameMessageHandler.currentSessions.remove(session.getUid());
try {

View File

@ -25,6 +25,7 @@ import com.ljsd.jieling.logic.question.QuestionLogic;
import com.ljsd.jieling.logic.store.BuyGoodsLogic;
import com.ljsd.jieling.logic.store.StoreLogic;
import com.ljsd.jieling.network.server.ProtocolsManager;
import com.ljsd.jieling.util.MessageUtil;
import manager.STableManager;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -47,6 +48,7 @@ public class MinuteTask extends Thread {
LOGGER.info("online use num::"+ OnlineUserManager.sessionMap.entrySet().size());
HotfixUtil.getInstance().doWork("../conf/hotfix.json");
ActivityLogic.getInstance().checkActiviyStatus();
MessageUtil.checkAndSendMsg();
STableManager.updateTablesWithTableNames(true);
ActivityLogic.getInstance().checkSecretBoxSeason();
StoreLogic.checkGlobalStore(false);

View File

@ -4,6 +4,8 @@ import com.ljsd.jieling.logic.OnlineUserManager;
import com.ljsd.jieling.network.session.ISession;
import com.ljsd.jieling.protocols.MessageTypeProto;
import com.ljsd.jieling.util.MessageUtil;
import io.netty.channel.ChannelFutureListener;
import io.netty.channel.ChannelHandlerContext;
import util.TimeUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -40,35 +42,24 @@ public class RetrySendIndicationThread extends Thread{
long now = TimeUtils.now();
Set<Integer> removeIds = new HashSet<>();
for(ISession session : sessionMap.values()){
if(session.getCtx() == null || session.getCtx().channel() == null){
removeIds.add(session.getUid());
continue;
}
if(session.getFiveReady() == 1 && session.getFiveByteBuf()!=null){
session.putBackIndicationToMap(MessageTypeProto.MessageType.FIVE_PLAYER_REFLUSH_INDICATION_VALUE,session.getFiveByteBuf());
session.setFiveByteBuf(null);
}
ConcurrentHashMap<Integer, ISession.IndicationMsg> indexToIndication = session.getIndexToIndication();
boolean send = false;
for(ISession.IndicationMsg indicationMsg : indexToIndication.values()){
long create = indicationMsg.getCreate();
int retryTimes = indicationMsg.getRetryTimes()+1;
if(now-create>retryTimes*300){
if(session.getUid() == 20000739){
Calendar calendar = Calendar.getInstance();
int i = calendar.get(Calendar.MINUTE);
if(i%2==0 && !send){
for(Integer id : indexToIndication.keySet()){
LOGGER.info("indication id={}",id);
}
send = true;
}
}
MessageUtil.retrySendIndication(session,indicationMsg.getMsg());
indicationMsg.setRetryTimes(retryTimes);
ChannelHandlerContext localCtx = session.getCtx();
if ((localCtx != null) && (localCtx.channel() != null) && (localCtx.channel().isOpen())
&& (localCtx.channel().isActive()) && (localCtx.channel().isWritable())) {
if(session.getFiveReady() == 1 && session.getFiveByteBuf()!=null){
session.putBackIndicationToMap(MessageTypeProto.MessageType.FIVE_PLAYER_REFLUSH_INDICATION_VALUE,session.getFiveByteBuf());
session.setFiveByteBuf(null);
}
ConcurrentHashMap<Integer, ISession.IndicationMsg> indexToIndication = session.getIndexToIndication();
for(ISession.IndicationMsg indicationMsg : indexToIndication.values()){
long create = indicationMsg.getCreate();
int retryTimes = indicationMsg.getRetryTimes()+1;
if(now-create>retryTimes*300){
MessageUtil.retrySendIndication(session,indicationMsg.getMsg());
indicationMsg.setRetryTimes(retryTimes);
}
}
}else{
removeIds.add(session.getUid());
}
}
for(Integer removeId:removeIds ){

View File

@ -12,6 +12,7 @@ import com.ljsd.jieling.logic.OnlineUserManager;
import com.ljsd.jieling.logic.dao.*;
import com.ljsd.jieling.logic.dao.root.GuildInfo;
import com.ljsd.jieling.logic.dao.root.User;
import com.ljsd.jieling.logic.fight.CombatLogic;
import com.ljsd.jieling.logic.hero.HeroLogic;
import com.ljsd.jieling.protocols.*;
import config.SMainLevelConfig;
@ -99,7 +100,6 @@ public class CBean2Proto {
.setBreakId(hero.getBreakId())
.setStarBreakId(hero.getStarBreakId())
.setCreateTime(hero.getCreateTime())
.addAllSkillIdList(hero.getSkillList())
.addAllEquipIdList(equipList)
.addEspecialEquip(hero.getEspecialEquip())
.addAllSoulPos(soulPoss)
@ -234,6 +234,9 @@ public class CBean2Proto {
length++;
}
for (Integer i : sMonsterConfig.getPassiveSkillList()){
if(i==0){
continue;
}
monsterSkillList.append(i).append("#");
}
}
@ -456,7 +459,7 @@ public class CBean2Proto {
.build();
}
public static PlayerInfoProto.GetMainLevelInfoResponse getMainLevelInfoResponse( User user ){
public static PlayerInfoProto.GetMainLevelInfoResponse getMainLevelInfoResponse( User user ) throws Exception {
long nowMs = TimeUtils.now();
int now = (int)(nowMs/1000);
MainLevelManager mainLevelManager = user.getMainLevelManager();
@ -511,6 +514,10 @@ public class CBean2Proto {
if(update){
mainLevelManager.directUpdateDb();
}
CombatLogic.GetNewAdventureData getNewAdventureData = new CombatLogic.GetNewAdventureData(user, false,true).invoke();
if (!StringUtil.isEmpty(getNewAdventureData.getRewardStr())){
builder.setReward(getNewAdventureData.getRewardStr());
}
return builder.build();
}

View File

@ -273,7 +273,7 @@ public class FightDataUtil {
private static LuaValue getSkill(String skillId,String...args) {
LuaValue skill = new LuaTable();
if (skillId==null || skillId.equals("") ){
if (StringUtil.isEmpty(skillId)){
return skill;
}
SSkillLogicVo sSkillLogicVo = SSkillLogicConfig.getsSkillLogicVo(Integer.valueOf(skillId));

View File

@ -257,8 +257,27 @@ public class ItemUtil {
public static void combineReward(User user,int[] dropGroupIds,float dropRatio, Map<Integer, Integer> itemMap, Map<Integer, Integer> cardMap, Map<Integer, Integer> equipMap, Map<Integer, Integer> randomMap){
public static void combineReward(User user,int[] dropGroupIds,float dropRatio, Map<Integer, Integer> itemMap, Map<Integer, Integer> cardMap, Map<Integer, Integer> equipMap, Map<Integer, Integer> randomMap,int reason){
combineRewardDropGroup(user, dropGroupIds, dropRatio, itemMap, cardMap, equipMap, randomMap);
ItemManager itemManager = user.getItemManager();
for(Map.Entry<Integer,Integer> item : itemMap.entrySet()){
Integer itemId = item.getKey();
Integer value = item.getValue();
SItem sItem = SItem.getsItemMap().get(itemId);
int itemNums = privilegeAdd(user, 1, sItem.getItemType(), value);
Item hadItem = itemManager.getItem(itemId);
int hadNums = 0;
if(hadItem !=null){
hadNums = hadItem.getItemNum();
}
if(hadNums<sItem.getItemNumlimit()){
if(hadNums + itemNums >sItem.getItemNumlimit()){
itemMap.put(itemId,sItem.getItemNumlimit() - hadNums);
}else{
itemMap.put(itemId,itemNums);
}
}
}
}
public static void combineReward(int[][] itemArr, Map<Integer, Integer> itemMap, Map<Integer, Integer> cardMap, Map<Integer, Integer> equipMap, Map<Integer, Integer> randomMap){
@ -485,7 +504,6 @@ public class ItemUtil {
if(itemNum <= 0){
continue;
}
itemNum=privilegeAdd(user,reason,sItem.getItemType(),itemNum);
if (itemNum >= sItem.getItemNumlimit()){
itemNum = sItem.getItemNumlimit();
}
@ -493,6 +511,9 @@ public class ItemUtil {
if (item == null) {
item = itemManager.newItem(entry.getKey(), itemNum);
} else {
if(item.getItemNum()>= sItem.getItemNumlimit()){
continue;
}
if (item.getItemNum() + entry.getValue() >= sItem.getItemNumlimit()){
itemNum = sItem.getItemNumlimit() -item.getItemNum();
item.setItemNum(sItem.getItemNumlimit());
@ -1373,36 +1394,60 @@ public class ItemUtil {
public static boolean checkCardAndEquipLimit( User user ,int[][] itemArr) {
SGameSetting gameSetting = STableManager.getFigureConfig(CommonStaticConfig.class).getGameSetting();
for (int[] ints : itemArr) {
int itemId = ints[0];
SItem sItem = SItem.getsItemMap().get(itemId);
int itemType = getItemType(sItem);
if (itemType == GlobalItemType.CARD) {
int hasHeroNum = user.getHeroManager().getHeroMap().size();
if (hasHeroNum >= gameSetting.getHeroNumlimit()){
return true;
}
} else if (itemType == GlobalItemType.EQUIP) {
EquipManager equipManager = user.getEquipManager();
int hasEquipNum = equipManager.getEquipMap().size();
if (hasEquipNum >= gameSetting.getEquipNumlimit()){
return true;
}
}else if(itemType == GlobalItemType.SOUL_MARK){
int limit = SSpecialConfig.getIntegerValue(SSpecialConfig.EQUIPSIGN_LIMIT);
if (user.getEquipManager().getSoulEquipMap().size() >=limit){
return true;
}
}else if(itemType == GlobalItemType.ESPECIAL_EQUIP){
int limit = SSpecialConfig.getIntegerValue(SSpecialConfig.EquipTalismana_limit);
if (user.getEquipManager().getEspecialEquipMap().size() >=limit){
return true;
}
Map<Integer, Integer> itemTypeMap = getItemTypeMap(itemArr);
for (Map.Entry<Integer, Integer> entry : itemTypeMap.entrySet()) {
switch (entry.getKey()){
case GlobalItemType.CARD:
int hasHeroNum = user.getHeroManager().getHeroMap().size();
if (hasHeroNum+entry.getValue() >= gameSetting.getHeroNumlimit()){
return true;
}
break;
case GlobalItemType.EQUIP:
EquipManager equipManager = user.getEquipManager();
int hasEquipNum = equipManager.getEquipMap().size();
if (hasEquipNum +entry.getValue()>= gameSetting.getEquipNumlimit()){
return true;
}
break;
case GlobalItemType.SOUL_MARK:
int soulLimit = SSpecialConfig.getIntegerValue(SSpecialConfig.EQUIPSIGN_LIMIT);
if (user.getEquipManager().getSoulEquipMap().size()+entry.getValue()>=soulLimit){
return true;
}
break;
case GlobalItemType.ESPECIAL_EQUIP:
int especialLimit = SSpecialConfig.getIntegerValue(SSpecialConfig.EquipTalismana_limit);
if (user.getEquipManager().getEspecialEquipMap().size()+entry.getValue() >=especialLimit){
return true;
}
break;
default:
break;
}
}
return false;
}
/**
* map
* @param itemArr
* @return
*/
public static Map<Integer,Integer> getItemTypeMap(int[][] itemArr){
Map<Integer,Integer> itemTypeMap = new HashMap<>();
for (int[] ints : itemArr) {
int itemId = ints[0];
SItem sItem = SItem.getsItemMap().get(itemId);
int itemType = getItemType(sItem);
if(itemTypeMap.containsKey(itemType)){
itemTypeMap.put(itemType,itemTypeMap.get(itemType)+ints[1]);
}else{
itemTypeMap.put(itemType,ints[1]);
}
}
return itemTypeMap;
}
//特权加成收益计算
public static int privilegeAdd(User user,int reason,int itemType,int sourceNum){

View File

@ -1,9 +1,14 @@
package com.ljsd.jieling.util;
import com.google.gson.Gson;
import com.google.protobuf.GeneratedMessage;
import com.ljsd.GameApplication;
import com.ljsd.jieling.chat.messge.MessageCache;
import com.ljsd.jieling.core.GlobalsDef;
import com.ljsd.jieling.core.HandlerLogicThread;
import com.ljsd.jieling.core.SimpleTransaction;
import com.ljsd.jieling.db.redis.RedisKey;
import com.ljsd.jieling.db.redis.RedisUtil;
import com.ljsd.jieling.exception.ErrorCodeException;
import com.ljsd.jieling.exception.ErrorUtil;
import com.ljsd.jieling.globals.Global;
@ -17,6 +22,7 @@ import com.ljsd.jieling.protocols.*;
import config.SErrorCodeEerverConfig;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.data.redis.core.ZSetOperations;
import java.util.ArrayList;
import java.util.Arrays;
@ -347,4 +353,30 @@ public class MessageUtil {
*/
List<T> combine(List<T> list);
}
public static void checkAndSendMsg(){
Set<ZSetOperations.TypedTuple<String>> adventureBossRankInfo= RedisUtil.getInstence().getZsetRangeWithScores(RedisKey.SYSMSG, "",0,-1);
int rank = 0;
long current = System.currentTimeMillis();
for(ZSetOperations.TypedTuple<String> item : adventureBossRankInfo){
if(item.getScore()<=current){
try {
long messageId = RedisUtil.getInstence().increment(GameApplication.serverId + RedisKey.CHAT_SYS_MSG_ID+ GameApplication.serverId);
ChatProto.ChatInfo.Builder builder= new Gson().fromJson(item.getValue(),ChatProto.ChatInfo.Builder.class);
builder.setMessageId(messageId);
MessageCache.addSystemMsg(builder.build(),messageId);
}catch (Exception e){
LOGGER.error(e+"");
return;
}
rank++;
}else {
return;
}
}
if(rank>0){
String key = RedisKey.getKey(RedisKey.SYSMSG, "", false);
RedisUtil.getInstence().removeZSetRangeByRank(key, 0, rank);
}
}
}

View File

@ -104,8 +104,8 @@ public class SCHero implements BaseConfig{
}
Map<Integer, Map<Integer, ConsumeMaterialInfo>> consumeMaterialInfoByStarTmp = new HashMap<>();
int[][] openSkillRules = scHero.getOpenSkillRules();
Map<Integer, List<Integer>> skillListByStarTmp = new HashMap<>();
scHero.setSkillListByStar(skillListByStarTmp);
int[][] rankupConsumeMaterial = scHero.getRankupConsumeMaterial();
for(int j=0;j<rankupConsumeMaterial.length;j++){
@ -121,24 +121,32 @@ public class SCHero implements BaseConfig{
}
scHero.setConsumeMaterialInfoOfPositionByStar(consumeMaterialInfoByStarTmp);
Map<Integer, List<Integer>> skillTmp = new HashMap<>();
for(int i=0;i<openSkillRules.length;i++){
int[] openSkillRule = openSkillRules[i];
int star = openSkillRule[0];
int skillId = openSkillRule[1];
if(!skillListByStarTmp.containsKey(star)){
skillListByStarTmp.put(star,new ArrayList<>());
if(!skillTmp.containsKey(star)){
skillTmp.put(star,new ArrayList<>());
}
skillTmp.get(star).add(skillId);
}
for(List<Integer> items : skillTmp.values()){
if(items.size() <2){
items.add(0);
}
skillListByStarTmp.get(star).add(skillId);
}
for(int[] openSkillRule : scHero.getOpenPassiveSkillRules()){
int star = openSkillRule[0];
int skillId = openSkillRule[1];
if(!skillListByStarTmp.containsKey(star)){
skillListByStarTmp.put(star,new ArrayList<>());
if(!skillTmp.containsKey(star)){
skillTmp.put(star,new ArrayList<>());
}
skillListByStarTmp.get(star).add(skillId);
skillTmp.get(star).add(skillId);
}
scHero.setSkillListByStar(skillTmp);
}
sCHero = integerSCHeroMap;
@ -217,14 +225,6 @@ public class SCHero implements BaseConfig{
return star;
}
public void setSkillListByStar(Map<Integer, List<Integer>> skillListByStar) {
this.skillListByStar = skillListByStar;
}
public Map<Integer, List<Integer>> getSkillListByStar() {
return skillListByStar;
}
public int[][] getSecondaryFactor() {
return secondaryFactor;
}
@ -252,4 +252,12 @@ public class SCHero implements BaseConfig{
public int[][] getOpenPassiveSkillRules() {
return openPassiveSkillRules;
}
public List<Integer> getSkillListByStar(int star) {
return skillListByStar.get(star);
}
public void setSkillListByStar(Map<Integer, List<Integer>> skillListByStar) {
this.skillListByStar = skillListByStar;
}
}

View File

@ -34,14 +34,14 @@ public class SDifferDemonsComonpentsConfig implements BaseConfig {
for(SDifferDemonsComonpentsConfig sDifferDemonsComonpentsConfig : config.values()){
int comonpentsId = sDifferDemonsComonpentsConfig.getComonpentsId();
int stage = sDifferDemonsComonpentsConfig.getStage();
if(!sDifferDemonsComonpentsConfigTmp.containsKey(comonpentsId)){
sDifferDemonsComonpentsConfigTmp.put(comonpentsId,new HashMap<>());
extraAddMapTmp.put(comonpentsId,new HashMap<>());
}
int[][] extraAdd = sDifferDemonsComonpentsConfig.getExtraAdd();
Map<Integer, Map<Integer, Integer>> extraMapTmpInfo = extraAddMapTmp.get(comonpentsId);
HashMap<Integer, Map<Integer, Integer>> extraCopyMapHashMap = new HashMap<>(extraMapTmpInfo);
if(extraAdd!=null&&extraAdd.length>0){
Map<Integer, Map<Integer, Integer>> extraMapTmpInfo = extraAddMapTmp.get(comonpentsId);
for(int [] extraItem : extraAdd){
int profession = extraItem[0];
int propertyId = extraItem[1];
@ -49,10 +49,18 @@ public class SDifferDemonsComonpentsConfig implements BaseConfig {
if(!extraMapTmpInfo.containsKey(profession)){
extraMapTmpInfo.put(profession,new HashMap<>());
}
if(extraMapTmpInfo.get(profession).containsKey(propertyId)){
propertyValue+=extraMapTmpInfo.get(profession).get(propertyId);
}
extraCopyMapHashMap.put(profession,new HashMap<>());
extraMapTmpInfo.put(profession,new HashMap<>());
extraCopyMapHashMap.get(profession).put(propertyId,propertyValue);
extraMapTmpInfo.get(profession).put(propertyId,propertyValue);
}
sDifferDemonsComonpentsConfig.setExtraAddMap(new HashMap<>(extraMapTmpInfo));
}
sDifferDemonsComonpentsConfig.setExtraAddMap(extraCopyMapHashMap);
sDifferDemonsComonpentsConfigTmp.get(comonpentsId).put(stage,sDifferDemonsComonpentsConfig);
}

View File

@ -3,6 +3,7 @@ package config;
import manager.STableManager;
import manager.Table;
import java.util.HashMap;
import java.util.Map;
@Table(name ="MainLevelConfig")
@ -41,15 +42,19 @@ public class SMainLevelConfig implements BaseConfig {
private int virtureId; //虚拟id关卡是自增的。
public static Map<Integer, SMainLevelConfig> config;
public static Map<Integer, SMainLevelConfig> sMainLevelConfigByVirtureIdMap;
@Override
public void init() throws Exception {
Map<Integer, SMainLevelConfig> configTmp = STableManager.getConfig(SMainLevelConfig.class);
Map<Integer, SMainLevelConfig> SMainLevelConfigByVirtureIdMapTmp =new HashMap<>();
for(SMainLevelConfig sMainLevelConfig : configTmp.values()){
int id = sMainLevelConfig.getId();
sMainLevelConfig.setVirtureId(10_000_000*(id%10) + id);
SMainLevelConfigByVirtureIdMapTmp.put(sMainLevelConfig.getVirtureId(),sMainLevelConfig);
}
config=configTmp;
sMainLevelConfigByVirtureIdMap=SMainLevelConfigByVirtureIdMapTmp;
}

View File

@ -367,7 +367,7 @@ public class ExcelUtils {
//判断cell类型
switch (cell.getCellType()) {
case Cell.CELL_TYPE_NUMERIC: {
if (cellType != null && cellType.toString().equals("float")){
if (cellType != null && cellType.toString().contains("float")){
cellValue = cell.getNumericCellValue();
}else{
cellValue = (int) cell.getNumericCellValue();