Merge branch 'master' of http://60.1.1.230/backend/jieling_server
commit
952b1dd161
|
@ -1,8 +1,8 @@
|
||||||
package com.ljsd.jieling.globals;
|
package com.ljsd.jieling.globals;
|
||||||
|
|
||||||
public interface Global {
|
public interface Global {
|
||||||
|
int EXECUTION = 1;//行动力id
|
||||||
int STAMINA = 2; // 体力id
|
int STAMINA = 2; // 体力id
|
||||||
int EXECUTION = 3;//行动力id
|
|
||||||
int DROP = 53;//水滴
|
int DROP = 53;//水滴
|
||||||
int HEROSTORY_TICKET = 28; //精英入场券
|
int HEROSTORY_TICKET = 28; //精英入场券
|
||||||
int GENERALSTORY_TICKET = 27; //普通入场券
|
int GENERALSTORY_TICKET = 27; //普通入场券
|
||||||
|
|
|
@ -1553,19 +1553,19 @@ public class MapLogic {
|
||||||
cacheRemove.add(hero.getId());
|
cacheRemove.add(hero.getId());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(!cacheRemove.isEmpty()){
|
// if(!cacheRemove.isEmpty()){
|
||||||
Iterator<TeamPosHeroInfo> iterator = team.iterator();
|
// Iterator<TeamPosHeroInfo> iterator = team.iterator();
|
||||||
while (iterator.hasNext()){
|
// while (iterator.hasNext()){
|
||||||
TeamPosHeroInfo next = iterator.next();
|
// TeamPosHeroInfo next = iterator.next();
|
||||||
if(cacheRemove.contains(next.getHeroId())){
|
// if(cacheRemove.contains(next.getHeroId())){
|
||||||
if(mapManager.getHeroAllAttributeMap().containsKey(next.getHeroId())){
|
// if(mapManager.getHeroAllAttributeMap().containsKey(next.getHeroId())){
|
||||||
mapManager.removeOneHeroAttribute(next.getHeroId());
|
// mapManager.removeOneHeroAttribute(next.getHeroId());
|
||||||
}
|
// }
|
||||||
iterator.remove();
|
// iterator.remove();
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
user.getTeamPosManager().updateTeamPosByTeamId(teamId,team);
|
// user.getTeamPosManager().updateTeamPosByTeamId(teamId,team);
|
||||||
}
|
// }
|
||||||
}else{
|
}else{
|
||||||
for (TeamPosHeroInfo teamPosHeroInfo : team) {
|
for (TeamPosHeroInfo teamPosHeroInfo : team) {
|
||||||
mapManager.updateHeroOneAttribute(teamPosHeroInfo.getHeroId(), HeroAttributeEnum.CurHP.getPropertyId(), checkResult[teamPosHeroInfo.getPosition()+1]);
|
mapManager.updateHeroOneAttribute(teamPosHeroInfo.getHeroId(), HeroAttributeEnum.CurHP.getPropertyId(), checkResult[teamPosHeroInfo.getPosition()+1]);
|
||||||
|
@ -3139,8 +3139,31 @@ public class MapLogic {
|
||||||
}
|
}
|
||||||
endlessMapInfo.setEndlessHeroInfo(endlessHeroInfo);
|
endlessMapInfo.setEndlessHeroInfo(endlessHeroInfo);
|
||||||
mapManager.setEndlessMapInfo(endlessMapInfo);
|
mapManager.setEndlessMapInfo(endlessMapInfo);
|
||||||
// List<TeamPosHeroInfo> team = user.getTeamPosManager().getTeamPosForHero().get(401);
|
List<TeamPosHeroInfo> team = user.getTeamPosManager().getTeamPosForHero().get(401);
|
||||||
// if(team!=null&&team.size()>0){
|
if(team!=null&&team.size()>0){
|
||||||
|
Set<String> cacheRemove = new HashSet<>();
|
||||||
|
Map<String, Map<Integer, Integer>> heroAllAttributeMap = mapManager.getHeroAllAttributeMap();
|
||||||
|
if(heroAllAttributeMap !=null){
|
||||||
|
for(Map.Entry<String, Map<Integer, Integer>> entry:heroAllAttributeMap.entrySet()){
|
||||||
|
if(entry.getValue().get(HeroAttributeEnum.CurHP.getPropertyId())==0){
|
||||||
|
cacheRemove.add(entry.getKey());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(!cacheRemove.isEmpty()){
|
||||||
|
Iterator<TeamPosHeroInfo> iterator = team.iterator();
|
||||||
|
while (iterator.hasNext()){
|
||||||
|
TeamPosHeroInfo next = iterator.next();
|
||||||
|
if(cacheRemove.contains(next.getHeroId())){
|
||||||
|
if(heroAllAttributeMap.containsKey(next.getHeroId())){
|
||||||
|
mapManager.removeOneHeroAttribute(next.getHeroId());
|
||||||
|
}
|
||||||
|
iterator.remove();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
user.getTeamPosManager().updateTeamPosByTeamId(401,team);
|
||||||
|
}
|
||||||
|
}
|
||||||
// Iterator<TeamPosHeroInfo> iterator = team.iterator();
|
// Iterator<TeamPosHeroInfo> iterator = team.iterator();
|
||||||
// while(iterator.hasNext()){
|
// while(iterator.hasNext()){
|
||||||
// TeamPosHeroInfo teamInfo = iterator.next();
|
// TeamPosHeroInfo teamInfo = iterator.next();
|
||||||
|
|
|
@ -111,6 +111,8 @@ public class CumulationData {
|
||||||
|
|
||||||
public int monsterAttackTimes;
|
public int monsterAttackTimes;
|
||||||
|
|
||||||
|
public int consumeAction;//无尽消耗行动力
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//任务重置
|
//任务重置
|
||||||
|
@ -158,6 +160,7 @@ public class CumulationData {
|
||||||
friendNums=0;
|
friendNums=0;
|
||||||
monsterAttackTimes = 0;
|
monsterAttackTimes = 0;
|
||||||
toBeStronger = 0;
|
toBeStronger = 0;
|
||||||
|
consumeAction = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void clearArray(int[] source){
|
private void clearArray(int[] source){
|
||||||
|
|
|
@ -306,7 +306,12 @@ public class GuildFightLogic {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
GuildInfo enemyInfo = GuilidManager.guildInfoMap.get(enemyFamily);
|
GuildInfo enemyInfo = GuilidManager.guildInfoMap.get(enemyFamily);
|
||||||
Family.EnemyFamily familyInfo = Family.EnemyFamily.newBuilder().setId(enemyInfo.getId()).setLevel(enemyInfo.getLevel()).setName(enemyInfo.getName()).setPictureId(1).build();
|
Family.EnemyFamily familyInfo = Family.EnemyFamily.newBuilder().setId(enemyInfo.getId())
|
||||||
|
.setLevel(enemyInfo.getLevel())
|
||||||
|
.setName(enemyInfo.getName())
|
||||||
|
.setPictureId(1)
|
||||||
|
.setTotalStar(redisUtil.getMapEntry(RedisKey.FAMILY_FIGHT_TOTAL_STAR,"",String.valueOf(enemyFamily),Integer.class))
|
||||||
|
.build();
|
||||||
GuildLogic.sendIndicationToMember(guildInfo, MessageTypeProto.MessageType.FAMILY_FIGHT_MATCHING_SUCCESS_INDICATION, familyInfo);
|
GuildLogic.sendIndicationToMember(guildInfo, MessageTypeProto.MessageType.FAMILY_FIGHT_MATCHING_SUCCESS_INDICATION, familyInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -21,6 +21,7 @@ import com.ljsd.jieling.network.server.ProtocolsManager;
|
||||||
import com.ljsd.jieling.network.session.ISession;
|
import com.ljsd.jieling.network.session.ISession;
|
||||||
import com.ljsd.jieling.protocols.CommonProto;
|
import com.ljsd.jieling.protocols.CommonProto;
|
||||||
import com.ljsd.jieling.protocols.HeroInfoProto;
|
import com.ljsd.jieling.protocols.HeroInfoProto;
|
||||||
|
import com.ljsd.jieling.protocols.MapInfoProto;
|
||||||
import com.ljsd.jieling.protocols.MessageTypeProto;
|
import com.ljsd.jieling.protocols.MessageTypeProto;
|
||||||
import com.ljsd.jieling.util.*;
|
import com.ljsd.jieling.util.*;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
|
@ -426,6 +427,7 @@ public class HeroLogic {
|
||||||
if(teamPosHeroInfos!=null){
|
if(teamPosHeroInfos!=null){
|
||||||
List<String> heroes = new ArrayList<>(teamPosHeroInfos.size());
|
List<String> heroes = new ArrayList<>(teamPosHeroInfos.size());
|
||||||
Map<String, Map<Integer, Integer>> heroAllAttributeMap = new HashMap<>(teamPosHeroInfos.size());
|
Map<String, Map<Integer, Integer>> heroAllAttributeMap = new HashMap<>(teamPosHeroInfos.size());
|
||||||
|
List<MapInfoProto.HeroInfo> indiHeros = new ArrayList<>();
|
||||||
for (TeamPosHeroInfo heroInfo : teamPosHeroInfos) {
|
for (TeamPosHeroInfo heroInfo : teamPosHeroInfos) {
|
||||||
Hero hero = user.getHeroManager().getHero(heroInfo.getHeroId());
|
Hero hero = user.getHeroManager().getHero(heroInfo.getHeroId());
|
||||||
if (hero == null) {
|
if (hero == null) {
|
||||||
|
@ -442,11 +444,23 @@ public class HeroLogic {
|
||||||
}
|
}
|
||||||
heroAllAttributeMap.put(hero.getId(), heroAllAttribute);
|
heroAllAttributeMap.put(hero.getId(), heroAllAttribute);
|
||||||
heroes.add(heroInfo.getHeroId());
|
heroes.add(heroInfo.getHeroId());
|
||||||
|
MapInfoProto.HeroInfo indiInfo = MapInfoProto.HeroInfo.newBuilder().setHeroId(heroInfo.getHeroId())
|
||||||
|
.setHeroHp(heroAllAttribute.get(HeroAttributeEnum.CurHP.getPropertyId()))
|
||||||
|
.setHeroMaxHp(heroAllAttribute.get(HeroAttributeEnum.Hp.getPropertyId()))
|
||||||
|
.build();
|
||||||
|
indiHeros.add(indiInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
user.getMapManager().setHeroAllAttributeMap(heroAllAttributeMap);
|
user.getMapManager().setHeroAllAttributeMap(heroAllAttributeMap);
|
||||||
|
if(user.getMapManager().getCurMapId()!=0){
|
||||||
|
MapInfoProto.EndlessSetTeamIndication response = MapInfoProto.EndlessSetTeamIndication.newBuilder().addAllInfo(indiHeros).build();
|
||||||
|
MessageUtil.sendIndicationMessage(iSession,1, MessageTypeProto.MessageType.ENDLESS_MAP_SET_TEAM_INDICATION_VALUE,response,true);
|
||||||
|
}
|
||||||
}else{
|
}else{
|
||||||
user.getTeamPosManager().changeTeamInfo(teamId,heroIds,pokemonoIds);
|
user.getTeamPosManager().changeTeamInfo(teamId,heroIds,pokemonoIds);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
user.getUserMissionManager().onGameEvent(user,GameEvent.HERO_IN_TEAM,heroIds.size());
|
user.getUserMissionManager().onGameEvent(user,GameEvent.HERO_IN_TEAM,heroIds.size());
|
||||||
MessageUtil.sendMessage(iSession,1,MessageTypeProto.MessageType.TEAM_POS_SAVE_RESPONSE_VALUE,null,true);
|
MessageUtil.sendMessage(iSession,1,MessageTypeProto.MessageType.TEAM_POS_SAVE_RESPONSE_VALUE,null,true);
|
||||||
|
|
|
@ -628,6 +628,9 @@ public class MissionLoigc {
|
||||||
case BLOODY_KILL_NUMS:
|
case BLOODY_KILL_NUMS:
|
||||||
count = user.getBloodyInfo().getKillNums();
|
count = user.getBloodyInfo().getKillNums();
|
||||||
break;
|
break;
|
||||||
|
case ENDLESS_CONSUME_ACTION:
|
||||||
|
count = cumulationData.consumeAction;
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
count = 0;
|
count = 0;
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -78,7 +78,7 @@ public enum MissionType {
|
||||||
MONSTER_ATTACK_LEVEL(57),//兽潮来袭到达x层
|
MONSTER_ATTACK_LEVEL(57),//兽潮来袭到达x层
|
||||||
TO_BE_STRONGER(58),//我要变强点击:%s次
|
TO_BE_STRONGER(58),//我要变强点击:%s次
|
||||||
BLOODY_KILL_NUMS(59),// 血战每日击杀人数
|
BLOODY_KILL_NUMS(59),// 血战每日击杀人数
|
||||||
|
ENDLESS_CONSUME_ACTION(60)//无尽消耗行动力
|
||||||
;
|
;
|
||||||
|
|
||||||
private int missionType;
|
private int missionType;
|
||||||
|
@ -211,6 +211,8 @@ public enum MissionType {
|
||||||
return TO_BE_STRONGER;
|
return TO_BE_STRONGER;
|
||||||
case 59:
|
case 59:
|
||||||
return BLOODY_KILL_NUMS;
|
return BLOODY_KILL_NUMS;
|
||||||
|
case 60:
|
||||||
|
return ENDLESS_CONSUME_ACTION;
|
||||||
default:
|
default:
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,6 +25,12 @@ public class ConsumerMaterialDataManager implements BaseDataManager{
|
||||||
data.consumerStamina+=count;
|
data.consumerStamina+=count;
|
||||||
result = new CumulationData.Result(missionType);
|
result = new CumulationData.Result(missionType);
|
||||||
}
|
}
|
||||||
|
}else if(missionType==MissionType.ENDLESS_CONSUME_ACTION){
|
||||||
|
count = consumeMaterialMapTmp.get(Global.EXECUTION);
|
||||||
|
if(count!=null){
|
||||||
|
data.consumeAction+=count;
|
||||||
|
result = new CumulationData.Result(missionType);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -31,6 +31,7 @@ public class DataManagerDistributor {
|
||||||
|
|
||||||
judges.put(MissionType.USER_CONSUMER_GEM,new ConsumerMaterialDataManager());
|
judges.put(MissionType.USER_CONSUMER_GEM,new ConsumerMaterialDataManager());
|
||||||
judges.put(MissionType.USER_CONSUMER_STAMINA,new ConsumerMaterialDataManager());
|
judges.put(MissionType.USER_CONSUMER_STAMINA,new ConsumerMaterialDataManager());
|
||||||
|
judges.put(MissionType.ENDLESS_CONSUME_ACTION,new ConsumerMaterialDataManager());
|
||||||
|
|
||||||
judges.put(MissionType.USER_WORKSHOP_LEVEL,new DefaultDataManager());
|
judges.put(MissionType.USER_WORKSHOP_LEVEL,new DefaultDataManager());
|
||||||
|
|
||||||
|
|
|
@ -101,6 +101,7 @@ public class MissionEventDistributor {
|
||||||
typeList = new ArrayList<>();
|
typeList = new ArrayList<>();
|
||||||
typeList.add(MissionType.USER_CONSUMER_GEM);
|
typeList.add(MissionType.USER_CONSUMER_GEM);
|
||||||
typeList.add(MissionType.USER_CONSUMER_STAMINA);
|
typeList.add(MissionType.USER_CONSUMER_STAMINA);
|
||||||
|
typeList.add(MissionType.ENDLESS_CONSUME_ACTION);
|
||||||
eventEnumListMap.put(GameEvent.CONSUMER_MATERIAL,typeList);
|
eventEnumListMap.put(GameEvent.CONSUMER_MATERIAL,typeList);
|
||||||
eventProcessor.put(GameEvent.CONSUMER_MATERIAL,new CumulationDataEventProcessor());
|
eventProcessor.put(GameEvent.CONSUMER_MATERIAL,new CumulationDataEventProcessor());
|
||||||
|
|
||||||
|
|
|
@ -274,20 +274,8 @@ public class ProtocolsManager implements ProtocolsAbstract {
|
||||||
int uid = packetNetData.getUserId();
|
int uid = packetNetData.getUserId();
|
||||||
int token = packetNetData.getToken();
|
int token = packetNetData.getToken();
|
||||||
session.setUid(uid);
|
session.setUid(uid);
|
||||||
String tokenKey = RedisKey.getKey(RedisKey.TOKEN, String.valueOf(uid),false);
|
session.setToken(token);
|
||||||
if(null==tokenKey||tokenKey.isEmpty()){
|
session.setUserLoginTime(System.currentTimeMillis()/1000);
|
||||||
return false;
|
|
||||||
}
|
|
||||||
String tokenK = (String)RedisUtil.getInstence().get(tokenKey);
|
|
||||||
if(null==tokenK||tokenK.isEmpty()){
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
int serverToken = Integer.parseInt((String)RedisUtil.getInstence().get(tokenKey));
|
|
||||||
if (token == serverToken){
|
|
||||||
session.setToken(token);
|
|
||||||
session.setUserLoginTime(System.currentTimeMillis()/1000);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -303,10 +291,13 @@ public class ProtocolsManager implements ProtocolsAbstract {
|
||||||
}
|
}
|
||||||
|
|
||||||
private int checkIndex(ISession iSession, PacketNetData packetNetData) {
|
private int checkIndex(ISession iSession, PacketNetData packetNetData) {
|
||||||
|
if(packetNetData.getMsgId() == MessageTypeProto.MessageType.LOGIN_REQUEST_VALUE || packetNetData.getMsgId() == MessageTypeProto.MessageType.RECONNECT_REQUEST_VALUE){
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
int index = packetNetData.getIndex();
|
int index = packetNetData.getIndex();
|
||||||
if (iSession.getIndex() >= index){
|
if (iSession.getIndex() >= index){
|
||||||
byte[] message = iSession.getCacheMessage(index);
|
byte[] message = iSession.getCacheMessage(index);
|
||||||
if (message==null &&( packetNetData.getMsgId() != MessageTypeProto.MessageType.LOGIN_REQUEST_VALUE || packetNetData.getMsgId() != MessageTypeProto.MessageType.RECONNECT_REQUEST_VALUE)){
|
if (message==null){
|
||||||
//TODO error
|
//TODO error
|
||||||
LOGGER.info("the uid={},the msg={} is processing",iSession.getUid(), MessageTypeProto.MessageType.valueOf(packetNetData.getMsgId()));
|
LOGGER.info("the uid={},the msg={} is processing",iSession.getUid(), MessageTypeProto.MessageType.valueOf(packetNetData.getMsgId()));
|
||||||
return 1;
|
return 1;
|
||||||
|
@ -346,27 +337,14 @@ public class ProtocolsManager implements ProtocolsAbstract {
|
||||||
LOGGER.info("player offLine ...");
|
LOGGER.info("player offLine ...");
|
||||||
ISession session = (ISession) gameSession;
|
ISession session = (ISession) gameSession;
|
||||||
synchronized (session) {
|
synchronized (session) {
|
||||||
//输出日志
|
OnlineUserManager.userOffline(session.getUid());
|
||||||
// PrintStream ps= null;
|
|
||||||
// try {
|
|
||||||
// ps = new PrintStream("tmp/game.txt");
|
|
||||||
// Map<MessageTypeProto.MessageType, String> gameMessageForLogin = ProtocolsManager.gameMessageForLogin;
|
|
||||||
// for (Map.Entry<MessageTypeProto.MessageType, String> entry :gameMessageForLogin.entrySet()){
|
|
||||||
// String value = entry.getValue();
|
|
||||||
// ps.println(value);
|
|
||||||
// }
|
|
||||||
// ps.close();
|
|
||||||
// } catch (FileNotFoundException e) {
|
|
||||||
// e.printStackTrace();
|
|
||||||
// }
|
|
||||||
User user = UserManager.getUserInMem(session.getUid());
|
User user = UserManager.getUserInMem(session.getUid());
|
||||||
if(user == null){
|
if(user == null){
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
KtEventUtils.onKtEvent(user, ParamEventBean.UserLoginOutEvent,1);
|
KtEventUtils.onKtEvent(user, ParamEventBean.UserLoginOutEvent,1);
|
||||||
KtEventUtils.onKtEvent(user, ParamEventBean.UserLogin,1);
|
KtEventUtils.onKtEvent(user, ParamEventBean.UserLogin,1);
|
||||||
|
LOGGER.info("player={} offLine ...",user.getId());
|
||||||
if(session.getOfflineType() == ErrorCode.reloginCode){
|
if(session.getOfflineType() == ErrorCode.reloginCode){
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -381,7 +359,7 @@ public class ProtocolsManager implements ProtocolsAbstract {
|
||||||
|
|
||||||
GameMessageHandler.currentSessions.remove(session.getUid());
|
GameMessageHandler.currentSessions.remove(session.getUid());
|
||||||
try {
|
try {
|
||||||
OnlineUserManager.userOffline(session.getUid());
|
|
||||||
PlayerManager playerInfoManager = user.getPlayerInfoManager();
|
PlayerManager playerInfoManager = user.getPlayerInfoManager();
|
||||||
playerInfoManager.setOffLineTime(TimeUtils.now());
|
playerInfoManager.setOffLineTime(TimeUtils.now());
|
||||||
long onlineTime = playerInfoManager.getOffLineTime() - playerInfoManager.getLoginTime();
|
long onlineTime = playerInfoManager.getOffLineTime() - playerInfoManager.getLoginTime();
|
||||||
|
|
Loading…
Reference in New Issue