法相第2版补充

back_recharge
duhui 2023-02-16 11:40:47 +08:00
parent 6d9fb12ab8
commit d94b80840e
8 changed files with 144 additions and 65 deletions

View File

@ -617,6 +617,7 @@ public class Hero extends MongoBase implements Comparable<Hero>,Cloneable {
clone.equipByPositionMap = new HashMap<>(clone.equipByPositionMap);
clone.soulEquipByPositionMap = new HashMap<>(clone.soulEquipByPositionMap);
clone.jewelInfo = new HashSet<>(clone.jewelInfo);
clone.faxiangList = new HashSet<>(clone.faxiangList);
clone.godSealByPositionMap = new HashMap<>(clone.godSealByPositionMap);
clone.equipStrongMap = new HashMap<>(clone.equipStrongMap);
} catch (CloneNotSupportedException e) {

View File

@ -64,14 +64,13 @@ public class UserManager {
//离线清除逻辑
public static void checkOffline(){
try {
long linshitime = 10 * 60 * 1000L;
Set<User> collect = userMap.entrySet().stream()
.filter(integerUserEntry -> !OnlineUserManager.checkUidOnline(integerUserEntry.getKey()))
.map(Map.Entry::getValue).collect(Collectors.toSet());
long now = System.currentTimeMillis();
for (User integerUserEntry : collect) {
Long addTime = userMapPutTime.getOrDefault(integerUserEntry.getId(), linshitime);
if (now - addTime >= linshitime) {
Long addTime = userMapPutTime.getOrDefault(integerUserEntry.getId(), LIVE_TIME);
if (now - addTime >= LIVE_TIME) {
userMap.remove(integerUserEntry.getId());
userMapPutTime.remove(integerUserEntry.getId());
}

View File

@ -1,12 +1,7 @@
package com.ljsd.jieling.logic.dao.vo;
import com.ljsd.jieling.logic.dao.Hero;
import com.ljsd.jieling.logic.dao.HeroManager;
import com.ljsd.jieling.logic.dao.Jewel;
import com.ljsd.jieling.logic.dao.PurpleMansionSeal;
import com.ljsd.jieling.logic.dao.*;
import com.ljsd.jieling.logic.dao.root.User;
import com.ljsd.jieling.thrift.idl.ArenaOfHero;
import com.ljsd.jieling.thrift.idl.CrossArenaManager;
import com.ljsd.jieling.util.CBean2Proto;
import config.SCHero;
@ -36,35 +31,42 @@ public class HeroVo {
private Map<Integer, Integer> faBaoGongMingSkillMap = new HashMap<>();
private Map<Integer, Long> userMountValidTime = new HashMap<>();
private Map<String, Jewel> jewelMap = new HashMap<>();
private Map<String, Faxiang> faxiangMap = new HashMap<>();
public HeroVo(User user, Hero hero) {
HeroManager heroManager = user.getHeroManager();
this.id = hero.getId();
this.templateId = hero.getTemplateId();
this.star = hero.getStar();
this.HMBreakId = hero.getBreakIdByHongMeng(heroManager);
this.starBreakId = hero.getStarBreakId();
this.HMEspecialEquipLevel = hero.getEspecialEquipLevelByHongmeng(heroManager,hero.getId());
this.propertyId = hero.getPropertyId();
this.godSoulLv = hero.getGodSoulLv();
this.likeLv = heroManager.getTotalLikeLv();
this.soulEquipByPositionMap = new HashMap<>(hero.getSoulEquipByPositionMap());
this.godSealByPositionMap = new HashMap<>(hero.getGodSealByPositionMap());
this.purpleMansionSealMap = new HashMap<>(heroManager.getPurpleMansionSeal());
this.HMEquipPositionMap = new HashMap<>(hero.getEquipByHongmengPositionMap(heroManager));
this.faBaoGongMingSkillMap = new HashMap<>(heroManager.getFaBaoGongMingSkillMap());
this.userMountValidTime = new HashMap<>(user.getPlayerInfoManager().getUserMountValidTime());
try {
this.jewelMap = new HashMap<>(CBean2Proto.jewelOfLocal(user,hero));
}catch (Exception e){
e.printStackTrace();
public HeroVo() {
}
public static HeroVo createHeroVo(User user, Hero hero){
HeroVo heroVo = new HeroVo();
HeroManager heroManager = user.getHeroManager();
heroVo.id = hero.getId();
heroVo.templateId = hero.getTemplateId();
heroVo.star = hero.getStar();
heroVo.HMBreakId = hero.getBreakIdByHongMeng(heroManager);
heroVo.starBreakId = hero.getStarBreakId();
heroVo.HMEspecialEquipLevel = hero.getEspecialEquipLevelByHongmeng(heroManager,hero.getId());
heroVo.propertyId = hero.getPropertyId();
heroVo.godSoulLv = hero.getGodSoulLv();
heroVo.likeLv = heroManager.getTotalLikeLv();
heroVo.soulEquipByPositionMap = new HashMap<>(hero.getSoulEquipByPositionMap());
heroVo.godSealByPositionMap = new HashMap<>(hero.getGodSealByPositionMap());
heroVo.purpleMansionSealMap = new HashMap<>(heroManager.getPurpleMansionSeal());
heroVo.HMEquipPositionMap = new HashMap<>(hero.getEquipByHongmengPositionMap(heroManager));
heroVo.faBaoGongMingSkillMap = new HashMap<>(heroManager.getFaBaoGongMingSkillMap());
heroVo.userMountValidTime = new HashMap<>(user.getPlayerInfoManager().getUserMountValidTime());
heroVo.jewelMap = new HashMap<>(CBean2Proto.jewelOfLocal(user,hero));
heroVo.faxiangMap = CBean2Proto.faxiangOfLocal(user,hero);
return heroVo;
}
public String getId() {
return id;
}
public Map<String, Faxiang> getFaxiangMap() {
return faxiangMap;
}
public int getGodSoulLv() {
return godSoulLv;
}

View File

@ -200,7 +200,7 @@ public class EquipLogic {
if (!checkCost || !costFaxiang){
throw new ErrorCodeException(ErrorCode.ITEM_NOT_ENOUGH,"SFaxiangLevelConfig 升级道具数量不足:"+faxiang.getStrongLv());
}
faxiang.setStrongLv(targetLv);
faxiang.setStar(targetLv);
ItemUtil.itemCostLong(user,costMap, BIReason.UP_FAXIANG_EQUIP_LV_COST,0);
costFaxiang(user, equipCostStr.toString(), true);
}
@ -259,17 +259,25 @@ public class EquipLogic {
*/
public void getAllFaxiangEquip(ISession iSession, int page) throws Exception {
int pageNum = 20;
boolean isFinish = false;
User user = UserManager.getUser(iSession.getUid());
ArrayList<CommonProto.Equip> equips = new ArrayList<>();
Map<String, Faxiang> faxiangMap = user.getEquipManager().getFaxiangMap();
List<Faxiang> faxiangList = new ArrayList<>(faxiangMap.values());
// 开始下标
int start = (page-1) * pageNum;
List<Faxiang> pageList = faxiangList.subList(start, pageNum);
// 结束下标
int end = start + pageNum;
if (end >= faxiangList.size()){
end = faxiangList.size();
isFinish = true;
}
List<Faxiang> pageList = faxiangList.subList(start, end);
for (Faxiang faxiang : pageList) {
CommonProto.Equip proto = CBean2Proto.getFaxiangEquipProto(faxiang);
equips.add(proto);
}
PlayerInfoProto.GetAllFaxiangEquipResponse build = PlayerInfoProto.GetAllFaxiangEquipResponse.newBuilder().addAllEquips(equips).build();
PlayerInfoProto.GetAllFaxiangEquipResponse build = PlayerInfoProto.GetAllFaxiangEquipResponse.newBuilder().addAllEquips(equips).setIsFinish(isFinish).build();
MessageUtil.sendMessage(iSession, 1, MessageTypeProto.MessageType.GET_ALL_EQUIP_RESPONSE_VALUE, build, true);
}
}

View File

@ -1,8 +1,8 @@
package com.ljsd.jieling.logic.help;
import com.ljsd.jieling.logic.dao.Faxiang;
import com.ljsd.jieling.logic.dao.Hero;
import com.ljsd.jieling.logic.dao.Jewel;
import com.ljsd.jieling.logic.dao.PropertyItem;
import java.util.HashMap;
import java.util.List;
@ -56,6 +56,8 @@ public class HelpHero {
*/
private Map<Integer, Integer> homeEquipMap = new HashMap<>(5);
private List<Faxiang> faxiangs;
public int getUid() {
return uid;
}
@ -119,4 +121,12 @@ public class HelpHero {
public void setFourTotalTier(int fourTotalTier) {
this.fourTotalTier = fourTotalTier;
}
public List<Faxiang> getFaxiangs() {
return faxiangs;
}
public void setFaxiangs(List<Faxiang> faxiangs) {
this.faxiangs = faxiangs;
}
}

View File

@ -2052,7 +2052,7 @@ public class HeroLogic {
// 角色初始被动
int[] skillLogicConfig = tempHero.getInitialPassiveSkillLogicConfig();
if (skillLogicConfig != null && skillLogicConfig.length > 0){
if (skillLogicConfig != null){
for (int skill : skillLogicConfig) {
skillList.add(skill);
}
@ -2072,6 +2072,18 @@ public class HeroLogic {
Arrays.stream(config.get(e).getPassiveSkill()).forEach(skillList::add);
});
//法相
Map<String, Faxiang> faxiangMap = heroVo.getFaxiangMap();
for (Faxiang faxiang : faxiangMap.values()) {
SFaxiangConfig faxiangConfig = SFaxiangConfig.faxiangMap.get(faxiang.getItemId());
if (faxiangConfig == null){
continue;
}
for (int i = 0; i < faxiang.getStar(); i++) {
skillList.add(faxiangConfig.getPassiveSkill()[i][0]);
}
}
// 神印套装
Iterator<Map.Entry<Integer, Integer>> godSealIterator = godSealByPositionMap.entrySet().iterator();
ArrayList<SEquipConfig> godSealSuiteNumList = new ArrayList<>();
@ -2243,7 +2255,7 @@ public class HeroLogic {
* @return
*/
public List<Integer> getHeroSkillList(User user, Hero hero) {
HeroVo heroVo = new HeroVo(user, hero);
HeroVo heroVo = HeroVo.createHeroVo(user, hero);
return originGetHeroSkillList(heroVo);
}
@ -3045,7 +3057,18 @@ public class HeroLogic {
Set<String> faxiangList = hero.getFaxiangList();
for (String id : faxiangList) {
Faxiang faxiang = equipManager.getFaxiang(id);
SFaxiangConfig config = SFaxiangConfig.faxiangMap.get(faxiang.getItemId());
SFaxiangLevelConfig levelConfig = SFaxiangLevelConfig.poolMap.get(config.getLevelUpPool()).get(faxiang.getStrongLv());
SFaxiangStarConfig starConfig = SFaxiangStarConfig.poolMap.get(config.getStar()).get(faxiang.getStar());
int[][] levelPara = levelConfig.getLevelPara();
int[][] property = new int[levelPara.length][];
for (int i = 0; i < levelPara.length; i++) {
int[] alone = levelPara[i];
property[i][0] = alone[0];
int value = (int)(alone[1] * (starConfig.getStarPara()/10000d+1));
property[i][1] = value;
}
combinedAttribute(property, heroAllAttribute);
}
//魂印

View File

@ -250,6 +250,9 @@ public class CBean2Proto {
// 魂宝灵宝
List<CommonProto.Equip> jewels = new ArrayList<>();
helpHero.getJewels().forEach(item->jewels.add(getEquipProto(item)));
// 法相
List<CommonProto.Equip> faxiang = new ArrayList<>();
helpHero.getFaxiangs().forEach(item->faxiang.add(getFaxiangEquipProto(item)));
// 装备详细信息
List<CommonProto.Equip> equips = new ArrayList<>();
Map<Integer, Integer> equip = helpHero.getHero().getEquipByHongmengPositionMap(otherUser.getHeroManager());
@ -263,6 +266,7 @@ public class CBean2Proto {
.setHero(getHero(helpHero.getHero()))
.setState(helpHero.getState())
.addAllJewels(jewels)
.addAllFaxiang(faxiang)
.setFourTotal(helpHero.getFourTotalTier())
.addAllEquips(equips)
.build();
@ -294,6 +298,17 @@ public class CBean2Proto {
}
}
// 法相
List<Faxiang> faxiang = new ArrayList<>();
Set<String> faxiangList = heroVo.getFaxiangList();
if (faxiangList != null && faxiangList.size() > 0){
// 装备列表
Map<String, Faxiang> faxiangMap = user.getEquipManager().getFaxiangMap();
for (String id : faxiangList) {
faxiang.add(faxiangMap.get(id));
}
}
// 结果返回,援助类型不在这里写
HelpHero helpHero = new HelpHero();
helpHero.setUid(user.getId());
@ -302,6 +317,7 @@ public class CBean2Proto {
helpHero.setHero(heroVo);
helpHero.setState(0);
helpHero.setJewels(jewels);
helpHero.setFaxiangs(faxiang);
helpHero.setFourTotalTier(user.getPlayerInfoManager().getFourChallengeTotal());
return helpHero;
}
@ -435,6 +451,7 @@ public class CBean2Proto {
.addAllSoulPos(soulPoss)
.setLockState(hero.getIsLock())
.addAllJewels(hero.getJewelInfo())
.addAllFaxiang(hero.getFaxiangList())
.setCreatetype(hero.getCreateType())
.setChangeId(hero.getChangeId())
.setSkinId(hero.getSkin())
@ -1408,4 +1425,25 @@ public class CBean2Proto {
}
return result;
}
/**
*
* @return
*/
public static Map<String, Faxiang> faxiangOfLocal(User user, Hero hero){
HashMap<String, Faxiang> result = new HashMap<>();
try {
Map<String, Faxiang> faxiangMap = user.getEquipManager().getFaxiangMap();
for (String faxiangId : hero.getFaxiangList()) {
Faxiang faxiang = faxiangMap.get(faxiangId);
if (faxiang == null){
continue;
}
result.put(faxiangId, faxiang);
}
}catch (Exception e){
e.printStackTrace();
}
return result;
}
}

View File

@ -1,7 +1,6 @@
package com.world.network.server;
import com.google.gson.Gson;
import com.ljsd.jieling.netty.cocdex.PacketNetData;
import com.ljsd.jieling.netty.server.IChannel;
import com.ljsd.jieling.protocol.INetConnet;
@ -13,7 +12,6 @@ import com.world.network.session.ISession;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import rpc.protocols.MessageTypeProto;
import util.NetUtils;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
@ -136,32 +134,32 @@ public class SessionManager implements INetSession<ISession>, INetReceived<ISess
@Override
public void readIdel(ISession iSession) {
//对端口扫描直接关闭
if (iSession.getUid() == 0) {
iSession.close();
return;
}
String remoteAddress = "";
if (!iSession.getChannel().isClosed() && iSession.getChannel().isConnected()) {
remoteAddress = NetUtils.toAddressString(iSession.getChannel().getRemoteAddress());
}
LOGGER.error("readIdea->uid={},iSessionId={},HeartBreatNums={},remoteAddress={};not receieve heart breat",
iSession.getUid(), iSession.getId(), iSession.getHeartBreatNums(), remoteAddress);
int heartBreatNums = iSession.getHeartBreatNums();
heartBreatNums--;
if (heartBreatNums <= 0) {
if (!OnlineServerManager.sessionMap.containsKey(iSession.getUid())) {
iSession.close();
return;
}
ISession oldSession = OnlineServerManager.sessionMap.get(iSession.getUid());
if (iSession.getId().equals(oldSession.getId())) {
kickOldUser(iSession.getUid(), "", 000, "LOSE HEART PACKET!!!!", 0);
}
return;
}
iSession.setHeartBreatNums(heartBreatNums);
// //对端口扫描直接关闭
// if (iSession.getUid() == 0) {
// iSession.close();
// return;
// }
// String remoteAddress = "";
// if (!iSession.getChannel().isClosed() && iSession.getChannel().isConnected()) {
// remoteAddress = NetUtils.toAddressString(iSession.getChannel().getRemoteAddress());
// }
//
// LOGGER.error("readIdea->uid={},iSessionId={},HeartBreatNums={},remoteAddress={};not receieve heart breat",
// iSession.getUid(), iSession.getId(), iSession.getHeartBreatNums(), remoteAddress);
// int heartBreatNums = iSession.getHeartBreatNums();
// heartBreatNums--;
// if (heartBreatNums <= 0) {
// if (!OnlineServerManager.sessionMap.containsKey(iSession.getUid())) {
// iSession.close();
// return;
// }
// ISession oldSession = OnlineServerManager.sessionMap.get(iSession.getUid());
// if (iSession.getId().equals(oldSession.getId())) {
// kickOldUser(iSession.getUid(), "", 000, "LOSE HEART PACKET!!!!", 0);
// }
// return;
// }
// iSession.setHeartBreatNums(heartBreatNums);
}
public boolean kickOldUser(int uid, String uToken, int errorCode, String errorMsg, long requestTime) {