back_recharge
parent
700c6f4d4c
commit
ab67577ff6
|
@ -10,7 +10,7 @@ import java.util.concurrent.ConcurrentHashMap;
|
|||
import java.util.concurrent.CopyOnWriteArrayList;
|
||||
|
||||
|
||||
//@Table(name ="SkillLogicConfig")
|
||||
@Table(name ="SkillLogicConfig")
|
||||
public class SSkillLogicConfig implements BaseConfig {
|
||||
public static Map<Integer, SSkillLogicConfig> sSkillLogicConfigMap;
|
||||
public static Map<Integer,SSkillLogicVo> sSkillLogicVoMap;
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
package com.ljsd.jieling.handler.map;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.googlecode.protobuf.format.JsonFormat;
|
||||
import com.ljsd.jieling.config.*;
|
||||
import com.ljsd.jieling.core.GlobalsDef;
|
||||
import com.ljsd.jieling.db.redis.RedisKey;
|
||||
|
@ -631,10 +633,17 @@ public class MapLogic {
|
|||
MessageUtil.sendErrorResponse(session,0, messageType.getNumber(), "");
|
||||
return;
|
||||
}
|
||||
int seed = (int)valueMap.get(RedisKey.FIGHT_SEED);
|
||||
int monsterGroupId = (int)valueMap.get(RedisKey.FIGHT_GROUPID);
|
||||
CommonProto.FightTeamInfo fightTeamInfo = (CommonProto.FightTeamInfo)valueMap.get(RedisKey.FIGHT_HEROES);
|
||||
List<CommonProto.FightTeamInfo> monsterTeamList = (List<CommonProto.FightTeamInfo>)valueMap.get(RedisKey.FIGHT_MONSTERS);
|
||||
|
||||
int seed = Integer.parseInt((String)valueMap.get(RedisKey.FIGHT_SEED));
|
||||
int monsterGroupId = Integer.parseInt((String)valueMap.get(RedisKey.FIGHT_GROUPID));
|
||||
CommonProto.FightTeamInfo.Builder builder = CommonProto.FightTeamInfo.newBuilder();
|
||||
JsonFormat.merge((String)valueMap.get(RedisKey.FIGHT_HEROES), builder);
|
||||
CommonProto.FightTeamInfo fightTeamInfo = builder.build();
|
||||
CommonProto.FightTeamInfo.Builder monsterBuilder = CommonProto.FightTeamInfo.newBuilder();
|
||||
JsonFormat.merge((String)valueMap.get(RedisKey.FIGHT_MONSTERS), monsterBuilder);
|
||||
CommonProto.FightTeamInfo monsterTeam = monsterBuilder.build();
|
||||
List<CommonProto.FightTeamInfo> monsterTeamList = new ArrayList<>();
|
||||
monsterTeamList.add(monsterTeam);
|
||||
|
||||
SMonsterGroup sMonsterGroup = SMonsterGroup.getsMonsterGroupMap().get(monsterGroupId);
|
||||
if (sMonsterGroup == null) {
|
||||
|
@ -646,7 +655,7 @@ public class MapLogic {
|
|||
frames = "14#1#0|132#2#3|152#2#5|178#3#2|219#2#4|260#3#1|287#2#2|312#3#5|467#1#1";
|
||||
LuaValue getFightData = FightDataUtil.getFinalFightData(fightTeamInfo,monsterTeamList);
|
||||
LuaValue getOptionData = FightDataUtil.getOptionData(frames);
|
||||
int[] checkResult = CheckFight.getInstance().checkFight(seed, getFightData, getOptionData);
|
||||
// int[] checkResult = CheckFight.getInstance().checkFight(seed, getFightData, getOptionData);
|
||||
|
||||
|
||||
CommonProto.Drop.Builder drop = ItemUtil.drop(user, sMonsterGroup.getRewardgroup(), 1, 1);
|
||||
|
@ -655,6 +664,8 @@ public class MapLogic {
|
|||
.setDrop(drop)
|
||||
.build();
|
||||
MessageUtil.sendMessage(session, 1, messageType.getNumber(), fightEndResponse, true);
|
||||
|
||||
RedisUtil.getInstence().del(key);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
package com.ljsd.jieling.handler.map.behavior;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.googlecode.protobuf.format.JsonFormat;
|
||||
import com.ljsd.jieling.config.MapPointConfig;
|
||||
import com.ljsd.jieling.core.GlobalsDef;
|
||||
import com.ljsd.jieling.db.redis.RedisKey;
|
||||
|
@ -11,14 +13,18 @@ import com.ljsd.jieling.handler.map.MapManager;
|
|||
import com.ljsd.jieling.handler.mission.CheckMissionReturn;
|
||||
import com.ljsd.jieling.handler.mission.Mission;
|
||||
import com.ljsd.jieling.handler.mission.MissionLogic;
|
||||
import com.ljsd.jieling.logic.OnlineUserManager;
|
||||
import com.ljsd.jieling.logic.dao.Hero;
|
||||
import com.ljsd.jieling.logic.dao.TeamPosHeroInfo;
|
||||
import com.ljsd.jieling.logic.dao.root.User;
|
||||
import com.ljsd.jieling.logic.hero.HeroLogic;
|
||||
import com.ljsd.jieling.network.session.ISession;
|
||||
import com.ljsd.jieling.protocols.CommonProto;
|
||||
import com.ljsd.jieling.protocols.MapInfoProto;
|
||||
import com.ljsd.jieling.protocols.MessageTypeProto;
|
||||
import com.ljsd.jieling.util.CBean2Proto;
|
||||
import com.ljsd.jieling.util.MonsterUtil;
|
||||
import org.json.JSONArray;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
|
@ -118,15 +124,19 @@ public class BehaviorUtil {
|
|||
//设置战斗随机种子
|
||||
int seed = (int)(System.currentTimeMillis()/1000);
|
||||
eventUpdateResponse.setFightSeed(seed);
|
||||
|
||||
String key = RedisKey.getKey(RedisKey.FIGHT, user.getId(), false);
|
||||
Map<String,Object> fightInfo = new HashMap<>();
|
||||
fightInfo.put(RedisKey.FIGHT_HEROES,fightTeamInfo);
|
||||
fightInfo.put(RedisKey.FIGHT_MONSTERS,monsterGroupList);
|
||||
fightInfo.put(RedisKey.FIGHT_SEED,seed);
|
||||
fightInfo.put(RedisKey.FIGHT_GROUPID,groupId);
|
||||
|
||||
fightInfo.put(RedisKey.FIGHT_HEROES, JsonFormat.printToString(fightTeamInfo));
|
||||
fightInfo.put(RedisKey.FIGHT_MONSTERS, JsonFormat.printToString(monsterGroupList.get(0)));//暂时没考虑多拨怪
|
||||
fightInfo.put(RedisKey.FIGHT_SEED,Integer.toString(seed));
|
||||
fightInfo.put(RedisKey.FIGHT_GROUPID, Integer.toString(groupId));
|
||||
RedisUtil.getInstence().hmset(key, fightInfo, RedisKey.EXPIRE_TIME);
|
||||
|
||||
|
||||
ISession session = OnlineUserManager.getSessionByUid(Integer.parseInt(user.getId()));
|
||||
MapLogic.getInstance().endFight(session,"", MessageTypeProto.MessageType.FIGHT_END_RESPONSE);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -689,6 +689,9 @@ public class HeroLogic {
|
|||
public String getPokenmonSkills(User user,int teamId){
|
||||
StringBuilder pokenSkillResult = new StringBuilder();
|
||||
List<TeamPosForPokenInfo> teamPosForPokenInfos = user.getTeamPosManager().getTeamPosForPoken().get(teamId);
|
||||
if (teamPosForPokenInfos==null){
|
||||
return "";
|
||||
}
|
||||
Map<Integer, Pokemon> pokemonMap = user.getPokemonManager().getPokemonMap();
|
||||
Collections.sort(teamPosForPokenInfos);
|
||||
for(TeamPosForPokenInfo teamPosForPokenInfo:teamPosForPokenInfos){
|
||||
|
|
|
@ -69,9 +69,16 @@ public class FightDataUtil {
|
|||
unitData.set("camp", 1);
|
||||
unitData.set("type", sMonster.getType());
|
||||
unitData.set("quality", sMonster.getQuality());
|
||||
|
||||
unitData.set("skill", getSkill(unitSkill[0]));
|
||||
unitData.set("superSkill", getSkill(unitSkill[1]));
|
||||
if (unitSkill.length==1){
|
||||
unitData.set("skill", getSkill(unitSkill[0]));
|
||||
unitData.set("superSkill", new LuaTable());
|
||||
}else if (unitSkill.length==2){
|
||||
unitData.set("skill", getSkill(unitSkill[0]));
|
||||
unitData.set("superSkill", getSkill(unitSkill[1]));
|
||||
}else {
|
||||
unitData.set("skill", new LuaTable());
|
||||
unitData.set("superSkill", new LuaTable());
|
||||
}
|
||||
unitData.set("passivity", new LuaTable());
|
||||
unitData.set("property", getMonsterProperty(sMonster));
|
||||
|
||||
|
@ -163,6 +170,9 @@ public class FightDataUtil {
|
|||
|
||||
private static LuaValue getTeamSkill(String pokemonSkill) {
|
||||
LuaValue teamSkill = new LuaTable();
|
||||
if (pokemonSkill.equals("") || pokemonSkill==null){
|
||||
return teamSkill;
|
||||
}
|
||||
String[] skills = pokemonSkill.trim().split("#");
|
||||
for (int i = 0; i < skills.length; i++) {
|
||||
|
||||
|
@ -202,6 +212,9 @@ public class FightDataUtil {
|
|||
|
||||
private static LuaValue getSkill(String skillId) {
|
||||
LuaValue skill = new LuaTable();
|
||||
if (skillId.equals("") || skillId==null){
|
||||
return skill;
|
||||
}
|
||||
SSkillLogicVo sSkillLogicVo = SSkillLogicConfig.getsSkillLogicVo(Integer.valueOf(skillId));
|
||||
if (sSkillLogicVo != null) {
|
||||
skill.rawset(1, LuaValue.valueOf(sSkillLogicVo.getCd()));
|
||||
|
|
Loading…
Reference in New Issue