无尽副本、法宝

back_recharge
lvxinran 2019-09-03 10:24:04 +08:00
parent 195409ee4e
commit 61cfce258f
24 changed files with 542 additions and 192 deletions

View File

@ -53,4 +53,8 @@ public class SEndlessMapConfig implements BaseConfig {
public int[][] getEndlessPoint() {
return endlessPoint;
}
public int[] getMapItem() {
return mapItem;
}
}

View File

@ -0,0 +1,68 @@
package com.ljsd.jieling.config;
import com.ljsd.jieling.logic.STableManager;
import com.ljsd.jieling.logic.Table;
import java.util.Map;
@Table(name ="EquipTalismana")
public class SEquipTalismana implements BaseConfig {
private int id;
private int talismanaId;
private int level;
private int[][] rankupBasicMaterial;
private int[][] rankupConsumeMaterial;
private int[][] property;
private int[][] specialProperty;
private int[] openSkillRules;
public static Map<Integer,SEquipTalismana> equipTalismanaMap ;
@Override
public void init() throws Exception {
equipTalismanaMap = STableManager.getConfig(SEquipTalismana.class);
}
public int getId() {
return id;
}
public int getTalismanaId() {
return talismanaId;
}
public int getLevel() {
return level;
}
public int[][] getRankupBasicMaterial() {
return rankupBasicMaterial;
}
public int[][] getRankupConsumeMaterial() {
return rankupConsumeMaterial;
}
public int[][] getProperty() {
return property;
}
public int[][] getSpecialProperty() {
return specialProperty;
}
public int[] getOpenSkillRules() {
return openSkillRules;
}
}

View File

@ -0,0 +1,44 @@
package com.ljsd.jieling.config;
import com.ljsd.jieling.logic.STableManager;
import com.ljsd.jieling.logic.Table;
import java.util.Map;
@Table(name ="EquipTalismanaRankup")
public class SEquipTalismanaRankup implements BaseConfig {
private int id;
private int issame;
private int starLimit;
private int isId;
public static Map<Integer,SEquipTalismanaRankup> equipTalismanaRankupMap ;
@Override
public void init() throws Exception {
equipTalismanaRankupMap = STableManager.getConfig(SEquipTalismanaRankup.class);
}
public int getId() {
return id;
}
public int getIssame() {
return issame;
}
public int getStarLimit() {
return starLimit;
}
public int getIsId() {
return isId;
}
}

View File

@ -79,6 +79,7 @@ public interface BIReason {
int GM_CHANGENAME = 48; // gm改名赠送
int BIND_PHONE = 49; // 修改手机号
int ENDLESS_REASON_CHANGE = 50;//无尽副本赛季更换
//道具消耗原因 1000开头
int ADVENTURE_UPLEVEL_CONSUME = 1000; //秘境升级
int SECRETBOX_CONSUME = 1001; //秘盒抽卡

View File

@ -21,6 +21,7 @@ public interface GlobalItemType {
int SecretBox=10; // 宝箱
int HEAD_FRAME = 11;//头像框
int CHANGE_NAME_CARD = 12;//改名道具卡
int ESPECIAL_EQUIP = 14;//法宝
//物品使用类型
int NO_USE = 0 ; //不使用
int RANDOM_USE = 1; // 随机使用

View File

@ -21,6 +21,7 @@ public class EquipUnLoadOptHandler extends BaseHandler {
HeroInfoProto.EquipUnLoadOptRequest equipUnLoadOptRequest = HeroInfoProto.EquipUnLoadOptRequest.parseFrom(netData.parseClientProtoNetData());
List<String> equipIdsList = equipUnLoadOptRequest.getEquipIdsList();
String heroId = equipUnLoadOptRequest.getHeroId();
HeroLogic.getInstance().unloadEquipOpt(iSession,heroId,equipIdsList);
int type = equipUnLoadOptRequest.getType();
HeroLogic.getInstance().unloadEquipOpt(iSession,heroId,equipIdsList,type);
}
}

View File

@ -17,7 +17,7 @@ public class EquipWearHandler extends BaseHandler{
@Override
public void process(ISession iSession, PacketNetData netData) throws Exception {
HeroInfoProto.EquipWearRequest equipWearRequest = HeroInfoProto.EquipWearRequest.parseFrom(netData.parseClientProtoNetData());
HeroLogic.getInstance().wearEquipOpt(iSession,equipWearRequest.getHeroId(),equipWearRequest.getEquipIdList());
HeroLogic.getInstance().wearEquipOpt(iSession,equipWearRequest.getHeroId(),equipWearRequest.getEquipIdList(),equipWearRequest.getType());
}
}

View File

@ -20,6 +20,7 @@ public class GetAllEquipHandler extends BaseHandler{
HeroInfoProto.GetAllEquipRequest getAllEquipRequest
= HeroInfoProto.GetAllEquipRequest.parseFrom(message);
int index = getAllEquipRequest.getIndex();
HeroLogic.getInstance().getAllEquipInfo(iSession,index);
int type = getAllEquipRequest.getType();
HeroLogic.getInstance().getAllEquipInfo(iSession,index,type);
}
}

View File

@ -93,9 +93,9 @@ public class GetPlayerInfoHandler extends BaseHandler{
.setHadTakeDailyBox(playerInfoManager.getHadTakeDailyBoxVip())
.setHadTakeLevelBox(playerInfoManager.getHadTakeLevelBoxVip())
.setVipLevel(playerInfoManager.getVipLevel()).build();
CommonProto.PlayerBindPhone playerBindPhone = CommonProto.PlayerBindPhone.newBuilder()
.setPhoneNum(user.getPlayerInfoManager().getPhoneBindInfo().getPhoneNum())
.setState(user.getPlayerInfoManager().getPhoneBindInfo().getState()).build();
CommonProto.PlayerBindPhone playerBindPhone = CommonProto.PlayerBindPhone.newBuilder().build();
// .setPhoneNum(user.getPlayerInfoManager().getPhoneBindInfo().getPhoneNum())
// .setState(user.getPlayerInfoManager().getPhoneBindInfo().getState()).build();
RechargeInfo rechargeInfo = playerInfoManager.getRechargeInfo();
Map<Integer, Integer> totalCountMap = user.getHeroManager().getTotalCount();
int alreadyCount =0;

View File

@ -1,6 +1,7 @@
package com.ljsd.jieling.handler.map;
import com.googlecode.protobuf.format.JsonFormat;
import com.ljsd.jieling.battle.actor.Monster;
import com.ljsd.jieling.config.*;
import com.ljsd.jieling.core.VipPrivilegeType;
import com.ljsd.jieling.dataReport.reportBeans_37.ChatContentType;
@ -211,21 +212,21 @@ public class MapLogic {
mapManager.addEndlessHero(teamPosForHero.get(i).getHeroId(),maxHp);
}
EndlessMapInfo endlessMapInfo = mapManager.getEndlessMapInfo();
// if(endlessMapInfo.getSeason()!=endlessSeason){
// mapManager.updateEndlessSeason(endlessSeason);
// mapManager.updateEndlessMapId(0);
// mapManager.endlessWalkCellSave(new HashSet<>());
// mapManager.endlessMapInfoSave(new HashMap<>());
// }else{
// Map<Integer, Cell> endlessMapCellInfo = mapManager.getEndlessMapInfo().getMapInfo();
// if(endlessMapCellInfo !=null&&endlessMapCellInfo.size()>0){
// mapManager.setMapInfo(endlessMapCellInfo);
// }
// Set<Integer> walkCell = mapManager.getEndlessMapInfo().getWalkCell();
// if(walkCell!=null&&walkCell.size()>0){
// mapManager.setWalkCells(walkCell);
// }
// }
if(endlessMapInfo.getSeason()!=endlessSeason){
mapManager.updateEndlessSeason(endlessSeason);
mapManager.updateEndlessMapId(0);
mapManager.endlessWalkCellSave(new HashSet<>());
mapManager.endlessMapInfoSave(new HashMap<>());
}else{
Map<Integer, Cell> endlessMapCellInfo = mapManager.getEndlessMapInfo().getMapInfo();
if(endlessMapCellInfo !=null&&endlessMapCellInfo.size()>0){
mapManager.setMapInfo(endlessMapCellInfo);
}
Set<Integer> walkCell = mapManager.getEndlessMapInfo().getWalkCell();
if(walkCell!=null&&walkCell.size()>0){
mapManager.setWalkCells(walkCell);
}
}
mapManager.updateEndlessMapId(mapId);
for(Map.Entry<Integer,Map<Integer,String>> entry :endlessMapInfo.getMapSign().entrySet()){
int curMapId = entry.getKey();
@ -419,12 +420,12 @@ public class MapLogic {
continue;
}
Cell cellValue = new Cell(xy, mapPointConfig.getInitialEventId(), mapPointConfig.getId());
if(mapPointConfig.getIsShowFightAbility()!=null&&mapPointConfig.getIsShowFightAbility().length>0){
int force = 0;
for(int i = 0 ; i <mapPointConfig.getIsShowFightAbility().length;i++){
force+=mapPointConfig.getIsShowFightAbility()[i];
int[] isShowFightAbility = mapPointConfig.getIsShowFightAbility();
if(isShowFightAbility !=null&& isShowFightAbility.length>0){
if(isShowFightAbility[0]!=0){
int force = MonsterUtil.getMonsterForce(isShowFightAbility);
cellValue.setForce(force);
}
cellValue.setForce(force);
}
newMap.put(xy, cellValue);
}
@ -1509,6 +1510,13 @@ public class MapLogic {
fightEndResponse.addAllRemainHpList(remainHp);
fightEndResponse.build();
if(SChallengeConfig.sChallengeConfigs.get(mapManager.getCurMapId()).getType()==4){
Cell cell = mapManager.getMapInfo().get(triggerXY);
MapPointConfig mapPointConfig = MapPointConfig.getScMapEventMap().get(cell.getPointId());
if(mapPointConfig.getStyle()==1){
BehaviorUtil.destoryApointXY(user, triggerXY);
}
}
if (sOptionConfig != null) {
int behaviorType = sOptionConfig.getBehaviorType();
int[][] behaviorTypeValues = sOptionConfig.getBehaviorTypeValues();
@ -3217,7 +3225,8 @@ public class MapLogic {
mapManager.updateEndlessConsumeExecution(mapManager.getEndlessMapInfo().getConsumeExecution()+costNum);
int [] cost1 = new int[]{costId,costNum};
cost[0] = cost1;
if(!ItemUtil.itemCost(user,cost,BIReason.ENDLESS_CONSUME_EXECUTION,1)) {
boolean costResult = ItemUtil.itemCost(user, cost, BIReason.ENDLESS_CONSUME_EXECUTION, 1);
if(!costResult) {
costNum = user.getItemManager().getItem(costId).getItemNum();
cost1[1]= costNum;
cost[0] = cost1;
@ -3280,4 +3289,34 @@ public class MapLogic {
}
MessageUtil.sendMessage(session,1,messageType.getNumber(),response.build(),true);
}
/**
*
* @throws Exception
*/
public void resetEndlessInfo() throws Exception {
Map<Integer, ISession> onlineUserMap = OnlineUserManager.sessionMap;
SEndlessMapConfig config = SEndlessMapConfig.sEndlessMapConfigMap.get(MapLogic.getEndlessMapId());
int[] mapItem = config.getMapItem();
for(Map.Entry<Integer, ISession> entry:onlineUserMap.entrySet()){
User user = UserManager.getUser(entry.getValue().getUid());
MapManager mapManager = user.getMapManager();
mapManager.setEndlessMapInfo(new EndlessMapInfo());
if(SChallengeConfig.sChallengeConfigs.get(mapManager.getCurMapId()).getType()==4){
resetMapInfo(user,false);
MessageUtil.sendIndicationMessage(entry.getValue(),1,MessageTypeProto.MessageType.MAP_OUT_INDICATION_VALUE,null,true);
}
ItemManager itemManager = user.getItemManager();
int [][] costItem = new int[mapItem.length][2];
for(int i = 0 ; i <mapItem.length;i++){
Item item = itemManager.getItem(mapItem[i]);
int[] it = new int[2];
it[0] = mapItem[i];
it[1] = item.getItemNum();
costItem[i] = it;
}
ItemUtil.itemCost(user,costItem, BIReason.ENDLESS_REASON_CHANGE,1);
}
updateEndlessSeason(0);
}
}

View File

@ -115,6 +115,7 @@ public class BehaviorUtil {
Cell cell = mapInfo.get(destoryXY);
if (cell != null) {
cell.setEventId(-1);
cell.setPointId(0);
mapManager.addOrUpdateCell(destoryXY, cell);
}
}

View File

@ -1,19 +1,19 @@
package com.ljsd.jieling.logic;
import com.ljsd.GameApplication;
import com.ljsd.jieling.config.SDailyTasksConfig;
import com.ljsd.jieling.config.SGlobalSystemConfig;
import com.ljsd.jieling.config.ServerConfig;
import com.ljsd.jieling.config.*;
import com.ljsd.jieling.config.json.KTSDKConstans;
import com.ljsd.jieling.config.json.ServerProperties;
import com.ljsd.jieling.core.FunctionIdEnum;
import com.ljsd.jieling.core.GlobalsDef;
import com.ljsd.jieling.db.mongo.MongoUtil;
import com.ljsd.jieling.globals.BIReason;
import com.ljsd.jieling.handler.map.EndlessMapInfo;
import com.ljsd.jieling.handler.map.MapLogic;
import com.ljsd.jieling.handler.map.MapManager;
import com.ljsd.jieling.logic.activity.ActivityLogic;
import com.ljsd.jieling.logic.arena.ArenaLogic;
import com.ljsd.jieling.logic.dao.GuilidManager;
import com.ljsd.jieling.logic.dao.TimeControllerOfFunction;
import com.ljsd.jieling.logic.dao.*;
import com.ljsd.jieling.logic.dao.root.GlobalSystemControl;
import com.ljsd.jieling.logic.dao.root.User;
import com.ljsd.jieling.logic.friend.FriendLogic;
@ -32,6 +32,7 @@ import com.ljsd.jieling.protocols.MessageTypeProto;
import com.ljsd.jieling.protocols.PlayerInfoProto;
import com.ljsd.jieling.thread.task.RPCGmServerTask;
import com.ljsd.jieling.thread.task.RPCServerTask;
import com.ljsd.jieling.util.ItemUtil;
import com.ljsd.jieling.util.MessageUtil;
import com.ljsd.jieling.util.TimeUtils;
import org.slf4j.Logger;
@ -182,7 +183,7 @@ public class GlobalDataManaager {
ArenaLogic.getInstance().updateArenaSeason(0);
break;
case Endless:
MapLogic.getInstance().updateEndlessSeason(0);
MapLogic.getInstance().resetEndlessInfo();
default:
break;
}

View File

@ -0,0 +1,5 @@
package com.ljsd.jieling.logic;
public interface UpStar {
}

View File

@ -1055,7 +1055,7 @@ public class ActivityLogic {
PlayerInfoProto.GetToBeStrongerResponse.Builder response = PlayerInfoProto.GetToBeStrongerResponse.newBuilder();
for(int i = 0 ; i <6;i++){
CommonProto.StrongerInfo.Builder info = CommonProto.StrongerInfo.newBuilder().setCurScore(1000).setMaxScore(6000);
response.addInfos(info);
response.addInfos(info.build());
}
MessageUtil.sendMessage(session,1,messageType.getNumber(),response.build(),true);
}

View File

@ -12,40 +12,21 @@ import org.slf4j.LoggerFactory;
import java.util.*;
public class Equip extends MongoBase implements Cloneable{
public class Equip extends PropertyItem implements Cloneable{
private static final org.slf4j.Logger LOGGER = LoggerFactory.getLogger(Equip.class);
private String id;
private int equipId;
private int level;
private int rebuildLevel;
private String heroId;
private Map<Integer, Integer> propertyValueByIdMap; //主属性 key 对应PropertyConfig id
private Map<Integer, Integer> secondValueByIdMap; //副属性
private int createTime;
private int skill;
private int isLocked;
public Equip() {
this.setRootCollection(User._COLLECTION_NAME);
}
public Equip(int uid, int equipTid) {
super();
this.setRootCollection(User._COLLECTION_NAME);
this.id = KeyGenUtils.produceIdByModule(UUIDEnum.EQUIP, uid);
this.equipId = equipTid;
this.propertyValueByIdMap = new HashMap<>();
super.setId(KeyGenUtils.produceIdByModule(UUIDEnum.EQUIP, uid));
super.setEquipId(equipTid);
Map<Integer, Integer> propertyValueByIdMap = new HashMap<>();
SEquipConfig sEquipConfig = SEquipConfig.getsEquipConfigById(equipTid);
SWorkShopSetting sWorkShopSetting = SWorkShopSetting.getsWorkShopSettingByLevel(sEquipConfig.getInitialLevel());
Map<Integer, Integer> promoteMap = new HashMap<>();
@ -60,24 +41,25 @@ public class Equip extends MongoBase implements Cloneable{
propertyPromote = 0;
}
int finalProperValue = MathUtils.random(properMinNum * (100 + propertyPromote) / 100, properMaxNum* (100 + propertyPromote) / 100);
this.propertyValueByIdMap.put(properTyId, finalProperValue);
propertyValueByIdMap.put(properTyId, finalProperValue);
super.setPropertyValueByIdMap(propertyValueByIdMap);
int secondNumMin = sEquipConfig.getSecondNumMin();
int secondNumMax = sEquipConfig.getSecondNumMax();
int secondValue = MathUtils.random(secondNumMin, secondNumMax);
this.secondValueByIdMap = getSecondValue(sEquipConfig.getPool(), secondValue,promoteMap);
this.createTime = (int)(TimeUtils.now()/1000);
Map<Integer, Integer> secondValueByIdMap = getSecondValue(sEquipConfig.getPool(), secondValue,promoteMap);
super.setSecondValueByIdMap(secondValueByIdMap);
super.setCreateTime((int)(TimeUtils.now()/1000));
//skill库随机
this.skill = getRandomSkill(sEquipConfig.getSkillPoolId());
super.setSkill(getRandomSkill(sEquipConfig.getSkillPoolId()));
}
//锻造
public Equip(int uid, int equipTid,int workShopLevle,List<Integer> runneIds) {
this.setRootCollection(User._COLLECTION_NAME);
this.id =KeyGenUtils.produceIdByModule(UUIDEnum.EQUIP,uid);
this.equipId = equipTid;
this.propertyValueByIdMap = new HashMap<>();
this.secondValueByIdMap = new HashMap<>();
super.setId(KeyGenUtils.produceIdByModule(UUIDEnum.EQUIP,uid));
super.setEquipId(equipTid);
Map<Integer,Integer> propertyValueByIdMap = new HashMap<>();
Map<Integer,Integer> secondValueByIdMap = new HashMap<>();
SWorkShopSetting sWorkShopSetting = SWorkShopSetting.getsWorkShopSettingByLevel(workShopLevle);
Map<Integer, Integer> promoteMap = new HashMap<>();
if( sWorkShopSetting != null && sWorkShopSetting.getPromoteMap()!=null){
@ -92,10 +74,12 @@ public class Equip extends MongoBase implements Cloneable{
int properMinNum = sEquipConfig.getPropertyMin()[1];
int properMaxNum = sEquipConfig.getPropertyMax()[1];
int finalProperValue = MathUtils.random(properMinNum * (100 + propertyPromote) / 100, properMaxNum* (100 + propertyPromote) / 100);
this.propertyValueByIdMap.put(properTyId,finalProperValue);
propertyValueByIdMap.put(properTyId,finalProperValue);
super.setPropertyValueByIdMap(propertyValueByIdMap);
super.setSecondValueByIdMap(secondValueByIdMap);
setForRunnes(runneIds,promoteMap);
this.createTime = (int)(TimeUtils.now()/1000);
this.skill = getRandomSkill(sEquipConfig.getSkillPoolId());
super.setCreateTime((int)(TimeUtils.now()/1000));
super.setSkill(getRandomSkill(sEquipConfig.getSkillPoolId()));
}
@ -118,7 +102,7 @@ public class Equip extends MongoBase implements Cloneable{
}
}
secondValueByIdMap = result;
super.setSecondValueByIdMap(result);
}
private void randomForRunne(int poolId,int nums,Map<Integer,Integer> secondValueByIdMap,Map<Integer, Integer> promoteMap){
@ -162,7 +146,7 @@ public class Equip extends MongoBase implements Cloneable{
sEquipPropertyPoolList.addAll(SEquipPropertyPool.getSEquipPropertyPool(pid));
}
if(sEquipPropertyPoolList.size()<nums){
LOGGER.error("the equip config is wrong,the equipTid={},the poolId={},the poolNum={},the requireNum={}",equipId,poolId,sEquipPropertyPoolList.size(),nums);
LOGGER.error("the equip config is wrong,the equipTid={},the poolId={},the poolNum={},the requireNum={}",super.getEquipId(),poolId,sEquipPropertyPoolList.size(),nums);
return result;
}
int totalWeight = 0;
@ -223,7 +207,7 @@ public class Equip extends MongoBase implements Cloneable{
return MathUtils.randomFromWeight(skillWeight);
}
public void rebuildEquip(int workShopLevle){
SEquipConfig sEquipConfig = SEquipConfig.getsEquipConfigById(this.equipId);
SEquipConfig sEquipConfig = SEquipConfig.getsEquipConfigById(super.getEquipId());
int properTyId = sEquipConfig.getPropertyMin()[0];
SWorkShopSetting sWorkShopSetting = SWorkShopSetting.getsWorkShopSettingByLevel(workShopLevle);
Map<Integer, Integer> promoteMap = null;
@ -242,7 +226,7 @@ public class Equip extends MongoBase implements Cloneable{
int properMinNum = sEquipConfig.getPropertyMin()[1];
int properMaxNum = sEquipConfig.getPropertyMax()[1];
int finalProperValue = MathUtils.random(properMinNum * (100 + propertyPromote) / 100, properMaxNum* (100 + propertyPromote) / 100);
this.propertyValueByIdMap.put(properTyId,finalProperValue);
super.getPropertyValueByIdMap().put(properTyId,finalProperValue);
}
List<SEquipPropertyPool> sEquipPropertyPoolList = new ArrayList<>();
for(Integer equipPool:sEquipConfig.getPool()){
@ -250,7 +234,7 @@ public class Equip extends MongoBase implements Cloneable{
}
for(SEquipPropertyPool sEquipPropertyPool : sEquipPropertyPoolList){
int secondPropertyId = sEquipPropertyPool.getPropertyId();
if(!secondValueByIdMap.containsKey(secondPropertyId)){
if(!super.getSecondValueByIdMap().containsKey(secondPropertyId)){
continue;
}
SPropertyConfig sPropertyConfig = SPropertyConfig.getsPropertyConfigByPID(secondPropertyId);
@ -266,94 +250,26 @@ public class Equip extends MongoBase implements Cloneable{
}
int value = MathUtils.random(sEquipPropertyPool.getMin() * (100 + secondPropertyPromote) / 100, sEquipPropertyPool.getMax()* (100 + secondPropertyPromote) / 100);
secondValueByIdMap.put(secondPropertyId,value);
super.getSecondValueByIdMap().put(secondPropertyId,value);
}
setRebuildLevel(workShopLevle);
setSecondValueByIdMap(secondValueByIdMap);
setPropertyValueByIdMap(propertyValueByIdMap);
}
public String getId() {
return id;
}
public int getEquipId() {
return equipId;
}
public void setEquipId(int equipId) throws Exception {
updateString("equipId",equipId);
this.equipId = equipId;
}
public int getLevel() {
return level;
}
public void setLevel(int level) throws Exception {
updateString("level",level);
this.level = level;
super.setSecondValueByIdMap(super.getSecondValueByIdMap());
super.setPropertyValueByIdMap(super.getSecondValueByIdMap());
}
public int getRebuildLevel() {
return rebuildLevel;
}
public String getHeroId() {
return heroId;
}
public void setHeroId(String heroId) throws Exception {
updateString("heroId",heroId);
this.heroId = heroId;
}
public Map<Integer, Integer> getPropertyValueByIdMap() {
return propertyValueByIdMap;
}
public Map<Integer, Integer> getSecondValueByIdMap() {
return secondValueByIdMap;
}
public void setRebuildLevel(int rebuildLevel) {
updateString("rebuildLevel",rebuildLevel);
this.rebuildLevel = rebuildLevel;
}
public void setPropertyValueByIdMap(Map<Integer, Integer> propertyValueByIdMap) {
updateString("propertyValueByIdMap",propertyValueByIdMap);
this.propertyValueByIdMap = propertyValueByIdMap;
}
public void setSecondValueByIdMap(Map<Integer, Integer> secondValueByIdMap) {
updateString("secondValueByIdMap",secondValueByIdMap);
this.secondValueByIdMap = secondValueByIdMap;
}
@Override
public Object clone() throws CloneNotSupportedException {
return (Equip) super.clone();
}
public int getCreateTime() {
return createTime;
}
public int getSkill() {
return skill;
}
public int getIsLocked() {
return isLocked;
}
public void updateIsLocked(int isLocked) {
updateString("isLocked",isLocked);
this.isLocked = isLocked;
}
}

View File

@ -15,6 +15,8 @@ public class EquipManager extends MongoBase {
private Map<String,Equip> equipMap;
private Map<String,EspecialEquip> especialEquipMap;
private Equip unDetermined;
private Map<Integer,Integer> equipHandBook;
@ -23,6 +25,7 @@ public class EquipManager extends MongoBase {
this.equipHandBook = new HashMap<>();
this.equipMap = new HashMap<>();
this.especialEquipMap = new HashMap<>();
this.setRootCollection(User._COLLECTION_NAME);
}
@ -34,6 +37,11 @@ public class EquipManager extends MongoBase {
Poster.getPoster().dispatchEvent(new EquipEvent(user.getId(),equip.getEquipId()));
}
public void addEspecialEquip(User user,EspecialEquip especialEquip){
updateString("especialEquipMap." + especialEquip.getId(), especialEquip);
especialEquipMap.put(especialEquip.getId(), especialEquip);
}
public void remove(String equipId){
if (equipMap.containsKey(equipId)){
removeString(getMongoKey()+".equipMap." + equipId);
@ -45,6 +53,10 @@ public class EquipManager extends MongoBase {
return equipMap;
}
public Map<String, EspecialEquip> getEspecialEquipMap() {
return especialEquipMap;
}
public Equip getUnDetermined() {
return unDetermined;
}

View File

@ -0,0 +1,30 @@
package com.ljsd.jieling.logic.dao;
import com.ljsd.jieling.logic.dao.root.User;
import com.ljsd.jieling.util.KeyGenUtils;
import com.ljsd.jieling.util.UUIDEnum;
public class EspecialEquip extends PropertyItem {
private int star;
public EspecialEquip(int uid,int equipTid) {
super();
super.setId(KeyGenUtils.produceIdByModule(UUIDEnum.ESPECIAL_EQUIP, uid));
super.setEquipId(equipTid);
this.star = 1;
}
public EspecialEquip() {
this.setRootCollection(User._COLLECTION_NAME);
}
public int getStar() {
return star;
}
public void setStar(int star) {
updateString("star",star);
this.star = star;
}
}

View File

@ -42,6 +42,8 @@ public class Hero extends MongoBase {
private int speed;
private String especialEquip;
public Hero(){
//绑定关系
this.setRootCollection(User._COLLECTION_NAME);
@ -57,6 +59,7 @@ public class Hero extends MongoBase {
this.star = initStar;
this.skillList = new ArrayList<>();
this.equipByPositionMap = new HashMap<>();
this.especialEquip = "";
List<Integer> skillIds = scHero.getSkillListByStar().get(star);
if(skillIds!=null && !skillIds.isEmpty()){
this.skillList.addAll(skillIds);
@ -201,4 +204,16 @@ public class Hero extends MongoBase {
updateString("starBreakId",starBreakId);
this.starBreakId = starBreakId;
}
public void updateEspecial(String especialEquip){
this.especialEquip = especialEquip;
updateString("especialEquip",especialEquip);
}
public void removeEspecial() {
removeString(getMongoKey()+".especialEquip");
especialEquip="";
}
public String getEspecialEquip() {
return especialEquip;
}
}

View File

@ -0,0 +1,123 @@
package com.ljsd.jieling.logic.dao;
import com.ljsd.common.mogodb.MongoBase;
import java.util.Map;
public class PropertyItem extends MongoBase {
private String id;
private int equipId;
private int level;
private String heroId;
private Map<Integer, Integer> propertyValueByIdMap; //主属性 key 对应PropertyConfig id
private Map<Integer, Integer> secondValueByIdMap; //副属性
private int createTime;
private int skill;
private int isLocked;
public PropertyItem(String id, int equipId, int level, String heroId, Map<Integer, Integer> propertyValueByIdMap, Map<Integer, Integer> secondValueByIdMap, int createTime, int skill, int isLocked) {
this.id = id;
this.equipId = equipId;
this.level = level;
this.heroId = heroId;
this.propertyValueByIdMap = propertyValueByIdMap;
this.secondValueByIdMap = secondValueByIdMap;
this.createTime = createTime;
this.skill = skill;
this.isLocked = isLocked;
}
public String getId() {
return id;
}
public void setId(String id) {
updateString("id",equipId);
this.id = id;
}
public int getEquipId() {
return equipId;
}
public void setEquipId(int equipId){
updateString("equipId",equipId);
this.equipId = equipId;
}
public int getLevel() {
return level;
}
public void setLevel(int level){
updateString("level",level);
this.level = level;
}
public PropertyItem() {
}
public String getHeroId() {
return heroId;
}
public void setHeroId(String heroId){
updateString("heroId",heroId);
this.heroId = heroId;
}
public Map<Integer, Integer> getPropertyValueByIdMap() {
return propertyValueByIdMap;
}
public Map<Integer, Integer> getSecondValueByIdMap() {
return secondValueByIdMap;
}
public void setPropertyValueByIdMap(Map<Integer, Integer> propertyValueByIdMap) {
updateString("propertyValueByIdMap",propertyValueByIdMap);
this.propertyValueByIdMap = propertyValueByIdMap;
}
public void setSecondValueByIdMap(Map<Integer, Integer> secondValueByIdMap) {
updateString("secondValueByIdMap",secondValueByIdMap);
this.secondValueByIdMap = secondValueByIdMap;
}
public int getCreateTime() {
return createTime;
}
public void setCreateTime(int createTime) {
updateString("createTime", createTime);
this.createTime = createTime;
}
public int getSkill() {
return skill;
}
public void setSkill(int skill) {
updateString("skill", skill);
this.skill = skill;
}
public int getIsLocked() {
return isLocked;
}
public void updateIsLocked(int isLocked) {
updateString("isLocked", isLocked);
this.isLocked = isLocked;
}
}

View File

@ -93,16 +93,30 @@ public class HeroLogic {
private static final String VERTICAL = "|";
private static final String DIVISION = "#";
public void getAllEquipInfo(ISession iSession,int index) throws Exception {
/**
*
* @param iSession
* @param index
* @param type
* @throws Exception
*/
public void getAllEquipInfo(ISession iSession,int index,int type) throws Exception {
int uid = iSession.getUid();
User user = UserManager.getUser(uid);
Map<String, Equip> equipMap = user.getEquipManager().getEquipMap();
List<CommonProto.Equip> equipList = new ArrayList<>();
for(Equip equipInfo: equipMap.values()){
equipList.add(CBean2Proto.getEquipProto(equipInfo));
if(type==1){
Map<String, Equip> equipMap = user.getEquipManager().getEquipMap();
for(Equip equipInfo: equipMap.values()){
equipList.add(CBean2Proto.getEquipProto(equipInfo));
}
}else{
Map<String, EspecialEquip> especialEquipMap = user.getEquipManager().getEspecialEquipMap();
for(EspecialEquip especialEquipInfo: especialEquipMap.values()){
equipList.add(CBean2Proto.getEquipProto(especialEquipInfo));
}
}
boolean isSendFinish = false;
int endIndex = index + Global.SEND_EQUIP_COUNT ;
int endIndex = index + Global.SEND_EQUIP_COUNT;
if (index < equipList.size()) {
if (endIndex >= equipList.size()) {
endIndex = equipList.size();
@ -531,6 +545,13 @@ public class HeroLogic {
}
/**
*
* @param session
* @param heroId
* @param consumeMaterialsList
* @throws Exception
*/
public void upHeroStar(ISession session, String heroId, List<HeroInfoProto.ConsumeMaterial> consumeMaterialsList) throws Exception {
int uid = session.getUid();
User user = UserManager.getUser(uid);
@ -1033,6 +1054,23 @@ public class HeroLogic {
}
}
//法宝加成
String especialEquip = hero.getEspecialEquip();
Map<String, EspecialEquip> especialEquipMap = user.getEquipManager().getEspecialEquipMap();
int equipTempId = especialEquipMap.get(especialEquip).getEquipId();
int tempStar = especialEquipMap.get(especialEquip).getStar();
Map<Integer, SEquipTalismana> equipTalismanaMap = SEquipTalismana.equipTalismanaMap;
for(Map.Entry<Integer, SEquipTalismana> entry:equipTalismanaMap.entrySet()){
if(entry.getValue().getTalismanaId()!=equipTempId){
continue;
}
if(entry.getValue().getLevel()!=tempStar){
continue;
}
}
//阵营光环加成
if(!isForce){
if(teamId!=0){
@ -1224,18 +1262,25 @@ public class HeroLogic {
// equip TODO 装备会导致英雄属性发生变化
public void wearEquipOpt(ISession session,String heroId,List<String> equipIds) throws Exception {
public void wearEquipOpt(ISession session,String heroId,List<String> equipIds,int type) throws Exception {
int uid = session.getUid();
User user = UserManager.getUser(uid);
Hero hero = user.getHeroManager().getHeroMap().get(heroId);
Map<Integer,String> equipInfoTmp = new HashMap<>(6);
if(!checkEquipForWear(hero,user.getEquipManager(),equipIds,equipInfoTmp)){
MessageUtil.sendErrorResponse(session,0,MessageTypeProto.MessageType.EQUIP_WEAR_RESPONSE_VALUE,"equip.wrong");
return;
if(type==1){
Map<Integer,String> equipInfoTmp = new HashMap<>(6);
if(!checkEquipForWear(hero,user.getEquipManager(),equipIds,equipInfoTmp)){
MessageUtil.sendErrorResponse(session,0,MessageTypeProto.MessageType.EQUIP_WEAR_RESPONSE_VALUE,"equip.wrong");
return;
}
hero.updateMutliEquipPositionMap(equipInfoTmp);
user.getUserMissionManager().onGameEvent(user,GameEvent.WEAR_EQUIP,equipInfoTmp.size());
}else if(type ==2){
if(equipIds.size()!=1){
MessageUtil.sendErrorResponse(session,0,MessageTypeProto.MessageType.EQUIP_WEAR_RESPONSE.getNumber(),"法宝智能穿戴一个");
}else{
hero.updateEspecial(equipIds.get(0));
}
}
hero.updateMutliEquipPositionMap(equipInfoTmp);
user.getUserMissionManager().onGameEvent(user,GameEvent.WEAR_EQUIP,equipInfoTmp.size());
// 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);
@ -1246,29 +1291,33 @@ public class HeroLogic {
}
public void unloadEquipOpt(ISession session,String heroId,List<String> equipIds) throws Exception {
public void unloadEquipOpt(ISession session,String heroId,List<String> equipIds,int type) throws Exception {
int uid = session.getUid();
User user = UserManager.getUser(uid);
Hero hero = user.getHeroManager().getHero(heroId);
if( hero == null || equipIds.isEmpty()){
MessageUtil.sendErrorResponse(session,0,MessageTypeProto.MessageType.EQUIP_UNLOAD_OPT_RESPONSE_VALUE,"");
return;
}
List<Integer> positions = new ArrayList<>();
for(String equipId : equipIds){
Equip equip = user.getEquipManager().getEquipMap().get(equipId);
if(null == equip || !StringUtil.isEmpty(equip.getHeroId())){
if(type==1){
if( hero == null || equipIds.isEmpty()){
MessageUtil.sendErrorResponse(session,0,MessageTypeProto.MessageType.EQUIP_UNLOAD_OPT_RESPONSE_VALUE,"");
return;
}
int equipIdTid = equip.getEquipId();
SEquipConfig sEquipConfig = SEquipConfig.getsEquipConfigById(equipIdTid);
int position = sEquipConfig.getPosition();
positions.add(position);
}
List<Integer> positions = new ArrayList<>();
for(String equipId : equipIds){
Equip equip = user.getEquipManager().getEquipMap().get(equipId);
if(null == equip || !StringUtil.isEmpty(equip.getHeroId())){
MessageUtil.sendErrorResponse(session,0,MessageTypeProto.MessageType.EQUIP_UNLOAD_OPT_RESPONSE_VALUE,"");
return;
}
int equipIdTid = equip.getEquipId();
SEquipConfig sEquipConfig = SEquipConfig.getsEquipConfigById(equipIdTid);
int position = sEquipConfig.getPosition();
positions.add(position);
}
for(Integer position : positions){
hero.removeEquip(position);
for(Integer position : positions){
hero.removeEquip(position);
}
}else if(type==2){
hero.removeEspecial();
}
//发送成功消息

View File

@ -83,6 +83,7 @@ public class CBean2Proto {
.setCreateTime(hero.getCreateTime())
.addAllSkillIdList(hero.getSkillList())
.addAllEquipIdList(equipList)
.addEspecialEquip(hero.getEspecialEquip())
.build();
}
@ -103,20 +104,26 @@ public class CBean2Proto {
}
public static CommonProto.Equip getEquipProto(Equip equip){
public static CommonProto.Equip getEquipProto(PropertyItem equip){
Map<Integer, Integer> propertyValueByIdMap = equip.getPropertyValueByIdMap();
Map<Integer, Integer> secondValueByIdMap = equip.getSecondValueByIdMap();
CommonProto.Equip equipProto =CommonProto.Equip.newBuilder()
CommonProto.Equip.Builder equipProto =CommonProto.Equip.newBuilder()
.setEquipId(equip.getEquipId())
.setId(equip.getId())
.setMainAttribute(parseFromMap(propertyValueByIdMap).get(0))
.addAllSecondAttribute(parseFromMap(secondValueByIdMap))
.setRebuildLevel(equip.getRebuildLevel())
.setCreateTime(equip.getCreateTime())
.setSkillId(equip.getSkill())
.setIsLocked(equip.getIsLocked())
.build();
return equipProto;
.setIsLocked(equip.getIsLocked());
if(equip instanceof Equip){
Equip tempEquip =(Equip)equip;
equipProto.setMainAttribute(parseFromMap(propertyValueByIdMap).get(0))
.addAllSecondAttribute(parseFromMap(secondValueByIdMap))
.setRebuildLevel(tempEquip.getRebuildLevel())
.setSkillId(tempEquip.getSkill());
}
if(equip instanceof EspecialEquip){
EspecialEquip tempEquip =(EspecialEquip)equip;
equipProto.setRebuildLevel(tempEquip.getStar());
}
return equipProto.build();
}

View File

@ -385,6 +385,7 @@ public class ItemUtil {
putcountMap(itemId, itemNum, cardMap);
break;
case GlobalItemType.EQUIP:
case GlobalItemType.ESPECIAL_EQUIP:
putcountMap(itemId, itemNum, equipMap);
break;
case GlobalItemType.RANDOM_ITME:
@ -771,15 +772,22 @@ public class ItemUtil {
private static void addEquip(User user,int equipId ,List<CommonProto.Equip> equipList) throws Exception {
EquipManager equipManager = user.getEquipManager();
Equip equip = new Equip(user.getId(),equipId);
equipManager.addEquip(user,equip);
equipList.add(CBean2Proto.getEquipProto(equip));
SEquipConfig sEquipConfig = SEquipConfig.getsEquipConfigById(equipId);
if (sEquipConfig.getQuality() >= 5) {
String nickName = user.getPlayerInfoManager().getNickName();
String message = SErrorCodeEerverConfig.getI18NMessage("lamp_lottery_equip_content", new Object[]{nickName, equipQulityNameMap.get(sEquipConfig.getQuality()),SItem.getsItemMap().get(equipId).getName()});
ChatLogic.getInstance().sendSysChatMessage(message,Global.LUCKY_LUCK,equipId,0,0,0,0,0);
int itemType = SItem.getsItemMap().get(equipId).getItemType();
if(itemType==GlobalItemType.EQUIP){
Equip equip = new Equip(user.getId(),equipId);
equipManager.addEquip(user,equip);
equipList.add(CBean2Proto.getEquipProto(equip));
SEquipConfig sEquipConfig = SEquipConfig.getsEquipConfigById(equipId);
if (sEquipConfig.getQuality() >= 5) {
String nickName = user.getPlayerInfoManager().getNickName();
String message = SErrorCodeEerverConfig.getI18NMessage("lamp_lottery_equip_content", new Object[]{nickName, equipQulityNameMap.get(sEquipConfig.getQuality()),SItem.getsItemMap().get(equipId).getName()});
ChatLogic.getInstance().sendSysChatMessage(message,Global.LUCKY_LUCK,equipId,0,0,0,0,0);
}
}else if(itemType==GlobalItemType.ESPECIAL_EQUIP){
EspecialEquip especialEquip = new EspecialEquip(user.getId(),equipId);
equipManager.addEspecialEquip(user,especialEquip);
}
}
/**

View File

@ -71,6 +71,29 @@ public class MonsterUtil {
return hps;
}
public static int getMonsterForce(int[] groupIds){
Map<Integer, SMonsterGroup> integerSMonsterGroupMap = SMonsterGroup.getsMonsterGroupMap();
Map<Integer, SMonsterConfig> integerSMonsterConfigMap = SMonsterConfig.getsMonsterConfigMap();
int maxForce = 0;
for(int i = 0 ; i < groupIds.length;i++){
SMonsterGroup sMonsterGroup = integerSMonsterGroupMap.get(groupIds[i]);
int[][] contents = sMonsterGroup.getContents();
int totalMonsterForce = 0;
for(int j = 0; j<contents.length;j++){
for(int k = 0;k<contents[j].length;k++){
SMonsterConfig monster = integerSMonsterConfigMap.get(contents[j][k]);
int monsterForce = (int)(monster.getAttack()*3+monster.getHp()*0.21+monster.getPhysicalDefence()*0.5+monster.getMagicDefence()*0.5);
totalMonsterForce+=monsterForce;
}
}
if(totalMonsterForce>maxForce){
maxForce = totalMonsterForce;
}
}
return (int)(maxForce*(0.8+groupIds.length*0.2));
}
public static String getMonsterSkillById(int monsterId){
CommonProto.FightUnitInfo monster = SMonsterConfig.getMonsterMap().get(monsterId);
return monster.getUnitSkillIds();

View File

@ -7,6 +7,7 @@ public enum UUIDEnum {
ARENARECORD(3),
ADVENTUREBOSS(4),
GUILDLOG(5),
ESPECIAL_EQUIP(6)
;
private int value;