Merge branch 'master' of 60.1.1.230:backend/jieling_server
commit
4cdb969929
|
@ -114,6 +114,8 @@ public class RedisKey {
|
||||||
public static final String FAMILY_ID = "FAMILY_ID";
|
public static final String FAMILY_ID = "FAMILY_ID";
|
||||||
|
|
||||||
public static final String FAMILY_FIGHT = "FAMILY_FIGHT" ;
|
public static final String FAMILY_FIGHT = "FAMILY_FIGHT" ;
|
||||||
|
public static final String FAMILY_FIGHT_RANK = "FAMILY_FIGHT_RANK";
|
||||||
|
|
||||||
public static final String OPERATE_FAMILY = "OPERATE_FAMILY";
|
public static final String OPERATE_FAMILY = "OPERATE_FAMILY";
|
||||||
public static final String OPERATE_FAMILY_APPLY = "OPERATE_FAMILY_APPLY";
|
public static final String OPERATE_FAMILY_APPLY = "OPERATE_FAMILY_APPLY";
|
||||||
public static final String OPERATE_FAMILY_APPLY_JOIN = "OPERATE_FAMILY_APPLY_JOIN";
|
public static final String OPERATE_FAMILY_APPLY_JOIN = "OPERATE_FAMILY_APPLY_JOIN";
|
||||||
|
|
|
@ -17,7 +17,7 @@ public class FamilyDefendInfoHandler extends BaseHandler {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void process(ISession iSession, PacketNetData netData) throws Exception {
|
public void process(ISession iSession, PacketNetData netData) throws Exception {
|
||||||
byte[] bytes = netData.parseClientProtoNetData();
|
|
||||||
GuildLogic.viewDefendInfo(iSession,MessageTypeProto.MessageType.FAMILY_VIEW_DEFEND_RESPONSE);
|
GuildLogic.viewDefendInfo(iSession,MessageTypeProto.MessageType.FAMILY_VIEW_DEFEND_RESPONSE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,21 @@
|
||||||
|
package com.ljsd.jieling.handler.family;
|
||||||
|
|
||||||
|
import com.ljsd.jieling.handler.BaseHandler;
|
||||||
|
import com.ljsd.jieling.logic.family.GuildLogic;
|
||||||
|
import com.ljsd.jieling.netty.cocdex.PacketNetData;
|
||||||
|
import com.ljsd.jieling.network.session.ISession;
|
||||||
|
import com.ljsd.jieling.protocols.MessageTypeProto;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
@Component
|
||||||
|
public class FamilyFightInfoHandler extends BaseHandler {
|
||||||
|
@Override
|
||||||
|
public MessageTypeProto.MessageType getMessageCode() {
|
||||||
|
return MessageTypeProto.MessageType.FAMILY_FIGHT_INFO_REQUEST;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void process(ISession iSession, PacketNetData netData) throws Exception {
|
||||||
|
GuildLogic.viewFightInfo(iSession, MessageTypeProto.MessageType.FAMILY_FIGHT_INFO_RESPONSE);
|
||||||
|
}
|
||||||
|
}
|
|
@ -12,13 +12,15 @@ public class FinishOptionsDifficultMapProcessor implements BaseMissionProcesor{
|
||||||
public int checkAndUpdateMissionProcessor(User user, SAccomplishmentConfig sAccomplishmentConfig, int eventId, int time, MapMissionType mapMissionType,int missionValue) {
|
public int checkAndUpdateMissionProcessor(User user, SAccomplishmentConfig sAccomplishmentConfig, int eventId, int time, MapMissionType mapMissionType,int missionValue) {
|
||||||
MapManager mapManager = user.getMapManager();
|
MapManager mapManager = user.getMapManager();
|
||||||
SChallengeConfig sChallengeConfig = SChallengeConfig.sChallengeConfigs.get(mapManager.getCurMapId());
|
SChallengeConfig sChallengeConfig = SChallengeConfig.sChallengeConfigs.get(mapManager.getCurMapId());
|
||||||
if(sChallengeConfig.getDifficultType()!=sAccomplishmentConfig.getValues()[sAccomplishmentConfig.getValues().length-1][0]){
|
int[][] configValues = sAccomplishmentConfig.getValues();
|
||||||
|
|
||||||
|
if(configValues[configValues.length-1][0]!=0&&sChallengeConfig.getDifficultType()!= configValues[configValues.length-1][0]){
|
||||||
return GlobalsDef.MAP_MISSION_RETURN;
|
return GlobalsDef.MAP_MISSION_RETURN;
|
||||||
}
|
}
|
||||||
if(missionValue==-1){
|
if(missionValue==-1){
|
||||||
return GlobalsDef.MAP_MISSION_RETURN;
|
return GlobalsDef.MAP_MISSION_RETURN;
|
||||||
}
|
}
|
||||||
int[][] value = sAccomplishmentConfig.getValues();
|
int[][] value = configValues;
|
||||||
missionValue = 0-missionValue;
|
missionValue = 0-missionValue;
|
||||||
for(int i = 0 ; i <value.length-1;i++){
|
for(int i = 0 ; i <value.length-1;i++){
|
||||||
for(int j =0;j<value[i].length;j++){
|
for(int j =0;j<value[i].length;j++){
|
||||||
|
|
|
@ -121,6 +121,7 @@ public class ActivityLogic {
|
||||||
long now = TimeUtils.now();
|
long now = TimeUtils.now();
|
||||||
ActivityManager activityManager = user.getActivityManager();
|
ActivityManager activityManager = user.getActivityManager();
|
||||||
Map<Integer, SGlobalActivity> sGlobalActivityMap = SGlobalActivity.getsGlobalActivityMap();
|
Map<Integer, SGlobalActivity> sGlobalActivityMap = SGlobalActivity.getsGlobalActivityMap();
|
||||||
|
Set<Integer> openNewActivityIds = new HashSet<>();
|
||||||
for (Integer openActivityId : openActivityIds) {
|
for (Integer openActivityId : openActivityIds) {
|
||||||
SGlobalActivity sGlobalActivity = sGlobalActivityMap.get(openActivityId);
|
SGlobalActivity sGlobalActivity = sGlobalActivityMap.get(openActivityId);
|
||||||
|
|
||||||
|
@ -136,10 +137,11 @@ public class ActivityLogic {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
abstractActivity.initActivity(user);
|
abstractActivity.initActivity(user);
|
||||||
|
//非角色活动开启通知
|
||||||
|
openNewActivityIds.add(openActivityId);
|
||||||
}
|
}
|
||||||
Map<Integer, ActivityMission> activityMissionMap = activityManager.getActivityMissionMap();
|
Map<Integer, ActivityMission> activityMissionMap = activityManager.getActivityMissionMap();
|
||||||
long userCreateTime = user.getPlayerInfoManager().getCreateTime();
|
long userCreateTime = user.getPlayerInfoManager().getCreateTime();
|
||||||
Set<Integer> openNewActivityIds = new HashSet<>();
|
|
||||||
for (SGlobalActivity sGlobalActivity : sGlobalActivityMap.values()) {
|
for (SGlobalActivity sGlobalActivity : sGlobalActivityMap.values()) {
|
||||||
int activityId = sGlobalActivity.getId();
|
int activityId = sGlobalActivity.getId();
|
||||||
if (openActivityIds.contains(activityId)) {
|
if (openActivityIds.contains(activityId)) {
|
||||||
|
|
|
@ -87,8 +87,8 @@ class ExpectRankActivity extends AbstractActivity {
|
||||||
SActivityRankingReward sActivityRankingReward1 = SActivityRankingReward.getsActivityRankingRewardMap().get(missionId);
|
SActivityRankingReward sActivityRankingReward1 = SActivityRankingReward.getsActivityRankingRewardMap().get(missionId);
|
||||||
//sendmail
|
//sendmail
|
||||||
SGlobalActivity sGlobalActivity = SGlobalActivity.getsGlobalActivityMap().get(id);
|
SGlobalActivity sGlobalActivity = SGlobalActivity.getsGlobalActivityMap().get(id);
|
||||||
String content = SErrorCodeEerverConfig.getI18NMessage("expertrank_activity_title");
|
String title = SErrorCodeEerverConfig.getI18NMessage("expertrank_activity_title");
|
||||||
String title = SErrorCodeEerverConfig.getI18NMessage("expertrank_activity_txt", new Object[]{sGlobalActivity.getSesc(), rank++});
|
String content = SErrorCodeEerverConfig.getI18NMessage("expertrank_activity_txt", new Object[]{sGlobalActivity.getSesc(), rank++});
|
||||||
String mailReward = ItemUtil.getMailReward(sActivityRankingReward1.getRankingReward());
|
String mailReward = ItemUtil.getMailReward(sActivityRankingReward1.getRankingReward());
|
||||||
MailLogic.getInstance().sendMail(uid, title, content, mailReward, nowTime, Global.MAIL_EFFECTIVE_TIME);
|
MailLogic.getInstance().sendMail(uid, title, content, mailReward, nowTime, Global.MAIL_EFFECTIVE_TIME);
|
||||||
}
|
}
|
||||||
|
|
|
@ -94,8 +94,8 @@ class ForceRankActivity extends AbstractActivity {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
//sendmail
|
//sendmail
|
||||||
String content = SErrorCodeEerverConfig.getI18NMessage("powerrank_activity_title");
|
String title = SErrorCodeEerverConfig.getI18NMessage("powerrank_activity_title");
|
||||||
String title = SErrorCodeEerverConfig.getI18NMessage("powerrank_activity_txt", new Object[]{rank});
|
String content = SErrorCodeEerverConfig.getI18NMessage("powerrank_activity_txt", new Object[]{rank});
|
||||||
String mailReward = ItemUtil.getMailReward(sActivityRewardConfig.getReward());
|
String mailReward = ItemUtil.getMailReward(sActivityRewardConfig.getReward());
|
||||||
MailLogic.getInstance().sendMail(uid, title, content, mailReward, nowTime, Global.MAIL_EFFECTIVE_TIME);
|
MailLogic.getInstance().sendMail(uid, title, content, mailReward, nowTime, Global.MAIL_EFFECTIVE_TIME);
|
||||||
//暂时不删
|
//暂时不删
|
||||||
|
|
|
@ -863,7 +863,54 @@ public class GuildLogic {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
private static Family.FamilyFightInfo familyFightDetailInfo(int guildId) throws Exception {
|
||||||
|
GuildInfo guildInfo = GuilidManager.guildInfoMap.get(guildId);
|
||||||
|
Map<Integer, Integer> defendInfo = guildInfo.getDefendInfo();
|
||||||
|
Family.FamilyFightInfo.Builder fightInfo = Family.FamilyFightInfo.newBuilder();
|
||||||
|
fightInfo.setGid(guildId);
|
||||||
|
for(int i = 0 ; i <3 ;i ++){
|
||||||
|
Family.FamilyBuildBuffInfo.Builder buffInfo = Family.FamilyBuildBuffInfo.newBuilder();
|
||||||
|
buffInfo.setBuildId(i+1);
|
||||||
|
buffInfo.setBuffId(i+1);
|
||||||
|
fightInfo.addBuildBuff(buffInfo);
|
||||||
|
}
|
||||||
|
for(Map.Entry<Integer, Integer> entry:defendInfo.entrySet()){
|
||||||
|
Family.FamilyFightPlayerInfo.Builder playerInfo = Family.FamilyFightPlayerInfo.newBuilder();
|
||||||
|
playerInfo.setBuildId(entry.getValue());
|
||||||
|
playerInfo.setBuildId(5);
|
||||||
|
PlayerManager playerManager = UserManager.getUser(entry.getKey()).getPlayerInfoManager();
|
||||||
|
Family.FamilyUserInfo.Builder userInfo =Family.FamilyUserInfo.newBuilder()
|
||||||
|
.setRoleUid(entry.getKey())
|
||||||
|
.setUserName(playerManager.getNickName())
|
||||||
|
.setUserLevel(playerManager.getLevel())
|
||||||
|
.setPosition(2)
|
||||||
|
.setSoulForce(HeroLogic.getInstance().calTeamTotalForce(UserManager.getUser(entry.getKey()),501,false))
|
||||||
|
.setHead(playerManager.getHead())
|
||||||
|
.setFrame(playerManager.getHeadFrame());
|
||||||
|
playerInfo.setUserInfo(userInfo);
|
||||||
|
fightInfo.addUser(playerInfo);
|
||||||
|
}
|
||||||
|
return fightInfo.build();
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 公会战查看双方对战信息
|
||||||
|
* @param session
|
||||||
|
* @param messageType
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
public static void viewFightInfo(ISession session, MessageTypeProto.MessageType messageType) throws Exception {
|
||||||
|
User user = UserManager.getUser(session.getUid());
|
||||||
|
int guildId = user.getPlayerInfoManager().getGuildId();
|
||||||
|
int enemyId = 13;
|
||||||
|
if(guildId==13){
|
||||||
|
enemyId = 14;
|
||||||
|
}
|
||||||
|
Family.FamilyFightInfoResponse.Builder builder = Family.FamilyFightInfoResponse.newBuilder();
|
||||||
|
builder.addInfo(familyFightDetailInfo(guildId));
|
||||||
|
builder.addInfo(familyFightDetailInfo(enemyId));
|
||||||
|
MessageUtil.sendMessage(session,1,messageType.getNumber(),builder.build(),true);
|
||||||
|
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* 公会战计入缓存
|
* 公会战计入缓存
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
|
@ -873,7 +920,12 @@ public class GuildLogic {
|
||||||
if(guildIds.size()<1){
|
if(guildIds.size()<1){
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
RedisUtil redisUtil = RedisUtil.getInstence();
|
||||||
for(Integer gid:guildIds){
|
for(Integer gid:guildIds){
|
||||||
|
String key = RedisKey.getKey(RedisKey.FAMILY_FIGHT_RANK, gid.toString(), true);
|
||||||
|
if(!redisUtil.getZset(key,0, redisUtil.getZsetSize(RedisKey.FAMILY_FIGHT_RANK)).contains(gid)){
|
||||||
|
redisUtil.zsetAddOne(RedisKey.FAMILY_FIGHT_RANK,gid.toString(),100);
|
||||||
|
}
|
||||||
GuildInfo guildInfo = GuilidManager.guildInfoMap.get(gid);
|
GuildInfo guildInfo = GuilidManager.guildInfoMap.get(gid);
|
||||||
Map<Integer, Integer> defendInfo = guildInfo.getDefendInfo();
|
Map<Integer, Integer> defendInfo = guildInfo.getDefendInfo();
|
||||||
if(defendInfo==null||defendInfo.size()<1){
|
if(defendInfo==null||defendInfo.size()<1){
|
||||||
|
@ -894,10 +946,17 @@ public class GuildLogic {
|
||||||
heroAllAttribute.put(heroInfo.getHeroId(),new FamilyHeroInfo(hero.getTemplateId(),hero.getLevel(),heroAttributeMap));
|
heroAllAttribute.put(heroInfo.getHeroId(),new FamilyHeroInfo(hero.getTemplateId(),hero.getLevel(),heroAttributeMap));
|
||||||
}
|
}
|
||||||
fightInfo.setHeroAttribute(heroAllAttribute);
|
fightInfo.setHeroAttribute(heroAllAttribute);
|
||||||
RedisUtil.getInstence().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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 战斗之后数据更新
|
||||||
|
* @param userAttack
|
||||||
|
* @param userDefend
|
||||||
|
*/
|
||||||
public void familyFightResult(User userAttack,User userDefend){
|
public void familyFightResult(User userAttack,User userDefend){
|
||||||
int defendGuildId =userDefend.getPlayerInfoManager().getGuildId();
|
int defendGuildId =userDefend.getPlayerInfoManager().getGuildId();
|
||||||
FamilyFightInfo defendInfo = RedisUtil.getInstence().getMapEntry(RedisKey.FAMILY_FIGHT, String.valueOf(defendGuildId), String.valueOf(userDefend.getId()), FamilyFightInfo.class);
|
FamilyFightInfo defendInfo = RedisUtil.getInstence().getMapEntry(RedisKey.FAMILY_FIGHT, String.valueOf(defendGuildId), String.valueOf(userDefend.getId()), FamilyFightInfo.class);
|
||||||
|
@ -939,8 +998,12 @@ public class GuildLogic {
|
||||||
Map<Integer, Integer> attribute = value.getAttribute();
|
Map<Integer, Integer> attribute = value.getAttribute();
|
||||||
attribute.put(HeroAttributeEnum.CurHP.getPropertyId(),fightResult[index]);
|
attribute.put(HeroAttributeEnum.CurHP.getPropertyId(),fightResult[index]);
|
||||||
value.setAttribute(attribute);
|
value.setAttribute(attribute);
|
||||||
RedisUtil.getInstence().putMapEntry(RedisKey.FAMILY_FIGHT,String.valueOf(defendGuildId),String.valueOf(userDefend.getId()),attribute);
|
|
||||||
index++;
|
index++;
|
||||||
}
|
}
|
||||||
|
defendInfo.setHeroAttribute(heroAttribute);
|
||||||
|
if(fightResult[0]==0){
|
||||||
|
defendInfo.setStarCount(defendInfo.getStarCount()-1);
|
||||||
|
}
|
||||||
|
RedisUtil.getInstence().putMapEntry(RedisKey.FAMILY_FIGHT,String.valueOf(defendGuildId),String.valueOf(userDefend.getId()),defendInfo);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue