Merge branch 'master' of http://60.1.1.230/backend/jieling_server
commit
7b8fe61d8a
|
@ -0,0 +1,35 @@
|
|||
package com.ljsd.jieling.config;
|
||||
|
||||
import com.ljsd.jieling.logic.STableManager;
|
||||
import com.ljsd.jieling.logic.Table;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
@Table(name ="TestWelfare")
|
||||
public class STestWelfare implements BaseConfig {
|
||||
|
||||
private int id;
|
||||
|
||||
private int[] reward;
|
||||
|
||||
public static Map<Integer, STestWelfare> testWelfareMap;
|
||||
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public void init() throws Exception {
|
||||
testWelfareMap= STableManager.getConfig(STestWelfare.class);
|
||||
}
|
||||
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public int[] getReward() {
|
||||
return reward;
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -120,6 +120,8 @@ public class RedisKey {
|
|||
public static final String FAMILY_FIGHT_MATCHING_RANK ="FAMILY_FIGHT_MATCHING_RANK";
|
||||
//公会战进攻获得星数排行榜
|
||||
public static final String FAMILY_FIGHT_STAR_RANK = "FAMILY_FIGHT_STAR_RANK";
|
||||
//公会战公会统计
|
||||
public static final String FAMILY_FIGHT_CAL_STAR = "FAMILY_FIGHT_CAL_STAR";
|
||||
|
||||
public static final String OPERATE_FAMILY = "OPERATE_FAMILY";
|
||||
public static final String OPERATE_FAMILY_APPLY = "OPERATE_FAMILY_APPLY";
|
||||
|
|
|
@ -38,6 +38,7 @@ public abstract class BaseHandler<T extends GeneratedMessage> {
|
|||
processWithProto(iSession, parser.parseFrom(netData.parseClientProtoNetData()));
|
||||
} catch (Exception var4) {
|
||||
System.out.print("解析协议失败" + var4);
|
||||
var4.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -2,20 +2,19 @@ package com.ljsd.jieling.handler.family;
|
|||
|
||||
import com.ljsd.jieling.handler.BaseHandler;
|
||||
import com.ljsd.jieling.logic.family.GuildFightLogic;
|
||||
import com.ljsd.jieling.netty.cocdex.PacketNetData;
|
||||
import com.ljsd.jieling.network.session.ISession;
|
||||
import com.ljsd.jieling.protocols.Family;
|
||||
import com.ljsd.jieling.protocols.MessageTypeProto;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component
|
||||
public class FamilyPersonalResultHandler extends BaseHandler {
|
||||
public class FamilyPersonalResultHandler extends BaseHandler<Family.PersonalFightResultRequest> {
|
||||
@Override
|
||||
public MessageTypeProto.MessageType getMessageCode() {
|
||||
return MessageTypeProto.MessageType.FAMILY_PERSONAL_FIGHT_RESULT_REQUEST;
|
||||
}
|
||||
@Override
|
||||
public void process(ISession iSession, PacketNetData netData) throws Exception {
|
||||
GuildFightLogic.personalFightResult(iSession,MessageTypeProto.MessageType.FAMILY_PERSONAL_FIGHT_RESULT_RESPONSE);
|
||||
public void processWithProto(ISession iSession, Family.PersonalFightResultRequest proto) throws Exception {
|
||||
GuildFightLogic.personalFightResult(iSession,proto.getType(),MessageTypeProto.MessageType.FAMILY_PERSONAL_FIGHT_RESULT_RESPONSE);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,23 @@
|
|||
package com.ljsd.jieling.handler.family;
|
||||
|
||||
import com.google.protobuf.GeneratedMessage;
|
||||
import com.ljsd.jieling.handler.BaseHandler;
|
||||
import com.ljsd.jieling.logic.family.GuildFightLogic;
|
||||
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 GuildFightResultHandler extends BaseHandler {
|
||||
@Override
|
||||
public MessageTypeProto.MessageType getMessageCode() {
|
||||
return MessageTypeProto.MessageType.FAMILY_FIGHT_TOTAL_RESULT_REQUEST;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void process(ISession iSession, PacketNetData netData) throws Exception {
|
||||
GuildFightLogic.guildFightResult(iSession,MessageTypeProto.MessageType.FAMILY_FIGHT_TOTAL_RESULT_RESPONSE);
|
||||
}
|
||||
}
|
|
@ -2191,6 +2191,7 @@ public class MapLogic {
|
|||
RedisUtil.getInstence().set(key, fightInfo, sFloodConfig.getBattleTime() + 100);
|
||||
FightInfoProto.FightStartResponse.Builder fightStartResponse = FightInfoProto.FightStartResponse.newBuilder();
|
||||
BehaviorUtil.getLevelDifficultyifficuFightInfo(user, sFloodConfig.getMonster(), teamId, sFloodConfig.getBattleTime(), fightStartResponse, RedisKey.CHALLENGE_MONSTER_ATTACK);
|
||||
user.getUserMissionManager().onGameEvent(user,GameEvent.MONSTER_ATTACK_PLAY);
|
||||
MessageUtil.sendMessage(session, 1, messageType.getNumber(), fightStartResponse.build(), true);
|
||||
}
|
||||
|
||||
|
@ -2268,6 +2269,7 @@ public class MapLogic {
|
|||
fightEndResponse.setResult(resultCode);
|
||||
fightEndResponse.build();
|
||||
user.getMapManager().setLastMonsterAttack(checkFightId + 1);
|
||||
user.getUserMissionManager().onGameEvent(user,GameEvent.MONSTER_ATTACK_LEVEL);
|
||||
MessageUtil.sendMessage(session, 1, messageType.getNumber(), fightEndResponse.build(), true);
|
||||
}
|
||||
|
||||
|
|
|
@ -255,6 +255,10 @@ public class GlobalDataManaager {
|
|||
PlayerLogic.getInstance().vipflushEveryDay(user,fBuilder);
|
||||
user.getUserMissionManager().onGameEvent(user, GameEvent.DAILY_REFRESH,0);
|
||||
FriendLogic.getInstance().refreshState(session);
|
||||
int sendDays = user.getPlayerInfoManager().getSendDays();
|
||||
int differentDays = TimeUtils.differentDaysByHour(System.currentTimeMillis(), user.getPlayerInfoManager().getLoginTime(), 5);
|
||||
PlayerLogic.getInstance().sendTestWelfareMail(user,sendDays,sendDays+differentDays);
|
||||
user.getPlayerInfoManager().setSendDays(sendDays+differentDays);
|
||||
// MapLogic.getInstance().towerAutoReset(session,fBuilder);
|
||||
if(fBuilder!=null){
|
||||
fBuilder.setSignInInfo(CommonProto.SignInInfo.newBuilder().setDays(user.getPlayerInfoManager().getSign()+1).setState(user.getPlayerInfoManager().getSignTotay()).build());
|
||||
|
|
|
@ -108,6 +108,8 @@ public class CumulationData {
|
|||
|
||||
public int friendNums;
|
||||
|
||||
public int monsterAttackTimes;
|
||||
|
||||
|
||||
|
||||
//任务重置
|
||||
|
@ -153,6 +155,7 @@ public class CumulationData {
|
|||
heroUpSomeStarTimesMap.clear();
|
||||
givePresents=0;
|
||||
friendNums=0;
|
||||
monsterAttackTimes = 0;
|
||||
}
|
||||
|
||||
private void clearArray(int[] source){
|
||||
|
|
|
@ -24,6 +24,7 @@ public class GuildMyInfo extends MongoBase {
|
|||
private List<Integer> path = new ArrayList<>(); //行走路线
|
||||
private int curPos=initPos;//当前位置
|
||||
private long preMoveTimestamp; //上次更新时间
|
||||
private int attackCount;//公会战进攻次数
|
||||
|
||||
public void clearOfLevelGuild(){
|
||||
path.clear();
|
||||
|
@ -97,4 +98,13 @@ public class GuildMyInfo extends MongoBase {
|
|||
public long getPreMoveTimestamp() {
|
||||
return preMoveTimestamp;
|
||||
}
|
||||
|
||||
public int getAttackCount() {
|
||||
return attackCount;
|
||||
}
|
||||
|
||||
public void updateAttackCount(int count){
|
||||
updateString("attackCount",count);
|
||||
this.attackCount = count;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -80,6 +80,8 @@ public class PlayerManager extends MongoBase {
|
|||
|
||||
private Set<Integer> fixIds = new CopyOnWriteArraySet<>();
|
||||
|
||||
private int sendDays;
|
||||
|
||||
public PlayerManager(){
|
||||
this.setRootCollection(User._COLLECTION_NAME);
|
||||
}
|
||||
|
@ -445,4 +447,13 @@ public class PlayerManager extends MongoBase {
|
|||
updateString("isdayFirst", isdayFirst);
|
||||
this.isdayFirst = isdayFirst;
|
||||
}
|
||||
|
||||
public int getSendDays() {
|
||||
return sendDays;
|
||||
}
|
||||
|
||||
public void setSendDays(int sendDays) {
|
||||
updateString("sendDays", sendDays);
|
||||
this.sendDays = sendDays;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -51,6 +51,7 @@ public class UserManager {
|
|||
initPlayer(user,openId);
|
||||
UserManager.addUser(user);
|
||||
MongoUtil.getInstence().getMyMongoTemplate().save(user);
|
||||
PlayerLogic.getInstance().sendTestWelfareMail(user,1,2);
|
||||
return user;
|
||||
}
|
||||
|
||||
|
@ -66,6 +67,7 @@ public class UserManager {
|
|||
playerManager.updateGuidePoint(1,1);
|
||||
playerManager.setCreateTime(now);
|
||||
playerManager.setLoginTime(now);
|
||||
playerManager.setSendDays(1);
|
||||
playerManager.updateVipInfo(user,0);
|
||||
playerManager.setRechargeInfo(new RechargeInfo());
|
||||
playerManager.setHeadFrame(SGameSetting.getGameSetting().getDefaultPicture());
|
||||
|
|
|
@ -34,6 +34,29 @@ public class GuildFightLogic {
|
|||
private static int status;
|
||||
private static boolean startMatching;
|
||||
|
||||
static{
|
||||
int hour = TimeUtils.getHourOfDay();
|
||||
switch (hour){
|
||||
case FamilyRound.FAMILY_FIGHT_START:
|
||||
status = 1;
|
||||
break;
|
||||
case FamilyRound.FAMILY_FIGHT_DEFEND_END:
|
||||
status = 2;
|
||||
break;
|
||||
case FamilyRound.FAMILY_FIGHT_MATCHING_END:
|
||||
status =3;
|
||||
break;
|
||||
case FamilyRound.FAMILY_FIGHT_ATTACK_END:
|
||||
status = 4;
|
||||
break;
|
||||
case FamilyRound.FAMILY_FIGHT_END:
|
||||
status = 0;
|
||||
break;
|
||||
default:
|
||||
status = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 查看工会布防信息
|
||||
*
|
||||
|
@ -67,6 +90,7 @@ public class GuildFightLogic {
|
|||
* @param messageType
|
||||
* @throws Exception
|
||||
*/
|
||||
|
||||
public static void viewDefendDetailInfo(ISession session, int uid, MessageTypeProto.MessageType messageType) throws Exception {
|
||||
User user = UserManager.getUser(uid);
|
||||
int guildId = user.getPlayerInfoManager().getGuildId();
|
||||
|
@ -74,14 +98,21 @@ public class GuildFightLogic {
|
|||
TeamPosManager teamPosManager = user.getTeamPosManager();
|
||||
CommonProto.Team.Builder team = CommonProto.Team.newBuilder();
|
||||
CommonProto.TeamOneTeamInfo.Builder oneInfo = CommonProto.TeamOneTeamInfo.newBuilder();
|
||||
for(Map.Entry<String, FamilyHeroInfo> entry:fightInfo.getHeroAttribute().entrySet()){
|
||||
int templateId = entry.getValue().getTempleteId();
|
||||
team.addHeroTid(templateId);
|
||||
Map<Integer, Integer> attribute = entry.getValue().getAttribute();
|
||||
if(status==3){
|
||||
int remainHp = attribute.get(HeroAttributeEnum.CurHP.getPropertyId())*100/attribute.get(HeroAttributeEnum.Hp.getPropertyId());
|
||||
LOGGER.info("血量为百分之{}",remainHp);
|
||||
oneInfo.addRemainHp(remainHp);
|
||||
if(fightInfo!=null){
|
||||
for(Map.Entry<String, FamilyHeroInfo> entry:fightInfo.getHeroAttribute().entrySet()){
|
||||
int templateId = entry.getValue().getTempleteId();
|
||||
team.addHeroTid(templateId);
|
||||
Map<Integer, Integer> attribute = entry.getValue().getAttribute();
|
||||
if(status==3){
|
||||
int remainHp = attribute.get(HeroAttributeEnum.CurHP.getPropertyId())*100/attribute.get(HeroAttributeEnum.Hp.getPropertyId());
|
||||
LOGGER.info("血量为百分之{}",remainHp);
|
||||
oneInfo.addRemainHp(remainHp);
|
||||
}
|
||||
}
|
||||
}else{
|
||||
List<TeamPosHeroInfo> teamPosHeroInfos = teamPosManager.getTeamPosForHero().get(501);
|
||||
for(TeamPosHeroInfo heroInfo:teamPosHeroInfos){
|
||||
team.addHeroTid(user.getHeroManager().getHero(heroInfo.getHeroId()).getTemplateId());
|
||||
}
|
||||
}
|
||||
oneInfo.setTeam(team);
|
||||
|
@ -128,6 +159,7 @@ public class GuildFightLogic {
|
|||
private static Family.FamilyFightInfo familyFightDetailInfo(int guildId) throws Exception {
|
||||
GuildInfo guildInfo = GuilidManager.guildInfoMap.get(guildId);
|
||||
Map<Integer, Integer> defendInfo = guildInfo.getDefendInfo();
|
||||
Map<Integer, FamilyFightInfo> fightValues = RedisUtil.getInstence().getMapValues(RedisKey.FAMILY_FIGHT, String.valueOf(guildId), Integer.class, FamilyFightInfo.class);
|
||||
Family.FamilyFightInfo.Builder fightInfo = Family.FamilyFightInfo.newBuilder();
|
||||
fightInfo.setGid(guildId);
|
||||
for (int i = 0; i < 3; i++) {
|
||||
|
@ -139,13 +171,13 @@ public class GuildFightLogic {
|
|||
for (Map.Entry<Integer, Integer> entry : defendInfo.entrySet()) {
|
||||
Family.FamilyFightPlayerInfo.Builder playerInfo = Family.FamilyFightPlayerInfo.newBuilder();
|
||||
playerInfo.setBuildId(entry.getValue());
|
||||
playerInfo.setStarCount(5);
|
||||
playerInfo.setStarCount(fightValues.get(entry.getKey()).getStarCount());
|
||||
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)
|
||||
.setPosition(GuildLogic.getMemberType(entry.getKey(),GuilidManager.guildInfoMap.get(guildId).getMembers()))
|
||||
.setSoulForce(HeroLogic.getInstance().calTeamTotalForce(UserManager.getUser(entry.getKey()), 501, false))
|
||||
.setHead(playerManager.getHead())
|
||||
.setFrame(playerManager.getHeadFrame())
|
||||
|
@ -224,6 +256,7 @@ public class GuildFightLogic {
|
|||
heroAllAttribute.put(heroInfo.getHeroId(), new FamilyHeroInfo(hero.getTemplateId(), hero.getLevel(), heroAttributeMap));
|
||||
}
|
||||
fightInfo.setHeroAttribute(heroAllAttribute);
|
||||
fightInfo.setBuildId(entry.getValue());
|
||||
fightInfo.setStarCount(guildSetting.getStarNum()[memberType-1]);
|
||||
redisUtil.putMapEntry(RedisKey.FAMILY_FIGHT, String.valueOf(guildInfo.getId()), String.valueOf(entry.getKey()), fightInfo);
|
||||
}
|
||||
|
@ -277,8 +310,11 @@ public class GuildFightLogic {
|
|||
*/
|
||||
public static void familyFightResult(ISession session, int defendUid, MessageTypeProto.MessageType messageType) throws Exception {
|
||||
User userAttack = UserManager.getUser(session.getUid());
|
||||
//战斗次数
|
||||
userAttack.getGuildMyInfo().updateAttackCount(userAttack.getGuildMyInfo().getAttackCount()+1);
|
||||
User userDefend = UserManager.getUser(defendUid);
|
||||
int defendGuildId = userDefend.getPlayerInfoManager().getGuildId();
|
||||
int defendBuildId = GuilidManager.guildInfoMap.get(defendGuildId).getDefendInfo().get(defendUid);
|
||||
RedisUtil redisUtil = RedisUtil.getInstence();
|
||||
FamilyFightInfo defendInfo = redisUtil.getMapEntry(RedisKey.FAMILY_FIGHT, String.valueOf(defendGuildId), String.valueOf(userDefend.getId()), FamilyFightInfo.class);
|
||||
Map<String, FamilyHeroInfo> heroAttribute = defendInfo.getHeroAttribute();
|
||||
|
@ -315,31 +351,54 @@ public class GuildFightLogic {
|
|||
System.out.println(fightResult[i]);
|
||||
}
|
||||
int index = 2;
|
||||
int dieCount = 0;
|
||||
// 战斗之后数据处理
|
||||
for (Map.Entry<String, FamilyHeroInfo> entry : heroAttribute.entrySet()) {
|
||||
FamilyHeroInfo value = entry.getValue();
|
||||
Map<Integer, Integer> attribute = value.getAttribute();
|
||||
if(fightResult[0]==0) {
|
||||
attribute.put(HeroAttributeEnum.CurHP.getPropertyId(), fightResult[index]);
|
||||
}else{
|
||||
attribute.put(HeroAttributeEnum.CurHP.getPropertyId(), 0);
|
||||
for (Map.Entry<String, FamilyHeroInfo> entry : heroAttribute.entrySet()) {
|
||||
FamilyHeroInfo value = entry.getValue();
|
||||
Map<Integer, Integer> attribute = value.getAttribute();
|
||||
if(fightResult[0]==0) {
|
||||
if(fightResult[index]==0){
|
||||
dieCount++;
|
||||
}
|
||||
value.setAttribute(attribute);
|
||||
index++;
|
||||
attribute.put(HeroAttributeEnum.CurHP.getPropertyId(), fightResult[index]);
|
||||
}else{
|
||||
dieCount = 5;
|
||||
attribute.put(HeroAttributeEnum.CurHP.getPropertyId(), 0);
|
||||
}
|
||||
|
||||
|
||||
value.setAttribute(attribute);
|
||||
index++;
|
||||
}
|
||||
defendInfo.setHeroAttribute(heroAttribute);
|
||||
if (fightResult[0] == 0) {
|
||||
defendInfo.setStarCount(defendInfo.getStarCount() - 1);
|
||||
//获得星数
|
||||
int getStar;
|
||||
if (fightResult[0] == 1) {
|
||||
//发送indication
|
||||
Family.DefeatResponse response = Family.DefeatResponse.newBuilder().setUid(defendUid).build();
|
||||
GuildLogic.sendIndicationToMember(GuilidManager.guildInfoMap.get(userDefend.getPlayerInfoManager().getGuildId()), MessageTypeProto.MessageType.FAMILY_DEFEATE_INDICATION,response);
|
||||
GuildLogic.sendIndicationToMember(GuilidManager.guildInfoMap.get(userAttack.getPlayerInfoManager().getGuildId()), MessageTypeProto.MessageType.FAMILY_DEFEATE_INDICATION,response);
|
||||
getStar = defendInfo.getStarCount();
|
||||
defendInfo.setStarCount(0);
|
||||
}else{
|
||||
int memberType = GuildLogic.getMemberType(defendUid, GuilidManager.guildInfoMap.get(defendGuildId).getMembers());
|
||||
int maxStar = SGuildSetting.sGuildSetting.getStarNum()[memberType];
|
||||
int lessStar = maxStar - dieCount*maxStar/5;
|
||||
//倍数k(maxStar/5)
|
||||
getStar = defendInfo.getStarCount()-lessStar;
|
||||
defendInfo.setStarCount(lessStar);
|
||||
}
|
||||
redisUtil.putMapEntry(RedisKey.FAMILY_FIGHT, String.valueOf(defendGuildId), String.valueOf(userDefend.getId()), defendInfo);
|
||||
//获得星数处理
|
||||
int attackGuildId = userAttack.getPlayerInfoManager().getGuildId();
|
||||
String attackRankKey = RedisKey.getKey(RedisKey.FAMILY_FIGHT_STAR_RANK, String.valueOf(attackGuildId), false);
|
||||
Double starCount = redisUtil.getZSetScore(RedisKey.FAMILY_FIGHT_STAR_RANK, String.valueOf(attackGuildId), String.valueOf(userAttack.getId()));
|
||||
redisUtil.zsetAddOne(attackRankKey,String.valueOf(userAttack.getId()),starCount+1);
|
||||
Family.FamilyFightAttackResponse response = Family.FamilyFightAttackResponse.newBuilder().setResult(fightResult[0]).setStarCount(1).build();
|
||||
redisUtil.zsetAddOne(attackRankKey,String.valueOf(userAttack.getId()),starCount+getStar);
|
||||
//建筑星数
|
||||
Integer haveGotStar = redisUtil.getMapEntry(RedisKey.FAMILY_FIGHT_CAL_STAR, String.valueOf(attackGuildId), String.valueOf(defendBuildId), int.class);
|
||||
if(haveGotStar==null){
|
||||
haveGotStar = 0;
|
||||
}
|
||||
redisUtil.putMapEntry(RedisKey.FAMILY_FIGHT_CAL_STAR,String.valueOf(attackGuildId),String.valueOf(defendBuildId),haveGotStar+getStar);
|
||||
Family.FamilyFightAttackResponse response = Family.FamilyFightAttackResponse.newBuilder().setResult(fightResult[0]).setStarCount(getStar).build();
|
||||
MessageUtil.sendMessage(session, 1, messageType.getNumber(), response, true);
|
||||
}
|
||||
|
||||
|
@ -381,6 +440,7 @@ public class GuildFightLogic {
|
|||
.setStartTime(startFightTime)
|
||||
.setRoundStartTime(roundStartTime)
|
||||
.setRoundEndTime(roundEndTime)
|
||||
.setAttackCount(UserManager.getUser(session.getUid()).getGuildMyInfo().getAttackCount())
|
||||
.setJoinType(1);
|
||||
if (enemyFamily != -1) {
|
||||
GuildInfo guildInfo = GuilidManager.guildInfoMap.get(enemyFamily);
|
||||
|
@ -432,13 +492,37 @@ public class GuildFightLogic {
|
|||
*/
|
||||
private static void removeMatchingInfo(){
|
||||
RedisUtil redisUtil = RedisUtil.getInstence();
|
||||
String key = RedisKey.getKey(RedisKey.FAMILY_FIGHT_MATCHING_RANK,"",false);
|
||||
redisUtil.removeZSetRangeByRank(key,0,redisUtil.getZsetSize(key));
|
||||
String matchingKey = RedisKey.getKey(RedisKey.FAMILY_FIGHT_MATCHING_RANK,"",false);
|
||||
// Set<String> matchingRank = redisUtil.getZset(RedisKey.FAMILY_FIGHT_MATCHING_RANK, 0, redisUtil.getZsetSize(matchingKey));
|
||||
// for(String index:matchingRank){
|
||||
// Map<Integer, FamilyFightInfo> fightDefend = redisUtil.getMapValues(RedisKey.FAMILY_FIGHT, index, Integer.class, FamilyFightInfo.class);
|
||||
// for (Map.Entry<Integer, FamilyFightInfo> defendEntry:fightDefend.entrySet()){
|
||||
// //删除布防信息
|
||||
// redisUtil.removeMapEntrys(RedisKey.FAMILY_FIGHT,index,defendEntry.getKey());
|
||||
// //删除公会结算
|
||||
// String starRankKey = RedisKey.getKey(RedisKey.FAMILY_FIGHT_STAR_RANK, String.valueOf(index), false);
|
||||
// redisUtil.removeZSetRangeByRank(starRankKey,0,redisUtil.getZsetSize(starRankKey));
|
||||
// }
|
||||
// for(int i = 1;i<=3;i++){
|
||||
// //删除获得星数信息
|
||||
// if(redisUtil.getMapEntry(RedisKey.FAMILY_FIGHT_CAL_STAR,String.valueOf(index),String.valueOf(i),Integer.class)!=null){
|
||||
// redisUtil.removeMapEntrys(RedisKey.FAMILY_FIGHT_CAL_STAR,String.valueOf(index),i);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//删除匹配信息
|
||||
redisUtil.removeZSetRangeByRank(matchingKey,0,redisUtil.getZsetSize(matchingKey));
|
||||
}
|
||||
/**
|
||||
* 公会战结算
|
||||
*/
|
||||
public void accountFamilyFightResult() {
|
||||
RedisUtil redisUtil = RedisUtil.getInstence();
|
||||
String key = RedisKey.getKey(RedisKey.FAMILY_FIGHT_MATCHING_RANK,"",false);
|
||||
|
||||
int size = redisUtil.getZsetSize(key);
|
||||
Set<ZSetOperations.TypedTuple<String>> zsetreverseRangeWithScores = redisUtil.getZsetreverseRangeWithScores(RedisKey.FAMILY_FIGHT_MATCHING_RANK, "", 0, size);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
@ -448,8 +532,11 @@ public class GuildFightLogic {
|
|||
* @param messageType
|
||||
* @throws Exception
|
||||
*/
|
||||
public static void personalFightResult(ISession session, MessageTypeProto.MessageType messageType) throws Exception {
|
||||
public static void personalFightResult(ISession session,int type, MessageTypeProto.MessageType messageType) throws Exception {
|
||||
int guildId = UserManager.getUser(session.getUid()).getPlayerInfoManager().getGuildId();
|
||||
if(type==1){
|
||||
guildId = getEnemyFamily(guildId);
|
||||
}
|
||||
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;
|
||||
|
@ -464,7 +551,7 @@ public class GuildFightLogic {
|
|||
.setUid(uid)
|
||||
.setHead(1)
|
||||
.setHeadFrame(playerInfoManager.getHeadFrame())
|
||||
.setPosition(1)
|
||||
.setPosition(GuildLogic.getMemberType(Integer.parseInt(personal.getValue()),GuilidManager.guildInfoMap.get(playerInfoManager.getGuildId()).getMembers()))
|
||||
.setName(playerInfoManager.getNickName())
|
||||
.setStarCount(personal.getScore().intValue());
|
||||
response.addResult(fightResult.build());
|
||||
|
@ -472,4 +559,25 @@ public class GuildFightLogic {
|
|||
}
|
||||
MessageUtil.sendMessage(session,1,messageType.getNumber(),response.build(),true);
|
||||
}
|
||||
|
||||
/**
|
||||
* 工会总战绩
|
||||
*/
|
||||
public static void guildFightResult(ISession session,MessageTypeProto.MessageType messageType) throws Exception {
|
||||
int guildId=UserManager.getUser(session.getUid()).getPlayerInfoManager().getGuildId();
|
||||
int enemyFamily = getEnemyFamily(guildId);
|
||||
Family.GuildFightResultResponse.Builder response = Family.GuildFightResultResponse.newBuilder();
|
||||
response.setGetExp(10);
|
||||
//获取星星
|
||||
Map<Integer, Integer> mapValues = RedisUtil.getInstence().getMapValues(RedisKey.FAMILY_FIGHT_CAL_STAR, String.valueOf(guildId), Integer.class, Integer.class);
|
||||
//失去星星
|
||||
Map<Integer, Integer> mapEnemyValues = RedisUtil.getInstence().getMapValues(RedisKey.FAMILY_FIGHT_CAL_STAR, String.valueOf(enemyFamily), Integer.class, Integer.class);
|
||||
response.addStar(mapValues.get(1)==null?0:mapValues.get(1));
|
||||
response.addStar(mapValues.get(2)==null?0:mapValues.get(2));
|
||||
response.addStar(mapValues.get(3)==null?0:mapValues.get(3));
|
||||
response.addStar(mapEnemyValues.get(1)==null?0:mapValues.get(1));
|
||||
response.addStar(mapEnemyValues.get(2)==null?0:mapValues.get(2));
|
||||
response.addStar(mapEnemyValues.get(3)==null?0:mapValues.get(3));
|
||||
MessageUtil.sendMessage(session,1,messageType.getNumber(),response.build(),true);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -715,7 +715,7 @@ public class GuildLogic {
|
|||
GuildInfo guildInfo = GuilidManager.guildInfoMap.get(guildId);
|
||||
|
||||
sendIndicationToMember(guildInfo, MessageTypeProto.MessageType.FAMILY_WALK_INDICATION,familyWalkIndicaiton);
|
||||
MessageUtil.sendMessage(session,1, msgId,null,true);
|
||||
MessageUtil.sendMessage(session,1,msgId,null,true);
|
||||
}
|
||||
|
||||
public static void updateMyPos(User user) {
|
||||
|
@ -784,6 +784,7 @@ public class GuildLogic {
|
|||
for(Integer sendUid : items){
|
||||
ISession isession = OnlineUserManager.getSessionByUid(sendUid);
|
||||
if(isession!=null){
|
||||
LOGGER.info("向{}发送indication",sendUid);
|
||||
MessageUtil.sendIndicationMessage(isession,1,messageType.getNumber(),generatedMessage,true);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -204,11 +204,14 @@ public class CombatLogic {
|
|||
int fightResult = checkResult[0];
|
||||
if(fightResult == 1){
|
||||
adventureManager.addAdventureStation(new AdventureStateInfo(arenaId));
|
||||
int[][] drop= new int[1][];
|
||||
drop[0] = new int[2];
|
||||
drop[0][0]=SGameSetting.getGameSetting().getAdventureItem();
|
||||
drop[0][1] = 1;
|
||||
ItemUtil.drop(user,drop,BIReason.FIRST_ADVENTURE_REWARD);
|
||||
if(arenaId == 1){
|
||||
int[][] drop= new int[1][];
|
||||
drop[0] = new int[2];
|
||||
drop[0][0]=SGameSetting.getGameSetting().getAdventureItem();
|
||||
drop[0][1] = 1;
|
||||
ItemUtil.drop(user,drop,BIReason.FIRST_ADVENTURE_REWARD);
|
||||
}
|
||||
|
||||
}
|
||||
FightInfoProto.AdventurnChallengeResponse.Builder builder = FightInfoProto.AdventurnChallengeResponse.newBuilder().setFightResult(fightResult);
|
||||
|
||||
|
@ -503,6 +506,7 @@ public class CombatLogic {
|
|||
|
||||
SAdventureConfig sAdventureConfig = SAdventureConfig.getConfig().get(arenaID);
|
||||
int[][][] invasionBoss = sAdventureConfig.getInvasionBoss();
|
||||
arenaID = MathUtils.randomInt(arenaID) + 1;
|
||||
AdventureStateInfo adventureStateInfo = adventureStateInfoMap.get(arenaID);
|
||||
int bossGroupID =0;
|
||||
int level = adventureStateInfo.getLevel();
|
||||
|
@ -539,6 +543,7 @@ public class CombatLogic {
|
|||
.setArenaId(adventureStateInfo.getPosition())
|
||||
.setBossGroupId(adventureBoss.getBossGroupId())
|
||||
.setRemainTime(remainTime)
|
||||
.setBossId(bossId)
|
||||
.build()).build();
|
||||
MessageUtil.sendMessage(iSession,1,msgId,build,true);
|
||||
}
|
||||
|
@ -656,12 +661,10 @@ public class CombatLogic {
|
|||
builder.setKillRewards(killReward);
|
||||
user.getUserMissionManager().onGameEvent(user, GameEvent.KILLINVASIONBOSS);
|
||||
RedisUtil.getInstence().removeMapEntrys(RedisKey.ADVENTRUEN_BOSS_INFO,"",bossId);
|
||||
if(adventureBoss.getFindUserId()!=uid){
|
||||
ISession findSession = OnlineUserManager.getSessionByUid(adventureBoss.getFindUserId());
|
||||
if(findSession!=null){
|
||||
FightInfoProto.AdventureBossKillIndication bossKilled = FightInfoProto.AdventureBossKillIndication.newBuilder().setBossId(adventureBoss.getBossId()).setPos(adventureBoss.getArenaId()).build();
|
||||
MessageUtil.sendIndicationMessage(findSession,1, MessageTypeProto.MessageType.ADVENTURE_BOSS_KILL_INDICATION_VALUE,bossKilled,true);
|
||||
}
|
||||
ISession findSession = OnlineUserManager.getSessionByUid(adventureBoss.getFindUserId());
|
||||
if(findSession!=null){
|
||||
FightInfoProto.AdventureBossKillIndication bossKilled = FightInfoProto.AdventureBossKillIndication.newBuilder().setBossId(adventureBoss.getBossId()).setPos(adventureBoss.getArenaId()).build();
|
||||
MessageUtil.sendIndicationMessage(findSession,1, MessageTypeProto.MessageType.ADVENTURE_BOSS_KILL_INDICATION_VALUE,bossKilled,true);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -49,4 +49,7 @@ public enum GameEvent {
|
|||
GIVE_PRESENT,//赠送体力
|
||||
FRIEND_NUMS,//好友数量
|
||||
|
||||
MONSTER_ATTACK_PLAY,//参与兽潮来袭
|
||||
MONSTER_ATTACK_LEVEL, // 兽潮来袭到达层
|
||||
|
||||
}
|
||||
|
|
|
@ -578,6 +578,12 @@ public class MissionLoigc {
|
|||
count = num;
|
||||
}
|
||||
break;
|
||||
case JOIN_MONSTER_ATTACK_TIMES:
|
||||
count = cumulationData.monsterAttackTimes;
|
||||
break;
|
||||
case MONSTER_ATTACK_LEVEL:
|
||||
count = user.getMapManager().getLastMonsterAttack() - 1;
|
||||
break;
|
||||
default:
|
||||
count = 0;
|
||||
break;
|
||||
|
|
|
@ -74,6 +74,9 @@ public enum MissionType {
|
|||
GIVE_FRIEND_STAMIN_TIMES(54),//赠送好友体力次数:%s
|
||||
HERO_UP_SOME_STAR_TIMES(55),//进阶x星卡牌个数达到:%s
|
||||
|
||||
JOIN_MONSTER_ATTACK_TIMES(56),//参与兽潮来袭的次数
|
||||
MONSTER_ATTACK_LEVEL(57),//兽潮来袭到达x层
|
||||
|
||||
|
||||
;
|
||||
|
||||
|
@ -199,6 +202,10 @@ public enum MissionType {
|
|||
return GIVE_FRIEND_STAMIN_TIMES;
|
||||
case 55:
|
||||
return HERO_UP_SOME_STAR_TIMES;
|
||||
case 56:
|
||||
return JOIN_MONSTER_ATTACK_TIMES;//参与兽潮来袭的次数
|
||||
case 57:
|
||||
return MONSTER_ATTACK_LEVEL;//兽潮来袭到达x层
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -95,6 +95,9 @@ public class DataManagerDistributor {
|
|||
|
||||
judges.put(MissionType.VIP_LEVEL,new DefaultDataManager());
|
||||
|
||||
judges.put(MissionType.JOIN_MONSTER_ATTACK_TIMES,new JoinMonsterAttackManager());
|
||||
judges.put(MissionType.MONSTER_ATTACK_LEVEL,new DefaultDataManager());
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,12 @@
|
|||
package com.ljsd.jieling.logic.mission.data;
|
||||
|
||||
import com.ljsd.jieling.logic.dao.CumulationData;
|
||||
import com.ljsd.jieling.logic.mission.MissionType;
|
||||
|
||||
public class JoinMonsterAttackManager implements BaseDataManager{
|
||||
@Override
|
||||
public CumulationData.Result updateData(CumulationData data, MissionType missionType, Object... parm) {
|
||||
data.monsterAttackTimes++;
|
||||
return new CumulationData.Result(missionType);
|
||||
}
|
||||
}
|
|
@ -231,6 +231,16 @@ public class MissionEventDistributor {
|
|||
eventEnumListMap.put(GameEvent.FRIEND_NUMS,typeList);
|
||||
eventProcessor.put(GameEvent.FRIEND_NUMS,new CumulationDataEventProcessor());
|
||||
|
||||
typeList = new ArrayList<>();
|
||||
typeList.add(MissionType.JOIN_MONSTER_ATTACK_TIMES);
|
||||
eventEnumListMap.put(GameEvent.MONSTER_ATTACK_PLAY,typeList);
|
||||
eventProcessor.put(GameEvent.MONSTER_ATTACK_PLAY,new CumulationDataEventProcessor());
|
||||
|
||||
typeList = new ArrayList<>();
|
||||
typeList.add(MissionType.MONSTER_ATTACK_LEVEL);
|
||||
eventEnumListMap.put(GameEvent.MONSTER_ATTACK_LEVEL,typeList);
|
||||
eventProcessor.put(GameEvent.MONSTER_ATTACK_LEVEL,new CumulationDataEventProcessor());
|
||||
|
||||
}
|
||||
|
||||
private static final ThreadLocal<Map<GameMisionType, List<MissionStateChangeInfo>>> threadMissionChangeList =
|
||||
|
|
|
@ -454,4 +454,19 @@ public class PlayerLogic {
|
|||
PlayerInfoProto.TakeSenvenScoreRewardResponse build = PlayerInfoProto.TakeSenvenScoreRewardResponse.newBuilder().setDrop(drop).build();
|
||||
MessageUtil.sendMessage(iSession,1,msgId,build,true);
|
||||
}
|
||||
|
||||
|
||||
public void sendTestWelfareMail(User user,int sendDay,int duration) throws Exception {
|
||||
String title = SErrorCodeEerverConfig.getI18NMessage("welfare_activity_daily_title");
|
||||
for(;sendDay<duration;sendDay++){
|
||||
STestWelfare sTestWelfare = STestWelfare.testWelfareMap.get(sendDay);
|
||||
if(sTestWelfare == null){
|
||||
return;
|
||||
}
|
||||
String content = SErrorCodeEerverConfig.getI18NMessage("welfare_activity_daily_txt",new String[]{Integer.toString(sendDay)});
|
||||
String mailReward = ItemUtil.getMailReward(user, sTestWelfare.getReward(), 1.0f);
|
||||
MailLogic.getInstance().sendMail(user.getId(),title,content,mailReward,(int)(System.currentTimeMillis()/1000),Global.MAIL_EFFECTIVE_TIME);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -424,6 +424,7 @@ public class CBean2Proto {
|
|||
CommonProto.AdventureBossSimpleInfo.newBuilder().setArenaId(adventureStateInfo.getPosition())
|
||||
.setBossGroupId(adventureBoss.getBossGroupId())
|
||||
.setRemainTime(remainTime)
|
||||
.setBossId(adventureBoss.getBossId())
|
||||
.build()
|
||||
);
|
||||
}else{
|
||||
|
|
Loading…
Reference in New Issue