# Conflicts:
#	serverlogic/src/main/java/com/ljsd/jieling/logic/hero/HeroLogic.java
back_recharge
zhangshanxue 2019-09-06 11:01:43 +08:00
commit 9406f2c28f
28 changed files with 433 additions and 109 deletions

View File

@ -75,6 +75,9 @@ public class SBloodyBattleSetting implements BaseConfig {
private int[][] mineralId;
private int baseScore;
private int extraDiscount;
private Map<Integer,int[]> debuffMap;
private Map<Integer,int[]> monsterIndexMap;

View File

@ -18,7 +18,7 @@ public class SBloodyRankConfig implements BaseConfig {
private int[][] reward;
private static Map<Integer, SBloodyRankConfig> sBloodyRankConfigMap;
public static Map<Integer, SBloodyRankConfig> sBloodyRankConfigMap;
@Override

View File

@ -3,6 +3,7 @@ package com.ljsd.jieling.config;
import com.ljsd.jieling.logic.STableManager;
import com.ljsd.jieling.logic.Table;
import java.util.HashMap;
import java.util.Map;
@Table(name ="EndlessMapConfig")
@ -22,11 +23,24 @@ public class SEndlessMapConfig implements BaseConfig {
private int[][] endlessPoint;
private int[][] initializeCount;
public static Map<Integer,SEndlessMapConfig> sEndlessMapConfigMap;
public static Map<Integer,Map<Integer,Integer>> initRandomPointMap;
@Override
public void init() throws Exception {
sEndlessMapConfigMap = STableManager.getConfig(SEndlessMapConfig.class);
initRandomPointMap = new HashMap<>();
for(Map.Entry<Integer,SEndlessMapConfig> entry:sEndlessMapConfigMap.entrySet()){
Map<Integer,Integer> pointMap = new HashMap<>();
int[][] initializeCount = entry.getValue().getInitializeCount();
for(int i = 0;i<initializeCount.length;i++){
pointMap.put(initializeCount[i][0],initializeCount[i][1]);
}
initRandomPointMap.put(entry.getKey(),pointMap);
}
}
@ -57,4 +71,8 @@ public class SEndlessMapConfig implements BaseConfig {
public int[] getMapItem() {
return mapItem;
}
public int[][] getInitializeCount() {
return initializeCount;
}
}

View File

@ -36,7 +36,7 @@ public enum FunctionIdEnum {
Store(20),
Endless(46),
Blood(47),
ToBeStronger(48),
WorkShopTech(101),
WorkShopCreateEquip(102),

View File

@ -87,7 +87,8 @@ public class HandlerLogicThread extends Thread{
whiteMsg.add(MessageTypeProto.MessageType.FAMILY_GET_APPLY_REQUEST_VALUE);
whiteMsg.add(MessageTypeProto.MessageType.ADVENTURE_BOSSHURT_REQEUST_VALUE);
whiteMsg.add(MessageTypeProto.MessageType.USER_FORCE_CHANGE_REQUEST_VALUE);
whiteMsg.add(MessageTypeProto.MessageType.ENDLESS_SET_SKIPFIGHT_REQUEST_VALUE);
}

View File

@ -154,6 +154,8 @@ public class RedisKey {
public static final String SESSION_OFFLINE = "SESSION_OFFLINE";
public static final String PLAYER_INFO_CACHE = "PLAYER_INFO_CACHE";
//问卷调查
public static final String QUESTION_FROMBACK = "QUESTION_FROMBACK";
public static final String BLOODY_RANK = "BLOODY_RANK";

View File

@ -964,7 +964,10 @@ public class RedisUtil {
public String getKey(String type,String key){
if(RedisKey.BLOODY_RANK.equals(key)){
if(RedisKey.BLOODY_RANK.equals(type)){
return type + RedisKey.Delimiter_colon + key;
}
if(RedisKey.PLAYER_INFO_CACHE.equals(type)){
return type + RedisKey.Delimiter_colon + key;
}
return GameApplication.serverId + RedisKey.Delimiter_colon + type + RedisKey.Delimiter_colon + key;

View File

@ -20,4 +20,5 @@ public interface GlobalGm {
int MONSTER_JUMP = 16;//跳到兽潮层
int OUT_BLOODY_BATTLE = 17;//退出血战
int MISSION_LEAD = 18;//任务指引
int ESPECIAL_EQUIP = 19;//增加法宝,星级
}

View File

@ -0,0 +1,20 @@
package com.ljsd.jieling.handler;
import com.ljsd.jieling.logic.blood.BloodLogic;
import com.ljsd.jieling.netty.cocdex.PacketNetData;
import com.ljsd.jieling.network.session.ISession;
import com.ljsd.jieling.protocols.MessageTypeProto;
import org.springframework.stereotype.Component;
@Component
public class BloodRankHandler extends BaseHandler{
@Override
public MessageTypeProto.MessageType getMessageCode() {
return MessageTypeProto.MessageType.BLOOD_RANK_REQUEST;
}
@Override
public void process(ISession iSession, PacketNetData netData) throws Exception {
BloodLogic.getInstance().getBloodRank(iSession, MessageTypeProto.MessageType.BLOOD_RANK_RESPONSE);
}
}

View File

@ -163,7 +163,7 @@ public class GMRequestHandler extends BaseHandler{
int itemId = sItem.getId();
int itemType = sItem.getItemType();
int itemNum = 9999;
if(itemType == GlobalItemType.CARD ||itemType == GlobalItemType.EQUIP){
if(itemType == GlobalItemType.CARD ||itemType == GlobalItemType.EQUIP ||itemType == GlobalItemType.ESPECIAL_EQUIP){
itemNum =1;
}
gmDrop[i++] = new int[]{itemId,itemNum};
@ -233,8 +233,15 @@ public class GMRequestHandler extends BaseHandler{
}
break;
case GlobalGm.MISSION_LEAD:
case GlobalGm.MISSION_LEAD:
break;
case GlobalGm.ESPECIAL_EQUIP:
int itemType = SItem.getsItemMap().get(prarm1).getItemType();
if(itemType==GlobalItemType.ESPECIAL_EQUIP){
EspecialEquip especialEquip = new EspecialEquip(cUser.getId(),prarm1);
especialEquip.setStar(prarm2);
cUser.getEquipManager().addEspecialEquip(cUser,especialEquip);
}
break;
default:

View File

@ -129,6 +129,7 @@ public class GetPlayerInfoHandler extends BaseHandler{
CommonProto.EndlessInfo.Builder endless = CommonProto.EndlessInfo.newBuilder();
endless.setMapId(MapLogic.getEndlessMapId());
endless.setWorldLevel(MongoUtil.getInstence().getMyMongoTemplate().findById(1, ServerConfig.class).getWorldLevel());
endless.setBloodScore(RedisUtil.getInstence().getZSetScore(RedisKey.BLOODY_RANK,Integer.toString(1), Integer.toString(userId)).intValue());
PlayerInfoProto.GetPlayerInfoResponse getPlayerInfoResponse
= PlayerInfoProto.GetPlayerInfoResponse.newBuilder()
.setPlayer(player)

View File

@ -1,27 +1,27 @@
package com.ljsd.jieling.handler.map;
public class EndlessHero {
private int maxHp;
private double maxHp;
private int curHp;
private double curHp;
public int getMaxHp() {
public double getMaxHp() {
return maxHp;
}
public int getCurHp() {
public double getCurHp() {
return curHp;
}
public void setMaxHp(int maxHp) {
public void setMaxHp(double maxHp) {
this.maxHp = maxHp;
}
public void setCurHp(int curHp) {
public void setCurHp(double curHp) {
this.curHp = curHp;
}
public EndlessHero(int maxHp, int curHp) {
public EndlessHero(double maxHp, double curHp) {
this.maxHp = maxHp;
this.curHp = curHp;
}

View File

@ -10,7 +10,7 @@ public class EndlessMapInfo {
private int curCell;
private Map<String,EndlessHero> endlessHeroInfo;
private Map<String,Integer> endlessHeroInfo;
private Map<Integer,Map<Integer,String>> mapSign;
@ -26,6 +26,8 @@ public class EndlessMapInfo {
private Map<Integer, Cell> mapInfo = new HashMap<>();
private int skipFight;
private int season;
@ -46,11 +48,11 @@ public class EndlessMapInfo {
this.curMapId = curMapId;
}
public Map<String, EndlessHero> getEndlessHeroInfo() {
public Map<String, Integer> getEndlessHeroInfo() {
return endlessHeroInfo;
}
public void setEndlessHeroInfo(Map<String, EndlessHero> endlessHeroInfo) {
public void setEndlessHeroInfo(Map<String, Integer> endlessHeroInfo) {
this.endlessHeroInfo = endlessHeroInfo;
}
@ -126,4 +128,12 @@ public class EndlessMapInfo {
public void setSeason(int season) {
this.season = season;
}
public int getSkipFight() {
return skipFight;
}
public void setSkipFight(int skipFight) {
this.skipFight = skipFight;
}
}

View File

@ -209,7 +209,7 @@ public class MapLogic {
List<TeamPosHeroInfo> teamPosForHero = user.getTeamPosManager().getTeamPosForHero().get(teamId);
for (int i = 0; i <teamPosForHero.size() ; i++) {
String endlessHeroId = teamPosForHero.get(i).getHeroId();
int maxHp = HeroLogic.getInstance().calHeroNotBufferAttribute(user,user.getHeroManager().getHero(endlessHeroId),true,teamId).get(1);
int maxHp = HeroLogic.getInstance().calHeroNotBufferAttribute(user,user.getHeroManager().getHero(endlessHeroId),false,teamId).get(1);
mapManager.addEndlessHero(teamPosForHero.get(i).getHeroId(),maxHp);
}
EndlessMapInfo endlessMapInfo = mapManager.getEndlessMapInfo();
@ -249,6 +249,7 @@ public class MapLogic {
mapEnterResponse.addRefreshInfo(info);
}
}
mapEnterResponse.setSkipFight(endlessMapInfo.getSkipFight());
}
List<CommonProto.Cell> cells = new ArrayList<>(mapManager.getMapInfo().size());
for (Map.Entry<Integer, Cell> entry : mapManager.getMapInfo().entrySet()) {
@ -338,17 +339,20 @@ public class MapLogic {
}
Map<Integer, Integer> heroAllAttribute = HeroLogic.getInstance().calHeroNotBufferAttribute(user, hero,false,teamId);
if(teamId==401){
Map<String, EndlessHero> endlessHeroInfo = user.getMapManager().getEndlessMapInfo().getEndlessHeroInfo();
Map<String, Integer> endlessHeroInfo = user.getMapManager().getEndlessMapInfo().getEndlessHeroInfo();
if(endlessHeroInfo!=null&&endlessHeroInfo.size()>0){
if(initType!=2){
if(endlessHeroInfo.get(hero.getId())!=null){
heroAllAttribute.put(HeroAttributeEnum.CurHP.getPropertyId(), endlessHeroInfo.get(hero.getId()).getCurHp());
Integer heroPercent = endlessHeroInfo.get(heroInfo.getHeroId());
if(heroPercent!=null){
int curHp = (int)((double)heroPercent/10000 * heroAllAttribute.get(HeroAttributeEnum.Hp.getPropertyId()));
heroAllAttribute.put(HeroAttributeEnum.CurHP.getPropertyId(),curHp);
}
}else{
mapManager.updateEndlessHeroHp(hero.getId(),endlessHeroInfo.get(hero.getId()).getMaxHp());
mapManager.updateEndlessHeroHp(hero.getId(),10000);
}
}
}
heroAllAttributeMap.put(hero.getId(), heroAllAttribute);
heroes.add(heroInfo.getHeroId());
}
@ -384,6 +388,9 @@ public class MapLogic {
mapManager.checkSuddenlyBoss();
int suddenlyBoss = mapManager.getSuddenlyBoss();
boolean canFindsuddenlyBoss = System.currentTimeMillis()> (mapManager.getSuddenlyBossStartTime() + SGameSetting.getGameSetting().getIncidentalBossCd())*1000;
Map<Integer, Map<Integer, Integer>> initRandomPointMap = SEndlessMapConfig.initRandomPointMap;
Map<Integer,List<Integer>> endlessRandomPoint = new HashMap<>();
for (Map.Entry<Integer, SCMap> entry : scMap.entrySet()) {
SCMap scMap1 = entry.getValue();
// 必出现的事件点
@ -398,6 +405,7 @@ public class MapLogic {
}
continue;
}
// 随机出现的事件点
int randomIndex = random.nextInt(scMap1.getGroups().length);
int x = scMap1.getGroups()[randomIndex][0];
@ -421,8 +429,35 @@ public class MapLogic {
continue;
}
Cell cellValue = new Cell(xy, mapPointConfig.getInitialEventId(), mapPointConfig.getId());
//如果是无尽本
if(initRandomPointMap.get(mapManager.getCurMapId())!=null){
if(initRandomPointMap.get(mapManager.getCurMapId()).get(mapPointConfig.getId())!=null){
if(endlessRandomPoint.get( mapPointConfig.getId())!=null){
endlessRandomPoint.get(mapPointConfig.getId()).add(xy);
}else{
List<Integer> points = new ArrayList<>();
points.add(xy);
endlessRandomPoint.put(mapPointConfig.getId(),points);
}
}
}else{
newMap.put(xy, cellValue);
}
}
//无尽本随机点处理
if(endlessRandomPoint.size()>0){
for(Map.Entry<Integer,List<Integer>> entry:endlessRandomPoint.entrySet()){
int count = initRandomPointMap.get(mapManager.getCurMapId()).get(entry.getKey());
List<Integer> points = entry.getValue();
Collections.shuffle(points);
for(int i = 0 ; i <count;i++){
MapPointConfig mapPointConfig = MapPointConfig.scMapEventMap.get(entry.getKey());
Cell cellValue = new Cell(points.get(i), mapPointConfig.getInitialEventId(),entry.getKey());
LOGGER.info("无尽生成{}的随机点为{},{}",entry.getKey(),CellUtil.pos2XY(points.get(i))[0],CellUtil.pos2XY(points.get(i))[1]);
newMap.put(points.get(i), cellValue);
}
newMap.put(xy, cellValue);
}
}
if (user.getPlayerInfoManager().getMapId() == 100) {
SGameSetting sGameSetting = SGameSetting.getGameSetting();
@ -435,8 +470,8 @@ public class MapLogic {
mission.setMissionId(challengeMapConfig.getMissionId());
mission.setMissionStep(0);
mission.setTime(0);
int xy = CellUtil.xy2Pos(challengeMapConfig.getPosition()[0], challengeMapConfig.getPosition()[1]);
SChallengeConfig sChallengeConfig = SChallengeConfig.sChallengeConfigs.get(mapManager.getCurMapId());
int xy = CellUtil.xy2Pos(challengeMapConfig.getPosition()[0], challengeMapConfig.getPosition()[1]);
int type = sChallengeConfig.getType();
if(type==4){
if(mapManager.getEndlessMapInfo().getCurCell()!=0){
@ -1256,10 +1291,16 @@ public class MapLogic {
}
if(SChallengeConfig.sChallengeConfigs.get(mapManager.getCurMapId()).getType()==4&&teamId==401){
for (int i = 0 ; i <team.size();i++) {
mapManager.updateEndlessHeroHp(team.get(i).getHeroId(),checkResult[i+2]);
Hero hero = user.getHeroManager().getHero(team.get(i).getHeroId());
Map<Integer, Integer> heroAllAttribute = HeroLogic.getInstance().calHeroNotBufferAttribute(user, hero,false,teamId);
int per = (int)(checkResult[i+2] / (double) heroAllAttribute.get(HeroAttributeEnum.Hp.getPropertyId())*10000);
mapManager.updateEndlessHeroHp(team.get(i).getHeroId(),per);
mapManager.updateHeroOneAttribute(team.get(i).getHeroId(), HeroAttributeEnum.CurHP.getPropertyId(), checkResult[i+2]);
}
}
if(SChallengeConfig.sChallengeConfigs.get(mapManager.getCurMapId()).getType()==4) {
endlessRefreshMonster(session,destoryXY);
}
BehaviorUtil.destoryApointXY(user, destoryXY);
SMonsterGroup sMonsterGroup = SMonsterGroup.getsMonsterGroupMap().get(groupId);
@ -1494,7 +1535,10 @@ public class MapLogic {
if(SChallengeConfig.sChallengeConfigs.get(mapManager.getCurMapId()).getType()==4&&teamId==401){
mapManager.updateEndlessFightCount(mapManager.getEndlessMapInfo().getFightCount()+1);
for (int i = 0 ; i <team.size();i++) {
mapManager.updateEndlessHeroHp(team.get(i).getHeroId(),checkResult[i+2]);
Hero hero = user.getHeroManager().getHero(team.get(i).getHeroId());
Map<Integer, Integer> heroAllAttribute = HeroLogic.getInstance().calHeroNotBufferAttribute(user, hero,false,teamId);
int per =(int) (checkResult[i+2] / (double) heroAllAttribute.get(HeroAttributeEnum.Hp.getPropertyId())*10000);
mapManager.updateEndlessHeroHp(team.get(i).getHeroId(),per);
mapManager.updateHeroOneAttribute(team.get(i).getHeroId(), HeroAttributeEnum.CurHP.getPropertyId(), checkResult[i+2]);
}
}
@ -1506,13 +1550,7 @@ public class MapLogic {
fightEndResponse.build();
if(SChallengeConfig.sChallengeConfigs.get(mapManager.getCurMapId()).getType()==4){
Cell cell = mapManager.getMapInfo().get(triggerXY);
MapPointConfig mapPointConfig = MapPointConfig.getScMapEventMap().get(cell.getPointId());
Map<Integer, SCMap> map= SCMap.sCMap.get(mapManager.getCurMapId());
if(mapPointConfig.getStyle()==1){
BehaviorUtil.destoryApointXY(user, triggerXY);
}
endlessRefreshMonster(session,triggerXY);
}
if (sOptionConfig != null) {
int behaviorType = sOptionConfig.getBehaviorType();
@ -3042,7 +3080,7 @@ public class MapLogic {
mapManager.setEndlessMapInfo(new EndlessMapInfo());
endlessMapInfo = mapManager.getEndlessMapInfo();
}
Map<String, EndlessHero> endlessHeroInfo = endlessMapInfo.getEndlessHeroInfo();
Map<String, Integer> endlessHeroInfo = endlessMapInfo.getEndlessHeroInfo();
MapInfoProto.GetEndlessHeroResponse.Builder response = MapInfoProto.GetEndlessHeroResponse.newBuilder();
//已开启地图处理
Map<Integer, SEndlessMapConfig> sEndlessMapConfigMap = SEndlessMapConfig.sEndlessMapConfigMap;
@ -3061,51 +3099,36 @@ public class MapLogic {
if(heroEntry.getValue().getLevel()<20){
continue;
}
int calHp = HeroLogic.getInstance().calHeroNotBufferAttribute(user, heroEntry.getValue(), true,401).get(1);
if(!endlessHeroInfo.containsKey(heroEntry.getKey())){
mapManager.addEndlessHero(heroEntry.getKey(),calHp);
if(endlessHeroInfo.get(heroEntry.getKey())==null){
mapManager.addEndlessHero(heroEntry.getKey(),10000);
}
for (Map.Entry<String,EndlessHero> entry :endlessHeroInfo.entrySet()) {
if (!entry.getKey().equals(heroEntry.getKey())) {
continue;
}
if(calHp!=entry.getValue().getMaxHp()){
int tempHp = (int)(entry.getValue().getCurHp()/entry.getValue().getMaxHp()*1.0F*calHp);
endlessHeroInfo.put(entry.getKey(),new EndlessHero(calHp,tempHp));
calHp = tempHp;
}else{
calHp = entry.getValue().getCurHp();
}
break;
}
LOGGER.info("英雄ID{},血量{}",heroEntry.getKey(),calHp);
CommonProto.endlessHero endlessHero = CommonProto.endlessHero.newBuilder().setHeroId(heroEntry.getKey()).setHp(calHp).build();
LOGGER.info("英雄ID{},血量{}",heroEntry.getKey(),endlessHeroInfo.get(heroEntry.getKey()).intValue());
CommonProto.endlessHero endlessHero = CommonProto.endlessHero.newBuilder().setHeroId(heroEntry.getKey()).setHp(endlessHeroInfo.get(heroEntry.getKey()).intValue()).build();
response.addHeroInfo(endlessHero);
}
endlessMapInfo.setEndlessHeroInfo(endlessHeroInfo);
mapManager.setEndlessMapInfo(endlessMapInfo);
List<TeamPosHeroInfo> team = user.getTeamPosManager().getTeamPosForHero().get(401);
if(team!=null&&team.size()>0){
Iterator<TeamPosHeroInfo> iterator = team.iterator();
while(iterator.hasNext()){
TeamPosHeroInfo teamInfo = iterator.next();
EndlessHero endlessHero = endlessMapInfo.getEndlessHeroInfo().get(teamInfo.getHeroId());
if(endlessHero==null){
continue;
}
if(endlessHero.getCurHp()==0){
Map<String, Map<Integer, Integer>> heroAllAttributeMap = mapManager.getHeroAllAttributeMap();
if(heroAllAttributeMap.containsKey(teamInfo.getHeroId())){
heroAllAttributeMap.remove(teamInfo.getHeroId());
}
mapManager.setHeroAllAttributeMap(heroAllAttributeMap);
iterator.remove();
}
}
user.getTeamPosManager().updateTeamPosByTeamId(401,team);
}
// List<TeamPosHeroInfo> team = user.getTeamPosManager().getTeamPosForHero().get(401);
// if(team!=null&&team.size()>0){
// Iterator<TeamPosHeroInfo> iterator = team.iterator();
// while(iterator.hasNext()){
// TeamPosHeroInfo teamInfo = iterator.next();
// EndlessHero endlessHero = endlessMapInfo.getEndlessHeroInfo().get(teamInfo.getHeroId());
// if(endlessHero==null){
// continue;
// }
// if(endlessHero.getCurHp()==0){
// Map<String, Map<Integer, Integer>> heroAllAttributeMap = mapManager.getHeroAllAttributeMap();
// if(heroAllAttributeMap.containsKey(teamInfo.getHeroId())){
// heroAllAttributeMap.remove(teamInfo.getHeroId());
// }
// mapManager.setHeroAllAttributeMap(heroAllAttributeMap);
// iterator.remove();
// }
// }
//
// user.getTeamPosManager().updateTeamPosByTeamId(401,team);
// }
MessageUtil.sendMessage(session,1,messageType.getNumber(),response.build(),true);
}
@ -3120,8 +3143,8 @@ public class MapLogic {
EndlessMapInfo endlessMapInfo = mapManager.getEndlessMapInfo();
// SChallengeMapConfig sChallengeMapConfig = SChallengeMapConfig.integerSChallengeMapConfigMap.get(endlessMapInfo.getCurMapId());
// mapManager.updateEndlessLocation(CellUtil.xy2Pos(sChallengeMapConfig.getPosition()[0],sChallengeMapConfig.getPosition()[1]));
for(Map.Entry<String,EndlessHero> entry:endlessMapInfo.getEndlessHeroInfo().entrySet()){
mapManager.updateEndlessHeroHp(entry.getKey(),entry.getValue().getMaxHp());
for(Map.Entry<String,Integer> entry:endlessMapInfo.getEndlessHeroInfo().entrySet()){
mapManager.updateEndlessHeroHp(entry.getKey(),10000);
}
for (Map.Entry<String, Map<Integer, Integer>> entry:mapManager.getHeroAllAttributeMap().entrySet()){
mapManager.updateHeroOneAttribute(entry.getKey(),HeroAttributeEnum.CurHP.getPropertyId(),entry.getValue().get(HeroAttributeEnum.Hp.getPropertyId()));
@ -3316,4 +3339,62 @@ public class MapLogic {
}
updateEndlessSeason(0);
}
/**
*
* @param session
* @param triggerXY
* @throws Exception
*/
private void endlessRefreshMonster(ISession session,int triggerXY) throws Exception {
User user = UserManager.getUser(session.getUid());
MapManager mapManager = user.getMapManager();
Cell cell = mapManager.getMapInfo().get(triggerXY);
MapPointConfig mapPointConfig = MapPointConfig.getScMapEventMap().get(cell.getPointId());
if(mapPointConfig.getStyle()==1){
Map<Integer, SCMap> map= SCMap.sCMap.get(mapManager.getCurMapId());
List<Integer> points = new ArrayList<>();
for(Map.Entry<Integer, SCMap> entry:map.entrySet()){
if(entry.getValue().getEvent()!=cell.getPointId()){
continue;
}
boolean flagToAddMonster = true;
int[][] groups = entry.getValue().getGroups();
for(int i = 0;i<groups.length;i++){
if(mapManager.getMapInfo().get(CellUtil.xy2Pos(groups[i][0],groups[i][1]))==null){
continue;
}
if(mapManager.getMapInfo().get(CellUtil.xy2Pos(groups[i][0],groups[i][1])).getPointId()!=0){
flagToAddMonster = false;
}
}
if(flagToAddMonster){
for(int i = 0;i<groups.length;i++){
points.add(CellUtil.xy2Pos(groups[i][0], groups[i][1]));
}
}
}
if (points.size()>0){
//无尽副本随机空地刷新小怪
int cellPos = points.get(MathUtils.randomInt(points.size()));
Cell addCell = new Cell(cellPos,mapPointConfig.getInitialEventId(),mapPointConfig.getId());
LOGGER.info("刷新位置为{}{}",CellUtil.pos2XY(cellPos)[0],CellUtil.pos2XY(cellPos)[1]);
mapManager.addOrUpdateCell(cellPos,addCell);
MapInfoProto.RefreshMonsterResponse monsterResponse = MapInfoProto.RefreshMonsterResponse.newBuilder().addCell(CBean2Proto.getCell(addCell)).build();
MessageUtil.sendIndicationMessage(session,1, MessageTypeProto.MessageType.ENDLESS_MONSTER_REFRESH_INDICATION_VALUE,monsterResponse,true);
}
BehaviorUtil.destoryApointXY(user, triggerXY);
}
}
/**
*
* @param session
* @param type
* @param messageType
*/
public void setEndlessSkipType(ISession session, int type, MessageTypeProto.MessageType messageType) throws Exception {
UserManager.getUser(session.getUid()).getMapManager().updateEndlessSkipFight(type);
MessageUtil.sendMessage(session,1,messageType.getNumber(),null,true);
}
}

View File

@ -695,24 +695,19 @@ public class MapManager extends MongoBase {
updateString("endlessMapInfo",endlessMapInfo);
this.endlessMapInfo = endlessMapInfo;
}
public void addEndlessHero(String heroId,int maxHp){
public void addEndlessHero(String heroId,int percent){
if(endlessMapInfo==null){
setEndlessMapInfo(new EndlessMapInfo());
}
if(endlessMapInfo.getEndlessHeroInfo().containsKey(heroId)){
return;
}
EndlessHero endlessHero = new EndlessHero(maxHp, maxHp);
updateString("endlessMapInfo."+heroId,endlessHero);
endlessMapInfo.getEndlessHeroInfo().put(heroId,endlessHero);
updateString("endlessMapInfo."+heroId,percent);
endlessMapInfo.getEndlessHeroInfo().put(heroId,percent);
}
public void updateEndlessHeroHp(String heroId,int hp){
updateString("endlessMapInfo.endlessHeroInfo."+heroId+".curHp",hp);
EndlessHero endlessHero = endlessMapInfo.getEndlessHeroInfo().get(heroId);
if(endlessHero!=null){
endlessHero.setCurHp(hp);
endlessMapInfo.getEndlessHeroInfo().put(heroId,endlessHero);
}
updateString("endlessMapInfo."+heroId,hp);
endlessMapInfo.getEndlessHeroInfo().put(heroId,hp);
}
public void updateEndlessLocation(int cellId){
endlessMapInfo.setCurCell(cellId);
@ -785,6 +780,10 @@ public class MapManager extends MongoBase {
endlessMapInfo.setSeason(season);
updateString("endlessMapInfo.season",season);
}
public void updateEndlessSkipFight(int type){
endlessMapInfo.setSkipFight(type);
updateString("endlessMapInfo.skipFight",type);
}
}

View File

@ -433,8 +433,8 @@ public class BehaviorUtil {
return monsterTeamList;
}
public static void refreshTimeMonster(User user,int[][] behaviorTypeValues){
user.getMapManager().updateEndlessCellTime(user.getMapManager().getCurXY(), (int)(TimeUtils.now()/1000)+behaviorTypeValues[0][1]);
public static void refreshTimeMonster(User user,int value){
user.getMapManager().updateEndlessCellTime(user.getMapManager().getCurXY(), (int)(TimeUtils.now()/1000)+value);
Map<Integer, Integer> cellRefreshTime = user.getMapManager().getEndlessMapInfo().getCellRefreshTime();
MapInfoProto.EndlessTimeIndication.Builder indication = MapInfoProto.EndlessTimeIndication.newBuilder();
for(Map.Entry<Integer, Integer> entry:cellRefreshTime.entrySet()){

View File

@ -34,7 +34,7 @@ public class FourtyEightBehavior extends BaseBehavior{
@Override
public boolean afterFight(User user, int[][] behaviorTypeValues, FightInfoProto.FightEndResponse.Builder fightEndResponse){
BehaviorUtil.refreshTimeMonster(user,behaviorTypeValues);
BehaviorUtil.refreshTimeMonster(user,behaviorTypeValues[0][1]);
return true;
}
}

View File

@ -21,7 +21,7 @@ public class FourtyNineBehavior extends BaseBehavior {
@Override
public boolean process(int optionId, User user, int[][] behaviorTypeValues, MapInfoProto.EventUpdateResponse.Builder eventUpdateResponse) throws Exception {
BehaviorUtil.refreshTimeMonster(user,behaviorTypeValues);
BehaviorUtil.refreshTimeMonster(user,behaviorTypeValues[0][0]);
return true;
}
}

View File

@ -0,0 +1,22 @@
package com.ljsd.jieling.handler.map.mapHandler;
import com.ljsd.jieling.handler.BaseHandler;
import com.ljsd.jieling.handler.map.MapLogic;
import com.ljsd.jieling.netty.cocdex.PacketNetData;
import com.ljsd.jieling.network.session.ISession;
import com.ljsd.jieling.protocols.MapInfoProto;
import com.ljsd.jieling.protocols.MessageTypeProto;
import org.springframework.stereotype.Component;
@Component
public class EndlessSetSkipFightHandler extends BaseHandler<MapInfoProto.EndlessSetSkipRequest> {
@Override
public MessageTypeProto.MessageType getMessageCode() {
return MessageTypeProto.MessageType.ENDLESS_SET_SKIPFIGHT_REQUEST;
}
@Override
public void processWithProto(ISession iSession, MapInfoProto.EndlessSetSkipRequest proto) throws Exception {
MapLogic.getInstance().setEndlessSkipType(iSession,proto.getType(), MessageTypeProto.MessageType.ENDLESS_SET_SKIPFIGHT_RESPONSE);
}
}

View File

@ -17,6 +17,7 @@ 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.blood.BloodLogic;
import com.ljsd.jieling.logic.dao.*;
import com.ljsd.jieling.logic.dao.root.GlobalSystemControl;
import com.ljsd.jieling.logic.dao.root.User;
@ -170,6 +171,7 @@ public class GlobalDataManaager {
MapLogic.getInstance().updateEndlessSeason(timeControllerOfFunction.getTimes());
serverConfigTmp.setWorldLevel(calWorldLevel());
MapLogic.getInstance().setEndlessMapId(getEndleeMapIdByLevel());
break;
default:
break;
}
@ -188,6 +190,10 @@ public class GlobalDataManaager {
break;
case Endless:
MapLogic.getInstance().resetEndlessInfo();
BloodLogic.getInstance().bloodSeasonReward();
break;
case Blood:
default:
break;
}

View File

@ -1,6 +1,9 @@
package com.ljsd.jieling.logic.blood;
import com.ljsd.GameApplication;
import com.ljsd.jieling.config.SBloodyRankConfig;
import com.ljsd.jieling.db.redis.RedisKey;
import com.ljsd.jieling.db.redis.RedisUtil;
import com.ljsd.jieling.logic.dao.*;
import com.ljsd.jieling.logic.dao.root.User;
import com.ljsd.jieling.logic.family.GuildLogic;
@ -8,9 +11,17 @@ import com.ljsd.jieling.logic.fight.CombatLogic;
import com.ljsd.jieling.logic.hero.HeroAttributeEnum;
import com.ljsd.jieling.logic.hero.HeroLogic;
import com.ljsd.jieling.logic.item.ItemLogic;
import com.ljsd.jieling.logic.mail.MailLogic;
import com.ljsd.jieling.network.session.ISession;
import com.ljsd.jieling.protocols.CommonProto;
import com.ljsd.jieling.protocols.MessageTypeProto;
import com.ljsd.jieling.protocols.RoomProto;
import com.ljsd.jieling.util.MessageUtil;
import com.ljsd.jieling.util.StringUtil;
import com.ljsd.jieling.util.TimeUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.data.redis.core.ZSetOperations;
import java.util.*;
@ -99,4 +110,63 @@ public class BloodLogic {
return fightDefendTeamInfo;
}
/**
*
* @param session
* @param messageType
*/
public void getBloodRank(ISession session, MessageTypeProto.MessageType messageType){
Set<ZSetOperations.TypedTuple<String>> zsetreverseRangeWithScores = RedisUtil.getInstence().getZsetreverseRangeWithScores(RedisKey.BLOODY_RANK, "1", 0, 100);
Map<Integer, PlayerInfoCache> playerInfoCacheMap = RedisUtil.getInstence().getMapValues(RedisKey.PLAYER_INFO_CACHE, "", Integer.class, PlayerInfoCache.class);
int rank = 0;
RoomProto.BloodRankResponse.Builder response = RoomProto.BloodRankResponse.newBuilder();
for(ZSetOperations.TypedTuple<String> blood:zsetreverseRangeWithScores){
rank++;
PlayerInfoCache cache = playerInfoCacheMap.get(Integer.parseInt(blood.getValue()));
CommonProto.BloodPersonInfo info = CommonProto.BloodPersonInfo.newBuilder()
.setHead(cache.getHead())
.setId(Integer.parseInt(blood.getValue()))
.setHeadFrame(cache.getHeadFrame())
.setLevel(cache.getLevel())
.setServerId(cache.getServerId())
.setScore(blood.getScore().intValue())
.setRank(rank)
.setName(cache.getName())
.build();
response.addInfos(info);
}
int myRank= RedisUtil.getInstence().getZSetreverseRank(RedisKey.BLOODY_RANK,"1",Integer.toString(session.getUid())).intValue();
response.setMyRank(myRank);
MessageUtil.sendMessage(session,1,messageType.getNumber(),response.build(),true);
}
public void bloodSeasonReward() throws Exception {
Set<ZSetOperations.TypedTuple<String>> zsetreverseRangeWithScores = RedisUtil.getInstence().getZsetreverseRangeWithScores(RedisKey.BLOODY_RANK, "1", 0, RedisUtil.getInstence().getZsetSize(RedisKey.getKey(RedisKey.BLOODY_RANK, "1", true)));
Map<Integer, PlayerInfoCache> players = RedisUtil.getInstence().getMapValues(RedisKey.PLAYER_INFO_CACHE, "", Integer.class, PlayerInfoCache.class);
Map<Integer, SBloodyRankConfig> sBloodyRankConfigMap = SBloodyRankConfig.sBloodyRankConfigMap;
int floor = 0 ;
for(ZSetOperations.TypedTuple<String> rank:zsetreverseRangeWithScores){
//是否为本服玩家
if(players.get(Integer.parseInt(rank.getValue())).getServerId()!= GameApplication.serverId){
continue;
}
int[][] reward;
for(Map.Entry<Integer, SBloodyRankConfig> entry:sBloodyRankConfigMap.entrySet()){
SBloodyRankConfig value = entry.getValue();
if(rank.getScore()>value.getScore()){
floor = entry.getKey();
}else{
break;
}
}
if(floor==0){
continue;
}else{
reward = sBloodyRankConfigMap.get(floor).getReward();
MailLogic.getInstance().sendMail(Integer.parseInt(rank.getValue()),"血战排行奖励","恭喜",StringUtil.parseArrayToString(reward), (int)(TimeUtils.now()/1000),10);
}
}
}
}

View File

@ -0,0 +1,50 @@
package com.ljsd.jieling.logic.dao;
public class PlayerInfoCache {
private int serverId;
private String name;
private String head;
private int headFrame;
private int level;
public String getName() {
return name;
}
public String getHead() {
return head;
}
public int getHeadFrame() {
return headFrame;
}
public void setName(String name) {
this.name = name;
}
public void setHead(String head) {
this.head = head;
}
public void setHeadFrame(int headFrame) {
this.headFrame = headFrame;
}
public void setServerId(int serverId) {
this.serverId = serverId;
}
public int getServerId() {
return serverId;
}
public int getLevel() {
return level;
}
public void setLevel(int level) {
this.level = level;
}
}

View File

@ -84,6 +84,7 @@ public class UserManager {
playerManager.setMaxForce(force);
PlayerLogic.getInstance().vipflushEveryDay(user,null);
ActivityLogic.getInstance().newPlayerOpenActivityMission(user);
PlayerLogic.getInstance().playerInfoUpdate(user);
user.getUserMissionManager().onGameEvent(user, GameEvent.USER_LEVELUP,0,1);
user.getUserMissionManager().onGameEvent(user, GameEvent.DAILY_REFRESH,0);
user.getUserMissionManager().onGameEvent(user, GameEvent.BEGINNER);

View File

@ -9,6 +9,7 @@ import com.ljsd.jieling.core.VipPrivilegeType;
import com.ljsd.jieling.globals.BIReason;
import com.ljsd.jieling.globals.Global;
import com.ljsd.jieling.logic.STableManager;
import com.ljsd.jieling.handler.map.EndlessHero;
import com.ljsd.jieling.logic.activity.event.HeroUpStarEvent;
import com.ljsd.jieling.logic.activity.event.Poster;
import com.ljsd.jieling.logic.dao.*;
@ -414,24 +415,34 @@ public class HeroLogic {
return;
}
user.getTeamPosManager().changeTeamInfo(teamId,heroIds,pokemonoIds);
//401图内可以更改编队
if(teamId == 401){
List<TeamPosHeroInfo> teamPosHeroInfos = user.getTeamPosManager().getTeamPosForHero().get(teamId);
List<String> heroes = new ArrayList<>(teamPosHeroInfos.size());
Map<String, Map<Integer, Integer>> heroAllAttributeMap = new HashMap<>(teamPosHeroInfos.size());
for (TeamPosHeroInfo heroInfo : teamPosHeroInfos) {
Hero hero = user.getHeroManager().getHero(heroInfo.getHeroId());
if (hero == null) {
break;
if(teamPosHeroInfos!=null){
List<String> heroes = new ArrayList<>(teamPosHeroInfos.size());
Map<String, Map<Integer, Integer>> heroAllAttributeMap = new HashMap<>(teamPosHeroInfos.size());
for (TeamPosHeroInfo heroInfo : teamPosHeroInfos) {
Hero hero = user.getHeroManager().getHero(heroInfo.getHeroId());
if (hero == null) {
break;
}
if(heroAllAttributeMap.get(heroInfo)!=null){
continue;
}
Map<Integer, Integer> heroAllAttribute = HeroLogic.getInstance().calHeroNotBufferAttribute(user, hero,false,teamId);
Map<String, Integer> endlessHeroInfo = user.getMapManager().getEndlessMapInfo().getEndlessHeroInfo();
if(endlessHeroInfo!=null&& endlessHeroInfo.size()>0){
int curHp = (int)(endlessHeroInfo.get(heroInfo.getHeroId()) /10000.00 * heroAllAttribute.get(HeroAttributeEnum.Hp.getPropertyId()));
heroAllAttribute.put(HeroAttributeEnum.CurHP.getPropertyId(), curHp);
}
heroAllAttributeMap.put(hero.getId(), heroAllAttribute);
heroes.add(heroInfo.getHeroId());
}
user.getMapManager().setHeroAllAttributeMap(heroAllAttributeMap);
}else{
user.getTeamPosManager().changeTeamInfo(teamId,heroIds,pokemonoIds);
}
Map<Integer, Integer> heroAllAttribute = HeroLogic.getInstance().calHeroNotBufferAttribute(user, hero,true,teamId);
if(user.getMapManager().getEndlessMapInfo().getEndlessHeroInfo()!=null&&user.getMapManager().getEndlessMapInfo().getEndlessHeroInfo().size()>0){
heroAllAttribute.put(HeroAttributeEnum.CurHP.getPropertyId(),user.getMapManager().getEndlessMapInfo().getEndlessHeroInfo().get(hero.getId()).getCurHp());
}
heroAllAttributeMap.put(hero.getId(), heroAllAttribute);
heroes.add(heroInfo.getHeroId());
}
user.getMapManager().setHeroAllAttributeMap(heroAllAttributeMap);
}
user.getUserMissionManager().onGameEvent(user,GameEvent.HERO_IN_TEAM,heroIds.size());
MessageUtil.sendMessage(iSession,1,MessageTypeProto.MessageType.TEAM_POS_SAVE_RESPONSE_VALUE,null,true);
}

View File

@ -485,6 +485,7 @@ public class ItemLogic {
user.getEquipManager().removeEspecialEquip(iterator.next());
}
}
user.getEquipManager().upStarEspecialEquip(equipId);
MessageUtil.sendMessage(session,1,MessageTypeProto.MessageType.UP_HERO_STAR_RESPONSE_VALUE,null,true);
}else{
MessageUtil.sendErrorResponse(session,0,MessageTypeProto.MessageType.UP_HERO_STAR_RESPONSE_VALUE,"材料不足");

View File

@ -54,8 +54,9 @@ public class WorkShopLogic {
return;
}
int limits = sWorkShopTechnology.getLimits();
int workShopLevel = workShopController.getWorkShopLevel();
if(workShopLevel<limits){
// int workShopLevel = workShopController.getWorkShopLevel();
int playerLevel = user.getPlayerInfoManager().getLevel();
if(playerLevel<limits){
MessageUtil.sendErrorResponse(iSession,0,msgId,"level not");
return;
}

View File

@ -1,5 +1,6 @@
package com.ljsd.jieling.logic.player;
import com.ljsd.GameApplication;
import com.ljsd.jieling.config.*;
import com.ljsd.jieling.core.VipPrivilegeType;
import com.ljsd.jieling.dataReport.reportBeans_37.ChatContentType;
@ -149,7 +150,7 @@ public class PlayerLogic {
return;
}
}
playerInfoUpdate(user);
MessageUtil.sendMessage(iSession,1,msgId,null,true);
}
@ -355,6 +356,7 @@ public class PlayerLogic {
return;
}
user.getPlayerInfoManager().setHeadFrame(frameId);
playerInfoUpdate(user);
MessageUtil.sendMessage(session,1,messageType.getNumber(),null,true);
}
@ -509,4 +511,18 @@ public class PlayerLogic {
}
}
/**
* redis
*/
public void playerInfoUpdate(User user){
PlayerManager playerInfoManager = user.getPlayerInfoManager();
PlayerInfoCache cache = new PlayerInfoCache();
cache.setHead(playerInfoManager.getHead());
cache.setHeadFrame(playerInfoManager.getHeadFrame());
cache.setName(playerInfoManager.getNickName());
cache.setLevel(playerInfoManager.getLevel());
cache.setServerId(GameApplication.serverId);
RedisUtil.getInstence().putMapEntry(RedisKey.PLAYER_INFO_CACHE,"",String.valueOf(user.getId()),cache);
}
}

View File

@ -71,12 +71,12 @@ public class BuyGoodsLogic {
if(isDiscount!=0){
price=(int)(sRechargeCommodityConfig.getPrice() * (10 + isDiscount)/10f);
}
if(!openId.equals("gm-test")&&price*100!=amount){
/* if(!openId.equals("gm-test")&&price*100!=amount){
resultRes.setResultCode(0);
resultRes.setResultMsg("amount is wrong");
LOGGER.info("the uid={},should pay={},amount={}",uid,price*100,amount);
return resultRes;
}
}*/
buyCount=buyCount+1;
int limit = sRechargeCommodityConfig.getLimit();
int type = sRechargeCommodityConfig.getType();