parent
e5ba9ebf06
commit
0367a54aca
|
@ -12,22 +12,18 @@ import com.ljsd.jieling.logic.activity.crossService.CrossServiceLogic;
|
|||
import com.ljsd.jieling.logic.dao.GuilidManager;
|
||||
import com.ljsd.jieling.logic.dao.PlayerManager;
|
||||
import com.ljsd.jieling.logic.dao.UserManager;
|
||||
import com.ljsd.jieling.logic.dao.root.GuildInfo;
|
||||
import com.ljsd.jieling.logic.dao.root.User;
|
||||
import com.ljsd.jieling.logic.family.DeathPathLogic;
|
||||
import com.ljsd.jieling.logic.mail.MailLogic;
|
||||
import rpc.protocols.PlayerInfoProto;
|
||||
import com.ljsd.jieling.util.ItemUtil;
|
||||
import config.SErrorCodeEerverConfig;
|
||||
import io.netty.util.internal.ConcurrentSet;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.data.redis.core.Cursor;
|
||||
import org.springframework.data.redis.core.ZSetOperations;
|
||||
import util.TimeUtils;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
|
@ -300,8 +296,7 @@ public class AreaManager {
|
|||
}
|
||||
PlayerManager playerInfoManager = oldUser.getPlayerInfoManager();
|
||||
playerInfoManager.setNickName(playerInfoManager.getNickName()+"_S"+i);
|
||||
//跨服redis存储名字
|
||||
CrossServiceLogic.getInstance().saveBasicPlayerToRedis(oldUser);
|
||||
CrossServiceLogic.getInstance().saveBasicPlayerToRedis(oldUser);//改名
|
||||
//sendmail
|
||||
String title = SErrorCodeEerverConfig.getI18NMessage("hefugaiming_mail_geren_title");
|
||||
String content = SErrorCodeEerverConfig.getI18NMessage("hefugaiming_mail_geren_txt");
|
||||
|
|
|
@ -8,29 +8,22 @@ import com.ljsd.jieling.db.redis.RedisKey;
|
|||
import com.ljsd.jieling.db.redis.RedisUtil;
|
||||
import com.ljsd.jieling.logic.GlobleSystemLogic;
|
||||
import com.ljsd.jieling.logic.OnlineUserManager;
|
||||
import com.ljsd.jieling.logic.dao.root.GuildInfo;
|
||||
import com.ljsd.jieling.logic.dao.root.User;
|
||||
import com.ljsd.jieling.util.ConfigurableApplicationContextManager;
|
||||
import com.ljsd.jieling.util.InnerMessageUtil;
|
||||
import com.ljsd.jieling.util.SysUtil;
|
||||
import com.mongodb.BasicDBObject;
|
||||
import com.mongodb.DBObject;
|
||||
import com.mongodb.MongoClient;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
import org.springframework.data.annotation.Transient;
|
||||
import org.springframework.data.mongodb.MongoDbFactory;
|
||||
import org.springframework.data.mongodb.core.SimpleMongoDbFactory;
|
||||
import org.springframework.data.mongodb.core.convert.MappingMongoConverter;
|
||||
import org.springframework.data.mongodb.core.query.BasicQuery;
|
||||
import util.MathUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.data.annotation.Transient;
|
||||
import org.springframework.data.mongodb.MongoDbFactory;
|
||||
import org.springframework.data.mongodb.core.MongoTemplate;
|
||||
import org.springframework.data.mongodb.core.SimpleMongoDbFactory;
|
||||
import org.springframework.data.mongodb.core.convert.MappingMongoConverter;
|
||||
import org.springframework.data.mongodb.core.query.Criteria;
|
||||
import org.springframework.data.mongodb.core.query.Query;
|
||||
import util.MathUtils;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.io.File;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.FileOutputStream;
|
||||
|
@ -101,7 +94,7 @@ public class MongoUtil {
|
|||
int randomLevel = MathUtils.random(5, 20);
|
||||
Criteria criatira = new Criteria();
|
||||
int minLevel = level - randomLevel;
|
||||
minLevel = minLevel <= 5 ? 5 : minLevel;
|
||||
minLevel = Math.max(minLevel, 5);
|
||||
int maxLevel = level + randomLevel;
|
||||
long befor3Day = System.currentTimeMillis() - BEFOR_3_DAY;
|
||||
|
||||
|
|
|
@ -1225,7 +1225,6 @@ public class RedisUtil {
|
|||
public <T> List<T> getAllSetToList(String key, Class<T> clazz){
|
||||
for(int i=0;i<MAX_TRY_TIMES;i++){
|
||||
try {
|
||||
|
||||
Set<String> members = redisTemplate.opsForSet().members(key);
|
||||
if(members!=null && !members.isEmpty()){
|
||||
List<T> result = new ArrayList<>(members.size());
|
||||
|
|
|
@ -254,12 +254,9 @@ public class FastChallengeHandler extends BaseHandler<FightInfoProto.FastFightCh
|
|||
// 公会人数处理
|
||||
carDealyFightPeopleNum(uid,guildInfo.getId());
|
||||
|
||||
CrossServiceLogic.getInstance().saveBasicPlayerToRedis(user);
|
||||
|
||||
fightData.toBuilder().setFightId(FightUtil.getFightId(uid,fightData.getFightType()));
|
||||
// 记录战报
|
||||
FightRecordLogic.getInstance().addRecordMap(user,fightData);
|
||||
|
||||
//扣除次数
|
||||
PlayerLogic.getInstance().checkAndUpdate(user, privilege, 1);
|
||||
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
package com.ljsd.jieling.handler.crossServer;
|
||||
|
||||
import com.ljsd.jieling.core.FunctionIdEnum;
|
||||
import com.ljsd.jieling.core.GlobalsDef;
|
||||
import com.ljsd.jieling.db.redis.RedisKey;
|
||||
import com.ljsd.jieling.db.redis.RedisUtil;
|
||||
import com.ljsd.jieling.globals.BIReason;
|
||||
|
@ -54,8 +53,6 @@ public class CrossYuxulundaoGetInfoHandler extends BaseHandler<ArenaInfoProto.Cr
|
|||
//ArenaOfUser myQuery = CrossServiceLogic.getInstance().query(user.getId());
|
||||
CSPlayer csPlayer = CrossServiceLogic.getPlayerByRedis(uid);
|
||||
if (csPlayer == null) {
|
||||
//跨服redis存储最大战力
|
||||
CrossServiceLogic.getInstance().saveBasicPlayerToRedis(user);
|
||||
MessageUtil.sendMessage(session, 1, MessageTypeProto.MessageType.CrossYuXuLunDaoGetInfoResponse.getNumber(), builder.build(), true);
|
||||
return;
|
||||
}
|
||||
|
@ -82,7 +79,7 @@ public class CrossYuxulundaoGetInfoHandler extends BaseHandler<ArenaInfoProto.Cr
|
|||
builder.setMyRank(myRank);
|
||||
List<ArenaEnemy> enemyList = arenaManager.getCrossYuxulundaoEnemies();
|
||||
if (enemyList != null && enemyList.size() > 0) {
|
||||
enemyList.forEach(n -> builder.addArenaEnemys(CrossYuxulundaoLogic.getInstance().getMatchRivalInfo(n.getEnemyId(), 0)));
|
||||
enemyList.forEach(n -> builder.addArenaEnemys(CrossYuxulundaoLogic.getMatchRivalInfo(n.getEnemyId(), 0)));
|
||||
}
|
||||
MessageUtil.sendMessage(session, 1, MessageTypeProto.MessageType.CrossYuXuLunDaoGetInfoResponse.getNumber(), builder.build(), true);
|
||||
return;
|
||||
|
@ -108,7 +105,7 @@ public class CrossYuxulundaoGetInfoHandler extends BaseHandler<ArenaInfoProto.Cr
|
|||
}
|
||||
builder.setIsFirst(true);
|
||||
isNeedUpdate = true;
|
||||
CrossServiceLogic.getInstance().saveBasicPlayerToRedis(user);
|
||||
|
||||
}else {
|
||||
//赛季内第一次登陆请求,删除上赛季的挑战记录
|
||||
String key = RedisKey.getKey(RedisKey.CROSS_YUXULUNDAO_RECORD, String.valueOf(uid), false);
|
||||
|
@ -150,7 +147,7 @@ public class CrossYuxulundaoGetInfoHandler extends BaseHandler<ArenaInfoProto.Cr
|
|||
}
|
||||
List<ArenaEnemy> enemyList = arenaManager.getCrossYuxulundaoEnemies();
|
||||
if (enemyList != null && enemyList.size() > 0) {
|
||||
enemyList.forEach(n -> builder.addArenaEnemys(CrossYuxulundaoLogic.getInstance().getMatchRivalInfo(n.getEnemyId(), 0)));
|
||||
enemyList.forEach(n -> builder.addArenaEnemys(CrossYuxulundaoLogic.getMatchRivalInfo(n.getEnemyId(), 0)));
|
||||
}
|
||||
int oldScore = csPlayer.getCrossYuxulundaoOldScore();
|
||||
int newScore = csPlayer.getCrossYuxulundaoNewScore();
|
||||
|
@ -184,9 +181,7 @@ public class CrossYuxulundaoGetInfoHandler extends BaseHandler<ArenaInfoProto.Cr
|
|||
isNeedUpdate = true;
|
||||
}
|
||||
if (isNeedUpdate) {
|
||||
//CrossServiceLogic.getInstance().update(myQuery);
|
||||
//CrossServiceLogic.getInstance().saveBasicPlayerToRedis(user);
|
||||
RedisUtil.getInstence().setObject(CrossServiceLogic.getKey(uid),csPlayer,CrossServiceLogic.EXPIRE);
|
||||
CrossServiceLogic.update(csPlayer);
|
||||
}
|
||||
builder.addAllDailyRewardState(arenaManager.getCrossYuxulundaoDailyRewad());
|
||||
builder.setChangedTimes(user.getPlayerInfoManager().getVipPrivilageValue(privId));
|
||||
|
|
|
@ -4,9 +4,9 @@ import com.ljsd.jieling.handler.BaseHandler;
|
|||
import com.ljsd.jieling.logic.friend.FriendLogic;
|
||||
import com.ljsd.jieling.netty.cocdex.PacketNetData;
|
||||
import com.ljsd.jieling.network.session.ISession;
|
||||
import org.springframework.stereotype.Component;
|
||||
import rpc.protocols.MessageTypeProto;
|
||||
import rpc.protocols.PlayerInfoProto;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
|
||||
@Component
|
||||
|
@ -34,7 +34,6 @@ public class GetFriendInfoHandler extends BaseHandler {
|
|||
FriendLogic.getInstance().getBlackFriendInfos(iSession);
|
||||
break;
|
||||
default: {
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -73,8 +73,6 @@ public class UpPracticeLevelHandler extends BaseHandler<HeroInfoProto.UpPractice
|
|||
|
||||
// 升级
|
||||
user.getHeroManager().setPracticeLevel(xiuXian2.getId());
|
||||
//跨服redis存储修行等级
|
||||
CrossServiceLogic.getInstance().saveBasicPlayerToRedis(user);
|
||||
user.getPlayerInfoManager().setNameColor(xiuXian2.getNameFontColor());
|
||||
|
||||
// 添加技能
|
||||
|
@ -99,6 +97,7 @@ public class UpPracticeLevelHandler extends BaseHandler<HeroInfoProto.UpPractice
|
|||
Poster.getPoster().dispatchEvent(new SaveHeroForceEvent(user.getId(),""));
|
||||
// 特权任务
|
||||
user.getUserMissionManager().onGameEvent(user, GameEvent.XIUXING_UP, MissionType.XIUXING_LEVEL, 0);
|
||||
CrossServiceLogic.getInstance().saveBasicPlayerToRedis(user);//修行升级
|
||||
// 升级返回
|
||||
HeroInfoProto.UpPracticeLevelResponse build = HeroInfoProto.UpPracticeLevelResponse.newBuilder().setPracticeLevel(xiuXian2.getId()).build();
|
||||
MessageUtil.sendMessage(iSession,1, MessageTypeProto.MessageType.UpPracticeLevelResponse_VALUE,build,true);
|
||||
|
|
|
@ -97,8 +97,7 @@ public class UserLevelEventHandler implements IEventHandler,IPrivilegeChange{
|
|||
//发首发预约邮件
|
||||
sendOrderMail(coreMongoTemplate,user);
|
||||
}
|
||||
//跨服redis存储级数
|
||||
CrossServiceLogic.getInstance().saveBasicPlayerToRedis(user);
|
||||
CrossServiceLogic.getInstance().saveBasicPlayerToRedis(user);//角色升级
|
||||
ActivityLogic.getInstance().updateActivityMissionProgress(user, ActivityType.GrowthFund,level);
|
||||
if(sGlobalSystemConfigs == null){
|
||||
return;
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
package com.ljsd.jieling.logic.activity.crossService;
|
||||
|
||||
import com.ljsd.GameApplication;
|
||||
import com.ljsd.jieling.db.mongo.MongoUtil;
|
||||
import com.ljsd.jieling.db.mongo.core.CServerInfo;
|
||||
import com.ljsd.jieling.db.redis.RedisKey;
|
||||
|
@ -105,7 +104,6 @@ public class CrossServiceLogic {
|
|||
csPlayer.setSkin(p.getUserSkin());
|
||||
csPlayer.setUserTitle(p.getUserTitle());
|
||||
csPlayer.setPracticeLevel(user.getHeroManager().getPracticeLevel());
|
||||
csPlayer.setServerId(GameApplication.serverId);
|
||||
csPlayer.setSex(p.getSex());
|
||||
csPlayer.setUserMount(p.getUserMount());
|
||||
csPlayer.setGuildId(p.getGuildId());
|
||||
|
|
|
@ -53,6 +53,7 @@ public class SaveHeroForceEventHandler implements IEventHandler {
|
|||
User user = UserManager.getUser(uid);
|
||||
// 英雄星级排行榜处理
|
||||
heroStarHandle(user);
|
||||
boolean isNeed = false;
|
||||
// 需要存储战力的编队
|
||||
List<Integer> saveForceTeamList = TeamEnum.getSaveForceTeamList();
|
||||
for (Integer teamId : saveForceTeamList) {
|
||||
|
@ -70,9 +71,13 @@ public class SaveHeroForceEventHandler implements IEventHandler {
|
|||
// 重新计算战力,并更新
|
||||
int force = HeroLogic.getInstance().calTeamTotalForce(user, TeamEnum.FORMATION_NORMAL.getTeamId(), false);
|
||||
user.getTeamPosManager().putTeamForceMap(teamId,force);
|
||||
if (TeamEnum.isCrossTeam(teamId)) {
|
||||
isNeed = true;
|
||||
}
|
||||
}
|
||||
if (isNeed){
|
||||
CrossServiceLogic.getInstance().saveBasicPlayerToRedis(user);//战力更新
|
||||
}
|
||||
// 更新跨服数据
|
||||
CrossServiceLogic.updateCsPlayer(uid);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -258,7 +258,7 @@ public class CrossYuxulundaoLogic {
|
|||
Map<Integer, SArenaRobotConfig> robotConfigMap = STableManager.getConfig(SArenaRobotConfig.class);
|
||||
if (robotConfigMap.containsKey(enemyId)) {
|
||||
SArenaRobotConfig sArenaRobotConfig = robotConfigMap.get(enemyId);
|
||||
CommonProto.ArenaPersonInfo personInfoBuild = CommonProto.ArenaPersonInfo.newBuilder()
|
||||
return CommonProto.ArenaPersonInfo.newBuilder()
|
||||
.setUid(enemyId)
|
||||
.setLevel(sArenaRobotConfig.getRobotLevel())
|
||||
.setName(sArenaRobotConfig.getRobotName())
|
||||
|
@ -268,7 +268,6 @@ public class CrossYuxulundaoLogic {
|
|||
.setHeadFrame(0)
|
||||
.setScore(robotConfigMap.get(enemyId).getMsScroe())
|
||||
.build();
|
||||
return personInfoBuild;
|
||||
}
|
||||
//其他服务器玩家
|
||||
CSPlayer csPlayer = CrossServiceLogic.getPlayerByRedis(enemyId);
|
||||
|
|
|
@ -124,7 +124,6 @@ public class UserManager {
|
|||
UserManager.addUser(user);
|
||||
initPlayer(user,openId,channel,pid,gid,platform,ip,channle_id,bundle_id,ccId,pack_Id);
|
||||
MongoUtil.getInstence().getMyMongoTemplate().save(user.getId(),user);
|
||||
PlayerLogic.getInstance().sendTestWelfareMail(user,1,1);
|
||||
return user;
|
||||
}
|
||||
|
||||
|
@ -174,7 +173,6 @@ public class UserManager {
|
|||
playerManager.setRideLevel(1);
|
||||
PlayerLogic.getInstance().vipflushEveryDay(user,null);
|
||||
ActivityLogic.getInstance().newPlayerOpenActivityMission(user);
|
||||
PlayerLogic.getInstance().playerInfoUpdate(user);
|
||||
user.getMainLevelManager().init();
|
||||
user.getUserMissionManager().onGameEvent(user, GameEvent.USER_LEVELUP,0,1);
|
||||
user.getUserMissionManager().onGameEvent(user, GameEvent.DAILY_REFRESH,0);
|
||||
|
@ -195,10 +193,7 @@ public class UserManager {
|
|||
int force = HeroLogic.getInstance().calTeamTotalForce(user, 1, true);
|
||||
playerManager.setMaxForce(force);
|
||||
user.getExpeditionManager().setExpeditionLeve(1);
|
||||
//跨服redis存储基本数据
|
||||
CrossServiceLogic.getInstance().saveBasicPlayerToRedis(user);
|
||||
|
||||
// user.getExpeditionManager().setForceSnap(force);
|
||||
CrossServiceLogic.getInstance().saveBasicPlayerToRedis(user);//初始化角色
|
||||
KtEventUtils.onKtEvent(user, ParamEventBean.UserRegister);
|
||||
}
|
||||
|
||||
|
|
|
@ -177,8 +177,7 @@ public class CSPlayer {
|
|||
}
|
||||
|
||||
public int getServerId() {
|
||||
int serverId = AreaManager.getInstance().getServerIdByUid(userId, GameApplication.serverId);
|
||||
return serverId;
|
||||
return AreaManager.getInstance().getServerIdByUid(userId, GameApplication.serverId);
|
||||
}
|
||||
|
||||
public void setServerId(int serverId) {
|
||||
|
|
|
@ -10,22 +10,24 @@ import com.ljsd.jieling.logic.GlobleSystemLogic;
|
|||
import com.ljsd.jieling.logic.OnlineUserManager;
|
||||
import com.ljsd.jieling.logic.activity.ActivityLogic;
|
||||
import com.ljsd.jieling.logic.activity.ActivityTypeEnum;
|
||||
import com.ljsd.jieling.logic.activity.crossService.CrossServiceLogic;
|
||||
import com.ljsd.jieling.logic.activity.event.ExploreEvent;
|
||||
import com.ljsd.jieling.logic.activity.event.Poster;
|
||||
import com.ljsd.jieling.logic.dao.*;
|
||||
import com.ljsd.jieling.logic.dao.cross.CSPlayer;
|
||||
import com.ljsd.jieling.logic.dao.ExplorerInfo;
|
||||
import com.ljsd.jieling.logic.dao.GuilidManager;
|
||||
import com.ljsd.jieling.logic.dao.TeamEnum;
|
||||
import com.ljsd.jieling.logic.dao.UserManager;
|
||||
import com.ljsd.jieling.logic.dao.root.GuildInfo;
|
||||
import com.ljsd.jieling.logic.dao.root.User;
|
||||
import com.ljsd.jieling.logic.hero.HeroLogic;
|
||||
import com.ljsd.jieling.logic.mail.MailLogic;
|
||||
import com.ljsd.jieling.logic.mission.GameEvent;
|
||||
import com.ljsd.jieling.logic.mission.MissionType;
|
||||
import com.ljsd.jieling.logic.rank.RankEnum;
|
||||
import com.ljsd.jieling.network.session.ISession;
|
||||
import com.ljsd.jieling.util.ItemUtil;
|
||||
import com.ljsd.jieling.util.MessageUtil;
|
||||
import config.*;
|
||||
import config.SErrorCodeEerverConfig;
|
||||
import config.SExplore;
|
||||
import config.SExploreFight;
|
||||
import config.SSpecialConfig;
|
||||
import manager.STableManager;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
@ -37,7 +39,6 @@ import util.StringUtil;
|
|||
import util.TimeUtils;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class ExplorerMapLogic {
|
||||
|
||||
|
@ -130,8 +131,7 @@ public class ExplorerMapLogic {
|
|||
guildInfo.setExploreKillMonsterNum(guildInfo.getExploreKillMonsterNum() + 1);
|
||||
GuilidManager.saveOrUpdateGuildInfo(guildInfo);
|
||||
Poster.getPoster().dispatchEvent(new ExploreEvent(user.getId(), 1));
|
||||
Set<Integer> allUid = new HashSet<>();
|
||||
allUid.addAll(guildInfo.getMembers().get(GlobalsDef.CHAIRMAN));
|
||||
Set<Integer> allUid = new HashSet<>(guildInfo.getMembers().get(GlobalsDef.CHAIRMAN));
|
||||
if (guildInfo.getMembers().get(GlobalsDef.MEMBER) != null) {
|
||||
allUid.addAll(guildInfo.getMembers().get(GlobalsDef.MEMBER));
|
||||
}
|
||||
|
@ -193,79 +193,6 @@ public class ExplorerMapLogic {
|
|||
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取地图玩家信息
|
||||
*/
|
||||
public static CommonProto.ArenaPersonInfo getMapPlayerInfo(int uid) {
|
||||
//其他服务器玩家
|
||||
CSPlayer csPlayer = CrossServiceLogic.getPlayerByRedis(uid);
|
||||
if (csPlayer == null) {
|
||||
return null;
|
||||
}
|
||||
String serverName = CrossServiceLogic.simplifyServerName(csPlayer.getServerId());
|
||||
return CommonProto.ArenaPersonInfo.newBuilder()
|
||||
.setUid(uid)
|
||||
.setLevel(csPlayer.getLevel())
|
||||
.setName(csPlayer.getName())
|
||||
.setServername(serverName)
|
||||
.setTotalForce(csPlayer.getMaxFore()) //.setTotalForce(crossArenaManager.getTotalForce())
|
||||
.setUserTitle(csPlayer.getUserTitle())
|
||||
.setUserMount(csPlayer.getUserMount())
|
||||
.setGender(csPlayer.getSex())
|
||||
.setUserSkin(csPlayer.getSkin())
|
||||
.setPracticeLevel(csPlayer.getPracticeLevel())
|
||||
.setScore(csPlayer.getCrossYuxulundaoNewScore())
|
||||
.setRank(0)
|
||||
.setHead(csPlayer.getHead())
|
||||
.setHeadFrame(csPlayer.getHeadFrame())
|
||||
.build();
|
||||
}
|
||||
|
||||
public static void sendRandomEvent(User user) {
|
||||
ISession sess = OnlineUserManager.sessionMap.get(user.getId());
|
||||
Map<Integer, SExplore> config = STableManager.getConfig(SExplore.class);
|
||||
Map<Integer, SExploreEvent> exploreEventConfig = STableManager.getConfig(SExploreEvent.class);
|
||||
List<SExplore> limitConfig = config.values().stream().filter(n -> n.getLevel() <= user.getPlayerInfoManager().getLevel()).collect(Collectors.toList());
|
||||
Random random = new Random();
|
||||
int randomMapId = random.nextInt(limitConfig.size());
|
||||
SExplore rankExplore = limitConfig.get(randomMapId);
|
||||
if(rankExplore.getEventList().length == 0){
|
||||
return;
|
||||
}
|
||||
int randomEventId = random.nextInt(rankExplore.getEventList().length);
|
||||
int eventId = rankExplore.getEventList()[randomEventId];
|
||||
LOGGER.info("explore add eventId:" + eventId + " randomMapId: " + randomMapId + 1);
|
||||
user.getPlayerInfoManager().addExploreEvent(new KeyVal(eventId, TimeUtils.nowInt() + exploreEventConfig.get(eventId).getTime(), randomMapId + 1));
|
||||
PlayerInfoProto.ExplorerMapIndicationEventResponse.Builder indication = PlayerInfoProto.ExplorerMapIndicationEventResponse.newBuilder();
|
||||
List<KeyVal> event = user.getPlayerInfoManager().getExploreEvent();
|
||||
//删除过期的
|
||||
if (event.removeIf(n -> n.getVal() < TimeUtils.nowInt())) {
|
||||
user.getPlayerInfoManager().setExploreEvent(event);
|
||||
}
|
||||
for (KeyVal keyVal : event) {
|
||||
indication.addRandEvent(CommonProto.CommKeyVal.newBuilder().setKey(keyVal.getKey()).setVal(keyVal.getVal()).
|
||||
setVal2(keyVal.getVa2()).build());
|
||||
}
|
||||
MessageUtil.sendIndicationMessage(sess, 1, MessageTypeProto.MessageType.ExplorerMapIndicationEventResponse_VALUE, indication.build(), true);
|
||||
}
|
||||
|
||||
public static void sendDisappearEvent(User user) {
|
||||
ISession sess = OnlineUserManager.sessionMap.get(user.getId());
|
||||
List<KeyVal> event = user.getPlayerInfoManager().getExploreEvent();
|
||||
if(event.size() == 0 ||event == null){
|
||||
return;
|
||||
}
|
||||
if (event.removeIf(n -> n.getVal() < TimeUtils.nowInt())) {
|
||||
user.getPlayerInfoManager().setExploreEvent(event);
|
||||
PlayerInfoProto.ExplorerMapIndicationEventResponse.Builder indication = PlayerInfoProto.ExplorerMapIndicationEventResponse.newBuilder();
|
||||
for (KeyVal keyVal : event) {
|
||||
indication.addRandEvent(CommonProto.CommKeyVal.newBuilder().setKey(keyVal.getKey()).setVal(keyVal.getVal()).
|
||||
setVal2(keyVal.getVa2()).build());
|
||||
}
|
||||
MessageUtil.sendIndicationMessage(sess, 1, MessageTypeProto.MessageType.ExplorerMapIndicationEventResponse_VALUE, indication.build(), true);
|
||||
}
|
||||
}
|
||||
|
||||
public void calOfflineReward(User user) throws Exception {
|
||||
//计算离线奖励
|
||||
Map<Integer, ExplorerInfo> explorer = user.getPlayerInfoManager().getExplorer();
|
||||
|
|
|
@ -20,8 +20,10 @@ import com.ljsd.jieling.ktbeans.KtEventUtils;
|
|||
import com.ljsd.jieling.ktbeans.parmsBean.ParamEventBean;
|
||||
import com.ljsd.jieling.logic.GlobalDataManaager;
|
||||
import com.ljsd.jieling.logic.OnlineUserManager;
|
||||
import com.ljsd.jieling.logic.activity.crossService.CrossServiceLogic;
|
||||
import com.ljsd.jieling.logic.blood.BloodLogic;
|
||||
import com.ljsd.jieling.logic.dao.*;
|
||||
import com.ljsd.jieling.logic.dao.cross.CSPlayer;
|
||||
import com.ljsd.jieling.logic.dao.root.GuildInfo;
|
||||
import com.ljsd.jieling.logic.dao.root.User;
|
||||
import com.ljsd.jieling.logic.fight.*;
|
||||
|
@ -220,17 +222,23 @@ public class GuildFightLogic {
|
|||
}
|
||||
fightInfo.addBuildBuff(buffInfo);
|
||||
}
|
||||
Map<Integer, Set<Integer>> members = GuilidManager.getGuildInfo(guildId).getMembers();
|
||||
for (Map.Entry<Integer, FamilyFightInfo> entry : fightValues.entrySet()) {
|
||||
Integer uid = entry.getKey();
|
||||
Family.FamilyFightPlayerInfo.Builder playerInfo = Family.FamilyFightPlayerInfo.newBuilder();
|
||||
playerInfo.setBuildId(entry.getValue().getBuildId());
|
||||
playerInfo.setStarCount(fightValues.get(entry.getKey()).getStarCount());
|
||||
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);
|
||||
playerInfo.setStarCount(fightValues.get(uid).getStarCount());
|
||||
CSPlayer player = CrossServiceLogic.getPlayerByRedis(uid);
|
||||
if (player == null){
|
||||
continue;
|
||||
}
|
||||
int memberType = GuildLogic.getMemberType(uid, members);
|
||||
FamilyFightInfo forceInfo = RedisUtil.getInstence().getMapEntry(RedisKey.FAMILY_FIGHT, String.valueOf(guildId), String.valueOf(uid), FamilyFightInfo.class);
|
||||
Family.FamilyUserInfo.Builder userInfo = Family.FamilyUserInfo.newBuilder()
|
||||
.setRoleUid(entry.getKey())
|
||||
.setRoleUid(uid)
|
||||
.setUserName(player.getName())
|
||||
.setUserLevel(player.getLevel())
|
||||
.setPosition(player.getGuildPosition())
|
||||
.setPosition(memberType)
|
||||
.setSoulForce(forceInfo.getForce())
|
||||
.setHead(player.getHead())
|
||||
.setFrame(player.getHeadFrame())
|
||||
|
@ -431,7 +439,7 @@ public class GuildFightLogic {
|
|||
/**
|
||||
* 战斗之后数据更新
|
||||
*/
|
||||
public static void familyFightResult(ISession session, int defendUid,int gid, MessageTypeProto.MessageType messageType) throws Exception {
|
||||
public static void familyFightResult(ISession session, int defendUid,int gid,MessageTypeProto.MessageType messageType) throws Exception {
|
||||
User userAttack = UserManager.getUser(session.getUid());
|
||||
RedisUtil redisUtil = RedisUtil.getInstence();
|
||||
//战斗次数
|
||||
|
@ -476,9 +484,15 @@ public class GuildFightLogic {
|
|||
indexAttack++;
|
||||
}
|
||||
}else{
|
||||
PlayerInfoCache player = RedisUtil.getInstence().getMapEntry(RedisKey.PLAYER_INFO_CACHE, "", String.valueOf(defendUid), PlayerInfoCache.class);
|
||||
|
||||
int memberType =player.getGuildPosition();
|
||||
CSPlayer player = CrossServiceLogic.getPlayerByRedis(defendUid);
|
||||
if (player == null){
|
||||
throw new ErrorCodeException(ErrorCode.FRIENDS_USER_NULL,"uid:"+defendUid);
|
||||
}
|
||||
int memberType = 0;
|
||||
Map<Integer, Set<Integer>> members = GuilidManager.getGuildInfo(player.getGuildId()).getMembers();
|
||||
if (members != null && !members.isEmpty()){
|
||||
memberType = GuildLogic.getMemberType(defendUid,members);
|
||||
}
|
||||
int maxStar = sGuildSetting.getStarNum()[memberType-1];
|
||||
getStar =(aliveHero-aliveCount)*maxStar/5;
|
||||
//倍数k(maxStar/5)
|
||||
|
@ -492,7 +506,6 @@ public class GuildFightLogic {
|
|||
redisUtil.putMapEntry(RedisKey.FAMILY_FIGHT, String.valueOf(gid), String.valueOf(defendUid), defendInfo);
|
||||
//发送indication
|
||||
Family.DefeatResponse fightResponse = Family.DefeatResponse.newBuilder().setUid(defendUid).setTeamLostStar(getStar).build();
|
||||
// GuildLogic.sendIndicationToMember(GuilidManager.guildInfoMap.get(gid), MessageTypeProto.MessageType.FAMILY_DEFEATE_INDICATION,fightResponse);
|
||||
GuildLogic.sendIndicationToMember(GuilidManager.getGuildInfo(userAttack.getPlayerInfoManager().getGuildId()), MessageTypeProto.MessageType.FAMILY_DEFEATE_INDICATION,fightResponse);
|
||||
//获得星数处理
|
||||
int attackGuildId = userAttack.getPlayerInfoManager().getGuildId();
|
||||
|
@ -855,32 +868,33 @@ public class GuildFightLogic {
|
|||
|
||||
/**
|
||||
* 查询该公会个人战绩
|
||||
* @param session
|
||||
* @param 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){
|
||||
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;
|
||||
Family.PersonalFightResultResponse.Builder response = Family.PersonalFightResultResponse.newBuilder();
|
||||
Map<Integer, Set<Integer>> members = GuilidManager.getGuildInfo(guildId).getMembers();
|
||||
while (it.hasNext()){
|
||||
ZSetOperations.TypedTuple<String> personal = it.next();
|
||||
int uid = Integer.parseInt(personal.getValue());
|
||||
PlayerInfoCache playerInfo = RedisUtil.getInstence().getMapEntry(RedisKey.PLAYER_INFO_CACHE, "", String.valueOf(uid), PlayerInfoCache.class);
|
||||
// PlayerManager playerInfoManager = UserManager.getUser(uid).getPlayerInfoManager();
|
||||
CSPlayer player = CrossServiceLogic.getPlayerByRedis(uid);
|
||||
if (player == null){
|
||||
continue;
|
||||
}
|
||||
int memberType = GuildLogic.getMemberType(uid, members);
|
||||
Family.PersonalFightResult.Builder fightResult = Family.PersonalFightResult.newBuilder()
|
||||
.setRank(rank)
|
||||
.setAttackCount(RedisUtil.getInstence().getMapEntry(RedisKey.FAMILY_FIGHT_ATTACK_COUNT,"",String.valueOf(uid),Integer.class))
|
||||
.setUid(uid)
|
||||
.setHead(playerInfo.getHead())
|
||||
.setHeadFrame(playerInfo.getHeadFrame())
|
||||
.setPosition(playerInfo.getGuildPosition())
|
||||
.setName(playerInfo.getName())
|
||||
.setHead(player.getHead())
|
||||
.setHeadFrame(player.getHeadFrame())
|
||||
.setPosition(memberType)
|
||||
.setName(player.getName())
|
||||
.setStarCount(personal.getScore().intValue());
|
||||
response.addResult(fightResult.build());
|
||||
rank++;
|
||||
|
|
|
@ -25,7 +25,10 @@ import com.ljsd.jieling.logic.activity.event.CommitSheJiEvent;
|
|||
import com.ljsd.jieling.logic.activity.event.GuildForceChangeEvent;
|
||||
import com.ljsd.jieling.logic.activity.event.Poster;
|
||||
import com.ljsd.jieling.logic.activity.event.SaveHeroForceEvent;
|
||||
import com.ljsd.jieling.logic.dao.*;
|
||||
import com.ljsd.jieling.logic.dao.GuildMyInfo;
|
||||
import com.ljsd.jieling.logic.dao.GuilidManager;
|
||||
import com.ljsd.jieling.logic.dao.PlayerManager;
|
||||
import com.ljsd.jieling.logic.dao.UserManager;
|
||||
import com.ljsd.jieling.logic.dao.root.*;
|
||||
import com.ljsd.jieling.logic.mail.MailLogic;
|
||||
import com.ljsd.jieling.logic.mission.GameEvent;
|
||||
|
@ -174,10 +177,6 @@ public class GuildLogic {
|
|||
|
||||
/**
|
||||
* 创建公会
|
||||
* @param session
|
||||
* @param familyName
|
||||
* @param announce
|
||||
* @throws Exception
|
||||
*/
|
||||
public static void createFamily(ISession session,String familyName,String announce) throws Exception {
|
||||
int uid = session.getUid();
|
||||
|
@ -210,14 +209,9 @@ public class GuildLogic {
|
|||
user.getPlayerInfoManager().setGuildId(guildInfo.getId());
|
||||
addGuildLog(guildInfo.getId(),GuildDef.Log.CREATE,user.getPlayerInfoManager().getNickName());
|
||||
|
||||
// 更新redis
|
||||
CrossServiceLogic.getInstance().saveBasicPlayerToRedis(user);
|
||||
RedisUtil.getInstence().setObject(RedisKey.GUILD_SERVERID + RedisKey.Delimiter_colon + guildInfo.getId(), GameApplication.serverId, -1);
|
||||
|
||||
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);
|
||||
user.getUserMissionManager().onGameEvent(user,GameEvent.JOIN_FAMILY);
|
||||
|
||||
Family.FamilyCreateResponse build = Family.FamilyCreateResponse.newBuilder()
|
||||
.setFamilyBaseInfo(CBean2Proto.getFamilyBaseInfo(guildInfo))
|
||||
.setFamilyUserInfo(CBean2Proto.getFamilyUserInfo(user,GlobalsDef.CHAIRMAN))
|
||||
|
@ -225,6 +219,7 @@ public class GuildLogic {
|
|||
.build();
|
||||
Poster.getPoster().dispatchEvent(new GuildForceChangeEvent(user.getId(),user.getPlayerInfoManager().getGuildId(),1,user.getPlayerInfoManager().getMaxForce()));
|
||||
ReportUtil.onReportEvent(user, ReportEventEnum.CREATE_GUILD.getType(),String.valueOf(guildInfo.getId()),guildInfo.getName(),guildInfo.getLevel(),guildInfo.getTotalMembers());
|
||||
CrossServiceLogic.getInstance().saveBasicPlayerToRedis(user);//创建公会
|
||||
MessageUtil.sendMessage(session,1,msgId,build,true);
|
||||
}
|
||||
|
||||
|
@ -401,6 +396,7 @@ public class GuildLogic {
|
|||
addGuildLog(guildInfo.getId(),GuildDef.Log.JOIN,user.getPlayerInfoManager().getNickName());
|
||||
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();
|
||||
CrossServiceLogic.getInstance().saveBasicPlayerToRedis(user);//加入公会
|
||||
MessageUtil.sendMessage(session,1,msgId,response,true);
|
||||
}
|
||||
|
||||
|
@ -601,9 +597,6 @@ public class GuildLogic {
|
|||
targetUser.getPlayerInfoManager().setGuildId(guildInfo.getId());
|
||||
targetUser.getGuildMyInfo().setJoinTime(TimeUtils.nowInt());
|
||||
MessageUtil.sendIndicationMessage(targetUser.getId(),Family.FamilyFeteRewardProcessIndication.newBuilder().setScore(guildInfo.getFete()).build());
|
||||
PlayerInfoCache cache = RedisUtil.getInstence().getMapEntry(RedisKey.PLAYER_INFO_CACHE, "", String.valueOf(applyId), PlayerInfoCache.class);
|
||||
cache.setGuildPosition(GlobalsDef.MEMBER);
|
||||
RedisUtil.getInstence().putMapEntry(RedisKey.PLAYER_INFO_CACHE,"",String.valueOf(applyId),cache);
|
||||
AyyncWorker ayyncWorker = new AyyncWorker(targetUser, true, new AynMissionWorker(GameEvent.JOIN_FAMILY));
|
||||
ProtocolsManager.getInstance().updateAyncWorker(ayyncWorker);
|
||||
Poster.getPoster().dispatchEvent(new GuildForceChangeEvent(targetUser.getId(),targetUser.getPlayerInfoManager().getGuildId(),1,targetUser.getPlayerInfoManager().getMaxForce()));
|
||||
|
@ -614,8 +607,6 @@ public class GuildLogic {
|
|||
.setType(entry.getKey())
|
||||
.setNum(entry.getValue()));
|
||||
}
|
||||
|
||||
//notify all change
|
||||
Family.GuildHelpInfoIndication build = builder
|
||||
.setUid(targetUser.getId())
|
||||
.setName(targetUser.getPlayerInfoManager().getNickName())
|
||||
|
@ -694,9 +685,6 @@ public class GuildLogic {
|
|||
|
||||
/**
|
||||
* 任命
|
||||
* @param session
|
||||
* @param targetUid
|
||||
* @param position
|
||||
*/
|
||||
public static void appointMent(ISession session,int targetUid,int position) throws Exception {
|
||||
int msgId = MessageTypeProto.MessageType.FAMILY_APPOINTMENT_RESPONSE_VALUE;
|
||||
|
@ -742,12 +730,9 @@ public class GuildLogic {
|
|||
}
|
||||
guildInfo.removeMember(targetType,targetUid);
|
||||
guildInfo.addMembers(position,targetUid);
|
||||
PlayerLogic.getInstance().playerInfoUpdate(PlayerLogic.getInstance().getUserByRpc(targetUid));
|
||||
sendPositionChange(targetUid,position);
|
||||
|
||||
if(position == GlobalsDef.CHAIRMAN){
|
||||
guildInfo.removeMember(GlobalsDef.CHAIRMAN,uid);
|
||||
PlayerLogic.getInstance().playerInfoUpdate(user);
|
||||
guildInfo.addMembers(GlobalsDef.MEMBER,uid);
|
||||
sendPositionChange(uid,GlobalsDef.CHAIRMAN_TO_MENBER);
|
||||
// 转移会长
|
||||
|
@ -970,10 +955,6 @@ public class GuildLogic {
|
|||
|
||||
//TODO lock check
|
||||
OnUserLeveFamily(user);
|
||||
|
||||
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);
|
||||
user.getPlayerInfoManager().setGuildId(0);
|
||||
user.getPlayerInfoManager().setWelfareRedPackets(clearRedPacketMap(user));
|
||||
|
@ -1659,8 +1640,6 @@ public class GuildLogic {
|
|||
}
|
||||
|
||||
RedisUtil.getInstence().zsetRemoveOne(RedisUtil.getInstence().getKey(personRank.getCrossRedisKey(),"",true),String.valueOf(user.getId()));
|
||||
|
||||
// RedisUtil.getInstence().putMapEntry(RedisKey.USER_LEVEL_GUILD_INFO,"",String.valueOf(user.getId()),guildId);
|
||||
// 十绝阵
|
||||
RedisUtil.getInstence().zsetRemoveOne(RedisUtil.getInstence().getKey(RedisKey.DEATH_PATH_TOTAL_PERSON_RANK,""),String.valueOf(user.getId()));
|
||||
//删除战力
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
package com.ljsd.jieling.logic.friend;
|
||||
|
||||
import com.ljsd.jieling.config.clazzStaticCfg.CommonStaticConfig;
|
||||
import com.ljsd.jieling.db.mongo.MongoUtil;
|
||||
import com.ljsd.jieling.db.redis.RedisKey;
|
||||
import com.ljsd.jieling.db.redis.RedisUtil;
|
||||
import com.ljsd.jieling.exception.ErrorCode;
|
||||
|
@ -10,9 +9,11 @@ import com.ljsd.jieling.globals.BIReason;
|
|||
import com.ljsd.jieling.ktbeans.ReportEventEnum;
|
||||
import com.ljsd.jieling.ktbeans.ReportUtil;
|
||||
import com.ljsd.jieling.logic.OnlineUserManager;
|
||||
import com.ljsd.jieling.logic.activity.crossService.CrossServiceLogic;
|
||||
import com.ljsd.jieling.logic.dao.FriendManager;
|
||||
import com.ljsd.jieling.logic.dao.PlayerManager;
|
||||
import com.ljsd.jieling.logic.dao.UserManager;
|
||||
import com.ljsd.jieling.logic.dao.cross.CSPlayer;
|
||||
import com.ljsd.jieling.logic.dao.root.User;
|
||||
import com.ljsd.jieling.logic.mission.GameEvent;
|
||||
import com.ljsd.jieling.logic.player.PlayerLogic;
|
||||
|
@ -46,8 +47,7 @@ public class FriendLogic {
|
|||
}
|
||||
|
||||
/**
|
||||
* 刷新好友状态
|
||||
* @param iSession
|
||||
* 刷新好友登陆状态
|
||||
*/
|
||||
public void refreshFirendState(ISession iSession) throws Exception {
|
||||
int uid = iSession.getUid();
|
||||
|
@ -66,8 +66,9 @@ public class FriendLogic {
|
|||
.build();
|
||||
MessageUtil.sendMessage(iSession, 1, MessageTypeProto.MessageType.REFRESH_FRIEND_STATE_RESPONSE_VALUE, refreshFriendStateResponse, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取好友信息
|
||||
* 获取全部好友信息
|
||||
*/
|
||||
public void getFriendInfos(ISession iSession) throws Exception {
|
||||
int uid = iSession.getUid();
|
||||
|
@ -89,7 +90,7 @@ public class FriendLogic {
|
|||
}
|
||||
|
||||
/**
|
||||
* 获取好友信息
|
||||
* 获取黑名单信息
|
||||
*/
|
||||
public void getBlackFriendInfos(ISession iSession) throws Exception {
|
||||
int uid = iSession.getUid();
|
||||
|
@ -104,16 +105,12 @@ public class FriendLogic {
|
|||
}
|
||||
friendList.add(friend);
|
||||
}
|
||||
PlayerInfoProto.GetFriendInfoResponse getFriendInfoResponse = PlayerInfoProto.GetFriendInfoResponse
|
||||
.newBuilder().addAllFriends(friendList)
|
||||
.build();
|
||||
PlayerInfoProto.GetFriendInfoResponse getFriendInfoResponse = PlayerInfoProto.GetFriendInfoResponse.newBuilder().addAllFriends(friendList).build();
|
||||
MessageUtil.sendMessage(iSession, 1, MessageTypeProto.MessageType.GET_FRIEND_INFO_REPONSE_VALUE, getFriendInfoResponse, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取推荐列表
|
||||
* @param iSession
|
||||
* @throws Exception
|
||||
*/
|
||||
public void getRecommendFriends(ISession iSession) throws Exception {
|
||||
int uid = iSession.getUid();
|
||||
|
@ -134,18 +131,15 @@ public class FriendLogic {
|
|||
if (!checkIsAllowRecommandFriend(friendManager, recommandId,recommondIds)){
|
||||
continue;
|
||||
}
|
||||
User recommandIdUser = UserManager.getUserNotCache(recommandId);
|
||||
if(recommandIdUser == null){
|
||||
CSPlayer player = CrossServiceLogic.getPlayerByRedis(recommandId);
|
||||
if(player == null){
|
||||
continue;
|
||||
}
|
||||
if(recommandIdUser.getFriendManager().getBlackFriends().contains(uid)){
|
||||
continue;
|
||||
}
|
||||
int minLevel = level - randomLevel;
|
||||
minLevel = Math.max(minLevel, 5);
|
||||
//todo 黑名单排除逻辑
|
||||
int minLevel = Math.max((level - randomLevel), 5);
|
||||
int maxLevel = level + randomLevel;
|
||||
int recommandLevel = recommandIdUser.getPlayerInfoManager().getLevel();
|
||||
if(recommandLevel < minLevel || recommandLevel > maxLevel){
|
||||
int playerLevel = player.getLevel();
|
||||
if(playerLevel < minLevel || playerLevel > maxLevel){
|
||||
continue;
|
||||
}
|
||||
recommondIds.add(recommandId);
|
||||
|
@ -155,26 +149,8 @@ public class FriendLogic {
|
|||
break;
|
||||
}
|
||||
}
|
||||
Collections.shuffle(recommandFriends);
|
||||
|
||||
|
||||
List<User> cUsers = MongoUtil.getInstence().getRandomUsers(selectSize, uid, playerInfoManager.getLevel());
|
||||
if (cUsers != null){
|
||||
Collections.shuffle(cUsers);
|
||||
for (User cUser1 : cUsers) {
|
||||
int recommandId = cUser1.getId();
|
||||
if (!checkIsAllowRecommandFriend(friendManager, recommandId,recommondIds)){
|
||||
continue;
|
||||
}
|
||||
recommondIds.add(recommandId);
|
||||
recommandFriends.add(recommandId);
|
||||
selectSize--;
|
||||
if(selectSize<=0){
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// todo 跨服加好友逻辑
|
||||
for (Integer commondUid : recommandFriends){
|
||||
CommonProto.Friend friend = CBean2Proto.getFriendInfo(commondUid,friendManager);
|
||||
if (friend == null) {
|
||||
|
@ -182,35 +158,38 @@ public class FriendLogic {
|
|||
}
|
||||
friendList.add(friend);
|
||||
}
|
||||
PlayerInfoProto.GetFriendInfoResponse getFriendInfoResponse = PlayerInfoProto.GetFriendInfoResponse
|
||||
PlayerInfoProto.GetFriendInfoResponse getFriendInfoResponse = PlayerInfoProto.GetFriendInfoResponse
|
||||
.newBuilder().addAllFriends(friendList)
|
||||
.build();
|
||||
MessageUtil.sendMessage(iSession, 1, MessageTypeProto.MessageType.GET_FRIEND_INFO_REPONSE_VALUE, getFriendInfoResponse, true);
|
||||
}
|
||||
|
||||
private boolean checkIsAllowRecommandFriend(FriendManager friendManager,int commandUserId,Set<Integer> recommondIds ) {
|
||||
/**
|
||||
* 检测是否允许添加好友
|
||||
*/
|
||||
private boolean checkIsAllowRecommandFriend(FriendManager friendManager,int commandUserId,Set<Integer> recommondIds) {
|
||||
List<Integer> friends = friendManager.getFriends();
|
||||
List<Integer> blackFriends = friendManager.getBlackFriends();
|
||||
// 已经是好友了
|
||||
if (friends.contains(commandUserId)){
|
||||
return false;
|
||||
return false;
|
||||
}
|
||||
// 已经推荐过了
|
||||
if (recommondIds.contains(commandUserId)){
|
||||
return false;
|
||||
}
|
||||
// 黑名单的
|
||||
if(blackFriends.contains(commandUserId)){
|
||||
return false;
|
||||
}
|
||||
// todo 走配置
|
||||
int maxSize = SSpecialConfig.getIntegerValue(SSpecialConfig.FRIENDAMOUNT_LIMIT);
|
||||
if (friends.size() >= maxSize) { //用户已达上限不推荐好友信息
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
//用户已达上限不推荐好友信息
|
||||
return friends.size() < maxSize;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取申请列表
|
||||
* @param iSession
|
||||
*/
|
||||
public void getApplyFriends(ISession iSession) throws Exception {
|
||||
int uid = iSession.getUid();
|
||||
|
@ -225,22 +204,18 @@ public class FriendLogic {
|
|||
}
|
||||
friendList.add(friend);
|
||||
}
|
||||
PlayerInfoProto.GetFriendInfoResponse getFriendInfoResponse = PlayerInfoProto.GetFriendInfoResponse
|
||||
.newBuilder().addAllFriends(friendList)
|
||||
.build();
|
||||
PlayerInfoProto.GetFriendInfoResponse getFriendInfoResponse = PlayerInfoProto.GetFriendInfoResponse.newBuilder().addAllFriends(friendList).build();
|
||||
MessageUtil.sendMessage(iSession, 1, MessageTypeProto.MessageType.GET_FRIEND_INFO_REPONSE_VALUE, getFriendInfoResponse, true);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 添加好友发送申请
|
||||
* @param iSession
|
||||
* @param inviteUidsList
|
||||
*/
|
||||
public void sendApply(ISession iSession, List<Integer> inviteUidsList) throws Exception {
|
||||
int msgId = MessageTypeProto.MessageType.FRIEND_INVITE_RESPONSE_VALUE;
|
||||
int uid = iSession.getUid();
|
||||
if (inviteUidsList.size() ==0){
|
||||
if (inviteUidsList.size() == 0){
|
||||
throw new ErrorCodeException(ErrorCode.FRIENDS_NO_APPLY);
|
||||
}
|
||||
User user = UserManager.getUser(uid);
|
||||
|
@ -292,7 +267,6 @@ public class FriendLogic {
|
|||
|
||||
/**
|
||||
* 在线好友申请推送
|
||||
* @param inviteUid
|
||||
*/
|
||||
private void sendFriendInfoIndication(int uid,int inviteUid,int type){
|
||||
boolean isOnline = OnlineUserManager.checkUidOnline(inviteUid);
|
||||
|
@ -308,7 +282,8 @@ public class FriendLogic {
|
|||
MessageUtil.sendIndicationMessage(session, 1, MessageTypeProto.MessageType.SEND_FRIEND_INFO_INDICATION_VALUE, sendFriendInfoIndication.build(), true);
|
||||
}
|
||||
}
|
||||
//t推送赠送体力状态
|
||||
|
||||
//推送赠送体力状态
|
||||
private void sendFriendStatedication(int uid ,int inviteUid,int type) {
|
||||
boolean isOnline = OnlineUserManager.checkUidOnline(inviteUid);
|
||||
if (isOnline) {
|
||||
|
@ -322,11 +297,8 @@ public class FriendLogic {
|
|||
|
||||
/**
|
||||
* 同意好友申请
|
||||
* @param iSession
|
||||
* @param type
|
||||
* @param friendId
|
||||
*/
|
||||
public void sendAgree(ISession iSession, int type, int friendId ) throws Exception {
|
||||
public void sendAgree(ISession iSession, int type, int friendId) throws Exception {
|
||||
int msgId = MessageTypeProto.MessageType.FRIEND_INVITE_OPERATION_RESPONSE_VALUE;
|
||||
int uid = iSession.getUid();
|
||||
// 自己的信息
|
||||
|
@ -470,8 +442,6 @@ public class FriendLogic {
|
|||
|
||||
/**
|
||||
* 删除好友
|
||||
* @param iSession
|
||||
* @param friendId
|
||||
*/
|
||||
public void delFriend(ISession iSession, int friendId) throws Exception {
|
||||
int msgId = MessageTypeProto.MessageType.DEL_FRIEND_RESPONSE_VALUE;
|
||||
|
@ -525,21 +495,15 @@ public class FriendLogic {
|
|||
MessageUtil.sendMessage(session, 1, msgId, null, true);
|
||||
|
||||
}
|
||||
|
||||
//删除好友清除赠送领取体力信息
|
||||
private void delFriendInfo(int friendId, int uid, FriendManager friendManager, FriendManager friendManager1) {
|
||||
friendManager1.delFriends(uid);
|
||||
// friendManager1.delGiveMap(uid);
|
||||
// friendManager1.delHaveReward(uid);
|
||||
friendManager.delFriends(friendId);
|
||||
// friendManager.delGiveMap(friendId);
|
||||
// friendManager.delHaveReward(friendId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 赠送礼包
|
||||
* @param iSession
|
||||
* @param friendId
|
||||
* @param type
|
||||
*/
|
||||
public void givePresent(ISession iSession, int friendId, int type) throws Exception {
|
||||
int msgId = MessageTypeProto.MessageType.FRIEND_GIVE_PRESENT_RESPONSE_VALUE;
|
||||
|
@ -585,9 +549,6 @@ public class FriendLogic {
|
|||
|
||||
/**
|
||||
* 领取赠礼
|
||||
* @param iSession
|
||||
* @param friendId
|
||||
* @param type
|
||||
*/
|
||||
public void takeHeart(ISession iSession, int friendId, int type) throws Exception {
|
||||
int msgId = MessageTypeProto.MessageType.FRIEND_TAKE_HEART_RESPONSE_VALUE;
|
||||
|
@ -656,8 +617,6 @@ public class FriendLogic {
|
|||
|
||||
/**
|
||||
* 根据名字查找用户
|
||||
* @param iSession
|
||||
* @param name
|
||||
*/
|
||||
public void getOneFriend(ISession iSession, String name) throws Exception {
|
||||
int msgId = MessageTypeProto.MessageType.FRIEND_SEARCH_RESPONSE_VALUE;
|
||||
|
@ -696,8 +655,6 @@ public class FriendLogic {
|
|||
|
||||
/**
|
||||
* 刷新赠送体力状态和点赞状态
|
||||
* @param iSession
|
||||
* @throws Exception
|
||||
*/
|
||||
public void refreshState(ISession iSession) throws Exception {
|
||||
int uid = iSession.getUid();
|
||||
|
|
|
@ -21,7 +21,6 @@ import com.ljsd.jieling.ktbeans.ReportEventEnum;
|
|||
import com.ljsd.jieling.ktbeans.ReportUtil;
|
||||
import com.ljsd.jieling.logic.OnlineUserManager;
|
||||
import com.ljsd.jieling.logic.activity.ActivityType;
|
||||
import com.ljsd.jieling.logic.activity.crossService.CrossServiceLogic;
|
||||
import com.ljsd.jieling.logic.activity.event.*;
|
||||
import com.ljsd.jieling.logic.activity.eventhandler.HeroFiveStarGetEventHandler;
|
||||
import com.ljsd.jieling.logic.activity.eventhandler.PokemonFiveStarGetEventHandler;
|
||||
|
@ -1285,10 +1284,6 @@ public class HeroLogic {
|
|||
}
|
||||
// 更新战力
|
||||
Poster.getPoster().dispatchEvent(new SaveHeroForceEvent(user.getId(),""));
|
||||
//跨服编队
|
||||
if (TeamEnum.isCrossTeam(teamId)) {
|
||||
CrossServiceLogic.getInstance().saveBasicPlayerToRedis(user);
|
||||
}
|
||||
user.getUserMissionManager().onGameEvent(user, GameEvent.HERO_IN_TEAM, heroIds.size());
|
||||
MessageUtil.sendMessage(iSession, 1, MessageTypeProto.MessageType.TEAM_POS_SAVE_RESPONSE_VALUE, null, true);
|
||||
}
|
||||
|
|
|
@ -35,7 +35,6 @@ import com.ljsd.jieling.logic.dao.cross.CSPlayer;
|
|||
import com.ljsd.jieling.logic.dao.root.GuildInfo;
|
||||
import com.ljsd.jieling.logic.dao.root.User;
|
||||
import com.ljsd.jieling.logic.family.CrossDeathPathLogic;
|
||||
import com.ljsd.jieling.logic.family.GuildLogic;
|
||||
import com.ljsd.jieling.logic.fight.CombatLogic;
|
||||
import com.ljsd.jieling.logic.hero.HeroLogic;
|
||||
import com.ljsd.jieling.logic.mail.MailLogic;
|
||||
|
@ -195,19 +194,14 @@ public class PlayerLogic {
|
|||
RedisUtil.getInstence().del(delkey);
|
||||
}
|
||||
playerInfoManager.setNickName(name);
|
||||
//跨服redis存储名字
|
||||
CrossServiceLogic.getInstance().saveBasicPlayerToRedis(user);
|
||||
if(sex==0||sex==1){
|
||||
playerInfoManager.setSex(sex);
|
||||
//跨服redis存储性别
|
||||
CrossServiceLogic.getInstance().saveBasicPlayerToRedis(user);
|
||||
int headID =SPlayerRole.getRolePic(sex);
|
||||
if(headID==0){
|
||||
LOGGER.error("Exception::sex pic null");
|
||||
}else {
|
||||
playerInfoManager.setHead(headID);
|
||||
}
|
||||
playerInfoUpdate(user);
|
||||
}
|
||||
String key = RedisKey.getKey(RedisKey.C_User_Name_Key, name, false);
|
||||
RedisUtil.getInstence().set(key, String.valueOf(uid),RedisKey.REDIS_OVER_FOREVER);
|
||||
|
@ -217,7 +211,6 @@ public class PlayerLogic {
|
|||
}
|
||||
teamPosManager.getTeamNames().put(teamPosId,name);
|
||||
}
|
||||
|
||||
if(type==3){
|
||||
//检查下
|
||||
int[][] cost = new int[1][];
|
||||
|
@ -231,7 +224,9 @@ public class PlayerLogic {
|
|||
throw new ErrorCodeException(ErrorCode.ITEM_NOT_ENOUGH);
|
||||
}
|
||||
}
|
||||
playerInfoUpdate(user);
|
||||
if (type != 2){
|
||||
CrossServiceLogic.getInstance().saveBasicPlayerToRedis(user);//玩家改名
|
||||
}
|
||||
MessageUtil.sendMessage(iSession,1,msgId,null,true);
|
||||
}
|
||||
|
||||
|
@ -345,8 +340,7 @@ public class PlayerLogic {
|
|||
Poster.getPoster().dispatchEvent(new GuildForceChangeEvent(user.getId(),user.getPlayerInfoManager().getGuildId(),2,teamForce-user.getPlayerInfoManager().getMaxForce()));
|
||||
}
|
||||
user.getPlayerInfoManager().setMaxForce(teamForce);
|
||||
//跨服redis存储最大战力
|
||||
CrossServiceLogic.getInstance().saveBasicPlayerToRedis(user);
|
||||
CrossServiceLogic.getInstance().saveBasicPlayerToRedis(user);//战力更新
|
||||
// 更新战力
|
||||
Poster.getPoster().dispatchEvent(new SaveHeroForceEvent(user.getId(),""));
|
||||
Poster.getPoster().dispatchEvent(new UserForceChangeEvent(uid,teamForce));
|
||||
|
@ -484,7 +478,7 @@ public class PlayerLogic {
|
|||
LOGGER.info("外观物品Id{}",decorationId);
|
||||
User user = UserManager.getUser(session.getUid());
|
||||
// 当前时间,秒
|
||||
long now = TimeUtils.now()/1000;
|
||||
long now = TimeUtils.nowInt();
|
||||
switch (type){
|
||||
case 0:
|
||||
// 获取头像框有效时间
|
||||
|
@ -496,8 +490,6 @@ public class PlayerLogic {
|
|||
throw new ErrorCodeException(ErrorCode.newDefineCode("头像框时间到期,更换无效"));
|
||||
}
|
||||
user.getPlayerInfoManager().setHeadFrame(decorationId);
|
||||
//跨服redis存储头像框
|
||||
CrossServiceLogic.getInstance().saveBasicPlayerToRedis(user);
|
||||
break;
|
||||
case 1:
|
||||
user.getPlayerInfoManager().setHead(decorationId);
|
||||
|
@ -516,8 +508,6 @@ public class PlayerLogic {
|
|||
throw new ErrorCodeException(ErrorCode.newDefineCode("称号时间到期,更换无效"));
|
||||
}
|
||||
user.getPlayerInfoManager().setUserTitle(decorationId);
|
||||
//跨服redis存储称号
|
||||
CrossServiceLogic.getInstance().saveBasicPlayerToRedis(user);
|
||||
break;
|
||||
case 3:
|
||||
Long time3;
|
||||
|
@ -533,8 +523,6 @@ public class PlayerLogic {
|
|||
throw new ErrorCodeException(ErrorCode.newDefineCode("坐骑时间到期,更换无效"));
|
||||
}
|
||||
user.getPlayerInfoManager().setUserMount(decorationId);
|
||||
//跨服redis存储级数
|
||||
CrossServiceLogic.getInstance().saveBasicPlayerToRedis(user);
|
||||
break;
|
||||
case 4:
|
||||
Long time4 = user.getPlayerInfoManager().getUserSkinValidTime().get(decorationId);
|
||||
|
@ -545,14 +533,11 @@ public class PlayerLogic {
|
|||
throw new ErrorCodeException(ErrorCode.newDefineCode("皮肤时间到期,更换无效"));
|
||||
}
|
||||
user.getPlayerInfoManager().setUserSkin(decorationId);
|
||||
//跨服redis存储皮肤
|
||||
CrossServiceLogic.getInstance().saveBasicPlayerToRedis(user);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
playerInfoUpdate(user);
|
||||
CrossServiceLogic.getInstance().saveBasicPlayerToRedis(user);//修改玩家头像/头像框/皮肤/称号
|
||||
MessageUtil.sendMessage(session,1,messageType.getNumber(),null,true);
|
||||
}
|
||||
|
||||
|
@ -638,16 +623,11 @@ public class PlayerLogic {
|
|||
.setUid(sArenaRobotConfig.getId());
|
||||
|
||||
CommonProto.TeamOneTeamInfo.Builder teamInfo = CommonProto.TeamOneTeamInfo.newBuilder();
|
||||
if(sArenaRobotConfig.getDifferDemonsId()!=null){
|
||||
// for(int pokenId:sArenaRobotConfig.getDifferDemonsId()){
|
||||
// teamInfo.addPokemonInfos(null);
|
||||
// }
|
||||
}
|
||||
teamInfo.setTotalForce(sArenaRobotConfig.getTotalForce());
|
||||
int position = 1;
|
||||
for(Map.Entry<Integer,CommonProto.Hero> item : sArenaRobotConfig.getHeroMapList().entrySet()){
|
||||
Integer heroTid = item.getKey();
|
||||
Integer heroStar = item.getValue().getStar();
|
||||
int heroStar = item.getValue().getStar();
|
||||
teamInfo.addTeam(CommonProto.TeamSimpleInfo.newBuilder()
|
||||
.setHeroid(String.valueOf(heroTid))
|
||||
.setHeroTid(heroTid)
|
||||
|
@ -660,9 +640,7 @@ public class PlayerLogic {
|
|||
}
|
||||
oneInfo.setTeam(teamInfo);
|
||||
//TODO 玉虚论道三队伍
|
||||
|
||||
return oneInfo;
|
||||
|
||||
}
|
||||
|
||||
public PlayerInfoProto.GetPlayerOneTeamInfoResponse getOneTeamInfo( int id,int teamId) throws Exception {
|
||||
|
@ -735,7 +713,7 @@ public class PlayerLogic {
|
|||
if(id ==TeamEnum.CROSS_YU_XU_LUN_DAO_ONE.getTeamId()){
|
||||
for(Map.Entry<Integer,CommonProto.Hero> item : sArenaRobotConfig.getHeroMapList().entrySet()){
|
||||
Integer heroTid = item.getKey();
|
||||
Integer heroStar = item.getValue().getStar();
|
||||
int heroStar = item.getValue().getStar();
|
||||
teamInfo.addTeam(CommonProto.TeamSimpleInfo.newBuilder().setPropertyId(item.getValue().getPropertyId()).setHeroid(String.valueOf(heroTid)).setHeroTid(heroTid).setLevel(sArenaRobotConfig.getRoleLv()).setStar(heroStar).setPosition(position++).setGodSoulLv(item.getValue().getGodSoulLv()).build());
|
||||
}
|
||||
teamInfo.setTotalForce(sArenaRobotConfig.getYxldTotalForce1());
|
||||
|
@ -743,7 +721,7 @@ public class PlayerLogic {
|
|||
}else if(id ==TeamEnum.CROSS_YU_XU_LUN_DAO_TWO.getTeamId()){
|
||||
for(Map.Entry<Integer,CommonProto.Hero> item : sArenaRobotConfig.getHeroMapList2().entrySet()){
|
||||
Integer heroTid = item.getKey();
|
||||
Integer heroStar = item.getValue().getStar();
|
||||
int heroStar = item.getValue().getStar();
|
||||
teamInfo.addTeam(CommonProto.TeamSimpleInfo.newBuilder().setPropertyId(item.getValue().getPropertyId()).setHeroid(String.valueOf(heroTid)).setHeroTid(heroTid).setLevel(sArenaRobotConfig.getRoleLv()).setStar(heroStar).setPosition(position++).setGodSoulLv(item.getValue().getGodSoulLv()).build());
|
||||
}
|
||||
teamInfo.setTotalForce(sArenaRobotConfig.getYxldTotalForce2());
|
||||
|
@ -751,15 +729,13 @@ public class PlayerLogic {
|
|||
}else if(id ==TeamEnum.CROSS_YU_XU_LUN_DAO_THREE.getTeamId()){
|
||||
for(Map.Entry<Integer,CommonProto.Hero> item : sArenaRobotConfig.getHeroMapList3().entrySet()){
|
||||
Integer heroTid = item.getKey();
|
||||
Integer heroStar = item.getValue().getStar();
|
||||
int heroStar = item.getValue().getStar();
|
||||
teamInfo.addTeam(CommonProto.TeamSimpleInfo.newBuilder().setPropertyId(item.getValue().getPropertyId()).setHeroid(String.valueOf(heroTid)).setHeroTid(heroTid).setLevel(sArenaRobotConfig.getRoleLv()).setStar(heroStar).setPosition(position++).setGodSoulLv(item.getValue().getGodSoulLv()).build());
|
||||
}
|
||||
teamInfo.setTotalForce(sArenaRobotConfig.getYxldTotalForce3());
|
||||
}
|
||||
//teamInfo.setTotalForce(sArenaRobotConfig.getYxldTotalForce());
|
||||
oneInfo.addCrossTeam(teamInfo);
|
||||
}
|
||||
//oneInfo.setTeam(teamInfo);
|
||||
return oneInfo;
|
||||
}
|
||||
|
||||
|
@ -1360,48 +1336,32 @@ public class PlayerLogic {
|
|||
}
|
||||
}
|
||||
|
||||
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);
|
||||
// }
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 用户基础信息修改同步到redis
|
||||
* time 2023-02-23 不用这个方法了
|
||||
*/
|
||||
public void playerInfoUpdate(User user){
|
||||
PlayerManager playerInfoManager = user.getPlayerInfoManager();
|
||||
PlayerInfoCache cache = new PlayerInfoCache();
|
||||
cache.setHead(playerInfoManager.getHead());
|
||||
cache.setHeadFrame(playerInfoManager.getHeadFrame());
|
||||
cache.setName(playerInfoManager.getNickName());
|
||||
cache.setLevel(playerInfoManager.getLevel());
|
||||
int serverId = AreaManager.getInstance().getServerIdByUid(user.getId(), GameApplication.serverId);
|
||||
cache.setServerId(serverId);
|
||||
cache.setId(user.getId());
|
||||
cache.setPracticeLevel(user.getHeroManager().getPracticeLevel());
|
||||
if(user.getPlayerInfoManager().getGuildId()==0){
|
||||
cache.setGuildPosition(0);
|
||||
}else{
|
||||
int memberType = GuildLogic.getMemberType(user.getId(), GuilidManager.getGuildInfo(user.getPlayerInfoManager().getGuildId()).getMembers());
|
||||
cache.setGuildPosition(memberType);
|
||||
}
|
||||
RedisUtil.getInstence().putMapEntry(RedisKey.PLAYER_INFO_CACHE,"",String.valueOf(user.getId()),cache);
|
||||
}
|
||||
// public void playerInfoUpdate(User user){
|
||||
// PlayerManager playerInfoManager = user.getPlayerInfoManager();
|
||||
// PlayerInfoCache cache = new PlayerInfoCache();
|
||||
// cache.setHead(playerInfoManager.getHead());
|
||||
// cache.setHeadFrame(playerInfoManager.getHeadFrame());
|
||||
// cache.setName(playerInfoManager.getNickName());
|
||||
// cache.setLevel(playerInfoManager.getLevel());
|
||||
// int serverId = AreaManager.getInstance().getServerIdByUid(user.getId(), GameApplication.serverId);
|
||||
// cache.setServerId(serverId);
|
||||
// cache.setId(user.getId());
|
||||
// cache.setPracticeLevel(user.getHeroManager().getPracticeLevel());
|
||||
// if(user.getPlayerInfoManager().getGuildId()==0){
|
||||
// cache.setGuildPosition(0);
|
||||
// }else{
|
||||
// int memberType = GuildLogic.getMemberType(user.getId(), GuilidManager.getGuildInfo(user.getPlayerInfoManager().getGuildId()).getMembers());
|
||||
// cache.setGuildPosition(memberType);
|
||||
// }
|
||||
// RedisUtil.getInstence().putMapEntry(RedisKey.PLAYER_INFO_CACHE,"",String.valueOf(user.getId()),cache);
|
||||
// }
|
||||
|
||||
/**
|
||||
* 坐骑升级
|
||||
* @param session
|
||||
* @param messageType
|
||||
* @throws Exception
|
||||
*/
|
||||
public void rideLevelUp(ISession session, MessageTypeProto.MessageType messageType) throws Exception {
|
||||
User user = UserManager.getUser(session.getUid());
|
||||
|
|
|
@ -432,8 +432,10 @@ public class SessionManager implements INetSession<ISession>, INetReceived<ISess
|
|||
playerInfoManager.setOffLineTime(TimeUtils.now());
|
||||
|
||||
CSPlayer player = CrossServiceLogic.getPlayerByRedis(user.getId());
|
||||
player.setOffLineTime(TimeUtils.now());
|
||||
CrossServiceLogic.update(player);
|
||||
if (player != null){
|
||||
player.setOffLineTime(TimeUtils.now());
|
||||
CrossServiceLogic.update(player);
|
||||
}
|
||||
// 总在线时间
|
||||
long onlineTime = playerInfoManager.getOffLineTime() - session.getUserLoginTime();
|
||||
playerInfoManager.addOnlineTime(onlineTime);
|
||||
|
|
|
@ -8,10 +8,10 @@ import com.ljsd.jieling.db.redis.RedisUtil;
|
|||
import com.ljsd.jieling.globals.Global;
|
||||
import com.ljsd.jieling.handler.map.Cell;
|
||||
import com.ljsd.jieling.handler.map.MapManager;
|
||||
import com.ljsd.jieling.handler.map.TowerBuff;
|
||||
import com.ljsd.jieling.logic.OnlineUserManager;
|
||||
import com.ljsd.jieling.logic.activity.crossService.CrossServiceLogic;
|
||||
import com.ljsd.jieling.logic.dao.*;
|
||||
import com.ljsd.jieling.logic.dao.cross.CSPlayer;
|
||||
import com.ljsd.jieling.logic.dao.root.GuildInfo;
|
||||
import com.ljsd.jieling.logic.dao.root.User;
|
||||
import com.ljsd.jieling.logic.fight.CombatLogic;
|
||||
|
@ -825,18 +825,11 @@ public class CBean2Proto {
|
|||
return chatInfo.build();
|
||||
}
|
||||
|
||||
|
||||
public static CommonProto.Friend getFriendInfo(int friendId, FriendManager friendManager){
|
||||
User user = null;
|
||||
try {
|
||||
user = UserManager.getUserNotCache(friendId);
|
||||
} catch (Exception e) {
|
||||
LOGGER.info("getFriendInfo user == null friendId={} e={}", friendId, e.toString());
|
||||
}
|
||||
if (user == null) {
|
||||
CSPlayer player = CrossServiceLogic.getPlayerByRedis(friendId);
|
||||
if (player == null){
|
||||
return null;
|
||||
}
|
||||
PlayerManager playerInfoManager = user.getPlayerInfoManager();
|
||||
int isGrive = 0;
|
||||
int haveReward = 0;
|
||||
CommonProto.Friend.Builder friend = CommonProto.Friend.newBuilder();
|
||||
|
@ -853,44 +846,27 @@ public class CBean2Proto {
|
|||
friend.setIsApplyed(1);
|
||||
}
|
||||
}
|
||||
friend.setId(user.getId());
|
||||
friend.setName(playerInfoManager.getNickName());
|
||||
friend.setLv(playerInfoManager.getLevel());
|
||||
friend.setId(player.getUserId());
|
||||
friend.setName(player.getName());
|
||||
friend.setLv(player.getLevel());
|
||||
long isOnline = 0;
|
||||
if (!OnlineUserManager.checkUidOnline(friendId)){
|
||||
isOnline = playerInfoManager.getOffLineTime();
|
||||
isOnline = player.getOffLineTime();
|
||||
}
|
||||
friend.setOffLineTime(isOnline);
|
||||
friend.setHaveReward(haveReward);
|
||||
friend.setIsGive(isGrive);
|
||||
friend.setHead(playerInfoManager.getHead());
|
||||
friend.setFrame(playerInfoManager.getHeadFrame());
|
||||
friend.setSoulVal(playerInfoManager.getMaxForce());
|
||||
friend.setUserMount(playerInfoManager.getUserMount());
|
||||
friend.setUserSkin(playerInfoManager.getUserSkin());
|
||||
friend.setUserTitle(playerInfoManager.getUserTitle());
|
||||
friend.setSex(playerInfoManager.getSex());
|
||||
friend.setPracticeLevel(user.getHeroManager().getPracticeLevel());
|
||||
friend.setHead(player.getHead());
|
||||
friend.setFrame(player.getHeadFrame());
|
||||
friend.setSoulVal(player.getMaxFore());
|
||||
friend.setUserMount(player.getUserMount());
|
||||
friend.setUserSkin(player.getSkin());
|
||||
friend.setUserTitle(player.getUserTitle());
|
||||
friend.setSex(player.getSex());
|
||||
friend.setPracticeLevel(player.getPracticeLevel());
|
||||
return friend.build();
|
||||
}
|
||||
|
||||
// public static CommonProto.RingFireInfo getRingFire(Pokemon pokemon) {
|
||||
// return CommonProto.RingFireInfo.newBuilder().addAllComonpentId(pokemon.getComonpentsLevelMap().keySet()).setStage(pokemon.getAllStage()).setId(pokemon.getId()).build();
|
||||
// }
|
||||
|
||||
public static List<CommonProto.TechnologyInfo> getTechInfo(Collection<Map<Integer, Integer>> techInfoMap){
|
||||
List<CommonProto.TechnologyInfo> result = new ArrayList<>(techInfoMap.size());
|
||||
Iterator<Map<Integer, Integer>> iterator = techInfoMap.iterator();
|
||||
while (iterator.hasNext()){
|
||||
Map<Integer, Integer> items = iterator.next();
|
||||
for(Map.Entry<Integer,Integer> item: items.entrySet()){
|
||||
result.add(CommonProto.TechnologyInfo.newBuilder().setTechId(item.getKey()).setLevle(item.getValue()).build());
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
|
||||
}
|
||||
public static CommonProto.Cell getCell(Cell cell){
|
||||
CommonProto.Cell.Builder protoCell = CommonProto.Cell.newBuilder();
|
||||
protoCell.setPointId(cell.getPointId());
|
||||
|
@ -898,12 +874,6 @@ public class CBean2Proto {
|
|||
protoCell.setMonsterForce(cell.getForce());
|
||||
return protoCell.build();
|
||||
}
|
||||
public static MapInfoProto.TowerBuff getTowerBuff(TowerBuff towerBuff){
|
||||
MapInfoProto.TowerBuff.Builder builder = MapInfoProto.TowerBuff.newBuilder();
|
||||
builder.setTowerLevel(towerBuff.getTowerLevel());
|
||||
builder.setEventId(towerBuff.getEventId());
|
||||
return builder.build();
|
||||
}
|
||||
|
||||
public static CommonProto.ItemInfo getItemInfo(Item item) {
|
||||
CommonProto.ItemInfo.Builder builder = CommonProto.ItemInfo.newBuilder();
|
||||
|
|
Loading…
Reference in New Issue