red
parent
aa2396aa44
commit
444bcddf9b
|
@ -32,9 +32,6 @@ public class GetAllMailHandler extends BaseHandler {
|
||||||
LOGGER.info("processMessage->uid={},token={},msgId={},msgIndex={}",
|
LOGGER.info("processMessage->uid={},token={},msgId={},msgIndex={}",
|
||||||
userId, token,msgId,msgIndex);
|
userId, token,msgId,msgIndex);
|
||||||
List<CommonProto.Mail> allUserMail = MailLogic.getInstance().getAllUserMail(userId);
|
List<CommonProto.Mail> allUserMail = MailLogic.getInstance().getAllUserMail(userId);
|
||||||
if(allUserMail.size()>10){
|
|
||||||
allUserMail = allUserMail.subList(0, 10);
|
|
||||||
}
|
|
||||||
PlayerInfoProto.GetAllMailInfoResponse getPlayerInfoResponse = PlayerInfoProto.GetAllMailInfoResponse.newBuilder()
|
PlayerInfoProto.GetAllMailInfoResponse getPlayerInfoResponse = PlayerInfoProto.GetAllMailInfoResponse.newBuilder()
|
||||||
.addAllMialList(allUserMail)
|
.addAllMialList(allUserMail)
|
||||||
.build();
|
.build();
|
||||||
|
|
|
@ -97,6 +97,7 @@ public class GetPlayerInfoHandler extends BaseHandler{
|
||||||
.setSuddenlyBossInfo(suddenlyBossInfo)
|
.setSuddenlyBossInfo(suddenlyBossInfo)
|
||||||
.setVipBaseInfo(vipInfoProto)
|
.setVipBaseInfo(vipInfoProto)
|
||||||
.setUserCreateTime((int)(playerInfoManager.getCreateTime()/1000))
|
.setUserCreateTime((int)(playerInfoManager.getCreateTime()/1000))
|
||||||
|
.addAllRedType(playerInfoManager.getReds())
|
||||||
.build();
|
.build();
|
||||||
try {
|
try {
|
||||||
MessageUtil.sendMessage(iSession, 1, MessageTypeProto.MessageType.GET_PLAYERINFO_RESPONSE_VALUE, getPlayerInfoResponse, true);
|
MessageUtil.sendMessage(iSession, 1, MessageTypeProto.MessageType.GET_PLAYERINFO_RESPONSE_VALUE, getPlayerInfoResponse, true);
|
||||||
|
|
|
@ -509,7 +509,8 @@ public class ArenaLogic {
|
||||||
.setAttackTime(arenaRecord.getCreateTime())
|
.setAttackTime(arenaRecord.getCreateTime())
|
||||||
.build());
|
.build());
|
||||||
}
|
}
|
||||||
|
User user = UserManager.getUser(uid);
|
||||||
|
user.getPlayerInfoManager().removeRed(GlobalsDef.SHARE_BOSS_RED_TYPE);
|
||||||
ArenaInfoProto.ArenaRecordInfoResponse build = ArenaInfoProto.ArenaRecordInfoResponse.newBuilder().addAllArenaRecordInfo(arenaRecordInfos).build();
|
ArenaInfoProto.ArenaRecordInfoResponse build = ArenaInfoProto.ArenaRecordInfoResponse.newBuilder().addAllArenaRecordInfo(arenaRecordInfos).build();
|
||||||
MessageUtil.sendMessage(iSession,1, MessageTypeProto.MessageType.ARENA_DEFENSE_RESPONSE_VALUE,build,true);
|
MessageUtil.sendMessage(iSession,1, MessageTypeProto.MessageType.ARENA_DEFENSE_RESPONSE_VALUE,build,true);
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -12,7 +12,9 @@ import com.ljsd.jieling.logic.mission.GameEvent;
|
||||||
import com.ljsd.jieling.util.MathUtils;
|
import com.ljsd.jieling.util.MathUtils;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
import java.util.HashSet;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
|
|
||||||
public class PlayerManager extends MongoBase {
|
public class PlayerManager extends MongoBase {
|
||||||
|
@ -59,6 +61,8 @@ public class PlayerManager extends MongoBase {
|
||||||
|
|
||||||
private Map<Integer,Integer> vipInfo = new HashMap<>();
|
private Map<Integer,Integer> vipInfo = new HashMap<>();
|
||||||
|
|
||||||
|
private Set<Integer> reds = new HashSet<>(2);
|
||||||
|
|
||||||
private RechargeInfo rechargeInfo;
|
private RechargeInfo rechargeInfo;
|
||||||
|
|
||||||
public PlayerManager(){
|
public PlayerManager(){
|
||||||
|
@ -328,4 +332,20 @@ public class PlayerManager extends MongoBase {
|
||||||
this.rechargeInfo = rechargeInfo;
|
this.rechargeInfo = rechargeInfo;
|
||||||
updateString("rechargeInfo", rechargeInfo);
|
updateString("rechargeInfo", rechargeInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Set<Integer> getReds() {
|
||||||
|
return reds;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setReds(Set<Integer> reds) {
|
||||||
|
updateString("reds", reds);
|
||||||
|
this.reds = reds;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void removeRed(int redType){
|
||||||
|
boolean remove = reds.remove(redType);
|
||||||
|
if(remove){
|
||||||
|
updateString("reds", reds);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,15 +4,13 @@ import com.ljsd.common.mogodb.MongoBase;
|
||||||
import com.ljsd.jieling.config.SDailyTasksConfig;
|
import com.ljsd.jieling.config.SDailyTasksConfig;
|
||||||
import com.ljsd.jieling.config.SVipLevelConfig;
|
import com.ljsd.jieling.config.SVipLevelConfig;
|
||||||
import com.ljsd.jieling.logic.dao.root.User;
|
import com.ljsd.jieling.logic.dao.root.User;
|
||||||
import com.ljsd.jieling.logic.mission.GameEvent;
|
import com.ljsd.jieling.logic.mission.*;
|
||||||
import com.ljsd.jieling.logic.mission.GameMisionType;
|
|
||||||
import com.ljsd.jieling.logic.mission.MissionState;
|
|
||||||
import com.ljsd.jieling.logic.mission.MissionType;
|
|
||||||
import com.ljsd.jieling.logic.mission.event.MissionEventDistributor;
|
import com.ljsd.jieling.logic.mission.event.MissionEventDistributor;
|
||||||
import com.ljsd.jieling.logic.mission.main.DailyMissionIdsType;
|
import com.ljsd.jieling.logic.mission.main.DailyMissionIdsType;
|
||||||
import com.ljsd.jieling.logic.mission.main.MissionStateChangeInfo;
|
import com.ljsd.jieling.logic.mission.main.MissionStateChangeInfo;
|
||||||
import com.ljsd.jieling.logic.mission.main.VipMissionIdsType;
|
import com.ljsd.jieling.logic.mission.main.VipMissionIdsType;
|
||||||
|
|
||||||
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
@ -47,12 +45,20 @@ public class UserMissionManager extends MongoBase {
|
||||||
dailyCumulationData.reset();
|
dailyCumulationData.reset();
|
||||||
updateString("dailyCumulationData",dailyCumulationData);
|
updateString("dailyCumulationData",dailyCumulationData);
|
||||||
}else{
|
}else{
|
||||||
for(Integer missionId : missionIds){
|
|
||||||
MissionStateChangeInfo doingInfo = new MissionStateChangeInfo(missionId,
|
|
||||||
MissionState.DOING, null);
|
|
||||||
missionTypeEnumListMap.get(GameMisionType.DAILYMISSION).add(doingInfo);
|
|
||||||
}
|
|
||||||
dailyMissionIdsType.getDoingMissionIds().addAll(missionIds);
|
dailyMissionIdsType.getDoingMissionIds().addAll(missionIds);
|
||||||
|
for(Integer missionId : missionIds){
|
||||||
|
SDailyTasksConfig sDailyTasksConfigById = SDailyTasksConfig.getSDailyTasksConfigById(missionId);
|
||||||
|
boolean isFinish = MissionLoigc.getDoingProgress(user, cumulationData, sDailyTasksConfigById.getType(), sDailyTasksConfigById.getValues()[0]) >= sDailyTasksConfigById.getValues()[1][0];
|
||||||
|
MissionStateChangeInfo stateChangeInfo = new MissionStateChangeInfo(missionId,
|
||||||
|
MissionState.DOING, null);
|
||||||
|
if(isFinish){
|
||||||
|
stateChangeInfo = new MissionStateChangeInfo(missionId,
|
||||||
|
MissionState.FINISH, null);
|
||||||
|
dailyMissionIdsType.getDoingMissionIds().remove(missionId);
|
||||||
|
dailyMissionIdsType.getFinishMissionIds().add(missionId);
|
||||||
|
}
|
||||||
|
missionTypeEnumListMap.get(GameMisionType.DAILYMISSION).add(stateChangeInfo);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
updateString("dailyMissionIdsType",dailyMissionIdsType);
|
updateString("dailyMissionIdsType",dailyMissionIdsType);
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -474,7 +474,6 @@ public class CombatLogic {
|
||||||
|
|
||||||
public void getInvasionBoss(ISession session) throws Exception {
|
public void getInvasionBoss(ISession session) throws Exception {
|
||||||
int uid = session.getUid();
|
int uid = session.getUid();
|
||||||
|
|
||||||
FightInfoProto.AdventureBossInfoResponse.Builder builder = FightInfoProto.AdventureBossInfoResponse.newBuilder();
|
FightInfoProto.AdventureBossInfoResponse.Builder builder = FightInfoProto.AdventureBossInfoResponse.newBuilder();
|
||||||
Map<String, Integer> myHurtInfo = RedisUtil.getInstence().getMapValues(RedisKey.ADVENTRUEN_BOSS_OWN, Integer.toString(uid), String.class, Integer.class);
|
Map<String, Integer> myHurtInfo = RedisUtil.getInstence().getMapValues(RedisKey.ADVENTRUEN_BOSS_OWN, Integer.toString(uid), String.class, Integer.class);
|
||||||
int now = (int)(TimeUtils.now()/1000);
|
int now = (int)(TimeUtils.now()/1000);
|
||||||
|
@ -525,6 +524,8 @@ public class CombatLogic {
|
||||||
RedisUtil.getInstence().removeMapEntrys(RedisKey.ADVENTRUEN_BOSS_INFO,"",removeAdventureBosseInfo.toArray());
|
RedisUtil.getInstence().removeMapEntrys(RedisKey.ADVENTRUEN_BOSS_INFO,"",removeAdventureBosseInfo.toArray());
|
||||||
RedisUtil.getInstence().removeMapEntrys(RedisKey.ADVENTRUEN_BOSS_OWN,"",removeAdventureBosseInfo.toArray());
|
RedisUtil.getInstence().removeMapEntrys(RedisKey.ADVENTRUEN_BOSS_OWN,"",removeAdventureBosseInfo.toArray());
|
||||||
}
|
}
|
||||||
|
User user = UserManager.getUser(uid);
|
||||||
|
user.getPlayerInfoManager().removeRed(GlobalsDef.ARENA_CHALLENGE_TYPE);
|
||||||
}
|
}
|
||||||
MessageUtil.sendMessage(session,1, MessageTypeProto.MessageType.ADVENTURE_BOSSHURT_RESPONSE_VALUE,builder.build(),true);
|
MessageUtil.sendMessage(session,1, MessageTypeProto.MessageType.ADVENTURE_BOSSHURT_RESPONSE_VALUE,builder.build(),true);
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,11 +27,16 @@ public class DailyMissionIdsType extends AbstractMissionType{
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void calCumulationDataResult(User user, CumulationData.Result result, List<MissionStateChangeInfo> missionStateChangeInfos, CumulationData cumulationData) {
|
public void calCumulationDataResult(User user, CumulationData.Result result, List<MissionStateChangeInfo> missionStateChangeInfos, CumulationData cumulationData) {
|
||||||
Set<Integer> doingMissionIds = getDoingMissionIds();
|
|
||||||
List<SDailyTasksConfig> sTaskConfigs = SDailyTasksConfig.getsTaskConfigByTypeMap(result.subType.getMissionTypeValue());
|
List<SDailyTasksConfig> sTaskConfigs = SDailyTasksConfig.getsTaskConfigByTypeMap(result.subType.getMissionTypeValue());
|
||||||
if (sTaskConfigs == null) {
|
if (sTaskConfigs == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
checkAndUpdateMision(user,sTaskConfigs,missionStateChangeInfos,cumulationData);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void checkAndUpdateMision(User user, List<SDailyTasksConfig> sTaskConfigs, List<MissionStateChangeInfo> missionStateChangeInfos,CumulationData cumulationData){
|
||||||
|
Set<Integer> doingMissionIds = getDoingMissionIds();
|
||||||
for (SDailyTasksConfig sTaskConfig : sTaskConfigs) {
|
for (SDailyTasksConfig sTaskConfig : sTaskConfigs) {
|
||||||
int missionId = sTaskConfig.getId();
|
int missionId = sTaskConfig.getId();
|
||||||
if (!doingMissionIds.contains(missionId)) {
|
if (!doingMissionIds.contains(missionId)) {
|
||||||
|
|
|
@ -2,8 +2,11 @@ package com.ljsd.jieling.util;
|
||||||
|
|
||||||
import com.google.protobuf.GeneratedMessage;
|
import com.google.protobuf.GeneratedMessage;
|
||||||
import com.googlecode.protobuf.format.JsonFormat;
|
import com.googlecode.protobuf.format.JsonFormat;
|
||||||
|
import com.ljsd.jieling.core.GlobalsDef;
|
||||||
import com.ljsd.jieling.db.mongo.MongoUtil;
|
import com.ljsd.jieling.db.mongo.MongoUtil;
|
||||||
import com.ljsd.jieling.logic.OnlineUserManager;
|
import com.ljsd.jieling.logic.OnlineUserManager;
|
||||||
|
import com.ljsd.jieling.logic.dao.UserManager;
|
||||||
|
import com.ljsd.jieling.logic.dao.root.User;
|
||||||
import com.ljsd.jieling.logic.room.Room;
|
import com.ljsd.jieling.logic.room.Room;
|
||||||
import com.ljsd.jieling.netty.PackageConstant;
|
import com.ljsd.jieling.netty.PackageConstant;
|
||||||
import com.ljsd.jieling.netty.cocdex.Tea;
|
import com.ljsd.jieling.netty.cocdex.Tea;
|
||||||
|
@ -14,6 +17,7 @@ import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import java.nio.ByteBuffer;
|
import java.nio.ByteBuffer;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
public class MessageUtil {
|
public class MessageUtil {
|
||||||
|
|
||||||
|
@ -25,7 +29,7 @@ public class MessageUtil {
|
||||||
backMessage = new byte[0];
|
backMessage = new byte[0];
|
||||||
} else {
|
} else {
|
||||||
backMessage = generatedMessage.toByteArray();
|
backMessage = generatedMessage.toByteArray();
|
||||||
// LOGGER.info(JsonFormat.printToString(generatedMessage));
|
LOGGER.info(JsonFormat.printToString(generatedMessage));
|
||||||
}
|
}
|
||||||
|
|
||||||
int length = PackageConstant.UID_FIELD_LEN + PackageConstant.TOKEN_LEN
|
int length = PackageConstant.UID_FIELD_LEN + PackageConstant.TOKEN_LEN
|
||||||
|
@ -62,11 +66,19 @@ public class MessageUtil {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public static void sendRedIndication(int sendUid,int redType) {
|
public static void sendRedIndication(int sendUid,int redType) throws Exception {
|
||||||
ISession session = OnlineUserManager.sessionMap.get(sendUid);
|
ISession session = OnlineUserManager.sessionMap.get(sendUid);
|
||||||
if(session!=null){
|
if(session!=null){
|
||||||
PlayerInfoProto.RedPointInfo redPointInfo = PlayerInfoProto.RedPointInfo.newBuilder().setType(redType).build();
|
PlayerInfoProto.RedPointInfo redPointInfo = PlayerInfoProto.RedPointInfo.newBuilder().setType(redType).build();
|
||||||
MessageUtil.sendIndicationMessage(session,1,MessageTypeProto.MessageType.SEND_RED_POINT_INDICATION_VALUE,redPointInfo,true);
|
MessageUtil.sendIndicationMessage(session,1,MessageTypeProto.MessageType.SEND_RED_POINT_INDICATION_VALUE,redPointInfo,true);
|
||||||
|
}else{
|
||||||
|
if(redType == GlobalsDef.MAIL_RED_TYPE){
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
User user = UserManager.getUser(sendUid);
|
||||||
|
Set<Integer> reds = user.getPlayerInfoManager().getReds();
|
||||||
|
reds.add(redType);
|
||||||
|
user.getPlayerInfoManager().setReds(reds);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue