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