Merge branch 'master_test_hw' into master_test_hw_sub

# Conflicts:
#	serverlogic/src/main/java/com/ljsd/jieling/globals/BIReason.java
back_recharge
zhangshanxue 2020-11-06 16:24:38 +08:00
commit cd8fd29036
34 changed files with 628 additions and 171 deletions

View File

@ -2271,8 +2271,16 @@ local effectList = {
BattleUtil.FinalDamage(skill, caster, target, damage, nil, 0, nil, true)
end)
end,
--瞬间恢复[a]*[b]%生命
--a[属性],b[float]
[119] = function(caster, target, args, interval, skill)
local pro1 = args[1]
local f1 = args[2]
BattleLogic.WaitForTrigger(interval, function ()
local val = floor(BattleUtil.FP_Mul(target:GetRoleData(BattlePropList[pro1]), f1))
BattleUtil.CalTreat(caster, target, val)
end)
end,
}

View File

@ -42,7 +42,7 @@ function EffectCaster:DoEffect(caster, target, eff, duration, skill)
e.args[i] = eff.args[i]
end
-- 检测被动技能对技能参数的影响
-- 检测被动技能对技能参数的影响
local function _PassiveCheck(pe)
if pe then
e = pe
@ -60,7 +60,7 @@ end
function EffectCaster:takeEffect(caster, target, effects, effectIndex, duration, skill)
for k=1, #effects do
-- 如果不是第一个效果对列的第一个效果则判断是否命中
-- 如果不是第一个效果对列的第一个效果则判断是否命中
if k ~= 1 and effectIndex == 1 then
if self:CheckTargetIsHit(target) then
self:DoEffect(caster, target, effects[k], duration, skill)
@ -76,25 +76,25 @@ function EffectCaster:ChooseTarget()
--
self.effectTargets = {}
self.targetIsHit = {}
-- 先计算出技能的目标
-- 先计算出技能的目标
for i=1, #self.effectList do
-- 是否重新选择目标
-- 是否重新选择目标
local isReTarget = true
if self.targets and self.targets[i] then
self.effectTargets[i] = self.targets[i]
-- 判断是否有有效目标
-- 判断是否有有效目标
for _, role in ipairs(self.effectTargets[i]) do
if not role:IsRealDead() then
isReTarget = false
end
end
end
-- 重新选择目标
-- 重新选择目标
if isReTarget then
local effectGroup = self.effectList[i]
local chooseId = effectGroup.chooseId
self.effectTargets[i] = BattleUtil.ChooseTarget(self.skill.owner, chooseId)
-- 检测被动对攻击目标的影响
-- 检测被动对攻击目标的影响
if i == 1 then
local function _PassiveTarget(targets)
self.effectTargets[i] = targets
@ -105,19 +105,19 @@ function EffectCaster:ChooseTarget()
end
end
-- 释放技能
-- func 技能释放完成回调
-- 释放技能
-- func 技能释放完成回调
function EffectCaster:Cast()
-- 选择目标
-- 选择目标
self:ChooseTarget()
-- 对目标造成相应的效果
-- 对目标造成相应的效果
for i=1, #self.effectList do
local effectGroup = self.effectList[i]
local chooseId = effectGroup.chooseId
local arr = self.effectTargets[i]
if arr and #arr > 0 then
-- 效果延迟1帧生效
-- 效果延迟1帧生效
BattleLogic.WaitForTrigger(BattleLogic.GameDeltaTime, function()
local effects = effectGroup.effects
local weight = math.floor(chooseId % 10000 / 100)
@ -125,10 +125,10 @@ function EffectCaster:Cast()
if count == 0 then
count = #arr
end
-- 全部同时生效
-- 全部同时生效
for j=1, count do
if arr[j] and not arr[j]:IsRealDead() then
-- 检测是否命中
-- 检测是否命中
if i == 1 then
self.targetIsHit[arr[j]] = BattleUtil.CheckIsHit(self.skill.owner, arr[j])
end
@ -140,7 +140,7 @@ function EffectCaster:Cast()
end
end
-- 遍历技能命中目标
-- 遍历技能命中目标
function EffectCaster:ForeachTargets(func)
local targets = self:GetDirectTargets()
for _, role in ipairs(targets) do
@ -150,7 +150,7 @@ function EffectCaster:ForeachTargets(func)
end
end
-- 获取直接选择目标Id
-- 获取直接选择目标Id
function EffectCaster:GetDirectChooseId()
local effectGroup = self.effectList[1]
local chooseId = effectGroup.chooseId
@ -158,12 +158,12 @@ function EffectCaster:GetDirectChooseId()
end
-- 获取技能的直接目标,和策划规定第一个效果的目标为直接效果目标,(包含miss的目标)
-- 获取技能的直接目标,和策划规定第一个效果的目标为直接效果目标,(包含miss的目标)
function EffectCaster:GetDirectTargets()
return self.effectTargets[1]
end
-- 获取直接目标不包含miss的目标可能为空
-- 获取直接目标不包含miss的目标可能为空
function EffectCaster:GetDirectTargetsNoMiss()
local list = {}
for _, role in ipairs(self.effectTargets[1]) do
@ -174,7 +174,7 @@ function EffectCaster:GetDirectTargetsNoMiss()
return list
end
-- 获取技能目标最大人数
-- 获取技能目标最大人数
function EffectCaster:GetMaxTargetNum()
local mainEffect = self.effectList[1]
if not mainEffect then
@ -183,7 +183,7 @@ function EffectCaster:GetMaxTargetNum()
return BattleUtil.GetMaxTargetNum(mainEffect.chooseId)
end
-- 判断是否命中
-- 判断是否命中
function EffectCaster:CheckTargetIsHit(role)
return self.targetIsHit[role]
end

View File

@ -54,8 +54,8 @@ local passivityList = {
local OnSkillCast = function(skill)
BattleUtil.RandomAction(f1, function ()
local duration = 0
for i=1, skill.effectCaster.effectList.size do
duration = max(duration, skill.effectCaster.effectList.buffer[i].duration)
for i=1, #skill.effectCaster.effectList do
duration = max(duration, skill.effectCaster.effectList[i].duration)
end
role:AddPropertyTransfer(BattlePropList[pro1], f2, BattlePropList[pro2], 2, duration + BattleLogic.GameDeltaTime * 2)
end)
@ -3554,7 +3554,7 @@ local passivityList = {
local i1 = args[1]
local onSkillCastEnd = function(skill)
local effectGroup = skill.effectCaster.effectList.buffer[1]
local effectGroup = skill.effectCaster.effectList[1]
local chooseId = effectGroup.chooseId
local chooseLimit = floor(chooseId / 10000) % 10
if chooseLimit == 3 then -- 打纵列

View File

@ -215,6 +215,8 @@ function BattleLogic.TurnRound(debugTurn)
-- 上一轮结束
BattleLogic.Event:DispatchEvent(BattleEventName.BattleRoundEnd, CurRound)
end
-- 检测一次灵兽技能
SkillManager.CheckMonsterSkill(function()
CurRound = CurRound + 1
CurCamp = BattleLogic.FirstCamp -- 判断先手阵营
CurSkillPos[0] = 0
@ -228,17 +230,29 @@ function BattleLogic.TurnRound(debugTurn)
BattleLogic.Event:DispatchEvent(BattleEventName.BattleRoundChange, CurRound)
-- 开始
BattleLogic.Event:DispatchEvent(BattleEventName.BattleRoundStart, CurRound)
-- 检测一次灵兽技能
SkillManager.CheckMonsterSkill(function()
--轮数变化后延时0.2秒用于初始化监听回合数被动的初始化
BattleLogic.WaitForTrigger(0.2,function()
-- 进入新轮
BattleLogic.CheckBattleLogic()
end)
end)
end)
else
-- 检测一次灵兽技能
SkillManager.CheckMonsterSkill(function()
--轮数变化后延时0.2秒用于初始化监听回合数被动的初始化
BattleLogic.WaitForTrigger(0.2,function()
-- 切换阵营
CurCamp = (CurCamp + 1) % 2
BattleLogic.CheckBattleLogic()
end)
end)
end
end
--检测战斗逻辑

View File

@ -36,7 +36,7 @@ local _ConditionConfig = {
local conId = condition[1]
local comType = condition[2]
local comValue = condition[3]
local rand = condition[3]
local rand = condition[4]
-- 获取当前回合
local curRound = BattleLogic.GetCurRound()
local isRoundOk = BattleUtil.CompareValue(curRound, comValue, comType)

View File

@ -74,7 +74,7 @@ local _TriggerConfig = {
end
},
[10] = {--10回合开始前
event = BattleEventName.BattleRoundEnd,
event = BattleEventName.BattleRoundStart,
triggerFunc = function(skill, ...)
return true
end
@ -104,6 +104,8 @@ end
function this.InitListener()
for triggerId, config in pairs(_TriggerConfig) do
BattleLogic.Event:AddEvent(config.event, function(...)
-- 用于排序
local sortList = {}
-- 判断是否有需要触发的技能
local triggerSkill = this.TriggerList[triggerId]
if not triggerSkill then
@ -118,12 +120,26 @@ function this.InitListener()
if config.triggerFunc(skill, ... ) then
-- 检测是否符合子条件
if MCondition.CheckCondition(skill, condition) then
-- 加入技能释放对列
-- 加入技能排序对列
table.insert(sortList, skill)
end
end
end
end
-- 对技能进行排序
table.sort(sortList, function(a, b)
-- 同阵营按位置排序
if a.owner.camp == b.owner.camp then
return a.owner.position < b.owner.position
else
-- 不同阵营的根据先手阵营排序
return a.owner.camp == BattleLogic.FirstCamp
end
end)
-- 依次加入技能管理
for _, skill in ipairs(sortList) do
SkillManager.AddMonsterSkill(skill)
end
end
end
end
end)
end
end

View File

@ -74,6 +74,10 @@ function this.CheckTurnRound()
if this.MonsterSkillList and #this.MonsterSkillList > 0 then
return
end
-- 检测一次灵兽技能
this.CheckMonsterSkill(this.MonsterCheckFunc)
--
if this.DeadSkillList and #this.DeadSkillList > 0 then
return
end
@ -89,6 +93,21 @@ function this.CheckTurnRound()
end
end
-- 检测是否需要等待灵兽技能
function this.CheckMonsterSkill(func)
this.MonsterCheckFunc = func
-- 判断是否可以向下执行
if not this.IsSkilling and (not this.MonsterSkillList or #this.MonsterSkillList == 0) then
--
if this.MonsterCheckFunc then
local func = this.MonsterCheckFunc
-- 置空方法放到回调之前,避免再会调中再次调用检测方法导致方法被删除
this.MonsterCheckFunc = nil
func()
end
end
end
--
function this.Update()
-- 如果正在引导战斗
@ -169,8 +188,9 @@ function this.Clear()
for _, skill in ipairs(this.SkillList) do
skill:Dispose()
skillPool:Put(skill)
end
this.MonsterSkillList = {}
this.DeadSkillList = {}
this.SkillList = {}
this.IsSkilling = false
end

View File

@ -0,0 +1,7 @@
战斗版本1.0.0
1、创建战斗版本文件
2、灵兽技能加入

View File

@ -156,7 +156,7 @@ public interface BIReason {
int SPECIAL_MONSTER_REWARD = 88;//灵兽涅槃获得
int SPECIAL_FREE_PIECE_REWARD = 89;//灵兽放生获得
int SKIN_USE_REWARD = 90;//激活皮肤获得头像
int ADVENTURE_UPLEVEL_CONSUME = 1000;//秘境升级
int SECRETBOX_CONSUME = 1001;//秘盒抽卡
@ -290,6 +290,7 @@ public interface BIReason {
int SPECIAL_FREE_PIECE_CONSUME = 1072;//灵兽放生碎片消耗
int SUB_ACTIVITY_CONSUME = 1073;//易经宝库
int SKIN_USE_CONSUME = 1073;//激活皮肤消耗
int SUB_ACTIVITY_CONSUME = 1074;//易经宝库
}

View File

@ -15,6 +15,7 @@ import com.ljsd.jieling.util.MessageUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
import util.TimeUtils;
import java.util.*;
@ -44,7 +45,19 @@ public class GetAllHerosHandler extends BaseHandler{
User user = UserManager.getUser(userId);
HeroManager heroManager = user.getHeroManager();
Map<String, Hero> heroMap = heroManager.getHeroMap();
int nowTime = TimeUtils.nowInt();
for(Hero hero : heroMap.values()){
//检测皮肤
if(hero.getSkin()!=0){
if(!heroManager.getSkinInfo().containsKey(hero.getSkin())){
hero.setSkin(0);
}else{
int skin= heroManager.getSkinInfo().get(hero.getSkin());
if(skin!=-1&&skin<nowTime){
hero.setSkin(0);
}
}
}
heroList.add(CBean2Proto.getHero(hero));
}
boolean isSendFinish = false;

View File

@ -81,10 +81,11 @@ public class GetPlayerInfoHandler extends BaseHandler{
Map<Integer, Integer> guidePoints = playerInfoManager.getGuidePoints();
Map<Integer, VipInfo> vipInfo = playerInfoManager.getVipInfo();
List<CommonProto.NewPlayerGuidePoint> list = new ArrayList<>();
SGameSetting setting = STableManager.getConfig(SGameSetting.class).get(1);
for(int[] vip:setting.getItemAdd()){
if(vip.length>3&&!vipInfo.containsKey(vip[3])){
playerInfoManager.addVipInfo(vip[3]);
Map<Integer, SPrivilegeTypeConfig> privilegeTypeConfigMap = SPrivilegeTypeConfig.getsPrivilegeTypeConfigMap();
for(Map.Entry<Integer, SPrivilegeTypeConfig> entry:privilegeTypeConfigMap.entrySet()){
//如果是<4 系统内置特权
if(entry.getValue().getUnlockType()<4&&!vipInfo.containsKey(entry.getKey())){
playerInfoManager.addVipInfo(entry.getKey());
}
}
List<CommonProto.Privilege> privilegeList = new ArrayList<>();
@ -157,6 +158,7 @@ public class GetPlayerInfoHandler extends BaseHandler{
List<CommonProto.GiftGoodsInfo> goodsBagInfo = new ArrayList<>(SRechargeCommodityConfig.rechargeCommodityConfigMap.size());
BuyGoodsLogic.getGoodsBagInfo(userId,goodsBagInfo,true);
int vipPrivilageValue = user.getPlayerInfoManager().getVipPrivilageValue(SMazeTreasureSetting.sMazeTreasureSetting.getRefreshVIP());
SGameSetting setting = STableManager.getConfig(SGameSetting.class).get(1);
if(setting.getBornItem().length>0){
Map<Integer, Integer> map = ItemUtil.arrayToMap(setting.getBornItem());
Set<Integer> remove = new HashSet<>(map.keySet());

View File

@ -0,0 +1,26 @@
package com.ljsd.jieling.handler.hero;
import com.ljsd.jieling.handler.BaseHandler;
import com.ljsd.jieling.logic.hero.HeroLogic;
import com.ljsd.jieling.network.session.ISession;
import com.ljsd.jieling.protocols.HeroInfoProto;
import com.ljsd.jieling.protocols.MessageTypeProto;
import org.springframework.stereotype.Component;
/**
* @author lvxinran
* @date 2020/10/31
* @discribe
*/
@Component
public class ChangeHeroSkinHandler extends BaseHandler<HeroInfoProto.ChangeSkinRequest> {
@Override
public MessageTypeProto.MessageType getMessageCode() {
return MessageTypeProto.MessageType.HERO_SKIN_CHANGE_REQUEST;
}
@Override
public void processWithProto(ISession iSession, HeroInfoProto.ChangeSkinRequest proto) throws Exception {
HeroLogic.getInstance().changeSkin(iSession,proto.getHeroId(),proto.getSkinId(), MessageTypeProto.MessageType.HERO_SKIN_CHANGE_RESPONSE);
}
}

View File

@ -0,0 +1,26 @@
package com.ljsd.jieling.handler.hero;
import com.ljsd.jieling.handler.BaseHandler;
import com.ljsd.jieling.logic.hero.HeroLogic;
import com.ljsd.jieling.netty.cocdex.PacketNetData;
import com.ljsd.jieling.network.session.ISession;
import com.ljsd.jieling.protocols.MessageTypeProto;
import org.springframework.stereotype.Component;
/**
* @author lvxinran
* @date 2020/10/31
* @discribe
*/
@Component
public class GetAllSkinHandler extends BaseHandler {
@Override
public MessageTypeProto.MessageType getMessageCode() {
return MessageTypeProto.MessageType.HERO_SKIN_GET_ALL_REQUEST;
}
@Override
public void process(ISession iSession, PacketNetData netData) throws Exception {
HeroLogic.getInstance().getAllSkin(iSession,MessageTypeProto.MessageType.HERO_SKIN_GET_ALL_RESPONSE);
}
}

View File

@ -3220,7 +3220,14 @@ public class MapLogic {
for(String id:heroIds){
Hero hero = heroManager.getHero(id);
String heroSkill = HeroLogic.getInstance().getHeroSkills(user,hero,new StringBuilder()).toString();
TrailHero trailHero = new TrailHero(hero.getTemplateId(),HeroLogic.getInstance().calHeroNotBufferAttribute(user,hero,false,0),hero.getStar(),heroSkill,hero.getLevel());
int skinTime = heroManager.getSkinInfo().getOrDefault(hero.getSkin(), 0);
int skinId = hero.getSkin();
if(skinTime!=-1&&skinTime<TimeUtils.nowInt()){
skinId = 0;
skinTime = 0;
}
TrailHero trailHero = new TrailHero(hero.getTemplateId(),HeroLogic.getInstance().calHeroNotBufferAttribute(user,hero,false,0),hero.getStar(),heroSkill,hero.getLevel(),skinId,skinTime);
heroInfo.put(id,trailHero);
}
mapManager.updateTrailHeroInfo(heroInfo);

View File

@ -19,6 +19,10 @@ public class TrailHero {
private int level;
private int skinId;
private int skinTime;
public int getTmpId() {
return tmpId;
}
@ -43,12 +47,22 @@ public class TrailHero {
this.star = star;
}
public TrailHero(int tmpId, Map<Integer, Integer> property, int star,String heroSkills,int level) {
public TrailHero(int tmpId, Map<Integer, Integer> property, int star,String heroSkills,int level,int skinId,int skinTime) {
this.tmpId = tmpId;
this.property = property;
this.star = star;
this.heroSkills = heroSkills;
this.level = level;
this.skinId = skinId;
this.skinTime = skinTime;
}
public int getSkinId() {
return skinId;
}
public int getSkinTime() {
return skinTime;
}
public String getHeroSkills() {

View File

@ -30,6 +30,7 @@ import com.ljsd.jieling.util.MessageUtil;
import com.ljsd.jieling.util.MonsterUtil;
import config.SArenaRobotConfig;
import config.SCHero;
import jdk.nashorn.internal.ir.debug.ObjectSizeCalculator;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import util.TimeUtils;
@ -241,6 +242,7 @@ public class BehaviorUtil {
.setProperty(property.substring(0, property.length()-1))
.setPosition(teamPosHeroInfo.getPosition())
.setStar(hero.getStar())
.setSkinId(hero.getSkin())
.build();
heroFightInfos.add(heroFightInfo);
}

View File

@ -105,6 +105,7 @@ public class TowerMap extends AbstractMap {
.setHeroHp(calHp)
.setStar(trailHero.getStar())
.setLevel(trailHero.getLevel())
.setSkinId(trailHero.getSkinId())
.build();
mapEnterResponse.addInfos(info);
}

View File

@ -120,6 +120,7 @@ public class ReportUtil {
} catch (Exception e) {
//异常处理
e.printStackTrace();
System.out.println(reportUserEvent.getBaseInfo().toString());
System.out.println("except:"+e);
}
}

View File

@ -98,10 +98,10 @@ public class BloodLogic {
* @param heroInfo
* @return
*/
public CommonProto.FightTeamInfo fightDataMakeUp(Map<String ,String> heroSkills ,Map<String, FamilyHeroInfo> heroInfo,String pokmanSkill,String passiveSkill){
return fightDataMakeUp(heroSkills, heroInfo, pokmanSkill, passiveSkill,null);
public CommonProto.FightTeamInfo fightDataMakeUp(Map<String ,String> heroSkills ,Map<String, FamilyHeroInfo> heroInfo,String pokmanSkill,String passiveSkill,int uid) throws Exception {
return fightDataMakeUp(heroSkills, heroInfo, pokmanSkill, passiveSkill,null,uid);
}
public CommonProto.FightTeamInfo fightDataMakeUp(Map<String ,String> heroSkills ,Map<String, FamilyHeroInfo> heroInfo,String pokmanSkill,String passiveSkill,Map<String,Double> remainHp){
public CommonProto.FightTeamInfo fightDataMakeUp(Map<String ,String> heroSkills ,Map<String, FamilyHeroInfo> heroInfo,String pokmanSkill,String passiveSkill,Map<String,Double> remainHp,int uid) throws Exception {
List<CommonProto.FightUnitInfo> heroDefendFightInfos = new ArrayList<>();
int index=0;
for (Map.Entry<String, FamilyHeroInfo> entry : heroInfo.entrySet()) {
@ -123,10 +123,15 @@ public class BloodLogic {
.build();
heroDefendFightInfos.add(heroFightInfo);
}
List<CommonProto.FightUnitInfo> pokemonSkills = new ArrayList<>();
User user = UserManager.getUser(uid, true);
if(user!=null&&!user.getPokemonManager().getPokemonTeamMap().isEmpty()){
pokemonSkills = HeroLogic.getInstance().getPokemonSkills(UserManager.getUser(uid));
}
return CommonProto.FightTeamInfo.
newBuilder()
.addAllFightUnitList(heroDefendFightInfos)
// .addAllPokemonUnitList(HeroLogic.getInstance().getPokemonSkills(user))
.addAllPokemonUnitList(pokemonSkills)
.setTeamPassiveList(passiveSkill)
.build();
}

View File

@ -647,7 +647,7 @@ public class ChampionshipLogic {
if (defMemberInfo.getType() == 0) {
FamilyFightInfo fightInfo = defMemberInfo.getFightInfo();
pvpFightEvent.setDefFightSnapData(new DefFightSnapData(fightInfo.getHeroAttribute(), fightInfo.getHeroSkills(), fightInfo.getPokenmonSkills(), fightInfo.getPassiveSkills()));
pvpFightEvent.setDefFightSnapData(new DefFightSnapData(fightInfo.getHeroAttribute(), fightInfo.getHeroSkills(), fightInfo.getPokenmonSkills(), fightInfo.getPassiveSkills(),defUid));
defForce = fightInfo.getForce();
}else {
SArenaRobotConfig sArenaRobotConfig = SArenaRobotConfig.getsArenaRobotConfigById(defUid);
@ -657,7 +657,7 @@ public class ChampionshipLogic {
}
if (attackMemberInfo.getType() == 0) {
FamilyFightInfo fightInfo = attackMemberInfo.getFightInfo();
pvpFightEvent.setAttackFightSnapData(new DefFightSnapData(fightInfo.getHeroAttribute(), fightInfo.getHeroSkills(), fightInfo.getPokenmonSkills(), fightInfo.getPassiveSkills()));
pvpFightEvent.setAttackFightSnapData(new DefFightSnapData(fightInfo.getHeroAttribute(), fightInfo.getHeroSkills(), fightInfo.getPokenmonSkills(), fightInfo.getPassiveSkills(),attackId));
minForce = fightInfo.getForce();
}else {
SArenaRobotConfig sArenaRobotConfig = SArenaRobotConfig.getsArenaRobotConfigById(attackId);

View File

@ -50,6 +50,7 @@ public class Hero extends MongoBase {
private int changeId ;
private Set<String> jewelInfo = new HashSet<>();
private int skin;
public Hero(){
//绑定关系
this.setRootCollection(User._COLLECTION_NAME);
@ -303,4 +304,14 @@ public class Hero extends MongoBase {
public int getChangeId() {
return changeId;
}
public int getSkin() {
return skin;
}
public void setSkin(int skin) {
this.skin = skin;
updateString("skin",skin);
}
}

View File

@ -21,6 +21,8 @@ public class HeroManager extends MongoBase {
private Map<Integer,Integer> heroHandBook = new HashMap<>();
private Map<Integer,Integer> skinInfo = new HashMap<>();
private int firstTenth;
@ -115,4 +117,17 @@ public class HeroManager extends MongoBase {
this.mustRandomCount = mustRandomCount;
updateString("mustRandomCount",mustRandomCount);
}
public Map<Integer, Integer> getSkinInfo() {
return skinInfo;
}
public void addSkin(int skinId,int time){
skinInfo.put(skinId,time);
updateString("skinInfo."+skinId,time);
}
public void removeSkin(int skinId){
skinInfo.remove(skinId);
removeString(getMongoKey()+"skinInfo."+skinId);
}
}

View File

@ -54,7 +54,12 @@ public class AreFightPro implements EndFightProcessor {
int warTime = STableManager.getFigureConfig(CommonStaticConfig.class).getsChampionshipSetting().getWarTime();
CommonProto.FightData build = CommonProto.FightData.newBuilder().setFightType(9).setHeroFightInfos(fightResult.getFightTeamInfo()).addMonsterList(fightResult.getDefFightTeamInfo()).setFightSeed(fightResult.getSeed()).setFightMaxTime(warTime).build();
CommonProto.FightData build = CommonProto.FightData.newBuilder()
.setFightType(9)
.setHeroFightInfos(fightResult.getFightTeamInfo())
.addMonsterList(fightResult.getDefFightTeamInfo())
.setFightSeed(fightResult.getSeed())
.setFightMaxTime(warTime).build();
arenaRecord.setFightData(build.toByteArray());
RedisUtil.getInstence().putMapEntry(RedisKey.CHAMPION_ARENA_RECORD,"",arenaRecord.getId(),arenaRecord);

View File

@ -10,7 +10,15 @@ public class DefFightSnapData {
private Map<String, String> heroSkills = new HashMap<>();
private String pokenmonSkills;
private String passiveSkills;
private int uid;
public DefFightSnapData(Map<String, FamilyHeroInfo> heroAttribute, Map<String, String> heroSkills, String pokenmonSkills, String passiveSkills, int uid) {
this.heroAttribute = heroAttribute;
this.heroSkills = heroSkills;
this.pokenmonSkills = pokenmonSkills;
this.passiveSkills = passiveSkills;
this.uid = uid;
}
public DefFightSnapData(Map<String, FamilyHeroInfo> heroAttribute, Map<String, String> heroSkills, String pokenmonSkills, String passiveSkills) {
this.heroAttribute = heroAttribute;
@ -19,6 +27,15 @@ public class DefFightSnapData {
this.passiveSkills = passiveSkills;
}
public int getUid() {
return uid;
}
public void setUid(int uid) {
this.uid = uid;
}
public Map<String, FamilyHeroInfo> getHeroAttribute() {
return heroAttribute;
}

View File

@ -24,6 +24,7 @@ import com.ljsd.jieling.util.MonsterUtil;
import config.SArenaRobotConfig;
import config.SCHero;
import org.luaj.vm2.LuaValue;
import util.TimeUtils;
import java.util.ArrayList;
import java.util.HashMap;
@ -54,12 +55,12 @@ public class FightUtil {
}
public static CommonProto.FightTeamInfo makeFightWithSnapData(DefFightSnapData defFightSnapData){
return BloodLogic.getInstance().fightDataMakeUp(defFightSnapData.getHeroSkills(),defFightSnapData.getHeroAttribute(),defFightSnapData.getPokenmonSkills(),defFightSnapData.getPassiveSkills());
public static CommonProto.FightTeamInfo makeFightWithSnapData(DefFightSnapData defFightSnapData) throws Exception {
return BloodLogic.getInstance().fightDataMakeUp(defFightSnapData.getHeroSkills(),defFightSnapData.getHeroAttribute(),defFightSnapData.getPokenmonSkills(),defFightSnapData.getPassiveSkills(),defFightSnapData.getUid());
}
public static CommonProto.FightTeamInfo makeFightBySnapDataWithDouble(DefFightSnapData defFightSnapData,Map<String, Double> attackBloodMap){
return BloodLogic.getInstance().fightDataMakeUp(defFightSnapData.getHeroSkills(),defFightSnapData.getHeroAttribute(),defFightSnapData.getPokenmonSkills(),defFightSnapData.getPassiveSkills(),attackBloodMap);
public static CommonProto.FightTeamInfo makeFightBySnapDataWithDouble(DefFightSnapData defFightSnapData,Map<String, Double> attackBloodMap) throws Exception {
return BloodLogic.getInstance().fightDataMakeUp(defFightSnapData.getHeroSkills(),defFightSnapData.getHeroAttribute(),defFightSnapData.getPokenmonSkills(),defFightSnapData.getPassiveSkills(),attackBloodMap,defFightSnapData.getUid());
}
@ -120,7 +121,7 @@ public class FightUtil {
return builder.build();
}
public static FightResult getFightForPVP(FightEvent fightEvent,int seed){
public static FightResult getFightForPVP(FightEvent fightEvent,int seed) throws Exception {
int fightSeed =seed;
PVPFightEvent pvpFightEvent = (PVPFightEvent)fightEvent;
CommonProto.FightTeamInfo fightTeamInfo = null;
@ -174,7 +175,7 @@ public class FightUtil {
return builder.build();
}
public static FightResult getFightForPVP(FightEvent fightEvent){
public static FightResult getFightForPVP(FightEvent fightEvent) throws Exception {
int fightSeed =getFightSeed();
return getFightForPVP(fightEvent,fightSeed);
}
@ -253,6 +254,7 @@ public class FightUtil {
.setProperty(property.substring(0, property.length()-1))
.setPosition(teamPosHeroInfo.getPosition())
.setStar(trailHero.getStar())
.setSkinId(trailHero.getSkinId()==0?0:(trailHero.getSkinTime()==-1||trailHero.getSkinTime()> TimeUtils.nowInt()?trailHero.getSkinId():0))
.build();
heroFightInfos.add(heroFightInfo);
}
@ -327,6 +329,7 @@ public class FightUtil {
.setUnitSkillIds(heroSkill.substring(0,heroSkill.length()-1))
.setProperty(property.substring(0, property.length()-1))
.setPosition(teamPosHeroInfo.getPosition())
.setSkinId(hero.getSkin())
.setStar(hero.getStar())
.build();
heroFightInfos.add(heroFightInfo);

View File

@ -365,6 +365,7 @@ public class HeroLogic{
case 3:
SGlobalActivity activity = SGlobalActivity.getsGlobalActivityMap().get(sLotterySetting.getActivityId());
if(activity.getType()== ActivityType.LIMIT_RANDOM_CARD){
// TIME_SUMMON(56,"Time_summon",new CommonEventHandler(),new String[]{"hero_id","summon_type","cost_item_id","cost_amount","hero_id_quality_list"}),
eventEnum = ReportEventEnum.TIME_SUMMON;
}else if (activity.getType()==ActivityType.BEAUTY_BAG){
eventEnum = ReportEventEnum.FATALITY_SUMMON;
@ -390,11 +391,14 @@ public class HeroLogic{
if (random == null) {
continue;
}
SCHero scHero = SCHero.getsCHero().get(random[0]);
if (scHero == null) {
result.add(String.valueOf(random[0]));
} else {
result.add(random[0] + "-" + scHero.getStar());
SItem item = SItem.getsItemMap().get(random[0]);
// SCHero scHero = SCHero.getsCHero().get(random[0]);
if (item == null) {
result.add(random[0] +"-id错误"+random[1]);
} else if(item.getItemType()==GlobalItemType.CARD) {
result.add(random[0] + "-" + item.getQuantity());
}else{
result.add(random[0] + "#" + random[1]);
}
}
if (costItem.length == 1) {
@ -951,7 +955,7 @@ public class HeroLogic{
if(reportConsumeHero.length()>0){
reportConsumeHero.append("|");
}
reportConsumeHero.append(hero.getTemplateId()).append("#lv.").append(hero.getLevel()).append("#star.").append(hero.getStar());
reportConsumeHero.append(hero.getTemplateId()).append("-").append(hero.getStar()).append("-").append(hero.getLevel());
if( 1 == isSame) {
@ -1031,6 +1035,7 @@ public class HeroLogic{
ChatLogic.getInstance().sendSysChatMessage(message,Global.DILIGENT,targetHero.getTemplateId(),0,0,0,0,0);
}
String consume = StringUtil.parseArrayToString(consumeMaterial);
// HERO_STRENGTHEN(13,"hero_strengthen", new CommonEventHandler(),new String[]{"hero_id","old_quality","new_quality","strengthen_type","cost_item_list","cost_hero_list"}),
ReportUtil.onReportEvent(user, ReportEventEnum.HERO_STRENGTHEN.getType(),String.valueOf(targetHero.getTemplateId()),String.valueOf(oldStar),String.valueOf(targetHero.getStar()),consume,reportConsumeHero.toString());
}
private void rankUpHeroExecute(Hero hero)throws Exception {
@ -1464,7 +1469,6 @@ public class HeroLogic{
}
combinedAttribute(pokemonAttr,heroAllAttribute);
}
//todo 灵兽
//灵兽图鉴加成
Set<Integer> pokemonBookEnabled = pokemonManager.getPokemonBookEnabled();
if(!pokemonBookEnabled.isEmpty()){
@ -1474,6 +1478,17 @@ public class HeroLogic{
combinedAttribute(activePara,heroAllAttribute);
}
}
//英雄皮肤加成 记得判断皮肤过期
int skin = hero.getSkin();
if(skin!=0){
Map<Integer, Integer> skinInfo = user.getHeroManager().getSkinInfo();
SHeroSkin sHeroSkin = SHeroSkin.skinMapByType.get(skin);
if(sHeroSkin!=null&&sHeroSkin.getMonomerProperty()!=null&&sHeroSkin.getMonomerProperty().length>0){
if(skinInfo.containsKey(skin)&&skinInfo.get(skin)>TimeUtils.nowInt()){
combinedAttribute(sHeroSkin.getMonomerProperty(),heroAllAttribute);
}
}
}
//装备总战力评分
int equipForce=0;
boolean needRemove = false;
@ -2827,6 +2842,16 @@ public class HeroLogic{
PokemonManager pokemonManager = user.getPokemonManager();
//todo 灵兽
Map<String, Pokemon> pokemonMap = pokemonManager.getPokemonMap();
Set<String> removeKey = new HashSet<>();
for(String key:pokemonMap.keySet()){
if(key.length()<=2){
removeKey.add(key);
}
}
for(String key:removeKey){
pokemonManager.removePokemon(key);
}
//
// //TODO 测试
// if(pokemonMap.isEmpty()){
@ -3230,6 +3255,61 @@ public class HeroLogic{
Poster.getPoster().dispatchEvent(new UserMainTeamForceEvent(session.getUid()));
MessageUtil.sendMessage(session,1,messageType.getNumber(),null,true);
}
/**
*
* @param session
* @param messageType
*/
public void getAllSkin(ISession session, MessageTypeProto.MessageType messageType) throws Exception {
User user = UserManager.getUser(session.getUid());
Map<Integer, Integer> skinInfo = user.getHeroManager().getSkinInfo();
HeroInfoProto.GetAllSkinResponse.Builder response = HeroInfoProto.GetAllSkinResponse.newBuilder();
Set<Integer> removeId = new HashSet<>(skinInfo.size()+1);
if(!skinInfo.isEmpty()){
for(Map.Entry<Integer,Integer> entry:skinInfo.entrySet()){
if(entry.getValue()!=-1&&entry.getValue()<TimeUtils.nowInt()){
removeId.add(entry.getKey());
}
}
if(!removeId.isEmpty()){
for(int remove :removeId){
user.getHeroManager().removeSkin(remove);
}
}
skinInfo.forEach((k,v)->response.addSkinInfo(CommonProto.SkinInfo.newBuilder().setSkinId(k).setOverTime(v).build()));
}
MessageUtil.sendMessage(session,1,messageType.getNumber(),response.build(),true);
}
/**
*
* @param session
* @param messageType
*/
public void changeSkin(ISession session,String heroId,int skinId, MessageTypeProto.MessageType messageType) throws Exception {
User user = UserManager.getUser(session.getUid());
Map<Integer, Integer> skinInfo = user.getHeroManager().getSkinInfo();
Hero hero = user.getHeroManager().getHero(heroId);
if(skinId!=0){
if(!skinInfo.containsKey(skinId)||(skinInfo.get(skinId)!=-1&&skinInfo.get(skinId)<TimeUtils.nowInt())){
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
}
if(hero==null||hero.getSkin()==skinId){
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
}
SHeroSkin sHeroSkin = SHeroSkin.skinMapByType.get(skinId);
if(sHeroSkin==null||sHeroSkin.getHeroId()!=hero.getTemplateId()){
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
}
}
hero.setSkin(skinId);
MessageUtil.sendMessage(session,1,messageType.getNumber(),null,true);
}
}

View File

@ -7,6 +7,7 @@ import com.ljsd.jieling.exception.ErrorCode;
import com.ljsd.jieling.exception.ErrorCodeException;
import com.ljsd.jieling.globals.BIReason;
import com.ljsd.jieling.globals.Global;
import com.ljsd.jieling.globals.GlobalItemType;
import com.ljsd.jieling.handler.map.MapManager;
import com.ljsd.jieling.ktbeans.ReportEventEnum;
import com.ljsd.jieling.ktbeans.ReportUtil;
@ -30,6 +31,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import util.MathUtils;
import util.StringUtil;
import util.TimeUtils;
import java.util.*;
import java.util.stream.Collectors;
@ -140,6 +142,15 @@ public class ItemLogic {
if (itemList.size() == 0 ){
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
}
if(itemList.size()==1){
CommonProto.Item item = itemList.iterator().next();
//如果是使用皮肤
if(SItem.getsItemMap().get(item.getItemId()).getItemType()== GlobalItemType.DECORATION){
useHeroSkin(iSession,user,item);
MessageUtil.sendMessage(iSession, 1,msgId, PlayerInfoProto.UseAndPriceItemResponse.newBuilder().build(), true);
return;
}
}
int openBoxLimits = STableManager.getFigureConfig(CommonStaticConfig.class).getGameSetting().getOpenBoxLimits();
for (CommonProto.Item item :itemList){
SItem sItem = SItem.getsItemMap().get(item.getItemId());
@ -176,6 +187,38 @@ public class ItemLogic {
sendUseAndPriceItemMessage(iSession, msgId, drop);
}
private void useHeroSkin(ISession session,User user,CommonProto.Item item) throws Exception {
Map<Integer, Integer> skinInfo = user.getHeroManager().getSkinInfo();
SHeroSkin sHeroSkin = STableManager.getConfig(SHeroSkin.class).get(item.getItemId());
if(sHeroSkin==null){
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
}
if(skinInfo.containsKey(sHeroSkin.getType())){
if(skinInfo.get(sHeroSkin.getType())==-1||skinInfo.get(sHeroSkin.getType())> TimeUtils.nowInt()){
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
}
}
int time;
if(sHeroSkin.getTime()==0){
time = -1;
}else{
// time =TimeUtils.nowInt()+120;
time =(int)(sHeroSkin.getTime()*TimeUtils.DAY/1000+TimeUtils.nowInt());
}
boolean use = ItemUtil.itemCost(user,new int[][]{{item.getItemId(),item.getItemNum()}},BIReason.SKIN_USE_CONSUME,1);
if(!use){
throw new ErrorCodeException(ErrorCode.ITEM_NOT_ENOUGH);
}
user.getHeroManager().addSkin(sHeroSkin.getType(),time);
ItemUtil.drop(user,new int[][]{sHeroSkin.getHeadIcon()},BIReason.SKIN_USE_REWARD);
HeroInfoProto.GetSkinIndication indication = HeroInfoProto.GetSkinIndication.newBuilder()
.setSkinInfo(CommonProto.SkinInfo.newBuilder().setSkinId(sHeroSkin.getType()).setOverTime(time))
.build();
MessageUtil.sendIndicationMessage(session,1, MessageTypeProto.MessageType.HERO_SKIN_USE_INDICATION_VALUE,indication,true);
}
/**
* 使

View File

@ -57,71 +57,73 @@ public class StoreLogic implements IEventHandler {
StoreLogic.getInstance();
}
public static void checkGlobalStore(boolean isStartServer) throws Exception {
public static void checkGlobalStore(boolean isStartServer) {
Calendar calendar = Calendar.getInstance();
long now = calendar.getTimeInMillis();
for(SStoreTypeConfig sStoreTypeConfig : SStoreTypeConfig.getsStoreTypeConfigMap().values()){
if(sStoreTypeConfig.getStoreOpenRule() == 3){
long startTime = ToolsUtil.getTimeLong(sStoreTypeConfig.getStartTimeLong(), sStoreTypeConfig.getEndTimeLong(),ActivityType.OPEN_TYPE_TIME,0, 1);
long endTime = ToolsUtil.getTimeLong(sStoreTypeConfig.getStartTimeLong(),sStoreTypeConfig.getEndTimeLong(), ActivityType.OPEN_TYPE_TIME,0, 2);
if(startTime!=0 && endTime!=0 && now > startTime && now<endTime && !openStoreInfo.contains(sStoreTypeConfig.getId())){
for(ISession session : OnlineUserManager.sessionMap.values()){
if(session.getFiveReady() == 1){
try {
updateUsersStoreAyync(UserManager.getUser(session.getUid()),user1 -> {
initOneStore(user1,sStoreTypeConfig.getId());
for (SStoreTypeConfig sStoreTypeConfig : SStoreTypeConfig.getsStoreTypeConfigMap().values()) {
if (sStoreTypeConfig.getStoreOpenRule() == 3) {
long startTime = ToolsUtil.getTimeLong(sStoreTypeConfig.getStartTimeLong(), sStoreTypeConfig.getEndTimeLong(), ActivityType.OPEN_TYPE_TIME, 0, 1);
long endTime = ToolsUtil.getTimeLong(sStoreTypeConfig.getStartTimeLong(), sStoreTypeConfig.getEndTimeLong(), ActivityType.OPEN_TYPE_TIME, 0, 2);
if (startTime != 0 && endTime != 0 && now > startTime && now < endTime && !openStoreInfo.contains(sStoreTypeConfig.getId())) {
for (ISession session : OnlineUserManager.sessionMap.values()) {
if (session.getFiveReady() == 1) {
try {
updateUsersStoreAyync(UserManager.getUser(session.getUid()), user1 -> {
initOneStore(user1, sStoreTypeConfig.getId());
MongoUtil.getInstence().lastUpdate();
});
}catch (Exception e){
LOGGER.error("Exception::=>{}",e.toString());
} catch (Exception e) {
LOGGER.error("Exception::=>{}", e.toString());
}
}
}
if(isStartServer){
if (isStartServer) {
openStoreInfo.add(sStoreTypeConfig.getId());
}
}
}else if(sStoreTypeConfig.getStoreOpenRule() == 6 ){
for(ISession session : OnlineUserManager.sessionMap.values()){
if(session.getFiveReady() == 1){
User user = UserManager.getUser(session.getUid());
if(user==null){
LOGGER.info("user null removeid=>{}",session.getUid());
} else if (sStoreTypeConfig.getStoreOpenRule() == 6) {
for (ISession session : OnlineUserManager.sessionMap.values()) {
if (session.getFiveReady() == 1) {
User user = UserManager.getUser(session.getUid(), true);
if (user == null) {
LOGGER.info("user null removeid=>{}", session.getUid());
OnlineUserManager.userOffline(session.getUid());
continue;
}
long userCreateTime = user.getPlayerInfoManager().getCreateTime();
long startTime = ToolsUtil.getTimeLong(sStoreTypeConfig.getStartTimeLong(), sStoreTypeConfig.getEndTimeLong(),ActivityType.OPEN_TYPE_ROLE,userCreateTime, 1);
long endTime = ToolsUtil.getTimeLong(sStoreTypeConfig.getStartTimeLong(),sStoreTypeConfig.getEndTimeLong(), ActivityType.OPEN_TYPE_ROLE,userCreateTime, 2);
if (now < startTime || now>endTime) {
long startTime = ToolsUtil.getTimeLong(sStoreTypeConfig.getStartTimeLong(), sStoreTypeConfig.getEndTimeLong(), ActivityType.OPEN_TYPE_ROLE, userCreateTime, 1);
long endTime = ToolsUtil.getTimeLong(sStoreTypeConfig.getStartTimeLong(), sStoreTypeConfig.getEndTimeLong(), ActivityType.OPEN_TYPE_ROLE, userCreateTime, 2);
if (now < startTime || now > endTime) {
continue;
}
if(!user.getStoreManager().getStoreInfoMap().containsKey(sStoreTypeConfig.getId())){
updateUsersStoreAyync(UserManager.getUser(session.getUid()),user1 -> {
initOneStore(user1,sStoreTypeConfig.getId());
if (!user.getStoreManager().getStoreInfoMap().containsKey(sStoreTypeConfig.getId())) {
updateUsersStoreAyync(UserManager.getUser(session.getUid()), user1 -> {
initOneStore(user1, sStoreTypeConfig.getId());
MongoUtil.getInstence().lastUpdate();
});
}
}
}
}else if(sStoreTypeConfig.getStoreOpenRule() == 7){
long startTime = ToolsUtil.getTimeLong(sStoreTypeConfig.getStartTimeLong(), sStoreTypeConfig.getEndTimeLong(),ActivityType.OPEN_TYPE_ROLE,0, 1);
long endTime = ToolsUtil.getTimeLong(sStoreTypeConfig.getStartTimeLong(),sStoreTypeConfig.getEndTimeLong(), ActivityType.OPEN_TYPE_ROLE,0, 2);
if (now < startTime || now>endTime) {
} else if (sStoreTypeConfig.getStoreOpenRule() == 7) {
long startTime = ToolsUtil.getTimeLong(sStoreTypeConfig.getStartTimeLong(), sStoreTypeConfig.getEndTimeLong(), ActivityType.OPEN_TYPE_ROLE, 0, 1);
long endTime = ToolsUtil.getTimeLong(sStoreTypeConfig.getStartTimeLong(), sStoreTypeConfig.getEndTimeLong(), ActivityType.OPEN_TYPE_ROLE, 0, 2);
if (now < startTime || now > endTime) {
continue;
}
for(ISession session : OnlineUserManager.sessionMap.values()){
if(session.getFiveReady() == 1){
User user = UserManager.getUser(session.getUid());
if(user==null){
LOGGER.info("user null removeid=>{}",session.getUid());
for (ISession session : OnlineUserManager.sessionMap.values()) {
if (session.getFiveReady() == 1) {
User user = UserManager.getUser(session.getUid(), true);
if (user == null) {
LOGGER.info("user null removeid=>{}", session.getUid());
OnlineUserManager.userOffline(session.getUid());
continue;
}
if(!user.getStoreManager().getStoreInfoMap().containsKey(sStoreTypeConfig.getId())){
updateUsersStoreAyync(UserManager.getUser(session.getUid()),user1 -> {
initOneStore(user1,sStoreTypeConfig.getId());
if (!user.getStoreManager().getStoreInfoMap().containsKey(sStoreTypeConfig.getId())) {
updateUsersStoreAyync(UserManager.getUser(session.getUid()), user1 -> {
initOneStore(user1, sStoreTypeConfig.getId());
MongoUtil.getInstence().lastUpdate();
});
}
@ -130,17 +132,21 @@ public class StoreLogic implements IEventHandler {
}
}
if(sStoreTypeConfig.getRefreshType()[0]==2&& calendar.get(Calendar.MINUTE) ==0){
if (sStoreTypeConfig.getRefreshType()[0] == 2 && calendar.get(Calendar.MINUTE) == 0) {
for(int i = 1;i<sStoreTypeConfig.getRefreshType().length;i++){
if(sStoreTypeConfig.getRefreshType()[i]!=calendar.get(Calendar.HOUR_OF_DAY)){
for (int i = 1; i < sStoreTypeConfig.getRefreshType().length; i++) {
if (sStoreTypeConfig.getRefreshType()[i] != calendar.get(Calendar.HOUR_OF_DAY)) {
continue;
}
sendRefreshIndication(sStoreTypeConfig,now);
break ;
sendRefreshIndication(sStoreTypeConfig, now);
break;
}
}
}
}catch (Exception e){
LOGGER.error(e.getMessage());
e.printStackTrace();
}
}
private static void sendRefreshIndication(SStoreTypeConfig sStoreTypeConfig,long lastRefreshTime) throws Exception {

View File

@ -106,6 +106,7 @@ public class CBean2Proto {
.addAllJewels(hero.getJewelInfo())
.setCreatetype(hero.getCreateType())
.setChangeId(hero.getChangeId())
.setSkinId(hero.getSkin())
.build();
}
@ -255,6 +256,7 @@ public class CBean2Proto {
monsterBuilder.setProperty(monsterPropertyList.toString());
monsterBuilder.setUnitSkillIds(monsterSkillList.toString());
monsterBuilder.setUnitId(String.valueOf(sMonsterConfig.getId()));
monsterBuilder.setSkinId(sMonsterConfig.getSkinId());
return monsterBuilder;
}
@ -552,7 +554,7 @@ public class CBean2Proto {
public static CommonProto.TeamSimpleInfo getSimpleTeamInfoByHero(Hero hero,int position){
return CommonProto.TeamSimpleInfo.newBuilder().setHeroid(hero.getId()).setHeroTid(hero.getTemplateId()).setLevel(hero.getLevel()).setStar(hero.getStar()).setPosition(position).build();
return CommonProto.TeamSimpleInfo.newBuilder().setHeroid(hero.getId()).setHeroTid(hero.getTemplateId()).setLevel(hero.getLevel()).setStar(hero.getStar()).setPosition(position).setSkinId(hero.getSkin()).build();
}
public static CommonProto.TeamSimpleInfo getSimpleTeamInfoByPokeMon(Pokemon pokemon,int position){
return CommonProto.TeamSimpleInfo.newBuilder().setHeroid(pokemon.getId()).setHeroTid(pokemon.getTmpId()).setLevel(pokemon.getLevel()).setStar(pokemon.getStar()).setPosition(position).build();

View File

@ -92,17 +92,18 @@ public class FightDataUtil {
unitData.set("position",unitInfo.getPosition());
unitData.set("quality", sMonster.getQuality());
unitData.set("element",sMonster.getPropertyName());
unitData.set("skinId",sMonster.getSkinId());
if (unitSkill.length==1){
unitData.set("skill", getSkill(unitSkill[0]));
unitData.set("skill", getSkill(unitSkill[0],sMonster.getSkinId()));
unitData.set("superSkill", new LuaTable());
unitData.set("passivity", new LuaTable());
}else if (unitSkill.length==2){
unitData.set("skill", getSkill(unitSkill[0]));
unitData.set("superSkill", getSkill(unitSkill[1]));
unitData.set("skill", getSkill(unitSkill[0],sMonster.getSkinId()));
unitData.set("superSkill", getSkill(unitSkill[1],sMonster.getSkinId()));
unitData.set("passivity", new LuaTable());
}else {
unitData.set("skill", getSkill(unitSkill[0]));
unitData.set("superSkill", getSkill(unitSkill[1]));
unitData.set("skill", getSkill(unitSkill[0],sMonster.getSkinId()));
unitData.set("superSkill", getSkill(unitSkill[1],sMonster.getSkinId()));
unitData.set("passivity", getPassivity(unitSkill));
}
unitData.set("ai", getMonsterAi(sMonster.getMonsterAi()));
@ -196,7 +197,7 @@ public class FightDataUtil {
playerData.set("teamPassive", getTeamPassive(heroTeam.getTeamPassiveList()));
playerData.set("outData",heroTeam.getSpecialPassive());
// 灵兽技能
playerData.set("monsterList", getPokemonSkill(heroTeam.getPokemonUnitListList(),0));
playerData.set("monsterList", getPokemonSkill(heroTeam.getPokemonUnitListList(),position));
playerData.set("firstCamp",first?1:0);
return playerData;
}
@ -269,7 +270,7 @@ public class FightDataUtil {
}else{
triggerCondition.rawset(1,LuaValue.valueOf(0));
}
oneSkill.set("effect",getSkill(String.valueOf(skillIDList[j])));
oneSkill.set("effect",getSkill(String.valueOf(skillIDList[j]),0));
oneSkill.set("triggerCondition",triggerCondition);
oneSkill.set("maxCount",sSpiritAnimalSkill.getWarEffectCount()[j]);
@ -310,14 +311,15 @@ public class FightDataUtil {
unitData.set("position", data.getPosition());
unitData.set("element", hero.getPropertyName());
unitData.set("skill", getSkill(skillIds[0]));
unitData.set("skill", getSkill(skillIds[0],data.getSkinId()));
if(skillIds.length == 1){
unitData.set("superSkill", getSkill(null));
unitData.set("superSkill", getSkill(null,data.getSkinId()));
}else {
unitData.set("superSkill", getSkill(skillIds[1]));
unitData.set("superSkill", getSkill(skillIds[1],data.getSkinId()));
}
unitData.set("passivity", getPassivity(skillIds));
unitData.set("property", getProperty(property));
unitData.set("skinId",data.getSkinId());
return unitData;
}
@ -330,7 +332,7 @@ public class FightDataUtil {
return property;
}
private static LuaValue getSkill(String skillId,String...args) {
private static LuaValue getSkill(String skillId,int skinId) {
LuaValue skill = new LuaTable();
if (StringUtil.isEmpty(skillId)){
return skill;
@ -342,7 +344,14 @@ public class FightDataUtil {
// cd+=Integer.parseInt(args[0]);
// }
skill.rawset(1, LuaValue.valueOf(skillId));
int skillDisplay =sSkillLogicVo.getSkillDisplay();
int[][] display =sSkillLogicVo.getSkillDisplay();
int skillDisplay = display[0][0];
for(int[] skillArray:display){
if(skillArray[0]==skinId){
skillDisplay = skillArray[1];
break;
}
}
SCombatControl sCombatControl = STableManager.getConfig(SCombatControl.class).get(skillDisplay);
int KeyFrame = sCombatControl.getKeyFrame();
int SkillDuration = sCombatControl.getSkillDuration();

View File

@ -0,0 +1,97 @@
package config;
import manager.STableManager;
import manager.Table;
import java.util.HashMap;
import java.util.Map;
@Table(name ="HeroSkin")
public class SHeroSkin implements BaseConfig {
private int id;
private int type;
private int heroId;
private String readingName;
private int[][] unlockProperty;
private int[][] monomerProperty;
private int time;
private int isDefault;
private int order;
private int[] price;
private int[] headIcon;
public static Map<Integer,SHeroSkin> skinMapByType;
@Override
public void init() throws Exception {
Map<Integer, SHeroSkin> config = STableManager.getConfig(SHeroSkin.class);
Map<Integer,SHeroSkin> skinMapByTypeTemp = new HashMap<>();
for(Map.Entry<Integer,SHeroSkin> entry:config.entrySet()){
skinMapByTypeTemp.put(entry.getValue().getType(),entry.getValue());
}
skinMapByType =skinMapByTypeTemp;
}
public int getId() {
return id;
}
public int getType() {
return type;
}
public int getHeroId() {
return heroId;
}
public String getReadingName() {
return readingName;
}
public int[][] getUnlockProperty() {
return unlockProperty;
}
public int[][] getMonomerProperty() {
return monomerProperty;
}
public int getTime() {
return time;
}
public int getIsDefault() {
return isDefault;
}
public int getOrder() {
return order;
}
public int[] getPrice() {
return price;
}
public int[] getHeadIcon() {
return headIcon;
}
}

View File

@ -58,6 +58,8 @@ public class SMonsterConfig implements BaseConfig {
private int[] monsterAi;
private int skinId;
@Override
@ -177,4 +179,8 @@ public class SMonsterConfig implements BaseConfig {
public int[] getMonsterAi() {
return monsterAi;
}
public int getSkinId() {
return skinId;
}
}

View File

@ -24,7 +24,7 @@ public class SSkillLogicConfig implements BaseConfig {
private float cd;
private int skillDisplay;
private int[][] skillDisplay;
@Override
public void init() throws Exception {
@ -66,7 +66,7 @@ public class SSkillLogicConfig implements BaseConfig {
return cd;
}
public int getSkillDisplay() {
public int[][] getSkillDisplay() {
return skillDisplay;
}

View File

@ -6,7 +6,7 @@ public class SSkillLogicVo{
private int skillId;
private int skillDisplay;
private int[][] skillDisplay;
private List<SkillTargetVo> skillTargetVoList;
@ -18,11 +18,11 @@ public class SSkillLogicVo{
this.skillId = skillId;
}
public int getSkillDisplay() {
public int[][] getSkillDisplay() {
return skillDisplay;
}
public void setSkillDisplay(int skillDisplay) {
public void setSkillDisplay(int[][] skillDisplay) {
this.skillDisplay = skillDisplay;
}