法相第一版
parent
cf05efb0da
commit
48205642e4
|
@ -425,6 +425,7 @@ public interface BIReason {
|
|||
int SUPER_GM_DIAL_REWARD = 1317;//超级GM转盘消耗
|
||||
int GOD_GM_DIAL_REWARD = 1318;//超级GM转盘消耗
|
||||
int SUPER_ME_DIAL_REWARD = 1319;//超级GM转盘消耗
|
||||
|
||||
int GM_ROOT_REMOVE_ITEM = 1320;//GM后台删除玩家道具
|
||||
int UP_FAXIANG_EQUIP_LV_COST = 1321;//法相升级消耗
|
||||
int UP_FAXIANG_EQUIP_STAR_COST = 1322;//法相升星消耗
|
||||
}
|
|
@ -22,9 +22,9 @@ public interface GlobalItemType {
|
|||
int SecretBox=10; // 宝箱
|
||||
int HEAD_FRAME = 11;//头像框
|
||||
int CHANGE_NAME_CARD = 12;//改名道具卡
|
||||
int SOUL_MARK =13;// 魂印
|
||||
int SOUL_MARK = 13;// 魂印
|
||||
int ESPECIAL_EQUIP = 14;//法宝
|
||||
int HEAD = 15;//法宝
|
||||
int HEAD = 15;//头像
|
||||
int DESIGNATION = 16;//称号
|
||||
int DECORATION = 17;//皮肤
|
||||
int RIDE = 18;//坐骑
|
||||
|
@ -53,8 +53,8 @@ public interface GlobalItemType {
|
|||
int DAY_RMB_CARD = 47;//现金卡,当日生效
|
||||
int DAY_XIAN_RECHARGE_CARD = 48;//仙充卡,当日生效
|
||||
int LARGE_AMOUNT_RECHARGE_CARD = 49;//大额直充卡
|
||||
|
||||
int GENERAL_DEBRIS = 50;//通用碎片
|
||||
int FAXIANG_EQUIP = 51;//法相装备
|
||||
|
||||
//物品使用类型
|
||||
int NO_USE = 0 ; //不使用
|
||||
|
|
|
@ -265,9 +265,10 @@ public class GMRequestHandler extends BaseHandler{
|
|||
int itemId = sItem.getId();
|
||||
int itemType = sItem.getItemType();
|
||||
int itemNum = 9999;
|
||||
if(itemType == GlobalItemType.CARD || itemType == GlobalItemType.EQUIP || itemType == GlobalItemType.ESPECIAL_EQUIP
|
||||
|| itemType==GlobalItemType.SOUL_MARK || itemType==GlobalItemType.JEWEL || itemType == GlobalItemType.GOD_SEAL){
|
||||
itemNum =1;
|
||||
if(itemType == GlobalItemType.CARD || itemType == GlobalItemType.ESPECIAL_EQUIP ||
|
||||
itemType == GlobalItemType.SOUL_MARK || itemType == GlobalItemType.JEWEL ||
|
||||
itemType == GlobalItemType.GOD_SEAL || itemType == GlobalItemType.FAXIANG_EQUIP ){
|
||||
itemNum = 1;
|
||||
}
|
||||
gmDrop[i++] = new int[]{itemId,itemNum};
|
||||
}
|
||||
|
|
|
@ -39,7 +39,10 @@ import rpc.protocols.CommonProto;
|
|||
import rpc.protocols.MessageTypeProto;
|
||||
import util.TimeUtils;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.Arrays;
|
||||
import java.util.Calendar;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class CrossYuxulundaoChallengeHandler extends BaseHandler<ArenaInfoProto.CrossYuXuLunDaoChallengeRequest> {
|
||||
|
@ -402,9 +405,11 @@ public class CrossYuxulundaoChallengeHandler extends BaseHandler<ArenaInfoProto.
|
|||
byte[] snapRecord = build.toByteArray();
|
||||
if (i == 0) {
|
||||
arenaRecord.setYxldFightData1(snapRecord);
|
||||
} else if (i == 1) {
|
||||
}
|
||||
if (i == 1) {
|
||||
arenaRecord.setYxldFightData2(snapRecord);
|
||||
} else if (i == 2) {
|
||||
}
|
||||
if (i == 2) {
|
||||
arenaRecord.setYxldFightData3(snapRecord);
|
||||
}
|
||||
}
|
||||
|
@ -423,9 +428,11 @@ public class CrossYuxulundaoChallengeHandler extends BaseHandler<ArenaInfoProto.
|
|||
byte[] snapRecord = build.toByteArray();
|
||||
if (i == 0) {
|
||||
arenaRecord.setYxldFightData1(snapRecord);
|
||||
} else if (i == 1) {
|
||||
}
|
||||
if (i == 1) {
|
||||
arenaRecord.setYxldFightData2(snapRecord);
|
||||
} else if (i == 2) {
|
||||
}
|
||||
if (i == 2) {
|
||||
arenaRecord.setYxldFightData3(snapRecord);
|
||||
}
|
||||
if (GameApplication.serverId == csPlayer.getServerId()) {
|
||||
|
@ -467,9 +474,11 @@ public class CrossYuxulundaoChallengeHandler extends BaseHandler<ArenaInfoProto.
|
|||
myforce = HeroLogic.getInstance().calTeamTotalForce(myUser, myteamId[i], false);
|
||||
if(defTeamId[i] == TeamEnum.CROSS_YU_XU_LUN_DAO_ONE.getTeamId()){
|
||||
defforce =sArenaRobotConfig.getYxldTotalForce1();
|
||||
}else if(defTeamId[i] == TeamEnum.CROSS_YU_XU_LUN_DAO_TWO.getTeamId()){
|
||||
}
|
||||
if(defTeamId[i] == TeamEnum.CROSS_YU_XU_LUN_DAO_TWO.getTeamId()){
|
||||
defforce =sArenaRobotConfig.getYxldTotalForce2();
|
||||
}else if(defTeamId[i] == TeamEnum.CROSS_YU_XU_LUN_DAO_THREE.getTeamId()){
|
||||
}
|
||||
if(defTeamId[i] == TeamEnum.CROSS_YU_XU_LUN_DAO_THREE.getTeamId()){
|
||||
defforce =sArenaRobotConfig.getYxldTotalForce3();
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,19 @@
|
|||
package com.ljsd.jieling.handler.equip;
|
||||
|
||||
import com.ljsd.jieling.handler.BaseHandler;
|
||||
import com.ljsd.jieling.logic.equip.EquipLogic;
|
||||
import com.ljsd.jieling.network.session.ISession;
|
||||
import rpc.protocols.MessageTypeProto;
|
||||
import rpc.protocols.PlayerInfoProto;
|
||||
|
||||
public class GetAllFaxiangEquipHandler extends BaseHandler<PlayerInfoProto.GetAllFaxiangEquipRequest> {
|
||||
@Override
|
||||
public MessageTypeProto.MessageType getMessageCode() {
|
||||
return MessageTypeProto.MessageType.GET_ALL_FAXIANG_EQUIP_REQUEST;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void processWithProto(ISession iSession, PlayerInfoProto.GetAllFaxiangEquipRequest proto) throws Exception {
|
||||
EquipLogic.getInstance().getAllFaxiangEquip(iSession,proto.getPage());
|
||||
}
|
||||
}
|
|
@ -1,6 +1,5 @@
|
|||
package com.ljsd.jieling.handler.explorerMap;
|
||||
|
||||
import com.ljsd.GameApplication;
|
||||
import com.ljsd.fight.FightType;
|
||||
import com.ljsd.jieling.exception.ErrorCode;
|
||||
import com.ljsd.jieling.exception.ErrorCodeException;
|
||||
|
@ -21,7 +20,6 @@ import com.ljsd.jieling.logic.fight.result.FightResult;
|
|||
import com.ljsd.jieling.logic.hero.HeroLogic;
|
||||
import com.ljsd.jieling.logic.player.PlayerLogic;
|
||||
import com.ljsd.jieling.network.session.ISession;
|
||||
import com.ljsd.jieling.thrift.idl.CrossArenaManager;
|
||||
import com.ljsd.jieling.util.ItemUtil;
|
||||
import com.ljsd.jieling.util.MessageUtil;
|
||||
import config.SArenaSetting;
|
||||
|
@ -101,15 +99,12 @@ public class ExplorerMapEventHandler extends BaseHandler<PlayerInfoProto.Explore
|
|||
} else if (exploreEventConfig.get(id).getType() == 2) {
|
||||
int defUid = user.getPlayerInfoManager().getExploreEventMatchDefUid();
|
||||
CSPlayer csPlayer = CrossServiceLogic.getPlayerByRedis(defUid);
|
||||
if (csPlayer == null) {
|
||||
User userByRpc = PlayerLogic.getInstance().getUserByRpc(defUid);
|
||||
if (csPlayer == null || userByRpc == null){
|
||||
throw new ErrorCodeException(ErrorCode.USE_NOT_EXIT);
|
||||
}
|
||||
CrossArenaManager crossArenaManager = null;
|
||||
if (GameApplication.serverId != csPlayer.getServerId()) {
|
||||
crossArenaManager = PlayerLogic.getInstance().getCrossArenaManagerData(csPlayer);
|
||||
}
|
||||
CommonProto.FightTeamInfo fightTeamInfo = FightUtil.makePersonFightData(user, TeamEnum.EXPLORE_EVENT_TEAM.getTeamId(), null, null);
|
||||
CommonProto.FightTeamInfo defteamInfo = FightUtil.makeCrossPersonData(csPlayer, TeamEnum.FORMATION_NORMAL.getTeamId(), null, crossArenaManager);
|
||||
CommonProto.FightTeamInfo defteamInfo = FightUtil.makePersonFightData(user, TeamEnum.FORMATION_NORMAL.getTeamId(), null, null);
|
||||
int myforce = HeroLogic.getInstance().calTeamTotalForce(user, TeamEnum.EXPLORE_EVENT_TEAM.getTeamId(), false);
|
||||
FightResult fightResult = GetWorldArenaChallengeRequestHandler.getFightForPVP(uid, defUid,
|
||||
fightTeamInfo, defteamInfo, FightUtil.getFightSeed(), myforce < csPlayer.getMainLineForce(), FightType.ExploreXinMo);
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
package com.ljsd.jieling.handler.family;
|
||||
|
||||
import com.ljsd.GameApplication;
|
||||
import com.ljsd.jieling.db.redis.RedisUtil;
|
||||
import com.ljsd.jieling.exception.ErrorCode;
|
||||
import com.ljsd.jieling.exception.ErrorCodeException;
|
||||
|
@ -19,8 +18,6 @@ import com.ljsd.jieling.logic.rank.RankEnum;
|
|||
import com.ljsd.jieling.logic.rank.rankImpl.AbstractRank;
|
||||
import com.ljsd.jieling.netty.cocdex.PacketNetData;
|
||||
import com.ljsd.jieling.network.session.ISession;
|
||||
import com.ljsd.jieling.thrift.idl.ArenaOfHero;
|
||||
import com.ljsd.jieling.thrift.idl.CrossArenaManager;
|
||||
import com.ljsd.jieling.util.CBean2Proto;
|
||||
import com.ljsd.jieling.util.MessageUtil;
|
||||
import config.SWorldBossSetting;
|
||||
|
@ -174,30 +171,17 @@ public class GetCarChallengeListHandler extends BaseHandler {
|
|||
int rank = typedTupleWithRankitem.getRank();
|
||||
int challengeGuildId = csPlayer.getGuildId();
|
||||
String serverName = CrossServiceLogic.simplifyServerName(csPlayer.getServerId());
|
||||
int fore;
|
||||
|
||||
if(GameApplication.serverId == csPlayer.getServerId()){
|
||||
User challengeUser = UserManager.getUserNotCache(challenegUid);
|
||||
if (challengeUser == null){
|
||||
throw new ErrorCodeException(ErrorCode.USE_NOT_EXIT);
|
||||
}
|
||||
fore = HeroLogic.getInstance().calTeamTotalForce(challengeUser, TeamEnum.CAR_DELAY_TEAM.getTeamId(),false);
|
||||
for (TeamPosHeroInfo heroInfo:challengeUser.getTeamPosManager().getTeamPosForHero().get(TeamEnum.CAR_DELAY_TEAM.getTeamId())) {
|
||||
Hero hero = challengeUser.getHeroManager().getHero(heroInfo.getHeroId());
|
||||
builder1.addTeamInfo(CBean2Proto.getSimpleTeamInfoByHero(user, hero,heroInfo.getPosition()));
|
||||
}
|
||||
}else {
|
||||
CrossArenaManager arenaManager = PlayerLogic.getInstance().getCrossArenaManagerData(csPlayer);
|
||||
if (arenaManager == null){
|
||||
throw new ErrorCodeException(ErrorCode.USE_NOT_EXIT);
|
||||
}
|
||||
fore = arenaManager.getTotalForceByTeam().get(TeamEnum.CAR_DELAY_TEAM.getTeamId());
|
||||
List<com.ljsd.jieling.thrift.idl.TeamPosHeroInfo> teamPosHeroInfos = arenaManager.getTeams().get(TeamEnum.CAR_DELAY_TEAM.getTeamId());
|
||||
for (com.ljsd.jieling.thrift.idl.TeamPosHeroInfo info : teamPosHeroInfos) {
|
||||
ArenaOfHero arenaOfHero = arenaManager.getHeros().get(info.getHeroId());
|
||||
builder1.addTeamInfo(CBean2Proto.getSimpleTeamInfoByHero(arenaOfHero,info.getPosition()));
|
||||
}
|
||||
User challengeUser = PlayerLogic.getInstance().getUserByRpc(challenegUid);
|
||||
if (challengeUser == null){
|
||||
throw new ErrorCodeException(ErrorCode.USE_NOT_EXIT);
|
||||
}
|
||||
int fore = HeroLogic.getInstance().calTeamTotalForce(challengeUser, TeamEnum.CAR_DELAY_TEAM.getTeamId(),false);
|
||||
for (TeamPosHeroInfo heroInfo:challengeUser.getTeamPosManager().getTeamPosForHero().get(TeamEnum.CAR_DELAY_TEAM.getTeamId())) {
|
||||
Hero hero = challengeUser.getHeroManager().getHero(heroInfo.getHeroId());
|
||||
builder1.addTeamInfo(CBean2Proto.getSimpleTeamInfoByHero(user, hero,heroInfo.getPosition()));
|
||||
}
|
||||
|
||||
builder1.setUid(challenegUid)
|
||||
.setUserName(csPlayer.getName())
|
||||
.setScore(item.getScore().longValue())
|
||||
|
|
|
@ -29,7 +29,6 @@ import com.ljsd.jieling.logic.rank.RankContext;
|
|||
import com.ljsd.jieling.logic.rank.RankEnum;
|
||||
import com.ljsd.jieling.logic.rank.rankImpl.AbstractRank;
|
||||
import com.ljsd.jieling.network.session.ISession;
|
||||
import com.ljsd.jieling.thrift.idl.CrossArenaManager;
|
||||
import com.ljsd.jieling.util.*;
|
||||
import config.SArenaSetting;
|
||||
import config.SMServerArenaSetting;
|
||||
|
@ -146,11 +145,11 @@ public class GetWorldArenaChallengeRequestHandler extends BaseHandler<WorldProto
|
|||
if (csPlayer == null){
|
||||
throw new ErrorCodeException(ErrorCode.USE_NOT_EXIT);
|
||||
}
|
||||
CrossArenaManager crossArenaManager = null;
|
||||
if (csPlayer.getServerId() != GameApplication.serverId){
|
||||
crossArenaManager = PlayerLogic.getInstance().getCrossArenaManagerData(csPlayer);
|
||||
User userByRpc = PlayerLogic.getInstance().getUserByRpc(challengeUid);
|
||||
if (userByRpc == null){
|
||||
throw new ErrorCodeException(ErrorCode.USE_NOT_EXIT,"跨服玩家信息不存在");
|
||||
}
|
||||
teamInfo = FightUtil.makeCrossPersonData(csPlayer, proto.getTeamId(), null, crossArenaManager);
|
||||
teamInfo = FightUtil.makePersonFightData(userByRpc, proto.getTeamId(), null, null);
|
||||
arenaEnemys = ArenaLogic.getInstance().getUserCrossArenaEnemy(csPlayer,proto.getChallengeRank(),false).build();
|
||||
defendForce = csPlayer.getLuoFuForce();
|
||||
} else {
|
||||
|
|
|
@ -15,9 +15,6 @@ import org.springframework.stereotype.Component;
|
|||
import rpc.protocols.MessageTypeProto;
|
||||
import rpc.protocols.PlayerInfoProto;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@Component
|
||||
public class GetPlayerOneTeamInfo extends BaseHandler<PlayerInfoProto.GetPlayerOneTeamInfoRequest> {
|
||||
@Override
|
||||
|
@ -27,24 +24,16 @@ public class GetPlayerOneTeamInfo extends BaseHandler<PlayerInfoProto.GetPlayerO
|
|||
|
||||
@Override
|
||||
public void processWithProto(ISession iSession, PlayerInfoProto.GetPlayerOneTeamInfoRequest proto) throws Exception {
|
||||
|
||||
PlayerInfoProto.GetPlayerOneTeamInfoResponse oneTeamInfo;
|
||||
if(proto.getServerId()==0){
|
||||
//本服其他功能
|
||||
oneTeamInfo = PlayerLogic.getInstance().getOneTeamInfo( proto.getPlayerId(), proto.getTeamId());
|
||||
}else{
|
||||
//跨服
|
||||
if(proto.getPlayerId()<1000){
|
||||
//机器人
|
||||
CrossArenaEnemy info = RedisUtil.getInstence().getMapEntry(RedisKey.CROSS_ARENA_ROBOT_INFO, String.valueOf(GlobleSystemLogic.getInstence().getCrossGroup()), String.valueOf(proto.getPlayerId()), CrossArenaEnemy.class);
|
||||
if(info==null){
|
||||
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
|
||||
}
|
||||
oneTeamInfo = PlayerLogic.getInstance().getOneTeamInfo(info.getEnemyId(),proto.getTeamId(),info);
|
||||
}else{
|
||||
//真人
|
||||
oneTeamInfo = PlayerLogic.getInstance().getCrossOneTeamInfo(proto.getPlayerId(),proto.getTeamId());
|
||||
// 跨服机器人
|
||||
if (proto.getServerId() != 0 && proto.getPlayerId() < 1000){
|
||||
CrossArenaEnemy info = RedisUtil.getInstence().getMapEntry(RedisKey.CROSS_ARENA_ROBOT_INFO, String.valueOf(GlobleSystemLogic.getInstence().getCrossGroup()), String.valueOf(proto.getPlayerId()), CrossArenaEnemy.class);
|
||||
if(info==null){
|
||||
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
|
||||
}
|
||||
oneTeamInfo = PlayerLogic.getInstance().getOneTeamInfo(info.getEnemyId(),proto.getTeamId(),info);
|
||||
}else {
|
||||
oneTeamInfo = PlayerLogic.getInstance().getOneTeamInfo(proto.getPlayerId(), proto.getTeamId());
|
||||
}
|
||||
MessageUtil.sendMessage(iSession,1, MessageTypeProto.MessageType.GET_PLAYER_ONE_TEAM_INFO_RESPONSE.getNumber(),oneTeamInfo,true);
|
||||
}
|
||||
|
|
|
@ -3,15 +3,12 @@ package com.ljsd.jieling.logic.dao;
|
|||
import com.ljsd.common.mogodb.MongoBase;
|
||||
import com.ljsd.jieling.logic.dao.root.User;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.*;
|
||||
|
||||
public class EquipManager extends MongoBase {
|
||||
|
||||
private Map<String,PropertyItem> equipMap;
|
||||
|
||||
private Map<String,Faxiang> faxiangMap = new HashMap<>();
|
||||
private Set<Integer> equipBookEnabled = new HashSet<>();
|
||||
private Set<Integer> equipList = new HashSet<>();
|
||||
|
||||
|
@ -63,14 +60,40 @@ public class EquipManager extends MongoBase {
|
|||
return equipMap;
|
||||
}
|
||||
|
||||
// public Equip getUnDetermined() {
|
||||
// return unDetermined;
|
||||
// }
|
||||
//
|
||||
// public void setUnDetermined(Equip unDetermined) {
|
||||
// updateString("unDetermined", unDetermined);
|
||||
// this.unDetermined = unDetermined;
|
||||
// }
|
||||
public void addFaxiang(Faxiang faxiang) {
|
||||
this.faxiangMap.put(faxiang.getId(),faxiang);
|
||||
updateString("faxiangMap." + faxiang.getId(), faxiang);
|
||||
}
|
||||
|
||||
public void removeFaxiang(String key) {
|
||||
this.faxiangMap.remove(key);
|
||||
removeString("faxiangMap." + key);
|
||||
}
|
||||
|
||||
public Faxiang getFaxiang(String key) {
|
||||
return faxiangMap.get(key);
|
||||
}
|
||||
|
||||
public Map<String, Faxiang> getFaxiangMap() {
|
||||
return faxiangMap;
|
||||
}
|
||||
|
||||
public Map<Integer, Map<Integer, List<Faxiang>>> getFaxiangCostMap() {
|
||||
Map<Integer, Map<Integer, List<Faxiang>>> map = new HashMap<>();
|
||||
for (Faxiang value : faxiangMap.values()) {
|
||||
if (value.getStrongLv() > 0){
|
||||
continue;
|
||||
}
|
||||
Map<Integer, List<Faxiang>> starMap = map.getOrDefault(value.getItemId(), new HashMap<>());
|
||||
List<Faxiang> list = starMap.getOrDefault(value.getStar(), new ArrayList<>());
|
||||
list.add(value);
|
||||
starMap.put(value.getStar(),list);
|
||||
map.put(value.getItemId(),starMap);
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
|
||||
public void addEquipHandBook(int equipId){
|
||||
if(equipHandBook.containsKey(equipId)){
|
||||
return;
|
||||
|
|
|
@ -0,0 +1,69 @@
|
|||
package com.ljsd.jieling.logic.dao;
|
||||
|
||||
import com.ljsd.common.mogodb.MongoBase;
|
||||
import com.ljsd.jieling.logic.dao.root.User;
|
||||
import com.ljsd.jieling.util.KeyGenUtils;
|
||||
import com.ljsd.jieling.util.UUIDEnum;
|
||||
|
||||
public class Faxiang extends MongoBase {
|
||||
private String id;
|
||||
private int itemId;
|
||||
private int strongLv;
|
||||
private int star;
|
||||
|
||||
public Faxiang() {
|
||||
this.setRootCollection(User._COLLECTION_NAME);
|
||||
}
|
||||
|
||||
public Faxiang(int uid,int itemId) {
|
||||
this.setRootCollection(User._COLLECTION_NAME);
|
||||
this.id = KeyGenUtils.produceIdByModule(UUIDEnum.Faxiang, uid);
|
||||
this.itemId = itemId;
|
||||
}
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
updateString("id", id);
|
||||
}
|
||||
|
||||
public int getItemId() {
|
||||
return itemId;
|
||||
}
|
||||
|
||||
public void setItemId(int itemId) {
|
||||
this.itemId = itemId;
|
||||
updateString("itemId", itemId);
|
||||
}
|
||||
|
||||
public int getStrongLv() {
|
||||
return strongLv;
|
||||
}
|
||||
|
||||
public void setStrongLv(int strongLv) {
|
||||
this.strongLv = strongLv;
|
||||
updateString("strongLv", strongLv);
|
||||
}
|
||||
|
||||
public void addStrongLv(int Lv) {
|
||||
this.strongLv += Lv;
|
||||
updateString("strongLv", strongLv);
|
||||
}
|
||||
|
||||
public int getStar() {
|
||||
return star;
|
||||
}
|
||||
|
||||
public void setStar(int star) {
|
||||
this.star = star;
|
||||
updateString("star", star);
|
||||
}
|
||||
|
||||
public void addStar(int lv) {
|
||||
this.star += lv;
|
||||
updateString("star", star);
|
||||
}
|
||||
}
|
|
@ -6,7 +6,6 @@ import com.ljsd.jieling.core.GlobalsDef;
|
|||
import com.ljsd.jieling.logic.dao.root.User;
|
||||
import com.ljsd.jieling.logic.hero.HeroLogic;
|
||||
import com.ljsd.jieling.logic.hero.HongMengAttributeEnum;
|
||||
import com.ljsd.jieling.logic.mission.GameEvent;
|
||||
import com.ljsd.jieling.util.KeyGenUtils;
|
||||
import com.ljsd.jieling.util.UUIDEnum;
|
||||
import config.*;
|
||||
|
@ -55,7 +54,7 @@ public class Hero extends MongoBase implements Comparable<Hero>,Cloneable {
|
|||
private int createType;
|
||||
private int changeId;
|
||||
private Set<String> jewelInfo = new HashSet<>();
|
||||
|
||||
private Set<String> faxiangList = new HashSet<>();
|
||||
private int skin;
|
||||
|
||||
///神魂绑定英雄 神魂等级:<hero动态id>
|
||||
|
@ -184,11 +183,7 @@ public class Hero extends MongoBase implements Comparable<Hero>,Cloneable {
|
|||
for(int i = 0; i < equipSign.length; i++){
|
||||
soulEquipByPositionMap.put(i+1,equipSign[i]);
|
||||
}
|
||||
// int[] equip = propConfig.getEquipList();
|
||||
equipByPositionMap = new HashMap<>();
|
||||
// for(int i = 0; i < equip.length; i++){
|
||||
// equipByPositionMap.put(i+1,equip[i]);
|
||||
// }
|
||||
}
|
||||
|
||||
public void upStar(int upStar) {
|
||||
|
@ -196,6 +191,19 @@ public class Hero extends MongoBase implements Comparable<Hero>,Cloneable {
|
|||
updateString("star", star);
|
||||
}
|
||||
|
||||
public Set<String> getFaxiangList() {
|
||||
return faxiangList;
|
||||
}
|
||||
|
||||
public void addFaxiang(String key) {
|
||||
this.faxiangList.add(key);
|
||||
updateString("faxiangList",faxiangList);
|
||||
}
|
||||
|
||||
public void uninstallFaxiang(String key) {
|
||||
this.faxiangList.remove(key);
|
||||
updateString("faxiangList",faxiangList);
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
package com.ljsd.jieling.logic.dao;
|
||||
|
||||
import com.ljsd.jieling.logic.dao.root.User;
|
||||
import com.ljsd.jieling.logic.hero.HongMengAttributeEnum;
|
||||
import com.ljsd.jieling.util.KeyGenUtils;
|
||||
import com.ljsd.jieling.util.UUIDEnum;
|
||||
import config.SJewelConfig;
|
||||
|
@ -13,7 +12,7 @@ import manager.STableManager;
|
|||
* @discribe
|
||||
*/
|
||||
public class Jewel extends PropertyItem implements Cloneable {
|
||||
// 精炼
|
||||
// 精炼/星级
|
||||
private int buildLevel;
|
||||
|
||||
private int jewelType;
|
||||
|
|
|
@ -2,8 +2,6 @@ package com.ljsd.jieling.logic.dao;
|
|||
|
||||
import com.ljsd.common.mogodb.MongoBase;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Map;
|
||||
|
||||
public class PropertyItem extends MongoBase implements Cloneable {
|
||||
|
@ -11,6 +9,9 @@ public class PropertyItem extends MongoBase implements Cloneable {
|
|||
|
||||
private int equipId;
|
||||
|
||||
/**
|
||||
* 强化等级
|
||||
*/
|
||||
private int level;
|
||||
|
||||
private String heroId;
|
||||
|
|
|
@ -0,0 +1,275 @@
|
|||
package com.ljsd.jieling.logic.equip;
|
||||
|
||||
import com.ljsd.jieling.exception.ErrorCode;
|
||||
import com.ljsd.jieling.exception.ErrorCodeException;
|
||||
import com.ljsd.jieling.globals.BIReason;
|
||||
import com.ljsd.jieling.logic.dao.EquipManager;
|
||||
import com.ljsd.jieling.logic.dao.Faxiang;
|
||||
import com.ljsd.jieling.logic.dao.Hero;
|
||||
import com.ljsd.jieling.logic.dao.UserManager;
|
||||
import com.ljsd.jieling.logic.dao.root.User;
|
||||
import com.ljsd.jieling.network.session.ISession;
|
||||
import com.ljsd.jieling.util.CBean2Proto;
|
||||
import com.ljsd.jieling.util.ItemUtil;
|
||||
import com.ljsd.jieling.util.MessageUtil;
|
||||
import config.SCHero;
|
||||
import config.SFaxiangConfig;
|
||||
import config.SFaxiangLevelConfig;
|
||||
import config.SFaxiangStarConfig;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import rpc.protocols.CommonProto;
|
||||
import rpc.protocols.MessageTypeProto;
|
||||
import rpc.protocols.PlayerInfoProto;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class EquipLogic {
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(EquipLogic.class);
|
||||
public static class Instance {
|
||||
public final static EquipLogic instance = new EquipLogic();
|
||||
}
|
||||
public static EquipLogic getInstance() {
|
||||
return EquipLogic.Instance.instance;
|
||||
}
|
||||
|
||||
/**
|
||||
* 穿脱法相装备
|
||||
* @param uid
|
||||
* @param heroID
|
||||
* @param faxiangID
|
||||
* @param action
|
||||
* @throws Exception
|
||||
*/
|
||||
public void wearFaxiangEquip(int uid, String heroID, String faxiangID, int action) throws Exception {
|
||||
User user = UserManager.getUser(uid);
|
||||
Hero hero = user.getHeroManager().getHero(heroID);
|
||||
if (hero == null){
|
||||
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE,"英雄不存在:"+heroID);
|
||||
}
|
||||
EquipManager equipManager = user.getEquipManager();
|
||||
Faxiang faxiang = equipManager.getFaxiang(faxiangID);
|
||||
if (faxiang == null){
|
||||
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE,"法相装备不存在:"+faxiangID);
|
||||
}
|
||||
Map<Integer, SFaxiangConfig> faxiangMap = SFaxiangConfig.faxiangMap;
|
||||
SFaxiangConfig faxiangConfig = faxiangMap.get(faxiang.getItemId());
|
||||
if (faxiangConfig == null || faxiangConfig.getIsOpen() == 0){
|
||||
throw new ErrorCodeException(ErrorCode.CFG_NULL,"法相配置表不存在,或未进入版本:"+faxiang.getItemId());
|
||||
}
|
||||
// 穿戴
|
||||
if (action == 1){
|
||||
Set<String> faxiangList = hero.getFaxiangList();
|
||||
if (faxiangList.contains(faxiangID)){
|
||||
LOGGER.error("法相已装备,hero:{}, faxiang:{}",heroID,faxiangID);
|
||||
throw new ErrorCodeException(ErrorCode.HERO_EQUIP_ERR,"法相已装备");
|
||||
}
|
||||
// 检测是否装备同类型的法相
|
||||
for (String faxiangId : faxiangList) {
|
||||
Faxiang faxiang1 = equipManager.getFaxiang(faxiangId);
|
||||
if (faxiang1 == null){
|
||||
hero.uninstallFaxiang(faxiangId);
|
||||
LOGGER.error("法相不存在装备库中,已卸载,uid:{}, hero:{}, faxiang:{}",uid,heroID,faxiangID);
|
||||
continue;
|
||||
}
|
||||
SFaxiangConfig faxiangConfig1 = faxiangMap.get(faxiang1.getItemId());
|
||||
if (faxiangConfig1 == null){
|
||||
hero.uninstallFaxiang(faxiangId);
|
||||
LOGGER.error("法相不存在装备库中,已卸载,uid:{}, hero:{}, faxiang:{}",uid,heroID,faxiangID);
|
||||
continue;
|
||||
}
|
||||
if (faxiangConfig.getType() == faxiangConfig1.getType()){
|
||||
throw new ErrorCodeException(ErrorCode.HERO_EQUIP_ERR,"法相已装备同类型的法相");
|
||||
}
|
||||
}
|
||||
SCHero scHero = SCHero.getsCHero().get(hero.getTemplateId());
|
||||
if (scHero == null){
|
||||
throw new ErrorCodeException(ErrorCode.CFG_NULL,"英雄不存在配置表中");
|
||||
}
|
||||
// 职业是否吻合
|
||||
if (faxiangConfig.getProfession() != 0 && faxiangConfig.getProfession() != scHero.getProfession()){
|
||||
throw new ErrorCodeException(ErrorCode.HERO_EQUIP_ERR,"英雄职业不符合");
|
||||
}
|
||||
if (faxiangConfig.getJob() != 0 && faxiangConfig.getJob() != scHero.getJob()){
|
||||
throw new ErrorCodeException(ErrorCode.HERO_EQUIP_ERR,"英雄细分职业不符合");
|
||||
}
|
||||
|
||||
hero.addFaxiang(faxiangID);
|
||||
}
|
||||
// 脱下
|
||||
if (action == 2){
|
||||
if (!hero.getFaxiangList().contains(faxiangID)){
|
||||
LOGGER.error("法相未装备,hero:{}, faxiang:{}",heroID,faxiangID);
|
||||
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE,"法相未装备");
|
||||
}
|
||||
hero.uninstallFaxiang(faxiangID);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 强化法相,或法相升星
|
||||
* @param uid
|
||||
* @param faxiangID
|
||||
* @param action
|
||||
* @throws Exception
|
||||
*/
|
||||
public void strongthenFaxiangEquip(int uid, String faxiangID, int targetLv, int action) throws Exception {
|
||||
User user = UserManager.getUser(uid);
|
||||
EquipManager equipManager = user.getEquipManager();
|
||||
Faxiang faxiang = equipManager.getFaxiang(faxiangID);
|
||||
if (faxiang == null){
|
||||
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE,"法相装备不存在:"+faxiangID);
|
||||
}
|
||||
Map<Integer, SFaxiangConfig> faxiangMap = SFaxiangConfig.faxiangMap;
|
||||
SFaxiangConfig faxiangConfig = faxiangMap.get(faxiang.getItemId());
|
||||
if (faxiangConfig == null || faxiangConfig.getIsOpen() == 0){
|
||||
throw new ErrorCodeException(ErrorCode.CFG_NULL,"SFaxiangConfig 配置表不存在,或未进入版本:"+faxiang.getItemId());
|
||||
}
|
||||
// 强化
|
||||
if (action == 1){
|
||||
if (faxiang.getStrongLv() >= targetLv){
|
||||
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE,"SFaxiangConfig 目标等级低于当前等级");
|
||||
}
|
||||
if (targetLv > faxiangConfig.getLevelMax()){
|
||||
throw new ErrorCodeException(ErrorCode.LEVE_MAX,"SFaxiangConfig 超过最大等级:"+targetLv);
|
||||
}
|
||||
Map<Integer, SFaxiangLevelConfig> levelConfigMap = SFaxiangLevelConfig.poolMap.get(faxiangConfig.getLevelUpPool());
|
||||
if (levelConfigMap == null){
|
||||
throw new ErrorCodeException(ErrorCode.CFG_NULL,"SFaxiangLevelConfig 配置表不存在, pool库:"+faxiangConfig.getLevelUpPool());
|
||||
}
|
||||
|
||||
HashMap<Integer, Long> costMap = new HashMap<>();
|
||||
int num = faxiang.getStrongLv();
|
||||
while (num == targetLv){
|
||||
SFaxiangLevelConfig levelConfig = levelConfigMap.get(num);
|
||||
if (levelConfig == null || levelConfig.getPropList() == null){
|
||||
throw new ErrorCodeException(ErrorCode.CFG_NULL,"SFaxiangLevelConfig 配置表不存在,或升级道具为空, level等级:"+num);
|
||||
}
|
||||
// 整合道具
|
||||
for (int[] prop : levelConfig.getPropList()) {
|
||||
costMap.put(prop[0],costMap.getOrDefault(prop[0],0L)+prop[1]);
|
||||
}
|
||||
num++;
|
||||
}
|
||||
|
||||
boolean checkCost = ItemUtil.checkCostLong(user,costMap);
|
||||
if (!checkCost){
|
||||
throw new ErrorCodeException(ErrorCode.ITEM_NOT_ENOUGH,"SFaxiangLevelConfig 升级道具数量不足:"+faxiang.getStrongLv());
|
||||
}
|
||||
faxiang.setStrongLv(targetLv);
|
||||
ItemUtil.itemCostLong(user,costMap, BIReason.UP_FAXIANG_EQUIP_LV_COST,0);
|
||||
}
|
||||
// 升星
|
||||
if (action == 2){
|
||||
if (faxiang.getStar() >= targetLv){
|
||||
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE,"SFaxiangConfig 目标等级低于当前等级");
|
||||
}
|
||||
if (targetLv > faxiangConfig.getStarMax()){
|
||||
throw new ErrorCodeException(ErrorCode.LEVE_MAX,"SFaxiangConfig 超过最大等级:"+targetLv);
|
||||
}
|
||||
Map<Integer, SFaxiangStarConfig> starConfigMap = SFaxiangStarConfig.poolMap.get(faxiangConfig.getLevelUpPool());
|
||||
if (starConfigMap == null){
|
||||
throw new ErrorCodeException(ErrorCode.CFG_NULL,"SFaxiangStarConfig 配置表不存在, pool库:"+faxiangConfig.getLevelUpPool());
|
||||
}
|
||||
|
||||
HashMap<Integer, Long> costMap = new HashMap<>();
|
||||
StringBuilder equipCostStr = new StringBuilder();
|
||||
int num = faxiang.getStar();
|
||||
while (num == targetLv){
|
||||
SFaxiangStarConfig starConfig = starConfigMap.get(num);
|
||||
if (starConfig == null || starConfig.getPropList() == null){
|
||||
throw new ErrorCodeException(ErrorCode.CFG_NULL,"SFaxiangLevelConfig 配置表不存在,或升级道具为空, level等级:"+num);
|
||||
}
|
||||
// 整合道具
|
||||
for (int[] prop : starConfig.getPropList()) {
|
||||
if (prop[0] == 0){
|
||||
// 法相
|
||||
equipCostStr.append(faxiang.getItemId()).append("#").append(num).append("#").append(prop[1]).append("|");
|
||||
continue;
|
||||
}
|
||||
// 道具
|
||||
costMap.put(prop[0],costMap.getOrDefault(prop[0],0L)+prop[1]);
|
||||
}
|
||||
num++;
|
||||
}
|
||||
|
||||
// 先校验,后消耗
|
||||
boolean checkCost = ItemUtil.checkCostLong(user,costMap);
|
||||
boolean costFaxiang = costFaxiang(user, equipCostStr.toString(), false);
|
||||
if (!checkCost || !costFaxiang){
|
||||
throw new ErrorCodeException(ErrorCode.ITEM_NOT_ENOUGH,"SFaxiangLevelConfig 升级道具数量不足:"+faxiang.getStrongLv());
|
||||
}
|
||||
faxiang.setStrongLv(targetLv);
|
||||
ItemUtil.itemCostLong(user,costMap, BIReason.UP_FAXIANG_EQUIP_LV_COST,0);
|
||||
costFaxiang(user, equipCostStr.toString(), true);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 消耗法相道具
|
||||
* @param user
|
||||
* @param costStr
|
||||
* @param cost
|
||||
* @return
|
||||
*/
|
||||
private boolean costFaxiang(User user, String costStr, boolean cost){
|
||||
if (costStr == null || costStr.isEmpty()){
|
||||
return true;
|
||||
}
|
||||
LOGGER.info("验证消耗法相道具,uid:{}, prop:{}, bol:{}",user.getId(),costStr,cost);
|
||||
EquipManager equipManager = user.getEquipManager();
|
||||
HashSet<String> set = new HashSet<>();
|
||||
Map<Integer, Map<Integer, List<Faxiang>>> map = equipManager.getFaxiangCostMap();
|
||||
int total = 0;
|
||||
String[] oneSplit = costStr.split("\\|");
|
||||
for (String one : oneSplit) {
|
||||
String[] value = one.split("#");
|
||||
// 每条有三个数据
|
||||
if (value.length != 3){
|
||||
return false;
|
||||
}
|
||||
// 根据 法相道具id#法相星级#法相数量 验证
|
||||
List<Faxiang> list = map.getOrDefault(Integer.parseInt(value[0]), new HashMap<>()).getOrDefault(Integer.parseInt(value[1]), new ArrayList<>());
|
||||
int num = Integer.parseInt(value[2]);
|
||||
if (list.size() < num){
|
||||
return false;
|
||||
}
|
||||
List<Faxiang> faxiangList = list.subList(0, num);
|
||||
set.addAll(faxiangList.stream().map(Faxiang::getId).collect(Collectors.toList()));
|
||||
total+=num;
|
||||
}
|
||||
if (total < set.size()){
|
||||
return false;
|
||||
}
|
||||
if (cost){
|
||||
for (String key : set) {
|
||||
equipManager.removeFaxiang(key);
|
||||
}
|
||||
LOGGER.info("验证消耗了法相道具,uid:{}, prop:{}",user.getId(),costStr);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取全部法相道具
|
||||
* @param iSession
|
||||
* @param page
|
||||
* @throws Exception
|
||||
*/
|
||||
public void getAllFaxiangEquip(ISession iSession, int page) throws Exception {
|
||||
int pageNum = 20;
|
||||
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);
|
||||
for (Faxiang faxiang : pageList) {
|
||||
CommonProto.Equip proto = CBean2Proto.getFaxiangEquipProto(faxiang);
|
||||
equips.add(proto);
|
||||
}
|
||||
PlayerInfoProto.GetAllFaxiangEquipResponse build = PlayerInfoProto.GetAllFaxiangEquipResponse.newBuilder().addAllEquips(equips).build();
|
||||
MessageUtil.sendMessage(iSession, 1, MessageTypeProto.MessageType.GET_ALL_EQUIP_RESPONSE_VALUE, build, true);
|
||||
}
|
||||
}
|
|
@ -232,22 +232,11 @@ public class FightUtil {
|
|||
}
|
||||
|
||||
public static CommonProto.FightTeamInfo getCrossFightTeam(CSPlayer csPlayer, int teamId) throws Exception {
|
||||
CommonProto.FightTeamInfo.Builder builder;
|
||||
// 本服
|
||||
if (csPlayer.getServerId() == GameApplication.serverId){
|
||||
User user = UserManager.getUserNotCache(csPlayer.getUserId());
|
||||
if (user == null){
|
||||
throw new ErrorCodeException(ErrorCode.USE_NOT_EXIT);
|
||||
}
|
||||
builder = BehaviorUtil.getFightTeamInfo(user,teamId,true).toBuilder();
|
||||
}else{
|
||||
// 跨服
|
||||
CrossArenaManager crossArenaManager = PlayerLogic.getInstance().getCrossArenaManagerData(csPlayer);
|
||||
if (crossArenaManager == null){
|
||||
throw new ErrorCodeException(ErrorCode.newDefineCode("服务器rpc失败:"+csPlayer.getUserId()));
|
||||
}
|
||||
builder = FightUtil.makeCrossPersonData(csPlayer, teamId, null, crossArenaManager).toBuilder();
|
||||
User user = PlayerLogic.getInstance().getUserByRpc(csPlayer.getUserId());
|
||||
if (user == null){
|
||||
throw new ErrorCodeException(ErrorCode.USE_NOT_EXIT);
|
||||
}
|
||||
CommonProto.FightTeamInfo.Builder builder = BehaviorUtil.getFightTeamInfo(user,teamId,true).toBuilder();
|
||||
return builder.build();
|
||||
}
|
||||
|
||||
|
@ -707,7 +696,6 @@ public class FightUtil {
|
|||
|
||||
//TODO 规范这个参数
|
||||
public static CommonProto.FightTeamInfo makeCrossPersonData(CSPlayer csPlayer, int teamId, ArenaRecord arenaRecord, CrossArenaManager crossArenaManager) throws Exception {
|
||||
//CSPlayer csPlayer = CrossServiceLogic.getPlayerByRedis(uid);
|
||||
if (csPlayer == null) {
|
||||
return null;//throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
|
||||
}
|
||||
|
|
|
@ -163,14 +163,6 @@ public class HeroLogic {
|
|||
int uid = iSession.getUid();
|
||||
User user = UserManager.getUser(uid);
|
||||
List<CommonProto.Equip> equipList = new ArrayList<>();
|
||||
// if(type==1){
|
||||
// Map<String, PropertyItem> equipMap = user.getEquipManager().getEquipMap();
|
||||
// for(PropertyItem equipInfo: equipMap.values()){
|
||||
// if(equipInfo instanceof Equip)
|
||||
// equipList.add(CBean2Proto.getEquipProto(equipInfo));
|
||||
// }
|
||||
// }
|
||||
//fix user item
|
||||
|
||||
ItemManager itemManager = user.getItemManager();
|
||||
EquipManager equipManager = user.getEquipManager();
|
||||
|
@ -196,7 +188,6 @@ public class HeroLogic {
|
|||
LOGGER.error("Exception :" + e);
|
||||
}
|
||||
}
|
||||
;
|
||||
//宝器
|
||||
if (type == 4) {
|
||||
Map<String, PropertyItem> equipMap = user.getEquipManager().getEquipMap();
|
||||
|
@ -221,7 +212,6 @@ public class HeroLogic {
|
|||
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
|
||||
}
|
||||
|
||||
|
||||
boolean isSendFinish = false;
|
||||
int endIndex = index + Global.SEND_EQUIP_COUNT;
|
||||
if (index < equipList.size()) {
|
||||
|
@ -3021,7 +3011,7 @@ public class HeroLogic {
|
|||
// 自己
|
||||
if (HeroLogic.ifOpenGodTree(user)) {
|
||||
// 获取神应等级
|
||||
int level = jewel.getGodTreeLv() >= config.getGodHoodMaxlv() ? config.getGodHoodMaxlv() : jewel.getGodTreeLv();
|
||||
int level = Math.min(jewel.getGodTreeLv(), config.getGodHoodMaxlv());
|
||||
// 获取加成属性
|
||||
property = HeroLogic.getInstance().godTreeAddition(godTreePoolMap, level, user.getPlayerInfoManager().getFourChallengeTotal());
|
||||
combinedAttribute(property, heroAllAttribute);
|
||||
|
@ -3029,6 +3019,7 @@ public class HeroLogic {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
//宝器共鸣
|
||||
if (flashing) {
|
||||
Map<Integer, SJewelResonanceConfig> config = STableManager.getConfig(SJewelResonanceConfig.class);
|
||||
|
@ -3036,10 +3027,10 @@ public class HeroLogic {
|
|||
int buildLevelProperty = 0;
|
||||
for (SJewelResonanceConfig value : config.values()) {
|
||||
if (value.getType() == 1) {
|
||||
levelProperty = value.getLevel() > minLevel ? levelProperty : (value.getId() > levelProperty ? value.getId() : levelProperty);
|
||||
levelProperty = value.getLevel() > minLevel ? levelProperty : (Math.max(value.getId(), levelProperty));
|
||||
}
|
||||
if (value.getType() == 2) {
|
||||
buildLevelProperty = value.getLevel() > minBuildLevel ? buildLevelProperty : (value.getId() > buildLevelProperty ? value.getId() : buildLevelProperty);
|
||||
buildLevelProperty = value.getLevel() > minBuildLevel ? buildLevelProperty : (Math.max(value.getId(), buildLevelProperty));
|
||||
}
|
||||
}
|
||||
if (levelProperty != 0) {
|
||||
|
@ -3050,6 +3041,13 @@ public class HeroLogic {
|
|||
}
|
||||
}
|
||||
|
||||
// 法相加成
|
||||
Set<String> faxiangList = hero.getFaxiangList();
|
||||
for (String id : faxiangList) {
|
||||
Faxiang faxiang = equipManager.getFaxiang(id);
|
||||
|
||||
}
|
||||
|
||||
//魂印
|
||||
Map<Integer, Integer> soulEquipByPositionMap = hero.getSoulEquipByPositionMap();
|
||||
soulEquipByPositionMap.forEach((k, v) -> {
|
||||
|
@ -3553,16 +3551,13 @@ public class HeroLogic {
|
|||
}
|
||||
hero.updateMutliEquipPositionMap(equipInfoTmp);
|
||||
user.getUserMissionManager().onGameEvent(user, GameEvent.WEAR_EQUIP, equipInfoTmp.size());
|
||||
} else if (type == 2) {
|
||||
}
|
||||
if (type == 2) {
|
||||
for (String jId : equipIds) {
|
||||
wearJewel(user.getHeroManager(), hero, equipManager, jId);
|
||||
}
|
||||
}
|
||||
|
||||
// Map<Integer, Integer> heroNotBufferAttribute = calHeroNotBufferAttribute(user, hero);
|
||||
// int force = calForce(heroNotBufferAttribute) + heroNotBufferAttribute.get(HeroAttributeEnum.EquipForce.getPropertyId());
|
||||
// LOGGER.info("the heroTid={},the force={}",hero.getTemplateId(),force);
|
||||
|
||||
// 更新战力
|
||||
Poster.getPoster().dispatchEvent(new SaveHeroForceEvent(user.getId(),heroId));
|
||||
// 鸿蒙阵,穿装备
|
||||
|
|
|
@ -21,8 +21,6 @@ import com.ljsd.jieling.logic.help.HelpTypeEnum;
|
|||
import com.ljsd.jieling.logic.hero.HeroLogic;
|
||||
import com.ljsd.jieling.logic.home.HomeLogic;
|
||||
import com.ljsd.jieling.logic.store.newRechargeInfo.NewRechargeInfo;
|
||||
import com.ljsd.jieling.thrift.idl.ArenaOfHero;
|
||||
import com.ljsd.jieling.thrift.idl.CrossArenaManager;
|
||||
import config.*;
|
||||
import manager.STableManager;
|
||||
import org.slf4j.Logger;
|
||||
|
@ -520,6 +518,20 @@ public class CBean2Proto {
|
|||
return equipProto.build();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取法相信息,纯装备信息
|
||||
* @param faxiang
|
||||
* @return
|
||||
*/
|
||||
public static CommonProto.Equip getFaxiangEquipProto(Faxiang faxiang){
|
||||
CommonProto.Equip.Builder equipProto = CommonProto.Equip.newBuilder();
|
||||
equipProto.setId(faxiang.getId());
|
||||
equipProto.setEquipId(faxiang.getItemId());
|
||||
equipProto.setExp(faxiang.getStrongLv());
|
||||
equipProto.setRebuildLevel(faxiang.getStar());
|
||||
return equipProto.build();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取装备信息,需要添加和玩家有关的调用次方法
|
||||
* @param equip
|
||||
|
|
|
@ -91,7 +91,7 @@ public class ItemUtil {
|
|||
private static void maptoAddWithOutItem(User user, ItemMap itemObj, CommonProto.Drop.Builder dropBuilder,int reason) throws Exception {
|
||||
addCard(user, itemObj.getCardMap(), dropBuilder,reason);
|
||||
addEquip(user, itemObj.getEquipMap(), dropBuilder,reason);
|
||||
addSpecialMonster(user,itemObj,dropBuilder,reason);
|
||||
// addSpecialMonster(user,itemObj,dropBuilder,reason);
|
||||
}
|
||||
|
||||
|
||||
|
@ -99,10 +99,7 @@ public class ItemUtil {
|
|||
public static CommonProto.Drop.Builder drop(User user, int[][] itemArr,int reason) throws Exception {
|
||||
CommonProto.Drop.Builder dropBuilder = CommonProto.Drop.newBuilder();
|
||||
ItemMap itemObj = new ItemMap();
|
||||
|
||||
selectItemArr(itemArr,itemObj);
|
||||
|
||||
// useRandomItem(user,randomMap,reason);
|
||||
mapToAdd(user,itemObj,dropBuilder,reason);
|
||||
return dropBuilder;
|
||||
}
|
||||
|
@ -661,6 +658,7 @@ public class ItemUtil {
|
|||
putCountMap(itemId,(int)amount, itemObj.getCardMap());
|
||||
break;
|
||||
case GlobalItemType.JEWEL:
|
||||
case GlobalItemType.FAXIANG_EQUIP:
|
||||
putCountMap(itemId,(int)amount, itemObj.getEquipMap());
|
||||
break;
|
||||
case GlobalItemType.SpecialMonster:
|
||||
|
@ -1226,43 +1224,44 @@ public class ItemUtil {
|
|||
}
|
||||
|
||||
/**
|
||||
* 添加装备
|
||||
* 添加装备(特指 宝器,法相等,(帽,衣,裤,鞋)基础装备算道具)
|
||||
* @param user
|
||||
* @param equipMap
|
||||
* @param dropBuilder
|
||||
*/
|
||||
public static void addEquip(User user, Map<Integer,Integer> equipMap, CommonProto.Drop.Builder dropBuilder,int reason) throws Exception {
|
||||
if (equipMap.isEmpty()) {
|
||||
if (equipMap == null || equipMap.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
// 过滤装备
|
||||
List<Integer> filter = new ArrayList<>();
|
||||
filter.add(GlobalItemType.EQUIP);
|
||||
filter.add(GlobalItemType.ESPECIAL_EQUIP);
|
||||
filter.add(GlobalItemType.JEWEL);
|
||||
filter.add(GlobalItemType.FAXIANG_EQUIP);
|
||||
|
||||
SGameSetting gameSetting = STableManager.getFigureConfig(CommonStaticConfig.class).getGameSetting();
|
||||
int hasEquipNum = user.getEquipManager().getEquipMap().size();
|
||||
String title = SErrorCodeEerverConfig.getI18NMessage("equip_bag_limit_title");
|
||||
String content = SErrorCodeEerverConfig.getI18NMessage("equip_bag_limit_txt");
|
||||
int equipNum = equipMap.entrySet().stream().filter(k ->{
|
||||
int itemType = SItem.getsItemMap().get(k.getKey()).getItemType();
|
||||
if(itemType==GlobalItemType.EQUIP){
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}).collect(Collectors.toSet()).size();
|
||||
if (hasEquipNum +equipNum>= gameSetting.getEquipNumlimit()){
|
||||
String reward = getLimitReward(equipMap,filter);
|
||||
int nowTime =(int) (TimeUtils.now()/1000);
|
||||
MailLogic.getInstance().sendMail(user.getId(),title,content,reward,nowTime,Global.MAIL_EFFECTIVE_TIME);
|
||||
MessageUtil.nofityBagIsFull(user);
|
||||
return;
|
||||
}
|
||||
|
||||
// 装备上限
|
||||
SGameSetting gameSetting = STableManager.getFigureConfig(CommonStaticConfig.class).getGameSetting();
|
||||
// int hasEquipNum = user.getEquipManager().getEquipMap().size();
|
||||
// // 获取其中的装备数量
|
||||
// int equipNum = equipMap.entrySet().stream().filter(k ->{
|
||||
// int itemType = SItem.getsItemMap().get(k.getKey()).getItemType();
|
||||
// return itemType == GlobalItemType.EQUIP;
|
||||
// }).collect(Collectors.toSet()).size();
|
||||
//
|
||||
// // 到达背包装备上限
|
||||
// if (hasEquipNum + equipNum >= gameSetting.getEquipNumlimit()){
|
||||
// String reward = getLimitReward(equipMap,filter);
|
||||
// MailLogic.getInstance().sendMail(user.getId(),title,content,reward,TimeUtils.nowInt(),Global.MAIL_EFFECTIVE_TIME);
|
||||
// MessageUtil.nofityBagIsFull(user);
|
||||
// return;
|
||||
// }
|
||||
|
||||
StringBuilder reward = new StringBuilder();
|
||||
List<CommonProto.Equip> equipList = new CopyOnWriteArrayList<>();
|
||||
List<CommonProto.Equip> jewelList = new CopyOnWriteArrayList<>();
|
||||
// jewelMap 为了做宝物礼包推送<宝物品质, 数量>
|
||||
Map<Integer, Integer> jewelMap = new HashMap<>();
|
||||
Map<Integer, Integer> jewelPushMap = new HashMap<>();
|
||||
for (Map.Entry<Integer, Integer> entry : equipMap.entrySet()) {
|
||||
int itemType = SItem.getsItemMap().get(entry.getKey()).getItemType();
|
||||
if(!filter.contains(itemType)){
|
||||
|
@ -1270,36 +1269,36 @@ public class ItemUtil {
|
|||
}
|
||||
int count = entry.getValue();
|
||||
for (int i = 0; i < count; i++) {
|
||||
// 到达装备上限,发送邮件,不走背包
|
||||
if (user.getEquipManager().getEquipMap().size() >= gameSetting.getEquipNumlimit()) {
|
||||
if (reward.length() == 0){
|
||||
reward = new StringBuilder(entry.getKey() + "#1");
|
||||
}else{
|
||||
reward.append("|").append(entry.getKey()).append("#1");
|
||||
reward.append(entry.getKey()).append("#1").append("|");
|
||||
if (reward.length() > 0){
|
||||
reward = new StringBuilder(reward.substring(0, reward.length() - 1));
|
||||
}
|
||||
continue;
|
||||
}else {
|
||||
addJewel(user, entry.getKey(), jewelPushMap, jewelList);
|
||||
ReportUtil.onReportEvent(user,ReportEventEnum.GET_TREASURE.getType(),entry.getKey(),reason);
|
||||
}
|
||||
addEquip(user, entry.getKey(), jewelMap,jewelList);
|
||||
ReportUtil.onReportEvent(user,ReportEventEnum.GET_TREASURE.getType(),entry.getKey(),reason);
|
||||
// KtEventUtils.onKtEvent(user, ParamEventBean.UserItemEvent,reason,GlobalsDef.addReason,entry.getKey(),1,-1);
|
||||
}
|
||||
}
|
||||
|
||||
if (reward.length() > 0) {
|
||||
int nowTime = (int) (TimeUtils.now() / 1000);
|
||||
MailLogic.getInstance().sendMail(user.getId(), title, content, reward.toString(), nowTime, Global.MAIL_EFFECTIVE_TIME);
|
||||
MailLogic.getInstance().sendMail(user.getId(), title, content, reward.toString(), TimeUtils.nowInt(), Global.MAIL_EFFECTIVE_TIME);
|
||||
MessageUtil.nofityBagIsFull(user);
|
||||
}
|
||||
if (!jewelMap.isEmpty()) {
|
||||
|
||||
dropBuilder.addAllSoulEquip(jewelList);
|
||||
dropBuilder.addAllEquipId(new CopyOnWriteArrayList<>());
|
||||
jewelList.clear();
|
||||
|
||||
if (!jewelPushMap.isEmpty()) {
|
||||
ISession sessionByUid = OnlineUserManager.getSessionByUid(user.getId());
|
||||
if (sessionByUid != null) {
|
||||
for (Map.Entry<Integer, Integer> entry : jewelMap.entrySet()) {
|
||||
for (Map.Entry<Integer, Integer> entry : jewelPushMap.entrySet()) {
|
||||
BuyGoodsNewLogic.openPush(sessionByUid, user, PushRechargeType.BAOWU_PINGZHI.getType(), entry.getKey(), entry.getValue());
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
dropBuilder.addAllEquipId(equipList);
|
||||
dropBuilder.addAllSoulEquip(jewelList);
|
||||
}
|
||||
|
||||
|
||||
|
@ -1322,35 +1321,38 @@ public class ItemUtil {
|
|||
return reward.toString();
|
||||
}
|
||||
|
||||
private static void addEquip(User user,int equipId ,Map<Integer, Integer> jewels,List<CommonProto.Equip> jewelList) {
|
||||
private static void addJewel(User user, int equipId , Map<Integer, Integer> jewels, List<CommonProto.Equip> jewelList) {
|
||||
EquipManager equipManager = user.getEquipManager();
|
||||
SItem item = SItem.getsItemMap().get(equipId);
|
||||
int itemType = item.getItemType();
|
||||
String msgTem = "";
|
||||
if(itemType==GlobalItemType.JEWEL){
|
||||
// 宝器
|
||||
if(itemType == GlobalItemType.JEWEL){
|
||||
Jewel equip = new Jewel(user.getId(),equipId);
|
||||
equipManager.addEquip(equip);
|
||||
jewelList.add(CBean2Proto.getEquipProto(equip));
|
||||
jewels.put(item.getQuantity(), jewels.getOrDefault(item.getQuantity(),0)+1);
|
||||
msgTem="lamp_lottery_equip_content";
|
||||
if (!jewels.containsKey(item.getQuantity())) {
|
||||
jewels.put(item.getQuantity(), 0);
|
||||
}
|
||||
jewels.put(item.getQuantity(), jewels.get(item.getQuantity()) + 1);
|
||||
}
|
||||
// 法相
|
||||
if(itemType == GlobalItemType.FAXIANG_EQUIP){
|
||||
Faxiang faxiang = new Faxiang(user.getId(), equipId);
|
||||
equipManager.addFaxiang(faxiang);
|
||||
jewelList.add(CBean2Proto.getFaxiangEquipProto(faxiang));
|
||||
}
|
||||
// 走马灯
|
||||
if (item.getQuantity() >= SSpecialConfig.getIntegerValue(msgTem+"_parm")) {
|
||||
try {
|
||||
String nickName = user.getPlayerInfoManager().getNickName();
|
||||
String nameColor = user.getPlayerInfoManager().getNameColor();
|
||||
String message = SErrorCodeEerverConfig.getI18NMessageNeedConvert(msgTem,
|
||||
new Object[]{nameColor, nickName, equipQulityNameMap.get(item.getQuantity()), item.getName()},
|
||||
new int[]{0,0,1,1});
|
||||
new Object[]{nameColor, nickName, equipQulityNameMap.get(item.getQuantity()), item.getName()}, new int[]{0,0,1,1});
|
||||
ChatLogic.getInstance().sendSysChatMessage(message,Global.LUCKY_LUCK,String.valueOf(equipId),0,0,0,0,0);
|
||||
}catch (Exception e){
|
||||
LOGGER.error("发送通知报错:{}",e.getMessage());
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1570,7 +1572,7 @@ public class ItemUtil {
|
|||
}
|
||||
|
||||
public static boolean checkCostLong(User user, Map<Integer, Long> itemMap) throws Exception {
|
||||
if (itemMap == null) {
|
||||
if (itemMap == null || itemMap.isEmpty()) {
|
||||
return true;
|
||||
}
|
||||
TemporaryItems temporaryItems = user.getMapManager().getTemporaryItems();
|
||||
|
|
|
@ -16,7 +16,8 @@ public enum UUIDEnum {
|
|||
ROBOT_UUID(12),
|
||||
ORDER(13),
|
||||
HardStage(15),
|
||||
FourChallenge(16)
|
||||
FourChallenge(16),
|
||||
Faxiang(17)
|
||||
;
|
||||
|
||||
private int value;
|
||||
|
|
Loading…
Reference in New Issue