Merge branch 'master' of http://60.1.1.230/backend/jieling_server
commit
f28972f9d3
|
@ -11,9 +11,11 @@ import com.ljsd.jieling.db.redis.RedisKey;
|
||||||
import com.ljsd.jieling.db.redis.RedisUtil;
|
import com.ljsd.jieling.db.redis.RedisUtil;
|
||||||
import com.ljsd.jieling.logic.OnlineUserManager;
|
import com.ljsd.jieling.logic.OnlineUserManager;
|
||||||
import com.ljsd.jieling.logic.dao.FriendManager;
|
import com.ljsd.jieling.logic.dao.FriendManager;
|
||||||
|
import com.ljsd.jieling.logic.dao.GuilidManager;
|
||||||
import com.ljsd.jieling.logic.dao.PlayerManager;
|
import com.ljsd.jieling.logic.dao.PlayerManager;
|
||||||
import com.ljsd.jieling.logic.dao.UserManager;
|
import com.ljsd.jieling.logic.dao.UserManager;
|
||||||
import com.ljsd.jieling.logic.dao.root.User;
|
import com.ljsd.jieling.logic.dao.root.User;
|
||||||
|
import com.ljsd.jieling.logic.family.GuildLogic;
|
||||||
import com.ljsd.jieling.network.session.ISession;
|
import com.ljsd.jieling.network.session.ISession;
|
||||||
import com.ljsd.jieling.protocols.ChatProto;
|
import com.ljsd.jieling.protocols.ChatProto;
|
||||||
import com.ljsd.jieling.protocols.MessageTypeProto;
|
import com.ljsd.jieling.protocols.MessageTypeProto;
|
||||||
|
@ -53,9 +55,6 @@ public class ChatLogic {
|
||||||
case 1: //世界
|
case 1: //世界
|
||||||
chatInfoList = MessageCache.worldMsg.getObjs(messageId);
|
chatInfoList = MessageCache.worldMsg.getObjs(messageId);
|
||||||
break;
|
break;
|
||||||
case 2: //公会
|
|
||||||
chatInfoList = MessageCache.guildMsg.getObjs(messageId);
|
|
||||||
break;
|
|
||||||
case 3: //好友
|
case 3: //好友
|
||||||
Map<Object, Object> hmget = RedisUtil.getInstence().hmget(GameApplication.serverId + RedisKey.CUser_Chat + uid);
|
Map<Object, Object> hmget = RedisUtil.getInstence().hmget(GameApplication.serverId + RedisKey.CUser_Chat + uid);
|
||||||
if (hmget != null && hmget.size() != 0){
|
if (hmget != null && hmget.size() != 0){
|
||||||
|
@ -142,9 +141,16 @@ public class ChatLogic {
|
||||||
MessageCache.addWordMsg(chatInfo,messageId);
|
MessageCache.addWordMsg(chatInfo,messageId);
|
||||||
break;
|
break;
|
||||||
case 2: //公会
|
case 2: //公会
|
||||||
messageId = RedisUtil.getInstence().increment(GameApplication.serverId + RedisKey.CHAT_GUILD_MSG_ID+ GameApplication.serverId);
|
int guildId = user.getPlayerInfoManager().getGuildId();
|
||||||
chatInfo = CBean2Proto.getChatInfoBuilder(user,message,nowTime,messageId);
|
if(guildId==0){
|
||||||
MessageCache.addGuildMsg(chatInfo,messageId);
|
MessageUtil.sendErrorResponse(iSession,0, msgId, "未加入公会");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
chatInfo = CBean2Proto.getChatInfoBuilder(user,message,nowTime,0);
|
||||||
|
ChatProto.SendChatInfoIndication sendChatInfoIndication = ChatProto.SendChatInfoIndication.newBuilder()
|
||||||
|
.setChatInfo(chatInfo)
|
||||||
|
.build();
|
||||||
|
GuildLogic.sendIndicationToMember(GuilidManager.guildInfoMap.get(guildId),MessageTypeProto.MessageType.SEND_CHAT_INFO_INDICATION,sendChatInfoIndication);
|
||||||
break;
|
break;
|
||||||
case 3: //好友
|
case 3: //好友
|
||||||
List<Integer> friends = friendManager.getFriends();
|
List<Integer> friends = friendManager.getFriends();
|
||||||
|
@ -156,7 +162,7 @@ public class ChatLogic {
|
||||||
if (OnlineUserManager.checkUidOnline(friendId)){
|
if (OnlineUserManager.checkUidOnline(friendId)){
|
||||||
ISession sessionByUid = OnlineUserManager.getSessionByUid(friendId);
|
ISession sessionByUid = OnlineUserManager.getSessionByUid(friendId);
|
||||||
chatInfo = CBean2Proto.getChatInfoBuilder(user,message,nowTime,0);
|
chatInfo = CBean2Proto.getChatInfoBuilder(user,message,nowTime,0);
|
||||||
ChatProto.SendChatInfoIndication sendChatInfoIndication = ChatProto.SendChatInfoIndication.newBuilder()
|
sendChatInfoIndication = ChatProto.SendChatInfoIndication.newBuilder()
|
||||||
.setChatInfo(chatInfo)
|
.setChatInfo(chatInfo)
|
||||||
.build();
|
.build();
|
||||||
assert sessionByUid != null;
|
assert sessionByUid != null;
|
||||||
|
|
|
@ -9,7 +9,6 @@ public class MessageCache {
|
||||||
|
|
||||||
public static LoopQueue worldMsg = new LoopQueue(capuatiy,perCaught,msgInterval);
|
public static LoopQueue worldMsg = new LoopQueue(capuatiy,perCaught,msgInterval);
|
||||||
public static LoopQueue sysMsg = new LoopQueue(capuatiy,perCaught,msgInterval);
|
public static LoopQueue sysMsg = new LoopQueue(capuatiy,perCaught,msgInterval);
|
||||||
public static LoopQueue guildMsg = new LoopQueue(capuatiy,perCaught,msgInterval);
|
|
||||||
|
|
||||||
|
|
||||||
public static void addWordMsg(ChatProto.ChatInfo chatInfo,long messageId){
|
public static void addWordMsg(ChatProto.ChatInfo chatInfo,long messageId){
|
||||||
|
@ -20,7 +19,4 @@ public class MessageCache {
|
||||||
sysMsg.push(chatInfo,messageId);
|
sysMsg.push(chatInfo,messageId);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void addGuildMsg(ChatProto.ChatInfo chatInfo,long messageId ){
|
|
||||||
guildMsg.push(chatInfo,messageId);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,78 @@
|
||||||
|
package com.ljsd.jieling.config;
|
||||||
|
|
||||||
|
import com.ljsd.jieling.db.mongo.MongoUtil;
|
||||||
|
import com.ljsd.jieling.logic.STableManager;
|
||||||
|
import com.ljsd.jieling.logic.Table;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
@Table(name="EndlessDifficulty")
|
||||||
|
public class SEndlessDifficulty implements BaseConfig{
|
||||||
|
private int id;
|
||||||
|
|
||||||
|
private int[] worldLevel;
|
||||||
|
|
||||||
|
private int[] monsterId;
|
||||||
|
|
||||||
|
private int[] rewardId;
|
||||||
|
|
||||||
|
public static Map<Integer,SEndlessDifficulty> difficultyMap;
|
||||||
|
|
||||||
|
public static Map<Integer,Integer> difficultyMonster;
|
||||||
|
|
||||||
|
public static Map<Integer,Integer> difficultyReward;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void init() throws Exception {
|
||||||
|
difficultyMap = STableManager.getConfig(SEndlessDifficulty.class);
|
||||||
|
setDifficult();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void setDifficult() throws Exception {
|
||||||
|
SEndlessDifficulty baseDiff = difficultyMap.get(1);
|
||||||
|
difficultyMonster = new HashMap<>();
|
||||||
|
difficultyReward = new HashMap<>();
|
||||||
|
ServerConfig serverConfigTmp = MongoUtil.getInstence().getMyMongoTemplate().findById(1, ServerConfig.class);
|
||||||
|
if(serverConfigTmp.getWorldLevel()==0){
|
||||||
|
for(int i = 0 ;i<baseDiff.getMonsterId().length;i++){
|
||||||
|
difficultyMonster.put(baseDiff.getMonsterId()[i],baseDiff.getMonsterId()[i]);
|
||||||
|
}
|
||||||
|
for(int i = 0 ;i<baseDiff.getRewardId().length;i++){
|
||||||
|
difficultyReward.put(baseDiff.getRewardId()[i],baseDiff.getRewardId()[i]);
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
for(Map.Entry<Integer,SEndlessDifficulty> entry:difficultyMap.entrySet()) {
|
||||||
|
if (serverConfigTmp.getWorldLevel() <= entry.getValue().getWorldLevel()[0] || serverConfigTmp.getWorldLevel() > entry.getValue().getWorldLevel()[1]) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
for(int i = 0 ;i<baseDiff.getMonsterId().length;i++){
|
||||||
|
difficultyMonster.put(baseDiff.getMonsterId()[i],entry.getValue().getMonsterId()[i]);
|
||||||
|
}
|
||||||
|
for(int i = 0 ;i<baseDiff.getRewardId().length;i++){
|
||||||
|
difficultyReward.put(baseDiff.getRewardId()[i],entry.getValue().getRewardId()[i]);
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int[] getWorldLevel() {
|
||||||
|
return worldLevel;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int[] getMonsterId() {
|
||||||
|
return monsterId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int[] getRewardId() {
|
||||||
|
return rewardId;
|
||||||
|
}
|
||||||
|
}
|
|
@ -126,6 +126,8 @@ public class RedisKey {
|
||||||
|
|
||||||
public static final String FAMILY_JOIN = "FAMILY_JOIN";
|
public static final String FAMILY_JOIN = "FAMILY_JOIN";
|
||||||
|
|
||||||
|
public static final String FAMILY_INFO = "FAMILY_INFO";
|
||||||
|
|
||||||
public static final String FAMILY_FIGHT = "FAMILY_FIGHT" ;
|
public static final String FAMILY_FIGHT = "FAMILY_FIGHT" ;
|
||||||
public static final String FAMILY_ATTACK_BLOOD = "FAMILY_ATTACK_BLOOD";
|
public static final String FAMILY_ATTACK_BLOOD = "FAMILY_ATTACK_BLOOD";
|
||||||
public static final String FAMILY_FIGHT_RANK = "FAMILY_FIGHT_RANK";
|
public static final String FAMILY_FIGHT_RANK = "FAMILY_FIGHT_RANK";
|
||||||
|
@ -194,6 +196,7 @@ public class RedisKey {
|
||||||
familyKey.add(FAMILY_FIGHT_ATTACK_COUNT);
|
familyKey.add(FAMILY_FIGHT_ATTACK_COUNT);
|
||||||
familyKey.add(FAMILY_FIGHT_TOTAL_STAR);
|
familyKey.add(FAMILY_FIGHT_TOTAL_STAR);
|
||||||
familyKey.add(FAMILY_FIGHT_TOTAL_EXP);
|
familyKey.add(FAMILY_FIGHT_TOTAL_EXP);
|
||||||
|
familyKey.add(FAMILY_INFO);
|
||||||
}
|
}
|
||||||
public static String getKey(String type, String key, boolean withoutServerId) {
|
public static String getKey(String type, String key, boolean withoutServerId) {
|
||||||
if(RedisKey.TOKEN.equals(type)||RedisKey.USER_SERVER_INFO.equals(type)||familyKey.contains(type)){
|
if(RedisKey.TOKEN.equals(type)||RedisKey.USER_SERVER_INFO.equals(type)||familyKey.contains(type)){
|
||||||
|
|
|
@ -20,6 +20,6 @@ public class FamilyDefendDetailInfoHandler extends BaseHandler {
|
||||||
byte[] bytes = netData.parseClientProtoNetData();
|
byte[] bytes = netData.parseClientProtoNetData();
|
||||||
Family.FamilyDefendDetailViewRequest request = Family.FamilyDefendDetailViewRequest.parseFrom(bytes);
|
Family.FamilyDefendDetailViewRequest request = Family.FamilyDefendDetailViewRequest.parseFrom(bytes);
|
||||||
|
|
||||||
GuildFightLogic.viewDefendDetailInfo(iSession,request.getPlayerId(), MessageTypeProto.MessageType.FAMILY_VIEW_DEFEND_DETAIL_RESPONSE);
|
GuildFightLogic.viewDefendDetailInfo(iSession,request.getPlayerId(),request.getGid(), MessageTypeProto.MessageType.FAMILY_VIEW_DEFEND_DETAIL_RESPONSE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -258,7 +258,7 @@ public class MapLogic {
|
||||||
|
|
||||||
mapEnterResponse.setLeftTime(getLeftTime(user, true));
|
mapEnterResponse.setLeftTime(getLeftTime(user, true));
|
||||||
for (Map.Entry<Integer, Integer> buffEntry : mapManager.getFoodBufferMap().entrySet()) {
|
for (Map.Entry<Integer, Integer> buffEntry : mapManager.getFoodBufferMap().entrySet()) {
|
||||||
if (buffEntry.getValue()==0) {
|
if (buffEntry.getValue()==0||buffEntry.getValue()==-1) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
CommonProto.FoodBuffer foodBuffer = CBean2Proto.getFoodBuffer(buffEntry.getKey(), buffEntry.getValue());
|
CommonProto.FoodBuffer foodBuffer = CBean2Proto.getFoodBuffer(buffEntry.getKey(), buffEntry.getValue());
|
||||||
|
@ -1021,6 +1021,7 @@ public class MapLogic {
|
||||||
MapManager mapManager = user.getMapManager();
|
MapManager mapManager = user.getMapManager();
|
||||||
SChallengeConfig challengeConfig = SChallengeConfig.sChallengeConfigs.get(mapManager.getCurMapId());
|
SChallengeConfig challengeConfig = SChallengeConfig.sChallengeConfigs.get(mapManager.getCurMapId());
|
||||||
if(mapManager.getCurMapId()==0){
|
if(mapManager.getCurMapId()==0){
|
||||||
|
mapManager.setCurXY(0);
|
||||||
MessageUtil.sendMessage(session,1,messageType.getNumber(),null,true);
|
MessageUtil.sendMessage(session,1,messageType.getNumber(),null,true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -1224,6 +1225,9 @@ public class MapLogic {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
int groupId = option[0];
|
int groupId = option[0];
|
||||||
|
if(SChallengeConfig.sChallengeConfigs.get(mapManager.getCurMapId()).getType()==4) {
|
||||||
|
groupId =SEndlessDifficulty.difficultyMonster.get(groupId);
|
||||||
|
}
|
||||||
int destoryXY = mapManager.getTriggerXY();
|
int destoryXY = mapManager.getTriggerXY();
|
||||||
CommonProto.FightTeamInfo fightTeamInfo = BehaviorUtil.getFightTeamInfo(user, mapManager.getTeamId(), true);
|
CommonProto.FightTeamInfo fightTeamInfo = BehaviorUtil.getFightTeamInfo(user, mapManager.getTeamId(), true);
|
||||||
Map<Integer, List<CommonProto.FightUnitInfo>> monsterByGroup = MonsterUtil.getMonsterByGroup(groupId);
|
Map<Integer, List<CommonProto.FightUnitInfo>> monsterByGroup = MonsterUtil.getMonsterByGroup(groupId);
|
||||||
|
@ -1262,43 +1266,51 @@ public class MapLogic {
|
||||||
mapManager.updateEndlessFightCount(1+mapManager.getEndlessMapInfo().getFightCount());
|
mapManager.updateEndlessFightCount(1+mapManager.getEndlessMapInfo().getFightCount());
|
||||||
}
|
}
|
||||||
if (resultCode == 0) {
|
if (resultCode == 0) {
|
||||||
//无尽副本复活消耗
|
if(SChallengeConfig.sChallengeConfigs.get(mapManager.getCurMapId()).getType()==4){
|
||||||
reviveConsumeExecution(user);
|
//无尽副本复活消耗
|
||||||
// 失败需要等待n秒后复活所有英雄
|
reviveConsumeExecution(user);
|
||||||
int dieCount = user.getMapManager().getDieCount();
|
for(Map.Entry<String, Map<Integer, Integer>> entry: mapManager.getHeroAllAttributeMap().entrySet()){
|
||||||
dieCount++;
|
mapManager.updateHeroOneAttribute(entry.getKey(),HeroAttributeEnum.CurHP.getPropertyId(),0);
|
||||||
user.getMapManager().setDieCount(dieCount);
|
mapManager.updateEndlessHeroHp(entry.getKey(),0);
|
||||||
int[] reviveTime = sChallengeConfig.getReviveTime();
|
}
|
||||||
long time = (long) (MathUtils.calABX(dieCount, reviveTime) * 1000);
|
}else {
|
||||||
user.getMapManager().setCanMoveTime(TimeUtils.now() + time);
|
// 失败需要等待n秒后复活所有英雄
|
||||||
int leftTime = getLeftTime(user, true);
|
int dieCount = user.getMapManager().getDieCount();
|
||||||
remainHp.clear();
|
dieCount++;
|
||||||
if (leftTime <= (int) (time / 1000)) {
|
user.getMapManager().setDieCount(dieCount);
|
||||||
resetMapInfo(user, false);
|
int[] reviveTime = sChallengeConfig.getReviveTime();
|
||||||
} else {
|
long time = (long) (MathUtils.calABX(dieCount, reviveTime) * 1000);
|
||||||
initTeamInfo(mapManager.getTeamId(), uid, user, mapManager,2);
|
user.getMapManager().setCanMoveTime(TimeUtils.now() + time);
|
||||||
List<TeamPosHeroInfo> teamPosHeroInfos = user.getTeamPosManager().getTeamPosForHero().get(mapManager.getTeamId());
|
int leftTime = getLeftTime(user, true);
|
||||||
for (TeamPosHeroInfo heroInfo : teamPosHeroInfos) {
|
remainHp.clear();
|
||||||
Hero hero = user.getHeroManager().getHero(heroInfo.getHeroId());
|
if (leftTime <= (int) (time / 1000)) {
|
||||||
if (hero == null) {
|
resetMapInfo(user, false);
|
||||||
continue;
|
} else {
|
||||||
|
initTeamInfo(mapManager.getTeamId(), uid, user, mapManager, 2);
|
||||||
|
List<TeamPosHeroInfo> teamPosHeroInfos = user.getTeamPosManager().getTeamPosForHero().get(mapManager.getTeamId());
|
||||||
|
for (TeamPosHeroInfo heroInfo : teamPosHeroInfos) {
|
||||||
|
Hero hero = user.getHeroManager().getHero(heroInfo.getHeroId());
|
||||||
|
if (hero == null) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
Map<Integer, Integer> heroAttributeMap = HeroLogic.getInstance().calHeroNotBufferAttribute(user, hero, false, teamId);
|
||||||
|
remainHp.add(heroAttributeMap.get(HeroAttributeEnum.CurHP.getPropertyId()));
|
||||||
}
|
}
|
||||||
Map<Integer, Integer> heroAttributeMap = HeroLogic.getInstance().calHeroNotBufferAttribute(user, hero,false,teamId);
|
|
||||||
remainHp.add(heroAttributeMap.get(HeroAttributeEnum.CurHP.getPropertyId()));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
CommonProto.Drop.Builder dropBuilder = CommonProto.Drop.newBuilder();
|
CommonProto.Drop.Builder dropBuilder = CommonProto.Drop.newBuilder();
|
||||||
FightInfoProto.FastFightResponse build = FightInfoProto.FastFightResponse
|
FightInfoProto.FastFightResponse build = FightInfoProto.FastFightResponse
|
||||||
.newBuilder()
|
.newBuilder()
|
||||||
.setResult(resultCode)
|
.setResult(resultCode)
|
||||||
.setEnventDrop(dropBuilder)
|
.setEnventDrop(dropBuilder)
|
||||||
.addAllRemainHpList(remainHp)
|
.addAllRemainHpList(remainHp)
|
||||||
.setEssenceValue(mapManager.getEssenceValue())
|
.setEssenceValue(mapManager.getEssenceValue())
|
||||||
.setLastXY(mapManager.getLastXY())
|
.setLastXY(mapManager.getLastXY())
|
||||||
.build();
|
.build();
|
||||||
mapManager.setCurXY(mapManager.getLastXY());
|
mapManager.setCurXY(mapManager.getLastXY());
|
||||||
MessageUtil.sendMessage(session, 1, messageType.getNumber(), build, true);
|
MessageUtil.sendMessage(session, 1, messageType.getNumber(), build, true);
|
||||||
return;
|
return;
|
||||||
|
|
||||||
}
|
}
|
||||||
List<TeamPosHeroInfo> team = user.getTeamPosManager().getTeamPosForHero().get(teamId);
|
List<TeamPosHeroInfo> team = user.getTeamPosManager().getTeamPosForHero().get(teamId);
|
||||||
if(SChallengeConfig.sChallengeConfigs.get(mapManager.getCurMapId()).getType()==4&&teamId==401){
|
if(SChallengeConfig.sChallengeConfigs.get(mapManager.getCurMapId()).getType()==4&&teamId==401){
|
||||||
|
@ -1401,6 +1413,9 @@ public class MapLogic {
|
||||||
String[] split = fightReady.split("#");
|
String[] split = fightReady.split("#");
|
||||||
RedisUtil.getInstence().del(fightReadyKey);
|
RedisUtil.getInstence().del(fightReadyKey);
|
||||||
groupId = Integer.parseInt(split[0]);
|
groupId = Integer.parseInt(split[0]);
|
||||||
|
if(SEndlessDifficulty.difficultyMonster.containsKey(groupId)){
|
||||||
|
groupId = SEndlessDifficulty.difficultyMonster.get(groupId);
|
||||||
|
}
|
||||||
if (split.length > 1) {
|
if (split.length > 1) {
|
||||||
pointId = split[1];
|
pointId = split[1];
|
||||||
}
|
}
|
||||||
|
@ -1412,6 +1427,9 @@ public class MapLogic {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
groupId = option[0];
|
groupId = option[0];
|
||||||
|
if(SChallengeConfig.sChallengeConfigs.get(mapManager.getCurMapId()).getType()==4) {
|
||||||
|
groupId =SEndlessDifficulty.difficultyMonster.get(groupId);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
FightInfoProto.FightStartResponse.Builder fightStartResponse = FightInfoProto.FightStartResponse.newBuilder();
|
FightInfoProto.FightStartResponse.Builder fightStartResponse = FightInfoProto.FightStartResponse.newBuilder();
|
||||||
SChallengeConfig sChallengeConfig = SChallengeConfig.sChallengeConfigs.get(mapManager.getCurMapId());
|
SChallengeConfig sChallengeConfig = SChallengeConfig.sChallengeConfigs.get(mapManager.getCurMapId());
|
||||||
|
@ -1483,29 +1501,36 @@ public class MapLogic {
|
||||||
|
|
||||||
mapManager.setLastFightResult(resultCode);
|
mapManager.setLastFightResult(resultCode);
|
||||||
if (resultCode == 0 || dropout == 1) {
|
if (resultCode == 0 || dropout == 1) {
|
||||||
//无尽副本复活消耗
|
if(SChallengeConfig.sChallengeConfigs.get(mapManager.getCurMapId()).getType()==4){
|
||||||
reviveConsumeExecution(user);
|
//无尽副本复活消耗
|
||||||
// 失败需要等待n秒后复活所有英雄
|
reviveConsumeExecution(user);
|
||||||
int dieCount = user.getMapManager().getDieCount();
|
for(Map.Entry<String, Map<Integer, Integer>> entry: mapManager.getHeroAllAttributeMap().entrySet()){
|
||||||
dieCount++;
|
mapManager.updateHeroOneAttribute(entry.getKey(),HeroAttributeEnum.CurHP.getPropertyId(),0);
|
||||||
user.getMapManager().setDieCount(dieCount);
|
mapManager.updateEndlessHeroHp(entry.getKey(),0);
|
||||||
int[] reviveTime = sChallengeConfig.getReviveTime();
|
}
|
||||||
long time = (long) (MathUtils.calABX(dieCount, reviveTime) * 1000);
|
}else{
|
||||||
user.getMapManager().setCanMoveTime(TimeUtils.now() + time);
|
// 失败需要等待n秒后复活所有英雄
|
||||||
int leftTime = getLeftTime(user, true);
|
int dieCount = user.getMapManager().getDieCount();
|
||||||
remainHp.clear();
|
dieCount++;
|
||||||
if (leftTime <= (int) (time / 1000)) {
|
user.getMapManager().setDieCount(dieCount);
|
||||||
resetMapInfo(user, false);
|
int[] reviveTime = sChallengeConfig.getReviveTime();
|
||||||
} else {
|
long time = (long) (MathUtils.calABX(dieCount, reviveTime) * 1000);
|
||||||
initTeamInfo(mapManager.getTeamId(), uid, user, mapManager,2);
|
user.getMapManager().setCanMoveTime(TimeUtils.now() + time);
|
||||||
Map<String, Map<Integer, Integer>> heroAllAttributeMap = mapManager.getHeroAllAttributeMap();
|
int leftTime = getLeftTime(user, true);
|
||||||
List<TeamPosHeroInfo> teamPosHeroInfos = user.getTeamPosManager().getTeamPosForHero().get(mapManager.getTeamId());
|
remainHp.clear();
|
||||||
for (TeamPosHeroInfo heroInfo : teamPosHeroInfos) {
|
if (leftTime <= (int) (time / 1000)) {
|
||||||
Hero hero = user.getHeroManager().getHero(heroInfo.getHeroId());
|
resetMapInfo(user, false);
|
||||||
if (hero == null) {
|
} else {
|
||||||
continue;
|
initTeamInfo(mapManager.getTeamId(), uid, user, mapManager,2);
|
||||||
|
Map<String, Map<Integer, Integer>> heroAllAttributeMap = mapManager.getHeroAllAttributeMap();
|
||||||
|
List<TeamPosHeroInfo> teamPosHeroInfos = user.getTeamPosManager().getTeamPosForHero().get(mapManager.getTeamId());
|
||||||
|
for (TeamPosHeroInfo heroInfo : teamPosHeroInfos) {
|
||||||
|
Hero hero = user.getHeroManager().getHero(heroInfo.getHeroId());
|
||||||
|
if (hero == null) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
remainHp.add(heroAllAttributeMap.get(hero.getId()).get(HeroAttributeEnum.CurHP.getPropertyId()));
|
||||||
}
|
}
|
||||||
remainHp.add(heroAllAttributeMap.get(hero.getId()).get(HeroAttributeEnum.CurHP.getPropertyId()));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
CommonProto.Drop.Builder dropBuilder = CommonProto.Drop.newBuilder();
|
CommonProto.Drop.Builder dropBuilder = CommonProto.Drop.newBuilder();
|
||||||
|
|
|
@ -2,6 +2,7 @@ package com.ljsd.jieling.logic;
|
||||||
|
|
||||||
import com.ljsd.GameApplication;
|
import com.ljsd.GameApplication;
|
||||||
import com.ljsd.jieling.config.SDailyTasksConfig;
|
import com.ljsd.jieling.config.SDailyTasksConfig;
|
||||||
|
import com.ljsd.jieling.config.SEndlessDifficulty;
|
||||||
import com.ljsd.jieling.config.SGlobalSystemConfig;
|
import com.ljsd.jieling.config.SGlobalSystemConfig;
|
||||||
import com.ljsd.jieling.config.ServerConfig;
|
import com.ljsd.jieling.config.ServerConfig;
|
||||||
import com.ljsd.jieling.config.json.KTSDKConstans;
|
import com.ljsd.jieling.config.json.KTSDKConstans;
|
||||||
|
@ -167,6 +168,7 @@ public class GlobalDataManaager {
|
||||||
case Endless:
|
case Endless:
|
||||||
MapLogic.getInstance().updateEndlessSeason(timeControllerOfFunction.getTimes());
|
MapLogic.getInstance().updateEndlessSeason(timeControllerOfFunction.getTimes());
|
||||||
serverConfigTmp.setWorldLevel(calWorldLevel());
|
serverConfigTmp.setWorldLevel(calWorldLevel());
|
||||||
|
SEndlessDifficulty.setDifficult();
|
||||||
MongoUtil.getLjsdMongoTemplate().save(serverConfigTmp);
|
MongoUtil.getLjsdMongoTemplate().save(serverConfigTmp);
|
||||||
MapLogic.getInstance().setEndlessMapId(getEndleeMapIdByLevel());
|
MapLogic.getInstance().setEndlessMapId(getEndleeMapIdByLevel());
|
||||||
break;
|
break;
|
||||||
|
@ -373,7 +375,7 @@ public class GlobalDataManaager {
|
||||||
}
|
}
|
||||||
private static int getEndleeMapIdByLevel() throws Exception {
|
private static int getEndleeMapIdByLevel() throws Exception {
|
||||||
ServerConfig config = MongoUtil.getInstence().getMyMongoTemplate().findById(1, ServerConfig.class);
|
ServerConfig config = MongoUtil.getInstence().getMyMongoTemplate().findById(1, ServerConfig.class);
|
||||||
int mapId = config.getWorldLevel() * 0 + 4001;
|
int mapId = config.getWorldLevel() * 0 + 4002;
|
||||||
return mapId;
|
return mapId;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,6 +8,7 @@ public class FamilyFightInfo {
|
||||||
private int familyId;
|
private int familyId;
|
||||||
private int buildId;
|
private int buildId;
|
||||||
private int starCount;
|
private int starCount;
|
||||||
|
private int force;
|
||||||
|
|
||||||
public Map<String, FamilyHeroInfo> getHeroAttribute() {
|
public Map<String, FamilyHeroInfo> getHeroAttribute() {
|
||||||
return heroAttribute;
|
return heroAttribute;
|
||||||
|
@ -48,4 +49,12 @@ public class FamilyFightInfo {
|
||||||
public void setStarCount(int starCount) {
|
public void setStarCount(int starCount) {
|
||||||
this.starCount = starCount;
|
this.starCount = starCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int getForce() {
|
||||||
|
return force;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setForce(int force) {
|
||||||
|
this.force = force;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,6 +6,7 @@ public class PlayerInfoCache {
|
||||||
private String head;
|
private String head;
|
||||||
private int headFrame;
|
private int headFrame;
|
||||||
private int level;
|
private int level;
|
||||||
|
private int guildPosition;
|
||||||
|
|
||||||
|
|
||||||
public String getName() {
|
public String getName() {
|
||||||
|
@ -47,4 +48,12 @@ public class PlayerInfoCache {
|
||||||
public void setLevel(int level) {
|
public void setLevel(int level) {
|
||||||
this.level = level;
|
this.level = level;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int getGuildPosition() {
|
||||||
|
return guildPosition;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setGuildPosition(int guildPosition) {
|
||||||
|
this.guildPosition = guildPosition;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -63,7 +63,8 @@ public class TeamPosManager extends MongoBase {
|
||||||
teamPosForHero.put(1,teamPosHeroInfoList);
|
teamPosForHero.put(1,teamPosHeroInfoList);
|
||||||
teamPosForHero.put(2,new ArrayList<>(1));
|
teamPosForHero.put(2,new ArrayList<>(1));
|
||||||
teamPosForHero.put(3,new ArrayList<>(1));
|
teamPosForHero.put(3,new ArrayList<>(1));
|
||||||
updateString("teamPosForHero",teamPosForHero);
|
teamPosForHero.put(501,new ArrayList<>(1));
|
||||||
|
updateString("teamPosForHero",teamPosForHero);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,51 @@
|
||||||
|
package com.ljsd.jieling.logic.dao.root;
|
||||||
|
|
||||||
|
public class GuildCache {
|
||||||
|
|
||||||
|
private int serverId;
|
||||||
|
|
||||||
|
private int icon;
|
||||||
|
|
||||||
|
private int level;
|
||||||
|
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
public int getServerId() {
|
||||||
|
return serverId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setServerId(int serverId) {
|
||||||
|
this.serverId = serverId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getIcon() {
|
||||||
|
return icon;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setIcon(int icon) {
|
||||||
|
this.icon = icon;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getLevel() {
|
||||||
|
return level;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLevel(int level) {
|
||||||
|
this.level = level;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setName(String name) {
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public GuildCache(int serverId, int icon, int level, String name) {
|
||||||
|
this.serverId = serverId;
|
||||||
|
this.icon = icon;
|
||||||
|
this.level = level;
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,5 +1,6 @@
|
||||||
package com.ljsd.jieling.logic.family;
|
package com.ljsd.jieling.logic.family;
|
||||||
|
|
||||||
|
import com.ljsd.GameApplication;
|
||||||
import com.ljsd.jieling.config.SArenaSetting;
|
import com.ljsd.jieling.config.SArenaSetting;
|
||||||
import com.ljsd.jieling.config.SGuildLevelConfig;
|
import com.ljsd.jieling.config.SGuildLevelConfig;
|
||||||
import com.ljsd.jieling.config.SGuildScoreConfig;
|
import com.ljsd.jieling.config.SGuildScoreConfig;
|
||||||
|
@ -10,6 +11,7 @@ import com.ljsd.jieling.db.redis.RedisUtil;
|
||||||
import com.ljsd.jieling.handler.map.behavior.BehaviorUtil;
|
import com.ljsd.jieling.handler.map.behavior.BehaviorUtil;
|
||||||
import com.ljsd.jieling.logic.blood.BloodLogic;
|
import com.ljsd.jieling.logic.blood.BloodLogic;
|
||||||
import com.ljsd.jieling.logic.dao.*;
|
import com.ljsd.jieling.logic.dao.*;
|
||||||
|
import com.ljsd.jieling.logic.dao.root.GuildCache;
|
||||||
import com.ljsd.jieling.logic.dao.root.GuildInfo;
|
import com.ljsd.jieling.logic.dao.root.GuildInfo;
|
||||||
import com.ljsd.jieling.logic.dao.root.User;
|
import com.ljsd.jieling.logic.dao.root.User;
|
||||||
import com.ljsd.jieling.logic.fight.CheckFight;
|
import com.ljsd.jieling.logic.fight.CheckFight;
|
||||||
|
@ -93,11 +95,9 @@ public class GuildFightLogic {
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public static void viewDefendDetailInfo(ISession session, int uid, MessageTypeProto.MessageType messageType) throws Exception {
|
public static void viewDefendDetailInfo(ISession session, int uid,int gid ,MessageTypeProto.MessageType messageType) throws Exception {
|
||||||
User user = UserManager.getUser(uid);
|
|
||||||
int guildId = user.getPlayerInfoManager().getGuildId();
|
FamilyFightInfo fightInfo = RedisUtil.getInstence().getMapEntry(RedisKey.FAMILY_FIGHT, String.valueOf(gid), String.valueOf(uid), FamilyFightInfo.class);
|
||||||
FamilyFightInfo fightInfo = RedisUtil.getInstence().getMapEntry(RedisKey.FAMILY_FIGHT, String.valueOf(guildId), String.valueOf(uid), FamilyFightInfo.class);
|
|
||||||
TeamPosManager teamPosManager = user.getTeamPosManager();
|
|
||||||
CommonProto.Team.Builder team = CommonProto.Team.newBuilder();
|
CommonProto.Team.Builder team = CommonProto.Team.newBuilder();
|
||||||
CommonProto.TeamOneTeamInfo.Builder oneInfo = CommonProto.TeamOneTeamInfo.newBuilder();
|
CommonProto.TeamOneTeamInfo.Builder oneInfo = CommonProto.TeamOneTeamInfo.newBuilder();
|
||||||
if(fightInfo!=null){
|
if(fightInfo!=null){
|
||||||
|
@ -111,7 +111,10 @@ public class GuildFightLogic {
|
||||||
oneInfo.addRemainHp(remainHp);
|
oneInfo.addRemainHp(remainHp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
oneInfo.setTotalForce(fightInfo.getForce());
|
||||||
}else{
|
}else{
|
||||||
|
User user = UserManager.getUser(uid);
|
||||||
|
TeamPosManager teamPosManager = user.getTeamPosManager();
|
||||||
List<TeamPosHeroInfo> teamPosHeroInfos = teamPosManager.getTeamPosForHero().get(501);
|
List<TeamPosHeroInfo> teamPosHeroInfos = teamPosManager.getTeamPosForHero().get(501);
|
||||||
if(teamPosHeroInfos==null){
|
if(teamPosHeroInfos==null){
|
||||||
teamPosHeroInfos = teamPosManager.getTeamPosForHero().get(1);
|
teamPosHeroInfos = teamPosManager.getTeamPosForHero().get(1);
|
||||||
|
@ -119,18 +122,18 @@ public class GuildFightLogic {
|
||||||
for(TeamPosHeroInfo heroInfo:teamPosHeroInfos){
|
for(TeamPosHeroInfo heroInfo:teamPosHeroInfos){
|
||||||
team.addHeroTid(user.getHeroManager().getHero(heroInfo.getHeroId()).getTemplateId());
|
team.addHeroTid(user.getHeroManager().getHero(heroInfo.getHeroId()).getTemplateId());
|
||||||
}
|
}
|
||||||
}
|
int force = HeroLogic.getInstance().calTeamTotalForce(user, 501, false);
|
||||||
oneInfo.setTeam(team);
|
if(force==0){
|
||||||
int force = HeroLogic.getInstance().calTeamTotalForce(user, 501, false);
|
force = HeroLogic.getInstance().calTeamTotalForce(user, 1, false);
|
||||||
if(force==0){
|
}
|
||||||
force = HeroLogic.getInstance().calTeamTotalForce(user, 1, false);
|
oneInfo.setTotalForce(force);
|
||||||
}
|
if (teamPosManager.getTeamPosForPoken().get(1) != null && teamPosManager.getTeamPosForPoken().get(1).size() > 0) {
|
||||||
oneInfo.setTotalForce(force);
|
for (TeamPosForPokenInfo posForPokenInfo : teamPosManager.getTeamPosForPoken().get(1)) {
|
||||||
if (teamPosManager.getTeamPosForPoken().get(1) != null && teamPosManager.getTeamPosForPoken().get(1).size() > 0) {
|
oneInfo.addPokemonInfos(posForPokenInfo.getPokenId());
|
||||||
for (TeamPosForPokenInfo posForPokenInfo : teamPosManager.getTeamPosForPoken().get(1)) {
|
}
|
||||||
oneInfo.addPokemonInfos(posForPokenInfo.getPokenId());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
oneInfo.setTeam(team);
|
||||||
Family.FamilyDefendDetailViewResponse.Builder response = Family.FamilyDefendDetailViewResponse.newBuilder();
|
Family.FamilyDefendDetailViewResponse.Builder response = Family.FamilyDefendDetailViewResponse.newBuilder();
|
||||||
response.setTeamInfo(oneInfo);
|
response.setTeamInfo(oneInfo);
|
||||||
MessageUtil.sendMessage(session, 1, messageType.getNumber(), response.build(), true);
|
MessageUtil.sendMessage(session, 1, messageType.getNumber(), response.build(), true);
|
||||||
|
@ -168,8 +171,10 @@ public class GuildFightLogic {
|
||||||
private static Family.FamilyFightInfo familyFightDetailInfo(int guildId) throws Exception {
|
private static Family.FamilyFightInfo familyFightDetailInfo(int guildId) throws Exception {
|
||||||
RedisUtil redisUtil = RedisUtil.getInstence();
|
RedisUtil redisUtil = RedisUtil.getInstence();
|
||||||
Map<String, int[]> buffCache = redisUtil.getMapValues(RedisKey.FAMILY_FIGHT_BUFF, String.valueOf(guildId), String.class, int[].class);
|
Map<String, int[]> buffCache = redisUtil.getMapValues(RedisKey.FAMILY_FIGHT_BUFF, String.valueOf(guildId), String.class, int[].class);
|
||||||
GuildInfo guildInfo = GuilidManager.guildInfoMap.get(guildId);
|
// GuildInfo guildInfo = GuilidManager.guildInfoMap.get(guildId);
|
||||||
Map<Integer, Integer> defendInfo = guildInfo.getDefendInfo();
|
// Map<Integer, Integer> defendInfo = guildInfo.getDefendInfo();
|
||||||
|
GuildCache mapEntry = RedisUtil.getInstence().getMapEntry(RedisKey.FAMILY_INFO, "", String.valueOf(guildId), GuildCache.class);
|
||||||
|
// RedisUtil.getInstence().getMapValues(RedisKey.FAMILY_FIGHT,String.valueOf(guildId),Integer.class,FamilyFightInfo.class)
|
||||||
Map<Integer, FamilyFightInfo> fightValues = RedisUtil.getInstence().getMapValues(RedisKey.FAMILY_FIGHT, String.valueOf(guildId), Integer.class, FamilyFightInfo.class);
|
Map<Integer, FamilyFightInfo> fightValues = RedisUtil.getInstence().getMapValues(RedisKey.FAMILY_FIGHT, String.valueOf(guildId), Integer.class, FamilyFightInfo.class);
|
||||||
Family.FamilyFightInfo.Builder fightInfo = Family.FamilyFightInfo.newBuilder();
|
Family.FamilyFightInfo.Builder fightInfo = Family.FamilyFightInfo.newBuilder();
|
||||||
fightInfo.setGid(guildId);
|
fightInfo.setGid(guildId);
|
||||||
|
@ -182,23 +187,20 @@ public class GuildFightLogic {
|
||||||
}
|
}
|
||||||
fightInfo.addBuildBuff(buffInfo);
|
fightInfo.addBuildBuff(buffInfo);
|
||||||
}
|
}
|
||||||
for (Map.Entry<Integer, Integer> entry : defendInfo.entrySet()) {
|
for (Map.Entry<Integer, FamilyFightInfo> entry : fightValues.entrySet()) {
|
||||||
int force = HeroLogic.getInstance().calTeamTotalForce(UserManager.getUser(entry.getKey()), 501, false);
|
|
||||||
if(force==0){
|
|
||||||
force = HeroLogic.getInstance().calTeamTotalForce(UserManager.getUser(entry.getKey()), 1, false);
|
|
||||||
}
|
|
||||||
Family.FamilyFightPlayerInfo.Builder playerInfo = Family.FamilyFightPlayerInfo.newBuilder();
|
Family.FamilyFightPlayerInfo.Builder playerInfo = Family.FamilyFightPlayerInfo.newBuilder();
|
||||||
playerInfo.setBuildId(entry.getValue());
|
playerInfo.setBuildId(entry.getValue().getBuildId());
|
||||||
playerInfo.setStarCount(fightValues.get(entry.getKey()).getStarCount());
|
playerInfo.setStarCount(fightValues.get(entry.getKey()).getStarCount());
|
||||||
PlayerManager playerManager = UserManager.getUser(entry.getKey()).getPlayerInfoManager();
|
PlayerInfoCache player = RedisUtil.getInstence().getMapEntry(RedisKey.PLAYER_INFO_CACHE, "", String.valueOf(entry.getKey()), PlayerInfoCache.class);
|
||||||
|
FamilyFightInfo forceInfo = RedisUtil.getInstence().getMapEntry(RedisKey.FAMILY_FIGHT, String.valueOf(guildId), String.valueOf(entry.getKey()), FamilyFightInfo.class);
|
||||||
Family.FamilyUserInfo.Builder userInfo = Family.FamilyUserInfo.newBuilder()
|
Family.FamilyUserInfo.Builder userInfo = Family.FamilyUserInfo.newBuilder()
|
||||||
.setRoleUid(entry.getKey())
|
.setRoleUid(entry.getKey())
|
||||||
.setUserName(playerManager.getNickName())
|
.setUserName(player.getName())
|
||||||
.setUserLevel(playerManager.getLevel())
|
.setUserLevel(player.getLevel())
|
||||||
.setPosition(GuildLogic.getMemberType(entry.getKey(),GuilidManager.guildInfoMap.get(guildId).getMembers()))
|
.setPosition(player.getGuildPosition())
|
||||||
.setSoulForce(force)
|
.setSoulForce(forceInfo.getForce())
|
||||||
.setHead(playerManager.getHead())
|
.setHead(player.getHead())
|
||||||
.setFrame(playerManager.getHeadFrame())
|
.setFrame(player.getHeadFrame())
|
||||||
.setContribute(0);
|
.setContribute(0);
|
||||||
playerInfo.setUserInfo(userInfo.build());
|
playerInfo.setUserInfo(userInfo.build());
|
||||||
fightInfo.addUser(playerInfo);
|
fightInfo.addUser(playerInfo);
|
||||||
|
@ -238,6 +240,9 @@ public class GuildFightLogic {
|
||||||
String key = RedisKey.getKey(RedisKey.FAMILY_FIGHT_RANK, "", false);
|
String key = RedisKey.getKey(RedisKey.FAMILY_FIGHT_RANK, "", false);
|
||||||
SGuildSetting guildSetting = sGuildSetting;
|
SGuildSetting guildSetting = sGuildSetting;
|
||||||
for (Integer gid : guildIds) {
|
for (Integer gid : guildIds) {
|
||||||
|
if(redisUtil.getZSetScore(RedisUtil.getInstence().getKey("guild-release", ""),"",String.valueOf(gid))>0){
|
||||||
|
continue;
|
||||||
|
}
|
||||||
Map<Integer, SGuildLevelConfig> configMap = SGuildLevelConfig.sGuildLevelConfigMap;
|
Map<Integer, SGuildLevelConfig> configMap = SGuildLevelConfig.sGuildLevelConfigMap;
|
||||||
//匹配处理
|
//匹配处理
|
||||||
GuildInfo guildInfo = GuilidManager.guildInfoMap.get(gid);
|
GuildInfo guildInfo = GuilidManager.guildInfoMap.get(gid);
|
||||||
|
@ -287,10 +292,17 @@ public class GuildFightLogic {
|
||||||
int[] buffInfo = redisUtil.getMapEntry(RedisKey.FAMILY_FIGHT_BUFF, gid.toString(), entry.getValue().toString(), int[].class);
|
int[] buffInfo = redisUtil.getMapEntry(RedisKey.FAMILY_FIGHT_BUFF, gid.toString(), entry.getValue().toString(), int[].class);
|
||||||
FamilyFightInfo fightInfo = new FamilyFightInfo();
|
FamilyFightInfo fightInfo = new FamilyFightInfo();
|
||||||
//血量处理,buff处理
|
//血量处理,buff处理
|
||||||
|
|
||||||
|
|
||||||
|
int force = HeroLogic.getInstance().calTeamTotalForce(user, 501, false);
|
||||||
|
if(force==0){
|
||||||
|
force = HeroLogic.getInstance().calTeamTotalForce(user, 1, false);
|
||||||
|
}
|
||||||
Map<String, FamilyHeroInfo> heroAllAttribute = BloodLogic.getInstance().battleRecord(user, 501, buffInfo);
|
Map<String, FamilyHeroInfo> heroAllAttribute = BloodLogic.getInstance().battleRecord(user, 501, buffInfo);
|
||||||
fightInfo.setHeroAttribute(heroAllAttribute);
|
fightInfo.setHeroAttribute(heroAllAttribute);
|
||||||
fightInfo.setBuildId(entry.getValue());
|
fightInfo.setBuildId(entry.getValue());
|
||||||
fightInfo.setStarCount(guildSetting.getStarNum()[memberType-1]);
|
fightInfo.setStarCount(guildSetting.getStarNum()[memberType-1]);
|
||||||
|
fightInfo.setForce(force);
|
||||||
redisUtil.putMapEntry(RedisKey.FAMILY_FIGHT, String.valueOf(guildInfo.getId()), String.valueOf(entry.getKey()), fightInfo);
|
redisUtil.putMapEntry(RedisKey.FAMILY_FIGHT, String.valueOf(guildInfo.getId()), String.valueOf(entry.getKey()), fightInfo);
|
||||||
familyTotalStar+=fightInfo.getStarCount();
|
familyTotalStar+=fightInfo.getStarCount();
|
||||||
}
|
}
|
||||||
|
@ -306,11 +318,12 @@ public class GuildFightLogic {
|
||||||
if (enemyFamily == -1) {
|
if (enemyFamily == -1) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
GuildInfo enemyInfo = GuilidManager.guildInfoMap.get(enemyFamily);
|
GuildCache enemyInfo = RedisUtil.getInstence().getMapEntry(RedisKey.FAMILY_INFO, "", String.valueOf(enemyFamily), GuildCache.class);
|
||||||
Family.EnemyFamily familyInfo = Family.EnemyFamily.newBuilder().setId(enemyInfo.getId())
|
// GuildInfo enemyInfo = GuilidManager.guildInfoMap.get(enemyFamily);
|
||||||
|
Family.EnemyFamily familyInfo = Family.EnemyFamily.newBuilder().setId(enemyFamily)
|
||||||
.setLevel(enemyInfo.getLevel())
|
.setLevel(enemyInfo.getLevel())
|
||||||
.setName(enemyInfo.getName())
|
.setName(enemyInfo.getName())
|
||||||
.setPictureId(1)
|
.setPictureId(enemyInfo.getIcon())
|
||||||
.setTotalStar(redisUtil.getMapEntry(RedisKey.FAMILY_FIGHT_TOTAL_STAR,"",String.valueOf(enemyFamily),Integer.class))
|
.setTotalStar(redisUtil.getMapEntry(RedisKey.FAMILY_FIGHT_TOTAL_STAR,"",String.valueOf(enemyFamily),Integer.class))
|
||||||
.setMyTotalStar(redisUtil.getMapEntry(RedisKey.FAMILY_FIGHT_TOTAL_STAR,"",String.valueOf(guildInfo.getId()),Integer.class))
|
.setMyTotalStar(redisUtil.getMapEntry(RedisKey.FAMILY_FIGHT_TOTAL_STAR,"",String.valueOf(guildInfo.getId()),Integer.class))
|
||||||
.build();
|
.build();
|
||||||
|
@ -490,7 +503,8 @@ public class GuildFightLogic {
|
||||||
*/
|
*/
|
||||||
public static void getFamilyFightRoundInfo(ISession session, MessageTypeProto.MessageType messageType) throws Exception {
|
public static void getFamilyFightRoundInfo(ISession session, MessageTypeProto.MessageType messageType) throws Exception {
|
||||||
RedisUtil redisUtil = RedisUtil.getInstence();
|
RedisUtil redisUtil = RedisUtil.getInstence();
|
||||||
int enemyFamily = getEnemyFamily(UserManager.getUser(session.getUid()).getPlayerInfoManager().getGuildId());
|
int guildId = UserManager.getUser(session.getUid()).getPlayerInfoManager().getGuildId();
|
||||||
|
int enemyFamily = getEnemyFamily(guildId);
|
||||||
Integer attackCount = redisUtil.getMapEntry(RedisKey.FAMILY_FIGHT_ATTACK_COUNT,"",String.valueOf(session.getUid()),Integer.class);
|
Integer attackCount = redisUtil.getMapEntry(RedisKey.FAMILY_FIGHT_ATTACK_COUNT,"",String.valueOf(session.getUid()),Integer.class);
|
||||||
if(attackCount==null){
|
if(attackCount==null){
|
||||||
attackCount = 0;
|
attackCount = 0;
|
||||||
|
@ -503,16 +517,19 @@ public class GuildFightLogic {
|
||||||
.setAttackCount(attackCount)
|
.setAttackCount(attackCount)
|
||||||
.setJoinType(1);
|
.setJoinType(1);
|
||||||
if (enemyFamily != -1) {
|
if (enemyFamily != -1) {
|
||||||
GuildInfo guildInfo = GuilidManager.guildInfoMap.get(enemyFamily);
|
GuildCache enemyInfo = RedisUtil.getInstence().getMapEntry(RedisKey.FAMILY_INFO, "", String.valueOf(enemyFamily), GuildCache.class);
|
||||||
Family.EnemyFamily familyInfo = Family.EnemyFamily.newBuilder()
|
// GuildInfo guildInfo = GuilidManager.guildInfoMap.get(enemyFamily);
|
||||||
.setId(guildInfo.getId())
|
if(enemyInfo!=null){
|
||||||
.setLevel(guildInfo.getLevel())
|
Family.EnemyFamily familyInfo = Family.EnemyFamily.newBuilder()
|
||||||
.setName(guildInfo.getName())
|
.setId(enemyFamily)
|
||||||
.setPictureId(1)
|
.setLevel(enemyInfo.getLevel())
|
||||||
.setTotalStar(redisUtil.getMapEntry(RedisKey.FAMILY_FIGHT_TOTAL_STAR,"",String.valueOf(enemyFamily),Integer.class))
|
.setName(enemyInfo.getName())
|
||||||
.setMyTotalStar(redisUtil.getMapEntry(RedisKey.FAMILY_FIGHT_TOTAL_STAR,"",String.valueOf(guildInfo.getId()),Integer.class))
|
.setPictureId(enemyInfo.getIcon())
|
||||||
.build();
|
.setTotalStar(redisUtil.getMapEntry(RedisKey.FAMILY_FIGHT_TOTAL_STAR,"",String.valueOf(enemyFamily),Integer.class))
|
||||||
response.setEnemy(familyInfo);
|
.setMyTotalStar(redisUtil.getMapEntry(RedisKey.FAMILY_FIGHT_TOTAL_STAR,"",String.valueOf(guildId),Integer.class))
|
||||||
|
.build();
|
||||||
|
response.setEnemy(familyInfo);
|
||||||
|
}
|
||||||
}else{
|
}else{
|
||||||
if(status!=0&&status!=1){
|
if(status!=0&&status!=1){
|
||||||
if(!startMatching){
|
if(!startMatching){
|
||||||
|
@ -643,11 +660,11 @@ public class GuildFightLogic {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
LOGGER.info("{}公会结算",str);
|
LOGGER.info("{}公会结算",str);
|
||||||
Map<Integer, Integer> enemyDefendInfo = GuilidManager.guildInfoMap.get(enemyFamily).getDefendInfo();
|
// Map<Integer, Integer> enemyDefendInfo = GuilidManager.guildInfoMap.get(enemyFamily).getDefendInfo();
|
||||||
for(Map.Entry<Integer, Integer> defend:enemyDefendInfo.entrySet()){
|
Map<Integer, FamilyFightInfo> fightInfo = redisUtil.getMapValues(RedisKey.FAMILY_FIGHT, "", Integer.class, FamilyFightInfo.class);
|
||||||
FamilyFightInfo mapEntry = redisUtil.getMapEntry(RedisKey.FAMILY_FIGHT, String.valueOf(enemyFamily), String.valueOf(defend.getKey()), FamilyFightInfo.class);
|
for(Map.Entry<Integer, FamilyFightInfo> defend:fightInfo.entrySet()){
|
||||||
if(mapEntry!=null){
|
if(defend!=null){
|
||||||
buildStar[defend.getValue()-1] = buildStar[defend.getValue()-1]+mapEntry.getStarCount();
|
buildStar[defend.getValue().getBuildId()-1] = buildStar[defend.getValue().getBuildId()-1]+defend.getValue().getStarCount();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for(int i = 0 ; i < buildStar.length;i++){
|
for(int i = 0 ; i < buildStar.length;i++){
|
||||||
|
@ -674,6 +691,9 @@ public class GuildFightLogic {
|
||||||
int getStar = getTotalStar(Integer.parseInt(str));
|
int getStar = getTotalStar(Integer.parseInt(str));
|
||||||
int loseStar = getTotalStar(enemyFamily);
|
int loseStar = getTotalStar(enemyFamily);
|
||||||
GuildInfo guildInfo = GuilidManager.guildInfoMap.get(Integer.parseInt(str));
|
GuildInfo guildInfo = GuilidManager.guildInfoMap.get(Integer.parseInt(str));
|
||||||
|
if(guildInfo==null){
|
||||||
|
continue;
|
||||||
|
}
|
||||||
LOGGER.info("公会{}获得星数:{},失去星数{}",str,getStar,loseStar);
|
LOGGER.info("公会{}获得星数:{},失去星数{}",str,getStar,loseStar);
|
||||||
//战绩结算
|
//战绩结算
|
||||||
int getExp = 0;
|
int getExp = 0;
|
||||||
|
@ -721,12 +741,21 @@ public class GuildFightLogic {
|
||||||
if(guildInfo.getExp()+getExp>=levelConfigMap.get(guildInfo.getLevel()).getExp()){
|
if(guildInfo.getExp()+getExp>=levelConfigMap.get(guildInfo.getLevel()).getExp()){
|
||||||
guildInfo.updateExp(guildInfo.getExp()+getExp-levelConfigMap.get(guildInfo.getLevel()).getExp());
|
guildInfo.updateExp(guildInfo.getExp()+getExp-levelConfigMap.get(guildInfo.getLevel()).getExp());
|
||||||
guildInfo.updateLevel(guildInfo.getLevel()+1);
|
guildInfo.updateLevel(guildInfo.getLevel()+1);
|
||||||
|
RedisUtil.getInstence().putMapEntry(RedisKey.FAMILY_INFO,"", String.valueOf(guildInfo.getId()),new GuildCache(GameApplication.serverId,guildInfo.getIcon(),guildInfo.getLevel(),guildInfo.getName()));
|
||||||
}else{
|
}else{
|
||||||
guildInfo.updateExp(guildInfo.getExp()+getExp);
|
guildInfo.updateExp(guildInfo.getExp()+getExp);
|
||||||
}
|
}
|
||||||
|
//个人奖励
|
||||||
|
// Set<ZSetOperations.TypedTuple<String>> zsetreverseRangeWithScores = RedisUtil.getInstence().getZsetreverseRangeWithScores(RedisKey.FAMILY_FIGHT_STAR_RANK, String.valueOf(guildId), 0, 20);
|
||||||
|
// Iterator<ZSetOperations.TypedTuple<String>> it = zsetreverseRangeWithScores.iterator();
|
||||||
|
// int rank = 1;
|
||||||
|
// Family.PersonalFightResultResponse.Builder response = Family.PersonalFightResultResponse.newBuilder();
|
||||||
|
// while (it.hasNext()){
|
||||||
|
// rank++;
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
MongoUtil.getLjsdMongoTemplate().lastUpdate();
|
MongoUtil.getLjsdMongoTemplate().lastUpdate();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询该公会个人战绩
|
* 查询该公会个人战绩
|
||||||
|
@ -746,15 +775,16 @@ public class GuildFightLogic {
|
||||||
while (it.hasNext()){
|
while (it.hasNext()){
|
||||||
ZSetOperations.TypedTuple<String> personal = it.next();
|
ZSetOperations.TypedTuple<String> personal = it.next();
|
||||||
int uid = Integer.parseInt(personal.getValue());
|
int uid = Integer.parseInt(personal.getValue());
|
||||||
PlayerManager playerInfoManager = UserManager.getUser(uid).getPlayerInfoManager();
|
PlayerInfoCache playerInfo = RedisUtil.getInstence().getMapEntry(RedisKey.PLAYER_INFO_CACHE, "", String.valueOf(uid), PlayerInfoCache.class);
|
||||||
|
// PlayerManager playerInfoManager = UserManager.getUser(uid).getPlayerInfoManager();
|
||||||
Family.PersonalFightResult.Builder fightResult = Family.PersonalFightResult.newBuilder()
|
Family.PersonalFightResult.Builder fightResult = Family.PersonalFightResult.newBuilder()
|
||||||
.setRank(rank)
|
.setRank(rank)
|
||||||
.setAttackCount(RedisUtil.getInstence().getMapEntry(RedisKey.FAMILY_FIGHT_ATTACK_COUNT,"",String.valueOf(uid),Integer.class))
|
.setAttackCount(RedisUtil.getInstence().getMapEntry(RedisKey.FAMILY_FIGHT_ATTACK_COUNT,"",String.valueOf(uid),Integer.class))
|
||||||
.setUid(uid)
|
.setUid(uid)
|
||||||
.setHead(1)
|
.setHead(1)
|
||||||
.setHeadFrame(playerInfoManager.getHeadFrame())
|
.setHeadFrame(playerInfo.getHeadFrame())
|
||||||
.setPosition(GuildLogic.getMemberType(Integer.parseInt(personal.getValue()),GuilidManager.guildInfoMap.get(playerInfoManager.getGuildId()).getMembers()))
|
.setPosition(playerInfo.getGuildPosition())
|
||||||
.setName(playerInfoManager.getNickName())
|
.setName(playerInfo.getName())
|
||||||
.setStarCount(personal.getScore().intValue());
|
.setStarCount(personal.getScore().intValue());
|
||||||
response.addResult(fightResult.build());
|
response.addResult(fightResult.build());
|
||||||
rank++;
|
rank++;
|
||||||
|
|
|
@ -1,7 +1,9 @@
|
||||||
package com.ljsd.jieling.logic.family;
|
package com.ljsd.jieling.logic.family;
|
||||||
|
|
||||||
import com.google.protobuf.GeneratedMessage;
|
import com.google.protobuf.GeneratedMessage;
|
||||||
|
import com.ljsd.GameApplication;
|
||||||
import com.ljsd.jieling.config.SErrorCodeEerverConfig;
|
import com.ljsd.jieling.config.SErrorCodeEerverConfig;
|
||||||
|
import com.ljsd.jieling.config.SGuildLevelConfig;
|
||||||
import com.ljsd.jieling.config.SGuildSetting;
|
import com.ljsd.jieling.config.SGuildSetting;
|
||||||
import com.ljsd.jieling.core.GlobalsDef;
|
import com.ljsd.jieling.core.GlobalsDef;
|
||||||
import com.ljsd.jieling.dataReport.reportBeans_37.ChatContentType;
|
import com.ljsd.jieling.dataReport.reportBeans_37.ChatContentType;
|
||||||
|
@ -13,10 +15,7 @@ import com.ljsd.jieling.globals.BIReason;
|
||||||
import com.ljsd.jieling.globals.Global;
|
import com.ljsd.jieling.globals.Global;
|
||||||
import com.ljsd.jieling.logic.OnlineUserManager;
|
import com.ljsd.jieling.logic.OnlineUserManager;
|
||||||
import com.ljsd.jieling.logic.dao.*;
|
import com.ljsd.jieling.logic.dao.*;
|
||||||
import com.ljsd.jieling.logic.dao.root.GuildApply;
|
import com.ljsd.jieling.logic.dao.root.*;
|
||||||
import com.ljsd.jieling.logic.dao.root.GuildInfo;
|
|
||||||
import com.ljsd.jieling.logic.dao.root.GuildLog;
|
|
||||||
import com.ljsd.jieling.logic.dao.root.User;
|
|
||||||
import com.ljsd.jieling.logic.mail.MailLogic;
|
import com.ljsd.jieling.logic.mail.MailLogic;
|
||||||
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;
|
||||||
|
@ -92,6 +91,10 @@ public class GuildLogic {
|
||||||
GuilidManager.addGuildInfo(guildInfo);
|
GuilidManager.addGuildInfo(guildInfo);
|
||||||
user.getPlayerInfoManager().setGuildId(guildInfo.getId());
|
user.getPlayerInfoManager().setGuildId(guildInfo.getId());
|
||||||
addGuildLog(guildInfo.getId(),GuildDef.Log.CREATE,user.getPlayerInfoManager().getNickName());
|
addGuildLog(guildInfo.getId(),GuildDef.Log.CREATE,user.getPlayerInfoManager().getNickName());
|
||||||
|
RedisUtil.getInstence().putMapEntry(RedisKey.FAMILY_INFO,"",String.valueOf(guildInfo.getId()),new GuildCache(GameApplication.serverId,guildInfo.getIcon(),guildInfo.getLevel(),guildInfo.getName()));
|
||||||
|
PlayerInfoCache cache = RedisUtil.getInstence().getMapEntry(RedisKey.PLAYER_INFO_CACHE, "", String.valueOf(uid), PlayerInfoCache.class);
|
||||||
|
cache.setGuildPosition(GlobalsDef.CHAIRMAN);
|
||||||
|
RedisUtil.getInstence().putMapEntry(RedisKey.PLAYER_INFO_CACHE,"",String.valueOf(uid),cache);
|
||||||
Family.FamilyCreateResponse build = Family.FamilyCreateResponse.newBuilder()
|
Family.FamilyCreateResponse build = Family.FamilyCreateResponse.newBuilder()
|
||||||
.setFamilyBaseInfo(CBean2Proto.getFamilyBaseInfo(guildInfo))
|
.setFamilyBaseInfo(CBean2Proto.getFamilyBaseInfo(guildInfo))
|
||||||
.setFamilyUserInfo(CBean2Proto.getFamilyUserInfo(user,GlobalsDef.CHAIRMAN))
|
.setFamilyUserInfo(CBean2Proto.getFamilyUserInfo(user,GlobalsDef.CHAIRMAN))
|
||||||
|
@ -193,7 +196,7 @@ public class GuildLogic {
|
||||||
Map<Integer, GuildApply> applyGuildPersonInfos = GuilidManager.getApplyGuildInfos(session.getUid(), 1);
|
Map<Integer, GuildApply> applyGuildPersonInfos = GuilidManager.getApplyGuildInfos(session.getUid(), 1);
|
||||||
SGuildSetting guildSetting = SGuildSetting.sGuildSetting;
|
SGuildSetting guildSetting = SGuildSetting.sGuildSetting;
|
||||||
if(applyGuildPersonInfos.size()>=guildSetting.getApplyLimit()){
|
if(applyGuildPersonInfos.size()>=guildSetting.getApplyLimit()){
|
||||||
MessageUtil.sendErrorResponse(session,0,msgId,"已达申请上线,无法继续申请");
|
MessageUtil.sendErrorResponse(session,0,msgId,"您当前申请上线,无法继续申请");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
for(Integer applyGuildId : applyGuilds){
|
for(Integer applyGuildId : applyGuilds){
|
||||||
|
@ -232,6 +235,9 @@ public class GuildLogic {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
//todo 判读人数是否已达上限
|
//todo 判读人数是否已达上限
|
||||||
|
if(guildInfo.getTotalMembers()>=SGuildLevelConfig.sGuildLevelConfigMap.get(guildInfo.getLevel()).getNum()){
|
||||||
|
MessageUtil.sendErrorResponse(session,0,msgId,"该工会人数已达上限");
|
||||||
|
}
|
||||||
boolean isSuccess = RedisUtil.getInstence().tryGetDistributedLock(RedisKey.OPERATE_FAMILY, Integer.toString(guildId), Integer.toString(uid), 500);
|
boolean isSuccess = RedisUtil.getInstence().tryGetDistributedLock(RedisKey.OPERATE_FAMILY, Integer.toString(guildId), Integer.toString(uid), 500);
|
||||||
if(!isSuccess){
|
if(!isSuccess){
|
||||||
MessageUtil.sendErrorResponse(session,0, msgId,"请稍后重试");
|
MessageUtil.sendErrorResponse(session,0, msgId,"请稍后重试");
|
||||||
|
@ -246,6 +252,9 @@ public class GuildLogic {
|
||||||
}
|
}
|
||||||
RedisUtil.getInstence().expire(RedisKey.getKey(RedisKey.FAMILY_JOIN,String.valueOf(uid),false),TimeUtils.DAY);
|
RedisUtil.getInstence().expire(RedisKey.getKey(RedisKey.FAMILY_JOIN,String.valueOf(uid),false),TimeUtils.DAY);
|
||||||
addGuildLog(guildInfo.getId(),GuildDef.Log.JOIN,user.getPlayerInfoManager().getNickName());
|
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.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();
|
Family.FamilyJoinResponse response = Family.FamilyJoinResponse.newBuilder().setFamilyJoinIndicaion(build).build();
|
||||||
MessageUtil.sendMessage(session,1,msgId,response,true);
|
MessageUtil.sendMessage(session,1,msgId,response,true);
|
||||||
|
@ -362,6 +371,7 @@ public class GuildLogic {
|
||||||
int msgId = MessageTypeProto.MessageType.FAMILY_OPERATION_APPLY_LIST_RESPONSE_VALUE;
|
int msgId = MessageTypeProto.MessageType.FAMILY_OPERATION_APPLY_LIST_RESPONSE_VALUE;
|
||||||
if(getMemberType(uid,guildInfo.getMembers())>=GlobalsDef.MEMBER) {
|
if(getMemberType(uid,guildInfo.getMembers())>=GlobalsDef.MEMBER) {
|
||||||
MessageUtil.sendErrorResponse(session,0,msgId,"你无权操作申请");
|
MessageUtil.sendErrorResponse(session,0,msgId,"你无权操作申请");
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
if(guildId == 0){
|
if(guildId == 0){
|
||||||
MessageUtil.sendErrorResponse(session,0,msgId,"未加入公会");
|
MessageUtil.sendErrorResponse(session,0,msgId,"未加入公会");
|
||||||
|
@ -372,6 +382,10 @@ public class GuildLogic {
|
||||||
MessageUtil.sendErrorResponse(session,0, msgId,"请稍后重试");
|
MessageUtil.sendErrorResponse(session,0, msgId,"请稍后重试");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if(GuildFightLogic.getStatus()!=0&&(type==1||type==3)){
|
||||||
|
MessageUtil.sendErrorResponse(session,0, msgId,"公会战期间不允许加入成员");
|
||||||
|
return;
|
||||||
|
}
|
||||||
try {
|
try {
|
||||||
Map<Integer, GuildApply> applyGuild = GuilidManager.getApplyGuildInfos(guildId, 0);
|
Map<Integer, GuildApply> applyGuild = GuilidManager.getApplyGuildInfos(guildId, 0);
|
||||||
switch (type){
|
switch (type){
|
||||||
|
@ -381,6 +395,10 @@ public class GuildLogic {
|
||||||
for(Set<Integer> memberOfType : members.values()){
|
for(Set<Integer> memberOfType : members.values()){
|
||||||
count+=memberOfType.size();
|
count+=memberOfType.size();
|
||||||
}
|
}
|
||||||
|
if(guildInfo.getTotalMembers()+applyGuild.size()>SGuildLevelConfig.sGuildLevelConfigMap.get(guildInfo.getLevel()).getNum()){
|
||||||
|
MessageUtil.sendErrorResponse(session,0,msgId,"全部同意后公会人数将大于最大人数,请单个同意");
|
||||||
|
return;
|
||||||
|
}
|
||||||
for(Integer addUid : applyGuild.keySet()){
|
for(Integer addUid : applyGuild.keySet()){
|
||||||
if(30-count<=0){
|
if(30-count<=0){
|
||||||
break;
|
break;
|
||||||
|
@ -402,6 +420,10 @@ public class GuildLogic {
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 3: //同意一个
|
case 3: //同意一个
|
||||||
|
if(guildInfo.getTotalMembers()>=SGuildLevelConfig.sGuildLevelConfigMap.get(guildInfo.getLevel()).getNum()){
|
||||||
|
MessageUtil.sendErrorResponse(session,0,msgId,"公会人数已满,无法加入");
|
||||||
|
return;
|
||||||
|
}
|
||||||
applyToJoin(guildInfo,applyId,true);
|
applyToJoin(guildInfo,applyId,true);
|
||||||
Map<Integer, GuildApply> applyPersonal = GuilidManager.getApplyGuildInfos(applyId, 1);
|
Map<Integer, GuildApply> applyPersonal = GuilidManager.getApplyGuildInfos(applyId, 1);
|
||||||
for(Map.Entry<Integer, GuildApply> personalEntry:applyPersonal.entrySet()) {
|
for(Map.Entry<Integer, GuildApply> personalEntry:applyPersonal.entrySet()) {
|
||||||
|
@ -482,6 +504,10 @@ public class GuildLogic {
|
||||||
MessageUtil.sendErrorResponse(session,0,msgId,"该人已被踢出");
|
MessageUtil.sendErrorResponse(session,0,msgId,"该人已被踢出");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if(GuildFightLogic.getStatus()!=0){
|
||||||
|
MessageUtil.sendErrorResponse(session,0, msgId,"公会战期间不允许踢出成员");
|
||||||
|
return;
|
||||||
|
}
|
||||||
//如果有防守信息则删除
|
//如果有防守信息则删除
|
||||||
if(guildInfo.getDefendInfo().containsKey((targetUid))){
|
if(guildInfo.getDefendInfo().containsKey((targetUid))){
|
||||||
guildInfo.removeDefendInfo(targetUid);
|
guildInfo.removeDefendInfo(targetUid);
|
||||||
|
@ -520,8 +546,20 @@ public class GuildLogic {
|
||||||
MessageUtil.sendErrorResponse(session,0,msgId,"无权操作");
|
MessageUtil.sendErrorResponse(session,0,msgId,"无权操作");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if(GuildFightLogic.getStatus()!=0){
|
||||||
|
MessageUtil.sendErrorResponse(session,0, msgId,"公会战期间不允许任命");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if(guildInfo.getMembers().get(2)!=null&&guildInfo.getMembers().get(2).size()>=SGuildLevelConfig.sGuildLevelConfigMap.get(guildInfo.getLevel()).getOfficalNum()){
|
||||||
|
MessageUtil.sendErrorResponse(session,0,msgId,"官员人数已上限");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
guildInfo.removeMember(targetType,targetUid);
|
guildInfo.removeMember(targetType,targetUid);
|
||||||
guildInfo.addMembers(position,targetUid);
|
guildInfo.addMembers(position,targetUid);
|
||||||
|
PlayerInfoCache cache = RedisUtil.getInstence().getMapEntry(RedisKey.PLAYER_INFO_CACHE, "", String.valueOf(uid), PlayerInfoCache.class);
|
||||||
|
cache.setGuildPosition(position);
|
||||||
|
RedisUtil.getInstence().putMapEntry(RedisKey.PLAYER_INFO_CACHE,"",String.valueOf(uid),cache);
|
||||||
sendPositionChange(targetUid,position);
|
sendPositionChange(targetUid,position);
|
||||||
User targetUser = UserManager.getUser(targetUid);
|
User targetUser = UserManager.getUser(targetUid);
|
||||||
if(position == GlobalsDef.CHAIRMAN){
|
if(position == GlobalsDef.CHAIRMAN){
|
||||||
|
@ -716,6 +754,9 @@ public class GuildLogic {
|
||||||
if(guildInfo.getDefendInfo().containsKey((uid))){
|
if(guildInfo.getDefendInfo().containsKey((uid))){
|
||||||
guildInfo.removeDefendInfo(uid);
|
guildInfo.removeDefendInfo(uid);
|
||||||
}
|
}
|
||||||
|
PlayerInfoCache cache = RedisUtil.getInstence().getMapEntry(RedisKey.PLAYER_INFO_CACHE, "", String.valueOf(uid), PlayerInfoCache.class);
|
||||||
|
cache.setGuildPosition(0);
|
||||||
|
RedisUtil.getInstence().putMapEntry(RedisKey.PLAYER_INFO_CACHE,"",String.valueOf(uid),cache);
|
||||||
guildInfo.removeMember(uidType,uid);
|
guildInfo.removeMember(uidType,uid);
|
||||||
user.getPlayerInfoManager().setGuildId(0);
|
user.getPlayerInfoManager().setGuildId(0);
|
||||||
user.getGuildMyInfo().clearOfLevelGuild();
|
user.getGuildMyInfo().clearOfLevelGuild();
|
||||||
|
@ -857,14 +898,16 @@ public class GuildLogic {
|
||||||
public static void changeFamilyIcon(ISession session, int iconId, MessageTypeProto.MessageType messageType) throws Exception {
|
public static void changeFamilyIcon(ISession session, int iconId, MessageTypeProto.MessageType messageType) throws Exception {
|
||||||
User user = UserManager.getUser(session.getUid());
|
User user = UserManager.getUser(session.getUid());
|
||||||
PlayerManager playerInfoManager = user.getPlayerInfoManager();
|
PlayerManager playerInfoManager = user.getPlayerInfoManager();
|
||||||
GuilidManager.guildInfoMap.get(playerInfoManager.getGuildId()).updateIcon(iconId);
|
|
||||||
int[] cost = SGuildSetting.sGuildSetting.getTotemCost();
|
int[] cost = SGuildSetting.sGuildSetting.getTotemCost();
|
||||||
int[][] cost1 = new int[1][];
|
int[][] cost1 = new int[1][];
|
||||||
cost1[0] = cost;
|
cost1[0] = cost;
|
||||||
boolean b = ItemUtil.itemCost(user, cost1, BIReason.FAMILY_SET_ICON, 1);
|
boolean b = ItemUtil.itemCost(user, cost1, BIReason.FAMILY_SET_ICON, 1);
|
||||||
if (!b){
|
if (!b){
|
||||||
MessageUtil.sendErrorResponse(session,0,messageType.getNumber(),"消耗物品不足");
|
MessageUtil.sendErrorResponse(session,0,messageType.getNumber(),"消耗物品不足");
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
GuilidManager.guildInfoMap.get(playerInfoManager.getGuildId()).updateIcon(iconId);
|
||||||
|
RedisUtil.getInstence().putMapEntry(RedisKey.FAMILY_INFO,"", String.valueOf(playerInfoManager.getGuildId()),new GuildCache(GameApplication.serverId,iconId,GuilidManager.guildInfoMap.get(playerInfoManager.getGuildId()).getLevel(),GuilidManager.guildInfoMap.get(playerInfoManager.getGuildId()).getName()));
|
||||||
MessageUtil.sendMessage(session,1,messageType.getNumber(),null,true);
|
MessageUtil.sendMessage(session,1,messageType.getNumber(),null,true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -129,25 +129,25 @@ public class CombatLogic {
|
||||||
int contiue = sFoodsConfig.getContiue();
|
int contiue = sFoodsConfig.getContiue();
|
||||||
if(contiue==0){
|
if(contiue==0){
|
||||||
contiue=-1;
|
contiue=-1;
|
||||||
// int teamId = mapManager.getTeamId();
|
int teamId = mapManager.getTeamId();
|
||||||
// List<TeamPosHeroInfo> teamPosHeroInfoList = user.getTeamPosManager().getTeamPosForHero().get(teamId);
|
List<TeamPosHeroInfo> teamPosHeroInfoList = user.getTeamPosManager().getTeamPosForHero().get(teamId);
|
||||||
// Map<Integer,Integer> foodAddMap = new HashMap<>();
|
Map<Integer,Integer> foodAddMap = new HashMap<>();
|
||||||
// getFoodAttributeAdd(GlobalsDef.FOOD_ADDITION_BATTLE_TYPE, GlobalsDef.FOOD_EAT_AFFECT_PERSON, foodAddMap, sFoodsConfig);
|
getFoodAttributeAdd(GlobalsDef.FOOD_ADDITION_BATTLE_TYPE, GlobalsDef.FOOD_EAT_AFFECT_PERSON, foodAddMap, sFoodsConfig);
|
||||||
// for (TeamPosHeroInfo heroInfo : teamPosHeroInfoList) {
|
for (TeamPosHeroInfo heroInfo : teamPosHeroInfoList) {
|
||||||
// Hero hero = user.getHeroManager().getHero(heroInfo.getHeroId());
|
Hero hero = user.getHeroManager().getHero(heroInfo.getHeroId());
|
||||||
// if (hero == null) {
|
if (hero == null) {
|
||||||
// continue;
|
continue;
|
||||||
// }
|
}
|
||||||
// Map<Integer, Integer> heroAllAttribute = user.getMapManager().getHeroAllAttributeByHeroId(hero.getId());
|
Map<Integer, Integer> heroAllAttribute = user.getMapManager().getHeroAllAttributeByHeroId(hero.getId());
|
||||||
// if(heroAllAttribute == null || heroAllAttribute.get(HeroAttributeEnum.CurHP.getPropertyId()) <= 0){
|
if(heroAllAttribute == null || heroAllAttribute.get(HeroAttributeEnum.CurHP.getPropertyId()) <= 0){
|
||||||
// continue;
|
continue;
|
||||||
// }
|
}
|
||||||
//
|
|
||||||
// HeroLogic.getInstance().combinedAttribute(foodAddMap,heroAllAttribute);
|
HeroLogic.getInstance().combinedAttribute(foodAddMap,heroAllAttribute);
|
||||||
// HeroLogic.getInstance().calInteractAdd(heroAllAttribute);
|
HeroLogic.getInstance().calInteractAdd(heroAllAttribute);
|
||||||
// heroAllAttributeMap.put(hero.getId(), heroAllAttribute);
|
heroAllAttributeMap.put(hero.getId(), heroAllAttribute);
|
||||||
// }
|
}
|
||||||
// mapManager.setHeroAllAttributeMap(heroAllAttributeMap);
|
mapManager.setHeroAllAttributeMap(heroAllAttributeMap);
|
||||||
}
|
}
|
||||||
mapManager.eatFood(foodIdOrEventId,contiue);
|
mapManager.eatFood(foodIdOrEventId,contiue);
|
||||||
}
|
}
|
||||||
|
|
|
@ -523,6 +523,7 @@ public class PlayerLogic {
|
||||||
cache.setName(playerInfoManager.getNickName());
|
cache.setName(playerInfoManager.getNickName());
|
||||||
cache.setLevel(playerInfoManager.getLevel());
|
cache.setLevel(playerInfoManager.getLevel());
|
||||||
cache.setServerId(GameApplication.serverId);
|
cache.setServerId(GameApplication.serverId);
|
||||||
|
cache.setGuildPosition(0);
|
||||||
RedisUtil.getInstence().putMapEntry(RedisKey.PLAYER_INFO_CACHE,"",String.valueOf(user.getId()),cache);
|
RedisUtil.getInstence().putMapEntry(RedisKey.PLAYER_INFO_CACHE,"",String.valueOf(user.getId()),cache);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -70,21 +70,6 @@ public class MinuteTask extends Thread {
|
||||||
CoreLogic.getInstance().checkCoreCdk();
|
CoreLogic.getInstance().checkCoreCdk();
|
||||||
BuyGoodsLogic.minuteCheckReharge();
|
BuyGoodsLogic.minuteCheckReharge();
|
||||||
RedisUtil.getInstence().set(RedisKey.ONLINE_NUM+RedisKey.Delimiter_colon+GameApplication.serverId, String.valueOf(OnlineUserManager.sessionMap.entrySet().size()));
|
RedisUtil.getInstence().set(RedisKey.ONLINE_NUM+RedisKey.Delimiter_colon+GameApplication.serverId, String.valueOf(OnlineUserManager.sessionMap.entrySet().size()));
|
||||||
ServerConfig serverConfigTmp = MongoUtil.getInstence().getMyMongoTemplate().findById(1, ServerConfig.class);
|
|
||||||
if(serverConfigTmp.getWorldLevel()==1){
|
|
||||||
Query query = new Query();
|
|
||||||
query.with(new Sort(Sort.Direction.DESC,"playerManager.level"));
|
|
||||||
query.fields().include("playerManager.level");
|
|
||||||
List<User> users = MongoUtil.getLjsdMongoTemplate().findAllByCondition(query, User.class);
|
|
||||||
int size = (int)(users.size()*0.85);
|
|
||||||
int level = 0;
|
|
||||||
for(int i = 0 ; i <size;i++){
|
|
||||||
level+=users.get(i).getPlayerInfoManager().getLevel();
|
|
||||||
}
|
|
||||||
LOGGER.info("计算世界等级为{}",level/size);
|
|
||||||
serverConfigTmp.setWorldLevel(level/size);
|
|
||||||
MongoUtil.getLjsdMongoTemplate().save(serverConfigTmp);
|
|
||||||
}
|
|
||||||
LOGGER.info("MinuteTask end...");
|
LOGGER.info("MinuteTask end...");
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
LOGGER.error("e",e);
|
LOGGER.error("e",e);
|
||||||
|
|
|
@ -139,6 +139,9 @@ public class ItemUtil {
|
||||||
|
|
||||||
private static void combineRewardDropGroup(User user, int[] dropGroupIds, float dropRatio, Map<Integer, Integer> itemMap, Map<Integer, Integer> cardMap, Map<Integer, Integer> equipMap, Map<Integer, Integer> randomMap) {
|
private static void combineRewardDropGroup(User user, int[] dropGroupIds, float dropRatio, Map<Integer, Integer> itemMap, Map<Integer, Integer> cardMap, Map<Integer, Integer> equipMap, Map<Integer, Integer> randomMap) {
|
||||||
for (int dropGroupId : dropGroupIds) {
|
for (int dropGroupId : dropGroupIds) {
|
||||||
|
if(SEndlessDifficulty.difficultyReward.containsKey(dropGroupId)){
|
||||||
|
dropGroupId = SEndlessDifficulty.difficultyReward.get(dropGroupId);
|
||||||
|
}
|
||||||
SRewardGroup sRewardGroup = SRewardGroup.getsRewardItemMap().get(dropGroupId);
|
SRewardGroup sRewardGroup = SRewardGroup.getsRewardItemMap().get(dropGroupId);
|
||||||
if (sRewardGroup == null) {
|
if (sRewardGroup == null) {
|
||||||
continue;
|
continue;
|
||||||
|
|
|
@ -1,7 +1,9 @@
|
||||||
package com.ljsd.jieling.util;
|
package com.ljsd.jieling.util;
|
||||||
|
|
||||||
|
import com.ljsd.jieling.config.SEndlessDifficulty;
|
||||||
import com.ljsd.jieling.config.SMonsterConfig;
|
import com.ljsd.jieling.config.SMonsterConfig;
|
||||||
import com.ljsd.jieling.config.SMonsterGroup;
|
import com.ljsd.jieling.config.SMonsterGroup;
|
||||||
|
import com.ljsd.jieling.handler.map.MapLogic;
|
||||||
import com.ljsd.jieling.protocols.CommonProto;
|
import com.ljsd.jieling.protocols.CommonProto;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
@ -77,6 +79,9 @@ public class MonsterUtil {
|
||||||
Map<Integer, SMonsterConfig> integerSMonsterConfigMap = SMonsterConfig.getsMonsterConfigMap();
|
Map<Integer, SMonsterConfig> integerSMonsterConfigMap = SMonsterConfig.getsMonsterConfigMap();
|
||||||
int maxForce = 0;
|
int maxForce = 0;
|
||||||
for(int i = 0 ; i < groupIds.length;i++){
|
for(int i = 0 ; i < groupIds.length;i++){
|
||||||
|
if(SEndlessDifficulty.difficultyMonster.containsKey(groupIds[i])){
|
||||||
|
groupIds[i]= SEndlessDifficulty.difficultyMonster.get(groupIds[i]);
|
||||||
|
}
|
||||||
SMonsterGroup sMonsterGroup = integerSMonsterGroupMap.get(groupIds[i]);
|
SMonsterGroup sMonsterGroup = integerSMonsterGroupMap.get(groupIds[i]);
|
||||||
int[][] contents = sMonsterGroup.getContents();
|
int[][] contents = sMonsterGroup.getContents();
|
||||||
int totalMonsterForce = 0;
|
int totalMonsterForce = 0;
|
||||||
|
|
Loading…
Reference in New Issue